decocms 3.67.2 → 3.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/dist/client/assets/{AlertCircle-BmclRZ36.js → AlertCircle-DhaQx9Mx.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-DfyRpa7I.js → ArrowUpRight-CfMwsozc.js} +1 -1
  3. package/dist/client/assets/{CheckCircle-chlyBg2w.js → CheckCircle-DTbDatzD.js} +1 -1
  4. package/dist/client/assets/{ChevronDown-xnujHbma.js → ChevronDown-6sFYQ_lK.js} +1 -1
  5. package/dist/client/assets/{ChevronLeft-D-0b0jaB.js → ChevronLeft-8zvGG53e.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-DgGMjNQ2.js → ChevronRight-BdMquS3m.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-ssLglSfS.js → ChevronUp-BNOOOsT2.js} +1 -1
  8. package/dist/client/assets/{DotsVertical-DET7Jl3A.js → DotsVertical-DQ-WKmA2.js} +1 -1
  9. package/dist/client/assets/{Eye-Cfz6tZ15.js → Eye-B4uYcIta.js} +1 -1
  10. package/dist/client/assets/{FilterLines-Dh9wNNXi.js → FilterLines-DCvNnP3i.js} +1 -1
  11. package/dist/client/assets/{Globe01-ewHp_9uK.js → Globe01-C7fVaUrg.js} +1 -1
  12. package/dist/client/assets/{Globe04-CAyiWi73.js → Globe04-Bwx3UG2x.js} +1 -1
  13. package/dist/client/assets/{HardDrive-ABAtWBN-.js → HardDrive-BOa3mtdo.js} +1 -1
  14. package/dist/client/assets/{Key01-JG8IVIcf.js → Key01-B-9ep-9Z.js} +1 -1
  15. package/dist/client/assets/{LayoutLeft-BAEXcrIX.js → LayoutLeft-XZqot3mq.js} +1 -1
  16. package/dist/client/assets/{LinkExternal01-BDty9NTy.js → LinkExternal01-iioOg4ap.js} +1 -1
  17. package/dist/client/assets/{Monitor01-BPADhIbr.js → Monitor01-DL3Tirrd.js} +1 -1
  18. package/dist/client/assets/{Palette-xtfhSkOy.js → Palette-pv0gmxnS.js} +1 -1
  19. package/dist/client/assets/{Play-BfqfXtxE.js → Play-DXtyMrcP.js} +1 -1
  20. package/dist/client/assets/{Plus-bN4DDzHM.js → Plus-J1K3Rh3s.js} +1 -1
  21. package/dist/client/assets/{SearchMd-JGuF2SJ3.js → SearchMd-CjaRzuTt.js} +1 -1
  22. package/dist/client/assets/{Settings02-DE29vYCu.js → Settings02-By0Jzp86.js} +1 -1
  23. package/dist/client/assets/{Shield01-n-a01HQd.js → Shield01-M8Hvv7sS.js} +1 -1
  24. package/dist/client/assets/{Star01-N3VFSdvZ.js → Star01-_Kd09vMY.js} +1 -1
  25. package/dist/client/assets/{Stars01-DsonRyoA.js → Stars01-DyLJc1qm.js} +1 -1
  26. package/dist/client/assets/{Stars02-mzsf2wYL.js → Stars02-CDIgaXAV.js} +1 -1
  27. package/dist/client/assets/{Sun-BstscSya.js → Sun-TGwF56wV.js} +1 -1
  28. package/dist/client/assets/{SwitchHorizontal01-D9okikgy.js → SwitchHorizontal01-X5LMtCou.js} +1 -1
  29. package/dist/client/assets/{Tool01-CzZMajtM.js → Tool01-Dw4_QC3_.js} +1 -1
  30. package/dist/client/assets/{Trash01-CVFvFDNw.js → Trash01-Cib_Sg7t.js} +1 -1
  31. package/dist/client/assets/{Upload01-nR0-bkCf.js → Upload01-CJqoFPBG.js} +1 -1
  32. package/dist/client/assets/{User01-DN5mCg88.js → User01-BywBiT-b.js} +1 -1
  33. package/dist/client/assets/{Users01-Dpm21bW1.js → Users01-CDCapXFR.js} +1 -1
  34. package/dist/client/assets/{Users03-TDNky6LJ.js → Users03-4g5nbjFJ.js} +1 -1
  35. package/dist/client/assets/{X-vxJbcFZu.js → X-BL2gdXEj.js} +1 -1
  36. package/dist/client/assets/{XCircle-3mnhYuh7.js → XCircle-CCiKaJ__.js} +1 -1
  37. package/dist/client/assets/{XClose-BWmveN5G.js → XClose-BtRDneKm.js} +1 -1
  38. package/dist/client/assets/{Zap-CPGAbdIn.js → Zap-B8ZLhQFM.js} +1 -1
  39. package/dist/client/assets/{ZapSquare-DtlZ0XtN.js → ZapSquare-J9sfjhfh.js} +1 -1
  40. package/dist/client/assets/{ZoomOut-Bv-x8t-3.js → ZoomOut-DCv2Tq6d.js} +1 -1
  41. package/dist/client/assets/{access-gate-Cjtt7v5f.js → access-gate-DFiTys6s.js} +1 -1
  42. package/dist/client/assets/{add-section-modal-BHRYoEPv.js → add-section-modal-ClOPZlnc.js} +1 -1
  43. package/dist/client/assets/{agent-icon-CHsmfzrp.js → agent-icon-Cf9b4Ru9.js} +1 -1
  44. package/dist/client/assets/{agents-list-8AgmuC9x.js → agents-list-C5u1JJrt.js} +1 -1
  45. package/dist/client/assets/{ai-providers-DQ7QvCkL.js → ai-providers-5s3h35FZ.js} +1 -1
  46. package/dist/client/assets/{alert-Cmmqv3gG.js → alert-DGGvXsmf.js} +1 -1
  47. package/dist/client/assets/{alert-dialog-DFBPrUlf.js → alert-dialog-C20YoJ0a.js} +1 -1
  48. package/dist/client/assets/app-editor-B87jVOIH.js +1 -0
  49. package/dist/client/assets/{auth-k-iFGlch.js → auth-RitCYkp6.js} +1 -1
  50. package/dist/client/assets/{auth-catchall-DnS0SsMp.js → auth-catchall-DwJMWiTa.js} +1 -1
  51. package/dist/client/assets/{auth-split-layout-B4NUZNui.js → auth-split-layout-BUqeR5HU.js} +1 -1
  52. package/dist/client/assets/{automation-list-row-BkSS1u9G.js → automation-list-row-BGAGsR0l.js} +1 -1
  53. package/dist/client/assets/{automation-runs-BYdznHPE.js → automation-runs-Dzg3ROYw.js} +1 -1
  54. package/dist/client/assets/{automations-C69mMjzM.js → automations-CxAwu4Kg.js} +1 -1
  55. package/dist/client/assets/{avatar-BJDY188d.js → avatar-Nw1x5eGz.js} +1 -1
  56. package/dist/client/assets/{badge-CFlBAGVs.js → badge-CuCfPx-y.js} +1 -1
  57. package/dist/client/assets/{block-document-Df8KoCXn.js → block-document-ZFzIRxrN.js} +1 -1
  58. package/dist/client/assets/{brand-context-DuY3atYS.js → brand-context-DzyWDcCk.js} +1 -1
  59. package/dist/client/assets/{buckets-B4sols7A.js → buckets-XQexDwjp.js} +1 -1
  60. package/dist/client/assets/{calendar-CGQ-ie88.js → calendar-CKrH5d_Q.js} +1 -1
  61. package/dist/client/assets/{capability-load-error-D3Lo8p0_.js → capability-load-error-gogxAwFW.js} +1 -1
  62. package/dist/client/assets/{card-0NTlYEIG.js → card-yVmBUFAg.js} +1 -1
  63. package/dist/client/assets/category-editor-BEoXjeUW.js +1 -0
  64. package/dist/client/assets/{chat-context-Dv96XiTZ.js → chat-context-WtXAdZJ4.js} +7 -7
  65. package/dist/client/assets/{checkbox-CpDoQ7Yv.js → checkbox-BMArZ_ix.js} +1 -1
  66. package/dist/client/assets/{cli-auth-success-DTM6IRFd.js → cli-auth-success-Cm2MX1PH.js} +1 -1
  67. package/dist/client/assets/{collection-detail-D-z_k4pc.js → collection-detail-CdcHUbmk.js} +1 -1
  68. package/dist/client/assets/{collection-display-button-Cq4SaVuJ.js → collection-display-button-Deigak_t.js} +1 -1
  69. package/dist/client/assets/{collection-search-wS84Uw7R.js → collection-search-CDaYX9FR.js} +1 -1
  70. package/dist/client/assets/{collection-tabs-CrXzE-CP.js → collection-tabs-dRuAELuw.js} +1 -1
  71. package/dist/client/assets/{command-fpVUb--D.js → command-P8Wd0xDH.js} +1 -1
  72. package/dist/client/assets/{connect-desktop-dialog-Y_3kKbGF.js → connect-desktop-dialog-p3tqZ2_6.js} +1 -1
  73. package/dist/client/assets/{connection-card-DubGHynt.js → connection-card-CCMuozOG.js} +1 -1
  74. package/dist/client/assets/{connection-detail-BxR9TIBE.js → connection-detail-JjdH17H6.js} +1 -1
  75. package/dist/client/assets/{connection-form-helpers-Cc2oyq0i.js → connection-form-helpers-BU4nsydd.js} +1 -1
  76. package/dist/client/assets/{connections-ZPdMyV6w.js → connections-xjFDA3iN.js} +1 -1
  77. package/dist/client/assets/{context-menu-BN5ZKldy.js → context-menu-XATcg7cH.js} +1 -1
  78. package/dist/client/assets/{decopilot-HFlhm62L.js → decopilot-CJM86E2F.js} +1 -1
  79. package/dist/client/assets/{decopilot-sse-pool-CXcIYn_j.js → decopilot-sse-pool-BVuJ_7ML.js} +1 -1
  80. package/dist/client/assets/{dialog-Bep6tMMx.js → dialog-jhtlYWQH.js} +1 -1
  81. package/dist/client/assets/{domain-settings-D5odYeT1.js → domain-settings-D18yHtBo.js} +1 -1
  82. package/dist/client/assets/{drawer-Col1fd6y.js → drawer-Ca9qnNLt.js} +1 -1
  83. package/dist/client/assets/{dropdown-menu-Dxrc7XSl.js → dropdown-menu-B4AhYSKY.js} +1 -1
  84. package/dist/client/assets/{empty-state-CBknX3cP.js → empty-state-Cz0bAkoo.js} +1 -1
  85. package/dist/client/assets/{extract-connection-data-yrZbGAUI.js → extract-connection-data-CObOyXJ4.js} +1 -1
  86. package/dist/client/assets/{file-explorer-NijMUVyf.js → file-explorer-D0NTDf_o.js} +1 -1
  87. package/dist/client/assets/{file-type-icon-IKZpdmMx.js → file-type-icon-CzNWenEv.js} +1 -1
  88. package/dist/client/assets/{files-DKn4CBvj.js → files-DMaBuySQ.js} +1 -1
  89. package/dist/client/assets/{form-DV7xSonM.js → form-rLORGBZw.js} +1 -1
  90. package/dist/client/assets/{general-BC32Z_k5.js → general-BvPRQvS3.js} +1 -1
  91. package/dist/client/assets/{github-repo-picker-DBTDDdPH.js → github-repo-picker-Cu20X1Oj.js} +1 -1
  92. package/dist/client/assets/{hooks-CD4luOZh.js → hooks-D14HehpA.js} +1 -1
  93. package/dist/client/assets/{image-field-C1JcT4iG.js → image-field-LMawai9Y.js} +1 -1
  94. package/dist/client/assets/{import-from-deco-dialog-B86dto7B.js → import-from-deco-dialog-BCZEU51-.js} +1 -1
  95. package/dist/client/assets/{index-CKbwNZU2.js → index-B9_waAhV.js} +1 -1
  96. package/dist/client/assets/{index-Dg_mwh5q.js → index-Bf1YdrMc.js} +1 -1
  97. package/dist/client/assets/{index-WlHoE4AJ.js → index-Bx5YRZw3.js} +1 -1
  98. package/dist/client/assets/{index-CEqjXzTC.js → index-C2-nEDLj.js} +1 -1
  99. package/dist/client/assets/{index-BxrNS_jM.js → index-C3gL9St4.js} +3 -3
  100. package/dist/client/assets/{index-D6GCfqA_.js → index-CBOm8PQT.js} +17 -17
  101. package/dist/client/assets/{index-zEyeziLM.js → index-CK3Q6Lxn.js} +1 -1
  102. package/dist/client/assets/{index-D9FdNYWJ.js → index-CQ_hnxd_.js} +1 -1
  103. package/dist/client/assets/{index-CKlSvIQJ.js → index-CaOvTlCR.js} +1 -1
  104. package/dist/client/assets/{index-9bg42Pa1.js → index-DVtTwolW.js} +1 -1
  105. package/dist/client/assets/{index-Yo8YIrYA.js → index-Df7da_i0.js} +1 -1
  106. package/dist/client/assets/{index-pFXSmgDj.js → index-DqifP8kh.js} +1 -1
  107. package/dist/client/assets/{index-B81miugv.js → index-i_JkZB27.js} +1 -1
  108. package/dist/client/assets/index-kcIuDE6u.js +502 -0
  109. package/dist/client/assets/{index-redirect-BLxPXqBJ.js → index-redirect-DD0m-QdY.js} +1 -1
  110. package/dist/client/assets/{input-B_0hsonc.js → input-BvSXiwAq.js} +1 -1
  111. package/dist/client/assets/{integration-icon-CGoCKywQ.js → integration-icon-BcoSEnuB.js} +1 -1
  112. package/dist/client/assets/{label-BPTSDSON.js → label-vllYe6cM.js} +1 -1
  113. package/dist/client/assets/{login-DEEIdIHI.js → login-DAeVvDXf.js} +1 -1
  114. package/dist/client/assets/{mcp-oauth-DLVO5G51.js → mcp-oauth-BswvczAL.js} +1 -1
  115. package/dist/client/assets/{members-BQxz1bvp.js → members-CqwytKDG.js} +1 -1
  116. package/dist/client/assets/{monaco-editor-W441ROEf.js → monaco-editor-DFjHxwB9.js} +1 -1
  117. package/dist/client/assets/{monitoring-stats-row-D5-vmeoy.js → monitoring-stats-row-DzD-p2bQ.js} +1 -1
  118. package/dist/client/assets/{oauth-callback-ai-provider-BRQJO2Gc.js → oauth-callback-ai-provider-BrGqlBMJ.js} +1 -1
  119. package/dist/client/assets/{oauth-callback-cwhxBVYa.js → oauth-callback-tznqb9vz.js} +1 -1
  120. package/dist/client/assets/{onboarding-DLulm50I.js → onboarding-BjK9ZeXA.js} +1 -1
  121. package/dist/client/assets/{org-install-BvuRLERX.js → org-install-C_FZDV9k.js} +1 -1
  122. package/dist/client/assets/{org-layout-U8_N5cyx.js → org-layout-CsJuQ6Ei.js} +1 -1
  123. package/dist/client/assets/{page-seo-form-DV2Uk66h.js → page-seo-form-BFfGH2mD.js} +1 -1
  124. package/dist/client/assets/page-seo-sheet-CitEZrcC.js +1 -0
  125. package/dist/client/assets/{popover-sjSahoqv.js → popover-sSylEgHu.js} +1 -1
  126. package/dist/client/assets/{post-editor-DxporwYQ.js → post-editor-BWay_CVr.js} +1 -1
  127. package/dist/client/assets/{preview-dialog-DYrCk7gz.js → preview-dialog-CRHdztnc.js} +1 -1
  128. package/dist/client/assets/{primitives-YmWQ6h4F.js → primitives-DDnm_QnL.js} +1 -1
  129. package/dist/client/assets/{profile-CIXAw6_5.js → profile-CHd6ohYJ.js} +1 -1
  130. package/dist/client/assets/{project-app-view-74tj13aJ.js → project-app-view-CXwN5Mnc.js} +1 -1
  131. package/dist/client/assets/record-editor-D-0BBq6H.js +1 -0
  132. package/dist/client/assets/registry-BCkAgbHk.js +2 -0
  133. package/dist/client/assets/{registry-layout-B7TG4eW0.js → registry-layout-BwUiqOJ3.js} +1 -1
  134. package/dist/client/assets/{require-capability-kUwVwrRi.js → require-capability-CHNIB1jg.js} +1 -1
  135. package/dist/client/assets/{required-auth-layout-C8zUq5LT.js → required-auth-layout-DHjwTgi9.js} +1 -1
  136. package/dist/client/assets/{reset-password-BFZirUKF.js → reset-password-D0a0hqfd.js} +1 -1
  137. package/dist/client/assets/{roles-BPq8P4Fj.js → roles-CRte-FI6.js} +1 -1
  138. package/dist/client/assets/save-referenced-block-BwxGXLv8.js +1 -0
  139. package/dist/client/assets/{save-status-CYJ9S6i-.js → save-status-N1v_enLx.js} +1 -1
  140. package/dist/client/assets/schema-form-mwEmbM5O.js +1 -0
  141. package/dist/client/assets/{scroll-area-DZusoPfA.js → scroll-area-Dbsv4e6O.js} +1 -1
  142. package/dist/client/assets/{search-input-CZ8SaGMM.js → search-input-ChrXBjj7.js} +1 -1
  143. package/dist/client/assets/{secrets-aZgMqeMb.js → secrets-CzfeR8W_.js} +1 -1
  144. package/dist/client/assets/sections-editor-D2GO3ILI.js +3 -0
  145. package/dist/client/assets/{select-DZ51rSQd.js → select-gQvIO328.js} +1 -1
  146. package/dist/client/assets/{select-model-D8T9MwL8.js → select-model-Dzwuphcu.js} +1 -1
  147. package/dist/client/assets/{seo-editor-D5EYUaLJ.js → seo-editor-CwC2Qeg7.js} +1 -1
  148. package/dist/client/assets/{settings-layout-Dk7oj7kq.js → settings-layout-A5O0niXa.js} +1 -1
  149. package/dist/client/assets/{settings-section-Y-F-fcr9.js → settings-section-0NTS3MkI.js} +1 -1
  150. package/dist/client/assets/{sheet-CrZDuw8F.js → sheet-BBNc6H-H.js} +1 -1
  151. package/dist/client/assets/{shell-controls-BQdMbkHw.js → shell-controls-Cc7-zEXH.js} +1 -1
  152. package/dist/client/assets/{shell-layout-CNKBQhI2.js → shell-layout-CrbOIA4d.js} +1 -1
  153. package/dist/client/assets/{shell-route-loading-BcQ50kz_.js → shell-route-loading-DJR-qsy8.js} +1 -1
  154. package/dist/client/assets/{sidebar-B48lsh1W.js → sidebar-B5eoEEUh.js} +1 -1
  155. package/dist/client/assets/{skeleton-DdaIW0fc.js → skeleton-DOQx-oqC.js} +1 -1
  156. package/dist/client/assets/{sortable.esm-DFtwWal7.js → sortable.esm-XdYFSg_0.js} +1 -1
  157. package/dist/client/assets/{sso-l-xNv6oX.js → sso-kYzS5Tqs.js} +1 -1
  158. package/dist/client/assets/{store-vHlKr9x8.js → store-hoHB6kbc.js} +1 -1
  159. package/dist/client/assets/store-registry-MgWAZcLM.js +2 -0
  160. package/dist/client/assets/{studio-tools-BzGW_qQX.js → studio-tools-B1vmC7k4.js} +1 -1
  161. package/dist/client/assets/{switch-BpPDo4WS.js → switch-BH90tU73.js} +1 -1
  162. package/dist/client/assets/{table-DdNE0yIK.js → table-Borl2aRc.js} +1 -1
  163. package/dist/client/assets/{tabs-COlIPxJa.js → tabs-CznF-MMq.js} +1 -1
  164. package/dist/client/assets/{task-status-saHJktPL.js → task-status-W8pectFm.js} +1 -1
  165. package/dist/client/assets/{textarea-C2QWkbxj.js → textarea-BVXgXW3B.js} +1 -1
  166. package/dist/client/assets/{toggle-group-Ef_DvlNC.js → toggle-group-Cn5J5q3D.js} +1 -1
  167. package/dist/client/assets/{toolbar-3-ia1qjF.js → toolbar-6hNYKLLh.js} +1 -1
  168. package/dist/client/assets/{tooltip-C3y7Q3JJ.js → tooltip-D9KNvVvr.js} +1 -1
  169. package/dist/client/assets/{types-CJ7l0TQf.js → types-C7TUAV0n.js} +1 -1
  170. package/dist/client/assets/{use-ai-providers-DhsmmwNY.js → use-ai-providers-CYtt5EvS.js} +1 -1
  171. package/dist/client/assets/{use-automations-DZiVqsJE.js → use-automations-DB885IUH.js} +1 -1
  172. package/dist/client/assets/{use-capability-CdIgj6nz.js → use-capability-BgNNCaLI.js} +1 -1
  173. package/dist/client/assets/{use-clock-tick-BYonkvKL.js → use-clock-tick-BHE1f1YU.js} +1 -1
  174. package/dist/client/assets/{use-collections-BvQz1-Ee.js → use-collections-H8HuKWEE.js} +1 -1
  175. package/dist/client/assets/{use-connection-CBkuINe5.js → use-connection-Cg1b4Um2.js} +1 -1
  176. package/dist/client/assets/{use-copy-C-SB9SRF.js → use-copy-BGWnHO-M.js} +1 -1
  177. package/dist/client/assets/{use-create-virtual-mcp-CoINGCk3.js → use-create-virtual-mcp-BTbe0O5T.js} +1 -1
  178. package/dist/client/assets/{use-debounced-autosave-BYr4wRK_.js → use-debounced-autosave-DIcW3_zI.js} +1 -1
  179. package/dist/client/assets/{use-deco-credits-DetFuvIX.js → use-deco-credits-D3w33USN.js} +1 -1
  180. package/dist/client/assets/{use-delete-connection-CkxbxokZ.js → use-delete-connection-CMXNBeGz.js} +1 -1
  181. package/dist/client/assets/{use-file-configs-WD--ot8g.js → use-file-configs-BBtTR4ju.js} +1 -1
  182. package/dist/client/assets/{use-infinite-scroll-gEtDbhxZ.js → use-infinite-scroll-Cj-XExfy.js} +1 -1
  183. package/dist/client/assets/{use-join-requests-uHIwhyje.js → use-join-requests-Dl6EohPu.js} +1 -1
  184. package/dist/client/assets/{use-mcp-client-C031r2-Q.js → use-mcp-client-DYJrfczK.js} +2 -2
  185. package/dist/client/assets/{use-mcp-prompts-BHrxc05G.js → use-mcp-prompts-CSCDL01T.js} +1 -1
  186. package/dist/client/assets/{use-mcp-tools-CDVfVRsf.js → use-mcp-tools-D3AAnhTZ.js} +1 -1
  187. package/dist/client/assets/{use-members-B_mfUbeK.js → use-members-DJNn_Bxw.js} +1 -1
  188. package/dist/client/assets/{use-navigate-to-agent-CPPIjmTk.js → use-navigate-to-agent-BlcN6V5v.js} +1 -1
  189. package/dist/client/assets/{use-org-auth-client-mvZWQoxD.js → use-org-auth-client-wIGZzMQc.js} +1 -1
  190. package/dist/client/assets/{use-org-sso-BRRrnOZZ.js → use-org-sso-CwWfX4uS.js} +1 -1
  191. package/dist/client/assets/{use-organization-roles-CU-1ZyJo.js → use-organization-roles-BXV_PsbS.js} +1 -1
  192. package/dist/client/assets/{use-organization-settings-LtL_2oVQ.js → use-organization-settings-DouM9EgM.js} +1 -1
  193. package/dist/client/assets/{use-registry-connections-CfQAHSyd.js → use-registry-connections-QEmucmhH.js} +1 -1
  194. package/dist/client/assets/{use-secrets-C_T7V5DI.js → use-secrets-DVqtKaXp.js} +1 -1
  195. package/dist/client/assets/{use-status-sounds-DzNOpTyc.js → use-status-sounds-Dl6bvWf3.js} +1 -1
  196. package/dist/client/assets/{use-view-mode-DE_kKgBR.js → use-view-mode-BCnWJZTf.js} +1 -1
  197. package/dist/client/assets/{use-virtual-mcp-DY9s0f6y.js → use-virtual-mcp-oKPxaCky.js} +1 -1
  198. package/dist/client/assets/useInfiniteQuery-YHehADCx.js +1 -0
  199. package/dist/client/assets/{useRouterState-Bhxm6U0G.js → useRouterState-ysmOvmXv.js} +1 -1
  200. package/dist/client/assets/useSuspenseInfiniteQuery-xMSumVHF.js +1 -0
  201. package/dist/client/assets/{view-mode-toggle-B17n_pEh.js → view-mode-toggle-CHlCGyzP.js} +1 -1
  202. package/dist/client/index.html +1 -1
  203. package/dist/server/cli.js +1334 -29715
  204. package/dist/server/server.js +332 -344
  205. package/package.json +1 -1
  206. package/dist/client/assets/app-editor-tzegGhGx.js +0 -1
  207. package/dist/client/assets/category-editor-D-jdlJmP.js +0 -1
  208. package/dist/client/assets/index-CCU8tTNs.js +0 -463
  209. package/dist/client/assets/page-seo-sheet-ucnktWGv.js +0 -1
  210. package/dist/client/assets/record-editor-DYTfVRe6.js +0 -1
  211. package/dist/client/assets/registry-HTjMEx4d.js +0 -2
  212. package/dist/client/assets/save-referenced-block-Canw40SS.js +0 -1
  213. package/dist/client/assets/schema-form-Phd91_TM.js +0 -1
  214. package/dist/client/assets/sections-editor-ok-Kih4-.js +0 -2
  215. package/dist/client/assets/store-registry-BX6cxuJq.js +0 -2
  216. package/dist/client/assets/useInfiniteQuery-DoglCZvJ.js +0 -1
  217. package/dist/client/assets/useSuspenseInfiniteQuery-hh4dm7oT.js +0 -1
