@decocms/mesh 2.65.0 → 2.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-BLu8Aodi.js → AlertCircle-BmDTNgCi.js} +1 -1
- package/dist/client/assets/{ArrowUp-TSXJSHlb.js → ArrowUp-DYeWvB8P.js} +1 -1
- package/dist/client/assets/{Calendar-B_PCwOFB.js → Calendar-DmBdk9eU.js} +1 -1
- package/dist/client/assets/{Check-TVVdApmr.js → Check-FOOd6Eiq.js} +1 -1
- package/dist/client/assets/{CheckCircle-BZgpD8UD.js → CheckCircle-DQui24Wk.js} +1 -1
- package/dist/client/assets/{ChevronDown-DQimov-w.js → ChevronDown-D2XG2Gn2.js} +1 -1
- package/dist/client/assets/{ChevronRight-C1wmaJaY.js → ChevronRight-DopLOHAf.js} +1 -1
- package/dist/client/assets/{Code01-C-_CZ4Yt.js → Code01-5ok4pVqx.js} +1 -1
- package/dist/client/assets/{Copy01-CsYLZnEs.js → Copy01-DeMGkSiw.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-DoBmdgcU.js → DotsHorizontal-Dqjmu4CT.js} +1 -1
- package/dist/client/assets/{DotsVertical-BmpdBChT.js → DotsVertical-DmUNpRAu.js} +1 -1
- package/dist/client/assets/{Download01-dA91PaJn.js → Download01-Cv1Z4E3h.js} +1 -1
- package/dist/client/assets/{Edit01-Cax2qmzX.js → Edit01-CF3AUhcj.js} +1 -1
- package/dist/client/assets/{File02-SOxsIjUX.js → File02-CESqkWVe.js} +1 -1
- package/dist/client/assets/{File06-CJnXWkSw.js → File06-C3Nbkeoy.js} +1 -1
- package/dist/client/assets/{FilterLines-BciMLF4N.js → FilterLines-DGQaIa6D.js} +1 -1
- package/dist/client/assets/{Globe02-CZ780J53.js → Globe02-BL9kqctd.js} +1 -1
- package/dist/client/assets/{Grid01-CDiu9G8k.js → Grid01-DDbvhTzI.js} +1 -1
- package/dist/client/assets/{Home02-CayMHoZF.js → Home02-D7WW64qF.js} +1 -1
- package/dist/client/assets/{Image01-eW3uiaQL.js → Image01-UeXsz1EO.js} +1 -1
- package/dist/client/assets/{Inbox01-CVff9P-h.js → Inbox01-_-qVJU9L.js} +1 -1
- package/dist/client/assets/{InfoCircle-Cwf7A7aM.js → InfoCircle-DZqaw0re.js} +1 -1
- package/dist/client/assets/{LinkExternal01-BjOSGZOe.js → LinkExternal01-Dzwm6JDU.js} +1 -1
- package/dist/client/assets/{List-Blxn6IBl.js → List-7GceYgj2.js} +1 -1
- package/dist/client/assets/{Loading01-CatM6JDa.js → Loading01-B_cIepvx.js} +1 -1
- package/dist/client/assets/{Lock01-CrPQKqta.js → Lock01-itjQ9WNq.js} +1 -1
- package/dist/client/assets/{Pin01-D3LZgLE8.js → Pin01-ycwW3H8M.js} +1 -1
- package/dist/client/assets/{Play-BA6_L1fM.js → Play-Bx5KdMkX.js} +1 -1
- package/dist/client/assets/{Plus-LdanziaX.js → Plus-BTHcgiwq.js} +1 -1
- package/dist/client/assets/{SearchMd-CDLQipSw.js → SearchMd-cyrKubyu.js} +1 -1
- package/dist/client/assets/{Share07-DPsUpckx.js → Share07-KO3g9brj.js} +1 -1
- package/dist/client/assets/{Terminal-C0IzqPpG.js → Terminal-C-7NXNYw.js} +1 -1
- package/dist/client/assets/{Tool01-BUbXFy6J.js → Tool01-DXuVNQ8j.js} +1 -1
- package/dist/client/assets/{Trash01-Du6SwTAz.js → Trash01-BVntsGdy.js} +1 -1
- package/dist/client/assets/{Upload01-CgP92uxk.js → Upload01-CZI-8Oxg.js} +1 -1
- package/dist/client/assets/{Users03-CsLBIBVK.js → Users03-CW_MIbrQ.js} +1 -1
- package/dist/client/assets/{X-D7ML9mux.js → X-nJs6CWkc.js} +1 -1
- package/dist/client/assets/{XClose-U1yU7qCl.js → XClose-grmHIFDR.js} +1 -1
- package/dist/client/assets/{agent-connections-preview-CsYvxmEm.js → agent-connections-preview-DRBTSbmt.js} +1 -1
- package/dist/client/assets/{agent-detail-wkiWbQKN.js → agent-detail-B4mhxHnw.js} +1 -1
- package/dist/client/assets/{agents-kNb1WD8x.js → agents-Ce8XdqjV.js} +1 -1
- package/dist/client/assets/{alert-dialog-DZBrJq-m.js → alert-dialog-DpejafUm.js} +1 -1
- package/dist/client/assets/{auth-catchall-BEy8E7j_.js → auth-catchall-C0vi9YlN.js} +1 -1
- package/dist/client/assets/{badge-Cw5-hSpe.js → badge-BoqXK3lQ.js} +1 -1
- package/dist/client/assets/{binder-ClDDqAqe.js → binder-CzgMN-r7.js} +1 -1
- package/dist/client/assets/{breadcrumb-Caj5YR93.js → breadcrumb-BIaqXYfC.js} +1 -1
- package/dist/client/assets/{button-BgBCyPX0.js → button-BpOnhkky.js} +1 -1
- package/dist/client/assets/{card-DElUPHrE.js → card-QAf6gSBk.js} +1 -1
- package/dist/client/assets/{checkbox-C3ba2fF0.js → checkbox-M8Qpx3bB.js} +1 -1
- package/dist/client/assets/{circle-alert-C2UMYCQm.js → circle-alert-_paQffOL.js} +1 -1
- package/dist/client/assets/{collapsible-Rf1qFjgA.js → collapsible-Casou47x.js} +1 -1
- package/dist/client/assets/{collection-detail-D7X5ych8.js → collection-detail-C75jQ60M.js} +1 -1
- package/dist/client/assets/{collection-search-DuFKyqlJ.js → collection-search-BHH6rJUx.js} +1 -1
- package/dist/client/assets/{collection-tab-BiZnyYe2.js → collection-tab-ewgG6gPy.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-Cd3HlK0O.js → collection-table-wrapper-BSOGGyRN.js} +1 -1
- package/dist/client/assets/{collection-tabs-Dh1QsIBU.js → collection-tabs-BERHo0JB.js} +1 -1
- package/dist/client/assets/{command-Di7AyqP9.js → command-j0rRzLsa.js} +1 -1
- package/dist/client/assets/{connect-D9Hcd45W.js → connect-BZHDhYNf.js} +1 -1
- package/dist/client/assets/{connection-card-bCbaOHws.js → connection-card-BxiMoHcy.js} +1 -1
- package/dist/client/assets/connection-detail-CLDY2hTl.js +1 -0
- package/dist/client/assets/{connections-DIaziwAv.js → connections-CzgxDqaC.js} +1 -1
- package/dist/client/assets/{constants-BfWMVBcn.js → constants-B1dGAzkj.js} +1 -1
- package/dist/client/assets/constants-CTZ4IIMo.js +1 -0
- package/dist/client/assets/{create-organization-dialog-WF7bdDSH.js → create-organization-dialog-BQQDstNY.js} +1 -1
- package/dist/client/assets/{dialog-Bnus_vJ4.js → dialog-C0hNL5DR.js} +1 -1
- package/dist/client/assets/{dropdown-menu-BdLRctPP.js → dropdown-menu-DJexz_iG.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-C4Hm0K_j.js → dynamic-plugin-layout-CQf-tOKf.js} +1 -1
- package/dist/client/assets/{empty-state-BHEu_dw7.js → empty-state-BqgMUhfM.js} +1 -1
- package/dist/client/assets/{empty-state-IVJXfQvW.js → empty-state-C8TWk9F-.js} +1 -1
- package/dist/client/assets/{env-vars-editor-BQGzh8xm.js → env-vars-editor-HJYbSC7d.js} +1 -1
- package/dist/client/assets/{error-boundary-Cqs9yFyH.js → error-boundary-DxoAfcBm.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BttJNYGh.js → extract-connection-data-B9k85tYq.js} +1 -1
- package/dist/client/assets/{file-browser-D9rjJxeo.js → file-browser-CvDyWBhC.js} +2 -2
- package/dist/client/assets/{form-gT1yr3Qo.js → form-Dk7QlEAK.js} +1 -1
- package/dist/client/assets/{grid-view-B3IbROP2.js → grid-view-Cwc1HGyY.js} +1 -1
- package/dist/client/assets/{home-DDpJgZ3V.js → home-CN3zWCYm.js} +1 -1
- package/dist/client/assets/{index-Cfcn3j8H.js → index-5OU1orTq.js} +1 -1
- package/dist/client/assets/{index--WoOZV8D.js → index-5q6rcGyy.js} +1 -1
- package/dist/client/assets/{index-DtEKIwl5.js → index-DOE-Wjlc.js} +1 -1
- package/dist/client/assets/{index-VemZ02DZ.js → index-Dadp543V.js} +1 -1
- package/dist/client/assets/{index-CZuZisdm.js → index-DlEzWBZo.js} +1 -1
- package/dist/client/assets/{index-ByQ-WW1t.js → index-iT9dC5c9.js} +3 -3
- package/dist/client/assets/{index-CrhNqpPK.js → index-s7ZD8Q89.js} +1 -1
- package/dist/client/assets/{index-CzUXuhMT.js → index-u_jFx8_b.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-BYaSWja-.js → infiniteQueryObserver-BZOwrkV7.js} +1 -1
- package/dist/client/assets/{input-CZnIHLcz.js → input-BxYV0rat.js} +1 -1
- package/dist/client/assets/{layout-cMYqFuJn.js → layout-CASMZyDZ.js} +1 -1
- package/dist/client/assets/{localstorage-keys-CmNyjwKR.js → localstorage-keys-5olAunK8.js} +1 -1
- package/dist/client/assets/{login-XOYvZmH2.js → login-Db3PmHLF.js} +1 -1
- package/dist/client/assets/{mcp-oauth-Cb_Gab-K.js → mcp-oauth-z5AJv_x-.js} +1 -1
- package/dist/client/assets/{mcp-server-card-uMBYGp_W.js → mcp-server-card-BoB65BcA.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-aBjEsXJ_.js → mcp-server-detail-DdNAJTvb.js} +2 -2
- package/dist/client/assets/members-ceiqMxhW.js +3 -0
- package/dist/client/assets/{monaco-editor-BKGJwQX8.js → monaco-editor-DGU8ljQX.js} +1 -1
- package/dist/client/assets/{monitoring-CTVn2xIM.js → monitoring-O_ifymcw.js} +1 -1
- package/dist/client/assets/{oauth-callback-BK14KwlT.js → oauth-callback-CJUhWZYA.js} +1 -1
- package/dist/client/assets/{page-C_q1Hu0d.js → page-DhHFaPO-.js} +1 -1
- package/dist/client/assets/{page-BRoCqKJJ.js → page-PpLUsHxD.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-DFlDiIxl.js → plugin-empty-state-CPUeVAAU.js} +1 -1
- package/dist/client/assets/{plugin-header-CBL4cwNA.js → plugin-header-EwCcoJvN.js} +1 -1
- package/dist/client/assets/{plugins-CZKUVOCn.js → plugins-DvqcqtBT.js} +1 -1
- package/dist/client/assets/{popover-5IvuXkII.js → popover-BMJmHsYE.js} +1 -1
- package/dist/client/assets/{registry-utils-BhwI9Zxs.js → registry-utils-DBl3y38w.js} +1 -1
- package/dist/client/assets/{resizable-BwJPsyFO.js → resizable-8AV10P7U.js} +1 -1
- package/dist/client/assets/{select-CTRzFFUx.js → select-CsCf0ULc.js} +1 -1
- package/dist/client/assets/{settings-BexesTWb.js → settings-DrPqjDLH.js} +1 -1
- package/dist/client/assets/{shell-layout-B1C9fUMW.js → shell-layout-D4FIGGpu.js} +1 -1
- package/dist/client/assets/{spinner-DOOIz_y9.js → spinner-BEdv3OCr.js} +1 -1
- package/dist/client/assets/{store-invite-Ba7ZRzca.js → store-invite-DwRsaBXD.js} +1 -1
- package/dist/client/assets/{switch-_3WnqN5a.js → switch-BElvgI-f.js} +1 -1
- package/dist/client/assets/{table-DpIrnboJ.js → table-CYp1yZI4.js} +1 -1
- package/dist/client/assets/{textarea-DGIzduMJ.js → textarea-agcUwZUx.js} +1 -1
- package/dist/client/assets/{tools-list-BAYACY-u.js → tools-list-9l0l9v4y.js} +1 -1
- package/dist/client/assets/{typewriter-title-BUxC2Fu_.js → typewriter-title-Ai1M4PRw.js} +1 -1
- package/dist/client/assets/{use-binding-DULZGaaF.js → use-binding-DJh8-5RZ.js} +1 -1
- package/dist/client/assets/{use-connection-BKNC3gBB.js → use-connection-SGm9ccmH.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-D3Pg2rlz.js → use-create-virtual-mcp-CqBT5mhP.js} +1 -1
- package/dist/client/assets/{use-deco-chat-open-DiV8AU-5.js → use-deco-chat-open-CnW1_sXm.js} +1 -1
- package/dist/client/assets/{use-list-state-DqBnjzP2.js → use-list-state-DxNIJ24C.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-DKz5CZB0.js → use-mcp-prompts-O5u3joa7.js} +1 -1
- package/dist/client/assets/{use-mobile-YX8Ptv-0.js → use-mobile-Dwv-QQpY.js} +1 -1
- package/dist/client/assets/{use-organization-settings-Bz__LWh9.js → use-organization-settings-Bfq84pBA.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-DDcNtB11.js → use-virtual-mcp-wUAVm-qx.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-D_I_CqcM.js +1 -0
- package/dist/client/assets/{useMutation-kTl5A-lQ.js → useMutation-DuHm_HpG.js} +1 -1
- package/dist/client/assets/useQuery-nHeassts.js +1 -0
- package/dist/client/assets/{view-mode-toggle-BibpdmwA.js → view-mode-toggle-La4Te8Tf.js} +1 -1
- package/dist/client/assets/{workflow-BFrCK9lY.js → workflow-DXxXXzkW.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +193 -175
- package/dist/server/migrate.js +169 -157
- package/dist/server/server.js +168 -162
- package/package.json +1 -1
- package/dist/client/assets/connection-detail-CZ9gXvAv.js +0 -1
- package/dist/client/assets/constants-DRQ176RT.js +0 -1
- package/dist/client/assets/members-BZdwsMln.js +0 -3
- package/dist/client/assets/useInfiniteQuery-CNM2deBK.js +0 -1
- package/dist/client/assets/useQuery-Cjcoc_Gz.js +0 -1
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as Y,c as U,j as n,v as Re,l as ht,u as pt,bA as tt,ac as Tt,p as Mt,bs as Ye,o as xt,ba as Dt,bi as It,s as q,ad as nt,ae as At,a as Vt,f as $t,F as Ot,h as Ft,k as Wt,i as Et,t as _e,K as st}from"./index-ByQ-WW1t.js";import{I as He,n as Lt,E as ve}from"./empty-state-IVJXfQvW.js";import{E as gt}from"./error-boundary-Cqs9yFyH.js";import{E as Rt,r as zt,e as bt}from"./env-vars-editor-BQGzh8xm.js";import{P as Ke,S as Xt}from"./index--WoOZV8D.js";import{b as Ut,a as Bt}from"./use-binding-DULZGaaF.js";import{u as qt,S as Yt}from"./index-CrhNqpPK.js";import{c as Qe,d as jt,j as Ht}from"./use-connection-BKNC3gBB.js";import{u as Kt}from"./constants-BfWMVBcn.js";import{b as Qt,d as Jt}from"./use-mcp-prompts-DKz5CZB0.js";import{a as Gt}from"./mcp-oauth-Cb_Gab-K.js";import{b as ot,e as Zt,c as en,d as tn,B as nn,a as sn}from"./breadcrumb-Caj5YR93.js";import{B as Be}from"./button-BgBCyPX0.js";import{C as on}from"./collection-tabs-Dh1QsIBU.js";import{i as Le}from"./Loading01-CatM6JDa.js";import{V as Je,a as rn}from"./layout-cMYqFuJn.js";import{C as an}from"./collection-tab-BiZnyYe2.js";import{B as qe}from"./badge-Cw5-hSpe.js";import{D as cn,a as ln,b as dn,c as rt}from"./dropdown-menu-BdLRctPP.js";import{F as J,a as un,b as G,d as K,f as Z,c as ne,e as mn}from"./form-gT1yr3Qo.js";import{I as ee}from"./input-CZnIHLcz.js";import{S as at,a as it,b as ct,c as lt,d as Q}from"./select-CTRzFFUx.js";import{i as yt}from"./CheckCircle-BZgpD8UD.js";import{t as fn}from"./ChevronDown-DQimov-w.js";import{s as Fe}from"./Globe02-CZ780J53.js";import{i as hn}from"./Terminal-C0IzqPpG.js";import{s as pn}from"./Trash01-Du6SwTAz.js";import{t as Ge}from"./Users03-CsLBIBVK.js";import{s as xn}from"./XClose-U1yU7qCl.js";import{U as gn}from"./use-list-state-DqBnjzP2.js";import{b as bn,a as jn}from"./use-virtual-mcp-DDcNtB11.js";import{i as yn}from"./ChevronRight-C1wmaJaY.js";import{s as vn}from"./Plus-LdanziaX.js";import{t as Ne,c as vt,d as Nn,m as dt,a as We}from"./differenceInSeconds-NQ4PDo0z.js";import{a as Nt,C as wt}from"./collection-table-wrapper-Cd3HlK0O.js";import{C as St}from"./collection-search-DuFKyqlJ.js";import{C as _t}from"./card-DElUPHrE.js";import{R as wn,T as Sn}from"./tools-list-BAYACY-u.js";import"./Pin01-D3LZgLE8.js";import"./use-organization-settings-Bz__LWh9.js";import"./useMutation-kTl5A-lQ.js";import"./binder-ClDDqAqe.js";import"./File06-CJnXWkSw.js";import"./index-CzUXuhMT.js";import"./constants-DRQ176RT.js";import"./registry-utils-BhwI9Zxs.js";import"./extract-connection-data-BttJNYGh.js";import"./github-icon-Dp3wHhYE.js";import"./generate-id-Dyweu44Y.js";import"./index-VemZ02DZ.js";import"./circle-alert-C2UMYCQm.js";import"./index-Cfcn3j8H.js";import"./X-D7ML9mux.js";import"./collapsible-Rf1qFjgA.js";import"./Code01-C-_CZ4Yt.js";import"./infiniteQueryObserver-BYaSWja-.js";import"./localstorage-keys-CmNyjwKR.js";import"./useQuery-Cjcoc_Gz.js";import"./popover-5IvuXkII.js";import"./Grid01-CDiu9G8k.js";import"./Image01-eW3uiaQL.js";import"./SearchMd-CDLQipSw.js";import"./spinner-DOOIz_y9.js";import"./dialog-Bnus_vJ4.js";import"./AlertCircle-BLu8Aodi.js";import"./ArrowUp-TSXJSHlb.js";import"./Edit01-Cax2qmzX.js";import"./Check-TVVdApmr.js";import"./Copy01-CsYLZnEs.js";import"./monaco-editor-BKGJwQX8.js";import"./use-create-virtual-mcp-D3Pg2rlz.js";import"./index-DtEKIwl5.js";import"./DotsVertical-BmpdBChT.js";import"./empty-state-BHEu_dw7.js";import"./Inbox01-CVff9P-h.js";import"./alert-dialog-DZBrJq-m.js";import"./use-mobile-YX8Ptv-0.js";import"./List-Blxn6IBl.js";import"./view-mode-toggle-BibpdmwA.js";import"./table-DpIrnboJ.js";const Ct=({size:t=24,color:e="currentColor",...s})=>Y.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},Y.createElement("path",{d:"M2 10s2.005-2.732 3.634-4.362A9 9 0 1 1 12 21a9.004 9.004 0 0 1-8.648-6.5M2 10V4m0 6h6"}));Ct.displayName="RefreshCcw01";let _n={};function Cn(){return _n}function ut(t){const e=Ne(t),s=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return s.setUTCFullYear(e.getFullYear()),+t-+s}function Ze(t,...e){const s=vt.bind(null,t||e.find(o=>typeof o=="object"));return e.map(s)}function Ee(t,e){const s=+Ne(t)-+Ne(e);return s<0?-1:s>0?1:s}function Pn(t){return vt(t,Date.now())}function kn(t,e,s){const[o,r]=Ze(s?.in,t,e),c=o.getFullYear()-r.getFullYear(),i=o.getMonth()-r.getMonth();return c*12+i}function Tn(t,e){const s=Ne(t);return s.setHours(23,59,59,999),s}function Mn(t,e){const s=Ne(t),o=s.getMonth();return s.setFullYear(s.getFullYear(),o+1,0),s.setHours(23,59,59,999),s}function Dn(t,e){const s=Ne(t);return+Tn(s)==+Mn(s)}function In(t,e,s){const[o,r,c]=Ze(s?.in,t,t,e),i=Ee(r,c),l=Math.abs(kn(r,c));if(l<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-i*l);let m=Ee(r,c)===-i;Dn(o)&&l===1&&Ee(o,c)===1&&(m=!1);const d=i*(l-+m);return d===0?0:d}const An={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Vn=(t,e,s)=>{let o;const r=An[t];return typeof r=="string"?o=r:e===1?o=r.one:o=r.other.replace("{{count}}",e.toString()),s?.addSuffix?s.comparison&&s.comparison>0?"in "+o:o+" ago":o};function Ue(t){return(e={})=>{const s=e.width?String(e.width):t.defaultWidth;return t.formats[s]||t.formats[t.defaultWidth]}}const $n={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},On={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Fn={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Wn={date:Ue({formats:$n,defaultWidth:"full"}),time:Ue({formats:On,defaultWidth:"full"}),dateTime:Ue({formats:Fn,defaultWidth:"full"})},En={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Ln=(t,e,s,o)=>En[t];function Ce(t){return(e,s)=>{const o=s?.context?String(s.context):"standalone";let r;if(o==="formatting"&&t.formattingValues){const i=t.defaultFormattingWidth||t.defaultWidth,l=s?.width?String(s.width):i;r=t.formattingValues[l]||t.formattingValues[i]}else{const i=t.defaultWidth,l=s?.width?String(s.width):t.defaultWidth;r=t.values[l]||t.values[i]}const c=t.argumentCallback?t.argumentCallback(e):e;return r[c]}}const Rn={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},zn={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Xn={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Un={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Bn={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},qn={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Yn=(t,e)=>{const s=Number(t),o=s%100;if(o>20||o<10)switch(o%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},Hn={ordinalNumber:Yn,era:Ce({values:Rn,defaultWidth:"wide"}),quarter:Ce({values:zn,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Ce({values:Xn,defaultWidth:"wide"}),day:Ce({values:Un,defaultWidth:"wide"}),dayPeriod:Ce({values:Bn,defaultWidth:"wide",formattingValues:qn,defaultFormattingWidth:"wide"})};function Pe(t){return(e,s={})=>{const o=s.width,r=o&&t.matchPatterns[o]||t.matchPatterns[t.defaultMatchWidth],c=e.match(r);if(!c)return null;const i=c[0],l=o&&t.parsePatterns[o]||t.parsePatterns[t.defaultParseWidth],m=Array.isArray(l)?Qn(l,p=>p.test(i)):Kn(l,p=>p.test(i));let d;d=t.valueCallback?t.valueCallback(m):m,d=s.valueCallback?s.valueCallback(d):d;const x=e.slice(i.length);return{value:d,rest:x}}}function Kn(t,e){for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&e(t[s]))return s}function Qn(t,e){for(let s=0;s<t.length;s++)if(e(t[s]))return s}function Jn(t){return(e,s={})=>{const o=e.match(t.matchPattern);if(!o)return null;const r=o[0],c=e.match(t.parsePattern);if(!c)return null;let i=t.valueCallback?t.valueCallback(c[0]):c[0];i=s.valueCallback?s.valueCallback(i):i;const l=e.slice(r.length);return{value:i,rest:l}}}const Gn=/^(\d+)(th|st|nd|rd)?/i,Zn=/\d+/i,es={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},ts={any:[/^b/i,/^(a|c)/i]},ns={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},ss={any:[/1/i,/2/i,/3/i,/4/i]},os={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},rs={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},as={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},is={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},cs={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},ls={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},ds={ordinalNumber:Jn({matchPattern:Gn,parsePattern:Zn,valueCallback:t=>parseInt(t,10)}),era:Pe({matchPatterns:es,defaultMatchWidth:"wide",parsePatterns:ts,defaultParseWidth:"any"}),quarter:Pe({matchPatterns:ns,defaultMatchWidth:"wide",parsePatterns:ss,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Pe({matchPatterns:os,defaultMatchWidth:"wide",parsePatterns:rs,defaultParseWidth:"any"}),day:Pe({matchPatterns:as,defaultMatchWidth:"wide",parsePatterns:is,defaultParseWidth:"any"}),dayPeriod:Pe({matchPatterns:cs,defaultMatchWidth:"any",parsePatterns:ls,defaultParseWidth:"any"})},us={code:"en-US",formatDistance:Vn,formatLong:Wn,formatRelative:Ln,localize:Hn,match:ds,options:{weekStartsOn:0,firstWeekContainsDate:1}};function ms(t,e,s){const o=Cn(),r=s?.locale??o.locale??us,c=2520,i=Ee(t,e);if(isNaN(i))throw new RangeError("Invalid time value");const l=Object.assign({},s,{addSuffix:s?.addSuffix,comparison:i}),[m,d]=Ze(s?.in,...i>0?[e,t]:[t,e]),x=Nn(d,m),p=(ut(d)-ut(m))/1e3,a=Math.round((x-p)/60);let g;if(a<2)return s?.includeSeconds?x<5?r.formatDistance("lessThanXSeconds",5,l):x<10?r.formatDistance("lessThanXSeconds",10,l):x<20?r.formatDistance("lessThanXSeconds",20,l):x<40?r.formatDistance("halfAMinute",0,l):x<60?r.formatDistance("lessThanXMinutes",1,l):r.formatDistance("xMinutes",1,l):a===0?r.formatDistance("lessThanXMinutes",1,l):r.formatDistance("xMinutes",a,l);if(a<45)return r.formatDistance("xMinutes",a,l);if(a<90)return r.formatDistance("aboutXHours",1,l);if(a<dt){const u=Math.round(a/60);return r.formatDistance("aboutXHours",u,l)}else{if(a<c)return r.formatDistance("xDays",1,l);if(a<We){const u=Math.round(a/dt);return r.formatDistance("xDays",u,l)}else if(a<We*2)return g=Math.round(a/We),r.formatDistance("aboutXMonths",g,l)}if(g=In(d,m),g<12){const u=Math.round(a/We);return r.formatDistance("xMonths",u,l)}else{const u=g%12,h=Math.trunc(g/12);return u<3?r.formatDistance("aboutXYears",h,l):u<9?r.formatDistance("overXYears",h,l):r.formatDistance("almostXYears",h+1,l)}}function fs(t,e){return ms(t,Pn(t),e)}function hs(t){const e=U.c(13),{virtualMcp:s,org:o}=t;let r;e[0]!==o||e[1]!==s.id?(r={org:o,agentId:s.id},e[0]=o,e[1]=s.id,e[2]=r):r=e[2];let c;e[3]!==s.icon||e[4]!==s.title?(c=s.icon?n.jsx("img",{src:s.icon,alt:s.title,className:"w-5 h-5 rounded-md object-cover shrink-0"}):n.jsx("div",{className:"w-8 h-8 rounded-md bg-primary/10 flex items-center justify-center shrink-0",children:n.jsx(Ge,{size:16,className:"text-primary"})}),e[3]=s.icon,e[4]=s.title,e[5]=c):c=e[5];let i;e[6]!==s.title?(i=n.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:s.title}),e[6]=s.title,e[7]=i):i=e[7];let l;e[8]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(yn,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[8]=l):l=e[8];let m;return e[9]!==r||e[10]!==c||e[11]!==i?(m=n.jsxs(ht,{to:"/$org/agents/$agentId",params:r,className:"flex items-center gap-3 p-2 pr-1 rounded-lg hover:bg-muted/50 transition-colors group",children:[c,i,l]}),e[9]=r,e[10]=c,e[11]=i,e[12]=m):m=e[12],m}function mt(t){const e=U.c(20),{connectionId:s,connectionTitle:o,connectionDescription:r,connectionIcon:c,org:i,hasExistingVirtualMcps:l}=t,m=Re(),d=jn();let x;e[0]!==d.create||e[1]!==r||e[2]!==c||e[3]!==s||e[4]!==o||e[5]!==m||e[6]!==i?(x=async()=>{const u=await d.create.mutateAsync({title:`${o} Agent`,description:r??null,icon:c??null,status:"active",connections:[{connection_id:s,selected_tools:null,selected_resources:null,selected_prompts:null}]});m({to:"/$org/agents/$agentId",params:{org:i,agentId:u.id}})},e[0]=d.create,e[1]=r,e[2]=c,e[3]=s,e[4]=o,e[5]=m,e[6]=i,e[7]=x):x=e[7];const p=x;if(l){let u;e[8]!==d.create.isPending?(u=d.create.isPending?n.jsx(Le,{size:16,className:"animate-spin"}):n.jsx(vn,{size:16}),e[8]=d.create.isPending,e[9]=u):u=e[9];let h;return e[10]!==d.create.isPending||e[11]!==p||e[12]!==u?(h=n.jsx(Be,{variant:"ghost",className:"size-6 p-0",onClick:p,disabled:d.create.isPending,children:u}),e[10]=d.create.isPending,e[11]=p,e[12]=u,e[13]=h):h=e[13],h}let a;e[14]!==d.create.isPending?(a=d.create.isPending?n.jsx(Le,{className:"animate-spin text-muted-foreground"}):n.jsx(Ge,{className:"size-3 text-muted-foreground"}),e[14]=d.create.isPending,e[15]=a):a=e[15];let g;return e[16]!==d.create.isPending||e[17]!==p||e[18]!==a?(g=n.jsxs(Be,{variant:"outline",size:"sm",onClick:p,disabled:d.create.isPending,children:[a,"Create an agent"]}),e[16]=d.create.isPending,e[17]=p,e[18]=a,e[19]=g):g=e[19],g}function ps(t){const e=U.c(26),{connectionId:s,connectionTitle:o,connectionDescription:r,connectionIcon:c,org:i}=t;let l;e[0]!==s?(l={filters:[{column:"connection_id",value:s}]},e[0]=s,e[1]=l):l=e[1];const m=bn(l);if(!(m.length>0)){let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("h4",{className:"text-xs text-muted-foreground font-medium",children:"Use in your IDE"}),e[2]=h):h=e[2];let b;return e[3]!==r||e[4]!==c||e[5]!==s||e[6]!==o||e[7]!==i?(b=n.jsxs("div",{className:"p-5 flex items-center justify-between gap-3",children:[h,n.jsx(mt,{connectionId:s,connectionTitle:o,connectionDescription:r,connectionIcon:c,org:i,hasExistingVirtualMcps:!1})]}),e[3]=r,e[4]=c,e[5]=s,e[6]=o,e[7]=i,e[8]=b):b=e[8],b}let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx("h4",{className:"text-xs text-muted-foreground font-medium",children:"Agents"}),e[9]=x):x=e[9];let p;e[10]!==r||e[11]!==c||e[12]!==s||e[13]!==o||e[14]!==i?(p=n.jsx("div",{className:"flex flex-col gap-1",children:n.jsxs("div",{className:"flex items-center justify-between",children:[x,n.jsx(mt,{connectionId:s,connectionTitle:o,connectionDescription:r,connectionIcon:c,org:i,hasExistingVirtualMcps:!0})]})}),e[10]=r,e[11]=c,e[12]=s,e[13]=o,e[14]=i,e[15]=p):p=e[15];let a;if(e[16]!==i||e[17]!==m){let h;e[19]!==i?(h=b=>n.jsx(hs,{virtualMcp:b,org:i},b.id),e[19]=i,e[20]=h):h=e[20],a=m.map(h),e[16]=i,e[17]=m,e[18]=a}else a=e[18];let g;e[21]!==a?(g=n.jsx("div",{className:"flex flex-col gap-2",children:a}),e[21]=a,e[22]=g):g=e[22];let u;return e[23]!==p||e[24]!==g?(u=n.jsxs("div",{className:"p-5 flex flex-col gap-3",children:[p,g]}),e[23]=p,e[24]=g,e[25]=u):u=e[25],u}function xs({form:t,connection:e,hasOAuthToken:s,onReauthenticate:o,onRemoveOAuth:r}){const c=tt({control:t.control,name:"ui_type"}),i=tt({control:t.control,name:"connection_url"}),{stdioEnabled:l}=Tt(),m=(()=>{if(typeof i!="string"||!i)return!1;try{const a=new URL(i);return a.hostname==="api.githubcopilot.com"&&a.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),d=l||e.connection_type==="STDIO",x=e.connection_type==="VIRTUAL",p=x?Mt(e.connection_url):null;return x?n.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Type"}),n.jsxs("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:[n.jsx(Ge,{className:"w-4 h-4 text-muted-foreground"}),n.jsx("span",{className:"text-sm",children:"Virtual MCP"})]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"This connection references a Virtual MCP. Tools and resources are aggregated dynamically from the Virtual MCP's underlying connections."})]}),p&&n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Virtual MCP ID"}),n.jsx("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:n.jsx("code",{className:"text-sm text-muted-foreground",children:p})})]})]}):n.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[n.jsx(J,{control:t.control,name:"ui_type",render:({field:a})=>n.jsxs(G,{className:"flex flex-col gap-3",children:[n.jsx(ne,{className:"text-xs text-muted-foreground font-medium",children:"Connection"}),c!=="NPX"&&c!=="STDIO"?n.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[n.jsxs(at,{value:a.value,onValueChange:a.onChange,children:[n.jsx(K,{children:n.jsxs(it,{className:"h-10 w-auto min-w-[90px] border-0 rounded-none bg-muted/50 focus:ring-0 focus:ring-offset-0",children:[n.jsx(Fe,{className:"w-4 h-4 text-muted-foreground shrink-0"}),n.jsx(ct,{})]})}),n.jsxs(lt,{children:[n.jsx(Q,{value:"HTTP",children:"HTTP"}),n.jsx(Q,{value:"SSE",children:"SSE"}),n.jsx(Q,{value:"Websocket",children:"Websocket"}),d&&n.jsxs(n.Fragment,{children:[n.jsx(Q,{value:"NPX",children:"NPX Package"}),n.jsx(Q,{value:"STDIO",children:"Custom Command"})]})]})]}),n.jsx("div",{className:"w-px bg-border"}),n.jsx(J,{control:t.control,name:"connection_url",render:({field:g})=>n.jsx(G,{className:"flex-1 min-w-0",children:n.jsx(K,{children:n.jsx(ee,{placeholder:"https://example.com/mcp",...g,value:g.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):n.jsxs(at,{value:a.value,onValueChange:a.onChange,children:[n.jsx(K,{children:n.jsx(it,{className:"h-10",children:n.jsx(ct,{})})}),n.jsxs(lt,{children:[n.jsx(Q,{value:"HTTP",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Fe,{className:"w-4 h-4"}),"HTTP"]})}),n.jsx(Q,{value:"SSE",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Fe,{className:"w-4 h-4"}),"SSE"]})}),n.jsx(Q,{value:"Websocket",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Fe,{className:"w-4 h-4"}),"Websocket"]})}),d&&n.jsxs(n.Fragment,{children:[n.jsx(Q,{value:"NPX",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Lt,{className:"w-4 h-4"}),"NPX Package"]})}),n.jsx(Q,{value:"STDIO",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(hn,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),n.jsx(Z,{})]})}),c==="NPX"&&n.jsx(J,{control:t.control,name:"npx_package",render:({field:a})=>n.jsxs(G,{className:"flex flex-col gap-3",children:[n.jsx(ne,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),n.jsx(K,{children:n.jsx(ee,{placeholder:"@perplexity-ai/mcp-server",...a,value:a.value||"",className:"h-10 rounded-lg"})}),n.jsx(Z,{})]})}),c==="STDIO"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsx(J,{control:t.control,name:"stdio_command",render:({field:a})=>n.jsxs(G,{className:"flex flex-col gap-3",children:[n.jsx(ne,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),n.jsx(K,{children:n.jsx(ee,{placeholder:"node, bun, python...",...a,value:a.value||"",className:"h-10 rounded-lg"})}),n.jsx(Z,{})]})}),n.jsx(J,{control:t.control,name:"stdio_args",render:({field:a})=>n.jsxs(G,{className:"flex flex-col gap-3",children:[n.jsx(ne,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),n.jsx(K,{children:n.jsx(ee,{placeholder:"arg1 arg2 --flag value",...a,value:a.value||"",className:"h-10 rounded-lg"})}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),n.jsx(Z,{})]})})]}),n.jsx(J,{control:t.control,name:"stdio_cwd",render:({field:a})=>n.jsxs(G,{className:"flex flex-col gap-3",children:[n.jsx(ne,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),n.jsx(K,{children:n.jsx(ee,{placeholder:"/path/to/project (optional)",...a,value:a.value||"",className:"h-10 rounded-lg"})}),n.jsx(Z,{})]})})]}),(c==="NPX"||c==="STDIO")&&n.jsx(J,{control:t.control,name:"env_vars",render:({field:a})=>n.jsxs(G,{className:"flex flex-col gap-3",children:[n.jsx(ne,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),n.jsx(K,{children:n.jsx(Rt,{value:a.value??[],onChange:a.onChange})}),n.jsx(Z,{})]})}),c!=="NPX"&&c!=="STDIO"&&n.jsx(J,{control:t.control,name:"connection_token",render:({field:a})=>n.jsxs(G,{className:"flex flex-col gap-3",children:[n.jsx(ne,{className:"text-xs text-muted-foreground font-medium",children:m?"GitHub Personal Access Token":"Token"}),s?n.jsx("div",{className:"flex items-center gap-2",children:n.jsxs(cn,{children:[n.jsx(ln,{asChild:!0,children:n.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:n.jsxs(qe,{variant:"success",className:"gap-1.5",children:[n.jsx(yt,{size:12}),"Authenticated via OAuth",n.jsx(fn,{size:12})]})})}),n.jsxs(dn,{align:"start",children:[n.jsxs(rt,{onClick:o,children:[n.jsx(Ct,{size:16}),"Re-authenticate"]}),n.jsxs(rt,{variant:"destructive",onClick:r,children:[n.jsx(pn,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&a.value===null?n.jsxs("div",{className:"relative group",children:[n.jsx("div",{className:"h-10 px-3 flex items-center rounded-lg border border-border bg-muted/50 text-muted-foreground font-mono text-sm",children:"••••••••••••••••"}),n.jsx("button",{type:"button",onClick:()=>a.onChange(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Clear and replace token",children:n.jsx(xn,{size:14,className:"text-muted-foreground"})})]}):n.jsxs(n.Fragment,{children:[n.jsx(K,{children:n.jsx(ee,{type:"password",placeholder:m?"Paste your GitHub PAT":"Enter access token...",...a,value:a.value||"",className:"h-10 rounded-lg"})}),m&&n.jsxs(mn,{children:["Create a PAT at"," ",n.jsx("a",{href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"github.com/settings/personal-access-tokens"})]})]}),n.jsx(Z,{})]})})]})}function gs(t){const e=U.c(43),{form:s,connection:o,isMCPAuthenticated:r,hasOAuthToken:c,onReauthenticate:i,onRemoveOAuth:l}=t,{org:m}=pt();let d;e[0]!==o.icon||e[1]!==o.title?(d=n.jsx(He,{icon:o.icon,name:o.title,size:"lg",className:"shadow-sm"}),e[0]=o.icon,e[1]=o.title,e[2]=d):d=e[2];let x;e[3]!==s.control?(x=n.jsxs("div",{className:"flex flex-col",children:[n.jsx(J,{control:s.control,name:"title",render:js}),n.jsx(J,{control:s.control,name:"description",render:bs})]}),e[3]=s.control,e[4]=x):x=e[4];let p;e[5]!==d||e[6]!==x?(p=n.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[d,x]}),e[5]=d,e[6]=x,e[7]=p):p=e[7];let a;e[8]!==o||e[9]!==s||e[10]!==c||e[11]!==i||e[12]!==l?(a=n.jsx(xs,{form:s,connection:o,hasOAuthToken:c,onReauthenticate:i,onRemoveOAuth:l}),e[8]=o,e[9]=s,e[10]=c,e[11]=i,e[12]=l,e[13]=a):a=e[13];let g;e[14]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Status"}),e[14]=g):g=e[14];let u;e[15]!==r?(u=n.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[g,r?n.jsxs(qe,{variant:"success",className:"gap-1.5 bg-success-foreground text-success",children:[n.jsx(yt,{size:12}),"Connected"]}):n.jsx(qe,{variant:"outline",className:"text-muted-foreground",children:"Not connected"})]}),e[15]=r,e[16]=u):u=e[16];let h;e[17]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Created by"}),e[17]=h):h=e[17];let b;e[18]!==o.created_by?(b=n.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[h,n.jsx(gn,{id:o.created_by,size:"2xs"})]}),e[18]=o.created_by,e[19]=b):b=e[19];let C;e[20]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Updated"}),e[20]=C):C=e[20];let v;e[21]!==o.updated_at?(v=o.updated_at?fs(new Date(o.updated_at),{addSuffix:!0}):"Unknown",e[21]=o.updated_at,e[22]=v):v=e[22];let j;e[23]!==v?(j=n.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[C,n.jsx("span",{className:"text-sm text-foreground",children:v})]}),e[23]=v,e[24]=j):j=e[24];let w;e[25]!==j||e[26]!==u||e[27]!==b?(w=n.jsxs("div",{className:"flex flex-col gap-2 p-5 border-b border-border",children:[u,b,j]}),e[25]=j,e[26]=u,e[27]=b,e[28]=w):w=e[28];let f;e[29]!==o.description||e[30]!==o.icon||e[31]!==o.id||e[32]!==o.title||e[33]!==m.slug?(f=n.jsx(ps,{connectionId:o.id,connectionTitle:o.title,connectionDescription:o.description,connectionIcon:o.icon,org:m.slug}),e[29]=o.description,e[30]=o.icon,e[31]=o.id,e[32]=o.title,e[33]=m.slug,e[34]=f):f=e[34];let P;e[35]!==w||e[36]!==f||e[37]!==p||e[38]!==a?(P=n.jsxs("div",{className:"flex flex-col h-full overflow-auto",children:[p,a,w,f]}),e[35]=w,e[36]=f,e[37]=p,e[38]=a,e[39]=P):P=e[39];let $;return e[40]!==s||e[41]!==P?($=n.jsx(un,{...s,children:P}),e[40]=s,e[41]=P,e[42]=$):$=e[42],$}function bs(t){const{field:e}=t;return n.jsxs(G,{className:"w-full space-y-0",children:[n.jsx(K,{children:n.jsx(ee,{...e,value:e.value||"",className:"h-auto py-0.5 text-base text-muted-foreground leading-6 px-2 -mx-2 border-transparent hover:bg-input/25 focus:border-input bg-transparent transition-all",placeholder:"Add a description..."})}),n.jsx(Z,{})]})}function js(t){const{field:e}=t;return n.jsxs(G,{className:"flex-1 space-y-0",children:[n.jsx(K,{children:n.jsx(ee,{...e,className:"h-auto py-0.5 text-lg! font-medium leading-7 px-2 -mx-2 border-transparent hover:bg-input/25 focus:border-input bg-transparent transition-all",placeholder:"Connection Name"})}),n.jsx(Z,{})]})}function ys(t){const e=U.c(42),{prompts:s,connectionId:o,org:r,connectionTitle:c,connectionIcon:i,onPromptClick:l,showToolbar:m,emptyMessage:d}=t,x=m===void 0?!0:m,p=d===void 0?"This connection doesn't have any prompts yet.":d,a=Re(),u=Ye().location.href,[h,b]=Y.useState(""),[C,v]=Y.useState("table"),[j,w]=Y.useState("name"),[f,P]=Y.useState("asc");let $;e[0]!==f||e[1]!==j?($=S=>{j===S?(P(_s),f==="desc"&&w(void 0)):(w(S),P("asc"))},e[0]=f,e[1]=j,e[2]=$):$=e[2];const T=$;let V;e[3]!==o||e[4]!==a||e[5]!==l||e[6]!==r?(V=S=>{l?l(S):o&&r&&a({to:"/$org/mcps/$connectionId/$collectionName/$itemId",params:{org:r,connectionId:o,collectionName:"prompts",itemId:encodeURIComponent(S.name)}})},e[3]=o,e[4]=a,e[5]=l,e[6]=r,e[7]=V):V=e[7];const k=V;let O;if(e[8]!==s||e[9]!==h||e[10]!==f||e[11]!==j){const S=!s||s.length===0?[]:h.trim()?(()=>{const H=h.toLowerCase();return s.filter(B=>B.name.toLowerCase().includes(H)||B.description&&B.description.toLowerCase().includes(H))})():s;O=!j||!f?S:[...S].sort((H,B)=>{const se=H[j]||"",we=B[j]||"",te=String(se).localeCompare(String(we));return f==="asc"?te:-te}),e[8]=s,e[9]=h,e[10]=f,e[11]=j,e[12]=O}else O=e[12];const M=O;let X;e[13]===Symbol.for("react.memo_cache_sentinel")?(X=[{id:"name",header:"Name",render:Ss,sortable:!0},{id:"description",header:"Description",render:ws,cellClassName:"flex-1",sortable:!0}],e[13]=X):X=e[13];const N=X;let R;e[14]===Symbol.for("react.memo_cache_sentinel")?(R=N.filter(Ns).map(vs),e[14]=R):R=e[14];const E=R;let I;e[15]!==i||e[16]!==c||e[17]!==T||e[18]!==x||e[19]!==f||e[20]!==j||e[21]!==u||e[22]!==C?(I=x&&n.jsxs(Je,{children:[n.jsx(wt,{viewMode:C,onViewModeChange:v,sortKey:j,sortDirection:f,onSort:T,sortOptions:E}),n.jsx(Ke,{title:c?`${c}: Prompts`:"Prompts",url:u,icon:i??"description"})]}),e[15]=i,e[16]=c,e[17]=T,e[18]=x,e[19]=f,e[20]=j,e[21]=u,e[22]=C,e[23]=I):I=e[23];let A;e[24]===Symbol.for("react.memo_cache_sentinel")?(A=S=>{S.key==="Escape"&&(b(""),S.target.blur())},e[24]=A):A=e[24];let D;e[25]!==h?(D=n.jsx(St,{value:h,onChange:b,placeholder:"Search prompts...",onKeyDown:A}),e[25]=h,e[26]=D):D=e[26];let y;e[27]!==p||e[28]!==k||e[29]!==T||e[30]!==h||e[31]!==f||e[32]!==j||e[33]!==M||e[34]!==C?(y=C==="cards"?n.jsx("div",{className:"flex-1 overflow-auto p-5",children:M.length===0?n.jsx(ve,{image:null,title:h?"No prompts found":"No prompts available",description:h?"Try adjusting your search terms":p}):n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:M.map(S=>n.jsx(_t,{className:"cursor-pointer transition-colors",onClick:()=>k(S),children:n.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[n.jsx(He,{icon:null,name:S.name,size:"md",className:"shrink-0 shadow-sm"}),n.jsxs("div",{className:"flex flex-col gap-0",children:[n.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:S.name}),n.jsx("p",{className:"text-base text-muted-foreground line-clamp-2",children:S.description||"No description"})]})]})},S.name))})}):n.jsx(Nt,{columns:N,data:M,isLoading:!1,sortKey:j,sortDirection:f,onSort:T,onRowClick:S=>k(S),emptyState:n.jsx(ve,{image:null,title:h?"No prompts found":"No prompts available",description:h?"Try adjusting your search terms":p})}),e[27]=p,e[28]=k,e[29]=T,e[30]=h,e[31]=f,e[32]=j,e[33]=M,e[34]=C,e[35]=y):y=e[35];let F;e[36]!==D||e[37]!==y?(F=n.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[D,y]}),e[36]=D,e[37]=y,e[38]=F):F=e[38];let z;return e[39]!==F||e[40]!==I?(z=n.jsxs(n.Fragment,{children:[I,F]}),e[39]=F,e[40]=I,e[41]=z):z=e[41],z}function vs(t){return{id:t.id,label:typeof t.header=="string"?t.header:t.id}}function Ns(t){return t.sortable}function ws(t){return n.jsx("span",{className:"text-sm text-foreground",children:t.description||"—"})}function Ss(t){return n.jsx("span",{className:"text-sm font-medium font-mono text-foreground",children:t.name})}function _s(t){return t==="asc"?"desc":t==="desc"?null:"asc"}function Cs(t){const e=U.c(6),{prompts:s,connectionId:o,org:r}=t,c=Qe(o),i=c?.title,l=c?.icon;let m;return e[0]!==o||e[1]!==r||e[2]!==s||e[3]!==i||e[4]!==l?(m=n.jsx(ys,{prompts:s,connectionId:o,org:r,connectionTitle:i,connectionIcon:l}),e[0]=o,e[1]=r,e[2]=s,e[3]=i,e[4]=l,e[5]=m):m=e[5],m}function Ps(t){const e=U.c(2),{repository:s}=t;let o;return e[0]!==s?(o=n.jsx("div",{className:"flex-1 overflow-y-auto bg-background",children:n.jsx(wn,{repository:s})}),e[0]=s,e[1]=o):o=e[1],o}function ks(t){const e=U.c(39),{resources:s,connectionTitle:o,connectionIcon:r,onResourceClick:c,showToolbar:i,emptyMessage:l}=t,m=i===void 0?!0:i,d=l===void 0?"This connection doesn't have any resources yet.":l,p=Ye().location.href,[a,g]=Y.useState(""),[u,h]=Y.useState("table"),[b,C]=Y.useState("name"),[v,j]=Y.useState("asc");let w;e[0]!==v||e[1]!==b?(w=y=>{b===y?(j($s),v==="desc"&&C(void 0)):(C(y),j("asc"))},e[0]=v,e[1]=b,e[2]=w):w=e[2];const f=w;let P;e[3]!==c?(P=y=>{c&&c(y)},e[3]=c,e[4]=P):P=e[4];const $=P;let T;if(e[5]!==s||e[6]!==a||e[7]!==v||e[8]!==b){const y=!s||s.length===0?[]:a.trim()?(()=>{const F=a.toLowerCase();return s.filter(z=>z.uri.toLowerCase().includes(F)||z.name&&z.name.toLowerCase().includes(F)||z.description&&z.description.toLowerCase().includes(F))})():s;T=!b||!v?y:[...y].sort((F,z)=>{const S=F[b]||"",H=z[b]||"",B=String(S).localeCompare(String(H));return v==="asc"?B:-B}),e[5]=s,e[6]=a,e[7]=v,e[8]=b,e[9]=T}else T=e[9];const V=T;let k;e[10]===Symbol.for("react.memo_cache_sentinel")?(k=[{id:"name",header:"Name",render:Vs,sortable:!0},{id:"uri",header:"URI",render:As,sortable:!0},{id:"description",header:"Description",render:Is,cellClassName:"flex-1",sortable:!0},{id:"mimeType",header:"Type",render:Ds,sortable:!0}],e[10]=k):k=e[10];const O=k;let M;e[11]===Symbol.for("react.memo_cache_sentinel")?(M=O.filter(Ms).map(Ts),e[11]=M):M=e[11];const X=M;let N;e[12]!==r||e[13]!==o||e[14]!==f||e[15]!==m||e[16]!==v||e[17]!==b||e[18]!==p||e[19]!==u?(N=m&&n.jsxs(Je,{children:[n.jsx(wt,{viewMode:u,onViewModeChange:h,sortKey:b,sortDirection:v,onSort:f,sortOptions:X}),n.jsx(Ke,{title:o?`${o}: Resources`:"Resources",url:p,icon:r??"folder"})]}),e[12]=r,e[13]=o,e[14]=f,e[15]=m,e[16]=v,e[17]=b,e[18]=p,e[19]=u,e[20]=N):N=e[20];let R;e[21]===Symbol.for("react.memo_cache_sentinel")?(R=y=>{y.key==="Escape"&&(g(""),y.target.blur())},e[21]=R):R=e[21];let E;e[22]!==a?(E=n.jsx(St,{value:a,onChange:g,placeholder:"Search resources...",onKeyDown:R}),e[22]=a,e[23]=E):E=e[23];let I;e[24]!==d||e[25]!==$||e[26]!==f||e[27]!==a||e[28]!==v||e[29]!==b||e[30]!==V||e[31]!==u?(I=u==="cards"?n.jsx("div",{className:"flex-1 overflow-auto p-5",children:V.length===0?n.jsx(ve,{image:null,title:a?"No resources found":"No resources available",description:a?"Try adjusting your search terms":d}):n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:V.map(y=>n.jsx(_t,{className:"cursor-pointer transition-colors",onClick:()=>$(y),children:n.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[n.jsx(He,{icon:null,name:y.name||y.uri,size:"md",className:"shrink-0 shadow-sm"}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:y.name||y.uri}),n.jsx("p",{className:"text-xs font-mono text-muted-foreground truncate",children:y.uri}),y.description&&n.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mt-1",children:y.description})]})]})},y.uri))})}):n.jsx(Nt,{columns:O,data:V,isLoading:!1,sortKey:b,sortDirection:v,onSort:f,onRowClick:y=>$(y),emptyState:n.jsx(ve,{image:null,title:a?"No resources found":"No resources available",description:a?"Try adjusting your search terms":d})}),e[24]=d,e[25]=$,e[26]=f,e[27]=a,e[28]=v,e[29]=b,e[30]=V,e[31]=u,e[32]=I):I=e[32];let A;e[33]!==E||e[34]!==I?(A=n.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[E,I]}),e[33]=E,e[34]=I,e[35]=A):A=e[35];let D;return e[36]!==A||e[37]!==N?(D=n.jsxs(n.Fragment,{children:[N,A]}),e[36]=A,e[37]=N,e[38]=D):D=e[38],D}function Ts(t){return{id:t.id,label:typeof t.header=="string"?t.header:t.id}}function Ms(t){return t.sortable}function Ds(t){return n.jsx("span",{className:"text-sm text-muted-foreground",children:t.mimeType||"—"})}function Is(t){return n.jsx("span",{className:"text-sm text-foreground",children:t.description||"—"})}function As(t){return n.jsx("span",{className:"text-sm font-mono text-muted-foreground",children:t.uri})}function Vs(t){return n.jsx("span",{className:"text-sm font-medium text-foreground",children:t.name||t.uri})}function $s(t){return t==="asc"?"desc":t==="desc"?null:"asc"}function Os(t){const e=U.c(6),{resources:s,connectionId:o,org:r}=t,c=Qe(o),i=c?.title,l=c?.icon;let m;return e[0]!==o||e[1]!==r||e[2]!==s||e[3]!==i||e[4]!==l?(m=n.jsx(ks,{resources:s,connectionId:o,org:r,connectionTitle:i,connectionIcon:l}),e[0]=o,e[1]=r,e[2]=s,e[3]=i,e[4]=l,e[5]=m):m=e[5],m}const Fs=xt({key:q().min(1,"Key is required"),value:q()}),Ws=xt({title:q().min(1,"Name is required"),description:q().nullable().optional(),ui_type:At(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:q().optional(),connection_token:q().nullable().optional(),npx_package:q().optional(),stdio_command:q().optional(),stdio_args:q().optional(),stdio_cwd:q().optional(),env_vars:nt(Fs).optional(),configuration_scopes:nt(q()).nullable().optional(),configuration_state:Dt(q(),It()).nullable().optional()}).refine(t=>t.ui_type==="NPX"?!!t.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(t=>t.ui_type==="STDIO"?!!t.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(t=>t.ui_type==="HTTP"||t.ui_type==="SSE"||t.ui_type==="Websocket"?!!t.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function Es(t){const e=U.c(5),{tools:s,connectionId:o,org:r,isLoading:c}=t;let i;return e[0]!==o||e[1]!==c||e[2]!==r||e[3]!==s?(i=n.jsx(Sn,{tools:s,connectionId:o,org:r,isLoading:c}),e[0]=o,e[1]=c,e[2]=r,e[3]=s,e[4]=i):i=e[4],i}function Ls(t){return t.command==="npx"}function Rs(t){return t.args?.find(e=>!e.startsWith("-"))??""}function zs(t){return{command:t.command,args:t.args?.join(" ")??"",cwd:t.cwd??""}}function Xs(t,e){const s={command:"npx",args:["-y",t]},o=bt(e);return Object.keys(o).length>0&&(s.envVars=o),s}function Us(t,e,s,o){const r={command:t};e.trim()&&(r.args=e.trim().split(/\s+/)),s?.trim()&&(r.cwd=s.trim());const c=bt(o);return Object.keys(c).length>0&&(r.envVars=c),r}function ft(t,e){const s={title:t.title,description:t.description??"",configuration_state:t.configuration_state??{},configuration_scopes:t.configuration_scopes||[]};if(t.connection_type==="STDIO"&&Et(t.connection_headers)){const o=t.connection_headers,r=zt(o.envVars);if(Ls(o)){const i=Rs(o);return{...s,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:i,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:r}}const c=zs(o);return{...s,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:c.command,stdio_args:c.args,stdio_cwd:c.cwd,env_vars:r}}return{...s,ui_type:t.connection_type,connection_url:t.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}function Bs(t){let e,s=null,o=null,r=null;return t.ui_type==="NPX"?(e="STDIO",s="",r=Xs(t.npx_package||"",t.env_vars||[])):t.ui_type==="STDIO"?(e="STDIO",s="",r=Us(t.stdio_command||"",t.stdio_args||"",t.stdio_cwd,t.env_vars||[])):(e=t.ui_type,s=t.connection_url||"",o=t.connection_token||null),{title:t.title,description:t.description||null,connection_type:e,connection_url:s,...o&&{connection_token:o},...r&&{connection_headers:r},configuration_state:t.configuration_state??null,configuration_scopes:t.configuration_scopes??null}}function qs(t){const e=U.c(117),{connection:s,connectionId:o,org:r,requestedTabId:c,collections:i,onUpdate:l,isUpdating:m,prompts:d,resources:x,tools:p,isLoadingTools:a}=t;let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={from:"/$org/mcps/$connectionId"},e[0]=g):g=e[0];const u=Re(g),h=Ot(),C=Ye().location.href,v=jt();let j;e[1]!==o?(j={connectionId:o},e[1]=o,e[2]=j):j=e[2];const w=qt(j),f=w.isAuthenticated;let P;e[3]!==s?(P={connections:[s],binding:"MCP"},e[3]=s,e[4]=P):P=e[4];const T=Bt(P).length>0,V=s?.metadata?.repository,k=!!V?.url;let O;e[5]===Symbol.for("react.memo_cache_sentinel")?(O=Ft(Ws),e[5]=O):O=e[5];let M;e[6]!==s?(M=ft(s),e[6]=s,e[7]=M):M=e[7];let X;e[8]!==M?(X={resolver:O,values:M},e[8]=M,e[9]=X):X=e[9];const N=Wt(X),R=N.formState.isDirty;let E;e[10]!==N||e[11]!==l?(E=async()=>{if(!await N.trigger())return;const L=N.getValues(),ye=Bs(L);await l(ye),N.reset(L)},e[10]=N,e[11]=l,e[12]=E):E=e[12];const I=E;let A;e[13]!==s||e[14]!==N?(A=()=>{N.reset(ft(s))},e[13]=s,e[14]=N,e[15]=A):A=e[15];const D=A;let y;e[16]!==s.id||e[17]!==v||e[18]!==h?(y=async()=>{const{token:_,tokenInfo:L,error:ye}=await Gt({connectionId:s.id});if(ye||!_){_e.error(`Authentication failed: ${ye}`);return}if(L)try{const Oe=await fetch(`/api/connections/${s.id}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:L.accessToken,refreshToken:L.refreshToken,expiresIn:L.expiresIn,scope:L.scope,clientId:L.clientId,clientSecret:L.clientSecret,tokenEndpoint:L.tokenEndpoint})});if(!Oe.ok)console.error("Failed to save OAuth token:",await Oe.text()),await v.update.mutateAsync({id:s.id,data:{connection_token:_}});else try{await v.update.mutateAsync({id:s.id,data:{}})}catch(et){console.warn("Failed to refresh connection tools after OAuth:",et)}}catch(Oe){console.error("Error saving OAuth token:",Oe),await v.update.mutateAsync({id:s.id,data:{connection_token:_}})}else await v.update.mutateAsync({id:s.id,data:{connection_token:_}});const kt=new URL(`/mcp/${s.id}`,window.location.origin);await h.invalidateQueries({queryKey:st.isMCPAuthenticated(kt.href,null)}),_e.success("Authentication successful")},e[16]=s.id,e[17]=v,e[18]=h,e[19]=y):y=e[19];const F=y;let z;e[20]!==s.id||e[21]!==h?(z=async()=>{try{const _=await fetch(`/api/connections/${s.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!_.ok){const ye=await _.text();_e.error(`Failed to remove OAuth: ${ye}`);return}const L=new URL(`/mcp/${s.id}`,window.location.origin);await h.invalidateQueries({queryKey:st.isMCPAuthenticated(L.href,null)}),_e.success("OAuth removed. You can now re-authenticate with a different account.")}catch(_){console.error("Error removing OAuth token:",_),_e.error("Failed to remove OAuth")}},e[20]=s.id,e[21]=h,e[22]=z):z=e[22];const S=z,H=p.length,B=d.length,se=x.length,we=H>0||a;let te;e[23]===Symbol.for("react.memo_cache_sentinel")?(te={id:"settings",label:"Settings"},e[23]=te):te=e[23];let oe;e[24]!==a||e[25]!==f||e[26]!==we||e[27]!==H?(oe=f&&we?[{id:"tools",label:"Tools",count:a?void 0:H}]:[],e[24]=a,e[25]=f,e[26]=we,e[27]=H,e[28]=oe):oe=e[28];let re;e[29]!==f||e[30]!==B?(re=f&&B>0?[{id:"prompts",label:"Prompts",count:B}]:[],e[29]=f,e[30]=B,e[31]=re):re=e[31];let ae;e[32]!==f||e[33]!==se?(ae=f&&se>0?[{id:"resources",label:"Resources",count:se}]:[],e[32]=f,e[33]=se,e[34]=ae):ae=e[34];let ke;if(e[35]!==i||e[36]!==k||e[37]!==f||e[38]!==oe||e[39]!==re||e[40]!==ae){let _;e[42]!==k?(_=k?[{id:"readme",label:"README"}]:[],e[42]=k,e[43]=_):_=e[43],ke=[te,...oe,...re,...ae,...f?(i||[]).map(Hs):[],..._],e[35]=i,e[36]=k,e[37]=f,e[38]=oe,e[39]=re,e[40]=ae,e[41]=ke}else ke=e[41];const Se=ke,Pt=f&&Se.some(Ys)?"tools":"settings",W=Se.some(_=>_.id===c)?c:Pt;let Te;e[44]!==u?(Te=_=>{u({search:L=>({...L,tab:_}),replace:!0})},e[44]=u,e[45]=Te):Te=e[45];const ie=Te;let ce;e[46]!==i?(ce=i||[],e[46]=i,e[47]=ce):ce=e[47];let Me;if(e[48]!==W||e[49]!==ce){let _;e[51]!==W?(_=L=>L.name===W,e[51]=W,e[52]=_):_=e[52],Me=ce.find(_),e[48]=W,e[49]=ce,e[50]=Me}else Me=e[50];const De=Me;let le;e[53]!==r?(le=n.jsx(ot,{children:n.jsx(en,{asChild:!0,children:n.jsx(ht,{to:"/$org/mcps",params:{org:r},children:"Connections"})})}),e[53]=r,e[54]=le):le=e[54];let Ie;e[55]===Symbol.for("react.memo_cache_sentinel")?(Ie=n.jsx(tn,{}),e[55]=Ie):Ie=e[55];let de;e[56]!==s.title?(de=n.jsx(ot,{children:n.jsx(Zt,{children:s.title})}),e[56]=s.title,e[57]=de):de=e[57];let Ae;e[58]!==le||e[59]!==de?(Ae=n.jsx(nn,{children:n.jsxs(sn,{children:[le,Ie,de]})}),e[58]=le,e[59]=de,e[60]=Ae):Ae=e[60];const ze=Ae;let ue;e[61]!==I||e[62]!==D||e[63]!==R||e[64]!==m?(ue=n.jsx(Xt,{onSave:I,onUndo:D,isDirty:R,isSaving:m}),e[61]=I,e[62]=D,e[63]=R,e[64]=m,e[65]=ue):ue=e[65];const Xe=s.icon??"settings";let me;e[66]!==s.title||e[67]!==Xe||e[68]!==C?(me=n.jsx(Ke,{title:s.title,url:C,icon:Xe}),e[66]=s.title,e[67]=Xe,e[68]=C,e[69]=me):me=e[69];let fe;e[70]!==ue||e[71]!==me?(fe=n.jsxs(Je,{children:[ue,me]}),e[70]=ue,e[71]=me,e[72]=fe):fe=e[72];let he;e[73]!==w.hasOAuthToken||e[74]!==s||e[75]!==N||e[76]!==F||e[77]!==S||e[78]!==f?(he=n.jsx("div",{className:"w-100 shrink-0 border-r border-border bg-background",children:n.jsx(gs,{form:N,connection:s,isMCPAuthenticated:f,hasOAuthToken:w.hasOAuthToken,onReauthenticate:F,onRemoveOAuth:S})}),e[73]=w.hasOAuthToken,e[74]=s,e[75]=N,e[76]=F,e[77]=S,e[78]=f,e[79]=he):he=e[79];let pe;e[80]!==W||e[81]!==ie||e[82]!==Se?(pe=n.jsx("div",{className:"shrink-0 flex items-center gap-4 px-5 py-3 border-b border-border",children:n.jsx(on,{tabs:Se,activeTab:W,onTabChange:ie,className:"flex-1"})}),e[80]=W,e[81]=ie,e[82]=Se,e[83]=pe):pe=e[83];let Ve;e[84]===Symbol.for("react.memo_cache_sentinel")?(Ve=n.jsx("div",{className:"flex h-full items-center justify-center",children:n.jsx(Le,{size:32,className:"animate-spin text-muted-foreground"})}),e[84]=Ve):Ve=e[84];let xe;e[85]!==De||e[86]!==W||e[87]!==w.isServerError||e[88]!==w.supportsOAuth||e[89]!==s||e[90]!==o||e[91]!==N||e[92]!==F||e[93]!==ie||e[94]!==T||e[95]!==k||e[96]!==a||e[97]!==f||e[98]!==r||e[99]!==d||e[100]!==V||e[101]!==x||e[102]!==p?(xe=n.jsx(Y.Suspense,{fallback:Ve,children:W==="tools"?n.jsx(Es,{tools:p,connectionId:o,org:r,isLoading:a}):W==="prompts"?n.jsx(Cs,{prompts:d,connectionId:o,org:r}):W==="resources"?n.jsx(Os,{resources:x,connectionId:o,org:r}):W==="settings"?n.jsx(Yt,{connection:s,form:N,hasMcpBinding:T,isMCPAuthenticated:f,supportsOAuth:w.supportsOAuth,isServerError:w.isServerError,onAuthenticate:F,onViewReadme:k?()=>ie("readme"):void 0}):W==="readme"&&k?n.jsx(Ps,{repository:V}):De&&f?n.jsx(an,{connectionId:o,org:r,activeCollection:De},W):n.jsx(ve,{title:"Collection not found",description:"This collection may have been deleted or you may not have access."})}),e[85]=De,e[86]=W,e[87]=w.isServerError,e[88]=w.supportsOAuth,e[89]=s,e[90]=o,e[91]=N,e[92]=F,e[93]=ie,e[94]=T,e[95]=k,e[96]=a,e[97]=f,e[98]=r,e[99]=d,e[100]=V,e[101]=x,e[102]=p,e[103]=xe):xe=e[103];let ge;e[104]!==W||e[105]!==xe?(ge=n.jsx("div",{className:"flex-1 overflow-auto",children:n.jsx(gt,{children:xe},W)}),e[104]=W,e[105]=xe,e[106]=ge):ge=e[106];let be;e[107]!==pe||e[108]!==ge?(be=n.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-hidden",children:[pe,ge]}),e[107]=pe,e[108]=ge,e[109]=be):be=e[109];let je;e[110]!==he||e[111]!==be?(je=n.jsxs("div",{className:"flex h-full w-full bg-background overflow-hidden",children:[he,be]}),e[110]=he,e[111]=be,e[112]=je):je=e[112];let $e;return e[113]!==ze||e[114]!==fe||e[115]!==je?($e=n.jsxs(rn,{breadcrumb:ze,children:[fe,je]}),e[113]=ze,e[114]=fe,e[115]=je,e[116]=$e):$e=e[116],$e}function Ys(t){return t.id==="tools"}function Hs(t){return{id:t.name,label:t.displayName}}function Ks(){const t=U.c(43);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/mcps/$connectionId"},t[0]=e):e=t[0];const s=Re(e);let o;t[1]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/mcps/$connectionId"},t[1]=o):o=t[1];const{connectionId:r,org:c}=Vt(o),{org:i}=pt();let l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l={from:"/shell/$org/mcps/$connectionId"},t[2]=l):l=t[2];const d=$t(l).tab??"",x=Qe(r),p=jt(),a=Ut(x??void 0);let g;t[3]!==r||t[4]!==i.id?(g={connectionId:r,orgId:i.id},t[3]=r,t[4]=i.id,t[5]=g):g=t[5];const u=Kt(g);let h;t[6]!==u?(h={client:u},t[6]=u,t[7]=h):h=t[7];const{data:b}=Qt(h);let C;t[8]!==u?(C={client:u},t[8]=u,t[9]=C):C=t[9];const{data:v}=Jt(C),j=x?.tools&&x.tools.length>0,w=!j;let f;t[10]!==u||t[11]!==w?(f={client:u,enabled:w},t[10]=u,t[11]=w,t[12]=f):f=t[12];const{data:P,isLoading:$}=Ht(f);let T;t[13]!==b?.prompts?(T=b?.prompts??[],t[13]=b?.prompts,t[14]=T):T=t[14];let V;t[15]!==T?(V=T.map(Gs),t[15]=T,t[16]=V):V=t[16];const k=V;let O;t[17]!==v?.resources?(O=v?.resources??[],t[17]=v?.resources,t[18]=O):O=t[18];let M;t[19]!==O?(M=O.map(Js),t[19]=O,t[20]=M):M=t[20];const X=M;let N;t[21]!==x||t[22]!==j||t[23]!==P?.tools?(N=j?x.tools??[]:(P?.tools??[]).map(Qs),t[21]=x,t[22]=j,t[23]=P?.tools,t[24]=N):N=t[24];const R=N;let E;t[25]!==p.update||t[26]!==r?(E=async D=>{await p.update.mutateAsync({id:r,data:D})},t[25]=p.update,t[26]=r,t[27]=E):E=t[27];const I=E;if(!x){let D;return t[28]!==s||t[29]!==c?(D=n.jsx("div",{className:"flex h-full w-full bg-background",children:n.jsx(ve,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:n.jsx(Be,{variant:"outline",onClick:()=>s({to:"/$org/mcps",params:{org:c}}),children:"Back to connections"})})}),t[28]=s,t[29]=c,t[30]=D):D=t[30],D}let A;return t[31]!==p.update.isPending||t[32]!==a||t[33]!==x||t[34]!==r||t[35]!==I||t[36]!==$||t[37]!==c||t[38]!==k||t[39]!==d||t[40]!==X||t[41]!==R?(A=n.jsx(qs,{org:c,connection:x,connectionId:r,requestedTabId:d,collections:a,onUpdate:I,isUpdating:p.update.isPending,prompts:k,resources:X,tools:R,isLoadingTools:$}),t[31]=p.update.isPending,t[32]=a,t[33]=x,t[34]=r,t[35]=I,t[36]=$,t[37]=c,t[38]=k,t[39]=d,t[40]=X,t[41]=R,t[42]=A):A=t[42],A}function Qs(t){return{name:t.name,description:t.description,inputSchema:t.inputSchema}}function Js(t){return{uri:t.uri,name:t.name,description:t.description}}function Gs(t){return{name:t.name,description:t.description}}function Zs(){const t=U.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(gt,{children:n.jsx(Y.Suspense,{fallback:n.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:n.jsx(Le,{size:32,className:"animate-spin text-muted-foreground"})}),children:n.jsx(Ks,{})})}),t[0]=e):e=t[0],e}function kr(){const t=U.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(Zs,{}),t[0]=e):e=t[0],e}export{kr as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{H as t,I as a}from"./index-ByQ-WW1t.js";const e=t(a,{target:"draft-7"});export{e as B};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{r as D,c as le,j as s,p as Xt,u as Ce,g as ae,K as ue,o as yt,ad as ct,s as Ne,ba as Jt,bg as Wt,F as Oe,k as zt,h as es,t as ne,E as ts}from"./index-ByQ-WW1t.js";import{C as ss,a as ns}from"./collection-table-wrapper-Cd3HlK0O.js";import{C as Ke}from"./collection-search-DuFKyqlJ.js";import{P as Te}from"./index-DtEKIwl5.js";import{B as rs,a as is,b as os,e as ls}from"./breadcrumb-Caj5YR93.js";import{I as kt,c as Re,b as Le,T as Pe,a as Me,E as dt}from"./empty-state-IVJXfQvW.js";import{C as De}from"./checkbox-C3ba2fF0.js";import{c as X,B as ie}from"./button-BgBCyPX0.js";import{e as Ut}from"./use-connection-BKNC3gBB.js";import{u as Ct,C as mt,a as ut,b as St,c as as,d as cs,e as ds,f as ms}from"./command-Di7AyqP9.js";import{u as it}from"./useQuery-Cjcoc_Gz.js";import{u as ve}from"./useMutation-kTl5A-lQ.js";import{f as ze,a as ke,b as Ue,c as Be,d as Ve,e as Ge,A as $e,g as Fe,h as Ae}from"./alert-dialog-DZBrJq-m.js";import{B as Ee}from"./badge-Cw5-hSpe.js";import{D as Bt,f as Vt,a as Gt,b as us,c as fs,e as hs}from"./dialog-Bnus_vJ4.js";import{D as jt,a as vt,b as Nt,c as tt,d as gs,e as xs,f as ps,g as bs}from"./dropdown-menu-BdLRctPP.js";import{i as Cs}from"./DotsHorizontal-DoBmdgcU.js";import{i as st}from"./Loading01-CatM6JDa.js";import{i as js}from"./Lock01-CrPQKqta.js";import{s as nt}from"./Plus-LdanziaX.js";import{s as $t}from"./Trash01-Du6SwTAz.js";import{i as It}from"./X-D7ML9mux.js";import{I as vs}from"./input-CZnIHLcz.js";import{S as Xe}from"./switch-_3WnqN5a.js";import{E as Ns}from"./error-boundary-Cqs9yFyH.js";import{a as Ts,F as wt,b as At,c as Es,d as Ot,f as _t}from"./form-gT1yr3Qo.js";import{S as ht,a as gt,b as xt,c as pt,d as bt}from"./select-CTRzFFUx.js";import{T as ys}from"./textarea-DGIzduMJ.js";import{a as qe,u as Qe}from"./constants-BfWMVBcn.js";import{C as Rt}from"./card-DElUPHrE.js";import{i as Ft}from"./DotsVertical-BmpdBChT.js";import{i as Ss}from"./index-CzUXuhMT.js";import{s as Kt}from"./XClose-U1yU7qCl.js";import{a as Is,b as ws,P as As}from"./popover-5IvuXkII.js";import{t as Os}from"./ChevronDown-DQimov-w.js";import"./ArrowUp-TSXJSHlb.js";import"./Check-TVVdApmr.js";import"./Grid01-CDiu9G8k.js";import"./List-Blxn6IBl.js";import"./view-mode-toggle-BibpdmwA.js";import"./table-DpIrnboJ.js";import"./SearchMd-CDLQipSw.js";import"./ChevronRight-C1wmaJaY.js";const qt=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M19 12H5m0 0 7 7m-7-7 7-7"}));qt.displayName="ArrowLeft";const Tt=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M11.302 21.615c.221.129.332.194.488.227.122.026.298.026.42 0 .156-.034.267-.098.488-.227C14.646 20.478 20 16.908 20 12V7.217c0-.799 0-1.199-.13-1.542a2 2 0 0 0-.548-.79c-.275-.243-.65-.383-1.398-.664l-5.362-2.01c-.208-.078-.312-.117-.419-.133a1 1 0 0 0-.286 0c-.107.016-.21.055-.419.133L6.076 4.22c-.748.28-1.122.421-1.398.664a2 2 0 0 0-.547.79C4 6.018 4 6.418 4 7.217V12c0 4.908 5.354 8.478 7.302 9.615Z"}));Tt.displayName="Shield01";const Qt=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M20 17H4m0 0 4-4m-4 4 4 4M4 7h16m0 0-4-4m4 4-4 4"}));Qt.displayName="SwitchHorizontal01";const Ht=[{name:"ORGANIZATION_CREATE",description:"Create a new organization",category:"Organizations"},{name:"ORGANIZATION_LIST",description:"List organizations",category:"Organizations"},{name:"ORGANIZATION_GET",description:"View organization details",category:"Organizations"},{name:"ORGANIZATION_UPDATE",description:"Update organization",category:"Organizations"},{name:"ORGANIZATION_DELETE",description:"Delete organization",category:"Organizations",dangerous:!0},{name:"ORGANIZATION_SETTINGS_GET",description:"View organization settings",category:"Organizations"},{name:"ORGANIZATION_SETTINGS_UPDATE",description:"Update organization settings",category:"Organizations"},{name:"ORGANIZATION_MEMBER_ADD",description:"Add members",category:"Organizations"},{name:"ORGANIZATION_MEMBER_REMOVE",description:"Remove members",category:"Organizations",dangerous:!0},{name:"ORGANIZATION_MEMBER_LIST",description:"List members",category:"Organizations"},{name:"ORGANIZATION_MEMBER_UPDATE_ROLE",description:"Update member roles",category:"Organizations"},{name:"COLLECTION_CONNECTIONS_CREATE",description:"Create connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_LIST",description:"List connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_GET",description:"View connection details",category:"Connections"},{name:"COLLECTION_CONNECTIONS_UPDATE",description:"Update connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_DELETE",description:"Delete connections",category:"Connections",dangerous:!0},{name:"CONNECTION_TEST",description:"Test connections",category:"Connections"},{name:"DATABASES_RUN_SQL",description:"Run SQL queries",category:"Connections",dangerous:!0},{name:"COLLECTION_VIRTUAL_MCP_CREATE",description:"Create virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_LIST",description:"List virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_GET",description:"View virtual MCP details",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_UPDATE",description:"Update virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_DELETE",description:"Delete virtual MCPs",category:"Virtual MCPs",dangerous:!0},{name:"MONITORING_LOGS_LIST",description:"List monitoring logs",category:"Monitoring"},{name:"MONITORING_STATS",description:"View monitoring statistics",category:"Monitoring"},{name:"API_KEY_CREATE",description:"Create API key",category:"API Keys"},{name:"API_KEY_LIST",description:"List API keys",category:"API Keys"},{name:"API_KEY_UPDATE",description:"Update API key",category:"API Keys"},{name:"API_KEY_DELETE",description:"Delete API key",category:"API Keys",dangerous:!0},{name:"EVENT_PUBLISH",description:"Publish events",category:"Event Bus"},{name:"EVENT_SUBSCRIBE",description:"Subscribe to events",category:"Event Bus"},{name:"EVENT_UNSUBSCRIBE",description:"Unsubscribe from events",category:"Event Bus"},{name:"EVENT_CANCEL",description:"Cancel recurring events",category:"Event Bus"},{name:"EVENT_ACK",description:"Acknowledge event delivery",category:"Event Bus"},{name:"EVENT_SUBSCRIPTION_LIST",description:"List event subscriptions",category:"Event Bus"},{name:"EVENT_SYNC_SUBSCRIPTIONS",description:"Sync subscriptions to desired state",category:"Event Bus"},{name:"USER_GET",description:"Get a user by id",category:"Users"},{name:"CODE_EXECUTION_SEARCH_TOOLS",description:"Search available tools by name or description",category:"Code Execution"},{name:"CODE_EXECUTION_DESCRIBE_TOOLS",description:"Get detailed schemas for specific tools",category:"Code Execution"},{name:"CODE_EXECUTION_RUN_CODE",description:"Run JavaScript code in a sandbox with tool access",category:"Code Execution",dangerous:!0},{name:"COLLECTION_THREADS_CREATE",description:"Create threads",category:"Threads"},{name:"COLLECTION_THREADS_LIST",description:"List threads",category:"Threads"},{name:"COLLECTION_THREADS_GET",description:"View thread details",category:"Threads"},{name:"COLLECTION_THREADS_UPDATE",description:"Update threads",category:"Threads"},{name:"COLLECTION_THREADS_DELETE",description:"Delete threads",category:"Threads",dangerous:!0},{name:"COLLECTION_THREAD_MESSAGES_LIST",description:"List thread messages",category:"Threads"},{name:"TAGS_LIST",description:"List organization tags",category:"Tags"},{name:"TAGS_CREATE",description:"Create organization tag",category:"Tags"},{name:"TAGS_DELETE",description:"Delete organization tag",category:"Tags",dangerous:!0},{name:"MEMBER_TAGS_GET",description:"Get member tags",category:"Tags"},{name:"MEMBER_TAGS_SET",description:"Set member tags",category:"Tags"}],_s={ORGANIZATION_CREATE:"Create organization",ORGANIZATION_LIST:"List organizations",ORGANIZATION_GET:"View organization details",ORGANIZATION_UPDATE:"Update organization",ORGANIZATION_DELETE:"Delete organization",ORGANIZATION_SETTINGS_GET:"View organization settings",ORGANIZATION_SETTINGS_UPDATE:"Update organization settings",ORGANIZATION_MEMBER_LIST:"List members",ORGANIZATION_MEMBER_ADD:"Add members",ORGANIZATION_MEMBER_REMOVE:"Remove members",ORGANIZATION_MEMBER_UPDATE_ROLE:"Update member roles",COLLECTION_CONNECTIONS_LIST:"List connections",COLLECTION_CONNECTIONS_GET:"View connection details",COLLECTION_CONNECTIONS_CREATE:"Create connections",COLLECTION_CONNECTIONS_UPDATE:"Update connections",COLLECTION_CONNECTIONS_DELETE:"Delete connections",CONNECTION_TEST:"Test connections",DATABASES_RUN_SQL:"Run SQL queries",COLLECTION_VIRTUAL_MCP_CREATE:"Create virtual MCPs",COLLECTION_VIRTUAL_MCP_LIST:"List virtual MCPs",COLLECTION_VIRTUAL_MCP_GET:"View virtual MCP details",COLLECTION_VIRTUAL_MCP_UPDATE:"Update virtual MCPs",COLLECTION_VIRTUAL_MCP_DELETE:"Delete virtual MCPs",MONITORING_LOGS_LIST:"List monitoring logs",MONITORING_STATS:"View monitoring statistics",API_KEY_CREATE:"Create API key",API_KEY_LIST:"List API keys",API_KEY_UPDATE:"Update API key",API_KEY_DELETE:"Delete API key",EVENT_PUBLISH:"Publish events",EVENT_SUBSCRIBE:"Subscribe to events",EVENT_UNSUBSCRIBE:"Unsubscribe from events",EVENT_CANCEL:"Cancel recurring events",EVENT_ACK:"Acknowledge event delivery",EVENT_SUBSCRIPTION_LIST:"List event subscriptions",EVENT_SYNC_SUBSCRIPTIONS:"Sync subscriptions to desired state",USER_GET:"Get user by id",CODE_EXECUTION_SEARCH_TOOLS:"Search tools",CODE_EXECUTION_DESCRIBE_TOOLS:"Describe tools",CODE_EXECUTION_RUN_CODE:"Run code",COLLECTION_THREADS_CREATE:"Create threads",COLLECTION_THREADS_LIST:"List threads",COLLECTION_THREADS_GET:"View thread details",COLLECTION_THREADS_UPDATE:"Update threads",COLLECTION_THREADS_DELETE:"Delete threads",COLLECTION_THREAD_MESSAGES_LIST:"List thread messages",TAGS_LIST:"List organization tags",TAGS_CREATE:"Create organization tag",TAGS_DELETE:"Delete organization tag",MEMBER_TAGS_GET:"Get member tags",MEMBER_TAGS_SET:"Set member tags"};function Rs(){const t={Organizations:[],Connections:[],"Virtual MCPs":[],Threads:[],Monitoring:[],Users:[],"API Keys":[],"Event Bus":[],"Code Execution":[],Tags:[]};for(const e of Ht)t[e.category]?.push(e);return t}function Ls(){return Ht.map(t=>({value:t.name,label:_s[t.name],dangerous:t.dangerous}))}const Ps=D.memo(function(e){const n=le.c(21),{connection:r,isSelected:l,hasToolsEnabled:o,activeToolsCount:c,totalToolsCount:i,onSelect:u,onToggle:x}=e,m=l?"bg-accent/50":"hover:bg-muted/50";let C;n[0]!==m?(C=X("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",m),n[0]=m,n[1]=C):C=n[1];let d;n[2]!==r.icon||n[3]!==r.title?(d=s.jsx(kt,{icon:r.icon,name:r.title,size:"xs"}),n[2]=r.icon,n[3]=r.title,n[4]=d):d=n[4];let N;n[5]!==r.title?(N=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:r.title})}),n[5]=r.title,n[6]=N):N=n[6];let g;n[7]!==u||n[8]!==d||n[9]!==N?(g=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:u,children:[d,N]}),n[7]=u,n[8]=d,n[9]=N,n[10]=g):g=n[10];let j;n[11]!==c||n[12]!==r.tools||n[13]!==o||n[14]!==x||n[15]!==i?(j=r.tools&&r.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[c,"/",i]}),s.jsx(De,{checked:o,onCheckedChange:x,onClick:zs})]}),n[11]=c,n[12]=r.tools,n[13]=o,n[14]=x,n[15]=i,n[16]=j):j=n[16];let b;return n[17]!==C||n[18]!==g||n[19]!==j?(b=s.jsxs("div",{className:C,children:[g,j]}),n[17]=C,n[18]=g,n[19]=j,n[20]=b):b=n[20],b}),Ms=D.memo(function(e){const n=le.c(18),{connectionId:r,tool:l,isSelected:o,onToggle:c}=e,i=`tool-${r}-${l.name}`,u=o?"text-foreground":"text-muted-foreground";let x;n[0]!==u?(x=X("text-sm font-medium",u),n[0]=u,n[1]=x):x=n[1];let m;n[2]!==x||n[3]!==l.name?(m=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:x,children:l.name})}),n[2]=x,n[3]=l.name,n[4]=m):m=n[4];let C;n[5]!==l.description?(C=l.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:l.description}),n[5]=l.description,n[6]=C):C=n[6];let d;n[7]!==m||n[8]!==C?(d=s.jsxs("div",{className:"flex-1 min-w-0",children:[m,C]}),n[7]=m,n[8]=C,n[9]=d):d=n[9];const N=`tool-${r}-${l.name}`;let g;n[10]!==o||n[11]!==c||n[12]!==N?(g=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(De,{id:N,checked:o,onCheckedChange:c,onClick:ks})}),n[10]=o,n[11]=c,n[12]=N,n[13]=g):g=n[13];let j;return n[14]!==i||n[15]!==d||n[16]!==g?(j=s.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:i,children:[d,g]}),n[14]=i,n[15]=d,n[16]=g,n[17]=j):j=n[17],j});function Ds({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:n}){const[r,l]=D.useState(""),o=D.useDeferredValue(r),[c,i]=D.useState("all"),[u,x]=D.useState(!1),m=D.useRef(new Set(Object.keys(t))),C=Ut({searchTerm:o.trim()||void 0}),d=n?C.filter(h=>h.connection_type!=="VIRTUAL"?!0:Xt(h.connection_url)!==n):C,N=m.current,g=[...N.values()].map(h=>d.find(S=>S.id===h)).filter(h=>h!==void 0),j=d.filter(h=>!N.has(h.id)),b=[...g,...j],I=h=>{const S=t[h];return S!==void 0&&S.length>0},v=b.filter(h=>{if(c==="all")return!0;const S=I(h.id);return c==="selected"?S:c==="unselected"?!S:!0}),[f,w]=D.useState(b[0]?.id??null),T=f?b.find(h=>h.id===f)??null:null,P=T?.tools??[],A=(h,S)=>t[h]?.includes(S)??!1,L=(h,S)=>{const E=t[h]??[],p=E.includes(S),R={...t};if(p){const k=E.filter(V=>V!==S);k.length===0?delete R[h]:R[h]=k}else R[h]=[...E,S];e(R)},_=h=>{const S=b.find(V=>V.id===h);if(!S?.tools)return;const E=t[h]??[],p=S.tools.map(V=>V.name),R=E.length>0&&p.every(V=>E.includes(V)),k={...t};R?delete k[h]:(k[h]=p,w(h)),e(k)},M=h=>{w(h),x(!0)},O=()=>{x(!1)};return s.jsxs("div",{className:"flex h-full",children:[s.jsxs("div",{className:X("w-full md:w-80 border-r border-border flex flex-col",u&&"hidden md:flex"),children:[s.jsx(Ke,{value:r,onChange:l,placeholder:"Search MCP Servers..."}),s.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[s.jsx("button",{onClick:()=>i("all"),className:X("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>i("selected"),className:X("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>i("unselected"),className:X("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:v.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:r?"No connections found":c==="selected"?"No servers selected":c==="unselected"?"No unselected servers":"No connections available"}):s.jsx("div",{className:"p-2 space-y-1",children:v.map(h=>{const S=h.tools?.length??0,E=t[h.id]?.length??0;return s.jsx(Ps,{connection:h,isSelected:f===h.id,hasToolsEnabled:I(h.id),activeToolsCount:E,totalToolsCount:S,onSelect:()=>M(h.id),onToggle:()=>_(h.id)},h.id)})})})]}),s.jsx("div",{className:X("flex-1 flex-col",u?"flex":"hidden md:flex"),children:T?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[s.jsx(ie,{variant:"ghost",size:"sm",onClick:O,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(qt,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(kt,{icon:T.icon,name:T.title,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:T.title}),T.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:T.description})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:P.length===0?s.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):s.jsx("div",{className:"space-y-2",children:P.map(h=>s.jsx(Ms,{connectionId:T.id,tool:h,isSelected:A(T.id,h.name),onToggle:()=>L(T.id,h.name)},h.name))})})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}function zs(t){return t.stopPropagation()}function ks(t){return t.stopPropagation()}const Lt=[{value:"owner",label:"Owner",isBuiltin:!0},{value:"admin",label:"Admin",isBuiltin:!0},{value:"user",label:"User",isBuiltin:!0}];function Us(t){return t.replace(/-/g," ")}function Bs(t){if(!t)return{staticPermissions:[],allowsAllStaticPermissions:!1,connectionIds:[],allowsAllConnections:!1,toolNames:[],allowsAllTools:!1};const e=[];let n=!1;const r=[];let l=!1;const o=new Set;let c=!1;for(const[i,u]of Object.entries(t)){if(i==="self"){u.includes("*")?n=!0:e.push(...u);continue}if(i==="*"){if(l=!0,u.includes("*"))c=!0;else for(const x of u)o.add(x);continue}if(r.push(i),u.includes("*"))c=!0;else for(const x of u)o.add(x)}return{staticPermissions:e,allowsAllStaticPermissions:n,connectionIds:r,allowsAllConnections:l,toolNames:Array.from(o),allowsAllTools:c}}function Et(){const{locator:t}=Ce(),{data:e,isLoading:n,error:r,refetch:l}=it({queryKey:ue.organizationRoles(t),queryFn:async()=>{try{const i=await ae.organization.listRoles();return i?.error?(console.error("[useOrganizationRoles] API error:",i.error),[]):i?.data??[]}catch(i){return console.error("[useOrganizationRoles] Fetch error:",i),[]}},staleTime:3e4}),o=Lt.map(i=>({role:i.value,label:i.label,isBuiltin:i.isBuiltin}));if(e&&Array.isArray(e))for(const i of e){const u=i.role;if(!u||Lt.some(j=>j.value===u))continue;const{staticPermissions:x,allowsAllStaticPermissions:m,connectionIds:C,allowsAllConnections:d,toolNames:N,allowsAllTools:g}=Bs(i.permission);o.push({id:i.id,role:u,label:Us(u),isBuiltin:!1,permission:i.permission??void 0,staticPermissionCount:m?-1:x.length,allowsAllStaticPermissions:m,connectionCount:d?-1:C.length,allowsAllConnections:d,toolCount:g?-1:N.length,allowsAllTools:g})}const c=o.filter(i=>!i.isBuiltin);return{roles:o,customRoles:c,builtinRoles:o.filter(i=>i.isBuiltin),isLoading:n,error:r,refetch:l}}const Vs=yt({role:yt({id:Ne().optional(),slug:Ne().optional(),label:Ne()}),allowAllStaticPermissions:Wt(),staticPermissions:ct(Ne()),toolSet:Jt(Ne(),ct(Ne())),memberIds:ct(Ne())});function Zt(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}const Gs=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],ft=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"];function $s(t){if(!t)return"bg-neutral-400";let e=0;for(let r=0;r<t.length;r++){const l=t.charCodeAt(r);e=(e<<5)-e+l,e=e&e}const n=Math.abs(e)%ft.length;return ft[n]??ft[0]}function Je(){return{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},memberIds:[]}}function Fs(t){const e=le.c(39),{allowAllStaticPermissions:n,staticPermissions:r,onAllowAllChange:l,onPermissionsChange:o,readOnly:c}=t,i=c===void 0?!1:c,[u,x]=D.useState(""),m=D.useDeferredValue(u);let C,d,N,g,j;if(e[0]!==n||e[1]!==m||e[2]!==l||e[3]!==o||e[4]!==i||e[5]!==u||e[6]!==r){const v=Rs(),f=Ls(),w=f.filter(O=>O.label.toLowerCase().includes(m.toLowerCase())),T=O=>{if(r.includes(O))o(r.filter(h=>h!==O));else{const h=[...r,O];h.length===f.length?(l(!0),o([])):o(h)}};N="flex flex-col h-full",e[12]!==u?(g=s.jsx("div",{className:"border-b border-border",children:s.jsx(Ke,{value:u,onChange:x,placeholder:"Search permissions...",className:"border-b-0"})}),e[12]=u,e[13]=g):g=e[13];const P=!i&&"hover:bg-muted/50 cursor-pointer";let A;e[14]!==P?(A=X("flex items-center justify-between px-4 py-3 rounded-lg",P),e[14]=P,e[15]=A):A=e[15];let L;e[16]!==n||e[17]!==l||e[18]!==o||e[19]!==i?(L=()=>{if(i)return;l(!n),o([])},e[16]=n,e[17]=l,e[18]=o,e[19]=i,e[20]=L):L=e[20];let _;e[21]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx("span",{className:"text-sm font-medium",children:"All organization permissions"}),e[21]=_):_=e[21];let M;e[22]!==n||e[23]!==l||e[24]!==o||e[25]!==i?(M=s.jsx("div",{onClick:Zs,children:i?s.jsx(Re,{children:s.jsxs(Le,{children:[s.jsx(Pe,{asChild:!0,children:s.jsx("div",{children:s.jsx(Xe,{checked:n,disabled:i,onCheckedChange:O=>{i||(l(O),o([]))}})})}),s.jsx(Me,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(Xe,{checked:n,disabled:i,onCheckedChange:O=>{i||(l(O),o([]))}})}),e[22]=n,e[23]=l,e[24]=o,e[25]=i,e[26]=M):M=e[26],e[27]!==M||e[28]!==A||e[29]!==L?(j=s.jsx("div",{className:"border-b border-border",children:s.jsxs("div",{className:A,onClick:L,children:[_,M]})}),e[27]=M,e[28]=A,e[29]=L,e[30]=j):j=e[30],C="flex-1 overflow-auto",d=Object.entries(v).map(O=>{const[h,S]=O,E=w.filter(p=>S.some(R=>R.name===p.value));return E.length===0?null:s.jsxs("div",{className:"mb-6 last:mb-0",children:[s.jsx("h4",{className:"text-sm font-medium p-3 pb-1.5 text-muted-foreground/75",children:h}),s.jsx("div",{className:"space-y-1",children:E.map(p=>s.jsxs("div",{className:X("flex items-center justify-between gap-3 px-4 py-3",!i&&"hover:bg-muted/50 cursor-pointer"),onClick:()=>{if(!i)if(n){l(!1);const R=f.map(Hs);o(R.filter(k=>k!==p.value))}else T(p.value)},children:[s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("span",{className:"text-sm",children:p.label})}),s.jsx("div",{onClick:Qs,children:i?s.jsx(Re,{children:s.jsxs(Le,{children:[s.jsx(Pe,{asChild:!0,children:s.jsx("div",{children:s.jsx(Xe,{checked:n||r.includes(p.value),disabled:i,onCheckedChange:()=>{if(!i)if(n){l(!1);const R=f.map(qs);o(R.filter(k=>k!==p.value))}else T(p.value)}})})}),s.jsx(Me,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(Xe,{checked:n||r.includes(p.value),disabled:i,onCheckedChange:()=>{if(!i)if(n){l(!1);const R=f.map(Ks);o(R.filter(k=>k!==p.value))}else T(p.value)}})})]},p.value))})]},h)}),e[0]=n,e[1]=m,e[2]=l,e[3]=o,e[4]=i,e[5]=u,e[6]=r,e[7]=C,e[8]=d,e[9]=N,e[10]=g,e[11]=j}else C=e[7],d=e[8],N=e[9],g=e[10],j=e[11];let b;e[31]!==C||e[32]!==d?(b=s.jsx("div",{className:C,children:d}),e[31]=C,e[32]=d,e[33]=b):b=e[33];let I;return e[34]!==N||e[35]!==g||e[36]!==j||e[37]!==b?(I=s.jsxs("div",{className:N,children:[g,j,b]}),e[34]=N,e[35]=g,e[36]=j,e[37]=b,e[38]=I):I=e[38],I}function Ks(t){return t.value}function qs(t){return t.value}function Qs(t){return t.stopPropagation()}function Hs(t){return t.value}function Zs(t){return t.stopPropagation()}function Ys(t){const e=le.c(56),{open:n,onOpenChange:r,selectedMemberIds:l,onAddMembers:o}=t,[c,i]=D.useState(""),u=D.useDeferredValue(c);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[0]=x):x=e[0];const[m,C]=D.useState(x),{data:d}=Ct();let N,g,j,b,I,v,f,w,T,P,A;if(e[1]!==d?.data?.members||e[2]!==u||e[3]!==o||e[4]!==r||e[5]!==n||e[6]!==m||e[7]!==c||e[8]!==l){const R=d?.data?.members??[];let k;e[20]!==u?(k=U=>{const a=u.toLowerCase();return U.user?.name?.toLowerCase().includes(a)||U.user?.email?.toLowerCase().includes(a)},e[20]=u,e[21]=k):k=e[21];const V=R.filter(k),q=Xs;let Q;e[22]!==l?(Q=U=>l.includes(U),e[22]=l,e[23]=Q):Q=e[23];const H=Q;let Z;e[24]!==m?(Z=U=>{m.includes(U)?C(m.filter(a=>a!==U)):C([...m,U])},e[24]=m,e[25]=Z):Z=e[25];const se=Z;let J;e[26]!==o||e[27]!==r||e[28]!==m?(J=()=>{o(m),C([]),r(!1)},e[26]=o,e[27]=r,e[28]=m,e[29]=J):J=e[29],j=J,g=ze,P=n,A=r,N=ke,w="sm:max-w-md p-0 overflow-hidden",e[30]===Symbol.for("react.memo_cache_sentinel")?(T=s.jsxs(Ue,{className:"px-6 pt-6",children:[s.jsx(Be,{children:"Add Members to Role"}),s.jsx(Ve,{children:"Select members to add to this role."})]}),e[30]=T):T=e[30],v="flex flex-col h-80",e[31]!==c?(f=s.jsx(Ke,{value:c,onChange:i,placeholder:"Search members...",className:"border-b border-t-0 border-x-0 rounded-none"}),e[31]=c,e[32]=f):f=e[32],b="flex-1 overflow-auto",I=V.length===0?s.jsx("div",{className:"flex items-center justify-center h-full px-6",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:c?"No members found":"No members available"})}):s.jsx("div",{className:"px-6 py-2 space-y-1",children:V.map(U=>{const a=q(U),y=H(U.id),F=m.includes(U.id);return s.jsxs("label",{className:X("flex items-center gap-3 p-2 rounded-lg",!a||y?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(De,{checked:F||y,onCheckedChange:()=>{a&&!y&&se(U.id)},disabled:!a||y}),s.jsx(Ae,{url:U.user?.image??void 0,fallback:Zt(U.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:U.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:U.user?.email})]}),!a&&s.jsx(Ee,{variant:"secondary",className:"shrink-0",children:"Owner"}),y&&a&&s.jsx(Ee,{variant:"outline",className:"shrink-0",children:"Added"})]},U.id)})}),e[1]=d?.data?.members,e[2]=u,e[3]=o,e[4]=r,e[5]=n,e[6]=m,e[7]=c,e[8]=l,e[9]=N,e[10]=g,e[11]=j,e[12]=b,e[13]=I,e[14]=v,e[15]=f,e[16]=w,e[17]=T,e[18]=P,e[19]=A}else N=e[9],g=e[10],j=e[11],b=e[12],I=e[13],v=e[14],f=e[15],w=e[16],T=e[17],P=e[18],A=e[19];let L;e[33]!==b||e[34]!==I?(L=s.jsx("div",{className:b,children:I}),e[33]=b,e[34]=I,e[35]=L):L=e[35];let _;e[36]!==L||e[37]!==v||e[38]!==f?(_=s.jsxs("div",{className:v,children:[f,L]}),e[36]=L,e[37]=v,e[38]=f,e[39]=_):_=e[39];let M;e[40]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsx($e,{children:"Cancel"}),e[40]=M):M=e[40];const O=m.length===0,h=m.length>0&&`(${m.length})`;let S;e[41]!==j||e[42]!==O||e[43]!==h?(S=s.jsxs(Ge,{className:"px-6 pb-6",children:[M,s.jsxs(Fe,{onClick:j,disabled:O,children:["Add ",h]})]}),e[41]=j,e[42]=O,e[43]=h,e[44]=S):S=e[44];let E;e[45]!==N||e[46]!==_||e[47]!==S||e[48]!==w||e[49]!==T?(E=s.jsxs(N,{className:w,children:[T,_,S]}),e[45]=N,e[46]=_,e[47]=S,e[48]=w,e[49]=T,e[50]=E):E=e[50];let p;return e[51]!==g||e[52]!==E||e[53]!==P||e[54]!==A?(p=s.jsx(g,{open:P,onOpenChange:A,children:E}),e[51]=g,e[52]=E,e[53]=P,e[54]=A,e[55]=p):p=e[55],p}function Xs(t){return t.role!=="owner"}function Js(t){const e=le.c(40),{memberIds:n,onMemberIdsChange:r,readOnly:l}=t,o=l===void 0?!1:l,[c,i]=D.useState(""),u=D.useDeferredValue(c),[x,m]=D.useState(!1),{data:C}=Ct();let d,N,g,j,b;if(e[0]!==C?.data?.members||e[1]!==u||e[2]!==n||e[3]!==r||e[4]!==o||e[5]!==c){const w=C?.data?.members??[];let T;e[11]!==n?(T=E=>n.includes(E.id),e[11]=n,e[12]=T):T=e[12];const P=w.filter(T);let A;e[13]!==u?(A=E=>{const p=u.toLowerCase();return E.user?.name?.toLowerCase().includes(p)||E.user?.email?.toLowerCase().includes(p)},e[13]=u,e[14]=A):A=e[14];const L=P.filter(A);let _;e[15]!==n||e[16]!==r?(_=E=>{r(n.filter(p=>p!==E))},e[15]=n,e[16]=r,e[17]=_):_=e[17];const M=_;let O;e[18]!==n||e[19]!==r?(O=E=>{r([...n,...E])},e[18]=n,e[19]=r,e[20]=O):O=e[20],d=O,j="flex flex-col h-full";let h;e[21]!==c?(h=s.jsx(Ke,{value:c,onChange:i,placeholder:"Search members...",className:"flex-1 border-b-0"}),e[21]=c,e[22]=h):h=e[22];let S;e[23]!==o?(S=o?s.jsx("div",{className:"pr-4",children:s.jsx(Re,{children:s.jsxs(Le,{children:[s.jsx(Pe,{asChild:!0,children:s.jsx("div",{children:s.jsxs(ie,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(nt,{size:16}),"Add Member"]})})}),s.jsx(Me,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})})}):s.jsx("div",{className:"pr-4",children:s.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>m(!0),children:[s.jsx(nt,{size:16}),"Add Member"]})}),e[23]=o,e[24]=S):S=e[24],e[25]!==h||e[26]!==S?(b=s.jsxs("div",{className:"flex items-center border-b border-border",children:[h,S]}),e[25]=h,e[26]=S,e[27]=b):b=e[27],N="flex-1 overflow-auto",g=P.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h3",{className:"text-lg font-medium mb-2",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to this role to grant them the configured permissions."})]})}):L.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',c,'"']})}):s.jsx("div",{className:"p-4 space-y-2",children:L.map(E=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(Ae,{url:E.user?.image??void 0,fallback:Zt(E.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:E.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:E.user?.email})]}),o?s.jsx(Re,{children:s.jsxs(Le,{children:[s.jsx(Pe,{asChild:!0,children:s.jsx("div",{children:s.jsx(ie,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(It,{size:16})})})}),s.jsx(Me,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})}):s.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>M(E.id),children:s.jsx(It,{size:16})})]},E.id))}),e[0]=C?.data?.members,e[1]=u,e[2]=n,e[3]=r,e[4]=o,e[5]=c,e[6]=d,e[7]=N,e[8]=g,e[9]=j,e[10]=b}else d=e[6],N=e[7],g=e[8],j=e[9],b=e[10];let I;e[28]!==N||e[29]!==g?(I=s.jsx("div",{className:N,children:g}),e[28]=N,e[29]=g,e[30]=I):I=e[30];let v;e[31]!==x||e[32]!==d||e[33]!==n?(v=s.jsx(Ys,{open:x,onOpenChange:m,selectedMemberIds:n,onAddMembers:d}),e[31]=x,e[32]=d,e[33]=n,e[34]=v):v=e[34];let f;return e[35]!==j||e[36]!==b||e[37]!==I||e[38]!==v?(f=s.jsxs("div",{className:j,children:[b,I,v]}),e[35]=j,e[36]=b,e[37]=I,e[38]=v,e[39]=f):f=e[39],f}function Ws(t){const e=le.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(st,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let r;return e[1]!==t?(r=s.jsx(D.Suspense,{fallback:n,children:s.jsx(Js,{...t})}),e[1]=t,e[2]=r):r=e[2],r}const en={owner:[],admin:[],user:[]};function We(t,e){const n=t==="owner"||t==="admin",r=e.filter(l=>l.role===t);return{role:{slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:n,staticPermissions:en[t],toolSet:{},memberIds:r.map(l=>l.id)}}function tn({trigger:t,onSuccess:e}){const[n,r]=D.useState(!1),[l,o]=D.useState("mcp"),{locator:c}=Ce(),i=Oe(),u=Ut()??[],{customRoles:x,refetch:m}=Et(),{data:C}=it({queryKey:ue.members(c),queryFn:()=>ae.organization.listMembers()}),d=zt({resolver:es(Vs),defaultValues:Je()}),N=d.formState.isValid,g=d.formState.isDirty,[j,b]=D.useState(null),[I,v]=D.useState(null),f=!d.watch("role.id")&&!d.watch("role.slug")&&!I,[w,T]=D.useState(null),[P,A]=D.useState(!1),[L,_]=D.useState(null),M=a=>{const y=a.permission||{},F=y.self||[],de=F.includes("*"),te=de?[]:F.filter(B=>B!=="*"),W={};for(const[B,G]of Object.entries(y))if(B!=="self")if(B==="*")for(const Y of u)G.includes("*")?W[Y.id]=Y.tools?.map(re=>re.name)??[]:W[Y.id]=G;else{const Y=u.find(re=>re.id===B);Y&&(G.includes("*")?W[B]=Y.tools?.map(re=>re.name)??[]:W[B]=G)}const ce=(C?.data?.members??[]).filter(B=>B.role===a.role).map(B=>B.id);return{role:{id:a.id,slug:a.role,label:a.label},allowAllStaticPermissions:de,staticPermissions:te,toolSet:W,memberIds:ce}},O=a=>{const y=M(a);d.reset(y),b(a.id??null),v(null)},h=()=>{d.reset(Je()),b(null),v(null),o("mcp")},S=a=>{g&&N?(_(()=>()=>O(a)),A(!0)):O(a)},E=async()=>{g&&N&&await Z(),h()},p=a=>{if(g&&N)_(()=>()=>{const y=We(a,C?.data?.members??[]);d.reset(y),v(a),b(null),o("org")}),A(!0);else{const y=We(a,C?.data?.members??[]);d.reset(y),v(a),b(null),o("org")}},R=a=>{if(!a&&d.formState.isDirty&&N){_(()=>()=>{r(!1),d.reset(Je()),v(null)}),A(!0);return}if(r(a),!a)d.reset(Je()),v(null),b(null);else{const y=x[0];if(y)O(y);else{const F=We("user",C?.data?.members??[]);d.reset(F),v("user"),b(null),o("org")}}},k=()=>{A(!1),L&&(L(),_(null))},V=a=>{const y={};a.allowAllStaticPermissions?y.self=["*"]:a.staticPermissions.length>0&&(y.self=a.staticPermissions);for(const[F,de]of Object.entries(a.toolSet))if(de.length>0){const W=u.find(ee=>ee.id===F)?.tools?.map(ee=>ee.name)??[];W.length>0&&W.every(ee=>de.includes(ee))?y[F]=["*"]:y[F]=de}return y},q=ve({mutationFn:async a=>{const y=V(a),F=a.role.slug||a.role.label.toLowerCase().replace(/\s+/g,"-");if(a.role.slug&&!a.role.id){const W=(C?.data?.members??[]).filter(B=>B.role===a.role.slug).map(B=>B.id),ee=a.memberIds.filter(B=>!W.includes(B)),ce=W.filter(B=>!a.memberIds.includes(B));for(const B of ee){const G=await ae.organization.updateMemberRole({memberId:B,role:[a.role.slug]});if(G?.error)throw new Error(G.error.message)}for(const B of ce){const G=await ae.organization.updateMemberRole({memberId:B,role:["user"]});if(G?.error)throw new Error(G.error.message)}return a}else if(a.role.id){const te=await ae.organization.updateRole({roleId:a.role.id,data:{permission:y}});if(te?.error)throw new Error(te.error.message);const ee=(C?.data?.members??[]).filter(G=>G.role===a.role.slug).map(G=>G.id),ce=a.memberIds.filter(G=>!ee.includes(G)),B=ee.filter(G=>!a.memberIds.includes(G));for(const G of ce){const Y=await ae.organization.updateMemberRole({memberId:G,role:[a.role.slug]});if(Y?.error)throw new Error(Y.error.message)}for(const G of B){const Y=await ae.organization.updateMemberRole({memberId:G,role:["user"]});if(Y?.error)throw new Error(Y.error.message)}return a}else{const te=await ae.organization.createRole({role:F,permission:y});if(te?.error)throw new Error(te.error.message);for(const W of a.memberIds){const ee=await ae.organization.updateMemberRole({memberId:W,role:[F]});if(ee?.error)throw new Error(ee.error.message)}return{...a,role:{...a.role,id:te.data?.roleData?.id,slug:F}}}},onSuccess:(a,y)=>{i.invalidateQueries({queryKey:ue.members(c)}),i.invalidateQueries({queryKey:ue.organizationRoles(c)});const F=!y.role.id&&!y.role.slug,de=y.role.slug&&!y.role.id;ne.success(de?"Members updated successfully!":F?"Role created successfully!":"Role updated successfully!"),m(),d.reset(a),a.role.id&&b(a.role.id),e?.()},onError:a=>{ne.error(a instanceof Error?a.message:"Failed to save role")}}),Q=ve({mutationFn:async a=>{const y=await ae.organization.deleteRole({roleId:a});if(y?.error)throw new Error(y.error.message);return y?.data},onSuccess:()=>{if(i.invalidateQueries({queryKey:ue.members(c)}),i.invalidateQueries({queryKey:ue.organizationRoles(c)}),ne.success("Role deleted successfully!"),m(),w?.id===j){const a=x.filter(y=>y.id!==w?.id);if(a[0])O(a[0]);else{const y=We("user",C?.data?.members??[]);d.reset(y),v("user"),b(null),o("org")}}},onError:a=>{ne.error(a instanceof Error?a.message:"Failed to delete role")}}),H=q.isPending||Q.isPending,Z=async()=>{const a=d.getValues();if(!a.role.label.trim()){ne.error("Role name is required"),d.setFocus("role.label");return}await q.mutateAsync(a)},se=d.handleSubmit(a=>{if(!a.role.label.trim()){ne.error("Role name is required"),d.setFocus("role.label");return}q.mutate(a)}),J=a=>{a.id&&T({id:a.id,label:a.label})},U=()=>{w?.id&&Q.mutate(w.id),T(null)};return s.jsxs(Bt,{open:n,onOpenChange:R,children:[s.jsx(Vt,{asChild:!0,children:t}),s.jsx(Gt,{className:"sm:max-w-5xl h-[80vh] max-h-[80vh] flex flex-col p-0 overflow-hidden w-[95vw]",children:s.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0 flex-col sm:flex-row",children:[s.jsxs("div",{className:"w-full sm:w-64 sm:border-r border-b sm:border-b-0 border-border flex flex-col bg-background sm:h-full max-h-[40vh] sm:max-h-full",children:[s.jsx("div",{className:"flex-1 overflow-auto px-3.5 py-3.5 pt-3.5",children:s.jsxs("div",{className:"flex flex-col gap-1",children:[Gs.map(a=>{const y=I===a.role;return s.jsxs("div",{className:X("flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden cursor-pointer transition-colors",y?"bg-accent":"hover:bg-muted/50"),onClick:()=>p(a.role),children:[s.jsx("div",{className:X("shrink-0 size-3 rounded-full",a.color)}),s.jsx("p",{className:"text-sm font-medium truncate flex-1",children:a.label}),s.jsx(js,{size:14,className:"text-muted-foreground shrink-0"})]},a.role)}),x.map(a=>{const y=j===a.id;return s.jsxs("div",{className:X("group flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden transition-colors cursor-pointer",y?"bg-accent":"hover:bg-muted/50"),onClick:()=>S(a),children:[s.jsx("div",{className:X("shrink-0 size-3 rounded-full",$s(a.label))}),s.jsx("p",{className:"text-sm font-medium truncate flex-1",children:a.label}),s.jsxs(jt,{children:[s.jsx(vt,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"icon",className:X("size-5 shrink-0 transition-opacity opacity-0 pointer-events-none","group-hover:opacity-100 group-hover:pointer-events-auto",y&&"opacity-100 pointer-events-auto"),onClick:F=>F.stopPropagation(),children:s.jsx(Cs,{size:14})})}),s.jsx(Nt,{align:"end",children:s.jsxs(tt,{className:"text-destructive",onClick:F=>{F.stopPropagation(),J(a)},children:[s.jsx($t,{size:16}),"Delete"]})})]})]},a.id)}),f&&s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden bg-accent",children:[s.jsx("div",{className:"shrink-0 size-3 rounded-full bg-neutral-400"}),s.jsx(vs,{...d.register("role.label"),placeholder:"Enter role name",className:"flex-1 text-sm font-medium border-0 shadow-none h-auto px-0 py-0 focus-visible:ring-0 bg-transparent",autoFocus:!0}),s.jsx(Ee,{variant:"secondary",className:"shrink-0 text-xs px-1.5 py-0",children:"New"})]})]})}),s.jsx("div",{className:"px-3.5 pb-3.5",children:s.jsxs(ie,{variant:"outline",size:"default",onClick:E,disabled:H||g,className:"w-full h-10",children:[s.jsx(nt,{size:16}),"Create new role"]})})]}),s.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[s.jsxs("div",{className:"h-12 border-b border-border px-4 py-3.5 flex items-center gap-2 shrink-0",children:[!I&&s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>o("mcp"),className:X("h-7 rounded-lg px-2 border border-input transition-colors",l==="mcp"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"MCP Permissions"}),s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>o("org"),className:X("h-7 rounded-lg px-2 border border-input transition-colors",l==="org"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"Organization Permissions"}),s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>o("members"),className:X("h-7 rounded-lg px-2 border border-input transition-colors",l==="members"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"Members"})]}),s.jsxs("div",{className:"flex-1 overflow-hidden min-h-0",children:[l==="mcp"&&!I&&s.jsx(Ds,{toolSet:d.watch("toolSet"),onToolSetChange:a=>d.setValue("toolSet",a,{shouldDirty:!0})}),l==="org"&&s.jsx(Fs,{allowAllStaticPermissions:d.watch("allowAllStaticPermissions"),staticPermissions:d.watch("staticPermissions"),onAllowAllChange:a=>d.setValue("allowAllStaticPermissions",a,{shouldDirty:!0}),onPermissionsChange:a=>d.setValue("staticPermissions",a,{shouldDirty:!0}),readOnly:!!I}),l==="members"&&s.jsx(Ws,{memberIds:d.watch("memberIds"),onMemberIdsChange:a=>d.setValue("memberIds",a,{shouldDirty:!0}),readOnly:I==="owner"})]}),(!I||I!=="owner")&&s.jsxs("div",{className:"border-t border-border px-5 py-5 flex items-center justify-end gap-2.5 shrink-0",children:[s.jsx(ie,{variant:"outline",onClick:()=>R(!1),disabled:H,className:"h-10",children:"Cancel"}),s.jsx(ie,{onClick:se,disabled:H||!N||!d.formState.isDirty,className:"h-10",children:q.isPending?"Saving...":f?"Create Role":"Save Changes"})]})]})]})}),s.jsx(ze,{open:w!==null,onOpenChange:a=>!a&&T(null),children:s.jsxs(ke,{children:[s.jsxs(Ue,{children:[s.jsx(Be,{children:"Delete Role"}),s.jsxs(Ve,{children:['Are you sure you want to delete the "',w?.label,'" role? This action cannot be undone.']})]}),s.jsxs(Ge,{children:[s.jsx($e,{children:"Cancel"}),s.jsx(Fe,{onClick:U,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),s.jsx(ze,{open:P,onOpenChange:A,children:s.jsxs(ke,{children:[s.jsxs(Ue,{children:[s.jsx(Be,{children:"Discard Changes"}),s.jsx(Ve,{children:"You have unsaved changes. Are you sure you want to discard them?"})]}),s.jsxs(Ge,{children:[s.jsx($e,{onClick:()=>_(null),children:"Keep Editing"}),s.jsx(Fe,{onClick:k,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})})]})}const sn=Ne().email("Invalid email address");function nn(t){if(!t.trim())return[];const e=t.split(/[,;\n]/).map(n=>n.trim().toLowerCase()).filter(n=>n.length>0);return Array.from(new Set(e))}function rn({trigger:t}){const[e,n]=D.useState(!1),{locator:r}=Ce(),l=Oe(),{data:o}=ae.useSession(),c=o?.user?.email,{roles:i,isLoading:u}=Et(),x=i.filter(v=>v.role!=="owner"),m=zt({mode:"onChange",defaultValues:{emailsText:"",role:"user"}}),C=m.watch("emailsText"),d=m.watch("role"),g=nn(C).filter(v=>{const f=sn.safeParse(v).success,w=!c||v!==c.toLowerCase();return f&&w}),j=ve({mutationFn:async({emails:v,role:f})=>{if(!f)throw new Error("Please select a role");const w=await Promise.allSettled(v.map(async P=>{const A=await ae.organization.inviteMember({email:P,role:f});if(A.error)throw new Error(A.error.message);return A.data})),T=w.filter(P=>P.status==="rejected");if(T.length>0)throw new Error(`Failed to invite ${T.length} member${T.length>1?"s":""}`);return w},onSuccess:(v,{emails:f})=>{l.invalidateQueries({queryKey:ue.members(r)}),l.invalidateQueries({queryKey:ue.invitations(r)}),ne.success(f.length===1?"Member invited successfully!":`${f.length} members invited successfully!`),m.reset({emailsText:"",role:"user"}),n(!1)},onError:v=>{ne.error(v instanceof Error?v.message:"Failed to invite members")}}),b=v=>{if(g.length===0){ne.error("Please enter at least one valid email address");return}if(!v.role){ne.error("Please select a role");return}j.mutate({emails:g,role:v.role})},I=g.length>0&&!!d;return s.jsxs(Bt,{open:e,onOpenChange:n,children:[s.jsx(Vt,{asChild:!0,children:t}),s.jsxs(Gt,{className:"sm:max-w-lg",children:[s.jsx(us,{children:s.jsx(fs,{children:"Invite members"})}),s.jsx(Ts,{...m,children:s.jsxs("form",{onSubmit:m.handleSubmit(b),className:"space-y-4",children:[s.jsx(wt,{control:m.control,name:"emailsText",render:({field:v})=>s.jsxs(At,{children:[s.jsx(Es,{children:"Email addresses"}),s.jsx(Ot,{children:s.jsx(ys,{...v,disabled:j.isPending,placeholder:`Enter email addresses separated by commas or new lines
|
|
2
|
-
e.g. user1@example.com, user2@example.com
|
|
3
|
-
or one per line`,className:"min-h-[120px] resize-none"})}),s.jsx(_t,{})]})}),s.jsx(wt,{control:m.control,name:"role",render:({field:v})=>s.jsxs(At,{children:[s.jsx(Ot,{children:s.jsxs(ht,{value:v.value,onValueChange:v.onChange,disabled:j.isPending||u,children:[s.jsx(gt,{className:"w-full",children:s.jsx(xt,{placeholder:"Select a role"})}),s.jsx(pt,{children:x.map(f=>{const w=[];return f.isBuiltin||(f.allowsAllStaticPermissions?w.push("Full org access"):f.staticPermissionCount&&f.staticPermissionCount>0&&w.push(`${f.staticPermissionCount} org perm${f.staticPermissionCount!==1?"s":""}`),f.allowsAllConnections?w.push("All connections"):f.connectionCount&&f.connectionCount>0&&w.push(`${f.connectionCount} connection${f.connectionCount!==1?"s":""}`),(f.connectionCount!==0||f.allowsAllConnections)&&(f.allowsAllTools?w.push("all tools"):f.toolCount&&f.toolCount>0&&w.push(`${f.toolCount} tool${f.toolCount!==1?"s":""}`))),s.jsx(bt,{value:f.role,children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{children:f.label}),!f.isBuiltin&&w.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:w.join(", ")})]})},f.role)})})]})}),s.jsx(_t,{})]})}),s.jsxs(hs,{children:[s.jsx(ie,{variant:"outline",onClick:()=>{m.reset({emailsText:"",role:"user"}),n(!1)},type:"button",disabled:j.isPending,children:"Cancel"}),s.jsx(ie,{type:"submit",disabled:j.isPending||!I,children:j.isPending?"Inviting...":`Invite ${g.length||0} Member${g.length!==1?"s":""}`})]})]})})]})]})}function on(){const t=le.c(9),{org:e,locator:n}=Ce();let r;t[0]!==e.id?(r={connectionId:qe,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const l=Qe(r);let o;t[2]!==n?(o=ue.invitations(n),t[2]=n,t[3]=o):o=t[3];let c;t[4]!==l?(c=async()=>{const u=await l.callTool({name:"ORGANIZATION_GET",arguments:{}});return(u.structuredContent??u)?.invitations??[]},t[4]=l,t[5]=c):c=t[5];let i;return t[6]!==o||t[7]!==c?(i={queryKey:o,queryFn:c},t[6]=o,t[7]=c,t[8]=i):i=t[8],ts(i)}function ln(){const t=le.c(5),{locator:e}=Ce(),n=Oe();let r;t[0]!==e||t[1]!==n?(r={mutationFn:cn,onSuccess:()=>{n.invalidateQueries({queryKey:ue.invitations(e)}),ne.success("Invitation cancelled")},onError:an},t[0]=e,t[1]=n,t[2]=r):r=t[2];const l=ve(r);let o;return t[3]!==l?(o={cancel:l},t[3]=l,t[4]=o):o=t[4],o}function an(t){ne.error(t instanceof Error?t.message:"Failed to cancel invitation")}async function cn(t){const e=await ae.organization.cancelInvitation({invitationId:t});if(e?.error)throw new Error(e.error.message);return e.data}const ot={tags:t=>[t,"tags"],memberTags:(t,e)=>[t,"member-tags",e]};function dn(){const t=le.c(9),{org:e,locator:n}=Ce();let r;t[0]!==e.id?(r={connectionId:qe,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const l=Qe(r);let o;t[2]!==n?(o=ot.tags(n),t[2]=n,t[3]=o):o=t[3];let c;t[4]!==l?(c=async()=>{const u=await l.callTool({name:"TAGS_LIST",arguments:{}});return(u.structuredContent??u).tags},t[4]=l,t[5]=c):c=t[5];let i;return t[6]!==o||t[7]!==c?(i={queryKey:o,queryFn:c,staleTime:3e4},t[6]=o,t[7]=c,t[8]=i):i=t[8],it(i)}function mn(){const t=le.c(10),e=Oe(),{org:n,locator:r}=Ce();let l;t[0]!==n.id?(l={connectionId:qe,orgId:n.id},t[0]=n.id,t[1]=l):l=t[1];const o=Qe(l);let c;t[2]!==o?(c=async x=>{const m=await o.callTool({name:"TAGS_CREATE",arguments:{name:x}});return(m.structuredContent??m).tag},t[2]=o,t[3]=c):c=t[3];let i;t[4]!==r||t[5]!==e?(i=()=>{e.invalidateQueries({queryKey:ot.tags(r)})},t[4]=r,t[5]=e,t[6]=i):i=t[6];let u;return t[7]!==c||t[8]!==i?(u={mutationFn:c,onSuccess:i,onError:un},t[7]=c,t[8]=i,t[9]=u):u=t[9],ve(u)}function un(t){ne.error(t instanceof Error?t.message:"Failed to create tag")}function fn(t){const e=le.c(12),{org:n,locator:r}=Ce();let l;e[0]!==n.id?(l={connectionId:qe,orgId:n.id},e[0]=n.id,e[1]=l):l=e[1];const o=Qe(l);let c;e[2]!==r||e[3]!==t?(c=ot.memberTags(r,t),e[2]=r,e[3]=t,e[4]=c):c=e[4];let i;e[5]!==o||e[6]!==t?(i=async()=>{const m=await o.callTool({name:"MEMBER_TAGS_GET",arguments:{memberId:t}});return(m.structuredContent??m).tags},e[5]=o,e[6]=t,e[7]=i):i=e[7];const u=!!t;let x;return e[8]!==c||e[9]!==i||e[10]!==u?(x={queryKey:c,queryFn:i,staleTime:3e4,enabled:u},e[8]=c,e[9]=i,e[10]=u,e[11]=x):x=e[11],it(x)}function hn(){const t=le.c(10),e=Oe(),{org:n,locator:r}=Ce();let l;t[0]!==n.id?(l={connectionId:qe,orgId:n.id},t[0]=n.id,t[1]=l):l=t[1];const o=Qe(l);let c;t[2]!==o?(c=async x=>{const{memberId:m,tagIds:C}=x,d=await o.callTool({name:"MEMBER_TAGS_SET",arguments:{memberId:m,tagIds:C}});return d.structuredContent??d},t[2]=o,t[3]=c):c=t[3];let i;t[4]!==r||t[5]!==e?(i=(x,m)=>{e.invalidateQueries({queryKey:ot.memberTags(r,m.memberId)})},t[4]=r,t[5]=e,t[6]=i):i=t[6];let u;return t[7]!==c||t[8]!==i?(u={mutationFn:c,onSuccess:i,onError:gn},t[7]=c,t[8]=i,t[9]=u):u=t[9],ve(u)}function gn(t){ne.error(t instanceof Error?t.message:"Failed to update member tags")}function Yt(t){const e=le.c(44),{memberId:n,className:r,disabled:l,placeholder:o,maxDisplay:c}=t,i=l===void 0?!1:l,u=o===void 0?"Add tags...":o,x=c===void 0?2:c,[m,C]=D.useState(!1),[d,N]=D.useState(""),{data:g,isLoading:j}=dn(),b=g===void 0?[]:g,{data:I,isLoading:v}=fn(n),f=I===void 0?[]:I,w=mn(),T=hn(),P=j||v,A=f.map(pn);let L;e[0]!==d?(L=K=>K.name.toLowerCase().includes(d.toLowerCase()),e[0]=d,e[1]=L):L=e[1];const _=b.filter(L);let M;e[2]!==d?(M=K=>K.name.toLowerCase()===d.toLowerCase(),e[2]=d,e[3]=M):M=e[3];const O=b.find(M),h=d.trim()&&!O,S=async K=>{const be=A.includes(K.id)?A.filter(ye=>ye!==K.id):[...A,K.id];await T.mutateAsync({memberId:n,tagIds:be})},E=async()=>{if(!d.trim())return;const K=await w.mutateAsync(d.trim());await T.mutateAsync({memberId:n,tagIds:[...A,K.id]}),N("")},p=async K=>{const ge=A.filter(be=>be!==K);await T.mutateAsync({memberId:n,tagIds:ge})},R=w.isPending||T.isPending,k=ws;let V;e[4]!==m?(V=()=>C(!m),e[4]=m,e[5]=V):V=e[5];let q;e[6]!==r?(q=X("h-auto min-h-8 px-2 py-1 justify-start font-normal","hover:bg-accent/50",r),e[6]=r,e[7]=q):q=e[7];const Q=i||P,H=P?s.jsx(st,{size:14,className:"animate-spin text-muted-foreground"}):f.length>0?s.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[f.slice(0,x).map(xn),f.length>x&&s.jsxs(Ee,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5",children:["+",f.length-x]})]}):s.jsx("span",{className:"text-muted-foreground text-xs",children:u});let Z;e[8]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsx(Os,{size:14,className:"ml-1 shrink-0 opacity-50"}),e[8]=Z):Z=e[8];let se;e[9]!==Q||e[10]!==H||e[11]!==V||e[12]!==q?(se=s.jsx(As,{asChild:!0,children:s.jsxs(ie,{variant:"ghost",size:"sm",onClick:V,className:q,disabled:Q,children:[H,Z]})}),e[9]=Q,e[10]=H,e[11]=V,e[12]=q,e[13]=se):se=e[13];const J=Is,U="w-56 p-0",a="start";let y;e[14]===Symbol.for("react.memo_cache_sentinel")?(y=()=>C(!1),e[14]=y):y=e[14];const F=ds,de=!1;let te;e[15]!==d?(te=s.jsx(ms,{placeholder:"Search or create...",value:d,onValueChange:N,className:"h-9"}),e[15]=d,e[16]=te):te=e[16];const W=cs,ee=f.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(mt,{heading:"Selected",children:f.map(K=>s.jsx(ut,{onSelect:()=>S(K),className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center justify-between w-full",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(De,{checked:!0,className:"[&_svg]:!text-primary-foreground"}),s.jsx("span",{children:K.name})]}),s.jsx("button",{onClick:ge=>{ge.stopPropagation(),p(K.id)},className:"opacity-50 hover:opacity-100",disabled:R,children:s.jsx(Kt,{size:14})})]})},K.id))}),s.jsx(St,{})]}),ce=mt,B="Available",G=_.length===0&&!h&&s.jsx(as,{children:"No tags found."}),Y=_.filter(K=>!A.includes(K.id)).map(K=>s.jsx(ut,{onSelect:()=>S(K),className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(De,{checked:!1,className:"[&_svg]:!text-primary-foreground"}),s.jsx("span",{children:K.name})]})},K.id));let re;e[17]!==ce||e[18]!==G||e[19]!==Y?(re=s.jsxs(ce,{heading:B,children:[G,Y]}),e[17]=ce,e[18]=G,e[19]=Y,e[20]=re):re=e[20];let me;e[21]!==E||e[22]!==R||e[23]!==d||e[24]!==h?(me=h&&s.jsxs(s.Fragment,{children:[s.jsx(St,{}),s.jsx(mt,{children:s.jsx(ut,{onSelect:E,className:"cursor-pointer",disabled:R,children:s.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[R?s.jsx(st,{size:14,className:"animate-spin"}):s.jsx(nt,{size:14}),s.jsxs("span",{children:['Create "',d.trim(),'"']})]})})})]}),e[21]=E,e[22]=R,e[23]=d,e[24]=h,e[25]=me):me=e[25];let pe;e[26]!==W||e[27]!==ee||e[28]!==re||e[29]!==me?(pe=s.jsxs(W,{children:[ee,re,me]}),e[26]=W,e[27]=ee,e[28]=re,e[29]=me,e[30]=pe):pe=e[30];let fe;e[31]!==F||e[32]!==te||e[33]!==pe?(fe=s.jsxs(F,{shouldFilter:de,children:[te,pe]}),e[31]=F,e[32]=te,e[33]=pe,e[34]=fe):fe=e[34];let he;e[35]!==J||e[36]!==y||e[37]!==fe?(he=s.jsx(J,{className:U,align:a,onEscapeKeyDown:y,children:fe}),e[35]=J,e[36]=y,e[37]=fe,e[38]=he):he=e[38];let je;return e[39]!==k||e[40]!==m||e[41]!==se||e[42]!==he?(je=s.jsxs(k,{open:m,onOpenChange:C,children:[se,he]}),e[39]=k,e[40]=m,e[41]=se,e[42]=he,e[43]=je):je=e[43],je}function xn(t){return s.jsx(Ee,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5",children:t.name},t.id)}function pn(t){return t.id}const Pt=["bg-neutral-400","bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500","bg-slate-500"],bn={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function rt(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function Cn(t){const e=new Map;for(const[n,r]of Object.entries(bn))e.set(n,r);for(let n=0;n<t.length;n++){const r=t[n];r&&!e.has(r.role)&&e.set(r.role,Pt[n%Pt.length]??"bg-neutral-400")}return e}function jn(t){return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function et(t){const e=le.c(79),{role:n,memberId:r,isOwner:l,roleColorMap:o,selectableRoles:c,onRoleChange:i,size:u,className:x}=t,m=u===void 0?"xs":u;let C,d,N,g,j,b,I,v,f,w,T;if(e[0]!==x||e[1]!==l||e[2]!==r||e[3]!==i||e[4]!==n||e[5]!==o||e[6]!==c||e[7]!==m){T=Symbol.for("react.early_return_sentinel");e:{const E=o.get(n)??"bg-neutral-400";if(l){let p;e[19]!==r||e[20]!==i?(p=U=>i(r,U),e[19]=r,e[20]=i,e[21]=p):p=e[21];let R;e[22]!==n?(R=s.jsx("span",{className:"capitalize truncate",children:n}),e[22]=n,e[23]=R):R=e[23];const k=s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("div",{className:X("size-2 rounded-full shrink-0",E)}),R]});let V;e[24]!==k?(V=s.jsx(xt,{children:k}),e[24]=k,e[25]=V):V=e[25];let q;e[26]!==x||e[27]!==m||e[28]!==V?(q=s.jsx(gt,{size:m,className:x,children:V}),e[26]=x,e[27]=m,e[28]=V,e[29]=q):q=e[29];let Q;if(e[30]!==o||e[31]!==c){let U;e[33]!==o?(U=a=>{const y=o.get(a.role)??"bg-neutral-400";return s.jsx(bt,{value:a.role,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:X("size-3 rounded-full",y)}),s.jsx("span",{className:"capitalize",children:a.label})]})},a.role)},e[33]=o,e[34]=U):U=e[34],Q=c.map(U),e[30]=o,e[31]=c,e[32]=Q}else Q=e[32];let H;e[35]!==Q?(H=s.jsx(pt,{children:Q}),e[35]=Q,e[36]=H):H=e[36];let Z;e[37]!==l||e[38]!==n||e[39]!==p||e[40]!==q||e[41]!==H?(Z=s.jsx(Pe,{asChild:!0,children:s.jsx("div",{className:"w-fit",children:s.jsxs(ht,{value:n,onValueChange:p,disabled:l,children:[q,H]})})}),e[37]=l,e[38]=n,e[39]=p,e[40]=q,e[41]=H,e[42]=Z):Z=e[42];let se;e[43]===Symbol.for("react.memo_cache_sentinel")?(se=s.jsx(Me,{children:s.jsx("p",{children:"The owner role cannot be changed"})}),e[43]=se):se=e[43];let J;e[44]!==Z?(J=s.jsx(Re,{children:s.jsxs(Le,{children:[Z,se]})}),e[44]=Z,e[45]=J):J=e[45],T=J;break e}N=ht,v=n,e[46]!==r||e[47]!==i?(f=p=>i(r,p),e[46]=r,e[47]=i,e[48]=f):f=e[48],w=l,d=gt,b=m,I=x,C=xt,j="flex items-center gap-2 min-w-0",g=X("size-2 rounded-full shrink-0",E)}e[0]=x,e[1]=l,e[2]=r,e[3]=i,e[4]=n,e[5]=o,e[6]=c,e[7]=m,e[8]=C,e[9]=d,e[10]=N,e[11]=g,e[12]=j,e[13]=b,e[14]=I,e[15]=v,e[16]=f,e[17]=w,e[18]=T}else C=e[8],d=e[9],N=e[10],g=e[11],j=e[12],b=e[13],I=e[14],v=e[15],f=e[16],w=e[17],T=e[18];if(T!==Symbol.for("react.early_return_sentinel"))return T;let P;e[49]!==g?(P=s.jsx("div",{className:g}),e[49]=g,e[50]=P):P=e[50];let A;e[51]!==n?(A=s.jsx("span",{className:"capitalize truncate",children:n}),e[51]=n,e[52]=A):A=e[52];let L;e[53]!==P||e[54]!==A||e[55]!==j?(L=s.jsxs("div",{className:j,children:[P,A]}),e[53]=P,e[54]=A,e[55]=j,e[56]=L):L=e[56];let _;e[57]!==C||e[58]!==L?(_=s.jsx(C,{children:L}),e[57]=C,e[58]=L,e[59]=_):_=e[59];let M;e[60]!==d||e[61]!==_||e[62]!==b||e[63]!==I?(M=s.jsx(d,{size:b,className:I,children:_}),e[60]=d,e[61]=_,e[62]=b,e[63]=I,e[64]=M):M=e[64];let O;if(e[65]!==o||e[66]!==c){let E;e[68]!==o?(E=p=>{const R=o.get(p.role)??"bg-neutral-400";return s.jsx(bt,{value:p.role,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:X("size-3 rounded-full",R)}),s.jsx("span",{className:"capitalize",children:p.label})]})},p.role)},e[68]=o,e[69]=E):E=e[69],O=c.map(E),e[65]=o,e[66]=c,e[67]=O}else O=e[67];let h;e[70]!==O?(h=s.jsx(pt,{children:O}),e[70]=O,e[71]=h):h=e[71];let S;return e[72]!==N||e[73]!==M||e[74]!==h||e[75]!==v||e[76]!==f||e[77]!==w?(S=s.jsxs(N,{value:v,onValueChange:f,disabled:w,children:[M,h]}),e[72]=N,e[73]=M,e[74]=h,e[75]=v,e[76]=f,e[77]=w,e[78]=S):S=e[78],S}function Mt(t){const e=le.c(51),{member:n,roles:r,onChangeRole:l,onRemove:o,isUpdating:c}=t,i=c===void 0?!1:c,u=n.role==="owner";let x,m,C,d,N,g,j,b,I;if(e[0]!==u||e[1]!==i||e[2]!==n.id||e[3]!==n.role||e[4]!==l||e[5]!==r){let M;e[15]!==n.role?(M=p=>p.role!==n.role&&p.role!=="owner",e[15]=n.role,e[16]=M):M=e[16];const O=r.filter(M);d=jt;let h;e[17]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Ft,{size:20}),e[17]=h):h=e[17],e[18]!==u?(I=s.jsx(vt,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:u,onClick:Nn,children:h})}),e[18]=u,e[19]=I):I=e[19],C=Nt,j="end",b=vn,m=gs;let S;e[20]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(Qt,{size:16}),e[20]=S):S=e[20],e[21]!==i?(g=s.jsxs(xs,{disabled:i,children:[S,"Change Role"]}),e[21]=i,e[22]=g):g=e[22],x=ps;let E;e[23]!==i||e[24]!==n.id||e[25]!==l?(E=p=>{const R=[];return p.isBuiltin||(p.allowsAllStaticPermissions?R.push("Full org access"):p.staticPermissionCount&&p.staticPermissionCount>0&&R.push(`${p.staticPermissionCount} org perm${p.staticPermissionCount!==1?"s":""}`),p.allowsAllConnections?R.push("All connections"):p.connectionCount&&p.connectionCount>0&&R.push(`${p.connectionCount} connection${p.connectionCount!==1?"s":""}`),(p.connectionCount!==0||p.allowsAllConnections)&&(p.allowsAllTools?R.push("all tools"):p.toolCount&&p.toolCount>0&&R.push(`${p.toolCount} tool${p.toolCount!==1?"s":""}`))),s.jsxs(tt,{onClick:k=>{k.stopPropagation(),l(n.id,p.role)},disabled:i,children:[p.isBuiltin?s.jsx(Tt,{size:16}):s.jsx(Ss,{size:16}),s.jsxs("span",{className:"flex flex-col",children:[s.jsx("span",{children:p.label}),!p.isBuiltin&&R.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:R.join(", ")})]})]},p.role)},e[23]=i,e[24]=n.id,e[25]=l,e[26]=E):E=e[26],N=O.map(E),e[0]=u,e[1]=i,e[2]=n.id,e[3]=n.role,e[4]=l,e[5]=r,e[6]=x,e[7]=m,e[8]=C,e[9]=d,e[10]=N,e[11]=g,e[12]=j,e[13]=b,e[14]=I}else x=e[6],m=e[7],C=e[8],d=e[9],N=e[10],g=e[11],j=e[12],b=e[13],I=e[14];let v;e[27]!==x||e[28]!==N?(v=s.jsx(x,{children:N}),e[27]=x,e[28]=N,e[29]=v):v=e[29];let f;e[30]!==m||e[31]!==g||e[32]!==v?(f=s.jsxs(m,{children:[g,v]}),e[30]=m,e[31]=g,e[32]=v,e[33]=f):f=e[33];let w;e[34]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(bs,{}),e[34]=w):w=e[34];let T;e[35]!==n.id||e[36]!==o?(T=M=>{M.stopPropagation(),o(n.id)},e[35]=n.id,e[36]=o,e[37]=T):T=e[37];let P;e[38]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx($t,{size:16}),e[38]=P):P=e[38];let A;e[39]!==T?(A=s.jsxs(tt,{variant:"destructive",onClick:T,children:[P,"Remove Member"]}),e[39]=T,e[40]=A):A=e[40];let L;e[41]!==C||e[42]!==A||e[43]!==j||e[44]!==b||e[45]!==f?(L=s.jsxs(C,{align:j,onClick:b,children:[f,w,A]}),e[41]=C,e[42]=A,e[43]=j,e[44]=b,e[45]=f,e[46]=L):L=e[46];let _;return e[47]!==d||e[48]!==L||e[49]!==I?(_=s.jsxs(d,{children:[I,L]}),e[47]=d,e[48]=L,e[49]=I,e[50]=_):_=e[50],_}function vn(t){return t.stopPropagation()}function Nn(t){return t.stopPropagation()}function Dt(t){const e=le.c(8),{invitationId:n,onCancel:r,isCancelling:l}=t,o=l===void 0?!1:l;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(vt,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:En,children:s.jsx(Ft,{size:20})})}),e[0]=c):c=e[0];let i;e[1]!==n||e[2]!==r?(i=m=>{m.stopPropagation(),r(n)},e[1]=n,e[2]=r,e[3]=i):i=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Kt,{size:16}),e[4]=u):u=e[4];let x;return e[5]!==o||e[6]!==i?(x=s.jsxs(jt,{children:[c,s.jsx(Nt,{align:"end",onClick:Tn,children:s.jsxs(tt,{variant:"destructive",onClick:i,disabled:o,children:[u,"Cancel Invitation"]})})]}),e[5]=o,e[6]=i,e[7]=x):x=e[7],x}function Tn(t){return t.stopPropagation()}function En(t){return t.stopPropagation()}function yn(){const t=le.c(79),{data:e}=Ct(),{data:n}=on(),r=ln(),l=Oe(),{locator:o}=Ce(),[c,i]=D.useState(null),[u,x]=D.useState(null),[m,C]=D.useState(""),[d,N]=D.useState("table"),[g,j]=D.useState("member"),[b,I]=D.useState("asc"),v=e?.data?.members;let f;t[0]!==g?(f=z=>{g===z?I(Un):(j(z),I("asc"))},t[0]=g,t[1]=f):f=t[1];const w=f;let T=v??[],P=n??[];if(m){const z=m.toLowerCase();T=T.filter($=>$.user?.name?.toLowerCase().includes(z)||$.user?.email?.toLowerCase().includes(z)||$.role?.toLowerCase().includes(z)),P=P.filter($=>$.email?.toLowerCase().includes(z)||$.role?.toLowerCase().includes(z))}if(g&&b){let z;t[2]!==b||t[3]!==g?(z=($,oe)=>{let xe,_e;e:switch(g){case"member":{xe=$.user?.name||"",_e=oe.user?.name||"";break e}case"role":{xe=$.role||"",_e=oe.role||"";break e}case"joined":{xe=$.createdAt?typeof $.createdAt=="string"?$.createdAt:$.createdAt.toISOString():"",_e=oe.createdAt?typeof oe.createdAt=="string"?oe.createdAt:oe.createdAt.toISOString():"";break e}default:return 0}return b==="asc"?xe.localeCompare(_e):_e.localeCompare(xe)},t[2]=b,t[3]=g,t[4]=z):z=t[4],T=[...T].sort(z)}const A=T;let L;t[5]!==o||t[6]!==l?(L={mutationFn:kn,onSuccess:()=>{l.invalidateQueries({queryKey:ue.members(o)}),ne.success("Member has been removed from the organization"),i(null)},onError:zn},t[5]=o,t[6]=l,t[7]=L):L=t[7];const _=ve(L);let M;t[8]!==o||t[9]!==l?(M={mutationFn:Dn,onSuccess:()=>{l.invalidateQueries({queryKey:ue.members(o)}),ne.success("Member's role has been updated")},onError:Mn},t[8]=o,t[9]=l,t[10]=M):M=t[10];const O=ve(M);let h;t[11]!==o||t[12]!==l?(h={mutationFn:Pn,onSuccess:()=>{l.invalidateQueries({queryKey:ue.invitations(o)}),ne.success("Invitation role has been updated")},onError:Ln},t[11]=o,t[12]=l,t[13]=h):h=t[13];const S=ve(h),{roles:E,customRoles:p}=Et();let R;t[14]!==p?(R=Cn(p),t[14]=p,t[15]=R):R=t[15];const k=R;let V;t[16]!==E?(V=E.filter(Rn),t[16]=E,t[17]=V):V=t[17];const q=V;let Q;t[18]===Symbol.for("react.memo_cache_sentinel")?(Q={id:"member",header:"Member",render:_n,cellClassName:"flex-1 min-w-0",sortable:!0},t[18]=Q):Q=t[18];let H;t[19]!==k||t[20]!==q||t[21]!==S||t[22]!==O?(H={id:"role",header:"Role",render:z=>z.type==="member"?s.jsx(et,{role:z.data.role,memberId:z.data.id,isOwner:z.data.role==="owner",roleColorMap:k,selectableRoles:q,onRoleChange:($,oe)=>O.mutate({memberId:$,role:oe}),className:"w-36"}):s.jsx(et,{role:z.data.role,memberId:z.data.id,isOwner:!1,roleColorMap:k,selectableRoles:q,onRoleChange:($,oe)=>S.mutate({invitationId:$,role:oe,email:z.data.email}),className:"w-36"}),cellClassName:"w-36 shrink-0",sortable:!0},t[19]=k,t[20]=q,t[21]=S,t[22]=O,t[23]=H):H=t[23];let Z,se;t[24]===Symbol.for("react.memo_cache_sentinel")?(Z={id:"tags",header:"Tags",render:On,cellClassName:"w-40 shrink-0"},se={id:"joined",header:"Joined",render:An,cellClassName:"w-48 shrink-0",sortable:!0},t[24]=Z,t[25]=se):(Z=t[24],se=t[25]);let J;t[26]!==r.cancel.isPending||t[27]!==E||t[28]!==O?(J={id:"actions",header:"",render:z=>z.type==="member"?s.jsx(Mt,{member:z.data,roles:E,onChangeRole:($,oe)=>O.mutate({memberId:$,role:oe}),onRemove:i,isUpdating:O.isPending}):s.jsx(Dt,{invitationId:z.data.id,onCancel:x,isCancelling:r.cancel.isPending}),cellClassName:"w-12 shrink-0"},t[26]=r.cancel.isPending,t[27]=E,t[28]=O,t[29]=J):J=t[29];let U;t[30]!==J||t[31]!==H?(U=[Q,H,Z,se,J],t[30]=J,t[31]=H,t[32]=U):U=t[32];const a=U;let y;t[33]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(tn,{trigger:s.jsxs(ie,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:[s.jsx(Tt,{size:16}),"Manage Roles"]})}),t[33]=y):y=t[33];let F;t[34]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsxs("div",{className:"flex items-center gap-2",children:[y,s.jsx(rn,{trigger:s.jsx(ie,{size:"sm",children:"Invite Member"})})]}),t[34]=F):F=t[34];const de=F,te=[...A.map(wn),...P.filter(In).map(Sn)],W=Te,ee=!!u;let ce;t[35]===Symbol.for("react.memo_cache_sentinel")?(ce=()=>x(null),t[35]=ce):ce=t[35];let B;t[36]===Symbol.for("react.memo_cache_sentinel")?(B=s.jsxs(Ue,{children:[s.jsx(Be,{children:"Cancel Invitation"}),s.jsx(Ve,{children:"Are you sure you want to cancel this invitation? The invitee will no longer be able to join the organization with this invitation."})]}),t[36]=B):B=t[36];let G;t[37]===Symbol.for("react.memo_cache_sentinel")?(G=s.jsx($e,{children:"Keep Invitation"}),t[37]=G):G=t[37];let Y;t[38]!==r.cancel||t[39]!==u?(Y=()=>{u&&(r.cancel.mutate(u),x(null))},t[38]=r.cancel,t[39]=u,t[40]=Y):Y=t[40];let re;t[41]!==r.cancel.isPending||t[42]!==Y?(re=s.jsxs(ke,{children:[B,s.jsxs(Ge,{children:[G,s.jsx(Fe,{onClick:Y,disabled:r.cancel.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Cancel Invitation"})]})]}),t[41]=r.cancel.isPending,t[42]=Y,t[43]=re):re=t[43];let me;t[44]!==ee||t[45]!==re?(me=s.jsx(ze,{open:ee,onOpenChange:ce,children:re}),t[44]=ee,t[45]=re,t[46]=me):me=t[46];const pe=!!c;let fe;t[47]===Symbol.for("react.memo_cache_sentinel")?(fe=()=>i(null),t[47]=fe):fe=t[47];let he;t[48]===Symbol.for("react.memo_cache_sentinel")?(he=s.jsxs(Ue,{children:[s.jsx(Be,{children:"Remove Member"}),s.jsx(Ve,{children:"Are you sure you want to remove this member from the organization? This action cannot be undone."})]}),t[48]=he):he=t[48];let je;t[49]===Symbol.for("react.memo_cache_sentinel")?(je=s.jsx($e,{children:"Cancel"}),t[49]=je):je=t[49];let K;t[50]!==c||t[51]!==_?(K=()=>c&&_.mutate(c),t[50]=c,t[51]=_,t[52]=K):K=t[52];let ge;t[53]!==_.isPending||t[54]!==K?(ge=s.jsxs(ke,{children:[he,s.jsxs(Ge,{children:[je,s.jsx(Fe,{onClick:K,disabled:_.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),t[53]=_.isPending,t[54]=K,t[55]=ge):ge=t[55];let be;t[56]!==pe||t[57]!==ge?(be=s.jsx(ze,{open:pe,onOpenChange:fe,children:ge}),t[56]=pe,t[57]=ge,t[58]=be):be=t[58];let ye;t[59]===Symbol.for("react.memo_cache_sentinel")?(ye=s.jsx(Te.Header.Left,{children:s.jsx(rs,{children:s.jsx(is,{children:s.jsx(os,{children:s.jsx(ls,{children:"Members"})})})})}),t[59]=ye):ye=t[59];let He;t[60]===Symbol.for("react.memo_cache_sentinel")?(He=[{id:"member",label:"Name"},{id:"role",label:"Role"},{id:"joined",label:"Joined"}],t[60]=He):He=t[60];let Se;t[61]!==w||t[62]!==b||t[63]!==g||t[64]!==d?(Se=s.jsxs(Te.Header,{children:[ye,s.jsxs(Te.Header.Right,{children:[s.jsx(ss,{viewMode:d,onViewModeChange:N,sortKey:g,sortDirection:b,onSort:w,sortOptions:He}),de]})]}),t[61]=w,t[62]=b,t[63]=g,t[64]=d,t[65]=Se):Se=t[65];let Ze;t[66]===Symbol.for("react.memo_cache_sentinel")?(Ze=z=>{z.key==="Escape"&&(C(""),z.target.blur())},t[66]=Ze):Ze=t[66];let Ie;t[67]!==m?(Ie=s.jsx(Ke,{value:m,onChange:C,placeholder:"Search members...",onKeyDown:Ze}),t[67]=m,t[68]=Ie):Ie=t[68];const lt=Te,at=d==="cards"?s.jsx("div",{className:"flex-1 overflow-auto p-5",children:te.length===0?s.jsx(dt,{title:"No members found",description:m?`No members match "${m}"`:"Invite members to get started."}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:te.map(z=>{if(z.type==="invitation")return s.jsxs(Rt,{className:"transition-colors relative opacity-75",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(Dt,{invitationId:z.data.id,onCancel:x,isCancelling:r.cancel.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(Ae,{fallback:rt(z.data.email),shape:"circle",size:"lg",className:"shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:z.data.email}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(Ee,{variant:"outline",className:"w-fit text-amber-600 border-amber-400",children:"Pending"})}),s.jsx(et,{role:z.data.role,memberId:z.data.id,isOwner:!1,roleColorMap:k,selectableRoles:q,onRoleChange:(oe,xe)=>S.mutate({invitationId:oe,role:xe,email:z.data.email}),className:"w-fit"})]})]})]},`inv-${z.data.id}`);const $=z.data;return s.jsxs(Rt,{className:"transition-colors relative",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(Mt,{member:$,roles:E,onChangeRole:(oe,xe)=>O.mutate({memberId:oe,role:xe}),onRemove:i,isUpdating:O.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(Ae,{url:$.user?.image??void 0,fallback:rt($.user?.name),shape:"circle",size:"lg",className:"shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:$.user?.name||"Unknown"}),s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:$.user?.email}),s.jsx(et,{role:$.role,memberId:$.id,isOwner:$.role==="owner",roleColorMap:k,selectableRoles:q,onRoleChange:(oe,xe)=>O.mutate({memberId:oe,role:xe}),className:"w-fit"}),s.jsx(Yt,{memberId:$.id,maxDisplay:3})]})]})]},$.id)})})}):s.jsx(ns,{columns:a,data:te,isLoading:!1,sortKey:g,sortDirection:b,onSort:w,emptyState:m?s.jsx(dt,{title:"No members found",description:`No members match "${m}"`}):s.jsx(dt,{title:"No members found",description:"Invite members to get started."})});let we;t[69]!==lt.Content||t[70]!==at?(we=s.jsx(lt.Content,{children:at}),t[69]=lt.Content,t[70]=at,t[71]=we):we=t[71];let Ye;return t[72]!==W||t[73]!==me||t[74]!==be||t[75]!==Se||t[76]!==Ie||t[77]!==we?(Ye=s.jsxs(W,{children:[me,be,Se,Ie,we]}),t[72]=W,t[73]=me,t[74]=be,t[75]=Se,t[76]=Ie,t[77]=we,t[78]=Ye):Ye=t[78],Ye}function Sn(t){return{type:"invitation",data:t}}function In(t){return t.status==="pending"}function wn(t){return{type:"member",data:t}}function An(t){return t.type==="member"?s.jsx("span",{className:"text-sm text-foreground",children:t.data.createdAt?jn(t.data.createdAt):"N/A"}):s.jsx(Ee,{variant:"outline",children:"Pending"})}function On(t){return t.type==="member"?s.jsx(Yt,{memberId:t.data.id,maxDisplay:2}):s.jsx("span",{className:"text-xs text-muted-foreground",children:"-"})}function _n(t){return t.type==="member"?s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ae,{url:t.data.user?.image??void 0,fallback:rt(t.data.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.data.user?.name||"Unknown"}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:t.data.user?.email})]})]}):s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ae,{fallback:rt(t.data.email),shape:"circle",size:"sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.data.email}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:"Invitation sent"})]})]})}function Rn(t){return t.role!=="owner"}function Ln(t){ne.error(t instanceof Error?t.message:"Failed to update invitation role")}async function Pn(t){const{invitationId:e,role:n,email:r}=t,l=await ae.organization.cancelInvitation({invitationId:e});if(l?.error)throw new Error(l.error.message);const o=await ae.organization.inviteMember({email:r,role:n});if(o?.error)throw new Error(o.error.message)}function Mn(t){ne.error(t instanceof Error?t.message:"Failed to update role")}async function Dn(t){const{memberId:e,role:n}=t,r=await ae.organization.updateMemberRole({memberId:e,role:[n]});if(r?.error)throw new Error(r.error.message)}function zn(t){ne.error(t instanceof Error?t.message:"Failed to remove member")}async function kn(t){const e=await ae.organization.removeMember({memberIdOrEmail:t});if(e?.error)throw new Error(e.error.message)}function Un(t){return t==="asc"?"desc":t==="desc"?null:"asc"}function Ar(){const t=le.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load members"})})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Ns,{fallback:e,children:s.jsx(D.Suspense,{fallback:s.jsx(Te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(st,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(yn,{})})}),t[1]=n):n=t[1],n}export{Ar as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as u}from"./infiniteQueryObserver-BYaSWja-.js";import{a1 as i}from"./index-ByQ-WW1t.js";function t(e,r){return i(e,u,r)}export{t as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a1 as u,a4 as s}from"./index-ByQ-WW1t.js";function o(e,r){return u(e,s,r)}export{o as u};
|