@nextclaw/ui 0.14.1-beta.1 → 0.14.1

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 (69) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/assets/{api-dQ6uQSZG.js → api-DPcvCLfa.js} +3 -3
  3. package/dist/assets/{channels-list-page-DfpjB8XB.js → channels-list-page-D6jtziu4.js} +2 -2
  4. package/dist/assets/chat-page-BBnNJoKG.js +105 -0
  5. package/dist/assets/{config-split-page-CeFfbaqc.js → config-split-page-BCJhqdK9.js} +1 -1
  6. package/dist/assets/{confirm-dialog-C95Y4QPC.js → confirm-dialog-CWh5FfK2.js} +1 -1
  7. package/dist/assets/{desktop-update-config-CcK6jiEb.js → desktop-update-config-DsRhBizi.js} +1 -1
  8. package/dist/assets/{dist-DTGzeil6.js → dist-DPrgcEC0.js} +1 -1
  9. package/dist/assets/{dist-fGogBmPA.js → dist-DsE4OsSS.js} +1 -1
  10. package/dist/assets/doc-browser-C8xOF_9F.js +1 -0
  11. package/dist/assets/{doc-browser-DVHhEb96.js → doc-browser-DgQedeAn.js} +1 -1
  12. package/dist/assets/{doc-browser-context-BfMXwnrz.js → doc-browser-context-B46tQGmO.js} +1 -1
  13. package/dist/assets/{ellipsis-D2F4KMiU.js → ellipsis-B81FStLm.js} +1 -1
  14. package/dist/assets/{external-link-CcgtBK26.js → external-link-C_dmG-WJ.js} +1 -1
  15. package/dist/assets/index-7o1WdUbU.js +103 -0
  16. package/dist/assets/index-DQWmEWzk.css +1 -0
  17. package/dist/assets/mcp-marketplace-page-CWZN7ohK.js +1 -0
  18. package/dist/assets/mcp-marketplace-page-Dzull_4-.js +40 -0
  19. package/dist/assets/{model-config-page-aAUkZkSX.js → model-config-page-Cv0O3BIj.js} +1 -1
  20. package/dist/assets/plus-Bnt56oqG.js +1 -0
  21. package/dist/assets/{provider-scoped-model-input-we4_Z4gP.js → provider-scoped-model-input-Duuh7i3h.js} +1 -1
  22. package/dist/assets/{providers-config-page-CtMkPSyu.js → providers-config-page-CPDz0Lxc.js} +1 -1
  23. package/dist/assets/{react-CTqdhFMk.js → react-sZz5HSCm.js} +1 -1
  24. package/dist/assets/remote-B0LMs8u7.js +1 -0
  25. package/dist/assets/rotate-cw-BfyG_KEF.js +1 -0
  26. package/dist/assets/{runtime-config-page-TD1UrTbG.js → runtime-config-page-q0fvv8ME.js} +1 -1
  27. package/dist/assets/{save-C9fKWfVB.js → save-MzjoiHri.js} +1 -1
  28. package/dist/assets/{search-D5FQ5q0X.js → search-B29dE4GN.js} +1 -1
  29. package/dist/assets/{search-config-page-AMEJJNIS.js → search-config-page-Dl5sZzob.js} +1 -1
  30. package/dist/assets/{secrets-config-page-CcgJnvBO.js → secrets-config-page-C_l-IFCK.js} +2 -2
  31. package/dist/assets/{select-Cu5n0E-3.js → select-BKmh05hd.js} +1 -1
  32. package/dist/assets/{tag-chip-C5aOtjxu.js → tag-chip-BS_7Ueom.js} +1 -1
  33. package/dist/assets/use-config-DZkBWIdL.js +1 -0
  34. package/dist/assets/x-CW2KO-Hz.js +1 -0
  35. package/dist/index.html +14 -14
  36. package/package.json +9 -9
  37. package/src/features/chat/components/layout/__tests__/chat-sidebar.test.tsx +70 -7
  38. package/src/features/chat/components/layout/chat-sidebar-toolbar.tsx +104 -16
  39. package/src/features/chat/components/layout/chat-sidebar.tsx +21 -2
  40. package/src/features/chat/features/input/hooks/use-chat-model-favorites.ts +2 -1
  41. package/src/features/chat/features/session/components/chat-sidebar-project-groups.tsx +3 -2
  42. package/src/features/chat/features/session-type/components/__tests__/{chat-sidebar-create-menu.test.tsx → chat-session-type-menu.test.tsx} +3 -3
  43. package/src/features/chat/features/session-type/components/__tests__/chat-session-type-option-item.test.tsx +27 -1
  44. package/src/features/chat/features/session-type/components/{chat-sidebar-create-menu.tsx → chat-session-type-menu.tsx} +11 -7
  45. package/src/features/chat/features/session-type/components/chat-session-type-option-item.tsx +15 -3
  46. package/src/features/chat/features/session-type/hooks/__tests__/use-chat-new-session-type-preference.test.tsx +152 -0
  47. package/src/features/chat/features/session-type/hooks/use-chat-new-session-type-preference.ts +159 -0
  48. package/src/features/marketplace/components/__tests__/marketplace-page.test.tsx +24 -0
  49. package/src/features/marketplace/components/curated-shelves/marketplace-shelf-card.tsx +8 -3
  50. package/src/features/marketplace/components/marketplace-item-list-view.tsx +2 -2
  51. package/src/features/marketplace/components/marketplace-list-card.tsx +124 -98
  52. package/src/features/marketplace/components/marketplace-page-parts.tsx +11 -6
  53. package/src/shared/components/common/__tests__/agent-avatar.test.tsx +3 -1
  54. package/src/shared/components/common/agent-avatar.tsx +5 -2
  55. package/src/shared/lib/api/index.ts +1 -0
  56. package/src/shared/lib/api/preferences/preference-keys.config.ts +9 -0
  57. package/src/shared/lib/i18n/locales/en-US/marketplace.json +2 -0
  58. package/src/shared/lib/i18n/locales/zh-CN/marketplace.json +2 -0
  59. package/dist/assets/chat-page-D3QaEqjs.js +0 -105
  60. package/dist/assets/doc-browser-CuBTcBEZ.js +0 -1
  61. package/dist/assets/index-ByJCbQqr.css +0 -1
  62. package/dist/assets/index-DjXqiloY.js +0 -103
  63. package/dist/assets/mcp-marketplace-page-98-V__3u.js +0 -1
  64. package/dist/assets/mcp-marketplace-page-BNq_PNmO.js +0 -40
  65. package/dist/assets/plus-1Rxl5FlV.js +0 -1
  66. package/dist/assets/remote-fQ7N_r8u.js +0 -1
  67. package/dist/assets/rotate-cw-CzfIeAJj.js +0 -1
  68. package/dist/assets/use-config-D8TESeo6.js +0 -1
  69. package/dist/assets/x-1qETdQ70.js +0 -1
