@decocms/mesh 2.20.1 → 2.20.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/dist/client/assets/{AlertCircle-DeGhTF84.js → AlertCircle-CI2U-jkN.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-m6KeIjPT.js → ArrowLeft-B3km7toT.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-BDjaIiFu.js → ArrowUp-BF7mM4C2.js} +1 -1
  4. package/dist/client/assets/{Check-Cs5AiVxS.js → Check-BQkm1TiP.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-7pGjkuTY.js → ChevronDown-DP6jvip7.js} +1 -1
  6. package/dist/client/assets/{Code01-BdN1qNoI.js → Code01-qXTn9GK9.js} +1 -1
  7. package/dist/client/assets/{Copy01-B_oHlu2-.js → Copy01-CEYn2daS.js} +1 -1
  8. package/dist/client/assets/{DotsHorizontal-B-RZHKDt.js → DotsHorizontal-C2Nr-D-f.js} +1 -1
  9. package/dist/client/assets/{DotsVertical-HKe7Lpcg.js → DotsVertical-BPP4U4GQ.js} +1 -1
  10. package/dist/client/assets/{Download01-4uLxYlt-.js → Download01-BkDXja2z.js} +1 -1
  11. package/dist/client/assets/{Edit01-CcxqoKWW.js → Edit01-Cq0mQDLh.js} +1 -1
  12. package/dist/client/assets/{File06-K5gpmB1y.js → File06-KMD38I-q.js} +1 -1
  13. package/dist/client/assets/{FilterLines-BCus583X.js → FilterLines-Bojt6HPl.js} +1 -1
  14. package/dist/client/assets/{FlipBackward-MuxfY5vX.js → FlipBackward-C-K9FamE.js} +1 -1
  15. package/dist/client/assets/{GitBranch01-ClkRJDdk.js → GitBranch01-DGTCzEh5.js} +1 -1
  16. package/dist/client/assets/{Grid01-XLGz76ym.js → Grid01-D4lXvveX.js} +1 -1
  17. package/dist/client/assets/{Home02-CeVIG1t0.js → Home02-DPdZvu8L.js} +1 -1
  18. package/dist/client/assets/{Image01-CycaMeSm.js → Image01-C0R6SF_P.js} +1 -1
  19. package/dist/client/assets/{Inbox01-1DQwZbO-.js → Inbox01-BsOUYwQZ.js} +1 -1
  20. package/dist/client/assets/{InfoCircle-DXvgKrQ3.js → InfoCircle-BgIkbjJr.js} +1 -1
  21. package/dist/client/assets/{Key01-B8mxyE2f.js → Key01-DTwk4FpG.js} +1 -1
  22. package/dist/client/assets/{LinkExternal01-B4WpWXG7.js → LinkExternal01-DmruqAb9.js} +1 -1
  23. package/dist/client/assets/{List-DWWQESNh.js → List-BsSZz32j.js} +1 -1
  24. package/dist/client/assets/{Loading01-BtKovu_m.js → Loading01-Ae5ezbtD.js} +1 -1
  25. package/dist/client/assets/{Lock01-CDOVc6ZJ.js → Lock01-BuQSktMF.js} +1 -1
  26. package/dist/client/assets/{Play-DYDE6oE1.js → Play-DKlNHVjf.js} +1 -1
  27. package/dist/client/assets/{Plus-CPExS1G1.js → Plus-CdG75X26.js} +1 -1
  28. package/dist/client/assets/{SearchMd-DwKDi1yz.js → SearchMd-GFaonOaJ.js} +1 -1
  29. package/dist/client/assets/{Terminal-LP4GeLJv.js → Terminal-C6mZx-5A.js} +1 -1
  30. package/dist/client/assets/{Trash01-DCb3R_1E.js → Trash01-BWIN9RL_.js} +1 -1
  31. package/dist/client/assets/{Upload01-BKDlh_J7.js → Upload01-CaBE4VYK.js} +1 -1
  32. package/dist/client/assets/{X-DWXiZn3v.js → X-C18ho617.js} +1 -1
  33. package/dist/client/assets/{XClose-s9vu-dQj.js → XClose-CfwoKknl.js} +1 -1
  34. package/dist/client/assets/{alert-dialog-CNXrLp-S.js → alert-dialog-CCJCsKzK.js} +1 -1
  35. package/dist/client/assets/{auth-catchall-M9fqis8u.js → auth-catchall-C33VWmDE.js} +1 -1
  36. package/dist/client/assets/{avatar-noXapmql.js → avatar-B7xnPXuk.js} +1 -1
  37. package/dist/client/assets/{badge-ChGpQW0J.js → badge-BVO6I0sW.js} +1 -1
  38. package/dist/client/assets/{binder-DZT62WgB.js → binder-By0LBK9Y.js} +1 -1
  39. package/dist/client/assets/{button-Dh_UOMtF.js → button-CGmrzkpY.js} +1 -1
  40. package/dist/client/assets/{card-Bjs7HBa2.js → card-DIjMh1NO.js} +1 -1
  41. package/dist/client/assets/{checkbox-DiEhrfCa.js → checkbox-DYViXeUc.js} +1 -1
  42. package/dist/client/assets/{collection-detail-BHOMTlVb.js → collection-detail-DtlOJm8P.js} +1 -1
  43. package/dist/client/assets/{collection-display-button-DKfm8yFW.js → collection-display-button-CtkxsCB_.js} +1 -1
  44. package/dist/client/assets/{collection-header-Cn-YMrm9.js → collection-header-B4qcjEt5.js} +1 -1
  45. package/dist/client/assets/{collection-page-A6cy4ewQ.js → collection-page-s-RR5fU6.js} +1 -1
  46. package/dist/client/assets/{collection-search-Bm9HY_m8.js → collection-search-BVb42O45.js} +1 -1
  47. package/dist/client/assets/{collection-tab-BQzpUnQW.js → collection-tab-CvrhLJCU.js} +1 -1
  48. package/dist/client/assets/{collection-table-wrapper-CnCS_a8f.js → collection-table-wrapper-BohFZqii.js} +1 -1
  49. package/dist/client/assets/{connection-DuIRkEvB.js → connection-ChwHK0-S.js} +1 -1
  50. package/dist/client/assets/{connection-card-Db71-JIc.js → connection-card-DMMfNQUo.js} +1 -1
  51. package/dist/client/assets/{connection-detail-C1yH43Km.js → connection-detail-D9bORT-_.js} +1 -1
  52. package/dist/client/assets/{connections-Bd35VTO7.js → connections-CRhyn7eO.js} +1 -1
  53. package/dist/client/assets/constants-J0aH6mLs.js +1 -0
  54. package/dist/client/assets/{create-organization-dialog-B19KPYZ1.js → create-organization-dialog-CtbMd6S_.js} +1 -1
  55. package/dist/client/assets/{dialog-BFNjB_wS.js → dialog-DJJ2cvEE.js} +1 -1
  56. package/dist/client/assets/{dropdown-menu-T7u8fl7N.js → dropdown-menu-CAeD2aIb.js} +1 -1
  57. package/dist/client/assets/{dynamic-plugin-layout-CaPvL2ak.js → dynamic-plugin-layout-BeSg8wRq.js} +1 -1
  58. package/dist/client/assets/{empty-state-ylKJe6-v.js → empty-state-BkAB-hls.js} +1 -1
  59. package/dist/client/assets/{empty-state-DhpaMqQD.js → empty-state-wP9uukGJ.js} +1 -1
  60. package/dist/client/assets/{env-vars-editor-BwDtTYE8.js → env-vars-editor-DuH6BBdA.js} +1 -1
  61. package/dist/client/assets/{error-boundary-_npCfvs4.js → error-boundary-BUvK8Sry.js} +1 -1
  62. package/dist/client/assets/{extract-connection-data-DfFE7uXb.js → extract-connection-data-BLs0SRok.js} +1 -1
  63. package/dist/client/assets/{file-browser-NWpg0oN1.js → file-browser-DuR45yyf.js} +2 -2
  64. package/dist/client/assets/{form-BEM8UzSv.js → form-DiGzBnRK.js} +1 -1
  65. package/dist/client/assets/{gateway-detail-BrjbS3jo.js → gateway-detail-BCBmyW-G.js} +1 -1
  66. package/dist/client/assets/{gateways-DhcOJhD5.js → gateways-BgSVXbfx.js} +1 -1
  67. package/dist/client/assets/{grid-view-BUF5kath.js → grid-view-Db741zGU.js} +1 -1
  68. package/dist/client/assets/{home-DyK0jpSk.js → home-BtJc_wcZ.js} +1 -1
  69. package/dist/client/assets/{index-Dh8Y3NBs.js → index-CL_rL7XJ.js} +4 -4
  70. package/dist/client/assets/{index-DanqEyuv.js → index-D4QCsSzb.js} +1 -1
  71. package/dist/client/assets/index-DUA-vRuy.js +1 -0
  72. package/dist/client/assets/{index-skH-OUyO.js → index-Diww4UW3.js} +2 -2
  73. package/dist/client/assets/{index-BRipTsvS.js → index-DjRWdLI4.js} +1 -1
  74. package/dist/client/assets/{infiniteQueryObserver-Dvgbvv4A.js → infiniteQueryObserver-BmbQcWdI.js} +1 -1
  75. package/dist/client/assets/{input-CdlPz8Vq.js → input-CrURMEZe.js} +1 -1
  76. package/dist/client/assets/{layout-DopLDDPE.js → layout-kp8TTJc9.js} +1 -1
  77. package/dist/client/assets/{lazy-highlighter-CQ8gN0d3.js → lazy-highlighter-dN3WcL6s.js} +1 -1
  78. package/dist/client/assets/{localstorage-keys-B_H3St2R.js → localstorage-keys-BVANkONM.js} +1 -1
  79. package/dist/client/assets/{login-1cuD6_Oo.js → login-CnuJ6k4x.js} +1 -1
  80. package/dist/client/assets/{mcp-oauth-B6eUt4Mr.js → mcp-oauth-CdcIczUJ.js} +1 -1
  81. package/dist/client/assets/{mcp-server-card-DTQIT3pj.js → mcp-server-card-VZUBDTRj.js} +1 -1
  82. package/dist/client/assets/{mcp-server-detail-BB_FT5IH.js → mcp-server-detail-CIR0FKMd.js} +1 -1
  83. package/dist/client/assets/{members-Cy4UaFKY.js → members-bQTH1spX.js} +1 -1
  84. package/dist/client/assets/{monaco-editor-CKUC5K4P.js → monaco-editor-CDRbE4GY.js} +1 -1
  85. package/dist/client/assets/{monitoring-DOZ3Tm1E.js → monitoring-Cb41cf-X.js} +1 -1
  86. package/dist/client/assets/{oauth-callback-DxWqmOqk.js → oauth-callback-z6t0OToi.js} +1 -1
  87. package/dist/client/assets/{page-wGlLXgmM.js → page-CcKdSzCp.js} +1 -1
  88. package/dist/client/assets/{page-zq0-MjKt.js → page-SWPgLEpC.js} +1 -1
  89. package/dist/client/assets/{pin-to-sidebar-button-C5qdidS1.js → pin-to-sidebar-button-DIwkO0Tx.js} +1 -1
  90. package/dist/client/assets/{plugin-empty-state-cSLsH0S-.js → plugin-empty-state-B-glkOMH.js} +1 -1
  91. package/dist/client/assets/{plugin-header-CzG38AxU.js → plugin-header-BA0z5mBU.js} +1 -1
  92. package/dist/client/assets/{plugins-BqbdQ0eM.js → plugins-Cq62fkYj.js} +1 -1
  93. package/dist/client/assets/{popover-B4iU4oXK.js → popover-Bx7diZ86.js} +1 -1
  94. package/dist/client/assets/{project-context-provider-Ci1EHyGR.js → project-context-provider-DulCVL2k.js} +1 -1
  95. package/dist/client/assets/{registry-utils-8goOeMwE.js → registry-utils-8Lvx2XTy.js} +1 -1
  96. package/dist/client/assets/{resizable-BteAr06H.js → resizable-Gk1RjNnW.js} +1 -1
  97. package/dist/client/assets/{resource-tabs-Dzc9tSXU.js → resource-tabs-ACbF96qo.js} +1 -1
  98. package/dist/client/assets/{select-B4aq4vxk.js → select-C8LOz7vA.js} +1 -1
  99. package/dist/client/assets/{settings-B6nAEWR5.js → settings-BXJ6BGel.js} +1 -1
  100. package/dist/client/assets/{shell-layout-CNkO6ROG.js → shell-layout-CFRw9Ru3.js} +1 -1
  101. package/dist/client/assets/{spinner-DwVZzFPC.js → spinner-BF56RAKQ.js} +1 -1
  102. package/dist/client/assets/{switch-PB1r01nO.js → switch-DJBd8Fzb.js} +1 -1
  103. package/dist/client/assets/{textarea-B7no0HbU.js → textarea-C_zgj3Sp.js} +1 -1
  104. package/dist/client/assets/{tool-set-selector-Cl3nu1df.js → tool-set-selector-B9rTBahU.js} +1 -1
  105. package/dist/client/assets/{tools-list-DNdG8U23.js → tools-list-mr-l2d8l.js} +1 -1
  106. package/dist/client/assets/{tooltip-DgJ4R-G6.js → tooltip-Suu_Gpqh.js} +1 -1
  107. package/dist/client/assets/{typewriter-title-YmbwonUg.js → typewriter-title-DM-oRxie.js} +1 -1
  108. package/dist/client/assets/{use-binding-R6SoNecZ.js → use-binding-D6wv_5fO.js} +1 -1
  109. package/dist/client/assets/{use-collections-CC15C_nK.js → use-collections-CXETocKO.js} +1 -1
  110. package/dist/client/assets/{use-connection-BY9aOm7H.js → use-connection-CCXutWLD.js} +1 -1
  111. package/dist/client/assets/{use-connection-resources-D2N-7Fdh.js → use-connection-resources-D0st76bP.js} +1 -1
  112. package/dist/client/assets/{use-create-gateway-D4_8vfl-.js → use-create-gateway-BlLsktgc.js} +1 -1
  113. package/dist/client/assets/{use-gateway-CmDE4xLF.js → use-gateway-DD-xEZju.js} +1 -1
  114. package/dist/client/assets/{use-gateway-system-prompt-nzDoNyO-.js → use-gateway-system-prompt-zGJSEzce.js} +1 -1
  115. package/dist/client/assets/{use-list-state-B0HVVNOr.js → use-list-state-AndcW8aD.js} +1 -1
  116. package/dist/client/assets/{use-mcp-DUgnx05H.js → use-mcp-D9llr83X.js} +1 -1
  117. package/dist/client/assets/{use-members-DEeTkVb7.js → use-members-CB2ebBfn.js} +1 -1
  118. package/dist/client/assets/{use-mobile-CZeMkOxo.js → use-mobile-DssCtDl6.js} +1 -1
  119. package/dist/client/assets/{use-organization-settings-8tWqPbhq.js → use-organization-settings-CQXtXtZs.js} +1 -1
  120. package/dist/client/assets/{use-tool-call-_jHZu2qb.js → use-tool-call-BmvKn7jp.js} +1 -1
  121. package/dist/client/assets/useInfiniteQuery-BttwTOfK.js +1 -0
  122. package/dist/client/assets/{useMutation-n0xwrWOz.js → useMutation-Dl1MMkEC.js} +1 -1
  123. package/dist/client/assets/useQuery-Bvk0U2ed.js +1 -0
  124. package/dist/client/assets/{value-BOu8imSs.js → value-DaPOjTmC.js} +1 -1
  125. package/dist/client/assets/{view-mode-toggle-Z5AVjYj0.js → view-mode-toggle-BLClM-0g.js} +1 -1
  126. package/dist/client/assets/{workflow-CZ2JUtj_.js → workflow-CQ7PQ7Dg.js} +1 -1
  127. package/dist/client/index.html +1 -1
  128. package/dist/server/cli.js +1 -1
  129. package/dist/server/node_modules/kysely/README.md +3 -1
  130. package/dist/server/node_modules/kysely/dist/cjs/index.d.ts +3 -1
  131. package/dist/server/node_modules/kysely/dist/cjs/migration/migrator.d.ts +1 -1
  132. package/dist/server/node_modules/kysely/dist/cjs/migration/migrator.js +75 -68
  133. package/dist/server/node_modules/kysely/dist/esm/index.d.ts +3 -1
  134. package/dist/server/node_modules/kysely/dist/esm/migration/migrator.d.ts +1 -1
  135. package/dist/server/node_modules/kysely/dist/esm/migration/migrator.js +75 -68
  136. package/dist/server/node_modules/kysely/package.json +13 -13
  137. package/dist/server/server.js +1 -1
  138. package/package.json +1 -1
  139. package/dist/client/assets/constants-C1rpewgJ.js +0 -1
  140. package/dist/client/assets/index-C6eYxyql.js +0 -1
  141. package/dist/client/assets/useInfiniteQuery-x4_y1w34.js +0 -1
  142. package/dist/client/assets/useQuery-FRehIqtM.js +0 -1
