@samanhappy/mcphub 1.0.3 → 1.0.5

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 (73) hide show
  1. package/README.fr.md +1 -1
  2. package/README.md +1 -1
  3. package/dist/betterAuth.js +21 -6
  4. package/dist/betterAuth.js.map +1 -1
  5. package/dist/clients/openapi.js +31 -9
  6. package/dist/clients/openapi.js.map +1 -1
  7. package/dist/config/index.js +8 -0
  8. package/dist/config/index.js.map +1 -1
  9. package/dist/controllers/configController.js +4 -5
  10. package/dist/controllers/configController.js.map +1 -1
  11. package/dist/controllers/oauthDynamicRegistrationController.js +6 -6
  12. package/dist/controllers/oauthDynamicRegistrationController.js.map +1 -1
  13. package/dist/controllers/oauthServerController.js +7 -7
  14. package/dist/controllers/oauthServerController.js.map +1 -1
  15. package/dist/controllers/serverController.js +107 -21
  16. package/dist/controllers/serverController.js.map +1 -1
  17. package/dist/index.js +2 -0
  18. package/dist/index.js.map +1 -1
  19. package/dist/middlewares/auth.js +2 -3
  20. package/dist/middlewares/auth.js.map +1 -1
  21. package/dist/middlewares/index.js +31 -23
  22. package/dist/middlewares/index.js.map +1 -1
  23. package/dist/routes/index.js +1 -1
  24. package/dist/routes/index.js.map +1 -1
  25. package/dist/services/betterAuthConfig.js +43 -11
  26. package/dist/services/betterAuthConfig.js.map +1 -1
  27. package/dist/services/betterAuthSession.js +1 -1
  28. package/dist/services/betterAuthSession.js.map +1 -1
  29. package/dist/utils/systemConfigCache.js +13 -0
  30. package/dist/utils/systemConfigCache.js.map +1 -0
  31. package/frontend/dist/assets/{ActivityPage-DeJomvjn.js → ActivityPage-Ccbl6DLW.js} +2 -2
  32. package/frontend/dist/assets/{ActivityPage-DeJomvjn.js.map → ActivityPage-Ccbl6DLW.js.map} +1 -1
  33. package/frontend/dist/assets/{Dashboard-CZPBdlCK.js → Dashboard-CPkAALtS.js} +2 -2
  34. package/frontend/dist/assets/{Dashboard-CZPBdlCK.js.map → Dashboard-CPkAALtS.js.map} +1 -1
  35. package/frontend/dist/assets/{EndpointCopy-Ds6T2k0b.js → EndpointCopy-BYHUhlpW.js} +2 -2
  36. package/frontend/dist/assets/{EndpointCopy-Ds6T2k0b.js.map → EndpointCopy-BYHUhlpW.js.map} +1 -1
  37. package/frontend/dist/assets/{GroupsPage-BN8Zp5i8.js → GroupsPage-CJI35G25.js} +2 -2
  38. package/frontend/dist/assets/{GroupsPage-BN8Zp5i8.js.map → GroupsPage-CJI35G25.js.map} +1 -1
  39. package/frontend/dist/assets/{LoginPage-CykN_c-N.js → LoginPage-BZ0WR09v.js} +2 -2
  40. package/frontend/dist/assets/{LoginPage-CykN_c-N.js.map → LoginPage-BZ0WR09v.js.map} +1 -1
  41. package/frontend/dist/assets/{LogsPage-cTSP1Ych.js → LogsPage-C_U-xXX0.js} +2 -2
  42. package/frontend/dist/assets/{LogsPage-cTSP1Ych.js.map → LogsPage-C_U-xXX0.js.map} +1 -1
  43. package/frontend/dist/assets/{MarketPage-3wD6aBlw.js → MarketPage-dyC4ocP6.js} +2 -2
  44. package/frontend/dist/assets/{MarketPage-3wD6aBlw.js.map → MarketPage-dyC4ocP6.js.map} +1 -1
  45. package/frontend/dist/assets/{PromptsPage-DCki8rQ_.js → PromptsPage-gNHl5xn5.js} +2 -2
  46. package/frontend/dist/assets/{PromptsPage-DCki8rQ_.js.map → PromptsPage-gNHl5xn5.js.map} +1 -1
  47. package/frontend/dist/assets/{ResourcesPage-BQouQx0Z.js → ResourcesPage-DvgjlTqh.js} +2 -2
  48. package/frontend/dist/assets/{ResourcesPage-BQouQx0Z.js.map → ResourcesPage-DvgjlTqh.js.map} +1 -1
  49. package/frontend/dist/assets/{ServersPage-Csxre8tN.js → ServersPage-CKuVFL3O.js} +4 -4
  50. package/frontend/dist/assets/{ServersPage-Csxre8tN.js.map → ServersPage-CKuVFL3O.js.map} +1 -1
  51. package/frontend/dist/assets/SettingsPage-D66oC6py.js +12 -0
  52. package/frontend/dist/assets/SettingsPage-D66oC6py.js.map +1 -0
  53. package/frontend/dist/assets/{StatusDot-Bue_Np95.js → StatusDot-C7XhRfMO.js} +2 -2
  54. package/frontend/dist/assets/{StatusDot-Bue_Np95.js.map → StatusDot-C7XhRfMO.js.map} +1 -1
  55. package/frontend/dist/assets/{ToggleGroup-tOnB-V7o.js → ToggleGroup-_MiJO3n_.js} +2 -2
  56. package/frontend/dist/assets/{ToggleGroup-tOnB-V7o.js.map → ToggleGroup-_MiJO3n_.js.map} +1 -1
  57. package/frontend/dist/assets/{UsersPage-TnUA9-uw.js → UsersPage-COmrRpdL.js} +2 -2
  58. package/frontend/dist/assets/{UsersPage-TnUA9-uw.js.map → UsersPage-COmrRpdL.js.map} +1 -1
  59. package/frontend/dist/assets/index-D82vzW6B.js +3 -0
  60. package/frontend/dist/assets/index-D82vzW6B.js.map +1 -0
  61. package/frontend/dist/assets/{resourceService-CQlrCAEY.js → resourceService-D-fKBZtF.js} +2 -2
  62. package/frontend/dist/assets/{resourceService-CQlrCAEY.js.map → resourceService-D-fKBZtF.js.map} +1 -1
  63. package/frontend/dist/assets/{useServerData-DP0ud49e.js → useServerData-DgGTUuZ8.js} +2 -2
  64. package/frontend/dist/assets/{useServerData-DP0ud49e.js.map → useServerData-DgGTUuZ8.js.map} +1 -1
  65. package/frontend/dist/assets/useSettingsData-B3CTLIUT.js +2 -0
  66. package/frontend/dist/assets/{useSettingsData-BoWRW73A.js.map → useSettingsData-B3CTLIUT.js.map} +1 -1
  67. package/frontend/dist/index.html +1 -1
  68. package/package.json +1 -1
  69. package/frontend/dist/assets/SettingsPage-ByIy81yn.js +0 -12
  70. package/frontend/dist/assets/SettingsPage-ByIy81yn.js.map +0 -1
  71. package/frontend/dist/assets/index-B49EwZHb.js +0 -3
  72. package/frontend/dist/assets/index-B49EwZHb.js.map +0 -1
  73. package/frontend/dist/assets/useSettingsData-BoWRW73A.js +0 -2
