@nextclaw/ui 0.25.1 → 0.25.2

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 (66) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/.vite/manifest.json +190 -190
  3. package/dist/assets/{account-panel-QhOMbAQP.js → account-panel-BXTCFv7d.js} +1 -1
  4. package/dist/assets/{api-BWFOIoUm.js → api-DqzQ-_3w.js} +1 -1
  5. package/dist/assets/{app-data-BnrEdmg2.js → app-data-C54N2p8b.js} +1 -1
  6. package/dist/assets/app-presenter-provider-V0xnU_Wb.js +115 -0
  7. package/dist/assets/{appearance-settings-page-C5z5sOkC.js → appearance-settings-page-83T2AtVm.js} +1 -1
  8. package/dist/assets/{channels-list-page-CzXYZZtK.js → channels-list-page-Bv7CVSqV.js} +1 -1
  9. package/dist/assets/{config-split-page-CxLWGwdt.js → config-split-page-DqAXKLmG.js} +1 -1
  10. package/dist/assets/{confirm-dialog-BWS7gA_z.js → confirm-dialog-BTKCWMn6.js} +1 -1
  11. package/dist/assets/{desktop-capabilities-page-BJNGkq4q.js → desktop-capabilities-page-zLzCSB7A.js} +1 -1
  12. package/dist/assets/{desktop-update-config-7tBum3MA.js → desktop-update-config-PmofcFf6.js} +1 -1
  13. package/dist/assets/{doc-browser-BNiqa-zm.js → doc-browser-BJrre2S_.js} +1 -1
  14. package/dist/assets/doc-browser-BPqA-zQx.js +1 -0
  15. package/dist/assets/{doc-browser-context-Dp0dEMyT.js → doc-browser-context-TILuCY5c.js} +1 -1
  16. package/dist/assets/{extensions-WWEYpaUh.js → extensions-CVUFK6Jj.js} +1 -1
  17. package/dist/assets/{i18n-ClHx6jwj.js → i18n-20rSH40D.js} +2 -2
  18. package/dist/assets/{i18n-provider-C1NxogO4.js → i18n-provider-BPRq6S7O.js} +1 -1
  19. package/dist/assets/{keyboard-shortcuts-settings-page-CS9BFOBW.js → keyboard-shortcuts-settings-page-CkQbSKwI.js} +1 -1
  20. package/dist/assets/login-page-Dlyvp-81.js +1 -0
  21. package/dist/assets/{login-page-CL0SrBCf.js → login-page-f8qQ4xKY.js} +1 -1
  22. package/dist/assets/main-D2dWy8fM.css +1 -0
  23. package/dist/assets/main-i18n-catalog.config-DZ-5ollN.js +1 -0
  24. package/dist/assets/{main-CvVBCOlN.js → main-ky5Efhq1.js} +2 -2
  25. package/dist/assets/{mcp-marketplace-page-D75hPmzO.js → mcp-marketplace-page-FfIfEo6w.js} +1 -1
  26. package/dist/assets/mcp-marketplace-page-sH7VptN_.js +1 -0
  27. package/dist/assets/{model-config-page-DFfcV9lu.js → model-config-page-Bcm6-pCX.js} +1 -1
  28. package/dist/assets/panel-app-i18n-catalog.config-p3qAY_Eq.js +1 -0
  29. package/dist/assets/{panelStandalone-D2CqTyi_.js → panelStandalone-By-6dDXS.js} +2 -2
  30. package/dist/assets/{privacy-settings-page-CE-xF9bo.js → privacy-settings-page-B1sHLAc1.js} +1 -1
  31. package/dist/assets/{projects-BF0wpY4X.js → projects-O3GTERwP.js} +1 -1
  32. package/dist/assets/{provider-scoped-model-input-BvZitHkT.js → provider-scoped-model-input-BQsugx1v.js} +1 -1
  33. package/dist/assets/{providers-config-page-cDeyluVG.js → providers-config-page-BDEdHJbw.js} +1 -1
  34. package/dist/assets/{pwa-dXn0s_lD.js → pwa-D_nZUwG0.js} +1 -1
  35. package/dist/assets/remote-CFWp4wyH.js +1 -0
  36. package/dist/assets/{runtime-config-page-DNo4dzS1.js → runtime-config-page-BHTKwgDi.js} +1 -1
  37. package/dist/assets/{search-config-page-CA0HxVy0.js → search-config-page-DWKlMHgH.js} +1 -1
  38. package/dist/assets/{secrets-config-page-iT1wamQp.js → secrets-config-page-DiQL088Y.js} +1 -1
  39. package/dist/assets/security-config-DmTDKKY4.js +1 -0
  40. package/dist/assets/{service-apps-panel-CU0tFrqT.js → service-apps-panel-CEnyYsQp.js} +1 -1
  41. package/dist/assets/{tag-chip-CY0Hqk_l.js → tag-chip-B1AYPOKL.js} +1 -1
  42. package/dist/assets/{theme-provider-BvpXGXWH.js → theme-provider-DzvAi3pe.js} +1 -1
  43. package/dist/assets/{use-config-C8ZkQiTc.js → use-config-BEdbtpD4.js} +1 -1
  44. package/dist/assets/{use-desktop-capabilities-DR9snbeo.js → use-desktop-capabilities-BkuRd2cY.js} +1 -1
  45. package/dist/index.html +18 -18
  46. package/dist/panel-standalone.html +5 -5
  47. package/package.json +5 -5
  48. package/src/features/chat/features/conversation/components/__tests__/session-voice-input.test-utils.ts +18 -5
  49. package/src/features/chat/features/conversation/components/chat-voice-input-panel.tsx +37 -14
  50. package/src/features/chat/features/conversation/components/session-conversation-input.tsx +3 -3
  51. package/src/features/chat/features/conversation/hooks/__tests__/use-chat-voice-input.test.tsx +116 -10
  52. package/src/features/chat/features/conversation/hooks/use-chat-voice-input.ts +15 -2
  53. package/src/features/chat/managers/chat-voice-input.manager.ts +26 -4
  54. package/src/features/chat/utils/chat-voice-permissions.utils.test.ts +36 -0
  55. package/src/features/chat/utils/chat-voice-permissions.utils.ts +31 -0
  56. package/src/shared/lib/i18n/locales/en-US/chat.json +18 -3
  57. package/src/shared/lib/i18n/locales/zh-CN/chat.json +18 -3
  58. package/dist/assets/app-presenter-provider-CDRBc_lQ.js +0 -115
  59. package/dist/assets/doc-browser-DZDqghNc.js +0 -1
  60. package/dist/assets/login-page-Dq5nPUCU.js +0 -1
  61. package/dist/assets/main-CLwCjK9U.css +0 -1
  62. package/dist/assets/main-i18n-catalog.config-D4qFo4OB.js +0 -1
  63. package/dist/assets/mcp-marketplace-page-CATnpZ2Q.js +0 -1
  64. package/dist/assets/panel-app-i18n-catalog.config-oUwmxoE7.js +0 -1
  65. package/dist/assets/remote-CV5wQVVj.js +0 -1
  66. package/dist/assets/security-config-B38PLI3M.js +0 -1
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/projects-BF0wpY4X.js","assets/chunk-DF37yw5_.js","assets/app-presenter-provider-CDRBc_lQ.js","assets/preload-helper-ca-nBW7U.js","assets/select-CG5YWnwe.js","assets/dist-C5I0v8Qn.js","assets/dist-BiIcnf9j.js","assets/utils-CBZPzC_b.js","assets/es2015-cuwbYI-l.js","assets/createLucideIcon-BNKf0_kc.js","assets/chevron-down-BL-yMYcX.js","assets/dialog-Xe73hpQz.js","assets/dist-czPa8xFO.js","assets/x-DdXOqLnX.js","assets/popover-NkrFlWHp.js","assets/tooltip-DYcuWhuP.js","assets/api-BWFOIoUm.js","assets/i18n-ClHx6jwj.js","assets/mcp-marketplace-page-D75hPmzO.js","assets/doc-browser-BNiqa-zm.js","assets/search-CUe41wjm.js","assets/book-open-xqEj1OLE.js","assets/boxes-D6uPnkGo.js","assets/navigation-link-BAQjgx2F.js","assets/host-capabilities-B107nwS3.js","assets/plus-LA8-jpxP.js","assets/refresh-cw-h9Xq3LY3.js","assets/doc-browser-context-Dp0dEMyT.js","assets/middleware-0o3JF3tS.js","assets/use-panel-app-scroll-restoration-ZnicIfo3.js","assets/circle-alert-lSa3LRvS.js","assets/loader-circle-K1BDdHR5.js","assets/confirm-dialog-BWS7gA_z.js","assets/i18n-provider-C1NxogO4.js","assets/tag-chip-CY0Hqk_l.js","assets/skeleton-Drvn83YW.js","assets/katex-B26hhTOT.js","assets/puzzle-D6gulz7u.js","assets/app-data-BnrEdmg2.js","assets/trash-2-BPPYt2NV.js","assets/ellipsis-C5YXdOUx.js","assets/eye-C84inPcV.js","assets/tabs-BuE0qKMh.js","assets/use-viewport-layout-BS18drMT.js","assets/theme-provider-BvpXGXWH.js","assets/use-desktop-capabilities-DR9snbeo.js","assets/logo-badge-C-5-zim6.js","assets/card-BhfAZv5L.js","assets/use-config-C8ZkQiTc.js","assets/provider-models-hrHMcHqg.js","assets/app-presenter-provider-jNGlmBLe.css","assets/circle-dashed-CU3yApvP.js","assets/settings-2-CE3ELQyk.js","assets/model-config-page-DFfcV9lu.js","assets/provider-scoped-model-input-BvZitHkT.js","assets/form-actions-BRESe-m_.js","assets/config-hints-B_C9DAp5.js","assets/appearance-settings-page-C5z5sOkC.js","assets/keyboard-shortcuts-settings-page-CS9BFOBW.js","assets/search-config-page-CA0HxVy0.js","assets/config-split-page-CxLWGwdt.js","assets/providers-config-page-cDeyluVG.js","assets/extensions-WWEYpaUh.js","assets/channels-list-page-CzXYZZtK.js","assets/runtime-config-page-DNo4dzS1.js","assets/rotate-cw-B6xm41Wn.js","assets/save-fff_WpY2.js","assets/pwa-dXn0s_lD.js","assets/desktop-update-config-7tBum3MA.js","assets/security-config-B38PLI3M.js","assets/secrets-config-page-iT1wamQp.js","assets/privacy-settings-page-CE-xF9bo.js","assets/desktop-capabilities-page-BJNGkq4q.js","assets/remote-CV5wQVVj.js","assets/mcp-marketplace-page-CATnpZ2Q.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./chunk-DF37yw5_.js";import{t}from"./client-BtGBwLTs.js";import{A as n,M as r,O as i,t as a}from"./utils-CBZPzC_b.js";import{t as o}from"./preload-helper-ca-nBW7U.js";import{a as s,c,d as l,f as u,l as d,r as f,s as p,u as m}from"./navigation-link-BAQjgx2F.js";import{$t as ee,An as h,Gt as g,Ht as _,Lt as v,Vt as te,Yt as y,_n as b,dn as ne,en as re,fn as x,gn as S,on as C,vn as ie,x as w}from"./api-BWFOIoUm.js";import{S as ae,b as oe,n as se,p as ce,u as le}from"./mcp-marketplace-page-D75hPmzO.js";import{A as ue,B as de,D as fe,F as pe,H as T,I as E,L as me,M as he,N as ge,O as _e,R as D,S as ve,U as ye,V as be,_ as xe,a as Se,at as Ce,b as we,c as Te,d as Ee,dt as De,f as Oe,g as ke,h as Ae,i as O,it as k,j as A,k as je,l as Me,lt as Ne,m as Pe,n as j,o as Fe,ot as Ie,p as Le,s as Re,t as ze,u as Be,w as Ve,x as He,z as Ue}from"./app-presenter-provider-CDRBc_lQ.js";import{i as We,s as M}from"./i18n-ClHx6jwj.js";import{t as Ge}from"./createLucideIcon-BNKf0_kc.js";import{c as Ke,f as qe,g as Je,l as Ye,s as Xe}from"./app-data-BnrEdmg2.js";import{t as Ze}from"./chevron-down-BL-yMYcX.js";import{t as Qe}from"./ellipsis-C5YXdOUx.js";import{a as $e,i as et,n as tt,r as nt,t as rt}from"./select-CG5YWnwe.js";import{t as it}from"./provider-scoped-model-input-BvZitHkT.js";import{t as at}from"./eye-C84inPcV.js";import{t as N}from"./use-viewport-layout-BS18drMT.js";import{t as ot}from"./plus-LA8-jpxP.js";import{n as st,s as ct,t as lt}from"./theme-provider-BvpXGXWH.js";import{t as ut}from"./settings-2-CE3ELQyk.js";import{n as dt,r as ft,t as pt}from"./pwa-dXn0s_lD.js";import{n as mt}from"./confirm-dialog-BWS7gA_z.js";import{t as ht}from"./trash-2-BPPYt2NV.js";import{a as P,i as F,n as I,o as L,r as R,t as z}from"./dialog-Xe73hpQz.js";import{i as gt,r as _t,t as vt}from"./popover-NkrFlWHp.js";import{n as yt,t as bt}from"./i18n-provider-C1NxogO4.js";import{n as xt,t as St}from"./doc-browser-context-Dp0dEMyT.js";import{t as Ct}from"./tag-chip-CY0Hqk_l.js";import{n as B,t as V}from"./card-BhfAZv5L.js";import{n as wt}from"./provider-models-hrHMcHqg.js";import{f as H,p as U,t as W}from"./use-config-C8ZkQiTc.js";import{t as Tt}from"./login-page-CL0SrBCf.js";var Et=Ge(`Gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),Dt=t(),G=e(r(),1);function Ot(){let e=j();return(0,G.useEffect)(()=>(e.chatCompletionNotificationManager.start(),()=>{e.chatCompletionNotificationManager.stop()}),[e.chatCompletionNotificationManager]),null}var kt=`NextClaw`,At=[{prefix:`/marketplace/mcp`,key:`marketplaceMcpPageTitle`},{prefix:`/marketplace/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/marketplace`,key:`marketplace`},{prefix:`/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/cron`,key:`cronPageTitle`},{prefix:`/agents`,key:`agentsPageTitle`},{prefix:`/projects`,key:`projectsTitle`},{prefix:`/chat`,key:`chat`},{prefix:`/model`,key:`modelPageTitle`},{prefix:`/search`,key:`searchPageTitle`},{prefix:`/providers`,key:`providersPageTitle`},{prefix:`/channels`,key:`channelsPageTitle`},{prefix:`/runtime`,key:`runtimePageTitle`},{prefix:`/updates`,key:`runtimeUpdatesPageTitle`},{prefix:`/remote`,key:`remotePageTitle`},{prefix:`/security`,key:`authSecurityTitle`},{prefix:`/secrets`,key:`secretsPageTitle`}];function jt(e,t){return e===t||e.startsWith(`${t}/`)}function Mt(e){let t=e.toLowerCase();for(let{prefix:e,key:n}of At)if(jt(t,e))return M(n);return M(`settings`)}function Nt(e){let t=e.toLowerCase();return t===`localhost`||t.endsWith(`.localhost`)||t===`::1`||t===`[::1]`||t.startsWith(`127.`)}function Pt(e){let t=e?.host.trim(),n=e?.hostname.trim(),r=e?.port.trim();return!t||!n?null:Nt(n)?r||null:t}function Ft(e,t){let n=Pt(t);return`${kt}${n?` ${n}`:``} - ${Mt(e)}`}var K=n(),It={..._e,...le};function Lt({children:e,sideDockManager:t}){let{isOpen:n,mode:r}=xt();ce();let{pathname:i}=m(),a=l(),o=O(),{language:s}=yt(),{isMobile:c}=N(),u=xe(),d=Fe(e=>e.isVisible);Fe(e=>e.pinnedItems);let f={getDockState:t.getDockState,pinTab:t.pinTab,unpinTab:t.unpinTab},p=(0,G.useCallback)(e=>{let t=je(e);if(t)return[{key:`chat`,items:[{key:`add-to-chat`,icon:(0,K.jsx)(Ce,{className:`h-4 w-4`}),label:M(`docBrowserAddToChat`),restoreFocus:!1,onSelect:()=>{let e=i===`/chat`||i.startsWith(`/chat/`),n=i===`/chat`?null:Be(i.slice(6));o.chatComposerIntentManager.requestUiResourceReference({targetSessionKey:e?n:null,reference:t}),e||a(Me)}}]}]},[a,i,o]);return(0,G.useEffect)(()=>{document.title=Ft(i,window.location)},[i,s]),c&&u!==`win32`?(0,K.jsx)(ke,{pathname:i,isDocBrowserOpen:n,docBrowserDockControls:f,docBrowserRenderers:It,docBrowserTabMenuGroups:p,topbarLeadingInset:u===`darwin`?`4.75rem`:void 0,children:e}):(0,K.jsx)(Oe,{pathname:i,isMobileLayout:c,isDocBrowserOpen:n,docBrowserMode:r,docBrowserDockControls:f,docBrowserRenderers:It,docBrowserTabMenuGroups:p,sideDock:d?(0,K.jsx)(Se,{manager:t}):null,children:e})}function Rt({children:e}){let t=O();return(0,K.jsx)(St,{manager:t.docBrowserManager,children:(0,K.jsx)(Lt,{sideDockManager:t.sideDockManager,children:e})})}function zt(){let{isMobile:e}=N();return e?(0,K.jsx)(Pe,{}):(0,K.jsx)(p,{to:`/model`,replace:!0})}var Bt=new Intl.NumberFormat;function Vt({agent:e,defaults:t,runtimeOptions:n,defaultRuntime:r,defaultRuntimeLabel:i,onOpenChange:a,onEdit:o}){if(!e)return null;let s=Ht(e.model,t?.model),c=Wt({agent:e,defaults:t,runtimeOptions:n,defaultRuntime:r,defaultRuntimeLabel:i}),l=Ut(e.contextTokens,t?.contextTokens??2e5),u=Ut(e.reservedContextTokens,t?.reservedContextTokens),d=Ht(e.thinkingDefault,t?.thinkingDefault??`off`),f=q(e.runtimeConfig??e.engineConfig,t?.engineConfig),p=q(e.models,t?.models);return(0,K.jsx)(z,{open:e!==null,onOpenChange:a,children:(0,K.jsxs)(I,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-popover p-0 sm:max-h-[720px] sm:max-w-2xl`,children:[(0,K.jsx)(`div`,{className:`shrink-0 px-5 pb-3 pt-5`,children:(0,K.jsx)(P,{className:`text-left`,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,K.jsx)(he,{agentId:e.id,displayName:e.displayName,avatarUrl:e.avatarUrl,className:`h-10 w-10 shrink-0`}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(L,{className:`truncate text-base`,children:e.displayName?.trim()||e.id}),(0,K.jsxs)(R,{className:`truncate text-xs`,children:[`@`,e.id]})]})]})})}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto overscroll-contain px-5 py-3`,children:[(0,K.jsxs)(J,{icon:Je,title:M(`agentsDetailsIdentitySection`),children:[(0,K.jsx)(Y,{label:M(`agentsDetailsFieldDisplayName`),value:e.displayName?.trim()||e.id}),(0,K.jsx)(Y,{label:M(`agentsDetailsFieldId`),value:e.id,mono:!0}),(0,K.jsx)(Y,{label:M(`agentsDetailsFieldDescription`),value:e.description?.trim()||M(`agentsDetailsEmptyValue`),wide:!0}),(0,K.jsx)(Y,{label:M(`agentsDetailsFieldWorkspace`),value:e.workspace??M(`agentsDetailsUnsetValue`),mono:!0,wide:!0})]}),(0,K.jsxs)(J,{icon:mt,title:M(`agentsDetailsRuntimeSection`),children:[(0,K.jsx)(Y,{label:M(`agentsDetailsFieldModel`),value:s.value,source:s.source}),(0,K.jsx)(Y,{label:M(`agentsDetailsFieldRuntime`),value:c.value,source:c.source}),(0,K.jsx)(Y,{label:M(`agentsDetailsFieldRuntimeConfig`),value:f.value,source:f.source,mono:!0,prewrap:!0})]}),(0,K.jsxs)(J,{icon:Et,title:M(`agentsDetailsContextSection`),children:[(0,K.jsx)(Y,{label:M(`agentsDetailsFieldContextTokens`),value:l.value,source:l.source}),(0,K.jsx)(Y,{label:M(`agentsDetailsFieldReservedContextTokens`),value:u.value,source:u.source})]}),(0,K.jsxs)(J,{icon:De,title:M(`agentsDetailsBehaviorSection`),children:[(0,K.jsx)(Y,{label:M(`agentsDetailsFieldThinkingDefault`),value:d.value,source:d.source}),(0,K.jsx)(Y,{label:M(`agentsDetailsFieldModelOverrides`),value:p.value,source:p.source,mono:!0,prewrap:!0}),(0,K.jsx)(Y,{label:M(`agentsDetailsFieldAvatar`),value:e.avatar??M(`agentsDetailsUnsetValue`),mono:!0})]})]}),(0,K.jsxs)(F,{className:`shrink-0 px-5 pb-4 pt-2`,children:[(0,K.jsx)(y,{type:`button`,variant:`ghost`,onClick:()=>a(!1),children:M(`cancel`)}),(0,K.jsxs)(y,{type:`button`,variant:`primary`,className:`px-4`,onClick:()=>o(e),children:[(0,K.jsx)(k,{className:`mr-2 h-4 w-4`}),M(`agentsDetailsEditAction`)]})]})]})})}function Ht(e,t){let n=e?.trim();return n?{value:n,source:`override`}:{value:t?.trim()||M(`agentsDetailsUnsetValue`),source:`default`}}function Ut(e,t){return typeof e==`number`?{value:Bt.format(e),source:`override`}:{value:typeof t==`number`?Bt.format(t):M(`agentsDetailsUnsetValue`),source:`default`}}function Wt(e){let{agent:t,defaults:n,runtimeOptions:r,defaultRuntime:i,defaultRuntimeLabel:a}=e,o=t.runtime?.trim()||t.engine?.trim();if(o)return{value:Gt(o,r,a),source:`override`};let s=n?.engine?.trim()||i;return{value:s?Gt(s,r,a):a,source:`default`}}function Gt(e,t,n){let r=E(e);return r?t.find(e=>e.value===r)?.label??D(r):n}function q(e,t){return Kt(e)?{value:JSON.stringify(e,null,2),source:`override`}:{value:Kt(t)?JSON.stringify(t,null,2):M(`agentsDetailsUnsetValue`),source:`default`}}function Kt(e){return!!(e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length>0)}function J(e){let{icon:t,title:n,children:r}=e;return(0,K.jsxs)(`section`,{className:`space-y-2 border-t border-border/60 pt-3 first:border-t-0 first:pt-0`,children:[(0,K.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-xs font-semibold leading-5 text-foreground`,children:[(0,K.jsx)(t,{className:`h-3.5 w-3.5 text-muted-foreground`}),n]}),(0,K.jsx)(`dl`,{className:`grid min-w-0 gap-x-6 gap-y-2.5 pl-5 sm:grid-cols-2`,children:r})]})}function Y(e){let{label:t,value:n,source:r,mono:i=!1,prewrap:o=!1,wide:s=!1}=e,c=o&&n.trim().startsWith(`{`),l=i&&(!o||c);return(0,K.jsxs)(`div`,{className:a(`grid min-w-0 grid-cols-[10rem_minmax(0,1fr)] items-baseline gap-x-2`,(s||c)&&`sm:col-span-2`),children:[(0,K.jsx)(`dt`,{className:`flex min-w-0 items-baseline leading-5`,children:(0,K.jsx)(`span`,{className:`whitespace-nowrap text-xs font-medium text-muted-foreground`,children:t})}),(0,K.jsxs)(`dd`,{className:a(`min-w-0 break-words text-xs leading-5 text-foreground`,c?`max-h-28 overflow-auto whitespace-pre-wrap rounded bg-muted/50 px-2 py-1.5 text-left`:``),children:[(0,K.jsx)(`span`,{className:l?`font-mono`:void 0,children:n}),r?(0,K.jsx)(qt,{source:r}):null]})]})}function qt({source:e}){return(0,K.jsxs)(`span`,{className:a(`ml-1 whitespace-nowrap text-xs font-normal leading-5`,e===`override`?`text-blue-500`:`text-muted-foreground`),children:[`(`,M(e===`override`?`agentsDetailsAgentOverride`:`agentsDetailsInheritedDefault`),`)`]})}function Jt({form:e,disabled:t=!1,onChange:n}){return(0,K.jsxs)(`details`,{className:`group rounded-2xl border border-border bg-card`,children:[(0,K.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-4 py-3 text-sm font-semibold text-foreground [&::-webkit-details-marker]:hidden`,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(ut,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,K.jsx)(`span`,{className:`truncate`,children:M(`agentsAdvancedConfigToggle`)})]}),(0,K.jsx)(Ze,{className:`h-4 w-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180`})]}),(0,K.jsxs)(`div`,{className:`space-y-4 border-t border-border/60 px-4 py-4`,children:[(0,K.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:M(`agentsAdvancedConfigDescription`)}),(0,K.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:(0,K.jsx)(Yt,{label:M(`agentsAdvancedContextTokensLabel`),value:e.contextTokens,min:1e3,step:1e3,disabled:t,onChange:e=>n({contextTokens:e})})})]})]})}function Yt(e){let{label:t,value:n,min:r,step:i,disabled:a,onChange:o}=e;return(0,K.jsxs)(`label`,{className:`space-y-2 text-sm font-medium text-foreground`,children:[(0,K.jsx)(`span`,{children:t}),(0,K.jsx)(g,{type:`number`,min:r,step:i,value:n,disabled:a,placeholder:M(`agentsAdvancedInheritPlaceholder`),"aria-label":t,onChange:e=>o(e.target.value)})]})}function Xt(e){return{displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,model:e.model??``,runtime:e.runtime??e.engine??``,contextTokens:Zt(e.contextTokens)}}function Zt(e){return typeof e==`number`?String(e):``}function Qt(e){let{runtimeOptions:t,currentRuntime:n}=e,r=n.trim();if(!r)return t;let i=E(r);return t.some(e=>e.value===i)?t:[...t,{value:i,label:D(i),icon:null,ready:!1,reason:`unavailable`,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}].sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))}function $t({value:e,disabled:t=!1,runtimeOptions:n,defaultRuntime:r,onChange:i}){let a=e.trim()?E(e):``,o=Qt({runtimeOptions:n,currentRuntime:e}),s=o.find(e=>e.value===a)??null,c=s?.reasonMessage?.trim()||(s?.ready===!1?M(`agentsRuntimeUnavailableHelp`):``);return(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsxs)(rt,{value:a||r,onValueChange:e=>i(e===r?``:e),disabled:t,children:[(0,K.jsx)(et,{"aria-label":M(`agentsCardRuntimeLabel`),className:`rounded-xl`,children:(0,K.jsx)($e,{placeholder:M(`agentsRuntimeSelectPlaceholder`)})}),(0,K.jsx)(tt,{className:`rounded-xl`,children:o.map(e=>(0,K.jsx)(nt,{value:e.value,disabled:e.ready===!1&&e.value!==a,className:`rounded-lg`,children:e.label},e.value))})]}),c?(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c}):null]})}function en({agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,K.jsx)(z,{open:e!==null,onOpenChange:a,children:e?(0,K.jsx)(tn,{agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e.id):null})}function tn(e){let{agent:t,pending:n,providerCatalog:r,runtimeOptions:i,defaultRuntime:a,onOpenChange:o,onSubmit:s}=e,[c,l]=(0,G.useState)(Xt(t));return(0,K.jsxs)(I,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-popover p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,K.jsx)(`div`,{className:`shrink-0 border-b border-border px-6 py-6`,children:(0,K.jsxs)(P,{className:`text-left`,children:[(0,K.jsx)(L,{children:M(`agentsEditDialogTitle`)}),(0,K.jsx)(R,{children:M(`agentsEditDialogDescription`)})]})}),(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsx)(ae,{tone:`warning`,title:M(`agentsEditHomeReadonly`),description:M(`agentsEditHomeReadonlyHint`),children:(0,K.jsx)(`div`,{className:`break-all text-sm text-amber-950`,children:t.workspace??`-`})}),(0,K.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,K.jsx)(g,{value:c.displayName,onChange:e=>l(t=>({...t,displayName:e.target.value})),placeholder:M(`agentsFormNamePlaceholder`)}),(0,K.jsx)(se,{value:c.description,onChange:e=>l(t=>({...t,description:e.target.value})),placeholder:M(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,K.jsx)(g,{value:c.avatar,onChange:e=>l(t=>({...t,avatar:e.target.value})),placeholder:M(`agentsFormAvatarPlaceholder`)}),(0,K.jsx)(it,{value:c.model,onChange:e=>l(t=>({...t,model:e})),providerCatalog:r,disabled:n,className:`md:col-span-2`}),(0,K.jsx)($t,{value:c.runtime,onChange:e=>l(t=>({...t,runtime:e})),runtimeOptions:i,defaultRuntime:a,disabled:n})]}),(0,K.jsx)(Jt,{form:c,disabled:n,onChange:e=>l(t=>({...t,...e}))})]})}),(0,K.jsxs)(F,{className:`shrink-0 border-t border-border px-6 py-5`,children:[(0,K.jsx)(y,{type:`button`,variant:`ghost`,onClick:()=>o(!1),disabled:n,children:M(`cancel`)}),(0,K.jsxs)(y,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>s(t.id,c),disabled:n,children:[(0,K.jsx)(k,{className:`mr-2 h-4 w-4`}),M(`agentsEditSaveAction`)]})]})]})}var nn=`请直接创建一个默认示例 Agent,不要问我问题。创建完成后,简单告诉我它能做什么。`;function rn(e){let t=e.trim();if(!t)return null;let n=Number(t);if(!Number.isFinite(n))throw Error(M(`agentsAdvancedInvalidNumberError`));return Math.trunc(n)}function an(e){return{displayName:e.displayName,description:e.description,avatar:e.avatar,model:e.model,...e.runtime.trim()?{runtime:e.runtime.trim()}:{runtime:``},contextTokens:rn(e.contextTokens)}}function X(e){let{icon:t,label:n,disabled:r=!1,destructive:i=!1,onClick:o}=e;return(0,K.jsxs)(`button`,{type:`button`,className:a(`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,i?`text-destructive hover:bg-destructive/10`:`text-foreground hover:bg-muted`),onClick:o,disabled:r,children:[(0,K.jsx)(t,{className:`h-4 w-4 shrink-0`}),(0,K.jsx)(`span`,{children:n})]})}function on(e){let{agent:t,runtimeOptions:n,defaultRuntimeLabel:r,updatePending:i,deletePending:a,onStartChat:o,onView:s,onEdit:c,onDelete:l}=e,u=t.runtime?.trim()||t.engine?.trim()||``,d=u?n.find(e=>e.value===E(u))?.label??D(u):r;return(0,K.jsx)(V,{className:`group overflow-hidden border border-border bg-card shadow-none transition-colors duration-200 hover:border-border/80`,children:(0,K.jsxs)(B,{className:`relative flex h-full flex-col gap-3 px-3.5 py-3.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-2.5 pr-16`,children:[(0,K.jsx)(he,{agentId:t.id,displayName:t.displayName,avatarUrl:t.avatarUrl,className:`h-9 w-9 shrink-0`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(`div`,{className:`truncate text-sm font-semibold text-foreground`,children:t.displayName?.trim()||t.id}),t.builtIn?(0,K.jsxs)(Ct,{tone:`warning`,className:`h-5 gap-1 border-amber-200 bg-amber-50 px-1.5 text-[10px] text-amber-700`,children:[(0,K.jsx)(qe,{className:`h-3 w-3`}),M(`agentsCardBuiltInTag`)]}):null]}),(0,K.jsxs)(`div`,{className:`truncate text-xs text-muted-foreground`,children:[`@`,t.id]})]})]}),(0,K.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 flex items-center gap-1 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,children:[(0,K.jsx)(y,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-muted-foreground hover:text-foreground`,"aria-label":M(`agentsCardStartChat`),title:M(`agentsCardStartChat`),onClick:o,children:(0,K.jsx)(Ie,{className:`h-4 w-4`})}),(0,K.jsxs)(vt,{children:[(0,K.jsx)(gt,{asChild:!0,children:(0,K.jsx)(y,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-muted-foreground hover:text-foreground`,"aria-label":M(`chatSessionMoreActions`),title:M(`chatSessionMoreActions`),children:(0,K.jsx)(Qe,{className:`h-4 w-4`})})}),(0,K.jsxs)(_t,{align:`end`,className:`w-44 p-1.5`,children:[(0,K.jsx)(X,{icon:at,label:M(`agentsViewDetailsAction`),onClick:s}),(0,K.jsx)(X,{icon:k,label:M(`agentsEditAction`),onClick:c,disabled:i}),t.builtIn?null:(0,K.jsx)(X,{icon:ht,label:M(`agentsRemoveAction`),onClick:l,disabled:a,destructive:!0})]})]})]}),(0,K.jsx)(`p`,{className:`line-clamp-2 min-h-10 text-sm leading-5 text-muted-foreground`,children:t.description?.trim()||(t.builtIn?M(`agentsCardBuiltInSummary`):M(`agentsCardCustomSummary`))}),(0,K.jsxs)(`div`,{className:`mt-auto grid gap-2 border-t border-border/60 pt-2 text-xs text-muted-foreground`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(mt,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/60`}),(0,K.jsx)(`span`,{className:`truncate`,children:d})]}),(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(Ne,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/60`}),(0,K.jsx)(`span`,{className:`truncate`,children:t.workspace??`-`})]})]})]})})}function sn(){let e=T(),t=Xe(),n=W(),r=U(),i=H(),a=Re(),o=Ye(),s=Ke(),[c,l]=(0,G.useState)(null),[u,d]=(0,G.useState)(null),f=(0,G.useMemo)(()=>t.data?.agents??[],[t.data?.agents]),p=(0,G.useMemo)(()=>[...f].sort((e,t)=>Number(!!t.builtIn)-Number(!!e.builtIn)||e.id.localeCompare(t.id)),[f]),m=(0,G.useMemo)(()=>wt({config:n.data,providersView:r.data,templatesView:i.data,onlyConfigured:!0}),[n.data,r.data,i.data]),h=(0,G.useMemo)(()=>pe(a.data?.options??[]),[a.data?.options]),g=(0,G.useMemo)(()=>E(a.data?.defaultType??`native`),[a.data?.defaultType]),_=(0,G.useMemo)(()=>h.find(e=>e.value===g)?.label??D(g),[g,h]),v=n.data?.agents.defaults,te=e=>{l(e)},b=e=>{d(e)},ne=async(e,t)=>{let n;try{n=an(t)}catch(e){ie.error(e instanceof Error?e.message:M(`agentsAdvancedParseFailed`));return}await o.mutateAsync({agentId:e,data:n}),d(null)},x=t=>{e.chatSessionListManager.startAgentDraftChat(t.id,me(t,g))},S=()=>{e.chatSessionListManager.startAgentDraftChat(`main`,g,nn)};return(0,K.jsxs)(re,{className:`space-y-6`,children:[(0,K.jsx)(ee,{headingLevel:1,title:M(`agentsHeroEyebrow`),description:M(`agentsHeroDescription`),actions:(0,K.jsxs)(y,{type:`button`,variant:`primary`,className:`h-9 shrink-0 rounded-xl px-4 text-sm font-semibold`,onClick:S,children:[(0,K.jsx)(ot,{className:`mr-2 h-4 w-4`}),M(`agentsCreateButton`)]})}),(0,K.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:t.isLoading?(0,K.jsx)(V,{className:`md:col-span-2 xl:col-span-3 border-dashed border-border bg-card/70`,children:(0,K.jsx)(B,{className:`py-14 text-center text-sm text-muted-foreground`,children:M(`agentsLoading`)})}):p.length===0?(0,K.jsx)(V,{className:`md:col-span-2 xl:col-span-3 overflow-hidden border-dashed border-border bg-gradient-subtle`,children:(0,K.jsxs)(B,{className:`flex min-h-[240px] flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,K.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-card/80 shadow-[0_18px_44px_rgba(0,0,0,0.08)]`,children:(0,K.jsx)(Je,{className:`h-8 w-8 text-warning`})}),(0,K.jsx)(`div`,{className:`text-lg font-semibold text-foreground`,children:M(`agentsEmpty`)}),(0,K.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-muted-foreground`,children:M(`agentsEmptyDescription`)}),(0,K.jsxs)(y,{type:`button`,variant:`primary`,className:`mt-5 rounded-2xl px-5`,onClick:S,children:[(0,K.jsx)(ot,{className:`mr-2 h-4 w-4`}),M(`agentsCreateButton`)]})]})}):p.map(e=>(0,K.jsx)(on,{agent:e,runtimeOptions:h,defaultRuntimeLabel:_,updatePending:o.isPending,deletePending:s.isPending,onStartChat:()=>x(e),onView:()=>te(e),onEdit:()=>b(e),onDelete:()=>s.mutate({agentId:e.id})},e.id))}),(0,K.jsx)(Vt,{agent:c,defaults:v,runtimeOptions:h,defaultRuntime:g,defaultRuntimeLabel:_,onOpenChange:e=>{e||l(null)},onEdit:e=>{l(null),d(e)}}),(0,K.jsx)(en,{agent:u,pending:o.isPending,providerCatalog:m,runtimeOptions:h,defaultRuntime:g,onOpenChange:e=>{!e&&!o.isPending&&d(null)},onSubmit:ne})]})}var cn=(0,G.lazy)(async()=>({default:(await o(async()=>{let{ProjectsPage:e}=await import(`./projects-BF0wpY4X.js`);return{ProjectsPage:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52]))).ProjectsPage})),Z=`max-w-[min(1180px,100%)]`;function ln(e){return e===`projects`?`relative flex flex-1 min-h-0 overflow-hidden bg-background`:`flex-1 min-h-0 overflow-hidden bg-background`}function un(e){let{routeSessionKey:t,syncRouteSessionSelection:n}=e;(0,G.useLayoutEffect)(()=>{n(t)},[t,n])}function dn({view:e,confirmDialog:t}){let{isMobile:n}=N(),r=A({restorationKey:`main-page:cron`}),i=A({restorationKey:`main-page:agents`}),{onScroll:a,scrollRef:o}=r,{onScroll:s,scrollRef:c}=i;return(0,K.jsxs)(`div`,{className:`h-full flex`,children:[n?null:(0,K.jsx)(Ee,{}),e===`chat`?n?(0,K.jsx)(Le,{}):(0,K.jsx)(ve,{}):(0,K.jsx)(`section`,{"data-theme-surface":`workspace`,className:ln(e),children:e===`projects`?(0,K.jsx)(G.Suspense,{fallback:(0,K.jsx)(`div`,{className:`h-full animate-pulse bg-card/30`}),children:(0,K.jsx)(cn,{})}):e===`inbox`?(0,K.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full flex-col py-4 sm:px-6 sm:py-5 ${Z}`,children:(0,K.jsx)(we,{})}):e===`panel-app`?(0,K.jsx)(fe,{}):e===`cron`?(0,K.jsx)(`div`,{ref:o,onScroll:a,className:`h-full overflow-auto custom-scrollbar`,children:(0,K.jsx)(`div`,{className:`mx-auto w-full px-4 py-4 sm:px-6 sm:py-5 ${Z}`,children:(0,K.jsx)(Ve,{})})}):e===`agents`?(0,K.jsx)(`div`,{ref:c,onScroll:s,className:`h-full overflow-auto custom-scrollbar`,children:(0,K.jsx)(`div`,{className:`mx-auto w-full px-4 py-4 sm:px-6 sm:py-5 ${Z}`,children:(0,K.jsx)(sn,{})})}):(0,K.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,K.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full flex-col px-4 py-4 sm:px-6 sm:py-5 ${Z}`,children:(0,K.jsx)(ue,{forcedType:`skills`})})})}),t]})}function fn(e){let t=T(),n=W(),r=U(),i=H(),a=de({limit:200}),o=Re(),s=e.sessionKey?.trim()||`draft-session`,c=Ue({sessionId:s});(0,G.useEffect)(()=>{t.chatQueryManager.syncSnapshot({configQuery:n,providersQuery:r,providerTemplatesQuery:i,sessionsQuery:a,sessionTypesQuery:o,sessionSkillsSessionId:s,sessionSkillsQuery:c})},[n,t.chatQueryManager,r,s,c,a,o,i])}function pn(){let e=T();(0,G.useEffect)(()=>v.eventBus.on(i.uiShowContent,t=>{e.chatThreadManager.handleUiShowContentEvent(t)}),[e])}function mn(){let{sessionId:e}=u(),t=(0,G.useMemo)(()=>Be(e),[e]);return{routeSessionKey:t,sessionKey:t??void 0}}function hn(){let e=T(),{confirm:t,ConfirmDialog:n}=oe(),r=m(),i=l();return(0,G.useEffect)(()=>{e.chatUiManager.syncState({pathname:r.pathname}),e.chatUiManager.bindActions({navigate:i,confirm:t})},[t,r.pathname,i,e]),(0,K.jsx)(n,{})}function gn({view:e}){let t=j();return(0,K.jsx)(be,{presenter:(0,G.useMemo)(()=>new Te(t),[t]),children:(0,K.jsx)(_n,{view:e})})}function _n({view:e}){let t=j(),n=T(),r=hn(),{routeSessionKey:i,sessionKey:a}=mn(),o=ge(e=>{let{snapshot:t}=e;return t.workspacePanelParentKey!==(a??null)||t.activeWorkspacePanelKind!==`child-session`?null:t.activeChildSessionKey?.trim()||null});return(0,G.useEffect)(()=>(t.chatCompletionNotificationManager.syncVisibleSessions([a,o]),()=>{t.chatCompletionNotificationManager.syncVisibleSessions([])}),[t.chatCompletionNotificationManager,a,o]),fn({sessionKey:a??null}),un({routeSessionKey:i,syncRouteSessionSelection:n.chatSessionListManager.syncRouteSessionSelection}),pn(),(0,K.jsx)(dn,{view:e,confirmDialog:r})}function Q({view:e}){return(0,K.jsx)(gn,{view:e})}function vn(e){let t=e.trim().toLowerCase();return t?!t.startsWith(`skills`):!0}function yn(e,t){t.startsWith(`mcp`)&&(e?.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}))}function bn(e,t){e&&vn(t)&&e.invalidateQueries({queryKey:[`config`]}),yn(e,t)}function xn(e){let t=e.trim().replace(/\\/g,`/`).replace(/\/+$/g,``);return/^[a-z]:/i.test(t)?t.toLowerCase():t}function Sn(e,t){if(!e)return;let n=xn(t);e.invalidateQueries({predicate:e=>e.queryKey[0]===`server-path-browse`&&typeof e.queryKey[1]==`string`&&xn(e.queryKey[1])===n})}function Cn(e){let t=(0,G.useRef)(!1);(0,G.useEffect)(()=>{let n=v.eventBus.on(i.connectionOpen,()=>{x.handleConnectionRestored(),C.refreshAfterRealtimeReconnect(),t.current&&(t.current=!1,e?.invalidateQueries({queryKey:[`ncp-sessions`]}))}),r=v.eventBus.on(i.connectionClose,()=>{x.handleConnectionInterrupted(null),t.current=!0}),a=v.eventBus.on(i.connectionError,e=>{x.handleConnectionInterrupted(e?.message??null),t.current=!0}),o=v.eventBus.on(i.configUpdated,({path:t})=>{bn(e,t)}),s=v.eventBus.on(i.serverPathChanged,({directoryPath:t})=>Sn(e,t)),c=v.eventBus.on(i.runtimeUpdateSnapshot,e=>{C.reportSnapshot(e)}),l=v.eventBus.on(i.sessionRunStatus,t=>{w(e,{type:`session.run-status`,payload:t})}),u=v.eventBus.on(i.sessionSummaryUpsert,t=>{w(e,{type:`session.summary.upsert`,payload:t})}),d=v.eventBus.on(i.sessionSummaryDelete,t=>{w(e,{type:`session.summary.delete`,payload:t})}),f=v.eventBus.on(i.error,e=>{console.error(`Realtime transport error:`,e.message)});return()=>{n(),r(),a(),o(),s(),c(),l(),u(),d(),f()}},[e])}var wn={"--width":`320px`},Tn=(0,G.lazy)(async()=>({default:(await ye()).AccountPanel})),En=(0,G.lazy)(async()=>({default:(await o(async()=>{let{ModelConfigPage:e}=await import(`./model-config-page-DFfcV9lu.js`);return{ModelConfigPage:e}},__vite__mapDeps([53,1,16,7,17,3,21,9,54,4,5,6,8,10,14,12,49,23,24,31,27,28,55,35,48,56]))).ModelConfigPage})),Dn=(0,G.lazy)(async()=>({default:(await o(async()=>{let{AppearanceSettingsPage:e}=await import(`./appearance-settings-page-C5z5sOkC.js`);return{AppearanceSettingsPage:e}},__vite__mapDeps([57,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50]))).AppearanceSettingsPage})),On=(0,G.lazy)(async()=>({default:(await o(async()=>{let{KeyboardShortcutsSettingsPage:e}=await import(`./keyboard-shortcuts-settings-page-CS9BFOBW.js`);return{KeyboardShortcutsSettingsPage:e}},__vite__mapDeps([58,2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50]))).KeyboardShortcutsSettingsPage})),kn=(0,G.lazy)(async()=>({default:(await o(async()=>{let{SearchConfigPage:e}=await import(`./search-config-page-CA0HxVy0.js`);return{SearchConfigPage:e}},__vite__mapDeps([59,1,4,5,6,7,8,9,10,16,17,3,20,23,24,43,28,60,55,48]))).SearchConfigPage})),An=(0,G.lazy)(async()=>({default:(await o(async()=>{let{ProvidersConfigPage:e}=await import(`./providers-config-page-cDeyluVG.js`);return{ProvidersConfigPage:e}},__vite__mapDeps([61,1,4,5,6,7,8,9,10,14,12,16,17,3,20,40,30,41,43,28,31,25,26,52,32,11,13,39,46,60,55,48,56,24,49]))).ProvidersConfigPage})),jn=(0,G.lazy)(async()=>({default:(await o(async()=>{let{ExtensionsConfigPage:e}=await import(`./extensions-WWEYpaUh.js`);return{ExtensionsConfigPage:e}},__vite__mapDeps([62,16,1,7,17,3,37,9,41,26]))).ExtensionsConfigPage})),Mn=(0,G.lazy)(async()=>({default:(await o(async()=>{let{ChannelsList:e}=await import(`./channels-list-page-CzXYZZtK.js`);return{ChannelsList:e}},__vite__mapDeps([63,1,4,5,6,7,8,9,10,16,17,3,20,21,23,24,42,43,28,31,13,46,60,34,55,48,56]))).ChannelsList})),Nn=(0,G.lazy)(async()=>({default:(await o(async()=>{let{RuntimeConfig:e}=await import(`./runtime-config-page-DNo4dzS1.js`);return{RuntimeConfig:e}},__vite__mapDeps([64,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,65,66,67,55]))).RuntimeConfig})),Pn=(0,G.lazy)(async()=>({default:(await o(async()=>{let{DesktopUpdateConfig:e}=await import(`./desktop-update-config-7tBum3MA.js`);return{DesktopUpdateConfig:e}},__vite__mapDeps([68,4,1,5,6,7,8,9,10,16,17,3,23,24,26,65,47]))).DesktopUpdateConfig})),Fn=(0,G.lazy)(async()=>({default:(await o(async()=>{let{SecurityConfig:e}=await import(`./security-config-B38PLI3M.js`);return{SecurityConfig:e}},__vite__mapDeps([69,16,1,7,17,3]))).SecurityConfig})),In=(0,G.lazy)(async()=>({default:(await o(async()=>{let{SecretsConfigPage:e}=await import(`./secrets-config-page-iT1wamQp.js`);return{SecretsConfigPage:e}},__vite__mapDeps([70,1,4,5,6,7,8,9,10,16,17,3,25,66,39,55,48]))).SecretsConfigPage})),Ln=(0,G.lazy)(async()=>({default:(await o(async()=>{let{PrivacySettingsPage:e}=await import(`./privacy-settings-page-CE-xF9bo.js`);return{PrivacySettingsPage:e}},__vite__mapDeps([71,4,1,5,6,7,8,9,10,16,17,3,48]))).PrivacySettingsPage})),Rn=(0,G.lazy)(async()=>({default:(await o(async()=>{let{DesktopCapabilitiesPage:e}=await import(`./desktop-capabilities-page-BJNGkq4q.js`);return{DesktopCapabilitiesPage:e}},__vite__mapDeps([72,16,1,7,17,3,45]))).DesktopCapabilitiesPage})),zn=(0,G.lazy)(async()=>({default:(await o(async()=>{let{RemoteAccessPage:e}=await import(`./remote-CV5wQVVj.js`);return{RemoteAccessPage:e}},__vite__mapDeps([73,2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50]))).RemoteAccessPage})),Bn=(0,G.lazy)(async()=>({default:(await o(async()=>{let{McpMarketplacePage:e}=await import(`./mcp-marketplace-page-CATnpZ2Q.js`);return{McpMarketplacePage:e}},__vite__mapDeps([74,18,1,4,5,6,7,8,9,10,11,12,13,16,17,3,19,15,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35]))).McpMarketplacePage}));function Vn(){return(0,K.jsx)(`div`,{className:`h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40`})}function Hn({children:e}){return(0,K.jsx)(G.Suspense,{fallback:(0,K.jsx)(Vn,{}),children:e})}function $(e){return(0,K.jsx)(Hn,{children:e})}var Un=[{path:`/projects/:projectId/:tab`,element:$((0,K.jsx)(Q,{view:`projects`}))},{path:`/projects`,element:$((0,K.jsx)(Q,{view:`projects`}))},{path:`/chat/skills`,redirectTo:`/skills`},{path:`/chat/cron`,redirectTo:`/cron`},{path:`/chat/agents`,redirectTo:`/agents`},{path:`/chat/:sessionId?`,element:$((0,K.jsx)(Q,{view:`chat`}))},{path:`/agents`,element:$((0,K.jsx)(Q,{view:`agents`}))},{path:`/skills`,element:$((0,K.jsx)(Q,{view:`skills`}))},{path:`/skills/scenes/:scene`,element:$((0,K.jsx)(Q,{view:`skills`}))},{path:`/cron`,element:$((0,K.jsx)(Q,{view:`cron`}))},{path:`/inbox/:deliveryId?`,element:$((0,K.jsx)(Q,{view:`inbox`}))},{path:`/apps/panel/:appId`,element:$((0,K.jsx)(Q,{view:`panel-app`}))},{path:`/appearance`,element:$((0,K.jsx)(Dn,{}))},{path:`/keyboard-shortcuts`,element:$((0,K.jsx)(On,{}))},{path:`/model`,element:$((0,K.jsx)(En,{}))},{path:`/search`,element:$((0,K.jsx)(kn,{}))},{path:`/providers`,element:$((0,K.jsx)(An,{}))},{path:`/extensions`,element:$((0,K.jsx)(jn,{}))},{path:`/channels`,element:$((0,K.jsx)(Mn,{}))},{path:`/runtime`,element:$((0,K.jsx)(Nn,{}))},{path:`/updates`,element:$((0,K.jsx)(Pn,{}))},{path:`/remote`,element:$((0,K.jsx)(zn,{}))},{path:`/security`,element:$((0,K.jsx)(Fn,{}))},{path:`/privacy`,element:$((0,K.jsx)(Ln,{}))},{path:`/desktop-capabilities`,element:$((0,K.jsx)(Rn,{}))},{path:`/secrets`,element:$((0,K.jsx)(In,{}))},{path:`/settings`,element:(0,K.jsx)(zt,{})},{path:`/marketplace/skills`,redirectTo:`/skills`},{path:`/marketplace`,redirectTo:`/skills`},{path:`/marketplace/mcp`,element:$((0,K.jsx)(Bn,{}))},{path:`/`,redirectTo:`/chat`},{path:`*`,redirectTo:`/chat`}];function Wn(e){return`redirectTo`in e?(0,K.jsx)(c,{path:e.path,element:(0,K.jsx)(p,{to:e.redirectTo,replace:!0})},e.path):(0,K.jsx)(c,{path:e.path,element:e.element},e.path)}function Gn(){return(0,K.jsx)(d,{children:Un.map(Wn)})}function Kn(){return Cn(S),ne(),(0,G.useEffect)(()=>(C.start(),()=>{C.stop()}),[]),(0,K.jsxs)(ze,{children:[(0,K.jsx)(Ot,{}),(0,K.jsx)(He,{}),(0,K.jsx)(Rt,{children:(0,K.jsx)(Gn,{})}),(0,K.jsx)(G.Suspense,{fallback:null,children:(0,K.jsx)(Tn,{})}),(0,K.jsx)(ct,{}),(0,K.jsx)(Ae,{})]})}function qn(){let e=_(),t=e.isError&&te(e.error);return e.isLoading&&!e.isError||t||e.isError?(0,K.jsx)(Kn,{}):e.data?.enabled&&!e.data.authenticated?(0,K.jsx)(Tt,{username:e.data.username}):(0,K.jsx)(Kn,{})}function Jn(){let{theme:e}=st();return(0,G.useEffect)(()=>{dt()},[]),(0,G.useEffect)(()=>{pt.syncTheme(e)},[e]),(0,K.jsxs)(h,{client:S,children:[(0,K.jsx)(qn,{}),(0,K.jsx)(ft,{}),(0,K.jsx)(b,{position:`top-right`,richColors:!0,offset:{top:window.nextclawDesktop?.platform===`win32`?56:44,right:72},mobileOffset:window.nextclawDesktop?.platform===`win32`?56:void 0,style:wn})]})}await We();var Yn=window.nextclawDesktop?.platform===`win32`?s:f;(0,Dt.createRoot)(document.getElementById(`root`)).render((0,K.jsx)(G.StrictMode,{children:(0,K.jsx)(lt,{children:(0,K.jsx)(bt,{children:(0,K.jsx)(Yn,{children:(0,K.jsx)(Jn,{})})})})}));
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/projects-O3GTERwP.js","assets/chunk-DF37yw5_.js","assets/app-presenter-provider-V0xnU_Wb.js","assets/preload-helper-ca-nBW7U.js","assets/select-CG5YWnwe.js","assets/dist-C5I0v8Qn.js","assets/dist-BiIcnf9j.js","assets/utils-CBZPzC_b.js","assets/es2015-cuwbYI-l.js","assets/createLucideIcon-BNKf0_kc.js","assets/chevron-down-BL-yMYcX.js","assets/dialog-Xe73hpQz.js","assets/dist-czPa8xFO.js","assets/x-DdXOqLnX.js","assets/popover-NkrFlWHp.js","assets/tooltip-DYcuWhuP.js","assets/api-DqzQ-_3w.js","assets/i18n-20rSH40D.js","assets/mcp-marketplace-page-FfIfEo6w.js","assets/doc-browser-BJrre2S_.js","assets/search-CUe41wjm.js","assets/book-open-xqEj1OLE.js","assets/boxes-D6uPnkGo.js","assets/navigation-link-BAQjgx2F.js","assets/host-capabilities-B107nwS3.js","assets/plus-LA8-jpxP.js","assets/refresh-cw-h9Xq3LY3.js","assets/doc-browser-context-TILuCY5c.js","assets/middleware-0o3JF3tS.js","assets/use-panel-app-scroll-restoration-ZnicIfo3.js","assets/circle-alert-lSa3LRvS.js","assets/loader-circle-K1BDdHR5.js","assets/confirm-dialog-BTKCWMn6.js","assets/i18n-provider-BPRq6S7O.js","assets/tag-chip-B1AYPOKL.js","assets/skeleton-Drvn83YW.js","assets/katex-B26hhTOT.js","assets/puzzle-D6gulz7u.js","assets/app-data-C54N2p8b.js","assets/trash-2-BPPYt2NV.js","assets/ellipsis-C5YXdOUx.js","assets/eye-C84inPcV.js","assets/tabs-BuE0qKMh.js","assets/use-viewport-layout-BS18drMT.js","assets/theme-provider-DzvAi3pe.js","assets/use-desktop-capabilities-BkuRd2cY.js","assets/logo-badge-C-5-zim6.js","assets/card-BhfAZv5L.js","assets/use-config-BEdbtpD4.js","assets/provider-models-hrHMcHqg.js","assets/app-presenter-provider-jNGlmBLe.css","assets/circle-dashed-CU3yApvP.js","assets/settings-2-CE3ELQyk.js","assets/model-config-page-Bcm6-pCX.js","assets/provider-scoped-model-input-BQsugx1v.js","assets/form-actions-BRESe-m_.js","assets/config-hints-B_C9DAp5.js","assets/appearance-settings-page-83T2AtVm.js","assets/keyboard-shortcuts-settings-page-CkQbSKwI.js","assets/search-config-page-DWKlMHgH.js","assets/config-split-page-DqAXKLmG.js","assets/providers-config-page-BDEdHJbw.js","assets/extensions-CVUFK6Jj.js","assets/channels-list-page-Bv7CVSqV.js","assets/runtime-config-page-BHTKwgDi.js","assets/rotate-cw-B6xm41Wn.js","assets/save-fff_WpY2.js","assets/pwa-D_nZUwG0.js","assets/desktop-update-config-PmofcFf6.js","assets/security-config-DmTDKKY4.js","assets/secrets-config-page-DiQL088Y.js","assets/privacy-settings-page-B1sHLAc1.js","assets/desktop-capabilities-page-zLzCSB7A.js","assets/remote-CFWp4wyH.js","assets/mcp-marketplace-page-sH7VptN_.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./chunk-DF37yw5_.js";import{t}from"./client-BtGBwLTs.js";import{A as n,M as r,O as i,t as a}from"./utils-CBZPzC_b.js";import{t as o}from"./preload-helper-ca-nBW7U.js";import{a as s,c,d as l,f as u,l as d,r as f,s as p,u as m}from"./navigation-link-BAQjgx2F.js";import{$t as ee,An as h,Gt as g,Ht as _,Lt as v,Vt as te,Yt as y,_n as b,dn as ne,en as re,fn as x,gn as S,on as C,vn as ie,x as w}from"./api-DqzQ-_3w.js";import{S as ae,b as oe,n as se,p as ce,u as le}from"./mcp-marketplace-page-FfIfEo6w.js";import{A as ue,B as de,D as fe,F as pe,H as T,I as E,L as me,M as he,N as ge,O as _e,R as D,S as ve,U as ye,V as be,_ as xe,a as Se,at as Ce,b as we,c as Te,d as Ee,dt as De,f as Oe,g as ke,h as Ae,i as O,it as k,j as A,k as je,l as Me,lt as Ne,m as Pe,n as j,o as Fe,ot as Ie,p as Le,s as Re,t as ze,u as Be,w as Ve,x as He,z as Ue}from"./app-presenter-provider-V0xnU_Wb.js";import{i as We,s as M}from"./i18n-20rSH40D.js";import{t as Ge}from"./createLucideIcon-BNKf0_kc.js";import{c as Ke,f as qe,g as Je,l as Ye,s as Xe}from"./app-data-C54N2p8b.js";import{t as Ze}from"./chevron-down-BL-yMYcX.js";import{t as Qe}from"./ellipsis-C5YXdOUx.js";import{a as $e,i as et,n as tt,r as nt,t as rt}from"./select-CG5YWnwe.js";import{t as it}from"./provider-scoped-model-input-BQsugx1v.js";import{t as at}from"./eye-C84inPcV.js";import{t as N}from"./use-viewport-layout-BS18drMT.js";import{t as ot}from"./plus-LA8-jpxP.js";import{n as st,s as ct,t as lt}from"./theme-provider-DzvAi3pe.js";import{t as ut}from"./settings-2-CE3ELQyk.js";import{n as dt,r as ft,t as pt}from"./pwa-D_nZUwG0.js";import{n as mt}from"./confirm-dialog-BTKCWMn6.js";import{t as ht}from"./trash-2-BPPYt2NV.js";import{a as P,i as F,n as I,o as L,r as R,t as z}from"./dialog-Xe73hpQz.js";import{i as gt,r as _t,t as vt}from"./popover-NkrFlWHp.js";import{n as yt,t as bt}from"./i18n-provider-BPRq6S7O.js";import{n as xt,t as St}from"./doc-browser-context-TILuCY5c.js";import{t as Ct}from"./tag-chip-B1AYPOKL.js";import{n as B,t as V}from"./card-BhfAZv5L.js";import{n as wt}from"./provider-models-hrHMcHqg.js";import{f as H,p as U,t as W}from"./use-config-BEdbtpD4.js";import{t as Tt}from"./login-page-f8qQ4xKY.js";var Et=Ge(`Gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),Dt=t(),G=e(r(),1);function Ot(){let e=j();return(0,G.useEffect)(()=>(e.chatCompletionNotificationManager.start(),()=>{e.chatCompletionNotificationManager.stop()}),[e.chatCompletionNotificationManager]),null}var kt=`NextClaw`,At=[{prefix:`/marketplace/mcp`,key:`marketplaceMcpPageTitle`},{prefix:`/marketplace/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/marketplace`,key:`marketplace`},{prefix:`/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/cron`,key:`cronPageTitle`},{prefix:`/agents`,key:`agentsPageTitle`},{prefix:`/projects`,key:`projectsTitle`},{prefix:`/chat`,key:`chat`},{prefix:`/model`,key:`modelPageTitle`},{prefix:`/search`,key:`searchPageTitle`},{prefix:`/providers`,key:`providersPageTitle`},{prefix:`/channels`,key:`channelsPageTitle`},{prefix:`/runtime`,key:`runtimePageTitle`},{prefix:`/updates`,key:`runtimeUpdatesPageTitle`},{prefix:`/remote`,key:`remotePageTitle`},{prefix:`/security`,key:`authSecurityTitle`},{prefix:`/secrets`,key:`secretsPageTitle`}];function jt(e,t){return e===t||e.startsWith(`${t}/`)}function Mt(e){let t=e.toLowerCase();for(let{prefix:e,key:n}of At)if(jt(t,e))return M(n);return M(`settings`)}function Nt(e){let t=e.toLowerCase();return t===`localhost`||t.endsWith(`.localhost`)||t===`::1`||t===`[::1]`||t.startsWith(`127.`)}function Pt(e){let t=e?.host.trim(),n=e?.hostname.trim(),r=e?.port.trim();return!t||!n?null:Nt(n)?r||null:t}function Ft(e,t){let n=Pt(t);return`${kt}${n?` ${n}`:``} - ${Mt(e)}`}var K=n(),It={..._e,...le};function Lt({children:e,sideDockManager:t}){let{isOpen:n,mode:r}=xt();ce();let{pathname:i}=m(),a=l(),o=O(),{language:s}=yt(),{isMobile:c}=N(),u=xe(),d=Fe(e=>e.isVisible);Fe(e=>e.pinnedItems);let f={getDockState:t.getDockState,pinTab:t.pinTab,unpinTab:t.unpinTab},p=(0,G.useCallback)(e=>{let t=je(e);if(t)return[{key:`chat`,items:[{key:`add-to-chat`,icon:(0,K.jsx)(Ce,{className:`h-4 w-4`}),label:M(`docBrowserAddToChat`),restoreFocus:!1,onSelect:()=>{let e=i===`/chat`||i.startsWith(`/chat/`),n=i===`/chat`?null:Be(i.slice(6));o.chatComposerIntentManager.requestUiResourceReference({targetSessionKey:e?n:null,reference:t}),e||a(Me)}}]}]},[a,i,o]);return(0,G.useEffect)(()=>{document.title=Ft(i,window.location)},[i,s]),c&&u!==`win32`?(0,K.jsx)(ke,{pathname:i,isDocBrowserOpen:n,docBrowserDockControls:f,docBrowserRenderers:It,docBrowserTabMenuGroups:p,topbarLeadingInset:u===`darwin`?`4.75rem`:void 0,children:e}):(0,K.jsx)(Oe,{pathname:i,isMobileLayout:c,isDocBrowserOpen:n,docBrowserMode:r,docBrowserDockControls:f,docBrowserRenderers:It,docBrowserTabMenuGroups:p,sideDock:d?(0,K.jsx)(Se,{manager:t}):null,children:e})}function Rt({children:e}){let t=O();return(0,K.jsx)(St,{manager:t.docBrowserManager,children:(0,K.jsx)(Lt,{sideDockManager:t.sideDockManager,children:e})})}function zt(){let{isMobile:e}=N();return e?(0,K.jsx)(Pe,{}):(0,K.jsx)(p,{to:`/model`,replace:!0})}var Bt=new Intl.NumberFormat;function Vt({agent:e,defaults:t,runtimeOptions:n,defaultRuntime:r,defaultRuntimeLabel:i,onOpenChange:a,onEdit:o}){if(!e)return null;let s=Ht(e.model,t?.model),c=Wt({agent:e,defaults:t,runtimeOptions:n,defaultRuntime:r,defaultRuntimeLabel:i}),l=Ut(e.contextTokens,t?.contextTokens??2e5),u=Ut(e.reservedContextTokens,t?.reservedContextTokens),d=Ht(e.thinkingDefault,t?.thinkingDefault??`off`),f=q(e.runtimeConfig??e.engineConfig,t?.engineConfig),p=q(e.models,t?.models);return(0,K.jsx)(z,{open:e!==null,onOpenChange:a,children:(0,K.jsxs)(I,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-popover p-0 sm:max-h-[720px] sm:max-w-2xl`,children:[(0,K.jsx)(`div`,{className:`shrink-0 px-5 pb-3 pt-5`,children:(0,K.jsx)(P,{className:`text-left`,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,K.jsx)(he,{agentId:e.id,displayName:e.displayName,avatarUrl:e.avatarUrl,className:`h-10 w-10 shrink-0`}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(L,{className:`truncate text-base`,children:e.displayName?.trim()||e.id}),(0,K.jsxs)(R,{className:`truncate text-xs`,children:[`@`,e.id]})]})]})})}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto overscroll-contain px-5 py-3`,children:[(0,K.jsxs)(J,{icon:Je,title:M(`agentsDetailsIdentitySection`),children:[(0,K.jsx)(Y,{label:M(`agentsDetailsFieldDisplayName`),value:e.displayName?.trim()||e.id}),(0,K.jsx)(Y,{label:M(`agentsDetailsFieldId`),value:e.id,mono:!0}),(0,K.jsx)(Y,{label:M(`agentsDetailsFieldDescription`),value:e.description?.trim()||M(`agentsDetailsEmptyValue`),wide:!0}),(0,K.jsx)(Y,{label:M(`agentsDetailsFieldWorkspace`),value:e.workspace??M(`agentsDetailsUnsetValue`),mono:!0,wide:!0})]}),(0,K.jsxs)(J,{icon:mt,title:M(`agentsDetailsRuntimeSection`),children:[(0,K.jsx)(Y,{label:M(`agentsDetailsFieldModel`),value:s.value,source:s.source}),(0,K.jsx)(Y,{label:M(`agentsDetailsFieldRuntime`),value:c.value,source:c.source}),(0,K.jsx)(Y,{label:M(`agentsDetailsFieldRuntimeConfig`),value:f.value,source:f.source,mono:!0,prewrap:!0})]}),(0,K.jsxs)(J,{icon:Et,title:M(`agentsDetailsContextSection`),children:[(0,K.jsx)(Y,{label:M(`agentsDetailsFieldContextTokens`),value:l.value,source:l.source}),(0,K.jsx)(Y,{label:M(`agentsDetailsFieldReservedContextTokens`),value:u.value,source:u.source})]}),(0,K.jsxs)(J,{icon:De,title:M(`agentsDetailsBehaviorSection`),children:[(0,K.jsx)(Y,{label:M(`agentsDetailsFieldThinkingDefault`),value:d.value,source:d.source}),(0,K.jsx)(Y,{label:M(`agentsDetailsFieldModelOverrides`),value:p.value,source:p.source,mono:!0,prewrap:!0}),(0,K.jsx)(Y,{label:M(`agentsDetailsFieldAvatar`),value:e.avatar??M(`agentsDetailsUnsetValue`),mono:!0})]})]}),(0,K.jsxs)(F,{className:`shrink-0 px-5 pb-4 pt-2`,children:[(0,K.jsx)(y,{type:`button`,variant:`ghost`,onClick:()=>a(!1),children:M(`cancel`)}),(0,K.jsxs)(y,{type:`button`,variant:`primary`,className:`px-4`,onClick:()=>o(e),children:[(0,K.jsx)(k,{className:`mr-2 h-4 w-4`}),M(`agentsDetailsEditAction`)]})]})]})})}function Ht(e,t){let n=e?.trim();return n?{value:n,source:`override`}:{value:t?.trim()||M(`agentsDetailsUnsetValue`),source:`default`}}function Ut(e,t){return typeof e==`number`?{value:Bt.format(e),source:`override`}:{value:typeof t==`number`?Bt.format(t):M(`agentsDetailsUnsetValue`),source:`default`}}function Wt(e){let{agent:t,defaults:n,runtimeOptions:r,defaultRuntime:i,defaultRuntimeLabel:a}=e,o=t.runtime?.trim()||t.engine?.trim();if(o)return{value:Gt(o,r,a),source:`override`};let s=n?.engine?.trim()||i;return{value:s?Gt(s,r,a):a,source:`default`}}function Gt(e,t,n){let r=E(e);return r?t.find(e=>e.value===r)?.label??D(r):n}function q(e,t){return Kt(e)?{value:JSON.stringify(e,null,2),source:`override`}:{value:Kt(t)?JSON.stringify(t,null,2):M(`agentsDetailsUnsetValue`),source:`default`}}function Kt(e){return!!(e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length>0)}function J(e){let{icon:t,title:n,children:r}=e;return(0,K.jsxs)(`section`,{className:`space-y-2 border-t border-border/60 pt-3 first:border-t-0 first:pt-0`,children:[(0,K.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-xs font-semibold leading-5 text-foreground`,children:[(0,K.jsx)(t,{className:`h-3.5 w-3.5 text-muted-foreground`}),n]}),(0,K.jsx)(`dl`,{className:`grid min-w-0 gap-x-6 gap-y-2.5 pl-5 sm:grid-cols-2`,children:r})]})}function Y(e){let{label:t,value:n,source:r,mono:i=!1,prewrap:o=!1,wide:s=!1}=e,c=o&&n.trim().startsWith(`{`),l=i&&(!o||c);return(0,K.jsxs)(`div`,{className:a(`grid min-w-0 grid-cols-[10rem_minmax(0,1fr)] items-baseline gap-x-2`,(s||c)&&`sm:col-span-2`),children:[(0,K.jsx)(`dt`,{className:`flex min-w-0 items-baseline leading-5`,children:(0,K.jsx)(`span`,{className:`whitespace-nowrap text-xs font-medium text-muted-foreground`,children:t})}),(0,K.jsxs)(`dd`,{className:a(`min-w-0 break-words text-xs leading-5 text-foreground`,c?`max-h-28 overflow-auto whitespace-pre-wrap rounded bg-muted/50 px-2 py-1.5 text-left`:``),children:[(0,K.jsx)(`span`,{className:l?`font-mono`:void 0,children:n}),r?(0,K.jsx)(qt,{source:r}):null]})]})}function qt({source:e}){return(0,K.jsxs)(`span`,{className:a(`ml-1 whitespace-nowrap text-xs font-normal leading-5`,e===`override`?`text-blue-500`:`text-muted-foreground`),children:[`(`,M(e===`override`?`agentsDetailsAgentOverride`:`agentsDetailsInheritedDefault`),`)`]})}function Jt({form:e,disabled:t=!1,onChange:n}){return(0,K.jsxs)(`details`,{className:`group rounded-2xl border border-border bg-card`,children:[(0,K.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-4 py-3 text-sm font-semibold text-foreground [&::-webkit-details-marker]:hidden`,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(ut,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,K.jsx)(`span`,{className:`truncate`,children:M(`agentsAdvancedConfigToggle`)})]}),(0,K.jsx)(Ze,{className:`h-4 w-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180`})]}),(0,K.jsxs)(`div`,{className:`space-y-4 border-t border-border/60 px-4 py-4`,children:[(0,K.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:M(`agentsAdvancedConfigDescription`)}),(0,K.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:(0,K.jsx)(Yt,{label:M(`agentsAdvancedContextTokensLabel`),value:e.contextTokens,min:1e3,step:1e3,disabled:t,onChange:e=>n({contextTokens:e})})})]})]})}function Yt(e){let{label:t,value:n,min:r,step:i,disabled:a,onChange:o}=e;return(0,K.jsxs)(`label`,{className:`space-y-2 text-sm font-medium text-foreground`,children:[(0,K.jsx)(`span`,{children:t}),(0,K.jsx)(g,{type:`number`,min:r,step:i,value:n,disabled:a,placeholder:M(`agentsAdvancedInheritPlaceholder`),"aria-label":t,onChange:e=>o(e.target.value)})]})}function Xt(e){return{displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,model:e.model??``,runtime:e.runtime??e.engine??``,contextTokens:Zt(e.contextTokens)}}function Zt(e){return typeof e==`number`?String(e):``}function Qt(e){let{runtimeOptions:t,currentRuntime:n}=e,r=n.trim();if(!r)return t;let i=E(r);return t.some(e=>e.value===i)?t:[...t,{value:i,label:D(i),icon:null,ready:!1,reason:`unavailable`,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}].sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))}function $t({value:e,disabled:t=!1,runtimeOptions:n,defaultRuntime:r,onChange:i}){let a=e.trim()?E(e):``,o=Qt({runtimeOptions:n,currentRuntime:e}),s=o.find(e=>e.value===a)??null,c=s?.reasonMessage?.trim()||(s?.ready===!1?M(`agentsRuntimeUnavailableHelp`):``);return(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsxs)(rt,{value:a||r,onValueChange:e=>i(e===r?``:e),disabled:t,children:[(0,K.jsx)(et,{"aria-label":M(`agentsCardRuntimeLabel`),className:`rounded-xl`,children:(0,K.jsx)($e,{placeholder:M(`agentsRuntimeSelectPlaceholder`)})}),(0,K.jsx)(tt,{className:`rounded-xl`,children:o.map(e=>(0,K.jsx)(nt,{value:e.value,disabled:e.ready===!1&&e.value!==a,className:`rounded-lg`,children:e.label},e.value))})]}),c?(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c}):null]})}function en({agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,K.jsx)(z,{open:e!==null,onOpenChange:a,children:e?(0,K.jsx)(tn,{agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e.id):null})}function tn(e){let{agent:t,pending:n,providerCatalog:r,runtimeOptions:i,defaultRuntime:a,onOpenChange:o,onSubmit:s}=e,[c,l]=(0,G.useState)(Xt(t));return(0,K.jsxs)(I,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-popover p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,K.jsx)(`div`,{className:`shrink-0 border-b border-border px-6 py-6`,children:(0,K.jsxs)(P,{className:`text-left`,children:[(0,K.jsx)(L,{children:M(`agentsEditDialogTitle`)}),(0,K.jsx)(R,{children:M(`agentsEditDialogDescription`)})]})}),(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsx)(ae,{tone:`warning`,title:M(`agentsEditHomeReadonly`),description:M(`agentsEditHomeReadonlyHint`),children:(0,K.jsx)(`div`,{className:`break-all text-sm text-amber-950`,children:t.workspace??`-`})}),(0,K.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,K.jsx)(g,{value:c.displayName,onChange:e=>l(t=>({...t,displayName:e.target.value})),placeholder:M(`agentsFormNamePlaceholder`)}),(0,K.jsx)(se,{value:c.description,onChange:e=>l(t=>({...t,description:e.target.value})),placeholder:M(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,K.jsx)(g,{value:c.avatar,onChange:e=>l(t=>({...t,avatar:e.target.value})),placeholder:M(`agentsFormAvatarPlaceholder`)}),(0,K.jsx)(it,{value:c.model,onChange:e=>l(t=>({...t,model:e})),providerCatalog:r,disabled:n,className:`md:col-span-2`}),(0,K.jsx)($t,{value:c.runtime,onChange:e=>l(t=>({...t,runtime:e})),runtimeOptions:i,defaultRuntime:a,disabled:n})]}),(0,K.jsx)(Jt,{form:c,disabled:n,onChange:e=>l(t=>({...t,...e}))})]})}),(0,K.jsxs)(F,{className:`shrink-0 border-t border-border px-6 py-5`,children:[(0,K.jsx)(y,{type:`button`,variant:`ghost`,onClick:()=>o(!1),disabled:n,children:M(`cancel`)}),(0,K.jsxs)(y,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>s(t.id,c),disabled:n,children:[(0,K.jsx)(k,{className:`mr-2 h-4 w-4`}),M(`agentsEditSaveAction`)]})]})]})}var nn=`请直接创建一个默认示例 Agent,不要问我问题。创建完成后,简单告诉我它能做什么。`;function rn(e){let t=e.trim();if(!t)return null;let n=Number(t);if(!Number.isFinite(n))throw Error(M(`agentsAdvancedInvalidNumberError`));return Math.trunc(n)}function an(e){return{displayName:e.displayName,description:e.description,avatar:e.avatar,model:e.model,...e.runtime.trim()?{runtime:e.runtime.trim()}:{runtime:``},contextTokens:rn(e.contextTokens)}}function X(e){let{icon:t,label:n,disabled:r=!1,destructive:i=!1,onClick:o}=e;return(0,K.jsxs)(`button`,{type:`button`,className:a(`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,i?`text-destructive hover:bg-destructive/10`:`text-foreground hover:bg-muted`),onClick:o,disabled:r,children:[(0,K.jsx)(t,{className:`h-4 w-4 shrink-0`}),(0,K.jsx)(`span`,{children:n})]})}function on(e){let{agent:t,runtimeOptions:n,defaultRuntimeLabel:r,updatePending:i,deletePending:a,onStartChat:o,onView:s,onEdit:c,onDelete:l}=e,u=t.runtime?.trim()||t.engine?.trim()||``,d=u?n.find(e=>e.value===E(u))?.label??D(u):r;return(0,K.jsx)(V,{className:`group overflow-hidden border border-border bg-card shadow-none transition-colors duration-200 hover:border-border/80`,children:(0,K.jsxs)(B,{className:`relative flex h-full flex-col gap-3 px-3.5 py-3.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-2.5 pr-16`,children:[(0,K.jsx)(he,{agentId:t.id,displayName:t.displayName,avatarUrl:t.avatarUrl,className:`h-9 w-9 shrink-0`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(`div`,{className:`truncate text-sm font-semibold text-foreground`,children:t.displayName?.trim()||t.id}),t.builtIn?(0,K.jsxs)(Ct,{tone:`warning`,className:`h-5 gap-1 border-amber-200 bg-amber-50 px-1.5 text-[10px] text-amber-700`,children:[(0,K.jsx)(qe,{className:`h-3 w-3`}),M(`agentsCardBuiltInTag`)]}):null]}),(0,K.jsxs)(`div`,{className:`truncate text-xs text-muted-foreground`,children:[`@`,t.id]})]})]}),(0,K.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 flex items-center gap-1 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,children:[(0,K.jsx)(y,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-muted-foreground hover:text-foreground`,"aria-label":M(`agentsCardStartChat`),title:M(`agentsCardStartChat`),onClick:o,children:(0,K.jsx)(Ie,{className:`h-4 w-4`})}),(0,K.jsxs)(vt,{children:[(0,K.jsx)(gt,{asChild:!0,children:(0,K.jsx)(y,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-muted-foreground hover:text-foreground`,"aria-label":M(`chatSessionMoreActions`),title:M(`chatSessionMoreActions`),children:(0,K.jsx)(Qe,{className:`h-4 w-4`})})}),(0,K.jsxs)(_t,{align:`end`,className:`w-44 p-1.5`,children:[(0,K.jsx)(X,{icon:at,label:M(`agentsViewDetailsAction`),onClick:s}),(0,K.jsx)(X,{icon:k,label:M(`agentsEditAction`),onClick:c,disabled:i}),t.builtIn?null:(0,K.jsx)(X,{icon:ht,label:M(`agentsRemoveAction`),onClick:l,disabled:a,destructive:!0})]})]})]}),(0,K.jsx)(`p`,{className:`line-clamp-2 min-h-10 text-sm leading-5 text-muted-foreground`,children:t.description?.trim()||(t.builtIn?M(`agentsCardBuiltInSummary`):M(`agentsCardCustomSummary`))}),(0,K.jsxs)(`div`,{className:`mt-auto grid gap-2 border-t border-border/60 pt-2 text-xs text-muted-foreground`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(mt,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/60`}),(0,K.jsx)(`span`,{className:`truncate`,children:d})]}),(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(Ne,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/60`}),(0,K.jsx)(`span`,{className:`truncate`,children:t.workspace??`-`})]})]})]})})}function sn(){let e=T(),t=Xe(),n=W(),r=U(),i=H(),a=Re(),o=Ye(),s=Ke(),[c,l]=(0,G.useState)(null),[u,d]=(0,G.useState)(null),f=(0,G.useMemo)(()=>t.data?.agents??[],[t.data?.agents]),p=(0,G.useMemo)(()=>[...f].sort((e,t)=>Number(!!t.builtIn)-Number(!!e.builtIn)||e.id.localeCompare(t.id)),[f]),m=(0,G.useMemo)(()=>wt({config:n.data,providersView:r.data,templatesView:i.data,onlyConfigured:!0}),[n.data,r.data,i.data]),h=(0,G.useMemo)(()=>pe(a.data?.options??[]),[a.data?.options]),g=(0,G.useMemo)(()=>E(a.data?.defaultType??`native`),[a.data?.defaultType]),_=(0,G.useMemo)(()=>h.find(e=>e.value===g)?.label??D(g),[g,h]),v=n.data?.agents.defaults,te=e=>{l(e)},b=e=>{d(e)},ne=async(e,t)=>{let n;try{n=an(t)}catch(e){ie.error(e instanceof Error?e.message:M(`agentsAdvancedParseFailed`));return}await o.mutateAsync({agentId:e,data:n}),d(null)},x=t=>{e.chatSessionListManager.startAgentDraftChat(t.id,me(t,g))},S=()=>{e.chatSessionListManager.startAgentDraftChat(`main`,g,nn)};return(0,K.jsxs)(re,{className:`space-y-6`,children:[(0,K.jsx)(ee,{headingLevel:1,title:M(`agentsHeroEyebrow`),description:M(`agentsHeroDescription`),actions:(0,K.jsxs)(y,{type:`button`,variant:`primary`,className:`h-9 shrink-0 rounded-xl px-4 text-sm font-semibold`,onClick:S,children:[(0,K.jsx)(ot,{className:`mr-2 h-4 w-4`}),M(`agentsCreateButton`)]})}),(0,K.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:t.isLoading?(0,K.jsx)(V,{className:`md:col-span-2 xl:col-span-3 border-dashed border-border bg-card/70`,children:(0,K.jsx)(B,{className:`py-14 text-center text-sm text-muted-foreground`,children:M(`agentsLoading`)})}):p.length===0?(0,K.jsx)(V,{className:`md:col-span-2 xl:col-span-3 overflow-hidden border-dashed border-border bg-gradient-subtle`,children:(0,K.jsxs)(B,{className:`flex min-h-[240px] flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,K.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-card/80 shadow-[0_18px_44px_rgba(0,0,0,0.08)]`,children:(0,K.jsx)(Je,{className:`h-8 w-8 text-warning`})}),(0,K.jsx)(`div`,{className:`text-lg font-semibold text-foreground`,children:M(`agentsEmpty`)}),(0,K.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-muted-foreground`,children:M(`agentsEmptyDescription`)}),(0,K.jsxs)(y,{type:`button`,variant:`primary`,className:`mt-5 rounded-2xl px-5`,onClick:S,children:[(0,K.jsx)(ot,{className:`mr-2 h-4 w-4`}),M(`agentsCreateButton`)]})]})}):p.map(e=>(0,K.jsx)(on,{agent:e,runtimeOptions:h,defaultRuntimeLabel:_,updatePending:o.isPending,deletePending:s.isPending,onStartChat:()=>x(e),onView:()=>te(e),onEdit:()=>b(e),onDelete:()=>s.mutate({agentId:e.id})},e.id))}),(0,K.jsx)(Vt,{agent:c,defaults:v,runtimeOptions:h,defaultRuntime:g,defaultRuntimeLabel:_,onOpenChange:e=>{e||l(null)},onEdit:e=>{l(null),d(e)}}),(0,K.jsx)(en,{agent:u,pending:o.isPending,providerCatalog:m,runtimeOptions:h,defaultRuntime:g,onOpenChange:e=>{!e&&!o.isPending&&d(null)},onSubmit:ne})]})}var cn=(0,G.lazy)(async()=>({default:(await o(async()=>{let{ProjectsPage:e}=await import(`./projects-O3GTERwP.js`);return{ProjectsPage:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52]))).ProjectsPage})),Z=`max-w-[min(1180px,100%)]`;function ln(e){return e===`projects`?`relative flex flex-1 min-h-0 overflow-hidden bg-background`:`flex-1 min-h-0 overflow-hidden bg-background`}function un(e){let{routeSessionKey:t,syncRouteSessionSelection:n}=e;(0,G.useLayoutEffect)(()=>{n(t)},[t,n])}function dn({view:e,confirmDialog:t}){let{isMobile:n}=N(),r=A({restorationKey:`main-page:cron`}),i=A({restorationKey:`main-page:agents`}),{onScroll:a,scrollRef:o}=r,{onScroll:s,scrollRef:c}=i;return(0,K.jsxs)(`div`,{className:`h-full flex`,children:[n?null:(0,K.jsx)(Ee,{}),e===`chat`?n?(0,K.jsx)(Le,{}):(0,K.jsx)(ve,{}):(0,K.jsx)(`section`,{"data-theme-surface":`workspace`,className:ln(e),children:e===`projects`?(0,K.jsx)(G.Suspense,{fallback:(0,K.jsx)(`div`,{className:`h-full animate-pulse bg-card/30`}),children:(0,K.jsx)(cn,{})}):e===`inbox`?(0,K.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full flex-col py-4 sm:px-6 sm:py-5 ${Z}`,children:(0,K.jsx)(we,{})}):e===`panel-app`?(0,K.jsx)(fe,{}):e===`cron`?(0,K.jsx)(`div`,{ref:o,onScroll:a,className:`h-full overflow-auto custom-scrollbar`,children:(0,K.jsx)(`div`,{className:`mx-auto w-full px-4 py-4 sm:px-6 sm:py-5 ${Z}`,children:(0,K.jsx)(Ve,{})})}):e===`agents`?(0,K.jsx)(`div`,{ref:c,onScroll:s,className:`h-full overflow-auto custom-scrollbar`,children:(0,K.jsx)(`div`,{className:`mx-auto w-full px-4 py-4 sm:px-6 sm:py-5 ${Z}`,children:(0,K.jsx)(sn,{})})}):(0,K.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,K.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full flex-col px-4 py-4 sm:px-6 sm:py-5 ${Z}`,children:(0,K.jsx)(ue,{forcedType:`skills`})})})}),t]})}function fn(e){let t=T(),n=W(),r=U(),i=H(),a=de({limit:200}),o=Re(),s=e.sessionKey?.trim()||`draft-session`,c=Ue({sessionId:s});(0,G.useEffect)(()=>{t.chatQueryManager.syncSnapshot({configQuery:n,providersQuery:r,providerTemplatesQuery:i,sessionsQuery:a,sessionTypesQuery:o,sessionSkillsSessionId:s,sessionSkillsQuery:c})},[n,t.chatQueryManager,r,s,c,a,o,i])}function pn(){let e=T();(0,G.useEffect)(()=>v.eventBus.on(i.uiShowContent,t=>{e.chatThreadManager.handleUiShowContentEvent(t)}),[e])}function mn(){let{sessionId:e}=u(),t=(0,G.useMemo)(()=>Be(e),[e]);return{routeSessionKey:t,sessionKey:t??void 0}}function hn(){let e=T(),{confirm:t,ConfirmDialog:n}=oe(),r=m(),i=l();return(0,G.useEffect)(()=>{e.chatUiManager.syncState({pathname:r.pathname}),e.chatUiManager.bindActions({navigate:i,confirm:t})},[t,r.pathname,i,e]),(0,K.jsx)(n,{})}function gn({view:e}){let t=j();return(0,K.jsx)(be,{presenter:(0,G.useMemo)(()=>new Te(t),[t]),children:(0,K.jsx)(_n,{view:e})})}function _n({view:e}){let t=j(),n=T(),r=hn(),{routeSessionKey:i,sessionKey:a}=mn(),o=ge(e=>{let{snapshot:t}=e;return t.workspacePanelParentKey!==(a??null)||t.activeWorkspacePanelKind!==`child-session`?null:t.activeChildSessionKey?.trim()||null});return(0,G.useEffect)(()=>(t.chatCompletionNotificationManager.syncVisibleSessions([a,o]),()=>{t.chatCompletionNotificationManager.syncVisibleSessions([])}),[t.chatCompletionNotificationManager,a,o]),fn({sessionKey:a??null}),un({routeSessionKey:i,syncRouteSessionSelection:n.chatSessionListManager.syncRouteSessionSelection}),pn(),(0,K.jsx)(dn,{view:e,confirmDialog:r})}function Q({view:e}){return(0,K.jsx)(gn,{view:e})}function vn(e){let t=e.trim().toLowerCase();return t?!t.startsWith(`skills`):!0}function yn(e,t){t.startsWith(`mcp`)&&(e?.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}))}function bn(e,t){e&&vn(t)&&e.invalidateQueries({queryKey:[`config`]}),yn(e,t)}function xn(e){let t=e.trim().replace(/\\/g,`/`).replace(/\/+$/g,``);return/^[a-z]:/i.test(t)?t.toLowerCase():t}function Sn(e,t){if(!e)return;let n=xn(t);e.invalidateQueries({predicate:e=>e.queryKey[0]===`server-path-browse`&&typeof e.queryKey[1]==`string`&&xn(e.queryKey[1])===n})}function Cn(e){let t=(0,G.useRef)(!1);(0,G.useEffect)(()=>{let n=v.eventBus.on(i.connectionOpen,()=>{x.handleConnectionRestored(),C.refreshAfterRealtimeReconnect(),t.current&&(t.current=!1,e?.invalidateQueries({queryKey:[`ncp-sessions`]}))}),r=v.eventBus.on(i.connectionClose,()=>{x.handleConnectionInterrupted(null),t.current=!0}),a=v.eventBus.on(i.connectionError,e=>{x.handleConnectionInterrupted(e?.message??null),t.current=!0}),o=v.eventBus.on(i.configUpdated,({path:t})=>{bn(e,t)}),s=v.eventBus.on(i.serverPathChanged,({directoryPath:t})=>Sn(e,t)),c=v.eventBus.on(i.runtimeUpdateSnapshot,e=>{C.reportSnapshot(e)}),l=v.eventBus.on(i.sessionRunStatus,t=>{w(e,{type:`session.run-status`,payload:t})}),u=v.eventBus.on(i.sessionSummaryUpsert,t=>{w(e,{type:`session.summary.upsert`,payload:t})}),d=v.eventBus.on(i.sessionSummaryDelete,t=>{w(e,{type:`session.summary.delete`,payload:t})}),f=v.eventBus.on(i.error,e=>{console.error(`Realtime transport error:`,e.message)});return()=>{n(),r(),a(),o(),s(),c(),l(),u(),d(),f()}},[e])}var wn={"--width":`320px`},Tn=(0,G.lazy)(async()=>({default:(await ye()).AccountPanel})),En=(0,G.lazy)(async()=>({default:(await o(async()=>{let{ModelConfigPage:e}=await import(`./model-config-page-Bcm6-pCX.js`);return{ModelConfigPage:e}},__vite__mapDeps([53,1,16,7,17,3,21,9,54,4,5,6,8,10,14,12,49,23,24,31,27,28,55,35,48,56]))).ModelConfigPage})),Dn=(0,G.lazy)(async()=>({default:(await o(async()=>{let{AppearanceSettingsPage:e}=await import(`./appearance-settings-page-83T2AtVm.js`);return{AppearanceSettingsPage:e}},__vite__mapDeps([57,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50]))).AppearanceSettingsPage})),On=(0,G.lazy)(async()=>({default:(await o(async()=>{let{KeyboardShortcutsSettingsPage:e}=await import(`./keyboard-shortcuts-settings-page-CkQbSKwI.js`);return{KeyboardShortcutsSettingsPage:e}},__vite__mapDeps([58,2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50]))).KeyboardShortcutsSettingsPage})),kn=(0,G.lazy)(async()=>({default:(await o(async()=>{let{SearchConfigPage:e}=await import(`./search-config-page-DWKlMHgH.js`);return{SearchConfigPage:e}},__vite__mapDeps([59,1,4,5,6,7,8,9,10,16,17,3,20,23,24,43,28,60,55,48]))).SearchConfigPage})),An=(0,G.lazy)(async()=>({default:(await o(async()=>{let{ProvidersConfigPage:e}=await import(`./providers-config-page-BDEdHJbw.js`);return{ProvidersConfigPage:e}},__vite__mapDeps([61,1,4,5,6,7,8,9,10,14,12,16,17,3,20,40,30,41,43,28,31,25,26,52,32,11,13,39,46,60,55,48,56,24,49]))).ProvidersConfigPage})),jn=(0,G.lazy)(async()=>({default:(await o(async()=>{let{ExtensionsConfigPage:e}=await import(`./extensions-CVUFK6Jj.js`);return{ExtensionsConfigPage:e}},__vite__mapDeps([62,16,1,7,17,3,37,9,41,26]))).ExtensionsConfigPage})),Mn=(0,G.lazy)(async()=>({default:(await o(async()=>{let{ChannelsList:e}=await import(`./channels-list-page-Bv7CVSqV.js`);return{ChannelsList:e}},__vite__mapDeps([63,1,4,5,6,7,8,9,10,16,17,3,20,21,23,24,42,43,28,31,13,46,60,34,55,48,56]))).ChannelsList})),Nn=(0,G.lazy)(async()=>({default:(await o(async()=>{let{RuntimeConfig:e}=await import(`./runtime-config-page-BHTKwgDi.js`);return{RuntimeConfig:e}},__vite__mapDeps([64,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,65,66,67,55]))).RuntimeConfig})),Pn=(0,G.lazy)(async()=>({default:(await o(async()=>{let{DesktopUpdateConfig:e}=await import(`./desktop-update-config-PmofcFf6.js`);return{DesktopUpdateConfig:e}},__vite__mapDeps([68,4,1,5,6,7,8,9,10,16,17,3,23,24,26,65,47]))).DesktopUpdateConfig})),Fn=(0,G.lazy)(async()=>({default:(await o(async()=>{let{SecurityConfig:e}=await import(`./security-config-DmTDKKY4.js`);return{SecurityConfig:e}},__vite__mapDeps([69,16,1,7,17,3]))).SecurityConfig})),In=(0,G.lazy)(async()=>({default:(await o(async()=>{let{SecretsConfigPage:e}=await import(`./secrets-config-page-DiQL088Y.js`);return{SecretsConfigPage:e}},__vite__mapDeps([70,1,4,5,6,7,8,9,10,16,17,3,25,66,39,55,48]))).SecretsConfigPage})),Ln=(0,G.lazy)(async()=>({default:(await o(async()=>{let{PrivacySettingsPage:e}=await import(`./privacy-settings-page-B1sHLAc1.js`);return{PrivacySettingsPage:e}},__vite__mapDeps([71,4,1,5,6,7,8,9,10,16,17,3,48]))).PrivacySettingsPage})),Rn=(0,G.lazy)(async()=>({default:(await o(async()=>{let{DesktopCapabilitiesPage:e}=await import(`./desktop-capabilities-page-zLzCSB7A.js`);return{DesktopCapabilitiesPage:e}},__vite__mapDeps([72,16,1,7,17,3,45]))).DesktopCapabilitiesPage})),zn=(0,G.lazy)(async()=>({default:(await o(async()=>{let{RemoteAccessPage:e}=await import(`./remote-CFWp4wyH.js`);return{RemoteAccessPage:e}},__vite__mapDeps([73,2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50]))).RemoteAccessPage})),Bn=(0,G.lazy)(async()=>({default:(await o(async()=>{let{McpMarketplacePage:e}=await import(`./mcp-marketplace-page-sH7VptN_.js`);return{McpMarketplacePage:e}},__vite__mapDeps([74,18,1,4,5,6,7,8,9,10,11,12,13,16,17,3,19,15,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35]))).McpMarketplacePage}));function Vn(){return(0,K.jsx)(`div`,{className:`h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40`})}function Hn({children:e}){return(0,K.jsx)(G.Suspense,{fallback:(0,K.jsx)(Vn,{}),children:e})}function $(e){return(0,K.jsx)(Hn,{children:e})}var Un=[{path:`/projects/:projectId/:tab`,element:$((0,K.jsx)(Q,{view:`projects`}))},{path:`/projects`,element:$((0,K.jsx)(Q,{view:`projects`}))},{path:`/chat/skills`,redirectTo:`/skills`},{path:`/chat/cron`,redirectTo:`/cron`},{path:`/chat/agents`,redirectTo:`/agents`},{path:`/chat/:sessionId?`,element:$((0,K.jsx)(Q,{view:`chat`}))},{path:`/agents`,element:$((0,K.jsx)(Q,{view:`agents`}))},{path:`/skills`,element:$((0,K.jsx)(Q,{view:`skills`}))},{path:`/skills/scenes/:scene`,element:$((0,K.jsx)(Q,{view:`skills`}))},{path:`/cron`,element:$((0,K.jsx)(Q,{view:`cron`}))},{path:`/inbox/:deliveryId?`,element:$((0,K.jsx)(Q,{view:`inbox`}))},{path:`/apps/panel/:appId`,element:$((0,K.jsx)(Q,{view:`panel-app`}))},{path:`/appearance`,element:$((0,K.jsx)(Dn,{}))},{path:`/keyboard-shortcuts`,element:$((0,K.jsx)(On,{}))},{path:`/model`,element:$((0,K.jsx)(En,{}))},{path:`/search`,element:$((0,K.jsx)(kn,{}))},{path:`/providers`,element:$((0,K.jsx)(An,{}))},{path:`/extensions`,element:$((0,K.jsx)(jn,{}))},{path:`/channels`,element:$((0,K.jsx)(Mn,{}))},{path:`/runtime`,element:$((0,K.jsx)(Nn,{}))},{path:`/updates`,element:$((0,K.jsx)(Pn,{}))},{path:`/remote`,element:$((0,K.jsx)(zn,{}))},{path:`/security`,element:$((0,K.jsx)(Fn,{}))},{path:`/privacy`,element:$((0,K.jsx)(Ln,{}))},{path:`/desktop-capabilities`,element:$((0,K.jsx)(Rn,{}))},{path:`/secrets`,element:$((0,K.jsx)(In,{}))},{path:`/settings`,element:(0,K.jsx)(zt,{})},{path:`/marketplace/skills`,redirectTo:`/skills`},{path:`/marketplace`,redirectTo:`/skills`},{path:`/marketplace/mcp`,element:$((0,K.jsx)(Bn,{}))},{path:`/`,redirectTo:`/chat`},{path:`*`,redirectTo:`/chat`}];function Wn(e){return`redirectTo`in e?(0,K.jsx)(c,{path:e.path,element:(0,K.jsx)(p,{to:e.redirectTo,replace:!0})},e.path):(0,K.jsx)(c,{path:e.path,element:e.element},e.path)}function Gn(){return(0,K.jsx)(d,{children:Un.map(Wn)})}function Kn(){return Cn(S),ne(),(0,G.useEffect)(()=>(C.start(),()=>{C.stop()}),[]),(0,K.jsxs)(ze,{children:[(0,K.jsx)(Ot,{}),(0,K.jsx)(He,{}),(0,K.jsx)(Rt,{children:(0,K.jsx)(Gn,{})}),(0,K.jsx)(G.Suspense,{fallback:null,children:(0,K.jsx)(Tn,{})}),(0,K.jsx)(ct,{}),(0,K.jsx)(Ae,{})]})}function qn(){let e=_(),t=e.isError&&te(e.error);return e.isLoading&&!e.isError||t||e.isError?(0,K.jsx)(Kn,{}):e.data?.enabled&&!e.data.authenticated?(0,K.jsx)(Tt,{username:e.data.username}):(0,K.jsx)(Kn,{})}function Jn(){let{theme:e}=st();return(0,G.useEffect)(()=>{dt()},[]),(0,G.useEffect)(()=>{pt.syncTheme(e)},[e]),(0,K.jsxs)(h,{client:S,children:[(0,K.jsx)(qn,{}),(0,K.jsx)(ft,{}),(0,K.jsx)(b,{position:`top-right`,richColors:!0,offset:{top:window.nextclawDesktop?.platform===`win32`?56:44,right:72},mobileOffset:window.nextclawDesktop?.platform===`win32`?56:void 0,style:wn})]})}await We();var Yn=window.nextclawDesktop?.platform===`win32`?s:f;(0,Dt.createRoot)(document.getElementById(`root`)).render((0,K.jsx)(G.StrictMode,{children:(0,K.jsx)(lt,{children:(0,K.jsx)(bt,{children:(0,K.jsx)(Yn,{children:(0,K.jsx)(Jn,{})})})})}));
@@ -1,4 +1,4 @@
1
- import{i as e}from"./chunk-DF37yw5_.js";import{A as t,M as n,i as r,t as i}from"./utils-CBZPzC_b.js";import{$ as a,Fn as o,G as s,Gt as c,J as l,K as u,Mn as d,Nn as f,Pn as p,Qt as m,U as h,Ut as g,W as ee,X as _,Y as v,Yt as y,Zt as b,bn as x,jn as S,q as C,vn as w,xn as T,yn as E}from"./api-BWFOIoUm.js";import{s as D}from"./i18n-ClHx6jwj.js";import{t as O}from"./createLucideIcon-BNKf0_kc.js";import"./doc-browser-BNiqa-zm.js";import{a as k,i as A,n as j,r as M,t as N}from"./select-CG5YWnwe.js";import{t as P}from"./circle-alert-lSa3LRvS.js";import{t as F}from"./loader-circle-K1BDdHR5.js";import{n as te,t as I}from"./confirm-dialog-BWS7gA_z.js";import{t as L}from"./x-DdXOqLnX.js";import{a as R,c as z,d as ne,f as re,i as B,l as V,n as ie,o as ae,p as oe,r as se,s as ce,t as le,u as ue}from"./dialog-Xe73hpQz.js";import{t as H}from"./skeleton-Drvn83YW.js";import{n as de}from"./i18n-provider-C1NxogO4.js";import{g as fe,n as pe}from"./doc-browser-context-Dp0dEMyT.js";import{t as me}from"./tag-chip-CY0Hqk_l.js";var he=class extends o{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:p()})}getOptimisticResult(e){return e.behavior=p(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,p=o&&c===`backward`,m=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:d(t,n.data),hasPreviousPage:f(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:s&&!l&&!p,isRefetching:a&&!u&&!m}}};function ge(e,t){return T(e,he,t)}var U=e(n(),1),W=t(),_e=b(`rounded-2xl border px-4 py-3`,{variants:{tone:{neutral:`border-gray-200 bg-gray-50 text-gray-900`,success:`border-emerald-200 bg-emerald-50 text-emerald-900`,warning:`border-amber-200 bg-amber-50 text-amber-900`,danger:`border-rose-200 bg-rose-50 text-rose-700`,info:`border-primary/20 bg-primary/10 text-primary`},borderStyle:{solid:``,dashed:`border-dashed`}},defaultVariants:{tone:`neutral`,borderStyle:`solid`}}),ve={neutral:`text-gray-900`,success:`text-emerald-800`,warning:`text-amber-900`,danger:`text-rose-700`,info:`text-primary`},ye={neutral:`text-gray-600`,success:`text-emerald-700`,warning:`text-amber-800`,danger:`text-rose-700`,info:`text-primary/90`},G=U.forwardRef(({className:e,tone:t=`neutral`,borderStyle:n=`solid`,title:r,description:a,icon:o,actions:s,children:c,...l},u)=>{let d=t??`neutral`,f=!!r||!!a||!!o||!!s;return(0,W.jsxs)(`div`,{ref:u,className:i(_e({tone:d,borderStyle:n}),e),...l,children:[f?(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,W.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,W.jsxs)(`div`,{className:`flex items-start gap-2`,children:[o?(0,W.jsx)(`div`,{className:`mt-0.5 shrink-0`,children:o}):null,(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,W.jsx)(`p`,{className:i(`text-sm font-medium`,ve[d]),children:r}):null,a?(0,W.jsx)(`p`,{className:i(r?`mt-1`:``,`text-sm leading-6`,ye[d]),children:a}):null]})]})}),s?(0,W.jsx)(`div`,{className:`shrink-0`,children:s}):null]}):null,c?(0,W.jsx)(`div`,{className:i(f?`mt-3`:``),children:c}):null]})});G.displayName=`NoticeCard`;var be=O(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),xe=O(`PackageCheck`,[[`path`,{d:`m16 16 2 2 4-4`,key:`gfu2re`}],[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}]]),Se=O(`PackageSearch`,[[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}],[`circle`,{cx:`18.5`,cy:`15.5`,r:`2.5`,key:`b5zd12`}],[`path`,{d:`M20.27 17.27 22 19`,key:`1l4muz`}]]),Ce={open:!1,title:``,description:``,confirmLabel:D(`confirm`),cancelLabel:D(`cancel`),variant:`default`,resolve:null};function we(){let[e,t]=(0,U.useState)(Ce),n=(0,U.useCallback)(e=>new Promise(n=>{t({open:!0,title:e.title,description:e.description??``,confirmLabel:e.confirmLabel??D(`confirm`),cancelLabel:e.cancelLabel??D(`cancel`),variant:e.variant??`default`,resolve:e=>{n(e),t(e=>({...e,open:!1,resolve:null}))}})}),[]),r=(0,U.useCallback)(e=>{t(t=>(!e&&t.resolve&&t.resolve(!1),{...t,open:e,resolve:e?t.resolve:null}))},[]);return{confirm:n,ConfirmDialog:(0,U.useCallback)(()=>(0,W.jsx)(I,{open:e.open,onOpenChange:r,title:e.title,description:e.description||void 0,confirmLabel:e.confirmLabel,cancelLabel:e.cancelLabel,variant:e.variant,onConfirm:()=>e.resolve?.(!0),onCancel:()=>e.resolve?.(!1)}),[e,r])}}function Te(e){if(!e||e.pages.length===0)return;let t=e.pages.flatMap(e=>e.items);return{...e.pages[e.pages.length-1],items:t,pages:e.pages,loadedItems:t.length,loadedPages:e.pages.length}}function Ee({scope:e,isRefreshing:t,searchText:n,searchPlaceholder:r,sort:i,onSearchTextChange:a,onSortChange:o}){return(0,W.jsx)(`div`,{className:`mb-4`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,W.jsx)(Se,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400`}),(0,W.jsx)(`input`,{value:n,onChange:e=>a(e.target.value),placeholder:r,className:`h-9 w-full rounded-xl border border-border/75 bg-card pl-9 pr-9 text-sm transition-colors focus:outline-none focus:ring-0`}),t&&(0,W.jsx)(F,{className:`absolute right-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 animate-spin text-primary`,"aria-label":D(`marketplaceRefreshingResults`)})]}),e===`all`&&(0,W.jsxs)(N,{value:i,onValueChange:e=>o(e),children:[(0,W.jsx)(A,{className:`h-9 w-[150px] shrink-0 rounded-lg`,children:(0,W.jsx)(k,{})}),(0,W.jsxs)(j,{children:[(0,W.jsx)(M,{value:`relevance`,children:D(`marketplaceSortRelevance`)}),(0,W.jsx)(M,{value:`updated`,children:D(`marketplaceSortUpdated`)})]})]})]})})}function De({count:e}){return(0,W.jsx)(W.Fragment,{children:Array.from({length:e},(e,t)=>(0,W.jsx)(`article`,{className:`h-full rounded-xl border border-gray-200/60 bg-white p-3.5 shadow-sm`,children:(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-2.5`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 gap-2.5`,children:[(0,W.jsx)(H,{className:`h-9 w-9 shrink-0 rounded-lg`}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,W.jsx)(H,{className:`h-4 w-32 max-w-[70%]`}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(H,{className:`h-3 w-12`}),(0,W.jsx)(H,{className:`h-3 w-24`})]}),(0,W.jsx)(H,{className:`h-3 w-full`}),(0,W.jsxs)(`div`,{className:`flex gap-1.5 pt-0.5`,children:[(0,W.jsx)(H,{className:`h-5 w-14 rounded-md`}),(0,W.jsx)(H,{className:`h-5 w-16 rounded-md`}),(0,W.jsx)(H,{className:`h-5 w-12 rounded-md`})]})]})]}),(0,W.jsx)(H,{className:`h-7 w-16 shrink-0 rounded-md`})]})},`marketplace-skeleton-${t}`))})}function Oe({hasMore:e,loading:t,sentinelRef:n}){return!e&&!t?null:(0,W.jsxs)(`div`,{className:`py-4`,children:[e&&(0,W.jsx)(`div`,{ref:n,className:`h-1 w-full`,"aria-hidden":`true`}),t&&(0,W.jsx)(`div`,{"data-testid":`marketplace-loading-more`,className:`pt-3 text-center text-xs text-gray-500`,children:D(`loading`)})]})}function ke(e){let t=e.trim().toLowerCase().replace(/_/g,`-`),n=[t,t.split(`-`)[0],`en`];return Array.from(new Set(n.filter(Boolean)))}function K(e){return e.trim().toLowerCase().replace(/_/g,`-`)}function Ae(e,t,n){if(e){let t=Object.entries(e).map(([e,t])=>({locale:K(e),text:typeof t==`string`?t.trim():``})).filter(e=>e.text.length>0);if(t.length>0){let e=new Map(t.map(e=>[e.locale,e.text]));for(let t of n){let n=K(t),r=e.get(n);if(r)return r}for(let e of n){let n=K(e).split(`-`)[0];if(!n)continue;let r=t.find(e=>e.locale===n||e.locale.startsWith(`${n}-`));if(r)return r.text}return t[0]?.text??``}}return t?.trim()??``}function je(e,t){if(!e)return``;for(let n of t)if(K(n).split(`-`)[0]===`zh`&&e.descriptionZh?.trim())return e.descriptionZh.trim();return e.description?.trim()?e.description.trim():e.descriptionZh?.trim()?e.descriptionZh.trim():``}function Me(){let e=pe();(0,U.useEffect)(()=>{let t=t=>{let n=t.target.closest(`a[href]`);if(!n)return;let r=n.getAttribute(`href`)||``;fe(r)&&(n.hasAttribute(`data-doc-external`)||t.ctrlKey||t.metaKey||t.shiftKey||(t.preventDefault(),t.stopPropagation(),e.open(r)))};return document.addEventListener(`click`,t,!0),()=>document.removeEventListener(`click`,t,!0)},[e])}var q=r(e=>({entries:{},setEntry:t=>e(e=>({entries:{...e.entries,[t.id]:t}}))}));function J(e){q.getState().setEntry(e)}function Ne(e){let t=e.indexOf(`:`);return t<=0||t>=e.length-1?null:{scope:e.slice(0,t),key:e.slice(t+1)}}function Pe(e){return e===`skill`||e===`skill-preview`}function Fe(e){let t=q(t=>e?t.entries[e]:void 0);return(0,U.useEffect)(()=>{if(!e||q.getState().entries[e])return;let t=Ne(e);if(!t||!Pe(t.scope))return;let n=!1,r=t.key,i=D(`marketplaceTypeSkill`);return a(t.key).then(a=>{n||J({id:e,title:r,typeLabel:i,spec:t.key,status:`ready`,summary:D(`marketplaceInstalledLocalSummary`),metadataRaw:a.metadataRaw,contentRaw:a.bodyRaw||a.raw,sourceUrl:a.sourceUrl,sourceLabel:a.source?`Source (${a.source})`:void 0})}).catch(()=>{n||J({id:e,title:r,typeLabel:i,spec:t.key,status:`error`,summary:D(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify({skill:t.key},null,2),contentRaw:D(`marketplaceDetailUnavailableDescription`)})}),()=>{n=!0}},[e]),t}var Ie=`marketplace-detail`,Le=`nextclaw://marketplace-detail`;function Re(e,t){return`${e}:${t}`}function ze(e){return`${Le}/${encodeURIComponent(e)}`}function Be(e){try{let t=new URL(e);if(t.protocol!==`nextclaw:`||t.hostname!==`marketplace-detail`)return null;let n=t.pathname.replace(/^\//,``);return n?decodeURIComponent(n):null}catch{return null}}function Ve(e){let t=ze(e.id);return{dedupeKey:`marketplace-detail:${e.id}`,historyPolicy:`managed`,kind:Ie,resourceUri:t,title:e.title,url:t}}function Y(e,t,n){J(t),e.openTarget(Ve(t),{activate:n?.activate,dedupeKey:`marketplace-detail:${t.id}`,title:t.title})}function He(e){let t=e.replace(/\r\n/g,`
1
+ import{i as e}from"./chunk-DF37yw5_.js";import{A as t,M as n,i as r,t as i}from"./utils-CBZPzC_b.js";import{$ as a,Fn as o,G as s,Gt as c,J as l,K as u,Mn as d,Nn as f,Pn as p,Qt as m,U as h,Ut as g,W as ee,X as _,Y as v,Yt as y,Zt as b,bn as x,jn as S,q as C,vn as w,xn as T,yn as E}from"./api-DqzQ-_3w.js";import{s as D}from"./i18n-20rSH40D.js";import{t as O}from"./createLucideIcon-BNKf0_kc.js";import"./doc-browser-BJrre2S_.js";import{a as k,i as A,n as j,r as M,t as N}from"./select-CG5YWnwe.js";import{t as P}from"./circle-alert-lSa3LRvS.js";import{t as F}from"./loader-circle-K1BDdHR5.js";import{n as te,t as I}from"./confirm-dialog-BTKCWMn6.js";import{t as L}from"./x-DdXOqLnX.js";import{a as R,c as z,d as ne,f as re,i as B,l as V,n as ie,o as ae,p as oe,r as se,s as ce,t as le,u as ue}from"./dialog-Xe73hpQz.js";import{t as H}from"./skeleton-Drvn83YW.js";import{n as de}from"./i18n-provider-BPRq6S7O.js";import{g as fe,n as pe}from"./doc-browser-context-TILuCY5c.js";import{t as me}from"./tag-chip-B1AYPOKL.js";var he=class extends o{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:p()})}getOptimisticResult(e){return e.behavior=p(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,p=o&&c===`backward`,m=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:d(t,n.data),hasPreviousPage:f(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:s&&!l&&!p,isRefetching:a&&!u&&!m}}};function ge(e,t){return T(e,he,t)}var U=e(n(),1),W=t(),_e=b(`rounded-2xl border px-4 py-3`,{variants:{tone:{neutral:`border-gray-200 bg-gray-50 text-gray-900`,success:`border-emerald-200 bg-emerald-50 text-emerald-900`,warning:`border-amber-200 bg-amber-50 text-amber-900`,danger:`border-rose-200 bg-rose-50 text-rose-700`,info:`border-primary/20 bg-primary/10 text-primary`},borderStyle:{solid:``,dashed:`border-dashed`}},defaultVariants:{tone:`neutral`,borderStyle:`solid`}}),ve={neutral:`text-gray-900`,success:`text-emerald-800`,warning:`text-amber-900`,danger:`text-rose-700`,info:`text-primary`},ye={neutral:`text-gray-600`,success:`text-emerald-700`,warning:`text-amber-800`,danger:`text-rose-700`,info:`text-primary/90`},G=U.forwardRef(({className:e,tone:t=`neutral`,borderStyle:n=`solid`,title:r,description:a,icon:o,actions:s,children:c,...l},u)=>{let d=t??`neutral`,f=!!r||!!a||!!o||!!s;return(0,W.jsxs)(`div`,{ref:u,className:i(_e({tone:d,borderStyle:n}),e),...l,children:[f?(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,W.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,W.jsxs)(`div`,{className:`flex items-start gap-2`,children:[o?(0,W.jsx)(`div`,{className:`mt-0.5 shrink-0`,children:o}):null,(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,W.jsx)(`p`,{className:i(`text-sm font-medium`,ve[d]),children:r}):null,a?(0,W.jsx)(`p`,{className:i(r?`mt-1`:``,`text-sm leading-6`,ye[d]),children:a}):null]})]})}),s?(0,W.jsx)(`div`,{className:`shrink-0`,children:s}):null]}):null,c?(0,W.jsx)(`div`,{className:i(f?`mt-3`:``),children:c}):null]})});G.displayName=`NoticeCard`;var be=O(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),xe=O(`PackageCheck`,[[`path`,{d:`m16 16 2 2 4-4`,key:`gfu2re`}],[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}]]),Se=O(`PackageSearch`,[[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}],[`circle`,{cx:`18.5`,cy:`15.5`,r:`2.5`,key:`b5zd12`}],[`path`,{d:`M20.27 17.27 22 19`,key:`1l4muz`}]]),Ce={open:!1,title:``,description:``,confirmLabel:D(`confirm`),cancelLabel:D(`cancel`),variant:`default`,resolve:null};function we(){let[e,t]=(0,U.useState)(Ce),n=(0,U.useCallback)(e=>new Promise(n=>{t({open:!0,title:e.title,description:e.description??``,confirmLabel:e.confirmLabel??D(`confirm`),cancelLabel:e.cancelLabel??D(`cancel`),variant:e.variant??`default`,resolve:e=>{n(e),t(e=>({...e,open:!1,resolve:null}))}})}),[]),r=(0,U.useCallback)(e=>{t(t=>(!e&&t.resolve&&t.resolve(!1),{...t,open:e,resolve:e?t.resolve:null}))},[]);return{confirm:n,ConfirmDialog:(0,U.useCallback)(()=>(0,W.jsx)(I,{open:e.open,onOpenChange:r,title:e.title,description:e.description||void 0,confirmLabel:e.confirmLabel,cancelLabel:e.cancelLabel,variant:e.variant,onConfirm:()=>e.resolve?.(!0),onCancel:()=>e.resolve?.(!1)}),[e,r])}}function Te(e){if(!e||e.pages.length===0)return;let t=e.pages.flatMap(e=>e.items);return{...e.pages[e.pages.length-1],items:t,pages:e.pages,loadedItems:t.length,loadedPages:e.pages.length}}function Ee({scope:e,isRefreshing:t,searchText:n,searchPlaceholder:r,sort:i,onSearchTextChange:a,onSortChange:o}){return(0,W.jsx)(`div`,{className:`mb-4`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,W.jsx)(Se,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400`}),(0,W.jsx)(`input`,{value:n,onChange:e=>a(e.target.value),placeholder:r,className:`h-9 w-full rounded-xl border border-border/75 bg-card pl-9 pr-9 text-sm transition-colors focus:outline-none focus:ring-0`}),t&&(0,W.jsx)(F,{className:`absolute right-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 animate-spin text-primary`,"aria-label":D(`marketplaceRefreshingResults`)})]}),e===`all`&&(0,W.jsxs)(N,{value:i,onValueChange:e=>o(e),children:[(0,W.jsx)(A,{className:`h-9 w-[150px] shrink-0 rounded-lg`,children:(0,W.jsx)(k,{})}),(0,W.jsxs)(j,{children:[(0,W.jsx)(M,{value:`relevance`,children:D(`marketplaceSortRelevance`)}),(0,W.jsx)(M,{value:`updated`,children:D(`marketplaceSortUpdated`)})]})]})]})})}function De({count:e}){return(0,W.jsx)(W.Fragment,{children:Array.from({length:e},(e,t)=>(0,W.jsx)(`article`,{className:`h-full rounded-xl border border-gray-200/60 bg-white p-3.5 shadow-sm`,children:(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-2.5`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 gap-2.5`,children:[(0,W.jsx)(H,{className:`h-9 w-9 shrink-0 rounded-lg`}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,W.jsx)(H,{className:`h-4 w-32 max-w-[70%]`}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(H,{className:`h-3 w-12`}),(0,W.jsx)(H,{className:`h-3 w-24`})]}),(0,W.jsx)(H,{className:`h-3 w-full`}),(0,W.jsxs)(`div`,{className:`flex gap-1.5 pt-0.5`,children:[(0,W.jsx)(H,{className:`h-5 w-14 rounded-md`}),(0,W.jsx)(H,{className:`h-5 w-16 rounded-md`}),(0,W.jsx)(H,{className:`h-5 w-12 rounded-md`})]})]})]}),(0,W.jsx)(H,{className:`h-7 w-16 shrink-0 rounded-md`})]})},`marketplace-skeleton-${t}`))})}function Oe({hasMore:e,loading:t,sentinelRef:n}){return!e&&!t?null:(0,W.jsxs)(`div`,{className:`py-4`,children:[e&&(0,W.jsx)(`div`,{ref:n,className:`h-1 w-full`,"aria-hidden":`true`}),t&&(0,W.jsx)(`div`,{"data-testid":`marketplace-loading-more`,className:`pt-3 text-center text-xs text-gray-500`,children:D(`loading`)})]})}function ke(e){let t=e.trim().toLowerCase().replace(/_/g,`-`),n=[t,t.split(`-`)[0],`en`];return Array.from(new Set(n.filter(Boolean)))}function K(e){return e.trim().toLowerCase().replace(/_/g,`-`)}function Ae(e,t,n){if(e){let t=Object.entries(e).map(([e,t])=>({locale:K(e),text:typeof t==`string`?t.trim():``})).filter(e=>e.text.length>0);if(t.length>0){let e=new Map(t.map(e=>[e.locale,e.text]));for(let t of n){let n=K(t),r=e.get(n);if(r)return r}for(let e of n){let n=K(e).split(`-`)[0];if(!n)continue;let r=t.find(e=>e.locale===n||e.locale.startsWith(`${n}-`));if(r)return r.text}return t[0]?.text??``}}return t?.trim()??``}function je(e,t){if(!e)return``;for(let n of t)if(K(n).split(`-`)[0]===`zh`&&e.descriptionZh?.trim())return e.descriptionZh.trim();return e.description?.trim()?e.description.trim():e.descriptionZh?.trim()?e.descriptionZh.trim():``}function Me(){let e=pe();(0,U.useEffect)(()=>{let t=t=>{let n=t.target.closest(`a[href]`);if(!n)return;let r=n.getAttribute(`href`)||``;fe(r)&&(n.hasAttribute(`data-doc-external`)||t.ctrlKey||t.metaKey||t.shiftKey||(t.preventDefault(),t.stopPropagation(),e.open(r)))};return document.addEventListener(`click`,t,!0),()=>document.removeEventListener(`click`,t,!0)},[e])}var q=r(e=>({entries:{},setEntry:t=>e(e=>({entries:{...e.entries,[t.id]:t}}))}));function J(e){q.getState().setEntry(e)}function Ne(e){let t=e.indexOf(`:`);return t<=0||t>=e.length-1?null:{scope:e.slice(0,t),key:e.slice(t+1)}}function Pe(e){return e===`skill`||e===`skill-preview`}function Fe(e){let t=q(t=>e?t.entries[e]:void 0);return(0,U.useEffect)(()=>{if(!e||q.getState().entries[e])return;let t=Ne(e);if(!t||!Pe(t.scope))return;let n=!1,r=t.key,i=D(`marketplaceTypeSkill`);return a(t.key).then(a=>{n||J({id:e,title:r,typeLabel:i,spec:t.key,status:`ready`,summary:D(`marketplaceInstalledLocalSummary`),metadataRaw:a.metadataRaw,contentRaw:a.bodyRaw||a.raw,sourceUrl:a.sourceUrl,sourceLabel:a.source?`Source (${a.source})`:void 0})}).catch(()=>{n||J({id:e,title:r,typeLabel:i,spec:t.key,status:`error`,summary:D(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify({skill:t.key},null,2),contentRaw:D(`marketplaceDetailUnavailableDescription`)})}),()=>{n=!0}},[e]),t}var Ie=`marketplace-detail`,Le=`nextclaw://marketplace-detail`;function Re(e,t){return`${e}:${t}`}function ze(e){return`${Le}/${encodeURIComponent(e)}`}function Be(e){try{let t=new URL(e);if(t.protocol!==`nextclaw:`||t.hostname!==`marketplace-detail`)return null;let n=t.pathname.replace(/^\//,``);return n?decodeURIComponent(n):null}catch{return null}}function Ve(e){let t=ze(e.id);return{dedupeKey:`marketplace-detail:${e.id}`,historyPolicy:`managed`,kind:Ie,resourceUri:t,title:e.title,url:t}}function Y(e,t,n){J(t),e.openTarget(Ve(t),{activate:n?.activate,dedupeKey:`marketplace-detail:${t.id}`,title:t.title})}function He(e){let t=e.replace(/\r\n/g,`
2
2
  `).split(`
3
3
  `);if(t[0]?.trim()!==`---`)return e;let n=t.findIndex((e,t)=>t>0&&e.trim()===`---`);return n>0?t.slice(n+1).join(`
4
4
  `).trim():e}function X(e){let t=[],n=/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\(https?:\/\/[^)\s]+\))/g,r=0,i=0;for(let a of e.matchAll(n)){if(a.index===void 0)continue;a.index>r&&t.push(e.slice(r,a.index));let n=a[0],o=`${i}-${a.index}`;if(n.startsWith("`"))t.push((0,W.jsx)(`code`,{className:`rounded border border-border bg-muted px-1 py-0.5 font-mono text-[0.88em] text-foreground`,children:n.slice(1,-1)},o));else if(n.startsWith(`**`))t.push((0,W.jsx)(`strong`,{children:n.slice(2,-2)},o));else{let e=n.match(/^\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)$/);t.push(e?(0,W.jsx)(`a`,{href:e[2],target:`_blank`,rel:`noopener noreferrer`,children:e[1]},o):n)}r=a.index+n.length,i+=1}return r<e.length&&t.push(e.slice(r)),t}function Ue(e){return/^(#{1,4})\s+/.test(e)||/^([-*])\s+/.test(e)||/^\d+\.\s+/.test(e)||/^>\s?/.test(e)||/^```/.test(e)}function We(e,t,n){let r=[],i=t+1;for(;i<e.length&&!e[i]?.trim().startsWith("```");)r.push(e[i]??``),i+=1;let a=n[1]??``;return{node:(0,W.jsxs)(`div`,{className:`relative my-3 overflow-hidden rounded-lg border border-border bg-muted/70`,children:[a?(0,W.jsx)(`span`,{className:`absolute right-3 top-2 font-mono text-[10px] text-muted-foreground`,children:a}):null,(0,W.jsx)(`pre`,{className:`m-0 overflow-x-auto p-3 text-xs leading-6 text-foreground`,children:(0,W.jsx)(`code`,{children:r.join(`
@@ -0,0 +1 @@
1
+ import{t as e}from"./mcp-marketplace-page-FfIfEo6w.js";export{e as McpMarketplacePage};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DF37yw5_.js";import{A as t,M as n}from"./utils-CBZPzC_b.js";import{t as r}from"./navigation-link-BAQjgx2F.js";import{Gt as i,Jt as a,Kt as o,Qt as s,Wt as c,Yt as l,qt as u}from"./api-BWFOIoUm.js";import{s as d}from"./i18n-ClHx6jwj.js";import{t as f}from"./book-open-xqEj1OLE.js";import{t as p}from"./provider-scoped-model-input-BvZitHkT.js";import{t as m}from"./loader-circle-K1BDdHR5.js";import{t as h}from"./skeleton-Drvn83YW.js";import{m as g}from"./doc-browser-context-Dp0dEMyT.js";import{n as _}from"./provider-models-hrHMcHqg.js";import{_ as v,f as y,p as b,r as x,t as S}from"./use-config-C8ZkQiTc.js";import{t as C}from"./form-actions-BRESe-m_.js";import{t as w}from"./config-hints-B_C9DAp5.js";var T=e(n(),1),E=t(),D=`provider/model`;function O(e){let{initialModel:t,initialWorkspace:n,isPending:s,modelHelpText:h,modelPlaceholder:_,onSubmit:v,providerCatalog:y,workspacePlaceholder:b}=e,[x,S]=(0,T.useState)(t),[w,D]=(0,T.useState)(n);return(0,E.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),v({model:x,workspace:w})},className:`space-y-5`,children:[(0,E.jsx)(a,{children:(0,E.jsxs)(u,{children:[(0,E.jsx)(o,{title:d(`defaultModel`),description:h,layout:`stacked`,children:(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(c,{htmlFor:`model`,className:`sr-only`,children:d(`defaultModel`)}),(0,E.jsx)(p,{id:`model`,value:x,onChange:S,providerCatalog:y,modelPlaceholder:_}),(0,E.jsx)(r,{href:g(`/guide/model-selection`),external:!0,icon:f,size:`xs`,children:d(`channelsGuideTitle`)})]})}),(0,E.jsx)(o,{title:d(`workspace`),layout:`stacked`,children:(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(c,{htmlFor:`workspace`,className:`sr-only`,children:d(`workspace`)}),(0,E.jsx)(i,{id:`workspace`,value:w,onChange:e=>D(e.target.value),placeholder:b,className:`rounded-xl`})]})})]})}),(0,E.jsx)(C,{children:(0,E.jsx)(l,{type:`submit`,disabled:s,size:`sm`,children:s?(0,E.jsx)(m,{className:`h-3.5 w-3.5 animate-spin`}):d(`saveChanges`)})})]})}function k(){let{data:e,isLoading:t}=S(),{data:n}=b(),{data:r}=y(),{data:i}=x(),a=v(),o=i?.uiHints,c=w(`agents.defaults.model`,o),l=w(`agents.defaults.workspace`,o),u=(0,T.useMemo)(()=>_({providersView:n,templatesView:r,config:e,onlyConfigured:!0}),[e,n,r]),f=d(`modelIdentifierHelp`)||c?.help||``,p=(e?.agents?.defaults?.model||``).trim(),m=e?.agents?.defaults?.workspace||``;return t?(0,E.jsx)(s,{title:d(`modelPageTitle`),description:d(`modelPageDescription`),children:(0,E.jsxs)(`div`,{className:`divide-y divide-border/55 overflow-hidden rounded-2xl bg-muted/45`,children:[(0,E.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,E.jsx)(h,{className:`h-5 w-24`}),(0,E.jsx)(h,{className:`h-10 w-full rounded-xl`})]}),(0,E.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,E.jsx)(h,{className:`h-5 w-24`}),(0,E.jsx)(h,{className:`h-10 w-full rounded-xl`})]})]})}):(0,E.jsx)(s,{title:d(`modelPageTitle`),description:d(`modelPageDescription`),children:(0,E.jsx)(O,{initialModel:p,initialWorkspace:m,isPending:a.isPending,modelHelpText:f,modelPlaceholder:c?.placeholder??D,onSubmit:({model:e,workspace:t})=>a.mutate({model:e,workspace:t}),providerCatalog:u,workspacePlaceholder:l?.placeholder??`/path/to/workspace`},`${p}::${m}`)})}export{k as ModelConfigPage};
1
+ import{i as e}from"./chunk-DF37yw5_.js";import{A as t,M as n}from"./utils-CBZPzC_b.js";import{t as r}from"./navigation-link-BAQjgx2F.js";import{Gt as i,Jt as a,Kt as o,Qt as s,Wt as c,Yt as l,qt as u}from"./api-DqzQ-_3w.js";import{s as d}from"./i18n-20rSH40D.js";import{t as f}from"./book-open-xqEj1OLE.js";import{t as p}from"./provider-scoped-model-input-BQsugx1v.js";import{t as m}from"./loader-circle-K1BDdHR5.js";import{t as h}from"./skeleton-Drvn83YW.js";import{m as g}from"./doc-browser-context-TILuCY5c.js";import{n as _}from"./provider-models-hrHMcHqg.js";import{_ as v,f as y,p as b,r as x,t as S}from"./use-config-BEdbtpD4.js";import{t as C}from"./form-actions-BRESe-m_.js";import{t as w}from"./config-hints-B_C9DAp5.js";var T=e(n(),1),E=t(),D=`provider/model`;function O(e){let{initialModel:t,initialWorkspace:n,isPending:s,modelHelpText:h,modelPlaceholder:_,onSubmit:v,providerCatalog:y,workspacePlaceholder:b}=e,[x,S]=(0,T.useState)(t),[w,D]=(0,T.useState)(n);return(0,E.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),v({model:x,workspace:w})},className:`space-y-5`,children:[(0,E.jsx)(a,{children:(0,E.jsxs)(u,{children:[(0,E.jsx)(o,{title:d(`defaultModel`),description:h,layout:`stacked`,children:(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(c,{htmlFor:`model`,className:`sr-only`,children:d(`defaultModel`)}),(0,E.jsx)(p,{id:`model`,value:x,onChange:S,providerCatalog:y,modelPlaceholder:_}),(0,E.jsx)(r,{href:g(`/guide/model-selection`),external:!0,icon:f,size:`xs`,children:d(`channelsGuideTitle`)})]})}),(0,E.jsx)(o,{title:d(`workspace`),layout:`stacked`,children:(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(c,{htmlFor:`workspace`,className:`sr-only`,children:d(`workspace`)}),(0,E.jsx)(i,{id:`workspace`,value:w,onChange:e=>D(e.target.value),placeholder:b,className:`rounded-xl`})]})})]})}),(0,E.jsx)(C,{children:(0,E.jsx)(l,{type:`submit`,disabled:s,size:`sm`,children:s?(0,E.jsx)(m,{className:`h-3.5 w-3.5 animate-spin`}):d(`saveChanges`)})})]})}function k(){let{data:e,isLoading:t}=S(),{data:n}=b(),{data:r}=y(),{data:i}=x(),a=v(),o=i?.uiHints,c=w(`agents.defaults.model`,o),l=w(`agents.defaults.workspace`,o),u=(0,T.useMemo)(()=>_({providersView:n,templatesView:r,config:e,onlyConfigured:!0}),[e,n,r]),f=d(`modelIdentifierHelp`)||c?.help||``,p=(e?.agents?.defaults?.model||``).trim(),m=e?.agents?.defaults?.workspace||``;return t?(0,E.jsx)(s,{title:d(`modelPageTitle`),description:d(`modelPageDescription`),children:(0,E.jsxs)(`div`,{className:`divide-y divide-border/55 overflow-hidden rounded-2xl bg-muted/45`,children:[(0,E.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,E.jsx)(h,{className:`h-5 w-24`}),(0,E.jsx)(h,{className:`h-10 w-full rounded-xl`})]}),(0,E.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,E.jsx)(h,{className:`h-5 w-24`}),(0,E.jsx)(h,{className:`h-10 w-full rounded-xl`})]})]})}):(0,E.jsx)(s,{title:d(`modelPageTitle`),description:d(`modelPageDescription`),children:(0,E.jsx)(O,{initialModel:p,initialWorkspace:m,isPending:a.isPending,modelHelpText:f,modelPlaceholder:c?.placeholder??D,onSubmit:({model:e,workspace:t})=>a.mutate({model:e,workspace:t}),providerCatalog:u,workspacePlaceholder:l?.placeholder??`/path/to/workspace`},`${p}::${m}`)})}export{k as ModelConfigPage};
@@ -0,0 +1 @@
1
+ import{o as e}from"./i18n-20rSH40D.js";import{i as t,n,r,t as i}from"./panel-app-B39rJPj8.js";function a(){e({zh:{...t,...r},en:{...n,...i}})}export{a as installPanelAppI18nCatalog};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/login-page-Dq5nPUCU.js","assets/login-page-CL0SrBCf.js","assets/chunk-DF37yw5_.js","assets/api-BWFOIoUm.js","assets/utils-CBZPzC_b.js","assets/i18n-ClHx6jwj.js","assets/preload-helper-ca-nBW7U.js","assets/card-BhfAZv5L.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./chunk-DF37yw5_.js";import{t}from"./client-BtGBwLTs.js";import{A as n,M as r}from"./utils-CBZPzC_b.js";import{t as i}from"./preload-helper-ca-nBW7U.js";import{An as a,Ht as o,Vt as s,_n as c,gn as l}from"./api-BWFOIoUm.js";import{a as u,s as d}from"./i18n-ClHx6jwj.js";import{c as f,p,s as m,t as h}from"./theme-provider-BvpXGXWH.js";import{t as g}from"./i18n-provider-C1NxogO4.js";var _=e(r(),1),v=t(),y=n(),b=(0,_.lazy)(async()=>({default:(await i(async()=>{let{LoginPage:e}=await import(`./login-page-Dq5nPUCU.js`);return{LoginPage:e}},__vite__mapDeps([0,1,2,3,4,5,6,7]))).LoginPage})),x=/^\/apps\/panel\/([^/]+)\/standalone\/?$/;function S(e){let t=x.exec(e);if(!t)return null;try{return decodeURIComponent(t[1])}catch{return null}}function C({appId:e}){let t=o(),n=t.isError&&s(t.error);return t.isLoading&&!t.isError||n||t.isError?(0,y.jsx)(f,{appId:e}):t.data?.enabled&&!t.data.authenticated?(0,y.jsx)(_.Suspense,{fallback:(0,y.jsx)(w,{message:d(`loading`)}),children:(0,y.jsx)(b,{username:t.data.username})}):(0,y.jsx)(f,{appId:e})}function w({message:e}){return(0,y.jsx)(`main`,{className:`flex h-dvh items-center justify-center bg-background px-6 text-sm text-muted-foreground`,children:e})}function T({pathname:e=window.location.pathname}){let t=S(e);return t?(0,y.jsx)(a,{client:l,children:(0,y.jsxs)(p,{children:[(0,y.jsx)(C,{appId:t}),(0,y.jsx)(m,{}),(0,y.jsx)(c,{position:`top-right`,richColors:!0,offset:16})]})}):(0,y.jsx)(w,{message:d(`panelAppsMainUnavailable`)})}await u();var E=document.getElementById(`root`);E&&(0,v.createRoot)(E).render((0,y.jsx)(_.StrictMode,{children:(0,y.jsx)(h,{children:(0,y.jsx)(g,{children:(0,y.jsx)(T,{})})})}));
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/login-page-Dlyvp-81.js","assets/login-page-f8qQ4xKY.js","assets/chunk-DF37yw5_.js","assets/api-DqzQ-_3w.js","assets/utils-CBZPzC_b.js","assets/i18n-20rSH40D.js","assets/preload-helper-ca-nBW7U.js","assets/card-BhfAZv5L.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./chunk-DF37yw5_.js";import{t}from"./client-BtGBwLTs.js";import{A as n,M as r}from"./utils-CBZPzC_b.js";import{t as i}from"./preload-helper-ca-nBW7U.js";import{An as a,Ht as o,Vt as s,_n as c,gn as l}from"./api-DqzQ-_3w.js";import{a as u,s as d}from"./i18n-20rSH40D.js";import{c as f,p,s as m,t as h}from"./theme-provider-DzvAi3pe.js";import{t as g}from"./i18n-provider-BPRq6S7O.js";var _=e(r(),1),v=t(),y=n(),b=(0,_.lazy)(async()=>({default:(await i(async()=>{let{LoginPage:e}=await import(`./login-page-Dlyvp-81.js`);return{LoginPage:e}},__vite__mapDeps([0,1,2,3,4,5,6,7]))).LoginPage})),x=/^\/apps\/panel\/([^/]+)\/standalone\/?$/;function S(e){let t=x.exec(e);if(!t)return null;try{return decodeURIComponent(t[1])}catch{return null}}function C({appId:e}){let t=o(),n=t.isError&&s(t.error);return t.isLoading&&!t.isError||n||t.isError?(0,y.jsx)(f,{appId:e}):t.data?.enabled&&!t.data.authenticated?(0,y.jsx)(_.Suspense,{fallback:(0,y.jsx)(w,{message:d(`loading`)}),children:(0,y.jsx)(b,{username:t.data.username})}):(0,y.jsx)(f,{appId:e})}function w({message:e}){return(0,y.jsx)(`main`,{className:`flex h-dvh items-center justify-center bg-background px-6 text-sm text-muted-foreground`,children:e})}function T({pathname:e=window.location.pathname}){let t=S(e);return t?(0,y.jsx)(a,{client:l,children:(0,y.jsxs)(p,{children:[(0,y.jsx)(C,{appId:t}),(0,y.jsx)(m,{}),(0,y.jsx)(c,{position:`top-right`,richColors:!0,offset:16})]})}):(0,y.jsx)(w,{message:d(`panelAppsMainUnavailable`)})}await u();var E=document.getElementById(`root`);E&&(0,v.createRoot)(E).render((0,y.jsx)(_.StrictMode,{children:(0,y.jsx)(h,{children:(0,y.jsx)(g,{children:(0,y.jsx)(T,{})})})}));
@@ -1 +1 @@
1
- import{A as e}from"./utils-CBZPzC_b.js";import{Jt as t,Kt as n,Qt as r,Ut as i,qt as a}from"./api-BWFOIoUm.js";import{s as o}from"./i18n-ClHx6jwj.js";import{a as s,i as c,n as l,r as u,t as d}from"./select-CG5YWnwe.js";import{t as f,u as p,v as m}from"./use-config-C8ZkQiTc.js";var h=e();function g(){let e=f(),g=p(),v=m(),y=e.data?.productAnalytics.enabled??!0,b=e.data?.productAnalytics.audience??`external`,x=e=>{v.mutate({data:{enabled:e}})},S=e=>{let t=e;v.mutate({data:{audience:t}})};return(0,h.jsxs)(r,{title:o(`privacyPageTitle`),description:o(`privacyPageDescription`),children:[(0,h.jsx)(t,{title:o(`productAnalyticsSectionTitle`),description:o(`productAnalyticsSectionDescription`),children:(0,h.jsxs)(a,{children:[(0,h.jsx)(n,{title:o(`productAnalyticsEnabledTitle`),description:o(`productAnalyticsEnabledDescription`),control:(0,h.jsx)(i,{"aria-label":o(`productAnalyticsEnabledTitle`),checked:y,disabled:e.isLoading||v.isPending,onCheckedChange:x})}),(0,h.jsx)(n,{title:o(`productAnalyticsAudienceTitle`),description:o(`productAnalyticsAudienceDescription`),control:(0,h.jsxs)(d,{value:b,onValueChange:S,disabled:e.isLoading||v.isPending,children:[(0,h.jsx)(c,{"aria-label":o(`productAnalyticsAudienceTitle`),className:`w-40 sm:w-48`,children:(0,h.jsx)(s,{})}),(0,h.jsxs)(l,{children:[(0,h.jsx)(u,{value:`external`,children:o(`productAnalyticsAudienceExternal`)}),(0,h.jsx)(u,{value:`internal`,children:o(`productAnalyticsAudienceInternal`)}),(0,h.jsx)(u,{value:`qa`,children:o(`productAnalyticsAudienceQa`)})]})]})})]})}),(0,h.jsx)(t,{title:o(`productAnalyticsDataTitle`),children:(0,h.jsxs)(a,{children:[(0,h.jsx)(n,{layout:`stacked`,title:o(`productAnalyticsCollectedTitle`),description:o(`productAnalyticsCollectedDescription`)}),(0,h.jsx)(n,{layout:`stacked`,title:o(`productAnalyticsExcludedTitle`),description:o(`productAnalyticsExcludedDescription`)}),(0,h.jsx)(n,{layout:`stacked`,title:o(`productAnalyticsAnonymousTitle`),description:o(`productAnalyticsAnonymousDescription`)})]})}),(0,h.jsx)(t,{title:o(`productAnalyticsStatusSectionTitle`),children:(0,h.jsxs)(a,{children:[(0,h.jsx)(n,{layout:`stacked`,title:o(`productAnalyticsStatusTitle`),description:_(g.data,g.isLoading)}),g.data?.lastError?(0,h.jsx)(n,{layout:`stacked`,title:o(`productAnalyticsLastErrorTitle`),description:g.data.lastError}):null]})})]})}function _(e,t){if(t)return o(`productAnalyticsStatusLoading`);if(!e?.lastAttemptAt)return o(`productAnalyticsStatusNever`);let n=new Date(e.lastAttemptAt).toLocaleString();if(!e.lastSuccessAt)return`${o(`productAnalyticsLastAttemptLabel`)} ${n} · ${e.pendingReceiptCount} ${o(`productAnalyticsPendingLabel`)}`;let r=new Date(e.lastSuccessAt).toLocaleString();return`${o(`productAnalyticsLastSuccessLabel`)} ${r} · ${e.pendingReceiptCount} ${o(`productAnalyticsPendingLabel`)}`}export{g as PrivacySettingsPage};
1
+ import{A as e}from"./utils-CBZPzC_b.js";import{Jt as t,Kt as n,Qt as r,Ut as i,qt as a}from"./api-DqzQ-_3w.js";import{s as o}from"./i18n-20rSH40D.js";import{a as s,i as c,n as l,r as u,t as d}from"./select-CG5YWnwe.js";import{t as f,u as p,v as m}from"./use-config-BEdbtpD4.js";var h=e();function g(){let e=f(),g=p(),v=m(),y=e.data?.productAnalytics.enabled??!0,b=e.data?.productAnalytics.audience??`external`,x=e=>{v.mutate({data:{enabled:e}})},S=e=>{let t=e;v.mutate({data:{audience:t}})};return(0,h.jsxs)(r,{title:o(`privacyPageTitle`),description:o(`privacyPageDescription`),children:[(0,h.jsx)(t,{title:o(`productAnalyticsSectionTitle`),description:o(`productAnalyticsSectionDescription`),children:(0,h.jsxs)(a,{children:[(0,h.jsx)(n,{title:o(`productAnalyticsEnabledTitle`),description:o(`productAnalyticsEnabledDescription`),control:(0,h.jsx)(i,{"aria-label":o(`productAnalyticsEnabledTitle`),checked:y,disabled:e.isLoading||v.isPending,onCheckedChange:x})}),(0,h.jsx)(n,{title:o(`productAnalyticsAudienceTitle`),description:o(`productAnalyticsAudienceDescription`),control:(0,h.jsxs)(d,{value:b,onValueChange:S,disabled:e.isLoading||v.isPending,children:[(0,h.jsx)(c,{"aria-label":o(`productAnalyticsAudienceTitle`),className:`w-40 sm:w-48`,children:(0,h.jsx)(s,{})}),(0,h.jsxs)(l,{children:[(0,h.jsx)(u,{value:`external`,children:o(`productAnalyticsAudienceExternal`)}),(0,h.jsx)(u,{value:`internal`,children:o(`productAnalyticsAudienceInternal`)}),(0,h.jsx)(u,{value:`qa`,children:o(`productAnalyticsAudienceQa`)})]})]})})]})}),(0,h.jsx)(t,{title:o(`productAnalyticsDataTitle`),children:(0,h.jsxs)(a,{children:[(0,h.jsx)(n,{layout:`stacked`,title:o(`productAnalyticsCollectedTitle`),description:o(`productAnalyticsCollectedDescription`)}),(0,h.jsx)(n,{layout:`stacked`,title:o(`productAnalyticsExcludedTitle`),description:o(`productAnalyticsExcludedDescription`)}),(0,h.jsx)(n,{layout:`stacked`,title:o(`productAnalyticsAnonymousTitle`),description:o(`productAnalyticsAnonymousDescription`)})]})}),(0,h.jsx)(t,{title:o(`productAnalyticsStatusSectionTitle`),children:(0,h.jsxs)(a,{children:[(0,h.jsx)(n,{layout:`stacked`,title:o(`productAnalyticsStatusTitle`),description:_(g.data,g.isLoading)}),g.data?.lastError?(0,h.jsx)(n,{layout:`stacked`,title:o(`productAnalyticsLastErrorTitle`),description:g.data.lastError}):null]})})]})}function _(e,t){if(t)return o(`productAnalyticsStatusLoading`);if(!e?.lastAttemptAt)return o(`productAnalyticsStatusNever`);let n=new Date(e.lastAttemptAt).toLocaleString();if(!e.lastSuccessAt)return`${o(`productAnalyticsLastAttemptLabel`)} ${n} · ${e.pendingReceiptCount} ${o(`productAnalyticsPendingLabel`)}`;let r=new Date(e.lastSuccessAt).toLocaleString();return`${o(`productAnalyticsLastSuccessLabel`)} ${r} · ${e.pendingReceiptCount} ${o(`productAnalyticsPendingLabel`)}`}export{g as PrivacySettingsPage};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DF37yw5_.js";import{A as t,M as n,O as r}from"./utils-CBZPzC_b.js";import{d as i,f as a,n as o}from"./navigation-link-BAQjgx2F.js";import{Gt as s,Lt as c,Yt as l,bn as u,jn as d,vn as f,yn as p}from"./api-BWFOIoUm.js";import{C as m,a as h,c as g,i as _,n as v,o as y,r as b,s as ee}from"./mcp-marketplace-page-D75hPmzO.js";import{C as te,H as x,P as S,ct as C,st as ne}from"./app-presenter-provider-CDRBc_lQ.js";import{n as w,r as T,s as E,t as D}from"./i18n-ClHx6jwj.js";import{t as O}from"./createLucideIcon-BNKf0_kc.js";import{h as re}from"./app-data-BnrEdmg2.js";import{t as k}from"./chevron-down-BL-yMYcX.js";import{n as ie}from"./ellipsis-C5YXdOUx.js";import{S as ae,a as A,i as j,n as M,r as N,t as P}from"./select-CG5YWnwe.js";import{t as oe}from"./circle-dashed-CU3yApvP.js";import{i as se,n as F,r as ce,t as le}from"./tabs-BuE0qKMh.js";import{t as ue}from"./use-viewport-layout-BS18drMT.js";import{t as de}from"./plus-LA8-jpxP.js";import{t as fe}from"./settings-2-CE3ELQyk.js";import{t as pe}from"./confirm-dialog-BWS7gA_z.js";import{t as I}from"./trash-2-BPPYt2NV.js";import{a as L,i as me,n as R,o as he,r as ge,t as _e}from"./dialog-Xe73hpQz.js";import{a as ve,i as ye,n as be,t as xe}from"./card-BhfAZv5L.js";var Se=O(`CircleX`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Ce=O(`Circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),we=O(`List`,[[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 18h.01`,key:`1tta3j`}],[`path`,{d:`M3 6h.01`,key:`1rqtza`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 18h13`,key:`1lx6n3`}],[`path`,{d:`M8 6h13`,key:`ik3vkj`}]]),Te=O(`Unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]),z=e(n(),1),B=t();function V({title:e,children:t,className:n=``}){return(0,B.jsxs)(xe,{hover:!1,surface:`flat`,className:n,children:[(0,B.jsx)(ye,{className:`p-4 pb-3`,children:(0,B.jsx)(ve,{children:e})}),(0,B.jsx)(be,{className:`p-4 pt-0`,children:t})]})}function H({children:e}){return(0,B.jsx)(`p`,{className:`py-5 text-sm text-muted-foreground`,children:e})}function U({available:e,children:t,className:n,label:r,onOpen:i,path:a}){return e?(0,B.jsx)(`button`,{type:`button`,className:n,title:a,onClick:()=>i(a,r),children:t}):(0,B.jsx)(`div`,{className:n,children:t})}function Ee({agreement:e,isLoading:t,isError:n,onOpenFile:r}){return(0,B.jsxs)(V,{title:E(`projectsAgreementFile`),children:[(0,B.jsx)(`p`,{className:`mb-4 text-sm text-muted-foreground`,children:E(`projectsAgreementDescription`)}),t?(0,B.jsx)(`p`,{className:`py-5 text-sm text-muted-foreground`,children:E(`projectsLoading`)}):n?(0,B.jsx)(`p`,{className:`py-5 text-sm text-destructive`,children:E(`projectsLoadFailed`)}):e?.available?(0,B.jsxs)(U,{available:!0,path:e.path,label:e.path,onOpen:r,className:`block w-full rounded-xl bg-muted/45 p-3 text-left transition-colors enabled:hover:bg-[var(--interaction-hover)] enabled:focus-visible:outline-none enabled:focus-visible:ring-1 enabled:focus-visible:ring-border`,children:[(0,B.jsx)(`span`,{className:`block text-sm font-medium`,children:e.path}),(0,B.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:E(`projectsAgreementOpen`)})]}):(0,B.jsx)(H,{children:E(`projectsNoAgreement`)})]})}var W=e=>[`project-work`,e],G=e=>[`project-work-summary`,e],K=e=>[`project-work-states`,e],q=e=>[`project-work-artifacts`,e],J=(e,t)=>[`project-work-item`,e,t],Y=(e,t)=>[`project-work-activity`,e,t];function De(e,t={}){return m({queryKey:[...W(e??``),t],enabled:!!e,initialPageParam:null,queryFn:async({pageParam:n})=>await c.projects.listWork(e,{...t,...n?{cursor:n}:{}}),getNextPageParam:e=>e.nextCursor})}function Oe(e){return u({queryKey:G(e??``),enabled:!!e,queryFn:async()=>await c.projects.getWorkSummary(e)})}function ke(e){return u({queryKey:K(e??``),enabled:!!e,queryFn:async()=>await c.projects.listWorkStates(e)})}function Ae(e,t={}){return m({queryKey:[...q(e??``),t],enabled:!!e,initialPageParam:null,queryFn:async({pageParam:n})=>await c.projects.listRecentWorkArtifacts(e,{...t,...n?{cursor:n}:{}}),getNextPageParam:e=>e.nextCursor})}function je(e,t){return u({queryKey:J(e??``,t??``),enabled:!!(e&&t),queryFn:async()=>await c.projects.getWorkItem(e,t)})}function Me(e,t){return u({queryKey:Y(e??``,t??``),enabled:!!(e&&t),queryFn:async()=>await c.projects.listWorkItemActivities(e,t,{limit:100})})}function X(e){let t=d(),n=async n=>{await Promise.all([t.invalidateQueries({queryKey:W(e)}),t.invalidateQueries({queryKey:G(e)}),t.invalidateQueries({queryKey:K(e)}),t.invalidateQueries({queryKey:q(e)}),...n?[t.invalidateQueries({queryKey:J(e,n)}),t.invalidateQueries({queryKey:Y(e,n)})]:[]])};return{createItem:p({mutationFn:async t=>await c.projects.createWorkItem(e,t),onSuccess:async e=>await n(e.id)}),updateItem:p({mutationFn:async t=>await c.projects.updateWorkItem(e,t.workItemId,t.patch),onSuccess:async e=>await n(e.id)}),deleteItem:p({mutationFn:async t=>await c.projects.deleteWorkItem(e,t),onSuccess:async e=>await n(e.id)}),restoreItem:p({mutationFn:async t=>await c.projects.restoreWorkItem(e,t),onSuccess:async e=>await n(e.id)}),linkArtifact:p({mutationFn:async t=>await c.projects.linkWorkItemArtifact(e,t.workItemId,{path:t.path,...t.label?{label:t.label}:{}}),onSuccess:async(e,t)=>await n(t.workItemId)}),unlinkArtifact:p({mutationFn:async t=>await c.projects.unlinkWorkItemArtifact(e,t.workItemId,t.artifactLinkId),onSuccess:async(e,t)=>await n(t.workItemId)}),createState:p({mutationFn:async t=>await c.projects.createWorkState(e,t),onSuccess:async()=>await n()}),updateState:p({mutationFn:async t=>await c.projects.updateWorkState(e,t.stateId,t.patch),onSuccess:async()=>await n()}),deleteState:p({mutationFn:async t=>await c.projects.deleteWorkState(e,t.stateId,t.migrateToStateId),onSuccess:async()=>await n()})}}function Z(e){let t=d();(0,z.useEffect)(()=>{if(e)return c.eventBus.on(r.projectWorkChanged,n=>{n.projectId===e&&(t.invalidateQueries({queryKey:W(e)}),t.invalidateQueries({queryKey:G(e)}),t.invalidateQueries({queryKey:K(e)}),t.invalidateQueries({queryKey:q(e)}),n.workItemId&&(t.invalidateQueries({queryKey:J(e,n.workItemId)}),t.invalidateQueries({queryKey:Y(e,n.workItemId)})))})},[e,t])}function Ne(e){return[...e].sort((e,t)=>e.position-t.position||e.name.localeCompare(t.name))}var Pe={started:0,unstarted:1,backlog:2,completed:3,canceled:4};function Fe(e){return[...e].sort((e,t)=>{let n=Pe[e.category]-Pe[t.category];return n===0?e.category===`completed`||e.category===`canceled`?e.position-t.position||e.name.localeCompare(t.name):t.position-e.position||e.name.localeCompare(t.name):n})}function Q(e,t){return`${e}${e.endsWith(`/`)||e.endsWith(`\\`)?``:`/`}${t}`}function Ie(e,t=new Date){if(!e)return`-`;let n=new Date(e),r=t.getTime()-n.getTime();if(Number.isNaN(n.getTime()))return e;if(r<6e4)return E(`projectsTimeJustNow`);let i=Math.floor(r/6e4);if(i<60)return E(`projectsTimeMinutesAgo`).replace(`{count}`,String(i));let a=Math.floor(i/60);if(a<24)return E(`projectsTimeHoursAgo`).replace(`{count}`,String(a));let o=Math.floor(a/24);return o===1?E(`projectsTimeYesterday`):o<7?E(`projectsTimeDaysAgo`).replace(`{count}`,String(o)):D(e)}var Le=20;function Re({projectId:e,onOpenFile:t}){let[n,r]=(0,z.useState)(``),i=Ae(e,{limit:Le,...n.trim()?{query:n.trim()}:{}}),a=i.data?.pages??[],o=a.flatMap(e=>e.artifacts),s=a[0]?.total??0;return i.isLoading?(0,B.jsx)(`p`,{className:`py-5 text-sm text-muted-foreground`,children:E(`projectsLoading`)}):i.isError?(0,B.jsx)(`p`,{className:`py-5 text-sm text-destructive`,children:E(`projectsLoadFailed`)}):(0,B.jsxs)(`section`,{className:`min-w-0`,"aria-label":E(`projectsArtifacts`),children:[(0,B.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-3`,children:[(0,B.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[T(s),` `,E(`projectsArtifactsCountSuffix`)]}),(0,B.jsx)(`input`,{type:`search`,value:n,className:`h-8 w-full min-w-0 rounded-lg border border-border/60 bg-transparent px-3 text-sm outline-none placeholder:text-muted-foreground sm:w-60`,placeholder:E(`projectsArtifactsSearchPlaceholder`),onChange:e=>r(e.target.value)})]}),o.length?(0,B.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border/60`,children:[(0,B.jsx)(`div`,{className:`divide-y divide-border/60`,children:o.map(e=>(0,B.jsxs)(U,{available:e.exists,path:e.path,label:e.label??e.path,onOpen:t,className:`flex w-full min-w-0 items-center gap-3 px-3 py-3 text-left text-sm transition-colors enabled:hover:bg-[var(--interaction-hover)] enabled:focus-visible:outline-none enabled:focus-visible:ring-1 enabled:focus-visible:ring-border`,children:[(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`span`,{className:`block truncate font-medium`,children:e.label??e.path}),(0,B.jsxs)(`span`,{className:`mt-1 block truncate text-xs text-muted-foreground`,children:[e.path,` · `,e.workItemTitle]})]}),(0,B.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground`,dateTime:e.createdAt,title:w(e.createdAt),children:Ie(e.createdAt)}),e.exists?null:(0,B.jsx)(`span`,{className:`shrink-0 text-xs text-destructive`,children:E(`projectsUnavailable`)})]},e.id))}),i.hasNextPage?(0,B.jsx)(`button`,{type:`button`,className:`w-full border-t border-border/60 px-3 py-2.5 text-left text-sm text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,disabled:i.isFetchingNextPage,onClick:()=>void i.fetchNextPage(),children:i.isFetchingNextPage?E(`projectsLoading`):E(`projectsArtifactsShowMore`)}):null]}):(0,B.jsx)(H,{children:n.trim()?E(`projectsArtifactsNoMatches`):E(`projectsNoArtifacts`)})]})}var ze={Backlog:`projectsWorkState_backlog`,Planned:`projectsWorkState_planned`,"In Progress":`projectsWorkState_inProgress`,"In Review":`projectsWorkState_inReview`,"Awaiting Acceptance":`projectsWorkState_awaitingAcceptance`,Completed:`projectsWorkState_completed`,Canceled:`projectsWorkState_canceled`};function $(e,t){let n=ze[e];return n?t?E(n,t):E(n):e}function Be({projectId:e,onOpenArtifact:t,onOpenWorkItem:n}){Z(e);let r=Oe(e),i=De(e,{limit:5}),a=Ae(e,{limit:5}),o=a.data?.pages[0]?.artifacts??[],s=i.data?.pages.flatMap(e=>e.items).slice(0,5)??[];return(0,B.jsxs)(`div`,{className:`space-y-5`,children:[(0,B.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,"aria-label":E(`projectsWorkSummary`),children:r.data?[[`projectsWorkTotal`,r.data.total],[`projectsWorkActive`,r.data.active],[`projectsWorkNeedsAttention`,r.data.attention],[`projectsWorkCompleted`,r.data.completed]].map(([e,t])=>(0,B.jsxs)(`div`,{className:`rounded-xl border border-border/60 bg-card p-4`,children:[(0,B.jsx)(`div`,{className:`text-2xl font-semibold`,children:t}),(0,B.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:E(e)})]},e)):(0,B.jsx)(`div`,{className:`col-span-full rounded-xl border border-border/60 p-5 text-sm text-muted-foreground`,children:r.isError?E(`projectsLoadFailed`):E(`projectsLoading`)})}),(0,B.jsxs)(`div`,{className:`grid min-w-0 gap-4 lg:grid-cols-2`,children:[(0,B.jsx)(V,{title:E(`projectsWorkRecentlyUpdated`),children:i.isLoading?(0,B.jsx)(`p`,{className:`py-5 text-sm text-muted-foreground`,children:E(`projectsLoading`)}):i.isError?(0,B.jsx)(`p`,{className:`py-5 text-sm text-destructive`,children:E(`projectsLoadFailed`)}):s.length?(0,B.jsx)(`div`,{className:`space-y-2`,children:s.map(e=>(0,B.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-3 rounded-xl bg-muted/45 px-3 py-3 text-left transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:()=>n(e.id),children:[(0,B.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium`,children:e.title}),(0,B.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:$(e.state.name)})]},e.id))}):(0,B.jsx)(H,{children:E(`projectsWorkEmpty`)})}),(0,B.jsx)(V,{title:E(`projectsRecentArtifacts`),children:a.isLoading?(0,B.jsx)(`p`,{className:`py-5 text-sm text-muted-foreground`,children:E(`projectsLoading`)}):a.isError?(0,B.jsx)(`p`,{className:`py-5 text-sm text-destructive`,children:E(`projectsLoadFailed`)}):o.length?(0,B.jsx)(`div`,{className:`space-y-2`,children:o.map(e=>(0,B.jsxs)(U,{available:e.exists,path:e.path,label:e.label??e.path,onOpen:t,className:`block w-full rounded-xl bg-muted/45 p-3 text-left text-sm transition-colors enabled:hover:bg-[var(--interaction-hover)] enabled:focus-visible:outline-none enabled:focus-visible:ring-1 enabled:focus-visible:ring-border`,children:[(0,B.jsx)(`span`,{className:`block truncate font-medium`,children:e.label??e.path}),(0,B.jsxs)(`span`,{className:`mt-1 block truncate text-xs text-muted-foreground`,children:[e.workItemTitle,(0,B.jsx)(`time`,{dateTime:e.createdAt,title:w(e.createdAt),children:` · ${Ie(e.createdAt)}`}),e.exists?``:` · ${E(`projectsUnavailable`)}`]})]},e.id))}):(0,B.jsx)(H,{children:E(`projectsNoRecentArtifacts`)})})]})]})}function Ve({skills:e,isLoading:t,isError:n,onOpen:r}){return t?(0,B.jsx)(`p`,{className:`py-5 text-sm text-muted-foreground`,children:E(`projectsLoading`)}):n?(0,B.jsx)(`p`,{className:`py-5 text-sm text-destructive`,children:E(`projectsLoadFailed`)}):(0,B.jsxs)(`section`,{className:`min-w-0`,"aria-label":E(`projectsSkills`),children:[(0,B.jsxs)(`p`,{className:`mb-3 text-sm text-muted-foreground`,children:[T(e.length),` `,E(`projectsSkillsCountSuffix`)]}),e.length?(0,B.jsx)(`div`,{className:`grid min-w-0 gap-3 md:grid-cols-2`,children:e.map(e=>(0,B.jsxs)(`button`,{type:`button`,className:`min-w-0 rounded-xl border border-border/60 p-3 text-left transition-colors hover:border-border hover:bg-muted/30 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:()=>r(e),children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium`,children:e.name}),(0,B.jsx)(`p`,{className:`mt-1 truncate text-xs text-muted-foreground`,title:e.path,children:e.path}),(0,B.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs text-muted-foreground`,title:e.description??e.ref,children:e.description??e.ref})]},e.ref))}):(0,B.jsx)(H,{children:E(`projectsNoSkills`)})]})}function He({onOpenArtifact:e,onOpenChange:t,projectId:n,projectRoot:r,workItemId:i}){let a=je(n,i),o=Me(n,i);Z(n);let s=ke(n);return(0,B.jsx)(b,{open:!!i,onOpenChange:t,children:(0,B.jsxs)(_,{side:`right`,closeLabel:E(`projectsCloseDetails`),className:`flex h-full w-full flex-col overflow-hidden p-0 sm:max-w-[680px]`,children:[a.isLoading?(0,B.jsx)(`div`,{className:`p-6 text-sm text-muted-foreground`,children:E(`projectsLoading`)}):null,a.isError?(0,B.jsx)(`div`,{className:`p-6 text-sm text-destructive`,children:E(`projectsWorkItemLoadFailed`)}):null,a.data?(0,B.jsx)(Ue,{item:a.data,states:s.data??[],activities:o.data?.activities??[],onOpenArtifact:(t,n)=>e(Q(r,t),n),onClose:()=>t(!1)},`${a.data.id}:${a.data.version}`):null]})})}function Ue({activities:e,item:t,onClose:n,onOpenArtifact:r,states:i}){let a=X(t.projectId),[c,u]=(0,z.useState)(t.title),[d,p]=(0,z.useState)(t.description),[m,_]=(0,z.useState)(t.stateId),[b,te]=(0,z.useState)(t.attention),[x,S]=(0,z.useState)(``),[C,w]=(0,z.useState)(``),[T,D]=(0,z.useState)(!1),O=async(e,t)=>{try{await e(),t?.()}catch(e){f.error(e instanceof Error?e.message:E(`projectsWorkActionFailed`))}},re=async()=>{try{await a.updateItem.mutateAsync({workItemId:t.id,patch:{title:c,description:d,stateId:m,attention:b,expectedVersion:t.version}}),f.success(E(`projectsWorkItemSaved`))}catch(e){f.error(e instanceof Error?e.message:E(`projectsWorkItemSaveFailed`))}},k=async()=>{if(x.trim())try{await a.linkArtifact.mutateAsync({workItemId:t.id,path:x.trim(),...C.trim()?{label:C.trim()}:{}}),S(``),w(``)}catch(e){f.error(e instanceof Error?e.message:E(`projectsWorkArtifactLinkFailed`))}};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(ee,{className:`shrink-0 border-b border-border/60 px-5 pb-5 pt-6 pr-14 sm:px-7 sm:pt-7`,children:[(0,B.jsx)(g,{children:E(`projectsWorkDetails`)}),(0,B.jsxs)(h,{children:[t.id,` · `,E(`projectsWorkVersion`),` `,t.version]})]}),(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-6 overflow-y-auto px-5 py-6 sm:px-7`,children:[(0,B.jsxs)(`section`,{className:`space-y-3`,children:[(0,B.jsx)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:E(`projectsWorkTitle`)}),(0,B.jsx)(s,{value:c,onChange:e=>u(e.target.value)}),(0,B.jsx)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:E(`projectsWorkDescription`)}),(0,B.jsx)(v,{className:`min-h-28`,value:d,onChange:e=>p(e.target.value)}),(0,B.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-muted-foreground`,children:E(`projectsStatus`)}),(0,B.jsxs)(P,{value:m,onValueChange:_,children:[(0,B.jsx)(j,{children:(0,B.jsx)(A,{})}),(0,B.jsx)(M,{children:i.map(e=>(0,B.jsx)(N,{value:e.id,children:$(e.name)},e.id))})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-muted-foreground`,children:E(`projectsWorkAttention`)}),(0,B.jsxs)(P,{value:b,onValueChange:e=>te(e),children:[(0,B.jsx)(j,{children:(0,B.jsx)(A,{})}),(0,B.jsxs)(M,{children:[(0,B.jsx)(N,{value:`none`,children:E(`projectsWorkAttention_none`)}),(0,B.jsx)(N,{value:`blocked`,children:E(`projectsWorkAttention_blocked`)}),(0,B.jsx)(N,{value:`awaiting-user`,children:E(`projectsWorkAttention_awaiting-user`)})]})]})]})]})]}),(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`mb-3 text-sm font-semibold`,children:E(`projectsWorkArtifacts`)}),(0,B.jsxs)(`div`,{className:`space-y-2`,children:[t.artifacts.map(e=>(0,B.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl border border-border/60 p-2`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 rounded-lg px-2 py-1 text-left hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:()=>r(e.path,e.label??e.path),children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-2 truncate text-sm font-medium`,children:[(0,B.jsx)(o,{className:`h-3.5 w-3.5 shrink-0`}),e.label??e.path]}),(0,B.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:e.path})]}),(0,B.jsx)(l,{size:`icon`,variant:`ghost`,"aria-label":E(`projectsWorkUnlinkArtifact`),onClick:()=>void O(()=>a.unlinkArtifact.mutateAsync({workItemId:t.id,artifactLinkId:e.id})),children:(0,B.jsx)(Te,{className:`h-4 w-4`})})]},e.id)),t.artifacts.length?null:(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:E(`projectsWorkNoArtifacts`)})]}),(0,B.jsxs)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-[1fr_12rem_auto]`,children:[(0,B.jsx)(s,{value:x,onChange:e=>S(e.target.value),placeholder:E(`projectsWorkArtifactPath`)}),(0,B.jsx)(s,{value:C,onChange:e=>w(e.target.value),placeholder:E(`projectsWorkArtifactLabel`)}),(0,B.jsxs)(l,{variant:`outline`,onClick:()=>void k(),disabled:!x.trim()||a.linkArtifact.isPending,children:[(0,B.jsx)(ne,{className:`mr-2 h-4 w-4`}),E(`projectsWorkLinkArtifact`)]})]})]}),(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`mb-3 text-sm font-semibold`,children:E(`projectsActivity`)}),(0,B.jsx)(`ol`,{className:`space-y-2`,children:e.map(e=>(0,B.jsxs)(`li`,{className:`rounded-xl bg-muted/35 px-3 py-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:E(`projectsWorkActivity_${e.type}`)}),(0,B.jsxs)(`span`,{className:`ml-2 text-xs text-muted-foreground`,children:[e.actor.kind,` ·`,` `,new Date(e.createdAt).toLocaleString()]})]},e.id))})]})]}),(0,B.jsxs)(y,{className:`shrink-0 border-t border-border/60 bg-background px-5 py-4 sm:px-7`,children:[t.deletedAt?(0,B.jsx)(l,{variant:`outline`,onClick:()=>void O(()=>a.restoreItem.mutateAsync(t.id)),children:E(`projectsRestore`)}):(0,B.jsxs)(l,{variant:`destructive`,onClick:()=>D(!0),children:[(0,B.jsx)(I,{className:`mr-2 h-4 w-4`}),E(`projectsDelete`)]}),(0,B.jsx)(l,{onClick:()=>void re(),disabled:!c.trim()||a.updateItem.isPending,children:E(`save`)})]}),(0,B.jsx)(pe,{open:T,onOpenChange:D,title:E(`projectsDeleteWorkItem`),description:E(`projectsDeleteWorkItemDescription`),confirmLabel:E(`projectsDelete`),variant:`destructive`,onCancel:()=>D(!1),onConfirm:()=>void O(()=>a.deleteItem.mutateAsync(t.id),n)})]})}var We=[`backlog`,`unstarted`,`started`,`completed`,`canceled`];function Ge({open:e,onOpenChange:t,projectId:n,states:r}){let i=X(n),a=Ne(r),[o,c]=(0,z.useState)(``),[u,d]=(0,z.useState)(`unstarted`),[p,m]=(0,z.useState)(null),[h,g]=(0,z.useState)(``),_=async e=>{try{await e()}catch(e){f.error(e instanceof Error?e.message:E(`projectsWorkActionFailed`))}},v=async()=>{o.trim()&&await _(async()=>{await i.createState.mutateAsync({name:o.trim(),category:u}),c(``)})},y=async(e,t)=>{let n=a[e],r=a[e+t];!n||!r||await _(async()=>{await i.updateState.mutateAsync({stateId:n.id,patch:{position:r.position}}),await i.updateState.mutateAsync({stateId:r.id,patch:{position:n.position}})})};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(_e,{open:e,onOpenChange:t,children:(0,B.jsxs)(R,{className:`max-h-[85vh] overflow-y-auto sm:max-w-2xl`,children:[(0,B.jsxs)(L,{children:[(0,B.jsx)(he,{children:E(`projectsWorkStateSettings`)}),(0,B.jsx)(ge,{children:E(`projectsWorkStateSettingsDescription`)})]}),(0,B.jsx)(`div`,{className:`space-y-2`,children:a.map((e,t)=>(0,B.jsxs)(`div`,{className:`grid gap-2 rounded-xl border border-border/60 p-3 sm:grid-cols-[1fr_11rem_auto]`,children:[(0,B.jsx)(s,{"aria-label":E(`projectsWorkStateName`),defaultValue:$(e.name),onBlur:t=>{let n=t.currentTarget.value.trim();n&&n!==$(e.name)&&_(()=>i.updateState.mutateAsync({stateId:e.id,patch:{name:n}}))}}),(0,B.jsxs)(P,{value:e.category,onValueChange:t=>void _(()=>i.updateState.mutateAsync({stateId:e.id,patch:{category:t}})),children:[(0,B.jsx)(j,{"aria-label":E(`projectsWorkStateCategory`),children:(0,B.jsx)(A,{})}),(0,B.jsx)(M,{children:We.map(e=>(0,B.jsx)(N,{value:e,children:E(`projectsWorkCategory_${e}`)},e))})]}),(0,B.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,B.jsx)(l,{size:`icon`,variant:`ghost`,"aria-label":E(`projectsMoveUp`),disabled:t===0,onClick:()=>void y(t,-1),children:(0,B.jsx)(ae,{className:`h-4 w-4`})}),(0,B.jsx)(l,{size:`icon`,variant:`ghost`,"aria-label":E(`projectsMoveDown`),disabled:t===a.length-1,onClick:()=>void y(t,1),children:(0,B.jsx)(k,{className:`h-4 w-4`})}),(0,B.jsx)(l,{size:`icon`,variant:`ghost`,"aria-label":E(`projectsDeleteState`),disabled:a.length<=1,onClick:()=>{m(e),g(``)},children:(0,B.jsx)(I,{className:`h-4 w-4`})})]}),(0,B.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-muted-foreground sm:col-span-3`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`default-state`,checked:e.isDefault,onChange:()=>void _(()=>i.updateState.mutateAsync({stateId:e.id,patch:{isDefault:!0}}))}),E(`projectsWorkDefaultState`)]})]},e.id))}),(0,B.jsxs)(`div`,{className:`grid gap-2 border-t border-border/60 pt-4 sm:grid-cols-[1fr_11rem_auto]`,children:[(0,B.jsx)(s,{value:o,onChange:e=>c(e.target.value),placeholder:E(`projectsWorkNewState`)}),(0,B.jsxs)(P,{value:u,onValueChange:e=>d(e),children:[(0,B.jsx)(j,{children:(0,B.jsx)(A,{})}),(0,B.jsx)(M,{children:We.map(e=>(0,B.jsx)(N,{value:e,children:E(`projectsWorkCategory_${e}`)},e))})]}),(0,B.jsxs)(l,{onClick:()=>void v(),disabled:!o.trim()||i.createState.isPending,children:[(0,B.jsx)(de,{className:`mr-2 h-4 w-4`}),E(`projectsAdd`)]})]})]})}),(0,B.jsx)(_e,{open:!!p,onOpenChange:e=>{e||m(null)},children:(0,B.jsxs)(R,{children:[(0,B.jsxs)(L,{children:[(0,B.jsx)(he,{children:E(`projectsDeleteState`)}),(0,B.jsx)(ge,{children:E(`projectsDeleteStateDescription`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:E(`projectsWorkStateMigration`)}),(0,B.jsxs)(P,{value:h,onValueChange:g,children:[(0,B.jsx)(j,{children:(0,B.jsx)(A,{placeholder:E(`projectsWorkStateMigrationOptional`)})}),(0,B.jsx)(M,{children:a.filter(e=>e.id!==p?.id).map(e=>(0,B.jsx)(N,{value:e.id,children:$(e.name)},e.id))})]})]}),(0,B.jsxs)(me,{children:[(0,B.jsx)(l,{variant:`outline`,onClick:()=>m(null),children:E(`cancel`)}),(0,B.jsx)(l,{variant:`destructive`,onClick:()=>{p&&_(async()=>{await i.deleteState.mutateAsync({stateId:p.id,migrateToStateId:h||null}),m(null)})},children:E(`projectsDelete`)})]})]})})]})}function Ke({startedProgress:e,state:t}){if(t.category===`backlog`)return(0,B.jsx)(`span`,{"aria-hidden":`true`,"data-state-visual":`backlog`,className:`inline-flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground/65`,children:(0,B.jsx)(oe,{className:`h-4 w-4`})});if(t.category===`unstarted`)return(0,B.jsx)(`span`,{"aria-hidden":`true`,"data-state-visual":`unstarted`,className:`inline-flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground`,children:(0,B.jsx)(Ce,{className:`h-4 w-4`,strokeWidth:2})});if(t.category===`completed`)return(0,B.jsx)(`span`,{"aria-hidden":`true`,"data-state-visual":`completed`,className:`inline-flex h-4 w-4 shrink-0 items-center justify-center text-emerald-600 dark:text-emerald-400`,children:(0,B.jsx)(re,{className:`h-4 w-4`,strokeWidth:2.25})});if(t.category===`canceled`)return(0,B.jsx)(`span`,{"aria-hidden":`true`,"data-state-visual":`canceled`,className:`inline-flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground/65`,children:(0,B.jsx)(Se,{className:`h-4 w-4`})});let n=Math.round((e??.5)*100),r=n>=67?`text-emerald-600 dark:text-emerald-400`:n>=40?`text-orange-500 dark:text-orange-400`:`text-amber-500 dark:text-amber-400`;return(0,B.jsx)(`span`,{"aria-hidden":`true`,"data-state-visual":`started`,className:`inline-flex h-4 w-4 shrink-0 items-center justify-center ${r}`,children:(0,B.jsxs)(`svg`,{className:`h-4 w-4`,viewBox:`0 0 16 16`,fill:`none`,children:[(0,B.jsx)(`circle`,{cx:`8`,cy:`8`,r:`5.5`,stroke:`currentColor`,strokeWidth:`1.75`,opacity:`0.22`}),(0,B.jsx)(`circle`,{cx:`8`,cy:`8`,r:`5.5`,pathLength:`100`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeDasharray:`${n} ${100-n}`,transform:`rotate(-90 8 8)`})]})})}function qe({item:e,onOpen:t}){return(0,B.jsxs)(`button`,{type:`button`,className:`w-full rounded-xl border border-border/50 bg-card p-3 text-left text-sm shadow-sm transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:t,children:[(0,B.jsx)(`span`,{className:`block font-medium`,children:e.title}),(0,B.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,B.jsx)(`span`,{children:$(e.state.name)}),e.attention===`none`?null:(0,B.jsx)(`span`,{className:`rounded-full bg-amber-500/15 px-2 py-0.5 text-amber-700 dark:text-amber-300`,children:E(`projectsWorkAttention_${e.attention}`)}),e.deletedAt?(0,B.jsx)(`span`,{children:E(`projectsDeleted`)}):null]})]})}function Je({hasNextPage:e,isError:t,isFetchingNextPage:n,isLoading:r,items:i,onLoadMore:a,onOpenWorkItem:o}){return r?(0,B.jsx)(`p`,{className:`py-3 text-xs text-muted-foreground`,children:E(`projectsLoading`)}):t?(0,B.jsx)(`p`,{className:`py-3 text-xs text-destructive`,children:E(`projectsLoadFailed`)}):(0,B.jsxs)(B.Fragment,{children:[i.length?i.map(e=>(0,B.jsx)(qe,{item:e,onOpen:()=>o(e.id)},e.id)):(0,B.jsx)(`p`,{className:`py-3 text-xs text-muted-foreground`,children:E(`projectsNoData`)}),e?(0,B.jsx)(l,{type:`button`,variant:`ghost`,size:`sm`,className:`w-full`,disabled:n,onClick:a,children:E(n?`projectsLoading`:`projectsWorkLoadMore`)}):null]})}function Ye({includeDeleted:e,onOpenWorkItem:t,state:n,startedProgress:r,view:i}){let[a,o]=(0,z.useState)(!1),s=De(n.projectId,{stateId:n.id,includeDeleted:e,limit:20}),c=s.data?.pages.flatMap(e=>e.items)??[],l=s.data?.pages[0]?.total;return(0,B.jsxs)(`section`,{className:i===`board`?`flex h-full min-h-0 min-w-0 flex-col overflow-hidden`:`min-w-0`,"aria-label":$(n.name),children:[(0,B.jsxs)(`button`,{type:`button`,className:`flex w-full shrink-0 items-center gap-2 rounded-lg px-1 py-2 text-left transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,"aria-expanded":!a,onClick:()=>o(e=>!e),children:[a?(0,B.jsx)(ie,{className:`h-4 w-4 shrink-0`}):(0,B.jsx)(k,{className:`h-4 w-4 shrink-0`}),(0,B.jsx)(Ke,{state:n,startedProgress:r}),(0,B.jsx)(`span`,{className:`min-w-0 truncate text-sm font-semibold`,children:$(n.name)}),(0,B.jsx)(`span`,{className:`ml-0.5 shrink-0 text-xs font-medium tabular-nums text-muted-foreground`,children:l??`…`})]}),a?null:(0,B.jsx)(`div`,{className:i===`board`?`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain px-1 pb-3`:`space-y-2 px-1 pb-3`,children:(0,B.jsx)(Je,{hasNextPage:s.hasNextPage,isError:s.isError,isFetchingNextPage:s.isFetchingNextPage,isLoading:s.isLoading,items:c,onLoadMore:()=>void s.fetchNextPage(),onOpenWorkItem:t})})]})}function Xe({onOpenWorkItem:e,projectId:t}){let[n,r]=(0,z.useState)(`list`),[i,a]=(0,z.useState)(!1),[o,c]=(0,z.useState)(``),[u,d]=(0,z.useState)(!1);Z(t);let p=ke(t),m=X(t),h=async()=>{if(o.trim())try{let t=await m.createItem.mutateAsync({title:o.trim()});c(``),e(t.id)}catch(e){f.error(e instanceof Error?e.message:E(`projectsWorkItemCreateFailed`))}};if(p.isLoading)return(0,B.jsx)(`div`,{className:`rounded-xl border border-border/60 p-5 text-sm text-muted-foreground`,children:E(`projectsLoading`)});if(p.isError)return(0,B.jsx)(`div`,{className:`rounded-xl border border-destructive/40 p-5 text-sm text-destructive`,children:E(`projectsLoadFailed`)});let g=Ne(p.data??[]),_=Fe(p.data??[]),v=g.filter(e=>e.category===`started`),y=new Map(v.map((e,t)=>[e.id,(t+1)/(v.length+1)]));return(0,B.jsxs)(`section`,{"aria-label":E(`projectsWork`),className:`min-w-0 space-y-4`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-[16rem] flex-1 gap-2`,children:[(0,B.jsx)(s,{value:o,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&h()},placeholder:E(`projectsWorkNewItem`)}),(0,B.jsxs)(l,{onClick:()=>void h(),disabled:!o.trim()||m.createItem.isPending,children:[(0,B.jsx)(de,{className:`mr-2 h-4 w-4`}),E(`projectsCreate`)]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1 rounded-xl bg-muted/40 p-1`,role:`group`,"aria-label":E(`projectsWorkViews`),children:[(0,B.jsxs)(l,{size:`sm`,variant:n===`list`?`secondary`:`ghost`,"aria-pressed":n===`list`,onClick:()=>r(`list`),children:[(0,B.jsx)(we,{className:`mr-2 h-4 w-4`}),E(`projectsWorkList`)]}),(0,B.jsxs)(l,{size:`sm`,variant:n===`board`?`secondary`:`ghost`,"aria-pressed":n===`board`,onClick:()=>r(`board`),children:[(0,B.jsx)(C,{className:`mr-2 h-4 w-4`}),E(`projectsWorkBoard`)]})]}),(0,B.jsxs)(l,{variant:`outline`,size:`sm`,onClick:()=>d(!0),children:[(0,B.jsx)(fe,{className:`mr-2 h-4 w-4`}),E(`projectsWorkStateSettings`)]})]}),(0,B.jsxs)(`label`,{className:`flex w-fit items-center gap-2 text-xs text-muted-foreground`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>a(e.target.checked)}),E(`projectsWorkShowDeleted`)]}),n===`list`?(0,B.jsx)(`div`,{className:`space-y-3`,children:_.map(t=>(0,B.jsx)(Ye,{state:t,startedProgress:y.get(t.id)??null,view:n,includeDeleted:i,onOpenWorkItem:e},t.id))}):null,n===`board`?(0,B.jsx)(`div`,{className:`grid h-[calc(100dvh-17rem)] min-h-[28rem] max-h-[52rem] min-w-0 auto-cols-[minmax(18rem,1fr)] grid-flow-col items-stretch gap-3 overflow-x-auto overflow-y-hidden pb-2`,children:g.map(t=>(0,B.jsx)(Ye,{state:t,startedProgress:y.get(t.id)??null,view:n,includeDeleted:i,onOpenWorkItem:e},t.id))}):null,(0,B.jsx)(Ge,{open:u,onOpenChange:d,projectId:t,states:g})]})}var Ze=e=>[`project-agreement`,e],Qe=e=>[`project-skills`,e];function $e(e){return u({queryKey:Ze(e??``),enabled:!!e,queryFn:async()=>await c.projects.getAgreement(e)})}function et(e){return u({queryKey:Qe(e??``),enabled:!!e,queryFn:async()=>await c.projects.listProjectSkills(e)})}function tt(e){return e===`overview`||e===`work`||e===`artifacts`||e===`skills`||e===`agreement`}var nt=[`overview`,`work`,`artifacts`,`skills`,`agreement`];function rt(){let{projectId:e,tab:t}=a(),n=i(),r=x(),{isMobile:o}=ue(),s=S(),[c,l]=(0,z.useState)(null),u=s.data?.projects??[],d=u.find(t=>t.id===e)??null,f=tt(t)?t:null,p=$e(f===`agreement`?d?.id??null:null),m=et(f===`skills`?d?.id??null:null);if(s.isLoading)return(0,B.jsx)(`main`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:E(`projectsLoading`)});if(s.isError)return(0,B.jsxs)(`main`,{className:`p-6 text-sm text-destructive`,children:[E(`projectsLoadFailed`),`: `,s.error.message]});if(!u.length)return(0,B.jsx)(`main`,{className:`p-6 text-sm text-muted-foreground`,children:E(`projectsEmpty`)});if(!d||!f)return(0,B.jsx)(`main`,{className:`p-6 text-sm text-muted-foreground`,children:E(`projectsChoose`)});let h=(e,t)=>r.chatThreadManager.openFilePreview({path:e,label:t,viewMode:`preview`,previewViewer:`rendered`});return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`main`,{className:`h-full min-w-0 flex-1 overflow-y-auto p-3 sm:p-4 md:p-6`,children:(0,B.jsxs)(`div`,{className:`mx-auto max-w-6xl space-y-4`,children:[(0,B.jsxs)(`header`,{className:`rounded-2xl border border-border/60 bg-card p-3 sm:p-4`,children:[(0,B.jsx)(`h1`,{className:`text-lg font-semibold`,children:d.name}),(0,B.jsx)(`p`,{className:`mt-1 break-all text-xs text-muted-foreground`,children:d.rootPath})]}),(0,B.jsxs)(le,{value:f,onValueChange:e=>n(`/projects/${encodeURIComponent(d.id)}/${e}`),children:[(0,B.jsx)(`div`,{className:`min-w-0 overflow-x-auto pb-1`,children:(0,B.jsx)(ce,{className:`w-max`,children:nt.map(e=>(0,B.jsx)(se,{value:e,children:E(`projects${e[0].toUpperCase()}${e.slice(1)}`)},e))})}),(0,B.jsx)(F,{value:`overview`,className:`mt-4`,children:(0,B.jsx)(Be,{projectId:d.id,onOpenArtifact:(e,t)=>h(Q(d.rootPath,e),t),onOpenWorkItem:l})}),(0,B.jsx)(F,{value:`work`,className:`mt-4`,children:(0,B.jsx)(Xe,{projectId:d.id,onOpenWorkItem:l})}),(0,B.jsx)(F,{value:`artifacts`,className:`mt-4`,children:(0,B.jsx)(Re,{projectId:d.id,onOpenFile:(e,t)=>h(Q(d.rootPath,e),t)})}),(0,B.jsx)(F,{value:`skills`,className:`mt-4`,children:(0,B.jsx)(Ve,{skills:m.data??[],isLoading:m.isLoading,isError:m.isError,onOpen:e=>h(Q(d.rootPath,e.path),e.name)})}),(0,B.jsx)(F,{value:`agreement`,className:`mt-4`,children:(0,B.jsx)(Ee,{agreement:p.data,isLoading:p.isLoading,isError:p.isError,onOpenFile:(e,t)=>h(Q(d.rootPath,e),t)})})]})]})}),(0,B.jsx)(He,{projectId:d.id,projectRoot:d.rootPath,workItemId:c,onOpenChange:e=>{e||l(null)},onOpenArtifact:h}),(0,B.jsx)(te,{layoutMode:o?`mobile`:`desktop`,sessionKey:null,projectRoot:d.rootPath})]})}export{rt as ProjectsPage};
1
+ import{i as e}from"./chunk-DF37yw5_.js";import{A as t,M as n,O as r}from"./utils-CBZPzC_b.js";import{d as i,f as a,n as o}from"./navigation-link-BAQjgx2F.js";import{Gt as s,Lt as c,Yt as l,bn as u,jn as d,vn as f,yn as p}from"./api-DqzQ-_3w.js";import{C as m,a as h,c as g,i as _,n as v,o as y,r as b,s as ee}from"./mcp-marketplace-page-FfIfEo6w.js";import{C as te,H as x,P as S,ct as C,st as ne}from"./app-presenter-provider-V0xnU_Wb.js";import{n as w,r as T,s as E,t as D}from"./i18n-20rSH40D.js";import{t as O}from"./createLucideIcon-BNKf0_kc.js";import{h as re}from"./app-data-C54N2p8b.js";import{t as k}from"./chevron-down-BL-yMYcX.js";import{n as ie}from"./ellipsis-C5YXdOUx.js";import{S as ae,a as A,i as j,n as M,r as N,t as P}from"./select-CG5YWnwe.js";import{t as oe}from"./circle-dashed-CU3yApvP.js";import{i as se,n as F,r as ce,t as le}from"./tabs-BuE0qKMh.js";import{t as ue}from"./use-viewport-layout-BS18drMT.js";import{t as de}from"./plus-LA8-jpxP.js";import{t as fe}from"./settings-2-CE3ELQyk.js";import{t as pe}from"./confirm-dialog-BTKCWMn6.js";import{t as I}from"./trash-2-BPPYt2NV.js";import{a as L,i as me,n as R,o as he,r as ge,t as _e}from"./dialog-Xe73hpQz.js";import{a as ve,i as ye,n as be,t as xe}from"./card-BhfAZv5L.js";var Se=O(`CircleX`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Ce=O(`Circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),we=O(`List`,[[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 18h.01`,key:`1tta3j`}],[`path`,{d:`M3 6h.01`,key:`1rqtza`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 18h13`,key:`1lx6n3`}],[`path`,{d:`M8 6h13`,key:`ik3vkj`}]]),Te=O(`Unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]),z=e(n(),1),B=t();function V({title:e,children:t,className:n=``}){return(0,B.jsxs)(xe,{hover:!1,surface:`flat`,className:n,children:[(0,B.jsx)(ye,{className:`p-4 pb-3`,children:(0,B.jsx)(ve,{children:e})}),(0,B.jsx)(be,{className:`p-4 pt-0`,children:t})]})}function H({children:e}){return(0,B.jsx)(`p`,{className:`py-5 text-sm text-muted-foreground`,children:e})}function U({available:e,children:t,className:n,label:r,onOpen:i,path:a}){return e?(0,B.jsx)(`button`,{type:`button`,className:n,title:a,onClick:()=>i(a,r),children:t}):(0,B.jsx)(`div`,{className:n,children:t})}function Ee({agreement:e,isLoading:t,isError:n,onOpenFile:r}){return(0,B.jsxs)(V,{title:E(`projectsAgreementFile`),children:[(0,B.jsx)(`p`,{className:`mb-4 text-sm text-muted-foreground`,children:E(`projectsAgreementDescription`)}),t?(0,B.jsx)(`p`,{className:`py-5 text-sm text-muted-foreground`,children:E(`projectsLoading`)}):n?(0,B.jsx)(`p`,{className:`py-5 text-sm text-destructive`,children:E(`projectsLoadFailed`)}):e?.available?(0,B.jsxs)(U,{available:!0,path:e.path,label:e.path,onOpen:r,className:`block w-full rounded-xl bg-muted/45 p-3 text-left transition-colors enabled:hover:bg-[var(--interaction-hover)] enabled:focus-visible:outline-none enabled:focus-visible:ring-1 enabled:focus-visible:ring-border`,children:[(0,B.jsx)(`span`,{className:`block text-sm font-medium`,children:e.path}),(0,B.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:E(`projectsAgreementOpen`)})]}):(0,B.jsx)(H,{children:E(`projectsNoAgreement`)})]})}var W=e=>[`project-work`,e],G=e=>[`project-work-summary`,e],K=e=>[`project-work-states`,e],q=e=>[`project-work-artifacts`,e],J=(e,t)=>[`project-work-item`,e,t],Y=(e,t)=>[`project-work-activity`,e,t];function De(e,t={}){return m({queryKey:[...W(e??``),t],enabled:!!e,initialPageParam:null,queryFn:async({pageParam:n})=>await c.projects.listWork(e,{...t,...n?{cursor:n}:{}}),getNextPageParam:e=>e.nextCursor})}function Oe(e){return u({queryKey:G(e??``),enabled:!!e,queryFn:async()=>await c.projects.getWorkSummary(e)})}function ke(e){return u({queryKey:K(e??``),enabled:!!e,queryFn:async()=>await c.projects.listWorkStates(e)})}function Ae(e,t={}){return m({queryKey:[...q(e??``),t],enabled:!!e,initialPageParam:null,queryFn:async({pageParam:n})=>await c.projects.listRecentWorkArtifacts(e,{...t,...n?{cursor:n}:{}}),getNextPageParam:e=>e.nextCursor})}function je(e,t){return u({queryKey:J(e??``,t??``),enabled:!!(e&&t),queryFn:async()=>await c.projects.getWorkItem(e,t)})}function Me(e,t){return u({queryKey:Y(e??``,t??``),enabled:!!(e&&t),queryFn:async()=>await c.projects.listWorkItemActivities(e,t,{limit:100})})}function X(e){let t=d(),n=async n=>{await Promise.all([t.invalidateQueries({queryKey:W(e)}),t.invalidateQueries({queryKey:G(e)}),t.invalidateQueries({queryKey:K(e)}),t.invalidateQueries({queryKey:q(e)}),...n?[t.invalidateQueries({queryKey:J(e,n)}),t.invalidateQueries({queryKey:Y(e,n)})]:[]])};return{createItem:p({mutationFn:async t=>await c.projects.createWorkItem(e,t),onSuccess:async e=>await n(e.id)}),updateItem:p({mutationFn:async t=>await c.projects.updateWorkItem(e,t.workItemId,t.patch),onSuccess:async e=>await n(e.id)}),deleteItem:p({mutationFn:async t=>await c.projects.deleteWorkItem(e,t),onSuccess:async e=>await n(e.id)}),restoreItem:p({mutationFn:async t=>await c.projects.restoreWorkItem(e,t),onSuccess:async e=>await n(e.id)}),linkArtifact:p({mutationFn:async t=>await c.projects.linkWorkItemArtifact(e,t.workItemId,{path:t.path,...t.label?{label:t.label}:{}}),onSuccess:async(e,t)=>await n(t.workItemId)}),unlinkArtifact:p({mutationFn:async t=>await c.projects.unlinkWorkItemArtifact(e,t.workItemId,t.artifactLinkId),onSuccess:async(e,t)=>await n(t.workItemId)}),createState:p({mutationFn:async t=>await c.projects.createWorkState(e,t),onSuccess:async()=>await n()}),updateState:p({mutationFn:async t=>await c.projects.updateWorkState(e,t.stateId,t.patch),onSuccess:async()=>await n()}),deleteState:p({mutationFn:async t=>await c.projects.deleteWorkState(e,t.stateId,t.migrateToStateId),onSuccess:async()=>await n()})}}function Z(e){let t=d();(0,z.useEffect)(()=>{if(e)return c.eventBus.on(r.projectWorkChanged,n=>{n.projectId===e&&(t.invalidateQueries({queryKey:W(e)}),t.invalidateQueries({queryKey:G(e)}),t.invalidateQueries({queryKey:K(e)}),t.invalidateQueries({queryKey:q(e)}),n.workItemId&&(t.invalidateQueries({queryKey:J(e,n.workItemId)}),t.invalidateQueries({queryKey:Y(e,n.workItemId)})))})},[e,t])}function Ne(e){return[...e].sort((e,t)=>e.position-t.position||e.name.localeCompare(t.name))}var Pe={started:0,unstarted:1,backlog:2,completed:3,canceled:4};function Fe(e){return[...e].sort((e,t)=>{let n=Pe[e.category]-Pe[t.category];return n===0?e.category===`completed`||e.category===`canceled`?e.position-t.position||e.name.localeCompare(t.name):t.position-e.position||e.name.localeCompare(t.name):n})}function Q(e,t){return`${e}${e.endsWith(`/`)||e.endsWith(`\\`)?``:`/`}${t}`}function Ie(e,t=new Date){if(!e)return`-`;let n=new Date(e),r=t.getTime()-n.getTime();if(Number.isNaN(n.getTime()))return e;if(r<6e4)return E(`projectsTimeJustNow`);let i=Math.floor(r/6e4);if(i<60)return E(`projectsTimeMinutesAgo`).replace(`{count}`,String(i));let a=Math.floor(i/60);if(a<24)return E(`projectsTimeHoursAgo`).replace(`{count}`,String(a));let o=Math.floor(a/24);return o===1?E(`projectsTimeYesterday`):o<7?E(`projectsTimeDaysAgo`).replace(`{count}`,String(o)):D(e)}var Le=20;function Re({projectId:e,onOpenFile:t}){let[n,r]=(0,z.useState)(``),i=Ae(e,{limit:Le,...n.trim()?{query:n.trim()}:{}}),a=i.data?.pages??[],o=a.flatMap(e=>e.artifacts),s=a[0]?.total??0;return i.isLoading?(0,B.jsx)(`p`,{className:`py-5 text-sm text-muted-foreground`,children:E(`projectsLoading`)}):i.isError?(0,B.jsx)(`p`,{className:`py-5 text-sm text-destructive`,children:E(`projectsLoadFailed`)}):(0,B.jsxs)(`section`,{className:`min-w-0`,"aria-label":E(`projectsArtifacts`),children:[(0,B.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-3`,children:[(0,B.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[T(s),` `,E(`projectsArtifactsCountSuffix`)]}),(0,B.jsx)(`input`,{type:`search`,value:n,className:`h-8 w-full min-w-0 rounded-lg border border-border/60 bg-transparent px-3 text-sm outline-none placeholder:text-muted-foreground sm:w-60`,placeholder:E(`projectsArtifactsSearchPlaceholder`),onChange:e=>r(e.target.value)})]}),o.length?(0,B.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border/60`,children:[(0,B.jsx)(`div`,{className:`divide-y divide-border/60`,children:o.map(e=>(0,B.jsxs)(U,{available:e.exists,path:e.path,label:e.label??e.path,onOpen:t,className:`flex w-full min-w-0 items-center gap-3 px-3 py-3 text-left text-sm transition-colors enabled:hover:bg-[var(--interaction-hover)] enabled:focus-visible:outline-none enabled:focus-visible:ring-1 enabled:focus-visible:ring-border`,children:[(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`span`,{className:`block truncate font-medium`,children:e.label??e.path}),(0,B.jsxs)(`span`,{className:`mt-1 block truncate text-xs text-muted-foreground`,children:[e.path,` · `,e.workItemTitle]})]}),(0,B.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground`,dateTime:e.createdAt,title:w(e.createdAt),children:Ie(e.createdAt)}),e.exists?null:(0,B.jsx)(`span`,{className:`shrink-0 text-xs text-destructive`,children:E(`projectsUnavailable`)})]},e.id))}),i.hasNextPage?(0,B.jsx)(`button`,{type:`button`,className:`w-full border-t border-border/60 px-3 py-2.5 text-left text-sm text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,disabled:i.isFetchingNextPage,onClick:()=>void i.fetchNextPage(),children:i.isFetchingNextPage?E(`projectsLoading`):E(`projectsArtifactsShowMore`)}):null]}):(0,B.jsx)(H,{children:n.trim()?E(`projectsArtifactsNoMatches`):E(`projectsNoArtifacts`)})]})}var ze={Backlog:`projectsWorkState_backlog`,Planned:`projectsWorkState_planned`,"In Progress":`projectsWorkState_inProgress`,"In Review":`projectsWorkState_inReview`,"Awaiting Acceptance":`projectsWorkState_awaitingAcceptance`,Completed:`projectsWorkState_completed`,Canceled:`projectsWorkState_canceled`};function $(e,t){let n=ze[e];return n?t?E(n,t):E(n):e}function Be({projectId:e,onOpenArtifact:t,onOpenWorkItem:n}){Z(e);let r=Oe(e),i=De(e,{limit:5}),a=Ae(e,{limit:5}),o=a.data?.pages[0]?.artifacts??[],s=i.data?.pages.flatMap(e=>e.items).slice(0,5)??[];return(0,B.jsxs)(`div`,{className:`space-y-5`,children:[(0,B.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,"aria-label":E(`projectsWorkSummary`),children:r.data?[[`projectsWorkTotal`,r.data.total],[`projectsWorkActive`,r.data.active],[`projectsWorkNeedsAttention`,r.data.attention],[`projectsWorkCompleted`,r.data.completed]].map(([e,t])=>(0,B.jsxs)(`div`,{className:`rounded-xl border border-border/60 bg-card p-4`,children:[(0,B.jsx)(`div`,{className:`text-2xl font-semibold`,children:t}),(0,B.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:E(e)})]},e)):(0,B.jsx)(`div`,{className:`col-span-full rounded-xl border border-border/60 p-5 text-sm text-muted-foreground`,children:r.isError?E(`projectsLoadFailed`):E(`projectsLoading`)})}),(0,B.jsxs)(`div`,{className:`grid min-w-0 gap-4 lg:grid-cols-2`,children:[(0,B.jsx)(V,{title:E(`projectsWorkRecentlyUpdated`),children:i.isLoading?(0,B.jsx)(`p`,{className:`py-5 text-sm text-muted-foreground`,children:E(`projectsLoading`)}):i.isError?(0,B.jsx)(`p`,{className:`py-5 text-sm text-destructive`,children:E(`projectsLoadFailed`)}):s.length?(0,B.jsx)(`div`,{className:`space-y-2`,children:s.map(e=>(0,B.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-3 rounded-xl bg-muted/45 px-3 py-3 text-left transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:()=>n(e.id),children:[(0,B.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium`,children:e.title}),(0,B.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:$(e.state.name)})]},e.id))}):(0,B.jsx)(H,{children:E(`projectsWorkEmpty`)})}),(0,B.jsx)(V,{title:E(`projectsRecentArtifacts`),children:a.isLoading?(0,B.jsx)(`p`,{className:`py-5 text-sm text-muted-foreground`,children:E(`projectsLoading`)}):a.isError?(0,B.jsx)(`p`,{className:`py-5 text-sm text-destructive`,children:E(`projectsLoadFailed`)}):o.length?(0,B.jsx)(`div`,{className:`space-y-2`,children:o.map(e=>(0,B.jsxs)(U,{available:e.exists,path:e.path,label:e.label??e.path,onOpen:t,className:`block w-full rounded-xl bg-muted/45 p-3 text-left text-sm transition-colors enabled:hover:bg-[var(--interaction-hover)] enabled:focus-visible:outline-none enabled:focus-visible:ring-1 enabled:focus-visible:ring-border`,children:[(0,B.jsx)(`span`,{className:`block truncate font-medium`,children:e.label??e.path}),(0,B.jsxs)(`span`,{className:`mt-1 block truncate text-xs text-muted-foreground`,children:[e.workItemTitle,(0,B.jsx)(`time`,{dateTime:e.createdAt,title:w(e.createdAt),children:` · ${Ie(e.createdAt)}`}),e.exists?``:` · ${E(`projectsUnavailable`)}`]})]},e.id))}):(0,B.jsx)(H,{children:E(`projectsNoRecentArtifacts`)})})]})]})}function Ve({skills:e,isLoading:t,isError:n,onOpen:r}){return t?(0,B.jsx)(`p`,{className:`py-5 text-sm text-muted-foreground`,children:E(`projectsLoading`)}):n?(0,B.jsx)(`p`,{className:`py-5 text-sm text-destructive`,children:E(`projectsLoadFailed`)}):(0,B.jsxs)(`section`,{className:`min-w-0`,"aria-label":E(`projectsSkills`),children:[(0,B.jsxs)(`p`,{className:`mb-3 text-sm text-muted-foreground`,children:[T(e.length),` `,E(`projectsSkillsCountSuffix`)]}),e.length?(0,B.jsx)(`div`,{className:`grid min-w-0 gap-3 md:grid-cols-2`,children:e.map(e=>(0,B.jsxs)(`button`,{type:`button`,className:`min-w-0 rounded-xl border border-border/60 p-3 text-left transition-colors hover:border-border hover:bg-muted/30 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:()=>r(e),children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium`,children:e.name}),(0,B.jsx)(`p`,{className:`mt-1 truncate text-xs text-muted-foreground`,title:e.path,children:e.path}),(0,B.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs text-muted-foreground`,title:e.description??e.ref,children:e.description??e.ref})]},e.ref))}):(0,B.jsx)(H,{children:E(`projectsNoSkills`)})]})}function He({onOpenArtifact:e,onOpenChange:t,projectId:n,projectRoot:r,workItemId:i}){let a=je(n,i),o=Me(n,i);Z(n);let s=ke(n);return(0,B.jsx)(b,{open:!!i,onOpenChange:t,children:(0,B.jsxs)(_,{side:`right`,closeLabel:E(`projectsCloseDetails`),className:`flex h-full w-full flex-col overflow-hidden p-0 sm:max-w-[680px]`,children:[a.isLoading?(0,B.jsx)(`div`,{className:`p-6 text-sm text-muted-foreground`,children:E(`projectsLoading`)}):null,a.isError?(0,B.jsx)(`div`,{className:`p-6 text-sm text-destructive`,children:E(`projectsWorkItemLoadFailed`)}):null,a.data?(0,B.jsx)(Ue,{item:a.data,states:s.data??[],activities:o.data?.activities??[],onOpenArtifact:(t,n)=>e(Q(r,t),n),onClose:()=>t(!1)},`${a.data.id}:${a.data.version}`):null]})})}function Ue({activities:e,item:t,onClose:n,onOpenArtifact:r,states:i}){let a=X(t.projectId),[c,u]=(0,z.useState)(t.title),[d,p]=(0,z.useState)(t.description),[m,_]=(0,z.useState)(t.stateId),[b,te]=(0,z.useState)(t.attention),[x,S]=(0,z.useState)(``),[C,w]=(0,z.useState)(``),[T,D]=(0,z.useState)(!1),O=async(e,t)=>{try{await e(),t?.()}catch(e){f.error(e instanceof Error?e.message:E(`projectsWorkActionFailed`))}},re=async()=>{try{await a.updateItem.mutateAsync({workItemId:t.id,patch:{title:c,description:d,stateId:m,attention:b,expectedVersion:t.version}}),f.success(E(`projectsWorkItemSaved`))}catch(e){f.error(e instanceof Error?e.message:E(`projectsWorkItemSaveFailed`))}},k=async()=>{if(x.trim())try{await a.linkArtifact.mutateAsync({workItemId:t.id,path:x.trim(),...C.trim()?{label:C.trim()}:{}}),S(``),w(``)}catch(e){f.error(e instanceof Error?e.message:E(`projectsWorkArtifactLinkFailed`))}};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(ee,{className:`shrink-0 border-b border-border/60 px-5 pb-5 pt-6 pr-14 sm:px-7 sm:pt-7`,children:[(0,B.jsx)(g,{children:E(`projectsWorkDetails`)}),(0,B.jsxs)(h,{children:[t.id,` · `,E(`projectsWorkVersion`),` `,t.version]})]}),(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-6 overflow-y-auto px-5 py-6 sm:px-7`,children:[(0,B.jsxs)(`section`,{className:`space-y-3`,children:[(0,B.jsx)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:E(`projectsWorkTitle`)}),(0,B.jsx)(s,{value:c,onChange:e=>u(e.target.value)}),(0,B.jsx)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:E(`projectsWorkDescription`)}),(0,B.jsx)(v,{className:`min-h-28`,value:d,onChange:e=>p(e.target.value)}),(0,B.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-muted-foreground`,children:E(`projectsStatus`)}),(0,B.jsxs)(P,{value:m,onValueChange:_,children:[(0,B.jsx)(j,{children:(0,B.jsx)(A,{})}),(0,B.jsx)(M,{children:i.map(e=>(0,B.jsx)(N,{value:e.id,children:$(e.name)},e.id))})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-muted-foreground`,children:E(`projectsWorkAttention`)}),(0,B.jsxs)(P,{value:b,onValueChange:e=>te(e),children:[(0,B.jsx)(j,{children:(0,B.jsx)(A,{})}),(0,B.jsxs)(M,{children:[(0,B.jsx)(N,{value:`none`,children:E(`projectsWorkAttention_none`)}),(0,B.jsx)(N,{value:`blocked`,children:E(`projectsWorkAttention_blocked`)}),(0,B.jsx)(N,{value:`awaiting-user`,children:E(`projectsWorkAttention_awaiting-user`)})]})]})]})]})]}),(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`mb-3 text-sm font-semibold`,children:E(`projectsWorkArtifacts`)}),(0,B.jsxs)(`div`,{className:`space-y-2`,children:[t.artifacts.map(e=>(0,B.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl border border-border/60 p-2`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 rounded-lg px-2 py-1 text-left hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:()=>r(e.path,e.label??e.path),children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-2 truncate text-sm font-medium`,children:[(0,B.jsx)(o,{className:`h-3.5 w-3.5 shrink-0`}),e.label??e.path]}),(0,B.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:e.path})]}),(0,B.jsx)(l,{size:`icon`,variant:`ghost`,"aria-label":E(`projectsWorkUnlinkArtifact`),onClick:()=>void O(()=>a.unlinkArtifact.mutateAsync({workItemId:t.id,artifactLinkId:e.id})),children:(0,B.jsx)(Te,{className:`h-4 w-4`})})]},e.id)),t.artifacts.length?null:(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:E(`projectsWorkNoArtifacts`)})]}),(0,B.jsxs)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-[1fr_12rem_auto]`,children:[(0,B.jsx)(s,{value:x,onChange:e=>S(e.target.value),placeholder:E(`projectsWorkArtifactPath`)}),(0,B.jsx)(s,{value:C,onChange:e=>w(e.target.value),placeholder:E(`projectsWorkArtifactLabel`)}),(0,B.jsxs)(l,{variant:`outline`,onClick:()=>void k(),disabled:!x.trim()||a.linkArtifact.isPending,children:[(0,B.jsx)(ne,{className:`mr-2 h-4 w-4`}),E(`projectsWorkLinkArtifact`)]})]})]}),(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`mb-3 text-sm font-semibold`,children:E(`projectsActivity`)}),(0,B.jsx)(`ol`,{className:`space-y-2`,children:e.map(e=>(0,B.jsxs)(`li`,{className:`rounded-xl bg-muted/35 px-3 py-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:E(`projectsWorkActivity_${e.type}`)}),(0,B.jsxs)(`span`,{className:`ml-2 text-xs text-muted-foreground`,children:[e.actor.kind,` ·`,` `,new Date(e.createdAt).toLocaleString()]})]},e.id))})]})]}),(0,B.jsxs)(y,{className:`shrink-0 border-t border-border/60 bg-background px-5 py-4 sm:px-7`,children:[t.deletedAt?(0,B.jsx)(l,{variant:`outline`,onClick:()=>void O(()=>a.restoreItem.mutateAsync(t.id)),children:E(`projectsRestore`)}):(0,B.jsxs)(l,{variant:`destructive`,onClick:()=>D(!0),children:[(0,B.jsx)(I,{className:`mr-2 h-4 w-4`}),E(`projectsDelete`)]}),(0,B.jsx)(l,{onClick:()=>void re(),disabled:!c.trim()||a.updateItem.isPending,children:E(`save`)})]}),(0,B.jsx)(pe,{open:T,onOpenChange:D,title:E(`projectsDeleteWorkItem`),description:E(`projectsDeleteWorkItemDescription`),confirmLabel:E(`projectsDelete`),variant:`destructive`,onCancel:()=>D(!1),onConfirm:()=>void O(()=>a.deleteItem.mutateAsync(t.id),n)})]})}var We=[`backlog`,`unstarted`,`started`,`completed`,`canceled`];function Ge({open:e,onOpenChange:t,projectId:n,states:r}){let i=X(n),a=Ne(r),[o,c]=(0,z.useState)(``),[u,d]=(0,z.useState)(`unstarted`),[p,m]=(0,z.useState)(null),[h,g]=(0,z.useState)(``),_=async e=>{try{await e()}catch(e){f.error(e instanceof Error?e.message:E(`projectsWorkActionFailed`))}},v=async()=>{o.trim()&&await _(async()=>{await i.createState.mutateAsync({name:o.trim(),category:u}),c(``)})},y=async(e,t)=>{let n=a[e],r=a[e+t];!n||!r||await _(async()=>{await i.updateState.mutateAsync({stateId:n.id,patch:{position:r.position}}),await i.updateState.mutateAsync({stateId:r.id,patch:{position:n.position}})})};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(_e,{open:e,onOpenChange:t,children:(0,B.jsxs)(R,{className:`max-h-[85vh] overflow-y-auto sm:max-w-2xl`,children:[(0,B.jsxs)(L,{children:[(0,B.jsx)(he,{children:E(`projectsWorkStateSettings`)}),(0,B.jsx)(ge,{children:E(`projectsWorkStateSettingsDescription`)})]}),(0,B.jsx)(`div`,{className:`space-y-2`,children:a.map((e,t)=>(0,B.jsxs)(`div`,{className:`grid gap-2 rounded-xl border border-border/60 p-3 sm:grid-cols-[1fr_11rem_auto]`,children:[(0,B.jsx)(s,{"aria-label":E(`projectsWorkStateName`),defaultValue:$(e.name),onBlur:t=>{let n=t.currentTarget.value.trim();n&&n!==$(e.name)&&_(()=>i.updateState.mutateAsync({stateId:e.id,patch:{name:n}}))}}),(0,B.jsxs)(P,{value:e.category,onValueChange:t=>void _(()=>i.updateState.mutateAsync({stateId:e.id,patch:{category:t}})),children:[(0,B.jsx)(j,{"aria-label":E(`projectsWorkStateCategory`),children:(0,B.jsx)(A,{})}),(0,B.jsx)(M,{children:We.map(e=>(0,B.jsx)(N,{value:e,children:E(`projectsWorkCategory_${e}`)},e))})]}),(0,B.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,B.jsx)(l,{size:`icon`,variant:`ghost`,"aria-label":E(`projectsMoveUp`),disabled:t===0,onClick:()=>void y(t,-1),children:(0,B.jsx)(ae,{className:`h-4 w-4`})}),(0,B.jsx)(l,{size:`icon`,variant:`ghost`,"aria-label":E(`projectsMoveDown`),disabled:t===a.length-1,onClick:()=>void y(t,1),children:(0,B.jsx)(k,{className:`h-4 w-4`})}),(0,B.jsx)(l,{size:`icon`,variant:`ghost`,"aria-label":E(`projectsDeleteState`),disabled:a.length<=1,onClick:()=>{m(e),g(``)},children:(0,B.jsx)(I,{className:`h-4 w-4`})})]}),(0,B.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-muted-foreground sm:col-span-3`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`default-state`,checked:e.isDefault,onChange:()=>void _(()=>i.updateState.mutateAsync({stateId:e.id,patch:{isDefault:!0}}))}),E(`projectsWorkDefaultState`)]})]},e.id))}),(0,B.jsxs)(`div`,{className:`grid gap-2 border-t border-border/60 pt-4 sm:grid-cols-[1fr_11rem_auto]`,children:[(0,B.jsx)(s,{value:o,onChange:e=>c(e.target.value),placeholder:E(`projectsWorkNewState`)}),(0,B.jsxs)(P,{value:u,onValueChange:e=>d(e),children:[(0,B.jsx)(j,{children:(0,B.jsx)(A,{})}),(0,B.jsx)(M,{children:We.map(e=>(0,B.jsx)(N,{value:e,children:E(`projectsWorkCategory_${e}`)},e))})]}),(0,B.jsxs)(l,{onClick:()=>void v(),disabled:!o.trim()||i.createState.isPending,children:[(0,B.jsx)(de,{className:`mr-2 h-4 w-4`}),E(`projectsAdd`)]})]})]})}),(0,B.jsx)(_e,{open:!!p,onOpenChange:e=>{e||m(null)},children:(0,B.jsxs)(R,{children:[(0,B.jsxs)(L,{children:[(0,B.jsx)(he,{children:E(`projectsDeleteState`)}),(0,B.jsx)(ge,{children:E(`projectsDeleteStateDescription`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:E(`projectsWorkStateMigration`)}),(0,B.jsxs)(P,{value:h,onValueChange:g,children:[(0,B.jsx)(j,{children:(0,B.jsx)(A,{placeholder:E(`projectsWorkStateMigrationOptional`)})}),(0,B.jsx)(M,{children:a.filter(e=>e.id!==p?.id).map(e=>(0,B.jsx)(N,{value:e.id,children:$(e.name)},e.id))})]})]}),(0,B.jsxs)(me,{children:[(0,B.jsx)(l,{variant:`outline`,onClick:()=>m(null),children:E(`cancel`)}),(0,B.jsx)(l,{variant:`destructive`,onClick:()=>{p&&_(async()=>{await i.deleteState.mutateAsync({stateId:p.id,migrateToStateId:h||null}),m(null)})},children:E(`projectsDelete`)})]})]})})]})}function Ke({startedProgress:e,state:t}){if(t.category===`backlog`)return(0,B.jsx)(`span`,{"aria-hidden":`true`,"data-state-visual":`backlog`,className:`inline-flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground/65`,children:(0,B.jsx)(oe,{className:`h-4 w-4`})});if(t.category===`unstarted`)return(0,B.jsx)(`span`,{"aria-hidden":`true`,"data-state-visual":`unstarted`,className:`inline-flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground`,children:(0,B.jsx)(Ce,{className:`h-4 w-4`,strokeWidth:2})});if(t.category===`completed`)return(0,B.jsx)(`span`,{"aria-hidden":`true`,"data-state-visual":`completed`,className:`inline-flex h-4 w-4 shrink-0 items-center justify-center text-emerald-600 dark:text-emerald-400`,children:(0,B.jsx)(re,{className:`h-4 w-4`,strokeWidth:2.25})});if(t.category===`canceled`)return(0,B.jsx)(`span`,{"aria-hidden":`true`,"data-state-visual":`canceled`,className:`inline-flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground/65`,children:(0,B.jsx)(Se,{className:`h-4 w-4`})});let n=Math.round((e??.5)*100),r=n>=67?`text-emerald-600 dark:text-emerald-400`:n>=40?`text-orange-500 dark:text-orange-400`:`text-amber-500 dark:text-amber-400`;return(0,B.jsx)(`span`,{"aria-hidden":`true`,"data-state-visual":`started`,className:`inline-flex h-4 w-4 shrink-0 items-center justify-center ${r}`,children:(0,B.jsxs)(`svg`,{className:`h-4 w-4`,viewBox:`0 0 16 16`,fill:`none`,children:[(0,B.jsx)(`circle`,{cx:`8`,cy:`8`,r:`5.5`,stroke:`currentColor`,strokeWidth:`1.75`,opacity:`0.22`}),(0,B.jsx)(`circle`,{cx:`8`,cy:`8`,r:`5.5`,pathLength:`100`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeDasharray:`${n} ${100-n}`,transform:`rotate(-90 8 8)`})]})})}function qe({item:e,onOpen:t}){return(0,B.jsxs)(`button`,{type:`button`,className:`w-full rounded-xl border border-border/50 bg-card p-3 text-left text-sm shadow-sm transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:t,children:[(0,B.jsx)(`span`,{className:`block font-medium`,children:e.title}),(0,B.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,B.jsx)(`span`,{children:$(e.state.name)}),e.attention===`none`?null:(0,B.jsx)(`span`,{className:`rounded-full bg-amber-500/15 px-2 py-0.5 text-amber-700 dark:text-amber-300`,children:E(`projectsWorkAttention_${e.attention}`)}),e.deletedAt?(0,B.jsx)(`span`,{children:E(`projectsDeleted`)}):null]})]})}function Je({hasNextPage:e,isError:t,isFetchingNextPage:n,isLoading:r,items:i,onLoadMore:a,onOpenWorkItem:o}){return r?(0,B.jsx)(`p`,{className:`py-3 text-xs text-muted-foreground`,children:E(`projectsLoading`)}):t?(0,B.jsx)(`p`,{className:`py-3 text-xs text-destructive`,children:E(`projectsLoadFailed`)}):(0,B.jsxs)(B.Fragment,{children:[i.length?i.map(e=>(0,B.jsx)(qe,{item:e,onOpen:()=>o(e.id)},e.id)):(0,B.jsx)(`p`,{className:`py-3 text-xs text-muted-foreground`,children:E(`projectsNoData`)}),e?(0,B.jsx)(l,{type:`button`,variant:`ghost`,size:`sm`,className:`w-full`,disabled:n,onClick:a,children:E(n?`projectsLoading`:`projectsWorkLoadMore`)}):null]})}function Ye({includeDeleted:e,onOpenWorkItem:t,state:n,startedProgress:r,view:i}){let[a,o]=(0,z.useState)(!1),s=De(n.projectId,{stateId:n.id,includeDeleted:e,limit:20}),c=s.data?.pages.flatMap(e=>e.items)??[],l=s.data?.pages[0]?.total;return(0,B.jsxs)(`section`,{className:i===`board`?`flex h-full min-h-0 min-w-0 flex-col overflow-hidden`:`min-w-0`,"aria-label":$(n.name),children:[(0,B.jsxs)(`button`,{type:`button`,className:`flex w-full shrink-0 items-center gap-2 rounded-lg px-1 py-2 text-left transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,"aria-expanded":!a,onClick:()=>o(e=>!e),children:[a?(0,B.jsx)(ie,{className:`h-4 w-4 shrink-0`}):(0,B.jsx)(k,{className:`h-4 w-4 shrink-0`}),(0,B.jsx)(Ke,{state:n,startedProgress:r}),(0,B.jsx)(`span`,{className:`min-w-0 truncate text-sm font-semibold`,children:$(n.name)}),(0,B.jsx)(`span`,{className:`ml-0.5 shrink-0 text-xs font-medium tabular-nums text-muted-foreground`,children:l??`…`})]}),a?null:(0,B.jsx)(`div`,{className:i===`board`?`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain px-1 pb-3`:`space-y-2 px-1 pb-3`,children:(0,B.jsx)(Je,{hasNextPage:s.hasNextPage,isError:s.isError,isFetchingNextPage:s.isFetchingNextPage,isLoading:s.isLoading,items:c,onLoadMore:()=>void s.fetchNextPage(),onOpenWorkItem:t})})]})}function Xe({onOpenWorkItem:e,projectId:t}){let[n,r]=(0,z.useState)(`list`),[i,a]=(0,z.useState)(!1),[o,c]=(0,z.useState)(``),[u,d]=(0,z.useState)(!1);Z(t);let p=ke(t),m=X(t),h=async()=>{if(o.trim())try{let t=await m.createItem.mutateAsync({title:o.trim()});c(``),e(t.id)}catch(e){f.error(e instanceof Error?e.message:E(`projectsWorkItemCreateFailed`))}};if(p.isLoading)return(0,B.jsx)(`div`,{className:`rounded-xl border border-border/60 p-5 text-sm text-muted-foreground`,children:E(`projectsLoading`)});if(p.isError)return(0,B.jsx)(`div`,{className:`rounded-xl border border-destructive/40 p-5 text-sm text-destructive`,children:E(`projectsLoadFailed`)});let g=Ne(p.data??[]),_=Fe(p.data??[]),v=g.filter(e=>e.category===`started`),y=new Map(v.map((e,t)=>[e.id,(t+1)/(v.length+1)]));return(0,B.jsxs)(`section`,{"aria-label":E(`projectsWork`),className:`min-w-0 space-y-4`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-[16rem] flex-1 gap-2`,children:[(0,B.jsx)(s,{value:o,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&h()},placeholder:E(`projectsWorkNewItem`)}),(0,B.jsxs)(l,{onClick:()=>void h(),disabled:!o.trim()||m.createItem.isPending,children:[(0,B.jsx)(de,{className:`mr-2 h-4 w-4`}),E(`projectsCreate`)]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1 rounded-xl bg-muted/40 p-1`,role:`group`,"aria-label":E(`projectsWorkViews`),children:[(0,B.jsxs)(l,{size:`sm`,variant:n===`list`?`secondary`:`ghost`,"aria-pressed":n===`list`,onClick:()=>r(`list`),children:[(0,B.jsx)(we,{className:`mr-2 h-4 w-4`}),E(`projectsWorkList`)]}),(0,B.jsxs)(l,{size:`sm`,variant:n===`board`?`secondary`:`ghost`,"aria-pressed":n===`board`,onClick:()=>r(`board`),children:[(0,B.jsx)(C,{className:`mr-2 h-4 w-4`}),E(`projectsWorkBoard`)]})]}),(0,B.jsxs)(l,{variant:`outline`,size:`sm`,onClick:()=>d(!0),children:[(0,B.jsx)(fe,{className:`mr-2 h-4 w-4`}),E(`projectsWorkStateSettings`)]})]}),(0,B.jsxs)(`label`,{className:`flex w-fit items-center gap-2 text-xs text-muted-foreground`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>a(e.target.checked)}),E(`projectsWorkShowDeleted`)]}),n===`list`?(0,B.jsx)(`div`,{className:`space-y-3`,children:_.map(t=>(0,B.jsx)(Ye,{state:t,startedProgress:y.get(t.id)??null,view:n,includeDeleted:i,onOpenWorkItem:e},t.id))}):null,n===`board`?(0,B.jsx)(`div`,{className:`grid h-[calc(100dvh-17rem)] min-h-[28rem] max-h-[52rem] min-w-0 auto-cols-[minmax(18rem,1fr)] grid-flow-col items-stretch gap-3 overflow-x-auto overflow-y-hidden pb-2`,children:g.map(t=>(0,B.jsx)(Ye,{state:t,startedProgress:y.get(t.id)??null,view:n,includeDeleted:i,onOpenWorkItem:e},t.id))}):null,(0,B.jsx)(Ge,{open:u,onOpenChange:d,projectId:t,states:g})]})}var Ze=e=>[`project-agreement`,e],Qe=e=>[`project-skills`,e];function $e(e){return u({queryKey:Ze(e??``),enabled:!!e,queryFn:async()=>await c.projects.getAgreement(e)})}function et(e){return u({queryKey:Qe(e??``),enabled:!!e,queryFn:async()=>await c.projects.listProjectSkills(e)})}function tt(e){return e===`overview`||e===`work`||e===`artifacts`||e===`skills`||e===`agreement`}var nt=[`overview`,`work`,`artifacts`,`skills`,`agreement`];function rt(){let{projectId:e,tab:t}=a(),n=i(),r=x(),{isMobile:o}=ue(),s=S(),[c,l]=(0,z.useState)(null),u=s.data?.projects??[],d=u.find(t=>t.id===e)??null,f=tt(t)?t:null,p=$e(f===`agreement`?d?.id??null:null),m=et(f===`skills`?d?.id??null:null);if(s.isLoading)return(0,B.jsx)(`main`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:E(`projectsLoading`)});if(s.isError)return(0,B.jsxs)(`main`,{className:`p-6 text-sm text-destructive`,children:[E(`projectsLoadFailed`),`: `,s.error.message]});if(!u.length)return(0,B.jsx)(`main`,{className:`p-6 text-sm text-muted-foreground`,children:E(`projectsEmpty`)});if(!d||!f)return(0,B.jsx)(`main`,{className:`p-6 text-sm text-muted-foreground`,children:E(`projectsChoose`)});let h=(e,t)=>r.chatThreadManager.openFilePreview({path:e,label:t,viewMode:`preview`,previewViewer:`rendered`});return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`main`,{className:`h-full min-w-0 flex-1 overflow-y-auto p-3 sm:p-4 md:p-6`,children:(0,B.jsxs)(`div`,{className:`mx-auto max-w-6xl space-y-4`,children:[(0,B.jsxs)(`header`,{className:`rounded-2xl border border-border/60 bg-card p-3 sm:p-4`,children:[(0,B.jsx)(`h1`,{className:`text-lg font-semibold`,children:d.name}),(0,B.jsx)(`p`,{className:`mt-1 break-all text-xs text-muted-foreground`,children:d.rootPath})]}),(0,B.jsxs)(le,{value:f,onValueChange:e=>n(`/projects/${encodeURIComponent(d.id)}/${e}`),children:[(0,B.jsx)(`div`,{className:`min-w-0 overflow-x-auto pb-1`,children:(0,B.jsx)(ce,{className:`w-max`,children:nt.map(e=>(0,B.jsx)(se,{value:e,children:E(`projects${e[0].toUpperCase()}${e.slice(1)}`)},e))})}),(0,B.jsx)(F,{value:`overview`,className:`mt-4`,children:(0,B.jsx)(Be,{projectId:d.id,onOpenArtifact:(e,t)=>h(Q(d.rootPath,e),t),onOpenWorkItem:l})}),(0,B.jsx)(F,{value:`work`,className:`mt-4`,children:(0,B.jsx)(Xe,{projectId:d.id,onOpenWorkItem:l})}),(0,B.jsx)(F,{value:`artifacts`,className:`mt-4`,children:(0,B.jsx)(Re,{projectId:d.id,onOpenFile:(e,t)=>h(Q(d.rootPath,e),t)})}),(0,B.jsx)(F,{value:`skills`,className:`mt-4`,children:(0,B.jsx)(Ve,{skills:m.data??[],isLoading:m.isLoading,isError:m.isError,onOpen:e=>h(Q(d.rootPath,e.path),e.name)})}),(0,B.jsx)(F,{value:`agreement`,className:`mt-4`,children:(0,B.jsx)(Ee,{agreement:p.data,isLoading:p.isLoading,isError:p.isError,onOpenFile:(e,t)=>h(Q(d.rootPath,e),t)})})]})]})}),(0,B.jsx)(He,{projectId:d.id,projectRoot:d.rootPath,workItemId:c,onOpenChange:e=>{e||l(null)},onOpenArtifact:h}),(0,B.jsx)(te,{layoutMode:o?`mobile`:`desktop`,sessionKey:null,projectRoot:d.rootPath})]})}export{rt as ProjectsPage};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DF37yw5_.js";import{A as t,M as n,t as r}from"./utils-CBZPzC_b.js";import{Gt as i}from"./api-BWFOIoUm.js";import{s as a}from"./i18n-ClHx6jwj.js";import{t as o}from"./createLucideIcon-BNKf0_kc.js";import{n as s}from"./chevron-down-BL-yMYcX.js";import{a as c,i as l,n as u,r as d,t as f}from"./select-CG5YWnwe.js";import{a as p,n as m,r as h,t as g}from"./popover-NkrFlWHp.js";import{f as _,i as v,r as y}from"./provider-models-hrHMcHqg.js";var b=o(`ChevronsUpDown`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),x=e(n(),1),S=t(),C=p(`15rem`);function w(e){return[...new Set(e.map(e=>e.trim()).filter(Boolean))]}function T({id:e,value:t,onChange:n,options:a,disabled:o=!1,placeholder:c,className:l,inputClassName:u,emptyText:d,createText:f,toggleLabel:p,maxItems:_=1/0,onEnter:v}){let[y,T]=(0,x.useState)(!1),E=(0,x.useRef)(null);(0,x.useEffect)(()=>{o&&y&&T(!1)},[o,y]);let D=(0,x.useMemo)(()=>w(a),[a]),O=t.trim().toLowerCase(),k=(0,x.useMemo)(()=>{let e=D.map((e,t)=>({option:e,index:t}));O.length>0&&e.sort((e,t)=>{let n=e.option.toLowerCase(),r=t.option.toLowerCase(),i=n===O?0:n.startsWith(O)?1:n.includes(O)?2:3,a=r===O?0:r.startsWith(O)?1:r.includes(O)?2:3;return i===a?e.index-t.index:i-a});let t=e.map(e=>e.option);return Number.isFinite(_)?t.slice(0,Math.max(1,_)):t},[D,O,_]),A=t.trim().length>0&&D.some(e=>e===t.trim()),j=()=>T(!1);return(0,S.jsxs)(g,{open:y&&!o,onOpenChange:e=>T(!o&&e),children:[(0,S.jsx)(m,{asChild:!0,children:(0,S.jsxs)(`div`,{ref:E,className:r(`relative`,l),children:[(0,S.jsx)(i,{id:e,value:t,disabled:o,onFocus:()=>{o||T(!0)},onChange:e=>{n(e.target.value),!y&&!o&&T(!0)},onKeyDown:e=>{e.key===`Enter`&&(v&&(e.preventDefault(),v()),j())},placeholder:c,className:r(`pr-10`,u)}),(0,S.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>T(e=>!e),disabled:o,className:r(`absolute inset-y-0 right-0 inline-flex w-10 items-center justify-center`,o?`cursor-not-allowed text-gray-300`:`text-gray-400 hover:text-gray-600`),"aria-label":p,children:(0,S.jsx)(b,{className:`h-4 w-4`})})]})}),(0,S.jsx)(h,{align:`start`,className:`flex w-[var(--radix-popover-trigger-width)] min-w-[12rem] flex-col overflow-hidden rounded-xl border border-gray-200 p-0 shadow-lg`,onInteractOutside:e=>{e.target instanceof Node&&E.current?.contains(e.target)&&e.preventDefault()},onOpenAutoFocus:e=>e.preventDefault(),style:{maxHeight:C},children:(0,S.jsxs)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto py-1`,children:[!A&&t.trim().length>0&&(0,S.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{n(t.trim()),j()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-gray-50`,children:[(0,S.jsx)(s,{className:`h-4 w-4 text-transparent`}),(0,S.jsx)(`span`,{className:`truncate text-gray-700`,children:f.replace(`{value}`,t.trim())})]}),k.map(e=>(0,S.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{n(e),j()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-gray-50`,children:[(0,S.jsx)(s,{className:r(`h-4 w-4`,e===t.trim()?`text-primary`:`text-transparent`)}),(0,S.jsx)(`span`,{className:`truncate text-gray-700`,children:e})]},e)),k.length===0&&t.trim().length===0&&(0,S.jsx)(`div`,{className:`px-3 py-2 text-sm text-gray-500`,children:d})]})})]})}var E=`provider/model`;function D(e){let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function O({id:e,value:t,onChange:n,providerCatalog:r,disabled:o=!1,providerPlaceholder:s,modelPlaceholder:p,className:m}){let[h,g]=(0,x.useState)(``),[b,C]=(0,x.useState)(``),w=r.length>0,O=p??E,k=(0,x.useMemo)(()=>new Map(r.map(e=>[e.name,e])),[r]),A=k.get(h),j=(0,x.useMemo)(()=>A?.aliases??[],[A]),M=(0,x.useMemo)(()=>D(A?.models??[]),[A]);return(0,x.useEffect)(()=>{let e=t.trim();if(!w){g(``),C(e);return}if(!e){C(``),g(e=>k.has(e)?e:``);return}let n=v(e,r)??``,i=k.get(n)?.aliases??[];g(n),C(n?_(e,i):e)},[w,r,k,t]),w?(0,S.jsxs)(`div`,{className:m,children:[(0,S.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,S.jsx)(`div`,{className:`sm:w-[38%] sm:min-w-[170px]`,children:(0,S.jsxs)(f,{value:h,onValueChange:e=>{let t=D(k.get(e)?.models??[])[0]??``;if(g(e),C(t),!t){n(``);return}n(y(k.get(e)?.prefix??e,t))},disabled:o,children:[(0,S.jsx)(l,{className:`h-10 w-full rounded-xl`,children:(0,S.jsx)(c,{placeholder:s??a(`providersSelectPlaceholder`)})}),(0,S.jsx)(u,{children:r.map(e=>(0,S.jsx)(d,{value:e.name,children:e.displayName},e.name))})]})}),(0,S.jsx)(`span`,{className:`hidden h-10 items-center justify-center leading-none text-lg font-semibold text-gray-300 sm:inline-flex`,children:`/`}),(0,S.jsx)(T,{id:e,value:b,onChange:e=>{if(!A){let t=e.trim();C(t),n(t);return}let t=_(e,j);C(t),n(t?y(A.prefix,t):``)},options:M,disabled:o||!h,placeholder:O,className:`sm:flex-1`,inputClassName:`h-10 rounded-xl`,emptyText:a(`modelPickerNoOptions`),createText:a(`modelPickerUseCustom`),toggleLabel:a(`modelPickerToggleOptions`)},h)]}),(0,S.jsx)(`p`,{className:`mt-2 text-xs text-gray-500`,children:a(`modelInputCustomHint`)})]}):(0,S.jsxs)(`div`,{className:m,children:[(0,S.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 px-4 py-3`,children:[(0,S.jsx)(`p`,{className:`text-sm font-semibold text-amber-950`,children:a(`providersEmptyTitle`)}),(0,S.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-amber-900`,children:a(`providersEmptyDescription`)})]}),(0,S.jsx)(i,{id:e,value:t,disabled:o,onChange:e=>n(e.target.value),placeholder:O,className:`mt-3 h-10 rounded-xl`}),(0,S.jsx)(`p`,{className:`mt-2 text-xs text-gray-500`,children:a(`modelInputCustomHint`)})]})}export{O as t};
1
+ import{i as e}from"./chunk-DF37yw5_.js";import{A as t,M as n,t as r}from"./utils-CBZPzC_b.js";import{Gt as i}from"./api-DqzQ-_3w.js";import{s as a}from"./i18n-20rSH40D.js";import{t as o}from"./createLucideIcon-BNKf0_kc.js";import{n as s}from"./chevron-down-BL-yMYcX.js";import{a as c,i as l,n as u,r as d,t as f}from"./select-CG5YWnwe.js";import{a as p,n as m,r as h,t as g}from"./popover-NkrFlWHp.js";import{f as _,i as v,r as y}from"./provider-models-hrHMcHqg.js";var b=o(`ChevronsUpDown`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),x=e(n(),1),S=t(),C=p(`15rem`);function w(e){return[...new Set(e.map(e=>e.trim()).filter(Boolean))]}function T({id:e,value:t,onChange:n,options:a,disabled:o=!1,placeholder:c,className:l,inputClassName:u,emptyText:d,createText:f,toggleLabel:p,maxItems:_=1/0,onEnter:v}){let[y,T]=(0,x.useState)(!1),E=(0,x.useRef)(null);(0,x.useEffect)(()=>{o&&y&&T(!1)},[o,y]);let D=(0,x.useMemo)(()=>w(a),[a]),O=t.trim().toLowerCase(),k=(0,x.useMemo)(()=>{let e=D.map((e,t)=>({option:e,index:t}));O.length>0&&e.sort((e,t)=>{let n=e.option.toLowerCase(),r=t.option.toLowerCase(),i=n===O?0:n.startsWith(O)?1:n.includes(O)?2:3,a=r===O?0:r.startsWith(O)?1:r.includes(O)?2:3;return i===a?e.index-t.index:i-a});let t=e.map(e=>e.option);return Number.isFinite(_)?t.slice(0,Math.max(1,_)):t},[D,O,_]),A=t.trim().length>0&&D.some(e=>e===t.trim()),j=()=>T(!1);return(0,S.jsxs)(g,{open:y&&!o,onOpenChange:e=>T(!o&&e),children:[(0,S.jsx)(m,{asChild:!0,children:(0,S.jsxs)(`div`,{ref:E,className:r(`relative`,l),children:[(0,S.jsx)(i,{id:e,value:t,disabled:o,onFocus:()=>{o||T(!0)},onChange:e=>{n(e.target.value),!y&&!o&&T(!0)},onKeyDown:e=>{e.key===`Enter`&&(v&&(e.preventDefault(),v()),j())},placeholder:c,className:r(`pr-10`,u)}),(0,S.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>T(e=>!e),disabled:o,className:r(`absolute inset-y-0 right-0 inline-flex w-10 items-center justify-center`,o?`cursor-not-allowed text-gray-300`:`text-gray-400 hover:text-gray-600`),"aria-label":p,children:(0,S.jsx)(b,{className:`h-4 w-4`})})]})}),(0,S.jsx)(h,{align:`start`,className:`flex w-[var(--radix-popover-trigger-width)] min-w-[12rem] flex-col overflow-hidden rounded-xl border border-gray-200 p-0 shadow-lg`,onInteractOutside:e=>{e.target instanceof Node&&E.current?.contains(e.target)&&e.preventDefault()},onOpenAutoFocus:e=>e.preventDefault(),style:{maxHeight:C},children:(0,S.jsxs)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto py-1`,children:[!A&&t.trim().length>0&&(0,S.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{n(t.trim()),j()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-gray-50`,children:[(0,S.jsx)(s,{className:`h-4 w-4 text-transparent`}),(0,S.jsx)(`span`,{className:`truncate text-gray-700`,children:f.replace(`{value}`,t.trim())})]}),k.map(e=>(0,S.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{n(e),j()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-gray-50`,children:[(0,S.jsx)(s,{className:r(`h-4 w-4`,e===t.trim()?`text-primary`:`text-transparent`)}),(0,S.jsx)(`span`,{className:`truncate text-gray-700`,children:e})]},e)),k.length===0&&t.trim().length===0&&(0,S.jsx)(`div`,{className:`px-3 py-2 text-sm text-gray-500`,children:d})]})})]})}var E=`provider/model`;function D(e){let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function O({id:e,value:t,onChange:n,providerCatalog:r,disabled:o=!1,providerPlaceholder:s,modelPlaceholder:p,className:m}){let[h,g]=(0,x.useState)(``),[b,C]=(0,x.useState)(``),w=r.length>0,O=p??E,k=(0,x.useMemo)(()=>new Map(r.map(e=>[e.name,e])),[r]),A=k.get(h),j=(0,x.useMemo)(()=>A?.aliases??[],[A]),M=(0,x.useMemo)(()=>D(A?.models??[]),[A]);return(0,x.useEffect)(()=>{let e=t.trim();if(!w){g(``),C(e);return}if(!e){C(``),g(e=>k.has(e)?e:``);return}let n=v(e,r)??``,i=k.get(n)?.aliases??[];g(n),C(n?_(e,i):e)},[w,r,k,t]),w?(0,S.jsxs)(`div`,{className:m,children:[(0,S.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,S.jsx)(`div`,{className:`sm:w-[38%] sm:min-w-[170px]`,children:(0,S.jsxs)(f,{value:h,onValueChange:e=>{let t=D(k.get(e)?.models??[])[0]??``;if(g(e),C(t),!t){n(``);return}n(y(k.get(e)?.prefix??e,t))},disabled:o,children:[(0,S.jsx)(l,{className:`h-10 w-full rounded-xl`,children:(0,S.jsx)(c,{placeholder:s??a(`providersSelectPlaceholder`)})}),(0,S.jsx)(u,{children:r.map(e=>(0,S.jsx)(d,{value:e.name,children:e.displayName},e.name))})]})}),(0,S.jsx)(`span`,{className:`hidden h-10 items-center justify-center leading-none text-lg font-semibold text-gray-300 sm:inline-flex`,children:`/`}),(0,S.jsx)(T,{id:e,value:b,onChange:e=>{if(!A){let t=e.trim();C(t),n(t);return}let t=_(e,j);C(t),n(t?y(A.prefix,t):``)},options:M,disabled:o||!h,placeholder:O,className:`sm:flex-1`,inputClassName:`h-10 rounded-xl`,emptyText:a(`modelPickerNoOptions`),createText:a(`modelPickerUseCustom`),toggleLabel:a(`modelPickerToggleOptions`)},h)]}),(0,S.jsx)(`p`,{className:`mt-2 text-xs text-gray-500`,children:a(`modelInputCustomHint`)})]}):(0,S.jsxs)(`div`,{className:m,children:[(0,S.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 px-4 py-3`,children:[(0,S.jsx)(`p`,{className:`text-sm font-semibold text-amber-950`,children:a(`providersEmptyTitle`)}),(0,S.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-amber-900`,children:a(`providersEmptyDescription`)})]}),(0,S.jsx)(i,{id:e,value:t,disabled:o,onChange:e=>n(e.target.value),placeholder:O,className:`mt-3 h-10 rounded-xl`}),(0,S.jsx)(`p`,{className:`mt-2 text-xs text-gray-500`,children:a(`modelInputCustomHint`)})]})}export{O as t};