decocms 3.36.3 → 3.36.5

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 (236) hide show
  1. package/dist/client/assets/{AlertCircle-BU9gj1Zb.js → AlertCircle-CHkhp8BT.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-D2O4sQl3.js → ArrowUpRight-BLDnDQA4.js} +1 -1
  3. package/dist/client/assets/{Check-BmF1hQRY.js → Check-g3DB8Y79.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-C4XwcfjN.js → CheckCircle-CaqJ0h8v.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-BIO7wba7.js → ChevronDown-2xes5oAP.js} +1 -1
  6. package/dist/client/assets/{ChevronLeft-CW2G6JyB.js → ChevronLeft-DoZaWCdC.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-CwhL8zaw.js → ChevronRight-BAb1spam.js} +1 -1
  8. package/dist/client/assets/{ChevronUp-DdLEv_cl.js → ChevronUp-D1fwNmdw.js} +1 -1
  9. package/dist/client/assets/{Container-Dyf0TzBH.js → Container-SX43EreL.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-DQMFAww2.js → DotsVertical-BJVJdITZ.js} +1 -1
  11. package/dist/client/assets/{Eye-Bi1ejTfS.js → Eye-B6_-sQMR.js} +1 -1
  12. package/dist/client/assets/{FilterLines-jWyOgIfr.js → FilterLines-Bppcas54.js} +1 -1
  13. package/dist/client/assets/{Globe01-DF9PUq9k.js → Globe01-BaaIcJuv.js} +1 -1
  14. package/dist/client/assets/{HardDrive-BIzpSh2R.js → HardDrive-DCOTq5uv.js} +1 -1
  15. package/dist/client/assets/{Key01-DJaxTkjl.js → Key01-WyguyLzq.js} +1 -1
  16. package/dist/client/assets/{LayoutLeft-C3u21iqS.js → LayoutLeft-DFTfTIl4.js} +1 -1
  17. package/dist/client/assets/{LinkExternal01-D7mXn_q6.js → LinkExternal01-C4yAqYts.js} +1 -1
  18. package/dist/client/assets/{Monitor01-B2V0QJVA.js → Monitor01-rl2bcoeM.js} +1 -1
  19. package/dist/client/assets/{Palette-CvjTgNao.js → Palette-VBLL4nJC.js} +1 -1
  20. package/dist/client/assets/{Play-6yxi-kVu.js → Play-Cjs1Q-Aw.js} +1 -1
  21. package/dist/client/assets/{Plus-D-k489Hw.js → Plus-C5heVoJ6.js} +1 -1
  22. package/dist/client/assets/{RefreshCcw01-0Z7TeT1O.js → RefreshCcw01-BZry-3Kg.js} +1 -1
  23. package/dist/client/assets/{SearchMd-BdcI0VcO.js → SearchMd-qFqO3CC6.js} +1 -1
  24. package/dist/client/assets/{Settings02-C6hr8Qy9.js → Settings02-CLIbq_7z.js} +1 -1
  25. package/dist/client/assets/{Shield01-DOB3vgca.js → Shield01-Bo6JmLSx.js} +1 -1
  26. package/dist/client/assets/{Star01-Du_V1z61.js → Star01-2SOe9QD-.js} +1 -1
  27. package/dist/client/assets/{Stars01-BAC8f8eM.js → Stars01-C-iKmdEF.js} +1 -1
  28. package/dist/client/assets/{Stars02-CpPe-VPg.js → Stars02-CEd2BxY_.js} +1 -1
  29. package/dist/client/assets/{Sun-C3Zhz8pG.js → Sun-jizGeY2D.js} +1 -1
  30. package/dist/client/assets/{SwitchHorizontal01-BRvArA9H.js → SwitchHorizontal01-CUtzfg9y.js} +1 -1
  31. package/dist/client/assets/{Tool01-yFL5Dn59.js → Tool01-IpmKT80v.js} +1 -1
  32. package/dist/client/assets/{Trash01-Br13J6pg.js → Trash01-DM00_xyO.js} +1 -1
  33. package/dist/client/assets/{Upload01-D4q_2hTt.js → Upload01-D0E7TXXq.js} +1 -1
  34. package/dist/client/assets/{User01-BtejVxVG.js → User01-ga9dWIix.js} +1 -1
  35. package/dist/client/assets/{Users01-Dy4pn4ki.js → Users01-lGeZPP0U.js} +1 -1
  36. package/dist/client/assets/{Users03-CmfKEZdY.js → Users03-1mzpWPfB.js} +1 -1
  37. package/dist/client/assets/{X-DcDNiBgo.js → X-C_bQSA-d.js} +1 -1
  38. package/dist/client/assets/{XCircle-e29W-Gcn.js → XCircle-D9AGwgGK.js} +1 -1
  39. package/dist/client/assets/{XClose-D4RzaaY5.js → XClose-dBx0FEAe.js} +1 -1
  40. package/dist/client/assets/{Zap-Cp6OTaVi.js → Zap-BJCyzigO.js} +1 -1
  41. package/dist/client/assets/{ZapSquare-CvMxvmoA.js → ZapSquare-CJ6AZAbk.js} +1 -1
  42. package/dist/client/assets/{ZoomOut-m5WCE6Ow.js → ZoomOut-B2ojfl-A.js} +1 -1
  43. package/dist/client/assets/{access-gate-B7iLwSTn.js → access-gate-DR6xMqvH.js} +1 -1
  44. package/dist/client/assets/{accordion-DyJkloNK.js → accordion-CQcOq9Y1.js} +1 -1
  45. package/dist/client/assets/{add-section-modal-CRDse3LE.js → add-section-modal-55MbBlme.js} +1 -1
  46. package/dist/client/assets/{agent-capabilities--0Cd735F.js → agent-capabilities-CtOghWTY.js} +1 -1
  47. package/dist/client/assets/{agent-icon-MPxc_53p.js → agent-icon-BIiUgn6T.js} +1 -1
  48. package/dist/client/assets/{agents-list-DvMDGpVE.js → agents-list-BC6bGl1F.js} +1 -1
  49. package/dist/client/assets/{ai-providers-BZpaXRIt.js → ai-providers-CF2sNVXk.js} +1 -1
  50. package/dist/client/assets/{alert--QwThtUs.js → alert-C0EsYqWw.js} +1 -1
  51. package/dist/client/assets/{alert-dialog-DAZnJbEa.js → alert-dialog-DH_8ED2c.js} +1 -1
  52. package/dist/client/assets/app-editor-iZwP6h8z.js +1 -0
  53. package/dist/client/assets/{auth-Rhn0UUKX.js → auth-DMsnFrvi.js} +1 -1
  54. package/dist/client/assets/{auth-catchall-COEk5Dgt.js → auth-catchall-B3-iMOVk.js} +1 -1
  55. package/dist/client/assets/{auth-split-layout-BU5p8xYF.js → auth-split-layout-DUkVa1zJ.js} +1 -1
  56. package/dist/client/assets/{automation-list-row-BkqsYOIc.js → automation-list-row-H0j7w0mf.js} +1 -1
  57. package/dist/client/assets/{automation-runs-CfLYge75.js → automation-runs-iFgQkQtG.js} +1 -1
  58. package/dist/client/assets/{automations-E9ZspVSN.js → automations-C6K_k2_u.js} +1 -1
  59. package/dist/client/assets/{avatar-DgWkRz32.js → avatar-D47Jk04K.js} +1 -1
  60. package/dist/client/assets/{badge-Ckvq5EMT.js → badge-B4Q3Kugn.js} +1 -1
  61. package/dist/client/assets/{brand-context-Cm9JdTeG.js → brand-context-BflLJViw.js} +1 -1
  62. package/dist/client/assets/{buckets-Dja8qKdg.js → buckets-Cer0snSA.js} +1 -1
  63. package/dist/client/assets/{calendar-C4NMm-GW.js → calendar-BOtLk06o.js} +1 -1
  64. package/dist/client/assets/{capability-load-error-DGtjMdu6.js → capability-load-error-CXdwr2J6.js} +1 -1
  65. package/dist/client/assets/{card-DV2a7ud0.js → card-LUxcXBOp.js} +1 -1
  66. package/dist/client/assets/{chat-context-CQJ83DKW.js → chat-context-BJ1vdoQm.js} +1 -1
  67. package/dist/client/assets/{checkbox-Eb0jgSAR.js → checkbox-CHqLn2TQ.js} +1 -1
  68. package/dist/client/assets/{cli-auth-success-C5I6pdNq.js → cli-auth-success-CjN24BgV.js} +1 -1
  69. package/dist/client/assets/{collection-detail-QmVn7T6P.js → collection-detail-Ba7yJUvR.js} +1 -1
  70. package/dist/client/assets/{collection-display-button-k6e_w5_8.js → collection-display-button-DuPg0P2z.js} +1 -1
  71. package/dist/client/assets/{collection-search-q3LrsDP0.js → collection-search-BJmgl3qg.js} +1 -1
  72. package/dist/client/assets/{collection-table-wrapper-Wg4_kRAB.js → collection-table-wrapper-BpQMr64m.js} +1 -1
  73. package/dist/client/assets/{collection-tabs-CvaARsvN.js → collection-tabs-BjDLPumD.js} +1 -1
  74. package/dist/client/assets/{collections-DjlDVd1Q.js → collections-_vOvxoxw.js} +1 -1
  75. package/dist/client/assets/{command--rBvALtU.js → command-DEfANLSd.js} +1 -1
  76. package/dist/client/assets/{connect-desktop-dialog-CkEEvZPz.js → connect-desktop-dialog-D5KjXYkQ.js} +1 -1
  77. package/dist/client/assets/{connection-card-DqPMpeMB.js → connection-card-CmfMbikw.js} +1 -1
  78. package/dist/client/assets/{connection-detail-Ceck3IrK.js → connection-detail-vdtWGKC_.js} +1 -1
  79. package/dist/client/assets/{connection-form-helpers-B6xP1FXS.js → connection-form-helpers-BzM5voPg.js} +1 -1
  80. package/dist/client/assets/{connections-BvYO4I8Q.js → connections-CUS_xbnw.js} +1 -1
  81. package/dist/client/assets/{decopilot-DxHNnnUA.js → decopilot-DdFCWM0M.js} +1 -1
  82. package/dist/client/assets/decopilot-sse-pool-Bxs_zfqE.js +1 -0
  83. package/dist/client/assets/{dialog-pxIgcxdx.js → dialog-DNvA-MUO.js} +1 -1
  84. package/dist/client/assets/{domain-settings-CGcPdYTM.js → domain-settings-DZsGHi4R.js} +1 -1
  85. package/dist/client/assets/{drawer-BrCENAAY.js → drawer-DaOnsuqJ.js} +1 -1
  86. package/dist/client/assets/{dropdown-menu-BS4mK__m.js → dropdown-menu-BWTWFWGo.js} +1 -1
  87. package/dist/client/assets/{dynamic-plugin-layout-Cn1BTjpz.js → dynamic-plugin-layout-ExZGsuej.js} +1 -1
  88. package/dist/client/assets/{empty-state-Cp1JLYcR.js → empty-state-D4NUg8rC.js} +1 -1
  89. package/dist/client/assets/{empty-state-vCEwHb1v.js → empty-state-DDEvpq3s.js} +1 -1
  90. package/dist/client/assets/{extract-connection-data-16MvAzOh.js → extract-connection-data-CkRoghUt.js} +1 -1
  91. package/dist/client/assets/{features-Dc3bQW1I.js → features-BongOf8c.js} +1 -1
  92. package/dist/client/assets/{file-explorer-CelbZiCq.js → file-explorer-XfexYTEx.js} +1 -1
  93. package/dist/client/assets/{file-type-icon-B3ZaCMP2.js → file-type-icon-BkDt79pr.js} +1 -1
  94. package/dist/client/assets/{files-B5orgVDs.js → files-Bz4E67nD.js} +1 -1
  95. package/dist/client/assets/{form-DsGRrH4I.js → form-DrzcdlAc.js} +1 -1
  96. package/dist/client/assets/{general-DvWuRP0a.js → general-BVm3ASTD.js} +1 -1
  97. package/dist/client/assets/{generate-id-B0UU4AyI.js → generate-id-CGijBPI-.js} +1 -1
  98. package/dist/client/assets/{github-repo-picker-BciViNc8.js → github-repo-picker-BeWTfzSO.js} +1 -1
  99. package/dist/client/assets/{header-tab-button-elaOU0d9.js → header-tab-button-zS78j2W5.js} +1 -1
  100. package/dist/client/assets/{hover-card-DfhDOin0.js → hover-card-B-GHi_m9.js} +1 -1
  101. package/dist/client/assets/{image-field-BIrSC9Gs.js → image-field-BSr72dUp.js} +1 -1
  102. package/dist/client/assets/{index-C8saI2Kn.js → index-BAd8YgC5.js} +21 -21
  103. package/dist/client/assets/{index-D4tq1hPm.js → index-BAj1MLDn.js} +1 -1
  104. package/dist/client/assets/{index-Dupl0DR-.js → index-BawfkDKi.js} +1 -1
  105. package/dist/client/assets/{index-m-rxA9SC.js → index-C8Pyar_y.js} +1 -1
  106. package/dist/client/assets/{index-ChdATVAA.js → index-CATx2LDP.js} +3 -3
  107. package/dist/client/assets/{index-3WWLSqtl.js → index-CFFL2KPG.js} +1 -1
  108. package/dist/client/assets/{index-DgyLJoal.js → index-CYO3Ph9A.js} +1 -1
  109. package/dist/client/assets/{index-L_0VXlrp.js → index-CkRC9R0g.js} +1 -1
  110. package/dist/client/assets/{index-BMSOEHke.js → index-DFVJVQA2.js} +1 -1
  111. package/dist/client/assets/{index-BKFf6V9A.js → index-DaZw25FU.js} +1 -1
  112. package/dist/client/assets/{index-DNM2q8BY.js → index-N4G3Aj63.js} +1 -1
  113. package/dist/client/assets/{index-DLRMbGKZ.js → index-XrBr9Z6q.js} +1 -1
  114. package/dist/client/assets/{index-xNHaP-xT.js → index-ZvvZYF8M.js} +1 -1
  115. package/dist/client/assets/{index-BLEyVrBm.js → index-ixf29u8o.js} +1 -1
  116. package/dist/client/assets/{index-redirect-Cl16_UY5.js → index-redirect-DVr8CNux.js} +1 -1
  117. package/dist/client/assets/{index-CkV2wRTX.js → index-uJwxtRre.js} +1 -1
  118. package/dist/client/assets/{input-BZ-4l6sv.js → input-mRhCdgaG.js} +1 -1
  119. package/dist/client/assets/{integration-icon-LHjd4NGc.js → integration-icon-BT5xGQIC.js} +1 -1
  120. package/dist/client/assets/{label-CGY9toLT.js → label-CfV-PYxa.js} +1 -1
  121. package/dist/client/assets/{layout-C8nv7dxR.js → layout-D1aQgp35.js} +1 -1
  122. package/dist/client/assets/{login-D5x6WUee.js → login-CZLccZp8.js} +1 -1
  123. package/dist/client/assets/{mcp-oauth-BeZ96noC.js → mcp-oauth-CrqBOcGb.js} +1 -1
  124. package/dist/client/assets/{members-0_y-hP8y.js → members-7Zc6z3Rq.js} +1 -1
  125. package/dist/client/assets/{monaco-editor-C8DVCvK_.js → monaco-editor-DEShyEoY.js} +1 -1
  126. package/dist/client/assets/{monitoring-stats-row-Dy60nPc4.js → monitoring-stats-row-BM39sgKM.js} +1 -1
  127. package/dist/client/assets/{oauth-callback-rU6P6YYM.js → oauth-callback-Deog_8B9.js} +1 -1
  128. package/dist/client/assets/{oauth-callback-ai-provider-CQlojnmt.js → oauth-callback-ai-provider-xndj3XhW.js} +1 -1
  129. package/dist/client/assets/{onboarding-BsFG_79R.js → onboarding-CIa5WJ8X.js} +1 -1
  130. package/dist/client/assets/{org-install-CGnSzU4n.js → org-install-BzEXj1P0.js} +1 -1
  131. package/dist/client/assets/{org-layout-ayqAcIyF.js → org-layout-CKQErl_L.js} +1 -1
  132. package/dist/client/assets/{org-plugin-layout-KLX9VenO.js → org-plugin-layout-C8fcylb0.js} +1 -1
  133. package/dist/client/assets/{page-seo-form-DJemjXau.js → page-seo-form-Bsto7oKw.js} +1 -1
  134. package/dist/client/assets/page-seo-sheet-DgBZvqMn.js +1 -0
  135. package/dist/client/assets/{pair-BriGg-MY.js → pair-GelmpgQ4.js} +1 -1
  136. package/dist/client/assets/{plugin-empty-state-CKqj8hWW.js → plugin-empty-state-DmX9NQ0c.js} +1 -1
  137. package/dist/client/assets/{plugin-header-Dg_-PVfV.js → plugin-header-CwlC7555.js} +1 -1
  138. package/dist/client/assets/{plugin-layout-CFCRHuug.js → plugin-layout-DXTE_nWx.js} +1 -1
  139. package/dist/client/assets/{popover-hHdVOt7q.js → popover-Djx3eehK.js} +1 -1
  140. package/dist/client/assets/{post-editor-DZXsYKGZ.js → post-editor-vgnxCwvH.js} +1 -1
  141. package/dist/client/assets/{primitives-CNx5bddX.js → primitives-CzBbBQlZ.js} +1 -1
  142. package/dist/client/assets/{profile-B3k1aQmn.js → profile-CfZAUHfV.js} +1 -1
  143. package/dist/client/assets/project-app-view-CWx732eY.js +1 -0
  144. package/dist/client/assets/record-editor-YgNVDF0i.js +1 -0
  145. package/dist/client/assets/registry-DsHjSNw5.js +2 -0
  146. package/dist/client/assets/{registry-layout-C9QKLcDQ.js → registry-layout-dZaBo1gQ.js} +1 -1
  147. package/dist/client/assets/{require-capability-D5XZoZnS.js → require-capability-BG1IhctK.js} +1 -1
  148. package/dist/client/assets/{required-auth-layout-DhqvkBI0.js → required-auth-layout-BIu6_zGe.js} +1 -1
  149. package/dist/client/assets/{reset-password-D7s0P0GF.js → reset-password-CKpvPCzb.js} +1 -1
  150. package/dist/client/assets/{resizable-BRT-qUaD.js → resizable-Cv_aeq4n.js} +1 -1
  151. package/dist/client/assets/{roles-CPQyhIdH.js → roles-C5F1SkRZ.js} +1 -1
  152. package/dist/client/assets/save-referenced-block-BFfdfLwW.js +1 -0
  153. package/dist/client/assets/{save-status-D1jAW4JE.js → save-status-BBW-EIin.js} +1 -1
  154. package/dist/client/assets/{schema-form-D3MP878L.js → schema-form-e-mnDCXf.js} +1 -1
  155. package/dist/client/assets/{scroll-area-DKNnXldV.js → scroll-area--D79tEKR.js} +1 -1
  156. package/dist/client/assets/{search-input-BQKJCNNI.js → search-input-Bxn-rqNj.js} +1 -1
  157. package/dist/client/assets/{secrets-J5Pwn3p4.js → secrets-ehDiMfv8.js} +1 -1
  158. package/dist/client/assets/{sections-editor-rePIiHP9.js → sections-editor-DYjunrSM.js} +1 -1
  159. package/dist/client/assets/{select-6yI1bUUl.js → select-Cgf1CYEw.js} +1 -1
  160. package/dist/client/assets/{select-model-z3ovXylT.js → select-model-C_VkZ9VQ.js} +1 -1
  161. package/dist/client/assets/{seo-editor--9JZnrI6.js → seo-editor-BNfgWkza.js} +1 -1
  162. package/dist/client/assets/{settings-layout-BKOOm0iL.js → settings-layout-9tbfb6nK.js} +1 -1
  163. package/dist/client/assets/{settings-section-BDeKU196.js → settings-section-DKCuI8RI.js} +1 -1
  164. package/dist/client/assets/{sheet-l2LhhOCY.js → sheet-BBLc_qUy.js} +1 -1
  165. package/dist/client/assets/{shell-controls-BxC6c_cJ.js → shell-controls-CiQQboR4.js} +1 -1
  166. package/dist/client/assets/{shell-layout-DSzgNlpN.js → shell-layout-uIwUEFHm.js} +1 -1
  167. package/dist/client/assets/{shell-route-loading-D-NySFQN.js → shell-route-loading-znYPD3vX.js} +1 -1
  168. package/dist/client/assets/{sidebar-ZxffB9i3.js → sidebar-BuWHGfqc.js} +1 -1
  169. package/dist/client/assets/{skeleton-DsBtdATm.js → skeleton-BRChPnS2.js} +1 -1
  170. package/dist/client/assets/{sortable.esm-B7SCN4Iq.js → sortable.esm-BSN8qWvt.js} +1 -1
  171. package/dist/client/assets/{spinner-DynhmXJb.js → spinner-uDki_7Z8.js} +1 -1
  172. package/dist/client/assets/{sso-Bya3BiB0.js → sso-Bpk5jRgU.js} +1 -1
  173. package/dist/client/assets/{store-C4ZU4zXI.js → store-DUo-qH8F.js} +1 -1
  174. package/dist/client/assets/store-registry-DUOhtiaZ.js +2 -0
  175. package/dist/client/assets/{studio-tools-tx_ynP6E.js → studio-tools-Av8VgprY.js} +1 -1
  176. package/dist/client/assets/{switch-DWpVVt2b.js → switch-BCvTAJSU.js} +1 -1
  177. package/dist/client/assets/{tab-id-CGE8BPr3.js → tab-id-B-5zrrfX.js} +1 -1
  178. package/dist/client/assets/{table-1jrYsVvf.js → table-CoPsT_qq.js} +1 -1
  179. package/dist/client/assets/{tabs-B9aEuz_5.js → tabs-DevQrGCr.js} +1 -1
  180. package/dist/client/assets/{task-status-BgRp2OfZ.js → task-status-DfBkdT3D.js} +1 -1
  181. package/dist/client/assets/{textarea-DbtEiAgf.js → textarea-QDTInyWb.js} +1 -1
  182. package/dist/client/assets/{toggle-group-BCauVBxS.js → toggle-group-BJNcAi1V.js} +1 -1
  183. package/dist/client/assets/{toolbar-C9WpnxRP.js → toolbar-n5eK8Q5W.js} +1 -1
  184. package/dist/client/assets/{tools-list-C-j8gu56.js → tools-list-DRP2WIO_.js} +1 -1
  185. package/dist/client/assets/{tooltip-CVKtA6h7.js → tooltip-1mt0C65x.js} +1 -1
  186. package/dist/client/assets/{types-Bik0zSxz.js → types-C-U3Ts-j.js} +1 -1
  187. package/dist/client/assets/{use-ai-providers-Bf7NstiT.js → use-ai-providers-DrMdym73.js} +1 -1
  188. package/dist/client/assets/{use-automations-DQhoL7n_.js → use-automations-CcLdI8uN.js} +1 -1
  189. package/dist/client/assets/{use-capability-BekxNShN.js → use-capability-Ctju3DPP.js} +1 -1
  190. package/dist/client/assets/{use-clock-tick-CQKT35Lf.js → use-clock-tick-C75wEYcQ.js} +1 -1
  191. package/dist/client/assets/{use-collections-DYulUuYs.js → use-collections-ByNVa1P1.js} +1 -1
  192. package/dist/client/assets/{use-connection-DpR6JQF5.js → use-connection-5fAWFRJ_.js} +1 -1
  193. package/dist/client/assets/{use-copy-BhHE-xFV.js → use-copy-xQaZthc_.js} +1 -1
  194. package/dist/client/assets/{use-create-virtual-mcp-ZidK7zTv.js → use-create-virtual-mcp-K5P4r7gs.js} +1 -1
  195. package/dist/client/assets/{use-debounced-autosave-2ixaaEOx.js → use-debounced-autosave-B6us4Px1.js} +1 -1
  196. package/dist/client/assets/{use-delete-connection-b1BC9mo1.js → use-delete-connection-BRozsEjt.js} +1 -1
  197. package/dist/client/assets/{use-file-configs-CvNjCdnD.js → use-file-configs-nuDPJJdx.js} +1 -1
  198. package/dist/client/assets/{use-infinite-scroll-BfpP7RsP.js → use-infinite-scroll-CzLnKKRE.js} +1 -1
  199. package/dist/client/assets/{use-list-state-BvQ5j7vs.js → use-list-state-DUnsuQSl.js} +1 -1
  200. package/dist/client/assets/{use-mcp-client-DjqC1nd8.js → use-mcp-client-SlmBrgfs.js} +1 -1
  201. package/dist/client/assets/{use-mcp-prompts-Drzzskll.js → use-mcp-prompts-BS6YGKJi.js} +1 -1
  202. package/dist/client/assets/{use-mcp-tools-BUMls37h.js → use-mcp-tools-DJTjDxAS.js} +1 -1
  203. package/dist/client/assets/{use-members-BiyrTP5I.js → use-members-Ceh2no3q.js} +1 -1
  204. package/dist/client/assets/{use-navigate-to-agent-B7_UOyHZ.js → use-navigate-to-agent-CSNmmW1c.js} +1 -1
  205. package/dist/client/assets/{use-org-auth-client-BrG8JDW1.js → use-org-auth-client-CNwi-nzI.js} +1 -1
  206. package/dist/client/assets/{use-org-sso-mx87uCVa.js → use-org-sso-DJ7AQqIg.js} +1 -1
  207. package/dist/client/assets/{use-organization-roles-_Z-_Ox1y.js → use-organization-roles-DMeQF3Y-.js} +1 -1
  208. package/dist/client/assets/{use-organization-settings-BWseGhxw.js → use-organization-settings-D0hAXIi9.js} +1 -1
  209. package/dist/client/assets/{use-registry-connections-BFZcaU10.js → use-registry-connections-CUSj2SXo.js} +1 -1
  210. package/dist/client/assets/{use-secrets-C-XHa3-0.js → use-secrets-BPqsqJsG.js} +1 -1
  211. package/dist/client/assets/{use-status-sounds-D1fVHGXs.js → use-status-sounds-DiIUarno.js} +1 -1
  212. package/dist/client/assets/{use-view-mode-DjLpAg7F.js → use-view-mode-40X1ior9.js} +1 -1
  213. package/dist/client/assets/{use-virtual-mcp-BldCtSoA.js → use-virtual-mcp-CU7uEJL7.js} +1 -1
  214. package/dist/client/assets/useInfiniteQuery-Dj9YLZ3r.js +1 -0
  215. package/dist/client/assets/{useRouterState-BZKGSD2r.js → useRouterState-CFGs8v1R.js} +1 -1
  216. package/dist/client/assets/useSuspenseInfiniteQuery-CACV_JG8.js +1 -0
  217. package/dist/client/assets/{user-Coe1o0e6.js → user-CW9-suBt.js} +1 -1
  218. package/dist/client/assets/{view-mode-toggle-GEdPTd_M.js → view-mode-toggle-CRuQE6Gp.js} +1 -1
  219. package/dist/client/assets/{watch-sse-pool-C_YrQqjE.js → watch-sse-pool-Dk5ELrHR.js} +1 -1
  220. package/dist/client/assets/workflow-detail-DkjxBQfg.js +1 -0
  221. package/dist/client/assets/{workflow-ZbQ4bKoz.js → workflow-yvNNhsP9.js} +1 -1
  222. package/dist/client/index.html +1 -1
  223. package/dist/server/cli.js +345 -344
  224. package/dist/server/server.js +228 -228
  225. package/package.json +1 -1
  226. package/dist/client/assets/app-editor-DOKG-0MP.js +0 -1
  227. package/dist/client/assets/decopilot-sse-pool-CKBDifRl.js +0 -1
  228. package/dist/client/assets/page-seo-sheet-CnqIZbrb.js +0 -1
  229. package/dist/client/assets/project-app-view-B-NllsZl.js +0 -1
  230. package/dist/client/assets/record-editor-DxhzZA73.js +0 -1
  231. package/dist/client/assets/registry-D_rElF24.js +0 -2
  232. package/dist/client/assets/save-referenced-block-VHJ6rXLi.js +0 -1
  233. package/dist/client/assets/store-registry-WPLrtDu9.js +0 -2
  234. package/dist/client/assets/useInfiniteQuery-aPUoKLwo.js +0 -1
  235. package/dist/client/assets/useSuspenseInfiniteQuery-CuHxM8XU.js +0 -1
  236. package/dist/client/assets/workflow-detail-DEuNJrY-.js +0 -1