@@ -1 +0,0 @@
1
- import{t as e}from"./mcp-marketplace-page-BNq_PNmO.js";export{e as McpMarketplacePage};
@@ -1,40 +0,0 @@
1
- import{h as e,p as t,r as n,u as r,v as i}from"./react-CTqdhFMk.js";import{C as a,D as o,E as s,Gt as c,It as l,Kt as u,Rt as d,S as f,T as p,Ut as m,Wt as h,an as g,gt as _,in as ee,nn as v,on as y,rn as b,w as x,zt as S}from"./api-dQ6uQSZG.js";import{c as C}from"./dist-fGogBmPA.js";import{a as w,i as T,n as E,r as D,t as O}from"./select-Cu5n0E-3.js";import{a as k,i as A,n as j,o as M,r as N,s as P}from"./confirm-dialog-C95Y4QPC.js";import{n as te}from"./doc-browser-context-BfMXwnrz.js";import{Ct as F,X as ne,_ as re,ft as I,h as L,ht as ie}from"./index-DjXqiloY.js";import{t as R}from"./tag-chip-C5aOtjxu.js";var ae=class extends y{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:g()})}getOptimisticResult(e){return e.behavior=g(),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`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:b(t,n.data),hasPreviousPage:ee(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}};function z(e,t){return u(e,ae,t)}var oe=C(`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=C(`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`}]]);function B(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}}var V=t();function H({scope:e,isRefreshing:t,searchText:r,searchPlaceholder:i,sort:a,onSearchTextChange:o,onSortChange:s}){return(0,V.jsx)(`div`,{className:`mb-4`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,V.jsx)(se,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400`}),(0,V.jsx)(`input`,{value:r,onChange:e=>o(e.target.value),placeholder:i,className:`h-9 w-full rounded-xl border border-gray-200/80 pl-9 pr-9 text-sm focus:outline-none focus:ring-1 focus:ring-primary/40`}),t&&(0,V.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":n(`marketplaceRefreshingResults`)})]}),e===`all`&&(0,V.jsxs)(O,{value:a,onValueChange:e=>s(e),children:[(0,V.jsx)(T,{className:`h-9 w-[150px] shrink-0 rounded-lg`,children:(0,V.jsx)(w,{})}),(0,V.jsxs)(E,{children:[(0,V.jsx)(D,{value:`relevance`,children:n(`marketplaceSortRelevance`)}),(0,V.jsx)(D,{value:`updated`,children:n(`marketplaceSortUpdated`)})]})]})]})})}function U({count:e}){return(0,V.jsx)(V.Fragment,{children:Array.from({length:e},(e,t)=>(0,V.jsx)(`article`,{className:`h-full rounded-2xl border border-gray-200/40 bg-white px-5 py-4 shadow-sm`,children:(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3.5`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 gap-3`,children:[(0,V.jsx)(L,{className:`h-10 w-10 shrink-0 rounded-xl`}),(0,V.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2 pt-0.5`,children:[(0,V.jsx)(L,{className:`h-4 w-32 max-w-[70%]`}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(L,{className:`h-3 w-12`}),(0,V.jsx)(L,{className:`h-3 w-24`})]}),(0,V.jsx)(L,{className:`h-3 w-full`})]})]}),(0,V.jsx)(L,{className:`h-8 w-20 shrink-0 rounded-xl`})]})},`marketplace-skeleton-${t}`))})}function W({hasMore:e,loading:t,sentinelRef:r}){return!e&&!t?null:(0,V.jsxs)(`div`,{className:`py-4`,children:[e&&(0,V.jsx)(`div`,{ref:r,className:`h-1 w-full`,"aria-hidden":`true`}),t&&(0,V.jsx)(`div`,{"data-testid":`marketplace-loading-more`,className:`pt-3 text-center text-xs text-gray-500`,children:n(`loading`)})]})}function G(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 q(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 ce(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():``}var J=i(e(),1),le=160;function Y({disabled:e,onLoadMore:t,thresholdPx:n=le,watchValue:r}){let i=(0,J.useRef)(null),a=(0,J.useRef)(null),o=(0,J.useRef)(t),s=(0,J.useRef)(!1);return(0,J.useEffect)(()=>{o.current=t},[t]),(0,J.useEffect)(()=>{e&&(s.current=!1)},[e]),(0,J.useEffect)(()=>{let t=i.current,r=a.current;if(e||!t||!r)return;let c=()=>{s.current||e||(s.current=!0,Promise.resolve(o.current()).finally(()=>{s.current=!1}))},l=()=>{r.getBoundingClientRect().top-t.getBoundingClientRect().bottom<=n&&c()};if(typeof IntersectionObserver==`function`){let e=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&c()},{root:t,rootMargin:`0px 0px ${n}px 0px`});return e.observe(r),l(),()=>{e.disconnect()}}return t.addEventListener(`scroll`,l,{passive:!0}),l(),()=>{t.removeEventListener(`scroll`,l)}},[e,n,r]),{containerRef:i,sentinelRef:a}}function X(e){return(e??``).trim().toLowerCase()}function ue(e){let t=new Map;for(let n of e){let e=[n.catalogSlug,n.spec,n.id,n.label];for(let r of e){let e=X(r);!e||t.has(e)||t.set(e,n)}}return t}function de(e,t){let n=[e.slug,e.install.spec,e.id,e.name];for(let e of n){let n=X(e);if(!n)continue;let r=t.get(n);if(r)return r}}function Z(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}function Q(e,t,n,r,i){let a=`<!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1" />
6
- <title>${Z(e)}</title>
7
- <style>
8
- body { margin: 0; background: #f8fafc; color: #0f172a; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
9
- .wrap { max-width: 980px; margin: 0 auto; padding: 28px 20px 40px; }
10
- .hero { border: 1px solid #dbeafe; border-radius: 16px; background: linear-gradient(180deg, #eff6ff, #ffffff); padding: 20px; }
11
- .hero h1 { margin: 0; font-size: 26px; }
12
- .grid { display: grid; grid-template-columns: 280px 1fr; gap: 14px; margin-top: 16px; }
13
- .card { border: 1px solid #e2e8f0; background: #fff; border-radius: 14px; overflow: hidden; }
14
- .card h2 { margin: 0; padding: 12px 14px; font-size: 13px; font-weight: 700; color: #1d4ed8; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
15
- .body { padding: 12px 14px; }
16
- pre { margin: 0; white-space: pre-wrap; line-height: 1.7; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
17
- a { color: #2563eb; text-decoration: none; }
18
- @media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }
19
- </style>
20
- </head>
21
- <body>
22
- <main class="wrap">
23
- <section class="hero">
24
- <h1>${Z(e)}</h1>
25
- ${i?`<p>${Z(i)}</p>`:``}
26
- ${r?`<p><a href="${Z(r)}" target="_blank" rel="noopener noreferrer">${Z(r)}</a></p>`:``}
27
- </section>
28
- <section class="grid">
29
- <article class="card">
30
- <h2>Metadata</h2>
31
- <div class="body"><pre>${Z(t)}</pre></div>
32
- </article>
33
- <article class="card">
34
- <h2>Content</h2>
35
- <div class="body"><pre>${Z(n)}</pre></div>
36
- </article>
37
- </section>
38
- </main>
39
- </body>
40
- </html>`;return`data:text/html;charset=utf-8,${encodeURIComponent(a)}`}function fe(e,t,r){return q(t?.summaryI18n,t?.summary,e)||ce(r,e)||n(`marketplaceInstalledLocalSummary`)}function pe(e,t){return t?.transport?t.transport.toUpperCase():(e?.install?.transportTypes??[]).map(e=>e.toUpperCase()).join(` / `)||`MCP`}function $(e){let{item:t,record:r,localeFallbacks:i,onOpen:a,onInstall:o,onToggle:s,onDoctor:c,onRemove:l}=e,u=r,d=t?.name??r?.label??r?.id??`MCP`,f=fe(i,t,r),p=pe(t,r),m=u?u.enabled===!1?n(`marketplaceDisable`):n(`statusReady`):null;return(0,V.jsx)(`article`,{onClick:a,className:`cursor-pointer rounded-2xl border border-gray-200/70 bg-white p-4 shadow-sm transition hover:border-blue-300 hover:shadow-md`,children:(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`text-sm font-semibold text-gray-900`,children:d}),(0,V.jsx)(`div`,{className:`mt-1 text-xs text-gray-500`,children:p}),(0,V.jsx)(`div`,{className:`mt-2 line-clamp-2 text-sm text-gray-600`,children:f}),(0,V.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(t?.tags??[]).map(e=>(0,V.jsx)(R,{children:e},e)),m?(0,V.jsx)(R,{tone:`success`,children:m}):null]})]}),(0,V.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2`,children:[!u&&t&&o?(0,V.jsx)(S,{type:`button`,size:`sm`,variant:`primary`,className:`rounded-xl`,onClick:e=>{e.stopPropagation(),o()},children:n(`marketplaceInstall`)}):null,u?(0,V.jsxs)(V.Fragment,{children:[s?(0,V.jsx)(S,{type:`button`,size:`sm`,variant:`outline`,className:`rounded-xl border-gray-200 text-gray-700`,onClick:e=>{e.stopPropagation(),s()},children:u.enabled===!1?n(`marketplaceEnable`):n(`marketplaceDisable`)}):null,c?(0,V.jsx)(S,{type:`button`,size:`sm`,variant:`outline`,className:`rounded-xl border-blue-200 text-blue-700 hover:border-blue-300 hover:bg-blue-50 hover:text-blue-700`,onClick:e=>{e.stopPropagation(),c()},children:n(`marketplaceMcpDoctor`)}):null,l?(0,V.jsx)(S,{type:`button`,size:`sm`,variant:`outline`,className:`rounded-xl border-rose-200 text-rose-600 hover:border-rose-300 hover:bg-rose-50 hover:text-rose-600`,onClick:e=>{e.stopPropagation(),l()},children:n(`marketplaceMcpRemove`)}):null]}):null]})]})})}function me(e){let{item:t,open:n,pending:r,onOpenChange:i,onSubmit:a}=e;return(0,V.jsx)(j,{open:n,onOpenChange:i,children:t?(0,V.jsx)(he,{item:t,pending:r,onOpenChange:i,onSubmit:a},`${t.slug}:${n?`open`:`closed`}`):null})}function he(e){let{item:t,pending:r,onOpenChange:i,onSubmit:a}=e,o=t.install,[s,c]=(0,J.useState)(o?.defaultName??``),[l,u]=(0,J.useState)(!0),[f,p]=(0,J.useState)(Object.fromEntries((o?.inputs??[]).map(e=>[e.id,e.defaultValue??``])));return(0,V.jsxs)(N,{children:[(0,V.jsxs)(M,{children:[(0,V.jsx)(P,{children:n(`marketplaceMcpInstallDialogTitle`)}),(0,V.jsx)(A,{children:t.name})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`div`,{className:`text-sm font-medium text-gray-800`,children:n(`marketplaceMcpServerName`)}),(0,V.jsx)(d,{value:s,onChange:e=>c(e.target.value),placeholder:o?.defaultName??`mcp-server`})]}),(0,V.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl border border-gray-200 px-3 py-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-sm font-medium text-gray-900`,children:n(`marketplaceMcpAllAgents`)}),(0,V.jsx)(`div`,{className:`text-xs text-gray-500`,children:n(`marketplaceMcpAllAgentsDescription`)})]}),(0,V.jsx)(_,{checked:l,onCheckedChange:u})]}),(o?.inputs??[]).map(e=>(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`div`,{className:`text-sm font-medium text-gray-800`,children:e.label}),e.description?(0,V.jsx)(`div`,{className:`text-xs text-gray-500`,children:e.description}):null,(0,V.jsx)(d,{type:e.secret?`password`:`text`,value:f[e.id]??``,onChange:t=>p(n=>({...n,[e.id]:t.target.value})),placeholder:e.defaultValue??``})]},e.id))]}),(0,V.jsxs)(k,{children:[(0,V.jsx)(S,{variant:`outline`,onClick:()=>i(!1),disabled:r,children:n(`cancel`)}),(0,V.jsx)(S,{onClick:()=>void a({name:s,allAgents:l,inputs:f}),disabled:r||!s.trim(),children:n(r?`marketplaceInstalling`:`marketplaceInstall`)})]})]})}function ge(e){let{result:t,targetName:r,open:i,pending:a,onOpenChange:o}=e;return(0,V.jsx)(j,{open:i,onOpenChange:o,children:(0,V.jsxs)(N,{children:[(0,V.jsxs)(M,{children:[(0,V.jsx)(P,{children:n(`marketplaceMcpDoctorTitle`)}),(0,V.jsx)(A,{children:r??`-`})]}),a?(0,V.jsx)(`div`,{className:`text-sm text-gray-500`,children:n(`loading`)}):null,!a&&t?(0,V.jsxs)(`div`,{className:`space-y-3 text-sm text-gray-700`,children:[(0,V.jsxs)(`div`,{children:[n(`marketplaceMcpDoctorAccessible`),`:`,` `,t.accessible?n(`statusReady`):n(`marketplaceOperationFailed`)]}),(0,V.jsxs)(`div`,{children:[n(`marketplaceMcpDoctorTransport`),`:`,` `,t.transport.toUpperCase()]}),(0,V.jsxs)(`div`,{children:[n(`marketplaceMcpDoctorTools`),`: `,t.toolCount]}),t.error?(0,V.jsx)(I,{tone:`danger`,description:t.error,className:`rounded-lg`}):null]}):null]})})}function _e(e){let t=z({queryKey:[`marketplace-mcp-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>p({...e,page:t}),getNextPageParam:e=>e.page<e.totalPages?e.page+1:void 0,staleTime:15e3}),n=(0,J.useMemo)(()=>B(t.data),[t.data]);return{...t,data:n}}function ve(){return c({queryKey:[`marketplace-mcp-installed`],queryFn:()=>x(),staleTime:1e4})}function ye(){let e=v();return h({mutationFn:s,onSuccess:t=>{e.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}),m.success(t.message||n(`marketplaceInstallSuccessMcp`))},onError:e=>{m.error(e.message||n(`marketplaceInstallFailed`))}})}function be(){let e=v();return h({mutationFn:o,onSuccess:t=>{e.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}),m.success(t.message||n(`marketplaceMcpManageSuccess`))},onError:e=>{m.error(e.message||n(`marketplaceOperationFailed`))}})}var xe=12;function Se(){let[e,t]=(0,J.useState)(`catalog`),[i,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(``),[u,d]=(0,J.useState)(`relevance`),[p,m]=(0,J.useState)(null),[g,_]=(0,J.useState)(null),[ee,v]=(0,J.useState)(null),{language:y}=ne(),b=te(),{confirm:x,ConfirmDialog:S}=re(),C=(0,J.useMemo)(()=>G(y),[y]);(0,J.useEffect)(()=>{let e=window.setTimeout(()=>{c(i.trim())},250);return()=>window.clearTimeout(e)},[i]);let w=_e({q:s||void 0,sort:u,pageSize:xe}),T=ve(),{containerRef:E,sentinelRef:D}=Y({disabled:e!==`catalog`||w.isError||!w.hasNextPage||w.isFetchingNextPage,onLoadMore:()=>w.fetchNextPage(),watchValue:`${e}:${s}:${u}:${w.data?.loadedItems??0}:${w.data?.loadedPages??0}`});(0,J.useEffect)(()=>{let e=E.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[E,s,e,u]);let O=ye(),k=be(),A=h({mutationFn:f,onSuccess:(e,t)=>{_(t),v(e)}}),j=(0,J.useMemo)(()=>ue(T.data?.records??[]),[T.data?.records]),M=(0,J.useMemo)(()=>(T.data?.records??[]).filter(e=>{let t=[e.id??``,e.label??``,e.catalogSlug??``,e.description??``,e.descriptionZh??``].join(` `).toLowerCase();return s?t.includes(s.toLowerCase()):!0}),[T.data?.records,s]),N=async(e,t)=>{let r=e?.name??t?.label??t?.id??`MCP`,i={title:r,kind:`content`,dedupeKey:e?`marketplace:mcp:${e.slug}`:`marketplace:mcp:${t?.id??t?.spec??r}`},o=fe(C,e,t);if(!e){let e=Q(r,JSON.stringify(t??{},null,2),n(`marketplaceInstalledLocalSummary`),t?.docsUrl,o);b.open(e,i);return}try{let t=await a(e.slug),n=Q(r,t.metadataRaw||JSON.stringify(e,null,2),t.bodyRaw||t.raw,t.sourceUrl,o);b.open(n,i)}catch(e){let t=Q(r,JSON.stringify({error:e instanceof Error?e.message:String(e)},null,2),o,void 0,o);b.open(t,i)}},P=async e=>{p&&(await O.mutateAsync({spec:p.slug,name:e.name.trim(),allAgents:e.allAgents,inputs:e.inputs}),m(null))},F=async(e,t)=>{let r=t.id||t.spec;r&&(e===`remove`&&!await x({title:`${n(`marketplaceMcpRemoveTitle`)} ${r}?`,description:n(`marketplaceMcpRemoveDescription`),confirmLabel:n(`marketplaceMcpRemove`),variant:`destructive`})||await k.mutateAsync({action:e,id:r,spec:t.spec}))},L=[{id:`catalog`,label:n(`marketplaceMcpTabCatalog`),icon:ie},{id:`installed`,label:n(`marketplaceMcpTabInstalled`),icon:oe,count:T.data?.total??0}];return(0,V.jsxs)(l,{className:`flex h-full min-h-0 flex-col pb-0 px-0`,children:[(0,V.jsxs)(`div`,{className:`flex flex-col gap-6 w-full max-w-[1400px] h-full min-h-0 mx-auto`,children:[(0,V.jsxs)(`div`,{className:`relative overflow-hidden rounded-[32px] bg-gradient-to-br from-[#0F172A] via-[#1E1B4B] to-[#312E81] px-10 py-14 text-white shadow-xl isolate`,children:[(0,V.jsx)(`div`,{className:`absolute top-0 right-0 -m-32 opacity-30 pointer-events-none mix-blend-screen scale-150 transform-gpu`,children:(0,V.jsx)(`div`,{className:`w-[500px] h-[500px] rounded-full bg-gradient-to-tl from-fuchsia-500/40 via-purple-500/30 to-indigo-500/20 blur-[80px]`})}),(0,V.jsx)(`div`,{className:`absolute bottom-0 left-0 -m-32 opacity-20 pointer-events-none mix-blend-screen transform-gpu`,children:(0,V.jsx)(`div`,{className:`w-[400px] h-[400px] rounded-full bg-gradient-to-tr from-blue-500/40 to-cyan-500/20 blur-[80px]`})}),(0,V.jsxs)(`div`,{className:`relative z-10 flex flex-col gap-3`,children:[(0,V.jsx)(`h1`,{className:`text-[38px] font-extrabold tracking-[-0.02em] leading-tight drop-shadow-sm text-transparent bg-clip-text bg-gradient-to-r from-white via-white to-white/70`,children:n(`marketplaceMcpPageTitle`)}),(0,V.jsx)(`p`,{className:`text-[17px] font-medium text-purple-100/70 max-w-2xl leading-relaxed tracking-wide`,children:n(`marketplaceMcpPageDescription`)})]})]}),(0,V.jsxs)(`div`,{className:`flex flex-col md:flex-row md:items-center justify-between gap-4 mt-2`,children:[(0,V.jsx)(`div`,{className:`flex items-center gap-1.5 p-1 bg-gray-100/60 backdrop-blur-sm rounded-2xl w-fit border border-gray-200/50 shadow-inner`,children:L.map(n=>{let i=e===n.id,a=n.icon;return(0,V.jsxs)(`button`,{onClick:()=>t(n.id),className:r(`relative flex items-center gap-2 px-5 py-2.5 rounded-xl font-semibold text-[14px] transition-all duration-300`,i?`text-gray-900 bg-white shadow-[0_2px_10px_rgb(0,0,0,0.06)]`:`text-gray-500 hover:text-gray-700 hover:bg-gray-200/40`),children:[(0,V.jsx)(a,{className:r(`w-4 h-4`,i?`text-primary`:`text-gray-400`)}),n.label,n.id===`installed`&&typeof n.count==`number`&&(0,V.jsx)(`span`,{className:r(`ml-1 flex items-center justify-center h-5 px-1.5 min-w-5 rounded-full text-[11px] font-bold transition-colors`,i?`bg-primary/10 text-primary`:`bg-gray-200 text-gray-500`),children:n.count})]},n.id)})}),(0,V.jsx)(`div`,{className:`flex-1 w-full md:max-w-md`,children:(0,V.jsx)(H,{scope:e===`catalog`?`all`:`installed`,searchText:i,isRefreshing:!1,searchPlaceholder:n(`marketplaceMcpSearchPlaceholder`),sort:u,onSearchTextChange:o,onSortChange:d})})]}),(0,V.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col mt-2`,children:[(0,V.jsx)(`div`,{className:`flex items-center justify-between mb-4 px-1`,children:(0,V.jsxs)(`h3`,{className:`text-[18px] font-bold tracking-tight text-gray-900 flex items-center gap-2`,children:[n(e===`catalog`?`marketplaceMcpSectionCatalog`:`marketplaceMcpSectionInstalled`),(0,V.jsx)(`span`,{className:`flex items-center justify-center h-6 px-2 rounded-lg bg-gray-100 text-[12px] font-semibold text-gray-500`,children:e===`catalog`?w.data?.total??0:T.data?.total??0})]})}),(0,V.jsxs)(`div`,{ref:E,className:`min-h-0 flex-1 overflow-y-auto pr-3 pb-8 -mx-1 px-1 custom-scrollbar`,"aria-busy":w.isLoading||w.isFetchingNextPage,children:[(0,V.jsxs)(`div`,{className:`grid grid-cols-1 gap-[22px] md:grid-cols-2 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 items-stretch`,children:[e===`catalog`&&w.isLoading&&(0,V.jsx)(U,{count:xe}),e===`catalog`&&!w.isLoading&&(w.data?.items??[]).map(e=>{let t=de(e,j);return(0,V.jsx)($,{item:e,record:t,localeFallbacks:C,onOpen:()=>void N(e,t),onInstall:()=>m(e),onToggle:t?()=>void F(t.enabled===!1?`enable`:`disable`,t):void 0,onDoctor:t?()=>{_(t.id??null),v(null),A.mutateAsync(t.id??``)}:void 0,onRemove:t?()=>void F(`remove`,t):void 0},e.id)}),e===`installed`&&M.map(e=>(0,V.jsx)($,{record:e,localeFallbacks:C,onOpen:()=>void N(void 0,e),onToggle:()=>void F(e.enabled===!1?`enable`:`disable`,e),onDoctor:()=>{_(e.id??null),v(null),A.mutateAsync(e.id??``)},onRemove:()=>void F(`remove`,e)},e.id??e.spec))]}),e===`catalog`&&w.isError&&(0,V.jsx)(I,{tone:`danger`,title:n(`marketplaceMcpSectionCatalog`),description:w.error.message}),e===`installed`&&T.isError&&(0,V.jsx)(I,{tone:`danger`,title:n(`marketplaceMcpSectionInstalled`),description:T.error.message}),e===`catalog`&&!w.isLoading&&!w.isError&&(w.data?.items?.length??0)===0&&(0,V.jsx)(`div`,{className:`flex flex-col items-center justify-center py-20 bg-gray-50/50 rounded-3xl border border-dashed border-gray-200 mt-4`,children:(0,V.jsx)(`p`,{className:`text-[15px] font-medium text-gray-500`,children:n(`marketplaceNoMcp`)})}),e===`installed`&&!T.isError&&M.length===0&&(0,V.jsx)(`div`,{className:`flex flex-col items-center justify-center py-20 bg-gray-50/50 rounded-3xl border border-dashed border-gray-200 mt-4`,children:(0,V.jsx)(`p`,{className:`text-[15px] font-medium text-gray-500`,children:n(`marketplaceNoInstalledMcp`)})}),e===`catalog`&&!w.isError&&(0,V.jsx)(W,{hasMore:!!w.hasNextPage,loading:w.isFetchingNextPage,sentinelRef:D})]})]})]}),(0,V.jsx)(me,{item:p,open:!!p,pending:O.isPending,onOpenChange:e=>!e&&m(null),onSubmit:P}),(0,V.jsx)(ge,{open:!!g,targetName:g,result:ee,pending:A.isPending,onOpenChange:e=>!e&&_(null)}),(0,V.jsx)(S,{})]})}export{H as a,B as c,q as i,z as l,Y as n,W as o,G as r,U as s,Se as t};
@@ -1 +0,0 @@
1
- import{c as e}from"./dist-fGogBmPA.js";var t=e(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]);export{t};
@@ -1 +0,0 @@
1
- import{lt as e}from"./index-DjXqiloY.js";export{e as RemoteAccessPage};
@@ -1 +0,0 @@
1
- import{c as e}from"./dist-fGogBmPA.js";var t=e(`RotateCw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]);export{t};
@@ -1 +0,0 @@
1
- import{r as e}from"./react-CTqdhFMk.js";import{$ as t,B as n,G as r,Gt as i,I as a,K as o,L as s,P as c,Q as l,Ut as u,V as d,W as f,Wt as p,X as m,Z as h,et as g,nn as _,nt as v,q as y,rt as b,tt as x,z as S}from"./api-dQ6uQSZG.js";function C(){return i({queryKey:[`config`],queryFn:S,staleTime:3e4,refetchOnWindowFocus:!0})}function w(){return i({queryKey:[`config-meta`],queryFn:n,staleTime:1/0})}function T(){return i({queryKey:[`providers`],queryFn:r,staleTime:3e4,refetchOnWindowFocus:!0})}function E(){return i({queryKey:[`provider-templates`],queryFn:f,staleTime:1/0})}function D(){return i({queryKey:[`config-schema`],queryFn:d,staleTime:1/0})}function O(){let n=_();return p({mutationFn:t,onSuccess:()=>{n.invalidateQueries({queryKey:[`config`]}),u.success(e(`configSaved`))},onError:t=>{u.error(e(`configSaveFailed`)+`: `+t.message)}})}function k(){let t=_();return p({mutationFn:({data:e})=>v(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),t.invalidateQueries({queryKey:[`config-meta`]}),u.success(e(`configSavedApplied`))},onError:t=>{u.error(e(`configSaveFailed`)+`: `+t.message)}})}function A(){let t=_();return p({mutationFn:({provider:e,data:t})=>g(e,t),onSuccess:(n,r)=>{t.invalidateQueries({queryKey:[`providers`]}),t.invalidateQueries({queryKey:[`config`]}),r.silentSuccess||u.success(e(`configSaved`))},onError:t=>{u.error(e(`configSaveFailed`)+`: `+t.message)}})}function j(){let t=_();return p({mutationFn:({data:e})=>c(e??{}),onSuccess:()=>{t.invalidateQueries({queryKey:[`providers`]}),t.invalidateQueries({queryKey:[`config`]}),u.success(e(`configSaved`))},onError:t=>{u.error(e(`configSaveFailed`)+`: `+t.message)}})}function M(){let t=_();return p({mutationFn:({provider:e})=>a(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`providers`]}),t.invalidateQueries({queryKey:[`config`]}),u.success(e(`configSaved`))},onError:t=>{u.error(e(`configSaveFailed`)+`: `+t.message)}})}function N(){return p({mutationFn:({provider:e,data:t})=>h(e,t)})}function P(){return p({mutationFn:({provider:e,data:t})=>m(e,t)})}function F(){return p({mutationFn:({provider:e,data:t})=>y(e,t)})}function I(){return p({mutationFn:({provider:e})=>o(e)})}function L(){let t=_();return p({mutationFn:({channel:e,data:t})=>l(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),t.invalidateQueries({queryKey:[`config-meta`]}),u.success(e(`configSavedApplying`))},onError:t=>{u.error(e(`configSaveFailed`)+`: `+t.message)}})}function R(){let t=_();return p({mutationFn:({data:e})=>x(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),u.success(e(`configSavedApplied`))},onError:t=>{u.error(e(`configSaveFailed`)+`: `+t.message)}})}function z(){let t=_();return p({mutationFn:({data:e})=>b(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),u.success(e(`configSavedApplied`))},onError:t=>{u.error(e(`configSaveFailed`)+`: `+t.message)}})}function B(){return p({mutationFn:({actionId:e,data:t})=>s(e,t),onError:t=>{u.error(e(`error`)+`: `+t.message)}})}export{k as _,M as a,F as c,P as d,N as f,R as g,A as h,j as i,E as l,O as m,w as n,B as o,L as p,D as r,I as s,C as t,T as u,z as v};
@@ -1 +0,0 @@
1
- import{c as e}from"./dist-fGogBmPA.js";var t=e(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t};