@@ -1 +1 @@
1
- import{r as $,p as Ne,K as re,b3 as dt,m as Oe,j as s,c as K,l as fe,B as ne,e as q,s as Pe,aB as Ie,v as se,aD as De,aE as ke,F as $e,x as mt,w as ut,a as Fe,n as he,t as Re,ac as Ke,a4 as ft,a1 as ht,f as gt,d as xt}from"./index-BxrNS_jM.js";import{u as pt,C as bt}from"./use-organization-roles-CU-1ZyJo.js";import{u as je}from"./use-org-auth-client-mvZWQoxD.js";import{B as ge}from"./badge-CFlBAGVs.js";import{f as Qe,a as qe,b as He,c as Ze,d as Xe,A as Je,e as We,g as et}from"./alert-dialog-DFBPrUlf.js";import{D as Tt,a as Et,b as _t,c as It}from"./dropdown-menu-Dxrc7XSl.js";import{a as Nt}from"./DotsVertical-DET7Jl3A.js";import{s as Ae}from"./Plus-bN4DDzHM.js";import{s as St}from"./Trash01-CVFvFDNw.js";import{P as te}from"./index-Dg_mwh5q.js";import{E as Ge}from"./empty-state-CBknX3cP.js";import{S as ve}from"./search-input-CZ8SaGMM.js";import{P as tt,D as st}from"./ai-providers-logos-DD3qZ33J.js";import{I as ye}from"./integration-icon-CGoCKywQ.js";import{u as Ct}from"./use-infinite-scroll-gEtDbhxZ.js";import{C as we}from"./checkbox-CpDoQ7Yv.js";import{i as At}from"./Settings02-DE29vYCu.js";import{u as Ot}from"./useSuspenseInfiniteQuery-hh4dm7oT.js";import{u as Rt,c as jt}from"./use-mcp-client-C031r2-Q.js";import{C as vt}from"./collection-search-wS84Uw7R.js";import{u as nt}from"./use-members-B_mfUbeK.js";import{u as yt}from"./use-connection-CBkuINe5.js";import{u as wt,d as Mt}from"./use-ai-providers-DhsmmwNY.js";import{A as lt}from"./avatar-BJDY188d.js";import{S as xe}from"./switch-BpPDo4WS.js";import{c as pe,b as be,T as Te,a as Ee}from"./tooltip-C3y7Q3JJ.js";import{S as Ue,a as Be,b as Ve}from"./settings-section-Y-F-fcr9.js";import{t as Lt}from"./ChevronDown-xnujHbma.js";import{i as Pt}from"./ChevronRight-DgGMjNQ2.js";import{i as ze}from"./X-vxJbcFZu.js";import{a as Dt}from"./use-capability-CdIgj6nz.js";import{A as kt}from"./access-gate-Cjtt7v5f.js";import"./table-DdNE0yIK.js";import"./SwitchHorizontal01-D9okikgy.js";import"./ChevronUp-ssLglSfS.js";import"./sidebar-B48lsh1W.js";import"./LayoutLeft-BAEXcrIX.js";import"./sheet-CrZDuw8F.js";import"./SearchMd-JGuF2SJ3.js";import"./XCircle-3mnhYuh7.js";import"./agent-icon-CHsmfzrp.js";import"./AlertCircle-BmclRZ36.js";import"./Tool01-CzZMajtM.js";import"./ArrowUpRight-DfyRpa7I.js";import"./ZapSquare-DtlZ0XtN.js";import"./Users03-TDNky6LJ.js";import"./CheckCircle-chlyBg2w.js";import"./ChevronLeft-D-0b0jaB.js";import"./Stars02-mzsf2wYL.js";import"./Eye-Cfz6tZ15.js";import"./ZoomOut-Bv-x8t-3.js";import"./Globe01-ewHp_9uK.js";import"./FilterLines-Dh9wNNXi.js";import"./Star01-N3VFSdvZ.js";import"./Globe04-CAyiWi73.js";import"./HardDrive-ABAtWBN-.js";import"./Key01-JG8IVIcf.js";import"./LinkExternal01-BDty9NTy.js";import"./Monitor01-BPADhIbr.js";import"./Sun-BstscSya.js";import"./Palette-xtfhSkOy.js";import"./Play-BfqfXtxE.js";import"./Shield01-n-a01HQd.js";import"./Stars01-DsonRyoA.js";import"./Upload01-nR0-bkCf.js";import"./User01-DN5mCg88.js";import"./Users01-Dpm21bW1.js";import"./XClose-BWmveN5G.js";import"./Zap-CPGAbdIn.js";import"./auth-k-iFGlch.js";import"./use-collections-BvQz1-Ee.js";import"./studio-tools-BzGW_qQX.js";import"./card-0NTlYEIG.js";import"./capability-load-error-D3Lo8p0_.js";const Me="basic-usage",Le=[{id:Me,label:"Basic Usage",description:"Tools all org members can access by default",section:"Basic Usage",tools:["COLLECTION_CONNECTIONS_LIST","COLLECTION_CONNECTIONS_GET","CONNECTION_TEST","COLLECTION_VIRTUAL_MCP_LIST","COLLECTION_VIRTUAL_MCP_GET","VIRTUAL_MCP_PLUGIN_CONFIG_GET","VIRTUAL_MCP_LAST_USED_LIST","AUTOMATION_GET","AUTOMATION_LIST","AUTOMATION_RUN_STATS","AI_PROVIDERS_LIST","AI_PROVIDERS_LIST_MODELS","AI_PROVIDERS_ACTIVE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_CREDITS","AI_PROVIDER_TOPUP_URL","LIST_OBJECTS","GET_OBJECT_METADATA","GET_PRESIGNED_URL","PUT_PRESIGNED_URL","FILE_OBJECTS_LIST","SANDBOX_START","SANDBOX_DELETE","GLOBAL_SEARCH","ORGANIZATION_SETTINGS_GET","USER_GET","LINK_CURRENT_GET","LINK_DISCONNECT","BRAND_CONTEXT_LIST","COLLECTION_THREADS_CREATE","COLLECTION_THREADS_LIST","COLLECTION_THREADS_GET","COLLECTION_THREADS_UPDATE","COLLECTION_THREADS_DELETE","COLLECTION_THREAD_MESSAGES_LIST","THREAD_BACKGROUND_TOOL_START","THREAD_SUBTASK_DELIVER"]},{id:"org:manage",label:"Manage organization",description:"Edit organization settings, brand context, and domain configuration",section:"Organization",tools:["ORGANIZATION_GET","ORGANIZATION_LIST","ORGANIZATION_UPDATE","ORGANIZATION_SETTINGS_GET","ORGANIZATION_SETTINGS_UPDATE","BRAND_CONTEXT_LIST","BRAND_CONTEXT_GET","BRAND_CONTEXT_CREATE","BRAND_CONTEXT_UPDATE","BRAND_CONTEXT_DELETE","BRAND_CONTEXT_EXTRACT","BRAND_GET","BRAND_LIST","ORGANIZATION_DOMAIN_LIST","ORGANIZATION_DOMAIN_ADD","ORGANIZATION_DOMAIN_UPDATE","ORGANIZATION_DOMAIN_VERIFY","ORGANIZATION_DOMAIN_REMOVE"]},{id:"members:manage",label:"Manage members",description:"Invite members, remove them, and change their roles",section:"Organization",tools:["ORGANIZATION_MEMBER_LIST","ORGANIZATION_MEMBER_ADD","ORGANIZATION_MEMBER_REMOVE","ORGANIZATION_MEMBER_UPDATE_ROLE","ORGANIZATION_JOIN_REQUEST_LIST","ORGANIZATION_JOIN_REQUEST_APPROVE","ORGANIZATION_JOIN_REQUEST_DENY"],dangerous:!0},{id:"connections:manage",label:"Manage connections",description:"Create, update, and delete connections",section:"Connections & Agents",tools:["COLLECTION_CONNECTIONS_CREATE","COLLECTION_CONNECTIONS_UPDATE","COLLECTION_CONNECTIONS_DELETE"],dangerous:!0},{id:"agents:manage",label:"Manage agents",description:"Create, configure, and delete agents",section:"Connections & Agents",tools:["COLLECTION_VIRTUAL_MCP_CREATE","COLLECTION_VIRTUAL_MCP_UPDATE","COLLECTION_VIRTUAL_MCP_DELETE","VIRTUAL_MCP_PLUGIN_CONFIG_UPDATE","VIRTUAL_MCP_PINNED_VIEWS_UPDATE"],dangerous:!0},{id:"automations:manage",label:"Manage automations",description:"Create, update, run, and delete automations",section:"Automations",tools:["AUTOMATION_CREATE","AUTOMATION_UPDATE","AUTOMATION_DELETE","AUTOMATION_TRIGGER_ADD","AUTOMATION_TRIGGER_REMOVE","AUTOMATION_TRIGGER_ROTATE_TOKEN","AUTOMATION_RUN"],dangerous:!0},{id:"monitoring:view",label:"View monitoring",description:"Access logs and usage statistics",section:"Monitoring",tools:["MONITORING_LOG_GET","MONITORING_LOGS_LIST","MONITORING_STATS","MONITORING_THREAD_USAGE"]},{id:"secrets:manage",label:"Manage secrets",description:"Create and list secrets stored in the credential vault",section:"Organization",tools:["SECRET_CREATE","SECRET_LIST"]},{id:"file-configs:manage",label:"Manage file configs",description:"Create, list, update and delete S3 bucket configurations",section:"Organization",tools:["FILE_CONFIG_CREATE","FILE_CONFIG_LIST","FILE_CONFIG_UPDATE","FILE_CONFIG_DELETE","FILE_OBJECTS_LIST"]},{id:"ai-providers:manage",label:"Manage AI providers",description:"Add or remove API keys and provision provider credentials",section:"AI Providers",tools:["AI_PROVIDER_KEY_CREATE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_KEY_DELETE","AI_PROVIDER_KEY_UPDATE","AI_PROVIDER_KEY_PREVIEW","AI_PROVIDER_OAUTH_URL","AI_PROVIDER_OAUTH_EXCHANGE","AI_PROVIDER_PROVISION_KEY","AI_PROVIDER_TOPUP_URL","AI_PROVIDER_CREDITS"]},{id:"tags:manage",label:"Manage tags",description:"Create, assign, and delete organization tags",section:"Organization",tools:["TAGS_LIST","TAGS_CREATE","TAGS_DELETE","MEMBER_TAGS_GET","MEMBER_TAGS_SET"]},{id:"registry:manage",label:"Manage registry",description:"Browse, publish, and manage items in the registry",section:"Store & Registry",tools:["COLLECTION_REGISTRY_APP_LIST","COLLECTION_REGISTRY_APP_GET","COLLECTION_REGISTRY_APP_VERSIONS","COLLECTION_REGISTRY_APP_FILTERS","REGISTRY_ITEM_LIST","REGISTRY_ITEM_SEARCH","REGISTRY_ITEM_GET","REGISTRY_ITEM_VERSIONS","REGISTRY_ITEM_FILTERS","REGISTRY_DISCOVER_TOOLS","REGISTRY_ITEM_CREATE","REGISTRY_ITEM_BULK_CREATE","REGISTRY_ITEM_UPDATE","REGISTRY_ITEM_DELETE","REGISTRY_AI_GENERATE","REGISTRY_PUBLISH_REQUEST_LIST","REGISTRY_PUBLISH_REQUEST_REVIEW","REGISTRY_PUBLISH_REQUEST_COUNT","REGISTRY_PUBLISH_REQUEST_DELETE","REGISTRY_PUBLISH_API_KEY_GENERATE","REGISTRY_PUBLISH_API_KEY_LIST","REGISTRY_PUBLISH_API_KEY_REVOKE"],dangerous:!0},{id:"registry:monitor",label:"Monitor registry health",description:"Run health checks on registry connections and view results",section:"Store & Registry",tools:["REGISTRY_MONITOR_RUN_START","REGISTRY_MONITOR_RUN_LIST","REGISTRY_MONITOR_RUN_GET","REGISTRY_MONITOR_RUN_CANCEL","REGISTRY_MONITOR_RESULT_LIST","REGISTRY_MONITOR_CONNECTION_LIST","REGISTRY_MONITOR_CONNECTION_SYNC","REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH"]},{id:"api-keys:manage",label:"Manage API keys",description:"Create, update, and revoke API keys",section:"Developer",tools:["API_KEY_CREATE","API_KEY_LIST","API_KEY_UPDATE","API_KEY_DELETE"]},{id:"storage:delete",label:"Delete from storage",description:"Permanently delete files from object storage",section:"Developer",tools:["DELETE_OBJECT","DELETE_OBJECTS"],dangerous:!0},{id:"connections:sql",label:"Run SQL queries",description:"Execute raw SQL against connected databases",section:"Developer",tools:["DATABASES_RUN_SQL"],dangerous:!0}];[...Le.find(t=>t.id===Me)?.tools??[]];const Gt=["agents:manage","connections:manage"];new Set(Le.filter(t=>Gt.includes(t.id)).flatMap(t=>t.tools));function Ut(){const t=new Map;for(const e of Le){if(e.id===Me)continue;const n=t.get(e.section)??[];n.push(e),t.set(e.section,n)}return Array.from(t.entries()).map(([e,n])=>({section:e,capabilities:n}))}function Bt(t,e,n){return n?!0:t.tools.every(l=>e.includes(l))}function Vt(t,e,n){if(n){const i=new Set(e);for(const r of t.tools)i.add(r);return Array.from(i)}const l=new Set(e);for(const i of t.tools)l.delete(i);return Array.from(l)}function zt(t){const e=q.c(21),{connection:n,isSelected:l,hasToolsEnabled:i,activeToolsCount:r,totalToolsCount:d,onSelect:h,onToggle:c}=t,g=l?"bg-accent/50":"hover:bg-muted/50";let f;e[0]!==g?(f=K("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",g),e[0]=g,e[1]=f):f=e[1];let a;e[2]!==n.icon||e[3]!==n.title?(a=s.jsx(ye,{icon:n.icon,name:n.title,size:"xs"}),e[2]=n.icon,e[3]=n.title,e[4]=a):a=e[4];let x;e[5]!==n.title?(x=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:n.title})}),e[5]=n.title,e[6]=x):x=e[6];let o;e[7]!==h||e[8]!==a||e[9]!==x?(o=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:h,children:[a,x]}),e[7]=h,e[8]=a,e[9]=x,e[10]=o):o=e[10];let m;e[11]!==r||e[12]!==n.tools||e[13]!==i||e[14]!==c||e[15]!==d?(m=n.tools&&n.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[r,"/",d]}),s.jsx(we,{checked:i,onCheckedChange:c,onClick:Yt})]}),e[11]=r,e[12]=n.tools,e[13]=i,e[14]=c,e[15]=d,e[16]=m):m=e[16];let N;return e[17]!==f||e[18]!==o||e[19]!==m?(N=s.jsxs("div",{className:f,children:[o,m]}),e[17]=f,e[18]=o,e[19]=m,e[20]=N):N=e[20],N}function Yt(t){return t.stopPropagation()}function $t(t){const e=q.c(18),{connectionId:n,tool:l,isSelected:i,onToggle:r}=t,d=`tool-${n}-${l.name}`,h=i?"text-foreground":"text-muted-foreground";let c;e[0]!==h?(c=K("text-sm font-medium",h),e[0]=h,e[1]=c):c=e[1];let g;e[2]!==c||e[3]!==l.name?(g=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:c,children:l.name})}),e[2]=c,e[3]=l.name,e[4]=g):g=e[4];let f;e[5]!==l.description?(f=l.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:l.description}),e[5]=l.description,e[6]=f):f=e[6];let a;e[7]!==g||e[8]!==f?(a=s.jsxs("div",{className:"flex-1 min-w-0",children:[g,f]}),e[7]=g,e[8]=f,e[9]=a):a=e[9];const x=`tool-${n}-${l.name}`;let o;e[10]!==i||e[11]!==r||e[12]!==x?(o=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(we,{id:x,checked:i,onCheckedChange:r,onClick:Ft})}),e[10]=i,e[11]=r,e[12]=x,e[13]=o):o=e[13];let m;return e[14]!==d||e[15]!==a||e[16]!==o?(m=s.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:d,children:[a,o]}),e[14]=d,e[15]=a,e[16]=o,e[17]=m):m=e[17],m}function Ft(t){return t.stopPropagation()}function Kt({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:n,searchQuery:l}){const[i,r]=$.useState(""),d=l!==void 0?l:i,h=$.useDeferredValue(d),[c,g]=$.useState("all"),[f,a]=$.useState(!1),x=$.useRef(new Set(Object.keys(t))),{org:o}=Ne(),m=Rt({connectionId:jt,orgId:o.id,orgSlug:o.slug}),N=100,E=h.trim(),T=E?{operator:"or",conditions:[{field:["title"],operator:"contains",value:E},{field:["description"],operator:"contains",value:E}]}:void 0,S=!!n,C={...T&&{where:T},orderBy:[{field:["updated_at"],direction:"asc"}],limit:N,offset:0,...S&&{include_virtual:!0}},v=JSON.stringify(C),{data:_,fetchNextPage:O,hasNextPage:p,isFetchingNextPage:R}=Ot({queryKey:re.collectionListInfinite(m,o.id,"","CONNECTIONS",v),queryFn:async({pageParam:b=0})=>(await m.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...T&&{where:T},orderBy:[{field:["updated_at"],direction:"asc"}],limit:N,offset:b,...S&&{include_virtual:!0}}})).structuredContent,initialPageParam:0,getNextPageParam:(b,D)=>{if(b?.hasMore)return D.reduce((Q,H)=>Q+(H?.items?.length??0),0)},staleTime:3e4}),I=_?.pages.flatMap(b=>b?.items??[])??[],j=Ct(O,p??!1,R),u=n?I.filter(b=>b.connection_type!=="VIRTUAL"?!0:dt(b.connection_url)!==n):I,w=x.current,A=[...w.values()].map(b=>u.find(D=>D.id===b)).filter(b=>b!==void 0),k=u.filter(b=>!w.has(b.id)),G=[...A,...k],U=b=>{const D=t[b];return D!==void 0&&D.length>0},B=G.filter(b=>{if(c==="all")return!0;const D=U(b.id);return c==="selected"?D:c==="unselected"?!D:!0}),[M,z]=$.useState(G[0]?.id??null),y=M?G.find(b=>b.id===M)??null:null,{data:L,isFetching:Y}=Oe({queryKey:re.collectionItem(m,o.id,"","CONNECTIONS",M??""),queryFn:async()=>M?(await m.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:M}})).structuredContent?.item??null:null,enabled:!!M,staleTime:3e4}),F=L?.tools??[],X=(b,D)=>t[b]?.includes(D)??!1,J=(b,D)=>{const Q=t[b]??[],H=Q.includes(D),W={...t};if(H){const Z=Q.filter(ee=>ee!==D);Z.length===0?delete W[b]:W[b]=Z}else W[b]=[...Q,D];e(W)},le=b=>{const D=b===M?F:[];if(!D.length)return;const Q=t[b]??[],H=D.map(ee=>ee.name),W=Q.length>0&&H.every(ee=>Q.includes(ee)),Z={...t};W?delete Z[b]:(Z[b]=H,z(b)),e(Z)},oe=b=>{z(b),a(!0)},ie=()=>{a(!1)};return s.jsxs("div",{className:"flex h-full",children:[s.jsxs("div",{className:K("w-full md:w-80 border-r border-border flex flex-col",f&&"hidden md:flex"),children:[l===void 0&&s.jsx(vt,{value:i,onChange:r,placeholder:"Search MCP Servers..."}),s.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[s.jsx("button",{onClick:()=>g("all"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>g("selected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>g("unselected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:B.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:d?"No connections found":c==="selected"?"No servers selected":c==="unselected"?"No unselected servers":"No connections available"}):s.jsxs("div",{className:"p-2 space-y-1",children:[B.map(b=>{const D=M===b.id,Q=D?F.length:0,H=t[b.id]?.length??0;return s.jsx(zt,{connection:{...b,tools:D?F:b.tools},isSelected:D,hasToolsEnabled:U(b.id),activeToolsCount:H,totalToolsCount:Q,onSelect:()=>oe(b.id),onToggle:()=>le(b.id)},b.id)}),s.jsx("div",{ref:j,className:"h-4"}),R&&s.jsx("div",{className:"flex justify-center py-3",children:s.jsx(fe,{size:18,className:"animate-spin text-muted-foreground"})})]})})]}),s.jsx("div",{className:K("flex-1 flex-col",f?"flex":"hidden md:flex"),children:y?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:ie,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(At,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(ye,{icon:y.icon,name:y.title,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:y.title}),y.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:y.description})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:Y?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(fe,{size:18,className:"animate-spin text-muted-foreground"})}):F.length===0?s.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):s.jsx("div",{className:"space-y-2",children:F.map(b=>s.jsx($t,{connectionId:y.id,tool:b,isSelected:X(y.id,b.name),onToggle:()=>J(y.id,b.name)},b.name))})})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}const Se=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"],Qt={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function qt(t){if(!t)return"bg-neutral-400";let e=0;for(let l=0;l<t.length;l++){const i=t.charCodeAt(l);e=(e<<5)-e+i,e=e&e}const n=Math.abs(e)%Se.length;return Se[n]??Se[0]}function Ht(t,e){return Qt[t]??"bg-neutral-400"}const Zt=Pe({role:Pe({id:se().optional(),slug:se().optional(),label:se()}),allowAllStaticPermissions:ke(),staticPermissions:Ie(se()),toolSet:De(se(),Ie(se())),allowAllModels:ke(),modelSet:De(se(),Ie(se())),memberIds:Ie(se())});function ot(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function Ye(t,e,n){const l=s.jsx(xe,{checked:t,disabled:e,onCheckedChange:n});return e?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:l})}),s.jsx(Ee,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):l}function Xt(t){const e=q.c(28),{allowAllStaticPermissions:n,staticPermissions:l,onAllowAllChange:i,onPermissionsChange:r,readOnly:d,searchQuery:h}=t,c=d===void 0?!1:d;let g;e[0]!==h?(g=h.trim().toLowerCase(),e[0]=h,e[1]=g):g=e[1];const f=$.useDeferredValue(g);let a;if(e[2]!==n||e[3]!==f||e[4]!==i||e[5]!==r||e[6]!==c||e[7]!==h||e[8]!==l){const x=Ut(),o=(v,_)=>{if(!c){if(n&&_){const O=x.flatMap(es).flatMap(Wt);i(!1),r(O.filter(p=>!v.tools.includes(p)));return}n||r(Vt(v,l,!_))}};let m;e[10]!==f?(m=v=>{const{section:_,capabilities:O}=v;return{section:_,capabilities:O.filter(p=>!f||p.label.toLowerCase().includes(f)||p.description.toLowerCase().includes(f))}},e[10]=f,e[11]=m):m=e[11];const N=x.map(m).filter(Jt);let E;e[12]!==n||e[13]!==i||e[14]!==r?(E=()=>{i(!n),r([])},e[12]=n,e[13]=i,e[14]=r,e[15]=E):E=e[15];let T;e[16]!==n||e[17]!==c||e[18]!==E?(T=Ye(n,c,E),e[16]=n,e[17]=c,e[18]=E,e[19]=T):T=e[19];let S;e[20]!==n||e[21]!==i||e[22]!==r||e[23]!==c?(S=c?void 0:()=>{i(!n),r([])},e[20]=n,e[21]=i,e[22]=r,e[23]=c,e[24]=S):S=e[24];let C;e[25]!==T||e[26]!==S?(C=s.jsx(Ue,{title:"General",children:s.jsx(Be,{children:s.jsx(Ve,{title:"All organization permissions",description:"Grant full access to all features below",action:T,onClick:S})})}),e[25]=T,e[26]=S,e[27]=C):C=e[27],a=s.jsx("div",{children:s.jsxs("div",{className:"flex flex-col gap-10 py-4",children:[C,N.length===0&&f?s.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:["No permissions match “",h,"”"]}):N.map(v=>{const{section:_,capabilities:O}=v;return s.jsx(Ue,{title:_,children:s.jsx(Be,{children:O.map(p=>{const R=Bt(p,l,n);return s.jsx(Ve,{title:s.jsxs("span",{className:"flex items-center gap-1.5",children:[p.label,p.dangerous&&s.jsx(ft,{size:12,className:"text-amber-500 shrink-0"})]}),description:p.description,action:Ye(R,c,()=>o(p,R)),onClick:c?void 0:()=>o(p,R)},p.id)})})},_)})]})}),e[2]=n,e[3]=f,e[4]=i,e[5]=r,e[6]=c,e[7]=h,e[8]=l,e[9]=a}else a=e[9];return a}function Jt(t){return t.capabilities.length>0}function Wt(t){return t.tools}function es(t){return t.capabilities}const it={anthropic:"Anthropic",openrouter:"OpenRouter"},ts={openai:"OpenAI",anthropic:"Anthropic",google:"Google","meta-llama":"Meta",mistralai:"Mistral","x-ai":"xAI",deepseek:"DeepSeek",qwen:"Qwen",moonshotai:"MoonshotAI",nvidia:"NVIDIA",perplexity:"Perplexity",cohere:"Cohere",amazon:"Amazon",microsoft:"Microsoft","z-ai":"Z.ai","ibm-granite":"IBM Granite",alibaba:"Alibaba",baidu:"Baidu",bytedance:"ByteDance",tencent:"Tencent",minimax:"MiniMax",nousresearch:"Nous Research",allenai:"Allen AI",inception:"Inception"};function ss(t,e){const n=t.indexOf("/"),l=n>0?t.slice(0,n):e;return l.startsWith("~")?l.slice(1):l}function ns(t){return ts[t]??it[t]??t}function ls(t){const e=t.indexOf(": ");return e>0&&e<32?t.slice(e+2):t}const rt=30;function os(t){const e=q.c(44),{connectionId:n,subProviderId:l,subProviderName:i,groupLogo:r,models:d,allConnectionModelIds:h,selectedModels:c,allowAllModels:g,allConnectionModelsSelected:f,onToggleModel:a,onExitAllowAll:x,readOnly:o,defaultExpanded:m}=t,[N,E]=$.useState(m),T=m||N,S=E,[C,v]=$.useState(rt);let _;e[0]!==f||e[1]!==g||e[2]!==c?(_=j=>g||f||c.includes("*")||c.includes(j),e[0]=f,e[1]=g,e[2]=c,e[3]=_):_=e[3];const O=_;let p;if(e[4]!==O||e[5]!==d){let j;e[7]!==O?(j=u=>O(u.id),e[7]=O,e[8]=j):j=e[8],p=d.filter(j),e[4]=O,e[5]=d,e[6]=p}else p=e[6];const R=p.length;let I;if(e[9]!==h||e[10]!==g||e[11]!==n||e[12]!==R||e[13]!==T||e[14]!==r||e[15]!==O||e[16]!==d||e[17]!==x||e[18]!==a||e[19]!==o||e[20]!==l||e[21]!==i||e[22]!==C){const j=d.slice(0,C),u=d.length>C;let w;e[24]===Symbol.for("react.memo_cache_sentinel")?(w=()=>S(cs),e[24]=w):w=e[24];const A=r??tt[l]??st;let k;e[25]!==i||e[26]!==A?(k=s.jsx(ye,{icon:A,name:i,size:"sm"}),e[25]=i,e[26]=A,e[27]=k):k=e[27];let G;e[28]!==i?(G=s.jsx("span",{className:"text-sm font-medium truncate",children:i}),e[28]=i,e[29]=G):G=e[29];let U;e[30]!==k||e[31]!==G?(U=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[k,G]}),e[30]=k,e[31]=G,e[32]=U):U=e[32];let B;e[33]!==R||e[34]!==d.length?(B=s.jsxs(ge,{variant:"secondary",className:"text-xs text-muted-foreground",children:[R,"/",d.length," enabled"]}),e[33]=R,e[34]=d.length,e[35]=B):B=e[35];let M;e[36]!==T?(M=T?s.jsx(Lt,{size:16,className:"text-muted-foreground shrink-0"}):s.jsx(Pt,{size:16,className:"text-muted-foreground shrink-0"}),e[36]=T,e[37]=M):M=e[37];let z;e[38]!==M||e[39]!==B?(z=s.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[B,M]}),e[38]=M,e[39]=B,e[40]=z):z=e[40];let y;e[41]!==z||e[42]!==U?(y=s.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3 hover:bg-muted/50 cursor-pointer",onClick:w,children:[U,z]}),e[41]=z,e[42]=U,e[43]=y):y=e[43],I=s.jsxs("div",{className:"border border-border rounded-lg overflow-hidden bg-card",children:[y,T&&s.jsxs("div",{className:"border-t border-border bg-muted/20",children:[j.map(L=>{const Y=O(L.id),F=()=>{if(!o){if(g){x(n,h,L.id);return}a(n,L.id)}};return s.jsxs("div",{className:K("flex items-center justify-between gap-3 px-4 py-3 border-b border-border last:border-b-0",!o&&"hover:bg-muted/50 cursor-pointer"),onClick:F,children:[s.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:s.jsx("span",{className:"text-sm truncate",children:L.title})}),s.jsx("div",{onClick:as,children:o?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:Y,disabled:!0,onCheckedChange:rs})})}),s.jsx(Ee,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(xe,{checked:Y,onCheckedChange:F})})]},L.id)}),u&&s.jsxs("button",{type:"button",className:"w-full px-4 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors",onClick:()=>v(is),children:["Show more (",d.length-C," remaining)"]})]})]}),e[9]=h,e[10]=g,e[11]=n,e[12]=R,e[13]=T,e[14]=r,e[15]=O,e[16]=d,e[17]=x,e[18]=a,e[19]=o,e[20]=l,e[21]=i,e[22]=C,e[23]=I}else I=e[23];return I}function is(t){return t+rt}function rs(){}function as(t){return t.stopPropagation()}function cs(t){return!t}function ds(t){const e=q.c(33),{connection:n,selectedModels:l,allowAllModels:i,onToggleModel:r,onExitAllowAll:d,allConnectionModelsSelected:h,searchQuery:c,readOnly:g}=t,f=Mt(n.id);let a,x,o,m,N;if(e[0]!==h||e[1]!==i||e[2]!==n.id||e[3]!==n.label||e[4]!==n.providerId||e[5]!==d||e[6]!==r||e[7]!==f||e[8]!==g||e[9]!==c||e[10]!==l){N=Symbol.for("react.early_return_sentinel");e:{let S;e[16]!==n.label?(S=A=>({...A,id:A.modelId,provider:n.label}),e[16]=n.label,e[17]=S):S=e[17];const C=f.filter(hs).map(S),v=c.trim().toLowerCase(),_=v?C.filter(A=>A.title.toLowerCase().includes(v)||A.id.toLowerCase().includes(v)||A.provider?.toLowerCase().includes(v)):C;if(_.length===0){N=null;break e}const O=new Map;for(const A of _){const k=ss(A.id,n.providerId),G=O.get(k)??{models:[],logo:null};G.models.push({id:A.id,title:ls(A.title),logo:A.logo}),!G.logo&&A.logo&&(G.logo=A.logo),O.set(k,G)}const p=Array.from(O.entries()).map(fs).sort(us),R=p.length===1||v.length>0;o="flex flex-col gap-3";const I=tt[n.providerId]??st;let j;e[18]!==n.providerId||e[19]!==I?(j=s.jsx("img",{src:I,alt:n.providerId,className:"w-4 h-4 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),e[18]=n.providerId,e[19]=I,e[20]=j):j=e[20];const u=it[n.providerId]??n.providerId;let w;e[21]!==u?(w=s.jsx("h4",{className:"text-sm font-medium",children:u}),e[21]=u,e[22]=w):w=e[22],e[23]!==w||e[24]!==j?(m=s.jsxs("div",{className:"flex items-center gap-2",children:[j,w]}),e[23]=w,e[24]=j,e[25]=m):m=e[25],a="flex flex-col gap-3",x=p.map(A=>s.jsx(os,{connectionId:n.id,subProviderId:A.id,subProviderName:A.name,groupLogo:A.logo,models:A.models,allConnectionModelIds:C.map(ms),selectedModels:l,allowAllModels:i,allConnectionModelsSelected:h,onToggleModel:r,onExitAllowAll:d,readOnly:g,defaultExpanded:R},A.id))}e[0]=h,e[1]=i,e[2]=n.id,e[3]=n.label,e[4]=n.providerId,e[5]=d,e[6]=r,e[7]=f,e[8]=g,e[9]=c,e[10]=l,e[11]=a,e[12]=x,e[13]=o,e[14]=m,e[15]=N}else a=e[11],x=e[12],o=e[13],m=e[14],N=e[15];if(N!==Symbol.for("react.early_return_sentinel"))return N;let E;e[26]!==a||e[27]!==x?(E=s.jsx("div",{className:a,children:x}),e[26]=a,e[27]=x,e[28]=E):E=e[28];let T;return e[29]!==o||e[30]!==m||e[31]!==E?(T=s.jsxs("div",{className:o,children:[m,E]}),e[29]=o,e[30]=m,e[31]=E,e[32]=T):T=e[32],T}function ms(t){return t.id}function us(t,e){return t.name.localeCompare(e.name)}function fs(t){const[e,n]=t;return{id:e,name:ns(e),logo:n.logo,models:n.models}}function hs(t,e,n){return n.findIndex(l=>l.modelId===t.modelId)===e}function gs(t){const e=q.c(35),{allowAllModels:n,modelSet:l,onAllowAllChange:i,onModelSetChange:r,readOnly:d,searchQuery:h}=t,c=d===void 0?!1:d,g=$.useDeferredValue(h),f=wt();let a;e[0]!==l||e[1]!==r?(a=(p,R)=>{const I=l[p]??[],j={...l};if(I.includes(R)){const u=I.filter(w=>w!==R);u.length===0?delete j[p]:j[p]=u}else j[p]=[...I,R];r(j)},e[0]=l,e[1]=r,e[2]=a):a=e[2];const x=a;let o;e[3]!==l||e[4]!==i||e[5]!==r?(o=(p,R,I)=>{i(!1),r({...l,[p]:R.filter(j=>j!==I)})},e[3]=l,e[4]=i,e[5]=r,e[6]=o):o=e[6];const m=o,N=!c&&"hover:bg-muted/50 cursor-pointer";let E;e[7]!==N?(E=K("flex items-center justify-between px-4 py-3 rounded-lg border border-border bg-card",N),e[7]=N,e[8]=E):E=e[8];let T;e[9]!==n||e[10]!==i||e[11]!==r||e[12]!==c?(T=()=>{if(c)return;const p=!n;i(p),p&&r({})},e[9]=n,e[10]=i,e[11]=r,e[12]=c,e[13]=T):T=e[13];let S;e[14]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[14]=S):S=e[14];let C;e[15]!==n||e[16]!==i||e[17]!==r||e[18]!==c?(C=s.jsx("div",{onClick:ps,children:c?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:n,disabled:!0,onCheckedChange:xs})})}),s.jsx(Ee,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(xe,{checked:n,onCheckedChange:p=>{i(p),p&&r({})}})}),e[15]=n,e[16]=i,e[17]=r,e[18]=c,e[19]=C):C=e[19];let v;e[20]!==E||e[21]!==T||e[22]!==C?(v=s.jsxs("div",{className:E,onClick:T,children:[S,C]}),e[20]=E,e[21]=T,e[22]=C,e[23]=v):v=e[23];let _;e[24]!==f||e[25]!==n||e[26]!==g||e[27]!==m||e[28]!==l||e[29]!==c||e[30]!==x?(_=f.length===0?s.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No LLM connections configured"}):f.map(p=>s.jsx($.Suspense,{fallback:s.jsxs("div",{className:"px-4 py-3 flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(fe,{className:"size-4 animate-spin"}),"Loading models..."]}),children:s.jsx(ds,{connection:p,selectedModels:l[p.id]??[],allowAllModels:n,onToggleModel:x,onExitAllowAll:m,allConnectionModelsSelected:(l[p.id]??[]).includes("*"),searchQuery:g,readOnly:c})},p.id)),e[24]=f,e[25]=n,e[26]=g,e[27]=m,e[28]=l,e[29]=c,e[30]=x,e[31]=_):_=e[31];let O;return e[32]!==_||e[33]!==v?(O=s.jsxs("div",{className:"flex flex-col h-full overflow-auto gap-6 pb-6",children:[v,_]}),e[32]=_,e[33]=v,e[34]=O):O=e[34],O}function xs(){}function ps(t){return t.stopPropagation()}function bs(t){const e=q.c(52),{open:n,onOpenChange:l,selectedMemberIds:i,onAddMembers:r}=t,[d,h]=$.useState(""),c=$.useDeferredValue(d);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[0]=g):g=e[0];const[f,a]=$.useState(g),{data:x}=nt();let o,m,N,E,T,S,C,v,_,O,p;if(e[1]!==x?.data?.members||e[2]!==c||e[3]!==r||e[4]!==l||e[5]!==n||e[6]!==f||e[7]!==d||e[8]!==i){const U=x?.data?.members??[];let B;e[20]!==c?(B=y=>{const L=c.toLowerCase();return y.user?.name?.toLowerCase().includes(L)||y.user?.email?.toLowerCase().includes(L)},e[20]=c,e[21]=B):B=e[21];const M=U.filter(B);let z;e[22]!==r||e[23]!==l||e[24]!==f?(z=()=>{r(f),a([]),l(!1)},e[22]=r,e[23]=l,e[24]=f,e[25]=z):z=e[25],N=z,m=Qe,O=n,p=l,o=qe,v="sm:max-w-md p-0",e[26]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsxs(He,{className:"px-6 pt-6",children:[s.jsx(Ze,{children:"Add Members to Role"}),s.jsx(Xe,{children:"Select members to add to this role."})]}),e[26]=_):_=e[26],S="flex flex-col h-80",e[27]!==d?(C=s.jsx("div",{className:"border-b border-border px-4 py-3",children:s.jsx(ve,{value:d,onChange:h,placeholder:"Search members...",className:"w-full"})}),e[27]=d,e[28]=C):C=e[28],E="flex-1 overflow-auto",T=M.length===0?s.jsx("div",{className:"flex items-center justify-center h-full px-6",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:d?"No members found":"No members available"})}):s.jsx("div",{className:"px-6 py-2 space-y-1",children:M.map(y=>{const L=y.role!=="owner",Y=i.includes(y.id),F=f.includes(y.id);return s.jsxs("label",{className:K("flex items-center gap-3 p-2 rounded-lg",!L||Y?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(we,{checked:F||Y,onCheckedChange:()=>{!L||Y||a(X=>X.includes(y.id)?X.filter(J=>J!==y.id):[...X,y.id])},disabled:!L||Y}),s.jsx(lt,{url:y.user?.image??void 0,fallback:ot(y.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:y.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:y.user?.email})]}),!L&&s.jsx(ge,{variant:"secondary",className:"shrink-0",children:"Owner"}),Y&&L&&s.jsx(ge,{variant:"outline",className:"shrink-0",children:"Added"})]},y.id)})}),e[1]=x?.data?.members,e[2]=c,e[3]=r,e[4]=l,e[5]=n,e[6]=f,e[7]=d,e[8]=i,e[9]=o,e[10]=m,e[11]=N,e[12]=E,e[13]=T,e[14]=S,e[15]=C,e[16]=v,e[17]=_,e[18]=O,e[19]=p}else o=e[9],m=e[10],N=e[11],E=e[12],T=e[13],S=e[14],C=e[15],v=e[16],_=e[17],O=e[18],p=e[19];let R;e[29]!==E||e[30]!==T?(R=s.jsx("div",{className:E,children:T}),e[29]=E,e[30]=T,e[31]=R):R=e[31];let I;e[32]!==R||e[33]!==S||e[34]!==C?(I=s.jsxs("div",{className:S,children:[C,R]}),e[32]=R,e[33]=S,e[34]=C,e[35]=I):I=e[35];let j;e[36]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Je,{children:"Cancel"}),e[36]=j):j=e[36];const u=f.length===0,w=f.length>0&&`(${f.length})`;let A;e[37]!==N||e[38]!==u||e[39]!==w?(A=s.jsxs(We,{className:"px-6 pb-6",children:[j,s.jsxs(et,{onClick:N,disabled:u,children:["Add ",w]})]}),e[37]=N,e[38]=u,e[39]=w,e[40]=A):A=e[40];let k;e[41]!==o||e[42]!==I||e[43]!==A||e[44]!==v||e[45]!==_?(k=s.jsxs(o,{className:v,children:[_,I,A]}),e[41]=o,e[42]=I,e[43]=A,e[44]=v,e[45]=_,e[46]=k):k=e[46];let G;return e[47]!==m||e[48]!==k||e[49]!==O||e[50]!==p?(G=s.jsx(m,{open:O,onOpenChange:p,children:k}),e[47]=m,e[48]=k,e[49]=O,e[50]=p,e[51]=G):G=e[51],G}function Ts(t){const e=q.c(29),{memberIds:n,onMemberIdsChange:l,readOnly:i,readOnlyMessage:r,searchQuery:d,addMemberDialogOpen:h,onAddMemberDialogOpenChange:c}=t,g=i===void 0?!1:i,f=r===void 0?"Owner membership cannot be changed":r,a=$.useDeferredValue(d),{data:x}=nt();let o,m,N;if(e[0]!==x?.data?.members||e[1]!==a||e[2]!==n||e[3]!==l||e[4]!==g||e[5]!==f||e[6]!==d){const v=x?.data?.members??[];let _;e[10]!==n?(_=I=>n.includes(I.id),e[10]=n,e[11]=_):_=e[11];const O=v.filter(_);let p;e[12]!==a?(p=I=>{const j=a.toLowerCase();return I.user?.name?.toLowerCase().includes(j)||I.user?.email?.toLowerCase().includes(j)},e[12]=a,e[13]=p):p=e[13];const R=O.filter(p);N="flex flex-col h-full",o="flex-1 overflow-auto",m=O.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h3",{className:"text-base font-medium mb-1",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to grant them the configured permissions."})]})}):R.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',d,'"']})}):s.jsx("div",{className:"p-4 space-y-2",children:R.map(I=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(lt,{url:I.user?.image??void 0,fallback:ot(I.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:I.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:I.user?.email})]}),g?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:s.jsx(ne,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(ze,{size:16})})})}),s.jsx(Ee,{children:s.jsx("p",{children:f})})]})}):s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>l(n.filter(j=>j!==I.id)),children:s.jsx(ze,{size:16})})]},I.id))}),e[0]=x?.data?.members,e[1]=a,e[2]=n,e[3]=l,e[4]=g,e[5]=f,e[6]=d,e[7]=o,e[8]=m,e[9]=N}else o=e[7],m=e[8],N=e[9];let E;e[14]!==o||e[15]!==m?(E=s.jsx("div",{className:o,children:m}),e[14]=o,e[15]=m,e[16]=E):E=e[16];let T;e[17]!==n||e[18]!==l?(T=v=>l([...n,...v]),e[17]=n,e[18]=l,e[19]=T):T=e[19];let S;e[20]!==h||e[21]!==n||e[22]!==c||e[23]!==T?(S=s.jsx(bs,{open:h,onOpenChange:c,selectedMemberIds:n,onAddMembers:T}),e[20]=h,e[21]=n,e[22]=c,e[23]=T,e[24]=S):S=e[24];let C;return e[25]!==N||e[26]!==E||e[27]!==S?(C=s.jsxs("div",{className:N,children:[E,S]}),e[25]=N,e[26]=E,e[27]=S,e[28]=C):C=e[28],C}function Es(t){const e=q.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let l;return e[1]!==t?(l=s.jsx($.Suspense,{fallback:n,children:s.jsx(Ts,{...t})}),e[1]=t,e[2]=l):l=e[2],l}const _s={owner:[],admin:[],user:[]};function Is(t,e,n,l){const i=t==="owner"||t==="admin";return{role:{id:n?.id,slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:i,staticPermissions:_s[t],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:e.filter(r=>r.role===t).map(r=>r.id)}}function Ns(t,e,n){const l=t.permission||{},i=l.self||[],r=i.includes("*"),d=r?[]:i.filter(a=>a!=="*"),h={};for(const[a,x]of Object.entries(l))if(!(a==="self"||a==="models"))if(a==="*")for(const o of n)h[o.id]=x.includes("*")?o.tools?.map(m=>m.name)??[]:x;else{const o=n.find(m=>m.id===a);o&&(h[a]=x.includes("*")?o.tools?.map(m=>m.name)??[]:x)}const c=l.models||[],g=c.length===0||c.includes("*:*"),f={};if(!g)for(const a of c){const x=a.indexOf(":");if(x===-1)continue;const o=a.slice(0,x),m=a.slice(x+1);f[o]||(f[o]=[]),f[o].push(m)}return{role:{id:t.id,slug:t.role,label:t.label},allowAllStaticPermissions:r,staticPermissions:d,toolSet:h,allowAllModels:g,modelSet:f,memberIds:e.filter(a=>a.role===t.role).map(a=>a.id)}}function Ss(t,e){const n={};t.allowAllStaticPermissions?n.self=["*"]:t.staticPermissions.length>0&&(n.self=t.staticPermissions);for(const[l,i]of Object.entries(t.toolSet))if(i.length>0){const d=e.find(h=>h.id===l)?.tools?.map(h=>h.name)??[];n[l]=d.length>0&&d.every(h=>i.includes(h))?["*"]:i}if(t.allowAllModels)n.models=["*:*"];else{const l=[];for(const[i,r]of Object.entries(t.modelSet))for(const d of r)l.push(`${i}:${d}`);l.length>0&&(n.models=l)}return n}function Cs(t,e,n){return t.kind==="builtin"?Is(t.role,e,void 0):t.kind==="custom"?Ns(t.role,e,n):{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:[]}}function As(t){const e=q.c(6),{readOnly:n,readOnlyMessage:l,onOpen:i}=t,r=l===void 0?"Owner membership cannot be changed":l;if(n){let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:s.jsxs(ne,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(Ae,{size:16}),"Add Member"]})})}),e[0]=c):c=e[0];let g;return e[1]!==r?(g=s.jsx(pe,{children:s.jsxs(be,{children:[c,s.jsx(Ee,{children:s.jsx("p",{children:r})})]})}),e[1]=r,e[2]=g):g=e[2],g}let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Ae,{size:16}),e[3]=d):d=e[3];let h;return e[4]!==i?(h=s.jsxs(ne,{variant:"outline",size:"sm",onClick:i,children:[d,"Add Member"]}),e[4]=i,e[5]=h):h=e[5],h}function Os(t){const e=q.c(14),{locator:n}=Ne(),l=je(),i=yt();let r;e[0]!==n?(r=re.members(n),e[0]=n,e[1]=r):r=e[1];let d;e[2]!==l?(d=()=>l.organization.listMembers(),e[2]=l,e[3]=d):d=e[3];let h;e[4]!==r||e[5]!==d?(h={queryKey:r,queryFn:d},e[4]=r,e[5]=d,e[6]=h):h=e[6];const{data:c,isPending:g}=Oe(h);if(g||!i){let o;return e[7]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:32,className:"animate-spin text-muted-foreground"})})}),e[7]=o):o=e[7],o}let f;e[8]!==c?.data?.members?(f=c?.data?.members??[],e[8]=c?.data?.members,e[9]=f):f=e[9];const a=f;let x;return e[10]!==i||e[11]!==a||e[12]!==t?(x=s.jsx(Rs,{...t,members:a,connections:i}),e[10]=i,e[11]=a,e[12]=t,e[13]=x):x=e[13],x}function Rs({target:t,onBack:e,onSaved:n,members:l,connections:i}){const{locator:r}=Ne(),d=je(),h=$e(),c=t.kind==="builtin",g=t.kind==="builtin"&&t.role==="owner",f=t.kind==="new",[a,x]=$.useState(c?"org":"mcp"),o=mt({resolver:ut(Zt),defaultValues:Cs(t,l,i)}),m=o.formState.isValid,N=o.formState.isDirty,E=Fe({mutationFn:async u=>{const w=Ss(u,i),A=u.role.slug||u.role.label.toLowerCase().replace(/\s+/g,"-"),k=(u.role.slug==="owner"||u.role.slug==="admin"||u.role.slug==="user")&&!u.role.id,G=async(U,B)=>{const M=l.filter(L=>L.role===(B??U)).map(L=>L.id),z=u.memberIds.filter(L=>!M.includes(L)),y=M.filter(L=>!u.memberIds.includes(L));for(const L of z){const Y=await d.organization.updateMemberRole({memberId:L,role:[U]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}for(const L of y){const Y=await d.organization.updateMemberRole({memberId:L,role:["user"]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}};if(k)return await G(u.role.slug),u;if(u.role.id){const U=u.role.label.toLowerCase().replace(/\s+/g,"-"),B=u.role.slug,M=U!==B,z=await d.organization.updateRole({roleId:u.role.id,data:{permission:w,...M?{roleName:U}:{}}});if(z?.error)throw new Error(z.error.message??"Something went wrong");return await G(M?U:B,M?B:void 0),M?{...u,role:{...u.role,slug:U}}:u}else{const U=await d.organization.createRole({role:A,permission:w});if(U?.error)throw new Error(U.error.message??"Something went wrong");for(const B of u.memberIds){const M=await d.organization.updateMemberRole({memberId:B,role:[A]});if(M?.error)throw new Error(M.error.message)}return{...u,role:{...u.role,id:U.data?.roleData?.id,slug:A}}}},onSuccess:(u,w)=>{h.invalidateQueries({queryKey:re.members(r)}),h.invalidateQueries({queryKey:re.organizationRoles(r)});const A=!w.role.id&&!w.role.slug,k=w.role.slug==="owner"&&!w.role.id;Re(k?"role_members_updated":A?"role_created":"role_updated",{role_slug:w.role.slug??null}),he.success(k?"Members updated successfully!":A?"Role created successfully!":"Role updated successfully!"),o.reset(u),n(u.role.id)},onError:u=>{he.error(u instanceof Error?u.message:"Failed to save role")}}),T=o.handleSubmit(u=>{if(!u.role.label.trim()){he.error("Role name is required"),o.setFocus("role.label");return}E.mutate(u)}),S=!g,C=t.kind==="builtin"?t.role.charAt(0).toUpperCase()+t.role.slice(1):t.kind==="custom"?t.role.label:"",v=[...g?[]:[{id:"mcp",label:"MCP Permissions"}],{id:"org",label:"Organization Permissions"},{id:"models",label:"Models"},{id:"members",label:"Members"}],[_,O]=$.useState(""),[p,R]=$.useState(!1),I=u=>{x(u),O("")},j={mcp:"Search MCP servers...",org:"Search permissions...",models:"Search models...",members:"Search members..."};return s.jsx(te,{children:s.jsxs(te.Content,{className:K("flex flex-col",a!=="org"&&"overflow-hidden"),children:[s.jsx("div",{className:"shrink-0 mx-auto w-full max-w-[1200px] px-4 md:px-10 pt-8 md:pt-12 pb-4",children:s.jsxs("div",{className:"flex flex-col gap-5",children:[s.jsx(te.Title,{actions:S&&s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"outline",size:"sm",onClick:e,disabled:E.isPending,children:"Cancel"}),s.jsx(ne,{size:"sm",onClick:T,disabled:E.isPending||!m||!N,children:E.isPending?"Saving...":f?"Create Role":"Save Changes"})]}),children:s.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[s.jsx("div",{className:K("size-2.5 rounded-full shrink-0",t.kind==="builtin"?Ht(t.role):qt(o.watch("role.label")))}),g&&s.jsx(Ke,{size:16,className:"text-muted-foreground shrink-0"}),f||t.kind==="custom"?s.jsx("input",{...o.register("role.label"),placeholder:"Role name",className:"leading-tight text-foreground bg-transparent border-none outline-none px-1 -mx-1 rounded hover:bg-input/25 focus:bg-input/25 transition-colors w-64 placeholder:text-muted-foreground/50",autoFocus:f}):s.jsx("span",{className:"truncate",children:C})]})}),s.jsx("div",{className:"flex items-center gap-2",children:v.map(u=>s.jsx("button",{type:"button",onClick:()=>I(u.id),className:K("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex items-center",a===u.id?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:u.label},u.id))}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(ve,{value:_,onChange:O,placeholder:j[a]??"Search...",className:"w-full md:w-[375px]"}),a==="members"&&s.jsx(As,{readOnly:t.kind==="builtin"&&t.role==="owner",onOpen:()=>R(!0)})]})]})}),s.jsx("div",{className:K("mx-auto w-full max-w-[1200px] px-4 md:px-10 pb-6",a!=="org"&&"flex-1 min-h-0"),children:s.jsxs("div",{className:K(a!=="org"&&"h-full overflow-hidden",a!=="models"&&a!=="org"&&"border border-border rounded-xl bg-card"),children:[a==="mcp"&&!g&&s.jsx(Kt,{toolSet:o.watch("toolSet"),onToolSetChange:u=>o.setValue("toolSet",u,{shouldDirty:!0}),searchQuery:_}),a==="org"&&s.jsx(Xt,{allowAllStaticPermissions:o.watch("allowAllStaticPermissions"),staticPermissions:o.watch("staticPermissions"),onAllowAllChange:u=>o.setValue("allowAllStaticPermissions",u,{shouldDirty:!0}),onPermissionsChange:u=>o.setValue("staticPermissions",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),a==="models"&&s.jsx(gs,{allowAllModels:o.watch("allowAllModels"),modelSet:o.watch("modelSet"),onAllowAllChange:u=>o.setValue("allowAllModels",u,{shouldDirty:!0}),onModelSetChange:u=>o.setValue("modelSet",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),a==="members"&&s.jsx(Es,{memberIds:o.watch("memberIds"),onMemberIdsChange:u=>o.setValue("memberIds",u,{shouldDirty:!0}),readOnly:t.kind==="builtin"&&(t.role==="owner"||t.role==="user"),readOnlyMessage:t.kind==="builtin"&&t.role==="user"?"User is the default role — members can't be removed from it; assign another role to change their access":"Owner membership cannot be changed",searchQuery:_,addMemberDialogOpen:p,onAddMemberDialogOpenChange:R})]})})]})})}function js(t){return t.kind==="builtin"?`builtin-${t.role}`:t.kind==="custom"?`custom-${t.role.id}`:"new"}function vs(t){const e=q.c(6),{area:n,children:l}=t,{isPrivileged:i,loading:r,error:d}=Dt();let h;return e[0]!==n||e[1]!==l||e[2]!==d||e[3]!==i||e[4]!==r?(h=s.jsx(kt,{granted:i,loading:r,error:d,area:n,children:l}),e[0]=n,e[1]=l,e[2]=d,e[3]=i,e[4]=r,e[5]=h):h=e[5],h}const ys=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],Ce=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"];function ws(t){if(!t)return"bg-neutral-400";let e=0;for(let l=0;l<t.length;l++){const i=t.charCodeAt(l);e=(e<<5)-e+i,e=e&e}const n=Math.abs(e)%Ce.length;return Ce[n]??Ce[0]}const Ms={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Ls(t,e){return e?Ms[t]??"bg-neutral-400":ws(t)}function Ps(){const t=q.c(77),[e,n]=$.useState(""),[l,i]=$.useState(null),r=gt();let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d={strict:!1},t[0]=d):d=t[0];const{role:h}=xt(d),{locator:c}=Ne(),g=je(),f=$e(),{customRoles:a,refetch:x}=pt();let o;t[1]!==r?(o=P=>r({to:".",search:V=>({...V,role:P})}),t[1]=r,t[2]=o):o=t[2];const m=o;let N;e:{if(!h){N=null;break e}if(h==="new"){N={kind:"new"};break e}if(h.startsWith("builtin-")){N={kind:"builtin",role:h.slice(8)};break e}let P;t[3]!==h?(P=ae=>ae.id===h,t[3]=h,t[4]=P):P=t[4];const V=a.find(P);N=V?{kind:"custom",role:V}:null}const E=N;let T;t[5]!==c?(T=re.members(c),t[5]=c,t[6]=T):T=t[6];let S;t[7]!==g?(S=()=>g.organization.listMembers(),t[7]=g,t[8]=S):S=t[8];let C;t[9]!==T||t[10]!==S?(C={queryKey:T,queryFn:S},t[9]=T,t[10]=S,t[11]=C):C=t[11];const{data:v}=Oe(C);let _;t[12]!==v?.data?.members?(_=v?.data?.members??[],t[12]=v?.data?.members,t[13]=_):_=t[13];const O=_;let p;t[14]!==O?(p=P=>O.filter(V=>V.role===P).length,t[14]=O,t[15]=p):p=t[15];const R=p;let I;if(t[16]!==a||t[17]!==R||t[18]!==e){let P;t[20]!==R?(P=ce=>({kind:"builtin",role:{...ce,memberCount:R(ce.role)}}),t[20]=R,t[21]=P):P=t[21];const V=ys.map(P);let ae;t[22]!==R?(ae=ce=>({kind:"custom",role:{...ce,memberCount:R(ce.role)}}),t[22]=R,t[23]=ae):ae=t[23];const at=a.map(ae);if(I=[...V,...at],e){const ce=e.toLowerCase();I=I.filter(ct=>ct.role.label.toLowerCase().includes(ce))}t[16]=a,t[17]=R,t[18]=e,t[19]=I}else I=t[19];let j;t[24]!==g?(j=async P=>{const V=await g.organization.deleteRole({roleId:P});if(V?.error)throw new Error(V.error.message);return V?.data},t[24]=g,t[25]=j):j=t[25];const u=Fe({mutationFn:j,onSuccess:(P,V)=>{Re("role_deleted",{role_id:V}),f.invalidateQueries({queryKey:re.members(c)}),f.invalidateQueries({queryKey:re.organizationRoles(c)}),he.success("Role deleted successfully!"),x(),E?.kind==="custom"&&E.role.id===V&&m(void 0)},onError:zs});let w,A,k,G;t[26]===Symbol.for("react.memo_cache_sentinel")?(G={id:"role",header:"Role",render:Vs,cellClassName:"flex-1 min-w-0",sortable:!0},w={id:"type",header:"Type",render:Bs,cellClassName:"w-28 shrink-0"},A={id:"permissions",header:"Permissions",render:Us,cellClassName:"flex-1 min-w-0"},k={id:"members",header:"Members",render:Gs,cellClassName:"w-24 shrink-0"},t[26]=w,t[27]=A,t[28]=k,t[29]=G):(w=t[26],A=t[27],k=t[28],G=t[29]);let U;t[30]===Symbol.for("react.memo_cache_sentinel")?(U=[G,w,A,k,{id:"actions",header:"",render:P=>P.kind==="builtin"?null:s.jsxs(Tt,{children:[s.jsx(Et,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:ks,children:s.jsx(Nt,{size:16})})}),s.jsx(_t,{align:"end",onClick:Ds,children:s.jsxs(It,{variant:"destructive",onClick:()=>{const V=P.role;V.id&&i({id:V.id,label:V.label})},children:[s.jsx(St,{size:16}),"Delete"]})})]}),cellClassName:"w-12 shrink-0"}],t[30]=U):U=t[30];const B=U;let M;t[31]!==m?(M=P=>{if(P.kind==="builtin")m(`builtin-${P.role.role}`);else{const V=P.role;m(V.id)}},t[31]=m,t[32]=M):M=t[32];const z=M;if(E){let P;t[33]!==m?(P=()=>m(void 0),t[33]=m,t[34]=P):P=t[34];let V;return t[35]!==x||t[36]!==m?(V=()=>{x(),m(void 0)},t[35]=x,t[36]=m,t[37]=V):V=t[37],s.jsx(Os,{target:E,onBack:P,onSaved:V},js(E))}let y;t[38]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(te.Title,{children:"Roles"}),t[38]=y):y=t[38];let L;t[39]===Symbol.for("react.memo_cache_sentinel")?(L=P=>{P.key==="Escape"&&(n(""),P.target.blur())},t[39]=L):L=t[39];let Y;t[40]!==e?(Y=s.jsx(ve,{value:e,onChange:n,placeholder:"Search roles...",className:"w-full md:w-[375px]",onKeyDown:L}),t[40]=e,t[41]=Y):Y=t[41];let F;t[42]!==m?(F=()=>m("new"),t[42]=m,t[43]=F):F=t[43];let X;t[44]===Symbol.for("react.memo_cache_sentinel")?(X=s.jsx(Ae,{size:16}),t[44]=X):X=t[44];let J;t[45]!==F?(J=s.jsxs(ne,{onClick:F,children:[X,"Create Role"]}),t[45]=F,t[46]=J):J=t[46];let le;t[47]!==Y||t[48]!==J?(le=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[Y,J]}),t[47]=Y,t[48]=J,t[49]=le):le=t[49];let oe;t[50]!==e?(oe=e?s.jsx(Ge,{title:"No roles found",description:`No roles match "${e}"`}):s.jsx(Ge,{title:"No roles",description:"Create a role to get started."}),t[50]=e,t[51]=oe):oe=t[51];let ie;t[52]!==I||t[53]!==B||t[54]!==z||t[55]!==oe?(ie=s.jsx(bt,{columns:B,data:I,isLoading:!1,onRowClick:z,emptyState:oe}),t[52]=I,t[53]=B,t[54]=z,t[55]=oe,t[56]=ie):ie=t[56];let b;t[57]!==le||t[58]!==ie?(b=s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs("div",{className:"flex flex-col gap-6",children:[y,le,ie]})})}),t[57]=le,t[58]=ie,t[59]=b):b=t[59];const D=l!==null;let Q;t[60]===Symbol.for("react.memo_cache_sentinel")?(Q=P=>!P&&i(null),t[60]=Q):Q=t[60];let H;t[61]===Symbol.for("react.memo_cache_sentinel")?(H=s.jsx(Ze,{children:"Delete Role"}),t[61]=H):H=t[61];const W=l?.label;let Z;t[62]!==W?(Z=s.jsxs(He,{children:[H,s.jsxs(Xe,{children:['Are you sure you want to delete the "',W,'" role? This action cannot be undone.']})]}),t[62]=W,t[63]=Z):Z=t[63];let ee;t[64]===Symbol.for("react.memo_cache_sentinel")?(ee=s.jsx(Je,{children:"Cancel"}),t[64]=ee):ee=t[64];let de;t[65]!==u||t[66]!==l?(de=s.jsxs(We,{children:[ee,s.jsx(et,{onClick:()=>{l?.id&&u.mutate(l.id),i(null)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[65]=u,t[66]=l,t[67]=de):de=t[67];let me;t[68]!==Z||t[69]!==de?(me=s.jsxs(qe,{children:[Z,de]}),t[68]=Z,t[69]=de,t[70]=me):me=t[70];let ue;t[71]!==D||t[72]!==me?(ue=s.jsx(Qe,{open:D,onOpenChange:Q,children:me}),t[71]=D,t[72]=me,t[73]=ue):ue=t[73];let _e;return t[74]!==b||t[75]!==ue?(_e=s.jsxs(te,{children:[b,ue]}),t[74]=b,t[75]=ue,t[76]=_e):_e=t[76],_e}function Ds(t){return t.stopPropagation()}function ks(t){return t.stopPropagation()}function Gs(t){return s.jsx("span",{className:"text-sm text-foreground",children:t.role.memberCount})}function Us(t){if(t.kind==="builtin")return t.role.role==="owner"||t.role.role==="admin"?s.jsx("span",{className:"text-sm text-muted-foreground",children:"Full access"}):s.jsx("span",{className:"text-sm text-muted-foreground",children:"Basic access"});const e=t.role,n=[];return e.allowsAllStaticPermissions?n.push("Full org access"):e.staticPermissionCount&&e.staticPermissionCount>0&&n.push(`${e.staticPermissionCount} org perm${e.staticPermissionCount!==1?"s":""}`),e.allowsAllConnections?n.push("All connections"):e.connectionCount&&e.connectionCount>0&&n.push(`${e.connectionCount} connection${e.connectionCount!==1?"s":""}`),s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:n.length>0?n.join(", "):"No permissions"})}function Bs(t){return t.kind==="builtin"?s.jsx(ge,{variant:"secondary",className:"text-xs",children:"Built-in"}):s.jsx(ge,{variant:"outline",className:"text-xs",children:"Custom"})}function Vs(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:K("size-2.5 rounded-full shrink-0",Ls(t.role.role,t.kind==="builtin"))}),s.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:t.role.label}),t.kind==="builtin"&&s.jsx(Ke,{size:12,className:"text-muted-foreground shrink-0"})]})}function zs(t,e){Re("role_delete_failed",{role_id:e,error:t instanceof Error?t.message:String(t)}),he.error(t instanceof Error?t.message:"Failed to delete role")}function Ys(){const t=q.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load roles"})})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(ht,{fallback:e,children:s.jsx($.Suspense,{fallback:s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(Ps,{})})}),t[1]=n):n=t[1],n}function ml(){const t=q.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(vs,{area:"roles",children:s.jsx(Ys,{})}),t[0]=e):e=t[0],e}export{ml as default};
1
+ import{r as $,p as Ne,K as re,b3 as dt,m as Oe,j as s,c as K,l as fe,B as ne,e as q,s as Pe,aB as Ie,v as se,aD as De,aE as ke,F as $e,x as mt,w as ut,a as Fe,n as he,t as Re,ae as Ke,a6 as ft,a1 as ht,f as gt,d as xt}from"./index-C3gL9St4.js";import{u as pt,C as bt}from"./use-organization-roles-BXV_PsbS.js";import{u as je}from"./use-org-auth-client-wIGZzMQc.js";import{B as ge}from"./badge-CuCfPx-y.js";import{f as Qe,a as qe,b as He,c as Ze,d as Xe,A as Je,e as We,g as et}from"./alert-dialog-C20YoJ0a.js";import{D as Tt,a as Et,b as _t,c as It}from"./dropdown-menu-B4AhYSKY.js";import{a as Nt}from"./DotsVertical-DQ-WKmA2.js";import{s as Ae}from"./Plus-J1K3Rh3s.js";import{s as St}from"./Trash01-Cib_Sg7t.js";import{P as te}from"./index-Bf1YdrMc.js";import{E as Ge}from"./empty-state-Cz0bAkoo.js";import{S as ve}from"./search-input-ChrXBjj7.js";import{P as tt,D as st}from"./ai-providers-logos-DD3qZ33J.js";import{I as ye}from"./integration-icon-BcoSEnuB.js";import{u as Ct}from"./use-infinite-scroll-Cj-XExfy.js";import{C as we}from"./checkbox-BMArZ_ix.js";import{i as At}from"./Settings02-By0Jzp86.js";import{u as Ot}from"./useSuspenseInfiniteQuery-xMSumVHF.js";import{u as Rt,S as jt}from"./use-mcp-client-DYJrfczK.js";import{C as vt}from"./collection-search-CDaYX9FR.js";import{u as nt}from"./use-members-DJNn_Bxw.js";import{u as yt}from"./use-connection-Cg1b4Um2.js";import{u as wt,d as Mt}from"./use-ai-providers-CYtt5EvS.js";import{A as lt}from"./avatar-Nw1x5eGz.js";import{S as xe}from"./switch-BH90tU73.js";import{c as pe,b as be,T as Te,a as Ee}from"./tooltip-D9KNvVvr.js";import{S as Ue,a as Be,b as Ve}from"./settings-section-0NTS3MkI.js";import{t as Lt}from"./ChevronDown-6sFYQ_lK.js";import{i as Pt}from"./ChevronRight-BdMquS3m.js";import{i as ze}from"./X-BL2gdXEj.js";import{a as Dt}from"./use-capability-BgNNCaLI.js";import{A as kt}from"./access-gate-DFiTys6s.js";import"./table-Borl2aRc.js";import"./SwitchHorizontal01-X5LMtCou.js";import"./ChevronUp-BNOOOsT2.js";import"./sidebar-B5eoEEUh.js";import"./LayoutLeft-XZqot3mq.js";import"./sheet-BBNc6H-H.js";import"./SearchMd-CjaRzuTt.js";import"./XCircle-CCiKaJ__.js";import"./agent-icon-Cf9b4Ru9.js";import"./AlertCircle-DhaQx9Mx.js";import"./Tool01-Dw4_QC3_.js";import"./ArrowUpRight-CfMwsozc.js";import"./ZapSquare-J9sfjhfh.js";import"./Users03-4g5nbjFJ.js";import"./CheckCircle-DTbDatzD.js";import"./ChevronLeft-8zvGG53e.js";import"./Stars02-CDIgaXAV.js";import"./Eye-B4uYcIta.js";import"./ZoomOut-DCv2Tq6d.js";import"./Globe01-C7fVaUrg.js";import"./FilterLines-DCvNnP3i.js";import"./Star01-_Kd09vMY.js";import"./Globe04-Bwx3UG2x.js";import"./HardDrive-BOa3mtdo.js";import"./Key01-B-9ep-9Z.js";import"./LinkExternal01-iioOg4ap.js";import"./Monitor01-DL3Tirrd.js";import"./Sun-TGwF56wV.js";import"./Palette-pv0gmxnS.js";import"./Play-DXtyMrcP.js";import"./Shield01-M8Hvv7sS.js";import"./Stars01-DyLJc1qm.js";import"./Upload01-CJqoFPBG.js";import"./User01-BywBiT-b.js";import"./Users01-CDCapXFR.js";import"./XClose-BtRDneKm.js";import"./Zap-B8ZLhQFM.js";import"./auth-RitCYkp6.js";import"./use-collections-H8HuKWEE.js";import"./studio-tools-B1vmC7k4.js";import"./card-yVmBUFAg.js";import"./capability-load-error-gogxAwFW.js";const Me="basic-usage",Le=[{id:Me,label:"Basic Usage",description:"Tools all org members can access by default",section:"Basic Usage",tools:["COLLECTION_CONNECTIONS_LIST","COLLECTION_CONNECTIONS_GET","CONNECTION_TEST","COLLECTION_VIRTUAL_MCP_LIST","COLLECTION_VIRTUAL_MCP_GET","VIRTUAL_MCP_PLUGIN_CONFIG_GET","VIRTUAL_MCP_LAST_USED_LIST","AUTOMATION_GET","AUTOMATION_LIST","AUTOMATION_RUN_STATS","AI_PROVIDERS_LIST","AI_PROVIDERS_LIST_MODELS","AI_PROVIDERS_ACTIVE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_CREDITS","AI_PROVIDER_TOPUP_URL","LIST_OBJECTS","GET_OBJECT_METADATA","GET_PRESIGNED_URL","PUT_PRESIGNED_URL","FILE_OBJECTS_LIST","SANDBOX_START","SANDBOX_DELETE","GLOBAL_SEARCH","ORGANIZATION_SETTINGS_GET","USER_GET","LINK_CURRENT_GET","LINK_DISCONNECT","BRAND_CONTEXT_LIST","COLLECTION_THREADS_CREATE","COLLECTION_THREADS_LIST","COLLECTION_THREADS_GET","COLLECTION_THREADS_UPDATE","COLLECTION_THREADS_DELETE","COLLECTION_THREAD_MESSAGES_LIST","THREAD_BACKGROUND_TOOL_START","THREAD_SUBTASK_DELIVER"]},{id:"org:manage",label:"Manage organization",description:"Edit organization settings, brand context, and domain configuration",section:"Organization",tools:["ORGANIZATION_GET","ORGANIZATION_LIST","ORGANIZATION_UPDATE","ORGANIZATION_SETTINGS_GET","ORGANIZATION_SETTINGS_UPDATE","BRAND_CONTEXT_LIST","BRAND_CONTEXT_GET","BRAND_CONTEXT_CREATE","BRAND_CONTEXT_UPDATE","BRAND_CONTEXT_DELETE","BRAND_CONTEXT_EXTRACT","BRAND_GET","BRAND_LIST","ORGANIZATION_DOMAIN_LIST","ORGANIZATION_DOMAIN_ADD","ORGANIZATION_DOMAIN_UPDATE","ORGANIZATION_DOMAIN_VERIFY","ORGANIZATION_DOMAIN_REMOVE"]},{id:"members:manage",label:"Manage members",description:"Invite members, remove them, and change their roles",section:"Organization",tools:["ORGANIZATION_MEMBER_LIST","ORGANIZATION_MEMBER_ADD","ORGANIZATION_MEMBER_REMOVE","ORGANIZATION_MEMBER_UPDATE_ROLE","ORGANIZATION_JOIN_REQUEST_LIST","ORGANIZATION_JOIN_REQUEST_APPROVE","ORGANIZATION_JOIN_REQUEST_DENY"],dangerous:!0},{id:"connections:manage",label:"Manage connections",description:"Create, update, and delete connections",section:"Connections & Agents",tools:["COLLECTION_CONNECTIONS_CREATE","COLLECTION_CONNECTIONS_UPDATE","COLLECTION_CONNECTIONS_DELETE"],dangerous:!0},{id:"agents:manage",label:"Manage agents",description:"Create, configure, and delete agents",section:"Connections & Agents",tools:["COLLECTION_VIRTUAL_MCP_CREATE","COLLECTION_VIRTUAL_MCP_UPDATE","COLLECTION_VIRTUAL_MCP_DELETE","VIRTUAL_MCP_PLUGIN_CONFIG_UPDATE","VIRTUAL_MCP_PINNED_VIEWS_UPDATE"],dangerous:!0},{id:"automations:manage",label:"Manage automations",description:"Create, update, run, and delete automations",section:"Automations",tools:["AUTOMATION_CREATE","AUTOMATION_UPDATE","AUTOMATION_DELETE","AUTOMATION_TRIGGER_ADD","AUTOMATION_TRIGGER_REMOVE","AUTOMATION_TRIGGER_ROTATE_TOKEN","AUTOMATION_RUN"],dangerous:!0},{id:"monitoring:view",label:"View monitoring",description:"Access logs and usage statistics",section:"Monitoring",tools:["MONITORING_LOG_GET","MONITORING_LOGS_LIST","MONITORING_STATS","MONITORING_THREAD_USAGE"]},{id:"secrets:manage",label:"Manage secrets",description:"Create and list secrets stored in the credential vault",section:"Organization",tools:["SECRET_CREATE","SECRET_LIST"]},{id:"file-configs:manage",label:"Manage file configs",description:"Create, list, update and delete S3 bucket configurations",section:"Organization",tools:["FILE_CONFIG_CREATE","FILE_CONFIG_LIST","FILE_CONFIG_UPDATE","FILE_CONFIG_DELETE","FILE_OBJECTS_LIST"]},{id:"ai-providers:manage",label:"Manage AI providers",description:"Add or remove API keys and provision provider credentials",section:"AI Providers",tools:["AI_PROVIDER_KEY_CREATE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_KEY_DELETE","AI_PROVIDER_KEY_UPDATE","AI_PROVIDER_KEY_PREVIEW","AI_PROVIDER_OAUTH_URL","AI_PROVIDER_OAUTH_EXCHANGE","AI_PROVIDER_PROVISION_KEY","AI_PROVIDER_TOPUP_URL","AI_PROVIDER_CREDITS"]},{id:"tags:manage",label:"Manage tags",description:"Create, assign, and delete organization tags",section:"Organization",tools:["TAGS_LIST","TAGS_CREATE","TAGS_DELETE","MEMBER_TAGS_GET","MEMBER_TAGS_SET"]},{id:"registry:manage",label:"Manage registry",description:"Browse, publish, and manage items in the registry",section:"Store & Registry",tools:["COLLECTION_REGISTRY_APP_LIST","COLLECTION_REGISTRY_APP_GET","COLLECTION_REGISTRY_APP_VERSIONS","COLLECTION_REGISTRY_APP_FILTERS","REGISTRY_ITEM_LIST","REGISTRY_ITEM_SEARCH","REGISTRY_ITEM_GET","REGISTRY_ITEM_VERSIONS","REGISTRY_ITEM_FILTERS","REGISTRY_DISCOVER_TOOLS","REGISTRY_ITEM_CREATE","REGISTRY_ITEM_BULK_CREATE","REGISTRY_ITEM_UPDATE","REGISTRY_ITEM_DELETE","REGISTRY_AI_GENERATE","REGISTRY_PUBLISH_REQUEST_LIST","REGISTRY_PUBLISH_REQUEST_REVIEW","REGISTRY_PUBLISH_REQUEST_COUNT","REGISTRY_PUBLISH_REQUEST_DELETE","REGISTRY_PUBLISH_API_KEY_GENERATE","REGISTRY_PUBLISH_API_KEY_LIST","REGISTRY_PUBLISH_API_KEY_REVOKE"],dangerous:!0},{id:"registry:monitor",label:"Monitor registry health",description:"Run health checks on registry connections and view results",section:"Store & Registry",tools:["REGISTRY_MONITOR_RUN_START","REGISTRY_MONITOR_RUN_LIST","REGISTRY_MONITOR_RUN_GET","REGISTRY_MONITOR_RUN_CANCEL","REGISTRY_MONITOR_RESULT_LIST","REGISTRY_MONITOR_CONNECTION_LIST","REGISTRY_MONITOR_CONNECTION_SYNC","REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH"]},{id:"api-keys:manage",label:"Manage API keys",description:"Create, update, and revoke API keys",section:"Developer",tools:["API_KEY_CREATE","API_KEY_LIST","API_KEY_UPDATE","API_KEY_DELETE"]},{id:"storage:delete",label:"Delete from storage",description:"Permanently delete files from object storage",section:"Developer",tools:["DELETE_OBJECT","DELETE_OBJECTS"],dangerous:!0},{id:"connections:sql",label:"Run SQL queries",description:"Execute raw SQL against connected databases",section:"Developer",tools:["DATABASES_RUN_SQL"],dangerous:!0}];[...Le.find(t=>t.id===Me)?.tools??[]];const Gt=["agents:manage","connections:manage"];new Set(Le.filter(t=>Gt.includes(t.id)).flatMap(t=>t.tools));function Ut(){const t=new Map;for(const e of Le){if(e.id===Me)continue;const n=t.get(e.section)??[];n.push(e),t.set(e.section,n)}return Array.from(t.entries()).map(([e,n])=>({section:e,capabilities:n}))}function Bt(t,e,n){return n?!0:t.tools.every(l=>e.includes(l))}function Vt(t,e,n){if(n){const i=new Set(e);for(const r of t.tools)i.add(r);return Array.from(i)}const l=new Set(e);for(const i of t.tools)l.delete(i);return Array.from(l)}function zt(t){const e=q.c(21),{connection:n,isSelected:l,hasToolsEnabled:i,activeToolsCount:r,totalToolsCount:d,onSelect:h,onToggle:c}=t,g=l?"bg-accent/50":"hover:bg-muted/50";let f;e[0]!==g?(f=K("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",g),e[0]=g,e[1]=f):f=e[1];let a;e[2]!==n.icon||e[3]!==n.title?(a=s.jsx(ye,{icon:n.icon,name:n.title,size:"xs"}),e[2]=n.icon,e[3]=n.title,e[4]=a):a=e[4];let x;e[5]!==n.title?(x=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:n.title})}),e[5]=n.title,e[6]=x):x=e[6];let o;e[7]!==h||e[8]!==a||e[9]!==x?(o=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:h,children:[a,x]}),e[7]=h,e[8]=a,e[9]=x,e[10]=o):o=e[10];let m;e[11]!==r||e[12]!==n.tools||e[13]!==i||e[14]!==c||e[15]!==d?(m=n.tools&&n.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[r,"/",d]}),s.jsx(we,{checked:i,onCheckedChange:c,onClick:Yt})]}),e[11]=r,e[12]=n.tools,e[13]=i,e[14]=c,e[15]=d,e[16]=m):m=e[16];let N;return e[17]!==f||e[18]!==o||e[19]!==m?(N=s.jsxs("div",{className:f,children:[o,m]}),e[17]=f,e[18]=o,e[19]=m,e[20]=N):N=e[20],N}function Yt(t){return t.stopPropagation()}function $t(t){const e=q.c(18),{connectionId:n,tool:l,isSelected:i,onToggle:r}=t,d=`tool-${n}-${l.name}`,h=i?"text-foreground":"text-muted-foreground";let c;e[0]!==h?(c=K("text-sm font-medium",h),e[0]=h,e[1]=c):c=e[1];let g;e[2]!==c||e[3]!==l.name?(g=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:c,children:l.name})}),e[2]=c,e[3]=l.name,e[4]=g):g=e[4];let f;e[5]!==l.description?(f=l.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:l.description}),e[5]=l.description,e[6]=f):f=e[6];let a;e[7]!==g||e[8]!==f?(a=s.jsxs("div",{className:"flex-1 min-w-0",children:[g,f]}),e[7]=g,e[8]=f,e[9]=a):a=e[9];const x=`tool-${n}-${l.name}`;let o;e[10]!==i||e[11]!==r||e[12]!==x?(o=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(we,{id:x,checked:i,onCheckedChange:r,onClick:Ft})}),e[10]=i,e[11]=r,e[12]=x,e[13]=o):o=e[13];let m;return e[14]!==d||e[15]!==a||e[16]!==o?(m=s.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:d,children:[a,o]}),e[14]=d,e[15]=a,e[16]=o,e[17]=m):m=e[17],m}function Ft(t){return t.stopPropagation()}function Kt({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:n,searchQuery:l}){const[i,r]=$.useState(""),d=l!==void 0?l:i,h=$.useDeferredValue(d),[c,g]=$.useState("all"),[f,a]=$.useState(!1),x=$.useRef(new Set(Object.keys(t))),{org:o}=Ne(),m=Rt({connectionId:jt,orgId:o.id,orgSlug:o.slug}),N=100,E=h.trim(),T=E?{operator:"or",conditions:[{field:["title"],operator:"contains",value:E},{field:["description"],operator:"contains",value:E}]}:void 0,S=!!n,C={...T&&{where:T},orderBy:[{field:["updated_at"],direction:"asc"}],limit:N,offset:0,...S&&{include_virtual:!0}},v=JSON.stringify(C),{data:_,fetchNextPage:O,hasNextPage:p,isFetchingNextPage:R}=Ot({queryKey:re.collectionListInfinite(m,o.id,"","CONNECTIONS",v),queryFn:async({pageParam:b=0})=>(await m.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...T&&{where:T},orderBy:[{field:["updated_at"],direction:"asc"}],limit:N,offset:b,...S&&{include_virtual:!0}}})).structuredContent,initialPageParam:0,getNextPageParam:(b,D)=>{if(b?.hasMore)return D.reduce((Q,H)=>Q+(H?.items?.length??0),0)},staleTime:3e4}),I=_?.pages.flatMap(b=>b?.items??[])??[],j=Ct(O,p??!1,R),u=n?I.filter(b=>b.connection_type!=="VIRTUAL"?!0:dt(b.connection_url)!==n):I,w=x.current,A=[...w.values()].map(b=>u.find(D=>D.id===b)).filter(b=>b!==void 0),k=u.filter(b=>!w.has(b.id)),G=[...A,...k],U=b=>{const D=t[b];return D!==void 0&&D.length>0},B=G.filter(b=>{if(c==="all")return!0;const D=U(b.id);return c==="selected"?D:c==="unselected"?!D:!0}),[M,z]=$.useState(G[0]?.id??null),y=M?G.find(b=>b.id===M)??null:null,{data:L,isFetching:Y}=Oe({queryKey:re.collectionItem(m,o.id,"","CONNECTIONS",M??""),queryFn:async()=>M?(await m.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:M}})).structuredContent?.item??null:null,enabled:!!M,staleTime:3e4}),F=L?.tools??[],X=(b,D)=>t[b]?.includes(D)??!1,J=(b,D)=>{const Q=t[b]??[],H=Q.includes(D),W={...t};if(H){const Z=Q.filter(ee=>ee!==D);Z.length===0?delete W[b]:W[b]=Z}else W[b]=[...Q,D];e(W)},le=b=>{const D=b===M?F:[];if(!D.length)return;const Q=t[b]??[],H=D.map(ee=>ee.name),W=Q.length>0&&H.every(ee=>Q.includes(ee)),Z={...t};W?delete Z[b]:(Z[b]=H,z(b)),e(Z)},oe=b=>{z(b),a(!0)},ie=()=>{a(!1)};return s.jsxs("div",{className:"flex h-full",children:[s.jsxs("div",{className:K("w-full md:w-80 border-r border-border flex flex-col",f&&"hidden md:flex"),children:[l===void 0&&s.jsx(vt,{value:i,onChange:r,placeholder:"Search MCP Servers..."}),s.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[s.jsx("button",{onClick:()=>g("all"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>g("selected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>g("unselected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:B.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:d?"No connections found":c==="selected"?"No servers selected":c==="unselected"?"No unselected servers":"No connections available"}):s.jsxs("div",{className:"p-2 space-y-1",children:[B.map(b=>{const D=M===b.id,Q=D?F.length:0,H=t[b.id]?.length??0;return s.jsx(zt,{connection:{...b,tools:D?F:b.tools},isSelected:D,hasToolsEnabled:U(b.id),activeToolsCount:H,totalToolsCount:Q,onSelect:()=>oe(b.id),onToggle:()=>le(b.id)},b.id)}),s.jsx("div",{ref:j,className:"h-4"}),R&&s.jsx("div",{className:"flex justify-center py-3",children:s.jsx(fe,{size:18,className:"animate-spin text-muted-foreground"})})]})})]}),s.jsx("div",{className:K("flex-1 flex-col",f?"flex":"hidden md:flex"),children:y?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:ie,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(At,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(ye,{icon:y.icon,name:y.title,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:y.title}),y.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:y.description})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:Y?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(fe,{size:18,className:"animate-spin text-muted-foreground"})}):F.length===0?s.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):s.jsx("div",{className:"space-y-2",children:F.map(b=>s.jsx($t,{connectionId:y.id,tool:b,isSelected:X(y.id,b.name),onToggle:()=>J(y.id,b.name)},b.name))})})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}const Se=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"],Qt={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function qt(t){if(!t)return"bg-neutral-400";let e=0;for(let l=0;l<t.length;l++){const i=t.charCodeAt(l);e=(e<<5)-e+i,e=e&e}const n=Math.abs(e)%Se.length;return Se[n]??Se[0]}function Ht(t,e){return Qt[t]??"bg-neutral-400"}const Zt=Pe({role:Pe({id:se().optional(),slug:se().optional(),label:se()}),allowAllStaticPermissions:ke(),staticPermissions:Ie(se()),toolSet:De(se(),Ie(se())),allowAllModels:ke(),modelSet:De(se(),Ie(se())),memberIds:Ie(se())});function ot(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function Ye(t,e,n){const l=s.jsx(xe,{checked:t,disabled:e,onCheckedChange:n});return e?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:l})}),s.jsx(Ee,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):l}function Xt(t){const e=q.c(28),{allowAllStaticPermissions:n,staticPermissions:l,onAllowAllChange:i,onPermissionsChange:r,readOnly:d,searchQuery:h}=t,c=d===void 0?!1:d;let g;e[0]!==h?(g=h.trim().toLowerCase(),e[0]=h,e[1]=g):g=e[1];const f=$.useDeferredValue(g);let a;if(e[2]!==n||e[3]!==f||e[4]!==i||e[5]!==r||e[6]!==c||e[7]!==h||e[8]!==l){const x=Ut(),o=(v,_)=>{if(!c){if(n&&_){const O=x.flatMap(es).flatMap(Wt);i(!1),r(O.filter(p=>!v.tools.includes(p)));return}n||r(Vt(v,l,!_))}};let m;e[10]!==f?(m=v=>{const{section:_,capabilities:O}=v;return{section:_,capabilities:O.filter(p=>!f||p.label.toLowerCase().includes(f)||p.description.toLowerCase().includes(f))}},e[10]=f,e[11]=m):m=e[11];const N=x.map(m).filter(Jt);let E;e[12]!==n||e[13]!==i||e[14]!==r?(E=()=>{i(!n),r([])},e[12]=n,e[13]=i,e[14]=r,e[15]=E):E=e[15];let T;e[16]!==n||e[17]!==c||e[18]!==E?(T=Ye(n,c,E),e[16]=n,e[17]=c,e[18]=E,e[19]=T):T=e[19];let S;e[20]!==n||e[21]!==i||e[22]!==r||e[23]!==c?(S=c?void 0:()=>{i(!n),r([])},e[20]=n,e[21]=i,e[22]=r,e[23]=c,e[24]=S):S=e[24];let C;e[25]!==T||e[26]!==S?(C=s.jsx(Ue,{title:"General",children:s.jsx(Be,{children:s.jsx(Ve,{title:"All organization permissions",description:"Grant full access to all features below",action:T,onClick:S})})}),e[25]=T,e[26]=S,e[27]=C):C=e[27],a=s.jsx("div",{children:s.jsxs("div",{className:"flex flex-col gap-10 py-4",children:[C,N.length===0&&f?s.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:["No permissions match “",h,"”"]}):N.map(v=>{const{section:_,capabilities:O}=v;return s.jsx(Ue,{title:_,children:s.jsx(Be,{children:O.map(p=>{const R=Bt(p,l,n);return s.jsx(Ve,{title:s.jsxs("span",{className:"flex items-center gap-1.5",children:[p.label,p.dangerous&&s.jsx(ft,{size:12,className:"text-amber-500 shrink-0"})]}),description:p.description,action:Ye(R,c,()=>o(p,R)),onClick:c?void 0:()=>o(p,R)},p.id)})})},_)})]})}),e[2]=n,e[3]=f,e[4]=i,e[5]=r,e[6]=c,e[7]=h,e[8]=l,e[9]=a}else a=e[9];return a}function Jt(t){return t.capabilities.length>0}function Wt(t){return t.tools}function es(t){return t.capabilities}const it={anthropic:"Anthropic",openrouter:"OpenRouter"},ts={openai:"OpenAI",anthropic:"Anthropic",google:"Google","meta-llama":"Meta",mistralai:"Mistral","x-ai":"xAI",deepseek:"DeepSeek",qwen:"Qwen",moonshotai:"MoonshotAI",nvidia:"NVIDIA",perplexity:"Perplexity",cohere:"Cohere",amazon:"Amazon",microsoft:"Microsoft","z-ai":"Z.ai","ibm-granite":"IBM Granite",alibaba:"Alibaba",baidu:"Baidu",bytedance:"ByteDance",tencent:"Tencent",minimax:"MiniMax",nousresearch:"Nous Research",allenai:"Allen AI",inception:"Inception"};function ss(t,e){const n=t.indexOf("/"),l=n>0?t.slice(0,n):e;return l.startsWith("~")?l.slice(1):l}function ns(t){return ts[t]??it[t]??t}function ls(t){const e=t.indexOf(": ");return e>0&&e<32?t.slice(e+2):t}const rt=30;function os(t){const e=q.c(44),{connectionId:n,subProviderId:l,subProviderName:i,groupLogo:r,models:d,allConnectionModelIds:h,selectedModels:c,allowAllModels:g,allConnectionModelsSelected:f,onToggleModel:a,onExitAllowAll:x,readOnly:o,defaultExpanded:m}=t,[N,E]=$.useState(m),T=m||N,S=E,[C,v]=$.useState(rt);let _;e[0]!==f||e[1]!==g||e[2]!==c?(_=j=>g||f||c.includes("*")||c.includes(j),e[0]=f,e[1]=g,e[2]=c,e[3]=_):_=e[3];const O=_;let p;if(e[4]!==O||e[5]!==d){let j;e[7]!==O?(j=u=>O(u.id),e[7]=O,e[8]=j):j=e[8],p=d.filter(j),e[4]=O,e[5]=d,e[6]=p}else p=e[6];const R=p.length;let I;if(e[9]!==h||e[10]!==g||e[11]!==n||e[12]!==R||e[13]!==T||e[14]!==r||e[15]!==O||e[16]!==d||e[17]!==x||e[18]!==a||e[19]!==o||e[20]!==l||e[21]!==i||e[22]!==C){const j=d.slice(0,C),u=d.length>C;let w;e[24]===Symbol.for("react.memo_cache_sentinel")?(w=()=>S(cs),e[24]=w):w=e[24];const A=r??tt[l]??st;let k;e[25]!==i||e[26]!==A?(k=s.jsx(ye,{icon:A,name:i,size:"sm"}),e[25]=i,e[26]=A,e[27]=k):k=e[27];let G;e[28]!==i?(G=s.jsx("span",{className:"text-sm font-medium truncate",children:i}),e[28]=i,e[29]=G):G=e[29];let U;e[30]!==k||e[31]!==G?(U=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[k,G]}),e[30]=k,e[31]=G,e[32]=U):U=e[32];let B;e[33]!==R||e[34]!==d.length?(B=s.jsxs(ge,{variant:"secondary",className:"text-xs text-muted-foreground",children:[R,"/",d.length," enabled"]}),e[33]=R,e[34]=d.length,e[35]=B):B=e[35];let M;e[36]!==T?(M=T?s.jsx(Lt,{size:16,className:"text-muted-foreground shrink-0"}):s.jsx(Pt,{size:16,className:"text-muted-foreground shrink-0"}),e[36]=T,e[37]=M):M=e[37];let z;e[38]!==M||e[39]!==B?(z=s.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[B,M]}),e[38]=M,e[39]=B,e[40]=z):z=e[40];let y;e[41]!==z||e[42]!==U?(y=s.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3 hover:bg-muted/50 cursor-pointer",onClick:w,children:[U,z]}),e[41]=z,e[42]=U,e[43]=y):y=e[43],I=s.jsxs("div",{className:"border border-border rounded-lg overflow-hidden bg-card",children:[y,T&&s.jsxs("div",{className:"border-t border-border bg-muted/20",children:[j.map(L=>{const Y=O(L.id),F=()=>{if(!o){if(g){x(n,h,L.id);return}a(n,L.id)}};return s.jsxs("div",{className:K("flex items-center justify-between gap-3 px-4 py-3 border-b border-border last:border-b-0",!o&&"hover:bg-muted/50 cursor-pointer"),onClick:F,children:[s.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:s.jsx("span",{className:"text-sm truncate",children:L.title})}),s.jsx("div",{onClick:as,children:o?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:Y,disabled:!0,onCheckedChange:rs})})}),s.jsx(Ee,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(xe,{checked:Y,onCheckedChange:F})})]},L.id)}),u&&s.jsxs("button",{type:"button",className:"w-full px-4 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors",onClick:()=>v(is),children:["Show more (",d.length-C," remaining)"]})]})]}),e[9]=h,e[10]=g,e[11]=n,e[12]=R,e[13]=T,e[14]=r,e[15]=O,e[16]=d,e[17]=x,e[18]=a,e[19]=o,e[20]=l,e[21]=i,e[22]=C,e[23]=I}else I=e[23];return I}function is(t){return t+rt}function rs(){}function as(t){return t.stopPropagation()}function cs(t){return!t}function ds(t){const e=q.c(33),{connection:n,selectedModels:l,allowAllModels:i,onToggleModel:r,onExitAllowAll:d,allConnectionModelsSelected:h,searchQuery:c,readOnly:g}=t,f=Mt(n.id);let a,x,o,m,N;if(e[0]!==h||e[1]!==i||e[2]!==n.id||e[3]!==n.label||e[4]!==n.providerId||e[5]!==d||e[6]!==r||e[7]!==f||e[8]!==g||e[9]!==c||e[10]!==l){N=Symbol.for("react.early_return_sentinel");e:{let S;e[16]!==n.label?(S=A=>({...A,id:A.modelId,provider:n.label}),e[16]=n.label,e[17]=S):S=e[17];const C=f.filter(hs).map(S),v=c.trim().toLowerCase(),_=v?C.filter(A=>A.title.toLowerCase().includes(v)||A.id.toLowerCase().includes(v)||A.provider?.toLowerCase().includes(v)):C;if(_.length===0){N=null;break e}const O=new Map;for(const A of _){const k=ss(A.id,n.providerId),G=O.get(k)??{models:[],logo:null};G.models.push({id:A.id,title:ls(A.title),logo:A.logo}),!G.logo&&A.logo&&(G.logo=A.logo),O.set(k,G)}const p=Array.from(O.entries()).map(fs).sort(us),R=p.length===1||v.length>0;o="flex flex-col gap-3";const I=tt[n.providerId]??st;let j;e[18]!==n.providerId||e[19]!==I?(j=s.jsx("img",{src:I,alt:n.providerId,className:"w-4 h-4 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),e[18]=n.providerId,e[19]=I,e[20]=j):j=e[20];const u=it[n.providerId]??n.providerId;let w;e[21]!==u?(w=s.jsx("h4",{className:"text-sm font-medium",children:u}),e[21]=u,e[22]=w):w=e[22],e[23]!==w||e[24]!==j?(m=s.jsxs("div",{className:"flex items-center gap-2",children:[j,w]}),e[23]=w,e[24]=j,e[25]=m):m=e[25],a="flex flex-col gap-3",x=p.map(A=>s.jsx(os,{connectionId:n.id,subProviderId:A.id,subProviderName:A.name,groupLogo:A.logo,models:A.models,allConnectionModelIds:C.map(ms),selectedModels:l,allowAllModels:i,allConnectionModelsSelected:h,onToggleModel:r,onExitAllowAll:d,readOnly:g,defaultExpanded:R},A.id))}e[0]=h,e[1]=i,e[2]=n.id,e[3]=n.label,e[4]=n.providerId,e[5]=d,e[6]=r,e[7]=f,e[8]=g,e[9]=c,e[10]=l,e[11]=a,e[12]=x,e[13]=o,e[14]=m,e[15]=N}else a=e[11],x=e[12],o=e[13],m=e[14],N=e[15];if(N!==Symbol.for("react.early_return_sentinel"))return N;let E;e[26]!==a||e[27]!==x?(E=s.jsx("div",{className:a,children:x}),e[26]=a,e[27]=x,e[28]=E):E=e[28];let T;return e[29]!==o||e[30]!==m||e[31]!==E?(T=s.jsxs("div",{className:o,children:[m,E]}),e[29]=o,e[30]=m,e[31]=E,e[32]=T):T=e[32],T}function ms(t){return t.id}function us(t,e){return t.name.localeCompare(e.name)}function fs(t){const[e,n]=t;return{id:e,name:ns(e),logo:n.logo,models:n.models}}function hs(t,e,n){return n.findIndex(l=>l.modelId===t.modelId)===e}function gs(t){const e=q.c(35),{allowAllModels:n,modelSet:l,onAllowAllChange:i,onModelSetChange:r,readOnly:d,searchQuery:h}=t,c=d===void 0?!1:d,g=$.useDeferredValue(h),f=wt();let a;e[0]!==l||e[1]!==r?(a=(p,R)=>{const I=l[p]??[],j={...l};if(I.includes(R)){const u=I.filter(w=>w!==R);u.length===0?delete j[p]:j[p]=u}else j[p]=[...I,R];r(j)},e[0]=l,e[1]=r,e[2]=a):a=e[2];const x=a;let o;e[3]!==l||e[4]!==i||e[5]!==r?(o=(p,R,I)=>{i(!1),r({...l,[p]:R.filter(j=>j!==I)})},e[3]=l,e[4]=i,e[5]=r,e[6]=o):o=e[6];const m=o,N=!c&&"hover:bg-muted/50 cursor-pointer";let E;e[7]!==N?(E=K("flex items-center justify-between px-4 py-3 rounded-lg border border-border bg-card",N),e[7]=N,e[8]=E):E=e[8];let T;e[9]!==n||e[10]!==i||e[11]!==r||e[12]!==c?(T=()=>{if(c)return;const p=!n;i(p),p&&r({})},e[9]=n,e[10]=i,e[11]=r,e[12]=c,e[13]=T):T=e[13];let S;e[14]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[14]=S):S=e[14];let C;e[15]!==n||e[16]!==i||e[17]!==r||e[18]!==c?(C=s.jsx("div",{onClick:ps,children:c?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:n,disabled:!0,onCheckedChange:xs})})}),s.jsx(Ee,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(xe,{checked:n,onCheckedChange:p=>{i(p),p&&r({})}})}),e[15]=n,e[16]=i,e[17]=r,e[18]=c,e[19]=C):C=e[19];let v;e[20]!==E||e[21]!==T||e[22]!==C?(v=s.jsxs("div",{className:E,onClick:T,children:[S,C]}),e[20]=E,e[21]=T,e[22]=C,e[23]=v):v=e[23];let _;e[24]!==f||e[25]!==n||e[26]!==g||e[27]!==m||e[28]!==l||e[29]!==c||e[30]!==x?(_=f.length===0?s.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No LLM connections configured"}):f.map(p=>s.jsx($.Suspense,{fallback:s.jsxs("div",{className:"px-4 py-3 flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(fe,{className:"size-4 animate-spin"}),"Loading models..."]}),children:s.jsx(ds,{connection:p,selectedModels:l[p.id]??[],allowAllModels:n,onToggleModel:x,onExitAllowAll:m,allConnectionModelsSelected:(l[p.id]??[]).includes("*"),searchQuery:g,readOnly:c})},p.id)),e[24]=f,e[25]=n,e[26]=g,e[27]=m,e[28]=l,e[29]=c,e[30]=x,e[31]=_):_=e[31];let O;return e[32]!==_||e[33]!==v?(O=s.jsxs("div",{className:"flex flex-col h-full overflow-auto gap-6 pb-6",children:[v,_]}),e[32]=_,e[33]=v,e[34]=O):O=e[34],O}function xs(){}function ps(t){return t.stopPropagation()}function bs(t){const e=q.c(52),{open:n,onOpenChange:l,selectedMemberIds:i,onAddMembers:r}=t,[d,h]=$.useState(""),c=$.useDeferredValue(d);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[0]=g):g=e[0];const[f,a]=$.useState(g),{data:x}=nt();let o,m,N,E,T,S,C,v,_,O,p;if(e[1]!==x?.data?.members||e[2]!==c||e[3]!==r||e[4]!==l||e[5]!==n||e[6]!==f||e[7]!==d||e[8]!==i){const U=x?.data?.members??[];let B;e[20]!==c?(B=y=>{const L=c.toLowerCase();return y.user?.name?.toLowerCase().includes(L)||y.user?.email?.toLowerCase().includes(L)},e[20]=c,e[21]=B):B=e[21];const M=U.filter(B);let z;e[22]!==r||e[23]!==l||e[24]!==f?(z=()=>{r(f),a([]),l(!1)},e[22]=r,e[23]=l,e[24]=f,e[25]=z):z=e[25],N=z,m=Qe,O=n,p=l,o=qe,v="sm:max-w-md p-0",e[26]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsxs(He,{className:"px-6 pt-6",children:[s.jsx(Ze,{children:"Add Members to Role"}),s.jsx(Xe,{children:"Select members to add to this role."})]}),e[26]=_):_=e[26],S="flex flex-col h-80",e[27]!==d?(C=s.jsx("div",{className:"border-b border-border px-4 py-3",children:s.jsx(ve,{value:d,onChange:h,placeholder:"Search members...",className:"w-full"})}),e[27]=d,e[28]=C):C=e[28],E="flex-1 overflow-auto",T=M.length===0?s.jsx("div",{className:"flex items-center justify-center h-full px-6",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:d?"No members found":"No members available"})}):s.jsx("div",{className:"px-6 py-2 space-y-1",children:M.map(y=>{const L=y.role!=="owner",Y=i.includes(y.id),F=f.includes(y.id);return s.jsxs("label",{className:K("flex items-center gap-3 p-2 rounded-lg",!L||Y?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(we,{checked:F||Y,onCheckedChange:()=>{!L||Y||a(X=>X.includes(y.id)?X.filter(J=>J!==y.id):[...X,y.id])},disabled:!L||Y}),s.jsx(lt,{url:y.user?.image??void 0,fallback:ot(y.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:y.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:y.user?.email})]}),!L&&s.jsx(ge,{variant:"secondary",className:"shrink-0",children:"Owner"}),Y&&L&&s.jsx(ge,{variant:"outline",className:"shrink-0",children:"Added"})]},y.id)})}),e[1]=x?.data?.members,e[2]=c,e[3]=r,e[4]=l,e[5]=n,e[6]=f,e[7]=d,e[8]=i,e[9]=o,e[10]=m,e[11]=N,e[12]=E,e[13]=T,e[14]=S,e[15]=C,e[16]=v,e[17]=_,e[18]=O,e[19]=p}else o=e[9],m=e[10],N=e[11],E=e[12],T=e[13],S=e[14],C=e[15],v=e[16],_=e[17],O=e[18],p=e[19];let R;e[29]!==E||e[30]!==T?(R=s.jsx("div",{className:E,children:T}),e[29]=E,e[30]=T,e[31]=R):R=e[31];let I;e[32]!==R||e[33]!==S||e[34]!==C?(I=s.jsxs("div",{className:S,children:[C,R]}),e[32]=R,e[33]=S,e[34]=C,e[35]=I):I=e[35];let j;e[36]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Je,{children:"Cancel"}),e[36]=j):j=e[36];const u=f.length===0,w=f.length>0&&`(${f.length})`;let A;e[37]!==N||e[38]!==u||e[39]!==w?(A=s.jsxs(We,{className:"px-6 pb-6",children:[j,s.jsxs(et,{onClick:N,disabled:u,children:["Add ",w]})]}),e[37]=N,e[38]=u,e[39]=w,e[40]=A):A=e[40];let k;e[41]!==o||e[42]!==I||e[43]!==A||e[44]!==v||e[45]!==_?(k=s.jsxs(o,{className:v,children:[_,I,A]}),e[41]=o,e[42]=I,e[43]=A,e[44]=v,e[45]=_,e[46]=k):k=e[46];let G;return e[47]!==m||e[48]!==k||e[49]!==O||e[50]!==p?(G=s.jsx(m,{open:O,onOpenChange:p,children:k}),e[47]=m,e[48]=k,e[49]=O,e[50]=p,e[51]=G):G=e[51],G}function Ts(t){const e=q.c(29),{memberIds:n,onMemberIdsChange:l,readOnly:i,readOnlyMessage:r,searchQuery:d,addMemberDialogOpen:h,onAddMemberDialogOpenChange:c}=t,g=i===void 0?!1:i,f=r===void 0?"Owner membership cannot be changed":r,a=$.useDeferredValue(d),{data:x}=nt();let o,m,N;if(e[0]!==x?.data?.members||e[1]!==a||e[2]!==n||e[3]!==l||e[4]!==g||e[5]!==f||e[6]!==d){const v=x?.data?.members??[];let _;e[10]!==n?(_=I=>n.includes(I.id),e[10]=n,e[11]=_):_=e[11];const O=v.filter(_);let p;e[12]!==a?(p=I=>{const j=a.toLowerCase();return I.user?.name?.toLowerCase().includes(j)||I.user?.email?.toLowerCase().includes(j)},e[12]=a,e[13]=p):p=e[13];const R=O.filter(p);N="flex flex-col h-full",o="flex-1 overflow-auto",m=O.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h3",{className:"text-base font-medium mb-1",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to grant them the configured permissions."})]})}):R.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',d,'"']})}):s.jsx("div",{className:"p-4 space-y-2",children:R.map(I=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(lt,{url:I.user?.image??void 0,fallback:ot(I.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:I.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:I.user?.email})]}),g?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:s.jsx(ne,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(ze,{size:16})})})}),s.jsx(Ee,{children:s.jsx("p",{children:f})})]})}):s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>l(n.filter(j=>j!==I.id)),children:s.jsx(ze,{size:16})})]},I.id))}),e[0]=x?.data?.members,e[1]=a,e[2]=n,e[3]=l,e[4]=g,e[5]=f,e[6]=d,e[7]=o,e[8]=m,e[9]=N}else o=e[7],m=e[8],N=e[9];let E;e[14]!==o||e[15]!==m?(E=s.jsx("div",{className:o,children:m}),e[14]=o,e[15]=m,e[16]=E):E=e[16];let T;e[17]!==n||e[18]!==l?(T=v=>l([...n,...v]),e[17]=n,e[18]=l,e[19]=T):T=e[19];let S;e[20]!==h||e[21]!==n||e[22]!==c||e[23]!==T?(S=s.jsx(bs,{open:h,onOpenChange:c,selectedMemberIds:n,onAddMembers:T}),e[20]=h,e[21]=n,e[22]=c,e[23]=T,e[24]=S):S=e[24];let C;return e[25]!==N||e[26]!==E||e[27]!==S?(C=s.jsxs("div",{className:N,children:[E,S]}),e[25]=N,e[26]=E,e[27]=S,e[28]=C):C=e[28],C}function Es(t){const e=q.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let l;return e[1]!==t?(l=s.jsx($.Suspense,{fallback:n,children:s.jsx(Ts,{...t})}),e[1]=t,e[2]=l):l=e[2],l}const _s={owner:[],admin:[],user:[]};function Is(t,e,n,l){const i=t==="owner"||t==="admin";return{role:{id:n?.id,slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:i,staticPermissions:_s[t],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:e.filter(r=>r.role===t).map(r=>r.id)}}function Ns(t,e,n){const l=t.permission||{},i=l.self||[],r=i.includes("*"),d=r?[]:i.filter(a=>a!=="*"),h={};for(const[a,x]of Object.entries(l))if(!(a==="self"||a==="models"))if(a==="*")for(const o of n)h[o.id]=x.includes("*")?o.tools?.map(m=>m.name)??[]:x;else{const o=n.find(m=>m.id===a);o&&(h[a]=x.includes("*")?o.tools?.map(m=>m.name)??[]:x)}const c=l.models||[],g=c.length===0||c.includes("*:*"),f={};if(!g)for(const a of c){const x=a.indexOf(":");if(x===-1)continue;const o=a.slice(0,x),m=a.slice(x+1);f[o]||(f[o]=[]),f[o].push(m)}return{role:{id:t.id,slug:t.role,label:t.label},allowAllStaticPermissions:r,staticPermissions:d,toolSet:h,allowAllModels:g,modelSet:f,memberIds:e.filter(a=>a.role===t.role).map(a=>a.id)}}function Ss(t,e){const n={};t.allowAllStaticPermissions?n.self=["*"]:t.staticPermissions.length>0&&(n.self=t.staticPermissions);for(const[l,i]of Object.entries(t.toolSet))if(i.length>0){const d=e.find(h=>h.id===l)?.tools?.map(h=>h.name)??[];n[l]=d.length>0&&d.every(h=>i.includes(h))?["*"]:i}if(t.allowAllModels)n.models=["*:*"];else{const l=[];for(const[i,r]of Object.entries(t.modelSet))for(const d of r)l.push(`${i}:${d}`);l.length>0&&(n.models=l)}return n}function Cs(t,e,n){return t.kind==="builtin"?Is(t.role,e,void 0):t.kind==="custom"?Ns(t.role,e,n):{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:[]}}function As(t){const e=q.c(6),{readOnly:n,readOnlyMessage:l,onOpen:i}=t,r=l===void 0?"Owner membership cannot be changed":l;if(n){let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:s.jsxs(ne,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(Ae,{size:16}),"Add Member"]})})}),e[0]=c):c=e[0];let g;return e[1]!==r?(g=s.jsx(pe,{children:s.jsxs(be,{children:[c,s.jsx(Ee,{children:s.jsx("p",{children:r})})]})}),e[1]=r,e[2]=g):g=e[2],g}let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Ae,{size:16}),e[3]=d):d=e[3];let h;return e[4]!==i?(h=s.jsxs(ne,{variant:"outline",size:"sm",onClick:i,children:[d,"Add Member"]}),e[4]=i,e[5]=h):h=e[5],h}function Os(t){const e=q.c(14),{locator:n}=Ne(),l=je(),i=yt();let r;e[0]!==n?(r=re.members(n),e[0]=n,e[1]=r):r=e[1];let d;e[2]!==l?(d=()=>l.organization.listMembers(),e[2]=l,e[3]=d):d=e[3];let h;e[4]!==r||e[5]!==d?(h={queryKey:r,queryFn:d},e[4]=r,e[5]=d,e[6]=h):h=e[6];const{data:c,isPending:g}=Oe(h);if(g||!i){let o;return e[7]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:32,className:"animate-spin text-muted-foreground"})})}),e[7]=o):o=e[7],o}let f;e[8]!==c?.data?.members?(f=c?.data?.members??[],e[8]=c?.data?.members,e[9]=f):f=e[9];const a=f;let x;return e[10]!==i||e[11]!==a||e[12]!==t?(x=s.jsx(Rs,{...t,members:a,connections:i}),e[10]=i,e[11]=a,e[12]=t,e[13]=x):x=e[13],x}function Rs({target:t,onBack:e,onSaved:n,members:l,connections:i}){const{locator:r}=Ne(),d=je(),h=$e(),c=t.kind==="builtin",g=t.kind==="builtin"&&t.role==="owner",f=t.kind==="new",[a,x]=$.useState(c?"org":"mcp"),o=mt({resolver:ut(Zt),defaultValues:Cs(t,l,i)}),m=o.formState.isValid,N=o.formState.isDirty,E=Fe({mutationFn:async u=>{const w=Ss(u,i),A=u.role.slug||u.role.label.toLowerCase().replace(/\s+/g,"-"),k=(u.role.slug==="owner"||u.role.slug==="admin"||u.role.slug==="user")&&!u.role.id,G=async(U,B)=>{const M=l.filter(L=>L.role===(B??U)).map(L=>L.id),z=u.memberIds.filter(L=>!M.includes(L)),y=M.filter(L=>!u.memberIds.includes(L));for(const L of z){const Y=await d.organization.updateMemberRole({memberId:L,role:[U]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}for(const L of y){const Y=await d.organization.updateMemberRole({memberId:L,role:["user"]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}};if(k)return await G(u.role.slug),u;if(u.role.id){const U=u.role.label.toLowerCase().replace(/\s+/g,"-"),B=u.role.slug,M=U!==B,z=await d.organization.updateRole({roleId:u.role.id,data:{permission:w,...M?{roleName:U}:{}}});if(z?.error)throw new Error(z.error.message??"Something went wrong");return await G(M?U:B,M?B:void 0),M?{...u,role:{...u.role,slug:U}}:u}else{const U=await d.organization.createRole({role:A,permission:w});if(U?.error)throw new Error(U.error.message??"Something went wrong");for(const B of u.memberIds){const M=await d.organization.updateMemberRole({memberId:B,role:[A]});if(M?.error)throw new Error(M.error.message)}return{...u,role:{...u.role,id:U.data?.roleData?.id,slug:A}}}},onSuccess:(u,w)=>{h.invalidateQueries({queryKey:re.members(r)}),h.invalidateQueries({queryKey:re.organizationRoles(r)});const A=!w.role.id&&!w.role.slug,k=w.role.slug==="owner"&&!w.role.id;Re(k?"role_members_updated":A?"role_created":"role_updated",{role_slug:w.role.slug??null}),he.success(k?"Members updated successfully!":A?"Role created successfully!":"Role updated successfully!"),o.reset(u),n(u.role.id)},onError:u=>{he.error(u instanceof Error?u.message:"Failed to save role")}}),T=o.handleSubmit(u=>{if(!u.role.label.trim()){he.error("Role name is required"),o.setFocus("role.label");return}E.mutate(u)}),S=!g,C=t.kind==="builtin"?t.role.charAt(0).toUpperCase()+t.role.slice(1):t.kind==="custom"?t.role.label:"",v=[...g?[]:[{id:"mcp",label:"MCP Permissions"}],{id:"org",label:"Organization Permissions"},{id:"models",label:"Models"},{id:"members",label:"Members"}],[_,O]=$.useState(""),[p,R]=$.useState(!1),I=u=>{x(u),O("")},j={mcp:"Search MCP servers...",org:"Search permissions...",models:"Search models...",members:"Search members..."};return s.jsx(te,{children:s.jsxs(te.Content,{className:K("flex flex-col",a!=="org"&&"overflow-hidden"),children:[s.jsx("div",{className:"shrink-0 mx-auto w-full max-w-[1200px] px-4 md:px-10 pt-8 md:pt-12 pb-4",children:s.jsxs("div",{className:"flex flex-col gap-5",children:[s.jsx(te.Title,{actions:S&&s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"outline",size:"sm",onClick:e,disabled:E.isPending,children:"Cancel"}),s.jsx(ne,{size:"sm",onClick:T,disabled:E.isPending||!m||!N,children:E.isPending?"Saving...":f?"Create Role":"Save Changes"})]}),children:s.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[s.jsx("div",{className:K("size-2.5 rounded-full shrink-0",t.kind==="builtin"?Ht(t.role):qt(o.watch("role.label")))}),g&&s.jsx(Ke,{size:16,className:"text-muted-foreground shrink-0"}),f||t.kind==="custom"?s.jsx("input",{...o.register("role.label"),placeholder:"Role name",className:"leading-tight text-foreground bg-transparent border-none outline-none px-1 -mx-1 rounded hover:bg-input/25 focus:bg-input/25 transition-colors w-64 placeholder:text-muted-foreground/50",autoFocus:f}):s.jsx("span",{className:"truncate",children:C})]})}),s.jsx("div",{className:"flex items-center gap-2",children:v.map(u=>s.jsx("button",{type:"button",onClick:()=>I(u.id),className:K("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex items-center",a===u.id?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:u.label},u.id))}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(ve,{value:_,onChange:O,placeholder:j[a]??"Search...",className:"w-full md:w-[375px]"}),a==="members"&&s.jsx(As,{readOnly:t.kind==="builtin"&&t.role==="owner",onOpen:()=>R(!0)})]})]})}),s.jsx("div",{className:K("mx-auto w-full max-w-[1200px] px-4 md:px-10 pb-6",a!=="org"&&"flex-1 min-h-0"),children:s.jsxs("div",{className:K(a!=="org"&&"h-full overflow-hidden",a!=="models"&&a!=="org"&&"border border-border rounded-xl bg-card"),children:[a==="mcp"&&!g&&s.jsx(Kt,{toolSet:o.watch("toolSet"),onToolSetChange:u=>o.setValue("toolSet",u,{shouldDirty:!0}),searchQuery:_}),a==="org"&&s.jsx(Xt,{allowAllStaticPermissions:o.watch("allowAllStaticPermissions"),staticPermissions:o.watch("staticPermissions"),onAllowAllChange:u=>o.setValue("allowAllStaticPermissions",u,{shouldDirty:!0}),onPermissionsChange:u=>o.setValue("staticPermissions",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),a==="models"&&s.jsx(gs,{allowAllModels:o.watch("allowAllModels"),modelSet:o.watch("modelSet"),onAllowAllChange:u=>o.setValue("allowAllModels",u,{shouldDirty:!0}),onModelSetChange:u=>o.setValue("modelSet",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),a==="members"&&s.jsx(Es,{memberIds:o.watch("memberIds"),onMemberIdsChange:u=>o.setValue("memberIds",u,{shouldDirty:!0}),readOnly:t.kind==="builtin"&&(t.role==="owner"||t.role==="user"),readOnlyMessage:t.kind==="builtin"&&t.role==="user"?"User is the default role — members can't be removed from it; assign another role to change their access":"Owner membership cannot be changed",searchQuery:_,addMemberDialogOpen:p,onAddMemberDialogOpenChange:R})]})})]})})}function js(t){return t.kind==="builtin"?`builtin-${t.role}`:t.kind==="custom"?`custom-${t.role.id}`:"new"}function vs(t){const e=q.c(6),{area:n,children:l}=t,{isPrivileged:i,loading:r,error:d}=Dt();let h;return e[0]!==n||e[1]!==l||e[2]!==d||e[3]!==i||e[4]!==r?(h=s.jsx(kt,{granted:i,loading:r,error:d,area:n,children:l}),e[0]=n,e[1]=l,e[2]=d,e[3]=i,e[4]=r,e[5]=h):h=e[5],h}const ys=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],Ce=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"];function ws(t){if(!t)return"bg-neutral-400";let e=0;for(let l=0;l<t.length;l++){const i=t.charCodeAt(l);e=(e<<5)-e+i,e=e&e}const n=Math.abs(e)%Ce.length;return Ce[n]??Ce[0]}const Ms={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Ls(t,e){return e?Ms[t]??"bg-neutral-400":ws(t)}function Ps(){const t=q.c(77),[e,n]=$.useState(""),[l,i]=$.useState(null),r=gt();let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d={strict:!1},t[0]=d):d=t[0];const{role:h}=xt(d),{locator:c}=Ne(),g=je(),f=$e(),{customRoles:a,refetch:x}=pt();let o;t[1]!==r?(o=P=>r({to:".",search:V=>({...V,role:P})}),t[1]=r,t[2]=o):o=t[2];const m=o;let N;e:{if(!h){N=null;break e}if(h==="new"){N={kind:"new"};break e}if(h.startsWith("builtin-")){N={kind:"builtin",role:h.slice(8)};break e}let P;t[3]!==h?(P=ae=>ae.id===h,t[3]=h,t[4]=P):P=t[4];const V=a.find(P);N=V?{kind:"custom",role:V}:null}const E=N;let T;t[5]!==c?(T=re.members(c),t[5]=c,t[6]=T):T=t[6];let S;t[7]!==g?(S=()=>g.organization.listMembers(),t[7]=g,t[8]=S):S=t[8];let C;t[9]!==T||t[10]!==S?(C={queryKey:T,queryFn:S},t[9]=T,t[10]=S,t[11]=C):C=t[11];const{data:v}=Oe(C);let _;t[12]!==v?.data?.members?(_=v?.data?.members??[],t[12]=v?.data?.members,t[13]=_):_=t[13];const O=_;let p;t[14]!==O?(p=P=>O.filter(V=>V.role===P).length,t[14]=O,t[15]=p):p=t[15];const R=p;let I;if(t[16]!==a||t[17]!==R||t[18]!==e){let P;t[20]!==R?(P=ce=>({kind:"builtin",role:{...ce,memberCount:R(ce.role)}}),t[20]=R,t[21]=P):P=t[21];const V=ys.map(P);let ae;t[22]!==R?(ae=ce=>({kind:"custom",role:{...ce,memberCount:R(ce.role)}}),t[22]=R,t[23]=ae):ae=t[23];const at=a.map(ae);if(I=[...V,...at],e){const ce=e.toLowerCase();I=I.filter(ct=>ct.role.label.toLowerCase().includes(ce))}t[16]=a,t[17]=R,t[18]=e,t[19]=I}else I=t[19];let j;t[24]!==g?(j=async P=>{const V=await g.organization.deleteRole({roleId:P});if(V?.error)throw new Error(V.error.message);return V?.data},t[24]=g,t[25]=j):j=t[25];const u=Fe({mutationFn:j,onSuccess:(P,V)=>{Re("role_deleted",{role_id:V}),f.invalidateQueries({queryKey:re.members(c)}),f.invalidateQueries({queryKey:re.organizationRoles(c)}),he.success("Role deleted successfully!"),x(),E?.kind==="custom"&&E.role.id===V&&m(void 0)},onError:zs});let w,A,k,G;t[26]===Symbol.for("react.memo_cache_sentinel")?(G={id:"role",header:"Role",render:Vs,cellClassName:"flex-1 min-w-0",sortable:!0},w={id:"type",header:"Type",render:Bs,cellClassName:"w-28 shrink-0"},A={id:"permissions",header:"Permissions",render:Us,cellClassName:"flex-1 min-w-0"},k={id:"members",header:"Members",render:Gs,cellClassName:"w-24 shrink-0"},t[26]=w,t[27]=A,t[28]=k,t[29]=G):(w=t[26],A=t[27],k=t[28],G=t[29]);let U;t[30]===Symbol.for("react.memo_cache_sentinel")?(U=[G,w,A,k,{id:"actions",header:"",render:P=>P.kind==="builtin"?null:s.jsxs(Tt,{children:[s.jsx(Et,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:ks,children:s.jsx(Nt,{size:16})})}),s.jsx(_t,{align:"end",onClick:Ds,children:s.jsxs(It,{variant:"destructive",onClick:()=>{const V=P.role;V.id&&i({id:V.id,label:V.label})},children:[s.jsx(St,{size:16}),"Delete"]})})]}),cellClassName:"w-12 shrink-0"}],t[30]=U):U=t[30];const B=U;let M;t[31]!==m?(M=P=>{if(P.kind==="builtin")m(`builtin-${P.role.role}`);else{const V=P.role;m(V.id)}},t[31]=m,t[32]=M):M=t[32];const z=M;if(E){let P;t[33]!==m?(P=()=>m(void 0),t[33]=m,t[34]=P):P=t[34];let V;return t[35]!==x||t[36]!==m?(V=()=>{x(),m(void 0)},t[35]=x,t[36]=m,t[37]=V):V=t[37],s.jsx(Os,{target:E,onBack:P,onSaved:V},js(E))}let y;t[38]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(te.Title,{children:"Roles"}),t[38]=y):y=t[38];let L;t[39]===Symbol.for("react.memo_cache_sentinel")?(L=P=>{P.key==="Escape"&&(n(""),P.target.blur())},t[39]=L):L=t[39];let Y;t[40]!==e?(Y=s.jsx(ve,{value:e,onChange:n,placeholder:"Search roles...",className:"w-full md:w-[375px]",onKeyDown:L}),t[40]=e,t[41]=Y):Y=t[41];let F;t[42]!==m?(F=()=>m("new"),t[42]=m,t[43]=F):F=t[43];let X;t[44]===Symbol.for("react.memo_cache_sentinel")?(X=s.jsx(Ae,{size:16}),t[44]=X):X=t[44];let J;t[45]!==F?(J=s.jsxs(ne,{onClick:F,children:[X,"Create Role"]}),t[45]=F,t[46]=J):J=t[46];let le;t[47]!==Y||t[48]!==J?(le=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[Y,J]}),t[47]=Y,t[48]=J,t[49]=le):le=t[49];let oe;t[50]!==e?(oe=e?s.jsx(Ge,{title:"No roles found",description:`No roles match "${e}"`}):s.jsx(Ge,{title:"No roles",description:"Create a role to get started."}),t[50]=e,t[51]=oe):oe=t[51];let ie;t[52]!==I||t[53]!==B||t[54]!==z||t[55]!==oe?(ie=s.jsx(bt,{columns:B,data:I,isLoading:!1,onRowClick:z,emptyState:oe}),t[52]=I,t[53]=B,t[54]=z,t[55]=oe,t[56]=ie):ie=t[56];let b;t[57]!==le||t[58]!==ie?(b=s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs("div",{className:"flex flex-col gap-6",children:[y,le,ie]})})}),t[57]=le,t[58]=ie,t[59]=b):b=t[59];const D=l!==null;let Q;t[60]===Symbol.for("react.memo_cache_sentinel")?(Q=P=>!P&&i(null),t[60]=Q):Q=t[60];let H;t[61]===Symbol.for("react.memo_cache_sentinel")?(H=s.jsx(Ze,{children:"Delete Role"}),t[61]=H):H=t[61];const W=l?.label;let Z;t[62]!==W?(Z=s.jsxs(He,{children:[H,s.jsxs(Xe,{children:['Are you sure you want to delete the "',W,'" role? This action cannot be undone.']})]}),t[62]=W,t[63]=Z):Z=t[63];let ee;t[64]===Symbol.for("react.memo_cache_sentinel")?(ee=s.jsx(Je,{children:"Cancel"}),t[64]=ee):ee=t[64];let de;t[65]!==u||t[66]!==l?(de=s.jsxs(We,{children:[ee,s.jsx(et,{onClick:()=>{l?.id&&u.mutate(l.id),i(null)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[65]=u,t[66]=l,t[67]=de):de=t[67];let me;t[68]!==Z||t[69]!==de?(me=s.jsxs(qe,{children:[Z,de]}),t[68]=Z,t[69]=de,t[70]=me):me=t[70];let ue;t[71]!==D||t[72]!==me?(ue=s.jsx(Qe,{open:D,onOpenChange:Q,children:me}),t[71]=D,t[72]=me,t[73]=ue):ue=t[73];let _e;return t[74]!==b||t[75]!==ue?(_e=s.jsxs(te,{children:[b,ue]}),t[74]=b,t[75]=ue,t[76]=_e):_e=t[76],_e}function Ds(t){return t.stopPropagation()}function ks(t){return t.stopPropagation()}function Gs(t){return s.jsx("span",{className:"text-sm text-foreground",children:t.role.memberCount})}function Us(t){if(t.kind==="builtin")return t.role.role==="owner"||t.role.role==="admin"?s.jsx("span",{className:"text-sm text-muted-foreground",children:"Full access"}):s.jsx("span",{className:"text-sm text-muted-foreground",children:"Basic access"});const e=t.role,n=[];return e.allowsAllStaticPermissions?n.push("Full org access"):e.staticPermissionCount&&e.staticPermissionCount>0&&n.push(`${e.staticPermissionCount} org perm${e.staticPermissionCount!==1?"s":""}`),e.allowsAllConnections?n.push("All connections"):e.connectionCount&&e.connectionCount>0&&n.push(`${e.connectionCount} connection${e.connectionCount!==1?"s":""}`),s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:n.length>0?n.join(", "):"No permissions"})}function Bs(t){return t.kind==="builtin"?s.jsx(ge,{variant:"secondary",className:"text-xs",children:"Built-in"}):s.jsx(ge,{variant:"outline",className:"text-xs",children:"Custom"})}function Vs(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:K("size-2.5 rounded-full shrink-0",Ls(t.role.role,t.kind==="builtin"))}),s.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:t.role.label}),t.kind==="builtin"&&s.jsx(Ke,{size:12,className:"text-muted-foreground shrink-0"})]})}function zs(t,e){Re("role_delete_failed",{role_id:e,error:t instanceof Error?t.message:String(t)}),he.error(t instanceof Error?t.message:"Failed to delete role")}function Ys(){const t=q.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load roles"})})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(ht,{fallback:e,children:s.jsx($.Suspense,{fallback:s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(Ps,{})})}),t[1]=n):n=t[1],n}function ml(){const t=q.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(vs,{area:"roles",children:s.jsx(Ys,{})}),t[0]=e):e=t[0],e}export{ml as default};
@@ -0,0 +1 @@
1
+ import{y as c}from"./preview-dialog-CRHdztnc.js";function t(r){return(e,a)=>{c(e),r(e,a)}}export{t as c};
@@ -1 +1 @@
1
- import{e as m,j as s,l as o}from"./index-BxrNS_jM.js";import{i as c}from"./AlertCircle-BmclRZ36.js";import{i as l}from"./ChevronUp-ssLglSfS.js";function u(i){const e=m.c(3),{isPending:a,isError:n}=i;if(n){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[s.jsx(c,{size:13}),"Couldn't save"]}),e[0]=t):t=e[0],t}if(a){let t;return e[1]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[s.jsx(o,{size:13,className:"animate-spin"}),"Saving…"]}),e[1]=t):t=e[1],t}let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground/70",children:[s.jsx(l,{size:13}),"Saved"]}),e[2]=r):r=e[2],r}export{u as S};
1
+ import{e as m,j as s,l as o}from"./index-C3gL9St4.js";import{i as c}from"./AlertCircle-DhaQx9Mx.js";import{i as l}from"./ChevronUp-BNOOOsT2.js";function u(i){const e=m.c(3),{isPending:a,isError:n}=i;if(n){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[s.jsx(c,{size:13}),"Couldn't save"]}),e[0]=t):t=e[0],t}if(a){let t;return e[1]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[s.jsx(o,{size:13,className:"animate-spin"}),"Saving…"]}),e[1]=t):t=e[1],t}let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground/70",children:[s.jsx(l,{size:13}),"Saved"]}),e[2]=r):r=e[2],r}export{u as S};
@@ -0,0 +1 @@
1
+ import{r as te,c as Se,j as s,e as Z,B as Re,n as Ae,m as Pt,K as Mt}from"./index-C3gL9St4.js";import{am as Ut,an as Vt,ao as Kt,ap as Ht,aq as Wt,ar as qt,ac as Yt,D as Gt,as as et,N as tt}from"./agent-icon-Cf9b4Ru9.js";import{C as Qt}from"./calendar-CKrH5d_Q.js";import{I as xe}from"./input-BvSXiwAq.js";import{L as me}from"./label-vllYe6cM.js";import{a as gt,b as xt,P as vt}from"./popover-sSylEgHu.js";import{T as Zt}from"./textarea-BVXgXW3B.js";import{b as Xt}from"./XCircle-CCiKaJ__.js";import{d as Jt}from"./SwitchHorizontal01-X5LMtCou.js";import{v as en,y as tn,z as nn}from"./scroll-area-Dbsv4e6O.js";import{S as rn}from"./switch-BH90tU73.js";import{a as bt,b as jt,c as Nt,S as St,d as kt}from"./select-gQvIO328.js";import{u as sn,a as nt,K as on,P as ln,D as an,c as cn,S as un,v as fn,e as dn,d as rt,b as pn,C as mn,s as hn}from"./sortable.esm-XdYFSg_0.js";import{c as Tt}from"./ZoomOut-DCv2Tq6d.js";import{s as yn}from"./Plus-J1K3Rh3s.js";import{s as Ct}from"./Trash01-Cib_Sg7t.js";import{a as gn,b as xn,c as vn,D as bn}from"./dropdown-menu-B4AhYSKY.js";import{i as Oe,Z as Pe,_ as st,n as We,l as qe,$ as wt,a0 as jn,a1 as Me,a2 as Ee,a3 as Nn,o as it,a4 as Sn,a5 as kn}from"./index-kcIuDE6u.js";import{e as At,u as Tn,m as Cn,L as wn,F as An,I as ot}from"./image-field-LMawai9Y.js";import{t as _t}from"./ChevronDown-6sFYQ_lK.js";import{i as It}from"./ChevronRight-BdMquS3m.js";import{i as _n}from"./Globe01-C7fVaUrg.js";import{T as In,b as Rn,a as On}from"./tooltip-D9KNvVvr.js";import{i as $n}from"./ChevronUp-BNOOOsT2.js";import{d as Fn}from"./Tool01-Dw4_QC3_.js";import{b as Ln,C as Dn,a as Bn,e as En,c as zn,d as Pn}from"./command-P8Wd0xDH.js";import{i as Mn}from"./Upload01-CJqoFPBG.js";import{c as Un}from"./use-file-configs-BBtTR4ju.js";function Ye(t){const e=t.__resolveType;if(typeof e!="string")return null;if(Oe(e)){const r=t.section?.__resolveType;return typeof r=="string"?r:e}return e}function Vn(t){return t.includes("flags/multivariate")}function Kn(t){return qe(t)}function Hn(t,e){const n=[...t],r=new Set(n.map(l=>l.resolveType)),i=(l,o)=>{!l||r.has(l)||(r.add(l),n.push({resolveType:l,title:o??Kn(l)}))};if(e.savedBlockKey&&i(e.savedBlockKey,e.savedBlockKey),e.editorValue&&typeof e.editorValue=="object"&&!Array.isArray(e.editorValue)){const l=Ye(e.editorValue);l?.includes("/")&&i(l)}return n}function Wn(t,e,n){const r=e[0]?.resolveType??"";if(n)return n;if(!t||typeof t!="object"||Array.isArray(t))return r;const i=t,l=i.__resolveType;if(typeof l=="string"){if(Pe(l)){const f=e.find(y=>y.resolveType===l);return f?f.resolveType:l}const u=e.find(f=>st(f.resolveType,l));if(u)return u.resolveType;const m=e.find(f=>f.resolveType===l);if(m)return m.resolveType;if(l.includes("/"))return l}const o=typeof i.type=="string"?i.type:void 0;if(o){const u=e.find(m=>m.discriminatorValue===o||m.resolveType===o||st(m.resolveType,o));if(u)return u.resolveType}let a=r,c=-1;for(const u of e){if(!u.schema?.properties)continue;const f=Object.keys(u.schema.properties).filter(y=>!y.startsWith("__")&&y!=="@type"&&y!=="action"&&y!=="alt").filter(y=>i[y]!==void 0).length;f>0&&f>c&&(c=f,a=u.resolveType)}return c>0,a}function lt(t,e,n){if(!t||typeof t!="object"||Array.isArray(t))return n??null;const r=Ye(t);if(!r)return n??null;if(!e)return r.includes("/")?null:n??null;const i=We(r,e);return i||(r.includes("/")?null:n??null)}function qn(t,e){if(!t?.properties||!e)return t??null;if(!(e in t.properties))return t;const n={...t.properties};return delete n[e],{...t,properties:n}}function Rt(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;if(typeof e.__resolveType!="string"||!Oe(e.__resolveType))return null;const n=e.section;return!n||typeof n!="object"||Array.isArray(n)?null:n}function Yn(t,e){if(e)return!0;if(!t||typeof t!="object"||Array.isArray(t))return!1;const n=t,r=Ye(n);return r&&Vn(r)?Array.isArray(n.variants)&&n.variants.length>0:Object.keys(n).some(i=>!i.startsWith("__")&&i!=="@type")}function Gn(t){if(t?.trim())try{const e=new URL(t);return e.protocol!=="https:"?void 0:e.href}catch{return}}function Qn(t){if(Array.isArray(t.variants)){const e=t.variants,n=e.find(i=>i.rule?.__resolveType?.includes("always"));if(typeof n?.value=="string")return n.value;const r=e.find(i=>typeof i.value=="string");if(r)return r.value}if(typeof t.src=="string")return t.src;if(typeof t.url=="string")return t.url;if(typeof t.value=="string")return t.value}function Ot(t){if(typeof t=="string"||t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(Ot);const e=t;return e.__resolveType?Qn(e)??t:$t(e)}function $t(t){const e={};for(const[n,r]of Object.entries(t))e[n]=Ot(r);return e}function Zn(t,e){return e.split(".").reduce((n,r)=>{if(!(n==null||typeof n!="object"))return n[r]},t)}function Ft(t){return t==null?"":Array.isArray(t)?t.map(Ft).filter(Boolean).join(","):typeof t=="object"?"":String(t)}function Ge(t,e){if(!t.includes("{"))return;const n=$t(e);return t.replace(/\{\{\{([^}]+)\}\}\}|\{\{([^}]+)\}\}/g,(i,l,o)=>{const a=(l??o??"").trim();return Ft(Zn(n,a))}).trim()||void 0}function Xn(t){return t.replace(/<[^>]*>/g,"").trim()}function Jn(t,e){if(e.includes("{"))return Ge(e,t);const n=t[e];if(typeof n=="string"&&n)return n;if(Array.isArray(n)){const r=n.map(i=>i==null?"":String(i)).filter(Boolean).join(",");if(r)return r}}function je(t,e,n){if(typeof t=="string")return t.trim()?t:`Item ${e+1}`;if(typeof t=="number"||typeof t=="boolean")return String(t);if(t&&typeof t=="object"&&!Array.isArray(t)){let r=t;const i=Rt(r);if(i&&(r=i),n?.titleBy){const o=Jn(r,n.titleBy);if(o)return o}for(const o of["name","label","title","alt","text","href","id","key"]){const a=r[o];if(typeof a=="string"&&a.trim()){const c=n?.properties?.[o]?.format;if(c==="rich-text"||c==="html"){const u=Xn(a);if(u)return u;continue}return a}if(Array.isArray(a)){const c=a.map(u=>u==null?"":String(u)).filter(Boolean).join(",");if(c)return c}}const l=r.__resolveType;if(typeof l=="string"&&l)return qe(l);if(n?.title){const o=Ge(n.title,r);if(o)return o;if(!n.title.includes("{"))return n.title}}return`Item ${e+1}`}function er(t){if(!t)return;if(typeof t.image=="string"&&t.image.includes("{"))return t.image;const e=t.properties?.image;if(!e)return;if(e.format==="image-uri")return"{{{image}}}";const n=e.properties;return n?.mobile?"{{{image.mobile}}}":n?.desktop?"{{{image.desktop}}}":"{{{image}}}"}function at(t,e){if(!t||typeof t!="object"||Array.isArray(t))return;const n=er(e);if(!n)return;const r=Ge(n,t);if(!r)return;const i=At(r)||r;return Gn(i)}function Lt(t){return t===wt||t===jn}function Ue(t,e){if(!Object.hasOwn(e,t))return null;const n=e[t]??{},r=n.__resolveType??t;return{data:{...n},resolveType:r}}function ze(t,e){const n=t.__resolveType??"";if(!n)return null;if(Oe(n)){const r=t.section??{};return Dt(r,e)}if(Lt(n)){const r=t.variants?.[0]?.value;return r?ze(r,e):null}return!Pe(n)||!Object.hasOwn(e,n)?{data:{...t},resolveType:n}:Ue(n,e)}function Dt(t,e){const n=t.__resolveType??"";if(!n)return null;if(Lt(n)){const r=t.variants?.[0]?.value;return r?ze(r,e):null}return!Pe(n)||!Object.hasOwn(e,n)?{data:{...t},resolveType:n}:Ue(n,e)}function tr(t,e){if(!t||typeof t!="object"||Array.isArray(t))return null;const r=t.__resolveType;if(typeof r!="string"||!Pe(r)||!Object.hasOwn(e,r))return null;const i=Ue(r,e);return i?{blockKey:r,...i}:null}function Fs(t,e,n){if(e.isMultivariate)return null;if(e.isSavedBlock){const r=e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType;return Ue(r,n)}if(e.isHidden){const l=(Oe(t.__resolveType)?t.section:t)?.variants?.[0]?.value??t;return ze(l,n)}if(e.isLazy||Oe(t.__resolveType)){const r=t.section??{};return Dt(r,n)}return ze(t,n)}const nr=new Set(["http:","https:","mailto:","tel:","ftp:"]);function rr(t){if(t.startsWith("/")||t.startsWith(".")||t.startsWith("#"))return!0;try{const e=new URL(t,"https://placeholder.invalid");return nr.has(e.protocol)}catch{return!1}}function ge(t){const e=Z.c(8),{active:n,label:r,onClick:i,children:l}=t,o=n?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let a;e[0]!==o?(a=Se("flex h-7 w-7 items-center justify-center rounded transition-colors cursor-pointer",o),e[0]=o,e[1]=a):a=e[1];let c;return e[2]!==n||e[3]!==l||e[4]!==r||e[5]!==i||e[6]!==a?(c=s.jsx("button",{type:"button","aria-label":r,"aria-pressed":n,onMouseDown:sr,onClick:i,className:a,children:l}),e[2]=n,e[3]=l,e[4]=r,e[5]=i,e[6]=a,e[7]=c):c=e[7],c}function sr(t){return t.preventDefault()}function ir({schema:t,value:e,onChange:n,path:r,label:i}){const l=typeof e=="string"?e:"",o=te.useRef(n);o.current=n;const a=en({extensions:[tn.configure({heading:{levels:[1,2,3]}})],content:l||"",editorProps:{attributes:{class:Se("prose prose-sm dark:prose-invert max-w-none focus:outline-none","min-h-[80px] px-3 py-2")}},onUpdate:({editor:c})=>{const u=c.getHTML();o.current(u==="<p></p>"?"":u)}});return a?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(me,{htmlFor:r,children:i}),t.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:t.description})]}),s.jsxs("div",{className:"overflow-hidden rounded-md border border-input",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 border-b border-border/60 bg-muted/30 px-1.5 py-1",children:[s.jsx(ge,{active:a.isActive("bold"),label:"Bold",onClick:()=>a.chain().focus().toggleBold().run(),children:s.jsx(Ut,{size:14})}),s.jsx(ge,{active:a.isActive("italic"),label:"Italic",onClick:()=>a.chain().focus().toggleItalic().run(),children:s.jsx(Vt,{size:14})}),s.jsx(ge,{active:a.isActive("underline"),label:"Underline",onClick:()=>a.chain().focus().toggleUnderline().run(),children:s.jsx(Kt,{size:14})}),s.jsx(ge,{active:a.isActive("strike"),label:"Strikethrough",onClick:()=>a.chain().focus().toggleStrike().run(),children:s.jsx(Ht,{size:14})}),s.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),s.jsx(ge,{active:a.isActive("heading",{level:1}),label:"Heading 1",onClick:()=>a.chain().focus().toggleHeading({level:1}).run(),children:s.jsx(Wt,{size:14})}),s.jsx(ge,{active:a.isActive("heading",{level:2}),label:"Heading 2",onClick:()=>a.chain().focus().toggleHeading({level:2}).run(),children:s.jsx(qt,{size:14})}),s.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),s.jsx(ge,{active:a.isActive("bulletList"),label:"Bullet list",onClick:()=>a.chain().focus().toggleBulletList().run(),children:s.jsx(Jt,{size:14})}),s.jsx(ge,{active:a.isActive("orderedList"),label:"Ordered list",onClick:()=>a.chain().focus().toggleOrderedList().run(),children:s.jsx("span",{className:"text-[11px] font-semibold leading-none",children:"1."})}),s.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),s.jsx(ge,{active:a.isActive("link"),label:"Link",onClick:()=>{const c=a.getAttributes("link").href,u=window.prompt("Link URL",c??"https://");u!==null&&(u===""?a.chain().focus().unsetLink().run():rr(u)&&a.chain().focus().setLink({href:u}).run())},children:s.jsx(Xt,{size:14})})]}),s.jsx(nn,{editor:a})]})]}):null}const Ce=t=>String(t).padStart(2,"0"),or="1900-01-01",lr="2099-12-31",ar="1900-01-01T00:00",cr="2099-12-31T23:59";function ur(t){if(!t)return"";const e=t.slice(0,10);if(/^\d{4}-\d{2}-\d{2}$/.test(e))return e;const n=new Date(t);return Number.isNaN(n.getTime())?"":`${n.getUTCFullYear()}-${Ce(n.getUTCMonth()+1)}-${Ce(n.getUTCDate())}`}function fr(t){return!t||!/^\d{4}-\d{2}-\d{2}$/.test(t)?"":`${t}T00:00:00.000Z`}function dr(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${Ce(e.getMonth()+1)}-${Ce(e.getDate())}T${Ce(e.getHours())}:${Ce(e.getMinutes())}`}function pr(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toISOString()}function mr(t){const e=Z.c(29),{id:n,withTime:r,value:i,onChange:l}=t,[o,a]=te.useState(!1);let c;e[0]!==i||e[1]!==r?(c=r?dr(i):ur(i),e[0]=i,e[1]=r,e[2]=c):c=e[2];const u=c;let m;e[3]!==l||e[4]!==r?(m=w=>{l(r?pr(w.target.value):fr(w.target.value))},e[3]=l,e[4]=r,e[5]=m):m=e[5];const f=m;let y;if(e[6]!==i){const w=i?new Date(i):null;y=w&&!Number.isNaN(w.getTime())?w:null,e[6]=i,e[7]=y}else y=e[7];const g=y;let b;e[8]!==l||e[9]!==g||e[10]!==r?(b=w=>{w&&(r&&g?w.setHours(g.getHours(),g.getMinutes(),0,0):w.setHours(0,0,0,0),l(w.toISOString()),a(!1))},e[8]=l,e[9]=g,e[10]=r,e[11]=b):b=e[11];const p=b,v=r?"datetime-local":"date",h=r?ar:or,d=r?cr:lr;let x;e[12]!==f||e[13]!==n||e[14]!==u||e[15]!==v||e[16]!==h||e[17]!==d?(x=s.jsx(xe,{id:n,type:v,min:h,max:d,value:u,onChange:f,className:"h-10 flex-1 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:opacity-0"}),e[12]=f,e[13]=n,e[14]=u,e[15]=v,e[16]=h,e[17]=d,e[18]=x):x=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(gt,{asChild:!0,children:s.jsx(Re,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0","aria-label":"Open calendar",children:s.jsx(Yt,{className:"h-4 w-4"})})}),e[19]=k):k=e[19];const S=g??void 0;let T;e[20]!==p||e[21]!==S?(T=s.jsx(xt,{className:"w-auto p-0",align:"end",children:s.jsx(Qt,{mode:"single",selected:S,onSelect:p,initialFocus:!0})}),e[20]=p,e[21]=S,e[22]=T):T=e[22];let N;e[23]!==o||e[24]!==T?(N=s.jsxs(vt,{open:o,onOpenChange:a,children:[k,T]}),e[23]=o,e[24]=T,e[25]=N):N=e[25];let C;return e[26]!==N||e[27]!==x?(C=s.jsxs("div",{className:"flex gap-1",children:[x,N]}),e[26]=N,e[27]=x,e[28]=C):C=e[28],C}function Fe(t){const e=Z.c(8),{htmlFor:n,label:r,description:i}=t;let l;e[0]!==n||e[1]!==r?(l=s.jsx(me,{htmlFor:n,children:r}),e[0]=n,e[1]=r,e[2]=l):l=e[2];let o;e[3]!==i?(o=i&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:i}),e[3]=i,e[4]=o):o=e[4];let a;return e[5]!==l||e[6]!==o?(a=s.jsxs("div",{className:"space-y-0.5",children:[l,o]}),e[5]=l,e[6]=o,e[7]=a):a=e[7],a}function Le(t){const e=Z.c(67),{schema:n,value:r,onChange:i,path:l,label:o}=t,a=typeof r=="string"?r:"",c=n.format;if(c==="rich-text"||c==="rich-text-inline"||c==="html"){let p;return e[0]!==o||e[1]!==i||e[2]!==l||e[3]!==n||e[4]!==r?(p=s.jsx(ir,{schema:n,value:r,onChange:i,path:l,label:o}),e[0]=o,e[1]=i,e[2]=l,e[3]=n,e[4]=r,e[5]=p):p=e[5],p}if(c==="textarea"||c==="markdown"){let p;e[6]!==o||e[7]!==l||e[8]!==n.description?(p=s.jsx(Fe,{htmlFor:l,label:o,description:n.description}),e[6]=o,e[7]=l,e[8]=n.description,e[9]=p):p=e[9];let v;e[10]!==i?(v=x=>i(x.target.value),e[10]=i,e[11]=v):v=e[11];let h;e[12]!==l||e[13]!==a||e[14]!==v?(h=s.jsx(Zt,{id:l,value:a,onChange:v,rows:4}),e[12]=l,e[13]=a,e[14]=v,e[15]=h):h=e[15];let d;return e[16]!==p||e[17]!==h?(d=s.jsxs("div",{className:"space-y-2",children:[p,h]}),e[16]=p,e[17]=h,e[18]=d):d=e[18],d}if(c==="date"||c==="date-time"){let p;e[19]!==o||e[20]!==l||e[21]!==n.description?(p=s.jsx(Fe,{htmlFor:l,label:o,description:n.description}),e[19]=o,e[20]=l,e[21]=n.description,e[22]=p):p=e[22];const v=c==="date-time";let h;e[23]!==i||e[24]!==l||e[25]!==a||e[26]!==v?(h=s.jsx(mr,{id:l,withTime:v,value:a,onChange:i}),e[23]=i,e[24]=l,e[25]=a,e[26]=v,e[27]=h):h=e[27];let d;return e[28]!==p||e[29]!==h?(d=s.jsxs("div",{className:"space-y-2",children:[p,h]}),e[28]=p,e[29]=h,e[30]=d):d=e[30],d}if(c==="color-input"){let p;e[31]!==o||e[32]!==l||e[33]!==n.description?(p=s.jsx(Fe,{htmlFor:l,label:o,description:n.description}),e[31]=o,e[32]=l,e[33]=n.description,e[34]=p):p=e[34];const v=a||"#000000";let h;e[35]!==i?(h=N=>i(N.target.value),e[35]=i,e[36]=h):h=e[36];let d;e[37]!==v||e[38]!==h?(d=s.jsx("input",{type:"color",value:v,onChange:h,className:"h-10 w-10 cursor-pointer rounded-lg border border-border bg-background p-1"}),e[37]=v,e[38]=h,e[39]=d):d=e[39];let x;e[40]!==i?(x=N=>i(N.target.value),e[40]=i,e[41]=x):x=e[41];let k;e[42]!==l||e[43]!==a||e[44]!==x?(k=s.jsx(xe,{id:l,value:a,onChange:x,placeholder:"#000000",className:"h-10 flex-1"}),e[42]=l,e[43]=a,e[44]=x,e[45]=k):k=e[45];let S;e[46]!==d||e[47]!==k?(S=s.jsxs("div",{className:"flex items-center gap-2",children:[d,k]}),e[46]=d,e[47]=k,e[48]=S):S=e[48];let T;return e[49]!==p||e[50]!==S?(T=s.jsxs("div",{className:"space-y-2",children:[p,S]}),e[49]=p,e[50]=S,e[51]=T):T=e[51],T}let u;e[52]!==o||e[53]!==l||e[54]!==n.description?(u=s.jsx(Fe,{htmlFor:l,label:o,description:n.description}),e[52]=o,e[53]=l,e[54]=n.description,e[55]=u):u=e[55];const m=c==="url"?"url":"text";let f;e[56]!==i?(f=p=>i(p.target.value),e[56]=i,e[57]=f):f=e[57];const y=n.default!=null?String(n.default):void 0;let g;e[58]!==l||e[59]!==a||e[60]!==m||e[61]!==f||e[62]!==y?(g=s.jsx(xe,{id:l,type:m,value:a,onChange:f,placeholder:y,className:"h-10"}),e[58]=l,e[59]=a,e[60]=m,e[61]=f,e[62]=y,e[63]=g):g=e[63];let b;return e[64]!==u||e[65]!==g?(b=s.jsxs("div",{className:"space-y-2",children:[u,g]}),e[64]=u,e[65]=g,e[66]=b):b=e[66],b}function hr(t){const e=Z.c(17),{schema:n,value:r,onChange:i,path:l,label:o}=t,a=typeof r=="number"?r:"";let c;e[0]!==o||e[1]!==l?(c=s.jsx(me,{htmlFor:l,children:o}),e[0]=o,e[1]=l,e[2]=c):c=e[2];let u;e[3]!==n.description?(u=n.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[3]=n.description,e[4]=u):u=e[4];let m;e[5]!==c||e[6]!==u?(m=s.jsxs("div",{className:"space-y-0.5",children:[c,u]}),e[5]=c,e[6]=u,e[7]=m):m=e[7];let f;e[8]!==i?(f=b=>{const p=b.target.value;i(p===""?void 0:Number(p))},e[8]=i,e[9]=f):f=e[9];let y;e[10]!==a||e[11]!==l||e[12]!==f?(y=s.jsx(xe,{id:l,type:"number",value:a,onChange:f,className:"h-10"}),e[10]=a,e[11]=l,e[12]=f,e[13]=y):y=e[13];let g;return e[14]!==m||e[15]!==y?(g=s.jsxs("div",{className:"space-y-2",children:[m,y]}),e[14]=m,e[15]=y,e[16]=g):g=e[16],g}function yr(t){const e=Z.c(17),{value:n,onChange:r,path:i,label:l,schema:o}=t,a=typeof n=="boolean"?n:!1;let c;e[0]!==l||e[1]!==i?(c=s.jsx(me,{htmlFor:i,children:l}),e[0]=l,e[1]=i,e[2]=c):c=e[2];let u;e[3]!==o.description?(u=o.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:o.description}),e[3]=o.description,e[4]=u):u=e[4];let m;e[5]!==c||e[6]!==u?(m=s.jsxs("div",{className:"space-y-0.5",children:[c,u]}),e[5]=c,e[6]=u,e[7]=m):m=e[7];let f;e[8]!==r?(f=b=>r(b),e[8]=r,e[9]=f):f=e[9];let y;e[10]!==a||e[11]!==i||e[12]!==f?(y=s.jsx(rn,{id:i,checked:a,onCheckedChange:f}),e[10]=a,e[11]=i,e[12]=f,e[13]=y):y=e[13];let g;return e[14]!==m||e[15]!==y?(g=s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[m,y]}),e[14]=m,e[15]=y,e[16]=g):g=e[16],g}const Qe="__enum_empty__";function Ze(t){return t===""?Qe:String(t)}function gr(t,e){if(t===Qe)return"";const n=e.find(r=>Ze(r)===t);return n!==void 0?n:t}function xr(t,e){return t==null?e.some(n=>n==="")?Qe:void 0:Ze(t)}function vr(t){return t===""?"":String(t)}function br(t){const e=Z.c(28),{schema:n,value:r,onChange:i,path:l,label:o}=t;let a;e[0]!==n.enum?(a=n.enum??[],e[0]=n.enum,e[1]=a):a=e[1];const c=a;let u;e[2]!==c||e[3]!==r?(u=xr(r,c),e[2]=c,e[3]=r,e[4]=u):u=e[4];const m=u;let f;e[5]!==o||e[6]!==l?(f=s.jsx(me,{htmlFor:l,children:o}),e[5]=o,e[6]=l,e[7]=f):f=e[7];let y;e[8]!==n.description?(y=n.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[8]=n.description,e[9]=y):y=e[9];let g;e[10]!==f||e[11]!==y?(g=s.jsxs("div",{className:"space-y-0.5",children:[f,y]}),e[10]=f,e[11]=y,e[12]=g):g=e[12];let b;e[13]!==i||e[14]!==c?(b=k=>i(gr(k,c)),e[13]=i,e[14]=c,e[15]=b):b=e[15];let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(jt,{className:"h-10",children:s.jsx(Nt,{placeholder:"Select..."})}),e[16]=p):p=e[16];let v;e[17]!==c?(v=c.map(jr),e[17]=c,e[18]=v):v=e[18];let h;e[19]!==v?(h=s.jsx(St,{children:v}),e[19]=v,e[20]=h):h=e[20];let d;e[21]!==m||e[22]!==b||e[23]!==h?(d=s.jsxs(kt,{value:m,onValueChange:b,children:[p,h]}),e[21]=m,e[22]=b,e[23]=h,e[24]=d):d=e[24];let x;return e[25]!==d||e[26]!==g?(x=s.jsxs("div",{className:"space-y-2",children:[g,d]}),e[25]=d,e[26]=g,e[27]=x):x=e[27],x}function jr(t){const e=Ze(t);return s.jsx(bt,{value:e,children:vr(t)},e)}function Bt(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase())}function Ne(t){return t.normalize("NFC").trim()}function ee(t,e){return Ne(t)===Ne(e)}function ct(t,e){return Ne(t).replace(/\s+/g,"").toLowerCase()===Ne(e).replace(/\s+/g,"").toLowerCase()}function De(t,e,n){const r=Ne(n);if(t.some(o=>ee(o,r)||ee(o,n)))return t;const i=[...t];return i.some(o=>ee(o,e))||i.push(e),i.push(n),i}function Nr(t,e,n){if(n.length===0)return n;const r=_e(t,e),i=n[0];return ee(i,r)||ee(i,t)?n.slice(1):n}function _e(t,e){return e.title??Bt(t)}function Ls(t,e){return e<=0?[]:t.slice(0,e)}function Ve(t,e){const n=Ne(e);return t.findIndex(r=>Ne(r)===n)}function ut(t,e){return t.type==="array"&&t.items||Me(t)?!0:Array.isArray(e)}function Sr(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)?t:{}}function $e(t,e,n,r){if(r.length===0)return null;const i=r[0];for(const o of t){const a=e[o];if(!a||!ut(a,n[o]))continue;const c=_e(o,a);if(ee(i,c)||ee(i,o)||r.some(u=>ee(u,c)||ee(u,o)))return o}for(const o of t){const a=e[o];if(!a||!ut(a,n[o]))continue;const c=n[o];if(!Array.isArray(c))continue;const u=a.items;for(let m=0;m<c.length;m++){const f=je(c[m],m,u);if(ee(f,i))return o}}for(const o of t){const a=e[o];if(a?.type!=="object"||!a.properties)continue;const c=Object.keys(a.properties),u=Sr(n[o]),m=_e(o,a);if($e(c,a.properties,u,r)||(ee(i,m)||ee(i,o))&&$e(c,a.properties,u,r.slice(1)))return o}let l=null;for(const o of t){const a=e[o];if(a?.type!=="block-ref")continue;const c=_e(o,a);if(!(i!==c&&i!==o)){if(r.length>1){const u=n[o];if(u&&typeof u=="object"&&!Array.isArray(u)){const m=r[1];if(Object.keys(u).some(y=>!y.startsWith("__")&&(ct(Bt(y),m)||ct(y,m))))return o}}l||(l=o)}}return l||null}function kr(t,e,n,r){return $e(t,e,n,r)}function Tr(t,e,n,r,i){if(i.length===0||!n.properties)return!1;const l=Object.keys(n.properties);if($e(l,n.properties,r,i))return!0;const o=i[0];return!ee(o,e)&&!ee(o,t)?!1:i.length>1||$e(l,n.properties,r,i.slice(1))!==null}function Cr(t,e,n,r){if(e.length===0)return null;for(let l=0;l<e.length;l++){const o=e[l],a=n.findIndex((c,u)=>ee(je(c,u,r),o));if(a>=0)return{index:a,innerPath:e.slice(l+1)}}const i=e.findIndex(l=>ee(l,t));if(i>=0&&e.length>i+1){const l=e[i+1],o=n.findIndex((a,c)=>ee(je(a,c,r),l));if(o>=0)return{index:o,innerPath:e.slice(i+2)}}return null}function Ke(t){return t.includes("/sections/")||t.includes("multivariate/section")||t===wt}function wr(t){if(t.type==="block-ref"&&t.anyOfRefs?.length)return t.anyOfRefs.some(n=>Ke(n.resolveType));if(t.anyOfRefs?.length)return t.anyOfRefs.some(n=>Ke(n.resolveType));const e=t.properties?.__resolveType;return e?.type==="block-ref"&&e.anyOfRefs?.length?e.anyOfRefs.some(n=>Ke(n.resolveType)):!1}function Ar(t,e){if(e==="global"||e==="sections"||Me(t))return!0;const n=t.type==="array"?t.items:void 0;return n?wr(n):!1}function ft(t){return Array.from({length:t},(e,n)=>({id:crypto.randomUUID(),index:n}))}function _r(t,e,n,r,i){if(e?.type==="object"&&e.properties&&Object.keys(e.properties).length>0||e?.type==="block-ref"&&e.anyOfRefs?.length)return e;if(t!=null&&typeof t=="object"&&!Array.isArray(t)){const l=t.__resolveType;if(typeof l=="string"&&n){const o=We(l,n);if(o?.properties&&Object.keys(o.properties).length>0)return o}}if(n&&r&&i){const o=We(r,n)?.properties?.[i]?.items;if(o?.properties&&Object.keys(o.properties).length>0)return{...o,titleBy:o.titleBy??e?.titleBy}}return e}function Ir(t){const e=t.split(".").filter(n=>!/^\d+$/.test(n));return e[e.length-1]??t}function Et(t){return t.map((e,n)=>({...e,index:n}))}function Rr(t,e){if(e===t.length)return t;if(e<t.length)return Et(t.slice(0,e));const n=Array.from({length:e-t.length},(r,i)=>({id:crypto.randomUUID(),index:t.length+i}));return[...t,...n]}function Or(t){const e=Z.c(8),{labelText:n,imageSrc:r}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Tt,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[0]=i):i=e[0];let l;e[1]!==r?(l=r&&s.jsx("img",{src:r,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[1]=r,e[2]=l):l=e[2];let o;e[3]!==n?(o=s.jsx("span",{className:"min-w-0 truncate",children:n}),e[3]=n,e[4]=o):o=e[4];let a;return e[5]!==l||e[6]!==o?(a=s.jsxs(s.Fragment,{children:[i,s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2.5 text-sm",children:[l,o]})]}),e[5]=l,e[6]=o,e[7]=a):a=e[7],a}function $r(t){const e=Z.c(37),{sortableId:n,labelText:r,imageSrc:i,onOpen:l,onRemove:o}=t;let a;e[0]!==n?(a={id:n,animateLayoutChanges:Dr},e[0]=n,e[1]=a):a=e[1];const{attributes:c,listeners:u,setNodeRef:m,transform:f,isDragging:y}=pn(a);let g;e[2]!==f?(g=mn.Transform.toString(f?{...f,x:0}:null),e[2]=f,e[3]=g):g=e[3];const b=y?0:void 0;let p;e[4]!==g||e[5]!==b?(p={transform:g,opacity:b},e[4]=g,e[5]=b,e[6]=p):p=e[6];const v=p;let h;e[7]!==l?(h=B=>{(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),l())},e[7]=l,e[8]=h):h=e[8];const d=y?"cursor-grabbing":"cursor-pointer";let x;e[9]!==d?(x=Se("group flex min-w-0 items-center gap-2.5 rounded-lg px-2 py-2.5 hover:bg-accent hover:text-accent-foreground touch-none",d),e[9]=d,e[10]=x):x=e[10];let k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(Tt,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[11]=k):k=e[11];let S;e[12]!==i?(S=i&&s.jsx("img",{src:i,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[12]=i,e[13]=S):S=e[13];let T;e[14]!==r?(T=s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:r}),e[14]=r,e[15]=T):T=e[15];const N=`Open actions for ${r}`;let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(Gt,{size:14}),e[16]=C):C=e[16];let w;e[17]!==N?(w=s.jsx(gn,{asChild:!0,children:s.jsx(Re,{type:"button",variant:"ghost",size:"icon","aria-label":N,className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100",onClick:Lr,onPointerDown:Fr,children:C})}),e[17]=N,e[18]=w):w=e[18];let _;e[19]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx(Ct,{size:14}),e[19]=_):_=e[19];let j;e[20]!==o?(j=s.jsx(xn,{align:"end",children:s.jsxs(vn,{className:"text-destructive focus:text-destructive",onClick:o,children:[_,"Delete"]})}),e[20]=o,e[21]=j):j=e[21];let I;e[22]!==w||e[23]!==j?(I=s.jsxs(bn,{children:[w,j]}),e[22]=w,e[23]=j,e[24]=I):I=e[24];let R;return e[25]!==c||e[26]!==r||e[27]!==u||e[28]!==l||e[29]!==m||e[30]!==v||e[31]!==T||e[32]!==I||e[33]!==h||e[34]!==x||e[35]!==S?(R=s.jsxs("div",{ref:m,style:v,...c,...u,role:"button",tabIndex:0,onClick:l,onKeyDown:h,className:x,title:r,children:[k,S,T,I]}),e[25]=c,e[26]=r,e[27]=u,e[28]=l,e[29]=m,e[30]=v,e[31]=T,e[32]=I,e[33]=h,e[34]=x,e[35]=S,e[36]=R):R=e[36],R}function Fr(t){return t.stopPropagation()}function Lr(t){return t.stopPropagation()}function Dr(){return!1}function Be(t){const e=Z.c(24),{schema:n,value:r,onChange:i,path:l,label:o,breadcrumbPath:a,onBreadcrumbChange:c,meta:u,decofile:m,onSaveReferencedBlock:f,containerResolveType:y,previewBaseUrl:g,onAddSectionItem:b,onRequestAddSection:p,sandbox:v}=t,h=a===void 0?[]:a,d=Array.isArray(r)?r:[],x=n.items,k=Ir(l),S=Ar(n,k),T=Cr(o,h,d,x),N=T?.index??null,[C,w]=te.useState(()=>ft(d.length)),[_,j]=te.useState(null),[I,R]=te.useState(l),[B,P]=te.useState(d.length),M=te.useRef(!1);I!==l?(R(l),P(d.length),w(ft(d.length))):B!==d.length&&(P(d.length),w(A=>Rr(A,d.length)));let E;e[0]!==x?(E=(A,D)=>je(A,D,x),e[0]=x,e[1]=E):E=e[1];const O=E,ne=A=>{if(M.current)return;const D=O(d[A],A);c?.(De(h,o,D))},re=A=>{const D=[...d,A];i(D);const Q=D.length-1,H=je(A,Q,x);c?.(De(h,o,H))},X=()=>{const A=x?.type,D=x?.default!==void 0?x.default:A==="object"?{}:A==="block-ref"?(()=>{const pe=x?.anyOfRefs?.[0]?.resolveType;return typeof pe!="string"||Ee(pe)?{}:{__resolveType:pe}})():A==="number"||A==="integer"?0:A==="boolean"?!1:A==="array"?[]:"",Q=[...d,D];i(Q);const H=Q.length-1,de=je(D,H,x);c?.(De(h,o,de))},U=()=>{if(S){if(!g){Ae.error("Start the preview dev server to add sections.");return}if(p){p({append:re});return}Ae.error("Section picker is not available in this editor.");return}X()},W=A=>{if(i(d.filter((D,Q)=>Q!==A)),N===A){const D=O(d[A],A),Q=Ve(h,D);c?.(Q>=0?h.slice(0,Q):[])}},Y=(A,D)=>{const Q=[...d];if(Q[A]=D,i(Q),A===N&&N!==null){const H=O(d[A],A),de=je(D,A,x);if(H!==de){const pe=Ve(h,H);if(pe>=0){const Je=[...h];Je[pe]=de,c?.(Je)}}}};let $;e[2]===Symbol.for("react.memo_cache_sentinel")?($={activationConstraint:{distance:8}},e[2]=$):$=e[2];let V;e[3]===Symbol.for("react.memo_cache_sentinel")?(V={coordinateGetter:hn},e[3]=V):V=e[3];const se=sn(nt(ln,$),nt(on,V)),F=C.map(Br);let L;e[4]===Symbol.for("react.memo_cache_sentinel")?(L=A=>{j(String(A.active.id))},e[4]=L):L=e[4];const G=L,le=A=>{j(null);const{active:D,over:Q}=A;if(!Q||D.id===Q.id)return;const H=F.indexOf(String(D.id)),de=F.indexOf(String(Q.id));H===-1||de===-1||(w(pe=>Et(rt([...pe],H,de))),i(rt([...d],H,de)),M.current=!0,requestAnimationFrame(()=>{M.current=!1}))};let J;e[5]===Symbol.for("react.memo_cache_sentinel")?(J=()=>{j(null)},e[5]=J):J=e[5];const he=J,ce=_?C.find(A=>A.id===_):null,ie=ce!=null?d[ce.index]:void 0,ye=ce!=null&&ie!==void 0?O(ie,ce.index):null,ae=ce!=null&&ie!==void 0?at(ie,x):void 0;if(N!==null&&N<d.length){const A=d[N],D=_r(A,x,u,y,k),Q=()=>{const H=O(A,N),de=De(h,o,H),pe=Ve(de,H);return pe>=0?de.slice(0,pe+1):de};return s.jsx("div",{className:"min-w-0",children:D?.type==="object"&&D.properties?s.jsx(Xe,{schema:D,value:A,onChange:H=>Y(N,H),basePath:`${l}.${N}`,breadcrumbPath:T?.innerPath??[],onBreadcrumbChange:H=>{c?.([...Q(),...H])},meta:u,decofile:m,onSaveReferencedBlock:f,previewBaseUrl:g,onAddSectionItem:b,onRequestAddSection:p,sandbox:v}):D?zt({schema:D,value:A,onChange:H=>Y(N,H),path:`${l}.${N}`,label:D.title??`Item ${N+1}`,breadcrumbPath:T?.innerPath??[],onBreadcrumbChange:H=>{c?.([...Q(),...H])},meta:u,decofile:m,onSaveReferencedBlock:f,previewBaseUrl:g,onAddSectionItem:b,onRequestAddSection:p,sandbox:v}):null})}const K="space-y-2";let q;e[6]!==o?(q=s.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:o}),e[6]=o,e[7]=q):q=e[7];const z=d.length>0&&s.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:d.length});let oe;e[8]!==q||e[9]!==z?(oe=s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[q,z]}),e[8]=q,e[9]=z,e[10]=oe):oe=e[10];let ue;e[11]!==n.description?(ue=n.description&&s.jsx("p",{className:"break-words text-xs leading-normal text-muted-foreground",children:n.description}),e[11]=n.description,e[12]=ue):ue=e[12];let ve;e[13]!==oe||e[14]!==ue?(ve=s.jsxs("div",{className:"min-w-0 space-y-0.5",children:[oe,ue]}),e[13]=oe,e[14]=ue,e[15]=ve):ve=e[15];const we=d.length>0&&s.jsx("div",{className:Se(_&&"cursor-grabbing"),children:s.jsxs(an,{sensors:se,collisionDetection:cn,onDragStart:G,onDragEnd:le,onDragCancel:he,children:[s.jsx(un,{items:F,strategy:fn,children:s.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border/50 p-1.5",children:C.map(A=>{const D=d[A.index];if(D===void 0)return null;const Q=O(D,A.index),H=at(D,x);return s.jsx($r,{sortableId:A.id,labelText:Q,imageSrc:H,onOpen:()=>ne(A.index),onRemove:()=>W(A.index)},A.id)})})}),s.jsx(dn,{dropAnimation:null,children:ye?s.jsx("div",{className:"flex min-w-0 items-center gap-2.5 rounded-lg border border-border/60 bg-background px-2 py-2.5 shadow-lg ring-1 ring-border/60",children:s.jsx(Or,{labelText:ye,imageSrc:ae})}):null})]})});let ke;e[16]===Symbol.for("react.memo_cache_sentinel")?(ke=s.jsx(yn,{size:14}),e[16]=ke):ke=e[16];const be=S?"Add section":"Add item";let fe;e[17]!==U||e[18]!==be?(fe=s.jsxs("button",{type:"button",onClick:U,className:"flex w-full items-center justify-center gap-1.5 rounded-xl border border-dashed border-border/60 py-2.5 text-sm text-muted-foreground transition-colors hover:border-border hover:bg-muted/30",children:[ke,be]}),e[17]=U,e[18]=be,e[19]=fe):fe=e[19];let Te;return e[20]!==ve||e[21]!==we||e[22]!==fe?(Te=s.jsxs("div",{className:K,children:[ve,we,fe]}),e[20]=ve,e[21]=we,e[22]=fe,e[23]=Te):Te=e[23],Te}function Br(t){return t.id}function Er(t){const e=Z.c(44),{schema:n,value:r,onChange:i,path:l,label:o,breadcrumbPath:a,onBreadcrumbChange:c,meta:u,decofile:m,onSaveReferencedBlock:f,previewBaseUrl:y,onAddSectionItem:g,onRequestAddSection:b,sandbox:p}=t;let v;e[0]!==a?(v=a===void 0?[]:a,e[0]=a,e[1]=v):v=e[1];const h=v,[d,x]=te.useState(!1);let k;e[2]!==r?(k=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},e[2]=r,e[3]=k):k=e[3];const S=k;if(!n.properties)return null;let T;e[4]!==l?(T=l.split(".").pop()??l,e[4]=l,e[5]=T):T=e[5];const N=T;let C;e[6]!==h||e[7]!==N||e[8]!==o||e[9]!==S||e[10]!==n?(C=Tr(N,o,n,S,h),e[6]=h,e[7]=N,e[8]=o,e[9]=S,e[10]=n,e[11]=C):C=e[11];const _=d||C,j=`${l}-fields`;let I;e[12]===Symbol.for("react.memo_cache_sentinel")?(I=()=>x(zr),e[12]=I):I=e[12];let R;e[13]!==_?(R=s.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors group-hover:text-accent-foreground",children:_?s.jsx(_t,{size:16}):s.jsx(It,{size:16})}),e[13]=_,e[14]=R):R=e[14];let B;e[15]!==o?(B=s.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:o}),e[15]=o,e[16]=B):B=e[16];let P;e[17]!==j||e[18]!==_||e[19]!==R||e[20]!==B?(P=s.jsxs("button",{type:"button","aria-expanded":_,"aria-controls":j,onClick:I,className:"group flex w-full min-w-0 items-center gap-2 rounded-md py-1.5 pr-2 text-left transition-colors hover:bg-accent hover:text-accent-foreground",children:[R,B]}),e[17]=j,e[18]=_,e[19]=R,e[20]=B,e[21]=P):P=e[21];let M;e[22]!==n.description?(M=n.description&&s.jsx("p",{className:"break-words pl-9 text-xs leading-normal text-muted-foreground",children:n.description}),e[22]=n.description,e[23]=M):M=e[23];let E;e[24]!==h||e[25]!==j||e[26]!==m||e[27]!==_||e[28]!==u||e[29]!==S||e[30]!==g||e[31]!==c||e[32]!==i||e[33]!==b||e[34]!==f||e[35]!==l||e[36]!==y||e[37]!==p||e[38]!==n?(E=_&&s.jsx("div",{id:j,className:"ml-3 min-w-0 max-w-full overflow-hidden border-l border-border/80 pl-5",children:s.jsx(Xe,{schema:n,value:S,onChange:i,basePath:l,breadcrumbPath:h,onBreadcrumbChange:c,meta:u,decofile:m,onSaveReferencedBlock:f,previewBaseUrl:y,onAddSectionItem:g,onRequestAddSection:b,sandbox:p})}),e[24]=h,e[25]=j,e[26]=m,e[27]=_,e[28]=u,e[29]=S,e[30]=g,e[31]=c,e[32]=i,e[33]=b,e[34]=f,e[35]=l,e[36]=y,e[37]=p,e[38]=n,e[39]=E):E=e[39];let O;return e[40]!==M||e[41]!==E||e[42]!==P?(O=s.jsxs("div",{className:"min-w-0 space-y-2",children:[P,M,E]}),e[40]=M,e[41]=E,e[42]=P,e[43]=O):O=e[43],O}function zr(t){return!t}function Pr(t){if(!t?.properties)return{};const e={};for(const[n,r]of Object.entries(t.properties))n.startsWith("__")||n==="@type"||(r.default!==void 0?e[n]=r.default:r.type==="boolean"?e[n]=!1:r.type==="string"?e[n]="":r.type==="number"||r.type==="integer"?e[n]=0:r.type==="object"&&(e[n]={}));return e}function Mr(t){const e=Z.c(3),{blockKey:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(In,{asChild:!0,children:s.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[s.jsx(_n,{size:11}),"Global"]})}),e[0]=r):r=e[0];let i;return e[1]!==n?(i=s.jsxs(Rn,{children:[r,s.jsxs(On,{side:"top",className:"max-w-[260px]",children:["Edits the saved block “",n,"”. Changes apply everywhere this loader is referenced on your site."]})]}),e[1]=n,e[2]=i):i=e[2],i}function Ur(t){const e=Z.c(28),{path:n,open:r,onOpenChange:i,title:l,nested:o,nestedBlockRef:a,globalBlockKey:c}=t,u=`${n}-loader-config`,m=a&&"ml-1";let f;e[0]!==m?(f=Se("rounded-lg border border-border/80 bg-muted/30",m),e[0]=m,e[1]=f):f=e[1];let y;e[2]!==i||e[3]!==r?(y=()=>i(!r),e[2]=i,e[3]=r,e[4]=y):y=e[4];let g;e[5]!==r?(g=s.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:r?s.jsx(_t,{size:16}):s.jsx(It,{size:16})}),e[5]=r,e[6]=g):g=e[6];let b;e[7]!==l?(b=s.jsx("span",{className:"truncate text-xs font-medium tracking-wide text-muted-foreground uppercase",children:l}),e[7]=l,e[8]=b):b=e[8];let p;e[9]!==c?(p=c&&s.jsx(Mr,{blockKey:c}),e[9]=c,e[10]=p):p=e[10];let v;e[11]!==b||e[12]!==p?(v=s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[b,p]}),e[11]=b,e[12]=p,e[13]=v):v=e[13];let h;e[14]!==u||e[15]!==r||e[16]!==y||e[17]!==g||e[18]!==v?(h=s.jsxs("button",{type:"button","aria-expanded":r,"aria-controls":u,onClick:y,className:"group flex w-full min-w-0 items-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors hover:bg-accent/50",children:[g,v]}),e[14]=u,e[15]=r,e[16]=y,e[17]=g,e[18]=v,e[19]=h):h=e[19];let d;e[20]!==u||e[21]!==o||e[22]!==r?(d=r&&s.jsx("div",{id:u,className:"border-t border-border/60 px-4 pb-4 pt-3",children:s.jsx("div",{className:"border-l border-border/80 pl-4",children:o})}),e[20]=u,e[21]=o,e[22]=r,e[23]=d):d=e[23];let x;return e[24]!==f||e[25]!==h||e[26]!==d?(x=s.jsxs("div",{className:f,children:[h,d]}),e[24]=f,e[25]=h,e[26]=d,e[27]=x):x=e[27],x}function dt(t){const e=Z.c(35),{schema:n,value:r,onChange:i,path:l,label:o,breadcrumbPath:a,onBreadcrumbChange:c,meta:u,decofile:m,onSaveReferencedBlock:f,sandbox:y}=t,g=(n.anyOfRefs??[]).filter(Hr),b=m&&r?tr(r,m):null,p=b?.data??r,v=b?null:Rt(p),h=v??p,d=Hn(g,{savedBlockKey:b?.blockKey,editorValue:p}),x=d.length>0?Wn(p,d,b?.blockKey):d[0]?.resolveType??"",S=n.type==="block-ref"&&d.some(Kr);let T;e[0]!==o||e[1]!==l?(T=o??(l.includes(".")?l.split(".")[0]:l),e[0]=o,e[1]=l,e[2]=T):T=e[2];const N=T;let C;e[3]!==a?(C=a??[],e[3]=a,e[4]=C):C=e[4];const w=C,_=S&&w[0]===N?w.slice(1):w,j=S?$=>{c?.([N,...$])}:c,[I,R]=te.useState(x),[B,P]=te.useState(x);B!==x&&(P(x),R(x));const[M,E]=te.useState(()=>Yn(p,b?.blockKey));if(d.length>0){const $=I||x;let V;e[5]!==$?(V=z=>z.resolveType===$,e[5]=$,e[6]=V):V=e[6];const se=d.find(V),F=lt(p,u,se?.schema),L=qn(F??se?.schema??null,n.discriminatorKey),G=n.discriminatorKey,le=z=>{R(z);const oe=d.find(fe=>fe.resolveType===z),ue=lt(p,u,oe?.schema),ve=new Set(Object.keys((ue??oe?.schema)?.properties??{})),we=r!==null&&typeof r=="object"&&!Array.isArray(r)?r:{},ke=Object.fromEntries(Object.entries(we).filter(fe=>{const[Te]=fe;return ve.has(Te)})),be={...Pr(oe?.schema),...ke};if(G){const fe=oe?.discriminatorValue??z;i({...be,[G]:fe});return}if(Ee(z)){i(be);return}i({...be,__resolveType:z})};let J;e[7]!==$||e[8]!==G||e[9]!==i?(J=z=>{if(G||!Ee($)||z===null||typeof z!="object"||Array.isArray(z)){i(z);return}const{__resolveType:oe,...ue}=z;i(ue)},e[7]=$,e[8]=G,e[9]=i,e[10]=J):J=e[10];const he=J,ce=L?.properties?s.jsx(Xe,{schema:L,value:h,onChange:z=>{if(b&&f){f(b.blockKey,z);return}if(v){i({...p,section:z});return}he(z)},basePath:l,breadcrumbPath:_,onBreadcrumbChange:j,meta:u,decofile:m,onSaveReferencedBlock:f,sandbox:y}):null;let ie;e[11]!==l?(ie=l.includes("."),e[11]=l,e[12]=ie):ie=e[12];const ye=ie;let ae;e[13]!==o||e[14]!==l?(ae=s.jsx(me,{htmlFor:l,children:o}),e[13]=o,e[14]=l,e[15]=ae):ae=e[15];let K;e[16]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx(jt,{children:s.jsx(Nt,{placeholder:"Select..."})}),e[16]=K):K=e[16];let q;return e[17]!==n.description?(q=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[17]=n.description,e[18]=q):q=e[18],s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[ae,s.jsxs(kt,{value:$||void 0,onValueChange:le,children:[K,s.jsx(St,{children:d.map(Vr)})]}),q]}),ce&&(S?s.jsx(Ur,{path:l,open:M,onOpenChange:E,title:ye?"Configuration":"Loader configuration",nested:ce,nestedBlockRef:ye,globalBlockKey:b?.blockKey}):ce)]})}if(n.anyOfRefs&&n.anyOfRefs.length>0)return null;let O;e[19]!==o||e[20]!==l?(O=s.jsx(me,{htmlFor:l,children:o}),e[19]=o,e[20]=l,e[21]=O):O=e[21];const ne=r!=null?String(r):"";let re;e[22]!==i?(re=$=>i($.target.value),e[22]=i,e[23]=re):re=e[23];const X=n.description??"";let U;e[24]!==l||e[25]!==ne||e[26]!==re||e[27]!==X?(U=s.jsx("input",{id:l,type:"text",value:ne,onChange:re,className:"w-full rounded-md border bg-background px-3 py-1.5 text-sm",placeholder:X}),e[24]=l,e[25]=ne,e[26]=re,e[27]=X,e[28]=U):U=e[28];let W;e[29]!==n.description?(W=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[29]=n.description,e[30]=W):W=e[30];let Y;return e[31]!==O||e[32]!==U||e[33]!==W?(Y=s.jsxs("div",{className:"space-y-1.5",children:[O,U,W]}),e[31]=O,e[32]=U,e[33]=W,e[34]=Y):Y=e[34],Y}function Vr(t){const e=t.title&&!t.title.includes("/")?t.title:Nn(t.resolveType)??qe(t.resolveType);return s.jsx(bt,{value:t.resolveType,children:e},t.resolveType)}function Kr(t){return t.resolveType.includes("/")&&!Ee(t.resolveType)}function Hr(t){return t.resolveType!==""}function Wr(t){if(!Array.isArray(t))return[];const e=[];for(const n of t)if(typeof n=="string")e.push({value:n,label:n});else if(n&&typeof n=="object"&&"value"in n){const r=n;e.push({value:String(r.value),label:typeof r.label=="string"?r.label:String(r.value),image:typeof r.image=="string"?r.image:void 0})}return e}async function qr(t,e,n){const r={};n&&(r.term=n);const l=`${t.replace(/\/+$/,"")}/deco/invoke/${e}`,o=await fetch(l,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw new Error(`Failed to fetch dynamic options: ${o.status}`);const a=await o.json();return Wr(a)}function pt(t){const e=Z.c(8),{path:n,label:r,description:i}=t;let l;e[0]!==r||e[1]!==n?(l=s.jsx(me,{htmlFor:n,children:r}),e[0]=r,e[1]=n,e[2]=l):l=e[2];let o;e[3]!==i?(o=i&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:i}),e[3]=i,e[4]=o):o=e[4];let a;return e[5]!==l||e[6]!==o?(a=s.jsxs("div",{className:"space-y-0.5",children:[l,o]}),e[5]=l,e[6]=o,e[7]=a):a=e[7],a}function Yr(t){const e=Z.c(71),{schema:n,value:r,onChange:i,path:l,label:o,sandbox:a}=t,c=n.options,u=a?.previewUrl,[m,f]=te.useState(!1),[y,g]=te.useState(""),[b,p]=te.useState(""),v=te.useRef(null);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=F=>{g(F),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{p(F)},300)},e[0]=h):h=e[0];const d=h,x=a?`${a.orgSlug}/${a.virtualMcpId}/${a.branch}`:"";let k;e[1]!==b||e[2]!==c||e[3]!==x?(k=Mt.sandboxInvoke(x,`dynamic-options:${c??""}:${b}`),e[1]=b,e[2]=c,e[3]=x,e[4]=k):k=e[4];let S;e[5]!==b||e[6]!==c||e[7]!==u?(S=()=>qr(u,c,b||void 0),e[5]=b,e[6]=c,e[7]=u,e[8]=S):S=e[8];const T=!!u&&!!c&&m;let N;e[9]!==k||e[10]!==S||e[11]!==T?(N={queryKey:k,queryFn:S,enabled:T,staleTime:6e4,retry:1},e[9]=k,e[10]=S,e[11]=T,e[12]=N):N=e[12];const C=Pt(N);let w;e[13]!==C.data?(w=C.data??[],e[13]=C.data,e[14]=w):w=e[14];const _=w,j=typeof r=="string"?r:"";let I;if(e[15]!==j||e[16]!==_){let F;e[18]!==j?(F=L=>L.value===j,e[18]=j,e[19]=F):F=e[19],I=_.find(F),e[15]=j,e[16]=_,e[17]=I}else I=e[17];const R=I;if(!u||!c){let F;e[20]!==o||e[21]!==l||e[22]!==n.description?(F=s.jsx(pt,{path:l,label:o,description:n.description}),e[20]=o,e[21]=l,e[22]=n.description,e[23]=F):F=e[23];let L;e[24]!==i?(L=J=>i(J.target.value),e[24]=i,e[25]=L):L=e[25];let G;e[26]!==j||e[27]!==l||e[28]!==L?(G=s.jsx(xe,{id:l,type:"text",value:j,onChange:L}),e[26]=j,e[27]=l,e[28]=L,e[29]=G):G=e[29];let le;return e[30]!==G||e[31]!==F?(le=s.jsxs("div",{className:"space-y-2",children:[F,G]}),e[30]=G,e[31]=F,e[32]=le):le=e[32],le}let B;e[33]!==o||e[34]!==l||e[35]!==n.description?(B=s.jsx(pt,{path:l,label:o,description:n.description}),e[33]=o,e[34]=l,e[35]=n.description,e[36]=B):B=e[36];let P;e[37]!==j||e[38]!==R?(P=R?s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[R.image&&s.jsx("img",{src:R.image,alt:"",referrerPolicy:"no-referrer",className:"h-6 w-6 shrink-0 rounded object-cover"}),s.jsx("span",{className:"truncate",children:R.label??R.value})]}):j?s.jsx("span",{className:"truncate",children:j}):s.jsx("span",{className:"text-muted-foreground",children:"Select..."}),e[37]=j,e[38]=R,e[39]=P):P=e[39];let M;e[40]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsx(Fn,{className:"size-4 shrink-0 opacity-50"}),e[40]=M):M=e[40];let E;e[41]!==m||e[42]!==P?(E=s.jsx(gt,{asChild:!0,children:s.jsxs(Re,{variant:"outline",role:"combobox","aria-expanded":m,className:"h-10 w-full justify-between font-normal",children:[P,M]})}),e[41]=m,e[42]=P,e[43]=E):E=e[43];let O;e[44]===Symbol.for("react.memo_cache_sentinel")?(O={width:"var(--radix-popover-trigger-width)"},e[44]=O):O=e[44];let ne;e[45]!==y?(ne=s.jsx(Ln,{placeholder:"Search...",className:"h-9",value:y,onValueChange:d}),e[45]=y,e[46]=ne):ne=e[46];const re=C.isLoading?"Loading...":"No results found.";let X;e[47]!==re?(X=s.jsx(Dn,{children:re}),e[47]=re,e[48]=X):X=e[48];let U;if(e[49]!==j||e[50]!==i||e[51]!==_){let F;e[53]!==j||e[54]!==i?(F=L=>s.jsxs(Bn,{value:L.value,onSelect:()=>{i(L.value===j?"":L.value),f(!1)},children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[L.image&&s.jsx("img",{src:L.image,alt:"",referrerPolicy:"no-referrer",className:"h-9 w-9 shrink-0 rounded object-cover"}),s.jsx("span",{className:"truncate",children:L.label??L.value})]}),s.jsx($n,{className:Se("ml-auto size-4 shrink-0",j===L.value?"opacity-100":"opacity-0")})]},L.value),e[53]=j,e[54]=i,e[55]=F):F=e[55],U=_.map(F),e[49]=j,e[50]=i,e[51]=_,e[52]=U}else U=e[52];let W;e[56]!==U?(W=s.jsx(En,{children:U}),e[56]=U,e[57]=W):W=e[57];let Y;e[58]!==X||e[59]!==W?(Y=s.jsxs(zn,{children:[X,W]}),e[58]=X,e[59]=W,e[60]=Y):Y=e[60];let $;e[61]!==ne||e[62]!==Y?($=s.jsx(xt,{className:"p-0",style:O,children:s.jsxs(Pn,{shouldFilter:!1,children:[ne,Y]})}),e[61]=ne,e[62]=Y,e[63]=$):$=e[63];let V;e[64]!==m||e[65]!==E||e[66]!==$?(V=s.jsxs(vt,{open:m,onOpenChange:f,children:[E,$]}),e[64]=m,e[65]=E,e[66]=$,e[67]=V):V=e[67];let se;return e[68]!==V||e[69]!==B?(se=s.jsxs("div",{className:"space-y-2",children:[B,V]}),e[68]=V,e[69]=B,e[70]=se):se=e[70],se}function mt(t){const e=Z.c(2),{ext:n}=t;if(!n)return null;let r;return e[0]!==n?(r=s.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:n}),e[0]=n,e[1]=r):r=e[1],r}function Gr(t){try{const e=new URL(t).pathname;return decodeURIComponent(e.split("/").pop()??t)}catch{return t.split("/").pop()??t}}function Qr(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"":t.slice(e+1).toLowerCase()}function ht(t){const e=Z.c(79),{schema:n,value:r,onChange:i,path:l,label:o,sandbox:a}=t,c=n.format==="video-uri",u=At(r),[m,f]=te.useState(!1),[y,g]=te.useState(!1),b=u?Gr(u):"",p=b?Qr(b):"",v=Un(),h=Tn();let d;e[0]!==v.data?.configs?(d=v.data?.configs??[],e[0]=v.data?.configs,e[1]=d):d=e[1];const x=a?.siteSlug;let k;e[2]!==d||e[3]!==x?(k=Cn(d,x),e[2]=d,e[3]=x,e[4]=k):k=e[4];const S=k;let T;e[5]!==v.data?.configs||e[6]!==S?(T=function(){if(S)return S.id;const K=v.data?.configs??[];if(K.length===1)return K[0].id;if(K.length===0)return null;const q=typeof window<"u"?window.localStorage.getItem(wn):null;return K.some(z=>z.id===q)?q:null},e[5]=v.data?.configs,e[6]=S,e[7]=T):T=e[7];const N=T;let C;e[8]!==c||e[9]!==i||e[10]!==N||e[11]!==f||e[12]!==h?(C=async function(K){if(!K)return;let q=Array.from(K);if(q.length===0)return;if(c&&(q=q.filter(Zr),q.length===0)){Ae.error("Please drop a video file (mp4, webm, …).");return}const z=N();if(!z){f(!0);return}try{const oe=await h.mutateAsync({configId:z,file:q[0]});i(oe.publicUrl),q.length>1&&Ae.info(`Uploaded ${q[0].name}; extra files were ignored (single-select field).`)}catch(oe){const ue=oe;Ae.error(ue instanceof Error?ue.message:"Upload failed")}},e[8]=c,e[9]=i,e[10]=N,e[11]=f,e[12]=h,e[13]=C):C=e[13];const w=C;let _;e[14]!==g?(_=function(K){K.preventDefault(),K.dataTransfer.types.includes("Files")&&g(!0)},e[14]=g,e[15]=_):_=e[15];const j=_;let I;e[16]!==g?(I=function(K){K.currentTarget===K.target&&g(!1)},e[16]=g,e[17]=I):I=e[17];const R=I;let B;e[18]!==w||e[19]!==g?(B=function(K){K.preventDefault(),g(!1),w(K.dataTransfer.files)},e[18]=w,e[19]=g,e[20]=B):B=e[20];const P=B;let M;e[21]!==o||e[22]!==l?(M=s.jsx(me,{htmlFor:l,className:"text-muted-foreground",children:o}),e[21]=o,e[22]=l,e[23]=M):M=e[23];let E;e[24]!==n.description?(E=n.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[24]=n.description,e[25]=E):E=e[25];let O;e[26]!==E||e[27]!==M?(O=s.jsxs("div",{className:"min-w-0 space-y-0.5",children:[M,E]}),e[26]=E,e[27]=M,e[28]=O):O=e[28];const ne=y&&"border-primary ring-2 ring-primary/30",re=h.isPending&&"pointer-events-none opacity-60";let X;e[29]!==ne||e[30]!==re?(X=Se("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",ne,re),e[29]=ne,e[30]=re,e[31]=X):X=e[31];let U;e[32]!==p||e[33]!==b||e[34]!==c||e[35]!==f||e[36]!==u||e[37]!==h.isPending?(U=u?c?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"relative h-40 w-full overflow-hidden bg-black",children:s.jsx("video",{src:u,preload:"metadata",className:"h-full w-full object-contain"},u)}),s.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[s.jsx(et,{size:14,className:"shrink-0 text-muted-foreground"}),s.jsx("p",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:b}),s.jsx(mt,{ext:p})]})]}):s.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",children:[s.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-md bg-background",children:s.jsx(tt,{size:18,className:"text-muted-foreground"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-sm font-medium",children:b}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:u})]}),s.jsx(mt,{ext:p})]}):s.jsxs("button",{type:"button",onClick:()=>f(!0),className:"flex w-full flex-col items-center justify-center gap-2 py-8 text-sm text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[c?s.jsx(et,{size:20}):s.jsx(tt,{size:20}),s.jsx("span",{className:"text-sm font-medium",children:h.isPending?"Uploading…":c?"Drop a video here or click to browse":"Drop a file or click to browse"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Up to 100 MB"})]}),e[32]=p,e[33]=b,e[34]=c,e[35]=f,e[36]=u,e[37]=h.isPending,e[38]=U):U=e[38];let W;e[39]!==y?(W=y&&s.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:s.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:"Drop to upload"})}),e[39]=y,e[40]=W):W=e[40];let Y;e[41]!==R||e[42]!==j||e[43]!==P||e[44]!==X||e[45]!==U||e[46]!==W?(Y=s.jsxs("div",{onDragOver:j,onDragLeave:R,onDrop:P,className:X,children:[U,W]}),e[41]=R,e[42]=j,e[43]=P,e[44]=X,e[45]=U,e[46]=W,e[47]=Y):Y=e[47];let $;e[48]!==i?($=ae=>i(ae.target.value),e[48]=i,e[49]=$):$=e[49];let V;e[50]!==l||e[51]!==u||e[52]!==$?(V=s.jsx(xe,{id:l,type:"url",value:u,onChange:$,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[50]=l,e[51]=u,e[52]=$,e[53]=V):V=e[53];let se;e[54]!==f?(se=()=>f(!0),e[54]=f,e[55]=se):se=e[55];let F;e[56]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(Mn,{size:14}),e[56]=F):F=e[56];const L=u?"Replace":"Browse";let G;e[57]!==se||e[58]!==L?(G=s.jsxs(Re,{type:"button",variant:"outline",size:"sm",onClick:se,className:"h-9 shrink-0",children:[F,L]}),e[57]=se,e[58]=L,e[59]=G):G=e[59];let le;e[60]!==i||e[61]!==u?(le=u&&s.jsx(Re,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(""),className:"h-9 shrink-0","aria-label":"Remove file",children:s.jsx(Ct,{size:14})}),e[60]=i,e[61]=u,e[62]=le):le=e[62];let J;e[63]!==V||e[64]!==G||e[65]!==le?(J=s.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[V,G,le]}),e[63]=V,e[64]=G,e[65]=le,e[66]=J):J=e[66];let he;e[67]!==i?(he=ae=>i(ae),e[67]=i,e[68]=he):he=e[68];const ce=S?.id??null;let ie;e[69]!==m||e[70]!==f||e[71]!==he||e[72]!==ce?(ie=s.jsx(An,{open:m,onOpenChange:f,mode:"any",onSelect:he,lockedConfigId:ce}),e[69]=m,e[70]=f,e[71]=he,e[72]=ce,e[73]=ie):ie=e[73];let ye;return e[74]!==O||e[75]!==Y||e[76]!==J||e[77]!==ie?(ye=s.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[O,Y,J,ie]}),e[74]=O,e[75]=Y,e[76]=J,e[77]=ie,e[78]=ye):ye=e[78],ye}function Zr(t){return t.type.startsWith("video/")}const Xr="website/loaders/secret.ts";function Ie(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t.__resolveType;return typeof e=="string"&&(e.endsWith("/secret.ts")||e.includes("loaders/secret"))}function Jr(){return{__resolveType:Xr,name:"",encrypted:""}}function es(t){const{value:e,...n}=t;return n}function He(t){const e=Z.c(45),{schema:n,value:r,onChange:i,label:l,path:o}=t;if(typeof r=="string"||r==null&&!Ie(r)){const N=typeof r=="string"?r:"";let C;e[0]!==l||e[1]!==o?(C=s.jsx(me,{htmlFor:o,className:"text-sm font-medium",children:l}),e[0]=l,e[1]=o,e[2]=C):C=e[2];let w;e[3]!==n.description?(w=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[3]=n.description,e[4]=w):w=e[4];let _;e[5]!==i?(_=R=>i(R.target.value),e[5]=i,e[6]=_):_=e[6];let j;e[7]!==o||e[8]!==N||e[9]!==_?(j=s.jsx(xe,{id:o,type:"password",value:N,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:"Secret value",onChange:_,className:"h-10"}),e[7]=o,e[8]=N,e[9]=_,e[10]=j):j=e[10];let I;return e[11]!==C||e[12]!==w||e[13]!==j?(I=s.jsxs("div",{className:"space-y-2",children:[C,w,j]}),e[11]=C,e[12]=w,e[13]=j,e[14]=I):I=e[14],I}let a;e[15]!==r?(a=Ie(r)?r:Jr(),e[15]=r,e[16]=a):a=e[16];const c=a,u=typeof c.name=="string"?c.name:"",m=typeof c.encrypted=="string"&&c.encrypted,f=`${o}-name`;let y;e[17]!==l||e[18]!==f?(y=s.jsx(me,{htmlFor:f,className:"text-sm font-medium",children:l}),e[17]=l,e[18]=f,e[19]=y):y=e[19];let g;e[20]!==n.description?(g=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[20]=n.description,e[21]=g):g=e[21];const b=`${o}-name`;let p;e[22]!==c||e[23]!==i?(p=N=>i({...c,name:N.target.value}),e[22]=c,e[23]=i,e[24]=p):p=e[24];let v;e[25]!==u||e[26]!==b||e[27]!==p?(v=s.jsx(xe,{id:b,value:u,placeholder:"Secret name",onChange:p,className:"h-10"}),e[25]=u,e[26]=b,e[27]=p,e[28]=v):v=e[28];const h=`${o}-value`,d=m?"Leave blank to keep current value":"Secret value";let x;e[29]!==c||e[30]!==m||e[31]!==i?(x=N=>{const C=N.target.value;if(!C){i(m?es(c):c);return}i({...c,value:C})},e[29]=c,e[30]=m,e[31]=i,e[32]=x):x=e[32];let k;e[33]!==x||e[34]!==h||e[35]!==d?(k=s.jsx(xe,{id:h,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:d,onChange:x,className:"h-10"}),e[33]=x,e[34]=h,e[35]=d,e[36]=k):k=e[36];let S;e[37]!==m?(S=m&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"A secret value is stored."}),e[37]=m,e[38]=S):S=e[38];let T;return e[39]!==k||e[40]!==S||e[41]!==y||e[42]!==g||e[43]!==v?(T=s.jsxs("div",{className:"space-y-2",children:[y,g,v,k,S]}),e[39]=k,e[40]=S,e[41]=y,e[42]=g,e[43]=v,e[44]=T):T=e[44],T}function ts(t){const e=t.length>0?t[0]:void 0;if(e==null||typeof e!="object"||Array.isArray(e))return;const n={};for(const[r,i]of Object.entries(e))r.startsWith("__")||(typeof i=="string"?n[r]={type:"string"}:typeof i=="number"?n[r]={type:"number"}:typeof i=="boolean"&&(n[r]={type:"boolean"}));return Object.keys(n).length>0?{type:"object",properties:n}:void 0}const ns=new Set(["__resolveType","@type"]);function rs(t){if(t.type!=="block-ref"||!t.anyOfRefs?.length||t.anyOfRefs.length!==1)return null;const e=t.anyOfRefs[0].resolveType;return e.endsWith("/multivariate/image.ts")?"image":e.endsWith("/multivariate/video.ts")||e.endsWith("/multivariate/file.ts")?"file":null}function ss(t){if(Me(t))for(const e of t.anyOfRefs??[]){const i=e.schema?.properties?.variants?.items?.properties?.value;if(i?.type==="array"&&i.items)return i.items}}function yt(t){if(t.type==="array"&&t.items)return t;const e=t.items??ss(t);return e?{...t,type:"array",items:e}:null}function is(t,e){if(e!==void 0)return e;switch(t){case"string":return"";case"number":case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return null}}function zt(t){const{schema:e,value:n}=t;if(it(n)){const o=Sn(n),a=yt(e);if(o!==null&&a)return s.jsx(Be,{...t,schema:a,value:o,onChange:c=>t.onChange(kn(n,c))},t.path)}if(Array.isArray(n)&&e.type==="block-ref"&&Me(e)){const o=yt(e);if(o)return s.jsx(Be,{...t,schema:o,value:n,onChange:t.onChange},t.path)}if(Array.isArray(n)&&!it(n)&&e.type==="block-ref"){const o=ts(n);if(o){const a={...e,type:"array",items:o};return s.jsx(Be,{...t,schema:a,value:n,onChange:t.onChange},t.path)}}if(e.type==="block-ref"||n!==null&&typeof n=="object"&&!Array.isArray(n)&&typeof n.__resolveType=="string"&&e.anyOfRefs){const o=rs(e);return o==="image"?s.jsx(ot,{...t},t.path):o==="file"?s.jsx(ht,{...t},t.path):e.anyOfRefs?s.jsx(dt,{...t},t.path):null}if(e.format==="image-uri")return s.jsx(ot,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return s.jsx(ht,{...t},t.path);if(e.format==="dynamic-options"&&e.options)return s.jsx(Yr,{...t},t.path);if(e.enum&&e.enum.length>0)return s.jsx(br,{...t},t.path);if(e.type==="anyOf")return s.jsx(dt,{...t},t.path);if(Ie(n)||e.format==="password"||n==null&&e.format==="password")return s.jsx(He,{...t},t.path);const r=n??is(e.type,e.default);if(r==null)return Ie(n)?s.jsx(He,{...t},t.path):null;if(Ie(r))return s.jsx(He,{...t,value:r},t.path);const i={...t,value:r},l=n==null?e.type??typeof r:Array.isArray(r)?"array":typeof r;if(l==="array"||Array.isArray(r))return s.jsx(Be,{...i},t.path);switch(l){case"boolean":return s.jsx(yr,{...i},t.path);case"number":case"integer":return s.jsx(hr,{...i},t.path);case"string":{const o=e.format;return o==="color-input"?s.jsx(Le,{...i},t.path):o==="textarea"||o==="rich-text"||o==="html"?s.jsx(Le,{...i},t.path):s.jsx(Le,{...i},t.path)}case"object":return r!==null&&typeof r=="object"&&!Array.isArray(r)?s.jsx(Er,{...i},t.path):null;default:return s.jsx(Le,{...i},t.path)}}function Xe(t){const e=Z.c(16),{schema:n,value:r,onChange:i,basePath:l,breadcrumbPath:o,onBreadcrumbChange:a,meta:c,decofile:u,onSaveReferencedBlock:m,previewBaseUrl:f,onAddSectionItem:y,onRequestAddSection:g,sandbox:b}=t;let p,v;if(e[0]!==l||e[1]!==u||e[2]!==c||e[3]!==y||e[4]!==a||e[5]!==i||e[6]!==g||e[7]!==m||e[8]!==f||e[9]!==b||e[10]!==n.properties||e[11]!==o||e[12]!==r){v=Symbol.for("react.early_return_sentinel");e:{const h=o===void 0?[]:o,d=n.properties;if(!d){v=null;break e}const x=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},k=Object.keys(d).filter(j=>!ns.has(j)&&d[j]?.hidden!==!0);if(k.length===0){let j;e[15]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No editable fields on this section."}),e[15]=j):j=e[15],v=j;break e}const S=(j,I)=>{i({...x,[j]:I})},T=typeof x.__resolveType=="string"?x.__resolveType:void 0,N=h.length>0?kr(k,d,x,h):null,C=N?d[N]:null,w=N&&C?[N]:k,_=N&&C?Nr(N,C,h):h;p=s.jsx("div",{className:"min-w-0 space-y-6",children:w.map(j=>{const I=d[j];if(!I)return null;const R=l?`${l}.${j}`:j,B=_e(j,I);return zt({schema:I,value:x[j],onChange:P=>S(j,P),path:R,label:B,breadcrumbPath:_,onBreadcrumbChange:a,meta:c,decofile:u,onSaveReferencedBlock:m,containerResolveType:T,previewBaseUrl:f,onAddSectionItem:y,onRequestAddSection:g,sandbox:b})})})}e[0]=l,e[1]=u,e[2]=c,e[3]=y,e[4]=a,e[5]=i,e[6]=g,e[7]=m,e[8]=f,e[9]=b,e[10]=n.properties,e[11]=o,e[12]=r,e[13]=p,e[14]=v}else p=e[13],v=e[14];return v!==Symbol.for("react.early_return_sentinel")?v:p}export{Xe as S,zt as a,Ls as b,Le as c,Ge as r,Gn as s,Fs as u};