@@ -1 +1 @@
1
- import{r as S,_ as ye,y as re,I as U,z as w,c as R,j as t,f as Fe,d as tt,b as st,k as ot,af as lt,B as nt,E as it,t as Ae}from"./index-skH-OUyO.js";import{I as Ee,E as rt}from"./empty-state-DhpaMqQD.js";import{E as Ve}from"./error-boundary-_npCfvs4.js";import{C as Ge}from"./checkbox-DiEhrfCa.js";import{c as H,B as V}from"./button-Dh_UOMtF.js";import{i as at}from"./ArrowLeft-m6KeIjPT.js";import{u as We}from"./use-connection-BY9aOm7H.js";import{C as ct}from"./collection-search-Bm9HY_m8.js";import{I as Pe}from"./input-CdlPz8Vq.js";import{s as dt}from"./Plus-CPExS1G1.js";import{i as mt}from"./X-DWXiZn3v.js";import{P as ut}from"./pin-to-sidebar-button-C5qdidS1.js";import{T as ft}from"./tool-set-selector-Cl3nu1df.js";import{b as ht,a as xt,i as pt}from"./use-gateway-CmDE4xLF.js";import{u as gt,a as bt}from"./use-connection-resources-D2N-7Fdh.js";import{u as jt,a as yt}from"./use-gateway-system-prompt-nzDoNyO-.js";import{s as He}from"./slugify-CEUa2lfQ.js";import{B as qe}from"./badge-ChGpQW0J.js";import{a as vt,D as St,c as Nt,d as _t}from"./dialog-BFNjB_wS.js";import{F as be,a as wt,b as ve,d as Se,f as Ne,c as Ct}from"./form-BEM8UzSv.js";import{I as kt,R as It,a as Tt}from"./index-C6eYxyql.js";import{R as $t}from"./resource-tabs-Dzc9tSXU.js";import{S as Rt,a as zt,b as At,c as Et,d as Ue}from"./select-B4aq4vxk.js";import{S as Pt}from"./switch-PB1r01nO.js";import{T as Mt}from"./textarea-B7no0HbU.js";import{a as Z,c as Y,b as J,T as Q}from"./tooltip-DgJ4R-G6.js";import{i as Ze}from"./Check-Cs5AiVxS.js";import{i as Dt}from"./Code01-BdN1qNoI.js";import{a as Ut}from"./Copy01-B_oHlu2-.js";import{i as Lt}from"./FlipBackward-MuxfY5vX.js";import{i as je}from"./InfoCircle-DXvgKrQ3.js";import{i as ze}from"./Loading01-BtKovu_m.js";import{a as Ot,V as Bt,b as Ft}from"./layout-DopLDDPE.js";import"./connection-DuIRkEvB.js";import"./project-context-provider-Ci1EHyGR.js";import"./use-collections-CC15C_nK.js";import"./useMutation-n0xwrWOz.js";import"./SearchMd-DwKDi1yz.js";import"./use-organization-settings-8tWqPbhq.js";import"./localstorage-keys-B_H3St2R.js";import"./useQuery-FRehIqtM.js";import"./ChevronDown-7pGjkuTY.js";const Ye=({size:o=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"M4 7h11m0 0-4 4m4-4-4-4M4 17h16m0 0-4 4m4-4-4-4"}));Ye.displayName="ArrowsRight";const Je=({size:o=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"}));Je.displayName="Circle";const Qe=({size:o=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"M10 17.659V20a2 2 0 1 0 4 0v-2.341M12 2v1m-9 9H2m3.5-6.5-.6-.6m13.6.6.6-.6M22 12h-1m-3 0a6 6 0 1 1-12 0 6 6 0 0 1 12 0Z"}));Qe.displayName="Lightbulb02";const Ke=({size:o=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"M7 3v3.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C7.76 8 8.04 8 8.6 8h6.8c.56 0 .84 0 1.054-.109a1 1 0 0 0 .437-.437C17 7.24 17 6.96 17 6.4V4m0 17v-6.4c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C16.24 13 15.96 13 15.4 13H8.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C7 13.76 7 14.04 7 14.6V21M21 9.325V16.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h6.875c.489 0 .733 0 .963.055.204.05.4.13.579.24.201.123.374.296.72.642l3.126 3.126c.346.346.519.519.642.72.11.18.19.374.24.579.055.23.055.474.055.963Z"}));Ke.displayName="Save01";const Xe=({size:o=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"m8.59 13.51 6.83 3.98m-.01-10.98-6.82 3.98M21 5a3 3 0 1 1-6 0 3 3 0 0 1 6 0ZM9 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm12 7a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}));Xe.displayName="Share07";const Me=ye(["inclusion","exclusion"]).describe("Tool selection mode: 'inclusion' = include selected (default), 'exclusion' = exclude selected"),Vt=re({connection_id:w().describe("Connection ID"),selected_tools:U(w()).nullable().describe("Selected tool names. With 'inclusion' mode: null = all tools included. With 'exclusion' mode: null = entire connection excluded"),selected_resources:U(w()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. With 'inclusion' mode: null = all resources included."),selected_prompts:U(w()).nullable().describe("Selected prompt names. With 'inclusion' mode: null = all prompts included. With 'exclusion' mode: null = entire connection excluded.")}),Gt=re({id:w().describe("Unique identifier for the gateway"),title:w().describe("Human-readable name for the gateway"),description:w().nullable().describe("Description of the gateway"),icon:w().nullable().optional().describe("Icon URL for the gateway"),created_at:w().describe("When the gateway was created"),updated_at:w().describe("When the gateway was last updated"),created_by:w().describe("User ID who created the gateway"),updated_by:w().optional().describe("User ID who last updated the gateway"),organization_id:w().describe("Organization ID this gateway belongs to"),tool_selection_mode:Me.describe("Tool selection mode: 'inclusion' = include selected, 'exclusion' = exclude selected"),status:ye(["active","inactive"]).describe("Current status"),connections:U(Vt).describe("Connections with their selected tools (behavior depends on tool_selection_mode)")});re({title:w().min(1).max(255).describe("Name for the gateway"),description:w().nullable().optional().describe("Optional description"),tool_selection_mode:Me.optional().default("inclusion").describe("Tool selection mode (defaults to 'inclusion')"),icon:w().nullable().optional().describe("Optional icon URL"),status:ye(["active","inactive"]).optional().default("active").describe("Initial status"),connections:U(re({connection_id:w().describe("Connection ID"),selected_tools:U(w()).nullable().optional().describe("Selected tool names (null/undefined = all tools or full exclusion)"),selected_resources:U(w()).nullable().optional().describe("Selected resource URIs or patterns with * and ** wildcards (null/undefined = all resources)"),selected_prompts:U(w()).nullable().optional().describe("Selected prompt names (null/undefined = all prompts or full exclusion)")})).describe("Connections to include/exclude (can be empty for exclusion mode)")});re({title:w().min(1).max(255).optional().describe("New name"),description:w().nullable().optional().describe("New description (null to clear)"),tool_selection_mode:Me.optional().describe("New tool selection mode"),icon:w().nullable().optional().describe("New icon URL (null to clear)"),status:ye(["active","inactive"]).optional().describe("New status"),connections:U(re({connection_id:w().describe("Connection ID"),selected_tools:U(w()).nullable().optional().describe("Selected tool names (null/undefined = all tools or full exclusion)"),selected_resources:U(w()).nullable().optional().describe("Selected resource URIs or patterns with * and ** wildcards (null/undefined = all resources)"),selected_prompts:U(w()).nullable().optional().describe("Selected prompt names (null/undefined = all prompts or full exclusion)")})).optional().describe("New connections (replaces existing)")});const Wt=S.memo(function(e){const s=R.c(20),{connection:l,isSelected:i,hasItemsEnabled:n,activeItemsCount:a,totalItemsCount:m,onSelect:c,onToggle:r}=e,d=i?"bg-accent/50":"hover:bg-muted/50";let u;s[0]!==d?(u=H("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",d),s[0]=d,s[1]=u):u=s[1];let f;s[2]!==l.icon||s[3]!==l.title?(f=t.jsx(Ee,{icon:l.icon,name:l.title,size:"xs"}),s[2]=l.icon,s[3]=l.title,s[4]=f):f=s[4];let b;s[5]!==l.title?(b=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:l.title})}),s[5]=l.title,s[6]=b):b=s[6];let x;s[7]!==c||s[8]!==f||s[9]!==b?(x=t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:c,children:[f,b]}),s[7]=c,s[8]=f,s[9]=b,s[10]=x):x=s[10];let p;s[11]!==a||s[12]!==n||s[13]!==r||s[14]!==m?(p=m>0&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[a,"/",m]}),t.jsx(Ge,{checked:n,onCheckedChange:r,onClick:qt})]}),s[11]=a,s[12]=n,s[13]=r,s[14]=m,s[15]=p):p=s[15];let y;return s[16]!==u||s[17]!==x||s[18]!==p?(y=t.jsxs("div",{className:u,children:[x,p]}),s[16]=u,s[17]=x,s[18]=p,s[19]=y):y=s[19],y}),Ht=S.memo(function(e){const s=R.c(18),{connectionId:l,item:i,isSelected:n,onToggle:a}=e,m=`item-${l}-${i.id}`,c=n?"text-foreground":"text-muted-foreground";let r;s[0]!==c?(r=H("text-sm font-medium",c),s[0]=c,s[1]=r):r=s[1];let d;s[2]!==i.name||s[3]!==r?(d=t.jsx("div",{className:"flex items-center gap-2 mb-1",children:t.jsx("span",{className:r,children:i.name})}),s[2]=i.name,s[3]=r,s[4]=d):d=s[4];let u;s[5]!==i.description?(u=i.description&&t.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:i.description}),s[5]=i.description,s[6]=u):u=s[6];let f;s[7]!==d||s[8]!==u?(f=t.jsxs("div",{className:"flex-1 min-w-0",children:[d,u]}),s[7]=d,s[8]=u,s[9]=f):f=s[9];const b=`item-${l}-${i.id}`;let x;s[10]!==n||s[11]!==a||s[12]!==b?(x=t.jsx("div",{className:"flex items-center shrink-0",children:t.jsx(Ge,{id:b,checked:n,onCheckedChange:a,onClick:Zt})}),s[10]=n,s[11]=a,s[12]=b,s[13]=x):x=s[13];let p;return s[14]!==m||s[15]!==f||s[16]!==x?(p=t.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:m,children:[f,x]}),s[14]=m,s[15]=f,s[16]=x,s[17]=p):p=s[17],p});function et({itemSet:o,onItemSetChange:e,getItems:s,itemLabel:l,emptyItemsMessage:i,extraContent:n}){const[a,m]=S.useState(""),c=S.useDeferredValue(a),[r,d]=S.useState("all"),[u,f]=S.useState(!1),b=S.useRef(new Set(Object.keys(o))),x=We({searchTerm:c.trim()||void 0}),p=b.current,y=[...p.values()].map(h=>x.find(N=>N.id===h)).filter(h=>h!==void 0),j=x.filter(h=>!p.has(h.id)),v=[...y,...j],g=h=>{const N=o[h];return N!==void 0&&N.length>0},_=v.filter(h=>{if(r==="all")return!0;const N=g(h.id);return r==="selected"?N:r==="unselected"?!N:!0}),[C,I]=S.useState(v[0]?.id??null),k=C?v.find(h=>h.id===C)??null:null,P=k?s(k):[],E=(h,N)=>o[h]?.includes(N)??!1,L=(h,N)=>{const z=o[h]??[],$=z.includes(N),G={...o};if($){const W=z.filter(q=>q!==N);W.length===0?delete G[h]:G[h]=W}else G[h]=[...z,N];e(G)},B=h=>{const N=v.find(F=>F.id===h);if(!N)return;const z=s(N);if(z.length===0)return;const $=o[h]??[],G=z.map(F=>F.id),W=$.length>0&&G.every(F=>$.includes(F)),q={...o};W?delete q[h]:(q[h]=G,I(h)),e(q)},A=h=>{I(h),f(!0)},M=()=>{f(!1)};return t.jsxs("div",{className:"flex h-full",children:[t.jsxs("div",{className:H("w-full md:w-80 border-r border-border flex flex-col",u&&"hidden md:flex"),children:[t.jsx(ct,{value:a,onChange:m,placeholder:"Search Connections..."}),t.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[t.jsx("button",{onClick:()=>d("all"),className:H("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",r==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),t.jsx("button",{onClick:()=>d("selected"),className:H("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",r==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),t.jsx("button",{onClick:()=>d("unselected"),className:H("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",r==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),t.jsx("div",{className:"flex-1 overflow-auto",children:_.length===0?t.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:a?"No connections found":r==="selected"?"No servers selected":r==="unselected"?"No unselected servers":"No connections available"}):t.jsx("div",{className:"p-2 space-y-1",children:_.map(h=>{const z=s(h).length,$=o[h.id]?.length??0;return t.jsx(Wt,{connection:h,isSelected:C===h.id,hasItemsEnabled:g(h.id),activeItemsCount:$,totalItemsCount:z,onSelect:()=>A(h.id),onToggle:()=>B(h.id)},h.id)})})})]}),t.jsx("div",{className:H("flex-1 flex-col",u?"flex":"hidden md:flex"),children:k?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[t.jsx(V,{variant:"ghost",size:"sm",onClick:M,className:"h-8 w-8 p-0 shrink-0",children:t.jsx(at,{size:20})}),t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[t.jsx(Ee,{icon:k.icon,name:k.title,size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:k.title}),k.description&&t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:k.description})]})]})]}),n,t.jsx("div",{className:"flex-1 overflow-auto p-4",children:P.length===0?t.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:i||`This connection has no ${l} available`}):t.jsx("div",{className:"space-y-2",children:P.map(h=>t.jsx(Ht,{connectionId:k.id,item:h,isSelected:E(k.id,h.id),onToggle:()=>L(k.id,h.id)},h.id))})})]}):t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsxs("div",{className:"text-sm text-muted-foreground text-center",children:["Select a connection to view its ",l]})})})]})}function qt(o){return o.stopPropagation()}function Zt(o){return o.stopPropagation()}function Yt(o){const e=R.c(6),{promptSet:s,onPromptSetChange:l,connectionPrompts:i}=o;let n;e[0]!==i?(n=c=>(i.get(c.id)??[]).map(Jt),e[0]=i,e[1]=n):n=e[1];const a=n;let m;return e[2]!==a||e[3]!==l||e[4]!==s?(m=t.jsx(et,{itemSet:s,onItemSetChange:l,getItems:a,itemLabel:"prompts",emptyItemsMessage:"This connection has no prompts available"}),e[2]=a,e[3]=l,e[4]=s,e[5]=m):m=e[5],m}function Jt(o){return{id:o.name,name:o.name,description:o.description}}function Qt(o){return o.includes("*")}function Kt(o){const e=R.c(27),{patterns:s,onAddPattern:l,onRemovePattern:i}=o,[n,a]=S.useState("");let m;e[0]!==n||e[1]!==l||e[2]!==s?(m=()=>{const f=n.trim();f&&!s.includes(f)&&(l(f),a(""))},e[0]=n,e[1]=l,e[2]=s,e[3]=m):m=e[3];const c=m;let r;e[4]!==c?(r=f=>{f.key==="Enter"&&(f.preventDefault(),c())},e[4]=c,e[5]=r):r=e[5];const d=r;let u;if(e[6]!==c||e[7]!==d||e[8]!==n||e[9]!==i||e[10]!==s){const f=s.filter(Qt);let b;e[12]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("code",{children:"*"}),e[12]=b):b=e[12];let x;e[13]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsxs("div",{className:"text-xs text-muted-foreground",children:["Add URI patterns to match multiple resources. Use ",b," for single segment and ",t.jsx("code",{children:"**"})," for multiple segments."]}),e[13]=x):x=e[13];let p;e[14]===Symbol.for("react.memo_cache_sentinel")?(p=I=>a(I.target.value),e[14]=p):p=e[14];let y;e[15]!==d||e[16]!==n?(y=t.jsx(Pe,{value:n,onChange:p,onKeyDown:d,placeholder:"e.g., file:///**/*.ts or db://users/*",className:"flex-1 text-sm"}),e[15]=d,e[16]=n,e[17]=y):y=e[17];let j;e[18]!==n?(j=n.trim(),e[18]=n,e[19]=j):j=e[19];const v=!j;let g;e[20]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(dt,{size:16}),e[20]=g):g=e[20];let _;e[21]!==c||e[22]!==v?(_=t.jsx(V,{type:"button",variant:"outline",size:"sm",onClick:c,disabled:v,children:g}),e[21]=c,e[22]=v,e[23]=_):_=e[23];let C;e[24]!==_||e[25]!==y?(C=t.jsxs("div",{className:"flex gap-2",children:[y,_]}),e[24]=_,e[25]=y,e[26]=C):C=e[26],u=t.jsxs("div",{className:"border-b border-border p-4 space-y-3",children:[x,C,f.length>0&&t.jsx("div",{className:"flex flex-wrap gap-2",children:f.map(I=>t.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 bg-muted rounded-md text-xs",children:[t.jsx("code",{className:"text-foreground",children:I}),t.jsx("button",{type:"button",onClick:()=>i(I),className:"text-muted-foreground hover:text-foreground",children:t.jsx(mt,{size:12})})]},I))})]}),e[6]=c,e[7]=d,e[8]=n,e[9]=i,e[10]=s,e[11]=u}else u=e[11];return u}function Xt(o){const e=R.c(23),{resourceSet:s,onResourceSetChange:l,connectionResources:i}=o,[n]=S.useState(null);let a;e[0]!==i?(a=g=>(i.get(g.id)??[]).map(es),e[0]=i,e[1]=a):a=e[1];const m=a;let c;e[2]!==l||e[3]!==s?(c=(g,_)=>{const C=s[g]??[];C.includes(_)||l({...s,[g]:[...C,_]})},e[2]=l,e[3]=s,e[4]=c):c=e[4];const r=c;let d;e[5]!==l||e[6]!==s?(d=(g,_)=>{const I=(s[g]??[]).filter(k=>k!==_);if(I.length===0){const k={...s};delete k[g],l(k)}else l({...s,[g]:I})},e[5]=l,e[6]=s,e[7]=d):d=e[7];const u=d;let f;e[8]!==l?(f=g=>{l(g)},e[8]=l,e[9]=f):f=e[9];const b=f;let x;e[10]!==s||e[11]!==n?(x=n?s[n]??[]:[],e[10]=s,e[11]=n,e[12]=x):x=e[12];const p=x;let y;e[13]!==r||e[14]!==u||e[15]!==n||e[16]!==p?(y=n?t.jsx(Kt,{patterns:p,onAddPattern:g=>r(n,g),onRemovePattern:g=>u(n,g)}):null,e[13]=r,e[14]=u,e[15]=n,e[16]=p,e[17]=y):y=e[17];const j=y;let v;return e[18]!==j||e[19]!==m||e[20]!==b||e[21]!==s?(v=t.jsx("div",{className:"h-full",children:t.jsx(et,{itemSet:s,onItemSetChange:b,getItems:m,itemLabel:"resources",emptyItemsMessage:"This connection has no resources available",extraContent:j})}),e[18]=j,e[19]=m,e[20]=b,e[21]=s,e[22]=v):v=e[22],v}function es(o){return{id:o.uri,name:o.name||o.uri,description:o.description||o.uri}}function ts(o){const e=R.c(8);let s,l;e[0]!==o?({className:s,...l}=o,e[0]=o,e[1]=s,e[2]=l):(s=e[1],l=e[2]);let i;e[3]!==s?(i=H("grid gap-3",s),e[3]=s,e[4]=i):i=e[4];let n;return e[5]!==l||e[6]!==i?(n=t.jsx(It,{"data-slot":"radio-group",className:i,...l}),e[5]=l,e[6]=i,e[7]=n):n=e[7],n}function Re(o){const e=R.c(9);let s,l;e[0]!==o?({className:s,...l}=o,e[0]=o,e[1]=s,e[2]=l):(s=e[1],l=e[2]);let i;e[3]!==s?(i=H("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",s),e[3]=s,e[4]=i):i=e[4];let n;e[5]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(Tt,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:t.jsx(Je,{className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})}),e[5]=n):n=e[5];let a;return e[6]!==l||e[7]!==i?(a=t.jsx(kt,{"data-slot":"radio-group-item",className:i,...l,children:n}),e[6]=l,e[7]=i,e[8]=a):a=e[8],a}function ss(o){const s=new TextEncoder().encode(o),l=Array.from(s,i=>String.fromCharCode(i)).join("");return btoa(l)}const os=Gt.pick({title:!0,description:!0,status:!0,tool_selection_mode:!0}).extend({title:w().min(1,"Name is required").max(255)});function Le(o,e){const s={};for(const l of o.connections)if(l.selected_tools===null){const i=e.get(l.connection_id)??[];i.length>0&&(s[l.connection_id]=i)}else l.selected_tools.length>0&&(s[l.connection_id]=l.selected_tools);return s}function Oe(o){const e={};for(const s of o.connections)s.selected_resources!==null&&s.selected_resources!==void 0&&s.selected_resources.length>0&&(e[s.connection_id]=s.selected_resources);return e}function Be(o){const e={};for(const s of o.connections)s.selected_prompts!==null&&s.selected_prompts!==void 0&&s.selected_prompts.length>0&&(e[s.connection_id]=s.selected_prompts);return e}function ls(o,e,s,l){const i=new Set([...Object.keys(o),...Object.keys(e),...Object.keys(s)]);return Array.from(i).map(n=>{const a=o[n]??[],m=l.get(n)??[],c=m.length>0&&m.every(r=>a.includes(r));return{connection_id:n,selected_tools:a.length===0||c?null:a,selected_resources:e[n]??null,selected_prompts:s[n]??null}})}function ns(o){const e=R.c(10),{gatewayUrl:s}=o,[l,i]=S.useState(!1);let n;e[0]!==s?(n=async()=>{await navigator.clipboard.writeText(s),i(!0),Ae.success("Agent URL copied to clipboard"),setTimeout(()=>i(!1),2e3)},e[0]=s,e[1]=n):n=e[1];const a=n;let m;e[2]!==l?(m=l?t.jsx(Ze,{size:20,className:"text-green-600"}):t.jsx(Ut,{size:20}),e[2]=l,e[3]=m):m=e[3];const c=l?"Copied!":"Copy URL";let r;e[4]!==c?(r=t.jsx("span",{className:"text-xs font-medium",children:c}),e[4]=c,e[5]=r):r=e[5];let d;return e[6]!==a||e[7]!==m||e[8]!==r?(d=t.jsxs(V,{type:"button",variant:"outline",onClick:a,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[m,r]}),e[6]=a,e[7]=m,e[8]=r,e[9]=d):d=e[9],d}function is(o){const e=R.c(7),{gatewayUrl:s,serverName:l}=o;let i;e[0]!==s||e[1]!==l?(i=()=>{const r=He(l),u=ss(JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Cursor"}},null,2)),f=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(r)}&config=${encodeURIComponent(u)}`;window.open(f,"_blank"),Ae.success("Opening Cursor...")},e[0]=s,e[1]=l,e[2]=i):i=e[2];const n=i;let a,m;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("img",{src:"/logos/cursor.svg",alt:"Cursor",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(11%) sepia(8%) saturate(785%) hue-rotate(1deg) brightness(95%) contrast(89%)"}}),m=t.jsx("span",{className:"text-xs font-medium",children:"Install on Cursor"}),e[3]=a,e[4]=m):(a=e[3],m=e[4]);let c;return e[5]!==n?(c=t.jsxs(V,{type:"button",variant:"outline",onClick:n,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[a,m]}),e[5]=n,e[6]=c):c=e[6],c}function rs(o){const e=R.c(11),{gatewayUrl:s,serverName:l}=o,[i,n]=S.useState(!1);let a;e[0]!==s||e[1]!==l?(a=async()=>{const f=He(l),x=JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Claude Code"}}),p=`claude mcp add-json ${f} '${x.replace(/'/g,"'\\''")}'`;await navigator.clipboard.writeText(p),n(!0),Ae.success("Claude Code command copied to clipboard"),setTimeout(()=>n(!1),2e3)},e[0]=s,e[1]=l,e[2]=a):a=e[2];const m=a;let c;e[3]!==i?(c=i?t.jsx(Ze,{size:20,className:"text-green-600"}):t.jsx("img",{src:"/logos/Claude Code.svg",alt:"Claude Code",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(55%) sepia(31%) saturate(1264%) hue-rotate(331deg) brightness(92%) contrast(86%)"}}),e[3]=i,e[4]=c):c=e[4];const r=i?"Copied!":"Install on Claude";let d;e[5]!==r?(d=t.jsx("span",{className:"text-xs font-medium",children:r}),e[5]=r,e[6]=d):d=e[6];let u;return e[7]!==m||e[8]!==c||e[9]!==d?(u=t.jsxs(V,{type:"button",variant:"outline",onClick:m,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[c,d]}),e[7]=m,e[8]=c,e[9]=d,e[10]=u):u=e[10],u}function as(o){const e=R.c(40),{open:s,onOpenChange:l,gateway:i}=o,[n,a]=S.useState("code_execution");let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=$=>{($==="passthrough"||$==="smart_tool_selection"||$==="code_execution")&&a($)},e[0]=m):m=e[0];const c=m;let r;e[1]!==i.id||e[2]!==n?(r=new URL(`/mcp/gateway/${i.id}`,window.location.origin),r.searchParams.set("mode",n),e[1]=i.id,e[2]=n,e[3]=r):r=e[3];let d;e[4]!==i.id||e[5]!==i.title?(d=i.title||`agent-${i.id.slice(0,8)}`,e[4]=i.id,e[5]=i.title,e[6]=d):d=e[6];const u=d;let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(vt,{children:t.jsx(St,{children:"Share Agent"})}),e[7]=f):f=e[7];let b;e[8]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("div",{children:t.jsx("h4",{className:"text-sm font-medium text-foreground mt-1",children:"How should this agent work?"})}),e[8]=b):b=e[8];let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(Ye,{className:"size-5 text-muted-foreground"})}),e[9]=x):x=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Direct access"}),e[10]=p):p=e[10];let y;e[11]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(J,{asChild:!0,children:t.jsx(je,{className:"size-3.5 text-muted-foreground"})}),e[11]=y):y=e[11];let j;e[12]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsxs("label",{htmlFor:"mode-passthrough",className:"flex items-center gap-3 px-3 py-5 rounded-lg border border-border hover:border-ring/50 cursor-pointer transition-colors has-checked:border-ring has-checked:bg-accent/5",children:[x,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[p,t.jsx(Z,{children:t.jsxs(Y,{children:[y,t.jsx(Q,{className:"max-w-xs",children:t.jsx("p",{className:"text-xs",children:"All tools are exposed directly via tools/list. Best for small tool surfaces with deterministic behavior."})})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Best for small teams or when you need predictable behavior"})]}),t.jsx(Re,{id:"mode-passthrough",value:"passthrough"})]}),e[12]=j):j=e[12];let v;e[13]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(Qe,{className:"size-5 text-muted-foreground"})}),e[13]=v):v=e[13];let g;e[14]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Smart discovery"}),e[14]=g):g=e[14];let _;e[15]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx(J,{asChild:!0,children:t.jsx(je,{className:"size-3.5 text-muted-foreground"})}),e[15]=_):_=e[15];let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsxs("label",{htmlFor:"mode-smart",className:"flex items-center gap-3 px-3 py-5 rounded-lg border border-border hover:border-ring/50 cursor-pointer transition-colors has-checked:border-ring has-checked:bg-accent/5",children:[v,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[g,t.jsx(Z,{children:t.jsxs(Y,{children:[_,t.jsx(Q,{className:"max-w-xs",children:t.jsx("p",{className:"text-xs",children:"Uses meta-tools (GATEWAY_SEARCH_TOOLS, GATEWAY_DESCRIBE_TOOLS, GATEWAY_CALL_TOOL) to keep the tool list small and request details on demand."})})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Ideal for large teams with many tools - AI finds what it needs"})]}),t.jsx(Re,{id:"mode-smart",value:"smart_tool_selection"})]}),e[16]=C):C=e[16];let I;e[17]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(Dt,{className:"size-5 text-muted-foreground"})}),e[17]=I):I=e[17];let k;e[18]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Smart execution"}),e[18]=k):k=e[18];let P;e[19]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(J,{asChild:!0,children:t.jsx(je,{className:"size-3.5 text-muted-foreground"})}),e[19]=P):P=e[19];let E;e[20]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsxs("label",{htmlFor:"mode-code",className:"relative flex items-center gap-3 px-3 py-5 rounded-lg border border-border hover:border-ring/50 cursor-pointer transition-colors has-checked:border-ring has-checked:bg-accent/5",children:[I,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[k,t.jsx(Z,{children:t.jsxs(Y,{children:[P,t.jsx(Q,{className:"max-w-xs",children:t.jsx("p",{className:"text-xs",children:"Exposes meta-tools for discovery + sandboxed execution (GATEWAY_RUN_CODE). Reduces overhead on large surfaces by shifting work into a controlled runtime."})})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Maximum flexibility - AI can write code to orchestrate tools"})]}),t.jsx(Re,{id:"mode-code",value:"code_execution"}),t.jsx(qe,{variant:"outline",className:"absolute -top-2.5 left-1/2 -translate-x-1/2 bg-background z-10",children:"Recommended"})]}),e[20]=E):E=e[20];let L;e[21]!==n?(L=t.jsxs("div",{className:"flex flex-col gap-3",children:[b,t.jsxs(ts,{value:n,onValueChange:c,className:"flex flex-col gap-4.5",children:[j,C,E]})]}),e[21]=n,e[22]=L):L=e[22];let B;e[23]!==r.href?(B=t.jsx(ns,{gatewayUrl:r.href}),e[23]=r.href,e[24]=B):B=e[24];let A,M;e[25]!==r.href||e[26]!==u?(A=t.jsx(is,{gatewayUrl:r.href,serverName:u}),M=t.jsx(rs,{gatewayUrl:r.href,serverName:u}),e[25]=r.href,e[26]=u,e[27]=A,e[28]=M):(A=e[27],M=e[28]);let h;e[29]!==B||e[30]!==A||e[31]!==M?(h=t.jsx("div",{className:"flex flex-col gap-3 pt-2",children:t.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[B,A,M]})}),e[29]=B,e[30]=A,e[31]=M,e[32]=h):h=e[32];let N;e[33]!==L||e[34]!==h?(N=t.jsxs(Nt,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[f,t.jsxs("div",{className:"flex flex-col gap-6",children:[L,h]})]}),e[33]=L,e[34]=h,e[35]=N):N=e[35];let z;return e[36]!==l||e[37]!==s||e[38]!==N?(z=t.jsx(_t,{open:s,onOpenChange:l,children:N}),e[36]=l,e[37]=s,e[38]=N,e[39]=z):z=e[39],z}function cs(o){const e=R.c(32),{form:s,icon:l,gatewayId:i}=o,[n]=jt(),[a,m]=yt(i);let c;e[0]!==s?(c=s.watch("title")||"Agent",e[0]=s,e[1]=c):c=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(pt,{}),e[2]=r):r=e[2];let d;e[3]!==l||e[4]!==c?(d=t.jsx(Ee,{icon:l,name:c,size:"lg",className:"shrink-0 shadow-sm",fallbackIcon:r}),e[3]=l,e[4]=c,e[5]=d):d=e[5];let u;e[6]!==s.control?(u=t.jsx(be,{control:s.control,name:"status",render:fs}),e[6]=s.control,e[7]=u):u=e[7];let f;e[8]!==d||e[9]!==u?(f=t.jsxs("div",{className:"flex items-start justify-between",children:[d,u]}),e[8]=d,e[9]=u,e[10]=f):f=e[10];let b;e[11]!==s.control?(b=t.jsxs("div",{className:"flex flex-col",children:[t.jsx(be,{control:s.control,name:"title",render:us}),t.jsx(be,{control:s.control,name:"description",render:ms})]}),e[11]=s.control,e[12]=b):b=e[12];let x;e[13]!==f||e[14]!==b?(x=t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[f,b]}),e[13]=f,e[14]=b,e[15]=x):x=e[15];let p;e[16]!==n||e[17]!==s.control?(p=n&&t.jsx("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:t.jsx(be,{control:s.control,name:"tool_selection_mode",render:ds})}),e[16]=n,e[17]=s.control,e[18]=p):p=e[18];let y;e[19]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsxs("div",{children:[t.jsx("h4",{className:"text-sm font-medium text-foreground mb-1",children:"System Prompt"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Stored locally for now"})]}),e[19]=y):y=e[19];let j;e[20]!==m?(j=C=>m(C.target.value),e[20]=m,e[21]=j):j=e[21];let v;e[22]!==a||e[23]!==j?(v=t.jsxs("div",{className:"flex flex-col gap-3 p-5",children:[y,t.jsx(Mt,{value:a,onChange:j,placeholder:"Enter system prompt instructions...",className:"min-h-[240px] resize-none text-sm leading-relaxed"})]}),e[22]=a,e[23]=j,e[24]=v):v=e[24];let g;e[25]!==v||e[26]!==x||e[27]!==p?(g=t.jsxs("div",{className:"flex flex-col",children:[x,p,v]}),e[25]=v,e[26]=x,e[27]=p,e[28]=g):g=e[28];let _;return e[29]!==s||e[30]!==g?(_=t.jsx("div",{className:"flex flex-col h-full overflow-auto",children:t.jsx(wt,{...s,children:g})}),e[29]=s,e[30]=g,e[31]=_):_=e[31],_}function ds(o){const{field:e}=o;return t.jsxs(ve,{children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(Ct,{className:"mb-0",children:"Selection Mode"}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(Z,{children:t.jsxs(Y,{children:[t.jsx(J,{asChild:!0,children:t.jsx(V,{type:"button",variant:"ghost",size:"icon",className:"size-7","aria-label":"Selection mode help",children:t.jsx(je,{size:14,className:"text-muted-foreground"})})}),t.jsx(Q,{side:"left",className:"max-w-sm",children:t.jsxs("div",{className:"text-xs space-y-1",children:[t.jsxs("div",{children:[t.jsx("strong",{children:"Include:"})," Only selected items are exposed."]}),t.jsxs("div",{children:[t.jsx("strong",{children:"Exclude:"})," All items except selected ones are exposed."]})]})})]})}),t.jsxs(Rt,{value:e.value,onValueChange:e.onChange,children:[t.jsx(Se,{children:t.jsx(zt,{className:"w-[180px]",children:t.jsx(At,{})})}),t.jsxs(Et,{children:[t.jsx(Ue,{value:"inclusion",children:"Include Selected"}),t.jsx(Ue,{value:"exclusion",children:"Exclude Selected"})]})]})]})]}),t.jsx(Ne,{})]})}function ms(o){const{field:e}=o;return t.jsxs(ve,{className:"w-full space-y-0",children:[t.jsx(Se,{children:t.jsx(Pe,{...e,value:e.value||"",className:"h-auto text-base text-muted-foreground leading-6 px-0 border-transparent hover:border-input focus:border-input bg-transparent transition-all",placeholder:"Add a description..."})}),t.jsx(Ne,{})]})}function us(o){const{field:e}=o;return t.jsxs(ve,{className:"w-full space-y-0",children:[t.jsx(Se,{children:t.jsx(Pe,{...e,className:"h-auto text-lg! font-medium leading-7 px-0 border-transparent hover:border-input focus:border-input bg-transparent transition-all",placeholder:"Agent Name"})}),t.jsx(Ne,{})]})}function fs(o){const{field:e}=o;return t.jsxs(ve,{children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(qe,{variant:e.value==="active"?"success":"outline",children:e.value==="active"?"Active":"Inactive"}),t.jsx(Se,{children:t.jsx(Pt,{checked:e.value==="active",onCheckedChange:s=>e.onChange(s?"active":"inactive")})})]}),t.jsx(Ne,{})]})}function hs(o){const e=R.c(81),{gateway:s,gatewayId:l,requestedTabId:i}=o,a=ot().location.href,m=lt();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={from:"/$org/gateways/$gatewayId"},e[0]=c):c=e[0];const r=Fe(c),d=xt();let u;e[1]===Symbol.for("react.memo_cache_sentinel")?(u={},e[1]=u):u=e[1];const f=We(u);let b;e[2]!==f?(b=f.map(ps),e[2]=f,e[3]=b):b=e[3];const x=b,{promptsMap:p}=gt(x),{resourcesMap:y}=bt(x);let j;if(e[4]!==f){j=new Map;for(const T of f)T.tools&&T.tools.length>0&&j.set(T.id,T.tools.map(xs));e[4]=f,e[5]=j}else j=e[5];let v;e[6]!==j||e[7]!==s?(v=()=>Le(s,j),e[6]=j,e[7]=s,e[8]=v):v=e[8];const[g,_]=S.useState(v);let C;e[9]!==s?(C=()=>Oe(s),e[9]=s,e[10]=C):C=e[10];const[I,k]=S.useState(C);let P;e[11]!==s?(P=()=>Be(s),e[11]=s,e[12]=P):P=e[12];const[E,L]=S.useState(P),[B,A]=S.useState(!1),[M,h]=S.useState(!1);let N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=T=>{_(T),A(!0)},e[13]=N):N=e[13];const z=N;let $;e[14]===Symbol.for("react.memo_cache_sentinel")?($=T=>{k(T),A(!0)},e[14]=$):$=e[14];const G=$;let W;e[15]===Symbol.for("react.memo_cache_sentinel")?(W=T=>{L(T),A(!0)},e[15]=W):W=e[15];const q=W;let F;e[16]===Symbol.for("react.memo_cache_sentinel")?(F=nt(os),e[16]=F):F=e[16];const _e=s.tool_selection_mode??"inclusion";let ce;e[17]!==s.description||e[18]!==s.status||e[19]!==s.title||e[20]!==_e?(ce={resolver:F,defaultValues:{title:s.title,description:s.description,status:s.status,tool_selection_mode:_e}},e[17]=s.description,e[18]=s.status,e[19]=s.title,e[20]=_e,e[21]=ce):ce=e[21];const O=it(ce),we=O.formState.isDirty||B;let de;e[22]!==d.update||e[23]!==j||e[24]!==O||e[25]!==l||e[26]!==E||e[27]!==I||e[28]!==g?(de=async()=>{const T=O.getValues(),$e=ls(g,I,E,j);await d.update.mutateAsync({id:l,data:{title:T.title,description:T.description,status:T.status,tool_selection_mode:T.tool_selection_mode,connections:$e}}),O.reset(T),A(!1)},e[22]=d.update,e[23]=j,e[24]=O,e[25]=l,e[26]=E,e[27]=I,e[28]=g,e[29]=de):de=e[29];const Ce=de;let me;e[30]!==j||e[31]!==O||e[32]!==s?(me=()=>{O.reset({title:s.title,description:s.description,status:s.status,tool_selection_mode:s.tool_selection_mode??"inclusion"}),_(Le(s,j)),k(Oe(s)),L(Be(s)),A(!1)},e[30]=j,e[31]=O,e[32]=s,e[33]=me):me=e[33];const ke=me;let ue;e[34]===Symbol.for("react.memo_cache_sentinel")?(ue=[{id:"settings",label:"Settings"},{id:"tools",label:"Tools"},{id:"resources",label:"Resources"},{id:"prompts",label:"Prompts"}],e[34]=ue):ue=e[34];const De=ue,D=De.some(T=>T.id===i)?i:"settings";let fe;e[35]!==r?(fe=T=>{r({search:$e=>({...$e,tab:T}),replace:!0})},e[35]=r,e[36]=fe):fe=e[36];const Ie=fe,ae=d.update.isPending;let K;e[37]!==m.history?(K=()=>m.history.back(),e[37]=m.history,e[38]=K):K=e[38];let X;e[39]!==D||e[40]!==Ie?(X=t.jsx(Ot,{children:t.jsx($t,{tabs:De,activeTab:D,onTabChange:Ie})}),e[39]=D,e[40]=Ie,e[41]=X):X=e[41];let ee;e[42]!==ke||e[43]!==Ce||e[44]!==we||e[45]!==ae?(ee=we&&t.jsxs(t.Fragment,{children:[t.jsx(Z,{children:t.jsxs(Y,{delayDuration:0,children:[t.jsx(J,{asChild:!0,children:t.jsx("span",{className:"inline-block",children:t.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:ae,onClick:ke,"aria-label":"Cancel",children:t.jsx(Lt,{size:14})})})}),t.jsx(Q,{side:"bottom",children:"Cancel"})]})}),t.jsx(Z,{children:t.jsxs(Y,{delayDuration:0,children:[t.jsx(J,{asChild:!0,children:t.jsx("span",{className:"inline-block",children:t.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:ae,onClick:Ce,"aria-label":"Save",children:ae?t.jsx(ze,{size:14,className:"animate-spin"}):t.jsx(Ke,{size:14})})})}),t.jsx(Q,{side:"bottom",children:"Save"})]})})]}),e[42]=ke,e[43]=Ce,e[44]=we,e[45]=ae,e[46]=ee):ee=e[46];let he;e[47]===Symbol.for("react.memo_cache_sentinel")?(he=()=>h(!0),e[47]=he):he=e[47];let xe;e[48]===Symbol.for("react.memo_cache_sentinel")?(xe=t.jsx(Z,{children:t.jsxs(Y,{delayDuration:0,children:[t.jsx(J,{asChild:!0,children:t.jsx("span",{className:"inline-block",children:t.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:he,"aria-label":"Share",children:t.jsx(Xe,{size:14})})})}),t.jsx(Q,{side:"bottom",children:"Share"})]})}),e[48]=xe):xe=e[48];const Te=s.icon??"cpu_chip";let te;e[49]!==s.title||e[50]!==Te||e[51]!==a?(te=t.jsx(ut,{title:s.title,url:a,icon:Te}),e[49]=s.title,e[50]=Te,e[51]=a,e[52]=te):te=e[52];let se;e[53]!==ee||e[54]!==te?(se=t.jsxs(Bt,{children:[ee,xe,te]}),e[53]=ee,e[54]=te,e[55]=se):se=e[55];let pe;e[56]===Symbol.for("react.memo_cache_sentinel")?(pe=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ze,{size:32,className:"animate-spin text-muted-foreground"})}),e[56]=pe):pe=e[56];let oe;e[57]!==D||e[58]!==p||e[59]!==y||e[60]!==O||e[61]!==s.icon||e[62]!==l||e[63]!==E||e[64]!==I||e[65]!==g?(oe=D==="settings"?t.jsx(cs,{form:O,icon:s.icon,gatewayId:l}):D==="tools"?t.jsx(ft,{toolSet:g,onToolSetChange:z}):D==="resources"?t.jsx(Xt,{resourceSet:I,onResourceSetChange:G,connectionResources:y}):D==="prompts"?t.jsx(Yt,{promptSet:E,onPromptSetChange:q,connectionPrompts:p}):null,e[57]=D,e[58]=p,e[59]=y,e[60]=O,e[61]=s.icon,e[62]=l,e[63]=E,e[64]=I,e[65]=g,e[66]=oe):oe=e[66];let le;e[67]!==oe?(le=t.jsx(S.Suspense,{fallback:pe,children:oe}),e[67]=oe,e[68]=le):le=e[68];let ne;e[69]!==D||e[70]!==le?(ne=t.jsx("div",{className:"flex h-full w-full bg-background overflow-hidden",children:t.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-hidden",children:t.jsx("div",{className:"h-full overflow-auto",children:t.jsx(Ve,{children:le},D)})})}),e[69]=D,e[70]=le,e[71]=ne):ne=e[71];let ie;e[72]!==s||e[73]!==M?(ie=t.jsx(as,{open:M,onOpenChange:h,gateway:s}),e[72]=s,e[73]=M,e[74]=ie):ie=e[74];let ge;return e[75]!==K||e[76]!==X||e[77]!==se||e[78]!==ne||e[79]!==ie?(ge=t.jsxs(Ft,{onBack:K,children:[X,se,ne,ie]}),e[75]=K,e[76]=X,e[77]=se,e[78]=ne,e[79]=ie,e[80]=ge):ge=e[80],ge}function xs(o){return o.name}function ps(o){return o.id}function gs(){const o=R.c(10);let e;o[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/gateways/$gatewayId"},o[0]=e):e=o[0];const s=Fe(e);let l;o[1]===Symbol.for("react.memo_cache_sentinel")?(l={from:"/shell/$org/gateways/$gatewayId"},o[1]=l):l=o[1];const{gatewayId:i,org:n}=tt(l);let a;o[2]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/shell/$org/gateways/$gatewayId"},o[2]=a):a=o[2];const c=st(a).tab||"settings",r=ht(i);if(!r){let u;return o[3]!==s||o[4]!==n?(u=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(rt,{title:"Agent not found",description:"This Agent may have been deleted or you may not have access.",actions:t.jsx(V,{variant:"outline",onClick:()=>s({to:"/$org/gateways",params:{org:n}}),children:"Back to agents"})})}),o[3]=s,o[4]=n,o[5]=u):u=o[5],u}let d;return o[6]!==r||o[7]!==i||o[8]!==c?(d=t.jsx(hs,{gateway:r,gatewayId:i,requestedTabId:c}),o[6]=r,o[7]=i,o[8]=c,o[9]=d):d=o[9],d}function bs(){const o=R.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ve,{children:t.jsx(S.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(ze,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(gs,{})})}),o[0]=e):e=o[0],e}function ao(){const o=R.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(bs,{}),o[0]=e):e=o[0],e}export{ao as default};
1
+ import{r as S,_ as ye,y as re,I as U,z as w,c as R,j as t,f as Fe,d as tt,b as st,k as ot,af as lt,B as nt,E as it,t as Ae}from"./index-Diww4UW3.js";import{I as Ee,E as rt}from"./empty-state-wP9uukGJ.js";import{E as Ve}from"./error-boundary-BUvK8Sry.js";import{C as Ge}from"./checkbox-DYViXeUc.js";import{c as H,B as V}from"./button-CGmrzkpY.js";import{i as at}from"./ArrowLeft-B3km7toT.js";import{u as We}from"./use-connection-CCXutWLD.js";import{C as ct}from"./collection-search-BVb42O45.js";import{I as Pe}from"./input-CrURMEZe.js";import{s as dt}from"./Plus-CdG75X26.js";import{i as mt}from"./X-C18ho617.js";import{P as ut}from"./pin-to-sidebar-button-DIwkO0Tx.js";import{T as ft}from"./tool-set-selector-B9rTBahU.js";import{b as ht,a as xt,i as pt}from"./use-gateway-DD-xEZju.js";import{u as gt,a as bt}from"./use-connection-resources-D0st76bP.js";import{u as jt,a as yt}from"./use-gateway-system-prompt-zGJSEzce.js";import{s as He}from"./slugify-CEUa2lfQ.js";import{B as qe}from"./badge-BVO6I0sW.js";import{a as vt,D as St,c as Nt,d as _t}from"./dialog-DJJ2cvEE.js";import{F as be,a as wt,b as ve,d as Se,f as Ne,c as Ct}from"./form-DiGzBnRK.js";import{I as kt,R as It,a as Tt}from"./index-DUA-vRuy.js";import{R as $t}from"./resource-tabs-ACbF96qo.js";import{S as Rt,a as zt,b as At,c as Et,d as Ue}from"./select-C8LOz7vA.js";import{S as Pt}from"./switch-DJBd8Fzb.js";import{T as Mt}from"./textarea-C_zgj3Sp.js";import{a as Z,c as Y,b as J,T as Q}from"./tooltip-Suu_Gpqh.js";import{i as Ze}from"./Check-BQkm1TiP.js";import{i as Dt}from"./Code01-qXTn9GK9.js";import{a as Ut}from"./Copy01-CEYn2daS.js";import{i as Lt}from"./FlipBackward-C-K9FamE.js";import{i as je}from"./InfoCircle-BgIkbjJr.js";import{i as ze}from"./Loading01-Ae5ezbtD.js";import{a as Ot,V as Bt,b as Ft}from"./layout-kp8TTJc9.js";import"./connection-ChwHK0-S.js";import"./project-context-provider-DulCVL2k.js";import"./use-collections-CXETocKO.js";import"./useMutation-Dl1MMkEC.js";import"./SearchMd-GFaonOaJ.js";import"./use-organization-settings-CQXtXtZs.js";import"./localstorage-keys-BVANkONM.js";import"./useQuery-Bvk0U2ed.js";import"./ChevronDown-DP6jvip7.js";const Ye=({size:o=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"M4 7h11m0 0-4 4m4-4-4-4M4 17h16m0 0-4 4m4-4-4-4"}));Ye.displayName="ArrowsRight";const Je=({size:o=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"}));Je.displayName="Circle";const Qe=({size:o=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"M10 17.659V20a2 2 0 1 0 4 0v-2.341M12 2v1m-9 9H2m3.5-6.5-.6-.6m13.6.6.6-.6M22 12h-1m-3 0a6 6 0 1 1-12 0 6 6 0 0 1 12 0Z"}));Qe.displayName="Lightbulb02";const Ke=({size:o=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"M7 3v3.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C7.76 8 8.04 8 8.6 8h6.8c.56 0 .84 0 1.054-.109a1 1 0 0 0 .437-.437C17 7.24 17 6.96 17 6.4V4m0 17v-6.4c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C16.24 13 15.96 13 15.4 13H8.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C7 13.76 7 14.04 7 14.6V21M21 9.325V16.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h6.875c.489 0 .733 0 .963.055.204.05.4.13.579.24.201.123.374.296.72.642l3.126 3.126c.346.346.519.519.642.72.11.18.19.374.24.579.055.23.055.474.055.963Z"}));Ke.displayName="Save01";const Xe=({size:o=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"m8.59 13.51 6.83 3.98m-.01-10.98-6.82 3.98M21 5a3 3 0 1 1-6 0 3 3 0 0 1 6 0ZM9 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm12 7a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}));Xe.displayName="Share07";const Me=ye(["inclusion","exclusion"]).describe("Tool selection mode: 'inclusion' = include selected (default), 'exclusion' = exclude selected"),Vt=re({connection_id:w().describe("Connection ID"),selected_tools:U(w()).nullable().describe("Selected tool names. With 'inclusion' mode: null = all tools included. With 'exclusion' mode: null = entire connection excluded"),selected_resources:U(w()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. With 'inclusion' mode: null = all resources included."),selected_prompts:U(w()).nullable().describe("Selected prompt names. With 'inclusion' mode: null = all prompts included. With 'exclusion' mode: null = entire connection excluded.")}),Gt=re({id:w().describe("Unique identifier for the gateway"),title:w().describe("Human-readable name for the gateway"),description:w().nullable().describe("Description of the gateway"),icon:w().nullable().optional().describe("Icon URL for the gateway"),created_at:w().describe("When the gateway was created"),updated_at:w().describe("When the gateway was last updated"),created_by:w().describe("User ID who created the gateway"),updated_by:w().optional().describe("User ID who last updated the gateway"),organization_id:w().describe("Organization ID this gateway belongs to"),tool_selection_mode:Me.describe("Tool selection mode: 'inclusion' = include selected, 'exclusion' = exclude selected"),status:ye(["active","inactive"]).describe("Current status"),connections:U(Vt).describe("Connections with their selected tools (behavior depends on tool_selection_mode)")});re({title:w().min(1).max(255).describe("Name for the gateway"),description:w().nullable().optional().describe("Optional description"),tool_selection_mode:Me.optional().default("inclusion").describe("Tool selection mode (defaults to 'inclusion')"),icon:w().nullable().optional().describe("Optional icon URL"),status:ye(["active","inactive"]).optional().default("active").describe("Initial status"),connections:U(re({connection_id:w().describe("Connection ID"),selected_tools:U(w()).nullable().optional().describe("Selected tool names (null/undefined = all tools or full exclusion)"),selected_resources:U(w()).nullable().optional().describe("Selected resource URIs or patterns with * and ** wildcards (null/undefined = all resources)"),selected_prompts:U(w()).nullable().optional().describe("Selected prompt names (null/undefined = all prompts or full exclusion)")})).describe("Connections to include/exclude (can be empty for exclusion mode)")});re({title:w().min(1).max(255).optional().describe("New name"),description:w().nullable().optional().describe("New description (null to clear)"),tool_selection_mode:Me.optional().describe("New tool selection mode"),icon:w().nullable().optional().describe("New icon URL (null to clear)"),status:ye(["active","inactive"]).optional().describe("New status"),connections:U(re({connection_id:w().describe("Connection ID"),selected_tools:U(w()).nullable().optional().describe("Selected tool names (null/undefined = all tools or full exclusion)"),selected_resources:U(w()).nullable().optional().describe("Selected resource URIs or patterns with * and ** wildcards (null/undefined = all resources)"),selected_prompts:U(w()).nullable().optional().describe("Selected prompt names (null/undefined = all prompts or full exclusion)")})).optional().describe("New connections (replaces existing)")});const Wt=S.memo(function(e){const s=R.c(20),{connection:l,isSelected:i,hasItemsEnabled:n,activeItemsCount:a,totalItemsCount:m,onSelect:c,onToggle:r}=e,d=i?"bg-accent/50":"hover:bg-muted/50";let u;s[0]!==d?(u=H("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",d),s[0]=d,s[1]=u):u=s[1];let f;s[2]!==l.icon||s[3]!==l.title?(f=t.jsx(Ee,{icon:l.icon,name:l.title,size:"xs"}),s[2]=l.icon,s[3]=l.title,s[4]=f):f=s[4];let b;s[5]!==l.title?(b=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:l.title})}),s[5]=l.title,s[6]=b):b=s[6];let x;s[7]!==c||s[8]!==f||s[9]!==b?(x=t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:c,children:[f,b]}),s[7]=c,s[8]=f,s[9]=b,s[10]=x):x=s[10];let p;s[11]!==a||s[12]!==n||s[13]!==r||s[14]!==m?(p=m>0&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[a,"/",m]}),t.jsx(Ge,{checked:n,onCheckedChange:r,onClick:qt})]}),s[11]=a,s[12]=n,s[13]=r,s[14]=m,s[15]=p):p=s[15];let y;return s[16]!==u||s[17]!==x||s[18]!==p?(y=t.jsxs("div",{className:u,children:[x,p]}),s[16]=u,s[17]=x,s[18]=p,s[19]=y):y=s[19],y}),Ht=S.memo(function(e){const s=R.c(18),{connectionId:l,item:i,isSelected:n,onToggle:a}=e,m=`item-${l}-${i.id}`,c=n?"text-foreground":"text-muted-foreground";let r;s[0]!==c?(r=H("text-sm font-medium",c),s[0]=c,s[1]=r):r=s[1];let d;s[2]!==i.name||s[3]!==r?(d=t.jsx("div",{className:"flex items-center gap-2 mb-1",children:t.jsx("span",{className:r,children:i.name})}),s[2]=i.name,s[3]=r,s[4]=d):d=s[4];let u;s[5]!==i.description?(u=i.description&&t.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:i.description}),s[5]=i.description,s[6]=u):u=s[6];let f;s[7]!==d||s[8]!==u?(f=t.jsxs("div",{className:"flex-1 min-w-0",children:[d,u]}),s[7]=d,s[8]=u,s[9]=f):f=s[9];const b=`item-${l}-${i.id}`;let x;s[10]!==n||s[11]!==a||s[12]!==b?(x=t.jsx("div",{className:"flex items-center shrink-0",children:t.jsx(Ge,{id:b,checked:n,onCheckedChange:a,onClick:Zt})}),s[10]=n,s[11]=a,s[12]=b,s[13]=x):x=s[13];let p;return s[14]!==m||s[15]!==f||s[16]!==x?(p=t.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:m,children:[f,x]}),s[14]=m,s[15]=f,s[16]=x,s[17]=p):p=s[17],p});function et({itemSet:o,onItemSetChange:e,getItems:s,itemLabel:l,emptyItemsMessage:i,extraContent:n}){const[a,m]=S.useState(""),c=S.useDeferredValue(a),[r,d]=S.useState("all"),[u,f]=S.useState(!1),b=S.useRef(new Set(Object.keys(o))),x=We({searchTerm:c.trim()||void 0}),p=b.current,y=[...p.values()].map(h=>x.find(N=>N.id===h)).filter(h=>h!==void 0),j=x.filter(h=>!p.has(h.id)),v=[...y,...j],g=h=>{const N=o[h];return N!==void 0&&N.length>0},_=v.filter(h=>{if(r==="all")return!0;const N=g(h.id);return r==="selected"?N:r==="unselected"?!N:!0}),[C,I]=S.useState(v[0]?.id??null),k=C?v.find(h=>h.id===C)??null:null,P=k?s(k):[],E=(h,N)=>o[h]?.includes(N)??!1,L=(h,N)=>{const z=o[h]??[],$=z.includes(N),G={...o};if($){const W=z.filter(q=>q!==N);W.length===0?delete G[h]:G[h]=W}else G[h]=[...z,N];e(G)},B=h=>{const N=v.find(F=>F.id===h);if(!N)return;const z=s(N);if(z.length===0)return;const $=o[h]??[],G=z.map(F=>F.id),W=$.length>0&&G.every(F=>$.includes(F)),q={...o};W?delete q[h]:(q[h]=G,I(h)),e(q)},A=h=>{I(h),f(!0)},M=()=>{f(!1)};return t.jsxs("div",{className:"flex h-full",children:[t.jsxs("div",{className:H("w-full md:w-80 border-r border-border flex flex-col",u&&"hidden md:flex"),children:[t.jsx(ct,{value:a,onChange:m,placeholder:"Search Connections..."}),t.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[t.jsx("button",{onClick:()=>d("all"),className:H("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",r==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),t.jsx("button",{onClick:()=>d("selected"),className:H("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",r==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),t.jsx("button",{onClick:()=>d("unselected"),className:H("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",r==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),t.jsx("div",{className:"flex-1 overflow-auto",children:_.length===0?t.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:a?"No connections found":r==="selected"?"No servers selected":r==="unselected"?"No unselected servers":"No connections available"}):t.jsx("div",{className:"p-2 space-y-1",children:_.map(h=>{const z=s(h).length,$=o[h.id]?.length??0;return t.jsx(Wt,{connection:h,isSelected:C===h.id,hasItemsEnabled:g(h.id),activeItemsCount:$,totalItemsCount:z,onSelect:()=>A(h.id),onToggle:()=>B(h.id)},h.id)})})})]}),t.jsx("div",{className:H("flex-1 flex-col",u?"flex":"hidden md:flex"),children:k?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[t.jsx(V,{variant:"ghost",size:"sm",onClick:M,className:"h-8 w-8 p-0 shrink-0",children:t.jsx(at,{size:20})}),t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[t.jsx(Ee,{icon:k.icon,name:k.title,size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:k.title}),k.description&&t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:k.description})]})]})]}),n,t.jsx("div",{className:"flex-1 overflow-auto p-4",children:P.length===0?t.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:i||`This connection has no ${l} available`}):t.jsx("div",{className:"space-y-2",children:P.map(h=>t.jsx(Ht,{connectionId:k.id,item:h,isSelected:E(k.id,h.id),onToggle:()=>L(k.id,h.id)},h.id))})})]}):t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsxs("div",{className:"text-sm text-muted-foreground text-center",children:["Select a connection to view its ",l]})})})]})}function qt(o){return o.stopPropagation()}function Zt(o){return o.stopPropagation()}function Yt(o){const e=R.c(6),{promptSet:s,onPromptSetChange:l,connectionPrompts:i}=o;let n;e[0]!==i?(n=c=>(i.get(c.id)??[]).map(Jt),e[0]=i,e[1]=n):n=e[1];const a=n;let m;return e[2]!==a||e[3]!==l||e[4]!==s?(m=t.jsx(et,{itemSet:s,onItemSetChange:l,getItems:a,itemLabel:"prompts",emptyItemsMessage:"This connection has no prompts available"}),e[2]=a,e[3]=l,e[4]=s,e[5]=m):m=e[5],m}function Jt(o){return{id:o.name,name:o.name,description:o.description}}function Qt(o){return o.includes("*")}function Kt(o){const e=R.c(27),{patterns:s,onAddPattern:l,onRemovePattern:i}=o,[n,a]=S.useState("");let m;e[0]!==n||e[1]!==l||e[2]!==s?(m=()=>{const f=n.trim();f&&!s.includes(f)&&(l(f),a(""))},e[0]=n,e[1]=l,e[2]=s,e[3]=m):m=e[3];const c=m;let r;e[4]!==c?(r=f=>{f.key==="Enter"&&(f.preventDefault(),c())},e[4]=c,e[5]=r):r=e[5];const d=r;let u;if(e[6]!==c||e[7]!==d||e[8]!==n||e[9]!==i||e[10]!==s){const f=s.filter(Qt);let b;e[12]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("code",{children:"*"}),e[12]=b):b=e[12];let x;e[13]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsxs("div",{className:"text-xs text-muted-foreground",children:["Add URI patterns to match multiple resources. Use ",b," for single segment and ",t.jsx("code",{children:"**"})," for multiple segments."]}),e[13]=x):x=e[13];let p;e[14]===Symbol.for("react.memo_cache_sentinel")?(p=I=>a(I.target.value),e[14]=p):p=e[14];let y;e[15]!==d||e[16]!==n?(y=t.jsx(Pe,{value:n,onChange:p,onKeyDown:d,placeholder:"e.g., file:///**/*.ts or db://users/*",className:"flex-1 text-sm"}),e[15]=d,e[16]=n,e[17]=y):y=e[17];let j;e[18]!==n?(j=n.trim(),e[18]=n,e[19]=j):j=e[19];const v=!j;let g;e[20]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(dt,{size:16}),e[20]=g):g=e[20];let _;e[21]!==c||e[22]!==v?(_=t.jsx(V,{type:"button",variant:"outline",size:"sm",onClick:c,disabled:v,children:g}),e[21]=c,e[22]=v,e[23]=_):_=e[23];let C;e[24]!==_||e[25]!==y?(C=t.jsxs("div",{className:"flex gap-2",children:[y,_]}),e[24]=_,e[25]=y,e[26]=C):C=e[26],u=t.jsxs("div",{className:"border-b border-border p-4 space-y-3",children:[x,C,f.length>0&&t.jsx("div",{className:"flex flex-wrap gap-2",children:f.map(I=>t.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 bg-muted rounded-md text-xs",children:[t.jsx("code",{className:"text-foreground",children:I}),t.jsx("button",{type:"button",onClick:()=>i(I),className:"text-muted-foreground hover:text-foreground",children:t.jsx(mt,{size:12})})]},I))})]}),e[6]=c,e[7]=d,e[8]=n,e[9]=i,e[10]=s,e[11]=u}else u=e[11];return u}function Xt(o){const e=R.c(23),{resourceSet:s,onResourceSetChange:l,connectionResources:i}=o,[n]=S.useState(null);let a;e[0]!==i?(a=g=>(i.get(g.id)??[]).map(es),e[0]=i,e[1]=a):a=e[1];const m=a;let c;e[2]!==l||e[3]!==s?(c=(g,_)=>{const C=s[g]??[];C.includes(_)||l({...s,[g]:[...C,_]})},e[2]=l,e[3]=s,e[4]=c):c=e[4];const r=c;let d;e[5]!==l||e[6]!==s?(d=(g,_)=>{const I=(s[g]??[]).filter(k=>k!==_);if(I.length===0){const k={...s};delete k[g],l(k)}else l({...s,[g]:I})},e[5]=l,e[6]=s,e[7]=d):d=e[7];const u=d;let f;e[8]!==l?(f=g=>{l(g)},e[8]=l,e[9]=f):f=e[9];const b=f;let x;e[10]!==s||e[11]!==n?(x=n?s[n]??[]:[],e[10]=s,e[11]=n,e[12]=x):x=e[12];const p=x;let y;e[13]!==r||e[14]!==u||e[15]!==n||e[16]!==p?(y=n?t.jsx(Kt,{patterns:p,onAddPattern:g=>r(n,g),onRemovePattern:g=>u(n,g)}):null,e[13]=r,e[14]=u,e[15]=n,e[16]=p,e[17]=y):y=e[17];const j=y;let v;return e[18]!==j||e[19]!==m||e[20]!==b||e[21]!==s?(v=t.jsx("div",{className:"h-full",children:t.jsx(et,{itemSet:s,onItemSetChange:b,getItems:m,itemLabel:"resources",emptyItemsMessage:"This connection has no resources available",extraContent:j})}),e[18]=j,e[19]=m,e[20]=b,e[21]=s,e[22]=v):v=e[22],v}function es(o){return{id:o.uri,name:o.name||o.uri,description:o.description||o.uri}}function ts(o){const e=R.c(8);let s,l;e[0]!==o?({className:s,...l}=o,e[0]=o,e[1]=s,e[2]=l):(s=e[1],l=e[2]);let i;e[3]!==s?(i=H("grid gap-3",s),e[3]=s,e[4]=i):i=e[4];let n;return e[5]!==l||e[6]!==i?(n=t.jsx(It,{"data-slot":"radio-group",className:i,...l}),e[5]=l,e[6]=i,e[7]=n):n=e[7],n}function Re(o){const e=R.c(9);let s,l;e[0]!==o?({className:s,...l}=o,e[0]=o,e[1]=s,e[2]=l):(s=e[1],l=e[2]);let i;e[3]!==s?(i=H("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",s),e[3]=s,e[4]=i):i=e[4];let n;e[5]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(Tt,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:t.jsx(Je,{className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})}),e[5]=n):n=e[5];let a;return e[6]!==l||e[7]!==i?(a=t.jsx(kt,{"data-slot":"radio-group-item",className:i,...l,children:n}),e[6]=l,e[7]=i,e[8]=a):a=e[8],a}function ss(o){const s=new TextEncoder().encode(o),l=Array.from(s,i=>String.fromCharCode(i)).join("");return btoa(l)}const os=Gt.pick({title:!0,description:!0,status:!0,tool_selection_mode:!0}).extend({title:w().min(1,"Name is required").max(255)});function Le(o,e){const s={};for(const l of o.connections)if(l.selected_tools===null){const i=e.get(l.connection_id)??[];i.length>0&&(s[l.connection_id]=i)}else l.selected_tools.length>0&&(s[l.connection_id]=l.selected_tools);return s}function Oe(o){const e={};for(const s of o.connections)s.selected_resources!==null&&s.selected_resources!==void 0&&s.selected_resources.length>0&&(e[s.connection_id]=s.selected_resources);return e}function Be(o){const e={};for(const s of o.connections)s.selected_prompts!==null&&s.selected_prompts!==void 0&&s.selected_prompts.length>0&&(e[s.connection_id]=s.selected_prompts);return e}function ls(o,e,s,l){const i=new Set([...Object.keys(o),...Object.keys(e),...Object.keys(s)]);return Array.from(i).map(n=>{const a=o[n]??[],m=l.get(n)??[],c=m.length>0&&m.every(r=>a.includes(r));return{connection_id:n,selected_tools:a.length===0||c?null:a,selected_resources:e[n]??null,selected_prompts:s[n]??null}})}function ns(o){const e=R.c(10),{gatewayUrl:s}=o,[l,i]=S.useState(!1);let n;e[0]!==s?(n=async()=>{await navigator.clipboard.writeText(s),i(!0),Ae.success("Agent URL copied to clipboard"),setTimeout(()=>i(!1),2e3)},e[0]=s,e[1]=n):n=e[1];const a=n;let m;e[2]!==l?(m=l?t.jsx(Ze,{size:20,className:"text-green-600"}):t.jsx(Ut,{size:20}),e[2]=l,e[3]=m):m=e[3];const c=l?"Copied!":"Copy URL";let r;e[4]!==c?(r=t.jsx("span",{className:"text-xs font-medium",children:c}),e[4]=c,e[5]=r):r=e[5];let d;return e[6]!==a||e[7]!==m||e[8]!==r?(d=t.jsxs(V,{type:"button",variant:"outline",onClick:a,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[m,r]}),e[6]=a,e[7]=m,e[8]=r,e[9]=d):d=e[9],d}function is(o){const e=R.c(7),{gatewayUrl:s,serverName:l}=o;let i;e[0]!==s||e[1]!==l?(i=()=>{const r=He(l),u=ss(JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Cursor"}},null,2)),f=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(r)}&config=${encodeURIComponent(u)}`;window.open(f,"_blank"),Ae.success("Opening Cursor...")},e[0]=s,e[1]=l,e[2]=i):i=e[2];const n=i;let a,m;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("img",{src:"/logos/cursor.svg",alt:"Cursor",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(11%) sepia(8%) saturate(785%) hue-rotate(1deg) brightness(95%) contrast(89%)"}}),m=t.jsx("span",{className:"text-xs font-medium",children:"Install on Cursor"}),e[3]=a,e[4]=m):(a=e[3],m=e[4]);let c;return e[5]!==n?(c=t.jsxs(V,{type:"button",variant:"outline",onClick:n,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[a,m]}),e[5]=n,e[6]=c):c=e[6],c}function rs(o){const e=R.c(11),{gatewayUrl:s,serverName:l}=o,[i,n]=S.useState(!1);let a;e[0]!==s||e[1]!==l?(a=async()=>{const f=He(l),x=JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Claude Code"}}),p=`claude mcp add-json ${f} '${x.replace(/'/g,"'\\''")}'`;await navigator.clipboard.writeText(p),n(!0),Ae.success("Claude Code command copied to clipboard"),setTimeout(()=>n(!1),2e3)},e[0]=s,e[1]=l,e[2]=a):a=e[2];const m=a;let c;e[3]!==i?(c=i?t.jsx(Ze,{size:20,className:"text-green-600"}):t.jsx("img",{src:"/logos/Claude Code.svg",alt:"Claude Code",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(55%) sepia(31%) saturate(1264%) hue-rotate(331deg) brightness(92%) contrast(86%)"}}),e[3]=i,e[4]=c):c=e[4];const r=i?"Copied!":"Install on Claude";let d;e[5]!==r?(d=t.jsx("span",{className:"text-xs font-medium",children:r}),e[5]=r,e[6]=d):d=e[6];let u;return e[7]!==m||e[8]!==c||e[9]!==d?(u=t.jsxs(V,{type:"button",variant:"outline",onClick:m,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[c,d]}),e[7]=m,e[8]=c,e[9]=d,e[10]=u):u=e[10],u}function as(o){const e=R.c(40),{open:s,onOpenChange:l,gateway:i}=o,[n,a]=S.useState("code_execution");let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=$=>{($==="passthrough"||$==="smart_tool_selection"||$==="code_execution")&&a($)},e[0]=m):m=e[0];const c=m;let r;e[1]!==i.id||e[2]!==n?(r=new URL(`/mcp/gateway/${i.id}`,window.location.origin),r.searchParams.set("mode",n),e[1]=i.id,e[2]=n,e[3]=r):r=e[3];let d;e[4]!==i.id||e[5]!==i.title?(d=i.title||`agent-${i.id.slice(0,8)}`,e[4]=i.id,e[5]=i.title,e[6]=d):d=e[6];const u=d;let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(vt,{children:t.jsx(St,{children:"Share Agent"})}),e[7]=f):f=e[7];let b;e[8]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("div",{children:t.jsx("h4",{className:"text-sm font-medium text-foreground mt-1",children:"How should this agent work?"})}),e[8]=b):b=e[8];let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(Ye,{className:"size-5 text-muted-foreground"})}),e[9]=x):x=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Direct access"}),e[10]=p):p=e[10];let y;e[11]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(J,{asChild:!0,children:t.jsx(je,{className:"size-3.5 text-muted-foreground"})}),e[11]=y):y=e[11];let j;e[12]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsxs("label",{htmlFor:"mode-passthrough",className:"flex items-center gap-3 px-3 py-5 rounded-lg border border-border hover:border-ring/50 cursor-pointer transition-colors has-checked:border-ring has-checked:bg-accent/5",children:[x,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[p,t.jsx(Z,{children:t.jsxs(Y,{children:[y,t.jsx(Q,{className:"max-w-xs",children:t.jsx("p",{className:"text-xs",children:"All tools are exposed directly via tools/list. Best for small tool surfaces with deterministic behavior."})})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Best for small teams or when you need predictable behavior"})]}),t.jsx(Re,{id:"mode-passthrough",value:"passthrough"})]}),e[12]=j):j=e[12];let v;e[13]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(Qe,{className:"size-5 text-muted-foreground"})}),e[13]=v):v=e[13];let g;e[14]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Smart discovery"}),e[14]=g):g=e[14];let _;e[15]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx(J,{asChild:!0,children:t.jsx(je,{className:"size-3.5 text-muted-foreground"})}),e[15]=_):_=e[15];let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsxs("label",{htmlFor:"mode-smart",className:"flex items-center gap-3 px-3 py-5 rounded-lg border border-border hover:border-ring/50 cursor-pointer transition-colors has-checked:border-ring has-checked:bg-accent/5",children:[v,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[g,t.jsx(Z,{children:t.jsxs(Y,{children:[_,t.jsx(Q,{className:"max-w-xs",children:t.jsx("p",{className:"text-xs",children:"Uses meta-tools (GATEWAY_SEARCH_TOOLS, GATEWAY_DESCRIBE_TOOLS, GATEWAY_CALL_TOOL) to keep the tool list small and request details on demand."})})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Ideal for large teams with many tools - AI finds what it needs"})]}),t.jsx(Re,{id:"mode-smart",value:"smart_tool_selection"})]}),e[16]=C):C=e[16];let I;e[17]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(Dt,{className:"size-5 text-muted-foreground"})}),e[17]=I):I=e[17];let k;e[18]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Smart execution"}),e[18]=k):k=e[18];let P;e[19]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(J,{asChild:!0,children:t.jsx(je,{className:"size-3.5 text-muted-foreground"})}),e[19]=P):P=e[19];let E;e[20]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsxs("label",{htmlFor:"mode-code",className:"relative flex items-center gap-3 px-3 py-5 rounded-lg border border-border hover:border-ring/50 cursor-pointer transition-colors has-checked:border-ring has-checked:bg-accent/5",children:[I,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[k,t.jsx(Z,{children:t.jsxs(Y,{children:[P,t.jsx(Q,{className:"max-w-xs",children:t.jsx("p",{className:"text-xs",children:"Exposes meta-tools for discovery + sandboxed execution (GATEWAY_RUN_CODE). Reduces overhead on large surfaces by shifting work into a controlled runtime."})})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Maximum flexibility - AI can write code to orchestrate tools"})]}),t.jsx(Re,{id:"mode-code",value:"code_execution"}),t.jsx(qe,{variant:"outline",className:"absolute -top-2.5 left-1/2 -translate-x-1/2 bg-background z-10",children:"Recommended"})]}),e[20]=E):E=e[20];let L;e[21]!==n?(L=t.jsxs("div",{className:"flex flex-col gap-3",children:[b,t.jsxs(ts,{value:n,onValueChange:c,className:"flex flex-col gap-4.5",children:[j,C,E]})]}),e[21]=n,e[22]=L):L=e[22];let B;e[23]!==r.href?(B=t.jsx(ns,{gatewayUrl:r.href}),e[23]=r.href,e[24]=B):B=e[24];let A,M;e[25]!==r.href||e[26]!==u?(A=t.jsx(is,{gatewayUrl:r.href,serverName:u}),M=t.jsx(rs,{gatewayUrl:r.href,serverName:u}),e[25]=r.href,e[26]=u,e[27]=A,e[28]=M):(A=e[27],M=e[28]);let h;e[29]!==B||e[30]!==A||e[31]!==M?(h=t.jsx("div",{className:"flex flex-col gap-3 pt-2",children:t.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[B,A,M]})}),e[29]=B,e[30]=A,e[31]=M,e[32]=h):h=e[32];let N;e[33]!==L||e[34]!==h?(N=t.jsxs(Nt,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[f,t.jsxs("div",{className:"flex flex-col gap-6",children:[L,h]})]}),e[33]=L,e[34]=h,e[35]=N):N=e[35];let z;return e[36]!==l||e[37]!==s||e[38]!==N?(z=t.jsx(_t,{open:s,onOpenChange:l,children:N}),e[36]=l,e[37]=s,e[38]=N,e[39]=z):z=e[39],z}function cs(o){const e=R.c(32),{form:s,icon:l,gatewayId:i}=o,[n]=jt(),[a,m]=yt(i);let c;e[0]!==s?(c=s.watch("title")||"Agent",e[0]=s,e[1]=c):c=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(pt,{}),e[2]=r):r=e[2];let d;e[3]!==l||e[4]!==c?(d=t.jsx(Ee,{icon:l,name:c,size:"lg",className:"shrink-0 shadow-sm",fallbackIcon:r}),e[3]=l,e[4]=c,e[5]=d):d=e[5];let u;e[6]!==s.control?(u=t.jsx(be,{control:s.control,name:"status",render:fs}),e[6]=s.control,e[7]=u):u=e[7];let f;e[8]!==d||e[9]!==u?(f=t.jsxs("div",{className:"flex items-start justify-between",children:[d,u]}),e[8]=d,e[9]=u,e[10]=f):f=e[10];let b;e[11]!==s.control?(b=t.jsxs("div",{className:"flex flex-col",children:[t.jsx(be,{control:s.control,name:"title",render:us}),t.jsx(be,{control:s.control,name:"description",render:ms})]}),e[11]=s.control,e[12]=b):b=e[12];let x;e[13]!==f||e[14]!==b?(x=t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[f,b]}),e[13]=f,e[14]=b,e[15]=x):x=e[15];let p;e[16]!==n||e[17]!==s.control?(p=n&&t.jsx("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:t.jsx(be,{control:s.control,name:"tool_selection_mode",render:ds})}),e[16]=n,e[17]=s.control,e[18]=p):p=e[18];let y;e[19]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsxs("div",{children:[t.jsx("h4",{className:"text-sm font-medium text-foreground mb-1",children:"System Prompt"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Stored locally for now"})]}),e[19]=y):y=e[19];let j;e[20]!==m?(j=C=>m(C.target.value),e[20]=m,e[21]=j):j=e[21];let v;e[22]!==a||e[23]!==j?(v=t.jsxs("div",{className:"flex flex-col gap-3 p-5",children:[y,t.jsx(Mt,{value:a,onChange:j,placeholder:"Enter system prompt instructions...",className:"min-h-[240px] resize-none text-sm leading-relaxed"})]}),e[22]=a,e[23]=j,e[24]=v):v=e[24];let g;e[25]!==v||e[26]!==x||e[27]!==p?(g=t.jsxs("div",{className:"flex flex-col",children:[x,p,v]}),e[25]=v,e[26]=x,e[27]=p,e[28]=g):g=e[28];let _;return e[29]!==s||e[30]!==g?(_=t.jsx("div",{className:"flex flex-col h-full overflow-auto",children:t.jsx(wt,{...s,children:g})}),e[29]=s,e[30]=g,e[31]=_):_=e[31],_}function ds(o){const{field:e}=o;return t.jsxs(ve,{children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(Ct,{className:"mb-0",children:"Selection Mode"}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(Z,{children:t.jsxs(Y,{children:[t.jsx(J,{asChild:!0,children:t.jsx(V,{type:"button",variant:"ghost",size:"icon",className:"size-7","aria-label":"Selection mode help",children:t.jsx(je,{size:14,className:"text-muted-foreground"})})}),t.jsx(Q,{side:"left",className:"max-w-sm",children:t.jsxs("div",{className:"text-xs space-y-1",children:[t.jsxs("div",{children:[t.jsx("strong",{children:"Include:"})," Only selected items are exposed."]}),t.jsxs("div",{children:[t.jsx("strong",{children:"Exclude:"})," All items except selected ones are exposed."]})]})})]})}),t.jsxs(Rt,{value:e.value,onValueChange:e.onChange,children:[t.jsx(Se,{children:t.jsx(zt,{className:"w-[180px]",children:t.jsx(At,{})})}),t.jsxs(Et,{children:[t.jsx(Ue,{value:"inclusion",children:"Include Selected"}),t.jsx(Ue,{value:"exclusion",children:"Exclude Selected"})]})]})]})]}),t.jsx(Ne,{})]})}function ms(o){const{field:e}=o;return t.jsxs(ve,{className:"w-full space-y-0",children:[t.jsx(Se,{children:t.jsx(Pe,{...e,value:e.value||"",className:"h-auto text-base text-muted-foreground leading-6 px-0 border-transparent hover:border-input focus:border-input bg-transparent transition-all",placeholder:"Add a description..."})}),t.jsx(Ne,{})]})}function us(o){const{field:e}=o;return t.jsxs(ve,{className:"w-full space-y-0",children:[t.jsx(Se,{children:t.jsx(Pe,{...e,className:"h-auto text-lg! font-medium leading-7 px-0 border-transparent hover:border-input focus:border-input bg-transparent transition-all",placeholder:"Agent Name"})}),t.jsx(Ne,{})]})}function fs(o){const{field:e}=o;return t.jsxs(ve,{children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(qe,{variant:e.value==="active"?"success":"outline",children:e.value==="active"?"Active":"Inactive"}),t.jsx(Se,{children:t.jsx(Pt,{checked:e.value==="active",onCheckedChange:s=>e.onChange(s?"active":"inactive")})})]}),t.jsx(Ne,{})]})}function hs(o){const e=R.c(81),{gateway:s,gatewayId:l,requestedTabId:i}=o,a=ot().location.href,m=lt();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={from:"/$org/gateways/$gatewayId"},e[0]=c):c=e[0];const r=Fe(c),d=xt();let u;e[1]===Symbol.for("react.memo_cache_sentinel")?(u={},e[1]=u):u=e[1];const f=We(u);let b;e[2]!==f?(b=f.map(ps),e[2]=f,e[3]=b):b=e[3];const x=b,{promptsMap:p}=gt(x),{resourcesMap:y}=bt(x);let j;if(e[4]!==f){j=new Map;for(const T of f)T.tools&&T.tools.length>0&&j.set(T.id,T.tools.map(xs));e[4]=f,e[5]=j}else j=e[5];let v;e[6]!==j||e[7]!==s?(v=()=>Le(s,j),e[6]=j,e[7]=s,e[8]=v):v=e[8];const[g,_]=S.useState(v);let C;e[9]!==s?(C=()=>Oe(s),e[9]=s,e[10]=C):C=e[10];const[I,k]=S.useState(C);let P;e[11]!==s?(P=()=>Be(s),e[11]=s,e[12]=P):P=e[12];const[E,L]=S.useState(P),[B,A]=S.useState(!1),[M,h]=S.useState(!1);let N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=T=>{_(T),A(!0)},e[13]=N):N=e[13];const z=N;let $;e[14]===Symbol.for("react.memo_cache_sentinel")?($=T=>{k(T),A(!0)},e[14]=$):$=e[14];const G=$;let W;e[15]===Symbol.for("react.memo_cache_sentinel")?(W=T=>{L(T),A(!0)},e[15]=W):W=e[15];const q=W;let F;e[16]===Symbol.for("react.memo_cache_sentinel")?(F=nt(os),e[16]=F):F=e[16];const _e=s.tool_selection_mode??"inclusion";let ce;e[17]!==s.description||e[18]!==s.status||e[19]!==s.title||e[20]!==_e?(ce={resolver:F,defaultValues:{title:s.title,description:s.description,status:s.status,tool_selection_mode:_e}},e[17]=s.description,e[18]=s.status,e[19]=s.title,e[20]=_e,e[21]=ce):ce=e[21];const O=it(ce),we=O.formState.isDirty||B;let de;e[22]!==d.update||e[23]!==j||e[24]!==O||e[25]!==l||e[26]!==E||e[27]!==I||e[28]!==g?(de=async()=>{const T=O.getValues(),$e=ls(g,I,E,j);await d.update.mutateAsync({id:l,data:{title:T.title,description:T.description,status:T.status,tool_selection_mode:T.tool_selection_mode,connections:$e}}),O.reset(T),A(!1)},e[22]=d.update,e[23]=j,e[24]=O,e[25]=l,e[26]=E,e[27]=I,e[28]=g,e[29]=de):de=e[29];const Ce=de;let me;e[30]!==j||e[31]!==O||e[32]!==s?(me=()=>{O.reset({title:s.title,description:s.description,status:s.status,tool_selection_mode:s.tool_selection_mode??"inclusion"}),_(Le(s,j)),k(Oe(s)),L(Be(s)),A(!1)},e[30]=j,e[31]=O,e[32]=s,e[33]=me):me=e[33];const ke=me;let ue;e[34]===Symbol.for("react.memo_cache_sentinel")?(ue=[{id:"settings",label:"Settings"},{id:"tools",label:"Tools"},{id:"resources",label:"Resources"},{id:"prompts",label:"Prompts"}],e[34]=ue):ue=e[34];const De=ue,D=De.some(T=>T.id===i)?i:"settings";let fe;e[35]!==r?(fe=T=>{r({search:$e=>({...$e,tab:T}),replace:!0})},e[35]=r,e[36]=fe):fe=e[36];const Ie=fe,ae=d.update.isPending;let K;e[37]!==m.history?(K=()=>m.history.back(),e[37]=m.history,e[38]=K):K=e[38];let X;e[39]!==D||e[40]!==Ie?(X=t.jsx(Ot,{children:t.jsx($t,{tabs:De,activeTab:D,onTabChange:Ie})}),e[39]=D,e[40]=Ie,e[41]=X):X=e[41];let ee;e[42]!==ke||e[43]!==Ce||e[44]!==we||e[45]!==ae?(ee=we&&t.jsxs(t.Fragment,{children:[t.jsx(Z,{children:t.jsxs(Y,{delayDuration:0,children:[t.jsx(J,{asChild:!0,children:t.jsx("span",{className:"inline-block",children:t.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:ae,onClick:ke,"aria-label":"Cancel",children:t.jsx(Lt,{size:14})})})}),t.jsx(Q,{side:"bottom",children:"Cancel"})]})}),t.jsx(Z,{children:t.jsxs(Y,{delayDuration:0,children:[t.jsx(J,{asChild:!0,children:t.jsx("span",{className:"inline-block",children:t.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:ae,onClick:Ce,"aria-label":"Save",children:ae?t.jsx(ze,{size:14,className:"animate-spin"}):t.jsx(Ke,{size:14})})})}),t.jsx(Q,{side:"bottom",children:"Save"})]})})]}),e[42]=ke,e[43]=Ce,e[44]=we,e[45]=ae,e[46]=ee):ee=e[46];let he;e[47]===Symbol.for("react.memo_cache_sentinel")?(he=()=>h(!0),e[47]=he):he=e[47];let xe;e[48]===Symbol.for("react.memo_cache_sentinel")?(xe=t.jsx(Z,{children:t.jsxs(Y,{delayDuration:0,children:[t.jsx(J,{asChild:!0,children:t.jsx("span",{className:"inline-block",children:t.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:he,"aria-label":"Share",children:t.jsx(Xe,{size:14})})})}),t.jsx(Q,{side:"bottom",children:"Share"})]})}),e[48]=xe):xe=e[48];const Te=s.icon??"cpu_chip";let te;e[49]!==s.title||e[50]!==Te||e[51]!==a?(te=t.jsx(ut,{title:s.title,url:a,icon:Te}),e[49]=s.title,e[50]=Te,e[51]=a,e[52]=te):te=e[52];let se;e[53]!==ee||e[54]!==te?(se=t.jsxs(Bt,{children:[ee,xe,te]}),e[53]=ee,e[54]=te,e[55]=se):se=e[55];let pe;e[56]===Symbol.for("react.memo_cache_sentinel")?(pe=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ze,{size:32,className:"animate-spin text-muted-foreground"})}),e[56]=pe):pe=e[56];let oe;e[57]!==D||e[58]!==p||e[59]!==y||e[60]!==O||e[61]!==s.icon||e[62]!==l||e[63]!==E||e[64]!==I||e[65]!==g?(oe=D==="settings"?t.jsx(cs,{form:O,icon:s.icon,gatewayId:l}):D==="tools"?t.jsx(ft,{toolSet:g,onToolSetChange:z}):D==="resources"?t.jsx(Xt,{resourceSet:I,onResourceSetChange:G,connectionResources:y}):D==="prompts"?t.jsx(Yt,{promptSet:E,onPromptSetChange:q,connectionPrompts:p}):null,e[57]=D,e[58]=p,e[59]=y,e[60]=O,e[61]=s.icon,e[62]=l,e[63]=E,e[64]=I,e[65]=g,e[66]=oe):oe=e[66];let le;e[67]!==oe?(le=t.jsx(S.Suspense,{fallback:pe,children:oe}),e[67]=oe,e[68]=le):le=e[68];let ne;e[69]!==D||e[70]!==le?(ne=t.jsx("div",{className:"flex h-full w-full bg-background overflow-hidden",children:t.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-hidden",children:t.jsx("div",{className:"h-full overflow-auto",children:t.jsx(Ve,{children:le},D)})})}),e[69]=D,e[70]=le,e[71]=ne):ne=e[71];let ie;e[72]!==s||e[73]!==M?(ie=t.jsx(as,{open:M,onOpenChange:h,gateway:s}),e[72]=s,e[73]=M,e[74]=ie):ie=e[74];let ge;return e[75]!==K||e[76]!==X||e[77]!==se||e[78]!==ne||e[79]!==ie?(ge=t.jsxs(Ft,{onBack:K,children:[X,se,ne,ie]}),e[75]=K,e[76]=X,e[77]=se,e[78]=ne,e[79]=ie,e[80]=ge):ge=e[80],ge}function xs(o){return o.name}function ps(o){return o.id}function gs(){const o=R.c(10);let e;o[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/gateways/$gatewayId"},o[0]=e):e=o[0];const s=Fe(e);let l;o[1]===Symbol.for("react.memo_cache_sentinel")?(l={from:"/shell/$org/gateways/$gatewayId"},o[1]=l):l=o[1];const{gatewayId:i,org:n}=tt(l);let a;o[2]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/shell/$org/gateways/$gatewayId"},o[2]=a):a=o[2];const c=st(a).tab||"settings",r=ht(i);if(!r){let u;return o[3]!==s||o[4]!==n?(u=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(rt,{title:"Agent not found",description:"This Agent may have been deleted or you may not have access.",actions:t.jsx(V,{variant:"outline",onClick:()=>s({to:"/$org/gateways",params:{org:n}}),children:"Back to agents"})})}),o[3]=s,o[4]=n,o[5]=u):u=o[5],u}let d;return o[6]!==r||o[7]!==i||o[8]!==c?(d=t.jsx(hs,{gateway:r,gatewayId:i,requestedTabId:c}),o[6]=r,o[7]=i,o[8]=c,o[9]=d):d=o[9],d}function bs(){const o=R.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ve,{children:t.jsx(S.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(ze,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(gs,{})})}),o[0]=e):e=o[0],e}function ao(){const o=R.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(bs,{}),o[0]=e):e=o[0],e}export{ao as default};
@@ -1 +1 @@
1
- import{c as ee,j as t,r as te,f as oe}from"./index-skH-OUyO.js";import{C as re}from"./collection-header-Cn-YMrm9.js";import{C as ie}from"./collection-page-A6cy4ewQ.js";import{C as ne}from"./collection-search-Bm9HY_m8.js";import{C as ae}from"./collection-table-wrapper-CnCS_a8f.js";import{C as le}from"./connection-card-Db71-JIc.js";import{E as W,I as ce}from"./empty-state-DhpaMqQD.js";import{E as de}from"./error-boundary-_npCfvs4.js";import{u as me,a as ue,i as x}from"./use-gateway-CmDE4xLF.js";import{u as pe,s as J}from"./use-list-state-B0HVVNOr.js";import{u as ge}from"./use-create-gateway-D4_8vfl-.js";import{u as he}from"./project-context-provider-Ci1EHyGR.js";import{c as fe,b as xe,d as je,A as Ce,e as we,g as ye,a as Ne,f as De}from"./alert-dialog-CNXrLp-S.js";import{B as se}from"./badge-ChGpQW0J.js";import{B as q}from"./button-Dh_UOMtF.js";import{b as Q,D as U,a as X,c as O}from"./dropdown-menu-T7u8fl7N.js";import{i as Y}from"./DotsVertical-HKe7Lpcg.js";import{i as Se}from"./Loading01-BtKovu_m.js";import{s as Z}from"./Trash01-DCb3R_1E.js";import"./collection-display-button-DKfm8yFW.js";import"./ArrowUp-BDjaIiFu.js";import"./Check-Cs5AiVxS.js";import"./Grid01-XLGz76ym.js";import"./List-DWWQESNh.js";import"./tooltip-DgJ4R-G6.js";import"./view-mode-toggle-Z5AVjYj0.js";import"./SearchMd-DwKDi1yz.js";import"./input-CdlPz8Vq.js";import"./card-Bjs7HBa2.js";import"./connection-DuIRkEvB.js";import"./use-collections-CC15C_nK.js";import"./useMutation-n0xwrWOz.js";import"./use-mobile-CZeMkOxo.js";function ve(e,r){switch(r.type){case"delete":return{mode:"deleting",gateway:r.gateway};case"close":return{mode:"idle"}}}function be(){const e=ee.c(63),{org:r}=he(),n=oe();let j;e[0]!==r.slug?(j={namespace:r.slug,resource:"gateways"},e[0]=r.slug,e[1]=j):j=e[1];const s=pe(j),f=me(s);let C;e[2]===Symbol.for("react.memo_cache_sentinel")?(C={navigateOnCreate:!0},e[2]=C):C=e[2];const{createGateway:B,isCreating:w}=ge(C),G=ue();let y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y={mode:"idle"},e[3]=y):y=e[3];const[i,N]=te.useReducer(ve,y);let D;e[4]!==G||e[5]!==i.gateway||e[6]!==i.mode?(D=async()=>{if(i.mode!=="deleting")return;const o=i.gateway.id;N({type:"close"});try{await G.delete.mutateAsync(o)}catch{}},e[4]=G,e[5]=i.gateway,e[6]=i.mode,e[7]=D):D=e[7];const R=D;let S,v,b,k,_,A;e[8]===Symbol.for("react.memo_cache_sentinel")?(S={id:"icon",header:"",render:Ke,cellClassName:"w-16 shrink-0",wrap:!0},v={id:"title",header:"Name",render:Pe,cellClassName:"w-48 min-w-0 shrink-0",sortable:!0},b={id:"description",header:"Description",render:Ee,cellClassName:"flex-1 min-w-0",wrap:!0,sortable:!0},k={id:"mode",header:"Mode",accessor:$e,cellClassName:"w-[100px]"},_={id:"connections",header:"Connections",render:ze,cellClassName:"w-24 shrink-0"},A={id:"status",header:"Status",render:Me,cellClassName:"w-24 shrink-0",sortable:!0},e[8]=S,e[9]=v,e[10]=b,e[11]=k,e[12]=_,e[13]=A):(S=e[8],v=e[9],b=e[10],k=e[11],_=e[12],A=e[13]);let I;e[14]!==n||e[15]!==r.slug?(I=[S,v,b,k,_,A,{id:"actions",header:"",render:o=>t.jsxs(Q,{children:[t.jsx(U,{asChild:!0,children:t.jsx(q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Ie,children:t.jsx(Y,{size:20})})}),t.jsxs(X,{align:"end",onClick:Ae,children:[t.jsxs(O,{onClick:a=>{a.stopPropagation(),n({to:"/$org/gateways/$gatewayId",params:{org:r.slug,gatewayId:o.id}})},children:[t.jsx(J,{size:16}),"Open"]}),t.jsxs(O,{variant:"destructive",onClick:a=>{a.stopPropagation(),N({type:"delete",gateway:o})},children:[t.jsx(Z,{size:16}),"Delete"]})]})]}),cellClassName:"w-12 shrink-0"}],e[14]=n,e[15]=r.slug,e[16]=I):I=e[16];const T=I,V=w?"Creating...":"Create Agent";let M;e[17]!==B||e[18]!==w||e[19]!==V?(M=t.jsx(q,{onClick:B,size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",disabled:w,children:V}),e[17]=B,e[18]=w,e[19]=V,e[20]=M):M=e[20];const H=M,L=i.mode==="deleting";let z;e[21]===Symbol.for("react.memo_cache_sentinel")?(z=o=>!o&&N({type:"close"}),e[21]=z):z=e[21];let $;e[22]===Symbol.for("react.memo_cache_sentinel")?($=t.jsx(fe,{children:"Delete Agent?"}),e[22]=$):$=e[22];const F=i.mode==="deleting"&&i.gateway.title;let l;e[23]!==F?(l=t.jsxs(xe,{children:[$,t.jsxs(je,{children:["This action cannot be undone. This will permanently delete"," ",t.jsx("span",{className:"font-medium text-foreground",children:F}),"."]})]}),e[23]=F,e[24]=l):l=e[24];let E;e[25]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsx(Ce,{children:"Cancel"}),e[25]=E):E=e[25];let c;e[26]!==R?(c=t.jsxs(we,{children:[E,t.jsx(ye,{onClick:R,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),e[26]=R,e[27]=c):c=e[27];let d;e[28]!==l||e[29]!==c?(d=t.jsxs(Ne,{children:[l,c]}),e[28]=l,e[29]=c,e[30]=d):d=e[30];let m;e[31]!==L||e[32]!==d?(m=t.jsx(De,{open:L,onOpenChange:z,children:d}),e[31]=L,e[32]=d,e[33]=m):m=e[33];let P;e[34]===Symbol.for("react.memo_cache_sentinel")?(P=[{id:"title",label:"Name"},{id:"description",label:"Description"},{id:"status",label:"Status"}],e[34]=P):P=e[34];let u;e[35]!==H||e[36]!==s.handleSort||e[37]!==s.setViewMode||e[38]!==s.sortDirection||e[39]!==s.sortKey||e[40]!==s.viewMode?(u=t.jsx(re,{title:"Agents",viewMode:s.viewMode,onViewModeChange:s.setViewMode,sortKey:s.sortKey,sortDirection:s.sortDirection,onSort:s.handleSort,sortOptions:P,ctaButton:H}),e[35]=H,e[36]=s.handleSort,e[37]=s.setViewMode,e[38]=s.sortDirection,e[39]=s.sortKey,e[40]=s.viewMode,e[41]=u):u=e[41];let p;e[42]!==s?(p=o=>{o.key==="Escape"&&(s.setSearch(""),o.target.blur())},e[42]=s,e[43]=p):p=e[43];let g;e[44]!==s.search||e[45]!==s.setSearch||e[46]!==p?(g=t.jsx(ne,{value:s.search,onChange:s.setSearch,placeholder:"Search for an agent...",onKeyDown:p}),e[44]=s.search,e[45]=s.setSearch,e[46]=p,e[47]=g):g=e[47];let h;e[48]!==T||e[49]!==f||e[50]!==s.handleSort||e[51]!==s.search||e[52]!==s.sortDirection||e[53]!==s.sortKey||e[54]!==s.viewMode||e[55]!==n||e[56]!==r.slug?(h=s.viewMode==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:f.length===0?t.jsx(W,{image:t.jsx(x,{size:36,className:"text-muted-foreground"}),title:s.search?"No agents found":"No agents yet",description:s.search?`No agents match "${s.search}"`:"Create an agent to aggregate tools from multiple Connections."}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:f.map(o=>t.jsx(le,{connection:{id:o.id,title:o.title,description:o.description,icon:o.icon,status:o.status},fallbackIcon:t.jsx(x,{}),onClick:()=>n({to:"/$org/gateways/$gatewayId",params:{org:r.slug,gatewayId:o.id}}),footer:t.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.jsxs("span",{children:[o.connections.length," connection",o.connections.length!==1?"s":""]}),t.jsx("span",{children:"•"}),t.jsx("span",{children:o.tool_selection_mode==="exclusion"?"Exclude":"Include"})]}),headerActions:t.jsxs(Q,{children:[t.jsx(U,{asChild:!0,children:t.jsx(q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:_e,children:t.jsx(Y,{size:20})})}),t.jsxs(X,{align:"end",onClick:ke,children:[t.jsxs(O,{onClick:a=>{a.stopPropagation(),n({to:"/$org/gateways/$gatewayId",params:{org:r.slug,gatewayId:o.id}})},children:[t.jsx(J,{size:16}),"Open"]}),t.jsxs(O,{variant:"destructive",onClick:a=>{a.stopPropagation(),N({type:"delete",gateway:o})},children:[t.jsx(Z,{size:16}),"Delete"]})]})]})},o.id))})}):t.jsx(ae,{columns:T,data:f,isLoading:!1,sortKey:s.sortKey,sortDirection:s.sortDirection,onSort:s.handleSort,onRowClick:o=>n({to:"/$org/gateways/$gatewayId",params:{org:r.slug,gatewayId:o.id}}),emptyState:s.search?t.jsx(W,{image:t.jsx(x,{size:36,className:"text-muted-foreground"}),title:"No agents found",description:`No agents match "${s.search}"`}):t.jsx(W,{image:t.jsx(x,{size:36,className:"text-muted-foreground"}),title:"No agents yet",description:"Create an agent to aggregate tools from multiple Connections."})}),e[48]=T,e[49]=f,e[50]=s.handleSort,e[51]=s.search,e[52]=s.sortDirection,e[53]=s.sortKey,e[54]=s.viewMode,e[55]=n,e[56]=r.slug,e[57]=h):h=e[57];let K;return e[58]!==m||e[59]!==u||e[60]!==g||e[61]!==h?(K=t.jsxs(ie,{children:[m,u,g,h]}),e[58]=m,e[59]=u,e[60]=g,e[61]=h,e[62]=K):K=e[62],K}function ke(e){return e.stopPropagation()}function _e(e){return e.stopPropagation()}function Ae(e){return e.stopPropagation()}function Ie(e){return e.stopPropagation()}function Me(e){return t.jsx(se,{variant:e.status==="active"?"default":"outline",children:e.status})}function ze(e){return t.jsx("span",{className:"text-sm text-muted-foreground",children:e.connections.length})}function $e(e){return t.jsx(se,{variant:"outline",className:"text-xs",children:e.tool_selection_mode==="exclusion"?"Exclude":"Include"})}function Ee(e){return t.jsx("span",{className:"text-sm text-foreground line-clamp-2",children:e.description||"—"})}function Pe(e){return t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:e.title})}function Ke(e){return t.jsx(ce,{icon:e.icon,name:e.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:t.jsx(x,{size:16})})}function ft(){const e=ee.c(1);let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(de,{children:t.jsx(te.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Se,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(be,{})})}),e[0]=r):r=e[0],r}export{ft as default};
1
+ import{c as ee,j as t,r as te,f as oe}from"./index-Diww4UW3.js";import{C as re}from"./collection-header-B4qcjEt5.js";import{C as ie}from"./collection-page-s-RR5fU6.js";import{C as ne}from"./collection-search-BVb42O45.js";import{C as ae}from"./collection-table-wrapper-BohFZqii.js";import{C as le}from"./connection-card-DMMfNQUo.js";import{E as W,I as ce}from"./empty-state-wP9uukGJ.js";import{E as de}from"./error-boundary-BUvK8Sry.js";import{u as me,a as ue,i as x}from"./use-gateway-DD-xEZju.js";import{u as pe,s as J}from"./use-list-state-AndcW8aD.js";import{u as ge}from"./use-create-gateway-BlLsktgc.js";import{u as he}from"./project-context-provider-DulCVL2k.js";import{c as fe,b as xe,d as je,A as Ce,e as we,g as ye,a as Ne,f as De}from"./alert-dialog-CCJCsKzK.js";import{B as se}from"./badge-BVO6I0sW.js";import{B as q}from"./button-CGmrzkpY.js";import{b as Q,D as U,a as X,c as O}from"./dropdown-menu-CAeD2aIb.js";import{i as Y}from"./DotsVertical-BPP4U4GQ.js";import{i as Se}from"./Loading01-Ae5ezbtD.js";import{s as Z}from"./Trash01-BWIN9RL_.js";import"./collection-display-button-CtkxsCB_.js";import"./ArrowUp-BF7mM4C2.js";import"./Check-BQkm1TiP.js";import"./Grid01-D4lXvveX.js";import"./List-BsSZz32j.js";import"./tooltip-Suu_Gpqh.js";import"./view-mode-toggle-BLClM-0g.js";import"./SearchMd-GFaonOaJ.js";import"./input-CrURMEZe.js";import"./card-DIjMh1NO.js";import"./connection-ChwHK0-S.js";import"./use-collections-CXETocKO.js";import"./useMutation-Dl1MMkEC.js";import"./use-mobile-DssCtDl6.js";function ve(e,r){switch(r.type){case"delete":return{mode:"deleting",gateway:r.gateway};case"close":return{mode:"idle"}}}function be(){const e=ee.c(63),{org:r}=he(),n=oe();let j;e[0]!==r.slug?(j={namespace:r.slug,resource:"gateways"},e[0]=r.slug,e[1]=j):j=e[1];const s=pe(j),f=me(s);let C;e[2]===Symbol.for("react.memo_cache_sentinel")?(C={navigateOnCreate:!0},e[2]=C):C=e[2];const{createGateway:B,isCreating:w}=ge(C),G=ue();let y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y={mode:"idle"},e[3]=y):y=e[3];const[i,N]=te.useReducer(ve,y);let D;e[4]!==G||e[5]!==i.gateway||e[6]!==i.mode?(D=async()=>{if(i.mode!=="deleting")return;const o=i.gateway.id;N({type:"close"});try{await G.delete.mutateAsync(o)}catch{}},e[4]=G,e[5]=i.gateway,e[6]=i.mode,e[7]=D):D=e[7];const R=D;let S,v,b,k,_,A;e[8]===Symbol.for("react.memo_cache_sentinel")?(S={id:"icon",header:"",render:Ke,cellClassName:"w-16 shrink-0",wrap:!0},v={id:"title",header:"Name",render:Pe,cellClassName:"w-48 min-w-0 shrink-0",sortable:!0},b={id:"description",header:"Description",render:Ee,cellClassName:"flex-1 min-w-0",wrap:!0,sortable:!0},k={id:"mode",header:"Mode",accessor:$e,cellClassName:"w-[100px]"},_={id:"connections",header:"Connections",render:ze,cellClassName:"w-24 shrink-0"},A={id:"status",header:"Status",render:Me,cellClassName:"w-24 shrink-0",sortable:!0},e[8]=S,e[9]=v,e[10]=b,e[11]=k,e[12]=_,e[13]=A):(S=e[8],v=e[9],b=e[10],k=e[11],_=e[12],A=e[13]);let I;e[14]!==n||e[15]!==r.slug?(I=[S,v,b,k,_,A,{id:"actions",header:"",render:o=>t.jsxs(Q,{children:[t.jsx(U,{asChild:!0,children:t.jsx(q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Ie,children:t.jsx(Y,{size:20})})}),t.jsxs(X,{align:"end",onClick:Ae,children:[t.jsxs(O,{onClick:a=>{a.stopPropagation(),n({to:"/$org/gateways/$gatewayId",params:{org:r.slug,gatewayId:o.id}})},children:[t.jsx(J,{size:16}),"Open"]}),t.jsxs(O,{variant:"destructive",onClick:a=>{a.stopPropagation(),N({type:"delete",gateway:o})},children:[t.jsx(Z,{size:16}),"Delete"]})]})]}),cellClassName:"w-12 shrink-0"}],e[14]=n,e[15]=r.slug,e[16]=I):I=e[16];const T=I,V=w?"Creating...":"Create Agent";let M;e[17]!==B||e[18]!==w||e[19]!==V?(M=t.jsx(q,{onClick:B,size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",disabled:w,children:V}),e[17]=B,e[18]=w,e[19]=V,e[20]=M):M=e[20];const H=M,L=i.mode==="deleting";let z;e[21]===Symbol.for("react.memo_cache_sentinel")?(z=o=>!o&&N({type:"close"}),e[21]=z):z=e[21];let $;e[22]===Symbol.for("react.memo_cache_sentinel")?($=t.jsx(fe,{children:"Delete Agent?"}),e[22]=$):$=e[22];const F=i.mode==="deleting"&&i.gateway.title;let l;e[23]!==F?(l=t.jsxs(xe,{children:[$,t.jsxs(je,{children:["This action cannot be undone. This will permanently delete"," ",t.jsx("span",{className:"font-medium text-foreground",children:F}),"."]})]}),e[23]=F,e[24]=l):l=e[24];let E;e[25]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsx(Ce,{children:"Cancel"}),e[25]=E):E=e[25];let c;e[26]!==R?(c=t.jsxs(we,{children:[E,t.jsx(ye,{onClick:R,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),e[26]=R,e[27]=c):c=e[27];let d;e[28]!==l||e[29]!==c?(d=t.jsxs(Ne,{children:[l,c]}),e[28]=l,e[29]=c,e[30]=d):d=e[30];let m;e[31]!==L||e[32]!==d?(m=t.jsx(De,{open:L,onOpenChange:z,children:d}),e[31]=L,e[32]=d,e[33]=m):m=e[33];let P;e[34]===Symbol.for("react.memo_cache_sentinel")?(P=[{id:"title",label:"Name"},{id:"description",label:"Description"},{id:"status",label:"Status"}],e[34]=P):P=e[34];let u;e[35]!==H||e[36]!==s.handleSort||e[37]!==s.setViewMode||e[38]!==s.sortDirection||e[39]!==s.sortKey||e[40]!==s.viewMode?(u=t.jsx(re,{title:"Agents",viewMode:s.viewMode,onViewModeChange:s.setViewMode,sortKey:s.sortKey,sortDirection:s.sortDirection,onSort:s.handleSort,sortOptions:P,ctaButton:H}),e[35]=H,e[36]=s.handleSort,e[37]=s.setViewMode,e[38]=s.sortDirection,e[39]=s.sortKey,e[40]=s.viewMode,e[41]=u):u=e[41];let p;e[42]!==s?(p=o=>{o.key==="Escape"&&(s.setSearch(""),o.target.blur())},e[42]=s,e[43]=p):p=e[43];let g;e[44]!==s.search||e[45]!==s.setSearch||e[46]!==p?(g=t.jsx(ne,{value:s.search,onChange:s.setSearch,placeholder:"Search for an agent...",onKeyDown:p}),e[44]=s.search,e[45]=s.setSearch,e[46]=p,e[47]=g):g=e[47];let h;e[48]!==T||e[49]!==f||e[50]!==s.handleSort||e[51]!==s.search||e[52]!==s.sortDirection||e[53]!==s.sortKey||e[54]!==s.viewMode||e[55]!==n||e[56]!==r.slug?(h=s.viewMode==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:f.length===0?t.jsx(W,{image:t.jsx(x,{size:36,className:"text-muted-foreground"}),title:s.search?"No agents found":"No agents yet",description:s.search?`No agents match "${s.search}"`:"Create an agent to aggregate tools from multiple Connections."}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:f.map(o=>t.jsx(le,{connection:{id:o.id,title:o.title,description:o.description,icon:o.icon,status:o.status},fallbackIcon:t.jsx(x,{}),onClick:()=>n({to:"/$org/gateways/$gatewayId",params:{org:r.slug,gatewayId:o.id}}),footer:t.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.jsxs("span",{children:[o.connections.length," connection",o.connections.length!==1?"s":""]}),t.jsx("span",{children:"•"}),t.jsx("span",{children:o.tool_selection_mode==="exclusion"?"Exclude":"Include"})]}),headerActions:t.jsxs(Q,{children:[t.jsx(U,{asChild:!0,children:t.jsx(q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:_e,children:t.jsx(Y,{size:20})})}),t.jsxs(X,{align:"end",onClick:ke,children:[t.jsxs(O,{onClick:a=>{a.stopPropagation(),n({to:"/$org/gateways/$gatewayId",params:{org:r.slug,gatewayId:o.id}})},children:[t.jsx(J,{size:16}),"Open"]}),t.jsxs(O,{variant:"destructive",onClick:a=>{a.stopPropagation(),N({type:"delete",gateway:o})},children:[t.jsx(Z,{size:16}),"Delete"]})]})]})},o.id))})}):t.jsx(ae,{columns:T,data:f,isLoading:!1,sortKey:s.sortKey,sortDirection:s.sortDirection,onSort:s.handleSort,onRowClick:o=>n({to:"/$org/gateways/$gatewayId",params:{org:r.slug,gatewayId:o.id}}),emptyState:s.search?t.jsx(W,{image:t.jsx(x,{size:36,className:"text-muted-foreground"}),title:"No agents found",description:`No agents match "${s.search}"`}):t.jsx(W,{image:t.jsx(x,{size:36,className:"text-muted-foreground"}),title:"No agents yet",description:"Create an agent to aggregate tools from multiple Connections."})}),e[48]=T,e[49]=f,e[50]=s.handleSort,e[51]=s.search,e[52]=s.sortDirection,e[53]=s.sortKey,e[54]=s.viewMode,e[55]=n,e[56]=r.slug,e[57]=h):h=e[57];let K;return e[58]!==m||e[59]!==u||e[60]!==g||e[61]!==h?(K=t.jsxs(ie,{children:[m,u,g,h]}),e[58]=m,e[59]=u,e[60]=g,e[61]=h,e[62]=K):K=e[62],K}function ke(e){return e.stopPropagation()}function _e(e){return e.stopPropagation()}function Ae(e){return e.stopPropagation()}function Ie(e){return e.stopPropagation()}function Me(e){return t.jsx(se,{variant:e.status==="active"?"default":"outline",children:e.status})}function ze(e){return t.jsx("span",{className:"text-sm text-muted-foreground",children:e.connections.length})}function $e(e){return t.jsx(se,{variant:"outline",className:"text-xs",children:e.tool_selection_mode==="exclusion"?"Exclude":"Include"})}function Ee(e){return t.jsx("span",{className:"text-sm text-foreground line-clamp-2",children:e.description||"—"})}function Pe(e){return t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:e.title})}function Ke(e){return t.jsx(ce,{icon:e.icon,name:e.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:t.jsx(x,{size:16})})}function ft(){const e=ee.c(1);let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(de,{children:t.jsx(te.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Se,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(be,{})})}),e[0]=r):r=e[0],r}export{ft as default};
@@ -1 +1 @@
1
- import{r as v,c as T,bM as D,j as s,x as q,t as w,bL as H}from"./index-skH-OUyO.js";import{K as L,u as Z,g as R,s as Q,a as W,i as I,f as U}from"./file-browser-NWpg0oN1.js";import{c as $,B as E}from"./button-Dh_UOMtF.js";import{i as S}from"./AlertCircle-DeGhTF84.js";import{n as A}from"./Download01-4uLxYlt-.js";import{i as J}from"./File06-K5gpmB1y.js";import{a as P}from"./Image01-CycaMeSm.js";import{i as M}from"./Loading01-BtKovu_m.js";import{s as V}from"./Trash01-DCb3R_1E.js";import{i as Y}from"./Upload01-BKDlh_J7.js";import{u as _}from"./useMutation-n0xwrWOz.js";import{u as X}from"./useQuery-FRehIqtM.js";import"./useInfiniteQuery-x4_y1w34.js";import"./infiniteQueryObserver-Dvgbvv4A.js";import"./checkbox-DiEhrfCa.js";import"./Check-Cs5AiVxS.js";import"./Grid01-XLGz76ym.js";import"./Home02-CeVIG1t0.js";import"./List-DWWQESNh.js";const B=({size:i=24,color:e="currentColor",...t})=>v.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},v.createElement("path",{d:"M14 2.27V6.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C14.76 8 15.04 8 15.6 8h4.13M20 9.988V17.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C17.72 22 16.88 22 15.2 22H8.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C4 19.72 4 18.88 4 17.2V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C6.28 2 7.12 2 8.8 2h3.212c.733 0 1.1 0 1.446.083.306.073.598.195.867.36.303.185.562.444 1.08.963l3.19 3.188c.518.519.777.778.963 1.081a3 3 0 0 1 .36.867c.082.346.082.712.082 1.446Z"}));B.displayName="File04";const G=({size:i=24,color:e="currentColor",...t})=>v.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},v.createElement("path",{d:"M14 2.27V6.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437c.214.11.494.11 1.054.11h4.13M8 15v3m8-5v5m-4-7.5V18m8-8.012V17.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C17.72 22 16.88 22 15.2 22H8.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C4 19.72 4 18.88 4 17.2V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C6.28 2 7.12 2 8.8 2h3.212c.733 0 1.1 0 1.446.083.306.073.598.195.867.36.303.185.562.444 1.08.963l3.19 3.188c.518.519.777.778.963 1.081a3 3 0 0 1 .36.867c.082.346.082.712.082 1.446Z"}));G.displayName="File07";const K=({size:i=24,color:e="currentColor",...t})=>v.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},v.createElement("path",{d:"M14 2.27V6.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437c.214.11.494.11 1.054.11h4.13M14 17.5l2.5-2.5-2.5-2.5m-4 0L7.5 15l2.5 2.5m10-7.512V17.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C17.72 22 16.88 22 15.2 22H8.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C4 19.72 4 18.88 4 17.2V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C6.28 2 7.12 2 8.8 2h3.212c.733 0 1.1 0 1.446.083.306.073.598.195.867.36.303.185.562.444 1.08.963l3.19 3.188c.518.519.777.778.963 1.081a3 3 0 0 1 .36.867c.082.346.082.712.082 1.446Z"}));K.displayName="FileCode01";const O=({size:i=24,color:e="currentColor",...t})=>v.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},v.createElement("path",{d:"M22 8.931c0-.605 0-.908-.12-1.049a.5.5 0 0 0-.42-.173c-.183.014-.397.228-.826.657L17 12l3.634 3.634c.429.429.643.643.827.657a.5.5 0 0 0 .42-.173c.119-.14.119-.444.119-1.05V8.932ZM2 9.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C4.28 5 5.12 5 6.8 5h5.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C17 7.28 17 8.12 17 9.8v4.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C14.72 19 13.88 19 12.2 19H6.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C2 16.72 2 15.88 2 14.2V9.8Z"}));O.displayName="VideoRecorder";function ee(i){const e=T.c(5),[t,g]=v.useState(!1),a=v.useRef(null),d=v.useRef(!1);let n;e[0]!==i?(n=u=>{a.current&&(a.current.disconnect(),a.current=null),u&&!d.current&&(a.current=new IntersectionObserver(y=>{const[c]=y;c?.isIntersecting&&!d.current&&(d.current=!0,g(!0),a.current?.disconnect(),a.current=null)},i),a.current.observe(u))},e[0]=i,e[1]=n):n=e[1];const l=n;let h;return e[2]!==t||e[3]!==l?(h=[t,l],e[2]=t,e[3]=l,e[4]=h):h=e[4],h}function te(i){const e=T.c(24),{objectKey:t,alt:g,className:a}=i,d=a===void 0?"":a,{connectionId:n,toolCaller:l}=D();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={rootMargin:"100px",threshold:0},e[0]=h):h=e[0];const[u,y]=ee(h);let c;e[1]!==n||e[2]!==t?(c=L.imagePreview(n,t),e[1]=n,e[2]=t,e[3]=c):c=e[3];let f;e[4]!==t||e[5]!==l?(f=async()=>{const{url:m}=await l("GET_PRESIGNED_URL",{key:t});return m},e[4]=t,e[5]=l,e[6]=f):f=e[6];let b;e[7]!==u||e[8]!==c||e[9]!==f?(b={queryKey:c,queryFn:f,enabled:u,staleTime:3e5,gcTime:6e5},e[7]=u,e[8]=c,e[9]=f,e[10]=b):b=e[10];const{data:k,isLoading:x,error:j}=X(b);let p;e[11]!==d?(p=$("relative w-full h-full flex items-center justify-center overflow-hidden",d),e[11]=d,e[12]=p):p=e[12];let r;e[13]!==g||e[14]!==j||e[15]!==k||e[16]!==x||e[17]!==u||e[18]!==t?(r=!u||x?s.jsx("div",{className:"flex flex-col items-center justify-center text-muted-foreground",children:x?s.jsx(M,{size:24,className:"animate-spin"}):s.jsx(P,{size:48})}):j?s.jsx("div",{className:"flex flex-col items-center justify-center text-muted-foreground",children:s.jsx(S,{size:24})}):k?s.jsx("img",{src:k,alt:g||t,className:"w-full h-full object-cover",loading:"lazy"}):null,e[13]=g,e[14]=j,e[15]=k,e[16]=x,e[17]=u,e[18]=t,e[19]=r):r=e[19];let o;return e[20]!==y||e[21]!==p||e[22]!==r?(o=s.jsx("div",{ref:y,className:p,children:r}),e[20]=y,e[21]=p,e[22]=r,e[23]=o):o=e[23],o}const z=12,se={Image01:P,VideoRecorder:O,Music01:I,File02:I,File04:B,File06:J,File07:G,FileCode01:K,Folder:H};function re(i){const e=i.split(".").pop()?.toLowerCase();return["jpg","jpeg","png","gif","webp","svg","bmp","ico"].includes(e||"")}function oe(i){const e=T.c(41),{item:t,onNavigate:g,onDownload:a,onDelete:d}=i;let n;e[0]!==t.key?(n=R(t.key),e[0]=t.key,e[1]=n):n=e[1];const l=n,h=t.isFolder?"Folder":W(t.key),u=se[h]||I;let y;e[2]!==t.isFolder||e[3]!==t.key?(y=!t.isFolder&&re(t.key),e[2]=t.isFolder,e[3]=t.key,e[4]=y):y=e[4];const c=y;let f;e[5]!==t.isFolder||e[6]!==t.key||e[7]!==g?(f=()=>t.isFolder?g(t.key):void 0,e[5]=t.isFolder,e[6]=t.key,e[7]=g,e[8]=f):f=e[8];const b=!c&&"p-4",k=t.isFolder?"cursor-pointer":"cursor-default";let x;e[9]!==b||e[10]!==k?(x=$("flex flex-col items-center justify-center w-full h-full",b,k),e[9]=b,e[10]=k,e[11]=x):x=e[11];let j;e[12]!==u||e[13]!==c||e[14]!==t.isFolder||e[15]!==t.key||e[16]!==l?(j=c?s.jsx("div",{className:"absolute inset-0",children:s.jsx(te,{objectKey:t.key,alt:l})}):s.jsx(u,{size:48,className:$(t.isFolder?"text-amber-500":"text-muted-foreground")}),e[12]=u,e[13]=c,e[14]=t.isFolder,e[15]=t.key,e[16]=l,e[17]=j):j=e[17];let p;e[18]!==c||e[19]!==t.isFolder||e[20]!==t.size||e[21]!==l?(p=c?s.jsxs("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2 pt-6",children:[s.jsx("span",{className:"text-sm text-white text-center line-clamp-1 block",children:l}),s.jsx("span",{className:"text-xs text-white/70 text-center block",children:U(t.size)})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"mt-3 text-sm text-center line-clamp-2 px-2",children:l}),!t.isFolder&&s.jsx("span",{className:"mt-1 text-xs text-muted-foreground",children:U(t.size)})]}),e[18]=c,e[19]=t.isFolder,e[20]=t.size,e[21]=l,e[22]=p):p=e[22];let r;e[23]!==f||e[24]!==x||e[25]!==j||e[26]!==p?(r=s.jsxs("button",{type:"button",onClick:f,className:x,children:[j,p]}),e[23]=f,e[24]=x,e[25]=j,e[26]=p,e[27]=r):r=e[27];let o;e[28]!==t.isFolder||e[29]!==t.key||e[30]!==d||e[31]!==a?(o=!t.isFolder&&s.jsxs("div",{className:"absolute top-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(E,{variant:"secondary",size:"sm",className:"size-7 p-0",onClick:F=>{F.stopPropagation(),a(t.key)},children:s.jsx(A,{size:14})}),s.jsx(E,{variant:"secondary",size:"sm",className:"size-7 p-0 text-destructive hover:text-destructive",onClick:F=>{F.stopPropagation(),d(t.key)},children:s.jsx(V,{size:14})})]}),e[28]=t.isFolder,e[29]=t.key,e[30]=d,e[31]=a,e[32]=o):o=e[32];let m;e[33]!==t.isFolder||e[34]!==t.key||e[35]!==d?(m=t.isFolder&&s.jsx("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:s.jsx(E,{variant:"secondary",size:"sm",className:"size-7 p-0 text-destructive hover:text-destructive",onClick:F=>{F.stopPropagation(),d(t.key)},children:s.jsx(V,{size:14})})}),e[33]=t.isFolder,e[34]=t.key,e[35]=d,e[36]=m):m=e[36];let N;return e[37]!==o||e[38]!==m||e[39]!==r?(N=s.jsxs("div",{className:"group relative aspect-square bg-muted/30 rounded-lg border border-border hover:border-primary/50 hover:bg-muted/50 transition-colors overflow-hidden",children:[r,o,m]}),e[37]=o,e[38]=m,e[39]=r,e[40]=N):N=e[40],N}function Fe({prefix:i,flat:e,onNavigate:t}){const g=v.useRef(null),a=q(),{connectionId:d,toolCaller:n}=D(),{objects:l,isLoading:h,isFetchingMore:u,hasMore:y,loadMore:c,error:f}=Z({prefix:i,flat:e,pageSize:z}),b=_({mutationFn:async r=>{const o=i+r.name,{url:m}=await n("PUT_PRESIGNED_URL",{key:o,contentType:r.type||"application/octet-stream"}),N=await fetch(m,{method:"PUT",body:r,headers:{"Content-Type":r.type||"application/octet-stream"}});if(!N.ok)throw new Error(`Upload failed: ${N.statusText}`);return o},onSuccess:r=>{w.success(`Uploaded ${R(r)}`),a.invalidateQueries({queryKey:L.objects(d,i,e,z)})},onError:r=>{w.error(`Upload failed: ${r.message}`)}}),k=_({mutationFn:async r=>r.length===1&&r[0]?n("DELETE_OBJECT",{key:r[0]}):n("DELETE_OBJECTS",{keys:r}),onSuccess:()=>{w.success("Deleted successfully"),a.invalidateQueries({queryKey:L.objects(d,i,e,z)})},onError:r=>{w.error(`Delete failed: ${r.message}`)}}),x=async r=>{try{const{url:o}=await n("GET_PRESIGNED_URL",{key:r}),m=await fetch(o);if(!m.ok)throw new Error(`Failed to fetch file: ${m.statusText}`);const N=await m.blob(),F=URL.createObjectURL(N),C=document.createElement("a");C.href=F,C.download=R(r),document.body.appendChild(C),C.click(),document.body.removeChild(C),URL.revokeObjectURL(F)}catch(o){w.error(`Download failed: ${o instanceof Error?o.message:"Unknown error"}`)}},j=r=>{const o=r.target.files;if(o){for(const m of Array.from(o))b.mutate(m);r.target.value=""}},p=r=>{if(!y||u)return;const o=r.currentTarget;o.scrollHeight-o.scrollTop-o.clientHeight<200&&c()};return f?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8",children:[s.jsx(S,{size:48,className:"text-destructive mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"Error loading files"}),s.jsx("p",{className:"text-muted-foreground text-center",children:f.message})]}):s.jsx("div",{className:"flex-1 overflow-y-auto p-4",onScroll:p,children:h?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[s.jsx(M,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading files..."})]}):l.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(Q,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"This folder is empty"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Upload files to get started"}),s.jsx("input",{ref:g,type:"file",multiple:!0,className:"hidden",onChange:j}),s.jsxs(E,{variant:"outline",onClick:()=>g.current?.click(),children:[s.jsx(Y,{size:14,className:"mr-1"}),"Upload files"]})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4",children:l.map(r=>s.jsx(oe,{item:r,onNavigate:t,onDownload:x,onDelete:o=>k.mutate([o])},r.key))}),u&&s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(M,{size:24,className:"animate-spin text-muted-foreground"})})]})})}export{Fe as default};
1
+ import{r as v,c as T,bM as D,j as s,x as q,t as w,bL as H}from"./index-Diww4UW3.js";import{K as L,u as Z,g as R,s as Q,a as W,i as I,f as U}from"./file-browser-DuR45yyf.js";import{c as $,B as E}from"./button-CGmrzkpY.js";import{i as S}from"./AlertCircle-CI2U-jkN.js";import{n as A}from"./Download01-BkDXja2z.js";import{i as J}from"./File06-KMD38I-q.js";import{a as P}from"./Image01-C0R6SF_P.js";import{i as M}from"./Loading01-Ae5ezbtD.js";import{s as V}from"./Trash01-BWIN9RL_.js";import{i as Y}from"./Upload01-CaBE4VYK.js";import{u as _}from"./useMutation-Dl1MMkEC.js";import{u as X}from"./useQuery-Bvk0U2ed.js";import"./useInfiniteQuery-BttwTOfK.js";import"./infiniteQueryObserver-BmbQcWdI.js";import"./checkbox-DYViXeUc.js";import"./Check-BQkm1TiP.js";import"./Grid01-D4lXvveX.js";import"./Home02-DPdZvu8L.js";import"./List-BsSZz32j.js";const B=({size:i=24,color:e="currentColor",...t})=>v.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},v.createElement("path",{d:"M14 2.27V6.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C14.76 8 15.04 8 15.6 8h4.13M20 9.988V17.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C17.72 22 16.88 22 15.2 22H8.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C4 19.72 4 18.88 4 17.2V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C6.28 2 7.12 2 8.8 2h3.212c.733 0 1.1 0 1.446.083.306.073.598.195.867.36.303.185.562.444 1.08.963l3.19 3.188c.518.519.777.778.963 1.081a3 3 0 0 1 .36.867c.082.346.082.712.082 1.446Z"}));B.displayName="File04";const G=({size:i=24,color:e="currentColor",...t})=>v.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},v.createElement("path",{d:"M14 2.27V6.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437c.214.11.494.11 1.054.11h4.13M8 15v3m8-5v5m-4-7.5V18m8-8.012V17.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C17.72 22 16.88 22 15.2 22H8.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C4 19.72 4 18.88 4 17.2V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C6.28 2 7.12 2 8.8 2h3.212c.733 0 1.1 0 1.446.083.306.073.598.195.867.36.303.185.562.444 1.08.963l3.19 3.188c.518.519.777.778.963 1.081a3 3 0 0 1 .36.867c.082.346.082.712.082 1.446Z"}));G.displayName="File07";const K=({size:i=24,color:e="currentColor",...t})=>v.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},v.createElement("path",{d:"M14 2.27V6.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437c.214.11.494.11 1.054.11h4.13M14 17.5l2.5-2.5-2.5-2.5m-4 0L7.5 15l2.5 2.5m10-7.512V17.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C17.72 22 16.88 22 15.2 22H8.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C4 19.72 4 18.88 4 17.2V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C6.28 2 7.12 2 8.8 2h3.212c.733 0 1.1 0 1.446.083.306.073.598.195.867.36.303.185.562.444 1.08.963l3.19 3.188c.518.519.777.778.963 1.081a3 3 0 0 1 .36.867c.082.346.082.712.082 1.446Z"}));K.displayName="FileCode01";const O=({size:i=24,color:e="currentColor",...t})=>v.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},v.createElement("path",{d:"M22 8.931c0-.605 0-.908-.12-1.049a.5.5 0 0 0-.42-.173c-.183.014-.397.228-.826.657L17 12l3.634 3.634c.429.429.643.643.827.657a.5.5 0 0 0 .42-.173c.119-.14.119-.444.119-1.05V8.932ZM2 9.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C4.28 5 5.12 5 6.8 5h5.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C17 7.28 17 8.12 17 9.8v4.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C14.72 19 13.88 19 12.2 19H6.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C2 16.72 2 15.88 2 14.2V9.8Z"}));O.displayName="VideoRecorder";function ee(i){const e=T.c(5),[t,g]=v.useState(!1),a=v.useRef(null),d=v.useRef(!1);let n;e[0]!==i?(n=u=>{a.current&&(a.current.disconnect(),a.current=null),u&&!d.current&&(a.current=new IntersectionObserver(y=>{const[c]=y;c?.isIntersecting&&!d.current&&(d.current=!0,g(!0),a.current?.disconnect(),a.current=null)},i),a.current.observe(u))},e[0]=i,e[1]=n):n=e[1];const l=n;let h;return e[2]!==t||e[3]!==l?(h=[t,l],e[2]=t,e[3]=l,e[4]=h):h=e[4],h}function te(i){const e=T.c(24),{objectKey:t,alt:g,className:a}=i,d=a===void 0?"":a,{connectionId:n,toolCaller:l}=D();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={rootMargin:"100px",threshold:0},e[0]=h):h=e[0];const[u,y]=ee(h);let c;e[1]!==n||e[2]!==t?(c=L.imagePreview(n,t),e[1]=n,e[2]=t,e[3]=c):c=e[3];let f;e[4]!==t||e[5]!==l?(f=async()=>{const{url:m}=await l("GET_PRESIGNED_URL",{key:t});return m},e[4]=t,e[5]=l,e[6]=f):f=e[6];let b;e[7]!==u||e[8]!==c||e[9]!==f?(b={queryKey:c,queryFn:f,enabled:u,staleTime:3e5,gcTime:6e5},e[7]=u,e[8]=c,e[9]=f,e[10]=b):b=e[10];const{data:k,isLoading:x,error:j}=X(b);let p;e[11]!==d?(p=$("relative w-full h-full flex items-center justify-center overflow-hidden",d),e[11]=d,e[12]=p):p=e[12];let r;e[13]!==g||e[14]!==j||e[15]!==k||e[16]!==x||e[17]!==u||e[18]!==t?(r=!u||x?s.jsx("div",{className:"flex flex-col items-center justify-center text-muted-foreground",children:x?s.jsx(M,{size:24,className:"animate-spin"}):s.jsx(P,{size:48})}):j?s.jsx("div",{className:"flex flex-col items-center justify-center text-muted-foreground",children:s.jsx(S,{size:24})}):k?s.jsx("img",{src:k,alt:g||t,className:"w-full h-full object-cover",loading:"lazy"}):null,e[13]=g,e[14]=j,e[15]=k,e[16]=x,e[17]=u,e[18]=t,e[19]=r):r=e[19];let o;return e[20]!==y||e[21]!==p||e[22]!==r?(o=s.jsx("div",{ref:y,className:p,children:r}),e[20]=y,e[21]=p,e[22]=r,e[23]=o):o=e[23],o}const z=12,se={Image01:P,VideoRecorder:O,Music01:I,File02:I,File04:B,File06:J,File07:G,FileCode01:K,Folder:H};function re(i){const e=i.split(".").pop()?.toLowerCase();return["jpg","jpeg","png","gif","webp","svg","bmp","ico"].includes(e||"")}function oe(i){const e=T.c(41),{item:t,onNavigate:g,onDownload:a,onDelete:d}=i;let n;e[0]!==t.key?(n=R(t.key),e[0]=t.key,e[1]=n):n=e[1];const l=n,h=t.isFolder?"Folder":W(t.key),u=se[h]||I;let y;e[2]!==t.isFolder||e[3]!==t.key?(y=!t.isFolder&&re(t.key),e[2]=t.isFolder,e[3]=t.key,e[4]=y):y=e[4];const c=y;let f;e[5]!==t.isFolder||e[6]!==t.key||e[7]!==g?(f=()=>t.isFolder?g(t.key):void 0,e[5]=t.isFolder,e[6]=t.key,e[7]=g,e[8]=f):f=e[8];const b=!c&&"p-4",k=t.isFolder?"cursor-pointer":"cursor-default";let x;e[9]!==b||e[10]!==k?(x=$("flex flex-col items-center justify-center w-full h-full",b,k),e[9]=b,e[10]=k,e[11]=x):x=e[11];let j;e[12]!==u||e[13]!==c||e[14]!==t.isFolder||e[15]!==t.key||e[16]!==l?(j=c?s.jsx("div",{className:"absolute inset-0",children:s.jsx(te,{objectKey:t.key,alt:l})}):s.jsx(u,{size:48,className:$(t.isFolder?"text-amber-500":"text-muted-foreground")}),e[12]=u,e[13]=c,e[14]=t.isFolder,e[15]=t.key,e[16]=l,e[17]=j):j=e[17];let p;e[18]!==c||e[19]!==t.isFolder||e[20]!==t.size||e[21]!==l?(p=c?s.jsxs("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2 pt-6",children:[s.jsx("span",{className:"text-sm text-white text-center line-clamp-1 block",children:l}),s.jsx("span",{className:"text-xs text-white/70 text-center block",children:U(t.size)})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"mt-3 text-sm text-center line-clamp-2 px-2",children:l}),!t.isFolder&&s.jsx("span",{className:"mt-1 text-xs text-muted-foreground",children:U(t.size)})]}),e[18]=c,e[19]=t.isFolder,e[20]=t.size,e[21]=l,e[22]=p):p=e[22];let r;e[23]!==f||e[24]!==x||e[25]!==j||e[26]!==p?(r=s.jsxs("button",{type:"button",onClick:f,className:x,children:[j,p]}),e[23]=f,e[24]=x,e[25]=j,e[26]=p,e[27]=r):r=e[27];let o;e[28]!==t.isFolder||e[29]!==t.key||e[30]!==d||e[31]!==a?(o=!t.isFolder&&s.jsxs("div",{className:"absolute top-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(E,{variant:"secondary",size:"sm",className:"size-7 p-0",onClick:F=>{F.stopPropagation(),a(t.key)},children:s.jsx(A,{size:14})}),s.jsx(E,{variant:"secondary",size:"sm",className:"size-7 p-0 text-destructive hover:text-destructive",onClick:F=>{F.stopPropagation(),d(t.key)},children:s.jsx(V,{size:14})})]}),e[28]=t.isFolder,e[29]=t.key,e[30]=d,e[31]=a,e[32]=o):o=e[32];let m;e[33]!==t.isFolder||e[34]!==t.key||e[35]!==d?(m=t.isFolder&&s.jsx("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:s.jsx(E,{variant:"secondary",size:"sm",className:"size-7 p-0 text-destructive hover:text-destructive",onClick:F=>{F.stopPropagation(),d(t.key)},children:s.jsx(V,{size:14})})}),e[33]=t.isFolder,e[34]=t.key,e[35]=d,e[36]=m):m=e[36];let N;return e[37]!==o||e[38]!==m||e[39]!==r?(N=s.jsxs("div",{className:"group relative aspect-square bg-muted/30 rounded-lg border border-border hover:border-primary/50 hover:bg-muted/50 transition-colors overflow-hidden",children:[r,o,m]}),e[37]=o,e[38]=m,e[39]=r,e[40]=N):N=e[40],N}function Fe({prefix:i,flat:e,onNavigate:t}){const g=v.useRef(null),a=q(),{connectionId:d,toolCaller:n}=D(),{objects:l,isLoading:h,isFetchingMore:u,hasMore:y,loadMore:c,error:f}=Z({prefix:i,flat:e,pageSize:z}),b=_({mutationFn:async r=>{const o=i+r.name,{url:m}=await n("PUT_PRESIGNED_URL",{key:o,contentType:r.type||"application/octet-stream"}),N=await fetch(m,{method:"PUT",body:r,headers:{"Content-Type":r.type||"application/octet-stream"}});if(!N.ok)throw new Error(`Upload failed: ${N.statusText}`);return o},onSuccess:r=>{w.success(`Uploaded ${R(r)}`),a.invalidateQueries({queryKey:L.objects(d,i,e,z)})},onError:r=>{w.error(`Upload failed: ${r.message}`)}}),k=_({mutationFn:async r=>r.length===1&&r[0]?n("DELETE_OBJECT",{key:r[0]}):n("DELETE_OBJECTS",{keys:r}),onSuccess:()=>{w.success("Deleted successfully"),a.invalidateQueries({queryKey:L.objects(d,i,e,z)})},onError:r=>{w.error(`Delete failed: ${r.message}`)}}),x=async r=>{try{const{url:o}=await n("GET_PRESIGNED_URL",{key:r}),m=await fetch(o);if(!m.ok)throw new Error(`Failed to fetch file: ${m.statusText}`);const N=await m.blob(),F=URL.createObjectURL(N),C=document.createElement("a");C.href=F,C.download=R(r),document.body.appendChild(C),C.click(),document.body.removeChild(C),URL.revokeObjectURL(F)}catch(o){w.error(`Download failed: ${o instanceof Error?o.message:"Unknown error"}`)}},j=r=>{const o=r.target.files;if(o){for(const m of Array.from(o))b.mutate(m);r.target.value=""}},p=r=>{if(!y||u)return;const o=r.currentTarget;o.scrollHeight-o.scrollTop-o.clientHeight<200&&c()};return f?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8",children:[s.jsx(S,{size:48,className:"text-destructive mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"Error loading files"}),s.jsx("p",{className:"text-muted-foreground text-center",children:f.message})]}):s.jsx("div",{className:"flex-1 overflow-y-auto p-4",onScroll:p,children:h?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[s.jsx(M,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading files..."})]}):l.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(Q,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"This folder is empty"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Upload files to get started"}),s.jsx("input",{ref:g,type:"file",multiple:!0,className:"hidden",onChange:j}),s.jsxs(E,{variant:"outline",onClick:()=>g.current?.click(),children:[s.jsx(Y,{size:14,className:"mr-1"}),"Upload files"]})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4",children:l.map(r=>s.jsx(oe,{item:r,onNavigate:t,onDownload:x,onDelete:o=>k.mutate([o])},r.key))}),u&&s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(M,{size:24,className:"animate-spin text-muted-foreground"})})]})})}export{Fe as default};
@@ -1 +1 @@
1
- import{c as f,j as s,a as I,r as C,e as F,f as E,x as O,t as w}from"./index-skH-OUyO.js";import{C as k}from"./card-Bjs7HBa2.js";import{c as y,B as $}from"./button-Dh_UOMtF.js";import{A as R}from"./avatar-noXapmql.js";import{i as D}from"./AlertCircle-DeGhTF84.js";import{i as H}from"./Check-Cs5AiVxS.js";import{s as G}from"./Plus-CPExS1G1.js";import{i as Q}from"./SearchMd-DwKDi1yz.js";import{s as q}from"./XClose-s9vu-dQj.js";import{I as B}from"./input-CdlPz8Vq.js";import{C as T}from"./create-organization-dialog-B19KPYZ1.js";import"./alert-dialog-CNXrLp-S.js";import"./form-BEM8UzSv.js";import"./spinner-DwVZzFPC.js";import"./useMutation-n0xwrWOz.js";function U(t){const e=f.c(10),{children:n,className:l,onNavigate:i,showHoverRing:r}=t,d=r===void 0?!1:r;let o;e[0]!==i?(o=p=>{i&&i(p)},e[0]=i,e[1]=o):o=e[1];const m=o,x=i&&"cursor-pointer",a=d&&"hover:ring-2 hover:ring-primary";let c;e[2]!==l||e[3]!==x||e[4]!==a?(c=y("group transition-all flex flex-col gap-0",x,a,l),e[2]=l,e[3]=x,e[4]=a,e[5]=c):c=e[5];let g;return e[6]!==n||e[7]!==m||e[8]!==c?(g=s.jsx(k,{className:c,onClick:m,children:n}),e[6]=n,e[7]=m,e[8]=c,e[9]=g):g=e[9],g}function M(t){const e=f.c(7),{url:n,fallback:l,shape:i,size:r,objectFit:d,className:o}=t,m=i===void 0?"square":i,x=r===void 0?"lg":r,a=d===void 0?"contain":d;let c;return e[0]!==o||e[1]!==l||e[2]!==a||e[3]!==m||e[4]!==x||e[5]!==n?(c=s.jsx(R,{url:n,fallback:l,shape:m,size:x,objectFit:a,className:o}),e[0]=o,e[1]=l,e[2]=a,e[3]=m,e[4]=x,e[5]=n,e[6]=c):c=e[6],c}function P(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("p-4 flex flex-col gap-4",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function V(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("font-medium truncate",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("p",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function X(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("text-sm text-muted-foreground truncate",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("h3",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function Y(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("flex flex-col gap-[2px]",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function J(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("flex justify-between items-start",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function K(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("p-4 border-t border-border flex justify-between items-center",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function W(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("flex items-center text-xs text-muted-foreground",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function Z(){const t=f.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex justify-between items-start",children:s.jsx("div",{className:"h-12 w-12 bg-muted rounded-lg animate-pulse"})}),t[0]=e):e=t[0];let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs("div",{className:"p-4 flex flex-col gap-4",children:[e,s.jsxs("div",{className:"flex flex-col gap-[2px]",children:[s.jsx("div",{className:"h-4 w-32 bg-muted rounded-lg animate-pulse"}),s.jsx("div",{className:"h-4 w-40 bg-muted rounded-lg animate-pulse"})]})]}),t[1]=n):n=t[1];let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs(k,{className:"group transition-colors flex flex-col",children:[n,s.jsxs("div",{className:"p-4 border-t border-border flex justify-between items-center",children:[s.jsx("div",{className:"h-6 w-6 bg-muted rounded-full animate-pulse"}),s.jsx("div",{className:"h-6 w-6 bg-muted rounded-full animate-pulse -ml-2"})]})]}),t[2]=l):l=t[2],l}const u=Object.assign(U,{Avatar:M,AvatarSection:J,Header:P,Title:V,Subtitle:X,Content:Y,Footer:K,Badge:W,Skeleton:Z}),ee={0:"gap-0",1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6",8:"gap-8"},te={1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",7:"grid-cols-7",8:"grid-cols-8"},se={1:"@min-3xl:grid-cols-1",2:"@min-3xl:grid-cols-2",3:"@min-3xl:grid-cols-3",4:"@min-3xl:grid-cols-4",5:"@min-3xl:grid-cols-5",6:"@min-3xl:grid-cols-6",7:"@min-3xl:grid-cols-7",8:"@min-3xl:grid-cols-8"},ie={1:"@min-6xl:grid-cols-1",2:"@min-6xl:grid-cols-2",3:"@min-6xl:grid-cols-3",4:"@min-6xl:grid-cols-4",5:"@min-6xl:grid-cols-5",6:"@min-6xl:grid-cols-6",7:"@min-6xl:grid-cols-7",8:"@min-6xl:grid-cols-8"},le={1:"@min-7xl:grid-cols-1",2:"@min-7xl:grid-cols-2",3:"@min-7xl:grid-cols-3",4:"@min-7xl:grid-cols-4",5:"@min-7xl:grid-cols-5",6:"@min-7xl:grid-cols-6",7:"@min-7xl:grid-cols-7",8:"@min-7xl:grid-cols-8"},ne={1:"@min-8xl:grid-cols-1",2:"@min-8xl:grid-cols-2",3:"@min-8xl:grid-cols-3",4:"@min-8xl:grid-cols-4",5:"@min-8xl:grid-cols-5",6:"@min-8xl:grid-cols-6",7:"@min-8xl:grid-cols-7",8:"@min-8xl:grid-cols-8"};function L(t){const e=f.c(13),{children:n,columns:l,gap:i,className:r}=t;let d;e[0]!==l?(d=l===void 0?{sm:2,md:3,lg:4}:l,e[0]=l,e[1]=d):d=e[1];const o=d,x=ee[i===void 0?4:i],a=o.sm&&te[o.sm],c=o.md&&se[o.md],g=o.lg&&ie[o.lg],p=o.xl&&le[o.xl],v=o["2xl"]&&ne[o["2xl"]];let N;e[2]!==r||e[3]!==x||e[4]!==a||e[5]!==c||e[6]!==g||e[7]!==p||e[8]!==v?(N=y("w-full grid",x,a,c,g,p,v,r),e[2]=r,e[3]=x,e[4]=a,e[5]=c,e[6]=g,e[7]=p,e[8]=v,e[9]=N):N=e[9];const b=N;let h;return e[10]!==n||e[11]!==b?(h=s.jsx("div",{className:b,children:n}),e[10]=n,e[11]=b,e[12]=h):h=e[12],h}function re(t){const e=f.c(9),{count:n,columns:l,gap:i,className:r}=t,d=n===void 0?8:n;let o;e[0]!==l?(o=l===void 0?{sm:2,md:3,lg:4}:l,e[0]=l,e[1]=o):o=e[1];const m=o,x=i===void 0?4:i;let a;e[2]!==d?(a=Array.from({length:d}).map(ae),e[2]=d,e[3]=a):a=e[3];let c;return e[4]!==r||e[5]!==m||e[6]!==x||e[7]!==a?(c=s.jsx(L,{columns:m,gap:x,className:r,children:a}),e[4]=r,e[5]=m,e[6]=x,e[7]=a,e[8]=c):c=e[8],c}function ae(t,e){return s.jsxs("div",{className:"bg-card hover:bg-accent transition-colors flex flex-col rounded-lg animate-pulse",children:[s.jsxs("div",{className:"p-4 flex flex-col gap-4",children:[s.jsx("div",{className:"h-12 w-12 bg-muted rounded-lg"}),s.jsx("div",{className:"h-4 w-32 bg-muted rounded-lg"}),s.jsx("div",{className:"h-4 w-32 bg-muted rounded-lg"})]}),s.jsxs("div",{className:"p-4 border-t border-border flex items-center",children:[s.jsx("div",{className:"h-6 w-6 bg-muted rounded-full animate-pulse"}),s.jsx("div",{className:"h-6 w-6 bg-muted rounded-full animate-pulse -ml-2"}),s.jsx("div",{className:"h-6 w-6 bg-muted rounded-full animate-pulse -ml-2"})]})]},e)}const A=Object.assign(L,{Skeleton:re});function oe({invitation:t}){const[e,n]=C.useState(!1),[l,i]=C.useState(!1),r=O(),d=E(),o=async()=>{n(!0);try{const a=await I.organization.acceptInvitation({invitationId:t.id});if(a.error)w.error(a.error.message),n(!1);else{const c=await I.organization.setActive({organizationId:t.organizationId});c?.data?.slug?(w.success("Invitation accepted!"),d({to:"/$org",params:{org:c.data.slug}})):(w.success("Invitation accepted! Redirecting..."),d({to:"/"}))}}catch{w.error("Failed to accept invitation"),n(!1)}},m=async()=>{i(!0);try{const a=await I.organization.rejectInvitation({invitationId:t.id});a.error?(w.error(a.error.message),i(!1)):(w.success("Invitation rejected"),await r.invalidateQueries(),i(!1))}catch{w.error("Failed to reject invitation"),i(!1)}},x=t.organizationName||t.organizationId;return s.jsxs(u,{className:"border-dashed",children:[s.jsxs(u.Header,{children:[s.jsx(u.AvatarSection,{children:s.jsx(u.Avatar,{url:"",fallback:x,size:"lg",objectFit:"contain"})}),s.jsxs(u.Content,{children:[s.jsx(u.Subtitle,{children:"You've been invited to join"}),s.jsx(u.Title,{children:x})]})]}),s.jsx(u.Footer,{className:"border-t border-dashed",children:s.jsxs("div",{className:"flex h-3.5 items-center gap-2 w-full",children:[s.jsx($,{onClick:o,disabled:e||l,className:"flex-1",size:"sm",children:e?"Accepting...":s.jsxs(s.Fragment,{children:[s.jsx(H,{size:16}),"Accept"]})}),s.jsx($,{variant:"outline",onClick:m,disabled:e||l,className:"flex-1",size:"sm",children:l?"Declining...":s.jsxs(s.Fragment,{children:[s.jsx(q,{size:16}),"Decline"]})})]})})]})}function ce({query:t}){const e=C.useContext(F),{data:n}=e.hooks.useListUserInvitations(),i=(n??[]).filter(d=>d.status==="pending"),r=t?(()=>{const d=t.toLowerCase();return i.filter(o=>o.organizationName?.toLowerCase().includes(d)||o.organizationId.toLowerCase().includes(d))})():i;return r.length===0?null:s.jsxs("div",{className:"mb-16",children:[s.jsx("h2",{className:"text-lg font-medium pb-2 border-b border-border/50 mb-6 px-2",children:"Invitations"}),s.jsx(A,{columns:{sm:2,md:3,lg:4},children:r.map(d=>s.jsx(oe,{invitation:d},d.id))})]})}function de(t){const e=f.c(14),{query:n}=t,{data:l}=I.useListOrganizations(),i=E();let r;e[0]!==l||e[1]!==n?(r=l?n?(()=>{const a=n.toLowerCase();return l.filter(c=>c.name.toLowerCase().includes(a)||c.slug.toLowerCase().includes(a))})():l:[],e[0]=l,e[1]=n,e[2]=r):r=e[2];const d=r;if(!l||l.length===0){let a;return e[3]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"No organizations yet. Create your first organization to get started."})}),e[3]=a):a=e[3],a}if(d.length===0){let a;return e[4]!==n?(a=s.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:s.jsxs("div",{className:"text-sm text-muted-foreground text-center",children:['No organizations found matching "',n,'".']})}),e[4]=n,e[5]=a):a=e[5],a}let o;e[6]===Symbol.for("react.memo_cache_sentinel")?(o={sm:2,md:3,lg:4},e[6]=o):o=e[6];let m;if(e[7]!==d||e[8]!==i){let a;e[10]!==i?(a=c=>s.jsxs(u,{onNavigate:()=>i({to:"/$org",params:{org:c.slug}}),children:[s.jsxs(u.Header,{children:[s.jsx(u.AvatarSection,{children:s.jsx(u.Avatar,{url:c.logo||"",fallback:c.name,size:"lg",objectFit:"contain"})}),s.jsxs(u.Content,{children:[s.jsxs(u.Subtitle,{children:["@",c.slug]}),s.jsx(u.Title,{children:c.name})]})]}),s.jsx(u.Footer,{children:s.jsxs("div",{className:"flex h-3.5 items-center text-xs text-muted-foreground",children:["Created:"," ",new Date(c.createdAt).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})]})})]},c.id),e[10]=i,e[11]=a):a=e[11],m=d.map(a),e[7]=d,e[8]=i,e[9]=m}else m=e[9];let x;return e[12]!==m?(x=s.jsx(A,{columns:o,children:m}),e[12]=m,e[13]=x):x=e[13],x}function me(t){const e=f.c(3),{error:n}=t;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(D,{size:24,className:"text-destructive"}),e[0]=l):l=e[0];let i;return e[1]!==n.message?(i=s.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[l,s.jsxs("div",{className:"text-sm text-muted-foreground text-center",children:["Error loading organizations: ",n.message]})]}),e[1]=n.message,e[2]=i):i=e[2],i}function xe(){const t=f.c(27),{error:e,isPending:n}=I.useListOrganizations(),[l,i]=C.useState(""),[r,d]=C.useState(!1),o=C.useDeferredValue(l);if(n){let j;return t[0]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("div",{className:"max-w-6xl mx-auto p-8",children:s.jsx("div",{className:"@container",children:s.jsx(A.Skeleton,{count:8,columns:{sm:2,md:3,lg:4}})})}),t[0]=j):j=t[0],j}if(e){let j;return t[1]!==e?(j=s.jsx("div",{className:"max-w-6xl mx-auto p-8",children:s.jsx(me,{error:e})}),t[1]=e,t[2]=j):j=t[2],j}let m;t[3]!==o?(m=s.jsx(C.Suspense,{fallback:null,children:s.jsx(ce,{query:o})}),t[3]=o,t[4]=m):m=t[4];let x;t[5]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx("h2",{className:"text-lg font-medium",children:"My organizations"}),t[5]=x):x=t[5];let a;t[6]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(Q,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),t[6]=a):a=t[6];let c;t[7]===Symbol.for("react.memo_cache_sentinel")?(c=j=>i(j.target.value),t[7]=c):c=t[7];let g;t[8]!==l?(g=s.jsxs("div",{className:"relative",children:[a,s.jsx(B,{className:"pl-8 h-8 w-52 border-none shadow-none focus-visible:ring-0",placeholder:"Search organizations...",value:l,onChange:c})]}),t[8]=l,t[9]=g):g=t[9];let p;t[10]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsxs($,{size:"sm",onClick:()=>d(!0),children:[s.jsx(G,{size:16}),s.jsx("span",{children:"New organization"})]}),t[10]=p):p=t[10];let v;t[11]!==g?(v=s.jsxs("div",{className:"flex items-center justify-between pb-2 border-b border-border/50 mb-6 px-2",children:[x,s.jsxs("div",{className:"flex items-center gap-3",children:[g,p]})]}),t[11]=g,t[12]=v):v=t[12];let N;t[13]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(A.Skeleton,{count:8,columns:{sm:2,md:3,lg:4}}),t[13]=N):N=t[13];let b;t[14]!==o?(b=s.jsx(C.Suspense,{fallback:N,children:s.jsx(de,{query:o})}),t[14]=o,t[15]=b):b=t[15];let h;t[16]!==v||t[17]!==b?(h=s.jsxs("div",{children:[v,b]}),t[16]=v,t[17]=b,t[18]=h):h=t[18];let S;t[19]!==m||t[20]!==h?(S=s.jsxs("div",{className:"@container",children:[m,h]}),t[19]=m,t[20]=h,t[21]=S):S=t[21];let z;t[22]!==r?(z=s.jsx(T,{open:r,onOpenChange:d}),t[22]=r,t[23]=z):z=t[23];let _;return t[24]!==S||t[25]!==z?(_=s.jsxs("div",{className:"max-w-6xl mx-auto p-8",children:[S,z]}),t[24]=S,t[25]=z,t[26]=_):_=t[26],_}function _e(){const t=f.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"min-h-full",children:s.jsx(xe,{})}),t[0]=e):e=t[0],e}export{_e as default};
1
+ import{c as f,j as s,a as I,r as C,e as F,f as E,x as O,t as w}from"./index-Diww4UW3.js";import{C as k}from"./card-DIjMh1NO.js";import{c as y,B as $}from"./button-CGmrzkpY.js";import{A as R}from"./avatar-B7xnPXuk.js";import{i as D}from"./AlertCircle-CI2U-jkN.js";import{i as H}from"./Check-BQkm1TiP.js";import{s as G}from"./Plus-CdG75X26.js";import{i as Q}from"./SearchMd-GFaonOaJ.js";import{s as q}from"./XClose-CfwoKknl.js";import{I as B}from"./input-CrURMEZe.js";import{C as T}from"./create-organization-dialog-CtbMd6S_.js";import"./alert-dialog-CCJCsKzK.js";import"./form-DiGzBnRK.js";import"./spinner-BF56RAKQ.js";import"./useMutation-Dl1MMkEC.js";function U(t){const e=f.c(10),{children:n,className:l,onNavigate:i,showHoverRing:r}=t,d=r===void 0?!1:r;let o;e[0]!==i?(o=p=>{i&&i(p)},e[0]=i,e[1]=o):o=e[1];const m=o,x=i&&"cursor-pointer",a=d&&"hover:ring-2 hover:ring-primary";let c;e[2]!==l||e[3]!==x||e[4]!==a?(c=y("group transition-all flex flex-col gap-0",x,a,l),e[2]=l,e[3]=x,e[4]=a,e[5]=c):c=e[5];let g;return e[6]!==n||e[7]!==m||e[8]!==c?(g=s.jsx(k,{className:c,onClick:m,children:n}),e[6]=n,e[7]=m,e[8]=c,e[9]=g):g=e[9],g}function M(t){const e=f.c(7),{url:n,fallback:l,shape:i,size:r,objectFit:d,className:o}=t,m=i===void 0?"square":i,x=r===void 0?"lg":r,a=d===void 0?"contain":d;let c;return e[0]!==o||e[1]!==l||e[2]!==a||e[3]!==m||e[4]!==x||e[5]!==n?(c=s.jsx(R,{url:n,fallback:l,shape:m,size:x,objectFit:a,className:o}),e[0]=o,e[1]=l,e[2]=a,e[3]=m,e[4]=x,e[5]=n,e[6]=c):c=e[6],c}function P(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("p-4 flex flex-col gap-4",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function V(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("font-medium truncate",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("p",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function X(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("text-sm text-muted-foreground truncate",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("h3",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function Y(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("flex flex-col gap-[2px]",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function J(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("flex justify-between items-start",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function K(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("p-4 border-t border-border flex justify-between items-center",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function W(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("flex items-center text-xs text-muted-foreground",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function Z(){const t=f.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex justify-between items-start",children:s.jsx("div",{className:"h-12 w-12 bg-muted rounded-lg animate-pulse"})}),t[0]=e):e=t[0];let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs("div",{className:"p-4 flex flex-col gap-4",children:[e,s.jsxs("div",{className:"flex flex-col gap-[2px]",children:[s.jsx("div",{className:"h-4 w-32 bg-muted rounded-lg animate-pulse"}),s.jsx("div",{className:"h-4 w-40 bg-muted rounded-lg animate-pulse"})]})]}),t[1]=n):n=t[1];let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs(k,{className:"group transition-colors flex flex-col",children:[n,s.jsxs("div",{className:"p-4 border-t border-border flex justify-between items-center",children:[s.jsx("div",{className:"h-6 w-6 bg-muted rounded-full animate-pulse"}),s.jsx("div",{className:"h-6 w-6 bg-muted rounded-full animate-pulse -ml-2"})]})]}),t[2]=l):l=t[2],l}const u=Object.assign(U,{Avatar:M,AvatarSection:J,Header:P,Title:V,Subtitle:X,Content:Y,Footer:K,Badge:W,Skeleton:Z}),ee={0:"gap-0",1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6",8:"gap-8"},te={1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",7:"grid-cols-7",8:"grid-cols-8"},se={1:"@min-3xl:grid-cols-1",2:"@min-3xl:grid-cols-2",3:"@min-3xl:grid-cols-3",4:"@min-3xl:grid-cols-4",5:"@min-3xl:grid-cols-5",6:"@min-3xl:grid-cols-6",7:"@min-3xl:grid-cols-7",8:"@min-3xl:grid-cols-8"},ie={1:"@min-6xl:grid-cols-1",2:"@min-6xl:grid-cols-2",3:"@min-6xl:grid-cols-3",4:"@min-6xl:grid-cols-4",5:"@min-6xl:grid-cols-5",6:"@min-6xl:grid-cols-6",7:"@min-6xl:grid-cols-7",8:"@min-6xl:grid-cols-8"},le={1:"@min-7xl:grid-cols-1",2:"@min-7xl:grid-cols-2",3:"@min-7xl:grid-cols-3",4:"@min-7xl:grid-cols-4",5:"@min-7xl:grid-cols-5",6:"@min-7xl:grid-cols-6",7:"@min-7xl:grid-cols-7",8:"@min-7xl:grid-cols-8"},ne={1:"@min-8xl:grid-cols-1",2:"@min-8xl:grid-cols-2",3:"@min-8xl:grid-cols-3",4:"@min-8xl:grid-cols-4",5:"@min-8xl:grid-cols-5",6:"@min-8xl:grid-cols-6",7:"@min-8xl:grid-cols-7",8:"@min-8xl:grid-cols-8"};function L(t){const e=f.c(13),{children:n,columns:l,gap:i,className:r}=t;let d;e[0]!==l?(d=l===void 0?{sm:2,md:3,lg:4}:l,e[0]=l,e[1]=d):d=e[1];const o=d,x=ee[i===void 0?4:i],a=o.sm&&te[o.sm],c=o.md&&se[o.md],g=o.lg&&ie[o.lg],p=o.xl&&le[o.xl],v=o["2xl"]&&ne[o["2xl"]];let N;e[2]!==r||e[3]!==x||e[4]!==a||e[5]!==c||e[6]!==g||e[7]!==p||e[8]!==v?(N=y("w-full grid",x,a,c,g,p,v,r),e[2]=r,e[3]=x,e[4]=a,e[5]=c,e[6]=g,e[7]=p,e[8]=v,e[9]=N):N=e[9];const b=N;let h;return e[10]!==n||e[11]!==b?(h=s.jsx("div",{className:b,children:n}),e[10]=n,e[11]=b,e[12]=h):h=e[12],h}function re(t){const e=f.c(9),{count:n,columns:l,gap:i,className:r}=t,d=n===void 0?8:n;let o;e[0]!==l?(o=l===void 0?{sm:2,md:3,lg:4}:l,e[0]=l,e[1]=o):o=e[1];const m=o,x=i===void 0?4:i;let a;e[2]!==d?(a=Array.from({length:d}).map(ae),e[2]=d,e[3]=a):a=e[3];let c;return e[4]!==r||e[5]!==m||e[6]!==x||e[7]!==a?(c=s.jsx(L,{columns:m,gap:x,className:r,children:a}),e[4]=r,e[5]=m,e[6]=x,e[7]=a,e[8]=c):c=e[8],c}function ae(t,e){return s.jsxs("div",{className:"bg-card hover:bg-accent transition-colors flex flex-col rounded-lg animate-pulse",children:[s.jsxs("div",{className:"p-4 flex flex-col gap-4",children:[s.jsx("div",{className:"h-12 w-12 bg-muted rounded-lg"}),s.jsx("div",{className:"h-4 w-32 bg-muted rounded-lg"}),s.jsx("div",{className:"h-4 w-32 bg-muted rounded-lg"})]}),s.jsxs("div",{className:"p-4 border-t border-border flex items-center",children:[s.jsx("div",{className:"h-6 w-6 bg-muted rounded-full animate-pulse"}),s.jsx("div",{className:"h-6 w-6 bg-muted rounded-full animate-pulse -ml-2"}),s.jsx("div",{className:"h-6 w-6 bg-muted rounded-full animate-pulse -ml-2"})]})]},e)}const A=Object.assign(L,{Skeleton:re});function oe({invitation:t}){const[e,n]=C.useState(!1),[l,i]=C.useState(!1),r=O(),d=E(),o=async()=>{n(!0);try{const a=await I.organization.acceptInvitation({invitationId:t.id});if(a.error)w.error(a.error.message),n(!1);else{const c=await I.organization.setActive({organizationId:t.organizationId});c?.data?.slug?(w.success("Invitation accepted!"),d({to:"/$org",params:{org:c.data.slug}})):(w.success("Invitation accepted! Redirecting..."),d({to:"/"}))}}catch{w.error("Failed to accept invitation"),n(!1)}},m=async()=>{i(!0);try{const a=await I.organization.rejectInvitation({invitationId:t.id});a.error?(w.error(a.error.message),i(!1)):(w.success("Invitation rejected"),await r.invalidateQueries(),i(!1))}catch{w.error("Failed to reject invitation"),i(!1)}},x=t.organizationName||t.organizationId;return s.jsxs(u,{className:"border-dashed",children:[s.jsxs(u.Header,{children:[s.jsx(u.AvatarSection,{children:s.jsx(u.Avatar,{url:"",fallback:x,size:"lg",objectFit:"contain"})}),s.jsxs(u.Content,{children:[s.jsx(u.Subtitle,{children:"You've been invited to join"}),s.jsx(u.Title,{children:x})]})]}),s.jsx(u.Footer,{className:"border-t border-dashed",children:s.jsxs("div",{className:"flex h-3.5 items-center gap-2 w-full",children:[s.jsx($,{onClick:o,disabled:e||l,className:"flex-1",size:"sm",children:e?"Accepting...":s.jsxs(s.Fragment,{children:[s.jsx(H,{size:16}),"Accept"]})}),s.jsx($,{variant:"outline",onClick:m,disabled:e||l,className:"flex-1",size:"sm",children:l?"Declining...":s.jsxs(s.Fragment,{children:[s.jsx(q,{size:16}),"Decline"]})})]})})]})}function ce({query:t}){const e=C.useContext(F),{data:n}=e.hooks.useListUserInvitations(),i=(n??[]).filter(d=>d.status==="pending"),r=t?(()=>{const d=t.toLowerCase();return i.filter(o=>o.organizationName?.toLowerCase().includes(d)||o.organizationId.toLowerCase().includes(d))})():i;return r.length===0?null:s.jsxs("div",{className:"mb-16",children:[s.jsx("h2",{className:"text-lg font-medium pb-2 border-b border-border/50 mb-6 px-2",children:"Invitations"}),s.jsx(A,{columns:{sm:2,md:3,lg:4},children:r.map(d=>s.jsx(oe,{invitation:d},d.id))})]})}function de(t){const e=f.c(14),{query:n}=t,{data:l}=I.useListOrganizations(),i=E();let r;e[0]!==l||e[1]!==n?(r=l?n?(()=>{const a=n.toLowerCase();return l.filter(c=>c.name.toLowerCase().includes(a)||c.slug.toLowerCase().includes(a))})():l:[],e[0]=l,e[1]=n,e[2]=r):r=e[2];const d=r;if(!l||l.length===0){let a;return e[3]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"No organizations yet. Create your first organization to get started."})}),e[3]=a):a=e[3],a}if(d.length===0){let a;return e[4]!==n?(a=s.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:s.jsxs("div",{className:"text-sm text-muted-foreground text-center",children:['No organizations found matching "',n,'".']})}),e[4]=n,e[5]=a):a=e[5],a}let o;e[6]===Symbol.for("react.memo_cache_sentinel")?(o={sm:2,md:3,lg:4},e[6]=o):o=e[6];let m;if(e[7]!==d||e[8]!==i){let a;e[10]!==i?(a=c=>s.jsxs(u,{onNavigate:()=>i({to:"/$org",params:{org:c.slug}}),children:[s.jsxs(u.Header,{children:[s.jsx(u.AvatarSection,{children:s.jsx(u.Avatar,{url:c.logo||"",fallback:c.name,size:"lg",objectFit:"contain"})}),s.jsxs(u.Content,{children:[s.jsxs(u.Subtitle,{children:["@",c.slug]}),s.jsx(u.Title,{children:c.name})]})]}),s.jsx(u.Footer,{children:s.jsxs("div",{className:"flex h-3.5 items-center text-xs text-muted-foreground",children:["Created:"," ",new Date(c.createdAt).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})]})})]},c.id),e[10]=i,e[11]=a):a=e[11],m=d.map(a),e[7]=d,e[8]=i,e[9]=m}else m=e[9];let x;return e[12]!==m?(x=s.jsx(A,{columns:o,children:m}),e[12]=m,e[13]=x):x=e[13],x}function me(t){const e=f.c(3),{error:n}=t;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(D,{size:24,className:"text-destructive"}),e[0]=l):l=e[0];let i;return e[1]!==n.message?(i=s.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[l,s.jsxs("div",{className:"text-sm text-muted-foreground text-center",children:["Error loading organizations: ",n.message]})]}),e[1]=n.message,e[2]=i):i=e[2],i}function xe(){const t=f.c(27),{error:e,isPending:n}=I.useListOrganizations(),[l,i]=C.useState(""),[r,d]=C.useState(!1),o=C.useDeferredValue(l);if(n){let j;return t[0]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("div",{className:"max-w-6xl mx-auto p-8",children:s.jsx("div",{className:"@container",children:s.jsx(A.Skeleton,{count:8,columns:{sm:2,md:3,lg:4}})})}),t[0]=j):j=t[0],j}if(e){let j;return t[1]!==e?(j=s.jsx("div",{className:"max-w-6xl mx-auto p-8",children:s.jsx(me,{error:e})}),t[1]=e,t[2]=j):j=t[2],j}let m;t[3]!==o?(m=s.jsx(C.Suspense,{fallback:null,children:s.jsx(ce,{query:o})}),t[3]=o,t[4]=m):m=t[4];let x;t[5]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx("h2",{className:"text-lg font-medium",children:"My organizations"}),t[5]=x):x=t[5];let a;t[6]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(Q,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),t[6]=a):a=t[6];let c;t[7]===Symbol.for("react.memo_cache_sentinel")?(c=j=>i(j.target.value),t[7]=c):c=t[7];let g;t[8]!==l?(g=s.jsxs("div",{className:"relative",children:[a,s.jsx(B,{className:"pl-8 h-8 w-52 border-none shadow-none focus-visible:ring-0",placeholder:"Search organizations...",value:l,onChange:c})]}),t[8]=l,t[9]=g):g=t[9];let p;t[10]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsxs($,{size:"sm",onClick:()=>d(!0),children:[s.jsx(G,{size:16}),s.jsx("span",{children:"New organization"})]}),t[10]=p):p=t[10];let v;t[11]!==g?(v=s.jsxs("div",{className:"flex items-center justify-between pb-2 border-b border-border/50 mb-6 px-2",children:[x,s.jsxs("div",{className:"flex items-center gap-3",children:[g,p]})]}),t[11]=g,t[12]=v):v=t[12];let N;t[13]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(A.Skeleton,{count:8,columns:{sm:2,md:3,lg:4}}),t[13]=N):N=t[13];let b;t[14]!==o?(b=s.jsx(C.Suspense,{fallback:N,children:s.jsx(de,{query:o})}),t[14]=o,t[15]=b):b=t[15];let h;t[16]!==v||t[17]!==b?(h=s.jsxs("div",{children:[v,b]}),t[16]=v,t[17]=b,t[18]=h):h=t[18];let S;t[19]!==m||t[20]!==h?(S=s.jsxs("div",{className:"@container",children:[m,h]}),t[19]=m,t[20]=h,t[21]=S):S=t[21];let z;t[22]!==r?(z=s.jsx(T,{open:r,onOpenChange:d}),t[22]=r,t[23]=z):z=t[23];let _;return t[24]!==S||t[25]!==z?(_=s.jsxs("div",{className:"max-w-6xl mx-auto p-8",children:[S,z]}),t[24]=S,t[25]=z,t[26]=_):_=t[26],_}function _e(){const t=f.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"min-h-full",children:s.jsx(xe,{})}),t[0]=e):e=t[0],e}export{_e as default};