@@ -1,4 +1,4 @@
1
- import{r as b,R as W,j as e}from"./framework-vendor-BUhDPOUZ.js";import{m as U,d as q,i as Q,e as M}from"./index-B49EwZHb.js";import{u as J}from"./useServerData-DP0ud49e.js";import{u as X}from"./useSettingsData-BoWRW73A.js";import{u as P}from"./i18n-vendor-Kbr87Ofu.js";import{W as ee,f as se,F as te,C as re,o as B,x as ae,u as le,t as ne,T as oe,s as ie,v as V,D as ce,P as _,j as de,X as me}from"./icons-vendor-CKgJB3SC.js";import{D as ue}from"./DeleteDialog-DRbWonMu.js";const pe={tools:[],prompts:[],resources:[]},H={tools:"all",prompts:"all",resources:"all"},Y=({servers:i,value:m,onChange:t,className:d})=>{const{t:u}=P(),{nameSeparator:A}=X(),[g,k]=b.useState(new Set),x=W.useMemo(()=>m.map(s=>typeof s=="string"?{name:s,...H}:{...s,tools:s.tools||"all",prompts:s.prompts||"all",resources:s.resources||"all"}),[m]),p=W.useMemo(()=>i.filter(s=>s.enabled!==!1),[i]);W.useEffect(()=>{const s=new Set(x.map(r=>r.name)),l=new Set(p.map(r=>r.name));k(r=>{const S=new Set;return r.forEach(N=>{(s.has(N)||l.has(N))&&S.add(N)}),S})},[x,p]);const v=s=>{if(x.findIndex(r=>r.name===s)>=0){const r=x.filter(S=>S.name!==s);t(r)}else{const r=[...x,{name:s,...H}];t(r)}},y=s=>{k(l=>{const r=new Set(l);return r.has(s)?r.delete(s):r.add(s),r})},w=s=>["tools","prompts","resources"].some(l=>{const r=s[l];return r==="all"||Array.isArray(r)&&r.length>0}),C=(s,l,r,S=!1)=>{const N=x.find(h=>h.name===s),z={...N?{...N}:{name:s,...pe},[l]:r};if(!w(z)){const h=x.filter(F=>F.name!==s);t(h),S||k(F=>{const I=new Set(F);return I.delete(s),I});return}if(N){t(x.map(h=>h.name===s?z:h));return}t([...x,z])},E=(s,l)=>{const r=`${s}${A}`;return l.startsWith(r)?l.slice(r.length):l},o=(s,l)=>l==="tools"?(s.tools||[]).filter(r=>r.enabled!==!1).map(r=>({key:r.name,value:E(s.name,r.name),description:r.description})):l==="prompts"?(s.prompts||[]).filter(r=>r.enabled!==!1).map(r=>({key:r.name,value:E(s.name,r.name),description:r.description})):(s.resources||[]).filter(r=>r.enabled!==!1).map(r=>({key:r.uri,value:r.uri,description:r.description})),c=(s,l,r)=>{const S=p.find(h=>h.name===s);if(!S)return;const N=o(S,l).map(h=>h.value),D=x.find(h=>h.name===s);if(!D){C(s,l,[r]);return}const z=D[l];if(z==="all"){const h=N.filter(F=>F!==r);C(s,l,h);return}if(Array.isArray(z)){if(z.includes(r)){C(s,l,z.filter(F=>F!==r));return}const h=[...z,r];C(s,l,h.length===N.length?"all":h);return}C(s,l,[r])},f=s=>{const l=x.find(r=>r.name===s);return!!(l&&w(l))},a=s=>{const l=x.find(r=>r.name===s);return l?["tools","prompts","resources"].some(r=>{const S=l[r];return Array.isArray(S)&&S.length>0}):!1},n=(s,l,r)=>{const S=x.find(D=>D.name===s);if(!S)return!1;const N=S[l];return N==="all"?!0:Array.isArray(N)?N.includes(r):!1},j=(s,l)=>{const r=x.find(D=>D.name===s.name);if(!r)return 0;const S=o(s,l),N=r[l];if(N==="all")return S.length;if(Array.isArray(N)){const D=new Set(S.map(z=>z.value));return N.filter(z=>D.has(z)).length}return 0},T=[{key:"tools",titleKey:"groups.toolSelection",countKey:"groups.toolsSelected",allKey:"groups.allTools"},{key:"prompts",titleKey:"groups.promptSelection",countKey:"groups.promptsSelected",allKey:"groups.allPrompts"},{key:"resources",titleKey:"groups.resourceSelection",countKey:"groups.resourcesSelected",allKey:"groups.allResources"}],R=s=>T.map(({key:l})=>({key:l,count:j(s,l)})).filter(l=>l.count>0);return e.jsxs("div",{className:U("space-y-4",d),children:[e.jsx("div",{className:"space-y-3",children:p.map(s=>{const l=f(s.name),r=a(s.name),S=g.has(s.name),N=x.find(h=>h.name===s.name),D=R(s),z=T.filter(({key:h})=>o(s,h).length>0);return e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg hover:border-gray-300 hover:bg-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 cursor-pointer rounded-lg transition-colors",onClick:()=>y(s.name),children:[e.jsxs("div",{className:"flex items-center space-x-3",onClick:h=>{h.stopPropagation(),v(s.name)},children:[e.jsx("input",{type:"checkbox",checked:l||r,onChange:()=>v(s.name),className:"w-4 h-4 text-blue-600 bg-gray-100 dark:bg-gray-800 border-gray-300 rounded focus:ring-blue-500"}),e.jsx("span",{className:"font-medium text-gray-900 cursor-pointer select-none",children:s.name})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[D.map(({key:h,count:F})=>e.jsxs("span",{className:"text-sm text-green-600 flex items-center gap-1",children:[h==="tools"?e.jsx(ee,{size:14}):h==="prompts"?e.jsx(se,{size:14}):e.jsx(te,{size:14})," ",F]},h)),z.length>0&&e.jsx("button",{type:"button",className:"p-1 text-gray-400 hover:text-gray-600 transition-colors",children:e.jsx("svg",{className:U("w-5 h-5 transition-transform",S&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]})]}),S&&z.length>0&&e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 p-3",children:e.jsx("div",{className:"space-y-4",children:z.map(({key:h,titleKey:F,countKey:I,allKey:L})=>{const $=o(s,h),K=j(s,h),O=(N==null?void 0:N[h])==="all"||K===$.length;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("span",{className:"text-sm font-medium text-gray-700",children:u(F)}),e.jsxs("div",{className:"flex items-center gap-3",children:[N&&e.jsx("span",{className:"text-xs text-green-600",children:O?`(${u(L)} ${$.length}/${$.length})`:`(${u(I)} ${K}/${$.length})`}),e.jsx("button",{type:"button",onClick:()=>{C(s.name,h,O?[]:"all",!0)},className:"text-sm text-blue-600 hover:text-blue-800 transition-colors",children:u(O?"groups.selectNone":"groups.selectAll")})]})]}),e.jsx("div",{className:"grid grid-cols-1 gap-2 max-h-32 overflow-y-auto",children:$.map(G=>{const Z=n(s.name,h,G.value);return e.jsxs("label",{className:"flex items-center space-x-2 text-sm",children:[e.jsx("input",{type:"checkbox",checked:Z,onChange:()=>c(s.name,h,G.value),className:"w-3 h-3 text-blue-600 bg-gray-100 dark:bg-gray-800 border-gray-300 rounded focus:ring-blue-500"}),e.jsx("span",{className:"text-gray-700 break-all whitespace-nowrap",children:G.value}),G.description&&e.jsx("span",{className:"text-gray-400 text-xs truncate",children:G.description})]},G.key)})})]},h)})})})]},s.name)})}),p.length===0&&e.jsx("p",{className:"text-gray-500 text-sm",children:u("groups.noServerOptions")})]})},xe=({onAdd:i,onCancel:m})=>{const{t}=P(),{createGroup:d}=q(),{allServers:u}=J(),[A,g]=b.useState([]),[k,x]=b.useState(null),[p,v]=b.useState(!1),[y,w]=b.useState({name:"",description:"",servers:[]});b.useEffect(()=>{g(u.filter(o=>o.enabled!==!1))},[u]);const C=o=>{const{name:c,value:f}=o.target;w(a=>({...a,[c]:f}))},E=async o=>{o.preventDefault(),v(!0),x(null);try{if(!y.name.trim()){x(t("groups.nameRequired")),v(!1);return}const c=await d(y.name,y.description,y.servers);if(!c||!c.success){x((c==null?void 0:c.message)||t("groups.createError")),v(!1);return}i()}catch(c){x(c instanceof Error?c.message:String(c)),v(!1)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg max-w-3xl w-full max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-6 flex-shrink-0",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-800 mb-4",children:t("groups.addNew")}),k&&e.jsx("div",{className:"mb-4 p-3 bg-red-100 text-red-700 rounded-md border border-gray-200 dark:border-gray-700",children:k})]}),e.jsxs("form",{onSubmit:E,className:"flex flex-col flex-1 min-h-0",children:[e.jsx("div",{className:"flex-1 overflow-y-auto px-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-gray-700 text-sm font-bold mb-2",htmlFor:"name",children:[t("groups.name")," *"]}),e.jsx("input",{type:"text",id:"name",name:"name",value:y.name,onChange:C,className:"w-full border border-gray-300 rounded-md px-3 py-2 text-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:t("groups.namePlaceholder"),required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",children:t("groups.configureCapabilities")}),e.jsx(Y,{servers:A,value:y.servers,onChange:o=>w(c=>({...c,servers:o})),className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4 bg-gray-50 dark:bg-gray-800"})]})]})}),e.jsxs("div",{className:"flex justify-end space-x-2 p-5 pt-3 border-t border-[var(--hub-line-2)] flex-shrink-0",children:[e.jsx("button",{type:"button",onClick:m,className:"hub-btn",disabled:p,children:t("common.cancel")}),e.jsx("button",{type:"submit",className:"hub-btn primary",disabled:p,children:t(p?"common.submitting":"common.create")})]})]})]})})},he=({group:i,onEdit:m,onCancel:t})=>{const{t:d}=P(),{updateGroup:u}=q(),{allServers:A}=J(),[g,k]=b.useState([]),[x,p]=b.useState(null),[v,y]=b.useState(!1),[w,C]=b.useState({name:i.name,description:i.description||"",servers:i.servers||[]});b.useEffect(()=>{k(A.filter(c=>c.enabled!==!1))},[A]);const E=c=>{const{name:f,value:a}=c.target;C(n=>({...n,[f]:a}))},o=async c=>{c.preventDefault(),y(!0),p(null);try{if(!w.name.trim()){p(d("groups.nameRequired")),y(!1);return}const f=await u(i.id,{name:w.name,description:w.description,servers:w.servers});if(!f||!f.success){p((f==null?void 0:f.message)||d("groups.updateError")),y(!1);return}m()}catch(f){p(f instanceof Error?f.message:String(f)),y(!1)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg max-w-3xl w-full max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-6 flex-shrink-0",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-800 mb-4",children:d("groups.edit")}),x&&e.jsx("div",{className:"mb-4 p-3 bg-red-100 text-red-700 rounded-md border border-gray-200 dark:border-gray-700",children:x})]}),e.jsxs("form",{onSubmit:o,className:"flex flex-col flex-1 min-h-0",children:[e.jsx("div",{className:"flex-1 overflow-y-auto px-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-gray-700 text-sm font-bold mb-2",htmlFor:"name",children:[d("groups.name")," *"]}),e.jsx("input",{type:"text",id:"name",name:"name",value:w.name,onChange:E,className:"w-full border border-gray-300 rounded-md px-3 py-2 text-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:d("groups.namePlaceholder"),required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",children:d("groups.configureCapabilities")}),e.jsx(Y,{servers:g,value:w.servers,onChange:c=>C(f=>({...f,servers:c})),className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4 bg-gray-50 dark:bg-gray-800"})]})]})}),e.jsxs("div",{className:"flex justify-end space-x-2 p-5 pt-3 border-t border-[var(--hub-line-2)] flex-shrink-0",children:[e.jsx("button",{type:"button",onClick:t,className:"hub-btn",disabled:v,children:d("common.cancel")}),e.jsx("button",{type:"submit",className:"hub-btn primary",disabled:v,children:d(v?"common.submitting":"common.save")})]})]})]})})},be=i=>i.map(m=>typeof m=="string"?m:m.name),ge=(i,m)=>{const t=i.servers.find(d=>typeof d=="string"?d===m:d.name===m);return t?typeof t=="string"?{name:t,tools:"all",prompts:"all",resources:"all"}:t:{name:m,tools:"all",prompts:"all",resources:"all"}},fe=async i=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(i),!0}catch{}try{const m=document.createElement("textarea");m.value=i,m.style.position="fixed",m.style.left="-9999px",document.body.appendChild(m),m.focus(),m.select();const t=document.execCommand("copy");return document.body.removeChild(m),t}catch{return!1}},ye=({group:i,servers:m,onEdit:t,onDelete:d})=>{var R;const{t:u}=P(),{showToast:A}=Q(),{installConfig:g,nameSeparator:k}=X(),x=((R=g==null?void 0:g.baseUrl)==null?void 0:R.replace(/\/+$/,""))||"",[p,v]=b.useState(!1),[y,w]=b.useState(!1),[C,E]=b.useState(!1),o=b.useRef(null);b.useEffect(()=>{const s=l=>{o.current&&!o.current.contains(l.target)&&E(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[]);const c=async s=>{await fe(s)?(w(!0),E(!1),A(u("common.copySuccess")||"Copied","success"),setTimeout(()=>w(!1),1500)):A(u("common.copyFailed")||"Copy failed","error")},f=`${x}/mcp/${i.name}`,a=be(i.servers),n=m.filter(s=>a.includes(s.name)),j=s=>{const l=ge(i,s.name),r=`${s.name}${k}`,S=s.tools||[],N=s.prompts||[],D=s.resources||[],z=Array.isArray(l.tools)?S.filter(I=>{if(I.enabled===!1)return!1;const L=I.name.startsWith(r)?I.name.slice(r.length):I.name;return l.tools.includes(L)}).length:S.filter(I=>I.enabled!==!1).length,h=Array.isArray(l.prompts)?N.filter(I=>{if(I.enabled===!1)return!1;const L=I.name.startsWith(r)?I.name.slice(r.length):I.name;return l.prompts.includes(L)}).length:N.filter(I=>I.enabled!==!1).length,F=Array.isArray(l.resources)?D.filter(I=>I.enabled!==!1&&l.resources.includes(I.uri)).length:D.filter(I=>I.enabled!==!1).length;return{visibleTools:z,totalTools:S.length,visiblePrompts:h,totalPrompts:N.length,visibleResources:F,totalResources:D.length}},T=n.reduce((s,l)=>s+j(l).visibleTools,0);return e.jsxs("div",{className:"hub-card overflow-visible",children:[e.jsxs("div",{className:"flex items-start gap-3 px-4 py-3",style:{borderBottom:"1px solid var(--hub-line-2)"},children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{style:{fontSize:15,fontWeight:600,letterSpacing:"-0.015em"},children:i.name}),e.jsx("span",{className:"hub-mono",style:{fontSize:11,color:"var(--hub-ink-3)",padding:"0 6px",border:"1px solid var(--hub-line)",borderRadius:4,height:18,display:"inline-flex",alignItems:"center"},title:i.id,children:i.id})]}),i.description&&e.jsx("div",{style:{fontSize:12.5,color:"var(--hub-ink-3)",marginTop:2},children:i.description})]}),e.jsxs("div",{className:"flex items-center gap-1",ref:o,children:[e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:()=>E(s=>!s),className:"hub-icon-btn sm",title:u("common.copy"),children:y?e.jsx(re,{size:13,className:"text-[var(--hub-ok)]"}):e.jsx(B,{size:13})}),C&&e.jsxs("div",{className:"absolute top-full right-0 mt-1 z-20 hub-card",style:{minWidth:160,padding:4},children:[e.jsxs("button",{onClick:()=>c(i.id),className:"flex items-center gap-2 w-full px-2.5 py-1.5 text-[13px] rounded-md hover:bg-[var(--hub-surface-hover)] text-left",children:[e.jsx(B,{size:12})," ",u("common.copyId")]}),e.jsxs("button",{onClick:()=>c(f),className:"flex items-center gap-2 w-full px-2.5 py-1.5 text-[13px] rounded-md hover:bg-[var(--hub-surface-hover)] text-left",children:[e.jsx(ae,{size:12})," ",u("common.copyUrl")]}),e.jsxs("button",{onClick:()=>c(JSON.stringify({mcpServers:{mcphub:{url:f,headers:{Authorization:"Bearer <your-access-token>"}}}},null,2)),className:"flex items-center gap-2 w-full px-2.5 py-1.5 text-[13px] rounded-md hover:bg-[var(--hub-surface-hover)] text-left",children:[e.jsx(le,{size:12})," ",u("common.copyJson")]})]})]}),e.jsx("button",{onClick:()=>t(i),className:"hub-icon-btn sm",title:u("groups.edit"),children:e.jsx(ne,{size:13})}),e.jsx("button",{onClick:()=>v(!0),className:"hub-icon-btn sm",title:u("groups.delete"),style:{color:"var(--hub-ink-3)"},children:e.jsx(oe,{size:13})})]})]}),e.jsxs("div",{className:"grid items-center gap-3 px-4 py-3",style:{gridTemplateColumns:"1fr 80px 1fr"},children:[e.jsx("div",{className:"flex flex-col gap-1.5",children:n.length===0?e.jsx("div",{style:{fontSize:12,color:"var(--hub-ink-3)"},children:u("groups.noServers")}):n.map(s=>{const l=j(s);return e.jsxs("div",{className:"flex items-center gap-2.5 px-2.5 py-1.5 rounded-md",style:{background:"var(--hub-bg-2)",border:"1px solid var(--hub-line-2)"},children:[e.jsx("span",{className:"inline-block flex-shrink-0",style:{width:6,height:6,borderRadius:50,background:s.status==="connected"?"var(--hub-ok)":s.status==="connecting"?"var(--hub-warn)":"var(--hub-err)"}}),e.jsx("span",{className:"hub-mono truncate flex-1",style:{fontSize:12.5},children:s.name}),e.jsxs("span",{className:"hub-mono hub-num flex-shrink-0",style:{fontSize:11,color:"var(--hub-ink-3)"},children:[l.visibleTools,"/",l.totalTools," tools"]})]},s.name)})}),e.jsxs("svg",{width:"80",height:"80",viewBox:"0 0 80 80",className:"self-center",children:[n.length===0?e.jsx("path",{d:"M0,40 C30,40 50,40 80,40",stroke:"var(--hub-line)",strokeWidth:"1",fill:"none",strokeDasharray:"3 3"}):n.map((s,l)=>{const r=12+60/Math.max(n.length,1)*(l+.5);return e.jsx("path",{d:`M0,${r} C 30,${r} 50,40 80,40`,stroke:"var(--hub-line)",strokeWidth:"1",fill:"none",strokeDasharray:"3 3"},l)}),e.jsx("circle",{cx:"80",cy:"40",r:"4",fill:"var(--hub-ink)"})]}),e.jsxs("div",{className:"px-3 py-2.5 rounded-md",style:{border:"1px solid var(--hub-line)",background:"var(--hub-bg-2)"},children:[e.jsx("div",{className:"hub-sect",style:{marginBottom:4},children:"endpoint"}),e.jsxs("div",{className:"hub-mono break-all",style:{fontSize:12,color:"var(--hub-ink-2)",lineHeight:1.4},children:[e.jsx("span",{style:{color:"var(--hub-ink-3)"},children:"/mcp/"}),e.jsx("b",{style:{color:"var(--hub-ink)",fontWeight:600},children:i.name})]}),e.jsx("div",{className:"flex gap-1.5 mt-2",children:e.jsxs("button",{className:"hub-btn sm flex-1 justify-center",onClick:()=>c(f),children:[e.jsx(B,{size:11})," ",u("common.copy")]})})]})]}),e.jsxs("div",{className:"flex justify-between items-center px-4 py-2",style:{borderTop:"1px solid var(--hub-line-2)",background:"var(--hub-bg-2)",fontSize:12,color:"var(--hub-ink-3)"},children:[e.jsxs("div",{className:"hub-mono",children:[e.jsx("span",{style:{color:"var(--hub-ink-2)"},children:n.length})," ",u("nav.servers").toLowerCase()," ·"," ",e.jsx("span",{style:{color:"var(--hub-ink-2)"},children:T})," ",u("server.tools").toLowerCase()]}),e.jsxs("button",{className:"hub-btn ghost sm",style:{color:"var(--hub-ink-3)"},onClick:()=>t(i),children:[u("groups.configureTools")||u("groups.edit"),e.jsx(ie,{size:11,style:{transform:"rotate(-90deg)"}})]})]}),e.jsx(ue,{isOpen:p,onClose:()=>v(!1),onConfirm:()=>{d(i.id),v(!1)},serverName:i.name,isGroup:!0})]})},je=({onSuccess:i,onCancel:m})=>{const{t}=P(),[d,u]=b.useState(""),[A,g]=b.useState(null),[k,x]=b.useState(!1),[p,v]=b.useState(null),y=`{
1
+ import{r as b,R as W,j as e}from"./framework-vendor-BUhDPOUZ.js";import{m as U,d as q,i as Q,e as M}from"./index-D82vzW6B.js";import{u as J}from"./useServerData-DgGTUuZ8.js";import{u as X}from"./useSettingsData-B3CTLIUT.js";import{u as P}from"./i18n-vendor-Kbr87Ofu.js";import{W as ee,f as se,F as te,C as re,o as B,x as ae,u as le,t as ne,T as oe,s as ie,v as V,D as ce,P as _,j as de,X as me}from"./icons-vendor-CKgJB3SC.js";import{D as ue}from"./DeleteDialog-DRbWonMu.js";const pe={tools:[],prompts:[],resources:[]},H={tools:"all",prompts:"all",resources:"all"},Y=({servers:i,value:m,onChange:t,className:d})=>{const{t:u}=P(),{nameSeparator:A}=X(),[g,k]=b.useState(new Set),x=W.useMemo(()=>m.map(s=>typeof s=="string"?{name:s,...H}:{...s,tools:s.tools||"all",prompts:s.prompts||"all",resources:s.resources||"all"}),[m]),p=W.useMemo(()=>i.filter(s=>s.enabled!==!1),[i]);W.useEffect(()=>{const s=new Set(x.map(r=>r.name)),l=new Set(p.map(r=>r.name));k(r=>{const S=new Set;return r.forEach(N=>{(s.has(N)||l.has(N))&&S.add(N)}),S})},[x,p]);const v=s=>{if(x.findIndex(r=>r.name===s)>=0){const r=x.filter(S=>S.name!==s);t(r)}else{const r=[...x,{name:s,...H}];t(r)}},y=s=>{k(l=>{const r=new Set(l);return r.has(s)?r.delete(s):r.add(s),r})},w=s=>["tools","prompts","resources"].some(l=>{const r=s[l];return r==="all"||Array.isArray(r)&&r.length>0}),C=(s,l,r,S=!1)=>{const N=x.find(h=>h.name===s),z={...N?{...N}:{name:s,...pe},[l]:r};if(!w(z)){const h=x.filter(F=>F.name!==s);t(h),S||k(F=>{const I=new Set(F);return I.delete(s),I});return}if(N){t(x.map(h=>h.name===s?z:h));return}t([...x,z])},E=(s,l)=>{const r=`${s}${A}`;return l.startsWith(r)?l.slice(r.length):l},o=(s,l)=>l==="tools"?(s.tools||[]).filter(r=>r.enabled!==!1).map(r=>({key:r.name,value:E(s.name,r.name),description:r.description})):l==="prompts"?(s.prompts||[]).filter(r=>r.enabled!==!1).map(r=>({key:r.name,value:E(s.name,r.name),description:r.description})):(s.resources||[]).filter(r=>r.enabled!==!1).map(r=>({key:r.uri,value:r.uri,description:r.description})),c=(s,l,r)=>{const S=p.find(h=>h.name===s);if(!S)return;const N=o(S,l).map(h=>h.value),D=x.find(h=>h.name===s);if(!D){C(s,l,[r]);return}const z=D[l];if(z==="all"){const h=N.filter(F=>F!==r);C(s,l,h);return}if(Array.isArray(z)){if(z.includes(r)){C(s,l,z.filter(F=>F!==r));return}const h=[...z,r];C(s,l,h.length===N.length?"all":h);return}C(s,l,[r])},f=s=>{const l=x.find(r=>r.name===s);return!!(l&&w(l))},a=s=>{const l=x.find(r=>r.name===s);return l?["tools","prompts","resources"].some(r=>{const S=l[r];return Array.isArray(S)&&S.length>0}):!1},n=(s,l,r)=>{const S=x.find(D=>D.name===s);if(!S)return!1;const N=S[l];return N==="all"?!0:Array.isArray(N)?N.includes(r):!1},j=(s,l)=>{const r=x.find(D=>D.name===s.name);if(!r)return 0;const S=o(s,l),N=r[l];if(N==="all")return S.length;if(Array.isArray(N)){const D=new Set(S.map(z=>z.value));return N.filter(z=>D.has(z)).length}return 0},T=[{key:"tools",titleKey:"groups.toolSelection",countKey:"groups.toolsSelected",allKey:"groups.allTools"},{key:"prompts",titleKey:"groups.promptSelection",countKey:"groups.promptsSelected",allKey:"groups.allPrompts"},{key:"resources",titleKey:"groups.resourceSelection",countKey:"groups.resourcesSelected",allKey:"groups.allResources"}],R=s=>T.map(({key:l})=>({key:l,count:j(s,l)})).filter(l=>l.count>0);return e.jsxs("div",{className:U("space-y-4",d),children:[e.jsx("div",{className:"space-y-3",children:p.map(s=>{const l=f(s.name),r=a(s.name),S=g.has(s.name),N=x.find(h=>h.name===s.name),D=R(s),z=T.filter(({key:h})=>o(s,h).length>0);return e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg hover:border-gray-300 hover:bg-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 cursor-pointer rounded-lg transition-colors",onClick:()=>y(s.name),children:[e.jsxs("div",{className:"flex items-center space-x-3",onClick:h=>{h.stopPropagation(),v(s.name)},children:[e.jsx("input",{type:"checkbox",checked:l||r,onChange:()=>v(s.name),className:"w-4 h-4 text-blue-600 bg-gray-100 dark:bg-gray-800 border-gray-300 rounded focus:ring-blue-500"}),e.jsx("span",{className:"font-medium text-gray-900 cursor-pointer select-none",children:s.name})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[D.map(({key:h,count:F})=>e.jsxs("span",{className:"text-sm text-green-600 flex items-center gap-1",children:[h==="tools"?e.jsx(ee,{size:14}):h==="prompts"?e.jsx(se,{size:14}):e.jsx(te,{size:14})," ",F]},h)),z.length>0&&e.jsx("button",{type:"button",className:"p-1 text-gray-400 hover:text-gray-600 transition-colors",children:e.jsx("svg",{className:U("w-5 h-5 transition-transform",S&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]})]}),S&&z.length>0&&e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 p-3",children:e.jsx("div",{className:"space-y-4",children:z.map(({key:h,titleKey:F,countKey:I,allKey:L})=>{const $=o(s,h),K=j(s,h),O=(N==null?void 0:N[h])==="all"||K===$.length;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("span",{className:"text-sm font-medium text-gray-700",children:u(F)}),e.jsxs("div",{className:"flex items-center gap-3",children:[N&&e.jsx("span",{className:"text-xs text-green-600",children:O?`(${u(L)} ${$.length}/${$.length})`:`(${u(I)} ${K}/${$.length})`}),e.jsx("button",{type:"button",onClick:()=>{C(s.name,h,O?[]:"all",!0)},className:"text-sm text-blue-600 hover:text-blue-800 transition-colors",children:u(O?"groups.selectNone":"groups.selectAll")})]})]}),e.jsx("div",{className:"grid grid-cols-1 gap-2 max-h-32 overflow-y-auto",children:$.map(G=>{const Z=n(s.name,h,G.value);return e.jsxs("label",{className:"flex items-center space-x-2 text-sm",children:[e.jsx("input",{type:"checkbox",checked:Z,onChange:()=>c(s.name,h,G.value),className:"w-3 h-3 text-blue-600 bg-gray-100 dark:bg-gray-800 border-gray-300 rounded focus:ring-blue-500"}),e.jsx("span",{className:"text-gray-700 break-all whitespace-nowrap",children:G.value}),G.description&&e.jsx("span",{className:"text-gray-400 text-xs truncate",children:G.description})]},G.key)})})]},h)})})})]},s.name)})}),p.length===0&&e.jsx("p",{className:"text-gray-500 text-sm",children:u("groups.noServerOptions")})]})},xe=({onAdd:i,onCancel:m})=>{const{t}=P(),{createGroup:d}=q(),{allServers:u}=J(),[A,g]=b.useState([]),[k,x]=b.useState(null),[p,v]=b.useState(!1),[y,w]=b.useState({name:"",description:"",servers:[]});b.useEffect(()=>{g(u.filter(o=>o.enabled!==!1))},[u]);const C=o=>{const{name:c,value:f}=o.target;w(a=>({...a,[c]:f}))},E=async o=>{o.preventDefault(),v(!0),x(null);try{if(!y.name.trim()){x(t("groups.nameRequired")),v(!1);return}const c=await d(y.name,y.description,y.servers);if(!c||!c.success){x((c==null?void 0:c.message)||t("groups.createError")),v(!1);return}i()}catch(c){x(c instanceof Error?c.message:String(c)),v(!1)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg max-w-3xl w-full max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-6 flex-shrink-0",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-800 mb-4",children:t("groups.addNew")}),k&&e.jsx("div",{className:"mb-4 p-3 bg-red-100 text-red-700 rounded-md border border-gray-200 dark:border-gray-700",children:k})]}),e.jsxs("form",{onSubmit:E,className:"flex flex-col flex-1 min-h-0",children:[e.jsx("div",{className:"flex-1 overflow-y-auto px-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-gray-700 text-sm font-bold mb-2",htmlFor:"name",children:[t("groups.name")," *"]}),e.jsx("input",{type:"text",id:"name",name:"name",value:y.name,onChange:C,className:"w-full border border-gray-300 rounded-md px-3 py-2 text-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:t("groups.namePlaceholder"),required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",children:t("groups.configureCapabilities")}),e.jsx(Y,{servers:A,value:y.servers,onChange:o=>w(c=>({...c,servers:o})),className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4 bg-gray-50 dark:bg-gray-800"})]})]})}),e.jsxs("div",{className:"flex justify-end space-x-2 p-5 pt-3 border-t border-[var(--hub-line-2)] flex-shrink-0",children:[e.jsx("button",{type:"button",onClick:m,className:"hub-btn",disabled:p,children:t("common.cancel")}),e.jsx("button",{type:"submit",className:"hub-btn primary",disabled:p,children:t(p?"common.submitting":"common.create")})]})]})]})})},he=({group:i,onEdit:m,onCancel:t})=>{const{t:d}=P(),{updateGroup:u}=q(),{allServers:A}=J(),[g,k]=b.useState([]),[x,p]=b.useState(null),[v,y]=b.useState(!1),[w,C]=b.useState({name:i.name,description:i.description||"",servers:i.servers||[]});b.useEffect(()=>{k(A.filter(c=>c.enabled!==!1))},[A]);const E=c=>{const{name:f,value:a}=c.target;C(n=>({...n,[f]:a}))},o=async c=>{c.preventDefault(),y(!0),p(null);try{if(!w.name.trim()){p(d("groups.nameRequired")),y(!1);return}const f=await u(i.id,{name:w.name,description:w.description,servers:w.servers});if(!f||!f.success){p((f==null?void 0:f.message)||d("groups.updateError")),y(!1);return}m()}catch(f){p(f instanceof Error?f.message:String(f)),y(!1)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg max-w-3xl w-full max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"p-6 flex-shrink-0",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-800 mb-4",children:d("groups.edit")}),x&&e.jsx("div",{className:"mb-4 p-3 bg-red-100 text-red-700 rounded-md border border-gray-200 dark:border-gray-700",children:x})]}),e.jsxs("form",{onSubmit:o,className:"flex flex-col flex-1 min-h-0",children:[e.jsx("div",{className:"flex-1 overflow-y-auto px-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-gray-700 text-sm font-bold mb-2",htmlFor:"name",children:[d("groups.name")," *"]}),e.jsx("input",{type:"text",id:"name",name:"name",value:w.name,onChange:E,className:"w-full border border-gray-300 rounded-md px-3 py-2 text-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:d("groups.namePlaceholder"),required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",children:d("groups.configureCapabilities")}),e.jsx(Y,{servers:g,value:w.servers,onChange:c=>C(f=>({...f,servers:c})),className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4 bg-gray-50 dark:bg-gray-800"})]})]})}),e.jsxs("div",{className:"flex justify-end space-x-2 p-5 pt-3 border-t border-[var(--hub-line-2)] flex-shrink-0",children:[e.jsx("button",{type:"button",onClick:t,className:"hub-btn",disabled:v,children:d("common.cancel")}),e.jsx("button",{type:"submit",className:"hub-btn primary",disabled:v,children:d(v?"common.submitting":"common.save")})]})]})]})})},be=i=>i.map(m=>typeof m=="string"?m:m.name),ge=(i,m)=>{const t=i.servers.find(d=>typeof d=="string"?d===m:d.name===m);return t?typeof t=="string"?{name:t,tools:"all",prompts:"all",resources:"all"}:t:{name:m,tools:"all",prompts:"all",resources:"all"}},fe=async i=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(i),!0}catch{}try{const m=document.createElement("textarea");m.value=i,m.style.position="fixed",m.style.left="-9999px",document.body.appendChild(m),m.focus(),m.select();const t=document.execCommand("copy");return document.body.removeChild(m),t}catch{return!1}},ye=({group:i,servers:m,onEdit:t,onDelete:d})=>{var R;const{t:u}=P(),{showToast:A}=Q(),{installConfig:g,nameSeparator:k}=X(),x=((R=g==null?void 0:g.baseUrl)==null?void 0:R.replace(/\/+$/,""))||"",[p,v]=b.useState(!1),[y,w]=b.useState(!1),[C,E]=b.useState(!1),o=b.useRef(null);b.useEffect(()=>{const s=l=>{o.current&&!o.current.contains(l.target)&&E(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[]);const c=async s=>{await fe(s)?(w(!0),E(!1),A(u("common.copySuccess")||"Copied","success"),setTimeout(()=>w(!1),1500)):A(u("common.copyFailed")||"Copy failed","error")},f=`${x}/mcp/${i.name}`,a=be(i.servers),n=m.filter(s=>a.includes(s.name)),j=s=>{const l=ge(i,s.name),r=`${s.name}${k}`,S=s.tools||[],N=s.prompts||[],D=s.resources||[],z=Array.isArray(l.tools)?S.filter(I=>{if(I.enabled===!1)return!1;const L=I.name.startsWith(r)?I.name.slice(r.length):I.name;return l.tools.includes(L)}).length:S.filter(I=>I.enabled!==!1).length,h=Array.isArray(l.prompts)?N.filter(I=>{if(I.enabled===!1)return!1;const L=I.name.startsWith(r)?I.name.slice(r.length):I.name;return l.prompts.includes(L)}).length:N.filter(I=>I.enabled!==!1).length,F=Array.isArray(l.resources)?D.filter(I=>I.enabled!==!1&&l.resources.includes(I.uri)).length:D.filter(I=>I.enabled!==!1).length;return{visibleTools:z,totalTools:S.length,visiblePrompts:h,totalPrompts:N.length,visibleResources:F,totalResources:D.length}},T=n.reduce((s,l)=>s+j(l).visibleTools,0);return e.jsxs("div",{className:"hub-card overflow-visible",children:[e.jsxs("div",{className:"flex items-start gap-3 px-4 py-3",style:{borderBottom:"1px solid var(--hub-line-2)"},children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{style:{fontSize:15,fontWeight:600,letterSpacing:"-0.015em"},children:i.name}),e.jsx("span",{className:"hub-mono",style:{fontSize:11,color:"var(--hub-ink-3)",padding:"0 6px",border:"1px solid var(--hub-line)",borderRadius:4,height:18,display:"inline-flex",alignItems:"center"},title:i.id,children:i.id})]}),i.description&&e.jsx("div",{style:{fontSize:12.5,color:"var(--hub-ink-3)",marginTop:2},children:i.description})]}),e.jsxs("div",{className:"flex items-center gap-1",ref:o,children:[e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:()=>E(s=>!s),className:"hub-icon-btn sm",title:u("common.copy"),children:y?e.jsx(re,{size:13,className:"text-[var(--hub-ok)]"}):e.jsx(B,{size:13})}),C&&e.jsxs("div",{className:"absolute top-full right-0 mt-1 z-20 hub-card",style:{minWidth:160,padding:4},children:[e.jsxs("button",{onClick:()=>c(i.id),className:"flex items-center gap-2 w-full px-2.5 py-1.5 text-[13px] rounded-md hover:bg-[var(--hub-surface-hover)] text-left",children:[e.jsx(B,{size:12})," ",u("common.copyId")]}),e.jsxs("button",{onClick:()=>c(f),className:"flex items-center gap-2 w-full px-2.5 py-1.5 text-[13px] rounded-md hover:bg-[var(--hub-surface-hover)] text-left",children:[e.jsx(ae,{size:12})," ",u("common.copyUrl")]}),e.jsxs("button",{onClick:()=>c(JSON.stringify({mcpServers:{mcphub:{url:f,headers:{Authorization:"Bearer <your-access-token>"}}}},null,2)),className:"flex items-center gap-2 w-full px-2.5 py-1.5 text-[13px] rounded-md hover:bg-[var(--hub-surface-hover)] text-left",children:[e.jsx(le,{size:12})," ",u("common.copyJson")]})]})]}),e.jsx("button",{onClick:()=>t(i),className:"hub-icon-btn sm",title:u("groups.edit"),children:e.jsx(ne,{size:13})}),e.jsx("button",{onClick:()=>v(!0),className:"hub-icon-btn sm",title:u("groups.delete"),style:{color:"var(--hub-ink-3)"},children:e.jsx(oe,{size:13})})]})]}),e.jsxs("div",{className:"grid items-center gap-3 px-4 py-3",style:{gridTemplateColumns:"1fr 80px 1fr"},children:[e.jsx("div",{className:"flex flex-col gap-1.5",children:n.length===0?e.jsx("div",{style:{fontSize:12,color:"var(--hub-ink-3)"},children:u("groups.noServers")}):n.map(s=>{const l=j(s);return e.jsxs("div",{className:"flex items-center gap-2.5 px-2.5 py-1.5 rounded-md",style:{background:"var(--hub-bg-2)",border:"1px solid var(--hub-line-2)"},children:[e.jsx("span",{className:"inline-block flex-shrink-0",style:{width:6,height:6,borderRadius:50,background:s.status==="connected"?"var(--hub-ok)":s.status==="connecting"?"var(--hub-warn)":"var(--hub-err)"}}),e.jsx("span",{className:"hub-mono truncate flex-1",style:{fontSize:12.5},children:s.name}),e.jsxs("span",{className:"hub-mono hub-num flex-shrink-0",style:{fontSize:11,color:"var(--hub-ink-3)"},children:[l.visibleTools,"/",l.totalTools," tools"]})]},s.name)})}),e.jsxs("svg",{width:"80",height:"80",viewBox:"0 0 80 80",className:"self-center",children:[n.length===0?e.jsx("path",{d:"M0,40 C30,40 50,40 80,40",stroke:"var(--hub-line)",strokeWidth:"1",fill:"none",strokeDasharray:"3 3"}):n.map((s,l)=>{const r=12+60/Math.max(n.length,1)*(l+.5);return e.jsx("path",{d:`M0,${r} C 30,${r} 50,40 80,40`,stroke:"var(--hub-line)",strokeWidth:"1",fill:"none",strokeDasharray:"3 3"},l)}),e.jsx("circle",{cx:"80",cy:"40",r:"4",fill:"var(--hub-ink)"})]}),e.jsxs("div",{className:"px-3 py-2.5 rounded-md",style:{border:"1px solid var(--hub-line)",background:"var(--hub-bg-2)"},children:[e.jsx("div",{className:"hub-sect",style:{marginBottom:4},children:"endpoint"}),e.jsxs("div",{className:"hub-mono break-all",style:{fontSize:12,color:"var(--hub-ink-2)",lineHeight:1.4},children:[e.jsx("span",{style:{color:"var(--hub-ink-3)"},children:"/mcp/"}),e.jsx("b",{style:{color:"var(--hub-ink)",fontWeight:600},children:i.name})]}),e.jsx("div",{className:"flex gap-1.5 mt-2",children:e.jsxs("button",{className:"hub-btn sm flex-1 justify-center",onClick:()=>c(f),children:[e.jsx(B,{size:11})," ",u("common.copy")]})})]})]}),e.jsxs("div",{className:"flex justify-between items-center px-4 py-2",style:{borderTop:"1px solid var(--hub-line-2)",background:"var(--hub-bg-2)",fontSize:12,color:"var(--hub-ink-3)"},children:[e.jsxs("div",{className:"hub-mono",children:[e.jsx("span",{style:{color:"var(--hub-ink-2)"},children:n.length})," ",u("nav.servers").toLowerCase()," ·"," ",e.jsx("span",{style:{color:"var(--hub-ink-2)"},children:T})," ",u("server.tools").toLowerCase()]}),e.jsxs("button",{className:"hub-btn ghost sm",style:{color:"var(--hub-ink-3)"},onClick:()=>t(i),children:[u("groups.configureTools")||u("groups.edit"),e.jsx(ie,{size:11,style:{transform:"rotate(-90deg)"}})]})]}),e.jsx(ue,{isOpen:p,onClose:()=>v(!1),onConfirm:()=>{d(i.id),v(!1)},serverName:i.name,isGroup:!0})]})},je=({onSuccess:i,onCancel:m})=>{const{t}=P(),[d,u]=b.useState(""),[A,g]=b.useState(null),[k,x]=b.useState(!1),[p,v]=b.useState(null),y=`{
2
2
  "groups": [
3
3
  {
4
4
  "name": "AI Assistants",
@@ -30,4 +30,4 @@ Supports:
30
30
  - All groups will be imported in a single efficient batch operation.`,w=a=>{try{const n=JSON.parse(a.trim());if(!n.groups||!Array.isArray(n.groups))return g(t("groupImport.invalidFormat")),null;for(const j of n.groups)if(!j.name||typeof j.name!="string")return g(t("groupImport.missingName")),null;return n}catch{return g(t("groupImport.parseError")),null}},C=()=>{g(null);const a=w(d);a&&v(a.groups)},E=async()=>{if(p){x(!0),g(null);try{const a=await M("/groups/batch",{groups:p});if(a.success){const{successCount:n,failureCount:j,results:T}=a;if(j>0){const R=T.filter(s=>!s.success).map(s=>`${s.name}: ${s.message||t("groupImport.addFailed")}`);g(t("groupImport.partialSuccess",{count:n,total:p.length})+`
31
31
  `+R.join(`
32
32
  `))}n>0&&i()}else g(a.message||t("groupImport.importFailed"))}catch(a){console.error("Import error:",a),g(t("groupImport.importFailed"))}finally{x(!1)}}},o=a=>e.jsx("span",{className:"text-gray-500 ml-2",children:t(`groups.${a}`)}),c=(a,n)=>{if(!n||n==="all")return null;const j=Array.isArray(n)?n.join(", "):n;return e.jsx("span",{className:"text-gray-500 ml-2",children:t(`groups.${a}`,{items:j})})},f=a=>!a||a.length===0?e.jsx("span",{className:"text-gray-500",children:t("groups.noServers")}):e.jsx("div",{className:"space-y-1",children:a.map((n,j)=>typeof n=="string"?e.jsxs("div",{className:"text-sm",children:["• ",n]},j):e.jsxs("div",{className:"text-sm",children:["• ",n.name,n.tools&&n.tools!=="all"&&e.jsxs("span",{className:"text-gray-500 ml-2",children:["(",Array.isArray(n.tools)?n.tools.join(", "):n.tools,")"]}),n.tools==="all"&&o("previewAllTools"),c("previewPrompts",n.prompts),n.prompts==="all"&&o("previewAllPrompts"),c("previewResources",n.resources),n.resources==="all"&&o("previewAllResources")]},j))});return e.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-6 w-full max-w-4xl max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:t("groupImport.title")}),e.jsx("button",{onClick:m,className:"text-gray-500 hover:text-gray-700",children:"✕"})]}),A&&e.jsx("div",{className:"mb-4 bg-red-50 border-l-4 border-red-500 p-4 rounded",children:e.jsx("p",{className:"text-red-700 whitespace-pre-wrap",children:A})}),p?e.jsxs("div",{children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-3",children:t("groupImport.previewTitle")}),e.jsx("div",{className:"space-y-3",children:p.map((a,n)=>e.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-medium text-gray-900",children:a.name}),a.description&&e.jsx("p",{className:"text-sm text-gray-600 mt-1",children:a.description}),e.jsxs("div",{className:"mt-2 text-sm text-gray-600",children:[e.jsxs("strong",{children:[t("groups.servers"),":"]}),e.jsx("div",{className:"mt-1",children:f(a.servers)})]})]})})},n))})]}),e.jsxs("div",{className:"flex justify-end space-x-4",children:[e.jsx("button",{onClick:()=>v(null),disabled:k,className:"hub-btn",children:t("common.back")}),e.jsx("button",{onClick:E,disabled:k,className:"hub-btn primary",children:k?e.jsxs(e.Fragment,{children:[e.jsxs("svg",{className:"animate-spin h-4 w-4 mr-2",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),t("groupImport.importing")]}):t("groupImport.import")})]})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:t("groupImport.inputLabel")}),e.jsx("textarea",{value:d,onChange:a=>u(a.target.value),className:"w-full h-96 px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 font-mono text-sm",placeholder:y}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:t("groupImport.inputHelp")})]}),e.jsxs("div",{className:"flex justify-end space-x-4",children:[e.jsx("button",{onClick:m,className:"hub-btn",children:t("common.cancel")}),e.jsx("button",{onClick:C,disabled:!d.trim(),className:"hub-btn primary",children:t("groupImport.preview")})]})]})]})})},ve=({groups:i,onCancel:m})=>{const{t}=P(),[d,u]=b.useState(""),[A,g]=b.useState(""),[k,x]=b.useState([]),[p,v]=b.useState(!1),[y,w]=b.useState(!1),[C,E]=b.useState(null),o=a=>{x(n=>n.includes(a)?n.filter(j=>j!==a):[...n,a])},c=()=>{k.length===i.length?x([]):x(i.map(a=>a.id))},f=async()=>{if(!d.trim()){E(t("template.nameRequired"));return}w(!0),E(null);try{const a=await M("/templates/export",{name:d.trim(),description:A.trim()||void 0,groupIds:k.length>0?k:void 0,includeDisabledServers:p});if(a.success&&a.data){const n=a.data,j=new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),T=URL.createObjectURL(j),R=document.createElement("a");R.href=T,R.download=`${n.name.replace(/[^a-zA-Z0-9-_]/g,"_")}.mcphub-template.json`,document.body.appendChild(R),R.click(),document.body.removeChild(R),URL.revokeObjectURL(T),m()}else E(a.message||t("template.exportFailed"))}catch(a){console.error("Export error:",a),E(t("template.exportFailed"))}finally{w(!1)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-6 w-full max-w-3xl max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:t("template.exportTitle")}),e.jsx("button",{onClick:m,className:"text-gray-500 hover:text-gray-700",children:"✕"})]}),C&&e.jsx("div",{className:"mb-4 bg-red-50 border-l-4 border-red-500 p-4 rounded",children:e.jsx("p",{className:"text-red-700",children:C})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[t("template.name")," *"]}),e.jsx("input",{type:"text",value:d,onChange:a=>u(a.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:t("template.namePlaceholder")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:t("template.description")}),e.jsx("input",{type:"text",value:A,onChange:a=>g(a.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:t("template.descriptionPlaceholder")})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700",children:t("template.selectGroups")}),e.jsx("button",{onClick:c,className:"text-sm text-blue-600 hover:text-blue-800",children:k.length===i.length?t("template.deselectAll"):t("template.selectAll")})]}),e.jsx("p",{className:"text-xs text-gray-500 mb-2",children:t("template.selectGroupsHelp")}),e.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-md max-h-48 overflow-y-auto",children:i.map(a=>e.jsxs("label",{className:"flex items-center px-3 py-2 hover:bg-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:k.includes(a.id),onChange:()=>o(a.id),className:"mr-3 h-4 w-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium text-gray-900",children:a.name}),a.description&&e.jsx("span",{className:"text-xs text-gray-500 ml-2",children:a.description})]})]},a.id))})]}),e.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:p,onChange:a=>v(a.target.checked),className:"h-4 w-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500"}),e.jsx("span",{className:"text-sm text-gray-700",children:t("template.includeDisabled")})]})]}),e.jsx("div",{className:"mt-4 p-3 bg-blue-50 border border-blue-200 rounded-md",children:e.jsx("p",{className:"text-sm text-blue-700",children:t("template.exportNote")})}),e.jsxs("div",{className:"flex justify-end space-x-4 mt-6",children:[e.jsx("button",{onClick:m,className:"hub-btn",children:t("common.cancel")}),e.jsx("button",{onClick:f,disabled:y||!d.trim(),className:"hub-btn primary",children:t(y?"template.exporting":"template.export")})]})]})})},Ne=({onSuccess:i,onCancel:m})=>{const{t}=P(),[d,u]=b.useState(null),[A,g]=b.useState(null),[k,x]=b.useState(!1),[p,v]=b.useState(null),y=b.useRef(null),w=o=>{var a;g(null),u(null),v(null);const c=(a=o.target.files)==null?void 0:a[0];if(!c)return;const f=new FileReader;f.onload=n=>{var j;try{const T=JSON.parse((j=n.target)==null?void 0:j.result);if(!T.version||!T.name||!T.servers||!T.groups){g(t("template.invalidFormat"));return}u(T)}catch{g(t("template.parseError"))}},f.readAsText(c)},C=o=>{if(g(null),u(null),v(null),!!o.trim())try{const c=JSON.parse(o.trim());if(!c.version||!c.name||!c.servers||!c.groups){g(t("template.invalidFormat"));return}u(c)}catch{g(t("template.parseError"))}},E=async()=>{if(d){x(!0),g(null);try{const o=await M("/templates/import",d);o.data?(v(o.data),o.data.success&&i()):g(o.message||t("template.importFailed"))}catch(o){console.error("Import error:",o),g(t("template.importFailed"))}finally{x(!1)}}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-6 w-full max-w-4xl max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:t("template.importTitle")}),e.jsx("button",{onClick:m,className:"text-gray-500 hover:text-gray-700",children:"✕"})]}),A&&e.jsx("div",{className:"mb-4 bg-red-50 border-l-4 border-red-500 p-4 rounded",children:e.jsx("p",{className:"text-red-700",children:A})}),p&&e.jsxs("div",{className:`mb-4 p-4 rounded border-l-4 ${p.success?"bg-green-50 border-green-500":"bg-yellow-50 border-yellow-500"}`,children:[e.jsx("p",{className:p.success?"text-green-700":"text-yellow-700",children:t("template.importResult",{serversCreated:p.serversCreated,serversSkipped:p.serversSkipped,groupsCreated:p.groupsCreated,groupsSkipped:p.groupsSkipped})}),p.requiredEnvVars.length>0&&e.jsxs("div",{className:"mt-2 p-2 bg-orange-50 border border-orange-200 rounded",children:[e.jsx("p",{className:"text-sm font-medium text-orange-800",children:t("template.envVarsNeeded")}),e.jsx("ul",{className:"mt-1 text-sm text-orange-700",children:p.requiredEnvVars.map(o=>e.jsx("li",{className:"font-mono",children:o},o))})]})]}),d?e.jsxs("div",{children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[e.jsx("h3",{className:"font-medium text-gray-900",children:d.name}),d.description&&e.jsx("p",{className:"text-sm text-gray-600 mt-1",children:d.description}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:[t("template.version"),": ",d.version," | ",t("template.createdAt"),":"," ",new Date(d.createdAt).toLocaleDateString()]})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:[t("template.servers")," (",Object.keys(d.servers).length,")"]}),e.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-md divide-y divide-gray-200 dark:divide-gray-700 max-h-40 overflow-y-auto",children:Object.entries(d.servers).map(([o,c])=>e.jsxs("div",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-sm font-medium text-gray-900",children:o}),e.jsx("span",{className:"text-xs text-gray-500 ml-2",children:c.type||"stdio"})]},o))})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:[t("template.groups")," (",d.groups.length,")"]}),e.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-md divide-y divide-gray-200 dark:divide-gray-700 max-h-40 overflow-y-auto",children:d.groups.map((o,c)=>e.jsxs("div",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-sm font-medium text-gray-900",children:o.name}),o.description&&e.jsx("span",{className:"text-xs text-gray-500 ml-2",children:o.description}),e.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:[o.servers.length," ",t("template.serversInGroup")]})]},c))})]}),d.requiredEnvVars.length>0&&e.jsxs("div",{className:"p-3 bg-orange-50 border border-orange-200 rounded-md",children:[e.jsx("h4",{className:"text-sm font-medium text-orange-800",children:t("template.envVarsNeeded")}),e.jsx("ul",{className:"mt-1 text-sm text-orange-700 font-mono",children:d.requiredEnvVars.map(o=>e.jsx("li",{children:o},o))})]})]}),e.jsxs("div",{className:"flex justify-end space-x-4 mt-6",children:[e.jsx("button",{onClick:()=>{u(null),v(null),y.current&&(y.current.value="")},className:"hub-btn",children:t("common.back")}),e.jsx("button",{onClick:E,disabled:k,className:"hub-btn primary",children:t(k?"template.importing":"template.import")})]})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"flex items-center justify-between mb-2",children:e.jsx("label",{className:"block text-sm font-medium text-gray-700",children:t("template.uploadFile")})}),e.jsx("div",{className:"flex items-center space-x-4",children:e.jsx("input",{ref:y,type:"file",accept:".json",onChange:w,className:"block text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-semibold file:bg-blue-50 file:text-blue-700 hover:file:bg-blue-100"})})]}),e.jsxs("div",{className:"relative my-4",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("div",{className:"w-full border-t border-gray-300"})}),e.jsx("div",{className:"relative flex justify-center text-sm",children:e.jsx("span",{className:"bg-white dark:bg-gray-800 px-2 text-gray-500",children:t("template.or")})})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:t("template.pasteJson")}),e.jsx("textarea",{className:"w-full h-64 px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 font-mono text-sm",placeholder:t("template.pastePlaceholder"),onChange:o=>C(o.target.value)})]}),e.jsx("div",{className:"flex justify-end space-x-4",children:e.jsx("button",{onClick:m,className:"hub-btn",children:t("common.cancel")})})]})]})})},ze=()=>{const{t:i}=P(),{groups:m,loading:t,error:d,setError:u,deleteGroup:A,triggerRefresh:g}=q(),{allServers:k}=J({refreshOnMount:!0}),[x,p]=b.useState(null),[v,y]=b.useState(!1),[w,C]=b.useState(!1),[E,o]=b.useState(!1),[c,f]=b.useState(!1),a=async n=>{const j=await A(n);(!j||!j.success)&&u((j==null?void 0:j.message)||i("groups.deleteError"))};return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-end justify-between gap-4 mb-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"hub-h1",children:i("pages.groups.title")}),e.jsxs("p",{className:"hub-sub",children:[e.jsx("span",{className:"hub-num",children:m.length})," ",i("nav.groups").toLowerCase()]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{className:"hub-btn",onClick:()=>C(!0),children:[e.jsx(V,{size:13})," ",i("groupImport.button")]}),e.jsxs("button",{className:"hub-btn",onClick:()=>o(!0),children:[e.jsx(ce,{size:13})," ",i("template.exportButton")]}),e.jsxs("button",{className:"hub-btn",onClick:()=>f(!0),children:[e.jsx(V,{size:13})," ",i("template.importButton")]}),e.jsxs("button",{className:"hub-btn primary",onClick:()=>y(!0),children:[e.jsx(_,{size:13})," ",i("groups.add")]})]})]}),d&&e.jsxs("div",{className:"hub-card flex items-center justify-between gap-3 mb-4",style:{padding:"10px 14px",borderColor:"oklch(0.85 0.1 25)",background:"oklch(0.97 0.03 25)",color:"oklch(0.4 0.18 25)"},children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(de,{size:14,className:"flex-shrink-0"}),e.jsx("span",{className:"truncate text-[13px]",children:d})]}),e.jsx("button",{className:"hub-icon-btn sm",onClick:()=>u(null),children:e.jsx(me,{size:13})})]}),t?e.jsx("div",{className:"hub-card p-6 text-center",style:{color:"var(--hub-ink-3)"},children:i("app.loading")}):m.length===0?e.jsx("div",{className:"hub-card p-10 text-center",style:{color:"var(--hub-ink-3)"},children:i("groups.noGroups")}):e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-3.5",children:[m.map(n=>e.jsx(ye,{group:n,servers:k,onEdit:p,onDelete:a},n.id)),e.jsx("button",{onClick:()=>y(!0),className:"flex items-center justify-center text-[var(--hub-ink-3)] hover:text-[var(--hub-ink-2)] transition-colors",style:{border:"1px dashed var(--hub-line)",borderRadius:10,minHeight:200,background:"transparent",cursor:"pointer"},children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"grid place-items-center mx-auto mb-2",style:{width:36,height:36,borderRadius:10,border:"1px solid var(--hub-line)"},children:e.jsx(_,{size:16})}),e.jsx("div",{style:{fontSize:13,fontWeight:500,color:"var(--hub-ink-2)"},children:i("groups.add")}),e.jsx("div",{style:{fontSize:12,marginTop:2},children:i("groups.addNew")})]})})]}),v&&e.jsx(xe,{onAdd:()=>{y(!1),g()},onCancel:()=>y(!1)}),w&&e.jsx(je,{onSuccess:()=>{C(!1),g()},onCancel:()=>C(!1)}),x&&e.jsx(he,{group:x,onEdit:()=>{p(null),g()},onCancel:()=>p(null)}),E&&e.jsx(ve,{groups:m,onCancel:()=>o(!1)}),c&&e.jsx(Ne,{onSuccess:()=>{f(!1),g()},onCancel:()=>f(!1)})]})};export{ze as default};
33
- //# sourceMappingURL=GroupsPage-BN8Zp5i8.js.map
33
+ //# sourceMappingURL=GroupsPage-CJI35G25.js.map