@@ -1 +1 @@
1
- import{r as $,p as Se,K as re,b8 as dt,m as Re,j as s,c as K,l as fe,B as ne,e as H,P as Pe,aE as Ie,R as se,aG as De,aH as ke,F as $e,G as mt,H as ut,a as Fe,n as he,t as Oe,D as Ke,s as ft,E as ht,f as gt,d as xt}from"./index-ChdATVAA.js";import{u as pt}from"./use-organization-roles-_Z-_Ox1y.js";import{u as je}from"./use-org-auth-client-BrG8JDW1.js";import{B as ge}from"./badge-Ckvq5EMT.js";import{A as Qe,a as He,b as qe,c as Ze,d as Xe,f as Je,e as We,g as et}from"./alert-dialog-DAZnJbEa.js";import{D as bt,a as Et,b as Tt,c as _t}from"./dropdown-menu-BS4mK__m.js";import{i as It}from"./DotsVertical-DQMFAww2.js";import{s as Ae}from"./Plus-D-k489Hw.js";import{s as St}from"./Trash01-Br13J6pg.js";import{C as Nt}from"./collection-table-wrapper-Wg4_kRAB.js";import{P as te}from"./index-Dupl0DR-.js";import{E as Ge}from"./empty-state-vCEwHb1v.js";import{S as ve}from"./search-input-BQKJCNNI.js";import{P as tt,D as st}from"./ai-providers-logos-DD3qZ33J.js";import{I as ye}from"./integration-icon-LHjd4NGc.js";import{u as Ct}from"./use-infinite-scroll-BfpP7RsP.js";import{C as we}from"./checkbox-Eb0jgSAR.js";import{i as At}from"./RefreshCcw01-0Z7TeT1O.js";import{u as Rt}from"./useSuspenseInfiniteQuery-CuHxM8XU.js";import{u as Ot,a as jt}from"./use-mcp-client-DjqC1nd8.js";import{C as vt}from"./collection-search-q3LrsDP0.js";import{u as nt}from"./use-members-BiyrTP5I.js";import{u as yt}from"./use-connection-DpR6JQF5.js";import{u as wt,d as Lt}from"./use-ai-providers-Bf7NstiT.js";import{A as lt}from"./avatar-DgWkRz32.js";import{S as xe}from"./switch-DWpVVt2b.js";import{c as pe,b as be,T as Ee,a as Te}from"./tooltip-CVKtA6h7.js";import{S as Ue,a as Be,b as Ve}from"./settings-section-BDeKU196.js";import{t as Mt}from"./ChevronDown-BIO7wba7.js";import{i as Pt}from"./ChevronRight-CwhL8zaw.js";import{i as ze}from"./X-DcDNiBgo.js";import{a as Dt}from"./use-capability-BekxNShN.js";import{A as kt}from"./access-gate-B7iLwSTn.js";import"./Check-BmF1hQRY.js";import"./table-1jrYsVvf.js";import"./SwitchHorizontal01-BRvArA9H.js";import"./sidebar-ZxffB9i3.js";import"./LayoutLeft-C3u21iqS.js";import"./sheet-l2LhhOCY.js";import"./SearchMd-BdcI0VcO.js";import"./Container-Dyf0TzBH.js";import"./agent-icon-MPxc_53p.js";import"./AlertCircle-BU9gj1Zb.js";import"./Tool01-yFL5Dn59.js";import"./XCircle-e29W-Gcn.js";import"./ArrowUpRight-D2O4sQl3.js";import"./ZapSquare-CvMxvmoA.js";import"./Users03-CmfKEZdY.js";import"./CheckCircle-C4XwcfjN.js";import"./ChevronLeft-CW2G6JyB.js";import"./ChevronUp-DdLEv_cl.js";import"./Eye-Bi1ejTfS.js";import"./ZoomOut-m5WCE6Ow.js";import"./Globe01-DF9PUq9k.js";import"./FilterLines-jWyOgIfr.js";import"./Star01-Du_V1z61.js";import"./Palette-CvjTgNao.js";import"./HardDrive-BIzpSh2R.js";import"./Stars02-CpPe-VPg.js";import"./Key01-DJaxTkjl.js";import"./LinkExternal01-D7mXn_q6.js";import"./Monitor01-B2V0QJVA.js";import"./Sun-C3Zhz8pG.js";import"./Play-6yxi-kVu.js";import"./Settings02-C6hr8Qy9.js";import"./Shield01-DOB3vgca.js";import"./Stars01-BAC8f8eM.js";import"./Upload01-D4q_2hTt.js";import"./User01-BtejVxVG.js";import"./Users01-Dy4pn4ki.js";import"./XClose-D4RzaaY5.js";import"./Zap-Cp6OTaVi.js";import"./auth-Rhn0UUKX.js";import"./use-collections-DYulUuYs.js";import"./card-DV2a7ud0.js";import"./capability-load-error-DGtjMdu6.js";const Le="basic-usage",Me=[{id:Le,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"]},{id:"org:manage",label:"Manage organization",description:"Edit organization settings, brand context, and domain configuration",section:"Organization",tools:["ORGANIZATION_GET","ORGANIZATION_LIST","ORGANIZATION_UPDATE","ORGANIZATION_SETTINGS_GET","ORGANIZATION_SETTINGS_UPDATE","BRAND_CONTEXT_LIST","BRAND_CONTEXT_GET","BRAND_CONTEXT_CREATE","BRAND_CONTEXT_UPDATE","BRAND_CONTEXT_DELETE","BRAND_CONTEXT_EXTRACT","BRAND_GET","BRAND_LIST","ORGANIZATION_DOMAIN_GET","ORGANIZATION_DOMAIN_SET","ORGANIZATION_DOMAIN_UPDATE","ORGANIZATION_DOMAIN_CLEAR"]},{id:"members:manage",label:"Manage members",description:"Invite members, remove them, and change their roles",section:"Organization",tools:["ORGANIZATION_MEMBER_LIST","ORGANIZATION_MEMBER_ADD","ORGANIZATION_MEMBER_REMOVE","ORGANIZATION_MEMBER_UPDATE_ROLE"],dangerous:!0},{id:"connections:manage",label:"Manage connections",description:"Create, update, and delete connections",section:"Connections & Agents",tools:["COLLECTION_CONNECTIONS_CREATE","COLLECTION_CONNECTIONS_UPDATE","COLLECTION_CONNECTIONS_DELETE"],dangerous:!0},{id:"agents:manage",label:"Manage agents",description:"Create, configure, and delete agents",section:"Connections & Agents",tools:["COLLECTION_VIRTUAL_MCP_CREATE","COLLECTION_VIRTUAL_MCP_UPDATE","COLLECTION_VIRTUAL_MCP_DELETE","VIRTUAL_MCP_PLUGIN_CONFIG_UPDATE","VIRTUAL_MCP_PINNED_VIEWS_UPDATE"],dangerous:!0},{id:"automations:manage",label:"Manage automations",description:"Create, update, run, and delete automations",section:"Automations",tools:["AUTOMATION_CREATE","AUTOMATION_UPDATE","AUTOMATION_DELETE","AUTOMATION_TRIGGER_ADD","AUTOMATION_TRIGGER_REMOVE","AUTOMATION_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","REGISTRY_MONITOR_SCHEDULE_SET","REGISTRY_MONITOR_SCHEDULE_CANCEL"]},{id:"api-keys:manage",label:"Manage API keys",description:"Create, update, and revoke API keys",section:"Developer",tools:["API_KEY_CREATE","API_KEY_LIST","API_KEY_UPDATE","API_KEY_DELETE"]},{id:"event-bus:use",label:"Use event bus",description:"Publish events and manage subscriptions",section:"Developer",tools:["EVENT_PUBLISH","EVENT_SUBSCRIBE","EVENT_UNSUBSCRIBE","EVENT_CANCEL","EVENT_ACK","EVENT_SUBSCRIPTION_LIST","EVENT_SYNC_SUBSCRIPTIONS"]},{id:"storage:delete",label:"Delete from storage",description:"Permanently delete files from object storage",section:"Developer",tools:["DELETE_OBJECT","DELETE_OBJECTS"],dangerous:!0},{id:"connections:sql",label:"Run SQL queries",description:"Execute raw SQL against connected databases",section:"Developer",tools:["DATABASES_RUN_SQL"],dangerous:!0}];[...Me.find(t=>t.id===Le)?.tools??[]];const Gt=["agents:manage","connections:manage"];new Set(Me.filter(t=>Gt.includes(t.id)).flatMap(t=>t.tools));function Ut(){const t=new Map;for(const e of Me){if(e.id===Le)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=H.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 S;return e[17]!==f||e[18]!==o||e[19]!==m?(S=s.jsxs("div",{className:f,children:[o,m]}),e[17]=f,e[18]=o,e[19]=m,e[20]=S):S=e[20],S}function Yt(t){return t.stopPropagation()}function $t(t){const e=H.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}=Se(),m=Ot({connectionId:jt,orgId:o.id,orgSlug:o.slug}),S=100,T=h.trim(),E=T?{operator:"or",conditions:[{field:["title"],operator:"contains",value:T},{field:["description"],operator:"contains",value:T}]}:void 0,N=!!n,C={...E&&{where:E},orderBy:[{field:["updated_at"],direction:"asc"}],limit:S,offset:0,...N&&{include_virtual:!0}},v=JSON.stringify(C),{data:_,fetchNextPage:R,hasNextPage:p,isFetchingNextPage:O}=Rt({queryKey:re.collectionListInfinite(m,o.id,"","CONNECTIONS",v),queryFn:async({pageParam:b=0})=>(await m.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...E&&{where:E},orderBy:[{field:["updated_at"],direction:"asc"}],limit:S,offset:b,...N&&{include_virtual:!0}}})).structuredContent,initialPageParam:0,getNextPageParam:(b,D)=>{if(b?.hasMore)return D.reduce((Q,q)=>Q+(q?.items?.length??0),0)},staleTime:3e4}),I=_?.pages.flatMap(b=>b?.items??[])??[],j=Ct(R,p??!1,O),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}),[L,z]=$.useState(G[0]?.id??null),y=L?G.find(b=>b.id===L)??null:null,{data:M,isFetching:Y}=Re({queryKey:re.collectionItem(m,o.id,"","CONNECTIONS",L??""),queryFn:async()=>L?(await m.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:L}})).structuredContent?.item??null:null,enabled:!!L,staleTime:3e4}),F=M?.tools??[],X=(b,D)=>t[b]?.includes(D)??!1,J=(b,D)=>{const Q=t[b]??[],q=Q.includes(D),W={...t};if(q){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===L?F:[];if(!D.length)return;const Q=t[b]??[],q=D.map(ee=>ee.name),W=Q.length>0&&q.every(ee=>Q.includes(ee)),Z={...t};W?delete Z[b]:(Z[b]=q,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=L===b.id,Q=D?F.length:0,q=t[b.id]?.length??0;return s.jsx(zt,{connection:{...b,tools:D?F:b.tools},isSelected:D,hasToolsEnabled:U(b.id),activeToolsCount:q,totalToolsCount:Q,onSelect:()=>oe(b.id),onToggle:()=>le(b.id)},b.id)}),s.jsx("div",{ref:j,className:"h-4"}),O&&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 Ne=["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 Ht(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)%Ne.length;return Ne[n]??Ne[0]}function qt(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(Ee,{asChild:!0,children:s.jsx("div",{children:l})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):l}function Xt(t){const e=H.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 R=x.flatMap(es).flatMap(Wt);i(!1),r(R.filter(p=>!v.tools.includes(p)));return}n||r(Vt(v,l,!_))}};let m;e[10]!==f?(m=v=>{const{section:_,capabilities:R}=v;return{section:_,capabilities:R.filter(p=>!f||p.label.toLowerCase().includes(f)||p.description.toLowerCase().includes(f))}},e[10]=f,e[11]=m):m=e[11];const S=x.map(m).filter(Jt);let T;e[12]!==n||e[13]!==i||e[14]!==r?(T=()=>{i(!n),r([])},e[12]=n,e[13]=i,e[14]=r,e[15]=T):T=e[15];let E;e[16]!==n||e[17]!==c||e[18]!==T?(E=Ye(n,c,T),e[16]=n,e[17]=c,e[18]=T,e[19]=E):E=e[19];let N;e[20]!==n||e[21]!==i||e[22]!==r||e[23]!==c?(N=c?void 0:()=>{i(!n),r([])},e[20]=n,e[21]=i,e[22]=r,e[23]=c,e[24]=N):N=e[24];let C;e[25]!==E||e[26]!==N?(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:E,onClick:N})})}),e[25]=E,e[26]=N,e[27]=C):C=e[27],a=s.jsx("div",{children:s.jsxs("div",{className:"flex flex-col gap-10 py-4",children:[C,S.length===0&&f?s.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:["No permissions match “",h,"”"]}):S.map(v=>{const{section:_,capabilities:R}=v;return s.jsx(Ue,{title:_,children:s.jsx(Be,{children:R.map(p=>{const O=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(O,c,()=>o(p,O)),onClick:c?void 0:()=>o(p,O)},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=H.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,[S,T]=$.useState(m),E=m||S,N=T,[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 R=_;let p;if(e[4]!==R||e[5]!==d){let j;e[7]!==R?(j=u=>R(u.id),e[7]=R,e[8]=j):j=e[8],p=d.filter(j),e[4]=R,e[5]=d,e[6]=p}else p=e[6];const O=p.length;let I;if(e[9]!==h||e[10]!==g||e[11]!==n||e[12]!==O||e[13]!==E||e[14]!==r||e[15]!==R||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=()=>N(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]!==O||e[34]!==d.length?(B=s.jsxs(ge,{variant:"secondary",className:"text-xs text-muted-foreground",children:[O,"/",d.length," enabled"]}),e[33]=O,e[34]=d.length,e[35]=B):B=e[35];let L;e[36]!==E?(L=E?s.jsx(Mt,{size:16,className:"text-muted-foreground shrink-0"}):s.jsx(Pt,{size:16,className:"text-muted-foreground shrink-0"}),e[36]=E,e[37]=L):L=e[37];let z;e[38]!==L||e[39]!==B?(z=s.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[B,L]}),e[38]=L,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,E&&s.jsxs("div",{className:"border-t border-border bg-muted/20",children:[j.map(M=>{const Y=R(M.id),F=()=>{if(!o){if(g){x(n,h,M.id);return}a(n,M.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:M.title})}),s.jsx("div",{onClick:as,children:o?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:Y,disabled:!0,onCheckedChange:rs})})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(xe,{checked:Y,onCheckedChange:F})})]},M.id)}),u&&s.jsxs("button",{type:"button",className:"w-full px-4 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors",onClick:()=>v(is),children:["Show more (",d.length-C," remaining)"]})]})]}),e[9]=h,e[10]=g,e[11]=n,e[12]=O,e[13]=E,e[14]=r,e[15]=R,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=H.c(33),{connection:n,selectedModels:l,allowAllModels:i,onToggleModel:r,onExitAllowAll:d,allConnectionModelsSelected:h,searchQuery:c,readOnly:g}=t,f=Lt(n.id);let a,x,o,m,S;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){S=Symbol.for("react.early_return_sentinel");e:{let N;e[16]!==n.label?(N=A=>({...A,id:A.modelId,provider:n.label}),e[16]=n.label,e[17]=N):N=e[17];const C=f.filter(hs).map(N),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){S=null;break e}const R=new Map;for(const A of _){const k=ss(A.id,n.providerId),G=R.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),R.set(k,G)}const p=Array.from(R.entries()).map(fs).sort(us),O=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:O},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]=S}else a=e[11],x=e[12],o=e[13],m=e[14],S=e[15];if(S!==Symbol.for("react.early_return_sentinel"))return S;let T;e[26]!==a||e[27]!==x?(T=s.jsx("div",{className:a,children:x}),e[26]=a,e[27]=x,e[28]=T):T=e[28];let E;return e[29]!==o||e[30]!==m||e[31]!==T?(E=s.jsxs("div",{className:o,children:[m,T]}),e[29]=o,e[30]=m,e[31]=T,e[32]=E):E=e[32],E}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=H.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,O)=>{const I=l[p]??[],j={...l};if(I.includes(O)){const u=I.filter(w=>w!==O);u.length===0?delete j[p]:j[p]=u}else j[p]=[...I,O];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,O,I)=>{i(!1),r({...l,[p]:O.filter(j=>j!==I)})},e[3]=l,e[4]=i,e[5]=r,e[6]=o):o=e[6];const m=o,S=!c&&"hover:bg-muted/50 cursor-pointer";let T;e[7]!==S?(T=K("flex items-center justify-between px-4 py-3 rounded-lg border border-border bg-card",S),e[7]=S,e[8]=T):T=e[8];let E;e[9]!==n||e[10]!==i||e[11]!==r||e[12]!==c?(E=()=>{if(c)return;const p=!n;i(p),p&&r({})},e[9]=n,e[10]=i,e[11]=r,e[12]=c,e[13]=E):E=e[13];let N;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[14]=N):N=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(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:n,disabled:!0,onCheckedChange:xs})})}),s.jsx(Te,{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]!==T||e[21]!==E||e[22]!==C?(v=s.jsxs("div",{className:T,onClick:E,children:[N,C]}),e[20]=T,e[21]=E,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 R;return e[32]!==_||e[33]!==v?(R=s.jsxs("div",{className:"flex flex-col h-full overflow-auto gap-6 pb-6",children:[v,_]}),e[32]=_,e[33]=v,e[34]=R):R=e[34],R}function xs(){}function ps(t){return t.stopPropagation()}function bs(t){const e=H.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,S,T,E,N,C,v,_,R,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 M=c.toLowerCase();return y.user?.name?.toLowerCase().includes(M)||y.user?.email?.toLowerCase().includes(M)},e[20]=c,e[21]=B):B=e[21];const L=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],S=z,m=Qe,R=n,p=l,o=He,v="sm:max-w-md p-0",e[26]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsxs(qe,{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],N="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],T="flex-1 overflow-auto",E=L.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:L.map(y=>{const M=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",!M||Y?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(we,{checked:F||Y,onCheckedChange:()=>{!M||Y||a(X=>X.includes(y.id)?X.filter(J=>J!==y.id):[...X,y.id])},disabled:!M||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})]}),!M&&s.jsx(ge,{variant:"secondary",className:"shrink-0",children:"Owner"}),Y&&M&&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]=S,e[12]=T,e[13]=E,e[14]=N,e[15]=C,e[16]=v,e[17]=_,e[18]=R,e[19]=p}else o=e[9],m=e[10],S=e[11],T=e[12],E=e[13],N=e[14],C=e[15],v=e[16],_=e[17],R=e[18],p=e[19];let O;e[29]!==T||e[30]!==E?(O=s.jsx("div",{className:T,children:E}),e[29]=T,e[30]=E,e[31]=O):O=e[31];let I;e[32]!==O||e[33]!==N||e[34]!==C?(I=s.jsxs("div",{className:N,children:[C,O]}),e[32]=O,e[33]=N,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]!==S||e[38]!==u||e[39]!==w?(A=s.jsxs(We,{className:"px-6 pb-6",children:[j,s.jsxs(et,{onClick:S,disabled:u,children:["Add ",w]})]}),e[37]=S,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]!==R||e[50]!==p?(G=s.jsx(m,{open:R,onOpenChange:p,children:k}),e[47]=m,e[48]=k,e[49]=R,e[50]=p,e[51]=G):G=e[51],G}function Es(t){const e=H.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,S;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 R=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 O=R.filter(p);S="flex flex-col h-full",o="flex-1 overflow-auto",m=R.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h3",{className:"text-base font-medium mb-1",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to grant them the configured permissions."})]})}):O.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:O.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(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(ne,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(ze,{size:16})})})}),s.jsx(Te,{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]=S}else o=e[7],m=e[8],S=e[9];let T;e[14]!==o||e[15]!==m?(T=s.jsx("div",{className:o,children:m}),e[14]=o,e[15]=m,e[16]=T):T=e[16];let E;e[17]!==n||e[18]!==l?(E=v=>l([...n,...v]),e[17]=n,e[18]=l,e[19]=E):E=e[19];let N;e[20]!==h||e[21]!==n||e[22]!==c||e[23]!==E?(N=s.jsx(bs,{open:h,onOpenChange:c,selectedMemberIds:n,onAddMembers:E}),e[20]=h,e[21]=n,e[22]=c,e[23]=E,e[24]=N):N=e[24];let C;return e[25]!==S||e[26]!==T||e[27]!==N?(C=s.jsxs("div",{className:S,children:[T,N]}),e[25]=S,e[26]=T,e[27]=N,e[28]=C):C=e[28],C}function Ts(t){const e=H.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(Es,{...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 Ss(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 Ns(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"?Ss(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=H.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(Ee,{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(Te,{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 Rs(t){const e=H.c(14),{locator:n}=Se(),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}=Re(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(Os,{...t,members:a,connections:i}),e[10]=i,e[11]=a,e[12]=t,e[13]=x):x=e[13],x}function Os({target:t,onBack:e,onSaved:n,members:l,connections:i}){const{locator:r}=Se(),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,S=o.formState.isDirty,T=Fe({mutationFn:async u=>{const w=Ns(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 L=l.filter(M=>M.role===(B??U)).map(M=>M.id),z=u.memberIds.filter(M=>!L.includes(M)),y=L.filter(M=>!u.memberIds.includes(M));for(const M of z){const Y=await d.organization.updateMemberRole({memberId:M,role:[U]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}for(const M of y){const Y=await d.organization.updateMemberRole({memberId:M,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,L=U!==B,z=await d.organization.updateRole({roleId:u.role.id,data:{permission:w,...L?{roleName:U}:{}}});if(z?.error)throw new Error(z.error.message??"Something went wrong");return await G(L?U:B,L?B:void 0),L?{...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 L=await d.organization.updateMemberRole({memberId:B,role:[A]});if(L?.error)throw new Error(L.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;Oe(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")}}),E=o.handleSubmit(u=>{if(!u.role.label.trim()){he.error("Role name is required"),o.setFocus("role.label");return}T.mutate(u)}),N=!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"}],[_,R]=$.useState(""),[p,O]=$.useState(!1),I=u=>{x(u),R("")},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:N&&s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"outline",size:"sm",onClick:e,disabled:T.isPending,children:"Cancel"}),s.jsx(ne,{size:"sm",onClick:E,disabled:T.isPending||!m||!S,children:T.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"?qt(t.role):Ht(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:R,placeholder:j[a]??"Search...",className:"w-full md:w-[375px]"}),a==="members"&&s.jsx(As,{readOnly:t.kind==="builtin"&&t.role==="owner",onOpen:()=>O(!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(Ts,{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:O})]})})]})})}function js(t){return t.kind==="builtin"?`builtin-${t.role}`:t.kind==="custom"?`custom-${t.role.id}`:"new"}function vs(t){const e=H.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 Ls={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Ms(t,e){return e?Ls[t]??"bg-neutral-400":ws(t)}function Ps(){const t=H.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}=Se(),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 S;e:{if(!h){S=null;break e}if(h==="new"){S={kind:"new"};break e}if(h.startsWith("builtin-")){S={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);S=V?{kind:"custom",role:V}:null}const T=S;let E;t[5]!==c?(E=re.members(c),t[5]=c,t[6]=E):E=t[6];let N;t[7]!==g?(N=()=>g.organization.listMembers(),t[7]=g,t[8]=N):N=t[8];let C;t[9]!==E||t[10]!==N?(C={queryKey:E,queryFn:N},t[9]=E,t[10]=N,t[11]=C):C=t[11];const{data:v}=Re(C);let _;t[12]!==v?.data?.members?(_=v?.data?.members??[],t[12]=v?.data?.members,t[13]=_):_=t[13];const R=_;let p;t[14]!==R?(p=P=>R.filter(V=>V.role===P).length,t[14]=R,t[15]=p):p=t[15];const O=p;let I;if(t[16]!==a||t[17]!==O||t[18]!==e){let P;t[20]!==O?(P=ce=>({kind:"builtin",role:{...ce,memberCount:O(ce.role)}}),t[20]=O,t[21]=P):P=t[21];const V=ys.map(P);let ae;t[22]!==O?(ae=ce=>({kind:"custom",role:{...ce,memberCount:O(ce.role)}}),t[22]=O,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]=O,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)=>{Oe("role_deleted",{role_id:V}),f.invalidateQueries({queryKey:re.members(c)}),f.invalidateQueries({queryKey:re.organizationRoles(c)}),he.success("Role deleted successfully!"),x(),T?.kind==="custom"&&T.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(bt,{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(It,{size:16})})}),s.jsx(Tt,{align:"end",onClick:Ds,children:s.jsxs(_t,{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 L;t[31]!==m?(L=P=>{if(P.kind==="builtin")m(`builtin-${P.role.role}`);else{const V=P.role;m(V.id)}},t[31]=m,t[32]=L):L=t[32];const z=L;if(T){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(Rs,{target:T,onBack:P,onSaved:V},js(T))}let y;t[38]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(te.Title,{children:"Roles"}),t[38]=y):y=t[38];let M;t[39]===Symbol.for("react.memo_cache_sentinel")?(M=P=>{P.key==="Escape"&&(n(""),P.target.blur())},t[39]=M):M=t[39];let Y;t[40]!==e?(Y=s.jsx(ve,{value:e,onChange:n,placeholder:"Search roles...",className:"w-full md:w-[375px]",onKeyDown:M}),t[40]=e,t[41]=Y):Y=t[41];let 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(Nt,{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 q;t[61]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx(Ze,{children:"Delete Role"}),t[61]=q):q=t[61];const W=l?.label;let Z;t[62]!==W?(Z=s.jsxs(qe,{children:[q,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(He,{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",Ms(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){Oe("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=H.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 fl(){const t=H.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{fl as default};
1
+ import{r as $,p as Se,K as re,b8 as dt,m as Re,j as s,c as K,l as fe,B as ne,e as H,P as Pe,aE as Ie,R as se,aG as De,aH as ke,F as $e,G as mt,H as ut,a as Fe,n as he,t as Oe,D as Ke,s as ft,E as ht,f as gt,d as xt}from"./index-CATx2LDP.js";import{u as pt}from"./use-organization-roles-DMeQF3Y-.js";import{u as je}from"./use-org-auth-client-CNwi-nzI.js";import{B as ge}from"./badge-B4Q3Kugn.js";import{A as Qe,a as He,b as qe,c as Ze,d as Xe,f as Je,e as We,g as et}from"./alert-dialog-DH_8ED2c.js";import{D as bt,a as Et,b as Tt,c as _t}from"./dropdown-menu-BWTWFWGo.js";import{i as It}from"./DotsVertical-BJVJdITZ.js";import{s as Ae}from"./Plus-C5heVoJ6.js";import{s as St}from"./Trash01-DM00_xyO.js";import{C as Nt}from"./collection-table-wrapper-BpQMr64m.js";import{P as te}from"./index-BawfkDKi.js";import{E as Ge}from"./empty-state-DDEvpq3s.js";import{S as ve}from"./search-input-Bxn-rqNj.js";import{P as tt,D as st}from"./ai-providers-logos-DD3qZ33J.js";import{I as ye}from"./integration-icon-BT5xGQIC.js";import{u as Ct}from"./use-infinite-scroll-CzLnKKRE.js";import{C as we}from"./checkbox-CHqLn2TQ.js";import{i as At}from"./RefreshCcw01-BZry-3Kg.js";import{u as Rt}from"./useSuspenseInfiniteQuery-CACV_JG8.js";import{u as Ot,a as jt}from"./use-mcp-client-SlmBrgfs.js";import{C as vt}from"./collection-search-BJmgl3qg.js";import{u as nt}from"./use-members-Ceh2no3q.js";import{u as yt}from"./use-connection-5fAWFRJ_.js";import{u as wt,d as Lt}from"./use-ai-providers-DrMdym73.js";import{A as lt}from"./avatar-D47Jk04K.js";import{S as xe}from"./switch-BCvTAJSU.js";import{c as pe,b as be,T as Ee,a as Te}from"./tooltip-1mt0C65x.js";import{S as Ue,a as Be,b as Ve}from"./settings-section-DKCuI8RI.js";import{t as Mt}from"./ChevronDown-2xes5oAP.js";import{i as Pt}from"./ChevronRight-BAb1spam.js";import{i as ze}from"./X-C_bQSA-d.js";import{a as Dt}from"./use-capability-Ctju3DPP.js";import{A as kt}from"./access-gate-DR6xMqvH.js";import"./Check-g3DB8Y79.js";import"./table-CoPsT_qq.js";import"./SwitchHorizontal01-CUtzfg9y.js";import"./sidebar-BuWHGfqc.js";import"./LayoutLeft-DFTfTIl4.js";import"./sheet-BBLc_qUy.js";import"./SearchMd-qFqO3CC6.js";import"./Container-SX43EreL.js";import"./agent-icon-BIiUgn6T.js";import"./AlertCircle-CHkhp8BT.js";import"./Tool01-IpmKT80v.js";import"./XCircle-D9AGwgGK.js";import"./ArrowUpRight-BLDnDQA4.js";import"./ZapSquare-CJ6AZAbk.js";import"./Users03-1mzpWPfB.js";import"./CheckCircle-CaqJ0h8v.js";import"./ChevronLeft-DoZaWCdC.js";import"./ChevronUp-D1fwNmdw.js";import"./Eye-B6_-sQMR.js";import"./ZoomOut-B2ojfl-A.js";import"./Globe01-BaaIcJuv.js";import"./FilterLines-Bppcas54.js";import"./Star01-2SOe9QD-.js";import"./Palette-VBLL4nJC.js";import"./HardDrive-DCOTq5uv.js";import"./Stars02-CEd2BxY_.js";import"./Key01-WyguyLzq.js";import"./LinkExternal01-C4yAqYts.js";import"./Monitor01-rl2bcoeM.js";import"./Sun-jizGeY2D.js";import"./Play-Cjs1Q-Aw.js";import"./Settings02-CLIbq_7z.js";import"./Shield01-Bo6JmLSx.js";import"./Stars01-C-iKmdEF.js";import"./Upload01-D0E7TXXq.js";import"./User01-ga9dWIix.js";import"./Users01-lGeZPP0U.js";import"./XClose-dBx0FEAe.js";import"./Zap-BJCyzigO.js";import"./auth-DMsnFrvi.js";import"./use-collections-ByNVa1P1.js";import"./card-LUxcXBOp.js";import"./capability-load-error-CXdwr2J6.js";const Le="basic-usage",Me=[{id:Le,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"]},{id:"org:manage",label:"Manage organization",description:"Edit organization settings, brand context, and domain configuration",section:"Organization",tools:["ORGANIZATION_GET","ORGANIZATION_LIST","ORGANIZATION_UPDATE","ORGANIZATION_SETTINGS_GET","ORGANIZATION_SETTINGS_UPDATE","BRAND_CONTEXT_LIST","BRAND_CONTEXT_GET","BRAND_CONTEXT_CREATE","BRAND_CONTEXT_UPDATE","BRAND_CONTEXT_DELETE","BRAND_CONTEXT_EXTRACT","BRAND_GET","BRAND_LIST","ORGANIZATION_DOMAIN_GET","ORGANIZATION_DOMAIN_SET","ORGANIZATION_DOMAIN_UPDATE","ORGANIZATION_DOMAIN_CLEAR"]},{id:"members:manage",label:"Manage members",description:"Invite members, remove them, and change their roles",section:"Organization",tools:["ORGANIZATION_MEMBER_LIST","ORGANIZATION_MEMBER_ADD","ORGANIZATION_MEMBER_REMOVE","ORGANIZATION_MEMBER_UPDATE_ROLE"],dangerous:!0},{id:"connections:manage",label:"Manage connections",description:"Create, update, and delete connections",section:"Connections & Agents",tools:["COLLECTION_CONNECTIONS_CREATE","COLLECTION_CONNECTIONS_UPDATE","COLLECTION_CONNECTIONS_DELETE"],dangerous:!0},{id:"agents:manage",label:"Manage agents",description:"Create, configure, and delete agents",section:"Connections & Agents",tools:["COLLECTION_VIRTUAL_MCP_CREATE","COLLECTION_VIRTUAL_MCP_UPDATE","COLLECTION_VIRTUAL_MCP_DELETE","VIRTUAL_MCP_PLUGIN_CONFIG_UPDATE","VIRTUAL_MCP_PINNED_VIEWS_UPDATE"],dangerous:!0},{id:"automations:manage",label:"Manage automations",description:"Create, update, run, and delete automations",section:"Automations",tools:["AUTOMATION_CREATE","AUTOMATION_UPDATE","AUTOMATION_DELETE","AUTOMATION_TRIGGER_ADD","AUTOMATION_TRIGGER_REMOVE","AUTOMATION_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","REGISTRY_MONITOR_SCHEDULE_SET","REGISTRY_MONITOR_SCHEDULE_CANCEL"]},{id:"api-keys:manage",label:"Manage API keys",description:"Create, update, and revoke API keys",section:"Developer",tools:["API_KEY_CREATE","API_KEY_LIST","API_KEY_UPDATE","API_KEY_DELETE"]},{id:"event-bus:use",label:"Use event bus",description:"Publish events and manage subscriptions",section:"Developer",tools:["EVENT_PUBLISH","EVENT_SUBSCRIBE","EVENT_UNSUBSCRIBE","EVENT_CANCEL","EVENT_ACK","EVENT_SUBSCRIPTION_LIST","EVENT_SYNC_SUBSCRIPTIONS"]},{id:"storage:delete",label:"Delete from storage",description:"Permanently delete files from object storage",section:"Developer",tools:["DELETE_OBJECT","DELETE_OBJECTS"],dangerous:!0},{id:"connections:sql",label:"Run SQL queries",description:"Execute raw SQL against connected databases",section:"Developer",tools:["DATABASES_RUN_SQL"],dangerous:!0}];[...Me.find(t=>t.id===Le)?.tools??[]];const Gt=["agents:manage","connections:manage"];new Set(Me.filter(t=>Gt.includes(t.id)).flatMap(t=>t.tools));function Ut(){const t=new Map;for(const e of Me){if(e.id===Le)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=H.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 S;return e[17]!==f||e[18]!==o||e[19]!==m?(S=s.jsxs("div",{className:f,children:[o,m]}),e[17]=f,e[18]=o,e[19]=m,e[20]=S):S=e[20],S}function Yt(t){return t.stopPropagation()}function $t(t){const e=H.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}=Se(),m=Ot({connectionId:jt,orgId:o.id,orgSlug:o.slug}),S=100,T=h.trim(),E=T?{operator:"or",conditions:[{field:["title"],operator:"contains",value:T},{field:["description"],operator:"contains",value:T}]}:void 0,N=!!n,C={...E&&{where:E},orderBy:[{field:["updated_at"],direction:"asc"}],limit:S,offset:0,...N&&{include_virtual:!0}},v=JSON.stringify(C),{data:_,fetchNextPage:R,hasNextPage:p,isFetchingNextPage:O}=Rt({queryKey:re.collectionListInfinite(m,o.id,"","CONNECTIONS",v),queryFn:async({pageParam:b=0})=>(await m.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...E&&{where:E},orderBy:[{field:["updated_at"],direction:"asc"}],limit:S,offset:b,...N&&{include_virtual:!0}}})).structuredContent,initialPageParam:0,getNextPageParam:(b,D)=>{if(b?.hasMore)return D.reduce((Q,q)=>Q+(q?.items?.length??0),0)},staleTime:3e4}),I=_?.pages.flatMap(b=>b?.items??[])??[],j=Ct(R,p??!1,O),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}),[L,z]=$.useState(G[0]?.id??null),y=L?G.find(b=>b.id===L)??null:null,{data:M,isFetching:Y}=Re({queryKey:re.collectionItem(m,o.id,"","CONNECTIONS",L??""),queryFn:async()=>L?(await m.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:L}})).structuredContent?.item??null:null,enabled:!!L,staleTime:3e4}),F=M?.tools??[],X=(b,D)=>t[b]?.includes(D)??!1,J=(b,D)=>{const Q=t[b]??[],q=Q.includes(D),W={...t};if(q){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===L?F:[];if(!D.length)return;const Q=t[b]??[],q=D.map(ee=>ee.name),W=Q.length>0&&q.every(ee=>Q.includes(ee)),Z={...t};W?delete Z[b]:(Z[b]=q,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=L===b.id,Q=D?F.length:0,q=t[b.id]?.length??0;return s.jsx(zt,{connection:{...b,tools:D?F:b.tools},isSelected:D,hasToolsEnabled:U(b.id),activeToolsCount:q,totalToolsCount:Q,onSelect:()=>oe(b.id),onToggle:()=>le(b.id)},b.id)}),s.jsx("div",{ref:j,className:"h-4"}),O&&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 Ne=["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 Ht(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)%Ne.length;return Ne[n]??Ne[0]}function qt(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(Ee,{asChild:!0,children:s.jsx("div",{children:l})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):l}function Xt(t){const e=H.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 R=x.flatMap(es).flatMap(Wt);i(!1),r(R.filter(p=>!v.tools.includes(p)));return}n||r(Vt(v,l,!_))}};let m;e[10]!==f?(m=v=>{const{section:_,capabilities:R}=v;return{section:_,capabilities:R.filter(p=>!f||p.label.toLowerCase().includes(f)||p.description.toLowerCase().includes(f))}},e[10]=f,e[11]=m):m=e[11];const S=x.map(m).filter(Jt);let T;e[12]!==n||e[13]!==i||e[14]!==r?(T=()=>{i(!n),r([])},e[12]=n,e[13]=i,e[14]=r,e[15]=T):T=e[15];let E;e[16]!==n||e[17]!==c||e[18]!==T?(E=Ye(n,c,T),e[16]=n,e[17]=c,e[18]=T,e[19]=E):E=e[19];let N;e[20]!==n||e[21]!==i||e[22]!==r||e[23]!==c?(N=c?void 0:()=>{i(!n),r([])},e[20]=n,e[21]=i,e[22]=r,e[23]=c,e[24]=N):N=e[24];let C;e[25]!==E||e[26]!==N?(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:E,onClick:N})})}),e[25]=E,e[26]=N,e[27]=C):C=e[27],a=s.jsx("div",{children:s.jsxs("div",{className:"flex flex-col gap-10 py-4",children:[C,S.length===0&&f?s.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:["No permissions match “",h,"”"]}):S.map(v=>{const{section:_,capabilities:R}=v;return s.jsx(Ue,{title:_,children:s.jsx(Be,{children:R.map(p=>{const O=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(O,c,()=>o(p,O)),onClick:c?void 0:()=>o(p,O)},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=H.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,[S,T]=$.useState(m),E=m||S,N=T,[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 R=_;let p;if(e[4]!==R||e[5]!==d){let j;e[7]!==R?(j=u=>R(u.id),e[7]=R,e[8]=j):j=e[8],p=d.filter(j),e[4]=R,e[5]=d,e[6]=p}else p=e[6];const O=p.length;let I;if(e[9]!==h||e[10]!==g||e[11]!==n||e[12]!==O||e[13]!==E||e[14]!==r||e[15]!==R||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=()=>N(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]!==O||e[34]!==d.length?(B=s.jsxs(ge,{variant:"secondary",className:"text-xs text-muted-foreground",children:[O,"/",d.length," enabled"]}),e[33]=O,e[34]=d.length,e[35]=B):B=e[35];let L;e[36]!==E?(L=E?s.jsx(Mt,{size:16,className:"text-muted-foreground shrink-0"}):s.jsx(Pt,{size:16,className:"text-muted-foreground shrink-0"}),e[36]=E,e[37]=L):L=e[37];let z;e[38]!==L||e[39]!==B?(z=s.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[B,L]}),e[38]=L,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,E&&s.jsxs("div",{className:"border-t border-border bg-muted/20",children:[j.map(M=>{const Y=R(M.id),F=()=>{if(!o){if(g){x(n,h,M.id);return}a(n,M.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:M.title})}),s.jsx("div",{onClick:as,children:o?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:Y,disabled:!0,onCheckedChange:rs})})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(xe,{checked:Y,onCheckedChange:F})})]},M.id)}),u&&s.jsxs("button",{type:"button",className:"w-full px-4 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors",onClick:()=>v(is),children:["Show more (",d.length-C," remaining)"]})]})]}),e[9]=h,e[10]=g,e[11]=n,e[12]=O,e[13]=E,e[14]=r,e[15]=R,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=H.c(33),{connection:n,selectedModels:l,allowAllModels:i,onToggleModel:r,onExitAllowAll:d,allConnectionModelsSelected:h,searchQuery:c,readOnly:g}=t,f=Lt(n.id);let a,x,o,m,S;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){S=Symbol.for("react.early_return_sentinel");e:{let N;e[16]!==n.label?(N=A=>({...A,id:A.modelId,provider:n.label}),e[16]=n.label,e[17]=N):N=e[17];const C=f.filter(hs).map(N),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){S=null;break e}const R=new Map;for(const A of _){const k=ss(A.id,n.providerId),G=R.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),R.set(k,G)}const p=Array.from(R.entries()).map(fs).sort(us),O=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:O},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]=S}else a=e[11],x=e[12],o=e[13],m=e[14],S=e[15];if(S!==Symbol.for("react.early_return_sentinel"))return S;let T;e[26]!==a||e[27]!==x?(T=s.jsx("div",{className:a,children:x}),e[26]=a,e[27]=x,e[28]=T):T=e[28];let E;return e[29]!==o||e[30]!==m||e[31]!==T?(E=s.jsxs("div",{className:o,children:[m,T]}),e[29]=o,e[30]=m,e[31]=T,e[32]=E):E=e[32],E}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=H.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,O)=>{const I=l[p]??[],j={...l};if(I.includes(O)){const u=I.filter(w=>w!==O);u.length===0?delete j[p]:j[p]=u}else j[p]=[...I,O];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,O,I)=>{i(!1),r({...l,[p]:O.filter(j=>j!==I)})},e[3]=l,e[4]=i,e[5]=r,e[6]=o):o=e[6];const m=o,S=!c&&"hover:bg-muted/50 cursor-pointer";let T;e[7]!==S?(T=K("flex items-center justify-between px-4 py-3 rounded-lg border border-border bg-card",S),e[7]=S,e[8]=T):T=e[8];let E;e[9]!==n||e[10]!==i||e[11]!==r||e[12]!==c?(E=()=>{if(c)return;const p=!n;i(p),p&&r({})},e[9]=n,e[10]=i,e[11]=r,e[12]=c,e[13]=E):E=e[13];let N;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[14]=N):N=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(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:n,disabled:!0,onCheckedChange:xs})})}),s.jsx(Te,{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]!==T||e[21]!==E||e[22]!==C?(v=s.jsxs("div",{className:T,onClick:E,children:[N,C]}),e[20]=T,e[21]=E,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 R;return e[32]!==_||e[33]!==v?(R=s.jsxs("div",{className:"flex flex-col h-full overflow-auto gap-6 pb-6",children:[v,_]}),e[32]=_,e[33]=v,e[34]=R):R=e[34],R}function xs(){}function ps(t){return t.stopPropagation()}function bs(t){const e=H.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,S,T,E,N,C,v,_,R,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 M=c.toLowerCase();return y.user?.name?.toLowerCase().includes(M)||y.user?.email?.toLowerCase().includes(M)},e[20]=c,e[21]=B):B=e[21];const L=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],S=z,m=Qe,R=n,p=l,o=He,v="sm:max-w-md p-0",e[26]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsxs(qe,{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],N="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],T="flex-1 overflow-auto",E=L.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:L.map(y=>{const M=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",!M||Y?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(we,{checked:F||Y,onCheckedChange:()=>{!M||Y||a(X=>X.includes(y.id)?X.filter(J=>J!==y.id):[...X,y.id])},disabled:!M||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})]}),!M&&s.jsx(ge,{variant:"secondary",className:"shrink-0",children:"Owner"}),Y&&M&&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]=S,e[12]=T,e[13]=E,e[14]=N,e[15]=C,e[16]=v,e[17]=_,e[18]=R,e[19]=p}else o=e[9],m=e[10],S=e[11],T=e[12],E=e[13],N=e[14],C=e[15],v=e[16],_=e[17],R=e[18],p=e[19];let O;e[29]!==T||e[30]!==E?(O=s.jsx("div",{className:T,children:E}),e[29]=T,e[30]=E,e[31]=O):O=e[31];let I;e[32]!==O||e[33]!==N||e[34]!==C?(I=s.jsxs("div",{className:N,children:[C,O]}),e[32]=O,e[33]=N,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]!==S||e[38]!==u||e[39]!==w?(A=s.jsxs(We,{className:"px-6 pb-6",children:[j,s.jsxs(et,{onClick:S,disabled:u,children:["Add ",w]})]}),e[37]=S,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]!==R||e[50]!==p?(G=s.jsx(m,{open:R,onOpenChange:p,children:k}),e[47]=m,e[48]=k,e[49]=R,e[50]=p,e[51]=G):G=e[51],G}function Es(t){const e=H.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,S;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 R=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 O=R.filter(p);S="flex flex-col h-full",o="flex-1 overflow-auto",m=R.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h3",{className:"text-base font-medium mb-1",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to grant them the configured permissions."})]})}):O.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:O.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(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(ne,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(ze,{size:16})})})}),s.jsx(Te,{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]=S}else o=e[7],m=e[8],S=e[9];let T;e[14]!==o||e[15]!==m?(T=s.jsx("div",{className:o,children:m}),e[14]=o,e[15]=m,e[16]=T):T=e[16];let E;e[17]!==n||e[18]!==l?(E=v=>l([...n,...v]),e[17]=n,e[18]=l,e[19]=E):E=e[19];let N;e[20]!==h||e[21]!==n||e[22]!==c||e[23]!==E?(N=s.jsx(bs,{open:h,onOpenChange:c,selectedMemberIds:n,onAddMembers:E}),e[20]=h,e[21]=n,e[22]=c,e[23]=E,e[24]=N):N=e[24];let C;return e[25]!==S||e[26]!==T||e[27]!==N?(C=s.jsxs("div",{className:S,children:[T,N]}),e[25]=S,e[26]=T,e[27]=N,e[28]=C):C=e[28],C}function Ts(t){const e=H.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(Es,{...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 Ss(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 Ns(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"?Ss(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=H.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(Ee,{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(Te,{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 Rs(t){const e=H.c(14),{locator:n}=Se(),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}=Re(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(Os,{...t,members:a,connections:i}),e[10]=i,e[11]=a,e[12]=t,e[13]=x):x=e[13],x}function Os({target:t,onBack:e,onSaved:n,members:l,connections:i}){const{locator:r}=Se(),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,S=o.formState.isDirty,T=Fe({mutationFn:async u=>{const w=Ns(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 L=l.filter(M=>M.role===(B??U)).map(M=>M.id),z=u.memberIds.filter(M=>!L.includes(M)),y=L.filter(M=>!u.memberIds.includes(M));for(const M of z){const Y=await d.organization.updateMemberRole({memberId:M,role:[U]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}for(const M of y){const Y=await d.organization.updateMemberRole({memberId:M,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,L=U!==B,z=await d.organization.updateRole({roleId:u.role.id,data:{permission:w,...L?{roleName:U}:{}}});if(z?.error)throw new Error(z.error.message??"Something went wrong");return await G(L?U:B,L?B:void 0),L?{...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 L=await d.organization.updateMemberRole({memberId:B,role:[A]});if(L?.error)throw new Error(L.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;Oe(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")}}),E=o.handleSubmit(u=>{if(!u.role.label.trim()){he.error("Role name is required"),o.setFocus("role.label");return}T.mutate(u)}),N=!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"}],[_,R]=$.useState(""),[p,O]=$.useState(!1),I=u=>{x(u),R("")},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:N&&s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"outline",size:"sm",onClick:e,disabled:T.isPending,children:"Cancel"}),s.jsx(ne,{size:"sm",onClick:E,disabled:T.isPending||!m||!S,children:T.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"?qt(t.role):Ht(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:R,placeholder:j[a]??"Search...",className:"w-full md:w-[375px]"}),a==="members"&&s.jsx(As,{readOnly:t.kind==="builtin"&&t.role==="owner",onOpen:()=>O(!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(Ts,{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:O})]})})]})})}function js(t){return t.kind==="builtin"?`builtin-${t.role}`:t.kind==="custom"?`custom-${t.role.id}`:"new"}function vs(t){const e=H.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 Ls={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Ms(t,e){return e?Ls[t]??"bg-neutral-400":ws(t)}function Ps(){const t=H.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}=Se(),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 S;e:{if(!h){S=null;break e}if(h==="new"){S={kind:"new"};break e}if(h.startsWith("builtin-")){S={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);S=V?{kind:"custom",role:V}:null}const T=S;let E;t[5]!==c?(E=re.members(c),t[5]=c,t[6]=E):E=t[6];let N;t[7]!==g?(N=()=>g.organization.listMembers(),t[7]=g,t[8]=N):N=t[8];let C;t[9]!==E||t[10]!==N?(C={queryKey:E,queryFn:N},t[9]=E,t[10]=N,t[11]=C):C=t[11];const{data:v}=Re(C);let _;t[12]!==v?.data?.members?(_=v?.data?.members??[],t[12]=v?.data?.members,t[13]=_):_=t[13];const R=_;let p;t[14]!==R?(p=P=>R.filter(V=>V.role===P).length,t[14]=R,t[15]=p):p=t[15];const O=p;let I;if(t[16]!==a||t[17]!==O||t[18]!==e){let P;t[20]!==O?(P=ce=>({kind:"builtin",role:{...ce,memberCount:O(ce.role)}}),t[20]=O,t[21]=P):P=t[21];const V=ys.map(P);let ae;t[22]!==O?(ae=ce=>({kind:"custom",role:{...ce,memberCount:O(ce.role)}}),t[22]=O,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]=O,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)=>{Oe("role_deleted",{role_id:V}),f.invalidateQueries({queryKey:re.members(c)}),f.invalidateQueries({queryKey:re.organizationRoles(c)}),he.success("Role deleted successfully!"),x(),T?.kind==="custom"&&T.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(bt,{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(It,{size:16})})}),s.jsx(Tt,{align:"end",onClick:Ds,children:s.jsxs(_t,{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 L;t[31]!==m?(L=P=>{if(P.kind==="builtin")m(`builtin-${P.role.role}`);else{const V=P.role;m(V.id)}},t[31]=m,t[32]=L):L=t[32];const z=L;if(T){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(Rs,{target:T,onBack:P,onSaved:V},js(T))}let y;t[38]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(te.Title,{children:"Roles"}),t[38]=y):y=t[38];let M;t[39]===Symbol.for("react.memo_cache_sentinel")?(M=P=>{P.key==="Escape"&&(n(""),P.target.blur())},t[39]=M):M=t[39];let Y;t[40]!==e?(Y=s.jsx(ve,{value:e,onChange:n,placeholder:"Search roles...",className:"w-full md:w-[375px]",onKeyDown:M}),t[40]=e,t[41]=Y):Y=t[41];let 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(Nt,{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 q;t[61]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx(Ze,{children:"Delete Role"}),t[61]=q):q=t[61];const W=l?.label;let Z;t[62]!==W?(Z=s.jsxs(qe,{children:[q,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(He,{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",Ms(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){Oe("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=H.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 fl(){const t=H.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{fl as default};
@@ -0,0 +1 @@
1
+ import{p as c}from"./header-tab-button-zS78j2W5.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-ChdATVAA.js";import{i as c}from"./AlertCircle-BU9gj1Zb.js";import{i as l}from"./Check-BmF1hQRY.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-CATx2LDP.js";import{i as c}from"./AlertCircle-CHkhp8BT.js";import{i as l}from"./Check-g3DB8Y79.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 +1 @@
1
- import{e as U,j as o,r as Q,B as Ce,c as De,n as be}from"./index-ChdATVAA.js";import{ab as Ct,v as It,ar as qe,H as Xe}from"./agent-icon-MPxc_53p.js";import{C as Rt}from"./calendar-C4NMm-GW.js";import{I as ue}from"./input-BZ-4l6sv.js";import{L as le}from"./label-CGY9toLT.js";import{a as Ot,b as Ft,P as Dt}from"./popover-hHdVOt7q.js";import{T as $t}from"./textarea-DbtEiAgf.js";import{S as Bt}from"./switch-DWpVVt2b.js";import{c as ut,S as ft,a as dt,b as pt,d as mt}from"./select-6yI1bUUl.js";import{a as Et,b as Ze,K as Lt,P as Pt,D as zt,c as Mt,S as Vt,v as Ut,f as Kt,e as Qe,d as Ht,C as Wt,s as Yt}from"./sortable.esm-B7SCN4Iq.js";import{d as yt}from"./ZoomOut-m5WCE6Ow.js";import{s as Gt}from"./Plus-D-k489Hw.js";import{s as ht}from"./Trash01-Br13J6pg.js";import{a as qt,b as Xt,c as Zt,D as Qt}from"./dropdown-menu-BS4mK__m.js";import{e as gt,u as Jt,L as en,F as tn,I as Je}from"./image-field-BIrSC9Gs.js";import{l as xt,i as Ie,a as $e,S as vt,P as nn,X as Be,n as Ue,Y as Re,Z as et,_ as rn,$ as sn,a0 as on,a1 as ln}from"./index-C8saI2Kn.js";import{t as bt}from"./ChevronDown-BIO7wba7.js";import{i as jt}from"./ChevronRight-CwhL8zaw.js";import{i as an}from"./Globe01-DF9PUq9k.js";import{T as cn,b as un,a as fn}from"./tooltip-CVKtA6h7.js";import{i as dn}from"./Upload01-D4q_2hTt.js";import{c as pn}from"./use-file-configs-CvNjCdnD.js";function mn(t){if(t?.trim())try{const e=new URL(t);return e.protocol!=="https:"?void 0:e.href}catch{return}}function yn(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 Tt(t){if(typeof t=="string"||t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(Tt);const e=t;return e.__resolveType?yn(e)??t:Nt(e)}function Nt(t){const e={};for(const[n,r]of Object.entries(t))e[n]=Tt(r);return e}function hn(t,e){return e.split(".").reduce((n,r)=>{if(!(n==null||typeof n!="object"))return n[r]},t)}function St(t){return t==null?"":Array.isArray(t)?t.map(St).filter(Boolean).join(","):typeof t=="object"?"":String(t)}function Ke(t,e){if(!t.includes("{"))return;const n=Nt(e);return t.replace(/\{\{\{([^}]+)\}\}\}|\{\{([^}]+)\}\}/g,(i,s,l)=>{const c=(s??l??"").trim();return St(hn(n,c))}).trim()||void 0}function gn(t,e){if(e.includes("{"))return Ke(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 ge(t,e,n){if(typeof t=="string")return t||`Item ${e+1}`;if(typeof t=="number"||typeof t=="boolean")return String(t);if(t&&typeof t=="object"&&!Array.isArray(t)){const r=t;if(n?.titleBy){const s=gn(r,n.titleBy);if(s)return s}for(const s of["name","label","title","alt","text","href","id"]){const l=r[s];if(typeof l=="string"&&l)return l;if(Array.isArray(l)){const c=l.map(a=>a==null?"":String(a)).filter(Boolean).join(",");if(c)return c}}const i=r.__resolveType;if(typeof i=="string"&&i)return xt(i);if(n?.title){const s=Ke(n.title,r);if(s)return s;if(!n.title.includes("{"))return n.title}}return`Item ${e+1}`}function xn(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 tt(t,e){if(!t||typeof t!="object"||Array.isArray(t))return;const n=xn(e);if(!n)return;const r=Ke(n,t);if(!r)return;const i=gt(r)||r;return mn(i)}function _t(t){return t===vt||t===nn}function Ee(t,e){if(!Object.hasOwn(e,t))return null;const n=e[t]??{},r=n.__resolveType??t;return{data:{...n},resolveType:r}}function Oe(t,e){const n=t.__resolveType??"";if(!n)return null;if(Ie(n)){const r=t.section??{};return kt(r,e)}if(_t(n)){const r=t.variants?.[0]?.value;return r?Oe(r,e):null}return!$e(n)||!Object.hasOwn(e,n)?{data:{...t},resolveType:n}:Ee(n,e)}function kt(t,e){const n=t.__resolveType??"";if(!n)return null;if(_t(n)){const r=t.variants?.[0]?.value;return r?Oe(r,e):null}return!$e(n)||!Object.hasOwn(e,n)?{data:{...t},resolveType:n}:Ee(n,e)}function vn(t,e){if(!t||typeof t!="object"||Array.isArray(t))return null;const r=t.__resolveType;if(typeof r!="string"||!$e(r)||!Object.hasOwn(e,r))return null;const i=Ee(r,e);return i?{blockKey:r,...i}:null}function Hr(t,e,n){if(e.isMultivariate)return null;if(e.isSavedBlock){const r=e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType;return Ee(r,n)}if(e.isHidden){const s=(Ie(t.__resolveType)?t.section:t)?.variants?.[0]?.value??t;return Oe(s,n)}if(e.isLazy||Ie(t.__resolveType)){const r=t.section??{};return kt(r,n)}return Oe(t,n)}const he=t=>String(t).padStart(2,"0"),bn="1900-01-01",jn="2099-12-31",Tn="1900-01-01T00:00",Nn="2099-12-31T23:59";function Sn(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()}-${he(n.getUTCMonth()+1)}-${he(n.getUTCDate())}`}function _n(t){return!t||!/^\d{4}-\d{2}-\d{2}$/.test(t)?"":`${t}T00:00:00.000Z`}function kn(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${he(e.getMonth()+1)}-${he(e.getDate())}T${he(e.getHours())}:${he(e.getMinutes())}`}function An(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toISOString()}function wn(t){const e=U.c(29),{id:n,withTime:r,value:i,onChange:s}=t,[l,c]=Q.useState(!1);let a;e[0]!==i||e[1]!==r?(a=r?kn(i):Sn(i),e[0]=i,e[1]=r,e[2]=a):a=e[2];const d=a;let p;e[3]!==s||e[4]!==r?(p=j=>{s(r?An(j.target.value):_n(j.target.value))},e[3]=s,e[4]=r,e[5]=p):p=e[5];const m=p;let g;if(e[6]!==i){const j=i?new Date(i):null;g=j&&!Number.isNaN(j.getTime())?j:null,e[6]=i,e[7]=g}else g=e[7];const y=g;let v;e[8]!==s||e[9]!==y||e[10]!==r?(v=j=>{j&&(r&&y?j.setHours(y.getHours(),y.getMinutes(),0,0):j.setHours(0,0,0,0),s(j.toISOString()),c(!1))},e[8]=s,e[9]=y,e[10]=r,e[11]=v):v=e[11];const f=v,h=r?"datetime-local":"date",u=r?Tn:bn,x=r?Nn:jn;let b;e[12]!==m||e[13]!==n||e[14]!==d||e[15]!==h||e[16]!==u||e[17]!==x?(b=o.jsx(ue,{id:n,type:h,min:u,max:x,value:d,onChange:m,className:"h-10 flex-1 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:opacity-0"}),e[12]=m,e[13]=n,e[14]=d,e[15]=h,e[16]=u,e[17]=x,e[18]=b):b=e[18];let _;e[19]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Ot,{asChild:!0,children:o.jsx(Ce,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0","aria-label":"Open calendar",children:o.jsx(Ct,{className:"h-4 w-4"})})}),e[19]=_):_=e[19];const k=y??void 0;let T;e[20]!==f||e[21]!==k?(T=o.jsx(Ft,{className:"w-auto p-0",align:"end",children:o.jsx(Rt,{mode:"single",selected:k,onSelect:f,initialFocus:!0})}),e[20]=f,e[21]=k,e[22]=T):T=e[22];let N;e[23]!==l||e[24]!==T?(N=o.jsxs(Dt,{open:l,onOpenChange:c,children:[_,T]}),e[23]=l,e[24]=T,e[25]=N):N=e[25];let I;return e[26]!==N||e[27]!==b?(I=o.jsxs("div",{className:"flex gap-1",children:[b,N]}),e[26]=N,e[27]=b,e[28]=I):I=e[28],I}function ke(t){const e=U.c(8),{htmlFor:n,label:r,description:i}=t;let s;e[0]!==n||e[1]!==r?(s=o.jsx(le,{htmlFor:n,children:r}),e[0]=n,e[1]=r,e[2]=s):s=e[2];let l;e[3]!==i?(l=i&&o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:i}),e[3]=i,e[4]=l):l=e[4];let c;return e[5]!==s||e[6]!==l?(c=o.jsxs("div",{className:"space-y-0.5",children:[s,l]}),e[5]=s,e[6]=l,e[7]=c):c=e[7],c}function Ae(t){const e=U.c(61),{schema:n,value:r,onChange:i,path:s,label:l}=t,c=typeof r=="string"?r:"",a=n.format;if(a==="textarea"||a==="rich-text"||a==="rich-text-inline"||a==="markdown"){let f;e[0]!==l||e[1]!==s||e[2]!==n.description?(f=o.jsx(ke,{htmlFor:s,label:l,description:n.description}),e[0]=l,e[1]=s,e[2]=n.description,e[3]=f):f=e[3];let h;e[4]!==i?(h=b=>i(b.target.value),e[4]=i,e[5]=h):h=e[5];let u;e[6]!==s||e[7]!==c||e[8]!==h?(u=o.jsx($t,{id:s,value:c,onChange:h,rows:4}),e[6]=s,e[7]=c,e[8]=h,e[9]=u):u=e[9];let x;return e[10]!==f||e[11]!==u?(x=o.jsxs("div",{className:"space-y-2",children:[f,u]}),e[10]=f,e[11]=u,e[12]=x):x=e[12],x}if(a==="date"||a==="date-time"){let f;e[13]!==l||e[14]!==s||e[15]!==n.description?(f=o.jsx(ke,{htmlFor:s,label:l,description:n.description}),e[13]=l,e[14]=s,e[15]=n.description,e[16]=f):f=e[16];const h=a==="date-time";let u;e[17]!==i||e[18]!==s||e[19]!==c||e[20]!==h?(u=o.jsx(wn,{id:s,withTime:h,value:c,onChange:i}),e[17]=i,e[18]=s,e[19]=c,e[20]=h,e[21]=u):u=e[21];let x;return e[22]!==f||e[23]!==u?(x=o.jsxs("div",{className:"space-y-2",children:[f,u]}),e[22]=f,e[23]=u,e[24]=x):x=e[24],x}if(a==="color-input"){let f;e[25]!==l||e[26]!==s||e[27]!==n.description?(f=o.jsx(ke,{htmlFor:s,label:l,description:n.description}),e[25]=l,e[26]=s,e[27]=n.description,e[28]=f):f=e[28];const h=c||"#000000";let u;e[29]!==i?(u=N=>i(N.target.value),e[29]=i,e[30]=u):u=e[30];let x;e[31]!==h||e[32]!==u?(x=o.jsx("input",{type:"color",value:h,onChange:u,className:"h-10 w-10 cursor-pointer rounded-lg border border-border bg-background p-1"}),e[31]=h,e[32]=u,e[33]=x):x=e[33];let b;e[34]!==i?(b=N=>i(N.target.value),e[34]=i,e[35]=b):b=e[35];let _;e[36]!==s||e[37]!==c||e[38]!==b?(_=o.jsx(ue,{id:s,value:c,onChange:b,placeholder:"#000000",className:"h-10 flex-1"}),e[36]=s,e[37]=c,e[38]=b,e[39]=_):_=e[39];let k;e[40]!==x||e[41]!==_?(k=o.jsxs("div",{className:"flex items-center gap-2",children:[x,_]}),e[40]=x,e[41]=_,e[42]=k):k=e[42];let T;return e[43]!==f||e[44]!==k?(T=o.jsxs("div",{className:"space-y-2",children:[f,k]}),e[43]=f,e[44]=k,e[45]=T):T=e[45],T}let d;e[46]!==l||e[47]!==s||e[48]!==n.description?(d=o.jsx(ke,{htmlFor:s,label:l,description:n.description}),e[46]=l,e[47]=s,e[48]=n.description,e[49]=d):d=e[49];const p=a==="url"?"url":"text";let m;e[50]!==i?(m=f=>i(f.target.value),e[50]=i,e[51]=m):m=e[51];const g=n.default!=null?String(n.default):void 0;let y;e[52]!==s||e[53]!==c||e[54]!==p||e[55]!==m||e[56]!==g?(y=o.jsx(ue,{id:s,type:p,value:c,onChange:m,placeholder:g,className:"h-10"}),e[52]=s,e[53]=c,e[54]=p,e[55]=m,e[56]=g,e[57]=y):y=e[57];let v;return e[58]!==d||e[59]!==y?(v=o.jsxs("div",{className:"space-y-2",children:[d,y]}),e[58]=d,e[59]=y,e[60]=v):v=e[60],v}function Cn(t){const e=U.c(17),{schema:n,value:r,onChange:i,path:s,label:l}=t,c=typeof r=="number"?r:"";let a;e[0]!==l||e[1]!==s?(a=o.jsx(le,{htmlFor:s,children:l}),e[0]=l,e[1]=s,e[2]=a):a=e[2];let d;e[3]!==n.description?(d=n.description&&o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[3]=n.description,e[4]=d):d=e[4];let p;e[5]!==a||e[6]!==d?(p=o.jsxs("div",{className:"space-y-0.5",children:[a,d]}),e[5]=a,e[6]=d,e[7]=p):p=e[7];let m;e[8]!==i?(m=v=>{const f=v.target.value;i(f===""?void 0:Number(f))},e[8]=i,e[9]=m):m=e[9];let g;e[10]!==c||e[11]!==s||e[12]!==m?(g=o.jsx(ue,{id:s,type:"number",value:c,onChange:m,className:"h-10"}),e[10]=c,e[11]=s,e[12]=m,e[13]=g):g=e[13];let y;return e[14]!==p||e[15]!==g?(y=o.jsxs("div",{className:"space-y-2",children:[p,g]}),e[14]=p,e[15]=g,e[16]=y):y=e[16],y}function In(t){const e=U.c(17),{value:n,onChange:r,path:i,label:s,schema:l}=t,c=typeof n=="boolean"?n:!1;let a;e[0]!==s||e[1]!==i?(a=o.jsx(le,{htmlFor:i,children:s}),e[0]=s,e[1]=i,e[2]=a):a=e[2];let d;e[3]!==l.description?(d=l.description&&o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:l.description}),e[3]=l.description,e[4]=d):d=e[4];let p;e[5]!==a||e[6]!==d?(p=o.jsxs("div",{className:"space-y-0.5",children:[a,d]}),e[5]=a,e[6]=d,e[7]=p):p=e[7];let m;e[8]!==r?(m=v=>r(v),e[8]=r,e[9]=m):m=e[9];let g;e[10]!==c||e[11]!==i||e[12]!==m?(g=o.jsx(Bt,{id:i,checked:c,onCheckedChange:m}),e[10]=c,e[11]=i,e[12]=m,e[13]=g):g=e[13];let y;return e[14]!==p||e[15]!==g?(y=o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[p,g]}),e[14]=p,e[15]=g,e[16]=y):y=e[16],y}const He="__enum_empty__";function We(t){return t===""?He:String(t)}function Rn(t,e){if(t===He)return"";const n=e.find(r=>We(r)===t);return n!==void 0?n:t}function On(t,e){return t==null?e.some(n=>n==="")?He:void 0:We(t)}function Fn(t){return t===""?"":String(t)}function Dn(t){const e=U.c(28),{schema:n,value:r,onChange:i,path:s,label:l}=t;let c;e[0]!==n.enum?(c=n.enum??[],e[0]=n.enum,e[1]=c):c=e[1];const a=c;let d;e[2]!==a||e[3]!==r?(d=On(r,a),e[2]=a,e[3]=r,e[4]=d):d=e[4];const p=d;let m;e[5]!==l||e[6]!==s?(m=o.jsx(le,{htmlFor:s,children:l}),e[5]=l,e[6]=s,e[7]=m):m=e[7];let g;e[8]!==n.description?(g=n.description&&o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[8]=n.description,e[9]=g):g=e[9];let y;e[10]!==m||e[11]!==g?(y=o.jsxs("div",{className:"space-y-0.5",children:[m,g]}),e[10]=m,e[11]=g,e[12]=y):y=e[12];let v;e[13]!==i||e[14]!==a?(v=_=>i(Rn(_,a)),e[13]=i,e[14]=a,e[15]=v):v=e[15];let f;e[16]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(ft,{className:"h-10",children:o.jsx(dt,{placeholder:"Select..."})}),e[16]=f):f=e[16];let h;e[17]!==a?(h=a.map($n),e[17]=a,e[18]=h):h=e[18];let u;e[19]!==h?(u=o.jsx(pt,{children:h}),e[19]=h,e[20]=u):u=e[20];let x;e[21]!==p||e[22]!==v||e[23]!==u?(x=o.jsxs(mt,{value:p,onValueChange:v,children:[f,u]}),e[21]=p,e[22]=v,e[23]=u,e[24]=x):x=e[24];let b;return e[25]!==x||e[26]!==y?(b=o.jsxs("div",{className:"space-y-2",children:[y,x]}),e[25]=x,e[26]=y,e[27]=b):b=e[27],b}function $n(t){const e=We(t);return o.jsx(ut,{value:e,children:Fn(t)},e)}function Bn(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase())}function Te(t){return t.normalize("NFC").trim()}function V(t,e){return Te(t)===Te(e)}function we(t,e,n){const r=Te(n);if(t.some(l=>V(l,r)||V(l,n)))return t;const i=[...t];return i.some(l=>V(l,e))||i.push(e),i.push(n),i}function En(t,e,n){if(n.length===0)return n;const r=Fe(t,e),i=n[0];return V(i,r)||V(i,t)?n.slice(1):n}function Fe(t,e){return e.title??Bn(t)}function Wr(t,e){return e<=0?[]:t.slice(0,e)}function nt(t,e){const n=Te(e);return t.findIndex(r=>Te(r)===n)}function rt(t,e){return t.type==="array"&&t.items||Be(t)?!0:Array.isArray(e)}function Ln(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)?t:{}}function Ne(t,e,n,r){if(r.length===0)return null;const i=r[0];for(const s of t){const l=e[s];if(!l||!rt(l,n[s]))continue;const c=Fe(s,l);if(V(i,c)||V(i,s)||r.some(a=>V(a,c)||V(a,s)))return s}for(const s of t){const l=e[s];if(!l||!rt(l,n[s]))continue;const c=n[s];if(!Array.isArray(c))continue;const a=l.items;for(let d=0;d<c.length;d++){const p=ge(c[d],d,a);if(V(p,i))return s}}for(const s of t){const l=e[s];if(l?.type!=="object"||!l.properties)continue;const c=Object.keys(l.properties),a=Ln(n[s]),d=Fe(s,l);if(Ne(c,l.properties,a,r)||(V(i,d)||V(i,s))&&Ne(c,l.properties,a,r.slice(1)))return s}return null}function Pn(t,e,n,r){return Ne(t,e,n,r)}function zn(t,e,n,r,i){if(i.length===0||!n.properties)return!1;const s=Object.keys(n.properties);if(Ne(s,n.properties,r,i))return!0;const l=i[0];return!V(l,e)&&!V(l,t)?!1:i.length>1||Ne(s,n.properties,r,i.slice(1))!==null}function Mn(t,e,n,r){if(e.length===0)return null;for(let s=0;s<e.length;s++){const l=e[s],c=n.findIndex((a,d)=>V(ge(a,d,r),l));if(c>=0)return{index:c,innerPath:e.slice(s+1)}}const i=e.findIndex(s=>V(s,t));if(i>=0&&e.length>i+1){const s=e[i+1],l=n.findIndex((c,a)=>V(ge(c,a,r),s));if(l>=0)return{index:l,innerPath:e.slice(i+2)}}return null}function ze(t){return t.includes("/sections/")||t.includes("multivariate/section")||t===vt}function Vn(t){if(t.type==="block-ref"&&t.anyOfRefs?.length)return t.anyOfRefs.some(n=>ze(n.resolveType));if(t.anyOfRefs?.length)return t.anyOfRefs.some(n=>ze(n.resolveType));const e=t.properties?.__resolveType;return e?.type==="block-ref"&&e.anyOfRefs?.length?e.anyOfRefs.some(n=>ze(n.resolveType)):!1}function Un(t,e){if(e==="global"||e==="sections"||Be(t))return!0;const n=t.type==="array"?t.items:void 0;return n?Vn(n):!1}function st(t){return Array.from({length:t},(e,n)=>({id:crypto.randomUUID(),index:n}))}function Kn(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 s=t.__resolveType;if(typeof s=="string"&&n){const l=Ue(s,n);if(l?.properties&&Object.keys(l.properties).length>0)return l}}if(n&&r&&i){const l=Ue(r,n)?.properties?.[i]?.items;if(l?.properties&&Object.keys(l.properties).length>0)return{...l,titleBy:l.titleBy??e?.titleBy}}return e}function Hn(t){const e=t.split(".").filter(n=>!/^\d+$/.test(n));return e[e.length-1]??t}function At(t){return t.map((e,n)=>({...e,index:n}))}function Wn(t,e){if(e===t.length)return t;if(e<t.length)return At(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 Yn(t){const e=U.c(8),{labelText:n,imageSrc:r}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(yt,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[0]=i):i=e[0];let s;e[1]!==r?(s=r&&o.jsx("img",{src:r,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[1]=r,e[2]=s):s=e[2];let l;e[3]!==n?(l=o.jsx("span",{className:"min-w-0 truncate",children:n}),e[3]=n,e[4]=l):l=e[4];let c;return e[5]!==s||e[6]!==l?(c=o.jsxs(o.Fragment,{children:[i,o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2.5 text-sm",children:[s,l]})]}),e[5]=s,e[6]=l,e[7]=c):c=e[7],c}function Gn(t){const e=U.c(37),{sortableId:n,labelText:r,imageSrc:i,onOpen:s,onRemove:l}=t;let c;e[0]!==n?(c={id:n,animateLayoutChanges:Zn},e[0]=n,e[1]=c):c=e[1];const{attributes:a,listeners:d,setNodeRef:p,transform:m,isDragging:g}=Ht(c);let y;e[2]!==m?(y=Wt.Transform.toString(m?{...m,x:0}:null),e[2]=m,e[3]=y):y=e[3];const v=g?0:void 0;let f;e[4]!==y||e[5]!==v?(f={transform:y,opacity:v},e[4]=y,e[5]=v,e[6]=f):f=e[6];const h=f;let u;e[7]!==s?(u=F=>{(F.key==="Enter"||F.key===" ")&&(F.preventDefault(),s())},e[7]=s,e[8]=u):u=e[8];const x=g?"cursor-grabbing":"cursor-pointer";let b;e[9]!==x?(b=De("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",x),e[9]=x,e[10]=b):b=e[10];let _;e[11]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(yt,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[11]=_):_=e[11];let k;e[12]!==i?(k=i&&o.jsx("img",{src:i,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[12]=i,e[13]=k):k=e[13];let T;e[14]!==r?(T=o.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 I;e[16]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx(It,{size:14}),e[16]=I):I=e[16];let j;e[17]!==N?(j=o.jsx(qt,{asChild:!0,children:o.jsx(Ce,{type:"button",variant:"ghost",size:"icon","aria-label":N,className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100",onClick:Xn,onPointerDown:qn,children:I})}),e[17]=N,e[18]=j):j=e[18];let S;e[19]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(ht,{size:14}),e[19]=S):S=e[19];let w;e[20]!==l?(w=o.jsx(Xt,{align:"end",children:o.jsxs(Zt,{className:"text-destructive focus:text-destructive",onClick:l,children:[S,"Delete"]})}),e[20]=l,e[21]=w):w=e[21];let C;e[22]!==j||e[23]!==w?(C=o.jsxs(Qt,{children:[j,w]}),e[22]=j,e[23]=w,e[24]=C):C=e[24];let O;return e[25]!==a||e[26]!==r||e[27]!==d||e[28]!==s||e[29]!==p||e[30]!==h||e[31]!==T||e[32]!==C||e[33]!==u||e[34]!==b||e[35]!==k?(O=o.jsxs("div",{ref:p,style:h,...a,...d,role:"button",tabIndex:0,onClick:s,onKeyDown:u,className:b,title:r,children:[_,k,T,C]}),e[25]=a,e[26]=r,e[27]=d,e[28]=s,e[29]=p,e[30]=h,e[31]=T,e[32]=C,e[33]=u,e[34]=b,e[35]=k,e[36]=O):O=e[36],O}function qn(t){return t.stopPropagation()}function Xn(t){return t.stopPropagation()}function Zn(){return!1}function Me(t){const e=U.c(24),{schema:n,value:r,onChange:i,path:s,label:l,breadcrumbPath:c,onBreadcrumbChange:a,meta:d,decofile:p,onSaveReferencedBlock:m,containerResolveType:g,previewBaseUrl:y,onAddSectionItem:v,onRequestAddSection:f}=t,h=c===void 0?[]:c,u=Array.isArray(r)?r:[],x=n.items,b=Hn(s),_=Un(n,b),k=Mn(l,h,u,x),T=k?.index??null,[N,I]=Q.useState(()=>st(u.length)),[j,S]=Q.useState(null),[w,C]=Q.useState(s),[O,F]=Q.useState(u.length),z=Q.useRef(!1);w!==s?(C(s),F(u.length),I(st(u.length))):O!==u.length&&(F(u.length),I(A=>Wn(A,u.length)));let B;e[0]!==x?(B=(A,D)=>ge(A,D,x),e[0]=x,e[1]=B):B=e[1];const M=B,J=A=>{if(z.current)return;const D=M(u[A],A);a?.(we(h,l,D))},W=A=>{const D=[...u,A];i(D);const E=D.length-1,P=ge(A,E,x);a?.(we(h,l,P))},re=()=>{const A=x?.type,D=x?.default!==void 0?x.default:A==="object"?{}:A==="block-ref"?(()=>{const ce=x?.anyOfRefs?.[0]?.resolveType;return typeof ce!="string"||Re(ce)?{}:{__resolveType:ce}})():A==="number"||A==="integer"?0:A==="boolean"?!1:A==="array"?[]:"",E=[...u,D];i(E);const P=E.length-1,oe=ge(D,P,x);a?.(we(h,l,oe))},H=()=>{if(_){if(!y){be.error("Start the preview dev server to add sections.");return}if(f){f({append:W});return}be.error("Section picker is not available in this editor.");return}re()},se=A=>{if(i(u.filter((D,E)=>E!==A)),T===A){const D=M(u[A],A),E=nt(h,D);a?.(E>=0?h.slice(0,E):[])}},ee=(A,D)=>{const E=[...u];E[A]=D,i(E)};let ie;e[2]===Symbol.for("react.memo_cache_sentinel")?(ie={activationConstraint:{distance:8}},e[2]=ie):ie=e[2];let Y;e[3]===Symbol.for("react.memo_cache_sentinel")?(Y={coordinateGetter:Yt},e[3]=Y):Y=e[3];const G=Et(Ze(Pt,ie),Ze(Lt,Y)),q=N.map(Qn);let K;e[4]===Symbol.for("react.memo_cache_sentinel")?(K=A=>{S(String(A.active.id))},e[4]=K):K=e[4];const X=K,te=A=>{S(null);const{active:D,over:E}=A;if(!E||D.id===E.id)return;const P=q.indexOf(String(D.id)),oe=q.indexOf(String(E.id));P===-1||oe===-1||(I(ce=>At(Qe([...ce],P,oe))),i(Qe([...u],P,oe)),z.current=!0,requestAnimationFrame(()=>{z.current=!1}))};let R;e[5]===Symbol.for("react.memo_cache_sentinel")?(R=()=>{S(null)},e[5]=R):R=e[5];const $=R,L=j?N.find(A=>A.id===j):null,ne=L!=null?u[L.index]:void 0,ae=L!=null&&ne!==void 0?M(ne,L.index):null,fe=L!=null&&ne!==void 0?tt(ne,x):void 0;if(T!==null&&T<u.length){const A=u[T],D=Kn(A,x,d,g,b),E=()=>{const P=M(A,T),oe=we(h,l,P),ce=nt(oe,P);return ce>=0?oe.slice(0,ce+1):oe};return o.jsx("div",{className:"min-w-0",children:D?.type==="object"&&D.properties?o.jsx(Ge,{schema:D,value:A,onChange:P=>ee(T,P),basePath:`${s}.${T}`,breadcrumbPath:k?.innerPath??[],onBreadcrumbChange:P=>{a?.([...E(),...P])},meta:d,decofile:p,onSaveReferencedBlock:m,previewBaseUrl:y,onAddSectionItem:v,onRequestAddSection:f}):D?wt({schema:D,value:A,onChange:P=>ee(T,P),path:`${s}.${T}`,label:D.title??`Item ${T+1}`,breadcrumbPath:k?.innerPath??[],onBreadcrumbChange:P=>{a?.([...E(),...P])},meta:d,decofile:p,onSaveReferencedBlock:m,previewBaseUrl:y,onAddSectionItem:v,onRequestAddSection:f}):null})}const xe="space-y-2";let Z;e[6]!==l?(Z=o.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:l}),e[6]=l,e[7]=Z):Z=e[7];const ve=u.length>0&&o.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:u.length});let de;e[8]!==Z||e[9]!==ve?(de=o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[Z,ve]}),e[8]=Z,e[9]=ve,e[10]=de):de=e[10];let pe;e[11]!==n.description?(pe=n.description&&o.jsx("p",{className:"break-words text-xs leading-normal text-muted-foreground",children:n.description}),e[11]=n.description,e[12]=pe):pe=e[12];let me;e[13]!==de||e[14]!==pe?(me=o.jsxs("div",{className:"min-w-0 space-y-0.5",children:[de,pe]}),e[13]=de,e[14]=pe,e[15]=me):me=e[15];const Le=u.length>0&&o.jsx("div",{className:De(j&&"cursor-grabbing"),children:o.jsxs(zt,{sensors:G,collisionDetection:Mt,onDragStart:X,onDragEnd:te,onDragCancel:$,children:[o.jsx(Vt,{items:q,strategy:Ut,children:o.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border/50 p-1.5",children:N.map(A=>{const D=u[A.index];if(D===void 0)return null;const E=M(D,A.index),P=tt(D,x);return o.jsx(Gn,{sortableId:A.id,labelText:E,imageSrc:P,onOpen:()=>J(A.index),onRemove:()=>se(A.index)},A.id)})})}),o.jsx(Kt,{dropAnimation:null,children:ae?o.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:o.jsx(Yn,{labelText:ae,imageSrc:fe})}):null})]})});let Se;e[16]===Symbol.for("react.memo_cache_sentinel")?(Se=o.jsx(Gt,{size:14}),e[16]=Se):Se=e[16];const Pe=_?"Add section":"Add item";let ye;e[17]!==H||e[18]!==Pe?(ye=o.jsxs("button",{type:"button",onClick:H,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:[Se,Pe]}),e[17]=H,e[18]=Pe,e[19]=ye):ye=e[19];let _e;return e[20]!==me||e[21]!==Le||e[22]!==ye?(_e=o.jsxs("div",{className:xe,children:[me,Le,ye]}),e[20]=me,e[21]=Le,e[22]=ye,e[23]=_e):_e=e[23],_e}function Qn(t){return t.id}function Jn(t){const e=U.c(43),{schema:n,value:r,onChange:i,path:s,label:l,breadcrumbPath:c,onBreadcrumbChange:a,meta:d,decofile:p,onSaveReferencedBlock:m,previewBaseUrl:g,onAddSectionItem:y,onRequestAddSection:v}=t;let f;e[0]!==c?(f=c===void 0?[]:c,e[0]=c,e[1]=f):f=e[1];const h=f,[u,x]=Q.useState(!1);let b;e[2]!==r?(b=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},e[2]=r,e[3]=b):b=e[3];const _=b;if(!n.properties)return null;let k;e[4]!==s?(k=s.split(".").pop()??s,e[4]=s,e[5]=k):k=e[5];const T=k;let N;e[6]!==h||e[7]!==T||e[8]!==l||e[9]!==_||e[10]!==n?(N=zn(T,l,n,_,h),e[6]=h,e[7]=T,e[8]=l,e[9]=_,e[10]=n,e[11]=N):N=e[11];const j=u||N,S=`${s}-fields`;let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=()=>x(er),e[12]=w):w=e[12];let C;e[13]!==j?(C=o.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:j?o.jsx(bt,{size:16}):o.jsx(jt,{size:16})}),e[13]=j,e[14]=C):C=e[14];let O;e[15]!==l?(O=o.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:l}),e[15]=l,e[16]=O):O=e[16];let F;e[17]!==S||e[18]!==j||e[19]!==C||e[20]!==O?(F=o.jsxs("button",{type:"button","aria-expanded":j,"aria-controls":S,onClick:w,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:[C,O]}),e[17]=S,e[18]=j,e[19]=C,e[20]=O,e[21]=F):F=e[21];let z;e[22]!==n.description?(z=n.description&&o.jsx("p",{className:"break-words pl-9 text-xs leading-normal text-muted-foreground",children:n.description}),e[22]=n.description,e[23]=z):z=e[23];let B;e[24]!==h||e[25]!==S||e[26]!==p||e[27]!==j||e[28]!==d||e[29]!==_||e[30]!==y||e[31]!==a||e[32]!==i||e[33]!==v||e[34]!==m||e[35]!==s||e[36]!==g||e[37]!==n?(B=j&&o.jsx("div",{id:S,className:"ml-3 min-w-0 max-w-full overflow-hidden border-l border-border/80 pl-5",children:o.jsx(Ge,{schema:n,value:_,onChange:i,basePath:s,breadcrumbPath:h,onBreadcrumbChange:a,meta:d,decofile:p,onSaveReferencedBlock:m,previewBaseUrl:g,onAddSectionItem:y,onRequestAddSection:v})}),e[24]=h,e[25]=S,e[26]=p,e[27]=j,e[28]=d,e[29]=_,e[30]=y,e[31]=a,e[32]=i,e[33]=v,e[34]=m,e[35]=s,e[36]=g,e[37]=n,e[38]=B):B=e[38];let M;return e[39]!==z||e[40]!==B||e[41]!==F?(M=o.jsxs("div",{className:"min-w-0 space-y-2",children:[F,z,B]}),e[39]=z,e[40]=B,e[41]=F,e[42]=M):M=e[42],M}function er(t){return!t}function Ye(t){const e=t.__resolveType;if(typeof e!="string")return null;if(Ie(e)){const r=t.section?.__resolveType;return typeof r=="string"?r:e}return e}function tr(t){return t.includes("flags/multivariate")}function nr(t){return xt(t)}function rr(t,e){const n=[...t],r=new Set(n.map(s=>s.resolveType)),i=(s,l)=>{!s||r.has(s)||(r.add(s),n.push({resolveType:s,title:l??nr(s)}))};if(e.savedBlockKey&&i(e.savedBlockKey,e.savedBlockKey),e.editorValue&&typeof e.editorValue=="object"&&!Array.isArray(e.editorValue)){const s=Ye(e.editorValue);s?.includes("/")&&i(s)}return n}function sr(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,s=i.__resolveType;if(typeof s=="string"){if($e(s)){const m=e.find(g=>g.resolveType===s);return m?m.resolveType:s}const d=e.find(m=>et(m.resolveType,s));if(d)return d.resolveType;const p=e.find(m=>m.resolveType===s);if(p)return p.resolveType;if(s.includes("/"))return s}const l=typeof i.type=="string"?i.type:void 0;if(l){const d=e.find(p=>p.discriminatorValue===l||p.resolveType===l||et(p.resolveType,l));if(d)return d.resolveType}let c=r,a=-1;for(const d of e){if(!d.schema?.properties)continue;const m=Object.keys(d.schema.properties).filter(g=>!g.startsWith("__")&&g!=="@type"&&g!=="action"&&g!=="alt").filter(g=>i[g]!==void 0).length;m>0&&m>a&&(a=m,c=d.resolveType)}return a>0,c}function it(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=Ue(r,e);return i||(r.includes("/")?null:n??null)}function ir(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 or(t,e){if(e)return!0;if(!t||typeof t!="object"||Array.isArray(t))return!1;const n=t,r=Ye(n);return r&&tr(r)?Array.isArray(n.variants)&&n.variants.length>0:Object.keys(n).some(i=>!i.startsWith("__")&&i!=="@type")}function lr(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 ar(t){const e=U.c(3),{blockKey:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(cn,{asChild:!0,children:o.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:[o.jsx(an,{size:11}),"Global"]})}),e[0]=r):r=e[0];let i;return e[1]!==n?(i=o.jsxs(un,{children:[r,o.jsxs(fn,{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 cr(t){const e=U.c(28),{path:n,open:r,onOpenChange:i,title:s,nested:l,nestedBlockRef:c,globalBlockKey:a}=t,d=`${n}-loader-config`,p=c&&"ml-1";let m;e[0]!==p?(m=De("rounded-lg border border-border/80 bg-muted/30",p),e[0]=p,e[1]=m):m=e[1];let g;e[2]!==i||e[3]!==r?(g=()=>i(!r),e[2]=i,e[3]=r,e[4]=g):g=e[4];let y;e[5]!==r?(y=o.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:r?o.jsx(bt,{size:16}):o.jsx(jt,{size:16})}),e[5]=r,e[6]=y):y=e[6];let v;e[7]!==s?(v=o.jsx("span",{className:"truncate text-xs font-medium tracking-wide text-muted-foreground uppercase",children:s}),e[7]=s,e[8]=v):v=e[8];let f;e[9]!==a?(f=a&&o.jsx(ar,{blockKey:a}),e[9]=a,e[10]=f):f=e[10];let h;e[11]!==v||e[12]!==f?(h=o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[v,f]}),e[11]=v,e[12]=f,e[13]=h):h=e[13];let u;e[14]!==d||e[15]!==r||e[16]!==g||e[17]!==y||e[18]!==h?(u=o.jsxs("button",{type:"button","aria-expanded":r,"aria-controls":d,onClick:g,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:[y,h]}),e[14]=d,e[15]=r,e[16]=g,e[17]=y,e[18]=h,e[19]=u):u=e[19];let x;e[20]!==d||e[21]!==l||e[22]!==r?(x=r&&o.jsx("div",{id:d,className:"border-t border-border/60 px-4 pb-4 pt-3",children:o.jsx("div",{className:"border-l border-border/80 pl-4",children:l})}),e[20]=d,e[21]=l,e[22]=r,e[23]=x):x=e[23];let b;return e[24]!==m||e[25]!==u||e[26]!==x?(b=o.jsxs("div",{className:m,children:[u,x]}),e[24]=m,e[25]=u,e[26]=x,e[27]=b):b=e[27],b}function ot(t){const e=U.c(30),{schema:n,value:r,onChange:i,path:s,label:l,breadcrumbPath:c,onBreadcrumbChange:a,meta:d,decofile:p,onSaveReferencedBlock:m}=t,g=(n.anyOfRefs??[]).filter(dr),y=p&&r?vn(r,p):null,v=y?.data??r,f=rr(g,{savedBlockKey:y?.blockKey,editorValue:v}),h=f.length>0?sr(v,f,y?.blockKey):f[0]?.resolveType??"",[u,x]=Q.useState(h),[b,_]=Q.useState(h);b!==h&&(_(h),x(h));const[k,T]=Q.useState(()=>or(v,y?.blockKey));if(f.length>0){const F=u||h;let z;e[0]!==F?(z=R=>R.resolveType===F,e[0]=F,e[1]=z):z=e[1];const B=f.find(z),M=it(v,d,B?.schema),J=ir(M??B?.schema??null,n.discriminatorKey),W=n.discriminatorKey,re=R=>{x(R);const $=f.find(Z=>Z.resolveType===R),L=it(v,d,$?.schema),ne=new Set(Object.keys((L??$?.schema)?.properties??{})),ae=r!==null&&typeof r=="object"&&!Array.isArray(r)?r:{},fe=Object.fromEntries(Object.entries(ae).filter(Z=>{const[ve]=Z;return ne.has(ve)})),xe={...lr($?.schema),...fe};if(W){const Z=$?.discriminatorValue??R;i({...xe,[W]:Z});return}if(Re(R)){i(xe);return}i({...xe,__resolveType:R})};let H;e[2]!==F||e[3]!==W||e[4]!==i?(H=R=>{if(W||!Re(F)||R===null||typeof R!="object"||Array.isArray(R)){i(R);return}const{__resolveType:$,...L}=R;i(L)},e[2]=F,e[3]=W,e[4]=i,e[5]=H):H=e[5];const se=H,ee=J?.properties?o.jsx(Ge,{schema:J,value:v,onChange:R=>{if(y&&m){m(y.blockKey,R);return}se(R)},basePath:s,breadcrumbPath:c,onBreadcrumbChange:a,meta:d,decofile:p,onSaveReferencedBlock:m}):null,Y=n.type==="block-ref"&&f.some(fr);let G;e[6]!==s?(G=s.includes("."),e[6]=s,e[7]=G):G=e[7];const q=G;let K;e[8]!==l||e[9]!==s?(K=o.jsx(le,{htmlFor:s,children:l}),e[8]=l,e[9]=s,e[10]=K):K=e[10];let X;e[11]===Symbol.for("react.memo_cache_sentinel")?(X=o.jsx(ft,{children:o.jsx(dt,{placeholder:"Select..."})}),e[11]=X):X=e[11];let te;return e[12]!==n.description?(te=n.description&&o.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[12]=n.description,e[13]=te):te=e[13],o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-1.5",children:[K,o.jsxs(mt,{value:F||void 0,onValueChange:re,children:[X,o.jsx(pt,{children:f.map(ur)})]}),te]}),ee&&(Y?o.jsx(cr,{path:s,open:k,onOpenChange:T,title:q?"Configuration":"Loader configuration",nested:ee,nestedBlockRef:q,globalBlockKey:y?.blockKey}):ee)]})}if(n.anyOfRefs&&n.anyOfRefs.length>0)return null;let N;e[14]!==l||e[15]!==s?(N=o.jsx(le,{htmlFor:s,children:l}),e[14]=l,e[15]=s,e[16]=N):N=e[16];const I=r!=null?String(r):"";let j;e[17]!==i?(j=F=>i(F.target.value),e[17]=i,e[18]=j):j=e[18];const S=n.description??"";let w;e[19]!==s||e[20]!==I||e[21]!==j||e[22]!==S?(w=o.jsx("input",{id:s,type:"text",value:I,onChange:j,className:"w-full rounded-md border bg-background px-3 py-1.5 text-sm",placeholder:S}),e[19]=s,e[20]=I,e[21]=j,e[22]=S,e[23]=w):w=e[23];let C;e[24]!==n.description?(C=n.description&&o.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[24]=n.description,e[25]=C):C=e[25];let O;return e[26]!==N||e[27]!==w||e[28]!==C?(O=o.jsxs("div",{className:"space-y-1.5",children:[N,w,C]}),e[26]=N,e[27]=w,e[28]=C,e[29]=O):O=e[29],O}function ur(t){return o.jsx(ut,{value:t.resolveType,children:t.title??rn(t.resolveType)??t.resolveType},t.resolveType)}function fr(t){return t.resolveType.includes("/")&&!Re(t.resolveType)}function dr(t){return t.resolveType!==""}function lt(t){const e=U.c(2),{ext:n}=t;if(!n)return null;let r;return e[0]!==n?(r=o.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 pr(t){try{const e=new URL(t).pathname;return decodeURIComponent(e.split("/").pop()??t)}catch{return t.split("/").pop()??t}}function mr(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"":t.slice(e+1).toLowerCase()}function at(t){const e=U.c(72),{schema:n,value:r,onChange:i,path:s,label:l}=t,c=n.format==="video-uri",a=gt(r),[d,p]=Q.useState(!1),[m,g]=Q.useState(!1),y=a?pr(a):"",v=y?mr(y):"",f=pn(),h=Jt();let u;e[0]!==f.data?.configs?(u=function(){const $=f.data?.configs??[];if($.length===1)return $[0].id;if($.length===0)return null;const L=typeof window<"u"?window.localStorage.getItem(en):null;return $.some(ne=>ne.id===L)?L:null},e[0]=f.data?.configs,e[1]=u):u=e[1];const x=u;let b;e[2]!==c||e[3]!==i||e[4]!==x||e[5]!==p||e[6]!==h?(b=async function($){if(!$)return;let L=Array.from($);if(L.length===0)return;if(c&&(L=L.filter(yr),L.length===0)){be.error("Please drop a video file (mp4, webm, …).");return}const ne=x();if(!ne){p(!0);return}try{const ae=await h.mutateAsync({configId:ne,file:L[0]});i(ae.publicUrl),L.length>1&&be.info(`Uploaded ${L[0].name}; extra files were ignored (single-select field).`)}catch(ae){const fe=ae;be.error(fe instanceof Error?fe.message:"Upload failed")}},e[2]=c,e[3]=i,e[4]=x,e[5]=p,e[6]=h,e[7]=b):b=e[7];const _=b;let k;e[8]!==g?(k=function($){$.preventDefault(),$.dataTransfer.types.includes("Files")&&g(!0)},e[8]=g,e[9]=k):k=e[9];const T=k;let N;e[10]!==g?(N=function($){$.currentTarget===$.target&&g(!1)},e[10]=g,e[11]=N):N=e[11];const I=N;let j;e[12]!==_||e[13]!==g?(j=function($){$.preventDefault(),g(!1),_($.dataTransfer.files)},e[12]=_,e[13]=g,e[14]=j):j=e[14];const S=j;let w;e[15]!==l||e[16]!==s?(w=o.jsx(le,{htmlFor:s,className:"text-muted-foreground",children:l}),e[15]=l,e[16]=s,e[17]=w):w=e[17];let C;e[18]!==n.description?(C=n.description&&o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=C):C=e[19];let O;e[20]!==w||e[21]!==C?(O=o.jsxs("div",{className:"min-w-0 space-y-0.5",children:[w,C]}),e[20]=w,e[21]=C,e[22]=O):O=e[22];const F=m&&"border-primary ring-2 ring-primary/30",z=h.isPending&&"pointer-events-none opacity-60";let B;e[23]!==z||e[24]!==F?(B=De("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",F,z),e[23]=z,e[24]=F,e[25]=B):B=e[25];let M;e[26]!==v||e[27]!==y||e[28]!==c||e[29]!==p||e[30]!==a||e[31]!==h.isPending?(M=a?c?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"relative h-40 w-full overflow-hidden bg-black",children:o.jsx("video",{src:a,preload:"metadata",className:"h-full w-full object-contain"},a)}),o.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[o.jsx(qe,{size:14,className:"shrink-0 text-muted-foreground"}),o.jsx("p",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:y}),o.jsx(lt,{ext:v})]})]}):o.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",children:[o.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-md bg-background",children:o.jsx(Xe,{size:18,className:"text-muted-foreground"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"truncate text-sm font-medium",children:y}),o.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a})]}),o.jsx(lt,{ext:v})]}):o.jsxs("button",{type:"button",onClick:()=>p(!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?o.jsx(qe,{size:20}):o.jsx(Xe,{size:20}),o.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"}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"Up to 100 MB"})]}),e[26]=v,e[27]=y,e[28]=c,e[29]=p,e[30]=a,e[31]=h.isPending,e[32]=M):M=e[32];let J;e[33]!==m?(J=m&&o.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:o.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:"Drop to upload"})}),e[33]=m,e[34]=J):J=e[34];let W;e[35]!==I||e[36]!==T||e[37]!==S||e[38]!==B||e[39]!==M||e[40]!==J?(W=o.jsxs("div",{onDragOver:T,onDragLeave:I,onDrop:S,className:B,children:[M,J]}),e[35]=I,e[36]=T,e[37]=S,e[38]=B,e[39]=M,e[40]=J,e[41]=W):W=e[41];let re;e[42]!==i?(re=R=>i(R.target.value),e[42]=i,e[43]=re):re=e[43];let H;e[44]!==s||e[45]!==a||e[46]!==re?(H=o.jsx(ue,{id:s,type:"url",value:a,onChange:re,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[44]=s,e[45]=a,e[46]=re,e[47]=H):H=e[47];let se;e[48]!==p?(se=()=>p(!0),e[48]=p,e[49]=se):se=e[49];let ee;e[50]===Symbol.for("react.memo_cache_sentinel")?(ee=o.jsx(dn,{size:14}),e[50]=ee):ee=e[50];const ie=a?"Replace":"Browse";let Y;e[51]!==se||e[52]!==ie?(Y=o.jsxs(Ce,{type:"button",variant:"outline",size:"sm",onClick:se,className:"h-9 shrink-0",children:[ee,ie]}),e[51]=se,e[52]=ie,e[53]=Y):Y=e[53];let G;e[54]!==i||e[55]!==a?(G=a&&o.jsx(Ce,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(""),className:"h-9 shrink-0","aria-label":"Remove file",children:o.jsx(ht,{size:14})}),e[54]=i,e[55]=a,e[56]=G):G=e[56];let q;e[57]!==H||e[58]!==Y||e[59]!==G?(q=o.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[H,Y,G]}),e[57]=H,e[58]=Y,e[59]=G,e[60]=q):q=e[60];let K;e[61]!==i?(K=R=>i(R),e[61]=i,e[62]=K):K=e[62];let X;e[63]!==d||e[64]!==p||e[65]!==K?(X=o.jsx(tn,{open:d,onOpenChange:p,mode:"any",onSelect:K}),e[63]=d,e[64]=p,e[65]=K,e[66]=X):X=e[66];let te;return e[67]!==W||e[68]!==q||e[69]!==X||e[70]!==O?(te=o.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[O,W,q,X]}),e[67]=W,e[68]=q,e[69]=X,e[70]=O,e[71]=te):te=e[71],te}function yr(t){return t.type.startsWith("video/")}const hr="website/loaders/secret.ts";function je(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 gr(){return{__resolveType:hr,name:"",encrypted:""}}function xr(t){const{value:e,...n}=t;return n}function Ve(t){const e=U.c(45),{schema:n,value:r,onChange:i,label:s,path:l}=t;if(typeof r=="string"||r==null&&!je(r)){const N=typeof r=="string"?r:"";let I;e[0]!==s||e[1]!==l?(I=o.jsx(le,{htmlFor:l,className:"text-sm font-medium",children:s}),e[0]=s,e[1]=l,e[2]=I):I=e[2];let j;e[3]!==n.description?(j=n.description&&o.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[3]=n.description,e[4]=j):j=e[4];let S;e[5]!==i?(S=O=>i(O.target.value),e[5]=i,e[6]=S):S=e[6];let w;e[7]!==l||e[8]!==N||e[9]!==S?(w=o.jsx(ue,{id:l,type:"password",value:N,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:"Secret value",onChange:S,className:"h-10"}),e[7]=l,e[8]=N,e[9]=S,e[10]=w):w=e[10];let C;return e[11]!==I||e[12]!==j||e[13]!==w?(C=o.jsxs("div",{className:"space-y-2",children:[I,j,w]}),e[11]=I,e[12]=j,e[13]=w,e[14]=C):C=e[14],C}let c;e[15]!==r?(c=je(r)?r:gr(),e[15]=r,e[16]=c):c=e[16];const a=c,d=typeof a.name=="string"?a.name:"",p=typeof a.encrypted=="string"&&a.encrypted,m=`${l}-name`;let g;e[17]!==s||e[18]!==m?(g=o.jsx(le,{htmlFor:m,className:"text-sm font-medium",children:s}),e[17]=s,e[18]=m,e[19]=g):g=e[19];let y;e[20]!==n.description?(y=n.description&&o.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[20]=n.description,e[21]=y):y=e[21];const v=`${l}-name`;let f;e[22]!==a||e[23]!==i?(f=N=>i({...a,name:N.target.value}),e[22]=a,e[23]=i,e[24]=f):f=e[24];let h;e[25]!==d||e[26]!==v||e[27]!==f?(h=o.jsx(ue,{id:v,value:d,placeholder:"Secret name",onChange:f,className:"h-10"}),e[25]=d,e[26]=v,e[27]=f,e[28]=h):h=e[28];const u=`${l}-value`,x=p?"Leave blank to keep current value":"Secret value";let b;e[29]!==a||e[30]!==p||e[31]!==i?(b=N=>{const I=N.target.value;if(!I){i(p?xr(a):a);return}i({...a,value:I})},e[29]=a,e[30]=p,e[31]=i,e[32]=b):b=e[32];let _;e[33]!==b||e[34]!==u||e[35]!==x?(_=o.jsx(ue,{id:u,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:x,onChange:b,className:"h-10"}),e[33]=b,e[34]=u,e[35]=x,e[36]=_):_=e[36];let k;e[37]!==p?(k=p&&o.jsx("p",{className:"text-xs text-muted-foreground",children:"A secret value is stored."}),e[37]=p,e[38]=k):k=e[38];let T;return e[39]!==_||e[40]!==k||e[41]!==g||e[42]!==y||e[43]!==h?(T=o.jsxs("div",{className:"space-y-2",children:[g,y,h,_,k]}),e[39]=_,e[40]=k,e[41]=g,e[42]=y,e[43]=h,e[44]=T):T=e[44],T}const vr=new Set(["__resolveType","@type"]);function br(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 jr(t){if(Be(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 ct(t){if(t.type==="array"&&t.items)return t;const e=t.items??jr(t);return e?{...t,type:"array",items:e}:null}function Tr(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 wt(t){const{schema:e,value:n}=t;if(sn(n)){const l=on(n),c=ct(e);if(l!==null&&c)return o.jsx(Me,{...t,schema:c,value:l,onChange:a=>t.onChange(ln(n,a))},t.path)}if(Array.isArray(n)&&e.type==="block-ref"&&Be(e)){const l=ct(e);if(l)return o.jsx(Me,{...t,schema:l,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 l=br(e);return l==="image"?o.jsx(Je,{...t},t.path):l==="file"?o.jsx(at,{...t},t.path):e.anyOfRefs?o.jsx(ot,{...t},t.path):null}if(e.format==="image-uri")return o.jsx(Je,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return o.jsx(at,{...t},t.path);if(e.enum&&e.enum.length>0)return o.jsx(Dn,{...t},t.path);if(e.type==="anyOf")return o.jsx(ot,{...t},t.path);if(je(n)||e.format==="password"||n==null&&e.format==="password")return o.jsx(Ve,{...t},t.path);const r=n??Tr(e.type,e.default);if(r==null)return je(n)?o.jsx(Ve,{...t},t.path):null;if(je(r))return o.jsx(Ve,{...t,value:r},t.path);const i={...t,value:r},s=n==null?e.type??typeof r:Array.isArray(r)?"array":typeof r;if(s==="array"||Array.isArray(r))return o.jsx(Me,{...i},t.path);switch(s){case"boolean":return o.jsx(In,{...i},t.path);case"number":case"integer":return o.jsx(Cn,{...i},t.path);case"string":{const l=e.format;return l==="color-input"?o.jsx(Ae,{...i},t.path):l==="textarea"||l==="rich-text"||l==="html"?o.jsx(Ae,{...i},t.path):o.jsx(Ae,{...i},t.path)}case"object":return r!==null&&typeof r=="object"&&!Array.isArray(r)?o.jsx(Jn,{...i},t.path):null;default:return o.jsx(Ae,{...i},t.path)}}function Ge(t){const e=U.c(15),{schema:n,value:r,onChange:i,basePath:s,breadcrumbPath:l,onBreadcrumbChange:c,meta:a,decofile:d,onSaveReferencedBlock:p,previewBaseUrl:m,onAddSectionItem:g,onRequestAddSection:y}=t;let v,f;if(e[0]!==s||e[1]!==d||e[2]!==a||e[3]!==g||e[4]!==c||e[5]!==i||e[6]!==y||e[7]!==p||e[8]!==m||e[9]!==n.properties||e[10]!==l||e[11]!==r){f=Symbol.for("react.early_return_sentinel");e:{const h=l===void 0?[]:l,u=n.properties;if(!u){f=null;break e}const x=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},b=Object.keys(u).filter(S=>!vr.has(S)&&u[S]?.hidden!==!0);if(b.length===0){let S;e[14]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No editable fields on this section."}),e[14]=S):S=e[14],f=S;break e}const _=(S,w)=>{i({...x,[S]:w})},k=typeof x.__resolveType=="string"?x.__resolveType:void 0,T=h.length>0?Pn(b,u,x,h):null,N=T?u[T]:null,I=T&&N?[T]:b,j=T&&N?En(T,N,h):h;v=o.jsx("div",{className:"min-w-0 space-y-6",children:I.map(S=>{const w=u[S];if(!w)return null;const C=s?`${s}.${S}`:S,O=Fe(S,w);return wt({schema:w,value:x[S],onChange:F=>_(S,F),path:C,label:O,breadcrumbPath:j,onBreadcrumbChange:c,meta:a,decofile:d,onSaveReferencedBlock:p,containerResolveType:k,previewBaseUrl:m,onAddSectionItem:g,onRequestAddSection:y})})})}e[0]=s,e[1]=d,e[2]=a,e[3]=g,e[4]=c,e[5]=i,e[6]=y,e[7]=p,e[8]=m,e[9]=n.properties,e[10]=l,e[11]=r,e[12]=v,e[13]=f}else v=e[12],f=e[13];return f!==Symbol.for("react.early_return_sentinel")?f:v}export{Ge as S,wt as a,Wr as b,Ae as c,Ke as r,mn as s,Hr as u};
1
+ import{e as U,j as o,r as Q,B as Ce,c as De,n as be}from"./index-CATx2LDP.js";import{ab as Ct,v as It,ar as qe,H as Xe}from"./agent-icon-BIiUgn6T.js";import{C as Rt}from"./calendar-BOtLk06o.js";import{I as ue}from"./input-mRhCdgaG.js";import{L as le}from"./label-CfV-PYxa.js";import{a as Ot,b as Ft,P as Dt}from"./popover-Djx3eehK.js";import{T as $t}from"./textarea-QDTInyWb.js";import{S as Bt}from"./switch-BCvTAJSU.js";import{c as ut,S as ft,a as dt,b as pt,d as mt}from"./select-Cgf1CYEw.js";import{a as Et,b as Ze,K as Lt,P as Pt,D as zt,c as Mt,S as Vt,v as Ut,f as Kt,e as Qe,d as Ht,C as Wt,s as Yt}from"./sortable.esm-BSN8qWvt.js";import{d as yt}from"./ZoomOut-B2ojfl-A.js";import{s as Gt}from"./Plus-C5heVoJ6.js";import{s as ht}from"./Trash01-DM00_xyO.js";import{a as qt,b as Xt,c as Zt,D as Qt}from"./dropdown-menu-BWTWFWGo.js";import{e as gt,u as Jt,L as en,F as tn,I as Je}from"./image-field-BSr72dUp.js";import{l as xt,i as Ie,a as $e,S as vt,P as nn,X as Be,n as Ue,Y as Re,Z as et,_ as rn,$ as sn,a0 as on,a1 as ln}from"./index-BAd8YgC5.js";import{t as bt}from"./ChevronDown-2xes5oAP.js";import{i as jt}from"./ChevronRight-BAb1spam.js";import{i as an}from"./Globe01-BaaIcJuv.js";import{T as cn,b as un,a as fn}from"./tooltip-1mt0C65x.js";import{i as dn}from"./Upload01-D0E7TXXq.js";import{c as pn}from"./use-file-configs-nuDPJJdx.js";function mn(t){if(t?.trim())try{const e=new URL(t);return e.protocol!=="https:"?void 0:e.href}catch{return}}function yn(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 Tt(t){if(typeof t=="string"||t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(Tt);const e=t;return e.__resolveType?yn(e)??t:Nt(e)}function Nt(t){const e={};for(const[n,r]of Object.entries(t))e[n]=Tt(r);return e}function hn(t,e){return e.split(".").reduce((n,r)=>{if(!(n==null||typeof n!="object"))return n[r]},t)}function St(t){return t==null?"":Array.isArray(t)?t.map(St).filter(Boolean).join(","):typeof t=="object"?"":String(t)}function Ke(t,e){if(!t.includes("{"))return;const n=Nt(e);return t.replace(/\{\{\{([^}]+)\}\}\}|\{\{([^}]+)\}\}/g,(i,s,l)=>{const c=(s??l??"").trim();return St(hn(n,c))}).trim()||void 0}function gn(t,e){if(e.includes("{"))return Ke(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 ge(t,e,n){if(typeof t=="string")return t||`Item ${e+1}`;if(typeof t=="number"||typeof t=="boolean")return String(t);if(t&&typeof t=="object"&&!Array.isArray(t)){const r=t;if(n?.titleBy){const s=gn(r,n.titleBy);if(s)return s}for(const s of["name","label","title","alt","text","href","id"]){const l=r[s];if(typeof l=="string"&&l)return l;if(Array.isArray(l)){const c=l.map(a=>a==null?"":String(a)).filter(Boolean).join(",");if(c)return c}}const i=r.__resolveType;if(typeof i=="string"&&i)return xt(i);if(n?.title){const s=Ke(n.title,r);if(s)return s;if(!n.title.includes("{"))return n.title}}return`Item ${e+1}`}function xn(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 tt(t,e){if(!t||typeof t!="object"||Array.isArray(t))return;const n=xn(e);if(!n)return;const r=Ke(n,t);if(!r)return;const i=gt(r)||r;return mn(i)}function _t(t){return t===vt||t===nn}function Ee(t,e){if(!Object.hasOwn(e,t))return null;const n=e[t]??{},r=n.__resolveType??t;return{data:{...n},resolveType:r}}function Oe(t,e){const n=t.__resolveType??"";if(!n)return null;if(Ie(n)){const r=t.section??{};return kt(r,e)}if(_t(n)){const r=t.variants?.[0]?.value;return r?Oe(r,e):null}return!$e(n)||!Object.hasOwn(e,n)?{data:{...t},resolveType:n}:Ee(n,e)}function kt(t,e){const n=t.__resolveType??"";if(!n)return null;if(_t(n)){const r=t.variants?.[0]?.value;return r?Oe(r,e):null}return!$e(n)||!Object.hasOwn(e,n)?{data:{...t},resolveType:n}:Ee(n,e)}function vn(t,e){if(!t||typeof t!="object"||Array.isArray(t))return null;const r=t.__resolveType;if(typeof r!="string"||!$e(r)||!Object.hasOwn(e,r))return null;const i=Ee(r,e);return i?{blockKey:r,...i}:null}function Hr(t,e,n){if(e.isMultivariate)return null;if(e.isSavedBlock){const r=e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType;return Ee(r,n)}if(e.isHidden){const s=(Ie(t.__resolveType)?t.section:t)?.variants?.[0]?.value??t;return Oe(s,n)}if(e.isLazy||Ie(t.__resolveType)){const r=t.section??{};return kt(r,n)}return Oe(t,n)}const he=t=>String(t).padStart(2,"0"),bn="1900-01-01",jn="2099-12-31",Tn="1900-01-01T00:00",Nn="2099-12-31T23:59";function Sn(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()}-${he(n.getUTCMonth()+1)}-${he(n.getUTCDate())}`}function _n(t){return!t||!/^\d{4}-\d{2}-\d{2}$/.test(t)?"":`${t}T00:00:00.000Z`}function kn(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${he(e.getMonth()+1)}-${he(e.getDate())}T${he(e.getHours())}:${he(e.getMinutes())}`}function An(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toISOString()}function wn(t){const e=U.c(29),{id:n,withTime:r,value:i,onChange:s}=t,[l,c]=Q.useState(!1);let a;e[0]!==i||e[1]!==r?(a=r?kn(i):Sn(i),e[0]=i,e[1]=r,e[2]=a):a=e[2];const d=a;let p;e[3]!==s||e[4]!==r?(p=j=>{s(r?An(j.target.value):_n(j.target.value))},e[3]=s,e[4]=r,e[5]=p):p=e[5];const m=p;let g;if(e[6]!==i){const j=i?new Date(i):null;g=j&&!Number.isNaN(j.getTime())?j:null,e[6]=i,e[7]=g}else g=e[7];const y=g;let v;e[8]!==s||e[9]!==y||e[10]!==r?(v=j=>{j&&(r&&y?j.setHours(y.getHours(),y.getMinutes(),0,0):j.setHours(0,0,0,0),s(j.toISOString()),c(!1))},e[8]=s,e[9]=y,e[10]=r,e[11]=v):v=e[11];const f=v,h=r?"datetime-local":"date",u=r?Tn:bn,x=r?Nn:jn;let b;e[12]!==m||e[13]!==n||e[14]!==d||e[15]!==h||e[16]!==u||e[17]!==x?(b=o.jsx(ue,{id:n,type:h,min:u,max:x,value:d,onChange:m,className:"h-10 flex-1 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:opacity-0"}),e[12]=m,e[13]=n,e[14]=d,e[15]=h,e[16]=u,e[17]=x,e[18]=b):b=e[18];let _;e[19]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Ot,{asChild:!0,children:o.jsx(Ce,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0","aria-label":"Open calendar",children:o.jsx(Ct,{className:"h-4 w-4"})})}),e[19]=_):_=e[19];const k=y??void 0;let T;e[20]!==f||e[21]!==k?(T=o.jsx(Ft,{className:"w-auto p-0",align:"end",children:o.jsx(Rt,{mode:"single",selected:k,onSelect:f,initialFocus:!0})}),e[20]=f,e[21]=k,e[22]=T):T=e[22];let N;e[23]!==l||e[24]!==T?(N=o.jsxs(Dt,{open:l,onOpenChange:c,children:[_,T]}),e[23]=l,e[24]=T,e[25]=N):N=e[25];let I;return e[26]!==N||e[27]!==b?(I=o.jsxs("div",{className:"flex gap-1",children:[b,N]}),e[26]=N,e[27]=b,e[28]=I):I=e[28],I}function ke(t){const e=U.c(8),{htmlFor:n,label:r,description:i}=t;let s;e[0]!==n||e[1]!==r?(s=o.jsx(le,{htmlFor:n,children:r}),e[0]=n,e[1]=r,e[2]=s):s=e[2];let l;e[3]!==i?(l=i&&o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:i}),e[3]=i,e[4]=l):l=e[4];let c;return e[5]!==s||e[6]!==l?(c=o.jsxs("div",{className:"space-y-0.5",children:[s,l]}),e[5]=s,e[6]=l,e[7]=c):c=e[7],c}function Ae(t){const e=U.c(61),{schema:n,value:r,onChange:i,path:s,label:l}=t,c=typeof r=="string"?r:"",a=n.format;if(a==="textarea"||a==="rich-text"||a==="rich-text-inline"||a==="markdown"){let f;e[0]!==l||e[1]!==s||e[2]!==n.description?(f=o.jsx(ke,{htmlFor:s,label:l,description:n.description}),e[0]=l,e[1]=s,e[2]=n.description,e[3]=f):f=e[3];let h;e[4]!==i?(h=b=>i(b.target.value),e[4]=i,e[5]=h):h=e[5];let u;e[6]!==s||e[7]!==c||e[8]!==h?(u=o.jsx($t,{id:s,value:c,onChange:h,rows:4}),e[6]=s,e[7]=c,e[8]=h,e[9]=u):u=e[9];let x;return e[10]!==f||e[11]!==u?(x=o.jsxs("div",{className:"space-y-2",children:[f,u]}),e[10]=f,e[11]=u,e[12]=x):x=e[12],x}if(a==="date"||a==="date-time"){let f;e[13]!==l||e[14]!==s||e[15]!==n.description?(f=o.jsx(ke,{htmlFor:s,label:l,description:n.description}),e[13]=l,e[14]=s,e[15]=n.description,e[16]=f):f=e[16];const h=a==="date-time";let u;e[17]!==i||e[18]!==s||e[19]!==c||e[20]!==h?(u=o.jsx(wn,{id:s,withTime:h,value:c,onChange:i}),e[17]=i,e[18]=s,e[19]=c,e[20]=h,e[21]=u):u=e[21];let x;return e[22]!==f||e[23]!==u?(x=o.jsxs("div",{className:"space-y-2",children:[f,u]}),e[22]=f,e[23]=u,e[24]=x):x=e[24],x}if(a==="color-input"){let f;e[25]!==l||e[26]!==s||e[27]!==n.description?(f=o.jsx(ke,{htmlFor:s,label:l,description:n.description}),e[25]=l,e[26]=s,e[27]=n.description,e[28]=f):f=e[28];const h=c||"#000000";let u;e[29]!==i?(u=N=>i(N.target.value),e[29]=i,e[30]=u):u=e[30];let x;e[31]!==h||e[32]!==u?(x=o.jsx("input",{type:"color",value:h,onChange:u,className:"h-10 w-10 cursor-pointer rounded-lg border border-border bg-background p-1"}),e[31]=h,e[32]=u,e[33]=x):x=e[33];let b;e[34]!==i?(b=N=>i(N.target.value),e[34]=i,e[35]=b):b=e[35];let _;e[36]!==s||e[37]!==c||e[38]!==b?(_=o.jsx(ue,{id:s,value:c,onChange:b,placeholder:"#000000",className:"h-10 flex-1"}),e[36]=s,e[37]=c,e[38]=b,e[39]=_):_=e[39];let k;e[40]!==x||e[41]!==_?(k=o.jsxs("div",{className:"flex items-center gap-2",children:[x,_]}),e[40]=x,e[41]=_,e[42]=k):k=e[42];let T;return e[43]!==f||e[44]!==k?(T=o.jsxs("div",{className:"space-y-2",children:[f,k]}),e[43]=f,e[44]=k,e[45]=T):T=e[45],T}let d;e[46]!==l||e[47]!==s||e[48]!==n.description?(d=o.jsx(ke,{htmlFor:s,label:l,description:n.description}),e[46]=l,e[47]=s,e[48]=n.description,e[49]=d):d=e[49];const p=a==="url"?"url":"text";let m;e[50]!==i?(m=f=>i(f.target.value),e[50]=i,e[51]=m):m=e[51];const g=n.default!=null?String(n.default):void 0;let y;e[52]!==s||e[53]!==c||e[54]!==p||e[55]!==m||e[56]!==g?(y=o.jsx(ue,{id:s,type:p,value:c,onChange:m,placeholder:g,className:"h-10"}),e[52]=s,e[53]=c,e[54]=p,e[55]=m,e[56]=g,e[57]=y):y=e[57];let v;return e[58]!==d||e[59]!==y?(v=o.jsxs("div",{className:"space-y-2",children:[d,y]}),e[58]=d,e[59]=y,e[60]=v):v=e[60],v}function Cn(t){const e=U.c(17),{schema:n,value:r,onChange:i,path:s,label:l}=t,c=typeof r=="number"?r:"";let a;e[0]!==l||e[1]!==s?(a=o.jsx(le,{htmlFor:s,children:l}),e[0]=l,e[1]=s,e[2]=a):a=e[2];let d;e[3]!==n.description?(d=n.description&&o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[3]=n.description,e[4]=d):d=e[4];let p;e[5]!==a||e[6]!==d?(p=o.jsxs("div",{className:"space-y-0.5",children:[a,d]}),e[5]=a,e[6]=d,e[7]=p):p=e[7];let m;e[8]!==i?(m=v=>{const f=v.target.value;i(f===""?void 0:Number(f))},e[8]=i,e[9]=m):m=e[9];let g;e[10]!==c||e[11]!==s||e[12]!==m?(g=o.jsx(ue,{id:s,type:"number",value:c,onChange:m,className:"h-10"}),e[10]=c,e[11]=s,e[12]=m,e[13]=g):g=e[13];let y;return e[14]!==p||e[15]!==g?(y=o.jsxs("div",{className:"space-y-2",children:[p,g]}),e[14]=p,e[15]=g,e[16]=y):y=e[16],y}function In(t){const e=U.c(17),{value:n,onChange:r,path:i,label:s,schema:l}=t,c=typeof n=="boolean"?n:!1;let a;e[0]!==s||e[1]!==i?(a=o.jsx(le,{htmlFor:i,children:s}),e[0]=s,e[1]=i,e[2]=a):a=e[2];let d;e[3]!==l.description?(d=l.description&&o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:l.description}),e[3]=l.description,e[4]=d):d=e[4];let p;e[5]!==a||e[6]!==d?(p=o.jsxs("div",{className:"space-y-0.5",children:[a,d]}),e[5]=a,e[6]=d,e[7]=p):p=e[7];let m;e[8]!==r?(m=v=>r(v),e[8]=r,e[9]=m):m=e[9];let g;e[10]!==c||e[11]!==i||e[12]!==m?(g=o.jsx(Bt,{id:i,checked:c,onCheckedChange:m}),e[10]=c,e[11]=i,e[12]=m,e[13]=g):g=e[13];let y;return e[14]!==p||e[15]!==g?(y=o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[p,g]}),e[14]=p,e[15]=g,e[16]=y):y=e[16],y}const He="__enum_empty__";function We(t){return t===""?He:String(t)}function Rn(t,e){if(t===He)return"";const n=e.find(r=>We(r)===t);return n!==void 0?n:t}function On(t,e){return t==null?e.some(n=>n==="")?He:void 0:We(t)}function Fn(t){return t===""?"":String(t)}function Dn(t){const e=U.c(28),{schema:n,value:r,onChange:i,path:s,label:l}=t;let c;e[0]!==n.enum?(c=n.enum??[],e[0]=n.enum,e[1]=c):c=e[1];const a=c;let d;e[2]!==a||e[3]!==r?(d=On(r,a),e[2]=a,e[3]=r,e[4]=d):d=e[4];const p=d;let m;e[5]!==l||e[6]!==s?(m=o.jsx(le,{htmlFor:s,children:l}),e[5]=l,e[6]=s,e[7]=m):m=e[7];let g;e[8]!==n.description?(g=n.description&&o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[8]=n.description,e[9]=g):g=e[9];let y;e[10]!==m||e[11]!==g?(y=o.jsxs("div",{className:"space-y-0.5",children:[m,g]}),e[10]=m,e[11]=g,e[12]=y):y=e[12];let v;e[13]!==i||e[14]!==a?(v=_=>i(Rn(_,a)),e[13]=i,e[14]=a,e[15]=v):v=e[15];let f;e[16]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(ft,{className:"h-10",children:o.jsx(dt,{placeholder:"Select..."})}),e[16]=f):f=e[16];let h;e[17]!==a?(h=a.map($n),e[17]=a,e[18]=h):h=e[18];let u;e[19]!==h?(u=o.jsx(pt,{children:h}),e[19]=h,e[20]=u):u=e[20];let x;e[21]!==p||e[22]!==v||e[23]!==u?(x=o.jsxs(mt,{value:p,onValueChange:v,children:[f,u]}),e[21]=p,e[22]=v,e[23]=u,e[24]=x):x=e[24];let b;return e[25]!==x||e[26]!==y?(b=o.jsxs("div",{className:"space-y-2",children:[y,x]}),e[25]=x,e[26]=y,e[27]=b):b=e[27],b}function $n(t){const e=We(t);return o.jsx(ut,{value:e,children:Fn(t)},e)}function Bn(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase())}function Te(t){return t.normalize("NFC").trim()}function V(t,e){return Te(t)===Te(e)}function we(t,e,n){const r=Te(n);if(t.some(l=>V(l,r)||V(l,n)))return t;const i=[...t];return i.some(l=>V(l,e))||i.push(e),i.push(n),i}function En(t,e,n){if(n.length===0)return n;const r=Fe(t,e),i=n[0];return V(i,r)||V(i,t)?n.slice(1):n}function Fe(t,e){return e.title??Bn(t)}function Wr(t,e){return e<=0?[]:t.slice(0,e)}function nt(t,e){const n=Te(e);return t.findIndex(r=>Te(r)===n)}function rt(t,e){return t.type==="array"&&t.items||Be(t)?!0:Array.isArray(e)}function Ln(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)?t:{}}function Ne(t,e,n,r){if(r.length===0)return null;const i=r[0];for(const s of t){const l=e[s];if(!l||!rt(l,n[s]))continue;const c=Fe(s,l);if(V(i,c)||V(i,s)||r.some(a=>V(a,c)||V(a,s)))return s}for(const s of t){const l=e[s];if(!l||!rt(l,n[s]))continue;const c=n[s];if(!Array.isArray(c))continue;const a=l.items;for(let d=0;d<c.length;d++){const p=ge(c[d],d,a);if(V(p,i))return s}}for(const s of t){const l=e[s];if(l?.type!=="object"||!l.properties)continue;const c=Object.keys(l.properties),a=Ln(n[s]),d=Fe(s,l);if(Ne(c,l.properties,a,r)||(V(i,d)||V(i,s))&&Ne(c,l.properties,a,r.slice(1)))return s}return null}function Pn(t,e,n,r){return Ne(t,e,n,r)}function zn(t,e,n,r,i){if(i.length===0||!n.properties)return!1;const s=Object.keys(n.properties);if(Ne(s,n.properties,r,i))return!0;const l=i[0];return!V(l,e)&&!V(l,t)?!1:i.length>1||Ne(s,n.properties,r,i.slice(1))!==null}function Mn(t,e,n,r){if(e.length===0)return null;for(let s=0;s<e.length;s++){const l=e[s],c=n.findIndex((a,d)=>V(ge(a,d,r),l));if(c>=0)return{index:c,innerPath:e.slice(s+1)}}const i=e.findIndex(s=>V(s,t));if(i>=0&&e.length>i+1){const s=e[i+1],l=n.findIndex((c,a)=>V(ge(c,a,r),s));if(l>=0)return{index:l,innerPath:e.slice(i+2)}}return null}function ze(t){return t.includes("/sections/")||t.includes("multivariate/section")||t===vt}function Vn(t){if(t.type==="block-ref"&&t.anyOfRefs?.length)return t.anyOfRefs.some(n=>ze(n.resolveType));if(t.anyOfRefs?.length)return t.anyOfRefs.some(n=>ze(n.resolveType));const e=t.properties?.__resolveType;return e?.type==="block-ref"&&e.anyOfRefs?.length?e.anyOfRefs.some(n=>ze(n.resolveType)):!1}function Un(t,e){if(e==="global"||e==="sections"||Be(t))return!0;const n=t.type==="array"?t.items:void 0;return n?Vn(n):!1}function st(t){return Array.from({length:t},(e,n)=>({id:crypto.randomUUID(),index:n}))}function Kn(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 s=t.__resolveType;if(typeof s=="string"&&n){const l=Ue(s,n);if(l?.properties&&Object.keys(l.properties).length>0)return l}}if(n&&r&&i){const l=Ue(r,n)?.properties?.[i]?.items;if(l?.properties&&Object.keys(l.properties).length>0)return{...l,titleBy:l.titleBy??e?.titleBy}}return e}function Hn(t){const e=t.split(".").filter(n=>!/^\d+$/.test(n));return e[e.length-1]??t}function At(t){return t.map((e,n)=>({...e,index:n}))}function Wn(t,e){if(e===t.length)return t;if(e<t.length)return At(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 Yn(t){const e=U.c(8),{labelText:n,imageSrc:r}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(yt,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[0]=i):i=e[0];let s;e[1]!==r?(s=r&&o.jsx("img",{src:r,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[1]=r,e[2]=s):s=e[2];let l;e[3]!==n?(l=o.jsx("span",{className:"min-w-0 truncate",children:n}),e[3]=n,e[4]=l):l=e[4];let c;return e[5]!==s||e[6]!==l?(c=o.jsxs(o.Fragment,{children:[i,o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2.5 text-sm",children:[s,l]})]}),e[5]=s,e[6]=l,e[7]=c):c=e[7],c}function Gn(t){const e=U.c(37),{sortableId:n,labelText:r,imageSrc:i,onOpen:s,onRemove:l}=t;let c;e[0]!==n?(c={id:n,animateLayoutChanges:Zn},e[0]=n,e[1]=c):c=e[1];const{attributes:a,listeners:d,setNodeRef:p,transform:m,isDragging:g}=Ht(c);let y;e[2]!==m?(y=Wt.Transform.toString(m?{...m,x:0}:null),e[2]=m,e[3]=y):y=e[3];const v=g?0:void 0;let f;e[4]!==y||e[5]!==v?(f={transform:y,opacity:v},e[4]=y,e[5]=v,e[6]=f):f=e[6];const h=f;let u;e[7]!==s?(u=F=>{(F.key==="Enter"||F.key===" ")&&(F.preventDefault(),s())},e[7]=s,e[8]=u):u=e[8];const x=g?"cursor-grabbing":"cursor-pointer";let b;e[9]!==x?(b=De("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",x),e[9]=x,e[10]=b):b=e[10];let _;e[11]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(yt,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[11]=_):_=e[11];let k;e[12]!==i?(k=i&&o.jsx("img",{src:i,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[12]=i,e[13]=k):k=e[13];let T;e[14]!==r?(T=o.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 I;e[16]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx(It,{size:14}),e[16]=I):I=e[16];let j;e[17]!==N?(j=o.jsx(qt,{asChild:!0,children:o.jsx(Ce,{type:"button",variant:"ghost",size:"icon","aria-label":N,className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100",onClick:Xn,onPointerDown:qn,children:I})}),e[17]=N,e[18]=j):j=e[18];let S;e[19]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(ht,{size:14}),e[19]=S):S=e[19];let w;e[20]!==l?(w=o.jsx(Xt,{align:"end",children:o.jsxs(Zt,{className:"text-destructive focus:text-destructive",onClick:l,children:[S,"Delete"]})}),e[20]=l,e[21]=w):w=e[21];let C;e[22]!==j||e[23]!==w?(C=o.jsxs(Qt,{children:[j,w]}),e[22]=j,e[23]=w,e[24]=C):C=e[24];let O;return e[25]!==a||e[26]!==r||e[27]!==d||e[28]!==s||e[29]!==p||e[30]!==h||e[31]!==T||e[32]!==C||e[33]!==u||e[34]!==b||e[35]!==k?(O=o.jsxs("div",{ref:p,style:h,...a,...d,role:"button",tabIndex:0,onClick:s,onKeyDown:u,className:b,title:r,children:[_,k,T,C]}),e[25]=a,e[26]=r,e[27]=d,e[28]=s,e[29]=p,e[30]=h,e[31]=T,e[32]=C,e[33]=u,e[34]=b,e[35]=k,e[36]=O):O=e[36],O}function qn(t){return t.stopPropagation()}function Xn(t){return t.stopPropagation()}function Zn(){return!1}function Me(t){const e=U.c(24),{schema:n,value:r,onChange:i,path:s,label:l,breadcrumbPath:c,onBreadcrumbChange:a,meta:d,decofile:p,onSaveReferencedBlock:m,containerResolveType:g,previewBaseUrl:y,onAddSectionItem:v,onRequestAddSection:f}=t,h=c===void 0?[]:c,u=Array.isArray(r)?r:[],x=n.items,b=Hn(s),_=Un(n,b),k=Mn(l,h,u,x),T=k?.index??null,[N,I]=Q.useState(()=>st(u.length)),[j,S]=Q.useState(null),[w,C]=Q.useState(s),[O,F]=Q.useState(u.length),z=Q.useRef(!1);w!==s?(C(s),F(u.length),I(st(u.length))):O!==u.length&&(F(u.length),I(A=>Wn(A,u.length)));let B;e[0]!==x?(B=(A,D)=>ge(A,D,x),e[0]=x,e[1]=B):B=e[1];const M=B,J=A=>{if(z.current)return;const D=M(u[A],A);a?.(we(h,l,D))},W=A=>{const D=[...u,A];i(D);const E=D.length-1,P=ge(A,E,x);a?.(we(h,l,P))},re=()=>{const A=x?.type,D=x?.default!==void 0?x.default:A==="object"?{}:A==="block-ref"?(()=>{const ce=x?.anyOfRefs?.[0]?.resolveType;return typeof ce!="string"||Re(ce)?{}:{__resolveType:ce}})():A==="number"||A==="integer"?0:A==="boolean"?!1:A==="array"?[]:"",E=[...u,D];i(E);const P=E.length-1,oe=ge(D,P,x);a?.(we(h,l,oe))},H=()=>{if(_){if(!y){be.error("Start the preview dev server to add sections.");return}if(f){f({append:W});return}be.error("Section picker is not available in this editor.");return}re()},se=A=>{if(i(u.filter((D,E)=>E!==A)),T===A){const D=M(u[A],A),E=nt(h,D);a?.(E>=0?h.slice(0,E):[])}},ee=(A,D)=>{const E=[...u];E[A]=D,i(E)};let ie;e[2]===Symbol.for("react.memo_cache_sentinel")?(ie={activationConstraint:{distance:8}},e[2]=ie):ie=e[2];let Y;e[3]===Symbol.for("react.memo_cache_sentinel")?(Y={coordinateGetter:Yt},e[3]=Y):Y=e[3];const G=Et(Ze(Pt,ie),Ze(Lt,Y)),q=N.map(Qn);let K;e[4]===Symbol.for("react.memo_cache_sentinel")?(K=A=>{S(String(A.active.id))},e[4]=K):K=e[4];const X=K,te=A=>{S(null);const{active:D,over:E}=A;if(!E||D.id===E.id)return;const P=q.indexOf(String(D.id)),oe=q.indexOf(String(E.id));P===-1||oe===-1||(I(ce=>At(Qe([...ce],P,oe))),i(Qe([...u],P,oe)),z.current=!0,requestAnimationFrame(()=>{z.current=!1}))};let R;e[5]===Symbol.for("react.memo_cache_sentinel")?(R=()=>{S(null)},e[5]=R):R=e[5];const $=R,L=j?N.find(A=>A.id===j):null,ne=L!=null?u[L.index]:void 0,ae=L!=null&&ne!==void 0?M(ne,L.index):null,fe=L!=null&&ne!==void 0?tt(ne,x):void 0;if(T!==null&&T<u.length){const A=u[T],D=Kn(A,x,d,g,b),E=()=>{const P=M(A,T),oe=we(h,l,P),ce=nt(oe,P);return ce>=0?oe.slice(0,ce+1):oe};return o.jsx("div",{className:"min-w-0",children:D?.type==="object"&&D.properties?o.jsx(Ge,{schema:D,value:A,onChange:P=>ee(T,P),basePath:`${s}.${T}`,breadcrumbPath:k?.innerPath??[],onBreadcrumbChange:P=>{a?.([...E(),...P])},meta:d,decofile:p,onSaveReferencedBlock:m,previewBaseUrl:y,onAddSectionItem:v,onRequestAddSection:f}):D?wt({schema:D,value:A,onChange:P=>ee(T,P),path:`${s}.${T}`,label:D.title??`Item ${T+1}`,breadcrumbPath:k?.innerPath??[],onBreadcrumbChange:P=>{a?.([...E(),...P])},meta:d,decofile:p,onSaveReferencedBlock:m,previewBaseUrl:y,onAddSectionItem:v,onRequestAddSection:f}):null})}const xe="space-y-2";let Z;e[6]!==l?(Z=o.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:l}),e[6]=l,e[7]=Z):Z=e[7];const ve=u.length>0&&o.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:u.length});let de;e[8]!==Z||e[9]!==ve?(de=o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[Z,ve]}),e[8]=Z,e[9]=ve,e[10]=de):de=e[10];let pe;e[11]!==n.description?(pe=n.description&&o.jsx("p",{className:"break-words text-xs leading-normal text-muted-foreground",children:n.description}),e[11]=n.description,e[12]=pe):pe=e[12];let me;e[13]!==de||e[14]!==pe?(me=o.jsxs("div",{className:"min-w-0 space-y-0.5",children:[de,pe]}),e[13]=de,e[14]=pe,e[15]=me):me=e[15];const Le=u.length>0&&o.jsx("div",{className:De(j&&"cursor-grabbing"),children:o.jsxs(zt,{sensors:G,collisionDetection:Mt,onDragStart:X,onDragEnd:te,onDragCancel:$,children:[o.jsx(Vt,{items:q,strategy:Ut,children:o.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border/50 p-1.5",children:N.map(A=>{const D=u[A.index];if(D===void 0)return null;const E=M(D,A.index),P=tt(D,x);return o.jsx(Gn,{sortableId:A.id,labelText:E,imageSrc:P,onOpen:()=>J(A.index),onRemove:()=>se(A.index)},A.id)})})}),o.jsx(Kt,{dropAnimation:null,children:ae?o.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:o.jsx(Yn,{labelText:ae,imageSrc:fe})}):null})]})});let Se;e[16]===Symbol.for("react.memo_cache_sentinel")?(Se=o.jsx(Gt,{size:14}),e[16]=Se):Se=e[16];const Pe=_?"Add section":"Add item";let ye;e[17]!==H||e[18]!==Pe?(ye=o.jsxs("button",{type:"button",onClick:H,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:[Se,Pe]}),e[17]=H,e[18]=Pe,e[19]=ye):ye=e[19];let _e;return e[20]!==me||e[21]!==Le||e[22]!==ye?(_e=o.jsxs("div",{className:xe,children:[me,Le,ye]}),e[20]=me,e[21]=Le,e[22]=ye,e[23]=_e):_e=e[23],_e}function Qn(t){return t.id}function Jn(t){const e=U.c(43),{schema:n,value:r,onChange:i,path:s,label:l,breadcrumbPath:c,onBreadcrumbChange:a,meta:d,decofile:p,onSaveReferencedBlock:m,previewBaseUrl:g,onAddSectionItem:y,onRequestAddSection:v}=t;let f;e[0]!==c?(f=c===void 0?[]:c,e[0]=c,e[1]=f):f=e[1];const h=f,[u,x]=Q.useState(!1);let b;e[2]!==r?(b=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},e[2]=r,e[3]=b):b=e[3];const _=b;if(!n.properties)return null;let k;e[4]!==s?(k=s.split(".").pop()??s,e[4]=s,e[5]=k):k=e[5];const T=k;let N;e[6]!==h||e[7]!==T||e[8]!==l||e[9]!==_||e[10]!==n?(N=zn(T,l,n,_,h),e[6]=h,e[7]=T,e[8]=l,e[9]=_,e[10]=n,e[11]=N):N=e[11];const j=u||N,S=`${s}-fields`;let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=()=>x(er),e[12]=w):w=e[12];let C;e[13]!==j?(C=o.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:j?o.jsx(bt,{size:16}):o.jsx(jt,{size:16})}),e[13]=j,e[14]=C):C=e[14];let O;e[15]!==l?(O=o.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:l}),e[15]=l,e[16]=O):O=e[16];let F;e[17]!==S||e[18]!==j||e[19]!==C||e[20]!==O?(F=o.jsxs("button",{type:"button","aria-expanded":j,"aria-controls":S,onClick:w,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:[C,O]}),e[17]=S,e[18]=j,e[19]=C,e[20]=O,e[21]=F):F=e[21];let z;e[22]!==n.description?(z=n.description&&o.jsx("p",{className:"break-words pl-9 text-xs leading-normal text-muted-foreground",children:n.description}),e[22]=n.description,e[23]=z):z=e[23];let B;e[24]!==h||e[25]!==S||e[26]!==p||e[27]!==j||e[28]!==d||e[29]!==_||e[30]!==y||e[31]!==a||e[32]!==i||e[33]!==v||e[34]!==m||e[35]!==s||e[36]!==g||e[37]!==n?(B=j&&o.jsx("div",{id:S,className:"ml-3 min-w-0 max-w-full overflow-hidden border-l border-border/80 pl-5",children:o.jsx(Ge,{schema:n,value:_,onChange:i,basePath:s,breadcrumbPath:h,onBreadcrumbChange:a,meta:d,decofile:p,onSaveReferencedBlock:m,previewBaseUrl:g,onAddSectionItem:y,onRequestAddSection:v})}),e[24]=h,e[25]=S,e[26]=p,e[27]=j,e[28]=d,e[29]=_,e[30]=y,e[31]=a,e[32]=i,e[33]=v,e[34]=m,e[35]=s,e[36]=g,e[37]=n,e[38]=B):B=e[38];let M;return e[39]!==z||e[40]!==B||e[41]!==F?(M=o.jsxs("div",{className:"min-w-0 space-y-2",children:[F,z,B]}),e[39]=z,e[40]=B,e[41]=F,e[42]=M):M=e[42],M}function er(t){return!t}function Ye(t){const e=t.__resolveType;if(typeof e!="string")return null;if(Ie(e)){const r=t.section?.__resolveType;return typeof r=="string"?r:e}return e}function tr(t){return t.includes("flags/multivariate")}function nr(t){return xt(t)}function rr(t,e){const n=[...t],r=new Set(n.map(s=>s.resolveType)),i=(s,l)=>{!s||r.has(s)||(r.add(s),n.push({resolveType:s,title:l??nr(s)}))};if(e.savedBlockKey&&i(e.savedBlockKey,e.savedBlockKey),e.editorValue&&typeof e.editorValue=="object"&&!Array.isArray(e.editorValue)){const s=Ye(e.editorValue);s?.includes("/")&&i(s)}return n}function sr(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,s=i.__resolveType;if(typeof s=="string"){if($e(s)){const m=e.find(g=>g.resolveType===s);return m?m.resolveType:s}const d=e.find(m=>et(m.resolveType,s));if(d)return d.resolveType;const p=e.find(m=>m.resolveType===s);if(p)return p.resolveType;if(s.includes("/"))return s}const l=typeof i.type=="string"?i.type:void 0;if(l){const d=e.find(p=>p.discriminatorValue===l||p.resolveType===l||et(p.resolveType,l));if(d)return d.resolveType}let c=r,a=-1;for(const d of e){if(!d.schema?.properties)continue;const m=Object.keys(d.schema.properties).filter(g=>!g.startsWith("__")&&g!=="@type"&&g!=="action"&&g!=="alt").filter(g=>i[g]!==void 0).length;m>0&&m>a&&(a=m,c=d.resolveType)}return a>0,c}function it(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=Ue(r,e);return i||(r.includes("/")?null:n??null)}function ir(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 or(t,e){if(e)return!0;if(!t||typeof t!="object"||Array.isArray(t))return!1;const n=t,r=Ye(n);return r&&tr(r)?Array.isArray(n.variants)&&n.variants.length>0:Object.keys(n).some(i=>!i.startsWith("__")&&i!=="@type")}function lr(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 ar(t){const e=U.c(3),{blockKey:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(cn,{asChild:!0,children:o.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:[o.jsx(an,{size:11}),"Global"]})}),e[0]=r):r=e[0];let i;return e[1]!==n?(i=o.jsxs(un,{children:[r,o.jsxs(fn,{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 cr(t){const e=U.c(28),{path:n,open:r,onOpenChange:i,title:s,nested:l,nestedBlockRef:c,globalBlockKey:a}=t,d=`${n}-loader-config`,p=c&&"ml-1";let m;e[0]!==p?(m=De("rounded-lg border border-border/80 bg-muted/30",p),e[0]=p,e[1]=m):m=e[1];let g;e[2]!==i||e[3]!==r?(g=()=>i(!r),e[2]=i,e[3]=r,e[4]=g):g=e[4];let y;e[5]!==r?(y=o.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:r?o.jsx(bt,{size:16}):o.jsx(jt,{size:16})}),e[5]=r,e[6]=y):y=e[6];let v;e[7]!==s?(v=o.jsx("span",{className:"truncate text-xs font-medium tracking-wide text-muted-foreground uppercase",children:s}),e[7]=s,e[8]=v):v=e[8];let f;e[9]!==a?(f=a&&o.jsx(ar,{blockKey:a}),e[9]=a,e[10]=f):f=e[10];let h;e[11]!==v||e[12]!==f?(h=o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[v,f]}),e[11]=v,e[12]=f,e[13]=h):h=e[13];let u;e[14]!==d||e[15]!==r||e[16]!==g||e[17]!==y||e[18]!==h?(u=o.jsxs("button",{type:"button","aria-expanded":r,"aria-controls":d,onClick:g,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:[y,h]}),e[14]=d,e[15]=r,e[16]=g,e[17]=y,e[18]=h,e[19]=u):u=e[19];let x;e[20]!==d||e[21]!==l||e[22]!==r?(x=r&&o.jsx("div",{id:d,className:"border-t border-border/60 px-4 pb-4 pt-3",children:o.jsx("div",{className:"border-l border-border/80 pl-4",children:l})}),e[20]=d,e[21]=l,e[22]=r,e[23]=x):x=e[23];let b;return e[24]!==m||e[25]!==u||e[26]!==x?(b=o.jsxs("div",{className:m,children:[u,x]}),e[24]=m,e[25]=u,e[26]=x,e[27]=b):b=e[27],b}function ot(t){const e=U.c(30),{schema:n,value:r,onChange:i,path:s,label:l,breadcrumbPath:c,onBreadcrumbChange:a,meta:d,decofile:p,onSaveReferencedBlock:m}=t,g=(n.anyOfRefs??[]).filter(dr),y=p&&r?vn(r,p):null,v=y?.data??r,f=rr(g,{savedBlockKey:y?.blockKey,editorValue:v}),h=f.length>0?sr(v,f,y?.blockKey):f[0]?.resolveType??"",[u,x]=Q.useState(h),[b,_]=Q.useState(h);b!==h&&(_(h),x(h));const[k,T]=Q.useState(()=>or(v,y?.blockKey));if(f.length>0){const F=u||h;let z;e[0]!==F?(z=R=>R.resolveType===F,e[0]=F,e[1]=z):z=e[1];const B=f.find(z),M=it(v,d,B?.schema),J=ir(M??B?.schema??null,n.discriminatorKey),W=n.discriminatorKey,re=R=>{x(R);const $=f.find(Z=>Z.resolveType===R),L=it(v,d,$?.schema),ne=new Set(Object.keys((L??$?.schema)?.properties??{})),ae=r!==null&&typeof r=="object"&&!Array.isArray(r)?r:{},fe=Object.fromEntries(Object.entries(ae).filter(Z=>{const[ve]=Z;return ne.has(ve)})),xe={...lr($?.schema),...fe};if(W){const Z=$?.discriminatorValue??R;i({...xe,[W]:Z});return}if(Re(R)){i(xe);return}i({...xe,__resolveType:R})};let H;e[2]!==F||e[3]!==W||e[4]!==i?(H=R=>{if(W||!Re(F)||R===null||typeof R!="object"||Array.isArray(R)){i(R);return}const{__resolveType:$,...L}=R;i(L)},e[2]=F,e[3]=W,e[4]=i,e[5]=H):H=e[5];const se=H,ee=J?.properties?o.jsx(Ge,{schema:J,value:v,onChange:R=>{if(y&&m){m(y.blockKey,R);return}se(R)},basePath:s,breadcrumbPath:c,onBreadcrumbChange:a,meta:d,decofile:p,onSaveReferencedBlock:m}):null,Y=n.type==="block-ref"&&f.some(fr);let G;e[6]!==s?(G=s.includes("."),e[6]=s,e[7]=G):G=e[7];const q=G;let K;e[8]!==l||e[9]!==s?(K=o.jsx(le,{htmlFor:s,children:l}),e[8]=l,e[9]=s,e[10]=K):K=e[10];let X;e[11]===Symbol.for("react.memo_cache_sentinel")?(X=o.jsx(ft,{children:o.jsx(dt,{placeholder:"Select..."})}),e[11]=X):X=e[11];let te;return e[12]!==n.description?(te=n.description&&o.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[12]=n.description,e[13]=te):te=e[13],o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-1.5",children:[K,o.jsxs(mt,{value:F||void 0,onValueChange:re,children:[X,o.jsx(pt,{children:f.map(ur)})]}),te]}),ee&&(Y?o.jsx(cr,{path:s,open:k,onOpenChange:T,title:q?"Configuration":"Loader configuration",nested:ee,nestedBlockRef:q,globalBlockKey:y?.blockKey}):ee)]})}if(n.anyOfRefs&&n.anyOfRefs.length>0)return null;let N;e[14]!==l||e[15]!==s?(N=o.jsx(le,{htmlFor:s,children:l}),e[14]=l,e[15]=s,e[16]=N):N=e[16];const I=r!=null?String(r):"";let j;e[17]!==i?(j=F=>i(F.target.value),e[17]=i,e[18]=j):j=e[18];const S=n.description??"";let w;e[19]!==s||e[20]!==I||e[21]!==j||e[22]!==S?(w=o.jsx("input",{id:s,type:"text",value:I,onChange:j,className:"w-full rounded-md border bg-background px-3 py-1.5 text-sm",placeholder:S}),e[19]=s,e[20]=I,e[21]=j,e[22]=S,e[23]=w):w=e[23];let C;e[24]!==n.description?(C=n.description&&o.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[24]=n.description,e[25]=C):C=e[25];let O;return e[26]!==N||e[27]!==w||e[28]!==C?(O=o.jsxs("div",{className:"space-y-1.5",children:[N,w,C]}),e[26]=N,e[27]=w,e[28]=C,e[29]=O):O=e[29],O}function ur(t){return o.jsx(ut,{value:t.resolveType,children:t.title??rn(t.resolveType)??t.resolveType},t.resolveType)}function fr(t){return t.resolveType.includes("/")&&!Re(t.resolveType)}function dr(t){return t.resolveType!==""}function lt(t){const e=U.c(2),{ext:n}=t;if(!n)return null;let r;return e[0]!==n?(r=o.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 pr(t){try{const e=new URL(t).pathname;return decodeURIComponent(e.split("/").pop()??t)}catch{return t.split("/").pop()??t}}function mr(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"":t.slice(e+1).toLowerCase()}function at(t){const e=U.c(72),{schema:n,value:r,onChange:i,path:s,label:l}=t,c=n.format==="video-uri",a=gt(r),[d,p]=Q.useState(!1),[m,g]=Q.useState(!1),y=a?pr(a):"",v=y?mr(y):"",f=pn(),h=Jt();let u;e[0]!==f.data?.configs?(u=function(){const $=f.data?.configs??[];if($.length===1)return $[0].id;if($.length===0)return null;const L=typeof window<"u"?window.localStorage.getItem(en):null;return $.some(ne=>ne.id===L)?L:null},e[0]=f.data?.configs,e[1]=u):u=e[1];const x=u;let b;e[2]!==c||e[3]!==i||e[4]!==x||e[5]!==p||e[6]!==h?(b=async function($){if(!$)return;let L=Array.from($);if(L.length===0)return;if(c&&(L=L.filter(yr),L.length===0)){be.error("Please drop a video file (mp4, webm, …).");return}const ne=x();if(!ne){p(!0);return}try{const ae=await h.mutateAsync({configId:ne,file:L[0]});i(ae.publicUrl),L.length>1&&be.info(`Uploaded ${L[0].name}; extra files were ignored (single-select field).`)}catch(ae){const fe=ae;be.error(fe instanceof Error?fe.message:"Upload failed")}},e[2]=c,e[3]=i,e[4]=x,e[5]=p,e[6]=h,e[7]=b):b=e[7];const _=b;let k;e[8]!==g?(k=function($){$.preventDefault(),$.dataTransfer.types.includes("Files")&&g(!0)},e[8]=g,e[9]=k):k=e[9];const T=k;let N;e[10]!==g?(N=function($){$.currentTarget===$.target&&g(!1)},e[10]=g,e[11]=N):N=e[11];const I=N;let j;e[12]!==_||e[13]!==g?(j=function($){$.preventDefault(),g(!1),_($.dataTransfer.files)},e[12]=_,e[13]=g,e[14]=j):j=e[14];const S=j;let w;e[15]!==l||e[16]!==s?(w=o.jsx(le,{htmlFor:s,className:"text-muted-foreground",children:l}),e[15]=l,e[16]=s,e[17]=w):w=e[17];let C;e[18]!==n.description?(C=n.description&&o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=C):C=e[19];let O;e[20]!==w||e[21]!==C?(O=o.jsxs("div",{className:"min-w-0 space-y-0.5",children:[w,C]}),e[20]=w,e[21]=C,e[22]=O):O=e[22];const F=m&&"border-primary ring-2 ring-primary/30",z=h.isPending&&"pointer-events-none opacity-60";let B;e[23]!==z||e[24]!==F?(B=De("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",F,z),e[23]=z,e[24]=F,e[25]=B):B=e[25];let M;e[26]!==v||e[27]!==y||e[28]!==c||e[29]!==p||e[30]!==a||e[31]!==h.isPending?(M=a?c?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"relative h-40 w-full overflow-hidden bg-black",children:o.jsx("video",{src:a,preload:"metadata",className:"h-full w-full object-contain"},a)}),o.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[o.jsx(qe,{size:14,className:"shrink-0 text-muted-foreground"}),o.jsx("p",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:y}),o.jsx(lt,{ext:v})]})]}):o.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",children:[o.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-md bg-background",children:o.jsx(Xe,{size:18,className:"text-muted-foreground"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"truncate text-sm font-medium",children:y}),o.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a})]}),o.jsx(lt,{ext:v})]}):o.jsxs("button",{type:"button",onClick:()=>p(!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?o.jsx(qe,{size:20}):o.jsx(Xe,{size:20}),o.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"}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"Up to 100 MB"})]}),e[26]=v,e[27]=y,e[28]=c,e[29]=p,e[30]=a,e[31]=h.isPending,e[32]=M):M=e[32];let J;e[33]!==m?(J=m&&o.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:o.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:"Drop to upload"})}),e[33]=m,e[34]=J):J=e[34];let W;e[35]!==I||e[36]!==T||e[37]!==S||e[38]!==B||e[39]!==M||e[40]!==J?(W=o.jsxs("div",{onDragOver:T,onDragLeave:I,onDrop:S,className:B,children:[M,J]}),e[35]=I,e[36]=T,e[37]=S,e[38]=B,e[39]=M,e[40]=J,e[41]=W):W=e[41];let re;e[42]!==i?(re=R=>i(R.target.value),e[42]=i,e[43]=re):re=e[43];let H;e[44]!==s||e[45]!==a||e[46]!==re?(H=o.jsx(ue,{id:s,type:"url",value:a,onChange:re,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[44]=s,e[45]=a,e[46]=re,e[47]=H):H=e[47];let se;e[48]!==p?(se=()=>p(!0),e[48]=p,e[49]=se):se=e[49];let ee;e[50]===Symbol.for("react.memo_cache_sentinel")?(ee=o.jsx(dn,{size:14}),e[50]=ee):ee=e[50];const ie=a?"Replace":"Browse";let Y;e[51]!==se||e[52]!==ie?(Y=o.jsxs(Ce,{type:"button",variant:"outline",size:"sm",onClick:se,className:"h-9 shrink-0",children:[ee,ie]}),e[51]=se,e[52]=ie,e[53]=Y):Y=e[53];let G;e[54]!==i||e[55]!==a?(G=a&&o.jsx(Ce,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(""),className:"h-9 shrink-0","aria-label":"Remove file",children:o.jsx(ht,{size:14})}),e[54]=i,e[55]=a,e[56]=G):G=e[56];let q;e[57]!==H||e[58]!==Y||e[59]!==G?(q=o.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[H,Y,G]}),e[57]=H,e[58]=Y,e[59]=G,e[60]=q):q=e[60];let K;e[61]!==i?(K=R=>i(R),e[61]=i,e[62]=K):K=e[62];let X;e[63]!==d||e[64]!==p||e[65]!==K?(X=o.jsx(tn,{open:d,onOpenChange:p,mode:"any",onSelect:K}),e[63]=d,e[64]=p,e[65]=K,e[66]=X):X=e[66];let te;return e[67]!==W||e[68]!==q||e[69]!==X||e[70]!==O?(te=o.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[O,W,q,X]}),e[67]=W,e[68]=q,e[69]=X,e[70]=O,e[71]=te):te=e[71],te}function yr(t){return t.type.startsWith("video/")}const hr="website/loaders/secret.ts";function je(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 gr(){return{__resolveType:hr,name:"",encrypted:""}}function xr(t){const{value:e,...n}=t;return n}function Ve(t){const e=U.c(45),{schema:n,value:r,onChange:i,label:s,path:l}=t;if(typeof r=="string"||r==null&&!je(r)){const N=typeof r=="string"?r:"";let I;e[0]!==s||e[1]!==l?(I=o.jsx(le,{htmlFor:l,className:"text-sm font-medium",children:s}),e[0]=s,e[1]=l,e[2]=I):I=e[2];let j;e[3]!==n.description?(j=n.description&&o.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[3]=n.description,e[4]=j):j=e[4];let S;e[5]!==i?(S=O=>i(O.target.value),e[5]=i,e[6]=S):S=e[6];let w;e[7]!==l||e[8]!==N||e[9]!==S?(w=o.jsx(ue,{id:l,type:"password",value:N,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:"Secret value",onChange:S,className:"h-10"}),e[7]=l,e[8]=N,e[9]=S,e[10]=w):w=e[10];let C;return e[11]!==I||e[12]!==j||e[13]!==w?(C=o.jsxs("div",{className:"space-y-2",children:[I,j,w]}),e[11]=I,e[12]=j,e[13]=w,e[14]=C):C=e[14],C}let c;e[15]!==r?(c=je(r)?r:gr(),e[15]=r,e[16]=c):c=e[16];const a=c,d=typeof a.name=="string"?a.name:"",p=typeof a.encrypted=="string"&&a.encrypted,m=`${l}-name`;let g;e[17]!==s||e[18]!==m?(g=o.jsx(le,{htmlFor:m,className:"text-sm font-medium",children:s}),e[17]=s,e[18]=m,e[19]=g):g=e[19];let y;e[20]!==n.description?(y=n.description&&o.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[20]=n.description,e[21]=y):y=e[21];const v=`${l}-name`;let f;e[22]!==a||e[23]!==i?(f=N=>i({...a,name:N.target.value}),e[22]=a,e[23]=i,e[24]=f):f=e[24];let h;e[25]!==d||e[26]!==v||e[27]!==f?(h=o.jsx(ue,{id:v,value:d,placeholder:"Secret name",onChange:f,className:"h-10"}),e[25]=d,e[26]=v,e[27]=f,e[28]=h):h=e[28];const u=`${l}-value`,x=p?"Leave blank to keep current value":"Secret value";let b;e[29]!==a||e[30]!==p||e[31]!==i?(b=N=>{const I=N.target.value;if(!I){i(p?xr(a):a);return}i({...a,value:I})},e[29]=a,e[30]=p,e[31]=i,e[32]=b):b=e[32];let _;e[33]!==b||e[34]!==u||e[35]!==x?(_=o.jsx(ue,{id:u,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:x,onChange:b,className:"h-10"}),e[33]=b,e[34]=u,e[35]=x,e[36]=_):_=e[36];let k;e[37]!==p?(k=p&&o.jsx("p",{className:"text-xs text-muted-foreground",children:"A secret value is stored."}),e[37]=p,e[38]=k):k=e[38];let T;return e[39]!==_||e[40]!==k||e[41]!==g||e[42]!==y||e[43]!==h?(T=o.jsxs("div",{className:"space-y-2",children:[g,y,h,_,k]}),e[39]=_,e[40]=k,e[41]=g,e[42]=y,e[43]=h,e[44]=T):T=e[44],T}const vr=new Set(["__resolveType","@type"]);function br(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 jr(t){if(Be(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 ct(t){if(t.type==="array"&&t.items)return t;const e=t.items??jr(t);return e?{...t,type:"array",items:e}:null}function Tr(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 wt(t){const{schema:e,value:n}=t;if(sn(n)){const l=on(n),c=ct(e);if(l!==null&&c)return o.jsx(Me,{...t,schema:c,value:l,onChange:a=>t.onChange(ln(n,a))},t.path)}if(Array.isArray(n)&&e.type==="block-ref"&&Be(e)){const l=ct(e);if(l)return o.jsx(Me,{...t,schema:l,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 l=br(e);return l==="image"?o.jsx(Je,{...t},t.path):l==="file"?o.jsx(at,{...t},t.path):e.anyOfRefs?o.jsx(ot,{...t},t.path):null}if(e.format==="image-uri")return o.jsx(Je,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return o.jsx(at,{...t},t.path);if(e.enum&&e.enum.length>0)return o.jsx(Dn,{...t},t.path);if(e.type==="anyOf")return o.jsx(ot,{...t},t.path);if(je(n)||e.format==="password"||n==null&&e.format==="password")return o.jsx(Ve,{...t},t.path);const r=n??Tr(e.type,e.default);if(r==null)return je(n)?o.jsx(Ve,{...t},t.path):null;if(je(r))return o.jsx(Ve,{...t,value:r},t.path);const i={...t,value:r},s=n==null?e.type??typeof r:Array.isArray(r)?"array":typeof r;if(s==="array"||Array.isArray(r))return o.jsx(Me,{...i},t.path);switch(s){case"boolean":return o.jsx(In,{...i},t.path);case"number":case"integer":return o.jsx(Cn,{...i},t.path);case"string":{const l=e.format;return l==="color-input"?o.jsx(Ae,{...i},t.path):l==="textarea"||l==="rich-text"||l==="html"?o.jsx(Ae,{...i},t.path):o.jsx(Ae,{...i},t.path)}case"object":return r!==null&&typeof r=="object"&&!Array.isArray(r)?o.jsx(Jn,{...i},t.path):null;default:return o.jsx(Ae,{...i},t.path)}}function Ge(t){const e=U.c(15),{schema:n,value:r,onChange:i,basePath:s,breadcrumbPath:l,onBreadcrumbChange:c,meta:a,decofile:d,onSaveReferencedBlock:p,previewBaseUrl:m,onAddSectionItem:g,onRequestAddSection:y}=t;let v,f;if(e[0]!==s||e[1]!==d||e[2]!==a||e[3]!==g||e[4]!==c||e[5]!==i||e[6]!==y||e[7]!==p||e[8]!==m||e[9]!==n.properties||e[10]!==l||e[11]!==r){f=Symbol.for("react.early_return_sentinel");e:{const h=l===void 0?[]:l,u=n.properties;if(!u){f=null;break e}const x=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},b=Object.keys(u).filter(S=>!vr.has(S)&&u[S]?.hidden!==!0);if(b.length===0){let S;e[14]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No editable fields on this section."}),e[14]=S):S=e[14],f=S;break e}const _=(S,w)=>{i({...x,[S]:w})},k=typeof x.__resolveType=="string"?x.__resolveType:void 0,T=h.length>0?Pn(b,u,x,h):null,N=T?u[T]:null,I=T&&N?[T]:b,j=T&&N?En(T,N,h):h;v=o.jsx("div",{className:"min-w-0 space-y-6",children:I.map(S=>{const w=u[S];if(!w)return null;const C=s?`${s}.${S}`:S,O=Fe(S,w);return wt({schema:w,value:x[S],onChange:F=>_(S,F),path:C,label:O,breadcrumbPath:j,onBreadcrumbChange:c,meta:a,decofile:d,onSaveReferencedBlock:p,containerResolveType:k,previewBaseUrl:m,onAddSectionItem:g,onRequestAddSection:y})})})}e[0]=s,e[1]=d,e[2]=a,e[3]=g,e[4]=c,e[5]=i,e[6]=y,e[7]=p,e[8]=m,e[9]=n.properties,e[10]=l,e[11]=r,e[12]=v,e[13]=f}else v=e[12],f=e[13];return f!==Symbol.for("react.early_return_sentinel")?f:v}export{Ge as S,wt as a,Wr as b,Ae as c,Ke as r,mn as s,Hr as u};