decocms 2.295.0 → 2.296.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-TmMuXcjl.js → AlertCircle-DGWwcoQZ.js} +1 -1
- package/dist/client/assets/{ArrowNarrowLeft-XQKT7KRo.js → ArrowNarrowLeft-6CbLfe6R.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-B1eJ8Zux.js → ArrowUpRight-DGFb4j2X.js} +1 -1
- package/dist/client/assets/{CheckCircle-CPpusm9-.js → CheckCircle-TABxOmV2.js} +1 -1
- package/dist/client/assets/{ChevronDown-XsMPED_o.js → ChevronDown-YpILLXr3.js} +1 -1
- package/dist/client/assets/{ChevronRight-DvnZfu1J.js → ChevronRight-C5cwFzdi.js} +1 -1
- package/dist/client/assets/{ChevronUp-g5JeXzsM.js → ChevronUp-D3ACbD1g.js} +1 -1
- package/dist/client/assets/{Container-D8zDQGz9.js → Container-CEV9uk-Z.js} +1 -1
- package/dist/client/assets/{DotsVertical-BOPp4_Zm.js → DotsVertical-uATdSTpl.js} +1 -1
- package/dist/client/assets/{LinkExternal01-CGJf1W_Z.js → LinkExternal01-DRPBZiOD.js} +1 -1
- package/dist/client/assets/{Lock01-LdcfCIRL.js → Lock01-BwE9ru6U.js} +1 -1
- package/dist/client/assets/{Palette-BGUZxjCc.js → Palette-BXvnxfG9.js} +1 -1
- package/dist/client/assets/{Play-DADQfe47.js → Play-DgZHjcoJ.js} +1 -1
- package/dist/client/assets/{Plus-C7kl4UV6.js → Plus-CCywDmjg.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-CrQnDm5g.js → RefreshCcw01-CtjTkTf4.js} +1 -1
- package/dist/client/assets/{SearchMd-CE8VI9gC.js → SearchMd-OYsWp4RC.js} +1 -1
- package/dist/client/assets/{Settings02-_WxqBg1B.js → Settings02-DxdBNXj6.js} +1 -1
- package/dist/client/assets/{Shield01-CieEV22y.js → Shield01-Qjvq_pQT.js} +1 -1
- package/dist/client/assets/{Star01-CoecGSHu.js → Star01-BP3IsurF.js} +1 -1
- package/dist/client/assets/{Sun-D-OJyv5-.js → Sun-beuoApqH.js} +1 -1
- package/dist/client/assets/{Tool01-w4UQOYN_.js → Tool01-CB2DUdHU.js} +1 -1
- package/dist/client/assets/{Trash01-O1QoDagR.js → Trash01-Rux2RMYE.js} +1 -1
- package/dist/client/assets/{User01-C1foHOaz.js → User01-CKOZDyFQ.js} +1 -1
- package/dist/client/assets/{Users03-BhdZR1Z1.js → Users03-CrrZL9MY.js} +1 -1
- package/dist/client/assets/{X-DgFNaccu.js → X-Cg5jWZ6W.js} +1 -1
- package/dist/client/assets/{XCircle-D0VmL_m9.js → XCircle-m0QK52Tq.js} +1 -1
- package/dist/client/assets/{XClose-BkeTzjOp.js → XClose-N2VTvn-z.js} +1 -1
- package/dist/client/assets/{Zap-DUFASc4_.js → Zap-DHpdmH1S.js} +1 -1
- package/dist/client/assets/{ZapSquare-CaSKDWHD.js → ZapSquare-CpCXmnKj.js} +1 -1
- package/dist/client/assets/{accordion-DRSjy726.js → accordion-CCTO7OqO.js} +1 -1
- package/dist/client/assets/{agent-icon-BhmyvzVy.js → agent-icon-BhGa08Fl.js} +1 -1
- package/dist/client/assets/{agents-list-LdRYJqAA.js → agents-list-BCvsLrk3.js} +1 -1
- package/dist/client/assets/ai-providers-CM3jlHKz.js +1 -0
- package/dist/client/assets/{alert-dialog-DTrs5R7J.js → alert-dialog-BvOLTTjL.js} +1 -1
- package/dist/client/assets/{auth-catchall-CczzVYAx.js → auth-catchall-Clb5yvZc.js} +1 -1
- package/dist/client/assets/{automation-list-row-CkuYa5Xq.js → automation-list-row-BP2xxw0G.js} +1 -1
- package/dist/client/assets/{automations-DzTmGwbV.js → automations-CMWGklob.js} +1 -1
- package/dist/client/assets/{avatar-DHedl4lM.js → avatar-Di9GD8dd.js} +1 -1
- package/dist/client/assets/{badge-CUROAd7Y.js → badge-mnYUd_xY.js} +1 -1
- package/dist/client/assets/{brand-context-MhkHZ_rd.js → brand-context-Lx9rMG-L.js} +1 -1
- package/dist/client/assets/{card-DRRYnLR5.js → card-DL6KKkK7.js} +1 -1
- package/dist/client/assets/{chat-context-BIEHgp18.js → chat-context-mYdLYubP.js} +1 -1
- package/dist/client/assets/{checkbox-BTh_K87_.js → checkbox-BYgqHfbE.js} +1 -1
- package/dist/client/assets/{collection-detail-DM6Y21iP.js → collection-detail-BCzBqbUR.js} +1 -1
- package/dist/client/assets/{collection-display-button-BXsRpfWh.js → collection-display-button-CtGgHUwN.js} +1 -1
- package/dist/client/assets/{collection-search-BLwJ-m2r.js → collection-search-CS-ZVub-.js} +1 -1
- package/dist/client/assets/{collection-search-13gXcoNW.js → collection-search-D9AiUt0i.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-BooWJqsY.js → collection-table-wrapper-CuIF1tqK.js} +1 -1
- package/dist/client/assets/{collection-tabs-C2kDDRsi.js → collection-tabs-CQzwJ8u9.js} +1 -1
- package/dist/client/assets/{collections-_hjyrDNM.js → collections-CxHTq2dT.js} +1 -1
- package/dist/client/assets/{command-vxtKK455.js → command-s71Khs6g.js} +1 -1
- package/dist/client/assets/{connection-card-BxYJJKnz.js → connection-card-ICJdFYlE.js} +1 -1
- package/dist/client/assets/{connection-detail-Bbwh3ZPp.js → connection-detail-C-LieaDQ.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-MZU_9Qmb.js → connection-form-helpers-BWfgsLZZ.js} +1 -1
- package/dist/client/assets/{connections-CdIKHQiA.js → connections-CNXnRXJ2.js} +1 -1
- package/dist/client/assets/{constants-Bwo9TbsB.js → constants-BJnjE8Tt.js} +1 -1
- package/dist/client/assets/{constants-CQ_wYHud.js → constants-ajN1Bhug.js} +1 -1
- package/dist/client/assets/{dialog-qUGJw8fC.js → dialog-YE4SL2S_.js} +1 -1
- package/dist/client/assets/{domain-settings-PW3cTWJG.js → domain-settings-DjkUX6V3.js} +1 -1
- package/dist/client/assets/{drawer-C92DFVm0.js → drawer-DoyG2yiq.js} +1 -1
- package/dist/client/assets/{dropdown-menu-SKNeSVuW.js → dropdown-menu-CT4y7aY2.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-BcIicEBf.js → dynamic-plugin-layout-ButDequ-.js} +1 -1
- package/dist/client/assets/{empty-state-LwBr5UHb.js → empty-state-8HZoUHAZ.js} +1 -1
- package/dist/client/assets/{empty-state-E0el_m_Z.js → empty-state-BSrKgguR.js} +1 -1
- package/dist/client/assets/{extract-connection-data-DoQ8Agh8.js → extract-connection-data-D_uDRowj.js} +1 -1
- package/dist/client/assets/{features-CFVyOGN4.js → features-DEPC_xpZ.js} +1 -1
- package/dist/client/assets/{form-DcpGmWEm.js → form-BbmPNrg3.js} +1 -1
- package/dist/client/assets/{general-CfMy1R6k.js → general-D6g4KKmC.js} +1 -1
- package/dist/client/assets/{index-16QTCuVi.js → index-B5pffmvD.js} +3 -3
- package/dist/client/assets/{index-Bei9_KoS.js → index-B7ZBAwSD.js} +1 -1
- package/dist/client/assets/index-BBkns99x.js +1 -0
- package/dist/client/assets/{index-Kp_u_eOI.js → index-BEJTb0Vw.js} +1 -1
- package/dist/client/assets/{index-DWP35Bmu.js → index-BMNXmL0A.js} +1 -1
- package/dist/client/assets/{index-Cf47l9oa.js → index-BjPD6k7-.js} +1 -1
- package/dist/client/assets/{index-6CBqUZKF.js → index-BoZfrZ34.js} +1 -1
- package/dist/client/assets/{index-BLaDEfeN.js → index-BqwQgnOI.js} +1 -1
- package/dist/client/assets/{index-DSFZ7nsY.js → index-C7tDpZrl.js} +1 -1
- package/dist/client/assets/{index-BAywNAd0.js → index-CariFzvs.js} +2 -2
- package/dist/client/assets/{index-_iFpWniT.js → index-DMby3CEd.js} +1 -1
- package/dist/client/assets/{index-CzqHZVv3.js → index-D_1AR6r3.js} +1 -1
- package/dist/client/assets/{index-Uxv9KeQf.js → index-Dcc7hO3D.js} +1 -1
- package/dist/client/assets/{index-CnMeIIuF.js → index-DfKVv3Jm.js} +1 -1
- package/dist/client/assets/{index-GLonPniQ.js → index-Duwc2HjF.js} +1 -1
- package/dist/client/assets/{index-CHNkGrWb.js → index-FEqdxfIc.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-CsxksMd0.js → infiniteQueryObserver-B14O_xhx.js} +1 -1
- package/dist/client/assets/{input-BqrzTDvC.js → input-DHEAaYve.js} +1 -1
- package/dist/client/assets/{integration-icon-Cw-LLP9G.js → integration-icon-Ceb5m9KS.js} +1 -1
- package/dist/client/assets/{label-Cq6u2Lh-.js → label-BMzmJDQh.js} +1 -1
- package/dist/client/assets/{layout-CUERkpHe.js → layout-DOsauSuM.js} +1 -1
- package/dist/client/assets/{lean-canvas-recruit-modal-B99UeYIe.js → lean-canvas-recruit-modal-BkLS8u5W.js} +1 -1
- package/dist/client/assets/{login-CjZqIBoL.js → login-B-Yrcjhs.js} +1 -1
- package/dist/client/assets/{members-Bj8baHVz.js → members-C0mvo5fb.js} +1 -1
- package/dist/client/assets/{monaco-editor-BXagKiI7.js → monaco-editor-BagFQ75t.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-BkU2srVh.js → monitoring-stats-row-DDPUNMkL.js} +1 -1
- package/dist/client/assets/{oauth-callback-Cqf2XK5j.js → oauth-callback-DO6ysGop.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-DrfnGdmp.js → oauth-callback-ai-provider-BEuoh6UY.js} +1 -1
- package/dist/client/assets/{onboarding-D-Fll1Qd.js → onboarding-DKITn4vN.js} +1 -1
- package/dist/client/assets/{org-layout-Ctr8m-Xy.js → org-layout-Dk4WIIF4.js} +1 -1
- package/dist/client/assets/{org-plugin-layout-BhS0DGxL.js → org-plugin-layout-CLffcHJs.js} +1 -1
- package/dist/client/assets/{pair-D59ITUWs.js → pair-vGTs_zPg.js} +56 -56
- package/dist/client/assets/{plugin-empty-state-CqpHZZ90.js → plugin-empty-state-CmHCNawV.js} +1 -1
- package/dist/client/assets/{plugin-header-CfMDsQ5-.js → plugin-header-C9WSKk3D.js} +1 -1
- package/dist/client/assets/{plugin-layout-DApFJ0hx.js → plugin-layout-DOzo0-WT.js} +1 -1
- package/dist/client/assets/{popover-CIQ5nYbk.js → popover-5Qa5l709.js} +1 -1
- package/dist/client/assets/{profile--MuhnyFH.js → profile-CyjcpQTt.js} +1 -1
- package/dist/client/assets/{project-app-view-C6unfZ4i.js → project-app-view-BL-P3zUl.js} +1 -1
- package/dist/client/assets/registry-BlMP6ABP.js +2 -0
- package/dist/client/assets/{registry-layout-CdfbaMKP.js → registry-layout-CIMBhCba.js} +1 -1
- package/dist/client/assets/{required-auth-layout-DAS0oBtI.js → required-auth-layout-BOwcnbO9.js} +1 -1
- package/dist/client/assets/{reset-password-BI6L3oGg.js → reset-password-Cl6CDyqy.js} +1 -1
- package/dist/client/assets/{roles-C20gcBRH.js → roles-DTF2ANjI.js} +1 -1
- package/dist/client/assets/{scroll-area-CwefWQJz.js → scroll-area-HNGrspxG.js} +1 -1
- package/dist/client/assets/{search-input-Cw7qsY4D.js → search-input-BvZNM2RM.js} +1 -1
- package/dist/client/assets/{select-BsqOoRjy.js → select-C5MYEBtM.js} +1 -1
- package/dist/client/assets/{select-model-2XCyUhYh.js → select-model-_j0smQSE.js} +1 -1
- package/dist/client/assets/{settings-layout-CInduq_4.js → settings-layout-Dq4UX_n_.js} +1 -1
- package/dist/client/assets/{settings-section-a70NRysW.js → settings-section-COnpJzJz.js} +1 -1
- package/dist/client/assets/{shell-layout-vlCxg3wp.js → shell-layout-BnsXbGf-.js} +1 -1
- package/dist/client/assets/{skeleton-ut2Fjnfc.js → skeleton-BzKJgxvw.js} +1 -1
- package/dist/client/assets/{sso-DWQtkeci.js → sso-Dl81_azC.js} +1 -1
- package/dist/client/assets/{store-DzJ4uPv_.js → store-IYIgp3qV.js} +1 -1
- package/dist/client/assets/store-registry-BJ9XvOV4.js +2 -0
- package/dist/client/assets/{switch-BOLNOz2b.js → switch-HROyTNdj.js} +1 -1
- package/dist/client/assets/{table-DP_npJUh.js → table-IqV9GNGa.js} +1 -1
- package/dist/client/assets/{tabs-C14WE3bq.js → tabs-BPvd4P0n.js} +1 -1
- package/dist/client/assets/{task-status-FilXySGc.js → task-status-DZKELKFJ.js} +1 -1
- package/dist/client/assets/{textarea-CmJMc5JU.js → textarea-KDZuzqvR.js} +1 -1
- package/dist/client/assets/{toggle-group-Cw56io9g.js → toggle-group-DM97u04F.js} +1 -1
- package/dist/client/assets/{tools-list-BQ35DR0s.js → tools-list-kpR-DdJQ.js} +1 -1
- package/dist/client/assets/{tooltip-iWA8tsOt.js → tooltip-Dr3uY9D4.js} +1 -1
- package/dist/client/assets/{types-D1-bFUi0.js → types-mFMyaEXB.js} +1 -1
- package/dist/client/assets/{use-ai-providers-O6PDM1es.js → use-ai-providers-D5NHg2Ru.js} +1 -1
- package/dist/client/assets/{use-collections-CB-s1Fe8.js → use-collections-B9qAfcJY.js} +1 -1
- package/dist/client/assets/{use-connection-BRDOgzI9.js → use-connection-Dw3HjptL.js} +1 -1
- package/dist/client/assets/{use-copy-D_tdIgNn.js → use-copy-CpV0fKqM.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-SQq_0wwz.js → use-create-virtual-mcp-GSBx9joR.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-gWQ7TcNv.js → use-decopilot-events-Lyv24iLh.js} +1 -1
- package/dist/client/assets/{use-delete-connection-BoFquqB-.js → use-delete-connection-DJQOIuEz.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-CXsf__mT.js → use-infinite-scroll-C-7Y6eBv.js} +1 -1
- package/dist/client/assets/{use-list-state-vDn3VfBt.js → use-list-state-CuoLDS8v.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-Cqhx2HL6.js → use-mcp-tools-C2NC0OB_.js} +1 -1
- package/dist/client/assets/{use-members-CUqwI0-t.js → use-members-DLx75xut.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-CnLUwuJt.js → use-navigate-to-agent-CxjZQ1fq.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-CEEu3RoZ.js → use-org-auth-client-CBU51XQa.js} +1 -1
- package/dist/client/assets/{use-org-sso-2VDp-rZw.js → use-org-sso-B61uYZKs.js} +1 -1
- package/dist/client/assets/{use-organization-roles-BPmOA_FM.js → use-organization-roles-DMz4JpGH.js} +1 -1
- package/dist/client/assets/{use-organization-settings-Bm3oyYWt.js → use-organization-settings-B81E2rNE.js} +1 -1
- package/dist/client/assets/{use-registry-connections-GaolpGHd.js → use-registry-connections-vur0Zrsf.js} +1 -1
- package/dist/client/assets/{use-status-sounds-CN6Aqzsb.js → use-status-sounds-DkEi-BmD.js} +1 -1
- package/dist/client/assets/{use-tasks-CvLwec2V.js → use-tasks-CIfTcsjC.js} +1 -1
- package/dist/client/assets/{use-view-mode-Cfb_2w0E.js → use-view-mode-NasGzpHg.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-CTsmN-sy.js → use-virtual-mcp-9JsEXBge.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-BOZnPi0L.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-M_8yh3H4.js +1 -0
- package/dist/client/assets/{user-CtOwtNK9.js → user-pxLMJc6I.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-cM3ZdaYG.js → view-mode-toggle-_crWUr2e.js} +1 -1
- package/dist/client/assets/{workflow-DFUEo5vC.js → workflow-DvosQfQf.js} +1 -1
- package/dist/client/assets/workflow-detail-CeNwzbGr.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +1 -1
- package/dist/server/node_modules/postgres-date/index.js +116 -0
- package/dist/server/node_modules/{postgres-interval → postgres-date}/package.json +8 -11
- package/dist/server/node_modules/postgres-date/readme.md +49 -0
- package/package.json +1 -1
- package/dist/client/assets/ai-providers-Beu_Ygx3.js +0 -1
- package/dist/client/assets/index-BdJA1qE_.js +0 -1
- package/dist/client/assets/registry-CKN348lV.js +0 -2
- package/dist/client/assets/store-registry-DsM1-Xx4.js +0 -2
- package/dist/client/assets/useInfiniteQuery-B47NEP-H.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-DKOsvjoC.js +0 -1
- package/dist/client/assets/workflow-detail-Dg_TbZT2.js +0 -1
- package/dist/server/node_modules/mimic-fn/index.d.ts +0 -54
- package/dist/server/node_modules/mimic-fn/index.js +0 -13
- package/dist/server/node_modules/mimic-fn/license +0 -9
- package/dist/server/node_modules/mimic-fn/package.json +0 -42
- package/dist/server/node_modules/mimic-fn/readme.md +0 -69
- package/dist/server/node_modules/postgres-interval/index.d.ts +0 -20
- package/dist/server/node_modules/postgres-interval/index.js +0 -125
- package/dist/server/node_modules/postgres-interval/readme.md +0 -48
- package/dist/server/node_modules/xtend/.jshintrc +0 -30
- package/dist/server/node_modules/xtend/LICENSE +0 -20
- package/dist/server/node_modules/xtend/README.md +0 -32
- package/dist/server/node_modules/xtend/immutable.js +0 -19
- package/dist/server/node_modules/xtend/mutable.js +0 -17
- package/dist/server/node_modules/xtend/package.json +0 -55
- package/dist/server/node_modules/xtend/test.js +0 -103
- /package/dist/server/node_modules/{postgres-interval → postgres-date}/license +0 -0
package/dist/client/assets/{plugin-empty-state-CqpHZZ90.js → plugin-empty-state-CmHCNawV.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as o,j as t,Z as n}from"./index-
|
|
1
|
+
import{e as o,j as t,Z as n}from"./index-CariFzvs.js";function a(){const s=o.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8",children:[t.jsx(n,{size:48,className:"text-muted-foreground mb-4"}),t.jsx("h3",{className:"text-lg font-medium mb-2",children:"No workflows connected"}),t.jsx("p",{className:"text-muted-foreground text-center max-w-md",children:"Connect a workflow provider to create and manage automated workflows with multiple steps and integrations."})]}),s[0]=e):e=s[0],e}export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as S,j as s,r as w,Z as y}from"./index-
|
|
1
|
+
import{e as S,j as s,r as w,Z as y}from"./index-CariFzvs.js";import{i as R,t as _}from"./ChevronDown-YpILLXr3.js";function E(x){const e=S.c(32),{connections:l,selectedConnectionId:n,onConnectionChange:N}=x,[r,z]=w.useState(!1),C=w.useRef(null);let p;if(e[0]!==l||e[1]!==n){let t;e[3]!==n?(t=u=>u.id===n,e[3]=n,e[4]=t):t=e[4],p=l.find(t),e[0]=l,e[1]=n,e[2]=p}else p=e[2];const i=p;let j;e[5]===Symbol.for("react.memo_cache_sentinel")?(j=t=>{C.current?.contains(t.relatedTarget)||z(!1)},e[5]=j):j=e[5];const k=j;if(l.length===1){let t;e[6]!==i?(t=i?.icon?s.jsx("img",{src:i.icon,alt:"",className:"size-4 rounded"}):s.jsx(y,{size:16}),e[6]=i,e[7]=t):t=e[7];const u=i?.title||"Workflows";let f;e[8]!==u?(f=s.jsx("span",{children:u}),e[8]=u,e[9]=f):f=e[9];let h;return e[10]!==t||e[11]!==f?(h=s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[t,f]}),e[10]=t,e[11]=f,e[12]=h):h=e[12],h}let o;e[13]!==r?(o=()=>z(!r),e[13]=r,e[14]=o):o=e[14];let c;e[15]!==i?(c=i?.icon?s.jsx("img",{src:i.icon,alt:"",className:"size-4 rounded"}):s.jsx(y,{size:16}),e[15]=i,e[16]=c):c=e[16];const v=i?.title||"Select provider";let a;e[17]!==v?(a=s.jsx("span",{children:v}),e[17]=v,e[18]=a):a=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(_,{size:14}),e[19]=b):b=e[19];let d;e[20]!==o||e[21]!==c||e[22]!==a?(d=s.jsxs("button",{type:"button",onClick:o,className:"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-md border border-border bg-background hover:bg-accent transition-colors",children:[c,a,b]}),e[20]=o,e[21]=c,e[22]=a,e[23]=d):d=e[23];let m;e[24]!==l||e[25]!==r||e[26]!==N||e[27]!==n?(m=r&&s.jsx("div",{className:"absolute left-0 top-full mt-1 z-50 min-w-48 rounded-md border border-border bg-popover p-1 shadow-md",children:l.map(t=>s.jsxs("button",{type:"button",onClick:()=>{N(t.id),z(!1)},className:"flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded-sm hover:bg-accent transition-colors",children:[t.icon?s.jsx("img",{src:t.icon,alt:"",className:"size-4 rounded"}):s.jsx(y,{size:16}),s.jsx("span",{className:"flex-1 text-left",children:t.title}),t.id===n&&s.jsx(R,{size:14,className:"text-primary"})]},t.id))}),e[24]=l,e[25]=r,e[26]=N,e[27]=n,e[28]=m):m=e[28];let g;return e[29]!==d||e[30]!==m?(g=s.jsxs("div",{className:"relative",ref:C,onBlur:k,children:[d,m]}),e[29]=d,e[30]=m,e[31]=g):g=e[31],g}function O(x){const e=S.c(2);let l;return e[0]!==x?(l=s.jsx(E,{...x}),e[0]=x,e[1]=l):l=e[1],l}export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as B,e as D,j as s,s as X,f as Z,g as ee,d as te,b as ne,K as se,n as ie,O as le,l as oe,B as re}from"./index-
|
|
1
|
+
import{r as B,e as D,j as s,s as X,f as Z,g as ee,d as te,b as ne,K as se,n as ie,O as le,l as oe,B as re}from"./index-CariFzvs.js";import{u as ae}from"./use-connection-Dw3HjptL.js";import{S as ce,u as ue,k as de}from"./constants-ajN1Bhug.js";import{a as me}from"./Settings02-DxdBNXj6.js";import{P as z}from"./index-D_1AR6r3.js";const fe=B.createContext(null);function F(i){const e=D.c(3),{value:h,children:m}=i,n=h;let l;return e[0]!==m||e[1]!==n?(l=s.jsx(fe.Provider,{value:n,children:m}),e[0]=m,e[1]=n,e[2]=l):l=e[2],l}B.createContext(null);function ge(i){return{id:i.id,title:i.title,icon:i.icon,description:i.description,app_name:i.app_name,app_id:i.app_id,tools:i.tools,metadata:i.metadata}}function _e(i){const e=D.c(59),{bindingName:h,renderEmptyState:m}=i,{org:n,project:l}=X(),k=Z();let j;e[0]===Symbol.for("react.memo_cache_sentinel")?(j={strict:!1},e[0]=j):j=e[0];const{org:T,taskId:w,pluginId:f}=ee(j);let I;e[1]===Symbol.for("react.memo_cache_sentinel")?(I={strict:!1},e[1]=I):I=e[1];const G=te(I).virtualmcpid;let P;e[2]!==h?(P={binding:h},e[2]=h,e[3]=P):P=e[3];const K=ae(P),{data:g}=ne.useSession();let _;e[4]!==n.id?(_={connectionId:ce,orgId:n.id},e[4]=n.id,e[5]=_):_=e[5];const O=ue(_);let x;e[6]!==f||e[7]!==l.id?(x=se.projectPluginConfig(l.id??"",f),e[6]=f,e[7]=l.id,e[8]=x):x=e[8];let p;e[9]!==f||e[10]!==l.id||e[11]!==O?(p=async()=>{const t=await O.callTool({name:"VIRTUAL_MCP_PLUGIN_CONFIG_GET",arguments:{virtualMcpId:l.id,pluginId:f}});return t.structuredContent??t},e[9]=f,e[10]=l.id,e[11]=O,e[12]=p):p=e[12];const U=!!l.id&&!!f;let v;e[13]!==x||e[14]!==p||e[15]!==U?(v={queryKey:x,queryFn:p,enabled:U},e[13]=x,e[14]=p,e[15]=U,e[16]=v):v=e[16];const{data:V,isLoading:Q}=ie(v),R=V?.config?.connectionId,C=R?K.find(t=>t.id===R):null,y=de({connectionId:C?.id,orgId:n.id});let b;e[17]!==g?(b=g?.user?{user:{id:g.user.id,name:g.user.name,email:g.user.email,image:g.user.image}}:null,e[17]=g,e[18]=b):b=e[18];const a=b;let N;e[19]!==n.id||e[20]!==n.name||e[21]!==n.slug?(N={id:n.id,slug:n.slug,name:n.name},e[19]=n.id,e[20]=n.name,e[21]=n.slug,e[22]=N):N=e[22];const c=N;if(Q){let t;return e[23]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[s.jsx(oe,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})]}),e[23]=t):t=e[23],t}if(K.length===0){let t;e[24]!==c||e[25]!==a?(t={connectionId:null,connection:null,toolCaller:null,org:c,session:a},e[24]=c,e[25]=a,e[26]=t):t=e[26];const u=t;let r;e[27]!==m?(r=m(),e[27]=m,e[28]=r):r=e[28];let o;e[29]!==r?(o=s.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:r}),e[29]=r,e[30]=o):o=e[30];let d;return e[31]!==u||e[32]!==o?(d=s.jsx(F,{value:u,children:o}),e[31]=u,e[32]=o,e[33]=d):d=e[33],d}if(!C){let t;e[34]!==c||e[35]!==a?(t={connectionId:null,connection:null,toolCaller:null,org:c,session:a},e[34]=c,e[35]=a,e[36]=t):t=e[36];const u=t;let r;e[37]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("div",{className:"flex flex-col items-center gap-2 text-center max-w-md",children:[s.jsx(me,{size:48,className:"text-muted-foreground mb-2"}),s.jsx("h2",{className:"text-lg font-semibold",children:"Plugin Not Configured"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"This plugin requires a connection to be configured. Go to project settings to select which integration to use."})]}),e[37]=r):r=e[37];let o;e[38]!==k||e[39]!==n.slug||e[40]!==T||e[41]!==l.id||e[42]!==w||e[43]!==G?(o=s.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-4 p-8",children:[r,s.jsx(re,{onClick:()=>{const H=T??n.slug,J=G??l.id??"",W=w??crypto.randomUUID();k({to:"/$org/$taskId",params:{org:H,taskId:W},search:{virtualmcpid:J,main:"settings"}})},children:"Go to Project Settings"})]}),e[38]=k,e[39]=n.slug,e[40]=T,e[41]=l.id,e[42]=w,e[43]=G,e[44]=o):o=e[44];let d;return e[45]!==u||e[46]!==o?(d=s.jsx(F,{value:u,children:o}),e[45]=u,e[46]=o,e[47]=d):d=e[47],d}const Y=C.id,$=ge(C);let S;e[48]!==y?(S=(t,u)=>y?y.callTool({name:t,arguments:u}).then(xe):Promise.reject(new Error("MCP client is not available")),e[48]=y,e[49]=S):S=e[49];const q=S;let E;e[50]!==C||e[51]!==c||e[52]!==a||e[53]!==$||e[54]!==q?(E={connectionId:Y,connection:$,toolCaller:q,org:c,session:a},e[50]=C,e[51]=c,e[52]=a,e[53]=$,e[54]=q,e[55]=E):E=e[55];const A=E;let L;e[56]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx(z,{children:s.jsx(z.Content,{children:s.jsx(le,{})})}),e[56]=L):L=e[56];let M;return e[57]!==A?(M=s.jsx(F,{value:A,children:L}),e[57]=A,e[58]=M):M=e[58],M}function xe(i){return i.structuredContent??i}export{_e as P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,aT as $,j as c,c4 as L,aU as z,b6 as A,a7 as _,a8 as g,c5 as b,aW as j,c6 as G,c7 as w,c8 as H,c9 as K,ae as U,ca as W,cb as V,cc as Z,cd as q,ce as B,cf as J,e as R,c as Q}from"./index-
|
|
1
|
+
import{r as i,aT as $,j as c,c4 as L,aU as z,b6 as A,a7 as _,a8 as g,c5 as b,aW as j,c6 as G,c7 as w,c8 as H,c9 as K,ae as U,ca as W,cb as V,cc as Z,cd as q,ce as B,cf as J,e as R,c as Q}from"./index-CariFzvs.js";var C="Popover",[E]=U(C,[w]),P=w(),[X,u]=E(C),N=t=>{const{__scopePopover:e,children:o,open:r,defaultOpen:n,onOpenChange:s,modal:a=!1}=t,p=P(e),l=i.useRef(null),[d,h]=i.useState(!1),[x,f]=$({prop:r,defaultProp:n??!1,onChange:s,caller:C});return c.jsx(L,{...p,children:c.jsx(X,{scope:e,contentId:z(),triggerRef:l,open:x,onOpenChange:f,onOpenToggle:i.useCallback(()=>f(m=>!m),[f]),hasCustomAnchor:d,onCustomAnchorAdd:i.useCallback(()=>h(!0),[]),onCustomAnchorRemove:i.useCallback(()=>h(!1),[]),modal:a,children:o})})};N.displayName=C;var F="PopoverAnchor",Y=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=u(F,o),s=P(o),{onCustomAnchorAdd:a,onCustomAnchorRemove:p}=n;return i.useEffect(()=>(a(),()=>p()),[a,p]),c.jsx(b,{...s,...r,ref:e})});Y.displayName=F;var S="PopoverTrigger",y=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=u(S,o),s=P(o),a=A(e,n.triggerRef),p=c.jsx(_.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":I(n.open),...r,ref:a,onClick:g(t.onClick,n.onOpenToggle)});return n.hasCustomAnchor?p:c.jsx(b,{asChild:!0,...s,children:p})});y.displayName=S;var O="PopoverPortal",[ee,oe]=E(O,{forceMount:void 0}),D=t=>{const{__scopePopover:e,forceMount:o,children:r,container:n}=t,s=u(O,e);return c.jsx(ee,{scope:e,forceMount:o,children:c.jsx(j,{present:o||s.open,children:c.jsx(G,{asChild:!0,container:n,children:r})})})};D.displayName=O;var v="PopoverContent",M=i.forwardRef((t,e)=>{const o=oe(v,t.__scopePopover),{forceMount:r=o.forceMount,...n}=t,s=u(v,t.__scopePopover);return c.jsx(j,{present:r||s.open,children:s.modal?c.jsx(re,{...n,ref:e}):c.jsx(ne,{...n,ref:e})})});M.displayName=v;var te=W("PopoverContent.RemoveScroll"),re=i.forwardRef((t,e)=>{const o=u(v,t.__scopePopover),r=i.useRef(null),n=A(e,r),s=i.useRef(!1);return i.useEffect(()=>{const a=r.current;if(a)return H(a)},[]),c.jsx(K,{as:te,allowPinchZoom:!0,children:c.jsx(T,{...t,ref:n,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:g(t.onCloseAutoFocus,a=>{a.preventDefault(),s.current||o.triggerRef.current?.focus()}),onPointerDownOutside:g(t.onPointerDownOutside,a=>{const p=a.detail.originalEvent,l=p.button===0&&p.ctrlKey===!0,d=p.button===2||l;s.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:g(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),ne=i.forwardRef((t,e)=>{const o=u(v,t.__scopePopover),r=i.useRef(!1),n=i.useRef(!1);return c.jsx(T,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{t.onCloseAutoFocus?.(s),s.defaultPrevented||(r.current||o.triggerRef.current?.focus(),s.preventDefault()),r.current=!1,n.current=!1},onInteractOutside:s=>{t.onInteractOutside?.(s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const a=s.target;o.triggerRef.current?.contains(a)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&n.current&&s.preventDefault()}})}),T=i.forwardRef((t,e)=>{const{__scopePopover:o,trapFocus:r,onOpenAutoFocus:n,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:p,onPointerDownOutside:l,onFocusOutside:d,onInteractOutside:h,...x}=t,f=u(v,o),m=P(o);return V(),c.jsx(Z,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:n,onUnmountAutoFocus:s,children:c.jsx(q,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:h,onEscapeKeyDown:p,onPointerDownOutside:l,onFocusOutside:d,onDismiss:()=>f.onOpenChange(!1),children:c.jsx(B,{"data-state":I(f.open),role:"dialog",id:f.contentId,...m,...x,ref:e,style:{...x.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),k="PopoverClose",se=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=u(k,o);return c.jsx(_.button,{type:"button",...r,ref:e,onClick:g(t.onClick,()=>n.onOpenChange(!1))})});se.displayName=k;var ae="PopoverArrow",ce=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=P(o);return c.jsx(J,{...n,...r,ref:e})});ce.displayName=ae;function I(t){return t?"open":"closed"}var ie=N,pe=y,le=D,de=M;function fe(t){const e=R.c(4);let o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=c.jsx(ie,{"data-slot":"popover",...o}),e[2]=o,e[3]=r):r=e[3],r}function ve(t){const e=R.c(4);let o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=c.jsx(pe,{"data-slot":"popover-trigger",...o}),e[2]=o,e[3]=r):r=e[3],r}function ge(t){const e=R.c(12);let o,r,n,s;e[0]!==t?({className:o,align:n,sideOffset:s,...r}=t,e[0]=t,e[1]=o,e[2]=r,e[3]=n,e[4]=s):(o=e[1],r=e[2],n=e[3],s=e[4]);const a=n===void 0?"center":n,p=s===void 0?4:s;let l;e[5]!==o?(l=Q("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-lg overflow-hidden border p-4 shadow-md outline-hidden",o),e[5]=o,e[6]=l):l=e[6];let d;return e[7]!==a||e[8]!==r||e[9]!==p||e[10]!==l?(d=c.jsx(le,{children:c.jsx(de,{"data-slot":"popover-content",align:a,sideOffset:p,className:l,...r})}),e[7]=a,e[8]=r,e[9]=p,e[10]=l,e[11]=d):d=e[11],d}export{ve as P,ge as a,fe as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as z,j as t,b as G,r as R,B as V,P as B,t as f,x as I}from"./index-
|
|
1
|
+
import{e as z,j as t,b as G,r as R,B as V,P as B,t as f,x as I}from"./index-CariFzvs.js";import{P as E}from"./index-D_1AR6r3.js";import{A as U}from"./avatar-Di9GD8dd.js";import{S as T}from"./switch-HROyTNdj.js";import{S as H,a as Y,d as q,c as F}from"./select-C5MYEBtM.js";import{T as K,a as L}from"./toggle-group-DM97u04F.js";import{I as J}from"./input-DHEAaYve.js";import{n as M,a as O,i as Q}from"./Sun-beuoApqH.js";import{i as W}from"./Play-DgZHjcoJ.js";import{p as X,q as Z}from"./question-004-sINsf4GQ.js";import"./index-DMby3CEd.js";import{d as ee,S as $,a as D,b as h,c as te}from"./settings-section-COnpJzJz.js";import"./tooltip-Dr3uY9D4.js";import"./X-Cg5jWZ6W.js";import"./User01-CKOZDyFQ.js";import"./ChevronDown-YpILLXr3.js";import"./ChevronUp-D3ACbD1g.js";import"./card-DL6KKkK7.js";import"./ArrowUpRight-DGFb4j2X.js";function ie(){const{data:e,isPending:i}=G.useSession(),n=e?.user,l=n?.image,[s,o]=R.useState(null),[a,c]=R.useState(!1),m=s??n?.name??"",p=s!==null&&s!==(n?.name??""),u=async()=>{if(p){c(!0);try{await G.updateUser({name:m}),f("profile_updated",{fields:["name"]}),o(null),I.success("Profile updated")}catch{I.error("Failed to update profile")}finally{c(!1)}}};return i?null:t.jsx($,{children:t.jsxs(D,{children:[t.jsx(h,{title:"Avatar",action:t.jsx(U,{url:l,fallback:n?.name??"U",shape:"circle",size:"base"})}),t.jsx(h,{title:"Display name",action:t.jsx(J,{id:"display-name",value:m,onChange:d=>o(d.target.value),onKeyDown:d=>{d.key==="Enter"&&u()},placeholder:"Your name",className:"w-[280px]"})}),t.jsx(h,{title:"Email",action:t.jsx("span",{className:"text-sm text-muted-foreground",children:n?.email})}),p&&t.jsxs(te,{children:[t.jsx(V,{variant:"outline",size:"sm",onClick:()=>o(null),disabled:a,children:"Cancel"}),t.jsx(V,{onClick:u,disabled:a,size:"sm",children:a?"Saving…":"Save"})]})]})})}function ne(){const e=z.c(48),[i,n]=B();let l;e[0]!==n?(l=async r=>{if(r&&await Notification.requestPermission()!=="granted"){f("preferences_notifications_permission_denied"),I.error("Notifications denied. Please enable them in your browser settings."),n(ae);return}f("preferences_notifications_toggled",{enabled:r}),n(x=>({...x,enableNotifications:r}))},e[0]=n,e[1]=l):l=e[1];const s=l;let o;e[2]!==n?(o=r=>{r&&(f("preferences_theme_changed",{to_value:r}),n(x=>({...x,theme:r})))},e[2]=n,e[3]=o):o=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(L,{value:"light","aria-label":"Light theme",children:t.jsx(M,{size:14})}),e[4]=a):a=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(L,{value:"dark","aria-label":"Dark theme",children:t.jsx(O,{size:14})}),e[5]=c):c=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(L,{value:"system","aria-label":"System theme",children:t.jsx(Q,{size:14})}),e[6]=m):m=e[6];let p;e[7]!==i.theme||e[8]!==o?(p=t.jsx(h,{title:"Theme",description:"Your preferred color scheme.",action:t.jsxs(K,{type:"single",size:"sm",variant:"outline",value:i.theme,onValueChange:o,children:[a,c,m]})}),e[7]=i.theme,e[8]=o,e[9]=p):p=e[9];let u;e[10]!==s||e[11]!==i.enableNotifications?(u=typeof Notification<"u"?()=>s(!i.enableNotifications):void 0,e[10]=s,e[11]=i.enableNotifications,e[12]=u):u=e[12];let d;e[13]!==s||e[14]!==i.enableNotifications?(d=t.jsx(T,{disabled:typeof Notification>"u",checked:i.enableNotifications,onCheckedChange:s}),e[13]=s,e[14]=i.enableNotifications,e[15]=d):d=e[15];let b;e[16]!==u||e[17]!==d?(b=t.jsx(h,{title:"Notifications",description:"Receive browser notifications for important events.",onClick:u,action:d}),e[16]=u,e[17]=d,e[18]=b):b=e[18];let v;e[19]!==i.enableSounds||e[20]!==n?(v=()=>{f("preferences_sounds_toggled",{enabled:!i.enableSounds}),n(le)},e[19]=i.enableSounds,e[20]=n,e[21]=v):v=e[21];let P;e[22]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx("button",{type:"button","aria-label":"Preview notification sound",onClick:se,className:"size-6 rounded flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent/50 transition-colors cursor-pointer",children:t.jsx(W,{size:11})}),e[22]=P):P=e[22];let g;e[23]!==n?(g=r=>{f("preferences_sounds_toggled",{enabled:r}),n(x=>({...x,enableSounds:r}))},e[23]=n,e[24]=g):g=e[24];let j;e[25]!==i.enableSounds||e[26]!==g?(j=t.jsxs("div",{className:"flex items-center gap-2",children:[P,t.jsx(T,{checked:i.enableSounds,onCheckedChange:g})]}),e[25]=i.enableSounds,e[26]=g,e[27]=j):j=e[27];let _;e[28]!==j||e[29]!==v?(_=t.jsx(h,{title:"Sounds",description:"Play sounds for agent actions and notifications.",onClick:v,action:j}),e[28]=j,e[29]=v,e[30]=_):_=e[30];let S;e[31]!==n?(S=r=>{f("preferences_tool_approval_changed",{to_value:r}),n(x=>({...x,toolApprovalLevel:r}))},e[31]=n,e[32]=S):S=e[32];let y;e[33]!==i.toolApprovalLevel?(y={readonly:"Ask before edit",auto:"Auto approve"}[i.toolApprovalLevel]??"Ask before edit",e[33]=i.toolApprovalLevel,e[34]=y):y=e[34];let N;e[35]!==y?(N=t.jsx(Y,{className:"w-36 h-7 text-xs",children:t.jsx("span",{children:y})}),e[35]=y,e[36]=N):N=e[36];let A;e[37]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx(q,{value:"readonly",textValue:"Ask before edit",children:t.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.jsx("span",{className:"font-medium",children:"Ask before edit"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"Auto-approve read-only tools"})]})}),e[37]=A):A=e[37];let k;e[38]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsxs(F,{children:[A,t.jsx(q,{value:"auto",textValue:"Auto approve",children:t.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.jsx("span",{className:"font-medium",children:"Auto approve"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"Execute all without approval"})]})})]}),e[38]=k):k=e[38];let C;e[39]!==i.toolApprovalLevel||e[40]!==S||e[41]!==N?(C=t.jsx(h,{title:"Tool Approval",description:"Control how tools are approved before execution.",action:t.jsxs(H,{value:i.toolApprovalLevel,onValueChange:S,children:[N,k]})}),e[39]=i.toolApprovalLevel,e[40]=S,e[41]=N,e[42]=C):C=e[42];let w;return e[43]!==_||e[44]!==C||e[45]!==p||e[46]!==b?(w=t.jsx($,{title:"Preferences",children:t.jsxs(D,{children:[p,b,_,C]})}),e[43]=_,e[44]=C,e[45]=p,e[46]=b,e[47]=w):w=e[47],w}function se(){f("preferences_sounds_previewed"),X(Z.dataUri).catch(oe)}function oe(){}function le(e){return{...e,enableSounds:!e.enableSounds}}function ae(e){return{...e,enableNotifications:!1}}function re(){const e=z.c(11),[i,n]=B();let l;e[0]!==i.experimental_vibecode||e[1]!==n?(l=()=>{f("preferences_experimental_vibecode_toggled",{enabled:!i.experimental_vibecode}),n(ce)},e[0]=i.experimental_vibecode,e[1]=n,e[2]=l):l=e[2];let s;e[3]!==n?(s=c=>{f("preferences_experimental_vibecode_toggled",{enabled:c}),n(m=>({...m,experimental_vibecode:c}))},e[3]=n,e[4]=s):s=e[4];let o;e[5]!==i.experimental_vibecode||e[6]!==s?(o=t.jsx(T,{checked:i.experimental_vibecode,onCheckedChange:s}),e[5]=i.experimental_vibecode,e[6]=s,e[7]=o):o=e[7];let a;return e[8]!==l||e[9]!==o?(a=t.jsx($,{title:"Experimental",children:t.jsx(D,{children:t.jsx(h,{title:"Import from GitHub",description:"Enable importing agents from GitHub repositories.",onClick:l,action:o})})}),e[8]=l,e[9]=o,e[10]=a):a=e[10],a}function ce(e){return{...e,experimental_vibecode:!e.experimental_vibecode}}function de(){const e=z.c(1);let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(E,{children:t.jsx(E.Content,{children:t.jsx(E.Body,{children:t.jsxs(ee,{children:[t.jsx(E.Title,{children:"Profile & Preferences"}),t.jsx(ie,{}),t.jsx(ne,{}),t.jsx(re,{})]})})})}),e[0]=i):i=e[0],i}function Ee(){const e=z.c(1);let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(de,{}),e[0]=i):i=e[0],i}export{Ee as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as E,s as H,j as N}from"./index-
|
|
1
|
+
import{e as E,s as H,j as N}from"./index-CariFzvs.js";import{m as O,k as $,s as v}from"./pair-vGTs_zPg.js";import{u as L}from"./constants-ajN1Bhug.js";import{a as k,c as q}from"./use-mcp-tools-C2NC0OB_.js";import{c as B}from"./content-blocks-o63cs2vh.js";import{g as Y,M as G,b as w}from"./types-mFMyaEXB.js";import{c as V,b as z}from"./chat-context-mYdLYubP.js";import{u as F}from"./shell-layout-BnsXbGf-.js";import"./agent-icon-BhGa08Fl.js";import"./AlertCircle-DGWwcoQZ.js";import"./Tool01-CB2DUdHU.js";import"./XClose-N2VTvn-z.js";import"./RefreshCcw01-CtjTkTf4.js";import"./ArrowNarrowLeft-6CbLfe6R.js";import"./XCircle-m0QK52Tq.js";import"./ArrowUpRight-DGFb4j2X.js";import"./ZapSquare-CpCXmnKj.js";import"./Users03-CrrZL9MY.js";import"./CheckCircle-TABxOmV2.js";import"./ChevronDown-YpILLXr3.js";import"./ChevronRight-C5cwFzdi.js";import"./ChevronUp-D3ACbD1g.js";import"./DotsVertical-uATdSTpl.js";import"./Container-CEV9uk-Z.js";import"./Star01-BP3IsurF.js";import"./Palette-BXvnxfG9.js";import"./SearchMd-OYsWp4RC.js";import"./index-D_1AR6r3.js";import"./tooltip-Dr3uY9D4.js";import"./X-Cg5jWZ6W.js";import"./LinkExternal01-DRPBZiOD.js";import"./Lock01-BwE9ru6U.js";import"./Sun-beuoApqH.js";import"./Play-DgZHjcoJ.js";import"./Plus-CCywDmjg.js";import"./Settings02-DxdBNXj6.js";import"./Shield01-Qjvq_pQT.js";import"./Trash01-Rux2RMYE.js";import"./User01-CKOZDyFQ.js";import"./Zap-DHpdmH1S.js";import"./index-Dcc7hO3D.js";import"./use-copy-CpV0fKqM.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./dialog-YE4SL2S_.js";import"./integration-icon-Ceb5m9KS.js";import"./use-virtual-mcp-9JsEXBge.js";import"./use-collections-B9qAfcJY.js";import"./use-ai-providers-D5NHg2Ru.js";import"./use-decopilot-events-Lyv24iLh.js";import"./create-sse-subscription-CxkOgzKf.js";import"./use-tasks-CIfTcsjC.js";import"./use-organization-settings-B81E2rNE.js";import"./required-auth-layout-BOwcnbO9.js";import"./use-org-sso-B61uYZKs.js";const J={};function K(U){const t=E.c(37),{client:s,resourceURI:P,tool:e,connectionId:l,orgId:p,args:a}=U,{sendMessage:c}=V(),{setAppContext:u,clearAppContext:g}=z(),{setChatOpen:d,openTab:r}=F(),n=`${l}:${e.name}`;let o;t[0]!==r?(o=h=>h==="inline"?(r("0"),"inline"):"fullscreen",t[0]=r,t[1]=o):o=t[1];const f=o,m=a??J;let i;t[2]!==s||t[3]!==e.name||t[4]!==m?(i={client:s,toolName:e.name,toolArguments:m},t[2]=s,t[3]=e.name,t[4]=m,t[5]=i):i=t[5];const{data:T}=q(i);let R;if(t[6]!==e._meta||t[7]!==e.name){const h=$(e._meta);R=v(e.name,h),t[6]=e._meta,t[7]=e.name,t[8]=R}else R=t[8];const S=R;let x;t[9]!==e.inputSchema?(x=e.inputSchema??{type:"object"},t[9]=e.inputSchema,t[10]=x):x=t[10];let A;t[11]!==S||t[12]!==x||t[13]!==e?(A={...e,name:S,inputSchema:x},t[11]=S,t[12]=x,t[13]=e,t[14]=A):A=t[14];const y=A;let _;t[15]!==c||t[16]!==d?(_=h=>{const b=B(h.content);b.content.length>0&&(d(!0),c({tiptapDoc:b}))},t[15]=c,t[16]=d,t[17]=_):_=t[17];const D=_;let C;t[18]!==y?(C={tool:y},t[18]=y,t[19]=C):C=t[19];let I;t[20]!==u||t[21]!==n?(I=h=>u(n,h),t[20]=u,t[21]=n,t[22]=I):I=t[22];let M;t[23]!==g||t[24]!==n?(M=()=>g(n),t[23]=g,t[24]=n,t[25]=M):M=t[25];let j;return t[26]!==s||t[27]!==D||t[28]!==f||t[29]!==p||t[30]!==P||t[31]!==C||t[32]!==I||t[33]!==M||t[34]!==m||t[35]!==T?(j=N.jsx(G,{resourceURI:P,orgId:p,toolInfo:C,toolInput:m,toolResult:T,displayMode:"fullscreen",minHeight:w.fullscreen.minHeight,maxHeight:w.fullscreen.maxHeight,client:s,onMessage:D,onUpdateModelContext:I,onTeardown:M,onRequestDisplayMode:f,className:"h-full"}),t[26]=s,t[27]=D,t[28]=f,t[29]=p,t[30]=P,t[31]=C,t[32]=I,t[33]=M,t[34]=m,t[35]=T,t[36]=j):j=t[36],j}function Qt(U){const t=E.c(22),{connectionId:s,toolName:P,args:e}=U,{org:l}=H();let p;t[0]!==s||t[1]!==l.id?(p={connectionId:s,orgId:l.id},t[0]=s,t[1]=l.id,t[2]=p):p=t[2];const a=L(p);let c;t[3]!==a?(c={client:a},t[3]=a,t[4]=c):c=t[4];const{data:u}=k(c),g=decodeURIComponent(P);let d;t[5]!==g?(d=O(g),t[5]=g,t[6]=d):d=t[6];const r=d;let n,o;if(t[7]!==r||t[8]!==u.tools){let i;t[11]!==r?(i=T=>T.name===r,t[11]=r,t[12]=i):i=t[12],o=u.tools.find(i),n=o?._meta?Y(o._meta):void 0,t[7]=r,t[8]=u.tools,t[9]=n,t[10]=o}else n=t[9],o=t[10];const f=n;if(!o||!f){let i;return t[13]!==r?(i=N.jsx("div",{className:"flex items-center justify-center h-full w-full",children:N.jsxs("p",{className:"text-sm text-muted-foreground",children:['Tool "',r,'" not found or has no UI']})}),t[13]=r,t[14]=i):i=t[14],i}let m;return t[15]!==e||t[16]!==a||t[17]!==s||t[18]!==l.id||t[19]!==f||t[20]!==o?(m=N.jsx(K,{client:a,resourceURI:f,tool:o,connectionId:s,orgId:l.id,args:e}),t[15]=e,t[16]=a,t[17]=s,t[18]=l.id,t[19]=f,t[20]=o,t[21]=m):m=t[21],m}export{Qt as AppViewContent};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/registry-layout-CIMBhCba.js","assets/index-CariFzvs.js","assets/index-D9g6ZM2x.css","assets/ArrowNarrowLeft-6CbLfe6R.js","assets/CheckCircle-TABxOmV2.js","assets/Container-CEV9uk-Z.js","assets/Settings02-DxdBNXj6.js","assets/XCircle-m0QK52Tq.js","assets/constants-ajN1Bhug.js","assets/useInfiniteQuery-BOZnPi0L.js","assets/infiniteQueryObserver-B14O_xhx.js","assets/badge-mnYUd_xY.js","assets/input-DHEAaYve.js","assets/dropdown-menu-CT4y7aY2.js","assets/ChevronDown-YpILLXr3.js","assets/ChevronRight-C5cwFzdi.js","assets/DotsVertical-uATdSTpl.js","assets/table-IqV9GNGa.js","assets/toggle-group-DM97u04F.js","assets/use-view-mode-NasGzpHg.js","assets/tooltip-Dr3uY9D4.js","assets/SearchMd-OYsWp4RC.js","assets/dialog-YE4SL2S_.js","assets/X-Cg5jWZ6W.js","assets/AlertCircle-DGWwcoQZ.js","assets/alert-dialog-BvOLTTjL.js","assets/card-DL6KKkK7.js","assets/Trash01-Rux2RMYE.js","assets/label-BMzmJDQh.js","assets/select-C5MYEBtM.js","assets/ChevronUp-D3ACbD1g.js","assets/switch-HROyTNdj.js","assets/textarea-KDZuzqvR.js","assets/RefreshCcw01-CtjTkTf4.js","assets/checkbox-BYgqHfbE.js","assets/LinkExternal01-DRPBZiOD.js","assets/use-copy-CpV0fKqM.js","assets/Plus-CCywDmjg.js","assets/Play-DgZHjcoJ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{e as a,j as t,r,l as i,_ as o}from"./index-CariFzvs.js";const n=r.lazy(()=>o(()=>import("./registry-layout-CIMBhCba.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38])));function c(){const s=a.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(i,{size:20,className:"animate-spin text-muted-foreground"})}),children:t.jsx(n,{})}),s[0]=e):e=s[0],e}export{c as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as Y,s as ie,n as Ie,o as ke,a as je,x as V,r as I,j as t,B as G,l as Le,c as Z,G as Fs,F as Bs}from"./index-
|
|
1
|
+
import{e as Y,s as ie,n as Ie,o as ke,a as je,x as V,r as I,j as t,B as G,l as Le,c as Z,G as Fs,F as Bs}from"./index-CariFzvs.js";import{i as Qs}from"./ArrowNarrowLeft-6CbLfe6R.js";import{i as qe}from"./CheckCircle-TABxOmV2.js";import{n as Vs}from"./Container-CEV9uk-Z.js";import{a as Gs}from"./Settings02-DxdBNXj6.js";import{b as Jt,n as Ks,a as ds,f as Zt,g as Ys,h as us,d as Hs,e as Ws,i as Js,c as St,t as Zs,j as Xs}from"./XCircle-m0QK52Tq.js";import{S as ce,u as oe,d as er}from"./constants-ajN1Bhug.js";import{u as ms}from"./useInfiniteQuery-BOZnPi0L.js";import{B as F}from"./badge-mnYUd_xY.js";import{I as ae}from"./input-DHEAaYve.js";import{a as dt,c as Ce,D as ut,b as mt,j as Xt,k as es,i as tr}from"./dropdown-menu-CT4y7aY2.js";import{c as Mt,d as Et,a as Fe,e as ue,b as Dt,T as me}from"./table-IqV9GNGa.js";import{T as sr,a as ts}from"./toggle-group-DM97u04F.js";import{u as rr}from"./use-view-mode-NasGzpHg.js";import{i as At}from"./DotsVertical-uATdSTpl.js";import{i as nr,a as ir}from"./SearchMd-OYsWp4RC.js";import{c as xt,d as ht,e as pt,D as ft,a as gt,b as jt}from"./dialog-YE4SL2S_.js";import{i as Ke}from"./AlertCircle-DGWwcoQZ.js";import{c as Ye,b as He,d as We,f as Je,g as Ze,e as Xe,a as et,A as tt}from"./alert-dialog-BvOLTTjL.js";import{C as ne}from"./card-DL6KKkK7.js";import{s as st}from"./Trash01-Rux2RMYE.js";import{L as X}from"./label-BMzmJDQh.js";import{S as lr,a as ar,b as or,c as cr,d as Rt}from"./select-C5MYEBtM.js";import{S as Oe}from"./switch-HROyTNdj.js";import{T as vt}from"./textarea-KDZuzqvR.js";import{a as $t,c as dr,i as ur,s as xs,b as mr}from"./RefreshCcw01-CtjTkTf4.js";import{i as xr}from"./X-Cg5jWZ6W.js";import{t as hr,i as Tt}from"./ChevronDown-YpILLXr3.js";import{n as pr}from"./ChevronUp-D3ACbD1g.js";import{C as ss}from"./checkbox-BYgqHfbE.js";import{n as fr}from"./LinkExternal01-DRPBZiOD.js";import{u as It}from"./use-copy-CpV0fKqM.js";import{s as gr}from"./Plus-CCywDmjg.js";import{a as jr,b as vr,T as br}from"./tooltip-Dr3uY9D4.js";import{i as yr}from"./Play-DgZHjcoJ.js";import"./infiniteQueryObserver-B14O_xhx.js";import"./ChevronRight-C5cwFzdi.js";const $e="private-registry",Nr=`
|
|
2
2
|
You are an MCP tool tester running automated integration checks.
|
|
3
3
|
|
|
4
4
|
Goal:
|
package/dist/client/assets/{required-auth-layout-DAS0oBtI.js → required-auth-layout-BOwcnbO9.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as c,j as i,A as a,S as u,h,k as f,U as m,N as x}from"./index-
|
|
1
|
+
import{e as c,j as i,A as a,S as u,h,k as f,U as m,N as x}from"./index-CariFzvs.js";function g(){const t=c.c(5),s=m().location.href;let r;t[0]!==s?(r=s==="/login"||s.startsWith("/login?"),t[0]=s,t[1]=r):r=t[1];const n=r;let o;if(t[2]!==s||t[3]!==n){const l=n?{}:{next:s};o=i.jsx(x,{to:"/login",search:l,replace:!0}),t[2]=s,t[3]=n,t[4]=o}else o=t[4];return o}function d(t){const e=c.c(6),{children:s}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx(a,{children:i.jsx(u,{})}),e[0]=r):r=e[0];let n;e[1]!==s?(n=i.jsx(h,{children:s}),e[1]=s,e[2]=n):n=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx(f,{children:i.jsx(g,{})}),e[3]=o):o=e[3];let l;return e[4]!==n?(l=i.jsxs(i.Fragment,{children:[r,n,o]}),e[4]=n,e[5]=l):l=e[5],l}export{d as R};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as q,d as Y,f as A,r as B,a as G,j as s,B as z,b as K}from"./index-
|
|
1
|
+
import{e as q,d as Y,f as A,r as B,a as G,j as s,B as z,b as K}from"./index-CariFzvs.js";import{I as L}from"./input-DHEAaYve.js";function H(){const e=q.c(45);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/reset-password"},e[0]=n):n=e[0];const{token:r,error:h}=Y(n),a=A(),[o,D]=B.useState(""),[l,M]=B.useState(""),[t,T]=B.useState(!1),i=h==="INVALID_TOKEN";let j;e[1]===Symbol.for("react.memo_cache_sentinel")?(j={mutationFn:O,onSuccess:()=>{T(!0)}},e[1]=j):j=e[1];const w=G(j),v=o===l,c=o.length>=8&&l.length>=8&&v,d=w.isPending,N=w.error;let y;e[2]!==c||e[3]!==o||e[4]!==w||e[5]!==r?(y=b=>{b.preventDefault(),!(!r||!c)&&w.mutate({newPassword:o,token:r})},e[2]=c,e[3]=o,e[4]=w,e[5]=r,e[6]=y):y=e[6];const F=y;let k;e[7]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle, var(--primary-foreground) 1px, transparent 1px)",backgroundSize:"16px 16px",opacity:.15}}),e[7]=k):k=e[7];let S,_,P,C;e[8]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-screen h-px bg-primary-foreground/15"}),_=s.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-screen h-px bg-primary-foreground/15"}),P=s.jsx("div",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-px h-screen bg-primary-foreground/15"}),C=s.jsx("div",{className:"absolute right-0 top-1/2 -translate-y-1/2 w-px h-screen bg-primary-foreground/15"}),e[8]=S,e[9]=_,e[10]=P,e[11]=C):(S=e[8],_=e[9],P=e[10],C=e[11]);let E;e[12]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx("div",{className:"flex justify-center",children:s.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12"})}),e[12]=E):E=e[12];const I=t?"Password reset successful":"Set a new password";let m;e[13]!==I?(m=s.jsx("div",{className:"text-center space-y-1",children:s.jsx("p",{className:"text-sm text-foreground/70",children:I})}),e[13]=I,e[14]=m):m=e[14];let u;e[15]!==i||e[16]!==a||e[17]!==t||e[18]!==r?(u=(i||!r&&!t)&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:"This reset link is invalid or has expired."}),s.jsx(z,{onClick:()=>a({to:"/login"}),className:"w-full font-semibold",size:"lg",children:"Back to login"})]}),e[15]=i,e[16]=a,e[17]=t,e[18]=r,e[19]=u):u=e[19];let x;e[20]!==N?(x=N&&s.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:N.message||"Failed to reset password. Please try again."}),e[20]=N,e[21]=x):x=e[21];let f;e[22]!==a||e[23]!==t?(f=t&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"rounded-xl bg-emerald-500/10 p-3 text-sm text-emerald-600 dark:text-emerald-400 text-center",children:"Your password has been reset. You can now sign in with your new password."}),s.jsx(z,{onClick:()=>a({to:"/login"}),className:"w-full font-semibold",size:"lg",children:"Go to login"})]}),e[22]=a,e[23]=t,e[24]=f):f=e[24];let g;e[25]!==c||e[26]!==l||e[27]!==F||e[28]!==i||e[29]!==d||e[30]!==o||e[31]!==v||e[32]!==t||e[33]!==r?(g=r&&!i&&!t&&s.jsxs("form",{onSubmit:F,className:"grid gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"New password"}),s.jsx(L,{type:"password",placeholder:"••••••••",value:o,onChange:b=>D(b.target.value),required:!0,minLength:8,disabled:d})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Confirm password"}),s.jsx(L,{type:"password",placeholder:"••••••••",value:l,onChange:b=>M(b.target.value),required:!0,minLength:8,disabled:d}),l&&!v&&s.jsx("p",{className:"text-xs text-destructive mt-1.5",children:"Passwords do not match"})]}),s.jsx(z,{type:"submit",disabled:d||!c,className:"w-full font-semibold",size:"lg",children:d?"Resetting...":"Reset password"})]}),e[25]=c,e[26]=l,e[27]=F,e[28]=i,e[29]=d,e[30]=o,e[31]=v,e[32]=t,e[33]=r,e[34]=g):g=e[34];let p;e[35]!==a||e[36]!==t?(p=!t&&s.jsx("div",{className:"text-center",children:s.jsx(z,{type:"button",variant:"link",onClick:()=>a({to:"/login"}),className:"text-sm text-muted-foreground hover:text-foreground",children:"Back to sign in"})}),e[35]=a,e[36]=t,e[37]=p):p=e[37];let R;return e[38]!==m||e[39]!==u||e[40]!==x||e[41]!==f||e[42]!==g||e[43]!==p?(R=s.jsxs("main",{className:"relative flex min-h-screen items-center justify-center bg-gradient-to-br from-primary to-primary/75 p-4",children:[k,s.jsxs("div",{className:"relative z-10",children:[S,_,P,C,s.jsxs("div",{className:"mx-auto w-full min-w-[400px] max-w-md grid gap-6 bg-card p-10 border border-primary-foreground/20",children:[E,m,u,x,f,g,p]})]})]}),e[38]=m,e[39]=u,e[40]=x,e[41]=f,e[42]=g,e[43]=p,e[44]=R):R=e[44],R}async function O(e){const{newPassword:n,token:r}=e,h=await K.resetPassword({newPassword:n,token:r});if(h.error)throw new Error(h.error.message||"Failed to reset password");return h}export{H as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as B,s as Ne,K as re,aM as ft,j as s,c as Q,l as xe,B as ne,e as q,n as Ye,o as $e,z as ht,C as xt,a as Fe,x as ue,t as Ae,H as Me,aK as _e,J as se,aI as Pe,a_ as Le,y as gt,E as pt,f as bt,d as Tt}from"./index-BAywNAd0.js";import{u as Et}from"./use-organization-roles-BPmOA_FM.js";import{u as Re}from"./use-org-auth-client-CEEu3RoZ.js";import{B as fe}from"./badge-CUROAd7Y.js";import{A as Qe,a as Ke,b as qe,c as He,d as Ze,f as Xe,e as Je,g as We}from"./alert-dialog-DTrs5R7J.js";import{D as It,a as _t,b as Nt,c as St}from"./dropdown-menu-SKNeSVuW.js";import{i as Ct}from"./DotsVertical-BOPp4_Zm.js";import{i as et}from"./Lock01-LdcfCIRL.js";import{s as je}from"./Plus-C7kl4UV6.js";import{s as jt}from"./Trash01-O1QoDagR.js";import{C as At}from"./collection-table-wrapper-BooWJqsY.js";import{P as te}from"./index-CzqHZVv3.js";import{E as ke}from"./empty-state-LwBr5UHb.js";import{S as Oe}from"./search-input-Cw7qsY4D.js";import{P as tt,D as st}from"./ai-providers-logos-D6a8kmGH.js";import{I as ve}from"./integration-icon-Cw-LLP9G.js";import{u as Rt}from"./use-infinite-scroll-CXsf__mT.js";import{C as we}from"./checkbox-BTh_K87_.js";import{i as Ot}from"./RefreshCcw01-CrQnDm5g.js";import{u as vt}from"./useSuspenseInfiniteQuery-DKOsvjoC.js";import{u as wt,S as yt}from"./constants-CQ_wYHud.js";import{C as Mt}from"./collection-search-13gXcoNW.js";import{u as nt}from"./use-members-CUqwI0-t.js";import{u as Pt}from"./use-connection-BRDOgzI9.js";import{u as Lt,c as kt}from"./use-ai-providers-O6PDM1es.js";import{A as lt}from"./avatar-DHedl4lM.js";import{S as he}from"./switch-BOLNOz2b.js";import{c as ge,T as pe,a as be,b as Te}from"./tooltip-iWA8tsOt.js";import{S as De,a as Ge,b as Ue}from"./settings-section-a70NRysW.js";import{t as Dt}from"./ChevronDown-XsMPED_o.js";import{i as Gt}from"./ChevronRight-DvnZfu1J.js";import{i as Be}from"./X-DgFNaccu.js";import"./table-DP_npJUh.js";import"./XClose-BkeTzjOp.js";import"./SearchMd-CE8VI9gC.js";import"./Container-D8zDQGz9.js";import"./agent-icon-BhmyvzVy.js";import"./AlertCircle-TmMuXcjl.js";import"./Tool01-w4UQOYN_.js";import"./ArrowNarrowLeft-XQKT7KRo.js";import"./XCircle-D0VmL_m9.js";import"./ArrowUpRight-B1eJ8Zux.js";import"./ZapSquare-CaSKDWHD.js";import"./Users03-BhdZR1Z1.js";import"./CheckCircle-CPpusm9-.js";import"./ChevronUp-g5JeXzsM.js";import"./Star01-CoecGSHu.js";import"./Palette-BGUZxjCc.js";import"./LinkExternal01-CGJf1W_Z.js";import"./Sun-D-OJyv5-.js";import"./Play-DADQfe47.js";import"./Settings02-_WxqBg1B.js";import"./Shield01-CieEV22y.js";import"./User01-C1foHOaz.js";import"./Zap-DUFASc4_.js";import"./infiniteQueryObserver-CsxksMd0.js";import"./use-collections-CB-s1Fe8.js";import"./card-DRRYnLR5.js";const ye="basic-usage",ot=[{id:ye,label:"Basic Usage",description:"Tools all org members can access by default",section:"Basic Usage",tools:["COLLECTION_CONNECTIONS_LIST","COLLECTION_CONNECTIONS_GET","CONNECTION_TEST","COLLECTION_VIRTUAL_MCP_LIST","COLLECTION_VIRTUAL_MCP_GET","VIRTUAL_MCP_PLUGIN_CONFIG_GET","AUTOMATION_GET","AUTOMATION_LIST","AI_PROVIDERS_LIST","AI_PROVIDERS_LIST_MODELS","AI_PROVIDERS_ACTIVE","LIST_OBJECTS","GET_OBJECT_METADATA","GET_PRESIGNED_URL","PUT_PRESIGNED_URL","VM_START","VM_DELETE"]},{id:"org:manage",label:"Manage organization",description:"Edit organization settings, brand context, and domain configuration",section:"Organization",tools:["ORGANIZATION_GET","ORGANIZATION_LIST","ORGANIZATION_UPDATE","ORGANIZATION_SETTINGS_GET","ORGANIZATION_SETTINGS_UPDATE","BRAND_CONTEXT_LIST","BRAND_CONTEXT_GET","BRAND_CONTEXT_CREATE","BRAND_CONTEXT_UPDATE","BRAND_CONTEXT_DELETE","BRAND_CONTEXT_EXTRACT","BRAND_GET","BRAND_LIST","ORGANIZATION_DOMAIN_GET","ORGANIZATION_DOMAIN_SET","ORGANIZATION_DOMAIN_UPDATE","ORGANIZATION_DOMAIN_CLEAR"]},{id:"members:manage",label:"Manage members",description:"Invite members, remove them, and change their roles",section:"Organization",tools:["ORGANIZATION_MEMBER_LIST","ORGANIZATION_MEMBER_ADD","ORGANIZATION_MEMBER_REMOVE","ORGANIZATION_MEMBER_UPDATE_ROLE"],dangerous:!0},{id:"connections:manage",label:"Manage connections",description:"Create, update, and delete connections",section:"Connections & Agents",tools:["COLLECTION_CONNECTIONS_CREATE","COLLECTION_CONNECTIONS_UPDATE","COLLECTION_CONNECTIONS_DELETE"],dangerous:!0},{id:"agents:manage",label:"Manage agents",description:"Create, configure, and delete agents",section:"Connections & Agents",tools:["COLLECTION_VIRTUAL_MCP_CREATE","COLLECTION_VIRTUAL_MCP_UPDATE","COLLECTION_VIRTUAL_MCP_DELETE","VIRTUAL_MCP_PLUGIN_CONFIG_UPDATE","VIRTUAL_MCP_PINNED_VIEWS_UPDATE"],dangerous:!0},{id:"automations:manage",label:"Manage automations",description:"Create, update, run, and delete automations",section:"Automations",tools:["AUTOMATION_CREATE","AUTOMATION_UPDATE","AUTOMATION_DELETE","AUTOMATION_TRIGGER_ADD","AUTOMATION_TRIGGER_REMOVE","AUTOMATION_RUN"],dangerous:!0},{id:"monitoring:view",label:"View monitoring",description:"Access logs and usage statistics",section:"Monitoring",tools:["MONITORING_LOG_GET","MONITORING_LOGS_LIST","MONITORING_STATS"]},{id:"ai-providers:manage",label:"Manage AI providers",description:"Add or remove API keys and provision provider credentials",section:"AI Providers",tools:["AI_PROVIDER_KEY_CREATE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_KEY_DELETE","AI_PROVIDER_OAUTH_URL","AI_PROVIDER_OAUTH_EXCHANGE","AI_PROVIDER_PROVISION_KEY","AI_PROVIDER_TOPUP_URL","AI_PROVIDER_CREDITS","AI_PROVIDER_CLI_ACTIVATE"]},{id:"tags:manage",label:"Manage tags",description:"Create, assign, and delete organization tags",section:"Organization",tools:["TAGS_LIST","TAGS_CREATE","TAGS_DELETE","MEMBER_TAGS_GET","MEMBER_TAGS_SET"]},{id:"registry:manage",label:"Manage registry",description:"Browse, publish, and manage items in the registry",section:"Store & Registry",tools:["COLLECTION_REGISTRY_APP_LIST","COLLECTION_REGISTRY_APP_GET","COLLECTION_REGISTRY_APP_VERSIONS","COLLECTION_REGISTRY_APP_FILTERS","REGISTRY_ITEM_LIST","REGISTRY_ITEM_SEARCH","REGISTRY_ITEM_GET","REGISTRY_ITEM_VERSIONS","REGISTRY_ITEM_FILTERS","REGISTRY_DISCOVER_TOOLS","REGISTRY_ITEM_CREATE","REGISTRY_ITEM_BULK_CREATE","REGISTRY_ITEM_UPDATE","REGISTRY_ITEM_DELETE","REGISTRY_AI_GENERATE","REGISTRY_PUBLISH_REQUEST_LIST","REGISTRY_PUBLISH_REQUEST_REVIEW","REGISTRY_PUBLISH_REQUEST_COUNT","REGISTRY_PUBLISH_REQUEST_DELETE","REGISTRY_PUBLISH_API_KEY_GENERATE","REGISTRY_PUBLISH_API_KEY_LIST","REGISTRY_PUBLISH_API_KEY_REVOKE"],dangerous:!0},{id:"registry:monitor",label:"Monitor registry health",description:"Run health checks on registry connections and view results",section:"Store & Registry",tools:["REGISTRY_MONITOR_RUN_START","REGISTRY_MONITOR_RUN_LIST","REGISTRY_MONITOR_RUN_GET","REGISTRY_MONITOR_RUN_CANCEL","REGISTRY_MONITOR_RESULT_LIST","REGISTRY_MONITOR_CONNECTION_LIST","REGISTRY_MONITOR_CONNECTION_SYNC","REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH","REGISTRY_MONITOR_SCHEDULE_SET","REGISTRY_MONITOR_SCHEDULE_CANCEL"]},{id:"api-keys:manage",label:"Manage API keys",description:"Create, update, and revoke API keys",section:"Developer",tools:["API_KEY_CREATE","API_KEY_LIST","API_KEY_UPDATE","API_KEY_DELETE"]},{id:"event-bus:use",label:"Use event bus",description:"Publish events and manage subscriptions",section:"Developer",tools:["EVENT_PUBLISH","EVENT_SUBSCRIBE","EVENT_UNSUBSCRIBE","EVENT_CANCEL","EVENT_ACK","EVENT_SUBSCRIPTION_LIST","EVENT_SYNC_SUBSCRIPTIONS"]},{id:"storage:delete",label:"Delete from storage",description:"Permanently delete files from object storage",section:"Developer",tools:["DELETE_OBJECT","DELETE_OBJECTS"],dangerous:!0},{id:"connections:sql",label:"Run SQL queries",description:"Execute raw SQL against connected databases",section:"Developer",tools:["DATABASES_RUN_SQL"],dangerous:!0}],Ut=new Set(ot.find(t=>t.id===ye)?.tools??[]);function Bt(){const t=new Map;for(const e of ot){if(e.id===ye)continue;const n=t.get(e.section)??[];n.push(e),t.set(e.section,n)}return Array.from(t.entries()).map(([e,n])=>({section:e,capabilities:n}))}function Vt(t,e,n){return n?!0:t.tools.every(l=>e.includes(l))}function zt(t,e,n){if(n){const o=new Set(e);for(const a of t.tools)o.add(a);return Array.from(o)}const l=new Set(e);for(const o of t.tools)l.delete(o);return Array.from(l)}const Yt=B.memo(function(e){const n=q.c(21),{connection:l,isSelected:o,hasToolsEnabled:a,activeToolsCount:d,totalToolsCount:p,onSelect:m,onToggle:g}=e,h=o?"bg-accent/50":"hover:bg-muted/50";let r;n[0]!==h?(r=Q("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",h),n[0]=h,n[1]=r):r=n[1];let x;n[2]!==l.icon||n[3]!==l.title?(x=s.jsx(ve,{icon:l.icon,name:l.title,size:"xs"}),n[2]=l.icon,n[3]=l.title,n[4]=x):x=n[4];let i;n[5]!==l.title?(i=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:l.title})}),n[5]=l.title,n[6]=i):i=n[6];let c;n[7]!==m||n[8]!==x||n[9]!==i?(c=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:m,children:[x,i]}),n[7]=m,n[8]=x,n[9]=i,n[10]=c):c=n[10];let E;n[11]!==d||n[12]!==l.tools||n[13]!==a||n[14]!==g||n[15]!==p?(E=l.tools&&l.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[d,"/",p]}),s.jsx(we,{checked:a,onCheckedChange:g,onClick:Qt})]}),n[11]=d,n[12]=l.tools,n[13]=a,n[14]=g,n[15]=p,n[16]=E):E=n[16];let b;return n[17]!==r||n[18]!==c||n[19]!==E?(b=s.jsxs("div",{className:r,children:[c,E]}),n[17]=r,n[18]=c,n[19]=E,n[20]=b):b=n[20],b}),$t=B.memo(function(e){const n=q.c(18),{connectionId:l,tool:o,isSelected:a,onToggle:d}=e,p=`tool-${l}-${o.name}`,m=a?"text-foreground":"text-muted-foreground";let g;n[0]!==m?(g=Q("text-sm font-medium",m),n[0]=m,n[1]=g):g=n[1];let h;n[2]!==g||n[3]!==o.name?(h=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:g,children:o.name})}),n[2]=g,n[3]=o.name,n[4]=h):h=n[4];let r;n[5]!==o.description?(r=o.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:o.description}),n[5]=o.description,n[6]=r):r=n[6];let x;n[7]!==h||n[8]!==r?(x=s.jsxs("div",{className:"flex-1 min-w-0",children:[h,r]}),n[7]=h,n[8]=r,n[9]=x):x=n[9];const i=`tool-${l}-${o.name}`;let c;n[10]!==a||n[11]!==d||n[12]!==i?(c=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(we,{id:i,checked:a,onCheckedChange:d,onClick:Kt})}),n[10]=a,n[11]=d,n[12]=i,n[13]=c):c=n[13];let E;return n[14]!==p||n[15]!==x||n[16]!==c?(E=s.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:p,children:[x,c]}),n[14]=p,n[15]=x,n[16]=c,n[17]=E):E=n[17],E});function Ft({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:n,searchQuery:l}){const[o,a]=B.useState(""),d=l!==void 0?l:o,p=B.useDeferredValue(d),[m,g]=B.useState("all"),[h,r]=B.useState(!1),x=B.useRef(new Set(Object.keys(t))),{org:i}=Ne(),c=wt({connectionId:yt,orgId:i.id}),E=100,b=p.trim(),I=b?{operator:"or",conditions:[{field:["title"],operator:"contains",value:b},{field:["description"],operator:"contains",value:b}]}:void 0,A=!!n,N={...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:E,offset:0,...A&&{include_virtual:!0}},R=JSON.stringify(N),{data:_,fetchNextPage:j,hasNextPage:f,isFetchingNextPage:S}=vt({queryKey:re.collectionListInfinite(c,i.id,"","CONNECTIONS",R),queryFn:async({pageParam:T=0})=>(await c.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:E,offset:T,...A&&{include_virtual:!0}}})).structuredContent,initialPageParam:0,getNextPageParam:(T,k)=>{if(T?.hasMore)return k.reduce((F,ee)=>F+(ee?.items?.length??0),0)},staleTime:3e4}),w=_?.pages.flatMap(T=>T?.items??[])??[],v=Rt(j,f??!1,S),u=n?w.filter(T=>T.connection_type!=="VIRTUAL"?!0:ft(T.connection_url)!==n):w,y=x.current,C=[...y.values()].map(T=>u.find(k=>k.id===T)).filter(T=>T!==void 0),D=u.filter(T=>!y.has(T.id)),G=[...C,...D],$=T=>{const k=t[T];return k!==void 0&&k.length>0},L=G.filter(T=>{if(m==="all")return!0;const k=$(T.id);return m==="selected"?k:m==="unselected"?!k:!0}),[V,z]=B.useState(G[0]?.id??null),O=V?G.find(T=>T.id===V)??null:null,M=O?.tools??[],Y=(T,k)=>t[T]?.includes(k)??!1,K=(T,k)=>{const F=t[T]??[],ee=F.includes(k),H={...t};if(ee){const Z=F.filter(X=>X!==k);Z.length===0?delete H[T]:H[T]=Z}else H[T]=[...F,k];e(H)},J=T=>{const k=G.find(X=>X.id===T);if(!k?.tools)return;const F=t[T]??[],ee=k.tools.map(X=>X.name),H=F.length>0&&ee.every(X=>F.includes(X)),Z={...t};H?delete Z[T]:(Z[T]=ee,z(T)),e(Z)},W=T=>{z(T),r(!0)},le=()=>{r(!1)};return s.jsxs("div",{className:"flex h-full",children:[s.jsxs("div",{className:Q("w-full md:w-80 border-r border-border flex flex-col",h&&"hidden md:flex"),children:[l===void 0&&s.jsx(Mt,{value:o,onChange:a,placeholder:"Search MCP Servers..."}),s.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[s.jsx("button",{onClick:()=>g("all"),className:Q("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",m==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>g("selected"),className:Q("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",m==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>g("unselected"),className:Q("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",m==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:L.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:d?"No connections found":m==="selected"?"No servers selected":m==="unselected"?"No unselected servers":"No connections available"}):s.jsxs("div",{className:"p-2 space-y-1",children:[L.map(T=>{const k=T.tools?.length??0,F=t[T.id]?.length??0;return s.jsx(Yt,{connection:T,isSelected:V===T.id,hasToolsEnabled:$(T.id),activeToolsCount:F,totalToolsCount:k,onSelect:()=>W(T.id),onToggle:()=>J(T.id)},T.id)}),s.jsx("div",{ref:v,className:"h-4"}),S&&s.jsx("div",{className:"flex justify-center py-3",children:s.jsx(xe,{size:18,className:"animate-spin text-muted-foreground"})})]})})]}),s.jsx("div",{className:Q("flex-1 flex-col",h?"flex":"hidden md:flex"),children:O?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:le,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(Ot,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(ve,{icon:O.icon,name:O.title,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:O.title}),O.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:O.description})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:M.length===0?s.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):s.jsx("div",{className:"space-y-2",children:M.map(T=>s.jsx($t,{connectionId:O.id,tool:T,isSelected:Y(O.id,T.name),onToggle:()=>K(O.id,T.name)},T.name))})})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}function Qt(t){return t.stopPropagation()}function Kt(t){return t.stopPropagation()}const Se=["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"],qt={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function it(t){if(!t)return"bg-neutral-400";let e=0;for(let l=0;l<t.length;l++){const o=t.charCodeAt(l);e=(e<<5)-e+o,e=e&e}const n=Math.abs(e)%Se.length;return Se[n]??Se[0]}function Ve(t,e){return e?qt[t]??"bg-neutral-400":it(t)}const Ht=Me({role:Me({id:se().optional(),slug:se().optional(),label:se()}),allowAllStaticPermissions:Le(),staticPermissions:_e(se()),toolSet:Pe(se(),_e(se())),allowAllModels:Le(),modelSet:Pe(se(),_e(se())),memberIds:_e(se())});function rt(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function ze(t,e,n){const l=s.jsx(he,{checked:t,disabled:e,onCheckedChange:n});return e?s.jsx(ge,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:l})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):l}function Zt(t){const e=q.c(28),{allowAllStaticPermissions:n,staticPermissions:l,onAllowAllChange:o,onPermissionsChange:a,readOnly:d,searchQuery:p}=t,m=d===void 0?!1:d;let g;e[0]!==p?(g=p.trim().toLowerCase(),e[0]=p,e[1]=g):g=e[1];const h=B.useDeferredValue(g);let r;if(e[2]!==n||e[3]!==h||e[4]!==o||e[5]!==a||e[6]!==m||e[7]!==p||e[8]!==l){const x=Bt(),i=(R,_)=>{if(!m){if(n&&_){const j=x.flatMap(Wt).flatMap(Jt);o(!1),a(j.filter(f=>!R.tools.includes(f)));return}n||a(zt(R,l,!_))}};let c;e[10]!==h?(c=R=>{const{section:_,capabilities:j}=R;return{section:_,capabilities:j.filter(f=>!h||f.label.toLowerCase().includes(h)||f.description.toLowerCase().includes(h))}},e[10]=h,e[11]=c):c=e[11];const E=x.map(c).filter(Xt);let b;e[12]!==n||e[13]!==o||e[14]!==a?(b=()=>{o(!n),a([])},e[12]=n,e[13]=o,e[14]=a,e[15]=b):b=e[15];let I;e[16]!==n||e[17]!==m||e[18]!==b?(I=ze(n,m,b),e[16]=n,e[17]=m,e[18]=b,e[19]=I):I=e[19];let A;e[20]!==n||e[21]!==o||e[22]!==a||e[23]!==m?(A=m?void 0:()=>{o(!n),a([])},e[20]=n,e[21]=o,e[22]=a,e[23]=m,e[24]=A):A=e[24];let N;e[25]!==I||e[26]!==A?(N=s.jsx(De,{title:"General",children:s.jsx(Ge,{children:s.jsx(Ue,{title:"All organization permissions",description:"Grant full access to all features below",action:I,onClick:A})})}),e[25]=I,e[26]=A,e[27]=N):N=e[27],r=s.jsx("div",{children:s.jsxs("div",{className:"flex flex-col gap-10 py-4",children:[N,E.length===0&&h?s.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:["No permissions match “",p,"”"]}):E.map(R=>{const{section:_,capabilities:j}=R;return s.jsx(De,{title:_,children:s.jsx(Ge,{children:j.map(f=>{const S=Vt(f,l,n);return s.jsx(Ue,{title:s.jsxs("span",{className:"flex items-center gap-1.5",children:[f.label,f.dangerous&&s.jsx(gt,{size:12,className:"text-amber-500 shrink-0"})]}),description:f.description,action:ze(S,m,()=>i(f,S)),onClick:m?void 0:()=>i(f,S)},f.id)})})},_)})]})}),e[2]=n,e[3]=h,e[4]=o,e[5]=a,e[6]=m,e[7]=p,e[8]=l,e[9]=r}else r=e[9];return r}function Xt(t){return t.capabilities.length>0}function Jt(t){return t.tools}function Wt(t){return t.capabilities}const at={anthropic:"Anthropic",openrouter:"OpenRouter"},es={openai:"OpenAI",anthropic:"Anthropic",google:"Google","meta-llama":"Meta",mistralai:"Mistral","x-ai":"xAI",deepseek:"DeepSeek",qwen:"Qwen",moonshotai:"MoonshotAI",nvidia:"NVIDIA",perplexity:"Perplexity",cohere:"Cohere",amazon:"Amazon",microsoft:"Microsoft","z-ai":"Z.ai","ibm-granite":"IBM Granite",alibaba:"Alibaba",baidu:"Baidu",bytedance:"ByteDance",tencent:"Tencent",minimax:"MiniMax",nousresearch:"Nous Research",allenai:"Allen AI",inception:"Inception"};function ts(t,e){const n=t.indexOf("/"),l=n>0?t.slice(0,n):e;return l.startsWith("~")?l.slice(1):l}function ss(t){return es[t]??at[t]??t}function ns(t){const e=t.indexOf(": ");return e>0&&e<32?t.slice(e+2):t}const ct=30;function ls(t){const e=q.c(44),{connectionId:n,subProviderId:l,subProviderName:o,groupLogo:a,models:d,allConnectionModelIds:p,selectedModels:m,allowAllModels:g,allConnectionModelsSelected:h,onToggleModel:r,onExitAllowAll:x,readOnly:i,defaultExpanded:c}=t,[E,b]=B.useState(c),I=c||E,A=b,[N,R]=B.useState(ct);let _;e[0]!==h||e[1]!==g||e[2]!==m?(_=v=>g||h||m.includes("*")||m.includes(v),e[0]=h,e[1]=g,e[2]=m,e[3]=_):_=e[3];const j=_;let f;if(e[4]!==j||e[5]!==d){let v;e[7]!==j?(v=u=>j(u.id),e[7]=j,e[8]=v):v=e[8],f=d.filter(v),e[4]=j,e[5]=d,e[6]=f}else f=e[6];const S=f.length;let w;if(e[9]!==p||e[10]!==g||e[11]!==n||e[12]!==S||e[13]!==I||e[14]!==a||e[15]!==j||e[16]!==d||e[17]!==x||e[18]!==r||e[19]!==i||e[20]!==l||e[21]!==o||e[22]!==N){const v=d.slice(0,N),u=d.length>N;let y;e[24]===Symbol.for("react.memo_cache_sentinel")?(y=()=>A(as),e[24]=y):y=e[24];const C=a??tt[l]??st;let D;e[25]!==o||e[26]!==C?(D=s.jsx(ve,{icon:C,name:o,size:"sm"}),e[25]=o,e[26]=C,e[27]=D):D=e[27];let G;e[28]!==o?(G=s.jsx("span",{className:"text-sm font-medium truncate",children:o}),e[28]=o,e[29]=G):G=e[29];let $;e[30]!==D||e[31]!==G?($=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[D,G]}),e[30]=D,e[31]=G,e[32]=$):$=e[32];let L;e[33]!==S||e[34]!==d.length?(L=s.jsxs(fe,{variant:"secondary",className:"text-xs text-muted-foreground",children:[S,"/",d.length," enabled"]}),e[33]=S,e[34]=d.length,e[35]=L):L=e[35];let V;e[36]!==I?(V=I?s.jsx(Dt,{size:16,className:"text-muted-foreground shrink-0"}):s.jsx(Gt,{size:16,className:"text-muted-foreground shrink-0"}),e[36]=I,e[37]=V):V=e[37];let z;e[38]!==V||e[39]!==L?(z=s.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[L,V]}),e[38]=V,e[39]=L,e[40]=z):z=e[40];let O;e[41]!==z||e[42]!==$?(O=s.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3 hover:bg-muted/50 cursor-pointer",onClick:y,children:[$,z]}),e[41]=z,e[42]=$,e[43]=O):O=e[43],w=s.jsxs("div",{className:"border border-border rounded-lg overflow-hidden bg-card",children:[O,I&&s.jsxs("div",{className:"border-t border-border bg-muted/20",children:[v.map(M=>{const Y=j(M.id),K=()=>{if(!i){if(g){x(n,p,M.id);return}r(n,M.id)}};return s.jsxs("div",{className:Q("flex items-center justify-between gap-3 px-4 py-3 border-b border-border last:border-b-0",!i&&"hover:bg-muted/50 cursor-pointer"),onClick:K,children:[s.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:s.jsx("span",{className:"text-sm truncate",children:M.title})}),s.jsx("div",{onClick:rs,children:i?s.jsx(ge,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsx(he,{checked:Y,disabled:!0,onCheckedChange:is})})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(he,{checked:Y,onCheckedChange:K})})]},M.id)}),u&&s.jsxs("button",{type:"button",className:"w-full px-4 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors",onClick:()=>R(os),children:["Show more (",d.length-N," remaining)"]})]})]}),e[9]=p,e[10]=g,e[11]=n,e[12]=S,e[13]=I,e[14]=a,e[15]=j,e[16]=d,e[17]=x,e[18]=r,e[19]=i,e[20]=l,e[21]=o,e[22]=N,e[23]=w}else w=e[23];return w}function os(t){return t+ct}function is(){}function rs(t){return t.stopPropagation()}function as(t){return!t}function cs(t){const e=q.c(33),{connection:n,selectedModels:l,allowAllModels:o,onToggleModel:a,onExitAllowAll:d,allConnectionModelsSelected:p,searchQuery:m,readOnly:g}=t,h=kt(n.id);let r,x,i,c,E;if(e[0]!==p||e[1]!==o||e[2]!==n.id||e[3]!==n.label||e[4]!==n.providerId||e[5]!==d||e[6]!==a||e[7]!==h||e[8]!==g||e[9]!==m||e[10]!==l){E=Symbol.for("react.early_return_sentinel");e:{let A;e[16]!==n.label?(A=C=>({...C,id:C.modelId,provider:n.label}),e[16]=n.label,e[17]=A):A=e[17];const N=h.filter(fs).map(A),R=m.trim().toLowerCase(),_=R?N.filter(C=>C.title.toLowerCase().includes(R)||C.id.toLowerCase().includes(R)||C.provider?.toLowerCase().includes(R)):N;if(_.length===0){E=null;break e}const j=new Map;for(const C of _){const D=ts(C.id,n.providerId),G=j.get(D)??{models:[],logo:null};G.models.push({id:C.id,title:ns(C.title),logo:C.logo}),!G.logo&&C.logo&&(G.logo=C.logo),j.set(D,G)}const f=Array.from(j.entries()).map(us).sort(ms),S=f.length===1||R.length>0;i="flex flex-col gap-3";const w=tt[n.providerId]??st;let v;e[18]!==n.providerId||e[19]!==w?(v=s.jsx("img",{src:w,alt:n.providerId,className:"w-4 h-4 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),e[18]=n.providerId,e[19]=w,e[20]=v):v=e[20];const u=at[n.providerId]??n.providerId;let y;e[21]!==u?(y=s.jsx("h4",{className:"text-sm font-medium",children:u}),e[21]=u,e[22]=y):y=e[22],e[23]!==y||e[24]!==v?(c=s.jsxs("div",{className:"flex items-center gap-2",children:[v,y]}),e[23]=y,e[24]=v,e[25]=c):c=e[25],r="flex flex-col gap-3",x=f.map(C=>s.jsx(ls,{connectionId:n.id,subProviderId:C.id,subProviderName:C.name,groupLogo:C.logo,models:C.models,allConnectionModelIds:N.map(ds),selectedModels:l,allowAllModels:o,allConnectionModelsSelected:p,onToggleModel:a,onExitAllowAll:d,readOnly:g,defaultExpanded:S},C.id))}e[0]=p,e[1]=o,e[2]=n.id,e[3]=n.label,e[4]=n.providerId,e[5]=d,e[6]=a,e[7]=h,e[8]=g,e[9]=m,e[10]=l,e[11]=r,e[12]=x,e[13]=i,e[14]=c,e[15]=E}else r=e[11],x=e[12],i=e[13],c=e[14],E=e[15];if(E!==Symbol.for("react.early_return_sentinel"))return E;let b;e[26]!==r||e[27]!==x?(b=s.jsx("div",{className:r,children:x}),e[26]=r,e[27]=x,e[28]=b):b=e[28];let I;return e[29]!==i||e[30]!==c||e[31]!==b?(I=s.jsxs("div",{className:i,children:[c,b]}),e[29]=i,e[30]=c,e[31]=b,e[32]=I):I=e[32],I}function ds(t){return t.id}function ms(t,e){return t.name.localeCompare(e.name)}function us(t){const[e,n]=t;return{id:e,name:ss(e),logo:n.logo,models:n.models}}function fs(t,e,n){return n.findIndex(l=>l.modelId===t.modelId)===e}function hs(t){const e=q.c(35),{allowAllModels:n,modelSet:l,onAllowAllChange:o,onModelSetChange:a,readOnly:d,searchQuery:p}=t,m=d===void 0?!1:d,g=B.useDeferredValue(p),h=Lt();let r;e[0]!==l||e[1]!==a?(r=(f,S)=>{const w=l[f]??[],v={...l};if(w.includes(S)){const u=w.filter(y=>y!==S);u.length===0?delete v[f]:v[f]=u}else v[f]=[...w,S];a(v)},e[0]=l,e[1]=a,e[2]=r):r=e[2];const x=r;let i;e[3]!==l||e[4]!==o||e[5]!==a?(i=(f,S,w)=>{o(!1),a({...l,[f]:S.filter(v=>v!==w)})},e[3]=l,e[4]=o,e[5]=a,e[6]=i):i=e[6];const c=i,E=!m&&"hover:bg-muted/50 cursor-pointer";let b;e[7]!==E?(b=Q("flex items-center justify-between px-4 py-3 rounded-lg border border-border bg-card",E),e[7]=E,e[8]=b):b=e[8];let I;e[9]!==n||e[10]!==o||e[11]!==a||e[12]!==m?(I=()=>{if(m)return;const f=!n;o(f),f&&a({})},e[9]=n,e[10]=o,e[11]=a,e[12]=m,e[13]=I):I=e[13];let A;e[14]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[14]=A):A=e[14];let N;e[15]!==n||e[16]!==o||e[17]!==a||e[18]!==m?(N=s.jsx("div",{onClick:gs,children:m?s.jsx(ge,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsx(he,{checked:n,disabled:!0,onCheckedChange:xs})})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(he,{checked:n,onCheckedChange:f=>{o(f),f&&a({})}})}),e[15]=n,e[16]=o,e[17]=a,e[18]=m,e[19]=N):N=e[19];let R;e[20]!==b||e[21]!==I||e[22]!==N?(R=s.jsxs("div",{className:b,onClick:I,children:[A,N]}),e[20]=b,e[21]=I,e[22]=N,e[23]=R):R=e[23];let _;e[24]!==h||e[25]!==n||e[26]!==g||e[27]!==c||e[28]!==l||e[29]!==m||e[30]!==x?(_=h.length===0?s.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No LLM connections configured"}):h.map(f=>s.jsx(B.Suspense,{fallback:s.jsxs("div",{className:"px-4 py-3 flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(xe,{className:"size-4 animate-spin"}),"Loading models..."]}),children:s.jsx(cs,{connection:f,selectedModels:l[f.id]??[],allowAllModels:n,onToggleModel:x,onExitAllowAll:c,allConnectionModelsSelected:(l[f.id]??[]).includes("*"),searchQuery:g,readOnly:m})},f.id)),e[24]=h,e[25]=n,e[26]=g,e[27]=c,e[28]=l,e[29]=m,e[30]=x,e[31]=_):_=e[31];let j;return e[32]!==_||e[33]!==R?(j=s.jsxs("div",{className:"flex flex-col h-full overflow-auto gap-6 pb-6",children:[R,_]}),e[32]=_,e[33]=R,e[34]=j):j=e[34],j}function xs(){}function gs(t){return t.stopPropagation()}function ps(t){const e=q.c(52),{open:n,onOpenChange:l,selectedMemberIds:o,onAddMembers:a}=t,[d,p]=B.useState(""),m=B.useDeferredValue(d);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[0]=g):g=e[0];const[h,r]=B.useState(g),{data:x}=nt();let i,c,E,b,I,A,N,R,_,j,f;if(e[1]!==x?.data?.members||e[2]!==m||e[3]!==a||e[4]!==l||e[5]!==n||e[6]!==h||e[7]!==d||e[8]!==o){const $=x?.data?.members??[];let L;e[20]!==m?(L=O=>{const M=m.toLowerCase();return O.user?.name?.toLowerCase().includes(M)||O.user?.email?.toLowerCase().includes(M)},e[20]=m,e[21]=L):L=e[21];const V=$.filter(L);let z;e[22]!==a||e[23]!==l||e[24]!==h?(z=()=>{a(h),r([]),l(!1)},e[22]=a,e[23]=l,e[24]=h,e[25]=z):z=e[25],E=z,c=Qe,j=n,f=l,i=Ke,R="sm:max-w-md p-0 overflow-hidden",e[26]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsxs(qe,{className:"px-6 pt-6",children:[s.jsx(He,{children:"Add Members to Role"}),s.jsx(Ze,{children:"Select members to add to this role."})]}),e[26]=_):_=e[26],A="flex flex-col h-80",e[27]!==d?(N=s.jsx("div",{className:"border-b border-border px-4 py-3",children:s.jsx(Oe,{value:d,onChange:p,placeholder:"Search members...",className:"w-full"})}),e[27]=d,e[28]=N):N=e[28],b="flex-1 overflow-auto",I=V.length===0?s.jsx("div",{className:"flex items-center justify-center h-full px-6",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:d?"No members found":"No members available"})}):s.jsx("div",{className:"px-6 py-2 space-y-1",children:V.map(O=>{const M=O.role!=="owner",Y=o.includes(O.id),K=h.includes(O.id);return s.jsxs("label",{className:Q("flex items-center gap-3 p-2 rounded-lg",!M||Y?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(we,{checked:K||Y,onCheckedChange:()=>{!M||Y||r(J=>J.includes(O.id)?J.filter(W=>W!==O.id):[...J,O.id])},disabled:!M||Y}),s.jsx(lt,{url:O.user?.image??void 0,fallback:rt(O.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:O.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:O.user?.email})]}),!M&&s.jsx(fe,{variant:"secondary",className:"shrink-0",children:"Owner"}),Y&&M&&s.jsx(fe,{variant:"outline",className:"shrink-0",children:"Added"})]},O.id)})}),e[1]=x?.data?.members,e[2]=m,e[3]=a,e[4]=l,e[5]=n,e[6]=h,e[7]=d,e[8]=o,e[9]=i,e[10]=c,e[11]=E,e[12]=b,e[13]=I,e[14]=A,e[15]=N,e[16]=R,e[17]=_,e[18]=j,e[19]=f}else i=e[9],c=e[10],E=e[11],b=e[12],I=e[13],A=e[14],N=e[15],R=e[16],_=e[17],j=e[18],f=e[19];let S;e[29]!==b||e[30]!==I?(S=s.jsx("div",{className:b,children:I}),e[29]=b,e[30]=I,e[31]=S):S=e[31];let w;e[32]!==S||e[33]!==A||e[34]!==N?(w=s.jsxs("div",{className:A,children:[N,S]}),e[32]=S,e[33]=A,e[34]=N,e[35]=w):w=e[35];let v;e[36]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(Xe,{children:"Cancel"}),e[36]=v):v=e[36];const u=h.length===0,y=h.length>0&&`(${h.length})`;let C;e[37]!==E||e[38]!==u||e[39]!==y?(C=s.jsxs(Je,{className:"px-6 pb-6",children:[v,s.jsxs(We,{onClick:E,disabled:u,children:["Add ",y]})]}),e[37]=E,e[38]=u,e[39]=y,e[40]=C):C=e[40];let D;e[41]!==i||e[42]!==w||e[43]!==C||e[44]!==R||e[45]!==_?(D=s.jsxs(i,{className:R,children:[_,w,C]}),e[41]=i,e[42]=w,e[43]=C,e[44]=R,e[45]=_,e[46]=D):D=e[46];let G;return e[47]!==c||e[48]!==D||e[49]!==j||e[50]!==f?(G=s.jsx(c,{open:j,onOpenChange:f,children:D}),e[47]=c,e[48]=D,e[49]=j,e[50]=f,e[51]=G):G=e[51],G}function bs(t){const e=q.c(28),{memberIds:n,onMemberIdsChange:l,readOnly:o,searchQuery:a,addMemberDialogOpen:d,onAddMemberDialogOpenChange:p}=t,m=o===void 0?!1:o,g=B.useDeferredValue(a),{data:h}=nt();let r,x,i;if(e[0]!==h?.data?.members||e[1]!==g||e[2]!==n||e[3]!==l||e[4]!==m||e[5]!==a){const A=h?.data?.members??[];let N;e[9]!==n?(N=f=>n.includes(f.id),e[9]=n,e[10]=N):N=e[10];const R=A.filter(N);let _;e[11]!==g?(_=f=>{const S=g.toLowerCase();return f.user?.name?.toLowerCase().includes(S)||f.user?.email?.toLowerCase().includes(S)},e[11]=g,e[12]=_):_=e[12];const j=R.filter(_);i="flex flex-col h-full",r="flex-1 overflow-auto",x=R.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h3",{className:"text-base font-medium mb-1",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to grant them the configured permissions."})]})}):j.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',a,'"']})}):s.jsx("div",{className:"p-4 space-y-2",children:j.map(f=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(lt,{url:f.user?.image??void 0,fallback:rt(f.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:f.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:f.user?.email})]}),m?s.jsx(ge,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsx(ne,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(Be,{size:16})})})}),s.jsx(Te,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})}):s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>l(n.filter(S=>S!==f.id)),children:s.jsx(Be,{size:16})})]},f.id))}),e[0]=h?.data?.members,e[1]=g,e[2]=n,e[3]=l,e[4]=m,e[5]=a,e[6]=r,e[7]=x,e[8]=i}else r=e[6],x=e[7],i=e[8];let c;e[13]!==r||e[14]!==x?(c=s.jsx("div",{className:r,children:x}),e[13]=r,e[14]=x,e[15]=c):c=e[15];let E;e[16]!==n||e[17]!==l?(E=A=>l([...n,...A]),e[16]=n,e[17]=l,e[18]=E):E=e[18];let b;e[19]!==d||e[20]!==n||e[21]!==p||e[22]!==E?(b=s.jsx(ps,{open:d,onOpenChange:p,selectedMemberIds:n,onAddMembers:E}),e[19]=d,e[20]=n,e[21]=p,e[22]=E,e[23]=b):b=e[23];let I;return e[24]!==i||e[25]!==c||e[26]!==b?(I=s.jsxs("div",{className:i,children:[c,b]}),e[24]=i,e[25]=c,e[26]=b,e[27]=I):I=e[27],I}function Ts(t){const e=q.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(xe,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let l;return e[1]!==t?(l=s.jsx(B.Suspense,{fallback:n,children:s.jsx(bs,{...t})}),e[1]=t,e[2]=l):l=e[2],l}const Es={owner:[],admin:[],user:[]};function Is(t,e,n,l){if(n?.permission!=null&&l)return dt({id:n.id,role:t,label:t.charAt(0).toUpperCase()+t.slice(1),permission:n.permission},e,l);const o=t==="owner"||t==="admin";return{role:{id:n?.id,slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:o,staticPermissions:Es[t],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:e.filter(a=>a.role===t).map(a=>a.id)}}function dt(t,e,n){const l=t.permission||{},o=l.self||[],a=o.includes("*"),d=a?[]:o.filter(r=>r!=="*"),p={};for(const[r,x]of Object.entries(l))if(!(r==="self"||r==="models"))if(r==="*")for(const i of n)p[i.id]=x.includes("*")?i.tools?.map(c=>c.name)??[]:x;else{const i=n.find(c=>c.id===r);i&&(p[r]=x.includes("*")?i.tools?.map(c=>c.name)??[]:x)}const m=l.models||[],g=m.length===0||m.includes("*:*"),h={};if(!g)for(const r of m){const x=r.indexOf(":");if(x===-1)continue;const i=r.slice(0,x),c=r.slice(x+1);h[i]||(h[i]=[]),h[i].push(c)}return{role:{id:t.id,slug:t.role,label:t.label},allowAllStaticPermissions:a,staticPermissions:d,toolSet:p,allowAllModels:g,modelSet:h,memberIds:e.filter(r=>r.role===t.role).map(r=>r.id)}}function _s(t,e){const n={};if(t.allowAllStaticPermissions)n.self=["*"];else{const l=new Set(t.staticPermissions);for(const o of Ut)l.add(o);l.size>0&&(n.self=Array.from(l))}for(const[l,o]of Object.entries(t.toolSet))if(o.length>0){const d=e.find(p=>p.id===l)?.tools?.map(p=>p.name)??[];n[l]=d.length>0&&d.every(p=>o.includes(p))?["*"]:o}if(t.allowAllModels)n.models=["*:*"];else{const l=[];for(const[o,a]of Object.entries(t.modelSet))for(const d of a)l.push(`${o}:${d}`);l.length>0&&(n.models=l)}return n}function Ns(t,e,n){return t.kind==="builtin"?Is(t.role,e,t.storedId!=null?{id:t.storedId,permission:t.storedPermission}:void 0,n):t.kind==="custom"?dt(t.role,e,n):{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:[]}}function Ss(t){const e=q.c(5),{readOnly:n,onOpen:l}=t;if(n){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsxs(ne,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(je,{size:16}),"Add Member"]})})}),e[0]=d):d=e[0];let p;return e[1]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(ge,{children:s.jsxs(pe,{children:[d,s.jsx(Te,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})}),e[1]=p):p=e[1],p}let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(je,{size:16}),e[2]=o):o=e[2];let a;return e[3]!==l?(a=s.jsxs(ne,{variant:"outline",size:"sm",onClick:l,children:[o,"Add Member"]}),e[3]=l,e[4]=a):a=e[4],a}function Cs(t){const e=q.c(14),{locator:n}=Ne(),l=Re(),o=Pt();let a;e[0]!==n?(a=re.members(n),e[0]=n,e[1]=a):a=e[1];let d;e[2]!==l?(d=()=>l.organization.listMembers(),e[2]=l,e[3]=d):d=e[3];let p;e[4]!==a||e[5]!==d?(p={queryKey:a,queryFn:d},e[4]=a,e[5]=d,e[6]=p):p=e[6];const{data:m,isPending:g}=Ye(p);if(g||!o){let i;return e[7]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(xe,{size:32,className:"animate-spin text-muted-foreground"})})}),e[7]=i):i=e[7],i}let h;e[8]!==m?.data?.members?(h=m?.data?.members??[],e[8]=m?.data?.members,e[9]=h):h=e[9];const r=h;let x;return e[10]!==o||e[11]!==r||e[12]!==t?(x=s.jsx(js,{...t,members:r,connections:o}),e[10]=o,e[11]=r,e[12]=t,e[13]=x):x=e[13],x}function js({target:t,onBack:e,onSaved:n,members:l,connections:o}){const{locator:a}=Ne(),d=Re(),p=$e(),m=t.kind==="builtin",g=t.kind==="builtin"&&t.role==="owner",h=t.kind==="new",[r,x]=B.useState(m?"org":"mcp"),i=ht({resolver:xt(Ht),defaultValues:Ns(t,l,o)}),c=i.formState.isValid,E=i.formState.isDirty,b=Fe({mutationFn:async u=>{const y=_s(u,o),C=u.role.slug||u.role.label.toLowerCase().replace(/\s+/g,"-"),D=u.role.slug==="owner"&&!u.role.id,G=(u.role.slug==="admin"||u.role.slug==="user")&&!u.role.id,$=async L=>{const V=l.filter(M=>M.role===L).map(M=>M.id),z=u.memberIds.filter(M=>!V.includes(M)),O=V.filter(M=>!u.memberIds.includes(M));for(const M of z){const Y=await d.organization.updateMemberRole({memberId:M,role:[L]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}for(const M of O){const Y=await d.organization.updateMemberRole({memberId:M,role:["user"]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}};if(D)return await $("owner"),u;if(u.role.id){const L=await d.organization.updateRole({roleId:u.role.id,data:{permission:y}});if(L?.error)throw new Error(L.error.message??"Something went wrong");return await $(u.role.slug),u}else if(G){const L=await authClient.organization.createRole({role:u.role.slug,permission:y});if(L?.error)throw new Error(L.error.message??"Something went wrong");return await $(u.role.slug),{...u,role:{...u.role,id:L.data?.roleData?.id}}}else{const L=await d.organization.createRole({role:C,permission:y});if(L?.error)throw new Error(L.error.message??"Something went wrong");for(const V of u.memberIds){const z=await d.organization.updateMemberRole({memberId:V,role:[C]});if(z?.error)throw new Error(z.error.message)}return{...u,role:{...u.role,id:L.data?.roleData?.id,slug:C}}}},onSuccess:(u,y)=>{p.invalidateQueries({queryKey:re.members(a)}),p.invalidateQueries({queryKey:re.organizationRoles(a)});const C=!y.role.id&&!y.role.slug,D=y.role.slug==="owner"&&!y.role.id;Ae(D?"role_members_updated":C?"role_created":"role_updated",{role_slug:y.role.slug??null}),ue.success(D?"Members updated successfully!":C?"Role created successfully!":"Role updated successfully!"),i.reset(u),n(u.role.id)},onError:u=>{ue.error(u instanceof Error?u.message:"Failed to save role")}}),I=i.handleSubmit(u=>{if(!u.role.label.trim()){ue.error("Role name is required"),i.setFocus("role.label");return}b.mutate(u)}),A=!g,N=t.kind==="builtin"?t.role.charAt(0).toUpperCase()+t.role.slice(1):t.kind==="custom"?t.role.label:"",R=[...g?[]:[{id:"mcp",label:"MCP Permissions"}],{id:"org",label:"Organization Permissions"},{id:"models",label:"Models"},{id:"members",label:"Members"}],[_,j]=B.useState(""),[f,S]=B.useState(!1),w=u=>{x(u),j("")},v={mcp:"Search MCP servers...",org:"Search permissions...",models:"Search models...",members:"Search members..."};return s.jsx(te,{children:s.jsxs(te.Content,{className:Q("flex flex-col",r!=="org"&&"overflow-hidden"),children:[s.jsx("div",{className:"shrink-0 mx-auto w-full max-w-[1200px] px-4 md:px-10 pt-8 md:pt-12 pb-4",children:s.jsxs("div",{className:"flex flex-col gap-5",children:[s.jsx(te.Title,{actions:A&&s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"outline",size:"sm",onClick:e,disabled:b.isPending,children:"Cancel"}),s.jsx(ne,{size:"sm",onClick:I,disabled:b.isPending||!c||!E,children:b.isPending?"Saving...":h?"Create Role":"Save Changes"})]}),children:s.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[s.jsx("div",{className:Q("size-2.5 rounded-full shrink-0",t.kind==="builtin"?Ve(t.role,!0):t.kind==="custom"?Ve(t.role.role,!1):it(i.watch("role.label")))}),g&&s.jsx(et,{size:16,className:"text-muted-foreground shrink-0"}),h?s.jsx("input",{...i.register("role.label"),placeholder:"Role name",className:"leading-tight text-foreground bg-transparent border-none outline-none px-1 -mx-1 rounded hover:bg-input/25 focus:bg-input/25 transition-colors w-64 placeholder:text-muted-foreground/50",autoFocus:!0}):s.jsx("span",{className:"truncate",children:N})]})}),s.jsx("div",{className:"flex items-center gap-2",children:R.map(u=>s.jsx("button",{type:"button",onClick:()=>w(u.id),className:Q("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex items-center",r===u.id?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:u.label},u.id))}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(Oe,{value:_,onChange:j,placeholder:v[r]??"Search...",className:"w-full md:w-[375px]"}),r==="members"&&s.jsx(Ss,{readOnly:t.kind==="builtin"&&t.role==="owner",onOpen:()=>S(!0)})]})]})}),s.jsx("div",{className:Q("mx-auto w-full max-w-[1200px] px-4 md:px-10 pb-6",r!=="org"&&"flex-1 min-h-0"),children:s.jsxs("div",{className:Q(r!=="org"&&"h-full overflow-hidden",r!=="models"&&r!=="org"&&"border border-border rounded-xl bg-card"),children:[r==="mcp"&&!g&&s.jsx(Ft,{toolSet:i.watch("toolSet"),onToolSetChange:u=>i.setValue("toolSet",u,{shouldDirty:!0}),searchQuery:_}),r==="org"&&s.jsx(Zt,{allowAllStaticPermissions:i.watch("allowAllStaticPermissions"),staticPermissions:i.watch("staticPermissions"),onAllowAllChange:u=>i.setValue("allowAllStaticPermissions",u,{shouldDirty:!0}),onPermissionsChange:u=>i.setValue("staticPermissions",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),r==="models"&&s.jsx(hs,{allowAllModels:i.watch("allowAllModels"),modelSet:i.watch("modelSet"),onAllowAllChange:u=>i.setValue("allowAllModels",u,{shouldDirty:!0}),onModelSetChange:u=>i.setValue("modelSet",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),r==="members"&&s.jsx(Ts,{memberIds:i.watch("memberIds"),onMemberIdsChange:u=>i.setValue("memberIds",u,{shouldDirty:!0}),readOnly:t.kind==="builtin"&&t.role==="owner",searchQuery:_,addMemberDialogOpen:f,onAddMemberDialogOpenChange:S})]})})]})})}function As(t){return t.kind==="builtin"?`builtin-${t.role}`:t.kind==="custom"?`custom-${t.role.id}`:"new"}const Rs=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],Ce=["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 Os(t){if(!t)return"bg-neutral-400";let e=0;for(let l=0;l<t.length;l++){const o=t.charCodeAt(l);e=(e<<5)-e+o,e=e&e}const n=Math.abs(e)%Ce.length;return Ce[n]??Ce[0]}const vs={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function ws(t,e){return e?vs[t]??"bg-neutral-400":Os(t)}function ys(){const t=q.c(77),[e,n]=B.useState(""),[l,o]=B.useState(null),a=bt();let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d={strict:!1},t[0]=d):d=t[0];const{role:p}=Tt(d),{locator:m}=Ne(),g=Re(),h=$e(),{customRoles:r,refetch:x}=Et();let i;t[1]!==a?(i=P=>a({to:".",search:U=>({...U,role:P})}),t[1]=a,t[2]=i):i=t[2];const c=i;let E;e:{if(!p){E=null;break e}if(p==="new"){E={kind:"new"};break e}if(p.startsWith("builtin-")){E={kind:"builtin",role:p.slice(8)};break e}let P;t[3]!==p?(P=oe=>oe.id===p,t[3]=p,t[4]=P):P=t[4];const U=r.find(P);E=U?{kind:"custom",role:U}:null}const b=E;let I;t[5]!==m?(I=re.members(m),t[5]=m,t[6]=I):I=t[6];let A;t[7]!==g?(A=()=>g.organization.listMembers(),t[7]=g,t[8]=A):A=t[8];let N;t[9]!==I||t[10]!==A?(N={queryKey:I,queryFn:A},t[9]=I,t[10]=A,t[11]=N):N=t[11];const{data:R}=Ye(N);let _;t[12]!==R?.data?.members?(_=R?.data?.members??[],t[12]=R?.data?.members,t[13]=_):_=t[13];const j=_;let f;t[14]!==j?(f=P=>j.filter(U=>U.role===P).length,t[14]=j,t[15]=f):f=t[15];const S=f;let w;if(t[16]!==r||t[17]!==S||t[18]!==e){let P;t[20]!==S?(P=ie=>({kind:"builtin",role:{...ie,memberCount:S(ie.role)}}),t[20]=S,t[21]=P):P=t[21];const U=Rs.map(P);let oe;t[22]!==S?(oe=ie=>({kind:"custom",role:{...ie,memberCount:S(ie.role)}}),t[22]=S,t[23]=oe):oe=t[23];const mt=r.map(oe);if(w=[...U,...mt],e){const ie=e.toLowerCase();w=w.filter(ut=>ut.role.label.toLowerCase().includes(ie))}t[16]=r,t[17]=S,t[18]=e,t[19]=w}else w=t[19];let v;t[24]!==g?(v=async P=>{const U=await g.organization.deleteRole({roleId:P});if(U?.error)throw new Error(U.error.message);return U?.data},t[24]=g,t[25]=v):v=t[25];const u=Fe({mutationFn:v,onSuccess:(P,U)=>{Ae("role_deleted",{role_id:U}),h.invalidateQueries({queryKey:re.members(m)}),h.invalidateQueries({queryKey:re.organizationRoles(m)}),ue.success("Role deleted successfully!"),x(),b?.kind==="custom"&&b.role.id===U&&c(void 0)},onError:Us});let y,C,D,G;t[26]===Symbol.for("react.memo_cache_sentinel")?(G={id:"role",header:"Role",render:Gs,cellClassName:"flex-1 min-w-0",sortable:!0},y={id:"type",header:"Type",render:Ds,cellClassName:"w-28 shrink-0"},C={id:"permissions",header:"Permissions",render:ks,cellClassName:"flex-1 min-w-0"},D={id:"members",header:"Members",render:Ls,cellClassName:"w-24 shrink-0"},t[26]=y,t[27]=C,t[28]=D,t[29]=G):(y=t[26],C=t[27],D=t[28],G=t[29]);let $;t[30]===Symbol.for("react.memo_cache_sentinel")?($=[G,y,C,D,{id:"actions",header:"",render:P=>P.kind==="builtin"?null:s.jsxs(It,{children:[s.jsx(_t,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Ps,children:s.jsx(Ct,{size:16})})}),s.jsx(Nt,{align:"end",onClick:Ms,children:s.jsxs(St,{variant:"destructive",onClick:()=>{const U=P.role;U.id&&o({id:U.id,label:U.label})},children:[s.jsx(jt,{size:16}),"Delete"]})})]}),cellClassName:"w-12 shrink-0"}],t[30]=$):$=t[30];const L=$;let V;t[31]!==c?(V=P=>{if(P.kind==="builtin")c(`builtin-${P.role.role}`);else{const U=P.role;c(U.id)}},t[31]=c,t[32]=V):V=t[32];const z=V;if(b){let P;t[33]!==c?(P=()=>c(void 0),t[33]=c,t[34]=P):P=t[34];let U;return t[35]!==x||t[36]!==c?(U=()=>{x(),c(void 0)},t[35]=x,t[36]=c,t[37]=U):U=t[37],s.jsx(Cs,{target:b,onBack:P,onSaved:U},As(b))}let O;t[38]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(te.Title,{children:"Roles"}),t[38]=O):O=t[38];let M;t[39]===Symbol.for("react.memo_cache_sentinel")?(M=P=>{P.key==="Escape"&&(n(""),P.target.blur())},t[39]=M):M=t[39];let Y;t[40]!==e?(Y=s.jsx(Oe,{value:e,onChange:n,placeholder:"Search roles...",className:"w-full md:w-[375px]",onKeyDown:M}),t[40]=e,t[41]=Y):Y=t[41];let K;t[42]!==c?(K=()=>c("new"),t[42]=c,t[43]=K):K=t[43];let J;t[44]===Symbol.for("react.memo_cache_sentinel")?(J=s.jsx(je,{size:16}),t[44]=J):J=t[44];let W;t[45]!==K?(W=s.jsxs(ne,{onClick:K,children:[J,"Create Role"]}),t[45]=K,t[46]=W):W=t[46];let le;t[47]!==Y||t[48]!==W?(le=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[Y,W]}),t[47]=Y,t[48]=W,t[49]=le):le=t[49];let T;t[50]!==e?(T=e?s.jsx(ke,{title:"No roles found",description:`No roles match "${e}"`}):s.jsx(ke,{title:"No roles",description:"Create a role to get started."}),t[50]=e,t[51]=T):T=t[51];let k;t[52]!==w||t[53]!==L||t[54]!==z||t[55]!==T?(k=s.jsx(At,{columns:L,data:w,isLoading:!1,onRowClick:z,emptyState:T}),t[52]=w,t[53]=L,t[54]=z,t[55]=T,t[56]=k):k=t[56];let F;t[57]!==le||t[58]!==k?(F=s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs("div",{className:"flex flex-col gap-6",children:[O,le,k]})})}),t[57]=le,t[58]=k,t[59]=F):F=t[59];const ee=l!==null;let H;t[60]===Symbol.for("react.memo_cache_sentinel")?(H=P=>!P&&o(null),t[60]=H):H=t[60];let Z;t[61]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsx(He,{children:"Delete Role"}),t[61]=Z):Z=t[61];const X=l?.label;let ae;t[62]!==X?(ae=s.jsxs(qe,{children:[Z,s.jsxs(Ze,{children:['Are you sure you want to delete the "',X,'" role? This action cannot be undone.']})]}),t[62]=X,t[63]=ae):ae=t[63];let Ee;t[64]===Symbol.for("react.memo_cache_sentinel")?(Ee=s.jsx(Xe,{children:"Cancel"}),t[64]=Ee):Ee=t[64];let ce;t[65]!==u||t[66]!==l?(ce=s.jsxs(Je,{children:[Ee,s.jsx(We,{onClick:()=>{l?.id&&u.mutate(l.id),o(null)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[65]=u,t[66]=l,t[67]=ce):ce=t[67];let de;t[68]!==ae||t[69]!==ce?(de=s.jsxs(Ke,{children:[ae,ce]}),t[68]=ae,t[69]=ce,t[70]=de):de=t[70];let me;t[71]!==ee||t[72]!==de?(me=s.jsx(Qe,{open:ee,onOpenChange:H,children:de}),t[71]=ee,t[72]=de,t[73]=me):me=t[73];let Ie;return t[74]!==F||t[75]!==me?(Ie=s.jsxs(te,{children:[F,me]}),t[74]=F,t[75]=me,t[76]=Ie):Ie=t[76],Ie}function Ms(t){return t.stopPropagation()}function Ps(t){return t.stopPropagation()}function Ls(t){return s.jsx("span",{className:"text-sm text-foreground",children:t.role.memberCount})}function ks(t){if(t.kind==="builtin")return t.role.role==="owner"||t.role.role==="admin"?s.jsx("span",{className:"text-sm text-muted-foreground",children:"Full access"}):s.jsx("span",{className:"text-sm text-muted-foreground",children:"Basic access"});const e=t.role,n=[];return e.allowsAllStaticPermissions?n.push("Full org access"):e.staticPermissionCount&&e.staticPermissionCount>0&&n.push(`${e.staticPermissionCount} org perm${e.staticPermissionCount!==1?"s":""}`),e.allowsAllConnections?n.push("All connections"):e.connectionCount&&e.connectionCount>0&&n.push(`${e.connectionCount} connection${e.connectionCount!==1?"s":""}`),s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:n.length>0?n.join(", "):"No permissions"})}function Ds(t){return t.kind==="builtin"?s.jsx(fe,{variant:"secondary",className:"text-xs",children:"Built-in"}):s.jsx(fe,{variant:"outline",className:"text-xs",children:"Custom"})}function Gs(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:Q("size-2.5 rounded-full shrink-0",ws(t.role.role,t.kind==="builtin"))}),s.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:t.role.label}),t.kind==="builtin"&&s.jsx(et,{size:12,className:"text-muted-foreground shrink-0"})]})}function Us(t,e){Ae("role_delete_failed",{role_id:e,error:t instanceof Error?t.message:String(t)}),ue.error(t instanceof Error?t.message:"Failed to delete role")}function Fn(){const t=q.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load roles"})})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(pt,{fallback:e,children:s.jsx(B.Suspense,{fallback:s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(xe,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(ys,{})})}),t[1]=n):n=t[1],n}export{Fn as default};
|
|
1
|
+
import{r as B,s as Ne,K as re,aM as ft,j as s,c as Q,l as xe,B as ne,e as q,n as Ye,o as $e,z as ht,C as xt,a as Fe,x as ue,t as Ae,H as Me,aK as _e,J as se,aI as Pe,a_ as Le,y as gt,E as pt,f as bt,d as Tt}from"./index-CariFzvs.js";import{u as Et}from"./use-organization-roles-DMz4JpGH.js";import{u as Re}from"./use-org-auth-client-CBU51XQa.js";import{B as fe}from"./badge-mnYUd_xY.js";import{A as Qe,a as Ke,b as qe,c as He,d as Ze,f as Xe,e as Je,g as We}from"./alert-dialog-BvOLTTjL.js";import{D as It,a as _t,b as Nt,c as St}from"./dropdown-menu-CT4y7aY2.js";import{i as Ct}from"./DotsVertical-uATdSTpl.js";import{i as et}from"./Lock01-BwE9ru6U.js";import{s as je}from"./Plus-CCywDmjg.js";import{s as jt}from"./Trash01-Rux2RMYE.js";import{C as At}from"./collection-table-wrapper-CuIF1tqK.js";import{P as te}from"./index-D_1AR6r3.js";import{E as ke}from"./empty-state-8HZoUHAZ.js";import{S as Oe}from"./search-input-BvZNM2RM.js";import{P as tt,D as st}from"./ai-providers-logos-D6a8kmGH.js";import{I as ve}from"./integration-icon-Ceb5m9KS.js";import{u as Rt}from"./use-infinite-scroll-C-7Y6eBv.js";import{C as we}from"./checkbox-BYgqHfbE.js";import{i as Ot}from"./RefreshCcw01-CtjTkTf4.js";import{u as vt}from"./useSuspenseInfiniteQuery-M_8yh3H4.js";import{u as wt,S as yt}from"./constants-ajN1Bhug.js";import{C as Mt}from"./collection-search-D9AiUt0i.js";import{u as nt}from"./use-members-DLx75xut.js";import{u as Pt}from"./use-connection-Dw3HjptL.js";import{u as Lt,c as kt}from"./use-ai-providers-D5NHg2Ru.js";import{A as lt}from"./avatar-Di9GD8dd.js";import{S as he}from"./switch-HROyTNdj.js";import{c as ge,T as pe,a as be,b as Te}from"./tooltip-Dr3uY9D4.js";import{S as De,a as Ge,b as Ue}from"./settings-section-COnpJzJz.js";import{t as Dt}from"./ChevronDown-YpILLXr3.js";import{i as Gt}from"./ChevronRight-C5cwFzdi.js";import{i as Be}from"./X-Cg5jWZ6W.js";import"./table-IqV9GNGa.js";import"./XClose-N2VTvn-z.js";import"./SearchMd-OYsWp4RC.js";import"./Container-CEV9uk-Z.js";import"./agent-icon-BhGa08Fl.js";import"./AlertCircle-DGWwcoQZ.js";import"./Tool01-CB2DUdHU.js";import"./ArrowNarrowLeft-6CbLfe6R.js";import"./XCircle-m0QK52Tq.js";import"./ArrowUpRight-DGFb4j2X.js";import"./ZapSquare-CpCXmnKj.js";import"./Users03-CrrZL9MY.js";import"./CheckCircle-TABxOmV2.js";import"./ChevronUp-D3ACbD1g.js";import"./Star01-BP3IsurF.js";import"./Palette-BXvnxfG9.js";import"./LinkExternal01-DRPBZiOD.js";import"./Sun-beuoApqH.js";import"./Play-DgZHjcoJ.js";import"./Settings02-DxdBNXj6.js";import"./Shield01-Qjvq_pQT.js";import"./User01-CKOZDyFQ.js";import"./Zap-DHpdmH1S.js";import"./infiniteQueryObserver-B14O_xhx.js";import"./use-collections-B9qAfcJY.js";import"./card-DL6KKkK7.js";const ye="basic-usage",ot=[{id:ye,label:"Basic Usage",description:"Tools all org members can access by default",section:"Basic Usage",tools:["COLLECTION_CONNECTIONS_LIST","COLLECTION_CONNECTIONS_GET","CONNECTION_TEST","COLLECTION_VIRTUAL_MCP_LIST","COLLECTION_VIRTUAL_MCP_GET","VIRTUAL_MCP_PLUGIN_CONFIG_GET","AUTOMATION_GET","AUTOMATION_LIST","AI_PROVIDERS_LIST","AI_PROVIDERS_LIST_MODELS","AI_PROVIDERS_ACTIVE","LIST_OBJECTS","GET_OBJECT_METADATA","GET_PRESIGNED_URL","PUT_PRESIGNED_URL","VM_START","VM_DELETE"]},{id:"org:manage",label:"Manage organization",description:"Edit organization settings, brand context, and domain configuration",section:"Organization",tools:["ORGANIZATION_GET","ORGANIZATION_LIST","ORGANIZATION_UPDATE","ORGANIZATION_SETTINGS_GET","ORGANIZATION_SETTINGS_UPDATE","BRAND_CONTEXT_LIST","BRAND_CONTEXT_GET","BRAND_CONTEXT_CREATE","BRAND_CONTEXT_UPDATE","BRAND_CONTEXT_DELETE","BRAND_CONTEXT_EXTRACT","BRAND_GET","BRAND_LIST","ORGANIZATION_DOMAIN_GET","ORGANIZATION_DOMAIN_SET","ORGANIZATION_DOMAIN_UPDATE","ORGANIZATION_DOMAIN_CLEAR"]},{id:"members:manage",label:"Manage members",description:"Invite members, remove them, and change their roles",section:"Organization",tools:["ORGANIZATION_MEMBER_LIST","ORGANIZATION_MEMBER_ADD","ORGANIZATION_MEMBER_REMOVE","ORGANIZATION_MEMBER_UPDATE_ROLE"],dangerous:!0},{id:"connections:manage",label:"Manage connections",description:"Create, update, and delete connections",section:"Connections & Agents",tools:["COLLECTION_CONNECTIONS_CREATE","COLLECTION_CONNECTIONS_UPDATE","COLLECTION_CONNECTIONS_DELETE"],dangerous:!0},{id:"agents:manage",label:"Manage agents",description:"Create, configure, and delete agents",section:"Connections & Agents",tools:["COLLECTION_VIRTUAL_MCP_CREATE","COLLECTION_VIRTUAL_MCP_UPDATE","COLLECTION_VIRTUAL_MCP_DELETE","VIRTUAL_MCP_PLUGIN_CONFIG_UPDATE","VIRTUAL_MCP_PINNED_VIEWS_UPDATE"],dangerous:!0},{id:"automations:manage",label:"Manage automations",description:"Create, update, run, and delete automations",section:"Automations",tools:["AUTOMATION_CREATE","AUTOMATION_UPDATE","AUTOMATION_DELETE","AUTOMATION_TRIGGER_ADD","AUTOMATION_TRIGGER_REMOVE","AUTOMATION_RUN"],dangerous:!0},{id:"monitoring:view",label:"View monitoring",description:"Access logs and usage statistics",section:"Monitoring",tools:["MONITORING_LOG_GET","MONITORING_LOGS_LIST","MONITORING_STATS"]},{id:"ai-providers:manage",label:"Manage AI providers",description:"Add or remove API keys and provision provider credentials",section:"AI Providers",tools:["AI_PROVIDER_KEY_CREATE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_KEY_DELETE","AI_PROVIDER_OAUTH_URL","AI_PROVIDER_OAUTH_EXCHANGE","AI_PROVIDER_PROVISION_KEY","AI_PROVIDER_TOPUP_URL","AI_PROVIDER_CREDITS","AI_PROVIDER_CLI_ACTIVATE"]},{id:"tags:manage",label:"Manage tags",description:"Create, assign, and delete organization tags",section:"Organization",tools:["TAGS_LIST","TAGS_CREATE","TAGS_DELETE","MEMBER_TAGS_GET","MEMBER_TAGS_SET"]},{id:"registry:manage",label:"Manage registry",description:"Browse, publish, and manage items in the registry",section:"Store & Registry",tools:["COLLECTION_REGISTRY_APP_LIST","COLLECTION_REGISTRY_APP_GET","COLLECTION_REGISTRY_APP_VERSIONS","COLLECTION_REGISTRY_APP_FILTERS","REGISTRY_ITEM_LIST","REGISTRY_ITEM_SEARCH","REGISTRY_ITEM_GET","REGISTRY_ITEM_VERSIONS","REGISTRY_ITEM_FILTERS","REGISTRY_DISCOVER_TOOLS","REGISTRY_ITEM_CREATE","REGISTRY_ITEM_BULK_CREATE","REGISTRY_ITEM_UPDATE","REGISTRY_ITEM_DELETE","REGISTRY_AI_GENERATE","REGISTRY_PUBLISH_REQUEST_LIST","REGISTRY_PUBLISH_REQUEST_REVIEW","REGISTRY_PUBLISH_REQUEST_COUNT","REGISTRY_PUBLISH_REQUEST_DELETE","REGISTRY_PUBLISH_API_KEY_GENERATE","REGISTRY_PUBLISH_API_KEY_LIST","REGISTRY_PUBLISH_API_KEY_REVOKE"],dangerous:!0},{id:"registry:monitor",label:"Monitor registry health",description:"Run health checks on registry connections and view results",section:"Store & Registry",tools:["REGISTRY_MONITOR_RUN_START","REGISTRY_MONITOR_RUN_LIST","REGISTRY_MONITOR_RUN_GET","REGISTRY_MONITOR_RUN_CANCEL","REGISTRY_MONITOR_RESULT_LIST","REGISTRY_MONITOR_CONNECTION_LIST","REGISTRY_MONITOR_CONNECTION_SYNC","REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH","REGISTRY_MONITOR_SCHEDULE_SET","REGISTRY_MONITOR_SCHEDULE_CANCEL"]},{id:"api-keys:manage",label:"Manage API keys",description:"Create, update, and revoke API keys",section:"Developer",tools:["API_KEY_CREATE","API_KEY_LIST","API_KEY_UPDATE","API_KEY_DELETE"]},{id:"event-bus:use",label:"Use event bus",description:"Publish events and manage subscriptions",section:"Developer",tools:["EVENT_PUBLISH","EVENT_SUBSCRIBE","EVENT_UNSUBSCRIBE","EVENT_CANCEL","EVENT_ACK","EVENT_SUBSCRIPTION_LIST","EVENT_SYNC_SUBSCRIPTIONS"]},{id:"storage:delete",label:"Delete from storage",description:"Permanently delete files from object storage",section:"Developer",tools:["DELETE_OBJECT","DELETE_OBJECTS"],dangerous:!0},{id:"connections:sql",label:"Run SQL queries",description:"Execute raw SQL against connected databases",section:"Developer",tools:["DATABASES_RUN_SQL"],dangerous:!0}],Ut=new Set(ot.find(t=>t.id===ye)?.tools??[]);function Bt(){const t=new Map;for(const e of ot){if(e.id===ye)continue;const n=t.get(e.section)??[];n.push(e),t.set(e.section,n)}return Array.from(t.entries()).map(([e,n])=>({section:e,capabilities:n}))}function Vt(t,e,n){return n?!0:t.tools.every(l=>e.includes(l))}function zt(t,e,n){if(n){const o=new Set(e);for(const a of t.tools)o.add(a);return Array.from(o)}const l=new Set(e);for(const o of t.tools)l.delete(o);return Array.from(l)}const Yt=B.memo(function(e){const n=q.c(21),{connection:l,isSelected:o,hasToolsEnabled:a,activeToolsCount:d,totalToolsCount:p,onSelect:m,onToggle:g}=e,h=o?"bg-accent/50":"hover:bg-muted/50";let r;n[0]!==h?(r=Q("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",h),n[0]=h,n[1]=r):r=n[1];let x;n[2]!==l.icon||n[3]!==l.title?(x=s.jsx(ve,{icon:l.icon,name:l.title,size:"xs"}),n[2]=l.icon,n[3]=l.title,n[4]=x):x=n[4];let i;n[5]!==l.title?(i=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:l.title})}),n[5]=l.title,n[6]=i):i=n[6];let c;n[7]!==m||n[8]!==x||n[9]!==i?(c=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:m,children:[x,i]}),n[7]=m,n[8]=x,n[9]=i,n[10]=c):c=n[10];let E;n[11]!==d||n[12]!==l.tools||n[13]!==a||n[14]!==g||n[15]!==p?(E=l.tools&&l.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[d,"/",p]}),s.jsx(we,{checked:a,onCheckedChange:g,onClick:Qt})]}),n[11]=d,n[12]=l.tools,n[13]=a,n[14]=g,n[15]=p,n[16]=E):E=n[16];let b;return n[17]!==r||n[18]!==c||n[19]!==E?(b=s.jsxs("div",{className:r,children:[c,E]}),n[17]=r,n[18]=c,n[19]=E,n[20]=b):b=n[20],b}),$t=B.memo(function(e){const n=q.c(18),{connectionId:l,tool:o,isSelected:a,onToggle:d}=e,p=`tool-${l}-${o.name}`,m=a?"text-foreground":"text-muted-foreground";let g;n[0]!==m?(g=Q("text-sm font-medium",m),n[0]=m,n[1]=g):g=n[1];let h;n[2]!==g||n[3]!==o.name?(h=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:g,children:o.name})}),n[2]=g,n[3]=o.name,n[4]=h):h=n[4];let r;n[5]!==o.description?(r=o.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:o.description}),n[5]=o.description,n[6]=r):r=n[6];let x;n[7]!==h||n[8]!==r?(x=s.jsxs("div",{className:"flex-1 min-w-0",children:[h,r]}),n[7]=h,n[8]=r,n[9]=x):x=n[9];const i=`tool-${l}-${o.name}`;let c;n[10]!==a||n[11]!==d||n[12]!==i?(c=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(we,{id:i,checked:a,onCheckedChange:d,onClick:Kt})}),n[10]=a,n[11]=d,n[12]=i,n[13]=c):c=n[13];let E;return n[14]!==p||n[15]!==x||n[16]!==c?(E=s.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:p,children:[x,c]}),n[14]=p,n[15]=x,n[16]=c,n[17]=E):E=n[17],E});function Ft({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:n,searchQuery:l}){const[o,a]=B.useState(""),d=l!==void 0?l:o,p=B.useDeferredValue(d),[m,g]=B.useState("all"),[h,r]=B.useState(!1),x=B.useRef(new Set(Object.keys(t))),{org:i}=Ne(),c=wt({connectionId:yt,orgId:i.id}),E=100,b=p.trim(),I=b?{operator:"or",conditions:[{field:["title"],operator:"contains",value:b},{field:["description"],operator:"contains",value:b}]}:void 0,A=!!n,N={...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:E,offset:0,...A&&{include_virtual:!0}},R=JSON.stringify(N),{data:_,fetchNextPage:j,hasNextPage:f,isFetchingNextPage:S}=vt({queryKey:re.collectionListInfinite(c,i.id,"","CONNECTIONS",R),queryFn:async({pageParam:T=0})=>(await c.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:E,offset:T,...A&&{include_virtual:!0}}})).structuredContent,initialPageParam:0,getNextPageParam:(T,k)=>{if(T?.hasMore)return k.reduce((F,ee)=>F+(ee?.items?.length??0),0)},staleTime:3e4}),w=_?.pages.flatMap(T=>T?.items??[])??[],v=Rt(j,f??!1,S),u=n?w.filter(T=>T.connection_type!=="VIRTUAL"?!0:ft(T.connection_url)!==n):w,y=x.current,C=[...y.values()].map(T=>u.find(k=>k.id===T)).filter(T=>T!==void 0),D=u.filter(T=>!y.has(T.id)),G=[...C,...D],$=T=>{const k=t[T];return k!==void 0&&k.length>0},L=G.filter(T=>{if(m==="all")return!0;const k=$(T.id);return m==="selected"?k:m==="unselected"?!k:!0}),[V,z]=B.useState(G[0]?.id??null),O=V?G.find(T=>T.id===V)??null:null,M=O?.tools??[],Y=(T,k)=>t[T]?.includes(k)??!1,K=(T,k)=>{const F=t[T]??[],ee=F.includes(k),H={...t};if(ee){const Z=F.filter(X=>X!==k);Z.length===0?delete H[T]:H[T]=Z}else H[T]=[...F,k];e(H)},J=T=>{const k=G.find(X=>X.id===T);if(!k?.tools)return;const F=t[T]??[],ee=k.tools.map(X=>X.name),H=F.length>0&&ee.every(X=>F.includes(X)),Z={...t};H?delete Z[T]:(Z[T]=ee,z(T)),e(Z)},W=T=>{z(T),r(!0)},le=()=>{r(!1)};return s.jsxs("div",{className:"flex h-full",children:[s.jsxs("div",{className:Q("w-full md:w-80 border-r border-border flex flex-col",h&&"hidden md:flex"),children:[l===void 0&&s.jsx(Mt,{value:o,onChange:a,placeholder:"Search MCP Servers..."}),s.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[s.jsx("button",{onClick:()=>g("all"),className:Q("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",m==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>g("selected"),className:Q("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",m==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>g("unselected"),className:Q("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",m==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:L.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:d?"No connections found":m==="selected"?"No servers selected":m==="unselected"?"No unselected servers":"No connections available"}):s.jsxs("div",{className:"p-2 space-y-1",children:[L.map(T=>{const k=T.tools?.length??0,F=t[T.id]?.length??0;return s.jsx(Yt,{connection:T,isSelected:V===T.id,hasToolsEnabled:$(T.id),activeToolsCount:F,totalToolsCount:k,onSelect:()=>W(T.id),onToggle:()=>J(T.id)},T.id)}),s.jsx("div",{ref:v,className:"h-4"}),S&&s.jsx("div",{className:"flex justify-center py-3",children:s.jsx(xe,{size:18,className:"animate-spin text-muted-foreground"})})]})})]}),s.jsx("div",{className:Q("flex-1 flex-col",h?"flex":"hidden md:flex"),children:O?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:le,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(Ot,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(ve,{icon:O.icon,name:O.title,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:O.title}),O.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:O.description})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:M.length===0?s.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):s.jsx("div",{className:"space-y-2",children:M.map(T=>s.jsx($t,{connectionId:O.id,tool:T,isSelected:Y(O.id,T.name),onToggle:()=>K(O.id,T.name)},T.name))})})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}function Qt(t){return t.stopPropagation()}function Kt(t){return t.stopPropagation()}const Se=["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"],qt={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function it(t){if(!t)return"bg-neutral-400";let e=0;for(let l=0;l<t.length;l++){const o=t.charCodeAt(l);e=(e<<5)-e+o,e=e&e}const n=Math.abs(e)%Se.length;return Se[n]??Se[0]}function Ve(t,e){return e?qt[t]??"bg-neutral-400":it(t)}const Ht=Me({role:Me({id:se().optional(),slug:se().optional(),label:se()}),allowAllStaticPermissions:Le(),staticPermissions:_e(se()),toolSet:Pe(se(),_e(se())),allowAllModels:Le(),modelSet:Pe(se(),_e(se())),memberIds:_e(se())});function rt(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function ze(t,e,n){const l=s.jsx(he,{checked:t,disabled:e,onCheckedChange:n});return e?s.jsx(ge,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:l})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):l}function Zt(t){const e=q.c(28),{allowAllStaticPermissions:n,staticPermissions:l,onAllowAllChange:o,onPermissionsChange:a,readOnly:d,searchQuery:p}=t,m=d===void 0?!1:d;let g;e[0]!==p?(g=p.trim().toLowerCase(),e[0]=p,e[1]=g):g=e[1];const h=B.useDeferredValue(g);let r;if(e[2]!==n||e[3]!==h||e[4]!==o||e[5]!==a||e[6]!==m||e[7]!==p||e[8]!==l){const x=Bt(),i=(R,_)=>{if(!m){if(n&&_){const j=x.flatMap(Wt).flatMap(Jt);o(!1),a(j.filter(f=>!R.tools.includes(f)));return}n||a(zt(R,l,!_))}};let c;e[10]!==h?(c=R=>{const{section:_,capabilities:j}=R;return{section:_,capabilities:j.filter(f=>!h||f.label.toLowerCase().includes(h)||f.description.toLowerCase().includes(h))}},e[10]=h,e[11]=c):c=e[11];const E=x.map(c).filter(Xt);let b;e[12]!==n||e[13]!==o||e[14]!==a?(b=()=>{o(!n),a([])},e[12]=n,e[13]=o,e[14]=a,e[15]=b):b=e[15];let I;e[16]!==n||e[17]!==m||e[18]!==b?(I=ze(n,m,b),e[16]=n,e[17]=m,e[18]=b,e[19]=I):I=e[19];let A;e[20]!==n||e[21]!==o||e[22]!==a||e[23]!==m?(A=m?void 0:()=>{o(!n),a([])},e[20]=n,e[21]=o,e[22]=a,e[23]=m,e[24]=A):A=e[24];let N;e[25]!==I||e[26]!==A?(N=s.jsx(De,{title:"General",children:s.jsx(Ge,{children:s.jsx(Ue,{title:"All organization permissions",description:"Grant full access to all features below",action:I,onClick:A})})}),e[25]=I,e[26]=A,e[27]=N):N=e[27],r=s.jsx("div",{children:s.jsxs("div",{className:"flex flex-col gap-10 py-4",children:[N,E.length===0&&h?s.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:["No permissions match “",p,"”"]}):E.map(R=>{const{section:_,capabilities:j}=R;return s.jsx(De,{title:_,children:s.jsx(Ge,{children:j.map(f=>{const S=Vt(f,l,n);return s.jsx(Ue,{title:s.jsxs("span",{className:"flex items-center gap-1.5",children:[f.label,f.dangerous&&s.jsx(gt,{size:12,className:"text-amber-500 shrink-0"})]}),description:f.description,action:ze(S,m,()=>i(f,S)),onClick:m?void 0:()=>i(f,S)},f.id)})})},_)})]})}),e[2]=n,e[3]=h,e[4]=o,e[5]=a,e[6]=m,e[7]=p,e[8]=l,e[9]=r}else r=e[9];return r}function Xt(t){return t.capabilities.length>0}function Jt(t){return t.tools}function Wt(t){return t.capabilities}const at={anthropic:"Anthropic",openrouter:"OpenRouter"},es={openai:"OpenAI",anthropic:"Anthropic",google:"Google","meta-llama":"Meta",mistralai:"Mistral","x-ai":"xAI",deepseek:"DeepSeek",qwen:"Qwen",moonshotai:"MoonshotAI",nvidia:"NVIDIA",perplexity:"Perplexity",cohere:"Cohere",amazon:"Amazon",microsoft:"Microsoft","z-ai":"Z.ai","ibm-granite":"IBM Granite",alibaba:"Alibaba",baidu:"Baidu",bytedance:"ByteDance",tencent:"Tencent",minimax:"MiniMax",nousresearch:"Nous Research",allenai:"Allen AI",inception:"Inception"};function ts(t,e){const n=t.indexOf("/"),l=n>0?t.slice(0,n):e;return l.startsWith("~")?l.slice(1):l}function ss(t){return es[t]??at[t]??t}function ns(t){const e=t.indexOf(": ");return e>0&&e<32?t.slice(e+2):t}const ct=30;function ls(t){const e=q.c(44),{connectionId:n,subProviderId:l,subProviderName:o,groupLogo:a,models:d,allConnectionModelIds:p,selectedModels:m,allowAllModels:g,allConnectionModelsSelected:h,onToggleModel:r,onExitAllowAll:x,readOnly:i,defaultExpanded:c}=t,[E,b]=B.useState(c),I=c||E,A=b,[N,R]=B.useState(ct);let _;e[0]!==h||e[1]!==g||e[2]!==m?(_=v=>g||h||m.includes("*")||m.includes(v),e[0]=h,e[1]=g,e[2]=m,e[3]=_):_=e[3];const j=_;let f;if(e[4]!==j||e[5]!==d){let v;e[7]!==j?(v=u=>j(u.id),e[7]=j,e[8]=v):v=e[8],f=d.filter(v),e[4]=j,e[5]=d,e[6]=f}else f=e[6];const S=f.length;let w;if(e[9]!==p||e[10]!==g||e[11]!==n||e[12]!==S||e[13]!==I||e[14]!==a||e[15]!==j||e[16]!==d||e[17]!==x||e[18]!==r||e[19]!==i||e[20]!==l||e[21]!==o||e[22]!==N){const v=d.slice(0,N),u=d.length>N;let y;e[24]===Symbol.for("react.memo_cache_sentinel")?(y=()=>A(as),e[24]=y):y=e[24];const C=a??tt[l]??st;let D;e[25]!==o||e[26]!==C?(D=s.jsx(ve,{icon:C,name:o,size:"sm"}),e[25]=o,e[26]=C,e[27]=D):D=e[27];let G;e[28]!==o?(G=s.jsx("span",{className:"text-sm font-medium truncate",children:o}),e[28]=o,e[29]=G):G=e[29];let $;e[30]!==D||e[31]!==G?($=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[D,G]}),e[30]=D,e[31]=G,e[32]=$):$=e[32];let L;e[33]!==S||e[34]!==d.length?(L=s.jsxs(fe,{variant:"secondary",className:"text-xs text-muted-foreground",children:[S,"/",d.length," enabled"]}),e[33]=S,e[34]=d.length,e[35]=L):L=e[35];let V;e[36]!==I?(V=I?s.jsx(Dt,{size:16,className:"text-muted-foreground shrink-0"}):s.jsx(Gt,{size:16,className:"text-muted-foreground shrink-0"}),e[36]=I,e[37]=V):V=e[37];let z;e[38]!==V||e[39]!==L?(z=s.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[L,V]}),e[38]=V,e[39]=L,e[40]=z):z=e[40];let O;e[41]!==z||e[42]!==$?(O=s.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3 hover:bg-muted/50 cursor-pointer",onClick:y,children:[$,z]}),e[41]=z,e[42]=$,e[43]=O):O=e[43],w=s.jsxs("div",{className:"border border-border rounded-lg overflow-hidden bg-card",children:[O,I&&s.jsxs("div",{className:"border-t border-border bg-muted/20",children:[v.map(M=>{const Y=j(M.id),K=()=>{if(!i){if(g){x(n,p,M.id);return}r(n,M.id)}};return s.jsxs("div",{className:Q("flex items-center justify-between gap-3 px-4 py-3 border-b border-border last:border-b-0",!i&&"hover:bg-muted/50 cursor-pointer"),onClick:K,children:[s.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:s.jsx("span",{className:"text-sm truncate",children:M.title})}),s.jsx("div",{onClick:rs,children:i?s.jsx(ge,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsx(he,{checked:Y,disabled:!0,onCheckedChange:is})})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(he,{checked:Y,onCheckedChange:K})})]},M.id)}),u&&s.jsxs("button",{type:"button",className:"w-full px-4 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors",onClick:()=>R(os),children:["Show more (",d.length-N," remaining)"]})]})]}),e[9]=p,e[10]=g,e[11]=n,e[12]=S,e[13]=I,e[14]=a,e[15]=j,e[16]=d,e[17]=x,e[18]=r,e[19]=i,e[20]=l,e[21]=o,e[22]=N,e[23]=w}else w=e[23];return w}function os(t){return t+ct}function is(){}function rs(t){return t.stopPropagation()}function as(t){return!t}function cs(t){const e=q.c(33),{connection:n,selectedModels:l,allowAllModels:o,onToggleModel:a,onExitAllowAll:d,allConnectionModelsSelected:p,searchQuery:m,readOnly:g}=t,h=kt(n.id);let r,x,i,c,E;if(e[0]!==p||e[1]!==o||e[2]!==n.id||e[3]!==n.label||e[4]!==n.providerId||e[5]!==d||e[6]!==a||e[7]!==h||e[8]!==g||e[9]!==m||e[10]!==l){E=Symbol.for("react.early_return_sentinel");e:{let A;e[16]!==n.label?(A=C=>({...C,id:C.modelId,provider:n.label}),e[16]=n.label,e[17]=A):A=e[17];const N=h.filter(fs).map(A),R=m.trim().toLowerCase(),_=R?N.filter(C=>C.title.toLowerCase().includes(R)||C.id.toLowerCase().includes(R)||C.provider?.toLowerCase().includes(R)):N;if(_.length===0){E=null;break e}const j=new Map;for(const C of _){const D=ts(C.id,n.providerId),G=j.get(D)??{models:[],logo:null};G.models.push({id:C.id,title:ns(C.title),logo:C.logo}),!G.logo&&C.logo&&(G.logo=C.logo),j.set(D,G)}const f=Array.from(j.entries()).map(us).sort(ms),S=f.length===1||R.length>0;i="flex flex-col gap-3";const w=tt[n.providerId]??st;let v;e[18]!==n.providerId||e[19]!==w?(v=s.jsx("img",{src:w,alt:n.providerId,className:"w-4 h-4 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),e[18]=n.providerId,e[19]=w,e[20]=v):v=e[20];const u=at[n.providerId]??n.providerId;let y;e[21]!==u?(y=s.jsx("h4",{className:"text-sm font-medium",children:u}),e[21]=u,e[22]=y):y=e[22],e[23]!==y||e[24]!==v?(c=s.jsxs("div",{className:"flex items-center gap-2",children:[v,y]}),e[23]=y,e[24]=v,e[25]=c):c=e[25],r="flex flex-col gap-3",x=f.map(C=>s.jsx(ls,{connectionId:n.id,subProviderId:C.id,subProviderName:C.name,groupLogo:C.logo,models:C.models,allConnectionModelIds:N.map(ds),selectedModels:l,allowAllModels:o,allConnectionModelsSelected:p,onToggleModel:a,onExitAllowAll:d,readOnly:g,defaultExpanded:S},C.id))}e[0]=p,e[1]=o,e[2]=n.id,e[3]=n.label,e[4]=n.providerId,e[5]=d,e[6]=a,e[7]=h,e[8]=g,e[9]=m,e[10]=l,e[11]=r,e[12]=x,e[13]=i,e[14]=c,e[15]=E}else r=e[11],x=e[12],i=e[13],c=e[14],E=e[15];if(E!==Symbol.for("react.early_return_sentinel"))return E;let b;e[26]!==r||e[27]!==x?(b=s.jsx("div",{className:r,children:x}),e[26]=r,e[27]=x,e[28]=b):b=e[28];let I;return e[29]!==i||e[30]!==c||e[31]!==b?(I=s.jsxs("div",{className:i,children:[c,b]}),e[29]=i,e[30]=c,e[31]=b,e[32]=I):I=e[32],I}function ds(t){return t.id}function ms(t,e){return t.name.localeCompare(e.name)}function us(t){const[e,n]=t;return{id:e,name:ss(e),logo:n.logo,models:n.models}}function fs(t,e,n){return n.findIndex(l=>l.modelId===t.modelId)===e}function hs(t){const e=q.c(35),{allowAllModels:n,modelSet:l,onAllowAllChange:o,onModelSetChange:a,readOnly:d,searchQuery:p}=t,m=d===void 0?!1:d,g=B.useDeferredValue(p),h=Lt();let r;e[0]!==l||e[1]!==a?(r=(f,S)=>{const w=l[f]??[],v={...l};if(w.includes(S)){const u=w.filter(y=>y!==S);u.length===0?delete v[f]:v[f]=u}else v[f]=[...w,S];a(v)},e[0]=l,e[1]=a,e[2]=r):r=e[2];const x=r;let i;e[3]!==l||e[4]!==o||e[5]!==a?(i=(f,S,w)=>{o(!1),a({...l,[f]:S.filter(v=>v!==w)})},e[3]=l,e[4]=o,e[5]=a,e[6]=i):i=e[6];const c=i,E=!m&&"hover:bg-muted/50 cursor-pointer";let b;e[7]!==E?(b=Q("flex items-center justify-between px-4 py-3 rounded-lg border border-border bg-card",E),e[7]=E,e[8]=b):b=e[8];let I;e[9]!==n||e[10]!==o||e[11]!==a||e[12]!==m?(I=()=>{if(m)return;const f=!n;o(f),f&&a({})},e[9]=n,e[10]=o,e[11]=a,e[12]=m,e[13]=I):I=e[13];let A;e[14]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[14]=A):A=e[14];let N;e[15]!==n||e[16]!==o||e[17]!==a||e[18]!==m?(N=s.jsx("div",{onClick:gs,children:m?s.jsx(ge,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsx(he,{checked:n,disabled:!0,onCheckedChange:xs})})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(he,{checked:n,onCheckedChange:f=>{o(f),f&&a({})}})}),e[15]=n,e[16]=o,e[17]=a,e[18]=m,e[19]=N):N=e[19];let R;e[20]!==b||e[21]!==I||e[22]!==N?(R=s.jsxs("div",{className:b,onClick:I,children:[A,N]}),e[20]=b,e[21]=I,e[22]=N,e[23]=R):R=e[23];let _;e[24]!==h||e[25]!==n||e[26]!==g||e[27]!==c||e[28]!==l||e[29]!==m||e[30]!==x?(_=h.length===0?s.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No LLM connections configured"}):h.map(f=>s.jsx(B.Suspense,{fallback:s.jsxs("div",{className:"px-4 py-3 flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(xe,{className:"size-4 animate-spin"}),"Loading models..."]}),children:s.jsx(cs,{connection:f,selectedModels:l[f.id]??[],allowAllModels:n,onToggleModel:x,onExitAllowAll:c,allConnectionModelsSelected:(l[f.id]??[]).includes("*"),searchQuery:g,readOnly:m})},f.id)),e[24]=h,e[25]=n,e[26]=g,e[27]=c,e[28]=l,e[29]=m,e[30]=x,e[31]=_):_=e[31];let j;return e[32]!==_||e[33]!==R?(j=s.jsxs("div",{className:"flex flex-col h-full overflow-auto gap-6 pb-6",children:[R,_]}),e[32]=_,e[33]=R,e[34]=j):j=e[34],j}function xs(){}function gs(t){return t.stopPropagation()}function ps(t){const e=q.c(52),{open:n,onOpenChange:l,selectedMemberIds:o,onAddMembers:a}=t,[d,p]=B.useState(""),m=B.useDeferredValue(d);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[0]=g):g=e[0];const[h,r]=B.useState(g),{data:x}=nt();let i,c,E,b,I,A,N,R,_,j,f;if(e[1]!==x?.data?.members||e[2]!==m||e[3]!==a||e[4]!==l||e[5]!==n||e[6]!==h||e[7]!==d||e[8]!==o){const $=x?.data?.members??[];let L;e[20]!==m?(L=O=>{const M=m.toLowerCase();return O.user?.name?.toLowerCase().includes(M)||O.user?.email?.toLowerCase().includes(M)},e[20]=m,e[21]=L):L=e[21];const V=$.filter(L);let z;e[22]!==a||e[23]!==l||e[24]!==h?(z=()=>{a(h),r([]),l(!1)},e[22]=a,e[23]=l,e[24]=h,e[25]=z):z=e[25],E=z,c=Qe,j=n,f=l,i=Ke,R="sm:max-w-md p-0 overflow-hidden",e[26]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsxs(qe,{className:"px-6 pt-6",children:[s.jsx(He,{children:"Add Members to Role"}),s.jsx(Ze,{children:"Select members to add to this role."})]}),e[26]=_):_=e[26],A="flex flex-col h-80",e[27]!==d?(N=s.jsx("div",{className:"border-b border-border px-4 py-3",children:s.jsx(Oe,{value:d,onChange:p,placeholder:"Search members...",className:"w-full"})}),e[27]=d,e[28]=N):N=e[28],b="flex-1 overflow-auto",I=V.length===0?s.jsx("div",{className:"flex items-center justify-center h-full px-6",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:d?"No members found":"No members available"})}):s.jsx("div",{className:"px-6 py-2 space-y-1",children:V.map(O=>{const M=O.role!=="owner",Y=o.includes(O.id),K=h.includes(O.id);return s.jsxs("label",{className:Q("flex items-center gap-3 p-2 rounded-lg",!M||Y?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(we,{checked:K||Y,onCheckedChange:()=>{!M||Y||r(J=>J.includes(O.id)?J.filter(W=>W!==O.id):[...J,O.id])},disabled:!M||Y}),s.jsx(lt,{url:O.user?.image??void 0,fallback:rt(O.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:O.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:O.user?.email})]}),!M&&s.jsx(fe,{variant:"secondary",className:"shrink-0",children:"Owner"}),Y&&M&&s.jsx(fe,{variant:"outline",className:"shrink-0",children:"Added"})]},O.id)})}),e[1]=x?.data?.members,e[2]=m,e[3]=a,e[4]=l,e[5]=n,e[6]=h,e[7]=d,e[8]=o,e[9]=i,e[10]=c,e[11]=E,e[12]=b,e[13]=I,e[14]=A,e[15]=N,e[16]=R,e[17]=_,e[18]=j,e[19]=f}else i=e[9],c=e[10],E=e[11],b=e[12],I=e[13],A=e[14],N=e[15],R=e[16],_=e[17],j=e[18],f=e[19];let S;e[29]!==b||e[30]!==I?(S=s.jsx("div",{className:b,children:I}),e[29]=b,e[30]=I,e[31]=S):S=e[31];let w;e[32]!==S||e[33]!==A||e[34]!==N?(w=s.jsxs("div",{className:A,children:[N,S]}),e[32]=S,e[33]=A,e[34]=N,e[35]=w):w=e[35];let v;e[36]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(Xe,{children:"Cancel"}),e[36]=v):v=e[36];const u=h.length===0,y=h.length>0&&`(${h.length})`;let C;e[37]!==E||e[38]!==u||e[39]!==y?(C=s.jsxs(Je,{className:"px-6 pb-6",children:[v,s.jsxs(We,{onClick:E,disabled:u,children:["Add ",y]})]}),e[37]=E,e[38]=u,e[39]=y,e[40]=C):C=e[40];let D;e[41]!==i||e[42]!==w||e[43]!==C||e[44]!==R||e[45]!==_?(D=s.jsxs(i,{className:R,children:[_,w,C]}),e[41]=i,e[42]=w,e[43]=C,e[44]=R,e[45]=_,e[46]=D):D=e[46];let G;return e[47]!==c||e[48]!==D||e[49]!==j||e[50]!==f?(G=s.jsx(c,{open:j,onOpenChange:f,children:D}),e[47]=c,e[48]=D,e[49]=j,e[50]=f,e[51]=G):G=e[51],G}function bs(t){const e=q.c(28),{memberIds:n,onMemberIdsChange:l,readOnly:o,searchQuery:a,addMemberDialogOpen:d,onAddMemberDialogOpenChange:p}=t,m=o===void 0?!1:o,g=B.useDeferredValue(a),{data:h}=nt();let r,x,i;if(e[0]!==h?.data?.members||e[1]!==g||e[2]!==n||e[3]!==l||e[4]!==m||e[5]!==a){const A=h?.data?.members??[];let N;e[9]!==n?(N=f=>n.includes(f.id),e[9]=n,e[10]=N):N=e[10];const R=A.filter(N);let _;e[11]!==g?(_=f=>{const S=g.toLowerCase();return f.user?.name?.toLowerCase().includes(S)||f.user?.email?.toLowerCase().includes(S)},e[11]=g,e[12]=_):_=e[12];const j=R.filter(_);i="flex flex-col h-full",r="flex-1 overflow-auto",x=R.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h3",{className:"text-base font-medium mb-1",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to grant them the configured permissions."})]})}):j.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',a,'"']})}):s.jsx("div",{className:"p-4 space-y-2",children:j.map(f=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(lt,{url:f.user?.image??void 0,fallback:rt(f.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:f.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:f.user?.email})]}),m?s.jsx(ge,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsx(ne,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(Be,{size:16})})})}),s.jsx(Te,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})}):s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>l(n.filter(S=>S!==f.id)),children:s.jsx(Be,{size:16})})]},f.id))}),e[0]=h?.data?.members,e[1]=g,e[2]=n,e[3]=l,e[4]=m,e[5]=a,e[6]=r,e[7]=x,e[8]=i}else r=e[6],x=e[7],i=e[8];let c;e[13]!==r||e[14]!==x?(c=s.jsx("div",{className:r,children:x}),e[13]=r,e[14]=x,e[15]=c):c=e[15];let E;e[16]!==n||e[17]!==l?(E=A=>l([...n,...A]),e[16]=n,e[17]=l,e[18]=E):E=e[18];let b;e[19]!==d||e[20]!==n||e[21]!==p||e[22]!==E?(b=s.jsx(ps,{open:d,onOpenChange:p,selectedMemberIds:n,onAddMembers:E}),e[19]=d,e[20]=n,e[21]=p,e[22]=E,e[23]=b):b=e[23];let I;return e[24]!==i||e[25]!==c||e[26]!==b?(I=s.jsxs("div",{className:i,children:[c,b]}),e[24]=i,e[25]=c,e[26]=b,e[27]=I):I=e[27],I}function Ts(t){const e=q.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(xe,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let l;return e[1]!==t?(l=s.jsx(B.Suspense,{fallback:n,children:s.jsx(bs,{...t})}),e[1]=t,e[2]=l):l=e[2],l}const Es={owner:[],admin:[],user:[]};function Is(t,e,n,l){if(n?.permission!=null&&l)return dt({id:n.id,role:t,label:t.charAt(0).toUpperCase()+t.slice(1),permission:n.permission},e,l);const o=t==="owner"||t==="admin";return{role:{id:n?.id,slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:o,staticPermissions:Es[t],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:e.filter(a=>a.role===t).map(a=>a.id)}}function dt(t,e,n){const l=t.permission||{},o=l.self||[],a=o.includes("*"),d=a?[]:o.filter(r=>r!=="*"),p={};for(const[r,x]of Object.entries(l))if(!(r==="self"||r==="models"))if(r==="*")for(const i of n)p[i.id]=x.includes("*")?i.tools?.map(c=>c.name)??[]:x;else{const i=n.find(c=>c.id===r);i&&(p[r]=x.includes("*")?i.tools?.map(c=>c.name)??[]:x)}const m=l.models||[],g=m.length===0||m.includes("*:*"),h={};if(!g)for(const r of m){const x=r.indexOf(":");if(x===-1)continue;const i=r.slice(0,x),c=r.slice(x+1);h[i]||(h[i]=[]),h[i].push(c)}return{role:{id:t.id,slug:t.role,label:t.label},allowAllStaticPermissions:a,staticPermissions:d,toolSet:p,allowAllModels:g,modelSet:h,memberIds:e.filter(r=>r.role===t.role).map(r=>r.id)}}function _s(t,e){const n={};if(t.allowAllStaticPermissions)n.self=["*"];else{const l=new Set(t.staticPermissions);for(const o of Ut)l.add(o);l.size>0&&(n.self=Array.from(l))}for(const[l,o]of Object.entries(t.toolSet))if(o.length>0){const d=e.find(p=>p.id===l)?.tools?.map(p=>p.name)??[];n[l]=d.length>0&&d.every(p=>o.includes(p))?["*"]:o}if(t.allowAllModels)n.models=["*:*"];else{const l=[];for(const[o,a]of Object.entries(t.modelSet))for(const d of a)l.push(`${o}:${d}`);l.length>0&&(n.models=l)}return n}function Ns(t,e,n){return t.kind==="builtin"?Is(t.role,e,t.storedId!=null?{id:t.storedId,permission:t.storedPermission}:void 0,n):t.kind==="custom"?dt(t.role,e,n):{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:[]}}function Ss(t){const e=q.c(5),{readOnly:n,onOpen:l}=t;if(n){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsxs(ne,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(je,{size:16}),"Add Member"]})})}),e[0]=d):d=e[0];let p;return e[1]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(ge,{children:s.jsxs(pe,{children:[d,s.jsx(Te,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})}),e[1]=p):p=e[1],p}let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(je,{size:16}),e[2]=o):o=e[2];let a;return e[3]!==l?(a=s.jsxs(ne,{variant:"outline",size:"sm",onClick:l,children:[o,"Add Member"]}),e[3]=l,e[4]=a):a=e[4],a}function Cs(t){const e=q.c(14),{locator:n}=Ne(),l=Re(),o=Pt();let a;e[0]!==n?(a=re.members(n),e[0]=n,e[1]=a):a=e[1];let d;e[2]!==l?(d=()=>l.organization.listMembers(),e[2]=l,e[3]=d):d=e[3];let p;e[4]!==a||e[5]!==d?(p={queryKey:a,queryFn:d},e[4]=a,e[5]=d,e[6]=p):p=e[6];const{data:m,isPending:g}=Ye(p);if(g||!o){let i;return e[7]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(xe,{size:32,className:"animate-spin text-muted-foreground"})})}),e[7]=i):i=e[7],i}let h;e[8]!==m?.data?.members?(h=m?.data?.members??[],e[8]=m?.data?.members,e[9]=h):h=e[9];const r=h;let x;return e[10]!==o||e[11]!==r||e[12]!==t?(x=s.jsx(js,{...t,members:r,connections:o}),e[10]=o,e[11]=r,e[12]=t,e[13]=x):x=e[13],x}function js({target:t,onBack:e,onSaved:n,members:l,connections:o}){const{locator:a}=Ne(),d=Re(),p=$e(),m=t.kind==="builtin",g=t.kind==="builtin"&&t.role==="owner",h=t.kind==="new",[r,x]=B.useState(m?"org":"mcp"),i=ht({resolver:xt(Ht),defaultValues:Ns(t,l,o)}),c=i.formState.isValid,E=i.formState.isDirty,b=Fe({mutationFn:async u=>{const y=_s(u,o),C=u.role.slug||u.role.label.toLowerCase().replace(/\s+/g,"-"),D=u.role.slug==="owner"&&!u.role.id,G=(u.role.slug==="admin"||u.role.slug==="user")&&!u.role.id,$=async L=>{const V=l.filter(M=>M.role===L).map(M=>M.id),z=u.memberIds.filter(M=>!V.includes(M)),O=V.filter(M=>!u.memberIds.includes(M));for(const M of z){const Y=await d.organization.updateMemberRole({memberId:M,role:[L]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}for(const M of O){const Y=await d.organization.updateMemberRole({memberId:M,role:["user"]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}};if(D)return await $("owner"),u;if(u.role.id){const L=await d.organization.updateRole({roleId:u.role.id,data:{permission:y}});if(L?.error)throw new Error(L.error.message??"Something went wrong");return await $(u.role.slug),u}else if(G){const L=await d.organization.createRole({role:u.role.slug,permission:y});if(L?.error)throw new Error(L.error.message??"Something went wrong");return await $(u.role.slug),{...u,role:{...u.role,id:L.data?.roleData?.id}}}else{const L=await d.organization.createRole({role:C,permission:y});if(L?.error)throw new Error(L.error.message??"Something went wrong");for(const V of u.memberIds){const z=await d.organization.updateMemberRole({memberId:V,role:[C]});if(z?.error)throw new Error(z.error.message)}return{...u,role:{...u.role,id:L.data?.roleData?.id,slug:C}}}},onSuccess:(u,y)=>{p.invalidateQueries({queryKey:re.members(a)}),p.invalidateQueries({queryKey:re.organizationRoles(a)});const C=!y.role.id&&!y.role.slug,D=y.role.slug==="owner"&&!y.role.id;Ae(D?"role_members_updated":C?"role_created":"role_updated",{role_slug:y.role.slug??null}),ue.success(D?"Members updated successfully!":C?"Role created successfully!":"Role updated successfully!"),i.reset(u),n(u.role.id)},onError:u=>{ue.error(u instanceof Error?u.message:"Failed to save role")}}),I=i.handleSubmit(u=>{if(!u.role.label.trim()){ue.error("Role name is required"),i.setFocus("role.label");return}b.mutate(u)}),A=!g,N=t.kind==="builtin"?t.role.charAt(0).toUpperCase()+t.role.slice(1):t.kind==="custom"?t.role.label:"",R=[...g?[]:[{id:"mcp",label:"MCP Permissions"}],{id:"org",label:"Organization Permissions"},{id:"models",label:"Models"},{id:"members",label:"Members"}],[_,j]=B.useState(""),[f,S]=B.useState(!1),w=u=>{x(u),j("")},v={mcp:"Search MCP servers...",org:"Search permissions...",models:"Search models...",members:"Search members..."};return s.jsx(te,{children:s.jsxs(te.Content,{className:Q("flex flex-col",r!=="org"&&"overflow-hidden"),children:[s.jsx("div",{className:"shrink-0 mx-auto w-full max-w-[1200px] px-4 md:px-10 pt-8 md:pt-12 pb-4",children:s.jsxs("div",{className:"flex flex-col gap-5",children:[s.jsx(te.Title,{actions:A&&s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"outline",size:"sm",onClick:e,disabled:b.isPending,children:"Cancel"}),s.jsx(ne,{size:"sm",onClick:I,disabled:b.isPending||!c||!E,children:b.isPending?"Saving...":h?"Create Role":"Save Changes"})]}),children:s.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[s.jsx("div",{className:Q("size-2.5 rounded-full shrink-0",t.kind==="builtin"?Ve(t.role,!0):t.kind==="custom"?Ve(t.role.role,!1):it(i.watch("role.label")))}),g&&s.jsx(et,{size:16,className:"text-muted-foreground shrink-0"}),h?s.jsx("input",{...i.register("role.label"),placeholder:"Role name",className:"leading-tight text-foreground bg-transparent border-none outline-none px-1 -mx-1 rounded hover:bg-input/25 focus:bg-input/25 transition-colors w-64 placeholder:text-muted-foreground/50",autoFocus:!0}):s.jsx("span",{className:"truncate",children:N})]})}),s.jsx("div",{className:"flex items-center gap-2",children:R.map(u=>s.jsx("button",{type:"button",onClick:()=>w(u.id),className:Q("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex items-center",r===u.id?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:u.label},u.id))}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(Oe,{value:_,onChange:j,placeholder:v[r]??"Search...",className:"w-full md:w-[375px]"}),r==="members"&&s.jsx(Ss,{readOnly:t.kind==="builtin"&&t.role==="owner",onOpen:()=>S(!0)})]})]})}),s.jsx("div",{className:Q("mx-auto w-full max-w-[1200px] px-4 md:px-10 pb-6",r!=="org"&&"flex-1 min-h-0"),children:s.jsxs("div",{className:Q(r!=="org"&&"h-full overflow-hidden",r!=="models"&&r!=="org"&&"border border-border rounded-xl bg-card"),children:[r==="mcp"&&!g&&s.jsx(Ft,{toolSet:i.watch("toolSet"),onToolSetChange:u=>i.setValue("toolSet",u,{shouldDirty:!0}),searchQuery:_}),r==="org"&&s.jsx(Zt,{allowAllStaticPermissions:i.watch("allowAllStaticPermissions"),staticPermissions:i.watch("staticPermissions"),onAllowAllChange:u=>i.setValue("allowAllStaticPermissions",u,{shouldDirty:!0}),onPermissionsChange:u=>i.setValue("staticPermissions",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),r==="models"&&s.jsx(hs,{allowAllModels:i.watch("allowAllModels"),modelSet:i.watch("modelSet"),onAllowAllChange:u=>i.setValue("allowAllModels",u,{shouldDirty:!0}),onModelSetChange:u=>i.setValue("modelSet",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),r==="members"&&s.jsx(Ts,{memberIds:i.watch("memberIds"),onMemberIdsChange:u=>i.setValue("memberIds",u,{shouldDirty:!0}),readOnly:t.kind==="builtin"&&t.role==="owner",searchQuery:_,addMemberDialogOpen:f,onAddMemberDialogOpenChange:S})]})})]})})}function As(t){return t.kind==="builtin"?`builtin-${t.role}`:t.kind==="custom"?`custom-${t.role.id}`:"new"}const Rs=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],Ce=["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 Os(t){if(!t)return"bg-neutral-400";let e=0;for(let l=0;l<t.length;l++){const o=t.charCodeAt(l);e=(e<<5)-e+o,e=e&e}const n=Math.abs(e)%Ce.length;return Ce[n]??Ce[0]}const vs={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function ws(t,e){return e?vs[t]??"bg-neutral-400":Os(t)}function ys(){const t=q.c(77),[e,n]=B.useState(""),[l,o]=B.useState(null),a=bt();let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d={strict:!1},t[0]=d):d=t[0];const{role:p}=Tt(d),{locator:m}=Ne(),g=Re(),h=$e(),{customRoles:r,refetch:x}=Et();let i;t[1]!==a?(i=P=>a({to:".",search:U=>({...U,role:P})}),t[1]=a,t[2]=i):i=t[2];const c=i;let E;e:{if(!p){E=null;break e}if(p==="new"){E={kind:"new"};break e}if(p.startsWith("builtin-")){E={kind:"builtin",role:p.slice(8)};break e}let P;t[3]!==p?(P=oe=>oe.id===p,t[3]=p,t[4]=P):P=t[4];const U=r.find(P);E=U?{kind:"custom",role:U}:null}const b=E;let I;t[5]!==m?(I=re.members(m),t[5]=m,t[6]=I):I=t[6];let A;t[7]!==g?(A=()=>g.organization.listMembers(),t[7]=g,t[8]=A):A=t[8];let N;t[9]!==I||t[10]!==A?(N={queryKey:I,queryFn:A},t[9]=I,t[10]=A,t[11]=N):N=t[11];const{data:R}=Ye(N);let _;t[12]!==R?.data?.members?(_=R?.data?.members??[],t[12]=R?.data?.members,t[13]=_):_=t[13];const j=_;let f;t[14]!==j?(f=P=>j.filter(U=>U.role===P).length,t[14]=j,t[15]=f):f=t[15];const S=f;let w;if(t[16]!==r||t[17]!==S||t[18]!==e){let P;t[20]!==S?(P=ie=>({kind:"builtin",role:{...ie,memberCount:S(ie.role)}}),t[20]=S,t[21]=P):P=t[21];const U=Rs.map(P);let oe;t[22]!==S?(oe=ie=>({kind:"custom",role:{...ie,memberCount:S(ie.role)}}),t[22]=S,t[23]=oe):oe=t[23];const mt=r.map(oe);if(w=[...U,...mt],e){const ie=e.toLowerCase();w=w.filter(ut=>ut.role.label.toLowerCase().includes(ie))}t[16]=r,t[17]=S,t[18]=e,t[19]=w}else w=t[19];let v;t[24]!==g?(v=async P=>{const U=await g.organization.deleteRole({roleId:P});if(U?.error)throw new Error(U.error.message);return U?.data},t[24]=g,t[25]=v):v=t[25];const u=Fe({mutationFn:v,onSuccess:(P,U)=>{Ae("role_deleted",{role_id:U}),h.invalidateQueries({queryKey:re.members(m)}),h.invalidateQueries({queryKey:re.organizationRoles(m)}),ue.success("Role deleted successfully!"),x(),b?.kind==="custom"&&b.role.id===U&&c(void 0)},onError:Us});let y,C,D,G;t[26]===Symbol.for("react.memo_cache_sentinel")?(G={id:"role",header:"Role",render:Gs,cellClassName:"flex-1 min-w-0",sortable:!0},y={id:"type",header:"Type",render:Ds,cellClassName:"w-28 shrink-0"},C={id:"permissions",header:"Permissions",render:ks,cellClassName:"flex-1 min-w-0"},D={id:"members",header:"Members",render:Ls,cellClassName:"w-24 shrink-0"},t[26]=y,t[27]=C,t[28]=D,t[29]=G):(y=t[26],C=t[27],D=t[28],G=t[29]);let $;t[30]===Symbol.for("react.memo_cache_sentinel")?($=[G,y,C,D,{id:"actions",header:"",render:P=>P.kind==="builtin"?null:s.jsxs(It,{children:[s.jsx(_t,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Ps,children:s.jsx(Ct,{size:16})})}),s.jsx(Nt,{align:"end",onClick:Ms,children:s.jsxs(St,{variant:"destructive",onClick:()=>{const U=P.role;U.id&&o({id:U.id,label:U.label})},children:[s.jsx(jt,{size:16}),"Delete"]})})]}),cellClassName:"w-12 shrink-0"}],t[30]=$):$=t[30];const L=$;let V;t[31]!==c?(V=P=>{if(P.kind==="builtin")c(`builtin-${P.role.role}`);else{const U=P.role;c(U.id)}},t[31]=c,t[32]=V):V=t[32];const z=V;if(b){let P;t[33]!==c?(P=()=>c(void 0),t[33]=c,t[34]=P):P=t[34];let U;return t[35]!==x||t[36]!==c?(U=()=>{x(),c(void 0)},t[35]=x,t[36]=c,t[37]=U):U=t[37],s.jsx(Cs,{target:b,onBack:P,onSaved:U},As(b))}let O;t[38]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(te.Title,{children:"Roles"}),t[38]=O):O=t[38];let M;t[39]===Symbol.for("react.memo_cache_sentinel")?(M=P=>{P.key==="Escape"&&(n(""),P.target.blur())},t[39]=M):M=t[39];let Y;t[40]!==e?(Y=s.jsx(Oe,{value:e,onChange:n,placeholder:"Search roles...",className:"w-full md:w-[375px]",onKeyDown:M}),t[40]=e,t[41]=Y):Y=t[41];let K;t[42]!==c?(K=()=>c("new"),t[42]=c,t[43]=K):K=t[43];let J;t[44]===Symbol.for("react.memo_cache_sentinel")?(J=s.jsx(je,{size:16}),t[44]=J):J=t[44];let W;t[45]!==K?(W=s.jsxs(ne,{onClick:K,children:[J,"Create Role"]}),t[45]=K,t[46]=W):W=t[46];let le;t[47]!==Y||t[48]!==W?(le=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[Y,W]}),t[47]=Y,t[48]=W,t[49]=le):le=t[49];let T;t[50]!==e?(T=e?s.jsx(ke,{title:"No roles found",description:`No roles match "${e}"`}):s.jsx(ke,{title:"No roles",description:"Create a role to get started."}),t[50]=e,t[51]=T):T=t[51];let k;t[52]!==w||t[53]!==L||t[54]!==z||t[55]!==T?(k=s.jsx(At,{columns:L,data:w,isLoading:!1,onRowClick:z,emptyState:T}),t[52]=w,t[53]=L,t[54]=z,t[55]=T,t[56]=k):k=t[56];let F;t[57]!==le||t[58]!==k?(F=s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs("div",{className:"flex flex-col gap-6",children:[O,le,k]})})}),t[57]=le,t[58]=k,t[59]=F):F=t[59];const ee=l!==null;let H;t[60]===Symbol.for("react.memo_cache_sentinel")?(H=P=>!P&&o(null),t[60]=H):H=t[60];let Z;t[61]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsx(He,{children:"Delete Role"}),t[61]=Z):Z=t[61];const X=l?.label;let ae;t[62]!==X?(ae=s.jsxs(qe,{children:[Z,s.jsxs(Ze,{children:['Are you sure you want to delete the "',X,'" role? This action cannot be undone.']})]}),t[62]=X,t[63]=ae):ae=t[63];let Ee;t[64]===Symbol.for("react.memo_cache_sentinel")?(Ee=s.jsx(Xe,{children:"Cancel"}),t[64]=Ee):Ee=t[64];let ce;t[65]!==u||t[66]!==l?(ce=s.jsxs(Je,{children:[Ee,s.jsx(We,{onClick:()=>{l?.id&&u.mutate(l.id),o(null)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[65]=u,t[66]=l,t[67]=ce):ce=t[67];let de;t[68]!==ae||t[69]!==ce?(de=s.jsxs(Ke,{children:[ae,ce]}),t[68]=ae,t[69]=ce,t[70]=de):de=t[70];let me;t[71]!==ee||t[72]!==de?(me=s.jsx(Qe,{open:ee,onOpenChange:H,children:de}),t[71]=ee,t[72]=de,t[73]=me):me=t[73];let Ie;return t[74]!==F||t[75]!==me?(Ie=s.jsxs(te,{children:[F,me]}),t[74]=F,t[75]=me,t[76]=Ie):Ie=t[76],Ie}function Ms(t){return t.stopPropagation()}function Ps(t){return t.stopPropagation()}function Ls(t){return s.jsx("span",{className:"text-sm text-foreground",children:t.role.memberCount})}function ks(t){if(t.kind==="builtin")return t.role.role==="owner"||t.role.role==="admin"?s.jsx("span",{className:"text-sm text-muted-foreground",children:"Full access"}):s.jsx("span",{className:"text-sm text-muted-foreground",children:"Basic access"});const e=t.role,n=[];return e.allowsAllStaticPermissions?n.push("Full org access"):e.staticPermissionCount&&e.staticPermissionCount>0&&n.push(`${e.staticPermissionCount} org perm${e.staticPermissionCount!==1?"s":""}`),e.allowsAllConnections?n.push("All connections"):e.connectionCount&&e.connectionCount>0&&n.push(`${e.connectionCount} connection${e.connectionCount!==1?"s":""}`),s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:n.length>0?n.join(", "):"No permissions"})}function Ds(t){return t.kind==="builtin"?s.jsx(fe,{variant:"secondary",className:"text-xs",children:"Built-in"}):s.jsx(fe,{variant:"outline",className:"text-xs",children:"Custom"})}function Gs(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:Q("size-2.5 rounded-full shrink-0",ws(t.role.role,t.kind==="builtin"))}),s.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:t.role.label}),t.kind==="builtin"&&s.jsx(et,{size:12,className:"text-muted-foreground shrink-0"})]})}function Us(t,e){Ae("role_delete_failed",{role_id:e,error:t instanceof Error?t.message:String(t)}),ue.error(t instanceof Error?t.message:"Failed to delete role")}function Fn(){const t=q.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load roles"})})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(pt,{fallback:e,children:s.jsx(B.Suspense,{fallback:s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(xe,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(ys,{})})}),t[1]=n):n=t[1],n}export{Fn as default};
|