@decocms/mesh 1.0.17 → 1.0.18
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-CDFxkn8P.js → AlertCircle-CAH7G7Fc.js} +1 -1
- package/dist/client/assets/{ArrowLeft-Ciuxq7Q-.js → ArrowLeft-DYJU0sRd.js} +1 -1
- package/dist/client/assets/{Calendar-Ck02Gl_h.js → Calendar-Ba37VUfB.js} +1 -1
- package/dist/client/assets/{ChevronDown-293zKGHe.js → ChevronDown-BtaAznAf.js} +1 -1
- package/dist/client/assets/{Clock-hKESOc1Y.js → Clock-BYv8XFdU.js} +1 -1
- package/dist/client/assets/{Copy01-Cfsho8qu.js → Copy01-DZzyV7nE.js} +1 -1
- package/dist/client/assets/{CpuChip02-DMyGj-Z2.js → CpuChip02-SXr5nJdo.js} +1 -1
- package/dist/client/assets/{DotsVertical-Dn7odh4O.js → DotsVertical-BJS2t7Tg.js} +1 -1
- package/dist/client/assets/{File06-Cdqoedhj.js → File06-NpiRHtR-.js} +1 -1
- package/dist/client/assets/{GitBranch01-nLLHsj1c.js → GitBranch01-iTqlzLTs.js} +1 -1
- package/dist/client/assets/{Inbox01-Cwh_U6Yy.js → Inbox01-BHWd6y2Z.js} +1 -1
- package/dist/client/assets/{InfoCircle-BXqyuDnq.js → InfoCircle-D6Oa5jFj.js} +1 -1
- package/dist/client/assets/{Key01-BhexYLb5.js → Key01-BYLHyZyj.js} +1 -1
- package/dist/client/assets/{LinkExternal01-I-KzAQEJ.js → LinkExternal01-CQv3krcN.js} +1 -1
- package/dist/client/assets/{Loading01-lzLKWums.js → Loading01-DdJTgVpp.js} +1 -1
- package/dist/client/assets/Lock01-CVeVWkZB.js +1 -0
- package/dist/client/assets/{Plus-Bl6yi8F8.js → Plus-DF_8yoMD.js} +1 -1
- package/dist/client/assets/{SearchMd-3Wd2TwbA.js → SearchMd-DDy8E2Sf.js} +1 -1
- package/dist/client/assets/{Terminal-DTrkBKv1.js → Terminal-CyVXhceX.js} +1 -1
- package/dist/client/assets/{Trash01-DtytfnvM.js → Trash01-3l-2SGXg.js} +1 -1
- package/dist/client/assets/{Upload01-DTjjOdhq.js → Upload01-BY1Megy0.js} +1 -1
- package/dist/client/assets/{X-Cp1i89ho.js → X-EkD3fVWA.js} +1 -1
- package/dist/client/assets/{XClose-BjXVNdsc.js → XClose-BQyXK7EC.js} +1 -1
- package/dist/client/assets/{alert-dialog-T6AiZUB1.js → alert-dialog-TgVzKfkb.js} +1 -1
- package/dist/client/assets/{auth-BYQ5JBPH.js → auth-CPnNaHvV.js} +1 -1
- package/dist/client/assets/{auth-catchall-ChAxJq9F.js → auth-catchall-LOKV6UAh.js} +1 -1
- package/dist/client/assets/{avatar-Cca1j58d.js → avatar-DSEJrCNe.js} +1 -1
- package/dist/client/assets/{badge-8HAdXiIR.js → badge-B1dobCRY.js} +1 -1
- package/dist/client/assets/{button--R5o0wL7.js → button-Cu7Gpj_2.js} +1 -1
- package/dist/client/assets/{card-DV2_nXad.js → card-BMKHMTDj.js} +1 -1
- package/dist/client/assets/{checkbox-BVd2RslL.js → checkbox-DbkRP74v.js} +1 -1
- package/dist/client/assets/{collection-detail-TIy-lzkt.js → collection-detail-ngjte1c4.js} +1 -1
- package/dist/client/assets/{collection-display-button-BDu-CjA3.js → collection-display-button-CfJOFOy4.js} +1 -1
- package/dist/client/assets/{collection-header-DUMmszqZ.js → collection-header-6vROlIaL.js} +1 -1
- package/dist/client/assets/{collection-page-CCqyH-ni.js → collection-page-DPG4FVyY.js} +1 -1
- package/dist/client/assets/{collection-search-BLREvhln.js → collection-search-Dt3csPYy.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-CIOycu1I.js → collection-table-wrapper-B3zYvq_F.js} +1 -1
- package/dist/client/assets/{connection-card-CdAxVoxf.js → connection-card-CjOjxUED.js} +1 -1
- package/dist/client/assets/{connection-detail-N74ve95g.js → connection-detail-BTYUiiKA.js} +1 -1
- package/dist/client/assets/{connections-eAJCThFh.js → connections-C46XykEA.js} +1 -1
- package/dist/client/assets/{core-9I4ovOKa.js → core-BFzlzP8F.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-DqGippHf.js → create-organization-dialog-CdptfMRb.js} +1 -1
- package/dist/client/assets/{dialog-DlJAicu4.js → dialog-CC7Romxu.js} +1 -1
- package/dist/client/assets/{dropdown-menu-CvIw74N_.js → dropdown-menu-De2MFXzP.js} +1 -1
- package/dist/client/assets/{env-vars-editor-L1OkJ6Xo.js → env-vars-editor-DKJqlIK-.js} +1 -1
- package/dist/client/assets/{error-boundary-BP-NCqAa.js → error-boundary-BlfwOQWs.js} +1 -1
- package/dist/client/assets/{extract-connection-data-DgR0N8lP.js → extract-connection-data-D7ePP-S9.js} +1 -1
- package/dist/client/assets/{form-B7S8d6pb.js → form-C9aG8a9_.js} +1 -1
- package/dist/client/assets/{formatDistanceToNow-4WRkEQoq.js → formatDistanceToNow-7bwQqEEJ.js} +1 -1
- package/dist/client/assets/{gateway-detail-DYsvJWds.js → gateway-detail-D1TGQ1-a.js} +1 -1
- package/dist/client/assets/{gateways-CqMlHfC3.js → gateways-CicECNcG.js} +1 -1
- package/dist/client/assets/{home-JebOEFno.js → home-6S0sFGwA.js} +1 -1
- package/dist/client/assets/{index-BCPBzRgp.js → index-BC4DFDP4.js} +1 -1
- package/dist/client/assets/{index-DlHvrb4b.js → index-BEpExDaW.js} +1 -1
- package/dist/client/assets/{index-OjgkLDRY.js → index-CqA7I8ME.js} +16 -16
- package/dist/client/assets/{index-DOAaveYz.js → index-rXoeRhPD.js} +1 -1
- package/dist/client/assets/{input-DkUxKlvC.js → input-DHGUS5vj.js} +1 -1
- package/dist/client/assets/json-DY5VamDr.js +1 -0
- package/dist/client/assets/{json-syntax-highlighter-B0pbrw7c.js → json-syntax-highlighter-Dykx_AFd.js} +2 -2
- package/dist/client/assets/{layout-BD1H2Fd4.js → layout-zE8Dp2X0.js} +1 -1
- package/dist/client/assets/{lazy-highlighter-Bm3luqqx.js → lazy-highlighter-CioqVtm3.js} +1 -1
- package/dist/client/assets/{localstorage-keys-BKdNuRRM.js → localstorage-keys-DECG1iSi.js} +1 -1
- package/dist/client/assets/{login-D-FrmPs7.js → login-Cx3k8N36.js} +1 -1
- package/dist/client/assets/{mcp-oauth-B-4OryyC.js → mcp-oauth-tlLalwei.js} +1 -1
- package/dist/client/assets/members-Bng4JPo_.js +3 -0
- package/dist/client/assets/{monitoring-Dp4gwq3v.js → monitoring-gTR9Celr.js} +1 -1
- package/dist/client/assets/{oauth-callback-q9nbBMZr.js → oauth-callback-DWHntj-c.js} +1 -1
- package/dist/client/assets/{page-DZEEXJGv.js → page-BNqzvH_D.js} +1 -1
- package/dist/client/assets/{popover-DtFzalb2.js → popover-DqxbH01z.js} +1 -1
- package/dist/client/assets/prism-light-YTNk6MZn.js +1 -0
- package/dist/client/assets/{resizable-DvxvrPoQ.js → resizable-1LBVjTrf.js} +4 -4
- package/dist/client/assets/{resource-tabs-zQhHBAXR.js → resource-tabs-CeU00pMP.js} +1 -1
- package/dist/client/assets/{select-BbFQz4Zb.js → select-Dg5JPxAc.js} +1 -1
- package/dist/client/assets/{settings-BNNbDOAc.js → settings-Bpm9SXP6.js} +1 -1
- package/dist/client/assets/shell-layout-hhV4DGMT.js +17 -0
- package/dist/client/assets/{spinner-D3PlZpfm.js → spinner-CyJuCfoJ.js} +1 -1
- package/dist/client/assets/store-DrnwLSGT.js +1 -0
- package/dist/client/assets/{store-app-detail-Ctq33yyn.js → store-app-detail-CFp562AP.js} +1 -1
- package/dist/client/assets/{switch-C7AQYM7p.js → switch-C28m6eWV.js} +1 -1
- package/dist/client/assets/{tools-list-BBjhQzX1.js → tools-list-NuJ6i7mN.js} +1 -1
- package/dist/client/assets/{tooltip-BNR213_s.js → tooltip-BGO9FrAb.js} +1 -1
- package/dist/client/assets/{types-B5imdZUc.js → types-B38t86fr.js} +1 -1
- package/dist/client/assets/{use-binding-BA2o2u6B.js → use-binding-BSrLFa69.js} +1 -1
- package/dist/client/assets/{use-connection-Bva8lo0T.js → use-connection-CRNsw_EM.js} +1 -1
- package/dist/client/assets/{use-connection-resources-D14aG9RS.js → use-connection-resources-CuRCIUIA.js} +1 -1
- package/dist/client/assets/{use-gateway-BR-Csw6g.js → use-gateway-BDLgsIti.js} +1 -1
- package/dist/client/assets/{use-list-state-BlFIS1BS.js → use-list-state-Bu3fDY_D.js} +1 -1
- package/dist/client/assets/{use-mcp-DEd-0oIU.js → use-mcp-C6M7GJsU.js} +1 -1
- package/dist/client/assets/{use-members-2m2D77cz.js → use-members-BjVwiFSf.js} +1 -1
- package/dist/client/assets/{use-mobile--3nyeV_n.js → use-mobile-DWX_zGvO.js} +1 -1
- package/dist/client/assets/{use-organization-settings-CRu5FU7t.js → use-organization-settings-BjHeWH30.js} +1 -1
- package/dist/client/assets/{use-tool-call-BaqpTLjb.js → use-tool-call-hxvro7CP.js} +1 -1
- package/dist/client/assets/useQuery-DYX0Erl2.js +1 -0
- package/dist/client/assets/{view-mode-toggle-RcIHDc_9.js → view-mode-toggle-CwRfmI4H.js} +1 -1
- package/dist/client/assets/well-known-mcp-DX3tGGx0.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +146 -146
- package/dist/server/migrate.js +92 -92
- package/dist/server/server.js +125 -125
- package/package.json +1 -1
- package/dist/client/assets/json-BhSdWvUi.js +0 -1
- package/dist/client/assets/members-B2Y9n1Dt.js +0 -3
- package/dist/client/assets/prism-light-f9F39inZ.js +0 -1
- package/dist/client/assets/shell-layout-bzzPOV5-.js +0 -17
- package/dist/client/assets/store-CFY_7skC.js +0 -1
- package/dist/client/assets/useQuery-CJBdsmlt.js +0 -1
- package/dist/client/assets/well-known-mcp-DgDkk-rH.js +0 -1
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aj as o}from"./index-OjgkLDRY.js";import{r}from"./json-BESjz4hO.js";var s=r();const e=o(s);export{e as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{r as U,K as oe,a as X,v as fs,W as He,X as Ms,Y as zs,w as ue,e as qe,y as Es,x as ks,t as J,j as t,c as de,q as Ds}from"./index-OjgkLDRY.js";import{C as Bs}from"./collection-header-DUMmszqZ.js";import{C as es}from"./collection-page-CCqyH-ni.js";import{C as Ze}from"./collection-search-BLREvhln.js";import{C as Gs}from"./collection-table-wrapper-CIOycu1I.js";import{T as Us,S as Ue}from"./switch-C7AQYM7p.js";import{u as Vs,c as $s}from"./use-connection-Bva8lo0T.js";import{u as os}from"./use-members-2m2D77cz.js";import{W as Fs,i as Ks}from"./well-known-mcp-DgDkk-rH.js";import{u as Ce,a as ve,c as ye,b as Ee,T as Ie}from"./tooltip-BNR213_s.js";import{u as Is}from"./useQuery-CJBdsmlt.js";import{A as je}from"./avatar-Cca1j58d.js";import{B as Se}from"./badge-8HAdXiIR.js";import{u as fe,c as ie,B as ee}from"./button--R5o0wL7.js";import{C as Qs}from"./checkbox-BVd2RslL.js";import{f as we,a as Te,b as Ae,c as Oe,d as Re,e as _e,A as Pe,g as Le}from"./alert-dialog-T6AiZUB1.js";import{d as Ss,e as ws,c as Ts,D as qs,a as Zs,T as Ys,f as Ws}from"./dialog-DlJAicu4.js";import{b as as,D as cs,a as ds,d as Ke,f as Hs,g as Js,h as Xs,e as et}from"./dropdown-menu-CvIw74N_.js";import{i as st,s as tt}from"./XClose-BjXVNdsc.js";import{i as As}from"./Loading01-lzLKWums.js";import{s as ss}from"./Plus-Bl6yi8F8.js";import{s as Os}from"./Trash01-DtytfnvM.js";import{i as hs}from"./X-Cp1i89ho.js";import{I as nt}from"./input-DkUxKlvC.js";import{E as Je}from"./SearchMd-3Wd2TwbA.js";import{E as it}from"./error-boundary-BP-NCqAa.js";import{a as rt,F as gs,b as xs,c as lt,d as ps,f as bs}from"./form-B7S8d6pb.js";import{S as ts,a as ns,b as is,c as rs,d as ls}from"./select-BbFQz4Zb.js";import{C as js}from"./card-DV2_nXad.js";import{i as Rs}from"./DotsVertical-Dn7odh4O.js";import{i as ot}from"./Key01-BhexYLb5.js";import"./collection-display-button-BDu-CjA3.js";import"./view-mode-toggle-RcIHDc_9.js";import"./ArrowLeft-Ciuxq7Q-.js";import"./ChevronDown-293zKGHe.js";const ms=({size:s=24,color:e="currentColor",...n})=>U.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},U.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"}));ms.displayName="Shield01";const _s=({size:s=24,color:e="currentColor",...n})=>U.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},U.createElement("path",{d:"M20 17H4m0 0 4-4m-4 4 4 4M4 7h16m0 0-4-4m4 4-4 4"}));_s.displayName="SwitchHorizontal01";const Ps=[{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_GATEWAY_CREATE",description:"Create gateways",category:"Gateways"},{name:"COLLECTION_GATEWAY_LIST",description:"List gateways",category:"Gateways"},{name:"COLLECTION_GATEWAY_GET",description:"View gateway details",category:"Gateways"},{name:"COLLECTION_GATEWAY_UPDATE",description:"Update gateways",category:"Gateways"},{name:"COLLECTION_GATEWAY_DELETE",description:"Delete gateways",category:"Gateways",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"}],at={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_GATEWAY_CREATE:"Create gateways",COLLECTION_GATEWAY_LIST:"List gateways",COLLECTION_GATEWAY_GET:"View gateway details",COLLECTION_GATEWAY_UPDATE:"Update gateways",COLLECTION_GATEWAY_DELETE:"Delete gateways",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"};function ct(){const s={Organizations:[],Connections:[],Gateways:[],Monitoring:[],"API Keys":[],"Event Bus":[]};for(const e of Ps)s[e.category]?.push(e);return s}function dt(){return Ps.map(s=>({value:s.name,label:at[s.name],dangerous:s.dangerous}))}const Cs=[{value:"owner",label:"Owner",isBuiltin:!0},{value:"admin",label:"Admin",isBuiltin:!0},{value:"user",label:"User",isBuiltin:!0}];function mt(s){return s.replace(/-/g," ")}function ut(s){if(!s)return{staticPermissions:[],allowsAllStaticPermissions:!1,connectionIds:[],allowsAllConnections:!1,toolNames:[],allowsAllTools:!1};const e=[];let n=!1;const l=[];let a=!1;const r=new Set;let h=!1;for(const[o,x]of Object.entries(s)){if(o===Fs.SELF){x.includes("*")?n=!0:e.push(...x);continue}if(o==="*"){if(a=!0,x.includes("*"))h=!0;else for(const y of x)r.add(y);continue}if(l.push(o),x.includes("*"))h=!0;else for(const y of x)r.add(y)}return{staticPermissions:e,allowsAllStaticPermissions:n,connectionIds:l,allowsAllConnections:a,toolNames:Array.from(r),allowsAllTools:h}}function us(){const{locator:s}=Ce(),{data:e,isLoading:n,error:l,refetch:a}=Is({queryKey:oe.organizationRoles(s),queryFn:async()=>{try{const o=await X.organization.listRoles();return o?.error?(console.error("[useOrganizationRoles] API error:",o.error),[]):o?.data??[]}catch(o){return console.error("[useOrganizationRoles] Fetch error:",o),[]}},staleTime:3e4}),r=Cs.map(o=>({role:o.value,label:o.label,isBuiltin:o.isBuiltin}));if(e&&Array.isArray(e))for(const o of e){const x=o.role;if(!x||Cs.some(j=>j.value===x))continue;const{staticPermissions:y,allowsAllStaticPermissions:f,connectionIds:T,allowsAllConnections:d,toolNames:I,allowsAllTools:u}=ut(o.permission);r.push({id:o.id,role:x,label:mt(x),isBuiltin:!1,permission:o.permission??void 0,staticPermissionCount:f?-1:y.length,allowsAllStaticPermissions:f,connectionCount:d?-1:T.length,allowsAllConnections:d,toolCount:u?-1:I.length,allowsAllTools:u})}const h=r.filter(o=>!o.isBuiltin);return{roles:r,customRoles:h,builtinRoles:r.filter(o=>o.isBuiltin),isLoading:n,error:l,refetch:a}}const ft=fs({role:fs({id:ue().optional(),slug:ue().optional(),label:ue()}),allowAllStaticPermissions:zs(),staticPermissions:He(ue()),toolSet:Ms(ue(),He(ue())),memberIds:He(ue())});function Ls(s){return s?s.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}const ht=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],Xe=["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 gt(s){if(!s)return"bg-neutral-400";let e=0;for(let l=0;l<s.length;l++){const a=s.charCodeAt(l);e=(e<<5)-e+a,e=e&e}const n=Math.abs(e)%Xe.length;return Xe[n]??Xe[0]}function Ve(){return{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},memberIds:[]}}function xt(s){const e=de.c(39),{allowAllStaticPermissions:n,staticPermissions:l,onAllowAllChange:a,onPermissionsChange:r,readOnly:h}=s,o=h===void 0?!1:h,[x,y]=U.useState(""),f=U.useDeferredValue(x);let T,d,I,u,j;if(e[0]!==n||e[1]!==f||e[2]!==a||e[3]!==r||e[4]!==o||e[5]!==x||e[6]!==l){const g=ct(),c=dt(),N=c.filter(E=>E.label.toLowerCase().includes(f.toLowerCase())),S=E=>{if(l.includes(E))r(l.filter(_=>_!==E));else{const _=[...l,E];_.length===c.length?(a(!0),r([])):r(_)}};I="flex flex-col h-full",e[12]!==x?(u=t.jsx("div",{className:"border-b border-border",children:t.jsx(Ze,{value:x,onChange:y,placeholder:"Search permissions...",className:"border-b-0"})}),e[12]=x,e[13]=u):u=e[13];const P=!o&&"hover:bg-muted/50 cursor-pointer";let w;e[14]!==P?(w=ie("flex items-center justify-between px-4 py-3 rounded-lg",P),e[14]=P,e[15]=w):w=e[15];let O;e[16]!==n||e[17]!==a||e[18]!==r||e[19]!==o?(O=()=>{if(o)return;a(!n),r([])},e[16]=n,e[17]=a,e[18]=r,e[19]=o,e[20]=O):O=e[20];let A;e[21]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx("span",{className:"text-sm font-medium",children:"All organization permissions"}),e[21]=A):A=e[21];let L;e[22]!==n||e[23]!==a||e[24]!==r||e[25]!==o?(L=t.jsx("div",{onClick:Nt,children:o?t.jsx(ve,{children:t.jsxs(ye,{children:[t.jsx(Ee,{asChild:!0,children:t.jsx("div",{children:t.jsx(Ue,{checked:n,disabled:o,onCheckedChange:E=>{o||(a(E),r([]))}})})}),t.jsx(Ie,{children:t.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):t.jsx(Ue,{checked:n,disabled:o,onCheckedChange:E=>{o||(a(E),r([]))}})}),e[22]=n,e[23]=a,e[24]=r,e[25]=o,e[26]=L):L=e[26],e[27]!==L||e[28]!==w||e[29]!==O?(j=t.jsx("div",{className:"border-b border-border",children:t.jsxs("div",{className:w,onClick:O,children:[A,L]})}),e[27]=L,e[28]=w,e[29]=O,e[30]=j):j=e[30],T="flex-1 overflow-auto",d=Object.entries(g).map(E=>{const[_,z]=E,v=N.filter(m=>z.some(M=>M.name===m.value));return v.length===0?null:t.jsxs("div",{className:"mb-6 last:mb-0",children:[t.jsx("h4",{className:"text-sm font-medium p-3 pb-1.5 text-muted-foreground/75",children:_}),t.jsx("div",{className:"space-y-1",children:v.map(m=>t.jsxs("div",{className:ie("flex items-center justify-between gap-3 px-4 py-3",!o&&"hover:bg-muted/50 cursor-pointer"),onClick:()=>{if(!o)if(n){a(!1);const M=c.map(Ct);r(M.filter(V=>V!==m.value))}else S(m.value)},children:[t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("span",{className:"text-sm",children:m.label})}),t.jsx("div",{onClick:jt,children:o?t.jsx(ve,{children:t.jsxs(ye,{children:[t.jsx(Ee,{asChild:!0,children:t.jsx("div",{children:t.jsx(Ue,{checked:n||l.includes(m.value),disabled:o,onCheckedChange:()=>{if(!o)if(n){a(!1);const M=c.map(bt);r(M.filter(V=>V!==m.value))}else S(m.value)}})})}),t.jsx(Ie,{children:t.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):t.jsx(Ue,{checked:n||l.includes(m.value),disabled:o,onCheckedChange:()=>{if(!o)if(n){a(!1);const M=c.map(pt);r(M.filter(V=>V!==m.value))}else S(m.value)}})})]},m.value))})]},_)}),e[0]=n,e[1]=f,e[2]=a,e[3]=r,e[4]=o,e[5]=x,e[6]=l,e[7]=T,e[8]=d,e[9]=I,e[10]=u,e[11]=j}else T=e[7],d=e[8],I=e[9],u=e[10],j=e[11];let p;e[31]!==T||e[32]!==d?(p=t.jsx("div",{className:T,children:d}),e[31]=T,e[32]=d,e[33]=p):p=e[33];let C;return e[34]!==I||e[35]!==u||e[36]!==j||e[37]!==p?(C=t.jsxs("div",{className:I,children:[u,j,p]}),e[34]=I,e[35]=u,e[36]=j,e[37]=p,e[38]=C):C=e[38],C}function pt(s){return s.value}function bt(s){return s.value}function jt(s){return s.stopPropagation()}function Ct(s){return s.value}function Nt(s){return s.stopPropagation()}function vt(s){const e=de.c(56),{open:n,onOpenChange:l,selectedMemberIds:a,onAddMembers:r}=s,[h,o]=U.useState(""),x=U.useDeferredValue(h);let y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[0]=y):y=e[0];const[f,T]=U.useState(y),{data:d}=os();let I,u,j,p,C,g,c,N,S,P,w;if(e[1]!==d?.data?.members||e[2]!==x||e[3]!==r||e[4]!==l||e[5]!==n||e[6]!==f||e[7]!==h||e[8]!==a){const M=d?.data?.members??[];let V;e[20]!==x?(V=D=>{const i=x.toLowerCase();return D.user?.name?.toLowerCase().includes(i)||D.user?.email?.toLowerCase().includes(i)},e[20]=x,e[21]=V):V=e[21];const se=M.filter(V),F=yt;let K;e[22]!==a?(K=D=>a.includes(D),e[22]=a,e[23]=K):K=e[23];const Q=K;let Y;e[24]!==f?(Y=D=>{f.includes(D)?T(f.filter(i=>i!==D)):T([...f,D])},e[24]=f,e[25]=Y):Y=e[25];const ne=Y;let te;e[26]!==r||e[27]!==l||e[28]!==f?(te=()=>{r(f),T([]),l(!1)},e[26]=r,e[27]=l,e[28]=f,e[29]=te):te=e[29],j=te,u=we,P=n,w=l,I=Te,N="sm:max-w-md p-0 overflow-hidden",e[30]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsxs(Ae,{className:"px-6 pt-6",children:[t.jsx(Oe,{children:"Add Members to Role"}),t.jsx(Re,{children:"Select members to add to this role."})]}),e[30]=S):S=e[30],g="flex flex-col h-80",e[31]!==h?(c=t.jsx(Ze,{value:h,onChange:o,placeholder:"Search members...",className:"border-b border-t-0 border-x-0 rounded-none"}),e[31]=h,e[32]=c):c=e[32],p="flex-1 overflow-auto",C=se.length===0?t.jsx("div",{className:"flex items-center justify-center h-full px-6",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:h?"No members found":"No members available"})}):t.jsx("div",{className:"px-6 py-2 space-y-1",children:se.map(D=>{const i=F(D),b=Q(D.id),$=f.includes(D.id);return t.jsxs("label",{className:ie("flex items-center gap-3 p-2 rounded-lg",!i||b?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[t.jsx(Qs,{checked:$||b,onCheckedChange:()=>{i&&!b&&ne(D.id)},disabled:!i||b}),t.jsx(je,{url:D.user?.image??void 0,fallback:Ls(D.user?.name),shape:"circle",size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:D.user?.name||"Unknown"}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:D.user?.email})]}),!i&&t.jsx(Se,{variant:"secondary",className:"shrink-0",children:"Owner"}),b&&i&&t.jsx(Se,{variant:"outline",className:"shrink-0",children:"Added"})]},D.id)})}),e[1]=d?.data?.members,e[2]=x,e[3]=r,e[4]=l,e[5]=n,e[6]=f,e[7]=h,e[8]=a,e[9]=I,e[10]=u,e[11]=j,e[12]=p,e[13]=C,e[14]=g,e[15]=c,e[16]=N,e[17]=S,e[18]=P,e[19]=w}else I=e[9],u=e[10],j=e[11],p=e[12],C=e[13],g=e[14],c=e[15],N=e[16],S=e[17],P=e[18],w=e[19];let O;e[33]!==p||e[34]!==C?(O=t.jsx("div",{className:p,children:C}),e[33]=p,e[34]=C,e[35]=O):O=e[35];let A;e[36]!==O||e[37]!==g||e[38]!==c?(A=t.jsxs("div",{className:g,children:[c,O]}),e[36]=O,e[37]=g,e[38]=c,e[39]=A):A=e[39];let L;e[40]===Symbol.for("react.memo_cache_sentinel")?(L=t.jsx(Pe,{children:"Cancel"}),e[40]=L):L=e[40];const E=f.length===0,_=f.length>0&&`(${f.length})`;let z;e[41]!==j||e[42]!==E||e[43]!==_?(z=t.jsxs(_e,{className:"px-6 pb-6",children:[L,t.jsxs(Le,{onClick:j,disabled:E,children:["Add ",_]})]}),e[41]=j,e[42]=E,e[43]=_,e[44]=z):z=e[44];let v;e[45]!==I||e[46]!==A||e[47]!==z||e[48]!==N||e[49]!==S?(v=t.jsxs(I,{className:N,children:[S,A,z]}),e[45]=I,e[46]=A,e[47]=z,e[48]=N,e[49]=S,e[50]=v):v=e[50];let m;return e[51]!==u||e[52]!==v||e[53]!==P||e[54]!==w?(m=t.jsx(u,{open:P,onOpenChange:w,children:v}),e[51]=u,e[52]=v,e[53]=P,e[54]=w,e[55]=m):m=e[55],m}function yt(s){return s.role!=="owner"}function Et(s){const e=de.c(40),{memberIds:n,onMemberIdsChange:l,readOnly:a}=s,r=a===void 0?!1:a,[h,o]=U.useState(""),x=U.useDeferredValue(h),[y,f]=U.useState(!1),{data:T}=os();let d,I,u,j,p;if(e[0]!==T?.data?.members||e[1]!==x||e[2]!==n||e[3]!==l||e[4]!==r||e[5]!==h){const N=T?.data?.members??[];let S;e[11]!==n?(S=v=>n.includes(v.id),e[11]=n,e[12]=S):S=e[12];const P=N.filter(S);let w;e[13]!==x?(w=v=>{const m=x.toLowerCase();return v.user?.name?.toLowerCase().includes(m)||v.user?.email?.toLowerCase().includes(m)},e[13]=x,e[14]=w):w=e[14];const O=P.filter(w);let A;e[15]!==n||e[16]!==l?(A=v=>{l(n.filter(m=>m!==v))},e[15]=n,e[16]=l,e[17]=A):A=e[17];const L=A;let E;e[18]!==n||e[19]!==l?(E=v=>{l([...n,...v])},e[18]=n,e[19]=l,e[20]=E):E=e[20],d=E,j="flex flex-col h-full";let _;e[21]!==h?(_=t.jsx(Ze,{value:h,onChange:o,placeholder:"Search members...",className:"flex-1 border-b-0"}),e[21]=h,e[22]=_):_=e[22];let z;e[23]!==r?(z=r?t.jsx("div",{className:"pr-4",children:t.jsx(ve,{children:t.jsxs(ye,{children:[t.jsx(Ee,{asChild:!0,children:t.jsx("div",{children:t.jsxs(ee,{variant:"outline",size:"sm",disabled:!0,children:[t.jsx(ss,{size:16}),"Add Member"]})})}),t.jsx(Ie,{children:t.jsx("p",{children:"Owner membership cannot be changed"})})]})})}):t.jsx("div",{className:"pr-4",children:t.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>f(!0),children:[t.jsx(ss,{size:16}),"Add Member"]})}),e[23]=r,e[24]=z):z=e[24],e[25]!==_||e[26]!==z?(p=t.jsxs("div",{className:"flex items-center border-b border-border",children:[_,z]}),e[25]=_,e[26]=z,e[27]=p):p=e[27],I="flex-1 overflow-auto",u=P.length===0?t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsxs("div",{className:"text-center",children:[t.jsx("h3",{className:"text-lg font-medium mb-2",children:"No members"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to this role to grant them the configured permissions."})]})}):O.length===0?t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',h,'"']})}):t.jsx("div",{className:"p-4 space-y-2",children:O.map(v=>t.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[t.jsx(je,{url:v.user?.image??void 0,fallback:Ls(v.user?.name),shape:"circle",size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:v.user?.name||"Unknown"}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:v.user?.email})]}),r?t.jsx(ve,{children:t.jsxs(ye,{children:[t.jsx(Ee,{asChild:!0,children:t.jsx("div",{children:t.jsx(ee,{variant:"ghost",size:"sm",disabled:!0,children:t.jsx(hs,{size:16})})})}),t.jsx(Ie,{children:t.jsx("p",{children:"Owner membership cannot be changed"})})]})}):t.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>L(v.id),children:t.jsx(hs,{size:16})})]},v.id))}),e[0]=T?.data?.members,e[1]=x,e[2]=n,e[3]=l,e[4]=r,e[5]=h,e[6]=d,e[7]=I,e[8]=u,e[9]=j,e[10]=p}else d=e[6],I=e[7],u=e[8],j=e[9],p=e[10];let C;e[28]!==I||e[29]!==u?(C=t.jsx("div",{className:I,children:u}),e[28]=I,e[29]=u,e[30]=C):C=e[30];let g;e[31]!==y||e[32]!==d||e[33]!==n?(g=t.jsx(vt,{open:y,onOpenChange:f,selectedMemberIds:n,onAddMembers:d}),e[31]=y,e[32]=d,e[33]=n,e[34]=g):g=e[34];let c;return e[35]!==j||e[36]!==p||e[37]!==C||e[38]!==g?(c=t.jsxs("div",{className:j,children:[p,C,g]}),e[35]=j,e[36]=p,e[37]=C,e[38]=g,e[39]=c):c=e[39],c}function It(s){const e=de.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx(As,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let l;return e[1]!==s?(l=t.jsx(U.Suspense,{fallback:n,children:t.jsx(Et,{...s})}),e[1]=s,e[2]=l):l=e[2],l}const St={owner:[],admin:[],user:[]};function $e(s,e){const n=s==="owner"||s==="admin",l=e.filter(a=>a.role===s);return{role:{slug:s,label:s.charAt(0).toUpperCase()+s.slice(1)},allowAllStaticPermissions:n,staticPermissions:St[s],toolSet:{},memberIds:l.map(a=>a.id)}}function wt({trigger:s,onSuccess:e}){const[n,l]=U.useState(!1),[a,r]=U.useState("mcp"),{locator:h}=Ce(),o=qe(),x=Vs()??[],{customRoles:y,refetch:f}=us(),{data:T}=Is({queryKey:oe.members(h),queryFn:()=>X.organization.listMembers()}),d=Es({resolver:ks(ft),defaultValues:Ve()}),I=d.formState.isValid,u=d.formState.isDirty,[j,p]=U.useState(null),[C,g]=U.useState(null),c=!d.watch("role.id")&&!d.watch("role.slug")&&!C,[N,S]=U.useState(null),[P,w]=U.useState(!1),[O,A]=U.useState(null),L=i=>{const b=i.permission||{},$=b.self||[],le=$.includes("*"),re=le?[]:$.filter(k=>k!=="*"),W={};for(const[k,B]of Object.entries(b))if(k!=="self")if(k==="*")for(const Z of x)B.includes("*")?W[Z.id]=Z.tools?.map(ae=>ae.name)??[]:W[Z.id]=B;else{const Z=x.find(ae=>ae.id===k);Z&&(B.includes("*")?W[k]=Z.tools?.map(ae=>ae.name)??[]:W[k]=B)}const me=(T?.data?.members??[]).filter(k=>k.role===i.role).map(k=>k.id);return{role:{id:i.id,slug:i.role,label:i.label},allowAllStaticPermissions:le,staticPermissions:re,toolSet:W,memberIds:me}},E=i=>{const b=L(i);d.reset(b),p(i.id??null),g(null)},_=()=>{d.reset(Ve()),p(null),g(null),r("mcp")},z=i=>{u&&I?(A(()=>()=>E(i)),w(!0)):E(i)},v=async()=>{u&&I&&await Y(),_()},m=i=>{if(u&&I)A(()=>()=>{const b=$e(i,T?.data?.members??[]);d.reset(b),g(i),p(null),r("org")}),w(!0);else{const b=$e(i,T?.data?.members??[]);d.reset(b),g(i),p(null),r("org")}},M=i=>{if(!i&&d.formState.isDirty&&I){A(()=>()=>{l(!1),d.reset(Ve()),g(null)}),w(!0);return}if(l(i),!i)d.reset(Ve()),g(null),p(null);else{const b=y[0];if(b)E(b);else{const $=$e("user",T?.data?.members??[]);d.reset($),g("user"),p(null),r("org")}}},V=()=>{w(!1),O&&(O(),A(null))},se=i=>{const b={};i.allowAllStaticPermissions?b.self=["*"]:i.staticPermissions.length>0&&(b.self=i.staticPermissions);for(const[$,le]of Object.entries(i.toolSet))if(le.length>0){const W=x.find(q=>q.id===$)?.tools?.map(q=>q.name)??[];W.length>0&&W.every(q=>le.includes(q))?b[$]=["*"]:b[$]=le}return b},F=fe({mutationFn:async i=>{const b=se(i),$=i.role.slug||i.role.label.toLowerCase().replace(/\s+/g,"-");if(i.role.slug&&!i.role.id){const W=(T?.data?.members??[]).filter(k=>k.role===i.role.slug).map(k=>k.id),q=i.memberIds.filter(k=>!W.includes(k)),me=W.filter(k=>!i.memberIds.includes(k));for(const k of q){const B=await X.organization.updateMemberRole({memberId:k,role:[i.role.slug]});if(B?.error)throw new Error(B.error.message)}for(const k of me){const B=await X.organization.updateMemberRole({memberId:k,role:["user"]});if(B?.error)throw new Error(B.error.message)}return i}else if(i.role.id){const re=await X.organization.updateRole({roleId:i.role.id,data:{permission:b}});if(re?.error)throw new Error(re.error.message);const q=(T?.data?.members??[]).filter(B=>B.role===i.role.slug).map(B=>B.id),me=i.memberIds.filter(B=>!q.includes(B)),k=q.filter(B=>!i.memberIds.includes(B));for(const B of me){const Z=await X.organization.updateMemberRole({memberId:B,role:[i.role.slug]});if(Z?.error)throw new Error(Z.error.message)}for(const B of k){const Z=await X.organization.updateMemberRole({memberId:B,role:["user"]});if(Z?.error)throw new Error(Z.error.message)}return i}else{const re=await X.organization.createRole({role:$,permission:b});if(re?.error)throw new Error(re.error.message);for(const W of i.memberIds){const q=await X.organization.updateMemberRole({memberId:W,role:[$]});if(q?.error)throw new Error(q.error.message)}return{...i,role:{...i.role,id:re.data?.roleData?.id,slug:$}}}},onSuccess:(i,b)=>{o.invalidateQueries({queryKey:oe.members(h)}),o.invalidateQueries({queryKey:oe.organizationRoles(h)});const $=!b.role.id&&!b.role.slug,le=b.role.slug&&!b.role.id;J.success(le?"Members updated successfully!":$?"Role created successfully!":"Role updated successfully!"),f(),d.reset(i),i.role.id&&p(i.role.id),e?.()},onError:i=>{J.error(i instanceof Error?i.message:"Failed to save role")}}),K=fe({mutationFn:async i=>{const b=await X.organization.deleteRole({roleId:i});if(b?.error)throw new Error(b.error.message);return b?.data},onSuccess:()=>{if(o.invalidateQueries({queryKey:oe.members(h)}),o.invalidateQueries({queryKey:oe.organizationRoles(h)}),J.success("Role deleted successfully!"),f(),N?.id===j){const i=y.filter(b=>b.id!==N?.id);if(i[0])E(i[0]);else{const b=$e("user",T?.data?.members??[]);d.reset(b),g("user"),p(null),r("org")}}},onError:i=>{J.error(i instanceof Error?i.message:"Failed to delete role")}}),Q=F.isPending||K.isPending,Y=async()=>{const i=d.getValues();if(!i.role.label.trim()){J.error("Role name is required"),d.setFocus("role.label");return}await F.mutateAsync(i)},ne=d.handleSubmit(i=>{if(!i.role.label.trim()){J.error("Role name is required"),d.setFocus("role.label");return}F.mutate(i)}),te=i=>{i.id&&S({id:i.id,label:i.label})},D=()=>{N?.id&&K.mutate(N.id),S(null)};return t.jsxs(Ss,{open:n,onOpenChange:M,children:[t.jsx(ws,{asChild:!0,children:s}),t.jsx(Ts,{className:"sm:max-w-5xl h-[80vh] max-h-[80vh] flex flex-col p-0 overflow-hidden w-[95vw]",children:t.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0 flex-col sm:flex-row",children:[t.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:[t.jsx("div",{className:"flex-1 overflow-auto px-3.5 py-3.5 pt-3.5",children:t.jsxs("div",{className:"flex flex-col gap-1",children:[ht.map(i=>{const b=C===i.role;return t.jsxs("div",{className:ie("flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden cursor-pointer transition-colors",b?"bg-accent":"hover:bg-muted/50"),onClick:()=>m(i.role),children:[t.jsx("div",{className:ie("shrink-0 size-3 rounded-full",i.color)}),t.jsx("p",{className:"text-sm font-medium truncate flex-1",children:i.label}),t.jsx(Ks,{size:14,className:"text-muted-foreground shrink-0"})]},i.role)}),y.map(i=>{const b=j===i.id;return t.jsxs("div",{className:ie("group flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden transition-colors cursor-pointer",b?"bg-accent":"hover:bg-muted/50"),onClick:()=>z(i),children:[t.jsx("div",{className:ie("shrink-0 size-3 rounded-full",gt(i.label))}),t.jsx("p",{className:"text-sm font-medium truncate flex-1",children:i.label}),t.jsxs(as,{children:[t.jsx(cs,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"icon",className:ie("size-5 shrink-0 transition-opacity opacity-0 pointer-events-none","group-hover:opacity-100 group-hover:pointer-events-auto",b&&"opacity-100 pointer-events-auto"),onClick:$=>$.stopPropagation(),children:t.jsx(st,{size:14})})}),t.jsx(ds,{align:"end",children:t.jsxs(Ke,{className:"text-destructive",onClick:$=>{$.stopPropagation(),te(i)},children:[t.jsx(Os,{size:16}),"Delete"]})})]})]},i.id)}),c&&t.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden bg-accent",children:[t.jsx("div",{className:"shrink-0 size-3 rounded-full bg-neutral-400"}),t.jsx(nt,{...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}),t.jsx(Se,{variant:"secondary",className:"shrink-0 text-xs px-1.5 py-0",children:"New"})]})]})}),t.jsx("div",{className:"px-3.5 pb-3.5",children:t.jsxs(ee,{variant:"outline",size:"default",onClick:v,disabled:Q||u,className:"w-full h-10",children:[t.jsx(ss,{size:16}),"Create new role"]})})]}),t.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[t.jsxs("div",{className:"h-12 border-b border-border px-4 py-3.5 flex items-center gap-2 shrink-0",children:[!C&&t.jsx(ee,{variant:"outline",size:"sm",onClick:()=>r("mcp"),className:ie("h-8 rounded-lg px-2 py-1",a==="mcp"?"bg-muted border-input text-foreground":"border-input text-muted-foreground bg-transparent"),children:"MCP Permissions"}),t.jsx(ee,{variant:"outline",size:"sm",onClick:()=>r("org"),className:ie("h-8 rounded-lg px-2 py-1",a==="org"?"bg-muted border-input text-foreground":"border-input text-muted-foreground bg-transparent"),children:"Organization Permissions"}),t.jsx(ee,{variant:"outline",size:"sm",onClick:()=>r("members"),className:ie("h-8 rounded-lg px-2 py-1",a==="members"?"bg-muted border-input text-foreground":"border-input text-muted-foreground bg-transparent"),children:"Members"})]}),t.jsxs("div",{className:"flex-1 overflow-hidden min-h-0",children:[a==="mcp"&&!C&&t.jsx(Us,{toolSet:d.watch("toolSet"),onToolSetChange:i=>d.setValue("toolSet",i,{shouldDirty:!0})}),a==="org"&&t.jsx(xt,{allowAllStaticPermissions:d.watch("allowAllStaticPermissions"),staticPermissions:d.watch("staticPermissions"),onAllowAllChange:i=>d.setValue("allowAllStaticPermissions",i,{shouldDirty:!0}),onPermissionsChange:i=>d.setValue("staticPermissions",i,{shouldDirty:!0}),readOnly:!!C}),a==="members"&&t.jsx(It,{memberIds:d.watch("memberIds"),onMemberIdsChange:i=>d.setValue("memberIds",i,{shouldDirty:!0}),readOnly:C==="owner"})]}),(!C||C!=="owner")&&t.jsxs("div",{className:"border-t border-border px-5 py-5 flex items-center justify-end gap-2.5 shrink-0",children:[t.jsx(ee,{variant:"outline",onClick:()=>M(!1),disabled:Q,className:"h-10",children:"Cancel"}),t.jsx(ee,{onClick:ne,disabled:Q||!I||!d.formState.isDirty,className:"h-10",children:F.isPending?"Saving...":c?"Create Role":"Save Changes"})]})]})]})}),t.jsx(we,{open:N!==null,onOpenChange:i=>!i&&S(null),children:t.jsxs(Te,{children:[t.jsxs(Ae,{children:[t.jsx(Oe,{children:"Delete Role"}),t.jsxs(Re,{children:['Are you sure you want to delete the "',N?.label,'" role? This action cannot be undone.']})]}),t.jsxs(_e,{children:[t.jsx(Pe,{children:"Cancel"}),t.jsx(Le,{onClick:D,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),t.jsx(we,{open:P,onOpenChange:w,children:t.jsxs(Te,{children:[t.jsxs(Ae,{children:[t.jsx(Oe,{children:"Discard Changes"}),t.jsx(Re,{children:"You have unsaved changes. Are you sure you want to discard them?"})]}),t.jsxs(_e,{children:[t.jsx(Pe,{onClick:()=>A(null),children:"Keep Editing"}),t.jsx(Le,{onClick:V,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})})]})}const Tt=ue().email("Invalid email address");function At(s){if(!s.trim())return[];const e=s.split(/[,;\n]/).map(n=>n.trim().toLowerCase()).filter(n=>n.length>0);return Array.from(new Set(e))}function Ot({trigger:s}){const[e,n]=U.useState(!1),{locator:l}=Ce(),a=qe(),{data:r}=X.useSession(),h=r?.user?.email,{roles:o,isLoading:x}=us(),y=o.filter(g=>g.role!=="owner"),f=Es({mode:"onChange",defaultValues:{emailsText:"",role:"user"}}),T=f.watch("emailsText"),d=f.watch("role"),u=At(T).filter(g=>{const c=Tt.safeParse(g).success,N=!h||g!==h.toLowerCase();return c&&N}),j=fe({mutationFn:async({emails:g,role:c})=>{if(!c)throw new Error("Please select a role");const N=await Promise.allSettled(g.map(async P=>{const w=await X.organization.inviteMember({email:P,role:c});if(w.error)throw new Error(w.error.message);return w.data})),S=N.filter(P=>P.status==="rejected");if(S.length>0)throw new Error(`Failed to invite ${S.length} member${S.length>1?"s":""}`);return N},onSuccess:(g,{emails:c})=>{a.invalidateQueries({queryKey:oe.members(l)}),a.invalidateQueries({queryKey:oe.invitations(l)}),J.success(c.length===1?"Member invited successfully!":`${c.length} members invited successfully!`),f.reset({emailsText:"",role:"user"}),n(!1)},onError:g=>{J.error(g instanceof Error?g.message:"Failed to invite members")}}),p=g=>{if(u.length===0){J.error("Please enter at least one valid email address");return}if(!g.role){J.error("Please select a role");return}j.mutate({emails:u,role:g.role})},C=u.length>0&&!!d;return t.jsxs(Ss,{open:e,onOpenChange:n,children:[t.jsx(ws,{asChild:!0,children:s}),t.jsxs(Ts,{className:"sm:max-w-lg",children:[t.jsx(qs,{children:t.jsx(Zs,{children:"Invite members"})}),t.jsx(rt,{...f,children:t.jsxs("form",{onSubmit:f.handleSubmit(p),className:"space-y-4",children:[t.jsx(gs,{control:f.control,name:"emailsText",render:({field:g})=>t.jsxs(xs,{children:[t.jsx(lt,{children:"Email addresses"}),t.jsx(ps,{children:t.jsx(Ys,{...g,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"})}),t.jsx(bs,{})]})}),t.jsx(gs,{control:f.control,name:"role",render:({field:g})=>t.jsxs(xs,{children:[t.jsx(ps,{children:t.jsxs(ts,{value:g.value,onValueChange:g.onChange,disabled:j.isPending||x,children:[t.jsx(ns,{className:"w-full",children:t.jsx(is,{placeholder:"Select a role"})}),t.jsx(rs,{children:y.map(c=>{const N=[];return c.isBuiltin||(c.allowsAllStaticPermissions?N.push("Full org access"):c.staticPermissionCount&&c.staticPermissionCount>0&&N.push(`${c.staticPermissionCount} org perm${c.staticPermissionCount!==1?"s":""}`),c.allowsAllConnections?N.push("All connections"):c.connectionCount&&c.connectionCount>0&&N.push(`${c.connectionCount} connection${c.connectionCount!==1?"s":""}`),(c.connectionCount!==0||c.allowsAllConnections)&&(c.allowsAllTools?N.push("all tools"):c.toolCount&&c.toolCount>0&&N.push(`${c.toolCount} tool${c.toolCount!==1?"s":""}`))),t.jsx(ls,{value:c.role,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:c.label}),!c.isBuiltin&&N.length>0&&t.jsx("span",{className:"text-xs text-muted-foreground",children:N.join(", ")})]})},c.role)})})]})}),t.jsx(bs,{})]})}),t.jsxs(Ws,{children:[t.jsx(ee,{variant:"outline",onClick:()=>{f.reset({emailsText:"",role:"user"}),n(!1)},type:"button",disabled:j.isPending,children:"Cancel"}),t.jsx(ee,{type:"submit",disabled:j.isPending||!C,children:j.isPending?"Inviting...":`Invite ${u.length||0} Member${u.length!==1?"s":""}`})]})]})})]})]})}function Rt(){const s=de.c(6),{locator:e}=Ce();let n;s[0]===Symbol.for("react.memo_cache_sentinel")?(n=$s(),s[0]=n):n=s[0];const l=n;let a;s[1]!==e?(a=oe.invitations(e),s[1]=e,s[2]=a):a=s[2];let r;s[3]===Symbol.for("react.memo_cache_sentinel")?(r=async()=>(await l("ORGANIZATION_GET",{}))?.invitations??[],s[3]=r):r=s[3];let h;return s[4]!==a?(h={queryKey:a,queryFn:r},s[4]=a,s[5]=h):h=s[5],Ds(h)}function _t(){const s=de.c(5),{locator:e}=Ce(),n=qe();let l;s[0]!==e||s[1]!==n?(l={mutationFn:Lt,onSuccess:()=>{n.invalidateQueries({queryKey:oe.invitations(e)}),J.success("Invitation cancelled")},onError:Pt},s[0]=e,s[1]=n,s[2]=l):l=s[2];const a=fe(l);let r;return s[3]!==a?(r={cancel:a},s[3]=a,s[4]=r):r=s[4],r}function Pt(s){J.error(s instanceof Error?s.message:"Failed to cancel invitation")}async function Lt(s){const e=await X.organization.cancelInvitation({invitationId:s});if(e?.error)throw new Error(e.error.message);return e.data}const Ns=["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"],Mt={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Qe(s){return s?s.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function zt(s){const e=new Map;for(const[n,l]of Object.entries(Mt))e.set(n,l);for(let n=0;n<s.length;n++){const l=s[n];l&&!e.has(l.role)&&e.set(l.role,Ns[n%Ns.length]??"bg-neutral-400")}return e}function kt(s){return new Date(s).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function Fe(s){const e=de.c(79),{role:n,memberId:l,isOwner:a,roleColorMap:r,selectableRoles:h,onRoleChange:o,size:x,className:y}=s,f=x===void 0?"xs":x;let T,d,I,u,j,p,C,g,c,N,S;if(e[0]!==y||e[1]!==a||e[2]!==l||e[3]!==o||e[4]!==n||e[5]!==r||e[6]!==h||e[7]!==f){S=Symbol.for("react.early_return_sentinel");e:{const v=r.get(n)??"bg-neutral-400";if(a){let m;e[19]!==l||e[20]!==o?(m=D=>o(l,D),e[19]=l,e[20]=o,e[21]=m):m=e[21];let M;e[22]!==n?(M=t.jsx("span",{className:"capitalize truncate",children:n}),e[22]=n,e[23]=M):M=e[23];const V=t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("div",{className:ie("size-2 rounded-full shrink-0",v)}),M]});let se;e[24]!==V?(se=t.jsx(is,{children:V}),e[24]=V,e[25]=se):se=e[25];let F;e[26]!==y||e[27]!==f||e[28]!==se?(F=t.jsx(ns,{size:f,className:y,children:se}),e[26]=y,e[27]=f,e[28]=se,e[29]=F):F=e[29];let K;if(e[30]!==r||e[31]!==h){let D;e[33]!==r?(D=i=>{const b=r.get(i.role)??"bg-neutral-400";return t.jsx(ls,{value:i.role,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:ie("size-3 rounded-full",b)}),t.jsx("span",{className:"capitalize",children:i.label})]})},i.role)},e[33]=r,e[34]=D):D=e[34],K=h.map(D),e[30]=r,e[31]=h,e[32]=K}else K=e[32];let Q;e[35]!==K?(Q=t.jsx(rs,{children:K}),e[35]=K,e[36]=Q):Q=e[36];let Y;e[37]!==a||e[38]!==n||e[39]!==m||e[40]!==F||e[41]!==Q?(Y=t.jsx(Ee,{asChild:!0,children:t.jsx("div",{className:"w-fit",children:t.jsxs(ts,{value:n,onValueChange:m,disabled:a,children:[F,Q]})})}),e[37]=a,e[38]=n,e[39]=m,e[40]=F,e[41]=Q,e[42]=Y):Y=e[42];let ne;e[43]===Symbol.for("react.memo_cache_sentinel")?(ne=t.jsx(Ie,{children:t.jsx("p",{children:"The owner role cannot be changed"})}),e[43]=ne):ne=e[43];let te;e[44]!==Y?(te=t.jsx(ve,{children:t.jsxs(ye,{children:[Y,ne]})}),e[44]=Y,e[45]=te):te=e[45],S=te;break e}I=ts,g=n,e[46]!==l||e[47]!==o?(c=m=>o(l,m),e[46]=l,e[47]=o,e[48]=c):c=e[48],N=a,d=ns,p=f,C=y,T=is,j="flex items-center gap-2 min-w-0",u=ie("size-2 rounded-full shrink-0",v)}e[0]=y,e[1]=a,e[2]=l,e[3]=o,e[4]=n,e[5]=r,e[6]=h,e[7]=f,e[8]=T,e[9]=d,e[10]=I,e[11]=u,e[12]=j,e[13]=p,e[14]=C,e[15]=g,e[16]=c,e[17]=N,e[18]=S}else T=e[8],d=e[9],I=e[10],u=e[11],j=e[12],p=e[13],C=e[14],g=e[15],c=e[16],N=e[17],S=e[18];if(S!==Symbol.for("react.early_return_sentinel"))return S;let P;e[49]!==u?(P=t.jsx("div",{className:u}),e[49]=u,e[50]=P):P=e[50];let w;e[51]!==n?(w=t.jsx("span",{className:"capitalize truncate",children:n}),e[51]=n,e[52]=w):w=e[52];let O;e[53]!==P||e[54]!==w||e[55]!==j?(O=t.jsxs("div",{className:j,children:[P,w]}),e[53]=P,e[54]=w,e[55]=j,e[56]=O):O=e[56];let A;e[57]!==T||e[58]!==O?(A=t.jsx(T,{children:O}),e[57]=T,e[58]=O,e[59]=A):A=e[59];let L;e[60]!==d||e[61]!==A||e[62]!==p||e[63]!==C?(L=t.jsx(d,{size:p,className:C,children:A}),e[60]=d,e[61]=A,e[62]=p,e[63]=C,e[64]=L):L=e[64];let E;if(e[65]!==r||e[66]!==h){let v;e[68]!==r?(v=m=>{const M=r.get(m.role)??"bg-neutral-400";return t.jsx(ls,{value:m.role,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:ie("size-3 rounded-full",M)}),t.jsx("span",{className:"capitalize",children:m.label})]})},m.role)},e[68]=r,e[69]=v):v=e[69],E=h.map(v),e[65]=r,e[66]=h,e[67]=E}else E=e[67];let _;e[70]!==E?(_=t.jsx(rs,{children:E}),e[70]=E,e[71]=_):_=e[71];let z;return e[72]!==I||e[73]!==L||e[74]!==_||e[75]!==g||e[76]!==c||e[77]!==N?(z=t.jsxs(I,{value:g,onValueChange:c,disabled:N,children:[L,_]}),e[72]=I,e[73]=L,e[74]=_,e[75]=g,e[76]=c,e[77]=N,e[78]=z):z=e[78],z}function vs(s){const e=de.c(51),{member:n,roles:l,onChangeRole:a,onRemove:r,isUpdating:h}=s,o=h===void 0?!1:h,x=n.role==="owner";let y,f,T,d,I,u,j,p,C;if(e[0]!==x||e[1]!==o||e[2]!==n.id||e[3]!==n.role||e[4]!==a||e[5]!==l){let L;e[15]!==n.role?(L=m=>m.role!==n.role&&m.role!=="owner",e[15]=n.role,e[16]=L):L=e[16];const E=l.filter(L);d=as;let _;e[17]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx(Rs,{size:20}),e[17]=_):_=e[17],e[18]!==x?(C=t.jsx(cs,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:x,onClick:Bt,children:_})}),e[18]=x,e[19]=C):C=e[19],T=ds,j="end",p=Dt,f=Hs;let z;e[20]===Symbol.for("react.memo_cache_sentinel")?(z=t.jsx(_s,{size:16}),e[20]=z):z=e[20],e[21]!==o?(u=t.jsxs(Js,{disabled:o,children:[z,"Change Role"]}),e[21]=o,e[22]=u):u=e[22],y=Xs;let v;e[23]!==o||e[24]!==n.id||e[25]!==a?(v=m=>{const M=[];return m.isBuiltin||(m.allowsAllStaticPermissions?M.push("Full org access"):m.staticPermissionCount&&m.staticPermissionCount>0&&M.push(`${m.staticPermissionCount} org perm${m.staticPermissionCount!==1?"s":""}`),m.allowsAllConnections?M.push("All connections"):m.connectionCount&&m.connectionCount>0&&M.push(`${m.connectionCount} connection${m.connectionCount!==1?"s":""}`),(m.connectionCount!==0||m.allowsAllConnections)&&(m.allowsAllTools?M.push("all tools"):m.toolCount&&m.toolCount>0&&M.push(`${m.toolCount} tool${m.toolCount!==1?"s":""}`))),t.jsxs(Ke,{onClick:V=>{V.stopPropagation(),a(n.id,m.role)},disabled:o,children:[m.isBuiltin?t.jsx(ms,{size:16}):t.jsx(ot,{size:16}),t.jsxs("span",{className:"flex flex-col",children:[t.jsx("span",{children:m.label}),!m.isBuiltin&&M.length>0&&t.jsx("span",{className:"text-xs text-muted-foreground",children:M.join(", ")})]})]},m.role)},e[23]=o,e[24]=n.id,e[25]=a,e[26]=v):v=e[26],I=E.map(v),e[0]=x,e[1]=o,e[2]=n.id,e[3]=n.role,e[4]=a,e[5]=l,e[6]=y,e[7]=f,e[8]=T,e[9]=d,e[10]=I,e[11]=u,e[12]=j,e[13]=p,e[14]=C}else y=e[6],f=e[7],T=e[8],d=e[9],I=e[10],u=e[11],j=e[12],p=e[13],C=e[14];let g;e[27]!==y||e[28]!==I?(g=t.jsx(y,{children:I}),e[27]=y,e[28]=I,e[29]=g):g=e[29];let c;e[30]!==f||e[31]!==u||e[32]!==g?(c=t.jsxs(f,{children:[u,g]}),e[30]=f,e[31]=u,e[32]=g,e[33]=c):c=e[33];let N;e[34]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(et,{}),e[34]=N):N=e[34];let S;e[35]!==n.id||e[36]!==r?(S=L=>{L.stopPropagation(),r(n.id)},e[35]=n.id,e[36]=r,e[37]=S):S=e[37];let P;e[38]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(Os,{size:16}),e[38]=P):P=e[38];let w;e[39]!==S?(w=t.jsxs(Ke,{variant:"destructive",onClick:S,children:[P,"Remove Member"]}),e[39]=S,e[40]=w):w=e[40];let O;e[41]!==T||e[42]!==w||e[43]!==j||e[44]!==p||e[45]!==c?(O=t.jsxs(T,{align:j,onClick:p,children:[c,N,w]}),e[41]=T,e[42]=w,e[43]=j,e[44]=p,e[45]=c,e[46]=O):O=e[46];let A;return e[47]!==d||e[48]!==O||e[49]!==C?(A=t.jsxs(d,{children:[C,O]}),e[47]=d,e[48]=O,e[49]=C,e[50]=A):A=e[50],A}function Dt(s){return s.stopPropagation()}function Bt(s){return s.stopPropagation()}function ys(s){const e=de.c(8),{invitationId:n,onCancel:l,isCancelling:a}=s,r=a===void 0?!1:a;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(cs,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Ut,children:t.jsx(Rs,{size:20})})}),e[0]=h):h=e[0];let o;e[1]!==n||e[2]!==l?(o=f=>{f.stopPropagation(),l(n)},e[1]=n,e[2]=l,e[3]=o):o=e[3];let x;e[4]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(tt,{size:16}),e[4]=x):x=e[4];let y;return e[5]!==r||e[6]!==o?(y=t.jsxs(as,{children:[h,t.jsx(ds,{align:"end",onClick:Gt,children:t.jsxs(Ke,{variant:"destructive",onClick:o,disabled:r,children:[x,"Cancel Invitation"]})})]}),e[5]=r,e[6]=o,e[7]=y):y=e[7],y}function Gt(s){return s.stopPropagation()}function Ut(s){return s.stopPropagation()}function Vt(){const s=de.c(74),{data:e}=os(),{data:n}=Rt(),l=_t(),a=qe(),{locator:r}=Ce(),[h,o]=U.useState(null),[x,y]=U.useState(null),[f,T]=U.useState(""),[d,I]=U.useState("table"),[u,j]=U.useState("member"),[p,C]=U.useState("asc"),g=e?.data?.members;let c;s[0]!==u?(c=R=>{u===R?C(sn):(j(R),C("asc"))},s[0]=u,s[1]=c):c=s[1];const N=c;let S=g??[],P=n??[];if(f){const R=f.toLowerCase();S=S.filter(G=>G.user?.name?.toLowerCase().includes(R)||G.user?.email?.toLowerCase().includes(R)||G.role?.toLowerCase().includes(R)),P=P.filter(G=>G.email?.toLowerCase().includes(R)||G.role?.toLowerCase().includes(R))}if(u&&p){let R;s[2]!==p||s[3]!==u?(R=(G,H)=>{let ce,Ne;e:switch(u){case"member":{ce=G.user?.name||"",Ne=H.user?.name||"";break e}case"role":{ce=G.role||"",Ne=H.role||"";break e}case"joined":{ce=G.createdAt?typeof G.createdAt=="string"?G.createdAt:G.createdAt.toISOString():"",Ne=H.createdAt?typeof H.createdAt=="string"?H.createdAt:H.createdAt.toISOString():"";break e}default:return 0}return p==="asc"?ce.localeCompare(Ne):Ne.localeCompare(ce)},s[2]=p,s[3]=u,s[4]=R):R=s[4],S=[...S].sort(R)}const w=S;let O;s[5]!==r||s[6]!==a?(O={mutationFn:en,onSuccess:()=>{a.invalidateQueries({queryKey:oe.members(r)}),J.success("Member has been removed from the organization"),o(null)},onError:Xt},s[5]=r,s[6]=a,s[7]=O):O=s[7];const A=fe(O);let L;s[8]!==r||s[9]!==a?(L={mutationFn:Jt,onSuccess:()=>{a.invalidateQueries({queryKey:oe.members(r)}),J.success("Member's role has been updated")},onError:Ht},s[8]=r,s[9]=a,s[10]=L):L=s[10];const E=fe(L);let _;s[11]!==r||s[12]!==a?(_={mutationFn:Wt,onSuccess:()=>{a.invalidateQueries({queryKey:oe.invitations(r)}),J.success("Invitation role has been updated")},onError:Yt},s[11]=r,s[12]=a,s[13]=_):_=s[13];const z=fe(_),{roles:v,customRoles:m}=us();let M;s[14]!==m?(M=zt(m),s[14]=m,s[15]=M):M=s[15];const V=M;let se;s[16]!==v?(se=v.filter(Zt),s[16]=v,s[17]=se):se=s[17];const F=se;let K;s[18]===Symbol.for("react.memo_cache_sentinel")?(K={id:"member",header:"Member",render:qt,cellClassName:"flex-1 min-w-0",sortable:!0},s[18]=K):K=s[18];let Q;s[19]!==V||s[20]!==F||s[21]!==z||s[22]!==E?(Q={id:"role",header:"Role",render:R=>R.type==="member"?t.jsx(Fe,{role:R.data.role,memberId:R.data.id,isOwner:R.data.role==="owner",roleColorMap:V,selectableRoles:F,onRoleChange:(G,H)=>E.mutate({memberId:G,role:H}),className:"w-36"}):t.jsx(Fe,{role:R.data.role,memberId:R.data.id,isOwner:!1,roleColorMap:V,selectableRoles:F,onRoleChange:(G,H)=>z.mutate({invitationId:G,role:H,email:R.data.email}),className:"w-36"}),cellClassName:"w-36 shrink-0",sortable:!0},s[19]=V,s[20]=F,s[21]=z,s[22]=E,s[23]=Q):Q=s[23];let Y;s[24]===Symbol.for("react.memo_cache_sentinel")?(Y={id:"joined",header:"Joined",render:Qt,cellClassName:"w-48 shrink-0",sortable:!0},s[24]=Y):Y=s[24];let ne;s[25]!==l.cancel.isPending||s[26]!==v||s[27]!==E?(ne={id:"actions",header:"",render:R=>R.type==="member"?t.jsx(vs,{member:R.data,roles:v,onChangeRole:(G,H)=>E.mutate({memberId:G,role:H}),onRemove:o,isUpdating:E.isPending}):t.jsx(ys,{invitationId:R.data.id,onCancel:y,isCancelling:l.cancel.isPending}),cellClassName:"w-12 shrink-0"},s[25]=l.cancel.isPending,s[26]=v,s[27]=E,s[28]=ne):ne=s[28];let te;s[29]!==Q||s[30]!==ne?(te=[K,Q,Y,ne],s[29]=Q,s[30]=ne,s[31]=te):te=s[31];const D=te;let i;s[32]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(wt,{trigger:t.jsxs(ee,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:[t.jsx(ms,{size:16}),"Manage Roles"]})}),s[32]=i):i=s[32];let b;s[33]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsxs("div",{className:"flex items-center gap-2",children:[i,t.jsx(Ot,{trigger:t.jsx(ee,{size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Invite Member"})})]}),s[33]=b):b=s[33];const $=b,le=[...w.map(Kt),...P.filter(Ft).map($t)],re=es,W=!!x;let q;s[34]===Symbol.for("react.memo_cache_sentinel")?(q=()=>y(null),s[34]=q):q=s[34];let me;s[35]===Symbol.for("react.memo_cache_sentinel")?(me=t.jsxs(Ae,{children:[t.jsx(Oe,{children:"Cancel Invitation"}),t.jsx(Re,{children:"Are you sure you want to cancel this invitation? The invitee will no longer be able to join the organization with this invitation."})]}),s[35]=me):me=s[35];let k;s[36]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(Pe,{children:"Keep Invitation"}),s[36]=k):k=s[36];let B;s[37]!==l.cancel||s[38]!==x?(B=()=>{x&&(l.cancel.mutate(x),y(null))},s[37]=l.cancel,s[38]=x,s[39]=B):B=s[39];let Z;s[40]!==l.cancel.isPending||s[41]!==B?(Z=t.jsxs(Te,{children:[me,t.jsxs(_e,{children:[k,t.jsx(Le,{onClick:B,disabled:l.cancel.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Cancel Invitation"})]})]}),s[40]=l.cancel.isPending,s[41]=B,s[42]=Z):Z=s[42];let ae;s[43]!==W||s[44]!==Z?(ae=t.jsx(we,{open:W,onOpenChange:q,children:Z}),s[43]=W,s[44]=Z,s[45]=ae):ae=s[45];const Ye=!!h;let Me;s[46]===Symbol.for("react.memo_cache_sentinel")?(Me=()=>o(null),s[46]=Me):Me=s[46];let ze;s[47]===Symbol.for("react.memo_cache_sentinel")?(ze=t.jsxs(Ae,{children:[t.jsx(Oe,{children:"Remove Member"}),t.jsx(Re,{children:"Are you sure you want to remove this member from the organization? This action cannot be undone."})]}),s[47]=ze):ze=s[47];let ke;s[48]===Symbol.for("react.memo_cache_sentinel")?(ke=t.jsx(Pe,{children:"Cancel"}),s[48]=ke):ke=s[48];let he;s[49]!==h||s[50]!==A?(he=()=>h&&A.mutate(h),s[49]=h,s[50]=A,s[51]=he):he=s[51];let ge;s[52]!==A.isPending||s[53]!==he?(ge=t.jsxs(Te,{children:[ze,t.jsxs(_e,{children:[ke,t.jsx(Le,{onClick:he,disabled:A.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),s[52]=A.isPending,s[53]=he,s[54]=ge):ge=s[54];let xe;s[55]!==Ye||s[56]!==ge?(xe=t.jsx(we,{open:Ye,onOpenChange:Me,children:ge}),s[55]=Ye,s[56]=ge,s[57]=xe):xe=s[57];let De;s[58]===Symbol.for("react.memo_cache_sentinel")?(De=[{id:"member",label:"Name"},{id:"role",label:"Role"},{id:"joined",label:"Joined"}],s[58]=De):De=s[58];let pe;s[59]!==N||s[60]!==p||s[61]!==u||s[62]!==d?(pe=t.jsx(Bs,{title:"Members",viewMode:d,onViewModeChange:I,sortKey:u,sortDirection:p,onSort:N,sortOptions:De,ctaButton:$}),s[59]=N,s[60]=p,s[61]=u,s[62]=d,s[63]=pe):pe=s[63];let Be;s[64]===Symbol.for("react.memo_cache_sentinel")?(Be=R=>{R.key==="Escape"&&(T(""),R.target.blur())},s[64]=Be):Be=s[64];let be;s[65]!==f?(be=t.jsx(Ze,{value:f,onChange:T,placeholder:"Search members...",onKeyDown:Be}),s[65]=f,s[66]=be):be=s[66];const We=d==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:le.length===0?t.jsx(Je,{title:"No members found",description:f?`No members match "${f}"`:"Invite members to get started."}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:le.map(R=>{if(R.type==="invitation")return t.jsxs(js,{className:"transition-colors relative opacity-75",children:[t.jsx("div",{className:"absolute top-4 right-4 z-10",children:t.jsx(ys,{invitationId:R.data.id,onCancel:y,isCancelling:l.cancel.isPending})}),t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(je,{fallback:Qe(R.data.email),shape:"circle",size:"lg",className:"shrink-0"}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:R.data.email}),t.jsx("div",{className:"flex items-center gap-2",children:t.jsx(Se,{variant:"outline",className:"w-fit text-amber-600 border-amber-400",children:"Pending"})}),t.jsx(Fe,{role:R.data.role,memberId:R.data.id,isOwner:!1,roleColorMap:V,selectableRoles:F,onRoleChange:(H,ce)=>z.mutate({invitationId:H,role:ce,email:R.data.email}),className:"w-fit"})]})]})]},`inv-${R.data.id}`);const G=R.data;return t.jsxs(js,{className:"transition-colors relative",children:[t.jsx("div",{className:"absolute top-4 right-4 z-10",children:t.jsx(vs,{member:G,roles:v,onChangeRole:(H,ce)=>E.mutate({memberId:H,role:ce}),onRemove:o,isUpdating:E.isPending})}),t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(je,{url:G.user?.image??void 0,fallback:Qe(G.user?.name),shape:"circle",size:"lg",className:"shrink-0"}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:G.user?.name||"Unknown"}),t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:G.user?.email}),t.jsx(Fe,{role:G.role,memberId:G.id,isOwner:G.role==="owner",roleColorMap:V,selectableRoles:F,onRoleChange:(H,ce)=>E.mutate({memberId:H,role:ce}),className:"w-fit"})]})]})]},G.id)})})}):t.jsx(Gs,{columns:D,data:le,isLoading:!1,sortKey:u,sortDirection:p,onSort:N,emptyState:f?t.jsx(Je,{title:"No members found",description:`No members match "${f}"`}):t.jsx(Je,{title:"No members found",description:"Invite members to get started."})});let Ge;return s[67]!==re||s[68]!==ae||s[69]!==xe||s[70]!==pe||s[71]!==be||s[72]!==We?(Ge=t.jsxs(re,{children:[ae,xe,pe,be,We]}),s[67]=re,s[68]=ae,s[69]=xe,s[70]=pe,s[71]=be,s[72]=We,s[73]=Ge):Ge=s[73],Ge}function $t(s){return{type:"invitation",data:s}}function Ft(s){return s.status==="pending"}function Kt(s){return{type:"member",data:s}}function Qt(s){return s.type==="member"?t.jsx("span",{className:"text-sm text-foreground",children:s.data.createdAt?kt(s.data.createdAt):"N/A"}):t.jsx(Se,{variant:"outline",children:"Pending"})}function qt(s){return s.type==="member"?t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(je,{url:s.data.user?.image??void 0,fallback:Qe(s.data.user?.name),shape:"circle",size:"sm"}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:s.data.user?.name||"Unknown"}),t.jsx("div",{className:"text-sm text-muted-foreground truncate",children:s.data.user?.email})]})]}):t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(je,{fallback:Qe(s.data.email),shape:"circle",size:"sm"}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:s.data.email}),t.jsx("div",{className:"text-sm text-muted-foreground truncate",children:"Invitation sent"})]})]})}function Zt(s){return s.role!=="owner"}function Yt(s){J.error(s instanceof Error?s.message:"Failed to update invitation role")}async function Wt(s){const{invitationId:e,role:n,email:l}=s,a=await X.organization.cancelInvitation({invitationId:e});if(a?.error)throw new Error(a.error.message);const r=await X.organization.inviteMember({email:l,role:n});if(r?.error)throw new Error(r.error.message)}function Ht(s){J.error(s instanceof Error?s.message:"Failed to update role")}async function Jt(s){const{memberId:e,role:n}=s,l=await X.organization.updateMemberRole({memberId:e,role:[n]});if(l?.error)throw new Error(l.error.message)}function Xt(s){J.error(s instanceof Error?s.message:"Failed to remove member")}async function en(s){const e=await X.organization.removeMember({memberIdOrEmail:s});if(e?.error)throw new Error(e.error.message)}function sn(s){return s==="asc"?"desc":s==="desc"?null:"asc"}function Dn(){const s=de.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(es,{children:t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load members"})})}),s[0]=e):e=s[0];let n;return s[1]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(it,{fallback:e,children:t.jsx(U.Suspense,{fallback:t.jsx(es,{children:t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx(As,{size:32,className:"animate-spin text-muted-foreground"})})}),children:t.jsx(Vt,{})})}),s[1]=n):n=s[1],n}export{Dn as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as o,h as i}from"./core-9I4ovOKa.js";import{aj as s}from"./index-OjgkLDRY.js";var g=o();const t=s(g);var e=i(t,{});e.registerLanguage=function(a,r){return t.register(r)};e.alias=function(a,r){return t.alias(a,r)};export{e as default};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import{r as w,c as x,j as a,e as at,d as ce,K as je,t as ne,f as lt,g as ae,a as J,R as it,T as rt,D as ct,C as dt,P as ut,h as mt,O as ft,i as ht,k as pt,l as xt,m as gt,G as bt,U as vt,n as jt,S as we,o as wt,p as St,N as yt,q as Ct,s as Se}from"./index-OjgkLDRY.js";import{g as Nt}from"./generate-id-Dyweu44Y.js";import{i as _t,E as kt}from"./SearchMd-3Wd2TwbA.js";import{u as It,a as $t,I as he,n as Tt}from"./use-connection-Bva8lo0T.js";import{u as Z,L as ee}from"./localstorage-keys-BKdNuRRM.js";import{u as q,T as Mt,a as Ot,b as zt,c as Dt,L as pe,i as At,P as Pt,O as Rt}from"./tooltip-BNR213_s.js";import{c as $,B as W}from"./button--R5o0wL7.js";import{i as ie}from"./CpuChip02-DMyGj-Z2.js";import{i as Et}from"./Loading01-lzLKWums.js";import{s as Lt}from"./Plus-Bl6yi8F8.js";import{i as oe}from"./X-Cp1i89ho.js";import{u as Ht}from"./use-binding-BA2o2u6B.js";import{u as Ut,a as Bt,b as Gt,c as Wt,d as Vt,C as A,e as Ft,I as Kt,D as Yt,f as Zt,g as qt,h as Qt,i as Xt,j as Jt,R as ye,k as es,l as ts,m as ss}from"./resizable-DvxvrPoQ.js";import{E as de}from"./error-boundary-BP-NCqAa.js";import{P as Ce,a as Ne,b as _e}from"./popover-DtFzalb2.js";import{s as ns}from"./Clock-hKESOc1Y.js";import{s as os}from"./Trash01-DtytfnvM.js";import{i as as}from"./File06-Cdqoedhj.js";import{u as te}from"./use-mobile--3nyeV_n.js";import{u as ke,a as ls}from"./use-organization-settings-CRu5FU7t.js";import{C as is}from"./create-organization-dialog-DqGippHf.js";import{I as rs}from"./input-DkUxKlvC.js";import{A as Q}from"./avatar-Cca1j58d.js";import{c as cs,D as ds,a as us,b as ms,d as fs,e as xe}from"./dropdown-menu-CvIw74N_.js";import{a as hs}from"./Copy01-Cfsho8qu.js";import{n as ge}from"./LinkExternal01-I-KzAQEJ.js";import{D as Ie,a as $e,b as Te,c as Me,d as Oe}from"./dialog-DlJAicu4.js";import"./useQuery-CJBdsmlt.js";import"./auth-BYQ5JBPH.js";import"./select-BbFQz4Zb.js";import"./ChevronDown-293zKGHe.js";import"./use-gateway-BR-Csw6g.js";import"./AlertCircle-CDFxkn8P.js";import"./Terminal-DTrkBKv1.js";import"./connection-card-CdAxVoxf.js";import"./card-DV2_nXad.js";import"./spinner-D3PlZpfm.js";import"./InfoCircle-BXqyuDnq.js";import"./alert-dialog-T6AiZUB1.js";import"./form-B7S8d6pb.js";const ze=({size:t=24,color:e="currentColor",...s})=>w.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},w.createElement("path",{d:"M9 7H4.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C3 7.76 3 8.04 3 8.6v10.8c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C3.76 21 4.04 21 4.6 21H9m0 0h6m-6 0V4.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C9.76 3 10.04 3 10.6 3h2.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C15 3.76 15 4.04 15 4.6V21m0-10h4.4c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C21 11.76 21 12.04 21 12.6v6.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C20.24 21 19.96 21 19.4 21H15"}));ze.displayName="BarChart10";const De=({size:t=24,color:e="currentColor",...s})=>w.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},w.createElement("path",{d:"M15 21v-5.4c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C14.24 14 13.96 14 13.4 14h-2.8c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C9 14.76 9 15.04 9 15.6V21M3 7a3 3 0 0 0 6 0 3 3 0 1 0 6 0 3 3 0 1 0 6 0M6.2 21h11.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C21 19.48 21 18.92 21 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C19.48 3 18.92 3 17.8 3H6.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C3 4.52 3 5.08 3 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C4.52 21 5.08 21 6.2 21Z"}));De.displayName="Building02";const Ae=({size:t=24,color:e="currentColor",...s})=>w.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},w.createElement("path",{d:"m7 15 5 5 5-5M7 9l5-5 5 5"}));Ae.displayName="ChevronSelectorVertical";const Pe=({size:t=24,color:e="currentColor",...s})=>w.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},w.createElement("path",{d:"M2 12h20M2 12c0 5.523 4.477 10 10 10M2 12C2 6.477 6.477 2 12 2m10 10c0 5.523-4.477 10-10 10m10-10c0-5.523-4.477-10-10-10m0 0a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10m0-20a15.3 15.3 0 0 0-4 10 15.3 15.3 0 0 0 4 10"}));Pe.displayName="Globe01";const Re=({size:t=24,color:e="currentColor",...s})=>w.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},w.createElement("path",{d:"M9 21v-7.4c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C9.76 12 10.04 12 10.6 12h2.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C15 12.76 15 13.04 15 13.6V21M11.018 2.764 4.235 8.039c-.453.353-.68.53-.843.75a2 2 0 0 0-.318.65C3 9.704 3 9.991 3 10.565V17.8c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C4.52 21 5.08 21 6.2 21h11.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C21 19.48 21 18.92 21 17.8v-7.235c0-.574 0-.861-.074-1.126a2.002 2.002 0 0 0-.318-.65c-.163-.22-.39-.397-.843-.75l-6.783-5.275c-.351-.273-.527-.41-.72-.462a1 1 0 0 0-.523 0c-.194.052-.37.189-.721.462Z"}));Re.displayName="Home02";const Ee=({size:t=24,color:e="currentColor",...s})=>w.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},w.createElement("path",{d:"M15 3v18M7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3Z"}));Ee.displayName="LayoutRight";const Le=({size:t=24,color:e="currentColor",...s})=>w.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},w.createElement("path",{d:"m16 17 5-5m0 0-5-5m5 5H9m0-9H7.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C3 5.28 3 6.12 3 7.8v8.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C5.28 21 6.12 21 7.8 21H9"}));Le.displayName="LogOut01";const He=({size:t=24,color:e="currentColor",...s})=>w.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},w.createElement("path",{d:"m2 7 8.165 5.715c.661.463.992.695 1.351.784a2 2 0 0 0 .968 0c.36-.09.69-.32 1.351-.784L22 7M6.8 20h10.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C22 17.72 22 16.88 22 15.2V8.8c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C19.72 4 18.88 4 17.2 4H6.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C2 6.28 2 7.12 2 8.8v6.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C4.28 20 5.12 20 6.8 20Z"}));He.displayName="Mail01";const Ue=({size:t=24,color:e="currentColor",...s})=>w.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},w.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}),w.createElement("path",{d:"M18.727 14.727a1.5 1.5 0 0 0 .3 1.655l.055.054a1.816 1.816 0 0 1 0 2.573 1.818 1.818 0 0 1-2.573 0l-.055-.055a1.5 1.5 0 0 0-1.654-.3 1.5 1.5 0 0 0-.91 1.373v.155a1.818 1.818 0 1 1-3.636 0V20.1a1.5 1.5 0 0 0-.981-1.373 1.5 1.5 0 0 0-1.655.3l-.054.055a1.818 1.818 0 0 1-3.106-1.287 1.818 1.818 0 0 1 .533-1.286l.054-.055a1.5 1.5 0 0 0 .3-1.654 1.5 1.5 0 0 0-1.372-.91h-.155a1.818 1.818 0 1 1 0-3.636H3.9a1.5 1.5 0 0 0 1.373-.981 1.5 1.5 0 0 0-.3-1.655l-.055-.054A1.818 1.818 0 1 1 7.491 4.99l.054.054a1.5 1.5 0 0 0 1.655.3h.073a1.5 1.5 0 0 0 .909-1.372v-.155a1.818 1.818 0 0 1 3.636 0V3.9a1.499 1.499 0 0 0 .91 1.373 1.5 1.5 0 0 0 1.654-.3l.054-.055a1.817 1.817 0 0 1 2.573 0 1.819 1.819 0 0 1 0 2.573l-.055.054a1.5 1.5 0 0 0-.3 1.655v.073a1.5 1.5 0 0 0 1.373.909h.155a1.818 1.818 0 0 1 0 3.636H20.1a1.499 1.499 0 0 0-1.373.91Z"}));Ue.displayName="Settings01";const Be=({size:t=24,color:e="currentColor",...s})=>w.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},w.createElement("path",{d:"M5.316 19.438A4.001 4.001 0 0 1 9 17h6a4.001 4.001 0 0 1 3.684 2.438M16 9.5a4 4 0 1 1-8 0 4 4 0 0 1 8 0Zm6 2.5c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));Be.displayName="UserCircle";const Ge=({size:t=24,color:e="currentColor",...s})=>w.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},w.createElement("path",{d:"M22 21v-2a4.002 4.002 0 0 0-3-3.874M15.5 3.291a4.001 4.001 0 0 1 0 7.418M17 21c0-1.864 0-2.796-.305-3.53a4 4 0 0 0-2.164-2.165C13.796 15 12.864 15 11 15H8c-1.864 0-2.796 0-3.53.305a4 4 0 0 0-2.166 2.164C2 18.204 2 19.136 2 21M13.5 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z"}));Ge.displayName="Users01";function ue(){const t=x.c(4);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=ee.decoChatOpen(),t[0]=e):e=t[0];const[s,o]=Z(e,ps);let n;return t[1]!==s||t[2]!==o?(n=[s,o],t[1]=s,t[2]=o,t[3]=n):n=t[3],n}function ps(t){return!!(t??!1)}function xs(t){const e=x.c(14),{title:s,description:o,avatar:n,avatarNode:l,className:i}=t,r=s===void 0?"Start a conversation":s;let c;e[0]!==i?(c=$("flex flex-col items-center justify-center gap-4 p-0 text-center",i),e[0]=i,e[1]=c):c=e[1];let d;e[2]!==n||e[3]!==l?(d=l||n&&a.jsx("img",{src:n,alt:"Chat avatar",className:"size-[60px] rounded-[18px] border-[1.875px] border-border/10"}),e[2]=n,e[3]=l,e[4]=d):d=e[4];let u;e[5]!==r?(u=r&&a.jsx("h3",{className:"text-xl font-medium text-foreground",children:r}),e[5]=r,e[6]=u):u=e[6];let m;e[7]!==o?(m=o&&a.jsx("div",{className:"text-muted-foreground text-center text-sm max-w-md",children:o}),e[7]=o,e[8]=m):m=e[8];let f;return e[9]!==c||e[10]!==d||e[11]!==u||e[12]!==m?(f=a.jsxs("div",{className:c,children:[d,u,m]}),e[9]=c,e[10]=d,e[11]=u,e[12]=m,e[13]=f):f=e[13],f}function gs(){const t=x.c(5),e=at(),{org:s}=q();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},t[0]=o):o=t[0];const n=ce(o);let l;return t[1]!==s||t[2]!==n||t[3]!==e?(l=i=>{const c=i.toolCall.toolName.match(/^COLLECTION_([A-Z_]+)_(CREATE|UPDATE|DELETE)$/);if(!c||!c[1])return;const d=c[1],u=n.connectionId;if(!u)return;e.invalidateQueries({queryKey:je.collection(s.slug,u,d)});const m=d.toLowerCase().replace(/_/g," ");ne.success(`${m} updated`)},t[1]=s,t[2]=n,t[3]=e,t[4]=l):l=t[4],l}function bs(t){const e=/\/[^/]+\/mcps\/([^/]+)\/([^/]+)\/([^/]+)/,s=t.match(e);return s&&s[1]&&s[2]&&s[3]?{connectionId:decodeURIComponent(s[1]),collectionName:decodeURIComponent(s[2]),itemId:decodeURIComponent(s[3])}:{connectionId:null,collectionName:null,itemId:null}}function vs(){const t=x.c(2),e=lt();let s;t[0]!==e.location.pathname?(s=bs(e.location.pathname),t[0]=e.location.pathname,t[1]=s):s=t[1];const{connectionId:o,collectionName:n,itemId:l}=s;return`You are an AI assistant running in an MCP Mesh environment.
|
|
2
|
-
|
|
3
|
-
## About MCP Mesh
|
|
4
|
-
The Model Context Protocol (MCP) Mesh allows users to connect external MCP servers and expose their capabilities through gateways. Each gateway provides access to a curated set of tools from connected MCP servers.
|
|
5
|
-
|
|
6
|
-
## Important Notes
|
|
7
|
-
- All tool calls are logged and audited for security and compliance
|
|
8
|
-
- You have access to the tools exposed through the selected gateway
|
|
9
|
-
- MCPs may expose resources that users can browse and edit
|
|
10
|
-
|
|
11
|
-
## Current Editing Context
|
|
12
|
-
${o?`- Connection ID: ${o}`:""}
|
|
13
|
-
${n?`- Collection Name: ${n}`:""}
|
|
14
|
-
${l?`- Item ID: ${l}`:""}
|
|
15
|
-
|
|
16
|
-
Help the user understand and work with this resource.
|
|
17
|
-
`}const We=()=>crypto.randomUUID(),Ve=w.createContext(null);function js(t){const e=x.c(15),{children:s}=t,{locator:o}=q(),n=Ut(),[l,i]=Z(ee.threadManagerState(o)+":active-id",ws);let r;e[0]!==i||e[1]!==n?(r=h=>{const v=h?.id||crypto.randomUUID(),g=new Date().toISOString(),b={id:v,title:h?.title||"",created_at:h?.created_at||g,updated_at:h?.updated_at||g,hidden:h?.hidden??!1};return n.insert.mutate(b),i(v),b},e[0]=i,e[1]=n,e[2]=r):r=e[2];const c=r;let d;e[3]!==l||e[4]!==i||e[5]!==n?(d=h=>{n.update.mutate({id:h,updates:{hidden:!0,updated_at:new Date().toISOString()}}),l===h&&i(We())},e[3]=l,e[4]=i,e[5]=n,e[6]=d):d=e[6];const u=d;let m;e[7]!==l||e[8]!==c||e[9]!==u||e[10]!==i?(m={activeThreadId:l,createThread:c,setActiveThreadId:i,hideThread:u},e[7]=l,e[8]=c,e[9]=u,e[10]=i,e[11]=m):m=e[11];const f=m;let p;return e[12]!==s||e[13]!==f?(p=a.jsx(Ve.Provider,{value:f,children:s}),e[12]=s,e[13]=f,e[14]=p):p=e[14],p}function ws(t){return t||We()}function Ss(){const t=w.useContext(Ve);if(!t)throw new Error("useChat must be used within a ChatProvider");return t}function ys(t){const e=new Date(t),o=new Date().getTime()-e.getTime(),n=Math.floor(o/6e4),l=Math.floor(o/36e5);return n<1?"now":n<60?`${n}m`:`${l}h`}function Cs(t){const e=new Date,s=new Date(e.getFullYear(),e.getMonth(),e.getDate()),o=new Date(s.getTime()-864e5),n=new Date(s.getTime()-7*864e5),l=new Date(s.getTime()-30*864e5),i=[],r=[],c=[],d=[],u=[];for(const f of t){const p=new Date(f.updated_at);p>=s?i.push(f):p>=o?r.push(f):p>=n?c.push(f):p>=l?d.push(f):u.push(f)}const m=[];return i.length>0&&m.push({label:"Today",threads:i,showRelativeTime:!0}),r.length>0&&m.push({label:"Yesterday",threads:r,showRelativeTime:!1}),c.length>0&&m.push({label:"7 days ago",threads:c,showRelativeTime:!1}),d.length>0&&m.push({label:"30 days ago",threads:d,showRelativeTime:!1}),u.length>0&&m.push({label:"Older",threads:u,showRelativeTime:!1}),m}function Ns(t){const e=x.c(36),{threads:s,activeThreadId:o,onSelectThread:n,onRemoveThread:l,onOpen:i}=t,[r,c]=w.useState("");let d,u,m,f,p,h,v,g,b;if(e[0]!==o||e[1]!==i||e[2]!==l||e[3]!==n||e[4]!==r||e[5]!==s){const y=r.trim()?s.filter(T=>(T.title||"New chat").toLowerCase().includes(r.toLowerCase())):s,N=Cs(y);let _;e[15]!==i?(_=T=>{T?i?.():c("")},e[15]=i,e[16]=_):_=e[16];const z=_;u=Ce,g=z,e[17]===Symbol.for("react.memo_cache_sentinel")?(b=a.jsx(Ne,{asChild:!0,children:a.jsx("button",{type:"button",className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent group cursor-pointer",title:"Chat history",children:a.jsx(ns,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"})})}),e[17]=b):b=e[17],d=_e,p="end",h="w-80 p-0";let k;e[18]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx(_t,{size:16,className:"text-muted-foreground shrink-0"}),e[18]=k):k=e[18];let M;e[19]===Symbol.for("react.memo_cache_sentinel")?(M=T=>c(T.target.value),e[19]=M):M=e[19],e[20]!==r?(v=a.jsx("div",{className:"border-b",children:a.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 cursor-text",children:[k,a.jsx("input",{type:"text",placeholder:"Search chats...",value:r,onChange:M,className:"flex-1 border-0 shadow-none focus:outline-none px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"})]})}),e[20]=r,e[21]=v):v=e[21],m="max-h-[300px] overflow-y-auto",f=y.length===0?a.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:r.trim()?"No chats found":"No chats yet"}):N.map((T,O)=>a.jsxs("div",{children:[O>0&&a.jsx("div",{className:"border-t mx-3"}),a.jsx("div",{className:"px-3 py-1",children:a.jsx("span",{className:"text-xs font-medium text-muted-foreground tracking-wide",children:T.label})}),T.threads.map(D=>{const V=D.id===o;return a.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 hover:bg-accent cursor-pointer group ${V?"bg-accent/50":""}`,onClick:()=>n(D.id),children:[a.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[a.jsx("span",{className:"text-sm truncate",children:D.title||"New chat"}),a.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:V?"current":T.showRelativeTime?ys(D.updated_at):null})]}),a.jsx("button",{type:"button",onClick:X=>{X.stopPropagation(),l(D.id)},className:"opacity-0 cursor-pointer group/trash group-hover:opacity-100 p-1 hover:bg-destructive/10 rounded transition-opacity",title:"Remove chat",children:a.jsx(os,{size:14,className:"text-muted-foreground group-hover/trash:text-destructive"})})]},D.id)})]},T.label)),e[0]=o,e[1]=i,e[2]=l,e[3]=n,e[4]=r,e[5]=s,e[6]=d,e[7]=u,e[8]=m,e[9]=f,e[10]=p,e[11]=h,e[12]=v,e[13]=g,e[14]=b}else d=e[6],u=e[7],m=e[8],f=e[9],p=e[10],h=e[11],v=e[12],g=e[13],b=e[14];let j;e[22]!==m||e[23]!==f?(j=a.jsx("div",{className:m,children:f}),e[22]=m,e[23]=f,e[24]=j):j=e[24];let S;e[25]!==d||e[26]!==p||e[27]!==h||e[28]!==v||e[29]!==j?(S=a.jsxs(d,{align:p,className:h,children:[v,j]}),e[25]=d,e[26]=p,e[27]=h,e[28]=v,e[29]=j,e[30]=S):S=e[30];let C;return e[31]!==u||e[32]!==g||e[33]!==b||e[34]!==S?(C=a.jsxs(u,{onOpenChange:g,children:[b,S]}),e[31]=u,e[32]=g,e[33]=b,e[34]=S,e[35]=C):C=e[35],C}const _s="https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png";function ks(){const t=x.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a.jsx("img",{src:"/empty-state-openrouter.svg",alt:"",width:336,height:320,"aria-hidden":"true",className:"w-xs h-auto mask-radial-[100%_100%] mask-radial-from-20% mask-radial-to-50% mask-radial-at-center"}),t[0]=e):e=t[0],e}function Is(t){const e=x.c(3),{gatewayId:s,onSelect:o}=t,{data:n}=Ft(s);if(n.length===0)return null;let l;return e[0]!==o||e[1]!==n?(l=a.jsx(Kt,{prompts:n,onSelect:o,className:"mt-6"}),e[0]=o,e[1]=n,e[2]=l):l=e[2],l}function $s(){const{org:{slug:t,id:e},locator:s}=q(),[,o]=ue(),n=ae(),{data:l}=J.useSession(),i=l?.user,{createThread:r,activeThreadId:c,setActiveThreadId:d,hideThread:u}=Ss(),{threads:m,refetch:f}=Bt(),p=Gt(),h=Wt(),v=It(),[g]=Ht({connections:v,binding:"LLMS"}),b=!!g,j=p.length>0,S=b&&j,[C,y]=Z(ee.chatSelectedModel(s),I=>I??null),[N,_]=Z(`${s}:selected-gateway`,()=>null),z=h[0],k=C??(z?{id:z.id,connectionId:z.connectionId}:null),M=p[0]?.id,T=N?.gatewayId??M,O=p.find(I=>I.id===T),D=h.find(I=>I.id===k?.id&&I.connectionId===k?.connectionId),V=vs(),X=gs(),R=Vt({threadId:c,systemPrompt:V,onToolCall:X,onCreateThread:I=>r({id:I.id,title:I.title})}),K=async I=>{if(!D){ne.error("No model configured");return}const U={created_at:new Date().toISOString(),thread_id:c,model:{id:D.id,connectionId:D.connectionId,provider:D.provider??void 0},gateway:O?{id:O.id}:void 0,user:{avatar:i?.image??void 0,name:i?.name??"you"}};await R.sendMessage(I,U)},B=I=>{y({id:I.id,connectionId:I.connectionId})},[L,F]=w.useState(!1),E=$t(),H=async()=>{if(!e||!i?.id){ne.error("Not authenticated");return}F(!0);try{const I="https://sites-openrouter.decocache.com/mcp",U=v?.find(ot=>ot.connection_url===I);if(U){n({to:"/$org/mcps/$connectionId",params:{org:t,connectionId:U.id}});return}const fe=new Date().toISOString(),st={id:Nt("conn"),title:"OpenRouter",description:"Access hundreds of LLM models from a single API",icon:"https://openrouter.ai/favicon.ico",app_name:"openrouter",app_id:"openrouter",connection_type:"HTTP",connection_url:I,connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{source:"chat",verified:!1,scopeName:"deco",toolsCount:0,publishedAt:null,repository:null},created_at:fe,updated_at:fe,created_by:i.id,organization_id:e,tools:null,bindings:null,status:"inactive"},nt=await E.create.mutateAsync(st);n({to:"/$org/mcps/$connectionId",params:{org:t,connectionId:nt.id}})}catch(I){ne.error(`Failed to connect OpenRouter: ${I instanceof Error?I.message:String(I)}`)}finally{F(!1)}};if(!S){let I,U;return!b&&!j?(I="Connect your providers",U="Connect an LLM provider and create a gateway to unlock AI-powered features."):b?(I="No gateways configured",U="Create a gateway to expose your MCP tools to the chat."):(I="No model provider connected",U="Connect to a model provider to unlock AI-powered features."),a.jsxs(A,{children:[a.jsxs(A.Header,{children:[a.jsxs(A.Header.Left,{children:[a.jsx("img",{src:_s,alt:"deco chat",className:"size-5 rounded"}),a.jsx("span",{className:"text-sm font-medium",children:"deco chat"})]}),a.jsx(A.Header.Right,{children:a.jsx("button",{type:"button",onClick:()=>o(!1),className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent transition-colors group cursor-pointer",title:"Close chat",children:a.jsx(oe,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"})})})]}),a.jsx(A.Main,{className:"flex flex-col items-center",children:a.jsx(A.EmptyState,{children:a.jsx(kt,{image:a.jsx(ks,{}),title:I,description:U,actions:a.jsxs(a.Fragment,{children:[a.jsxs(W,{variant:"outline",onClick:H,disabled:L,children:[a.jsx("img",{src:"https://openrouter.ai/favicon.ico",alt:"OpenRouter",className:"size-4"}),L?"Installing...":"Install OpenRouter"]}),a.jsx(W,{variant:"outline",onClick:()=>n({to:"/$org/mcps",params:{org:t},search:{action:"create"}}),children:"Install MCP Server"})]})})})})]})}const Y=R.messages.filter(I=>I.role!=="system");return a.jsxs(A,{children:[a.jsxs(A.Header,{children:[a.jsxs(A.Header.Left,{children:[a.jsx(he,{icon:O?.icon,name:O?.title||"deco chat",size:"xs",fallbackIcon:a.jsx(ie,{size:12})}),a.jsx("span",{className:"text-sm font-medium",children:O?.title||"deco chat"})]}),a.jsxs(A.Header.Right,{children:[a.jsx("button",{type:"button",onClick:()=>r(),className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent group cursor-pointer",title:"New chat",children:a.jsx(Lt,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"})}),a.jsx(Ns,{threads:m,activeThreadId:c,onSelectThread:d,onRemoveThread:u,onOpen:()=>f()}),a.jsx("button",{type:"button",onClick:()=>o(!1),className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent transition-colors group cursor-pointer",title:"Close chat",children:a.jsx(oe,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"})})]})]}),a.jsx(A.Main,{children:Y.length===0?a.jsx(A.EmptyState,{children:a.jsxs("div",{className:"flex flex-col items-center gap-6 w-full px-4",children:[a.jsx(xs,{title:O?.title||"Ask deco chat",description:O?.description??"Ask anything about configuring model providers or using MCP Mesh.",avatarNode:a.jsx(he,{icon:O?.icon,name:O?.title||"deco chat",size:"lg",fallbackIcon:a.jsx(ie,{size:32}),className:"size-[60px]! rounded-[18px]!"})}),T&&a.jsx(de,{fallback:null,children:a.jsx(w.Suspense,{fallback:a.jsx("div",{className:"flex justify-center",children:a.jsx(Et,{size:20,className:"animate-spin text-muted-foreground"})}),children:a.jsx(Is,{gatewayId:T,onSelect:I=>{K(I.description??I.name)}})})},T)]})}):a.jsx(A.Messages,{messages:R.messages,status:R.status,minHeightOffset:240})}),a.jsx(A.Footer,{children:a.jsx("div",{children:a.jsxs(A.Input,{onSubmit:K,onStop:R.stop,disabled:h.length===0||!k,isStreaming:R.status==="submitted"||R.status==="streaming",placeholder:h.length===0?"Add an LLM binding connection to start chatting":"Ask anything or @ for context",usageMessages:R.messages,children:[a.jsx(A.Input.GatewaySelector,{disabled:!1,selectedGatewayId:T,onGatewayChange:I=>{I&&_({gatewayId:I})}}),a.jsx(A.Input.ModelSelector,{disabled:!1,selectedModel:k??void 0,onModelChange:B})]})})})]})}function Ts(t){const e=x.c(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let o;return e[2]!==s?(o=a.jsx(it,{"data-slot":"sheet",...s}),e[2]=s,e[3]=o):o=e[3],o}function Ms(t){const e=x.c(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let o;return e[2]!==s?(o=a.jsx(ut,{"data-slot":"sheet-portal",...s}),e[2]=s,e[3]=o):o=e[3],o}function Os(t){const e=x.c(8);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let n;e[3]!==s?(n=$("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",s),e[3]=s,e[4]=n):n=e[4];let l;return e[5]!==o||e[6]!==n?(l=a.jsx(ft,{"data-slot":"sheet-overlay",className:n,...o}),e[5]=o,e[6]=n,e[7]=l):l=e[7],l}function zs(t){const e=x.c(17);let s,o,n,l;e[0]!==t?({className:o,children:s,side:l,...n}=t,e[0]=t,e[1]=s,e[2]=o,e[3]=n,e[4]=l):(s=e[1],o=e[2],n=e[3],l=e[4]);const i=l===void 0?"right":l;let r;e[5]===Symbol.for("react.memo_cache_sentinel")?(r=a.jsx(Os,{}),e[5]=r):r=e[5];const c=i==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",d=i==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",u=i==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",m=i==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t";let f;e[6]!==o||e[7]!==c||e[8]!==d||e[9]!==u||e[10]!==m?(f=$("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",c,d,u,m,o),e[6]=o,e[7]=c,e[8]=d,e[9]=u,e[10]=m,e[11]=f):f=e[11];let p;e[12]===Symbol.for("react.memo_cache_sentinel")?(p=a.jsxs(mt,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[a.jsx(oe,{className:"size-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]}),e[12]=p):p=e[12];let h;return e[13]!==s||e[14]!==n||e[15]!==f?(h=a.jsxs(Ms,{children:[r,a.jsxs(dt,{"data-slot":"sheet-content",className:f,...n,children:[s,p]})]}),e[13]=s,e[14]=n,e[15]=f,e[16]=h):h=e[16],h}function Ds(t){const e=x.c(8);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let n;e[3]!==s?(n=$("flex flex-col gap-1.5 p-4",s),e[3]=s,e[4]=n):n=e[4];let l;return e[5]!==o||e[6]!==n?(l=a.jsx("div",{"data-slot":"sheet-header",className:n,...o}),e[5]=o,e[6]=n,e[7]=l):l=e[7],l}function As(t){const e=x.c(8);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let n;e[3]!==s?(n=$("text-foreground font-semibold",s),e[3]=s,e[4]=n):n=e[4];let l;return e[5]!==o||e[6]!==n?(l=a.jsx(rt,{"data-slot":"sheet-title",className:n,...o}),e[5]=o,e[6]=n,e[7]=l):l=e[7],l}function Ps(t){const e=x.c(8);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let n;e[3]!==s?(n=$("text-muted-foreground text-sm",s),e[3]=s,e[4]=n):n=e[4];let l;return e[5]!==o||e[6]!==n?(l=a.jsx(ct,{"data-slot":"sheet-description",className:n,...o}),e[5]=o,e[6]=n,e[7]=l):l=e[7],l}function Fe(t){const e=x.c(8);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let n;e[3]!==s?(n=$("bg-accent animate-pulse rounded-md",s),e[3]=s,e[4]=n):n=e[4];let l;return e[5]!==o||e[6]!==n?(l=a.jsx("div",{"data-slot":"skeleton",className:n,...o}),e[5]=o,e[6]=n,e[7]=l):l=e[7],l}const Rs="sidebar_state",Es=3600*24*7,Ls="16rem",Hs="18rem",Us="3rem",Bs="b",Ke=w.createContext(null);function me(){const t=w.useContext(Ke);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function Gs(t){const e=x.c(21),{defaultOpen:s,open:o,onOpenChange:n,children:l}=t,i=s===void 0?!0:s,r=te(),[c,d]=w.useState(!1),[u,m]=w.useState(i),f=o??u;let p;e[0]!==f||e[1]!==n?(p=z=>{const k=typeof z=="function"?z(f):z;n?n(k):m(k),document.cookie=`${Rs}=${k}; path=/; max-age=${Es}`},e[0]=f,e[1]=n,e[2]=p):p=e[2];const h=p;let v;e[3]!==r||e[4]!==h?(v=()=>r?d(Vs):h(Ws),e[3]=r,e[4]=h,e[5]=v):v=e[5];const g=v;let b,j;e[6]!==g?(b=()=>{const z=k=>{if(k.key===Bs&&(k.metaKey||k.ctrlKey)){const M=k.target;if(M.tagName==="INPUT"||M.tagName==="TEXTAREA"||M.isContentEditable)return;k.preventDefault(),g()}};return globalThis.addEventListener("keydown",z),()=>globalThis.removeEventListener("keydown",z)},j=[g],e[6]=g,e[7]=b,e[8]=j):(b=e[7],j=e[8]),w.useEffect(b,j);const S=f?"expanded":"collapsed";let C;e[9]!==r||e[10]!==f||e[11]!==c||e[12]!==h||e[13]!==S||e[14]!==g?(C={state:S,open:f,setOpen:h,isMobile:r,openMobile:c,setOpenMobile:d,toggleSidebar:g},e[9]=r,e[10]=f,e[11]=c,e[12]=h,e[13]=S,e[14]=g,e[15]=C):C=e[15];const y=C;let N;e[16]!==l?(N=a.jsx(Ot,{delayDuration:0,children:l}),e[16]=l,e[17]=N):N=e[17];let _;return e[18]!==y||e[19]!==N?(_=a.jsx(Ke.Provider,{value:y,children:N}),e[18]=y,e[19]=N,e[20]=_):_=e[20],_}function Ws(t){return!t}function Vs(t){return!t}function Fs(t){const e=x.c(14);let s,o,n,l;e[0]!==t?({className:o,style:l,children:s,...n}=t,e[0]=t,e[1]=s,e[2]=o,e[3]=n,e[4]=l):(s=e[1],o=e[2],n=e[3],l=e[4]);let i;e[5]!==l?(i={"--sidebar-width":Ls,"--sidebar-width-icon":Us,...l},e[5]=l,e[6]=i):i=e[6];const r=i;let c;e[7]!==o?(c=$("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex h-full w-full",o),e[7]=o,e[8]=c):c=e[8];let d;return e[9]!==s||e[10]!==n||e[11]!==r||e[12]!==c?(d=a.jsx("div",{"data-slot":"sidebar-wrapper",style:r,className:c,...n,children:s}),e[9]=s,e[10]=n,e[11]=r,e[12]=c,e[13]=d):d=e[13],d}function Ks(t){const e=x.c(46);let s,o,n,l,i,r;e[0]!==t?({side:l,variant:i,collapsible:r,className:o,children:s,...n}=t,e[0]=t,e[1]=s,e[2]=o,e[3]=n,e[4]=l,e[5]=i,e[6]=r):(s=e[1],o=e[2],n=e[3],l=e[4],i=e[5],r=e[6]);const c=l===void 0?"left":l,d=i===void 0?"sidebar":i,u=r===void 0?"offcanvas":r,{isMobile:m,state:f,openMobile:p,setOpenMobile:h}=me();if(u==="none"){let k;e[7]!==o?(k=$("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",o),e[7]=o,e[8]=k):k=e[8];let M;return e[9]!==s||e[10]!==n||e[11]!==k?(M=a.jsx("div",{"data-slot":"sidebar",className:k,...n,children:s}),e[9]=s,e[10]=n,e[11]=k,e[12]=M):M=e[12],M}if(m){let k;e[13]===Symbol.for("react.memo_cache_sentinel")?(k={"--sidebar-width":Hs},e[13]=k):k=e[13];let M;e[14]===Symbol.for("react.memo_cache_sentinel")?(M=a.jsxs(Ds,{className:"sr-only",children:[a.jsx(As,{children:"Sidebar"}),a.jsx(Ps,{children:"Displays the mobile sidebar."})]}),e[14]=M):M=e[14];let T;e[15]!==s?(T=a.jsx("div",{className:"flex h-full w-full flex-col",children:s}),e[15]=s,e[16]=T):T=e[16];let O;e[17]!==c||e[18]!==T?(O=a.jsxs(zs,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:k,side:c,children:[M,T]}),e[17]=c,e[18]=T,e[19]=O):O=e[19];let D;return e[20]!==p||e[21]!==n||e[22]!==h||e[23]!==O?(D=a.jsx(Ts,{open:p,onOpenChange:h,...n,children:O}),e[20]=p,e[21]=n,e[22]=h,e[23]=O,e[24]=D):D=e[24],D}const v=f==="collapsed"?u:"",g=d==="floating"||d==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)";let b;e[25]!==g?(b=$("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",g),e[25]=g,e[26]=b):b=e[26];let j;e[27]!==b?(j=a.jsx("div",{"data-slot":"sidebar-gap",className:b}),e[27]=b,e[28]=j):j=e[28];const S=c==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",C=d==="floating"||d==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)";let y;e[29]!==o||e[30]!==S||e[31]!==C?(y=$("fixed top-12 bottom-0 z-10 hidden w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",S,C,o),e[29]=o,e[30]=S,e[31]=C,e[32]=y):y=e[32];let N;e[33]!==s?(N=a.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border py-2 flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:s}),e[33]=s,e[34]=N):N=e[34];let _;e[35]!==n||e[36]!==y||e[37]!==N?(_=a.jsx("div",{"data-slot":"sidebar-container",className:y,...n,children:N}),e[35]=n,e[36]=y,e[37]=N,e[38]=_):_=e[38];let z;return e[39]!==c||e[40]!==f||e[41]!==_||e[42]!==v||e[43]!==j||e[44]!==d?(z=a.jsxs("div",{className:"group peer text-foreground hidden md:block border-r","data-state":f,"data-collapsible":v,"data-variant":d,"data-side":c,"data-slot":"sidebar",children:[j,_]}),e[39]=c,e[40]=f,e[41]=_,e[42]=v,e[43]=j,e[44]=d,e[45]=z):z=e[45],z}function Ys(t){const e=x.c(8);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let n;e[3]!==s?(n=$("bg-background relative flex w-full flex-1 flex-col min-w-0","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",s),e[3]=s,e[4]=n):n=e[4];let l;return e[5]!==o||e[6]!==n?(l=a.jsx("main",{"data-slot":"sidebar-inset",className:n,...o}),e[5]=o,e[6]=n,e[7]=l):l=e[7],l}function Zs(t){const e=x.c(8);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let n;e[3]!==s?(n=$("h-4 m-0! w-full",s),e[3]=s,e[4]=n):n=e[4];let l;return e[5]!==o||e[6]!==n?(l=a.jsx("div",{"data-sidebar":"separator",className:n,...o}),e[5]=o,e[6]=n,e[7]=l):l=e[7],l}function qs(t){const e=x.c(8);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let n;e[3]!==s?(n=$("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",s),e[3]=s,e[4]=n):n=e[4];let l;return e[5]!==o||e[6]!==n?(l=a.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:n,...o}),e[5]=o,e[6]=n,e[7]=l):l=e[7],l}function Qs(t){const e=x.c(8);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let n;e[3]!==s?(n=$("relative flex w-full min-w-0 flex-col px-2 py-2 md:py-0",s),e[3]=s,e[4]=n):n=e[4];let l;return e[5]!==o||e[6]!==n?(l=a.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:n,...o}),e[5]=o,e[6]=n,e[7]=l):l=e[7],l}function Xs(t){const e=x.c(8);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let n;e[3]!==s?(n=$("w-full text-sm",s),e[3]=s,e[4]=n):n=e[4];let l;return e[5]!==o||e[6]!==n?(l=a.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:n,...o}),e[5]=o,e[6]=n,e[7]=l):l=e[7],l}function Js(t){const e=x.c(8);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let n;e[3]!==s?(n=$("flex w-full min-w-0 flex-col gap-1",s),e[3]=s,e[4]=n):n=e[4];let l;return e[5]!==o||e[6]!==n?(l=a.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:n,...o}),e[5]=o,e[6]=n,e[7]=l):l=e[7],l}function le(t){const e=x.c(8);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let n;e[3]!==s?(n=$("group/menu-item relative",s),e[3]=s,e[4]=n):n=e[4];let l;return e[5]!==o||e[6]!==n?(l=a.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:n,...o}),e[5]=o,e[6]=n,e[7]=l):l=e[7],l}const en=ht("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-lg px-2 py-1.5 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding,colors] transition-colors duration-150 ease-out hover:transition-none focus-visible:ring-2 active:bg-sidebar-accent/75 disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent/75 [&>span:last-child]:truncate [&>svg]:size-[18px] [&>svg]:shrink-0 [&>svg]:text-muted-foreground",{variants:{variant:{default:"hover:bg-sidebar-accent text-sidebar-foreground/80 active:text-sidebar-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-7 text-sm font-[450]",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function Ye(t){const e=x.c(28);let s,o,n,l,i,r,c;e[0]!==t?({asChild:n,isActive:l,variant:i,size:r,tooltip:c,className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o,e[3]=n,e[4]=l,e[5]=i,e[6]=r,e[7]=c):(s=e[1],o=e[2],n=e[3],l=e[4],i=e[5],r=e[6],c=e[7]);const d=n===void 0?!1:n,u=l===void 0?!1:l,m=i===void 0?"default":i,f=r===void 0?"default":r,p=d?pt:"button",{isMobile:h,state:v}=me();let g;e[8]!==s||e[9]!==f||e[10]!==m?(g=$(en({variant:m,size:f}),s),e[8]=s,e[9]=f,e[10]=m,e[11]=g):g=e[11];let b;e[12]!==p||e[13]!==u||e[14]!==o||e[15]!==f||e[16]!==g?(b=a.jsx(p,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":f,"data-active":u,className:g,...o}),e[12]=p,e[13]=u,e[14]=o,e[15]=f,e[16]=g,e[17]=b):b=e[17];const j=b;if(!c)return j;if(typeof c=="string"){let _;e[18]!==c?(_={children:c},e[18]=c,e[19]=_):_=e[19],c=_}let S;e[20]!==j?(S=a.jsx(zt,{asChild:!0,children:j}),e[20]=j,e[21]=S):S=e[21];const C=v!=="collapsed"||h;let y;e[22]!==C||e[23]!==c?(y=a.jsx(Mt,{side:"right",align:"center",hidden:C,...c}),e[22]=C,e[23]=c,e[24]=y):y=e[24];let N;return e[25]!==S||e[26]!==y?(N=a.jsxs(Dt,{children:[S,y]}),e[25]=S,e[26]=y,e[27]=N):N=e[27],N}function tn(t){const e=x.c(26),{item:s}=t,o=ae(),{org:n}=q(),l=ke(n.id),i=ls(n.id);let r;e[0]!==i.update||e[1]!==s.url||e[2]!==l?.sidebar_items?(r=async()=>{const C=(l?.sidebar_items||[]).filter(y=>y.url!==s.url);await i.update.mutateAsync({sidebar_items:C})},e[0]=i.update,e[1]=s.url,e[2]=l?.sidebar_items,e[3]=r):r=e[3];const c=r;let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=/^https?:\/\/.+/,e[4]=d):d=e[4];let u;e[5]!==s.icon?(u=d.test(s.icon),e[5]=s.icon,e[6]=u):u=e[6];const m=u;let f;e[7]!==s.url||e[8]!==o?(f=()=>{o({to:s.url})},e[7]=s.url,e[8]=o,e[9]=f):f=e[9];const p=s.title;let h;e[10]!==m||e[11]!==s.icon||e[12]!==s.title?(h=a.jsx("div",{className:"flex items-center justify-center shrink-0",children:m?a.jsx("img",{src:s.icon,alt:s.title,className:"h-4 w-4 rounded object-cover"}):a.jsx(as,{size:16,className:"text-muted-foreground group-hover/item:text-foreground transition-colors"})}),e[10]=m,e[11]=s.icon,e[12]=s.title,e[13]=h):h=e[13];let v;e[14]!==s.title?(v=s.title.toLocaleLowerCase(),e[14]=s.title,e[15]=v):v=e[15];let g;e[16]!==v?(g=a.jsx("div",{className:"flex-1 min-w-0 flex flex-col items-start",children:a.jsx("span",{className:"truncate text-sm w-full capitalize",children:v})}),e[16]=v,e[17]=g):g=e[17];let b;e[18]!==c?(b=a.jsx(oe,{size:16,className:"text-muted-foreground opacity-0 group-hover/item:opacity-50 hover:opacity-100 cursor-pointer",onClick:S=>{S.preventDefault(),S.stopPropagation(),c()}}),e[18]=c,e[19]=b):b=e[19];let j;return e[20]!==s.title||e[21]!==f||e[22]!==h||e[23]!==g||e[24]!==b?(j=a.jsx(le,{children:a.jsxs(Ye,{className:"w-full pr-2 group/item relative cursor-pointer text-foreground/90 hover:text-foreground",onClick:f,tooltip:p,children:[h,g,b]})}),e[20]=s.title,e[21]=f,e[22]=h,e[23]=g,e[24]=b,e[25]=j):j=e[25],j}function sn(){const t=x.c(4),{org:e}=q(),o=ke(e.id)?.sidebar_items;if(!o?.length)return null;let n;t[0]!==o?(n=o.map(nn),t[0]=o,t[1]=n):n=t[1];let l;return t[2]!==n?(l=a.jsx(Ze,{children:n}),t[2]=n,t[3]=l):l=t[3],l}function nn(t){return a.jsx(tn,{item:t},t.url)}function be(){const t=x.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a.jsx(le,{children:a.jsx("div",{className:"flex items-center gap-2 px-4 py-2",children:a.jsx(Fe,{className:"h-4 flex-1"})})}),t[0]=e):e=t[0],e}function Ze(t){const e=x.c(4),{children:s}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=a.jsx(Zs,{className:"my-2 -ml-1"}),e[0]=o):o=e[0];let n;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=a.jsx(le,{children:a.jsx("div",{className:"group-data-[collapsible=icon]:hidden px-2 py-0 text-xs font-medium h-6 text-muted-foreground flex items-center justify-between",children:a.jsx("span",{className:"whitespace-nowrap",children:"Pinned Views"})})}),e[1]=n):n=e[1];let l;return e[2]!==s?(l=a.jsxs(a.Fragment,{children:[o,n,s]}),e[2]=s,e[3]=l):l=e[3],l}function on(){const t=x.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a.jsx(w.Suspense,{fallback:a.jsxs(Ze,{children:[a.jsx(be,{}),a.jsx(be,{})]}),children:a.jsx(sn,{})}),t[0]=e):e=t[0],e}function an(){const t=x.c(43),{locator:e}=q(),s=ae();let o;t[0]!==e?(o=pe.parse(e),t[0]=e,t[1]=o):o=t[1];const{org:n}=o;let l;t[2]!==e?(l=pe.isOrgAdminProject(e),t[2]=e,t[3]=l):l=t[3];const i=l;let r;t[4]===Symbol.for("react.memo_cache_sentinel")?(r=a.jsx(Re,{}),t[4]=r):r=t[4];let c;t[5]!==s||t[6]!==n?(c={key:"home",label:"Home",icon:r,onClick:()=>s({to:"/$org",params:{org:n}})},t[5]=s,t[6]=n,t[7]=c):c=t[7];let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=a.jsx(De,{}),t[8]=d):d=t[8];let u;t[9]!==s||t[10]!==n?(u={key:"store",label:"Store",icon:d,onClick:()=>s({to:"/$org/store",params:{org:n}})},t[9]=s,t[10]=n,t[11]=u):u=t[11];let m;t[12]===Symbol.for("react.memo_cache_sentinel")?(m=a.jsx(Tt,{}),t[12]=m):m=t[12];let f;t[13]!==s||t[14]!==n?(f={key:"mcps",label:"MCP Servers",icon:m,onClick:()=>s({to:"/$org/mcps",params:{org:n}})},t[13]=s,t[14]=n,t[15]=f):f=t[15];let p;t[16]===Symbol.for("react.memo_cache_sentinel")?(p=a.jsx(ie,{}),t[16]=p):p=t[16];let h;t[17]!==s||t[18]!==n?(h={key:"gateways",label:"MCP Gateways",icon:p,onClick:()=>s({to:"/$org/gateways",params:{org:n}})},t[17]=s,t[18]=n,t[19]=h):h=t[19];let v;t[20]===Symbol.for("react.memo_cache_sentinel")?(v=a.jsx(ze,{}),t[20]=v):v=t[20];let g;t[21]!==s||t[22]!==n?(g={key:"monitoring",label:"Monitoring",icon:v,onClick:()=>s({to:"/$org/monitoring",params:{org:n}})},t[21]=s,t[22]=n,t[23]=g):g=t[23];let b;t[24]===Symbol.for("react.memo_cache_sentinel")?(b=a.jsx(Ge,{}),t[24]=b):b=t[24];let j;t[25]!==s||t[26]!==n?(j={key:"members",label:"Members",icon:b,onClick:()=>s({to:"/$org/members",params:{org:n}})},t[25]=s,t[26]=n,t[27]=j):j=t[27];let S;t[28]===Symbol.for("react.memo_cache_sentinel")?(S=a.jsx(Ue,{}),t[28]=S):S=t[28];let C;t[29]!==s||t[30]!==n?(C={key:"settings",label:"Settings",icon:S,onClick:()=>s({to:"/$org/settings",params:{org:n}})},t[29]=s,t[30]=n,t[31]=C):C=t[31];let y;t[32]!==g||t[33]!==j||t[34]!==C||t[35]!==c||t[36]!==u||t[37]!==f||t[38]!==h?(y=[c,u,f,h,g,j,C],t[32]=g,t[33]=j,t[34]=C,t[35]=c,t[36]=u,t[37]=f,t[38]=h,t[39]=y):y=t[39];const N=y;let _;return t[40]!==N||t[41]!==i?(_=i?N:[],t[40]=N,t[41]=i,t[42]=_):_=t[42],_}function qe(t){const e=x.c(10),{navigationItems:s,footer:o,additionalContent:n,variant:l,collapsible:i}=t,r=l===void 0?"sidebar":l,c=i===void 0?"icon":i;let d;e[0]!==s?(d=s.map(ln),e[0]=s,e[1]=d):d=e[1];let u;e[2]!==n||e[3]!==d?(u=a.jsx(qs,{className:"flex-1 overflow-x-hidden",children:a.jsx(Qs,{className:"font-medium",children:a.jsx(Xs,{children:a.jsxs(Js,{className:"gap-0.5",children:[d,n]})})})}),e[2]=n,e[3]=d,e[4]=u):u=e[4];let m;return e[5]!==c||e[6]!==o||e[7]!==u||e[8]!==r?(m=a.jsxs(Ks,{variant:r,collapsible:c,children:[u,o]}),e[5]=c,e[6]=o,e[7]=u,e[8]=r,e[9]=m):m=e[9],m}function ln(t){return a.jsx(le,{children:a.jsxs(Ye,{className:"group/nav-item cursor-pointer text-foreground/90 hover:text-foreground",onClick:t.onClick,isActive:t.isActive,tooltip:t.label,children:[a.jsx("span",{className:"text-muted-foreground group-hover/nav-item:text-foreground transition-colors [&>svg]:size-4",children:t.icon}),a.jsx("span",{className:"truncate",children:t.label})]})},t.key)}qe.Skeleton=function(){return a.jsx("div",{className:"flex flex-col gap-0.5",children:Array.from({length:8}).map((e,s)=>a.jsx("div",{className:"w-full h-8",children:a.jsx(Fe,{className:"h-full bg-sidebar-accent rounded-md"})},s))})};function rn(){const t=x.c(3),e=an();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=a.jsx(a.Fragment,{children:a.jsx(de,{children:a.jsx(w.Suspense,{fallback:null,children:a.jsx(on,{})})})}),t[0]=s):s=t[0];let o;return t[1]!==e?(o=a.jsx(qe,{navigationItems:e,additionalContent:s}),t[1]=e,t[2]=o):o=t[2],o}function cn(t){const e=x.c(12);let s,o,n,l;e[0]!==t?({className:s,orientation:n,decorative:l,...o}=t,e[0]=t,e[1]=s,e[2]=o,e[3]=n,e[4]=l):(s=e[1],o=e[2],n=e[3],l=e[4]);const i=n===void 0?"horizontal":n,r=l===void 0?!0:l;let c;e[5]!==s?(c=$("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",s),e[5]=s,e[6]=c):c=e[6];let d;return e[7]!==r||e[8]!==i||e[9]!==o||e[10]!==c?(d=a.jsx(xt,{"data-slot":"separator-root",decorative:r,orientation:i,className:c,...o}),e[7]=r,e[8]=i,e[9]=o,e[10]=c,e[11]=d):d=e[11],d}const Qe=w.createContext(null);function dn(){const t=w.useContext(Qe);if(!t)throw new Error("TopbarSwitcher compound components must be used within TopbarSwitcher.Root");return t}function un(t){const e=x.c(10),{children:s,onItemHover:o}=t,[n,l]=w.useState(null);let i;e[0]!==o?(i=m=>{l(m),o?.(m)},e[0]=o,e[1]=i):i=e[1];const r=i;let c;e[2]!==n||e[3]!==r?(c={hoveredItem:n,setHoveredItem:r},e[2]=n,e[3]=r,e[4]=c):c=e[4];let d;e[5]!==s?(d=a.jsx(Ce,{children:s}),e[5]=s,e[6]=d):d=e[6];let u;return e[7]!==c||e[8]!==d?(u=a.jsx(Qe.Provider,{value:c,children:d}),e[7]=c,e[8]=d,e[9]=u):u=e[9],u}function mn(t){const e=x.c(6),{children:s,onClick:o}=t;let n;e[0]!==s||e[1]!==o?(n=a.jsx(W,{variant:"link",className:"p-0.5 h-auto",onClick:o,type:"button",children:s}),e[0]=s,e[1]=o,e[2]=n):n=e[2];let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=a.jsx(Ne,{asChild:!0,children:a.jsx(W,{size:"icon",variant:"ghost",className:"w-6 h-6 p-0",children:a.jsx(Ae,{size:16,className:"opacity-50"})})}),e[3]=l):l=e[3];let i;return e[4]!==n?(i=a.jsxs("div",{className:"flex items-center gap-1",children:[n,l]}),e[4]=n,e[5]=i):i=e[5],i}function fn(t){const e=x.c(8),{item:s,fallback:o}=t,n=o===void 0?"":o,l=s?.avatarUrl??"",i=s?.name??n;let r;e[0]!==l||e[1]!==i?(r=a.jsx(Q,{url:l,fallback:i,size:"xs",objectFit:"contain"}),e[0]=l,e[1]=i,e[2]=r):r=e[2];const c=s?.name??n;let d;e[3]!==c?(d=a.jsx("span",{children:c}),e[3]=c,e[4]=d):d=e[4];let u;return e[5]!==r||e[6]!==d?(u=a.jsxs("div",{className:"flex items-center gap-2",children:[r,d]}),e[5]=r,e[6]=d,e[7]=u):u=e[7],u}function hn(t){const e=x.c(6),{children:s,align:o}=t,n=o===void 0?"start":o,i=w.Children.toArray(s).filter(pn).length===1?"280px":"480px";let r;e[0]!==i?(r={width:i},e[0]=i,e[1]=r):r=e[1];let c;return e[2]!==n||e[3]!==s||e[4]!==r?(c=a.jsx(_e,{align:n,className:"p-0 flex items-start",style:r,children:s}),e[2]=n,e[3]=s,e[4]=r,e[5]=c):c=e[5],c}function pn(t){return w.isValidElement(t)&&(t.type===Je||t.type===Xe)}function Xe(t){const e=x.c(5),{children:s,className:o}=t;let n;e[0]!==o?(n=$("flex flex-col border-border w-[240px] border-r last:border-r-0 last:w-full",o),e[0]=o,e[1]=n):n=e[1];let l;return e[2]!==s||e[3]!==n?(l=a.jsx("div",{className:n,children:s}),e[2]=s,e[3]=n,e[4]=l):l=e[4],l}const Je=Xe;function xn(t){const e=x.c(6),{placeholder:s,value:o,onChange:n}=t,l=s===void 0?"Search...":s;let i;e[0]!==n?(i=c=>n(c.target.value),e[0]=n,e[1]=i):i=e[1];let r;return e[2]!==l||e[3]!==i||e[4]!==o?(r=a.jsx(rs,{placeholder:l,value:o,onChange:i,className:"rounded-none border-t-0 border-x-0 focus-visible:border-border focus-visible:ring-0"}),e[2]=l,e[3]=i,e[4]=o,e[5]=r):r=e[5],r}function gn(t){const e=x.c(6),{children:s,emptyMessage:o}=t,n=o===void 0?"No items found.":o,l=w.Children.count(s)>0;let i;e[0]!==n||e[1]!==l?(i=!l&&a.jsx("div",{className:"text-muted-foreground text-sm px-1 py-8 text-center",children:n}),e[0]=n,e[1]=l,e[2]=i):i=e[2];let r;return e[3]!==s||e[4]!==i?(r=a.jsxs("div",{className:"flex flex-col gap-0.5 p-1 max-h-44 overflow-y-auto",children:[i,s]}),e[3]=s,e[4]=i,e[5]=r):r=e[5],r}function bn(t){const e=x.c(15),{item:s,onClick:o,onHover:n,children:l}=t,i=dn();let r;e[0]!==i||e[1]!==s||e[2]!==n?(r=()=>{i.setHoveredItem(s.slug),n?.(s)},e[0]=i,e[1]=s,e[2]=n,e[3]=r):r=e[3];const c=r;let d;e[4]!==s||e[5]!==o?(d=()=>o(s),e[4]=s,e[5]=o,e[6]=d):d=e[6];let u;e[7]!==l||e[8]!==s.avatarUrl||e[9]!==s.name?(u=l||a.jsxs(a.Fragment,{children:[a.jsx(Q,{url:s.avatarUrl??"",fallback:s.name,size:"xs",className:"w-[22px]! h-[22px]!",objectFit:"contain"}),a.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:s.name})]}),e[7]=l,e[8]=s.avatarUrl,e[9]=s.name,e[10]=u):u=e[10];let m;return e[11]!==c||e[12]!==d||e[13]!==u?(m=a.jsx(W,{onClick:d,onMouseEnter:c,variant:"ghost",size:"sm",className:"w-full justify-start font-normal",children:u}),e[11]=c,e[12]=d,e[13]=u,e[14]=m):m=e[14],m}function vn(t){const e=x.c(2),{children:s}=t;let o;return e[0]!==s?(o=a.jsx("div",{className:"px-1 pb-1 pt-0.5",children:s}),e[0]=s,e[1]=o):o=e[1],o}function jn(t){const e=x.c(11),{onClick:s,icon:o,children:n,variant:l}=t,r=(l===void 0?"default":l)==="muted"&&"text-muted-foreground";let c;e[0]!==r?(c=$("w-full justify-start font-normal",r),e[0]=r,e[1]=c):c=e[1];let d;e[2]!==o?(d=o&&a.jsx("span",{className:"[&>svg]:size-4",children:o}),e[2]=o,e[3]=d):d=e[3];let u;e[4]!==n?(u=a.jsx("span",{children:n}),e[4]=n,e[5]=u):u=e[5];let m;return e[6]!==s||e[7]!==c||e[8]!==d||e[9]!==u?(m=a.jsxs(W,{variant:"ghost",size:"sm",className:c,onClick:s,children:[d,u]}),e[6]=s,e[7]=c,e[8]=d,e[9]=u,e[10]=m):m=e[10],m}function wn(){const t=x.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a.jsx(cn,{}),t[0]=e):e=t[0],e}function Sn(){const t=x.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a.jsx("div",{className:"h-4 w-16 bg-accent rounded-full animate-pulse"}),t[0]=e):e=t[0],e}const P=Object.assign(un,{Trigger:mn,CurrentItem:fn,Content:hn,Panel:Je,Search:xn,Items:gn,Item:bn,Actions:vn,Action:jn,Separator:wn,Skeleton:Sn});function re(){const t=x.c(59);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={strict:!1},t[0]=e):e=t[0];const{org:s}=ce(e),{data:o}=J.useListOrganizations(),n=ae();let l;t[1]!==s||t[2]!==o?(l=o?.find(V=>V.slug===s),t[1]=s,t[2]=o,t[3]=l):l=t[3];const i=l,[r,c]=w.useState(""),[d,u]=w.useState(!1);let m,f,p,h,v,g,b,j;if(t[4]!==i||t[5]!==n||t[6]!==s||t[7]!==r||t[8]!==o){const X=(o?(()=>{const E=o.filter(H=>H.name.toLowerCase().includes(r.toLowerCase()));if(s){const H=E.findIndex(Y=>Y.slug===s);if(H>0){const Y=E[H];Y&&(E.splice(H,1),E.unshift(Y))}}return E})():[]).map(yn);let R;t[17]!==i?(R=i?{slug:i.slug,name:i.name,avatarUrl:i.logo}:void 0,t[17]=i,t[18]=R):R=t[18];const K=R;h=P;let B;t[19]!==n||t[20]!==s?(B=()=>n({to:"/$org",params:{org:s??""}}),t[19]=n,t[20]=s,t[21]=B):B=t[21];let L;t[22]!==K?(L=a.jsx(P.CurrentItem,{item:K}),t[22]=K,t[23]=L):L=t[23],t[24]!==B||t[25]!==L?(j=a.jsx(P.Trigger,{onClick:B,children:L}),t[24]=B,t[25]=L,t[26]=j):j=t[26],p=P.Content,f=P.Panel,t[27]!==r?(b=a.jsx(P.Search,{placeholder:"Search organizations...",value:r,onChange:c}),t[27]=r,t[28]=b):b=t[28],m=P.Items,v="No organizations found.";let F;t[29]!==n?(F=E=>a.jsx(P.Item,{item:E,onClick:H=>n({to:"/$org",params:{org:H.slug}})},E.slug),t[29]=n,t[30]=F):F=t[30],g=X.map(F),t[4]=i,t[5]=n,t[6]=s,t[7]=r,t[8]=o,t[9]=m,t[10]=f,t[11]=p,t[12]=h,t[13]=v,t[14]=g,t[15]=b,t[16]=j}else m=t[9],f=t[10],p=t[11],h=t[12],v=t[13],g=t[14],b=t[15],j=t[16];let S;t[31]!==m||t[32]!==v||t[33]!==g?(S=a.jsx(m,{emptyMessage:v,children:g}),t[31]=m,t[32]=v,t[33]=g,t[34]=S):S=t[34];let C,y;t[35]===Symbol.for("react.memo_cache_sentinel")?(C=a.jsx(P.Actions,{children:a.jsx(P.Action,{onClick:()=>u(!0),variant:"muted",children:"+ Create organization"})}),y=a.jsx(P.Separator,{}),t[35]=C,t[36]=y):(C=t[35],y=t[36]);let N;t[37]!==n?(N=()=>n({to:"/"}),t[37]=n,t[38]=N):N=t[38];let _;t[39]===Symbol.for("react.memo_cache_sentinel")?(_=a.jsx(cs,{}),t[39]=_):_=t[39];let z;t[40]!==N?(z=a.jsx(P.Actions,{children:a.jsx(P.Action,{onClick:N,icon:_,children:"See all organizations"})}),t[40]=N,t[41]=z):z=t[41];let k;t[42]!==f||t[43]!==z||t[44]!==b||t[45]!==S?(k=a.jsxs(f,{children:[b,S,C,y,z]}),t[42]=f,t[43]=z,t[44]=b,t[45]=S,t[46]=k):k=t[46];let M;t[47]!==p||t[48]!==k?(M=a.jsx(p,{children:k}),t[47]=p,t[48]=k,t[49]=M):M=t[49];let T;t[50]!==h||t[51]!==M||t[52]!==j?(T=a.jsxs(h,{children:[j,M]}),t[50]=h,t[51]=M,t[52]=j,t[53]=T):T=t[53];let O;t[54]!==d?(O=a.jsx(is,{open:d,onOpenChange:u}),t[54]=d,t[55]=O):O=t[55];let D;return t[56]!==T||t[57]!==O?(D=a.jsxs(a.Fragment,{children:[T,O]}),t[56]=T,t[57]=O,t[58]=D):D=t[58],D}function yn(t){return{slug:t.slug,name:t.name,avatarUrl:t.logo}}re.Skeleton=P.Skeleton;const et=w.createContext({setOpen:()=>{}}),Cn=()=>w.useContext(et),Nn=t=>{const e=x.c(25);let s,o,n,l,i;e[0]!==t?({children:s,defaultOpen:o,open:l,onOpenChange:n,...i}=t,e[0]=t,e[1]=s,e[2]=o,e[3]=n,e[4]=l,e[5]=i):(s=e[1],o=e[2],n=e[3],l=e[4],i=e[5]);const r=o??!1;let c;e[6]!==n||e[7]!==l||e[8]!==r?(c={prop:l,defaultProp:r,onChange:n},e[6]=n,e[7]=l,e[8]=r,e[9]=c):c=e[9];const[d,u]=Xt(c);let m;e[10]!==u?(m={setOpen:u},e[10]=u,e[11]=m):m=e[11];let f;e[12]!==s||e[13]!==d||e[14]!==i||e[15]!==u?(f=a.jsx(Jt,{open:d,onOpenChange:u,...i,children:s}),e[12]=s,e[13]=d,e[14]=i,e[15]=u,e[16]=f):f=e[16];let p;e[17]!==d||e[18]!==i||e[19]!==u||e[20]!==f?(p=a.jsx(ms,{open:d,onOpenChange:u,...i,children:f}),e[17]=d,e[18]=i,e[19]=u,e[20]=f,e[21]=p):p=e[21];let h;return e[22]!==m||e[23]!==p?(h=a.jsx(et.Provider,{value:m,children:p}),e[22]=m,e[23]=p,e[24]=h):h=e[24],h},_n=t=>{const{children:e,title:s,...o}=t,n=te(),{className:l,...i}=o;return n?a.jsxs(Zt,{...i,children:[a.jsx(qt,{className:"hidden",children:a.jsx(Qt,{children:s})}),a.jsx("div",{className:$("flex flex-col gap-2 p-2 py-4",l),children:e})]}):a.jsx(us,{...o,children:e})},kn=t=>{const{children:e,...s}=t,{setOpen:o}=Cn(),n=te(),{className:l,...i}=s;return n?a.jsx("div",{...i,onClick:r=>{o(!1);const{onClick:c}=i;c?.(r)},className:$("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",l),children:e}):a.jsx(fs,{...s,children:e})},In=t=>{const e=x.c(7);let s,o;e[0]!==t?({children:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const n=te();let l;return e[3]!==s||e[4]!==n||e[5]!==o?(l=n?a.jsx(Yt,{asChild:!0,children:s}):a.jsx(ds,{...o,children:s}),e[3]=s,e[4]=n,e[5]=o,e[6]=l):l=e[6],l},$n=t=>{const e=x.c(7);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const n=te();let l;return e[3]!==s||e[4]!==n||e[5]!==o?(l=n?a.jsx(xe,{className:$(s),...o}):a.jsx(xe,{className:$(s),...o}),e[3]=s,e[4]=n,e[5]=o,e[6]=l):l=e[6],l};function Tn(t){const e=x.c(11),{user:s,trigger:o,align:n,children:l}=t,i=n===void 0?"start":n;let r;e[0]!==o||e[1]!==s?(r=o(s),e[0]=o,e[1]=s,e[2]=r):r=e[2];let c;e[3]!==r?(c=a.jsx(In,{asChild:!0,children:a.jsx("div",{children:r})}),e[3]=r,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==l?(d=a.jsx(_n,{side:"top",align:i,className:"md:w-[240px]",children:l}),e[5]=i,e[6]=l,e[7]=d):d=e[7];let u;return e[8]!==c||e[9]!==d?(u=a.jsxs(Nn,{children:[c,d]}),e[8]=c,e[9]=d,e[10]=u):u=e[10],u}function Mn(t){const e=x.c(8),{children:s,onClick:o,className:n,asChild:l}=t;let i;e[0]!==l||e[1]!==s||e[2]!==o?(i=l?s:a.jsx("button",{type:"button",className:"flex items-center gap-2 text-sm w-full cursor-pointer",onClick:o,children:s}),e[0]=l,e[1]=s,e[2]=o,e[3]=i):i=e[3];let r;return e[4]!==l||e[5]!==n||e[6]!==i?(r=a.jsx(kn,{asChild:l,className:n,children:i}),e[4]=l,e[5]=n,e[6]=i,e[7]=r):r=e[7],r}function On(t){const e=x.c(2),{className:s}=t;let o;return e[0]!==s?(o=a.jsx($n,{className:s}),e[0]=s,e[1]=o):o=e[1],o}function zn(){const t=x.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a.jsx("div",{className:"w-8 h-8 bg-muted rounded-full animate-pulse"}),t[0]=e):e=t[0],e}const G=Object.assign(Tn,{Item:Mn,Separator:On,Skeleton:zn});function Dn(t){const e=x.c(32),{open:s,onOpenChange:o,user:n,userImage:l}=t,[i,r]=w.useState(!1);let c;e[0]!==n.id?(c=()=>{navigator.clipboard.writeText(n.id),r(!0),setTimeout(()=>r(!1),2e3)},e[0]=n.id,e[1]=c):c=e[1];const d=c;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=a.jsxs(Ie,{children:[a.jsx($e,{children:"Profile"}),a.jsx(Te,{children:"Your account information"})]}),e[2]=u):u=e[2];const m=n.name||n.email||"U";let f;e[3]!==m||e[4]!==l?(f=a.jsx(Q,{url:l,fallback:m,shape:"circle",size:"2xl"}),e[3]=m,e[4]=l,e[5]=f):f=e[5];const p=n.name||n.email;let h;e[6]!==p?(h=a.jsx("div",{className:"text-lg font-semibold text-center",children:p}),e[6]=p,e[7]=h):h=e[7];let v;e[8]!==n.email?(v=a.jsx("div",{className:"text-sm text-muted-foreground text-center",children:n.email}),e[8]=n.email,e[9]=v):v=e[9];let g;e[10]!==h||e[11]!==v?(g=a.jsxs("div",{className:"flex flex-col items-center gap-2 w-full",children:[h,v]}),e[10]=h,e[11]=v,e[12]=g):g=e[12];let b;e[13]===Symbol.for("react.memo_cache_sentinel")?(b=a.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"User ID"}),e[13]=b):b=e[13];let j;e[14]!==n.id?(j=a.jsxs("div",{className:"flex flex-col gap-1 min-w-0 flex-1",children:[b,a.jsx("span",{className:"text-sm font-mono truncate",children:n.id})]}),e[14]=n.id,e[15]=j):j=e[15];let S;e[16]!==i?(S=i?a.jsx(At,{size:16,className:"text-green-600"}):a.jsx(hs,{size:16,className:"text-muted-foreground"}),e[16]=i,e[17]=S):S=e[17];let C;e[18]!==d||e[19]!==S?(C=a.jsx("button",{type:"button",onClick:d,className:"flex-shrink-0 p-2 hover:bg-background rounded-md transition-colors","aria-label":"Copy user ID",children:S}),e[18]=d,e[19]=S,e[20]=C):C=e[20];let y;e[21]!==j||e[22]!==C?(y=a.jsxs("div",{className:"flex items-center justify-between gap-3 w-full px-4 py-3 rounded-lg bg-muted/50 border border-border",children:[j,C]}),e[21]=j,e[22]=C,e[23]=y):y=e[23];let N;e[24]!==y||e[25]!==f||e[26]!==g?(N=a.jsxs(Me,{className:"sm:max-w-md",children:[u,a.jsxs("div",{className:"flex flex-col items-center gap-6 py-4",children:[f,g,y]})]}),e[24]=y,e[25]=f,e[26]=g,e[27]=N):N=e[27];let _;return e[28]!==o||e[29]!==s||e[30]!==N?(_=a.jsx(Oe,{open:s,onOpenChange:o,children:N}),e[28]=o,e[29]=s,e[30]=N,e[31]=_):_=e[31],_}function An(t){const e=x.c(5),{open:s,onOpenChange:o}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=a.jsxs(Ie,{children:[a.jsx($e,{children:"Invitations"}),a.jsx(Te,{children:"Your pending organization invitations"})]}),e[0]=n):n=e[0];let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=a.jsxs(Me,{className:"sm:max-w-lg",children:[n,a.jsx("div",{className:"max-h-[420px] overflow-auto pr-1",children:a.jsx(vt,{})})]}),e[1]=l):l=e[1];let i;return e[2]!==o||e[3]!==s?(i=a.jsx(Oe,{open:s,onOpenChange:o,children:l}),e[2]=o,e[3]=s,e[4]=i):i=e[4],i}function Pn(t){const e=x.c(31),{user:s,userImage:o,hasInvites:n,showInvitesItem:l}=t,[i,r]=w.useState(!1),[c,d]=w.useState(!1);let u;e[0]!==n||e[1]!==s.email||e[2]!==s.name||e[3]!==o?(u=()=>a.jsxs("div",{className:"relative",children:[a.jsx(Q,{url:o,fallback:s.name||s.email||"U",shape:"circle",size:"sm",className:"cursor-pointer hover:ring-2 ring-muted-foreground transition-all"}),n&&a.jsx("span",{className:"absolute -top-0.5 -right-0.5 h-2.5 w-2.5 rounded-full bg-destructive ring-2 ring-background"})]}),e[0]=n,e[1]=s.email,e[2]=s.name,e[3]=o,e[4]=u):u=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=a.jsxs(G.Item,{onClick:()=>r(!0),children:[a.jsx(Be,{className:"text-muted-foreground",size:18}),"Profile"]}),e[5]=m):m=e[5];let f;e[6]!==n||e[7]!==l?(f=l&&a.jsxs(G.Item,{onClick:()=>d(!0),children:[a.jsx(He,{className:"text-muted-foreground",size:18}),"Invitations",n&&a.jsx("span",{className:"ml-auto h-2 w-2 rounded-full bg-destructive"})]}),e[6]=n,e[7]=l,e[8]=f):f=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=a.jsx(G.Separator,{}),e[9]=p):p=e[9];let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=a.jsx(bt,{className:"w-4 h-4 text-muted-foreground"}),e[10]=h):h=e[10];let v;e[11]===Symbol.for("react.memo_cache_sentinel")?(v=a.jsx(G.Item,{asChild:!0,children:a.jsxs("a",{href:"https://github.com/decocms/admin",target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 text-sm cursor-pointer",children:[h,"decocms/admin",a.jsx(ge,{size:18,className:"text-muted-foreground ml-auto"})]})}),e[11]=v):v=e[11];let g;e[12]===Symbol.for("react.memo_cache_sentinel")?(g=a.jsx(Pe,{className:"text-muted-foreground",size:18}),e[12]=g):g=e[12];let b,j;e[13]===Symbol.for("react.memo_cache_sentinel")?(b=a.jsx(G.Item,{asChild:!0,children:a.jsxs("a",{href:"https://decocms.com",target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 text-sm cursor-pointer",children:[g,"Homepage",a.jsx(ge,{size:18,className:"ml-auto text-muted-foreground"})]})}),j=a.jsx(G.Separator,{}),e[13]=b,e[14]=j):(b=e[13],j=e[14]);let S;e[15]===Symbol.for("react.memo_cache_sentinel")?(S=a.jsxs(G.Item,{onClick:Rn,children:[a.jsx(Le,{size:18,className:"text-muted-foreground"}),"Log out"]}),e[15]=S):S=e[15];let C;e[16]!==u||e[17]!==f||e[18]!==s?(C=a.jsxs(G,{user:s,trigger:u,align:"end",children:[m,f,p,v,b,j,S]}),e[16]=u,e[17]=f,e[18]=s,e[19]=C):C=e[19];let y;e[20]!==i||e[21]!==s||e[22]!==o?(y=i&&a.jsx(Dn,{open:i,onOpenChange:r,user:s,userImage:o}),e[20]=i,e[21]=s,e[22]=o,e[23]=y):y=e[23];let N;e[24]!==c||e[25]!==l?(N=l&&c&&a.jsx(An,{open:c,onOpenChange:d}),e[24]=c,e[25]=l,e[26]=N):N=e[26];let _;return e[27]!==C||e[28]!==y||e[29]!==N?(_=a.jsxs(a.Fragment,{children:[C,y,N]}),e[27]=C,e[28]=y,e[29]=N,e[30]=_):_=e[30],_}function Rn(){return J.signOut()}function En(){const{data:t}=J.useSession(),e=w.useContext(gt),{data:s}=e.hooks.useListUserInvitations(),n=(s??[]).length>0;if(!t?.user)return a.jsx(Q,{url:void 0,fallback:"U",shape:"circle",size:"sm",className:"cursor-pointer",muted:!0});const l=t.user,i={...l,name:l.name??void 0},r=l.image;return a.jsx(Pn,{user:i,userImage:r,hasInvites:n,showInvitesItem:!0})}function Ln(t){const e=x.c(6),{children:s}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=a.jsx(jt,{children:a.jsx(we,{})}),e[0]=o):o=e[0];let n;e[1]!==s?(n=a.jsx(wt,{children:s}),e[1]=s,e[2]=n):n=e[2];let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=a.jsx(St,{children:a.jsx(yt,{to:"/login",replace:!0})}),e[3]=l):l=e[3];let i;return e[4]!==n?(i=a.jsxs(a.Fragment,{children:[o,n,l]}),e[4]=n,e[5]=i):i=e[5],i}function Hn(t){const e=x.c(5),{children:s,className:o}=t;let n;e[0]!==o?(n=$("fixed top-0 left-0 right-0 z-20 bg-sidebar flex items-center w-full h-12 border-b border-border",o),e[0]=o,e[1]=n):n=e[1];let l;return e[2]!==s||e[3]!==n?(l=a.jsx("div",{className:n,children:s}),e[2]=s,e[3]=n,e[4]=l):l=e[4],l}function Un(t){const e=x.c(5),{children:s,className:o}=t;let n;e[0]!==o?(n=$("flex items-center justify-center px-2 h-full border-r border-border",o),e[0]=o,e[1]=n):n=e[1];let l;return e[2]!==s||e[3]!==n?(l=a.jsx("div",{className:n,children:s}),e[2]=s,e[3]=n,e[4]=l):l=e[4],l}function Bn(t){const e=x.c(5),{children:s,className:o}=t;let n;e[0]!==o?(n=$("flex items-center gap-2 px-2 h-full",o),e[0]=o,e[1]=n):n=e[1];let l;return e[2]!==s||e[3]!==n?(l=a.jsx("div",{className:n,children:s}),e[2]=s,e[3]=n,e[4]=l):l=e[4],l}function Gn(t){const e=x.c(5),{children:s,className:o}=t;let n;e[0]!==o?(n=$("flex items-center gap-2 px-2 h-full flex-1",o),e[0]=o,e[1]=n):n=e[1];let l;return e[2]!==s||e[3]!==n?(l=a.jsx("div",{className:n,children:s}),e[2]=s,e[3]=n,e[4]=l):l=e[4],l}function Wn(t){const e=x.c(5),{children:s,className:o}=t;let n;e[0]!==o?(n=$("flex items-center gap-2 px-2 h-full ml-auto",o),e[0]=o,e[1]=n):n=e[1];let l;return e[2]!==s||e[3]!==n?(l=a.jsx("div",{className:n,children:s}),e[2]=s,e[3]=n,e[4]=l):l=e[4],l}function Vn(){const t=x.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a.jsx("div",{className:"flex items-center justify-center px-2 h-full border-r border-border",children:a.jsx("div",{className:"w-8 h-8 bg-muted rounded-md animate-pulse"})}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=a.jsx("div",{className:"flex items-center gap-2 px-2 h-full",children:a.jsx("div",{className:"w-32 h-6 bg-muted rounded-md animate-pulse"})}),t[1]=s):s=t[1];let o;return t[2]===Symbol.for("react.memo_cache_sentinel")?(o=a.jsxs("div",{className:"fixed top-0 left-0 right-0 z-20 bg-sidebar flex items-center w-full h-12 border-b border-border",children:[e,s,a.jsx("div",{className:"flex items-center gap-2 px-2 h-full ml-auto",children:a.jsx("div",{className:"w-8 h-8 bg-muted rounded-full animate-pulse"})})]}),t[2]=o):o=t[2],o}const se=Object.assign(Hn,{Sidebar:Un,Left:Bn,Center:Gn,Right:Wn,Skeleton:Vn});function tt(){const t=x.c(3),{toggleSidebar:e}=me();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=a.jsx(Ee,{className:"text-muted-foreground/85 group-hover:text-foreground transition-colors",size:20}),t[0]=s):s=t[0];let o;return t[1]!==e?(o=a.jsx(a.Fragment,{children:a.jsx(W,{onClick:e,size:"icon",variant:"ghost",className:"w-8 h-8 rounded-md",children:s})}),t[1]=e,t[2]=o):o=t[2],o}tt.Skeleton=function(){return a.jsx("div",{className:"w-8 h-8 bg-muted rounded-md animate-pulse"})};const Fn="https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png";function ve(t){const e=x.c(18),{showSidebarToggle:s,showOrgSwitcher:o,showDecoChat:n}=t,l=s===void 0?!1:s,i=o===void 0?!1:o,r=n===void 0?!1:n,[,c]=ue();let d;e[0]!==c?(d=()=>c(Kn),e[0]=c,e[1]=d):d=e[1];const u=d;let m;e[2]!==l?(m=l&&a.jsx(se.Sidebar,{children:a.jsx(tt,{})}),e[2]=l,e[3]=m):m=e[3];let f;e[4]!==i?(f=i&&a.jsx(w.Suspense,{fallback:a.jsx(re.Skeleton,{}),children:a.jsx(re,{})}),e[4]=i,e[5]=f):f=e[5];let p;e[6]!==f?(p=a.jsx(se.Left,{children:f}),e[6]=f,e[7]=p):p=e[7];let h;e[8]!==r||e[9]!==u?(h=r&&a.jsxs(W,{size:"sm",variant:"default",onClick:u,children:[a.jsx(Q,{url:Fn,fallback:"DC",size:"2xs",className:"rounded-sm"}),"deco chat"]}),e[8]=r,e[9]=u,e[10]=h):h=e[10];let v;e[11]===Symbol.for("react.memo_cache_sentinel")?(v=a.jsx(En,{}),e[11]=v):v=e[11];let g;e[12]!==h?(g=a.jsxs(se.Right,{className:"gap-2",children:[h,v]}),e[12]=h,e[13]=g):g=e[13];let b;return e[14]!==g||e[15]!==m||e[16]!==p?(b=a.jsxs(se,{children:[m,p,g]}),e[14]=g,e[15]=m,e[16]=p,e[17]=b):b=e[17],b}function Kn(t){return!t}function Yn(t){const e=x.c(10),{children:s,className:o}=t,[,n]=w.useTransition();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=ee.decoChatPanelWidth(),e[0]=l):l=e[0];const[i,r]=Z(l,30);let c;e[1]!==r?(c=f=>n(()=>r(f)),e[1]=r,e[2]=c):c=e[2];const d=c;let u;e[3]!==o?(u=$("min-w-0",o),e[3]=o,e[4]=u):u=e[4];let m;return e[5]!==i||e[6]!==s||e[7]!==d||e[8]!==u?(m=a.jsx(ye,{defaultSize:i,minSize:20,className:u,onResize:d,children:s}),e[5]=i,e[6]=s,e[7]=d,e[8]=u,e[9]=m):m=e[9],m}function Zn(t){const e=x.c(5),{children:s}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=ee.sidebarOpen(),e[0]=o):o=e[0];const[n,l]=Z(o,!0);let i;return e[1]!==s||e[2]!==l||e[3]!==n?(i=a.jsx(Gs,{open:n,onOpenChange:l,children:s}),e[1]=s,e[2]=l,e[3]=n,e[4]=i):i=e[4],i}function qn(){const t=x.c(9),[e]=ue();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=a.jsx(ye,{className:"bg-background",children:a.jsx(Se,{})}),t[0]=s):s=t[0];let o;t[1]!==e?(o=a.jsx(es,{withHandle:e}),t[1]=e,t[2]=o):o=t[2];const n=e?"max-w-none":"max-w-0";let l;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=a.jsx(de,{children:a.jsx(w.Suspense,{fallback:a.jsx(ts,{}),children:a.jsx($s,{})})}),t[3]=l):l=t[3];let i;t[4]!==n?(i=a.jsx(Yn,{className:n,children:l}),t[4]=n,t[5]=i):i=t[5];let r;return t[6]!==o||t[7]!==i?(r=a.jsxs(ss,{direction:"horizontal",children:[s,o,i]}),t[6]=o,t[7]=i,t[8]=r):r=t[8],r}function Qn(){const t=x.c(19);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={strict:!1},t[0]=e):e=t[0];const{org:s}=ce(e);let o;t[1]!==s?(o=je.activeOrganization(s),t[1]=s,t[2]=o):o=t[2];let n;t[3]!==s?(n=async()=>{if(!s)return null;const{data:p}=await J.organization.setActive({organizationSlug:s});return{org:p,project:{slug:Rt}}},t[3]=s,t[4]=n):n=t[4];let l;t[5]!==o||t[6]!==n?(l={queryKey:o,queryFn:n,gcTime:1/0,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnMount:!1},t[5]=o,t[6]=n,t[7]=l):l=t[7];const{data:i}=Ct(l);if(!i){let p;t[8]===Symbol.for("react.memo_cache_sentinel")?(p=a.jsx(ve,{}),t[8]=p):p=t[8];let h;return t[9]===Symbol.for("react.memo_cache_sentinel")?(h=a.jsxs("div",{className:"min-h-screen bg-background",children:[p,a.jsx("div",{className:"pt-12",children:a.jsx(Se,{})})]}),t[9]=h):h=t[9],h}let r;t[10]===Symbol.for("react.memo_cache_sentinel")?(r=a.jsx(ve,{showSidebarToggle:!0,showOrgSwitcher:!0,showDecoChat:!0}),t[10]=r):r=t[10];let c;t[11]===Symbol.for("react.memo_cache_sentinel")?(c={"--sidebar-width":"13rem","--sidebar-width-mobile":"11rem"},t[11]=c):c=t[11];let d;t[12]===Symbol.for("react.memo_cache_sentinel")?(d=a.jsx(rn,{}),t[12]=d):d=t[12];let u;t[13]===Symbol.for("react.memo_cache_sentinel")?(u=a.jsx(Zn,{children:a.jsxs("div",{className:"flex flex-col h-screen",children:[r,a.jsxs(Fs,{className:"flex-1 bg-sidebar",style:c,children:[d,a.jsx(Ys,{className:"pt-12",children:a.jsx(qn,{})})]})]})}),t[13]=u):u=t[13];let m;t[14]!==i.org.slug?(m=a.jsx(js,{children:u},i.org.slug),t[14]=i.org.slug,t[15]=m):m=t[15];let f;return t[16]!==i||t[17]!==m?(f=a.jsx(Pt,{...i,children:m}),t[16]=i,t[17]=m,t[18]=f):f=t[18],f}function Lo(){const t=x.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a.jsx(Ln,{children:a.jsx(w.Suspense,{fallback:a.jsx(we,{}),children:a.jsx(Qn,{})})}),t[0]=e):e=t[0],e}export{Lo as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ap as H,aq as D,ar as G,as as q,at as Y,au as Z,r as T,c as A,j as s,g as _,K as J,a as X,f as ee,s as te}from"./index-OjgkLDRY.js";import{i as se,g as ie,a as le}from"./well-known-mcp-DgDkk-rH.js";import{C as re}from"./collection-header-DUMmszqZ.js";import{I as ne,b as ae,c as oe,a as W,u as ce}from"./use-connection-Bva8lo0T.js";import{b as de,T as me,c as fe,u as z}from"./tooltip-BNR213_s.js";import{s as ue}from"./slugify-CEUa2lfQ.js";import{n as he}from"./Inbox01-Cwh_U6Yy.js";import{i as Q}from"./Loading01-lzLKWums.js";import{i as xe,E as pe}from"./SearchMd-3Wd2TwbA.js";import{C as ge}from"./collection-search-BLREvhln.js";import{C as ve}from"./card-DV2_nXad.js";import{g as je,f as Ne,a as ye}from"./registry-utils-ulDDT0d8.js";import{e as Ce}from"./app-name-gTETL9So.js";import{d as we,a as Se,b as be,c as Pe,S as Re}from"./select-BbFQz4Zb.js";import{s as Ie}from"./Plus-Bl6yi8F8.js";import{B}from"./button--R5o0wL7.js";import{a as ke}from"./use-binding-BA2o2u6B.js";import{L as Ee,u as Le}from"./localstorage-keys-BKdNuRRM.js";import"./collection-display-button-BDu-CjA3.js";import"./dropdown-menu-CvIw74N_.js";import"./view-mode-toggle-RcIHDc_9.js";import"./input-DkUxKlvC.js";import"./ChevronDown-293zKGHe.js";import"./auth-BYQ5JBPH.js";import"./useQuery-CJBdsmlt.js";var Me=class extends H{constructor(t,e){super(t,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){super.setOptions({...t,behavior:D()})}getOptimisticResult(t){return t.behavior=D(),super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,e){const{state:l}=t,f=super.createResult(t,e),{isFetching:o,isRefetching:h,isError:a,isRefetchError:c}=f,r=l.fetchMeta?.fetchMore?.direction,i=a&&r==="forward",n=o&&r==="forward",d=a&&r==="backward",x=o&&r==="backward";return{...f,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:q(e,l.data),hasPreviousPage:G(e,l.data),isFetchNextPageError:i,isFetchingNextPage:n,isFetchPreviousPageError:d,isFetchingPreviousPage:x,isRefetchError:c&&!i&&!d,isRefetching:h&&!n&&!x}}};function Te(t,e){return Y({...t,enabled:!0,suspense:!0,throwOnError:Z},Me,e)}const U=({size:t=24,color:e="currentColor",...l})=>T.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...l},T.createElement("path",{d:"m9 12 2 2 4.5-4.5m2.401-4.501a2.03 2.03 0 0 0 1.1 1.1l1.744.723a2.033 2.033 0 0 1 1.1 2.656l-.722 1.744a2.03 2.03 0 0 0 0 1.556l.722 1.744a2.033 2.033 0 0 1-1.1 2.656L19 17.901A2.033 2.033 0 0 0 17.9 19l-.723 1.745a2.032 2.032 0 0 1-2.656 1.1l-1.744-.722a2.032 2.032 0 0 0-1.555 0l-1.745.723a2.033 2.033 0 0 1-2.654-1.1L6.1 19.001A2.033 2.033 0 0 0 5 17.9l-1.744-.723a2.033 2.033 0 0 1-1.1-2.654l.721-1.744a2.033 2.033 0 0 0 0-1.556l-.722-1.746a2.033 2.033 0 0 1 1.1-2.657L5 6.098A2.03 2.03 0 0 0 6.1 5l.723-1.745a2.033 2.033 0 0 1 2.656-1.1l1.744.722a2.033 2.033 0 0 0 1.555-.001l1.746-.72a2.032 2.032 0 0 1 2.655 1.1l.723 1.746v-.003Z"}));U.displayName="CheckVerified02";function Ae(t){const e=t.title||t.server.title||t.id||"Unnamed Item",l=t.server.description||null,f=t.server.icons?.[0]?.src||je(t.server.repository)||null,o=t._meta?.["mcp.mesh"]?.verified??!1,h=t.server.version,c=(t.server.remotes?.length??0)>0;let r=e,i=null;if(e.includes("/")){const n=e.split("/");n.length>=2&&(i=n[0]||null,r=Ce(e))}if(!i){const n=t._meta?.["mcp.mesh"]?.scopeName,d=t._meta?.["mcp.mesh"]?.appName;n&&d?i=`${n}/${d}`:n&&(i=n)}return{icon:f,scopeName:i,displayName:r,description:l,version:h||null,isVerified:o,canInstall:c}}function Ke(t){const e=A.c(39),{icon:l,scopeName:f,displayName:o,description:h,isVerified:a,canInstall:c,onClick:r}=t;let i;e[0]!==o||e[1]!==l?(i=s.jsx(ne,{icon:l,name:o,size:"md",className:"shadow-sm"}),e[0]=o,e[1]=l,e[2]=i):i=e[2];let n;e[3]!==o?(n=s.jsx("span",{className:"truncate",children:o}),e[3]=o,e[4]=n):n=e[4];let d;e[5]!==a?(d=a&&s.jsx(U,{size:16,className:"text-success shrink-0"}),e[5]=a,e[6]=d):d=e[6];let x;e[7]!==c?(x=!c&&s.jsx(se,{size:16,className:"text-muted-foreground shrink-0"}),e[7]=c,e[8]=x):x=e[8];let v;e[9]!==n||e[10]!==d||e[11]!==x?(v=s.jsx(de,{asChild:!0,children:s.jsxs("div",{className:"flex items-center gap-2 text-base font-medium min-w-0",children:[n,d,x]})}),e[9]=n,e[10]=d,e[11]=x,e[12]=v):v=e[12];let m;e[13]!==o?(m=s.jsx("p",{children:o}),e[13]=o,e[14]=m):m=e[14];let p;e[15]!==c?(p=!c&&s.jsx("p",{className:"text-xs mt-1",children:"No connection available"}),e[15]=c,e[16]=p):p=e[16];let g;e[17]!==m||e[18]!==p?(g=s.jsxs(me,{children:[m,p]}),e[17]=m,e[18]=p,e[19]=g):g=e[19];let y;e[20]!==v||e[21]!==g?(y=s.jsxs(fe,{children:[v,g]}),e[20]=v,e[21]=g,e[22]=y):y=e[22];let C;e[23]!==f?(C=f&&s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:f}),e[23]=f,e[24]=C):C=e[24];let b;e[25]!==C||e[26]!==y?(b=s.jsx("div",{className:"flex gap-2 items-start min-w-0 flex-1",children:s.jsxs("div",{className:"min-w-0 flex-1",children:[y,C]})}),e[25]=C,e[26]=y,e[27]=b):b=e[27];let w;e[28]!==i||e[29]!==b?(w=s.jsxs("div",{className:"flex gap-3",children:[i,b]}),e[28]=i,e[29]=b,e[30]=w):w=e[30];const P=h||"No description available";let j;e[31]!==P?(j=s.jsx("div",{className:"grid grid-cols-1 gap-1 min-w-0",children:s.jsx("div",{className:"text-sm text-muted-foreground line-clamp-2",children:P})}),e[31]=P,e[32]=j):j=e[32];let u;e[33]!==w||e[34]!==j?(u=s.jsxs("div",{className:"flex flex-col gap-4 h-full relative",children:[w,j]}),e[33]=w,e[34]=j,e[35]=u):u=e[35];let S;return e[36]!==r||e[37]!==u?(S=s.jsx(ve,{className:"p-6 cursor-pointer hover:bg-muted/50 transition-colors",onClick:r,children:u}),e[36]=r,e[37]=u,e[38]=S):S=e[38],S}function V(t){const e=A.c(12),{items:l,title:f,onItemClick:o}=t;if(l.length===0)return null;let h;e[0]!==f?(h=f&&s.jsx("div",{className:"flex items-center justify-between w-max gap-2",children:s.jsx("h2",{className:"text-lg font-medium",children:f})}),e[0]=f,e[1]=h):h=e[1];let a;if(e[2]!==l||e[3]!==o){let i;e[5]!==o?(i=n=>{const d=Ae(n);return s.jsx(Ke,{...d,onClick:()=>o(n)},n.id)},e[5]=o,e[6]=i):i=e[6],a=l.map(i),e[2]=l,e[3]=o,e[4]=a}else a=e[4];let c;e[7]!==a?(c=s.jsx("div",{className:"grid grid-cols-4 gap-4",children:a}),e[7]=a,e[8]=c):c=e[8];let r;return e[9]!==h||e[10]!==c?(r=s.jsxs("div",{className:"flex flex-col gap-4",children:[h,c]}),e[9]=h,e[10]=c,e[11]=r):r=e[11],r}function $e(t,e){if(!e)return t;const l=e.toLowerCase();return t.filter(f=>(f.name||f.title||"").toLowerCase().includes(l)||(f.description||f.server.description||"").toLowerCase().includes(l))}function Oe(t){return t.verified===!0||t._meta?.["mcp.mesh"]?.verified===!0||t.server._meta?.["mcp.mesh"]?.verified===!0}function Fe(t){const e=A.c(32),{items:l,isLoadingMore:f,registryId:o,hasMore:h,onLoadMore:a}=t,c=f===void 0?!1:f,r=h===void 0?!1:h,[i,n]=T.useState(""),d=_(),{org:x}=z(),v=T.useRef(null);let m,p,g;e[0]!==l||e[1]!==i?(m=$e(l,i),g=m.filter(Oe),p=m.filter(R=>!g.find(I=>I.id===R.id)),e[0]=l,e[1]=i,e[2]=m,e[3]=p,e[4]=g):(m=e[2],p=e[3],g=e[4]);const y=p;let C;e[5]!==d||e[6]!==x.slug||e[7]!==o?(C=R=>{const I=ue(R.name||R.title||R.server.title||""),L=R.server.name;d({to:"/$org/store/$appName",params:{org:x.slug,appName:I},search:{registryId:o,serverName:L}})},e[5]=d,e[6]=x.slug,e[7]=o,e[8]=C):C=e[8];const b=C;let w;e[9]!==r||e[10]!==c||e[11]!==a||e[12]!==i?(w=R=>{if(!r||!a||i||c)return;const I=R.currentTarget;I.scrollHeight-I.scrollTop-I.clientHeight<200&&a()},e[9]=r,e[10]=c,e[11]=a,e[12]=i,e[13]=w):w=e[13];const P=w;let j;e[14]===Symbol.for("react.memo_cache_sentinel")?(j=R=>{R.key==="Enter"&&n(R.currentTarget.value)},e[14]=j):j=e[14];let u;e[15]!==i?(u=s.jsx(ge,{value:i,onChange:n,placeholder:"Search for an MCP Server...",onKeyDown:j}),e[15]=i,e[16]=u):u=e[16];let S;e[17]!==y||e[18]!==m||e[19]!==b||e[20]!==r||e[21]!==c||e[22]!==l.length||e[23]!==i||e[24]!==g?(S=s.jsx("div",{className:"p-5",children:s.jsx("div",{children:l.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(he,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"No items available"}),s.jsx("p",{className:"text-muted-foreground",children:"This store doesn't have any available items yet."})]}):i&&m.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(xe,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"No results found"}),s.jsx("p",{className:"text-muted-foreground",children:"Try adjusting your search terms."})]}):s.jsxs("div",{className:"flex flex-col gap-8",children:[g.length>0&&s.jsx(V,{items:g,title:"Verified",onItemClick:b}),y.length>0&&s.jsx(V,{items:y,title:g.length>0?"All":"",onItemClick:b}),r&&!i&&c&&s.jsx("div",{className:"flex justify-center py-8",children:s.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[s.jsx(Q,{size:20,className:"animate-spin"}),s.jsx("span",{className:"text-sm",children:"Loading more items..."})]})})]})})}),e[17]=y,e[18]=m,e[19]=b,e[20]=r,e[21]=c,e[22]=l.length,e[23]=i,e[24]=g,e[25]=S):S=e[25];let k;e[26]!==P||e[27]!==S?(k=s.jsx("div",{ref:v,className:"flex-1 overflow-y-auto",onScroll:P,children:S}),e[26]=P,e[27]=S,e[28]=k):k=e[28];let E;return e[29]!==u||e[30]!==k?(E=s.jsxs("div",{className:"flex flex-col h-full",children:[u,k]}),e[29]=u,e[30]=k,e[31]=E):E=e[31],E}const F=24;function ze(t){const e=A.c(27),{registryId:l}=t,f=ae(l);let o,h,a,c;if(e[0]!==f?.tools||e[1]!==l){if(o=Ne(f?.tools),!o)throw new Error("This registry does not support listing store items.");let u;e[6]!==l?(u=oe(l),e[6]=l,e[7]=u):u=e[7],c=u,a=Te,h=J.toolCall(l,o,JSON.stringify({limit:F})),e[0]=f?.tools,e[1]=l,e[2]=o,e[3]=h,e[4]=a,e[5]=c}else o=e[2],h=e[3],a=e[4],c=e[5];let r;e[8]!==o||e[9]!==c?(r=async u=>{const{pageParam:S}=u;return await c(o,S?{cursor:S,limit:F}:{limit:F})},e[8]=o,e[9]=c,e[10]=r):r=e[10];let i;e[11]!==h||e[12]!==r?(i={queryKey:h,queryFn:r,initialPageParam:void 0,getNextPageParam:De,staleTime:36e5},e[11]=h,e[12]=r,e[13]=i):i=e[13];const{data:n,fetchNextPage:d,hasNextPage:x,isFetchingNextPage:v}=a(i);let m;e:{if(!n?.pages||n.pages.length===0){m=null;break e}const u=n.pages[0];if(typeof u=="object"&&u!==null&&"totalCount"in u&&typeof u.totalCount=="number"){m=u.totalCount;break e}m=null}const p=m,g=n?.pages;let y;e[14]!==g?(y=ye(g),e[14]=g,e[15]=y):y=e[15];const C=y;let b;e[16]!==d||e[17]!==x||e[18]!==v?(b=()=>{x&&!v&&d()},e[16]=d,e[17]=x,e[18]=v,e[19]=b):b=e[19];const w=b,P=x??!1;let j;return e[20]!==C||e[21]!==w||e[22]!==v||e[23]!==l||e[24]!==P||e[25]!==p?(j=s.jsx(Fe,{items:C,isLoadingMore:v,registryId:l,hasMore:P,onLoadMore:w,totalCount:p}),e[20]=C,e[21]=w,e[22]=v,e[23]=l,e[24]=P,e[25]=p,e[26]=j):j=e[26],j}function De(t){if(typeof t=="object"&&t!==null){const e=t.nextCursor||t.cursor;if(e)return e}}function Be(t){const e=A.c(15),{registries:l,value:f,onValueChange:o,onAddWellKnown:h,wellKnownRegistries:a,placeholder:c}=t,r=c===void 0?"Select a registry...":c;let i;e[0]!==r?(i=s.jsx(Se,{className:"w-[200px] h-8!",children:s.jsx(be,{placeholder:r})}),e[0]=r,e[1]=i):i=e[1];let n;e[2]!==l?(n=l.map(Ve),e[2]=l,e[3]=n):n=e[3];let d;e[4]!==h||e[5]!==a?(d=a.length>0&&s.jsxs("div",{className:"border-t border-border pt-1",children:[s.jsx("p",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:"Other known registries"}),a.map(m=>s.jsxs("button",{onClick:p=>{p.preventDefault(),p.stopPropagation(),h(m)},className:"relative flex w-full cursor-pointer items-center gap-2 rounded-xl py-1.5 pr-8 pl-2 text-sm outline-hidden select-none hover:bg-accent hover:text-accent-foreground",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[m.icon?s.jsx("img",{src:m.icon,alt:m.title,className:"w-4 h-4 rounded"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:m.title.slice(0,1).toUpperCase()}),s.jsx("span",{className:"flex-1",children:m.title})]}),s.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center text-muted-foreground",children:s.jsx(Ie,{size:16})})]},m.id??m.title))]}),e[4]=h,e[5]=a,e[6]=d):d=e[6];let x;e[7]!==n||e[8]!==d?(x=s.jsxs(Pe,{children:[n,d]}),e[7]=n,e[8]=d,e[9]=x):x=e[9];let v;return e[10]!==o||e[11]!==i||e[12]!==x||e[13]!==f?(v=s.jsxs(Re,{value:f,onValueChange:o,children:[i,x]}),e[10]=o,e[11]=i,e[12]=x,e[13]=f,e[14]=v):v=e[14],v}function Ve(t){return s.jsx(we,{className:"cursor-pointer",value:t.id??t.name,children:s.jsxs("div",{className:"flex items-center gap-2",children:[t.icon?s.jsx("img",{src:t.icon,alt:t.name,className:"w-4 h-4 rounded"}):s.jsx("div",{className:"w-4 h-4 rounded from-primary/20 to-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:t.name.slice(0,1).toUpperCase()}),s.jsx("span",{children:t.name})]})},t.id??t.name)}function _e({registries:t,onConnected:e}){const l=W(),{org:{slug:f}}=z(),{data:o}=X.useSession(),h=_(),[a,c]=T.useState(!1),r=t[0],i=async()=>{if(!(!r||!o?.user?.id)){c(!0);try{const d=await l.create.mutateAsync(r);e?.(d.id)}finally{c(!1)}}},n=()=>{h({to:"/$org/mcps",params:{org:f},search:{action:"create"}})};return s.jsx(pe,{image:s.jsx("img",{src:"/store-empty-state.svg",alt:"No store connected",width:336,height:320,className:"max-w-full h-auto"}),title:"Connect to registry",description:"Connect to discover and use MCP Servers from the community.",actions:s.jsxs(s.Fragment,{children:[s.jsxs(B,{variant:"outline",onClick:i,disabled:a||!r,children:[r?.icon&&s.jsx("img",{src:r.icon,alt:"",className:"size-4"}),a?"Installing...":"Install Registry"]}),s.jsx(B,{variant:"outline",onClick:n,children:"Install MCP Server"})]})})}function vt(){const t=A.c(41),{org:e}=z(),l=ce(),f=W(),o=ee(),h=o.location.pathname.includes("/store/")&&o.location.pathname.split("/").length>3,a=ke(l);let c;t[0]!==a?(c=a.map(Ue),t[0]=a,t[1]=c):c=t[1];const r=c;let i;t[2]!==e.slug?(i=Ee.selectedRegistry(e.slug),t[2]=e.slug,t[3]=i):i=t[3];const[n,d]=Le(i,Qe);let x;if(t[4]!==a||t[5]!==n){let N;t[7]!==n?(N=O=>O.id===n,t[7]=n,t[8]=N):N=t[8],x=a.find(N),t[4]=a,t[5]=n,t[6]=x}else x=t[6];const m=x?.id||a[0]?.id||"";let p;t[9]!==e.id?(p=ie(e.id),t[9]=e.id,t[10]=p):p=t[10];let g;t[11]!==p?(g=[p],t[11]=p,t[12]=g):g=t[12];const y=g;let C;t[13]===Symbol.for("react.memo_cache_sentinel")?(C=[le()],t[13]=C):C=t[13];const b=C;let w;t[14]!==f.create||t[15]!==d?(w=async N=>{const O=await f.create.mutateAsync(N);d(O.id)},t[14]=f.create,t[15]=d,t[16]=w):w=t[16];const P=w;let j;t[17]!==a?(j=new Set(a.map(We)),t[17]=a,t[18]=j):j=t[18];const u=j;let S;t[19]!==u||t[20]!==y?(S=y.filter(N=>N.id&&!u.has(N.id)),t[19]=u,t[20]=y,t[21]=S):S=t[21];const k=S;let E;t[22]!==u?(E=b.filter(N=>N.id&&!u.has(N.id)),t[22]=u,t[23]=E):E=t[23];const R=E;if(h){let N;return t[24]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(te,{}),t[24]=N):N=t[24],N}let I;t[25]!==P?(I=async N=>P(N),t[25]=P,t[26]=I):I=t[26];let L;t[27]!==k||t[28]!==m||t[29]!==r||t[30]!==d||t[31]!==I?(L=s.jsx(re,{title:"Store",ctaButton:s.jsx(Be,{wellKnownRegistries:k,registries:r,value:m,onValueChange:d,onAddWellKnown:I,placeholder:"Select store..."})}),t[27]=k,t[28]=m,t[29]=r,t[30]=d,t[31]=I,t[32]=L):L=t[32];let K;t[33]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[s.jsx(Q,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading store items..."})]}),t[33]=K):K=t[33];let M;t[34]!==R||t[35]!==m||t[36]!==d?(M=s.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:s.jsx(T.Suspense,{fallback:K,children:m?s.jsx(ze,{registryId:m}):s.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:s.jsx(_e,{registries:R,onConnected:N=>{d(N)}})})})}),t[34]=R,t[35]=m,t[36]=d,t[37]=M):M=t[37];let $;return t[38]!==L||t[39]!==M?($=s.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[L,M]}),t[38]=L,t[39]=M,t[40]=$):$=t[40],$}function We(t){return t.id}function Qe(){return""}function Ue(t){return{id:t.id,name:t.title,icon:t.icon||void 0}}export{vt as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{at as u,ap as s}from"./index-OjgkLDRY.js";function t(e,r){return u(e,s,r)}export{t as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as n}from"./index-OjgkLDRY.js";const i=({size:e=24,color:o="currentColor",...c})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:o,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...c},n.createElement("path",{d:"M17 10V8A5 5 0 0 0 7 8v2m5 4.5v2M8.8 21h6.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C20 18.72 20 17.88 20 16.2v-1.4c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C17.72 10 16.88 10 15.2 10H8.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C4 12.28 4 13.12 4 14.8v1.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C6.28 21 7.12 21 8.8 21Z"}));i.displayName="Lock01";const r="https://api.decocms.com/mcp/registry",t={SELF:"self",REGISTRY:"registry",COMMUNITY_REGISTRY:"community-registry"},s={SELF:e=>`${e}_${t.SELF}`,REGISTRY:e=>`${e}_${t.REGISTRY}`,COMMUNITY_REGISTRY:e=>`${e}_${t.COMMUNITY_REGISTRY}`};function l(e){return{id:s.REGISTRY(e),title:"Deco Store",description:"Official deco MCP registry with curated integrations",connection_type:"HTTP",connection_url:r,icon:"https://assets.decocache.com/decocms/00ccf6c3-9e13-4517-83b0-75ab84554bb9/596364c63320075ca58483660156b6d9de9b526e.png",app_name:"deco-registry",app_id:null,connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!0,type:"registry"}}}function d(){return{id:t.COMMUNITY_REGISTRY,title:"MCP Registry",description:"Community MCP registry with thousands of handy MCPs",connection_type:"HTTP",connection_url:"https://sites-registry.decocache.com/mcp",icon:"https://assets.decocache.com/decocms/cd7ca472-0f72-463a-b0de-6e44bdd0f9b4/mcp.png",app_name:"mcp-registry",app_id:null,connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!0,type:"registry"}}}export{t as W,d as a,l as g,i};
|