decocms 4.76.78 → 4.76.80

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-DBEuJvXd.js → AlertCircle-jnYXpTjw.js} +1 -1
  2. package/dist/client/assets/{AreaChart-RJnPaDTO.js → AreaChart-rXhSjQGk.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-OqBYOpu3.js → ArrowUp-BULPWB7Z.js} +1 -1
  4. package/dist/client/assets/{ArrowUpRight-3xkp-kWm.js → ArrowUpRight-Bfov_iuz.js} +1 -1
  5. package/dist/client/assets/{Check-Oxo5mPeL.js → Check-DP2mt6rz.js} +1 -1
  6. package/dist/client/assets/{CheckCircle-DAvZWWWn.js → CheckCircle-BSbIKmQs.js} +1 -1
  7. package/dist/client/assets/{ChevronDown-DCZlSvzQ.js → ChevronDown-CoccBu6f.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-L_rxCnv3.js → ChevronRight-Dac0PLd_.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-BXrO8J56.js → ChevronUp-pTNKSSUr.js} +1 -1
  10. package/dist/client/assets/{Circle-DLL8alCD.js → Circle-DiO-c6WF.js} +1 -1
  11. package/dist/client/assets/{Copy01-uwiMYWRU.js → Copy01-TqyK4bro.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-B0IViKUD.js → DotsVertical-CARUusKJ.js} +1 -1
  13. package/dist/client/assets/{Eye-DVo1_Pm2.js → Eye-eSjTRW9u.js} +1 -1
  14. package/dist/client/assets/{FilterLines-CAdlDh3I.js → FilterLines-CHV6FOUS.js} +1 -1
  15. package/dist/client/assets/{Flag01-fXAeu3l9.js → Flag01-CUmBzqic.js} +1 -1
  16. package/dist/client/assets/{Globe01-By9gtoyg.js → Globe01-J-8OOzt3.js} +1 -1
  17. package/dist/client/assets/{Globe04-uOyvHHk7.js → Globe04-Cy2rfQz8.js} +1 -1
  18. package/dist/client/assets/{HardDrive-D38nWE_J.js → HardDrive-D-DXjOCo.js} +1 -1
  19. package/dist/client/assets/{Image01-B-uMMK1I.js → Image01-qp5QFhXj.js} +1 -1
  20. package/dist/client/assets/{Key01-ChBXFLCM.js → Key01-CO3ih1Yp.js} +1 -1
  21. package/dist/client/assets/{LayoutLeft-DPtsS7J4.js → LayoutLeft-DFAoke9t.js} +1 -1
  22. package/dist/client/assets/{LinkExternal01-C3luIiQr.js → LinkExternal01-gXSgK9Q8.js} +1 -1
  23. package/dist/client/assets/{List-CgvHjjyd.js → List-DJTQCjkX.js} +1 -1
  24. package/dist/client/assets/{Monitor01-BbnHlrzQ.js → Monitor01-BAgRlVpH.js} +1 -1
  25. package/dist/client/assets/{Package-CJkGCd9M.js → Package-DHGoGq6a.js} +1 -1
  26. package/dist/client/assets/{Palette-Dem2eeFJ.js → Palette-B_oTQul8.js} +1 -1
  27. package/dist/client/assets/{Play-02R_l1hm.js → Play-NT8-sedu.js} +1 -1
  28. package/dist/client/assets/{Plus-D8fSfWhL.js → Plus-D7Xzgcq0.js} +1 -1
  29. package/dist/client/assets/{SearchLg-BKY8fQrj.js → SearchLg-Byrs3fPZ.js} +1 -1
  30. package/dist/client/assets/{SearchMd-Di7fRkvt.js → SearchMd-D7SBsVYX.js} +1 -1
  31. package/dist/client/assets/{Settings02-CJygIZBg.js → Settings02-BxjyJOk0.js} +1 -1
  32. package/dist/client/assets/{Shield01-bU8ewL-C.js → Shield01-iP7ccMGT.js} +1 -1
  33. package/dist/client/assets/{Star01-CAO22TgC.js → Star01-DyRB3uOn.js} +1 -1
  34. package/dist/client/assets/{Stars01-BbGPjqZd.js → Stars01-CFgrkGH8.js} +1 -1
  35. package/dist/client/assets/{Stars02-Bs0TEaNy.js → Stars02-B0wc0Mon.js} +1 -1
  36. package/dist/client/assets/{Sun-BZaKEOLT.js → Sun-CuDXWWoR.js} +1 -1
  37. package/dist/client/assets/{SwitchHorizontal01-DqE-u_vC.js → SwitchHorizontal01-DitaMPqn.js} +1 -1
  38. package/dist/client/assets/{Tool01-DHJpebK1.js → Tool01-CoqzXqCD.js} +1 -1
  39. package/dist/client/assets/{Tool02-DlSNNbnL.js → Tool02-CBb9CzRq.js} +1 -1
  40. package/dist/client/assets/{Trash01-BGwW4PUs.js → Trash01-UbH0KmqS.js} +1 -1
  41. package/dist/client/assets/{TrendUp01-Lnwj2rUh.js → TrendUp01-5NcKZnVz.js} +1 -1
  42. package/dist/client/assets/{Upload01-DVcY511n.js → Upload01-D7V1TLPg.js} +1 -1
  43. package/dist/client/assets/{User01-joygJQdk.js → User01-DA8mg0ER.js} +1 -1
  44. package/dist/client/assets/{UserPlus01-DvdLIpOn.js → UserPlus01-bZVqXgcl.js} +1 -1
  45. package/dist/client/assets/{Users01-BVTwFHJb.js → Users01-BjhbLbv0.js} +1 -1
  46. package/dist/client/assets/{Users03-FhX9tiey.js → Users03-CK9WhDRZ.js} +1 -1
  47. package/dist/client/assets/{X-Bs0u_0yh.js → X-Ct6uDLb4.js} +1 -1
  48. package/dist/client/assets/{XCircle-DGorVz-d.js → XCircle-C1jh_oYh.js} +1 -1
  49. package/dist/client/assets/{XClose-hq2LkF75.js → XClose-H0nsoGTm.js} +1 -1
  50. package/dist/client/assets/{Zap-CT4kcBoV.js → Zap-BuQt1TC8.js} +1 -1
  51. package/dist/client/assets/{ZapSquare-DivgtbPr.js → ZapSquare-DpaNYQXJ.js} +1 -1
  52. package/dist/client/assets/{ZoomOut-B2C9WPW-.js → ZoomOut-B9LJbYbt.js} +1 -1
  53. package/dist/client/assets/{access-gate-B4pZWmwl.js → access-gate-C31HEb6y.js} +1 -1
  54. package/dist/client/assets/{add-section-modal-JBdSC8cO.js → add-section-modal-Bb2kdLwQ.js} +1 -1
  55. package/dist/client/assets/{agent-icon-Xdz_mRuJ.js → agent-icon-snZpoXRr.js} +1 -1
  56. package/dist/client/assets/{agents-list-2gWOzqrw.js → agents-list-Bwcf-V6E.js} +1 -1
  57. package/dist/client/assets/{ai-providers-N4FbEwVk.js → ai-providers-DDBvRFlC.js} +1 -1
  58. package/dist/client/assets/{alert-j61mFoia.js → alert-CculFdMk.js} +1 -1
  59. package/dist/client/assets/{alert-dialog-CWlVUd73.js → alert-dialog-Bc_r_l2R.js} +1 -1
  60. package/dist/client/assets/{app-editor-BRpM18eX.js → app-editor-D9rIsXAn.js} +1 -1
  61. package/dist/client/assets/{auth-DDOP_TUe.js → auth-B6PY9djs.js} +1 -1
  62. package/dist/client/assets/{auth-catchall-B0LUMpZy.js → auth-catchall-DCdG8anC.js} +1 -1
  63. package/dist/client/assets/{auth-entry-wtr1fLwN.js → auth-entry-CSB36Rq1.js} +1 -1
  64. package/dist/client/assets/{auth-split-layout-Bifmzv2W.js → auth-split-layout-BuJmTwGZ.js} +1 -1
  65. package/dist/client/assets/{authenticate-and-persist-oauth-BcKcvBur.js → authenticate-and-persist-oauth-C1FiOXML.js} +1 -1
  66. package/dist/client/assets/{automation-list-row-CWbyvM3t.js → automation-list-row-1BNXsMNe.js} +1 -1
  67. package/dist/client/assets/{automation-runs-ewxrJgPk.js → automation-runs-D4ymiYOy.js} +1 -1
  68. package/dist/client/assets/automations-s3QIqVgi.js +1 -0
  69. package/dist/client/assets/{autosend-sntJRLit.js → autosend-BLnyPZap.js} +1 -1
  70. package/dist/client/assets/{avatar-BumqAYVV.js → avatar-OkMq9Zk7.js} +1 -1
  71. package/dist/client/assets/{badge-DuwyDvgL.js → badge-LKHpiZNV.js} +1 -1
  72. package/dist/client/assets/{block-document-COkNQDU1.js → block-document-DDz_VDM7.js} +1 -1
  73. package/dist/client/assets/{brand-context-DJ55kBWm.js → brand-context-C2tIZm7d.js} +1 -1
  74. package/dist/client/assets/{buckets-CZaQ9-E2.js → buckets-B7uB4T8J.js} +1 -1
  75. package/dist/client/assets/{bulk-category-panel-C4UbsY4X.js → bulk-category-panel-Ch5buJHH.js} +1 -1
  76. package/dist/client/assets/{calendar-Dpt7QB2d.js → calendar-CExQwziS.js} +1 -1
  77. package/dist/client/assets/{capability-load-error-CVQ-0IvS.js → capability-load-error-Si55yJYn.js} +1 -1
  78. package/dist/client/assets/{card-whir3-TU.js → card-CQb0gFPD.js} +1 -1
  79. package/dist/client/assets/{category-editor-DSjyTevO.js → category-editor-BbVWXgcn.js} +1 -1
  80. package/dist/client/assets/{chat-context-CZYpc7lP.js → chat-context-BlFYYcaC.js} +1 -1
  81. package/dist/client/assets/{checkbox-DbEZ6b_D.js → checkbox-aaBpY9LU.js} +1 -1
  82. package/dist/client/assets/{cli-auth-success-DhmnJDJJ.js → cli-auth-success-I4Cf-959.js} +1 -1
  83. package/dist/client/assets/{collection-detail-B32MmFU7.js → collection-detail-CtkLF3bv.js} +1 -1
  84. package/dist/client/assets/{collection-display-button--OVhArve.js → collection-display-button-BKx9wavy.js} +1 -1
  85. package/dist/client/assets/{collection-search-26JlKJRJ.js → collection-search-B8hFnz_e.js} +1 -1
  86. package/dist/client/assets/{collection-table-wrapper-DPtPbXkO.js → collection-table-wrapper-m26XJ5zy.js} +1 -1
  87. package/dist/client/assets/{collection-tabs-CMkX9SJV.js → collection-tabs-CrZ5Bp_o.js} +1 -1
  88. package/dist/client/assets/{command-BoNCgAXF.js → command-7qGSdx1i.js} +1 -1
  89. package/dist/client/assets/{commerce-onboarding-DbO5ycXJ.js → commerce-onboarding-BnceiFob.js} +1 -1
  90. package/dist/client/assets/{companions-core-C3l18hJe.js → companions-core-WSDg9Q8E.js} +1 -1
  91. package/dist/client/assets/{connect-desktop-dialog-DR3AZpl6.js → connect-desktop-dialog-CBtRTJNW.js} +1 -1
  92. package/dist/client/assets/{connection-card-ClbjHgoq.js → connection-card-D50wo4YR.js} +1 -1
  93. package/dist/client/assets/{connection-detail-B8ktqErv.js → connection-detail-CTOdx6bT.js} +1 -1
  94. package/dist/client/assets/{connection-form-helpers-CkjvvPa_.js → connection-form-helpers-DJzPz9wV.js} +1 -1
  95. package/dist/client/assets/connections-DwTuRHOz.js +1 -0
  96. package/dist/client/assets/{decopilot-sse-pool-ByDpDqQ2.js → decopilot-sse-pool-BDLoK0Wm.js} +1 -1
  97. package/dist/client/assets/{dialog-hBUfi5DB.js → dialog-peEhu4Kz.js} +1 -1
  98. package/dist/client/assets/{domain-settings-DnawB_fV.js → domain-settings-C_ZasSRC.js} +1 -1
  99. package/dist/client/assets/{drawer-CrQJ-4Ry.js → drawer-siY4qV8Y.js} +1 -1
  100. package/dist/client/assets/{dropdown-menu-BDW1EJyx.js → dropdown-menu-BbwNK63m.js} +1 -1
  101. package/dist/client/assets/{empty-state-LUctNkh2.js → empty-state-CZ_W2Tkk.js} +1 -1
  102. package/dist/client/assets/{extract-connection-data-BFgBaCrk.js → extract-connection-data-BUGzC6aY.js} +1 -1
  103. package/dist/client/assets/{file-explorer-1FqRLQQ5.js → file-explorer-DH5nWAOV.js} +1 -1
  104. package/dist/client/assets/{file-type-icon-CaoqUw2g.js → file-type-icon-C5Q28sIK.js} +1 -1
  105. package/dist/client/assets/{files-BpPo_clL.js → files--hgUCesT.js} +1 -1
  106. package/dist/client/assets/{form-B8zhOVR3.js → form-CRRv-eFx.js} +1 -1
  107. package/dist/client/assets/{general-DxlJNW0F.js → general-DMy52QmH.js} +1 -1
  108. package/dist/client/assets/{github-repo-picker-D93GRlsF.js → github-repo-picker-CK4CEHS1.js} +1 -1
  109. package/dist/client/assets/{hooks-DNLn_ut2.js → hooks-DzAxJzub.js} +1 -1
  110. package/dist/client/assets/{index-DArYfizl.js → index-B3h-sOvw.js} +1 -1
  111. package/dist/client/assets/{index-sveg7vlb.js → index-BlBk22YN.js} +1 -1
  112. package/dist/client/assets/{index-F-ZMCKP-.js → index-BqB_p9kl.js} +2 -2
  113. package/dist/client/assets/{index-BUTM8e7t.js → index-BsuuzzL7.js} +1 -1
  114. package/dist/client/assets/{index-qg-bT8JA.js → index-C-emgAXU.js} +1 -1
  115. package/dist/client/assets/{index-vt02LGOF.js → index-CKwYI32T.js} +1 -1
  116. package/dist/client/assets/{index-ivY09p7e.js → index-C_2i_GH6.js} +1 -1
  117. package/dist/client/assets/{index-Cag8mnTh.js → index-Ca82Q4Ek.js} +1 -1
  118. package/dist/client/assets/{index-CWrnaczo.js → index-Cjb2VjOD.js} +1 -1
  119. package/dist/client/assets/{index-CdyljS_N.js → index-CkVK9R4Q.js} +1 -1
  120. package/dist/client/assets/{index-MnX4iOa5.js → index-DL6RS5ps.js} +1 -1
  121. package/dist/client/assets/{index-gpoC3ssJ.js → index-DXQc6dMd.js} +6 -6
  122. package/dist/client/assets/{index-DGQdC8j6.js → index-Dm8PN3sF.js} +3 -3
  123. package/dist/client/assets/{index-redirect-UnLDnJlQ.js → index-redirect-CW4Hmc_U.js} +1 -1
  124. package/dist/client/assets/{index-DTiOXvtP.js → index-uLCsUmwK.js} +1 -1
  125. package/dist/client/assets/{input-DwWe5Hqk.js → input-BSpKqXLN.js} +1 -1
  126. package/dist/client/assets/{integration-icon-CfaWXLBn.js → integration-icon-Ct1_3FnK.js} +1 -1
  127. package/dist/client/assets/{invite-member-dialog-D3eUhcy1.js → invite-member-dialog-CgUaSpI7.js} +1 -1
  128. package/dist/client/assets/{label-DdsuSm6M.js → label-Dpmg8kbt.js} +1 -1
  129. package/dist/client/assets/{layout-Bts6NJ_J.js → layout-Bdpzm3ey.js} +1 -1
  130. package/dist/client/assets/{login-Dd4NGdu8.js → login-DoXlIPME.js} +1 -1
  131. package/dist/client/assets/{mcp-oauth-SHxAJnkD.js → mcp-oauth-PhgGxYkw.js} +1 -1
  132. package/dist/client/assets/{members-6mHVnRNm.js → members-DKGbqK5B.js} +1 -1
  133. package/dist/client/assets/{monaco-editor-DGONpAoN.js → monaco-editor-B16YtA8X.js} +1 -1
  134. package/dist/client/assets/{monitoring-stats-row-CfSW2sgf.js → monitoring-stats-row-CWKkLDlv.js} +1 -1
  135. package/dist/client/assets/{multi-select-CD32kF2s.js → multi-select-DxX6mzig.js} +1 -1
  136. package/dist/client/assets/{oauth-callback-Bzq_-z2r.js → oauth-callback-Dk3i6V9o.js} +1 -1
  137. package/dist/client/assets/{oauth-callback-ai-provider-DxKql_z0.js → oauth-callback-ai-provider-DlOZuGYF.js} +1 -1
  138. package/dist/client/assets/{onboarding-BwDunMKX.js → onboarding-CAcyakf1.js} +1 -1
  139. package/dist/client/assets/{org-install-BR62T5jO.js → org-install-C2zIHkeR.js} +1 -1
  140. package/dist/client/assets/{org-layout-BHG4t6-u.js → org-layout-BcQBMdPy.js} +1 -1
  141. package/dist/client/assets/{organization-choice-DlY0QjY5.js → organization-choice-5_6S_6zP.js} +1 -1
  142. package/dist/client/assets/{orgs-Bsar34iG.js → orgs-C2BJ5EFt.js} +1 -1
  143. package/dist/client/assets/{page-seo-form-D8JddRAG.js → page-seo-form-KAZS3ToW.js} +1 -1
  144. package/dist/client/assets/page-seo-sheet-DqgEUv1F.js +1 -0
  145. package/dist/client/assets/{popover-BoSjy_J9.js → popover-DeKqmccr.js} +1 -1
  146. package/dist/client/assets/{post-editor-BeOF_jnK.js → post-editor-BxW62afL.js} +1 -1
  147. package/dist/client/assets/{primitives-cDJctbRp.js → primitives-CymWnBD-.js} +1 -1
  148. package/dist/client/assets/{profile-BpIHCO3e.js → profile-BwWbMD5G.js} +1 -1
  149. package/dist/client/assets/project-app-view-C22JAiGq.js +1 -0
  150. package/dist/client/assets/record-editor-Cr9pcpoJ.js +1 -0
  151. package/dist/client/assets/redirect-editor-Cdaf3rMv.js +1 -0
  152. package/dist/client/assets/registry-CafaLurw.js +2 -0
  153. package/dist/client/assets/{registry-layout-BTDmQem2.js → registry-layout-BS7GUXaT.js} +1 -1
  154. package/dist/client/assets/{reports-rH-WO9Po.js → reports-FOQonGLx.js} +1 -1
  155. package/dist/client/assets/{require-capability--U_vi60H.js → require-capability-BzSu6vDt.js} +1 -1
  156. package/dist/client/assets/{required-auth-layout-B-_kB-P-.js → required-auth-layout-CtWEo2zO.js} +1 -1
  157. package/dist/client/assets/{reset-password-BbwEGkWF.js → reset-password-DV1m5l_o.js} +1 -1
  158. package/dist/client/assets/{roles-BRucDg6D.js → roles-CViXiD9L.js} +1 -1
  159. package/dist/client/assets/{search-input-B0lumlG7.js → search-input-DDPtoz8G.js} +1 -1
  160. package/dist/client/assets/{secrets-Cx316kN4.js → secrets-D5Nvu4k_.js} +1 -1
  161. package/dist/client/assets/{sections-editor-DUBW607x.js → sections-editor-BEtL6q2R.js} +1 -1
  162. package/dist/client/assets/{select-vVirKMnE.js → select-klspWFYa.js} +1 -1
  163. package/dist/client/assets/{select-model-BltF0usx.js → select-model-CkWmVi0T.js} +1 -1
  164. package/dist/client/assets/{self-tool-result-hAvB5Ojq.js → self-tool-result-DP1UhnDY.js} +1 -1
  165. package/dist/client/assets/{seo-editor-CWtXZnRQ.js → seo-editor-Dn-_kbOa.js} +1 -1
  166. package/dist/client/assets/{settings-layout-Bew9lvu0.js → settings-layout-DwJV1u0V.js} +1 -1
  167. package/dist/client/assets/{settings-section-CvpT3RW4.js → settings-section-D0lLPZJi.js} +1 -1
  168. package/dist/client/assets/{shell-controls-C-g_XIqJ.js → shell-controls-DNqZZykp.js} +1 -1
  169. package/dist/client/assets/{shell-layout-b2wj0DO7.js → shell-layout-BgOVraTq.js} +1 -1
  170. package/dist/client/assets/{sidebar-C_llE2r0.js → sidebar-CWl0stLq.js} +1 -1
  171. package/dist/client/assets/{skeleton-CB7DUvyX.js → skeleton-Da5tCZLy.js} +1 -1
  172. package/dist/client/assets/{sso-CUBuMbRD.js → sso-CZt2rspj.js} +1 -1
  173. package/dist/client/assets/{store-B1pmnLUq.js → store-Ch42aNij.js} +1 -1
  174. package/dist/client/assets/store-registry-BHUhDKz-.js +2 -0
  175. package/dist/client/assets/{studio-tools-DII0jqi8.js → studio-tools-CzCUBnU-.js} +1 -1
  176. package/dist/client/assets/{switch-DW7tjnTv.js → switch-Dqjnq7F3.js} +1 -1
  177. package/dist/client/assets/{table-DqN44BtI.js → table-BjewzTT6.js} +1 -1
  178. package/dist/client/assets/{tabs-DoePSWje.js → tabs-CnhXq_U0.js} +1 -1
  179. package/dist/client/assets/{textarea-BH3kgWLk.js → textarea-D900hyiY.js} +1 -1
  180. package/dist/client/assets/{toggle-group-Dbv18C0K.js → toggle-group-DBV_nUpZ.js} +1 -1
  181. package/dist/client/assets/{toolbar-CFkubGs8.js → toolbar-YYGLWfBz.js} +1 -1
  182. package/dist/client/assets/{toolbar-icon-button-B2gRcy3Z.js → toolbar-icon-button-B73WjSi8.js} +1 -1
  183. package/dist/client/assets/{tooltip-CO1zVhUs.js → tooltip-Bk3ktdBG.js} +1 -1
  184. package/dist/client/assets/{use-ai-providers-DuJIHuvT.js → use-ai-providers-iP_P_qPq.js} +1 -1
  185. package/dist/client/assets/{use-automations-CjVm1klr.js → use-automations-B4s7u2oP.js} +1 -1
  186. package/dist/client/assets/{use-autosave-IhKsmyqJ.js → use-autosave-BBj3AnV5.js} +1 -1
  187. package/dist/client/assets/{use-capability-CEIYeJxR.js → use-capability-Bj8-MDeV.js} +1 -1
  188. package/dist/client/assets/{use-clock-tick-BDXFn1B6.js → use-clock-tick-BkDrX01P.js} +1 -1
  189. package/dist/client/assets/{use-collections-BqfJEMNR.js → use-collections-Bu8eD7uC.js} +1 -1
  190. package/dist/client/assets/{use-connection-DM8eKjeN.js → use-connection-CmsG7X0s.js} +1 -1
  191. package/dist/client/assets/{use-copy-eCXRBbSs.js → use-copy-kh-dYPFQ.js} +1 -1
  192. package/dist/client/assets/{use-create-virtual-mcp-C4Sbw3ia.js → use-create-virtual-mcp-CsB1oiAT.js} +1 -1
  193. package/dist/client/assets/{use-debounced-autosave-DQFgMtID.js → use-debounced-autosave-C_ONA6Qe.js} +1 -1
  194. package/dist/client/assets/{use-debounced-value-CMoeorqx.js → use-debounced-value-HHfWLIor.js} +1 -1
  195. package/dist/client/assets/{use-deco-credits-C0lExqRa.js → use-deco-credits-BKeBX-tq.js} +1 -1
  196. package/dist/client/assets/{use-decopilot-events-qGOD1WG0.js → use-decopilot-events-BLubMomL.js} +1 -1
  197. package/dist/client/assets/{use-delete-connection-BOFCmtMj.js → use-delete-connection-Ht5L6JbO.js} +1 -1
  198. package/dist/client/assets/{use-deployment-admin-Cwn49qZM.js → use-deployment-admin-DLq8R8Z0.js} +1 -1
  199. package/dist/client/assets/{use-file-configs-Nmeyll7B.js → use-file-configs-Bb1H_3HC.js} +1 -1
  200. package/dist/client/assets/{use-infinite-scroll-DW-B2iyn.js → use-infinite-scroll-BgeUdZ2r.js} +1 -1
  201. package/dist/client/assets/{use-join-requests-Dz8x0kbW.js → use-join-requests-C_f8RBci.js} +1 -1
  202. package/dist/client/assets/{use-mcp-auth-status-D-ki6Fzr.js → use-mcp-auth-status-e6L3fZT5.js} +1 -1
  203. package/dist/client/assets/{use-mcp-client-Csg0Ohl1.js → use-mcp-client-DOzs0Tmt.js} +1 -1
  204. package/dist/client/assets/{use-mcp-tools-DF4E3rLo.js → use-mcp-tools-DhrHyKlg.js} +1 -1
  205. package/dist/client/assets/{use-members-B1t5oiJJ.js → use-members-BLpPXsL5.js} +1 -1
  206. package/dist/client/assets/{use-mobile-DVuyUrh-.js → use-mobile-BgevOYAE.js} +1 -1
  207. package/dist/client/assets/{use-navigate-to-agent-BL2c2hni.js → use-navigate-to-agent-BSIL2UXY.js} +1 -1
  208. package/dist/client/assets/{use-org-auth-client-dM7W8lCQ.js → use-org-auth-client-DPIwgKGR.js} +1 -1
  209. package/dist/client/assets/{use-org-sso-w2vntLws.js → use-org-sso-_Lv26Jfl.js} +1 -1
  210. package/dist/client/assets/{use-organization-roles-7B2EryzT.js → use-organization-roles-BfCy8yn0.js} +1 -1
  211. package/dist/client/assets/{use-organization-settings-Dfv3IVMe.js → use-organization-settings-DzOh1lQX.js} +1 -1
  212. package/dist/client/assets/{use-registry-connections-DMVj_IUs.js → use-registry-connections-Cmxhk2_F.js} +1 -1
  213. package/dist/client/assets/{use-secrets-j8nq_pg4.js → use-secrets-CpoJkn6P.js} +1 -1
  214. package/dist/client/assets/{use-status-sounds-CQv-RBYC.js → use-status-sounds-BnhDmlSe.js} +1 -1
  215. package/dist/client/assets/{use-view-mode-DJr2m2Jz.js → use-view-mode-CStnutyU.js} +1 -1
  216. package/dist/client/assets/{use-virtual-mcp-6yApsgIW.js → use-virtual-mcp-BNqYWExX.js} +1 -1
  217. package/dist/client/assets/useInfiniteQuery-D0i2Yvlm.js +1 -0
  218. package/dist/client/assets/{useRouterState-D5zTQX9l.js → useRouterState-Bxyc9w2N.js} +1 -1
  219. package/dist/client/assets/useSuspenseInfiniteQuery-aK7IB6_b.js +1 -0
  220. package/dist/client/assets/{users-Dji-ZHlw.js → users-Amo4ZEh-.js} +1 -1
  221. package/dist/client/assets/{variant-calendar-UBPoL6eu.js → variant-calendar-CFJPE3Hl.js} +1 -1
  222. package/dist/client/assets/{view-mode-toggle-BxM9Rzzk.js → view-mode-toggle-sV52jMjK.js} +1 -1
  223. package/dist/client/index.html +1 -1
  224. package/dist/server/cli.js +1 -1
  225. package/dist/server/server.js +1 -1
  226. package/package.json +1 -1
  227. package/dist/client/assets/automations-C5v25H5e.js +0 -1
  228. package/dist/client/assets/connections-BcUWe8c_.js +0 -1
  229. package/dist/client/assets/page-seo-sheet-CaWQpVxd.js +0 -1
  230. package/dist/client/assets/project-app-view-CD4EGdca.js +0 -1
  231. package/dist/client/assets/record-editor-DpnQ11Qy.js +0 -1
  232. package/dist/client/assets/redirect-editor-DTyzzd3k.js +0 -1
  233. package/dist/client/assets/registry-B76hNPE7.js +0 -2
  234. package/dist/client/assets/store-registry-UxzRtugx.js +0 -2
  235. package/dist/client/assets/useInfiniteQuery-CzbwdXBh.js +0 -1
  236. package/dist/client/assets/useSuspenseInfiniteQuery-0mVVL1tH.js +0 -1
@@ -1 +1 @@
1
- import{c as d,j as t,i as u,B as h,L as f,k as x,O as p,l as b}from"./index-DGQdC8j6.js";import{u as j}from"./useRouterState-D5zTQX9l.js";import{R as _}from"./required-auth-layout-B-_kB-P-.js";import{u as y}from"./use-deployment-admin-Cwn49qZM.js";const g=[{to:"/_admin/users",label:"Users"},{to:"/_admin/orgs",label:"Organizations"}];function v(){const e=d.c(5);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={select:N},e[0]=s):s=e[0];const a=j(s);let n;e[1]!==a?(n=g.map(r=>t.jsx(f,{to:r.to,className:b("-mb-px border-b-2 px-3 py-2.5 text-sm font-medium transition-colors",a.startsWith(r.to)?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:r.label},r.to)),e[1]=a,e[2]=n):n=e[2];let o;return e[3]!==n?(o=t.jsx("nav",{className:"flex items-center gap-1 border-b border-border px-4 md:px-10",children:n}),e[3]=n,e[4]=o):o=e[4],o}function N(e){return e.location.pathname}function S(){const e=d.c(7),{isAdmin:s,loading:a,needsEmailVerification:n}=y();if(a){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"flex h-dvh flex-1 items-center justify-center",children:t.jsx(u,{size:20,className:"animate-spin text-muted-foreground"})}),e[0]=i):i=e[0],i}if(!s){const i=n?"Verify your email address to access the admin dashboard.":"This dashboard is restricted to deployment admins.";let m;e[1]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(h,{variant:"outline",size:"sm",asChild:!0,children:t.jsx(f,{to:"/",children:"Go home"})}),e[1]=m):m=e[1];let c;return e[2]!==i?(c=t.jsx(x,{area:"the admin dashboard",description:i,action:m}),e[2]=i,e[3]=c):c=e[3],c}let o,r;e[4]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("div",{className:"shrink-0 px-4 pt-6 md:px-10",children:t.jsx("h1",{className:"pb-4 text-xl font-medium",children:"Admin Dashboard"})}),r=t.jsx(v,{}),e[4]=o,e[5]=r):(o=e[4],r=e[5]);let l;return e[6]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsxs("div",{className:"flex h-dvh flex-col overflow-hidden bg-background",children:[o,r,t.jsx("div",{className:"flex-1 overflow-hidden",children:t.jsx(p,{})})]}),e[6]=l):l=e[6],l}function z(){const e=d.c(1);let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx(_,{children:t.jsx(S,{})}),e[0]=s):s=e[0],s}export{z as default};
1
+ import{c as d,j as t,i as u,B as h,L as f,k as x,O as p,l as b}from"./index-Dm8PN3sF.js";import{u as j}from"./useRouterState-Bxyc9w2N.js";import{R as _}from"./required-auth-layout-CtWEo2zO.js";import{u as y}from"./use-deployment-admin-DLq8R8Z0.js";const g=[{to:"/_admin/users",label:"Users"},{to:"/_admin/orgs",label:"Organizations"}];function v(){const e=d.c(5);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={select:N},e[0]=s):s=e[0];const a=j(s);let n;e[1]!==a?(n=g.map(r=>t.jsx(f,{to:r.to,className:b("-mb-px border-b-2 px-3 py-2.5 text-sm font-medium transition-colors",a.startsWith(r.to)?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:r.label},r.to)),e[1]=a,e[2]=n):n=e[2];let o;return e[3]!==n?(o=t.jsx("nav",{className:"flex items-center gap-1 border-b border-border px-4 md:px-10",children:n}),e[3]=n,e[4]=o):o=e[4],o}function N(e){return e.location.pathname}function S(){const e=d.c(7),{isAdmin:s,loading:a,needsEmailVerification:n}=y();if(a){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"flex h-dvh flex-1 items-center justify-center",children:t.jsx(u,{size:20,className:"animate-spin text-muted-foreground"})}),e[0]=i):i=e[0],i}if(!s){const i=n?"Verify your email address to access the admin dashboard.":"This dashboard is restricted to deployment admins.";let m;e[1]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(h,{variant:"outline",size:"sm",asChild:!0,children:t.jsx(f,{to:"/",children:"Go home"})}),e[1]=m):m=e[1];let c;return e[2]!==i?(c=t.jsx(x,{area:"the admin dashboard",description:i,action:m}),e[2]=i,e[3]=c):c=e[3],c}let o,r;e[4]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("div",{className:"shrink-0 px-4 pt-6 md:px-10",children:t.jsx("h1",{className:"pb-4 text-xl font-medium",children:"Admin Dashboard"})}),r=t.jsx(v,{}),e[4]=o,e[5]=r):(o=e[4],r=e[5]);let l;return e[6]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsxs("div",{className:"flex h-dvh flex-col overflow-hidden bg-background",children:[o,r,t.jsx("div",{className:"flex-1 overflow-hidden",children:t.jsx(p,{})})]}),e[6]=l):l=e[6],l}function z(){const e=d.c(1);let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx(_,{children:t.jsx(S,{})}),e[0]=s):s=e[0],s}export{z as default};
@@ -1 +1 @@
1
- import{a,u as f,j as o,S as g,N as p}from"./index-DGQdC8j6.js";import{A as x}from"./auth-entry-wtr1fLwN.js";import{A as S}from"./auth-split-layout-Bifmzv2W.js";import"./input-DwWe5Hqk.js";import"./retry-CErkP7V6.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";function y(e){if(!e.client_id||e.response_type!=="code")return null;const t=new URLSearchParams;return e.client_id&&t.set("client_id",e.client_id),e.redirect_uri&&t.set("redirect_uri",e.redirect_uri),e.response_type&&t.set("response_type",e.response_type),e.state&&t.set("state",e.state),e.scope&&t.set("scope",e.scope),e.code_challenge&&t.set("code_challenge",e.code_challenge),e.code_challenge_method&&t.set("code_challenge_method",e.code_challenge_method),`/api/auth/mcp/authorize?${t.toString()}`}function N(){const e=a.useSession(),t=f({from:"/login"}),{next:i="/",client_id:r,redirect_uri:s,response_type:l,state:h,scope:u,code_challenge:d,code_challenge_method:_}=t,n=i.startsWith("/")&&!i.startsWith("//")?i:"/",c=y({client_id:r,redirect_uri:s,response_type:l,state:h,scope:u,code_challenge:d,code_challenge_method:_});return e.data?c?(window.location.href=c,o.jsx(g,{})):o.jsx(p,{to:n}):o.jsx(S,{children:o.jsx(x,{callbackUrl:n,redirectUrl:c})})}export{N as default};
1
+ import{a,u as f,j as o,S as g,N as p}from"./index-Dm8PN3sF.js";import{A as x}from"./auth-entry-CSB36Rq1.js";import{A as S}from"./auth-split-layout-BuJmTwGZ.js";import"./input-BSpKqXLN.js";import"./retry-CErkP7V6.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";function y(e){if(!e.client_id||e.response_type!=="code")return null;const t=new URLSearchParams;return e.client_id&&t.set("client_id",e.client_id),e.redirect_uri&&t.set("redirect_uri",e.redirect_uri),e.response_type&&t.set("response_type",e.response_type),e.state&&t.set("state",e.state),e.scope&&t.set("scope",e.scope),e.code_challenge&&t.set("code_challenge",e.code_challenge),e.code_challenge_method&&t.set("code_challenge_method",e.code_challenge_method),`/api/auth/mcp/authorize?${t.toString()}`}function N(){const e=a.useSession(),t=f({from:"/login"}),{next:i="/",client_id:r,redirect_uri:s,response_type:l,state:h,scope:u,code_challenge:d,code_challenge_method:_}=t,n=i.startsWith("/")&&!i.startsWith("//")?i:"/",c=y({client_id:r,redirect_uri:s,response_type:l,state:h,scope:u,code_challenge:d,code_challenge_method:_});return e.data?c?(window.location.href=c,o.jsx(g,{})):o.jsx(p,{to:n}):o.jsx(S,{children:o.jsx(x,{callbackUrl:n,redirectUrl:c})})}export{N as default};
@@ -1 +1 @@
1
- import{d as x,b as N,c as z,a as D}from"./auth-DDOP_TUe.js";function E(t){let e=0;for(let n=0;n<t.length;n++){const r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(16)}function H(){return window.location.origin}function C(){try{const t=window.location.hostname;return t==="localhost"||t.endsWith(".localhost")||t==="127.0.0.1"||t==="::1"}catch{return!1}}const M=new Map,R="mcp:oauth:callback:";class W{serverUrl;_clientMetadata;_redirectUrl;_windowMode;_state=null;_codeVerifier=null;_clientInfo=null;_tokens=null;constructor(e){this.serverUrl=e.serverUrl,this._redirectUrl=e.callbackUrl??`${H()}/oauth/callback`,this._windowMode=e.windowMode??"popup";const n=e.scope?Array.isArray(e.scope)?e.scope.join(" "):e.scope:void 0;this._clientMetadata={redirect_uris:[this._redirectUrl],token_endpoint_auth_method:"none",grant_types:["authorization_code","refresh_token"],response_types:["code"],client_name:e.clientName??"@decocms/mesh MCP client",...n&&{scope:n}},M.set(E(this.serverUrl),this)}get redirectUrl(){return this._redirectUrl}get clientMetadata(){return this._clientMetadata}state(){return this._state||(this._state=crypto.randomUUID()),this._state}getStoredState(){return this._state}clientInformation(){return this._clientInfo??void 0}saveClientInformation(e){this._clientInfo=e}tokens(){return this._tokens??void 0}saveTokens(e){this._tokens=e}redirectToAuthorization(e){if(this._windowMode==="tab"){if(!window.open(e.toString(),"_blank"))throw new Error("Tab was blocked")}else{const o=window.screenX+(window.outerWidth-600)/2,s=window.screenY+(window.outerHeight-700)/2;if(!window.open(e.toString(),"mcp-oauth",`width=600,height=700,left=${o},top=${s},popup=yes`)&&!window.open(e.toString(),"_blank"))throw new Error("Popup was blocked")}}saveCodeVerifier(e){this._codeVerifier=e}codeVerifier(){if(!this._codeVerifier)throw new Error("Code verifier not found");return this._codeVerifier}invalidateCredentials(){this._clientInfo=null,this._tokens=null,this._codeVerifier=null,this._state=null}getServerUrl(){return this.serverUrl}cleanup(){M.delete(E(this.serverUrl))}}async function G(t){const e=t.meshUrl??window.location.origin,n=t.orgSlug?`/api/${encodeURIComponent(t.orgSlug)}/mcp/${t.connectionId}`:`/mcp/${t.connectionId}`,r=new URL(n,e),o=new W({serverUrl:r.href,clientName:t.clientName,clientUri:t.clientUri,callbackUrl:t.callbackUrl,scope:t.scope,windowMode:t.windowMode}),s={fn:null};try{const i=new Promise((l,d)=>{const k=t.timeout||12e4;let b,p=!1;const L=o.state(),A=`${R}${L}`,h=()=>{window.removeEventListener("message",v),window.removeEventListener("storage",O),clearTimeout(b);try{localStorage.removeItem(A)}catch{}};s.fn=u=>{p||(p=!0,h(),d(u))};const U=async u=>{if(p)return;if(p=!0,!u.success){h(),d(new Error(u.error||"OAuth authentication failed"));return}const{code:m,state:$}=u;if(!m){h(),d(new Error("Missing authorization code"));return}if(o.getStoredState()!==$){h(),d(new Error("OAuth state mismatch - possible CSRF attack"));return}try{const T=(await x(r))?.authorization_servers?.[0]||r,S=await N(T),g=o.clientInformation();if(!g){h(),d(new Error("Client information not found"));return}const P=o.codeVerifier(),V=await z(T,{metadata:S,clientInformation:g,authorizationCode:m,codeVerifier:P,redirectUri:o.redirectUrl,resource:new URL(r)});h(),l({tokens:V,clientId:g.client_id??null,clientSecret:"client_secret"in g?g.client_secret:null,tokenEndpoint:S?.token_endpoint??null,userinfoEndpoint:S?.userinfo_endpoint??null})}catch(I){h(),d(I)}},v=async u=>{!C()&&u.origin!==window.location.origin||u.data?.type==="mcp:oauth:callback"&&await U(u.data)},O=async u=>{if(!(u.key!==A||!u.newValue))try{const m=JSON.parse(u.newValue);await U(m)}catch{}};window.addEventListener("message",v),window.addEventListener("storage",O),b=setTimeout(()=>{p||(p=!0,h(),d(new Error("OAuth authentication timeout")))},k)});if(i.catch(()=>{}),await D(o,{serverUrl:r})==="REDIRECT"){const l=await i,d=l.tokens;return{token:l.tokens.access_token,tokenInfo:{accessToken:l.tokens.access_token,refreshToken:l.tokens.refresh_token??null,expiresIn:l.tokens.expires_in??null,scope:l.tokens.scope??null,clientId:l.clientId,clientSecret:l.clientSecret,tokenEndpoint:l.tokenEndpoint,userinfoEndpoint:l.userinfoEndpoint,idToken:typeof d.id_token=="string"?d.id_token:null},error:null}}const a=o.tokens(),w=o.clientInformation(),f=a;return{token:a?.access_token||null,tokenInfo:a?{accessToken:a.access_token,refreshToken:a.refresh_token??null,expiresIn:a.expires_in??null,scope:a.scope??null,clientId:w?.client_id??null,clientSecret:w&&"client_secret"in w?w.client_secret:null,tokenEndpoint:null,userinfoEndpoint:null,idToken:f&&typeof f.id_token=="string"?f.id_token:null}:null,error:null}}catch(i){return s.fn&&s.fn(i instanceof Error?i:new Error(String(i))),{token:null,tokenInfo:null,error:i instanceof Error?i.message:String(i)}}finally{o.cleanup()}}function y(t,e){if(window.opener&&!window.opener.closed){const n=C()?"*":window.location.origin;return window.opener.postMessage(t,n),!0}if(e)try{const n=`${R}${e}`;return localStorage.setItem(n,JSON.stringify(t)),!0}catch{}return!1}async function X(){const t=new URLSearchParams(window.location.search),e=t.get("code");let n=t.get("state");const r=t.get("error"),o=t.get("error_description");let s=n;if(n)try{const c=atob(n),a=JSON.parse(c);a.clientState&&(s=a.clientState)}catch{}if(r){const c=o||r;return y({type:"mcp:oauth:callback",success:!1,error:c},s),{success:!1,error:c}}if(!e||!n){const c="Missing code or state parameter";return y({type:"mcp:oauth:callback",success:!1,error:c},s),{success:!1,error:c}}return n=s||n,y({type:"mcp:oauth:callback",success:!0,code:e,state:n},n)?{success:!0}:{success:!1,error:"Parent window not available"}}function _(){if(typeof window<"u"&&window.location?.origin)return window.location.origin}function j(t){try{const e=_(),n=e?new URL(t,e):new URL(t),r=n.pathname.match(/^\/api\/[^/]+\/mcp\/([^/]+)/);return r?r[1]??null:n.pathname.match(/^\/mcp\/([^/]+)/)?.[1]??null}catch{return null}}function J(t){try{const e=_();return(e?new URL(t,e):new URL(t)).pathname.match(/^\/api\/([^/]+)\/mcp\//)?.[1]??null}catch{return null}}async function K(t,e,n){try{const r=`/api/${encodeURIComponent(e)}/connections/${t}/oauth-token/status`,o=n?new URL(r,n).href:r,s=_(),i=!n||new URL(n).origin===s,c=await fetch(o,{credentials:i?"include":"omit"});return c.ok?{hasToken:(await c.json()).hasToken===!0}:{hasToken:!1}}catch{return{hasToken:!1}}}async function q({url:t,token:e,orgId:n,meshUrl:r}){try{const o=new Headers;o.set("Content-Type","application/json"),o.set("Accept","application/json, text/event-stream");const s=await fetch(t,{method:"POST",headers:o,body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"@decocms/mesh MCP client",version:"1.0.0"}}})}),i=j(t),c=J(t),a=_(),w=r??(a?new URL(t,a).origin:new URL(t).origin);if(s.ok)return{isAuthenticated:!0,supportsOAuth:!1,hasOAuthToken:(i&&c?await K(i,c,w):{hasToken:!1}).hasToken};let f;try{const k=await s.json();f=k.error||k.message}catch{}return s.status>=500?{isAuthenticated:!1,supportsOAuth:!1,hasOAuthToken:!1,error:f||`HTTP ${s.status}`,isServerError:!0}:{isAuthenticated:!1,supportsOAuth:!!s.headers.get("WWW-Authenticate"),hasOAuthToken:!1,error:f||`HTTP ${s.status}`}}catch(o){return console.error("[isConnectionAuthenticated] Error:",o),{isAuthenticated:!1,supportsOAuth:!1,hasOAuthToken:!1,error:o.message}}}export{G as a,X as h,q as i};
1
+ import{d as x,b as N,c as z,a as D}from"./auth-B6PY9djs.js";function E(t){let e=0;for(let n=0;n<t.length;n++){const r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(16)}function H(){return window.location.origin}function C(){try{const t=window.location.hostname;return t==="localhost"||t.endsWith(".localhost")||t==="127.0.0.1"||t==="::1"}catch{return!1}}const M=new Map,R="mcp:oauth:callback:";class W{serverUrl;_clientMetadata;_redirectUrl;_windowMode;_state=null;_codeVerifier=null;_clientInfo=null;_tokens=null;constructor(e){this.serverUrl=e.serverUrl,this._redirectUrl=e.callbackUrl??`${H()}/oauth/callback`,this._windowMode=e.windowMode??"popup";const n=e.scope?Array.isArray(e.scope)?e.scope.join(" "):e.scope:void 0;this._clientMetadata={redirect_uris:[this._redirectUrl],token_endpoint_auth_method:"none",grant_types:["authorization_code","refresh_token"],response_types:["code"],client_name:e.clientName??"@decocms/mesh MCP client",...n&&{scope:n}},M.set(E(this.serverUrl),this)}get redirectUrl(){return this._redirectUrl}get clientMetadata(){return this._clientMetadata}state(){return this._state||(this._state=crypto.randomUUID()),this._state}getStoredState(){return this._state}clientInformation(){return this._clientInfo??void 0}saveClientInformation(e){this._clientInfo=e}tokens(){return this._tokens??void 0}saveTokens(e){this._tokens=e}redirectToAuthorization(e){if(this._windowMode==="tab"){if(!window.open(e.toString(),"_blank"))throw new Error("Tab was blocked")}else{const o=window.screenX+(window.outerWidth-600)/2,s=window.screenY+(window.outerHeight-700)/2;if(!window.open(e.toString(),"mcp-oauth",`width=600,height=700,left=${o},top=${s},popup=yes`)&&!window.open(e.toString(),"_blank"))throw new Error("Popup was blocked")}}saveCodeVerifier(e){this._codeVerifier=e}codeVerifier(){if(!this._codeVerifier)throw new Error("Code verifier not found");return this._codeVerifier}invalidateCredentials(){this._clientInfo=null,this._tokens=null,this._codeVerifier=null,this._state=null}getServerUrl(){return this.serverUrl}cleanup(){M.delete(E(this.serverUrl))}}async function G(t){const e=t.meshUrl??window.location.origin,n=t.orgSlug?`/api/${encodeURIComponent(t.orgSlug)}/mcp/${t.connectionId}`:`/mcp/${t.connectionId}`,r=new URL(n,e),o=new W({serverUrl:r.href,clientName:t.clientName,clientUri:t.clientUri,callbackUrl:t.callbackUrl,scope:t.scope,windowMode:t.windowMode}),s={fn:null};try{const i=new Promise((l,d)=>{const k=t.timeout||12e4;let b,p=!1;const L=o.state(),A=`${R}${L}`,h=()=>{window.removeEventListener("message",v),window.removeEventListener("storage",O),clearTimeout(b);try{localStorage.removeItem(A)}catch{}};s.fn=u=>{p||(p=!0,h(),d(u))};const U=async u=>{if(p)return;if(p=!0,!u.success){h(),d(new Error(u.error||"OAuth authentication failed"));return}const{code:m,state:$}=u;if(!m){h(),d(new Error("Missing authorization code"));return}if(o.getStoredState()!==$){h(),d(new Error("OAuth state mismatch - possible CSRF attack"));return}try{const T=(await x(r))?.authorization_servers?.[0]||r,S=await N(T),g=o.clientInformation();if(!g){h(),d(new Error("Client information not found"));return}const P=o.codeVerifier(),V=await z(T,{metadata:S,clientInformation:g,authorizationCode:m,codeVerifier:P,redirectUri:o.redirectUrl,resource:new URL(r)});h(),l({tokens:V,clientId:g.client_id??null,clientSecret:"client_secret"in g?g.client_secret:null,tokenEndpoint:S?.token_endpoint??null,userinfoEndpoint:S?.userinfo_endpoint??null})}catch(I){h(),d(I)}},v=async u=>{!C()&&u.origin!==window.location.origin||u.data?.type==="mcp:oauth:callback"&&await U(u.data)},O=async u=>{if(!(u.key!==A||!u.newValue))try{const m=JSON.parse(u.newValue);await U(m)}catch{}};window.addEventListener("message",v),window.addEventListener("storage",O),b=setTimeout(()=>{p||(p=!0,h(),d(new Error("OAuth authentication timeout")))},k)});if(i.catch(()=>{}),await D(o,{serverUrl:r})==="REDIRECT"){const l=await i,d=l.tokens;return{token:l.tokens.access_token,tokenInfo:{accessToken:l.tokens.access_token,refreshToken:l.tokens.refresh_token??null,expiresIn:l.tokens.expires_in??null,scope:l.tokens.scope??null,clientId:l.clientId,clientSecret:l.clientSecret,tokenEndpoint:l.tokenEndpoint,userinfoEndpoint:l.userinfoEndpoint,idToken:typeof d.id_token=="string"?d.id_token:null},error:null}}const a=o.tokens(),w=o.clientInformation(),f=a;return{token:a?.access_token||null,tokenInfo:a?{accessToken:a.access_token,refreshToken:a.refresh_token??null,expiresIn:a.expires_in??null,scope:a.scope??null,clientId:w?.client_id??null,clientSecret:w&&"client_secret"in w?w.client_secret:null,tokenEndpoint:null,userinfoEndpoint:null,idToken:f&&typeof f.id_token=="string"?f.id_token:null}:null,error:null}}catch(i){return s.fn&&s.fn(i instanceof Error?i:new Error(String(i))),{token:null,tokenInfo:null,error:i instanceof Error?i.message:String(i)}}finally{o.cleanup()}}function y(t,e){if(window.opener&&!window.opener.closed){const n=C()?"*":window.location.origin;return window.opener.postMessage(t,n),!0}if(e)try{const n=`${R}${e}`;return localStorage.setItem(n,JSON.stringify(t)),!0}catch{}return!1}async function X(){const t=new URLSearchParams(window.location.search),e=t.get("code");let n=t.get("state");const r=t.get("error"),o=t.get("error_description");let s=n;if(n)try{const c=atob(n),a=JSON.parse(c);a.clientState&&(s=a.clientState)}catch{}if(r){const c=o||r;return y({type:"mcp:oauth:callback",success:!1,error:c},s),{success:!1,error:c}}if(!e||!n){const c="Missing code or state parameter";return y({type:"mcp:oauth:callback",success:!1,error:c},s),{success:!1,error:c}}return n=s||n,y({type:"mcp:oauth:callback",success:!0,code:e,state:n},n)?{success:!0}:{success:!1,error:"Parent window not available"}}function _(){if(typeof window<"u"&&window.location?.origin)return window.location.origin}function j(t){try{const e=_(),n=e?new URL(t,e):new URL(t),r=n.pathname.match(/^\/api\/[^/]+\/mcp\/([^/]+)/);return r?r[1]??null:n.pathname.match(/^\/mcp\/([^/]+)/)?.[1]??null}catch{return null}}function J(t){try{const e=_();return(e?new URL(t,e):new URL(t)).pathname.match(/^\/api\/([^/]+)\/mcp\//)?.[1]??null}catch{return null}}async function K(t,e,n){try{const r=`/api/${encodeURIComponent(e)}/connections/${t}/oauth-token/status`,o=n?new URL(r,n).href:r,s=_(),i=!n||new URL(n).origin===s,c=await fetch(o,{credentials:i?"include":"omit"});return c.ok?{hasToken:(await c.json()).hasToken===!0}:{hasToken:!1}}catch{return{hasToken:!1}}}async function q({url:t,token:e,orgId:n,meshUrl:r}){try{const o=new Headers;o.set("Content-Type","application/json"),o.set("Accept","application/json, text/event-stream");const s=await fetch(t,{method:"POST",headers:o,body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"@decocms/mesh MCP client",version:"1.0.0"}}})}),i=j(t),c=J(t),a=_(),w=r??(a?new URL(t,a).origin:new URL(t).origin);if(s.ok)return{isAuthenticated:!0,supportsOAuth:!1,hasOAuthToken:(i&&c?await K(i,c,w):{hasToken:!1}).hasToken};let f;try{const k=await s.json();f=k.error||k.message}catch{}return s.status>=500?{isAuthenticated:!1,supportsOAuth:!1,hasOAuthToken:!1,error:f||`HTTP ${s.status}`,isServerError:!0}:{isAuthenticated:!1,supportsOAuth:!!s.headers.get("WWW-Authenticate"),hasOAuthToken:!1,error:f||`HTTP ${s.status}`}}catch(o){return console.error("[isConnectionAuthenticated] Error:",o),{isAuthenticated:!1,supportsOAuth:!1,hasOAuthToken:!1,error:o.message}}}export{G as a,X as h,q as i};
@@ -1 +1 @@
1
- import{c as U,j as s,B as ze,C as pe,v as At,n as Qe,d as Me,K as ce,t as oe,m as vt,r as re,l as ke,i as Xe,E as Mt,p as Re}from"./index-DGQdC8j6.js";import{C as Rt}from"./collection-display-button--OVhArve.js";import{S as zt}from"./search-input-B0lumlG7.js";import{P as Ae}from"./index-qg-bT8JA.js";import{C as Pt}from"./collection-table-wrapper-DPtPbXkO.js";import{E as We}from"./empty-state-LUctNkh2.js";import{I as Et}from"./invite-member-dialog-D3eUhcy1.js";import{b as kt,S as Dt,a as $t}from"./settings-section-CvpT3RW4.js";import{u as qt,a as Ot}from"./use-join-requests-Dz8x0kbW.js";import{A as De}from"./avatar-BumqAYVV.js";import{f as Ft}from"./format-time-BnbuEtat.js";import{g as Ve}from"./get-initials-D-f_fDFw.js";import{u as Lt}from"./use-members-B1t5oiJJ.js";import{u as $e}from"./studio-tools-DII0jqi8.js";import{u as Ct}from"./use-org-auth-client-dM7W8lCQ.js";import{u as Bt}from"./use-organization-roles-7B2EryzT.js";import{g as Kt,a as Vt}from"./role-color-DVw_ATb1.js";import{T as Qt,a as Gt,c as Ut,b as Jt}from"./tooltip-CO1zVhUs.js";import{a as st,e as nt,g as it,b as at,c as lt,d as ot,A as rt,f as ct}from"./alert-dialog-CWlVUd73.js";import{B as Ge}from"./badge-DuwyDvgL.js";import{C as mt}from"./card-whir3-TU.js";import{D as yt,a as St,c as Nt,e as Ht,f as Wt,g as Yt,d as et,j as Zt}from"./dropdown-menu-BDW1EJyx.js";import{i as wt}from"./DotsVertical-B0IViKUD.js";import{i as Xt}from"./Key01-ChBXFLCM.js";import{i as es}from"./Shield01-bU8ewL-C.js";import{a as ts}from"./SwitchHorizontal01-DqE-u_vC.js";import{s as ss}from"./Trash01-BGwW4PUs.js";import{s as _t}from"./XClose-hq2LkF75.js";import{b as dt,a as ut,d as ft,c as pt,S as ht}from"./select-vVirKMnE.js";import{C as xt}from"./checkbox-DbEZ6b_D.js";import{e as Ye,a as Ze,f as gt,C as ns,c as is,d as as,b as ls}from"./command-BoNCgAXF.js";import{a as os,b as rs,P as cs}from"./popover-BoSjy_J9.js";import{t as ms}from"./ChevronDown-DCZlSvzQ.js";import{s as ds}from"./Plus-D8fSfWhL.js";import{R as us}from"./require-capability--U_vi60H.js";import"./ArrowUp-OqBYOpu3.js";import"./Check-Oxo5mPeL.js";import"./List-CgvHjjyd.js";import"./view-mode-toggle-BxM9Rzzk.js";import"./SearchMd-Di7fRkvt.js";import"./sidebar-C_llE2r0.js";import"./LayoutLeft-DPtsS7J4.js";import"./use-mobile-DVuyUrh-.js";import"./X-Bs0u_0yh.js";import"./table-DqN44BtI.js";import"./dialog-hBUfi5DB.js";import"./form-B8zhOVR3.js";import"./label-DdsuSm6M.js";import"./textarea-BH3kgWLk.js";import"./ArrowUpRight-3xkp-kWm.js";import"./use-capability-CEIYeJxR.js";import"./User01-joygJQdk.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./ChevronRight-L_rxCnv3.js";import"./Circle-DLL8alCD.js";import"./ChevronUp-BXrO8J56.js";import"./index-Cag8mnTh.js";import"./access-gate-B4pZWmwl.js";import"./capability-load-error-CVQ-0IvS.js";function fs(){const t=U.c(9),e=qt(),{approve:n,deny:l}=Ot();if(e.length===0)return null;let i;if(t[0]!==n||t[1]!==l||t[2]!==e){let o;t[4]!==n||t[5]!==l?(o=r=>s.jsx(kt,{icon:s.jsx(De,{url:r.user?.image??void 0,fallback:(r.user?.name??r.user?.email??"?").charAt(0).toUpperCase(),shape:"circle",size:"sm"}),title:r.user?.name??r.user?.email??r.userId,description:r.user?.email,action:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ze,{size:"sm",variant:"outline",onClick:()=>l.mutate(r.id),disabled:l.isPending||n.isPending,children:"Deny"}),s.jsx(ze,{size:"sm",onClick:()=>n.mutate(r.id),disabled:n.isPending||l.isPending,children:"Approve"})]})},r.id),t[4]=n,t[5]=l,t[6]=o):o=t[6],i=e.map(o),t[0]=n,t[1]=l,t[2]=e,t[3]=i}else i=t[3];let a;return t[7]!==i?(a=s.jsx(Dt,{title:"Join requests",description:"People who requested to join via a domain in approval mode.",children:s.jsx($t,{children:i})}),t[7]=i,t[8]=a):a=t[8],a}function ps(){const t=U.c(7),{locator:e}=pe(),n=$e();let l;t[0]!==e?(l=ce.invitations(e),t[0]=e,t[1]=l):l=t[1];let i;t[2]!==n?(i=async()=>(await n.call("ORGANIZATION_GET",{}))?.invitations??[],t[2]=n,t[3]=i):i=t[3];let a;return t[4]!==l||t[5]!==i?(a={queryKey:l,queryFn:i},t[4]=l,t[5]=i,t[6]=a):a=t[6],At(a)}function hs(){const t=U.c(10),{locator:e}=pe(),n=Ct(),l=Qe();let i;t[0]!==n?(i=async f=>{const x=await n.organization.cancelInvitation({invitationId:f});if(x?.error)throw new Error(x.error.message);return x.data},t[0]=n,t[1]=i):i=t[1];let a;t[2]!==e||t[3]!==l?(a=()=>{l.invalidateQueries({queryKey:ce.invitations(e)}),oe.success("Invitation cancelled")},t[2]=e,t[3]=l,t[4]=a):a=t[4];let o;t[5]!==i||t[6]!==a?(o={mutationFn:i,onSuccess:a,onError:xs},t[5]=i,t[6]=a,t[7]=o):o=t[7];const r=Me(o);let u;return t[8]!==r?(u={cancel:r},t[8]=r,t[9]=u):u=t[9],u}function xs(t){oe.error(t instanceof Error?t.message:"Failed to cancel invitation")}function gs(){const t=U.c(7),{locator:e}=pe(),n=$e();let l;t[0]!==e?(l=ce.tags(e),t[0]=e,t[1]=l):l=t[1];let i;t[2]!==n?(i=async()=>{const{tags:o}=await n.call("TAGS_LIST",{});return o},t[2]=n,t[3]=i):i=t[3];let a;return t[4]!==l||t[5]!==i?(a={queryKey:l,queryFn:i,staleTime:3e4},t[4]=l,t[5]=i,t[6]=a):a=t[6],vt(a)}function js(){const t=U.c(8),e=Qe(),{locator:n}=pe(),l=$e();let i;t[0]!==l?(i=async r=>{const{tag:u}=await l.call("TAGS_CREATE",{name:r});return u},t[0]=l,t[1]=i):i=t[1];let a;t[2]!==n||t[3]!==e?(a=()=>{e.invalidateQueries({queryKey:ce.tags(n)})},t[2]=n,t[3]=e,t[4]=a):a=t[4];let o;return t[5]!==i||t[6]!==a?(o={mutationFn:i,onSuccess:a,onError:bs},t[5]=i,t[6]=a,t[7]=o):o=t[7],Me(o)}function bs(t){oe.error(t instanceof Error?t.message:"Failed to create tag")}function vs(t){const e=U.c(10),{locator:n}=pe(),l=$e();let i;e[0]!==n||e[1]!==t?(i=ce.memberTags(n,t),e[0]=n,e[1]=t,e[2]=i):i=e[2];let a;e[3]!==t||e[4]!==l?(a=async()=>{const{tags:u}=await l.call("MEMBER_TAGS_GET",{memberId:t});return u},e[3]=t,e[4]=l,e[5]=a):a=e[5];const o=!!t;let r;return e[6]!==i||e[7]!==a||e[8]!==o?(r={queryKey:i,queryFn:a,staleTime:3e4,enabled:o},e[6]=i,e[7]=a,e[8]=o,e[9]=r):r=e[9],vt(r)}function Cs(){const t=U.c(8),e=Qe(),{locator:n}=pe(),l=$e();let i;t[0]!==l?(i=async r=>{const{memberId:u,tagIds:f}=r;return await l.call("MEMBER_TAGS_SET",{memberId:u,tagIds:f})},t[0]=l,t[1]=i):i=t[1];let a;t[2]!==n||t[3]!==e?(a=(r,u)=>{e.invalidateQueries({queryKey:ce.memberTags(n,u.memberId)})},t[2]=n,t[3]=e,t[4]=a):a=t[4];let o;return t[5]!==i||t[6]!==a?(o={mutationFn:i,onSuccess:a,onError:ys},t[5]=i,t[6]=a,t[7]=o):o=t[7],Me(o)}function ys(t){oe.error(t instanceof Error?t.message:"Failed to update member tags")}function Tt(t){const e=U.c(44),{memberId:n,className:l,disabled:i,placeholder:a,maxDisplay:o}=t,r=i===void 0?!1:i,u=a===void 0?"Add tags...":a,f=o===void 0?2:o,[x,j]=re.useState(!1),[p,I]=re.useState(""),{data:M,isLoading:b}=gs(),D=M===void 0?[]:M,{data:v,isLoading:$}=vs(n),C=v===void 0?[]:v,E=js(),N=Cs(),R=b||$,S=C.map(Ns);let z;e[0]!==p?(z=g=>g.name.toLowerCase().includes(p.toLowerCase()),e[0]=p,e[1]=z):z=e[1];const A=D.filter(z);let y;e[2]!==p?(y=g=>g.name.toLowerCase()===p.toLowerCase(),e[2]=p,e[3]=y):y=e[3];const K=D.find(y),w=p.trim()&&!K,k=async g=>{const fe=S.includes(g.id)?S.filter(ge=>ge!==g.id):[...S,g.id];await N.mutateAsync({memberId:n,tagIds:fe})},_=async()=>{if(!p.trim())return;const g=await E.mutateAsync(p.trim());await N.mutateAsync({memberId:n,tagIds:[...S,g.id]}),I("")},c=async g=>{const se=S.filter(fe=>fe!==g);await N.mutateAsync({memberId:n,tagIds:se})},h=E.isPending||N.isPending,F=rs;let P;e[4]!==x?(P=()=>j(!x),e[4]=x,e[5]=P):P=e[5];let q;e[6]!==l?(q=ke("h-auto min-h-8 px-2 py-1 justify-start font-normal","hover:bg-accent/50",l),e[6]=l,e[7]=q):q=e[7];const V=r||R,O=R?s.jsx(Xe,{size:14,className:"animate-spin text-muted-foreground"}):C.length>0?s.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[C.slice(0,f).map(Ss),C.length>f&&s.jsxs(Ge,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5",children:["+",C.length-f]})]}):s.jsx("span",{className:"text-muted-foreground text-xs",children:u});let Q;e[8]===Symbol.for("react.memo_cache_sentinel")?(Q=s.jsx(ms,{size:14,className:"ml-1 shrink-0 opacity-50"}),e[8]=Q):Q=e[8];let L;e[9]!==V||e[10]!==O||e[11]!==P||e[12]!==q?(L=s.jsx(cs,{asChild:!0,children:s.jsxs(ze,{variant:"ghost",size:"sm",onClick:P,className:q,disabled:V,children:[O,Q]})}),e[9]=V,e[10]=O,e[11]=P,e[12]=q,e[13]=L):L=e[13];const G=os,J="w-56 p-0",H="start";let W;e[14]===Symbol.for("react.memo_cache_sentinel")?(W=()=>j(!1),e[14]=W):W=e[14];const ne=as,he=!1;let Y;e[15]!==p?(Y=s.jsx(ls,{placeholder:"Search or create...",value:p,onValueChange:I,className:"h-9"}),e[15]=p,e[16]=Y):Y=e[16];const ie=is,me=C.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(Ye,{heading:"Selected",children:C.map(g=>s.jsx(Ze,{onSelect:()=>k(g),className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center justify-between w-full",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(xt,{checked:!0,className:"[&_svg]:!text-primary-foreground"}),s.jsx("span",{children:g.name})]}),s.jsx("button",{onClick:se=>{se.stopPropagation(),c(g.id)},className:"opacity-50 hover:opacity-100",disabled:h,children:s.jsx(_t,{size:14})})]})},g.id))}),s.jsx(gt,{})]}),Pe=Ye,xe="Available",Ee=A.length===0&&!w&&s.jsx(ns,{children:"No tags found."}),ue=A.filter(g=>!S.includes(g.id)).map(g=>s.jsx(Ze,{onSelect:()=>k(g),className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(xt,{checked:!1,className:"[&_svg]:!text-primary-foreground"}),s.jsx("span",{children:g.name})]})},g.id));let ae;e[17]!==Pe||e[18]!==Ee||e[19]!==ue?(ae=s.jsxs(Pe,{heading:xe,children:[Ee,ue]}),e[17]=Pe,e[18]=Ee,e[19]=ue,e[20]=ae):ae=e[20];let le;e[21]!==_||e[22]!==h||e[23]!==p||e[24]!==w?(le=w&&s.jsxs(s.Fragment,{children:[s.jsx(gt,{}),s.jsx(Ye,{children:s.jsx(Ze,{onSelect:_,className:"cursor-pointer",disabled:h,children:s.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[h?s.jsx(Xe,{size:14,className:"animate-spin"}):s.jsx(ds,{size:14}),s.jsxs("span",{children:['Create "',p.trim(),'"']})]})})})]}),e[21]=_,e[22]=h,e[23]=p,e[24]=w,e[25]=le):le=e[25];let Z;e[26]!==ie||e[27]!==me||e[28]!==ae||e[29]!==le?(Z=s.jsxs(ie,{children:[me,ae,le]}),e[26]=ie,e[27]=me,e[28]=ae,e[29]=le,e[30]=Z):Z=e[30];let X;e[31]!==ne||e[32]!==Y||e[33]!==Z?(X=s.jsxs(ne,{shouldFilter:he,children:[Y,Z]}),e[31]=ne,e[32]=Y,e[33]=Z,e[34]=X):X=e[34];let ee;e[35]!==G||e[36]!==W||e[37]!==X?(ee=s.jsx(G,{className:J,align:H,onEscapeKeyDown:W,children:X}),e[35]=G,e[36]=W,e[37]=X,e[38]=ee):ee=e[38];let te;return e[39]!==F||e[40]!==x||e[41]!==L||e[42]!==ee?(te=s.jsxs(F,{open:x,onOpenChange:j,children:[L,ee]}),e[39]=F,e[40]=x,e[41]=L,e[42]=ee,e[43]=te):te=e[43],te}function Ss(t){return s.jsx(Ge,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5",children:t.name},t.id)}function Ns(t){return t.id}const ws=["owner","admin","user"];function _s(t){const e=new Map;for(const n of ws)e.set(n,Kt(n,!0));for(const n of t)n&&!e.has(n.role)&&e.set(n.role,Vt(n.role));return e}function Ke(t){const e=U.c(79),{role:n,memberId:l,isOwner:i,roleColorMap:a,selectableRoles:o,onRoleChange:r,size:u,className:f}=t,x=u===void 0?"xs":u;let j,p,I,M,b,D,v,$,C,E,N;if(e[0]!==f||e[1]!==i||e[2]!==l||e[3]!==r||e[4]!==n||e[5]!==a||e[6]!==o||e[7]!==x){N=Symbol.for("react.early_return_sentinel");e:{const _=a.get(n)??"bg-neutral-400";if(i){let c;e[19]!==l||e[20]!==r?(c=J=>r(l,J),e[19]=l,e[20]=r,e[21]=c):c=e[21];let h;e[22]!==n?(h=s.jsx("span",{className:"capitalize truncate",children:n}),e[22]=n,e[23]=h):h=e[23];const F=s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("div",{className:ke("size-2 rounded-full shrink-0",_)}),h]});let P;e[24]!==F?(P=s.jsx(dt,{children:F}),e[24]=F,e[25]=P):P=e[25];let q;e[26]!==f||e[27]!==x||e[28]!==P?(q=s.jsx(ut,{size:x,className:f,children:P}),e[26]=f,e[27]=x,e[28]=P,e[29]=q):q=e[29];let V;if(e[30]!==a||e[31]!==o){let J;e[33]!==a?(J=H=>{const W=a.get(H.role)??"bg-neutral-400";return s.jsx(ft,{value:H.role,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:ke("size-3 rounded-full",W)}),s.jsx("span",{className:"capitalize",children:H.label})]})},H.role)},e[33]=a,e[34]=J):J=e[34],V=o.map(J),e[30]=a,e[31]=o,e[32]=V}else V=e[32];let O;e[35]!==V?(O=s.jsx(pt,{children:V}),e[35]=V,e[36]=O):O=e[36];let Q;e[37]!==i||e[38]!==n||e[39]!==c||e[40]!==q||e[41]!==O?(Q=s.jsx(Qt,{asChild:!0,children:s.jsx("div",{className:"w-fit",children:s.jsxs(ht,{value:n,onValueChange:c,disabled:i,children:[q,O]})})}),e[37]=i,e[38]=n,e[39]=c,e[40]=q,e[41]=O,e[42]=Q):Q=e[42];let L;e[43]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx(Gt,{children:s.jsx("p",{children:"The owner role cannot be changed"})}),e[43]=L):L=e[43];let G;e[44]!==Q?(G=s.jsx(Ut,{children:s.jsxs(Jt,{children:[Q,L]})}),e[44]=Q,e[45]=G):G=e[45],N=G;break e}I=ht,$=n,e[46]!==l||e[47]!==r?(C=c=>r(l,c),e[46]=l,e[47]=r,e[48]=C):C=e[48],E=i,p=ut,D=x,v=f,j=dt,b="flex items-center gap-2 min-w-0",M=ke("size-2 rounded-full shrink-0",_)}e[0]=f,e[1]=i,e[2]=l,e[3]=r,e[4]=n,e[5]=a,e[6]=o,e[7]=x,e[8]=j,e[9]=p,e[10]=I,e[11]=M,e[12]=b,e[13]=D,e[14]=v,e[15]=$,e[16]=C,e[17]=E,e[18]=N}else j=e[8],p=e[9],I=e[10],M=e[11],b=e[12],D=e[13],v=e[14],$=e[15],C=e[16],E=e[17],N=e[18];if(N!==Symbol.for("react.early_return_sentinel"))return N;let R;e[49]!==M?(R=s.jsx("div",{className:M}),e[49]=M,e[50]=R):R=e[50];let S;e[51]!==n?(S=s.jsx("span",{className:"capitalize truncate",children:n}),e[51]=n,e[52]=S):S=e[52];let z;e[53]!==R||e[54]!==S||e[55]!==b?(z=s.jsxs("div",{className:b,children:[R,S]}),e[53]=R,e[54]=S,e[55]=b,e[56]=z):z=e[56];let A;e[57]!==j||e[58]!==z?(A=s.jsx(j,{children:z}),e[57]=j,e[58]=z,e[59]=A):A=e[59];let y;e[60]!==p||e[61]!==A||e[62]!==D||e[63]!==v?(y=s.jsx(p,{size:D,className:v,children:A}),e[60]=p,e[61]=A,e[62]=D,e[63]=v,e[64]=y):y=e[64];let K;if(e[65]!==a||e[66]!==o){let _;e[68]!==a?(_=c=>{const h=a.get(c.role)??"bg-neutral-400";return s.jsx(ft,{value:c.role,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:ke("size-3 rounded-full",h)}),s.jsx("span",{className:"capitalize",children:c.label})]})},c.role)},e[68]=a,e[69]=_):_=e[69],K=o.map(_),e[65]=a,e[66]=o,e[67]=K}else K=e[67];let w;e[70]!==K?(w=s.jsx(pt,{children:K}),e[70]=K,e[71]=w):w=e[71];let k;return e[72]!==I||e[73]!==y||e[74]!==w||e[75]!==$||e[76]!==C||e[77]!==E?(k=s.jsxs(I,{value:$,onValueChange:C,disabled:E,children:[y,w]}),e[72]=I,e[73]=y,e[74]=w,e[75]=$,e[76]=C,e[77]=E,e[78]=k):k=e[78],k}function jt(t){const e=U.c(51),{member:n,roles:l,onChangeRole:i,onRemove:a,isUpdating:o}=t,r=o===void 0?!1:o,u=n.role==="owner";let f,x,j,p,I,M,b,D,v;if(e[0]!==u||e[1]!==r||e[2]!==n.id||e[3]!==n.role||e[4]!==i||e[5]!==l){let y;e[15]!==n.role?(y=c=>c.role!==n.role&&c.role!=="owner",e[15]=n.role,e[16]=y):y=e[16];const K=l.filter(y);p=yt;let w;e[17]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(wt,{size:20}),e[17]=w):w=e[17],e[18]!==u?(v=s.jsx(St,{asChild:!0,children:s.jsx(ze,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:u,onClick:Is,children:w})}),e[18]=u,e[19]=v):v=e[19],j=Nt,b="end",D=Ts,x=Ht;let k;e[20]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(ts,{size:16}),e[20]=k):k=e[20],e[21]!==r?(M=s.jsxs(Wt,{disabled:r,children:[k,"Change Role"]}),e[21]=r,e[22]=M):M=e[22],f=Yt;let _;e[23]!==r||e[24]!==n.id||e[25]!==i?(_=c=>{const h=[];return c.isBuiltin||(c.allowsAllStaticPermissions?h.push("Full org access"):c.staticPermissionCount&&c.staticPermissionCount>0&&h.push(`${c.staticPermissionCount} org perm${c.staticPermissionCount!==1?"s":""}`),c.allowsAllConnections?h.push("All connections"):c.connectionCount&&c.connectionCount>0&&h.push(`${c.connectionCount} connection${c.connectionCount!==1?"s":""}`),(c.connectionCount!==0||c.allowsAllConnections)&&(c.allowsAllTools?h.push("all tools"):c.toolCount&&c.toolCount>0&&h.push(`${c.toolCount} tool${c.toolCount!==1?"s":""}`))),s.jsxs(et,{onClick:F=>{F.stopPropagation(),i(n.id,c.role)},disabled:r,children:[c.isBuiltin?s.jsx(es,{size:16}):s.jsx(Xt,{size:16}),s.jsxs("span",{className:"flex flex-col",children:[s.jsx("span",{children:c.label}),!c.isBuiltin&&h.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:h.join(", ")})]})]},c.role)},e[23]=r,e[24]=n.id,e[25]=i,e[26]=_):_=e[26],I=K.map(_),e[0]=u,e[1]=r,e[2]=n.id,e[3]=n.role,e[4]=i,e[5]=l,e[6]=f,e[7]=x,e[8]=j,e[9]=p,e[10]=I,e[11]=M,e[12]=b,e[13]=D,e[14]=v}else f=e[6],x=e[7],j=e[8],p=e[9],I=e[10],M=e[11],b=e[12],D=e[13],v=e[14];let $;e[27]!==f||e[28]!==I?($=s.jsx(f,{children:I}),e[27]=f,e[28]=I,e[29]=$):$=e[29];let C;e[30]!==x||e[31]!==M||e[32]!==$?(C=s.jsxs(x,{children:[M,$]}),e[30]=x,e[31]=M,e[32]=$,e[33]=C):C=e[33];let E;e[34]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx(Zt,{}),e[34]=E):E=e[34];let N;e[35]!==n.id||e[36]!==a?(N=y=>{y.stopPropagation(),a(n.id)},e[35]=n.id,e[36]=a,e[37]=N):N=e[37];let R;e[38]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(ss,{size:16}),e[38]=R):R=e[38];let S;e[39]!==N?(S=s.jsxs(et,{variant:"destructive",onClick:N,children:[R,"Remove Member"]}),e[39]=N,e[40]=S):S=e[40];let z;e[41]!==j||e[42]!==S||e[43]!==b||e[44]!==D||e[45]!==C?(z=s.jsxs(j,{align:b,onClick:D,children:[C,E,S]}),e[41]=j,e[42]=S,e[43]=b,e[44]=D,e[45]=C,e[46]=z):z=e[46];let A;return e[47]!==p||e[48]!==z||e[49]!==v?(A=s.jsxs(p,{children:[v,z]}),e[47]=p,e[48]=z,e[49]=v,e[50]=A):A=e[50],A}function Ts(t){return t.stopPropagation()}function Is(t){return t.stopPropagation()}function bt(t){const e=U.c(8),{invitationId:n,onCancel:l,isCancelling:i}=t,a=i===void 0?!1:i;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(St,{asChild:!0,children:s.jsx(ze,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Ms,children:s.jsx(wt,{size:20})})}),e[0]=o):o=e[0];let r;e[1]!==n||e[2]!==l?(r=x=>{x.stopPropagation(),l(n)},e[1]=n,e[2]=l,e[3]=r):r=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(_t,{size:16}),e[4]=u):u=e[4];let f;return e[5]!==a||e[6]!==r?(f=s.jsxs(yt,{children:[o,s.jsx(Nt,{align:"end",onClick:As,children:s.jsxs(et,{variant:"destructive",onClick:r,disabled:a,children:[u,"Cancel Invitation"]})})]}),e[5]=a,e[6]=r,e[7]=f):f=e[7],f}function As(t){return t.stopPropagation()}function Ms(t){return t.stopPropagation()}function Rs(){const t=U.c(103),{data:e}=Lt(),{data:n}=ps(),l=hs(),i=Qe(),{locator:a}=pe(),o=Ct(),[r,u]=re.useState(null),[f,x]=re.useState(null),[j,p]=re.useState(""),[I,M]=re.useState("table"),[b,D]=re.useState("member"),[v,$]=re.useState("asc"),C=e?.data?.members;let E;t[0]!==b?(E=m=>{b===m?$(Bs):(D(m),$("asc"))},t[0]=b,t[1]=E):E=t[1];const N=E;let R=C??[],S=n??[];if(j){const m=j.toLowerCase();R=R.filter(d=>d.user?.name?.toLowerCase().includes(m)||d.user?.email?.toLowerCase().includes(m)||d.role?.toLowerCase().includes(m)),S=S.filter(d=>d.email?.toLowerCase().includes(m)||d.role?.toLowerCase().includes(m))}if(b&&v){let m;t[2]!==v||t[3]!==b?(m=(d,T)=>{let B,de;e:switch(b){case"member":{B=d.user?.name||"",de=T.user?.name||"";break e}case"role":{B=d.role||"",de=T.role||"";break e}case"joined":{B=d.createdAt?typeof d.createdAt=="string"?d.createdAt:d.createdAt.toISOString():"",de=T.createdAt?typeof T.createdAt=="string"?T.createdAt:T.createdAt.toISOString():"";break e}default:return 0}return v==="asc"?B.localeCompare(de):de.localeCompare(B)},t[2]=v,t[3]=b,t[4]=m):m=t[4],R=[...R].sort(m)}const z=R;let A;t[5]!==o?(A=async m=>{const d=await o.organization.removeMember({memberIdOrEmail:m});if(d?.error)throw new Error(d.error.message)},t[5]=o,t[6]=A):A=t[6];let y;t[7]!==a||t[8]!==i?(y=()=>{Re("member_removed"),i.invalidateQueries({queryKey:ce.members(a)}),oe.success("Member has been removed from the organization"),u(null)},t[7]=a,t[8]=i,t[9]=y):y=t[9];let K;t[10]!==A||t[11]!==y?(K={mutationFn:A,onSuccess:y,onError:Ls},t[10]=A,t[11]=y,t[12]=K):K=t[12];const w=Me(K);let k;t[13]!==o?(k=async m=>{const{memberId:d,role:T}=m,B=await o.organization.updateMemberRole({memberId:d,role:[T]});if(B?.error)throw new Error(B.error.message)},t[13]=o,t[14]=k):k=t[14];let _;t[15]!==a||t[16]!==i?(_=(m,d)=>{Re("member_role_updated",{new_role:d.role}),i.invalidateQueries({queryKey:ce.members(a)}),oe.success("Member's role has been updated")},t[15]=a,t[16]=i,t[17]=_):_=t[17];let c;t[18]!==k||t[19]!==_?(c={mutationFn:k,onSuccess:_,onError:Fs},t[18]=k,t[19]=_,t[20]=c):c=t[20];const h=Me(c);let F;t[21]!==o?(F=async m=>{const{invitationId:d,role:T,email:B}=m,de=await o.organization.cancelInvitation({invitationId:d});if(de?.error)throw new Error(de.error.message);const tt=await o.organization.inviteMember({email:B,role:T});if(tt?.error)throw new Error(tt.error.message)},t[21]=o,t[22]=F):F=t[22];let P;t[23]!==a||t[24]!==i?(P=(m,d)=>{Re("invitation_role_updated",{new_role:d.role}),i.invalidateQueries({queryKey:ce.invitations(a)}),oe.success("Invitation role has been updated")},t[23]=a,t[24]=i,t[25]=P):P=t[25];let q;t[26]!==F||t[27]!==P?(q={mutationFn:F,onSuccess:P,onError:Os},t[26]=F,t[27]=P,t[28]=q):q=t[28];const V=Me(q),{roles:O,customRoles:Q}=Bt();let L;t[29]!==Q?(L=_s(Q),t[29]=Q,t[30]=L):L=t[30];const G=L;let J;t[31]!==O?(J=O.filter(qs),t[31]=O,t[32]=J):J=t[32];const H=J;let W;t[33]===Symbol.for("react.memo_cache_sentinel")?(W={id:"member",header:"Member",render:$s,cellClassName:"flex-1 min-w-0",sortable:!0},t[33]=W):W=t[33];let ne;t[34]!==G||t[35]!==H||t[36]!==V||t[37]!==h?(ne={id:"role",header:"Role",render:m=>m.type==="member"?s.jsx(Ke,{role:m.data.role,memberId:m.data.id,isOwner:m.data.role==="owner",roleColorMap:G,selectableRoles:H,onRoleChange:(d,T)=>h.mutate({memberId:d,role:T}),className:"w-36"}):s.jsx(Ke,{role:m.data.role,memberId:m.data.id,isOwner:!1,roleColorMap:G,selectableRoles:H,onRoleChange:(d,T)=>V.mutate({invitationId:d,role:T,email:m.data.email}),className:"w-36"}),cellClassName:"w-36 shrink-0",sortable:!0},t[34]=G,t[35]=H,t[36]=V,t[37]=h,t[38]=ne):ne=t[38];let he,Y;t[39]===Symbol.for("react.memo_cache_sentinel")?(he={id:"tags",header:"Tags",render:Ds,cellClassName:"w-40 shrink-0"},Y={id:"joined",header:"Joined",render:ks,cellClassName:"w-48 shrink-0",sortable:!0},t[39]=he,t[40]=Y):(he=t[39],Y=t[40]);let ie;t[41]!==l.cancel.isPending||t[42]!==O||t[43]!==h?(ie={id:"actions",header:"",render:m=>m.type==="member"?s.jsx(jt,{member:m.data,roles:O,onChangeRole:(d,T)=>h.mutate({memberId:d,role:T}),onRemove:u,isUpdating:h.isPending}):s.jsx(bt,{invitationId:m.data.id,onCancel:x,isCancelling:l.cancel.isPending}),cellClassName:"w-12 shrink-0"},t[41]=l.cancel.isPending,t[42]=O,t[43]=h,t[44]=ie):ie=t[44];let me;t[45]!==ne||t[46]!==ie?(me=[W,ne,he,Y,ie],t[45]=ne,t[46]=ie,t[47]=me):me=t[47];const Pe=me;let xe;t[48]===Symbol.for("react.memo_cache_sentinel")?(xe=s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(Et,{trigger:s.jsx(ze,{children:"Invite Member"})})}),t[48]=xe):xe=t[48];const Ee=xe,ue=[...z.map(Es),...S.filter(Ps).map(zs)],ae=Ae,le=!!f;let Z;t[49]===Symbol.for("react.memo_cache_sentinel")?(Z=()=>x(null),t[49]=Z):Z=t[49];let X;t[50]===Symbol.for("react.memo_cache_sentinel")?(X=s.jsxs(at,{children:[s.jsx(lt,{children:"Cancel Invitation"}),s.jsx(ot,{children:"Are you sure you want to cancel this invitation? The invitee will no longer be able to join the organization with this invitation."})]}),t[50]=X):X=t[50];let ee;t[51]===Symbol.for("react.memo_cache_sentinel")?(ee=s.jsx(rt,{children:"Keep Invitation"}),t[51]=ee):ee=t[51];let te;t[52]!==l.cancel||t[53]!==f?(te=()=>{f&&(l.cancel.mutate(f),x(null))},t[52]=l.cancel,t[53]=f,t[54]=te):te=t[54];let g;t[55]!==l.cancel.isPending||t[56]!==te?(g=s.jsxs(st,{children:[X,s.jsxs(nt,{children:[ee,s.jsx(it,{onClick:te,disabled:l.cancel.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Cancel Invitation"})]})]}),t[55]=l.cancel.isPending,t[56]=te,t[57]=g):g=t[57];let se;t[58]!==le||t[59]!==g?(se=s.jsx(ct,{open:le,onOpenChange:Z,children:g}),t[58]=le,t[59]=g,t[60]=se):se=t[60];const fe=!!r;let ge;t[61]===Symbol.for("react.memo_cache_sentinel")?(ge=()=>u(null),t[61]=ge):ge=t[61];let qe;t[62]===Symbol.for("react.memo_cache_sentinel")?(qe=s.jsxs(at,{children:[s.jsx(lt,{children:"Remove Member"}),s.jsx(ot,{children:"Are you sure you want to remove this member from the organization? This action cannot be undone."})]}),t[62]=qe):qe=t[62];let Oe;t[63]===Symbol.for("react.memo_cache_sentinel")?(Oe=s.jsx(rt,{children:"Cancel"}),t[63]=Oe):Oe=t[63];let je;t[64]!==r||t[65]!==w?(je=()=>r&&w.mutate(r),t[64]=r,t[65]=w,t[66]=je):je=t[66];let be;t[67]!==w.isPending||t[68]!==je?(be=s.jsxs(st,{children:[qe,s.jsxs(nt,{children:[Oe,s.jsx(it,{onClick:je,disabled:w.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),t[67]=w.isPending,t[68]=je,t[69]=be):be=t[69];let ve;t[70]!==fe||t[71]!==be?(ve=s.jsx(ct,{open:fe,onOpenChange:ge,children:be}),t[70]=fe,t[71]=be,t[72]=ve):ve=t[72];const Ue=Ae,Je=Ae,It="flex flex-col gap-6";let Ce,ye;t[73]===Symbol.for("react.memo_cache_sentinel")?(Ce=s.jsx(fs,{}),ye=s.jsx(Ae.Title,{children:"Members"}),t[73]=Ce,t[74]=ye):(Ce=t[73],ye=t[74]);let Fe;t[75]===Symbol.for("react.memo_cache_sentinel")?(Fe=m=>{m.key==="Escape"&&(p(""),m.target.blur())},t[75]=Fe):Fe=t[75];let Se;t[76]!==j?(Se=s.jsx(zt,{value:j,onChange:p,placeholder:"Search members...",className:"w-full md:w-[375px]",onKeyDown:Fe}),t[76]=j,t[77]=Se):Se=t[77];let Le;t[78]===Symbol.for("react.memo_cache_sentinel")?(Le=[{id:"member",label:"Name"},{id:"role",label:"Role"},{id:"joined",label:"Joined"}],t[78]=Le):Le=t[78];let Ne;t[79]!==N||t[80]!==v||t[81]!==b||t[82]!==I?(Ne=s.jsx(Rt,{viewMode:I,onViewModeChange:M,sortKey:b,sortDirection:v,onSort:N,sortOptions:Le}),t[79]=N,t[80]=v,t[81]=b,t[82]=I,t[83]=Ne):Ne=t[83];let we;t[84]!==Se||t[85]!==Ne?(we=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[Se,Ne]}),Ee]}),t[84]=Se,t[85]=Ne,t[86]=we):we=t[86];const He=I==="cards"?s.jsx("div",{children:ue.length===0?s.jsx(We,{title:"No members found",description:j?`No members match "${j}"`:"Invite members to get started."}):s.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:ue.map(m=>{if(m.type==="invitation")return s.jsxs(mt,{className:"transition-colors relative opacity-75",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(bt,{invitationId:m.data.id,onCancel:x,isCancelling:l.cancel.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(De,{fallback:Ve(m.data.email),shape:"circle",size:"lg",className:"shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:m.data.email}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(Ge,{variant:"outline",className:"w-fit text-warning border-warning/40",children:"Pending"})}),s.jsx(Ke,{role:m.data.role,memberId:m.data.id,isOwner:!1,roleColorMap:G,selectableRoles:H,onRoleChange:(T,B)=>V.mutate({invitationId:T,role:B,email:m.data.email}),className:"w-fit"})]})]})]},`inv-${m.data.id}`);const d=m.data;return s.jsxs(mt,{className:"transition-colors relative",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(jt,{member:d,roles:O,onChangeRole:(T,B)=>h.mutate({memberId:T,role:B}),onRemove:u,isUpdating:h.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(De,{url:d.user?.image??void 0,fallback:Ve(d.user?.name),shape:"circle",size:"lg",className:"shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:d.user?.name||"Unknown"}),s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:d.user?.email}),s.jsx(Ke,{role:d.role,memberId:d.id,isOwner:d.role==="owner",roleColorMap:G,selectableRoles:H,onRoleChange:(T,B)=>h.mutate({memberId:T,role:B}),className:"w-fit"}),s.jsx(Tt,{memberId:d.id,maxDisplay:3})]})]})]},d.id)})})}):s.jsx(Pt,{columns:Pe,data:ue,isLoading:!1,sortKey:b,sortDirection:v,onSort:N,emptyState:j?s.jsx(We,{title:"No members found",description:`No members match "${j}"`}):s.jsx(We,{title:"No members found",description:"Invite members to get started."})});let _e;t[87]!==Ce||t[88]!==ye||t[89]!==we||t[90]!==He?(_e=s.jsxs("div",{className:It,children:[Ce,ye,we,He]}),t[87]=Ce,t[88]=ye,t[89]=we,t[90]=He,t[91]=_e):_e=t[91];let Te;t[92]!==Je.Body||t[93]!==_e?(Te=s.jsx(Je.Body,{children:_e}),t[92]=Je.Body,t[93]=_e,t[94]=Te):Te=t[94];let Ie;t[95]!==Ue.Content||t[96]!==Te?(Ie=s.jsx(Ue.Content,{children:Te}),t[95]=Ue.Content,t[96]=Te,t[97]=Ie):Ie=t[97];let Be;return t[98]!==ae||t[99]!==se||t[100]!==ve||t[101]!==Ie?(Be=s.jsxs(ae,{children:[se,ve,Ie]}),t[98]=ae,t[99]=se,t[100]=ve,t[101]=Ie,t[102]=Be):Be=t[102],Be}function zs(t){return{type:"invitation",data:t}}function Ps(t){return t.status==="pending"}function Es(t){return{type:"member",data:t}}function ks(t){return t.type==="member"?s.jsx("span",{className:"text-sm text-foreground",children:t.data.createdAt?Ft(t.data.createdAt):"N/A"}):s.jsx(Ge,{variant:"outline",children:"Pending"})}function Ds(t){return t.type==="member"?s.jsx(Tt,{memberId:t.data.id,maxDisplay:2}):s.jsx("span",{className:"text-xs text-muted-foreground",children:"-"})}function $s(t){return t.type==="member"?s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(De,{url:t.data.user?.image??void 0,fallback:Ve(t.data.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.data.user?.name||"Unknown"}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:t.data.user?.email})]})]}):s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(De,{fallback:Ve(t.data.email),shape:"circle",size:"sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.data.email}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:"Invitation sent"})]})]})}function qs(t){return t.role!=="owner"}function Os(t,e){Re("invitation_role_update_failed",{new_role:e.role,error:t instanceof Error?t.message:String(t)}),oe.error(t instanceof Error?t.message:"Failed to update invitation role")}function Fs(t,e){Re("member_role_update_failed",{new_role:e.role,error:t instanceof Error?t.message:String(t)}),oe.error(t instanceof Error?t.message:"Failed to update role")}function Ls(t){Re("member_remove_failed",{error:t instanceof Error?t.message:String(t)}),oe.error(t instanceof Error?t.message:"Failed to remove member")}function Bs(t){return t==="asc"?"desc":t==="desc"?null:"asc"}function Ks(){const t=U.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Ae,{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 members"})})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Mt,{fallback:e,children:s.jsx(re.Suspense,{fallback:s.jsx(Ae,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(Xe,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(Rs,{})})}),t[1]=n):n=t[1],n}function Wn(){const t=U.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(us,{capability:"members:manage",area:"members",children:s.jsx(Ks,{})}),t[0]=e):e=t[0],e}export{Wn as default};
1
+ import{c as U,j as s,B as ze,C as pe,v as At,n as Qe,d as Me,K as ce,t as oe,m as vt,r as re,l as ke,i as Xe,E as Mt,p as Re}from"./index-Dm8PN3sF.js";import{C as Rt}from"./collection-display-button-BKx9wavy.js";import{S as zt}from"./search-input-DDPtoz8G.js";import{P as Ae}from"./index-C-emgAXU.js";import{C as Pt}from"./collection-table-wrapper-m26XJ5zy.js";import{E as We}from"./empty-state-CZ_W2Tkk.js";import{I as Et}from"./invite-member-dialog-CgUaSpI7.js";import{b as kt,S as Dt,a as $t}from"./settings-section-D0lLPZJi.js";import{u as qt,a as Ot}from"./use-join-requests-C_f8RBci.js";import{A as De}from"./avatar-OkMq9Zk7.js";import{f as Ft}from"./format-time-BnbuEtat.js";import{g as Ve}from"./get-initials-D-f_fDFw.js";import{u as Lt}from"./use-members-BLpPXsL5.js";import{u as $e}from"./studio-tools-CzCUBnU-.js";import{u as Ct}from"./use-org-auth-client-DPIwgKGR.js";import{u as Bt}from"./use-organization-roles-BfCy8yn0.js";import{g as Kt,a as Vt}from"./role-color-DVw_ATb1.js";import{T as Qt,a as Gt,c as Ut,b as Jt}from"./tooltip-Bk3ktdBG.js";import{a as st,e as nt,g as it,b as at,c as lt,d as ot,A as rt,f as ct}from"./alert-dialog-Bc_r_l2R.js";import{B as Ge}from"./badge-LKHpiZNV.js";import{C as mt}from"./card-CQb0gFPD.js";import{D as yt,a as St,c as Nt,e as Ht,f as Wt,g as Yt,d as et,j as Zt}from"./dropdown-menu-BbwNK63m.js";import{i as wt}from"./DotsVertical-CARUusKJ.js";import{i as Xt}from"./Key01-CO3ih1Yp.js";import{i as es}from"./Shield01-iP7ccMGT.js";import{a as ts}from"./SwitchHorizontal01-DitaMPqn.js";import{s as ss}from"./Trash01-UbH0KmqS.js";import{s as _t}from"./XClose-H0nsoGTm.js";import{b as dt,a as ut,d as ft,c as pt,S as ht}from"./select-klspWFYa.js";import{C as xt}from"./checkbox-aaBpY9LU.js";import{e as Ye,a as Ze,f as gt,C as ns,c as is,d as as,b as ls}from"./command-7qGSdx1i.js";import{a as os,b as rs,P as cs}from"./popover-DeKqmccr.js";import{t as ms}from"./ChevronDown-CoccBu6f.js";import{s as ds}from"./Plus-D7Xzgcq0.js";import{R as us}from"./require-capability-BzSu6vDt.js";import"./ArrowUp-BULPWB7Z.js";import"./Check-DP2mt6rz.js";import"./List-DJTQCjkX.js";import"./view-mode-toggle-sV52jMjK.js";import"./SearchMd-D7SBsVYX.js";import"./sidebar-CWl0stLq.js";import"./LayoutLeft-DFAoke9t.js";import"./use-mobile-BgevOYAE.js";import"./X-Ct6uDLb4.js";import"./table-BjewzTT6.js";import"./dialog-peEhu4Kz.js";import"./form-CRRv-eFx.js";import"./label-Dpmg8kbt.js";import"./textarea-D900hyiY.js";import"./ArrowUpRight-Bfov_iuz.js";import"./use-capability-Bj8-MDeV.js";import"./User01-DA8mg0ER.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./ChevronRight-Dac0PLd_.js";import"./Circle-DiO-c6WF.js";import"./ChevronUp-pTNKSSUr.js";import"./index-Ca82Q4Ek.js";import"./access-gate-C31HEb6y.js";import"./capability-load-error-Si55yJYn.js";function fs(){const t=U.c(9),e=qt(),{approve:n,deny:l}=Ot();if(e.length===0)return null;let i;if(t[0]!==n||t[1]!==l||t[2]!==e){let o;t[4]!==n||t[5]!==l?(o=r=>s.jsx(kt,{icon:s.jsx(De,{url:r.user?.image??void 0,fallback:(r.user?.name??r.user?.email??"?").charAt(0).toUpperCase(),shape:"circle",size:"sm"}),title:r.user?.name??r.user?.email??r.userId,description:r.user?.email,action:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ze,{size:"sm",variant:"outline",onClick:()=>l.mutate(r.id),disabled:l.isPending||n.isPending,children:"Deny"}),s.jsx(ze,{size:"sm",onClick:()=>n.mutate(r.id),disabled:n.isPending||l.isPending,children:"Approve"})]})},r.id),t[4]=n,t[5]=l,t[6]=o):o=t[6],i=e.map(o),t[0]=n,t[1]=l,t[2]=e,t[3]=i}else i=t[3];let a;return t[7]!==i?(a=s.jsx(Dt,{title:"Join requests",description:"People who requested to join via a domain in approval mode.",children:s.jsx($t,{children:i})}),t[7]=i,t[8]=a):a=t[8],a}function ps(){const t=U.c(7),{locator:e}=pe(),n=$e();let l;t[0]!==e?(l=ce.invitations(e),t[0]=e,t[1]=l):l=t[1];let i;t[2]!==n?(i=async()=>(await n.call("ORGANIZATION_GET",{}))?.invitations??[],t[2]=n,t[3]=i):i=t[3];let a;return t[4]!==l||t[5]!==i?(a={queryKey:l,queryFn:i},t[4]=l,t[5]=i,t[6]=a):a=t[6],At(a)}function hs(){const t=U.c(10),{locator:e}=pe(),n=Ct(),l=Qe();let i;t[0]!==n?(i=async f=>{const x=await n.organization.cancelInvitation({invitationId:f});if(x?.error)throw new Error(x.error.message);return x.data},t[0]=n,t[1]=i):i=t[1];let a;t[2]!==e||t[3]!==l?(a=()=>{l.invalidateQueries({queryKey:ce.invitations(e)}),oe.success("Invitation cancelled")},t[2]=e,t[3]=l,t[4]=a):a=t[4];let o;t[5]!==i||t[6]!==a?(o={mutationFn:i,onSuccess:a,onError:xs},t[5]=i,t[6]=a,t[7]=o):o=t[7];const r=Me(o);let u;return t[8]!==r?(u={cancel:r},t[8]=r,t[9]=u):u=t[9],u}function xs(t){oe.error(t instanceof Error?t.message:"Failed to cancel invitation")}function gs(){const t=U.c(7),{locator:e}=pe(),n=$e();let l;t[0]!==e?(l=ce.tags(e),t[0]=e,t[1]=l):l=t[1];let i;t[2]!==n?(i=async()=>{const{tags:o}=await n.call("TAGS_LIST",{});return o},t[2]=n,t[3]=i):i=t[3];let a;return t[4]!==l||t[5]!==i?(a={queryKey:l,queryFn:i,staleTime:3e4},t[4]=l,t[5]=i,t[6]=a):a=t[6],vt(a)}function js(){const t=U.c(8),e=Qe(),{locator:n}=pe(),l=$e();let i;t[0]!==l?(i=async r=>{const{tag:u}=await l.call("TAGS_CREATE",{name:r});return u},t[0]=l,t[1]=i):i=t[1];let a;t[2]!==n||t[3]!==e?(a=()=>{e.invalidateQueries({queryKey:ce.tags(n)})},t[2]=n,t[3]=e,t[4]=a):a=t[4];let o;return t[5]!==i||t[6]!==a?(o={mutationFn:i,onSuccess:a,onError:bs},t[5]=i,t[6]=a,t[7]=o):o=t[7],Me(o)}function bs(t){oe.error(t instanceof Error?t.message:"Failed to create tag")}function vs(t){const e=U.c(10),{locator:n}=pe(),l=$e();let i;e[0]!==n||e[1]!==t?(i=ce.memberTags(n,t),e[0]=n,e[1]=t,e[2]=i):i=e[2];let a;e[3]!==t||e[4]!==l?(a=async()=>{const{tags:u}=await l.call("MEMBER_TAGS_GET",{memberId:t});return u},e[3]=t,e[4]=l,e[5]=a):a=e[5];const o=!!t;let r;return e[6]!==i||e[7]!==a||e[8]!==o?(r={queryKey:i,queryFn:a,staleTime:3e4,enabled:o},e[6]=i,e[7]=a,e[8]=o,e[9]=r):r=e[9],vt(r)}function Cs(){const t=U.c(8),e=Qe(),{locator:n}=pe(),l=$e();let i;t[0]!==l?(i=async r=>{const{memberId:u,tagIds:f}=r;return await l.call("MEMBER_TAGS_SET",{memberId:u,tagIds:f})},t[0]=l,t[1]=i):i=t[1];let a;t[2]!==n||t[3]!==e?(a=(r,u)=>{e.invalidateQueries({queryKey:ce.memberTags(n,u.memberId)})},t[2]=n,t[3]=e,t[4]=a):a=t[4];let o;return t[5]!==i||t[6]!==a?(o={mutationFn:i,onSuccess:a,onError:ys},t[5]=i,t[6]=a,t[7]=o):o=t[7],Me(o)}function ys(t){oe.error(t instanceof Error?t.message:"Failed to update member tags")}function Tt(t){const e=U.c(44),{memberId:n,className:l,disabled:i,placeholder:a,maxDisplay:o}=t,r=i===void 0?!1:i,u=a===void 0?"Add tags...":a,f=o===void 0?2:o,[x,j]=re.useState(!1),[p,I]=re.useState(""),{data:M,isLoading:b}=gs(),D=M===void 0?[]:M,{data:v,isLoading:$}=vs(n),C=v===void 0?[]:v,E=js(),N=Cs(),R=b||$,S=C.map(Ns);let z;e[0]!==p?(z=g=>g.name.toLowerCase().includes(p.toLowerCase()),e[0]=p,e[1]=z):z=e[1];const A=D.filter(z);let y;e[2]!==p?(y=g=>g.name.toLowerCase()===p.toLowerCase(),e[2]=p,e[3]=y):y=e[3];const K=D.find(y),w=p.trim()&&!K,k=async g=>{const fe=S.includes(g.id)?S.filter(ge=>ge!==g.id):[...S,g.id];await N.mutateAsync({memberId:n,tagIds:fe})},_=async()=>{if(!p.trim())return;const g=await E.mutateAsync(p.trim());await N.mutateAsync({memberId:n,tagIds:[...S,g.id]}),I("")},c=async g=>{const se=S.filter(fe=>fe!==g);await N.mutateAsync({memberId:n,tagIds:se})},h=E.isPending||N.isPending,F=rs;let P;e[4]!==x?(P=()=>j(!x),e[4]=x,e[5]=P):P=e[5];let q;e[6]!==l?(q=ke("h-auto min-h-8 px-2 py-1 justify-start font-normal","hover:bg-accent/50",l),e[6]=l,e[7]=q):q=e[7];const V=r||R,O=R?s.jsx(Xe,{size:14,className:"animate-spin text-muted-foreground"}):C.length>0?s.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[C.slice(0,f).map(Ss),C.length>f&&s.jsxs(Ge,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5",children:["+",C.length-f]})]}):s.jsx("span",{className:"text-muted-foreground text-xs",children:u});let Q;e[8]===Symbol.for("react.memo_cache_sentinel")?(Q=s.jsx(ms,{size:14,className:"ml-1 shrink-0 opacity-50"}),e[8]=Q):Q=e[8];let L;e[9]!==V||e[10]!==O||e[11]!==P||e[12]!==q?(L=s.jsx(cs,{asChild:!0,children:s.jsxs(ze,{variant:"ghost",size:"sm",onClick:P,className:q,disabled:V,children:[O,Q]})}),e[9]=V,e[10]=O,e[11]=P,e[12]=q,e[13]=L):L=e[13];const G=os,J="w-56 p-0",H="start";let W;e[14]===Symbol.for("react.memo_cache_sentinel")?(W=()=>j(!1),e[14]=W):W=e[14];const ne=as,he=!1;let Y;e[15]!==p?(Y=s.jsx(ls,{placeholder:"Search or create...",value:p,onValueChange:I,className:"h-9"}),e[15]=p,e[16]=Y):Y=e[16];const ie=is,me=C.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(Ye,{heading:"Selected",children:C.map(g=>s.jsx(Ze,{onSelect:()=>k(g),className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center justify-between w-full",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(xt,{checked:!0,className:"[&_svg]:!text-primary-foreground"}),s.jsx("span",{children:g.name})]}),s.jsx("button",{onClick:se=>{se.stopPropagation(),c(g.id)},className:"opacity-50 hover:opacity-100",disabled:h,children:s.jsx(_t,{size:14})})]})},g.id))}),s.jsx(gt,{})]}),Pe=Ye,xe="Available",Ee=A.length===0&&!w&&s.jsx(ns,{children:"No tags found."}),ue=A.filter(g=>!S.includes(g.id)).map(g=>s.jsx(Ze,{onSelect:()=>k(g),className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(xt,{checked:!1,className:"[&_svg]:!text-primary-foreground"}),s.jsx("span",{children:g.name})]})},g.id));let ae;e[17]!==Pe||e[18]!==Ee||e[19]!==ue?(ae=s.jsxs(Pe,{heading:xe,children:[Ee,ue]}),e[17]=Pe,e[18]=Ee,e[19]=ue,e[20]=ae):ae=e[20];let le;e[21]!==_||e[22]!==h||e[23]!==p||e[24]!==w?(le=w&&s.jsxs(s.Fragment,{children:[s.jsx(gt,{}),s.jsx(Ye,{children:s.jsx(Ze,{onSelect:_,className:"cursor-pointer",disabled:h,children:s.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[h?s.jsx(Xe,{size:14,className:"animate-spin"}):s.jsx(ds,{size:14}),s.jsxs("span",{children:['Create "',p.trim(),'"']})]})})})]}),e[21]=_,e[22]=h,e[23]=p,e[24]=w,e[25]=le):le=e[25];let Z;e[26]!==ie||e[27]!==me||e[28]!==ae||e[29]!==le?(Z=s.jsxs(ie,{children:[me,ae,le]}),e[26]=ie,e[27]=me,e[28]=ae,e[29]=le,e[30]=Z):Z=e[30];let X;e[31]!==ne||e[32]!==Y||e[33]!==Z?(X=s.jsxs(ne,{shouldFilter:he,children:[Y,Z]}),e[31]=ne,e[32]=Y,e[33]=Z,e[34]=X):X=e[34];let ee;e[35]!==G||e[36]!==W||e[37]!==X?(ee=s.jsx(G,{className:J,align:H,onEscapeKeyDown:W,children:X}),e[35]=G,e[36]=W,e[37]=X,e[38]=ee):ee=e[38];let te;return e[39]!==F||e[40]!==x||e[41]!==L||e[42]!==ee?(te=s.jsxs(F,{open:x,onOpenChange:j,children:[L,ee]}),e[39]=F,e[40]=x,e[41]=L,e[42]=ee,e[43]=te):te=e[43],te}function Ss(t){return s.jsx(Ge,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5",children:t.name},t.id)}function Ns(t){return t.id}const ws=["owner","admin","user"];function _s(t){const e=new Map;for(const n of ws)e.set(n,Kt(n,!0));for(const n of t)n&&!e.has(n.role)&&e.set(n.role,Vt(n.role));return e}function Ke(t){const e=U.c(79),{role:n,memberId:l,isOwner:i,roleColorMap:a,selectableRoles:o,onRoleChange:r,size:u,className:f}=t,x=u===void 0?"xs":u;let j,p,I,M,b,D,v,$,C,E,N;if(e[0]!==f||e[1]!==i||e[2]!==l||e[3]!==r||e[4]!==n||e[5]!==a||e[6]!==o||e[7]!==x){N=Symbol.for("react.early_return_sentinel");e:{const _=a.get(n)??"bg-neutral-400";if(i){let c;e[19]!==l||e[20]!==r?(c=J=>r(l,J),e[19]=l,e[20]=r,e[21]=c):c=e[21];let h;e[22]!==n?(h=s.jsx("span",{className:"capitalize truncate",children:n}),e[22]=n,e[23]=h):h=e[23];const F=s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("div",{className:ke("size-2 rounded-full shrink-0",_)}),h]});let P;e[24]!==F?(P=s.jsx(dt,{children:F}),e[24]=F,e[25]=P):P=e[25];let q;e[26]!==f||e[27]!==x||e[28]!==P?(q=s.jsx(ut,{size:x,className:f,children:P}),e[26]=f,e[27]=x,e[28]=P,e[29]=q):q=e[29];let V;if(e[30]!==a||e[31]!==o){let J;e[33]!==a?(J=H=>{const W=a.get(H.role)??"bg-neutral-400";return s.jsx(ft,{value:H.role,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:ke("size-3 rounded-full",W)}),s.jsx("span",{className:"capitalize",children:H.label})]})},H.role)},e[33]=a,e[34]=J):J=e[34],V=o.map(J),e[30]=a,e[31]=o,e[32]=V}else V=e[32];let O;e[35]!==V?(O=s.jsx(pt,{children:V}),e[35]=V,e[36]=O):O=e[36];let Q;e[37]!==i||e[38]!==n||e[39]!==c||e[40]!==q||e[41]!==O?(Q=s.jsx(Qt,{asChild:!0,children:s.jsx("div",{className:"w-fit",children:s.jsxs(ht,{value:n,onValueChange:c,disabled:i,children:[q,O]})})}),e[37]=i,e[38]=n,e[39]=c,e[40]=q,e[41]=O,e[42]=Q):Q=e[42];let L;e[43]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx(Gt,{children:s.jsx("p",{children:"The owner role cannot be changed"})}),e[43]=L):L=e[43];let G;e[44]!==Q?(G=s.jsx(Ut,{children:s.jsxs(Jt,{children:[Q,L]})}),e[44]=Q,e[45]=G):G=e[45],N=G;break e}I=ht,$=n,e[46]!==l||e[47]!==r?(C=c=>r(l,c),e[46]=l,e[47]=r,e[48]=C):C=e[48],E=i,p=ut,D=x,v=f,j=dt,b="flex items-center gap-2 min-w-0",M=ke("size-2 rounded-full shrink-0",_)}e[0]=f,e[1]=i,e[2]=l,e[3]=r,e[4]=n,e[5]=a,e[6]=o,e[7]=x,e[8]=j,e[9]=p,e[10]=I,e[11]=M,e[12]=b,e[13]=D,e[14]=v,e[15]=$,e[16]=C,e[17]=E,e[18]=N}else j=e[8],p=e[9],I=e[10],M=e[11],b=e[12],D=e[13],v=e[14],$=e[15],C=e[16],E=e[17],N=e[18];if(N!==Symbol.for("react.early_return_sentinel"))return N;let R;e[49]!==M?(R=s.jsx("div",{className:M}),e[49]=M,e[50]=R):R=e[50];let S;e[51]!==n?(S=s.jsx("span",{className:"capitalize truncate",children:n}),e[51]=n,e[52]=S):S=e[52];let z;e[53]!==R||e[54]!==S||e[55]!==b?(z=s.jsxs("div",{className:b,children:[R,S]}),e[53]=R,e[54]=S,e[55]=b,e[56]=z):z=e[56];let A;e[57]!==j||e[58]!==z?(A=s.jsx(j,{children:z}),e[57]=j,e[58]=z,e[59]=A):A=e[59];let y;e[60]!==p||e[61]!==A||e[62]!==D||e[63]!==v?(y=s.jsx(p,{size:D,className:v,children:A}),e[60]=p,e[61]=A,e[62]=D,e[63]=v,e[64]=y):y=e[64];let K;if(e[65]!==a||e[66]!==o){let _;e[68]!==a?(_=c=>{const h=a.get(c.role)??"bg-neutral-400";return s.jsx(ft,{value:c.role,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:ke("size-3 rounded-full",h)}),s.jsx("span",{className:"capitalize",children:c.label})]})},c.role)},e[68]=a,e[69]=_):_=e[69],K=o.map(_),e[65]=a,e[66]=o,e[67]=K}else K=e[67];let w;e[70]!==K?(w=s.jsx(pt,{children:K}),e[70]=K,e[71]=w):w=e[71];let k;return e[72]!==I||e[73]!==y||e[74]!==w||e[75]!==$||e[76]!==C||e[77]!==E?(k=s.jsxs(I,{value:$,onValueChange:C,disabled:E,children:[y,w]}),e[72]=I,e[73]=y,e[74]=w,e[75]=$,e[76]=C,e[77]=E,e[78]=k):k=e[78],k}function jt(t){const e=U.c(51),{member:n,roles:l,onChangeRole:i,onRemove:a,isUpdating:o}=t,r=o===void 0?!1:o,u=n.role==="owner";let f,x,j,p,I,M,b,D,v;if(e[0]!==u||e[1]!==r||e[2]!==n.id||e[3]!==n.role||e[4]!==i||e[5]!==l){let y;e[15]!==n.role?(y=c=>c.role!==n.role&&c.role!=="owner",e[15]=n.role,e[16]=y):y=e[16];const K=l.filter(y);p=yt;let w;e[17]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(wt,{size:20}),e[17]=w):w=e[17],e[18]!==u?(v=s.jsx(St,{asChild:!0,children:s.jsx(ze,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:u,onClick:Is,children:w})}),e[18]=u,e[19]=v):v=e[19],j=Nt,b="end",D=Ts,x=Ht;let k;e[20]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(ts,{size:16}),e[20]=k):k=e[20],e[21]!==r?(M=s.jsxs(Wt,{disabled:r,children:[k,"Change Role"]}),e[21]=r,e[22]=M):M=e[22],f=Yt;let _;e[23]!==r||e[24]!==n.id||e[25]!==i?(_=c=>{const h=[];return c.isBuiltin||(c.allowsAllStaticPermissions?h.push("Full org access"):c.staticPermissionCount&&c.staticPermissionCount>0&&h.push(`${c.staticPermissionCount} org perm${c.staticPermissionCount!==1?"s":""}`),c.allowsAllConnections?h.push("All connections"):c.connectionCount&&c.connectionCount>0&&h.push(`${c.connectionCount} connection${c.connectionCount!==1?"s":""}`),(c.connectionCount!==0||c.allowsAllConnections)&&(c.allowsAllTools?h.push("all tools"):c.toolCount&&c.toolCount>0&&h.push(`${c.toolCount} tool${c.toolCount!==1?"s":""}`))),s.jsxs(et,{onClick:F=>{F.stopPropagation(),i(n.id,c.role)},disabled:r,children:[c.isBuiltin?s.jsx(es,{size:16}):s.jsx(Xt,{size:16}),s.jsxs("span",{className:"flex flex-col",children:[s.jsx("span",{children:c.label}),!c.isBuiltin&&h.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:h.join(", ")})]})]},c.role)},e[23]=r,e[24]=n.id,e[25]=i,e[26]=_):_=e[26],I=K.map(_),e[0]=u,e[1]=r,e[2]=n.id,e[3]=n.role,e[4]=i,e[5]=l,e[6]=f,e[7]=x,e[8]=j,e[9]=p,e[10]=I,e[11]=M,e[12]=b,e[13]=D,e[14]=v}else f=e[6],x=e[7],j=e[8],p=e[9],I=e[10],M=e[11],b=e[12],D=e[13],v=e[14];let $;e[27]!==f||e[28]!==I?($=s.jsx(f,{children:I}),e[27]=f,e[28]=I,e[29]=$):$=e[29];let C;e[30]!==x||e[31]!==M||e[32]!==$?(C=s.jsxs(x,{children:[M,$]}),e[30]=x,e[31]=M,e[32]=$,e[33]=C):C=e[33];let E;e[34]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx(Zt,{}),e[34]=E):E=e[34];let N;e[35]!==n.id||e[36]!==a?(N=y=>{y.stopPropagation(),a(n.id)},e[35]=n.id,e[36]=a,e[37]=N):N=e[37];let R;e[38]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(ss,{size:16}),e[38]=R):R=e[38];let S;e[39]!==N?(S=s.jsxs(et,{variant:"destructive",onClick:N,children:[R,"Remove Member"]}),e[39]=N,e[40]=S):S=e[40];let z;e[41]!==j||e[42]!==S||e[43]!==b||e[44]!==D||e[45]!==C?(z=s.jsxs(j,{align:b,onClick:D,children:[C,E,S]}),e[41]=j,e[42]=S,e[43]=b,e[44]=D,e[45]=C,e[46]=z):z=e[46];let A;return e[47]!==p||e[48]!==z||e[49]!==v?(A=s.jsxs(p,{children:[v,z]}),e[47]=p,e[48]=z,e[49]=v,e[50]=A):A=e[50],A}function Ts(t){return t.stopPropagation()}function Is(t){return t.stopPropagation()}function bt(t){const e=U.c(8),{invitationId:n,onCancel:l,isCancelling:i}=t,a=i===void 0?!1:i;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(St,{asChild:!0,children:s.jsx(ze,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Ms,children:s.jsx(wt,{size:20})})}),e[0]=o):o=e[0];let r;e[1]!==n||e[2]!==l?(r=x=>{x.stopPropagation(),l(n)},e[1]=n,e[2]=l,e[3]=r):r=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(_t,{size:16}),e[4]=u):u=e[4];let f;return e[5]!==a||e[6]!==r?(f=s.jsxs(yt,{children:[o,s.jsx(Nt,{align:"end",onClick:As,children:s.jsxs(et,{variant:"destructive",onClick:r,disabled:a,children:[u,"Cancel Invitation"]})})]}),e[5]=a,e[6]=r,e[7]=f):f=e[7],f}function As(t){return t.stopPropagation()}function Ms(t){return t.stopPropagation()}function Rs(){const t=U.c(103),{data:e}=Lt(),{data:n}=ps(),l=hs(),i=Qe(),{locator:a}=pe(),o=Ct(),[r,u]=re.useState(null),[f,x]=re.useState(null),[j,p]=re.useState(""),[I,M]=re.useState("table"),[b,D]=re.useState("member"),[v,$]=re.useState("asc"),C=e?.data?.members;let E;t[0]!==b?(E=m=>{b===m?$(Bs):(D(m),$("asc"))},t[0]=b,t[1]=E):E=t[1];const N=E;let R=C??[],S=n??[];if(j){const m=j.toLowerCase();R=R.filter(d=>d.user?.name?.toLowerCase().includes(m)||d.user?.email?.toLowerCase().includes(m)||d.role?.toLowerCase().includes(m)),S=S.filter(d=>d.email?.toLowerCase().includes(m)||d.role?.toLowerCase().includes(m))}if(b&&v){let m;t[2]!==v||t[3]!==b?(m=(d,T)=>{let B,de;e:switch(b){case"member":{B=d.user?.name||"",de=T.user?.name||"";break e}case"role":{B=d.role||"",de=T.role||"";break e}case"joined":{B=d.createdAt?typeof d.createdAt=="string"?d.createdAt:d.createdAt.toISOString():"",de=T.createdAt?typeof T.createdAt=="string"?T.createdAt:T.createdAt.toISOString():"";break e}default:return 0}return v==="asc"?B.localeCompare(de):de.localeCompare(B)},t[2]=v,t[3]=b,t[4]=m):m=t[4],R=[...R].sort(m)}const z=R;let A;t[5]!==o?(A=async m=>{const d=await o.organization.removeMember({memberIdOrEmail:m});if(d?.error)throw new Error(d.error.message)},t[5]=o,t[6]=A):A=t[6];let y;t[7]!==a||t[8]!==i?(y=()=>{Re("member_removed"),i.invalidateQueries({queryKey:ce.members(a)}),oe.success("Member has been removed from the organization"),u(null)},t[7]=a,t[8]=i,t[9]=y):y=t[9];let K;t[10]!==A||t[11]!==y?(K={mutationFn:A,onSuccess:y,onError:Ls},t[10]=A,t[11]=y,t[12]=K):K=t[12];const w=Me(K);let k;t[13]!==o?(k=async m=>{const{memberId:d,role:T}=m,B=await o.organization.updateMemberRole({memberId:d,role:[T]});if(B?.error)throw new Error(B.error.message)},t[13]=o,t[14]=k):k=t[14];let _;t[15]!==a||t[16]!==i?(_=(m,d)=>{Re("member_role_updated",{new_role:d.role}),i.invalidateQueries({queryKey:ce.members(a)}),oe.success("Member's role has been updated")},t[15]=a,t[16]=i,t[17]=_):_=t[17];let c;t[18]!==k||t[19]!==_?(c={mutationFn:k,onSuccess:_,onError:Fs},t[18]=k,t[19]=_,t[20]=c):c=t[20];const h=Me(c);let F;t[21]!==o?(F=async m=>{const{invitationId:d,role:T,email:B}=m,de=await o.organization.cancelInvitation({invitationId:d});if(de?.error)throw new Error(de.error.message);const tt=await o.organization.inviteMember({email:B,role:T});if(tt?.error)throw new Error(tt.error.message)},t[21]=o,t[22]=F):F=t[22];let P;t[23]!==a||t[24]!==i?(P=(m,d)=>{Re("invitation_role_updated",{new_role:d.role}),i.invalidateQueries({queryKey:ce.invitations(a)}),oe.success("Invitation role has been updated")},t[23]=a,t[24]=i,t[25]=P):P=t[25];let q;t[26]!==F||t[27]!==P?(q={mutationFn:F,onSuccess:P,onError:Os},t[26]=F,t[27]=P,t[28]=q):q=t[28];const V=Me(q),{roles:O,customRoles:Q}=Bt();let L;t[29]!==Q?(L=_s(Q),t[29]=Q,t[30]=L):L=t[30];const G=L;let J;t[31]!==O?(J=O.filter(qs),t[31]=O,t[32]=J):J=t[32];const H=J;let W;t[33]===Symbol.for("react.memo_cache_sentinel")?(W={id:"member",header:"Member",render:$s,cellClassName:"flex-1 min-w-0",sortable:!0},t[33]=W):W=t[33];let ne;t[34]!==G||t[35]!==H||t[36]!==V||t[37]!==h?(ne={id:"role",header:"Role",render:m=>m.type==="member"?s.jsx(Ke,{role:m.data.role,memberId:m.data.id,isOwner:m.data.role==="owner",roleColorMap:G,selectableRoles:H,onRoleChange:(d,T)=>h.mutate({memberId:d,role:T}),className:"w-36"}):s.jsx(Ke,{role:m.data.role,memberId:m.data.id,isOwner:!1,roleColorMap:G,selectableRoles:H,onRoleChange:(d,T)=>V.mutate({invitationId:d,role:T,email:m.data.email}),className:"w-36"}),cellClassName:"w-36 shrink-0",sortable:!0},t[34]=G,t[35]=H,t[36]=V,t[37]=h,t[38]=ne):ne=t[38];let he,Y;t[39]===Symbol.for("react.memo_cache_sentinel")?(he={id:"tags",header:"Tags",render:Ds,cellClassName:"w-40 shrink-0"},Y={id:"joined",header:"Joined",render:ks,cellClassName:"w-48 shrink-0",sortable:!0},t[39]=he,t[40]=Y):(he=t[39],Y=t[40]);let ie;t[41]!==l.cancel.isPending||t[42]!==O||t[43]!==h?(ie={id:"actions",header:"",render:m=>m.type==="member"?s.jsx(jt,{member:m.data,roles:O,onChangeRole:(d,T)=>h.mutate({memberId:d,role:T}),onRemove:u,isUpdating:h.isPending}):s.jsx(bt,{invitationId:m.data.id,onCancel:x,isCancelling:l.cancel.isPending}),cellClassName:"w-12 shrink-0"},t[41]=l.cancel.isPending,t[42]=O,t[43]=h,t[44]=ie):ie=t[44];let me;t[45]!==ne||t[46]!==ie?(me=[W,ne,he,Y,ie],t[45]=ne,t[46]=ie,t[47]=me):me=t[47];const Pe=me;let xe;t[48]===Symbol.for("react.memo_cache_sentinel")?(xe=s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(Et,{trigger:s.jsx(ze,{children:"Invite Member"})})}),t[48]=xe):xe=t[48];const Ee=xe,ue=[...z.map(Es),...S.filter(Ps).map(zs)],ae=Ae,le=!!f;let Z;t[49]===Symbol.for("react.memo_cache_sentinel")?(Z=()=>x(null),t[49]=Z):Z=t[49];let X;t[50]===Symbol.for("react.memo_cache_sentinel")?(X=s.jsxs(at,{children:[s.jsx(lt,{children:"Cancel Invitation"}),s.jsx(ot,{children:"Are you sure you want to cancel this invitation? The invitee will no longer be able to join the organization with this invitation."})]}),t[50]=X):X=t[50];let ee;t[51]===Symbol.for("react.memo_cache_sentinel")?(ee=s.jsx(rt,{children:"Keep Invitation"}),t[51]=ee):ee=t[51];let te;t[52]!==l.cancel||t[53]!==f?(te=()=>{f&&(l.cancel.mutate(f),x(null))},t[52]=l.cancel,t[53]=f,t[54]=te):te=t[54];let g;t[55]!==l.cancel.isPending||t[56]!==te?(g=s.jsxs(st,{children:[X,s.jsxs(nt,{children:[ee,s.jsx(it,{onClick:te,disabled:l.cancel.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Cancel Invitation"})]})]}),t[55]=l.cancel.isPending,t[56]=te,t[57]=g):g=t[57];let se;t[58]!==le||t[59]!==g?(se=s.jsx(ct,{open:le,onOpenChange:Z,children:g}),t[58]=le,t[59]=g,t[60]=se):se=t[60];const fe=!!r;let ge;t[61]===Symbol.for("react.memo_cache_sentinel")?(ge=()=>u(null),t[61]=ge):ge=t[61];let qe;t[62]===Symbol.for("react.memo_cache_sentinel")?(qe=s.jsxs(at,{children:[s.jsx(lt,{children:"Remove Member"}),s.jsx(ot,{children:"Are you sure you want to remove this member from the organization? This action cannot be undone."})]}),t[62]=qe):qe=t[62];let Oe;t[63]===Symbol.for("react.memo_cache_sentinel")?(Oe=s.jsx(rt,{children:"Cancel"}),t[63]=Oe):Oe=t[63];let je;t[64]!==r||t[65]!==w?(je=()=>r&&w.mutate(r),t[64]=r,t[65]=w,t[66]=je):je=t[66];let be;t[67]!==w.isPending||t[68]!==je?(be=s.jsxs(st,{children:[qe,s.jsxs(nt,{children:[Oe,s.jsx(it,{onClick:je,disabled:w.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),t[67]=w.isPending,t[68]=je,t[69]=be):be=t[69];let ve;t[70]!==fe||t[71]!==be?(ve=s.jsx(ct,{open:fe,onOpenChange:ge,children:be}),t[70]=fe,t[71]=be,t[72]=ve):ve=t[72];const Ue=Ae,Je=Ae,It="flex flex-col gap-6";let Ce,ye;t[73]===Symbol.for("react.memo_cache_sentinel")?(Ce=s.jsx(fs,{}),ye=s.jsx(Ae.Title,{children:"Members"}),t[73]=Ce,t[74]=ye):(Ce=t[73],ye=t[74]);let Fe;t[75]===Symbol.for("react.memo_cache_sentinel")?(Fe=m=>{m.key==="Escape"&&(p(""),m.target.blur())},t[75]=Fe):Fe=t[75];let Se;t[76]!==j?(Se=s.jsx(zt,{value:j,onChange:p,placeholder:"Search members...",className:"w-full md:w-[375px]",onKeyDown:Fe}),t[76]=j,t[77]=Se):Se=t[77];let Le;t[78]===Symbol.for("react.memo_cache_sentinel")?(Le=[{id:"member",label:"Name"},{id:"role",label:"Role"},{id:"joined",label:"Joined"}],t[78]=Le):Le=t[78];let Ne;t[79]!==N||t[80]!==v||t[81]!==b||t[82]!==I?(Ne=s.jsx(Rt,{viewMode:I,onViewModeChange:M,sortKey:b,sortDirection:v,onSort:N,sortOptions:Le}),t[79]=N,t[80]=v,t[81]=b,t[82]=I,t[83]=Ne):Ne=t[83];let we;t[84]!==Se||t[85]!==Ne?(we=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[Se,Ne]}),Ee]}),t[84]=Se,t[85]=Ne,t[86]=we):we=t[86];const He=I==="cards"?s.jsx("div",{children:ue.length===0?s.jsx(We,{title:"No members found",description:j?`No members match "${j}"`:"Invite members to get started."}):s.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:ue.map(m=>{if(m.type==="invitation")return s.jsxs(mt,{className:"transition-colors relative opacity-75",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(bt,{invitationId:m.data.id,onCancel:x,isCancelling:l.cancel.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(De,{fallback:Ve(m.data.email),shape:"circle",size:"lg",className:"shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:m.data.email}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(Ge,{variant:"outline",className:"w-fit text-warning border-warning/40",children:"Pending"})}),s.jsx(Ke,{role:m.data.role,memberId:m.data.id,isOwner:!1,roleColorMap:G,selectableRoles:H,onRoleChange:(T,B)=>V.mutate({invitationId:T,role:B,email:m.data.email}),className:"w-fit"})]})]})]},`inv-${m.data.id}`);const d=m.data;return s.jsxs(mt,{className:"transition-colors relative",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(jt,{member:d,roles:O,onChangeRole:(T,B)=>h.mutate({memberId:T,role:B}),onRemove:u,isUpdating:h.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(De,{url:d.user?.image??void 0,fallback:Ve(d.user?.name),shape:"circle",size:"lg",className:"shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:d.user?.name||"Unknown"}),s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:d.user?.email}),s.jsx(Ke,{role:d.role,memberId:d.id,isOwner:d.role==="owner",roleColorMap:G,selectableRoles:H,onRoleChange:(T,B)=>h.mutate({memberId:T,role:B}),className:"w-fit"}),s.jsx(Tt,{memberId:d.id,maxDisplay:3})]})]})]},d.id)})})}):s.jsx(Pt,{columns:Pe,data:ue,isLoading:!1,sortKey:b,sortDirection:v,onSort:N,emptyState:j?s.jsx(We,{title:"No members found",description:`No members match "${j}"`}):s.jsx(We,{title:"No members found",description:"Invite members to get started."})});let _e;t[87]!==Ce||t[88]!==ye||t[89]!==we||t[90]!==He?(_e=s.jsxs("div",{className:It,children:[Ce,ye,we,He]}),t[87]=Ce,t[88]=ye,t[89]=we,t[90]=He,t[91]=_e):_e=t[91];let Te;t[92]!==Je.Body||t[93]!==_e?(Te=s.jsx(Je.Body,{children:_e}),t[92]=Je.Body,t[93]=_e,t[94]=Te):Te=t[94];let Ie;t[95]!==Ue.Content||t[96]!==Te?(Ie=s.jsx(Ue.Content,{children:Te}),t[95]=Ue.Content,t[96]=Te,t[97]=Ie):Ie=t[97];let Be;return t[98]!==ae||t[99]!==se||t[100]!==ve||t[101]!==Ie?(Be=s.jsxs(ae,{children:[se,ve,Ie]}),t[98]=ae,t[99]=se,t[100]=ve,t[101]=Ie,t[102]=Be):Be=t[102],Be}function zs(t){return{type:"invitation",data:t}}function Ps(t){return t.status==="pending"}function Es(t){return{type:"member",data:t}}function ks(t){return t.type==="member"?s.jsx("span",{className:"text-sm text-foreground",children:t.data.createdAt?Ft(t.data.createdAt):"N/A"}):s.jsx(Ge,{variant:"outline",children:"Pending"})}function Ds(t){return t.type==="member"?s.jsx(Tt,{memberId:t.data.id,maxDisplay:2}):s.jsx("span",{className:"text-xs text-muted-foreground",children:"-"})}function $s(t){return t.type==="member"?s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(De,{url:t.data.user?.image??void 0,fallback:Ve(t.data.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.data.user?.name||"Unknown"}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:t.data.user?.email})]})]}):s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(De,{fallback:Ve(t.data.email),shape:"circle",size:"sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.data.email}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:"Invitation sent"})]})]})}function qs(t){return t.role!=="owner"}function Os(t,e){Re("invitation_role_update_failed",{new_role:e.role,error:t instanceof Error?t.message:String(t)}),oe.error(t instanceof Error?t.message:"Failed to update invitation role")}function Fs(t,e){Re("member_role_update_failed",{new_role:e.role,error:t instanceof Error?t.message:String(t)}),oe.error(t instanceof Error?t.message:"Failed to update role")}function Ls(t){Re("member_remove_failed",{error:t instanceof Error?t.message:String(t)}),oe.error(t instanceof Error?t.message:"Failed to remove member")}function Bs(t){return t==="asc"?"desc":t==="desc"?null:"asc"}function Ks(){const t=U.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Ae,{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 members"})})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Mt,{fallback:e,children:s.jsx(re.Suspense,{fallback:s.jsx(Ae,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(Xe,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(Rs,{})})}),t[1]=n):n=t[1],n}function Wn(){const t=U.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(us,{capability:"members:manage",area:"members",children:s.jsx(Ks,{})}),t[0]=e):e=t[0],e}export{Wn as default};
@@ -1,4 +1,4 @@
1
- import{c as D,j as p,r as d,aX as O}from"./index-DGQdC8j6.js";import{l as I,F as L}from"./index-vt02LGOF.js";import{S as N}from"./chat-context-CZYpc7lP.js";import{d as K}from"./delay-CnY5UFtP.js";function C(t){return Math.ceil(t.length*3/4)}function Y(t){const e=[];for(const r of t)switch(r.type){case"text":r.text?.trim()&&e.push({type:"paragraph",content:[{type:"text",text:r.text}]});break;case"image":case"audio":r.data&&r.mimeType&&e.push({type:"paragraph",content:[{type:"file",attrs:{id:crypto.randomUUID(),name:`${r.type}.${r.mimeType.split("/")[1]??"bin"}`,mimeType:r.mimeType,size:C(r.data),data:r.data}}]});break;case"resource":{const n=r.resource;"text"in n&&n.text?e.push({type:"paragraph",content:[{type:"text",text:n.text}]}):"blob"in n&&n.blob&&e.push({type:"paragraph",content:[{type:"file",attrs:{id:crypto.randomUUID(),name:String(n.uri),mimeType:n.mimeType??"application/octet-stream",size:C(n.blob),data:n.blob}}]});break}case"resource_link":e.push({type:"paragraph",content:[{type:"text",text:r.name??r.uri}]});break}return{type:"doc",content:e}}async function z(t){const e=t.getModel();if(!e)throw new Error("[Monaco] No model found in editor");const r=e.getValue(),i=r.replace(/export default (async )?function/,"export default $1function __default")+`
1
+ import{c as D,j as p,r as d,aX as O}from"./index-Dm8PN3sF.js";import{l as I,F as L}from"./index-CKwYI32T.js";import{S as N}from"./chat-context-BlFYYcaC.js";import{d as K}from"./delay-CnY5UFtP.js";function C(t){return Math.ceil(t.length*3/4)}function Y(t){const e=[];for(const r of t)switch(r.type){case"text":r.text?.trim()&&e.push({type:"paragraph",content:[{type:"text",text:r.text}]});break;case"image":case"audio":r.data&&r.mimeType&&e.push({type:"paragraph",content:[{type:"file",attrs:{id:crypto.randomUUID(),name:`${r.type}.${r.mimeType.split("/")[1]??"bin"}`,mimeType:r.mimeType,size:C(r.data),data:r.data}}]});break;case"resource":{const n=r.resource;"text"in n&&n.text?e.push({type:"paragraph",content:[{type:"text",text:n.text}]}):"blob"in n&&n.blob&&e.push({type:"paragraph",content:[{type:"file",attrs:{id:crypto.randomUUID(),name:String(n.uri),mimeType:n.mimeType??"application/octet-stream",size:C(n.blob),data:n.blob}}]});break}case"resource_link":e.push({type:"paragraph",content:[{type:"text",text:r.name??r.uri}]});break}return{type:"doc",content:e}}async function z(t){const e=t.getModel();if(!e)throw new Error("[Monaco] No model found in editor");const r=e.getValue(),i=r.replace(/export default (async )?function/,"export default $1function __default")+`
2
2
  type __ExpandRecursively<T> = T extends (...args: infer A) => infer R
3
3
  ? (...args: __ExpandRecursively<A>) => __ExpandRecursively<R>
4
4
  : T extends object
@@ -1,4 +1,4 @@
1
- import{r as d,bB as me,bx as Gr,c as cr,l as st,j as w}from"./index-DGQdC8j6.js";import{w as Yr,e as Ae,s as fe,i as V,f as ur,r as ye,h as at,j as fr,J as nt,k as D,m as _,n as ue,o as we,p as Se,q as re,R as ct,L as de,t as Hr,v as Oe,x as Vr,y as qr,z as Ur,B as Zr,D as Le,E as He,F as Xr,G as Jr,H as Qr,I as ea,K as Ne,M as ze,N as q,O as ut,P as ft,Z as Ke,Q as dr,S as vr,T as pr,U as xe,V as mr,W as te,Y as ta,_ as yr,$ as he,a0 as ra,a1 as ie,a2 as ve,a3 as oe,a4 as pe,a5 as hr,a6 as gr,a7 as br,a8 as aa,a9 as na,aa as dt,ab as ia,ac as vt,ad as oa,ae as la,af as sa,ag as ca,ah as ua,ai as xr,aj as fa,ak as da,al as va,am as pa,an as ma,ao as Or,ap as ya,aq as Pr,ar as ha,as as jr,at as ga,au as ba,av as pt,aw as xa,ax as Oa,ay as Pa,az as ja,aA as $,aB as Aa,aC as ka,aD as Ia,aE as wa,aF as Sa,aG as Ea,aH as Ta,aI as Ca,aJ as Da,aK as Ma,aL as Ba,aM as $a,aN as _a,aO as La,aP as Na,X as mt,C as yt,A as za,b as Ka,c as ht}from"./AreaChart-RJnPaDTO.js";const Ar=Math.cos,Ee=Math.sin,U=Math.sqrt,Te=Math.PI,We=2*Te,it={draw(t,e){const r=U(e/Te);t.moveTo(r,0),t.arc(0,0,r,0,We)}},Wa={draw(t,e){const r=U(e/5)/2;t.moveTo(-3*r,-r),t.lineTo(-r,-r),t.lineTo(-r,-3*r),t.lineTo(r,-3*r),t.lineTo(r,-r),t.lineTo(3*r,-r),t.lineTo(3*r,r),t.lineTo(r,r),t.lineTo(r,3*r),t.lineTo(-r,3*r),t.lineTo(-r,r),t.lineTo(-3*r,r),t.closePath()}},kr=U(1/3),Ra=kr*2,Fa={draw(t,e){const r=U(e/Ra),a=r*kr;t.moveTo(0,-r),t.lineTo(a,0),t.lineTo(0,r),t.lineTo(-a,0),t.closePath()}},Ga={draw(t,e){const r=U(e),a=-r/2;t.rect(a,a,r,r)}},Ya=.8908130915292852,Ir=Ee(Te/10)/Ee(7*Te/10),Ha=Ee(We/10)*Ir,Va=-Ar(We/10)*Ir,qa={draw(t,e){const r=U(e*Ya),a=Ha*r,n=Va*r;t.moveTo(0,-r),t.lineTo(a,n);for(let i=1;i<5;++i){const l=We*i/5,f=Ar(l),o=Ee(l);t.lineTo(o*r,-f*r),t.lineTo(f*a-o*n,o*a+f*n)}t.closePath()}},Fe=U(3),Ua={draw(t,e){const r=-U(e/(Fe*3));t.moveTo(0,r*2),t.lineTo(-Fe*r,-r),t.lineTo(Fe*r,-r),t.closePath()}},G=-.5,Y=U(3)/2,Ve=1/U(12),Za=(Ve/2+1)*3,Xa={draw(t,e){const r=U(e/Za),a=r/2,n=r*Ve,i=a,l=r*Ve+r,f=-i,o=l;t.moveTo(a,n),t.lineTo(i,l),t.lineTo(f,o),t.lineTo(G*a-Y*n,Y*a+G*n),t.lineTo(G*i-Y*l,Y*i+G*l),t.lineTo(G*f-Y*o,Y*f+G*o),t.lineTo(G*a+Y*n,G*n-Y*a),t.lineTo(G*i+Y*l,G*l-Y*i),t.lineTo(G*f+Y*o,G*o-Y*f),t.closePath()}};function Ja(t,e){let r=null,a=Yr(n);t=typeof t=="function"?t:Ae(t||it),e=typeof e=="function"?e:Ae(e===void 0?64:+e);function n(){let i;if(r||(r=i=a()),t.apply(this,arguments).draw(r,+e.apply(this,arguments)),i)return r=null,i+""||null}return n.type=function(i){return arguments.length?(t=typeof i=="function"?i:Ae(i),n):t},n.size=function(i){return arguments.length?(e=typeof i=="function"?i:Ae(+i),n):e},n.context=function(i){return arguments.length?(r=i??null,n):r},n}var Qa="Invariant failed";function en(t,e){throw new Error(Qa)}var tn=["type","size","sizeType"];function qe(){return qe=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)({}).hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},qe.apply(null,arguments)}function gt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,a)}return r}function bt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?gt(Object(r),!0).forEach(function(a){rn(t,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):gt(Object(r)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(r,a))})}return t}function rn(t,e,r){return(e=an(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function an(t){var e=nn(t,"string");return typeof e=="symbol"?e:e+""}function nn(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var a=r.call(t,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function on(t,e){if(t==null)return{};var r,a,n=ln(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)r=i[a],e.indexOf(r)===-1&&{}.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function ln(t,e){if(t==null)return{};var r={};for(var a in t)if({}.hasOwnProperty.call(t,a)){if(e.indexOf(a)!==-1)continue;r[a]=t[a]}return r}var wr={symbolCircle:it,symbolCross:Wa,symbolDiamond:Fa,symbolSquare:Ga,symbolStar:qa,symbolTriangle:Ua,symbolWye:Xa},sn=Math.PI/180,cn=t=>{var e="symbol".concat(ur(t));return wr[e]||it},un=(t,e,r)=>{if(e==="area")return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var a=18*sn;return 1.25*t*t*(Math.tan(a)-Math.tan(a*2)*Math.tan(a)**2)}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},fn=(t,e)=>{wr["symbol".concat(ur(t))]=e},Sr=t=>{var{type:e="circle",size:r=64,sizeType:a="area"}=t,n=on(t,tn),i=bt(bt({},n),{},{type:e,size:r,sizeType:a}),l="circle";typeof e=="string"&&(l=e);var f=()=>{var v=cn(l),m=Ja().type(v).size(un(r,a,l)),y=m();if(y!==null)return y},{className:o,cx:s,cy:c}=i,u=fe(i);return V(s)&&V(c)&&V(r)?d.createElement("path",qe({},u,{className:me("recharts-symbols",o),transform:"translate(".concat(s,", ").concat(c,")"),d:f()})):null};Sr.registerSymbol=fn;var xt=function(e,r){for(var a=arguments.length,n=new Array(a>2?a-2:0),i=2;i<a;i++)n[i-2]=arguments[i];if(typeof console<"u"&&console.warn&&(r===void 0&&console.warn("LogUtils requires an error message argument"),!e))if(r===void 0)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=0;console.warn(r.replace(/%s/g,()=>n[l++]))}},dn=["radius"],vn=["radius"],Ot,Pt,jt,At,kt,It,wt,St,Et,Tt;function Ct(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,a)}return r}function Dt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ct(Object(r),!0).forEach(function(a){pn(t,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ct(Object(r)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(r,a))})}return t}function pn(t,e,r){return(e=mn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function mn(t){var e=yn(t,"string");return typeof e=="symbol"?e:e+""}function yn(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var a=r.call(t,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ce(){return Ce=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)({}).hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Ce.apply(null,arguments)}function Mt(t,e){if(t==null)return{};var r,a,n=hn(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)r=i[a],e.indexOf(r)===-1&&{}.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function hn(t,e){if(t==null)return{};var r={};for(var a in t)if({}.hasOwnProperty.call(t,a)){if(e.indexOf(a)!==-1)continue;r[a]=t[a]}return r}function J(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var Bt=(t,e,r,a,n)=>{var i=ue(r),l=ue(a),f=Math.min(Math.abs(i)/2,Math.abs(l)/2),o=l>=0?1:-1,s=i>=0?1:-1,c=l>=0&&i>=0||l<0&&i<0?1:0,u;if(f>0&&Array.isArray(n)){for(var v=[0,0,0,0],m=0,y=4;m<y;m++){var h,b=(h=n[m])!==null&&h!==void 0?h:0;v[m]=b>f?f:b}u=D(Ot||(Ot=J(["M",",",""])),t,e+o*v[0]),v[0]>0&&(u+=D(Pt||(Pt=J(["A ",",",",0,0,",",",",",""])),v[0],v[0],c,t+s*v[0],e)),u+=D(jt||(jt=J(["L ",",",""])),t+r-s*v[1],e),v[1]>0&&(u+=D(At||(At=J(["A ",",",",0,0,",`,
1
+ import{r as d,bB as me,bx as Gr,c as cr,l as st,j as w}from"./index-Dm8PN3sF.js";import{w as Yr,e as Ae,s as fe,i as V,f as ur,r as ye,h as at,j as fr,J as nt,k as D,m as _,n as ue,o as we,p as Se,q as re,R as ct,L as de,t as Hr,v as Oe,x as Vr,y as qr,z as Ur,B as Zr,D as Le,E as He,F as Xr,G as Jr,H as Qr,I as ea,K as Ne,M as ze,N as q,O as ut,P as ft,Z as Ke,Q as dr,S as vr,T as pr,U as xe,V as mr,W as te,Y as ta,_ as yr,$ as he,a0 as ra,a1 as ie,a2 as ve,a3 as oe,a4 as pe,a5 as hr,a6 as gr,a7 as br,a8 as aa,a9 as na,aa as dt,ab as ia,ac as vt,ad as oa,ae as la,af as sa,ag as ca,ah as ua,ai as xr,aj as fa,ak as da,al as va,am as pa,an as ma,ao as Or,ap as ya,aq as Pr,ar as ha,as as jr,at as ga,au as ba,av as pt,aw as xa,ax as Oa,ay as Pa,az as ja,aA as $,aB as Aa,aC as ka,aD as Ia,aE as wa,aF as Sa,aG as Ea,aH as Ta,aI as Ca,aJ as Da,aK as Ma,aL as Ba,aM as $a,aN as _a,aO as La,aP as Na,X as mt,C as yt,A as za,b as Ka,c as ht}from"./AreaChart-rXhSjQGk.js";const Ar=Math.cos,Ee=Math.sin,U=Math.sqrt,Te=Math.PI,We=2*Te,it={draw(t,e){const r=U(e/Te);t.moveTo(r,0),t.arc(0,0,r,0,We)}},Wa={draw(t,e){const r=U(e/5)/2;t.moveTo(-3*r,-r),t.lineTo(-r,-r),t.lineTo(-r,-3*r),t.lineTo(r,-3*r),t.lineTo(r,-r),t.lineTo(3*r,-r),t.lineTo(3*r,r),t.lineTo(r,r),t.lineTo(r,3*r),t.lineTo(-r,3*r),t.lineTo(-r,r),t.lineTo(-3*r,r),t.closePath()}},kr=U(1/3),Ra=kr*2,Fa={draw(t,e){const r=U(e/Ra),a=r*kr;t.moveTo(0,-r),t.lineTo(a,0),t.lineTo(0,r),t.lineTo(-a,0),t.closePath()}},Ga={draw(t,e){const r=U(e),a=-r/2;t.rect(a,a,r,r)}},Ya=.8908130915292852,Ir=Ee(Te/10)/Ee(7*Te/10),Ha=Ee(We/10)*Ir,Va=-Ar(We/10)*Ir,qa={draw(t,e){const r=U(e*Ya),a=Ha*r,n=Va*r;t.moveTo(0,-r),t.lineTo(a,n);for(let i=1;i<5;++i){const l=We*i/5,f=Ar(l),o=Ee(l);t.lineTo(o*r,-f*r),t.lineTo(f*a-o*n,o*a+f*n)}t.closePath()}},Fe=U(3),Ua={draw(t,e){const r=-U(e/(Fe*3));t.moveTo(0,r*2),t.lineTo(-Fe*r,-r),t.lineTo(Fe*r,-r),t.closePath()}},G=-.5,Y=U(3)/2,Ve=1/U(12),Za=(Ve/2+1)*3,Xa={draw(t,e){const r=U(e/Za),a=r/2,n=r*Ve,i=a,l=r*Ve+r,f=-i,o=l;t.moveTo(a,n),t.lineTo(i,l),t.lineTo(f,o),t.lineTo(G*a-Y*n,Y*a+G*n),t.lineTo(G*i-Y*l,Y*i+G*l),t.lineTo(G*f-Y*o,Y*f+G*o),t.lineTo(G*a+Y*n,G*n-Y*a),t.lineTo(G*i+Y*l,G*l-Y*i),t.lineTo(G*f+Y*o,G*o-Y*f),t.closePath()}};function Ja(t,e){let r=null,a=Yr(n);t=typeof t=="function"?t:Ae(t||it),e=typeof e=="function"?e:Ae(e===void 0?64:+e);function n(){let i;if(r||(r=i=a()),t.apply(this,arguments).draw(r,+e.apply(this,arguments)),i)return r=null,i+""||null}return n.type=function(i){return arguments.length?(t=typeof i=="function"?i:Ae(i),n):t},n.size=function(i){return arguments.length?(e=typeof i=="function"?i:Ae(+i),n):e},n.context=function(i){return arguments.length?(r=i??null,n):r},n}var Qa="Invariant failed";function en(t,e){throw new Error(Qa)}var tn=["type","size","sizeType"];function qe(){return qe=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)({}).hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},qe.apply(null,arguments)}function gt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,a)}return r}function bt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?gt(Object(r),!0).forEach(function(a){rn(t,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):gt(Object(r)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(r,a))})}return t}function rn(t,e,r){return(e=an(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function an(t){var e=nn(t,"string");return typeof e=="symbol"?e:e+""}function nn(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var a=r.call(t,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function on(t,e){if(t==null)return{};var r,a,n=ln(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)r=i[a],e.indexOf(r)===-1&&{}.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function ln(t,e){if(t==null)return{};var r={};for(var a in t)if({}.hasOwnProperty.call(t,a)){if(e.indexOf(a)!==-1)continue;r[a]=t[a]}return r}var wr={symbolCircle:it,symbolCross:Wa,symbolDiamond:Fa,symbolSquare:Ga,symbolStar:qa,symbolTriangle:Ua,symbolWye:Xa},sn=Math.PI/180,cn=t=>{var e="symbol".concat(ur(t));return wr[e]||it},un=(t,e,r)=>{if(e==="area")return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var a=18*sn;return 1.25*t*t*(Math.tan(a)-Math.tan(a*2)*Math.tan(a)**2)}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},fn=(t,e)=>{wr["symbol".concat(ur(t))]=e},Sr=t=>{var{type:e="circle",size:r=64,sizeType:a="area"}=t,n=on(t,tn),i=bt(bt({},n),{},{type:e,size:r,sizeType:a}),l="circle";typeof e=="string"&&(l=e);var f=()=>{var v=cn(l),m=Ja().type(v).size(un(r,a,l)),y=m();if(y!==null)return y},{className:o,cx:s,cy:c}=i,u=fe(i);return V(s)&&V(c)&&V(r)?d.createElement("path",qe({},u,{className:me("recharts-symbols",o),transform:"translate(".concat(s,", ").concat(c,")"),d:f()})):null};Sr.registerSymbol=fn;var xt=function(e,r){for(var a=arguments.length,n=new Array(a>2?a-2:0),i=2;i<a;i++)n[i-2]=arguments[i];if(typeof console<"u"&&console.warn&&(r===void 0&&console.warn("LogUtils requires an error message argument"),!e))if(r===void 0)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=0;console.warn(r.replace(/%s/g,()=>n[l++]))}},dn=["radius"],vn=["radius"],Ot,Pt,jt,At,kt,It,wt,St,Et,Tt;function Ct(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,a)}return r}function Dt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ct(Object(r),!0).forEach(function(a){pn(t,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ct(Object(r)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(r,a))})}return t}function pn(t,e,r){return(e=mn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function mn(t){var e=yn(t,"string");return typeof e=="symbol"?e:e+""}function yn(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var a=r.call(t,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ce(){return Ce=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)({}).hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Ce.apply(null,arguments)}function Mt(t,e){if(t==null)return{};var r,a,n=hn(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)r=i[a],e.indexOf(r)===-1&&{}.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function hn(t,e){if(t==null)return{};var r={};for(var a in t)if({}.hasOwnProperty.call(t,a)){if(e.indexOf(a)!==-1)continue;r[a]=t[a]}return r}function J(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var Bt=(t,e,r,a,n)=>{var i=ue(r),l=ue(a),f=Math.min(Math.abs(i)/2,Math.abs(l)/2),o=l>=0?1:-1,s=i>=0?1:-1,c=l>=0&&i>=0||l<0&&i<0?1:0,u;if(f>0&&Array.isArray(n)){for(var v=[0,0,0,0],m=0,y=4;m<y;m++){var h,b=(h=n[m])!==null&&h!==void 0?h:0;v[m]=b>f?f:b}u=D(Ot||(Ot=J(["M",",",""])),t,e+o*v[0]),v[0]>0&&(u+=D(Pt||(Pt=J(["A ",",",",0,0,",",",",",""])),v[0],v[0],c,t+s*v[0],e)),u+=D(jt||(jt=J(["L ",",",""])),t+r-s*v[1],e),v[1]>0&&(u+=D(At||(At=J(["A ",",",",0,0,",`,
2
2
  `,",",""])),v[1],v[1],c,t+r,e+o*v[1])),u+=D(kt||(kt=J(["L ",",",""])),t+r,e+a-o*v[2]),v[2]>0&&(u+=D(It||(It=J(["A ",",",",0,0,",`,
3
3
  `,",",""])),v[2],v[2],c,t+r-s*v[2],e+a)),u+=D(wt||(wt=J(["L ",",",""])),t+s*v[3],e+a),v[3]>0&&(u+=D(St||(St=J(["A ",",",",0,0,",`,
4
4
  `,",",""])),v[3],v[3],c,t,e+a-o*v[3])),u+="Z"}else if(f>0&&n===+n&&n>0){var p=Math.min(f,n);u=D(Et||(Et=J(["M ",",",`
@@ -1 +1 @@
1
- import{c as he,r as te,l as xe,j as t,B as pe}from"./index-DGQdC8j6.js";import{B as ce}from"./badge-DuwyDvgL.js";import{C as de}from"./checkbox-DbEZ6b_D.js";import{t as me}from"./ChevronDown-DCZlSvzQ.js";import{b as ge,C as ve,a as ue,c as je,e as Ce,d as be}from"./command-BoNCgAXF.js";import{P as Ne,a as ye,b as we}from"./popover-BoSjy_J9.js";function Ke(o){const e=he.c(74),{options:n,onValueChange:i,defaultValue:P,placeholder:se,variant:le,animation:ae,maxCount:ne,modalPopover:ie,asChild:oe,className:G,disabled:re,onSearchChange:V}=o;let _;e[0]!==P?(_=P===void 0?[]:P,e[0]=P,e[1]=_):_=e[1];const d=_,L=se===void 0?"Select items":se,E=le===void 0?"default":le,O=ae===void 0?0:ae,k=ne===void 0?3:ne,q=ie===void 0?!1:ie,H=oe===void 0?!1:oe,Q=re===void 0?!1:re,[s,S]=te.useState(d),[U,B]=te.useState(!1);let D,I;e[2]!==d||e[3]!==s?(D=()=>{JSON.stringify(s)!==JSON.stringify(d)&&S(d)},I=[d,s],e[2]=d,e[3]=s,e[4]=D,e[5]=I):(D=e[4],I=e[5]),te.useEffect(D,I);let K;e[6]!==i||e[7]!==s?(K=l=>{if(l.key==="Enter")B(!0);else if(l.key==="Backspace"&&!l.currentTarget.value){const a=[...s];a.pop(),S(a),i(a)}},e[6]=i,e[7]=s,e[8]=K):K=e[8];const W=K;let T;e[9]!==i||e[10]!==s?(T=l=>{const a=s.includes(l.value)?s.filter(w=>w!==l.value):[...s,l.value];S(a),i(a)},e[9]=i,e[10]=s,e[11]=T):T=e[11];const c=T;let $;e[12]!==i?($=()=>{S([]),i([])},e[12]=i,e[13]=$):$=e[13];const X=$;let z;e[14]===Symbol.for("react.memo_cache_sentinel")?(z=()=>{B(Ve)},e[14]=z):z=e[14];const fe=z;let A;e[15]!==X||e[16]!==i||e[17]!==n||e[18]!==s.length?(A=()=>{if(s.length===n.length)X();else{const l=n.map(Pe);S(l),i(l)}},e[15]=X,e[16]=i,e[17]=n,e[18]=s.length,e[19]=A):A=e[19];const r=A;let m;e[20]!==H?(m=H?{}:{variant:"outline"},e[20]=H,e[21]=m):m=e[21];let u;e[22]!==G?(u=xe("border-input data-[placeholder]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-full max-w-xs items-center justify-between gap-2 rounded-xl border bg-transparent px-3 py-2 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[2px] disabled:cursor-not-allowed disabled:opacity-50 h-10 min-h-10",G),e[22]=G,e[23]=u):u=e[23];let f;e[24]!==O||e[25]!==k||e[26]!==n||e[27]!==L||e[28]!==s||e[29]!==E?(f=s.length>0?t.jsxs("div",{className:"flex items-center justify-between w-full min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[s.slice(0,k).map(l=>{const a=n.find(ee=>ee.value===l),w=a?.icon;return t.jsxs(ce,{variant:E==="default"?"default":"secondary",className:"max-w-24",style:{animationDuration:`${O}s`},children:[w&&t.jsx(w,{className:"h-3 w-3 shrink-0"}),t.jsx("span",{className:"truncate",children:a?.label})]},l)}),s.length>k&&t.jsxs(ce,{variant:E==="default"?"default":"secondary",className:"flex-shrink-0",style:{animationDuration:`${O}s`},children:["+",s.length-k]})]}),t.jsx("div",{className:"flex items-center shrink-0 ml-2",children:t.jsx(me,{size:20,className:"shrink-0 opacity-50"})})]}):t.jsxs("div",{className:"flex items-center justify-between w-full",children:[t.jsx("span",{className:"text-sm text-muted-foreground",children:L}),t.jsx(me,{size:20,className:"shrink-0 opacity-50"})]}),e[24]=O,e[25]=k,e[26]=n,e[27]=L,e[28]=s,e[29]=E,e[30]=f):f=e[30];let h;e[31]!==Q||e[32]!==m||e[33]!==u||e[34]!==f?(h=t.jsx(Ne,{asChild:!0,children:t.jsx(pe,{ref:null,...m,onClick:fe,className:u,disabled:Q,children:f})}),e[31]=Q,e[32]=m,e[33]=u,e[34]=f,e[35]=h):h=e[35];let J;e[36]===Symbol.for("react.memo_cache_sentinel")?(J=()=>B(!1),e[36]=J):J=e[36];const Y=!V;let x;e[37]!==W||e[38]!==V?(x=t.jsx(ge,{placeholder:"Search...",onKeyDown:W,onValueChange:V,className:"rounded-t-xl"}),e[37]=W,e[38]=V,e[39]=x):x=e[39];let M;e[40]===Symbol.for("react.memo_cache_sentinel")?(M=t.jsx(ve,{children:"No results found."}),e[40]=M):M=e[40];let p;e[41]!==r?(p=()=>{r()},e[41]=r,e[42]=p):p=e[42];let g;e[43]!==r?(g=l=>{l.stopPropagation(),r()},e[43]=r,e[44]=g):g=e[44];const Z=s.length===n.length&&n.length>0;let v;e[45]!==Z||e[46]!==r?(v=t.jsx(de,{checked:Z,onCheckedChange:r,className:"mr-2 [&_svg]:!text-primary-foreground",onClick:Se}),e[45]=Z,e[46]=r,e[47]=v):v=e[47];let R;e[48]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx("span",{children:"(Select All)"}),e[48]=R):R=e[48];let j;e[49]!==g||e[50]!==v?(j=t.jsxs("div",{className:"flex items-center w-full",onClick:g,children:[v,R]}),e[49]=g,e[50]=v,e[51]=j):j=e[51];let C;e[52]!==p||e[53]!==j?(C=t.jsx(ue,{onSelect:p,className:"cursor-pointer",children:j},"all"),e[52]=p,e[53]=j,e[54]=C):C=e[54];let b;if(e[55]!==n||e[56]!==s||e[57]!==c){let l;e[59]!==s||e[60]!==c?(l=a=>{const w=s.includes(a.value);return t.jsx(ue,{onSelect:()=>{c(a)},className:"cursor-pointer",children:t.jsxs("div",{className:"flex items-center w-full",onClick:ee=>{ee.stopPropagation(),c(a)},children:[t.jsx(de,{checked:w,onCheckedChange:()=>{c(a)},className:"mr-2 [&_svg]:!text-primary-foreground",onClick:ke}),a.icon&&t.jsx(a.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),t.jsx("span",{children:a.label})]})},a.value)},e[59]=s,e[60]=c,e[61]=l):l=e[61],b=n.map(l),e[55]=n,e[56]=s,e[57]=c,e[58]=b}else b=e[58];let N;e[62]!==C||e[63]!==b?(N=t.jsxs(je,{className:"rounded-b-xl",children:[M,t.jsxs(Ce,{children:[C,b]})]}),e[62]=C,e[63]=b,e[64]=N):N=e[64];let y;e[65]!==Y||e[66]!==x||e[67]!==N?(y=t.jsx(ye,{className:"w-auto p-0 max-w-xs rounded-xl",align:"start",onEscapeKeyDown:J,children:t.jsxs(be,{shouldFilter:Y,className:"rounded-xl",children:[x,N]})}),e[65]=Y,e[66]=x,e[67]=N,e[68]=y):y=e[68];let F;return e[69]!==U||e[70]!==q||e[71]!==h||e[72]!==y?(F=t.jsxs(we,{open:U,onOpenChange:B,modal:q,children:[h,y]}),e[69]=U,e[70]=q,e[71]=h,e[72]=y,e[73]=F):F=e[73],F}function ke(o){return o.stopPropagation()}function Se(o){return o.stopPropagation()}function Pe(o){return o.value}function Ve(o){return!o}export{Ke as M};
1
+ import{c as he,r as te,l as xe,j as t,B as pe}from"./index-Dm8PN3sF.js";import{B as ce}from"./badge-LKHpiZNV.js";import{C as de}from"./checkbox-aaBpY9LU.js";import{t as me}from"./ChevronDown-CoccBu6f.js";import{b as ge,C as ve,a as ue,c as je,e as Ce,d as be}from"./command-7qGSdx1i.js";import{P as Ne,a as ye,b as we}from"./popover-DeKqmccr.js";function Ke(o){const e=he.c(74),{options:n,onValueChange:i,defaultValue:P,placeholder:se,variant:le,animation:ae,maxCount:ne,modalPopover:ie,asChild:oe,className:G,disabled:re,onSearchChange:V}=o;let _;e[0]!==P?(_=P===void 0?[]:P,e[0]=P,e[1]=_):_=e[1];const d=_,L=se===void 0?"Select items":se,E=le===void 0?"default":le,O=ae===void 0?0:ae,k=ne===void 0?3:ne,q=ie===void 0?!1:ie,H=oe===void 0?!1:oe,Q=re===void 0?!1:re,[s,S]=te.useState(d),[U,B]=te.useState(!1);let D,I;e[2]!==d||e[3]!==s?(D=()=>{JSON.stringify(s)!==JSON.stringify(d)&&S(d)},I=[d,s],e[2]=d,e[3]=s,e[4]=D,e[5]=I):(D=e[4],I=e[5]),te.useEffect(D,I);let K;e[6]!==i||e[7]!==s?(K=l=>{if(l.key==="Enter")B(!0);else if(l.key==="Backspace"&&!l.currentTarget.value){const a=[...s];a.pop(),S(a),i(a)}},e[6]=i,e[7]=s,e[8]=K):K=e[8];const W=K;let T;e[9]!==i||e[10]!==s?(T=l=>{const a=s.includes(l.value)?s.filter(w=>w!==l.value):[...s,l.value];S(a),i(a)},e[9]=i,e[10]=s,e[11]=T):T=e[11];const c=T;let $;e[12]!==i?($=()=>{S([]),i([])},e[12]=i,e[13]=$):$=e[13];const X=$;let z;e[14]===Symbol.for("react.memo_cache_sentinel")?(z=()=>{B(Ve)},e[14]=z):z=e[14];const fe=z;let A;e[15]!==X||e[16]!==i||e[17]!==n||e[18]!==s.length?(A=()=>{if(s.length===n.length)X();else{const l=n.map(Pe);S(l),i(l)}},e[15]=X,e[16]=i,e[17]=n,e[18]=s.length,e[19]=A):A=e[19];const r=A;let m;e[20]!==H?(m=H?{}:{variant:"outline"},e[20]=H,e[21]=m):m=e[21];let u;e[22]!==G?(u=xe("border-input data-[placeholder]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-full max-w-xs items-center justify-between gap-2 rounded-xl border bg-transparent px-3 py-2 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[2px] disabled:cursor-not-allowed disabled:opacity-50 h-10 min-h-10",G),e[22]=G,e[23]=u):u=e[23];let f;e[24]!==O||e[25]!==k||e[26]!==n||e[27]!==L||e[28]!==s||e[29]!==E?(f=s.length>0?t.jsxs("div",{className:"flex items-center justify-between w-full min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[s.slice(0,k).map(l=>{const a=n.find(ee=>ee.value===l),w=a?.icon;return t.jsxs(ce,{variant:E==="default"?"default":"secondary",className:"max-w-24",style:{animationDuration:`${O}s`},children:[w&&t.jsx(w,{className:"h-3 w-3 shrink-0"}),t.jsx("span",{className:"truncate",children:a?.label})]},l)}),s.length>k&&t.jsxs(ce,{variant:E==="default"?"default":"secondary",className:"flex-shrink-0",style:{animationDuration:`${O}s`},children:["+",s.length-k]})]}),t.jsx("div",{className:"flex items-center shrink-0 ml-2",children:t.jsx(me,{size:20,className:"shrink-0 opacity-50"})})]}):t.jsxs("div",{className:"flex items-center justify-between w-full",children:[t.jsx("span",{className:"text-sm text-muted-foreground",children:L}),t.jsx(me,{size:20,className:"shrink-0 opacity-50"})]}),e[24]=O,e[25]=k,e[26]=n,e[27]=L,e[28]=s,e[29]=E,e[30]=f):f=e[30];let h;e[31]!==Q||e[32]!==m||e[33]!==u||e[34]!==f?(h=t.jsx(Ne,{asChild:!0,children:t.jsx(pe,{ref:null,...m,onClick:fe,className:u,disabled:Q,children:f})}),e[31]=Q,e[32]=m,e[33]=u,e[34]=f,e[35]=h):h=e[35];let J;e[36]===Symbol.for("react.memo_cache_sentinel")?(J=()=>B(!1),e[36]=J):J=e[36];const Y=!V;let x;e[37]!==W||e[38]!==V?(x=t.jsx(ge,{placeholder:"Search...",onKeyDown:W,onValueChange:V,className:"rounded-t-xl"}),e[37]=W,e[38]=V,e[39]=x):x=e[39];let M;e[40]===Symbol.for("react.memo_cache_sentinel")?(M=t.jsx(ve,{children:"No results found."}),e[40]=M):M=e[40];let p;e[41]!==r?(p=()=>{r()},e[41]=r,e[42]=p):p=e[42];let g;e[43]!==r?(g=l=>{l.stopPropagation(),r()},e[43]=r,e[44]=g):g=e[44];const Z=s.length===n.length&&n.length>0;let v;e[45]!==Z||e[46]!==r?(v=t.jsx(de,{checked:Z,onCheckedChange:r,className:"mr-2 [&_svg]:!text-primary-foreground",onClick:Se}),e[45]=Z,e[46]=r,e[47]=v):v=e[47];let R;e[48]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx("span",{children:"(Select All)"}),e[48]=R):R=e[48];let j;e[49]!==g||e[50]!==v?(j=t.jsxs("div",{className:"flex items-center w-full",onClick:g,children:[v,R]}),e[49]=g,e[50]=v,e[51]=j):j=e[51];let C;e[52]!==p||e[53]!==j?(C=t.jsx(ue,{onSelect:p,className:"cursor-pointer",children:j},"all"),e[52]=p,e[53]=j,e[54]=C):C=e[54];let b;if(e[55]!==n||e[56]!==s||e[57]!==c){let l;e[59]!==s||e[60]!==c?(l=a=>{const w=s.includes(a.value);return t.jsx(ue,{onSelect:()=>{c(a)},className:"cursor-pointer",children:t.jsxs("div",{className:"flex items-center w-full",onClick:ee=>{ee.stopPropagation(),c(a)},children:[t.jsx(de,{checked:w,onCheckedChange:()=>{c(a)},className:"mr-2 [&_svg]:!text-primary-foreground",onClick:ke}),a.icon&&t.jsx(a.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),t.jsx("span",{children:a.label})]})},a.value)},e[59]=s,e[60]=c,e[61]=l):l=e[61],b=n.map(l),e[55]=n,e[56]=s,e[57]=c,e[58]=b}else b=e[58];let N;e[62]!==C||e[63]!==b?(N=t.jsxs(je,{className:"rounded-b-xl",children:[M,t.jsxs(Ce,{children:[C,b]})]}),e[62]=C,e[63]=b,e[64]=N):N=e[64];let y;e[65]!==Y||e[66]!==x||e[67]!==N?(y=t.jsx(ye,{className:"w-auto p-0 max-w-xs rounded-xl",align:"start",onEscapeKeyDown:J,children:t.jsxs(be,{shouldFilter:Y,className:"rounded-xl",children:[x,N]})}),e[65]=Y,e[66]=x,e[67]=N,e[68]=y):y=e[68];let F;return e[69]!==U||e[70]!==q||e[71]!==h||e[72]!==y?(F=t.jsxs(we,{open:U,onOpenChange:B,modal:q,children:[h,y]}),e[69]=U,e[70]=q,e[71]=h,e[72]=y,e[73]=F):F=e[73],F}function ke(o){return o.stopPropagation()}function Se(o){return o.stopPropagation()}function Pe(o){return o.value}function Ve(o){return!o}export{Ke as M};
@@ -1 +1 @@
1
- import{r,j as e,i as n}from"./index-DGQdC8j6.js";import{h as l}from"./mcp-oauth-SHxAJnkD.js";import"./auth-DDOP_TUe.js";function h(){const[s,c]=r.useState(null),[i,a]=r.useState(!1);return r.useEffect(()=>{(async()=>{try{const t=await l();if(!t.success){c(t.error||"MCP authentication failed"),setTimeout(()=>{window.close()},3e3);return}a(!0),setTimeout(()=>{window.close()},1500)}catch(t){c(t instanceof Error?t.message:String(t)),setTimeout(()=>{window.close()},3e3)}})()},[]),e.jsx("div",{className:"min-h-screen flex items-center justify-center p-8 bg-background",children:e.jsxs("div",{className:"w-full max-w-md flex flex-col items-center justify-center gap-8",children:[i&&e.jsx("img",{src:"/empty-state-success.svg",alt:"",width:220,height:200,"aria-hidden":"true"}),!i&&!s&&e.jsx("div",{className:"flex items-center justify-center py-4",children:e.jsx(n,{size:32,className:"animate-spin text-primary"})}),s&&e.jsx("img",{src:"/empty-state-error.svg",alt:"",width:220,height:200,"aria-hidden":"true"}),e.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[e.jsx("h2",{className:"text-lg font-medium text-foreground",children:s?"Authentication Failed":i?"Authentication Successful":"Authentication in progress..."}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mb-2",children:"An error occurred during authentication:"}),e.jsx("p",{className:"text-destructive",children:s}),e.jsxs("p",{className:"mt-2",children:[e.jsx("br",{}),"This window will close automatically."]})]}):i?e.jsxs("p",{children:["Authentication complete.",e.jsx("br",{}),"This window will close automatically."]}):e.jsx("p",{children:"Processing authentication..."})})]})]})})}export{h as default};
1
+ import{r,j as e,i as n}from"./index-Dm8PN3sF.js";import{h as l}from"./mcp-oauth-PhgGxYkw.js";import"./auth-B6PY9djs.js";function h(){const[s,c]=r.useState(null),[i,a]=r.useState(!1);return r.useEffect(()=>{(async()=>{try{const t=await l();if(!t.success){c(t.error||"MCP authentication failed"),setTimeout(()=>{window.close()},3e3);return}a(!0),setTimeout(()=>{window.close()},1500)}catch(t){c(t instanceof Error?t.message:String(t)),setTimeout(()=>{window.close()},3e3)}})()},[]),e.jsx("div",{className:"min-h-screen flex items-center justify-center p-8 bg-background",children:e.jsxs("div",{className:"w-full max-w-md flex flex-col items-center justify-center gap-8",children:[i&&e.jsx("img",{src:"/empty-state-success.svg",alt:"",width:220,height:200,"aria-hidden":"true"}),!i&&!s&&e.jsx("div",{className:"flex items-center justify-center py-4",children:e.jsx(n,{size:32,className:"animate-spin text-primary"})}),s&&e.jsx("img",{src:"/empty-state-error.svg",alt:"",width:220,height:200,"aria-hidden":"true"}),e.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[e.jsx("h2",{className:"text-lg font-medium text-foreground",children:s?"Authentication Failed":i?"Authentication Successful":"Authentication in progress..."}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mb-2",children:"An error occurred during authentication:"}),e.jsx("p",{className:"text-destructive",children:s}),e.jsxs("p",{className:"mt-2",children:[e.jsx("br",{}),"This window will close automatically."]})]}):i?e.jsxs("p",{children:["Authentication complete.",e.jsx("br",{}),"This window will close automatically."]}):e.jsx("p",{children:"Processing authentication..."})})]})]})})}export{h as default};
@@ -1 +1 @@
1
- import{r,j as e,i as d}from"./index-DGQdC8j6.js";function m(){const[s,i]=r.useState("loading"),[o,l]=r.useState(null),c=r.useRef(!1);return c.current||(c.current=!0,queueMicrotask(()=>{try{const t=new URLSearchParams(window.location.search),a=t.get("code"),n=t.get("state");if(!a||!n)throw new Error("Missing code or state parameter");if(window.opener)window.opener.postMessage({type:"AI_PROVIDER_OAUTH_CALLBACK",code:a,stateToken:n},window.location.origin),i("success"),setTimeout(()=>window.close(),1500);else throw new Error("No opener window found")}catch(t){console.error("OAuth callback error:",t),l(t instanceof Error?t.message:String(t)),i("error"),setTimeout(()=>window.close(),3e3)}})),e.jsx("div",{className:"min-h-screen flex items-center justify-center p-8 bg-background",children:e.jsxs("div",{className:"w-full max-w-md flex flex-col items-center justify-center gap-8",children:[s==="success"&&e.jsx("img",{src:"/empty-state-success.svg",alt:"",width:220,height:200,"aria-hidden":"true"}),s==="loading"&&e.jsx("div",{className:"flex items-center justify-center py-4",children:e.jsx(d,{size:32,className:"animate-spin text-primary"})}),s==="error"&&e.jsx("img",{src:"/empty-state-error.svg",alt:"",width:220,height:200,"aria-hidden":"true"}),e.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[e.jsx("h2",{className:"text-lg font-medium text-foreground",children:s==="error"?"Authentication Failed":s==="success"?"Authentication Successful":"Authentication in progress..."}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s==="error"?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mb-2",children:"An error occurred during authentication:"}),e.jsx("p",{className:"text-destructive",children:o}),e.jsx("p",{className:"mt-2",children:"This window will close automatically."})]}):s==="success"?e.jsx("p",{children:"Authentication complete. This window will close automatically."}):e.jsx("p",{children:"Processing authentication..."})})]})]})})}export{m as default};
1
+ import{r,j as e,i as d}from"./index-Dm8PN3sF.js";function m(){const[s,i]=r.useState("loading"),[o,l]=r.useState(null),c=r.useRef(!1);return c.current||(c.current=!0,queueMicrotask(()=>{try{const t=new URLSearchParams(window.location.search),a=t.get("code"),n=t.get("state");if(!a||!n)throw new Error("Missing code or state parameter");if(window.opener)window.opener.postMessage({type:"AI_PROVIDER_OAUTH_CALLBACK",code:a,stateToken:n},window.location.origin),i("success"),setTimeout(()=>window.close(),1500);else throw new Error("No opener window found")}catch(t){console.error("OAuth callback error:",t),l(t instanceof Error?t.message:String(t)),i("error"),setTimeout(()=>window.close(),3e3)}})),e.jsx("div",{className:"min-h-screen flex items-center justify-center p-8 bg-background",children:e.jsxs("div",{className:"w-full max-w-md flex flex-col items-center justify-center gap-8",children:[s==="success"&&e.jsx("img",{src:"/empty-state-success.svg",alt:"",width:220,height:200,"aria-hidden":"true"}),s==="loading"&&e.jsx("div",{className:"flex items-center justify-center py-4",children:e.jsx(d,{size:32,className:"animate-spin text-primary"})}),s==="error"&&e.jsx("img",{src:"/empty-state-error.svg",alt:"",width:220,height:200,"aria-hidden":"true"}),e.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[e.jsx("h2",{className:"text-lg font-medium text-foreground",children:s==="error"?"Authentication Failed":s==="success"?"Authentication Successful":"Authentication in progress..."}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s==="error"?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mb-2",children:"An error occurred during authentication:"}),e.jsx("p",{className:"text-destructive",children:o}),e.jsx("p",{className:"mt-2",children:"This window will close automatically."})]}):s==="success"?e.jsx("p",{children:"Authentication complete. This window will close automatically."}):e.jsx("p",{children:"Processing authentication..."})})]})]})})}export{m as default};
@@ -1 +1 @@
1
- import{c as K,j as t,a as re,i as X,r as E,m as pe,K as he,B as ce,d as oe,l as W,t as me}from"./index-DGQdC8j6.js";import{R as xe}from"./required-auth-layout-B-_kB-P-.js";import{A as J}from"./auth-split-layout-Bifmzv2W.js";import{O as be}from"./organization-choice-DlY0QjY5.js";import{A as de}from"./avatar-BumqAYVV.js";import{I as je}from"./input-DwWe5Hqk.js";import{L as ye}from"./label-DdsuSm6M.js";import{S as ve}from"./switch-DW7tjnTv.js";import{t as Ne,a as Se}from"./Users03-FhX9tiey.js";import{i as we}from"./CheckCircle-DAvZWWWn.js";import{t as ze}from"./Globe04-uOyvHHk7.js";import{a as ke}from"./Palette-Dem2eeFJ.js";import{i as Ce}from"./Upload01-DVcY511n.js";import"./User01-joygJQdk.js";const _e=new Set(["gmail.com","googlemail.com","outlook.com","hotmail.com","live.com","yahoo.com","yahoo.co.uk","icloud.com","me.com","mac.com","aol.com","protonmail.com","proton.me","zoho.com","yandex.com","mail.com","gmx.com","gmx.net","tutanota.com","fastmail.com"]);function se(i){return i.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function Xe(){const i=K.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(xe,{children:t.jsx(Oe,{})}),i[0]=e):e=i[0],e}function ie(i){const e=K.c(13),{title:g,description:c,logoUrl:u,logoFallback:o}=i;let a;e[0]!==o||e[1]!==u?(a=t.jsx("div",{children:u?t.jsx(de,{url:u,fallback:o??"?",shape:"square",size:"base",className:"h-12 w-12"}):t.jsxs(t.Fragment,{children:[t.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12 dark:hidden"}),t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-12 w-12 hidden dark:block"})]})}),e[0]=o,e[1]=u,e[2]=a):a=e[2];let r;e[3]!==g?(r=t.jsx("h1",{className:"text-2xl font-medium leading-8",children:g}),e[3]=g,e[4]=r):r=e[4];let n;e[5]!==c?(n=t.jsx("p",{className:"text-base text-muted-foreground leading-6",children:c}),e[5]=c,e[6]=n):n=e[6];let f;e[7]!==r||e[8]!==n?(f=t.jsxs("div",{className:"space-y-2",children:[r,n]}),e[7]=r,e[8]=n,e[9]=f):f=e[9];let s;return e[10]!==a||e[11]!==f?(s=t.jsxs("div",{className:"grid gap-10",children:[a,f]}),e[10]=a,e[11]=f,e[12]=s):s=e[12],s}function Oe(){const i=K.c(4),{data:e,isPending:g}=re.useSession();if(g){let a;return i[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(J,{children:t.jsx("div",{className:"flex items-center gap-2",children:t.jsx(X,{size:14,className:"animate-spin text-muted-foreground"})})}),i[0]=a):a=i[0],a}const c=e?.user?.email??"",u=e?.user?.name;let o;return i[1]!==u||i[2]!==c?(o=t.jsx(Ee,{email:c,userName:u}),i[1]=u,i[2]=c,i[3]=o):o=i[3],o}function Ee(i){const e=K.c(54),{email:g,userName:c}=i;let u,o,a,r,n,f;if(e[0]!==g||e[1]!==c){a=g.split("@")[1]?.toLowerCase()??"",r=!!a&&!_e.has(a);const l=a.split(".")[0]??"";o=l.charAt(0).toUpperCase()+l.slice(1);let m;e[8]!==o||e[9]!==r||e[10]!==c?(m=r?o:c?.split(" ")[0]??"",e[8]=o,e[9]=r,e[10]=c,e[11]=m):m=e[11],u=m,f=pe,n=he.domainLookup(a),e[0]=g,e[1]=c,e[2]=u,e[3]=o,e[4]=a,e[5]=r,e[6]=n,e[7]=f}else u=e[2],o=e[3],a=e[4],r=e[5],n=e[6],f=e[7];let s;e[12]!==r||e[13]!==n?(s={queryKey:n,queryFn:Re,enabled:r},e[12]=r,e[13]=n,e[14]=s):s=e[14];const{data:j,isLoading:d,isError:N,refetch:p}=f(s);let L;e[15]===Symbol.for("react.memo_cache_sentinel")?(L=new Set,e[15]=L):L=e[15];const[k,C]=E.useState(L),[A,_]=E.useState(!1);if(d){let l;e[16]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(X,{size:14,className:"animate-spin text-muted-foreground"}),e[16]=l):l=e[16];let m;return e[17]!==a?(m=t.jsx(J,{children:t.jsxs("div",{className:"flex items-center gap-2 py-4",children:[l,t.jsxs("span",{className:"text-sm text-muted-foreground",children:["Checking ",a,"..."]})]})}),e[17]=a,e[18]=m):m=e[18],m}if(N){let l;e[19]!==a?(l=t.jsxs("span",{className:"text-sm text-muted-foreground",children:["Couldn't check ",a," for an existing organization."]}),e[19]=a,e[20]=l):l=e[20];let m;e[21]!==p?(m=t.jsx(ce,{variant:"outline",size:"sm",onClick:()=>p(),children:"Retry"}),e[21]=p,e[22]=m):m=e[22];let h;return e[23]!==l||e[24]!==m?(h=t.jsx(J,{children:t.jsxs("div",{className:"flex flex-col items-start gap-3 py-4",children:[l,m]})}),e[23]=l,e[24]=m,e[25]=h):h=e[25],h}let y,b;e[26]!==j?.organizations?(y=(j?.organizations??[]).flatMap(Pe),b=y.some(Ae),e[26]=j?.organizations,e[27]=y,e[28]=b):(y=e[27],b=e[28]);const $=b;if(A){let l;e[29]!==c?(l=c?.split(" ")[0]??"",e[29]=c,e[30]=l):l=e[30];let m;e[31]===Symbol.for("react.memo_cache_sentinel")?(m=()=>_(!1),e[31]=m):m=e[31];let h;return e[32]!==o||e[33]!==a||e[34]!==r||e[35]!==l?(h=t.jsx(ne,{isCorporateEmail:r,emailDomain:a,domainLabel:o,defaultName:l,allowDomainClaim:!1,onBack:m}),e[32]=o,e[33]=a,e[34]=r,e[35]=l,e[36]=h):h=e[36],h}if(y.length>0){const l=$?y.length===1?"You have access to an organization":"You have access to multiple organizations":"Request access to an organization",m=$?"Your email domain matches an existing organization.":"Your email domain matches an organization that requires admin approval to join.";let h;e[37]!==l||e[38]!==m?(h=t.jsx(ie,{title:l,description:m}),e[37]=l,e[38]=m,e[39]=h):h=e[39];let z;e[40]===Symbol.for("react.memo_cache_sentinel")?(z=D=>C(R=>new Set(R).add(D)),e[40]=z):z=e[40];let S;e[41]!==y||e[42]!==a||e[43]!==k?(S=t.jsx(be,{organizations:y,domain:a,requestedSlugs:k,onRequestedSlug:z,onJoined:Le}),e[41]=y,e[42]=a,e[43]=k,e[44]=S):S=e[44];let P;e[45]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx("button",{type:"button",className:"text-sm text-muted-foreground hover:text-foreground transition-colors text-center",onClick:()=>_(!0),children:"Create a new organization instead"}),e[45]=P):P=e[45];let O;return e[46]!==S||e[47]!==h?(O=t.jsx(J,{children:t.jsxs("div",{className:"grid gap-10",children:[h,S,P]})}),e[46]=S,e[47]=h,e[48]=O):O=e[48],O}let w;return e[49]!==u||e[50]!==o||e[51]!==a||e[52]!==r?(w=t.jsx(ne,{isCorporateEmail:r,emailDomain:a,domainLabel:o,defaultName:u}),e[49]=u,e[50]=o,e[51]=a,e[52]=r,e[53]=w):w=e[53],w}function Le(i,e){window.location.href=`/${e}`}function Ae(i){return i.joinMode==="auto"}function Pe(i){return i.joinMode==="auto"||i.joinMode==="request"?[{id:i.id,name:i.name,slug:i.slug,logo:i.logo,joinMode:i.joinMode}]:[]}async function Re(){const i=await fetch("/api/auth/custom/domain-lookup",{credentials:"include"});if(!i.ok)throw new Error(`Failed to look up domain (${i.status})`);return i.json()}function ne(i){const e=K.c(70),{isCorporateEmail:g,emailDomain:c,domainLabel:u,defaultName:o,allowDomainClaim:a,onBack:r}=i,n=a===void 0?!0:a,f=g&&n?`https://www.google.com/s2/favicons?domain=${c}&sz=128`:null,[s,j]=E.useState(o),[d,N]=E.useState(f),[p,L]=E.useState(!0),[k,C]=E.useState(null);let A;e[0]!==p||e[1]!==d||e[2]!==s?(A=async()=>{const x=await fetch("/api/auth/custom/domain-setup",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s.trim()||void 0,logo:d??void 0,claimDomain:p})}),v=await x.json();if(!x.ok||!v.success)throw new Error(v.error||"Failed to set up organization");return v},e[0]=p,e[1]=d,e[2]=s,e[3]=A):A=e[3];let _;e[4]!==p?(_=x=>{if(!x.slug)return;const v=ue.filter(ge=>p||!ge.claimOnly).length,G=fe*(v-1)+800;C(x.slug),setTimeout(()=>{window.location.href=`/${x.slug}`},G)},e[4]=p,e[5]=_):_=e[5];let y;e[6]!==A||e[7]!==_?(y={mutationFn:A,onSuccess:_},e[6]=A,e[7]=_,e[8]=y):y=e[8];const b=oe(y);let $;e[9]!==d||e[10]!==s?($={mutationFn:async()=>{const x=s.trim(),v=se(x);if(!v)throw new Error("Invalid organization name");const G=await re.organization.create({name:x,slug:v,...d?{logo:d}:{}});if(G?.error)throw new Error(G.error.message||"Failed to create organization");window.location.href=`/${G?.data?.slug??v}`}},e[9]=d,e[10]=s,e[11]=$):$=e[11];const w=oe($);if(b.isPending||k){let x;e[12]!==u||e[13]!==s?(x=s.trim()||u,e[12]=u,e[13]=s,e[14]=x):x=e[14];let v;return e[15]!==p||e[16]!==c||e[17]!==d||e[18]!==x?(v=t.jsx(J,{children:t.jsx(Fe,{orgName:x,domain:c,claimDomain:p,logoUrl:d})}),e[15]=p,e[16]=c,e[17]=d,e[18]=x,e[19]=v):v=e[19],v}const l=w.isPending;let m;e[20]!==s?(m=se(s.trim()),e[20]=s,e[21]=m):m=e[21];const h=!!m,z=b.error||w.error||null;let S;e[22]!==n||e[23]!==h||e[24]!==w||e[25]!==b||e[26]!==g?(S=x=>{x.preventDefault(),h&&(g&&n?b.mutate():w.mutate())},e[22]=n,e[23]=h,e[24]=w,e[25]=b,e[26]=g,e[27]=S):S=e[27];const P=S;let O;e[28]===Symbol.for("react.memo_cache_sentinel")?(O=t.jsx(ie,{title:"Welcome to deco",description:"Set up your organization to get started"}),e[28]=O):O=e[28];let D;e[29]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-sm font-medium",children:"Organization avatar"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional"})]}),e[29]=D):D=e[29];let R;e[30]!==o||e[31]!==s?(R=(s.trim()||o||"?").charAt(0).toUpperCase(),e[30]=o,e[31]=s,e[32]=R):R=e[32];const Z=l||b.isPending;let F;e[33]!==d||e[34]!==R||e[35]!==Z?(F=t.jsxs("div",{className:"flex items-center justify-between gap-4 p-4",children:[D,t.jsx($e,{value:d,fallback:R,onChange:N,disabled:Z})]}),e[33]=d,e[34]=R,e[35]=Z,e[36]=F):F=e[36];let H;e[37]===Symbol.for("react.memo_cache_sentinel")?(H=t.jsx(ye,{htmlFor:"org-name",className:"text-sm font-medium shrink-0",children:"Organization name"}),e[37]=H):H=e[37];let Q;e[38]===Symbol.for("react.memo_cache_sentinel")?(Q=x=>j(x.target.value),e[38]=Q):Q=e[38];const ee=o||"My Organization",te=l||b.isPending;let M;e[39]!==s||e[40]!==ee||e[41]!==te?(M=t.jsxs("div",{className:"flex items-center justify-between gap-4 p-4",children:[H,t.jsx(je,{id:"org-name",value:s,onChange:Q,placeholder:ee,disabled:te,className:"h-10 max-w-[220px]"})]}),e[39]=s,e[40]=ee,e[41]=te,e[42]=M):M=e[42];let q;e[43]!==n||e[44]!==p||e[45]!==b.isPending||e[46]!==c||e[47]!==g||e[48]!==l?(q=g&&n&&t.jsxs("div",{className:"flex items-center justify-between gap-4 p-4",children:[t.jsxs("div",{className:"space-y-0.5",children:[t.jsxs("p",{className:"text-sm font-medium",children:["Allow @",c," sign-ups"]}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Anyone with a verified @",c," email can join this org"]})]}),t.jsx(ve,{checked:p,onCheckedChange:L,disabled:l||b.isPending})]}),e[43]=n,e[44]=p,e[45]=b.isPending,e[46]=c,e[47]=g,e[48]=l,e[49]=q):q=e[49];let U;e[50]!==F||e[51]!==M||e[52]!==q?(U=t.jsxs("div",{className:"rounded-xl card-shadow bg-background dark:bg-input/30 divide-y divide-border",children:[F,M,q]}),e[50]=F,e[51]=M,e[52]=q,e[53]=U):U=e[53];let T;e[54]!==z?(T=z&&t.jsx("p",{className:"text-xs text-destructive",children:z instanceof Error?z.message:"Failed to create organization"}),e[54]=z,e[55]=T):T=e[55];const ae=!h||l||b.isPending;let I;e[56]!==b.isPending||e[57]!==l?(I=l||b.isPending?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(X,{size:14,className:"animate-spin"})," Creating..."]}):"Continue",e[56]=b.isPending,e[57]=l,e[58]=I):I=e[58];let B;e[59]!==ae||e[60]!==I?(B=t.jsx(ce,{type:"submit",size:"xl",className:"w-full",disabled:ae,children:I}),e[59]=ae,e[60]=I,e[61]=B):B=e[61];let Y;e[62]!==r?(Y=r&&t.jsx("button",{type:"button",className:"text-sm text-muted-foreground hover:text-foreground transition-colors text-center",onClick:r,children:"See available organizations"}),e[62]=r,e[63]=Y):Y=e[63];let V;return e[64]!==P||e[65]!==U||e[66]!==T||e[67]!==B||e[68]!==Y?(V=t.jsx(J,{children:t.jsxs("form",{onSubmit:P,className:"grid gap-10",children:[O,U,T,B,Y]})}),e[64]=P,e[65]=U,e[66]=T,e[67]=B,e[68]=Y,e[69]=V):V=e[69],V}function $e(i){const e=K.c(14),{value:g,fallback:c,onChange:u,disabled:o}=i,a=E.useRef(null);let r;e[0]!==u?(r=L=>{const k=L.target.files?.[0];if(!k)return;if(k.size>2097152){me.error("Image must be smaller than 2MB"),a.current&&(a.current.value="");return}const C=new FileReader;C.onerror=De,C.onloadend=()=>{C.result&&u(C.result),a.current&&(a.current.value="")},C.readAsDataURL(k)},e[0]=u,e[1]=r):r=e[1];const n=r;let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=()=>a.current?.click(),e[2]=f):f=e[2];let s;e[3]!==o||e[4]!==n?(s=t.jsx("input",{ref:a,type:"file",accept:"image/*",onChange:n,className:"hidden",disabled:o}),e[3]=o,e[4]=n,e[5]=s):s=e[5];const j=g??void 0;let d;e[6]!==c||e[7]!==j?(d=t.jsx(de,{url:j,fallback:c,shape:"square",size:"base"}),e[6]=c,e[7]=j,e[8]=d):d=e[8];let N;e[9]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx("span",{className:"absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(Ce,{size:14,className:"text-white"})}),e[9]=N):N=e[9];let p;return e[10]!==o||e[11]!==s||e[12]!==d?(p=t.jsxs("button",{type:"button",onClick:f,disabled:o,className:"relative rounded-lg overflow-hidden ring-1 ring-border hover:ring-2 hover:ring-ring/40 transition-all disabled:opacity-50 group","aria-label":"Upload organization logo",children:[s,d,N]}),e[10]=o,e[11]=s,e[12]=d,e[13]=p):p=e[13],p}function De(){return me.error("Failed to read image")}const ue=[{icon:Ne,label:"Creating organization",claimOnly:!1},{icon:ze,label:"Claiming email domain",claimOnly:!0},{icon:Se,label:"Enabling auto-join for your team",claimOnly:!0},{icon:ke,label:"Extracting brand context",claimOnly:!1}],fe=1500,le=[{bg:"var(--brand-green-light)",fg:"var(--brand-green-dark)"},{bg:"var(--brand-purple-light)",fg:"var(--brand-purple-dark)"},{bg:"var(--brand-yellow-light)",fg:"var(--brand-yellow-dark)"}];function Fe({orgName:i,domain:e,claimDomain:g,logoUrl:c}){const u=ue.filter(n=>g||!n.claimOnly),[o,a]=E.useState(0),r=E.useRef(!1);if(!r.current){r.current=!0;for(let n=1;n<u.length;n++)setTimeout(()=>a(n),fe*n)}return t.jsxs("div",{className:"grid gap-10",children:[t.jsx(ie,{title:`Setting up ${i}`,description:`Getting everything ready from ${e}`,logoUrl:c??null,logoFallback:i.charAt(0).toUpperCase()||"?"}),t.jsx("ul",{className:"grid gap-5",children:u.map((n,f)=>{const s=n.icon,j=f===o,d=f<o,N=le[f%le.length];return t.jsxs("li",{className:"flex items-center gap-4 motion-safe:transition-opacity motion-safe:duration-300 motion-safe:ease-out",style:{opacity:d||j?1:.4},children:[t.jsxs("span",{className:W("relative grid h-8 w-8 shrink-0 place-items-center rounded-lg","motion-safe:transition-colors motion-safe:duration-300",!d&&(j?"bg-muted text-foreground":"bg-muted text-muted-foreground")),style:d?{backgroundColor:N.bg,color:N.fg}:void 0,children:[t.jsx(we,{size:16,className:W("absolute motion-safe:transition-all motion-safe:duration-300 motion-safe:ease-out",d?"scale-100 opacity-100":"scale-75 opacity-0"),"aria-hidden":"true"}),t.jsx(X,{size:16,className:W("absolute animate-spin","motion-safe:transition-opacity motion-safe:duration-200",j?"opacity-100":"opacity-0"),"aria-hidden":"true"}),t.jsx(s,{size:16,className:W("absolute motion-safe:transition-opacity motion-safe:duration-200",!d&&!j?"opacity-100":"opacity-0"),"aria-hidden":"true"})]}),t.jsx("span",{className:W("text-base leading-6 motion-safe:transition-colors motion-safe:duration-300",j||d?"text-foreground":"text-muted-foreground"),children:n.label})]},n.label)})})]})}export{Xe as default};
1
+ import{c as K,j as t,a as re,i as X,r as E,m as pe,K as he,B as ce,d as oe,l as W,t as me}from"./index-Dm8PN3sF.js";import{R as xe}from"./required-auth-layout-CtWEo2zO.js";import{A as J}from"./auth-split-layout-BuJmTwGZ.js";import{O as be}from"./organization-choice-5_6S_6zP.js";import{A as de}from"./avatar-OkMq9Zk7.js";import{I as je}from"./input-BSpKqXLN.js";import{L as ye}from"./label-Dpmg8kbt.js";import{S as ve}from"./switch-Dqjnq7F3.js";import{t as Ne,a as Se}from"./Users03-CK9WhDRZ.js";import{i as we}from"./CheckCircle-BSbIKmQs.js";import{t as ze}from"./Globe04-Cy2rfQz8.js";import{a as ke}from"./Palette-B_oTQul8.js";import{i as Ce}from"./Upload01-D7V1TLPg.js";import"./User01-DA8mg0ER.js";const _e=new Set(["gmail.com","googlemail.com","outlook.com","hotmail.com","live.com","yahoo.com","yahoo.co.uk","icloud.com","me.com","mac.com","aol.com","protonmail.com","proton.me","zoho.com","yandex.com","mail.com","gmx.com","gmx.net","tutanota.com","fastmail.com"]);function se(i){return i.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function Xe(){const i=K.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(xe,{children:t.jsx(Oe,{})}),i[0]=e):e=i[0],e}function ie(i){const e=K.c(13),{title:g,description:c,logoUrl:u,logoFallback:o}=i;let a;e[0]!==o||e[1]!==u?(a=t.jsx("div",{children:u?t.jsx(de,{url:u,fallback:o??"?",shape:"square",size:"base",className:"h-12 w-12"}):t.jsxs(t.Fragment,{children:[t.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12 dark:hidden"}),t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-12 w-12 hidden dark:block"})]})}),e[0]=o,e[1]=u,e[2]=a):a=e[2];let r;e[3]!==g?(r=t.jsx("h1",{className:"text-2xl font-medium leading-8",children:g}),e[3]=g,e[4]=r):r=e[4];let n;e[5]!==c?(n=t.jsx("p",{className:"text-base text-muted-foreground leading-6",children:c}),e[5]=c,e[6]=n):n=e[6];let f;e[7]!==r||e[8]!==n?(f=t.jsxs("div",{className:"space-y-2",children:[r,n]}),e[7]=r,e[8]=n,e[9]=f):f=e[9];let s;return e[10]!==a||e[11]!==f?(s=t.jsxs("div",{className:"grid gap-10",children:[a,f]}),e[10]=a,e[11]=f,e[12]=s):s=e[12],s}function Oe(){const i=K.c(4),{data:e,isPending:g}=re.useSession();if(g){let a;return i[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(J,{children:t.jsx("div",{className:"flex items-center gap-2",children:t.jsx(X,{size:14,className:"animate-spin text-muted-foreground"})})}),i[0]=a):a=i[0],a}const c=e?.user?.email??"",u=e?.user?.name;let o;return i[1]!==u||i[2]!==c?(o=t.jsx(Ee,{email:c,userName:u}),i[1]=u,i[2]=c,i[3]=o):o=i[3],o}function Ee(i){const e=K.c(54),{email:g,userName:c}=i;let u,o,a,r,n,f;if(e[0]!==g||e[1]!==c){a=g.split("@")[1]?.toLowerCase()??"",r=!!a&&!_e.has(a);const l=a.split(".")[0]??"";o=l.charAt(0).toUpperCase()+l.slice(1);let m;e[8]!==o||e[9]!==r||e[10]!==c?(m=r?o:c?.split(" ")[0]??"",e[8]=o,e[9]=r,e[10]=c,e[11]=m):m=e[11],u=m,f=pe,n=he.domainLookup(a),e[0]=g,e[1]=c,e[2]=u,e[3]=o,e[4]=a,e[5]=r,e[6]=n,e[7]=f}else u=e[2],o=e[3],a=e[4],r=e[5],n=e[6],f=e[7];let s;e[12]!==r||e[13]!==n?(s={queryKey:n,queryFn:Re,enabled:r},e[12]=r,e[13]=n,e[14]=s):s=e[14];const{data:j,isLoading:d,isError:N,refetch:p}=f(s);let L;e[15]===Symbol.for("react.memo_cache_sentinel")?(L=new Set,e[15]=L):L=e[15];const[k,C]=E.useState(L),[A,_]=E.useState(!1);if(d){let l;e[16]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(X,{size:14,className:"animate-spin text-muted-foreground"}),e[16]=l):l=e[16];let m;return e[17]!==a?(m=t.jsx(J,{children:t.jsxs("div",{className:"flex items-center gap-2 py-4",children:[l,t.jsxs("span",{className:"text-sm text-muted-foreground",children:["Checking ",a,"..."]})]})}),e[17]=a,e[18]=m):m=e[18],m}if(N){let l;e[19]!==a?(l=t.jsxs("span",{className:"text-sm text-muted-foreground",children:["Couldn't check ",a," for an existing organization."]}),e[19]=a,e[20]=l):l=e[20];let m;e[21]!==p?(m=t.jsx(ce,{variant:"outline",size:"sm",onClick:()=>p(),children:"Retry"}),e[21]=p,e[22]=m):m=e[22];let h;return e[23]!==l||e[24]!==m?(h=t.jsx(J,{children:t.jsxs("div",{className:"flex flex-col items-start gap-3 py-4",children:[l,m]})}),e[23]=l,e[24]=m,e[25]=h):h=e[25],h}let y,b;e[26]!==j?.organizations?(y=(j?.organizations??[]).flatMap(Pe),b=y.some(Ae),e[26]=j?.organizations,e[27]=y,e[28]=b):(y=e[27],b=e[28]);const $=b;if(A){let l;e[29]!==c?(l=c?.split(" ")[0]??"",e[29]=c,e[30]=l):l=e[30];let m;e[31]===Symbol.for("react.memo_cache_sentinel")?(m=()=>_(!1),e[31]=m):m=e[31];let h;return e[32]!==o||e[33]!==a||e[34]!==r||e[35]!==l?(h=t.jsx(ne,{isCorporateEmail:r,emailDomain:a,domainLabel:o,defaultName:l,allowDomainClaim:!1,onBack:m}),e[32]=o,e[33]=a,e[34]=r,e[35]=l,e[36]=h):h=e[36],h}if(y.length>0){const l=$?y.length===1?"You have access to an organization":"You have access to multiple organizations":"Request access to an organization",m=$?"Your email domain matches an existing organization.":"Your email domain matches an organization that requires admin approval to join.";let h;e[37]!==l||e[38]!==m?(h=t.jsx(ie,{title:l,description:m}),e[37]=l,e[38]=m,e[39]=h):h=e[39];let z;e[40]===Symbol.for("react.memo_cache_sentinel")?(z=D=>C(R=>new Set(R).add(D)),e[40]=z):z=e[40];let S;e[41]!==y||e[42]!==a||e[43]!==k?(S=t.jsx(be,{organizations:y,domain:a,requestedSlugs:k,onRequestedSlug:z,onJoined:Le}),e[41]=y,e[42]=a,e[43]=k,e[44]=S):S=e[44];let P;e[45]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx("button",{type:"button",className:"text-sm text-muted-foreground hover:text-foreground transition-colors text-center",onClick:()=>_(!0),children:"Create a new organization instead"}),e[45]=P):P=e[45];let O;return e[46]!==S||e[47]!==h?(O=t.jsx(J,{children:t.jsxs("div",{className:"grid gap-10",children:[h,S,P]})}),e[46]=S,e[47]=h,e[48]=O):O=e[48],O}let w;return e[49]!==u||e[50]!==o||e[51]!==a||e[52]!==r?(w=t.jsx(ne,{isCorporateEmail:r,emailDomain:a,domainLabel:o,defaultName:u}),e[49]=u,e[50]=o,e[51]=a,e[52]=r,e[53]=w):w=e[53],w}function Le(i,e){window.location.href=`/${e}`}function Ae(i){return i.joinMode==="auto"}function Pe(i){return i.joinMode==="auto"||i.joinMode==="request"?[{id:i.id,name:i.name,slug:i.slug,logo:i.logo,joinMode:i.joinMode}]:[]}async function Re(){const i=await fetch("/api/auth/custom/domain-lookup",{credentials:"include"});if(!i.ok)throw new Error(`Failed to look up domain (${i.status})`);return i.json()}function ne(i){const e=K.c(70),{isCorporateEmail:g,emailDomain:c,domainLabel:u,defaultName:o,allowDomainClaim:a,onBack:r}=i,n=a===void 0?!0:a,f=g&&n?`https://www.google.com/s2/favicons?domain=${c}&sz=128`:null,[s,j]=E.useState(o),[d,N]=E.useState(f),[p,L]=E.useState(!0),[k,C]=E.useState(null);let A;e[0]!==p||e[1]!==d||e[2]!==s?(A=async()=>{const x=await fetch("/api/auth/custom/domain-setup",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s.trim()||void 0,logo:d??void 0,claimDomain:p})}),v=await x.json();if(!x.ok||!v.success)throw new Error(v.error||"Failed to set up organization");return v},e[0]=p,e[1]=d,e[2]=s,e[3]=A):A=e[3];let _;e[4]!==p?(_=x=>{if(!x.slug)return;const v=ue.filter(ge=>p||!ge.claimOnly).length,G=fe*(v-1)+800;C(x.slug),setTimeout(()=>{window.location.href=`/${x.slug}`},G)},e[4]=p,e[5]=_):_=e[5];let y;e[6]!==A||e[7]!==_?(y={mutationFn:A,onSuccess:_},e[6]=A,e[7]=_,e[8]=y):y=e[8];const b=oe(y);let $;e[9]!==d||e[10]!==s?($={mutationFn:async()=>{const x=s.trim(),v=se(x);if(!v)throw new Error("Invalid organization name");const G=await re.organization.create({name:x,slug:v,...d?{logo:d}:{}});if(G?.error)throw new Error(G.error.message||"Failed to create organization");window.location.href=`/${G?.data?.slug??v}`}},e[9]=d,e[10]=s,e[11]=$):$=e[11];const w=oe($);if(b.isPending||k){let x;e[12]!==u||e[13]!==s?(x=s.trim()||u,e[12]=u,e[13]=s,e[14]=x):x=e[14];let v;return e[15]!==p||e[16]!==c||e[17]!==d||e[18]!==x?(v=t.jsx(J,{children:t.jsx(Fe,{orgName:x,domain:c,claimDomain:p,logoUrl:d})}),e[15]=p,e[16]=c,e[17]=d,e[18]=x,e[19]=v):v=e[19],v}const l=w.isPending;let m;e[20]!==s?(m=se(s.trim()),e[20]=s,e[21]=m):m=e[21];const h=!!m,z=b.error||w.error||null;let S;e[22]!==n||e[23]!==h||e[24]!==w||e[25]!==b||e[26]!==g?(S=x=>{x.preventDefault(),h&&(g&&n?b.mutate():w.mutate())},e[22]=n,e[23]=h,e[24]=w,e[25]=b,e[26]=g,e[27]=S):S=e[27];const P=S;let O;e[28]===Symbol.for("react.memo_cache_sentinel")?(O=t.jsx(ie,{title:"Welcome to deco",description:"Set up your organization to get started"}),e[28]=O):O=e[28];let D;e[29]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-sm font-medium",children:"Organization avatar"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional"})]}),e[29]=D):D=e[29];let R;e[30]!==o||e[31]!==s?(R=(s.trim()||o||"?").charAt(0).toUpperCase(),e[30]=o,e[31]=s,e[32]=R):R=e[32];const Z=l||b.isPending;let F;e[33]!==d||e[34]!==R||e[35]!==Z?(F=t.jsxs("div",{className:"flex items-center justify-between gap-4 p-4",children:[D,t.jsx($e,{value:d,fallback:R,onChange:N,disabled:Z})]}),e[33]=d,e[34]=R,e[35]=Z,e[36]=F):F=e[36];let H;e[37]===Symbol.for("react.memo_cache_sentinel")?(H=t.jsx(ye,{htmlFor:"org-name",className:"text-sm font-medium shrink-0",children:"Organization name"}),e[37]=H):H=e[37];let Q;e[38]===Symbol.for("react.memo_cache_sentinel")?(Q=x=>j(x.target.value),e[38]=Q):Q=e[38];const ee=o||"My Organization",te=l||b.isPending;let M;e[39]!==s||e[40]!==ee||e[41]!==te?(M=t.jsxs("div",{className:"flex items-center justify-between gap-4 p-4",children:[H,t.jsx(je,{id:"org-name",value:s,onChange:Q,placeholder:ee,disabled:te,className:"h-10 max-w-[220px]"})]}),e[39]=s,e[40]=ee,e[41]=te,e[42]=M):M=e[42];let q;e[43]!==n||e[44]!==p||e[45]!==b.isPending||e[46]!==c||e[47]!==g||e[48]!==l?(q=g&&n&&t.jsxs("div",{className:"flex items-center justify-between gap-4 p-4",children:[t.jsxs("div",{className:"space-y-0.5",children:[t.jsxs("p",{className:"text-sm font-medium",children:["Allow @",c," sign-ups"]}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Anyone with a verified @",c," email can join this org"]})]}),t.jsx(ve,{checked:p,onCheckedChange:L,disabled:l||b.isPending})]}),e[43]=n,e[44]=p,e[45]=b.isPending,e[46]=c,e[47]=g,e[48]=l,e[49]=q):q=e[49];let U;e[50]!==F||e[51]!==M||e[52]!==q?(U=t.jsxs("div",{className:"rounded-xl card-shadow bg-background dark:bg-input/30 divide-y divide-border",children:[F,M,q]}),e[50]=F,e[51]=M,e[52]=q,e[53]=U):U=e[53];let T;e[54]!==z?(T=z&&t.jsx("p",{className:"text-xs text-destructive",children:z instanceof Error?z.message:"Failed to create organization"}),e[54]=z,e[55]=T):T=e[55];const ae=!h||l||b.isPending;let I;e[56]!==b.isPending||e[57]!==l?(I=l||b.isPending?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(X,{size:14,className:"animate-spin"})," Creating..."]}):"Continue",e[56]=b.isPending,e[57]=l,e[58]=I):I=e[58];let B;e[59]!==ae||e[60]!==I?(B=t.jsx(ce,{type:"submit",size:"xl",className:"w-full",disabled:ae,children:I}),e[59]=ae,e[60]=I,e[61]=B):B=e[61];let Y;e[62]!==r?(Y=r&&t.jsx("button",{type:"button",className:"text-sm text-muted-foreground hover:text-foreground transition-colors text-center",onClick:r,children:"See available organizations"}),e[62]=r,e[63]=Y):Y=e[63];let V;return e[64]!==P||e[65]!==U||e[66]!==T||e[67]!==B||e[68]!==Y?(V=t.jsx(J,{children:t.jsxs("form",{onSubmit:P,className:"grid gap-10",children:[O,U,T,B,Y]})}),e[64]=P,e[65]=U,e[66]=T,e[67]=B,e[68]=Y,e[69]=V):V=e[69],V}function $e(i){const e=K.c(14),{value:g,fallback:c,onChange:u,disabled:o}=i,a=E.useRef(null);let r;e[0]!==u?(r=L=>{const k=L.target.files?.[0];if(!k)return;if(k.size>2097152){me.error("Image must be smaller than 2MB"),a.current&&(a.current.value="");return}const C=new FileReader;C.onerror=De,C.onloadend=()=>{C.result&&u(C.result),a.current&&(a.current.value="")},C.readAsDataURL(k)},e[0]=u,e[1]=r):r=e[1];const n=r;let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=()=>a.current?.click(),e[2]=f):f=e[2];let s;e[3]!==o||e[4]!==n?(s=t.jsx("input",{ref:a,type:"file",accept:"image/*",onChange:n,className:"hidden",disabled:o}),e[3]=o,e[4]=n,e[5]=s):s=e[5];const j=g??void 0;let d;e[6]!==c||e[7]!==j?(d=t.jsx(de,{url:j,fallback:c,shape:"square",size:"base"}),e[6]=c,e[7]=j,e[8]=d):d=e[8];let N;e[9]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx("span",{className:"absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(Ce,{size:14,className:"text-white"})}),e[9]=N):N=e[9];let p;return e[10]!==o||e[11]!==s||e[12]!==d?(p=t.jsxs("button",{type:"button",onClick:f,disabled:o,className:"relative rounded-lg overflow-hidden ring-1 ring-border hover:ring-2 hover:ring-ring/40 transition-all disabled:opacity-50 group","aria-label":"Upload organization logo",children:[s,d,N]}),e[10]=o,e[11]=s,e[12]=d,e[13]=p):p=e[13],p}function De(){return me.error("Failed to read image")}const ue=[{icon:Ne,label:"Creating organization",claimOnly:!1},{icon:ze,label:"Claiming email domain",claimOnly:!0},{icon:Se,label:"Enabling auto-join for your team",claimOnly:!0},{icon:ke,label:"Extracting brand context",claimOnly:!1}],fe=1500,le=[{bg:"var(--brand-green-light)",fg:"var(--brand-green-dark)"},{bg:"var(--brand-purple-light)",fg:"var(--brand-purple-dark)"},{bg:"var(--brand-yellow-light)",fg:"var(--brand-yellow-dark)"}];function Fe({orgName:i,domain:e,claimDomain:g,logoUrl:c}){const u=ue.filter(n=>g||!n.claimOnly),[o,a]=E.useState(0),r=E.useRef(!1);if(!r.current){r.current=!0;for(let n=1;n<u.length;n++)setTimeout(()=>a(n),fe*n)}return t.jsxs("div",{className:"grid gap-10",children:[t.jsx(ie,{title:`Setting up ${i}`,description:`Getting everything ready from ${e}`,logoUrl:c??null,logoFallback:i.charAt(0).toUpperCase()||"?"}),t.jsx("ul",{className:"grid gap-5",children:u.map((n,f)=>{const s=n.icon,j=f===o,d=f<o,N=le[f%le.length];return t.jsxs("li",{className:"flex items-center gap-4 motion-safe:transition-opacity motion-safe:duration-300 motion-safe:ease-out",style:{opacity:d||j?1:.4},children:[t.jsxs("span",{className:W("relative grid h-8 w-8 shrink-0 place-items-center rounded-lg","motion-safe:transition-colors motion-safe:duration-300",!d&&(j?"bg-muted text-foreground":"bg-muted text-muted-foreground")),style:d?{backgroundColor:N.bg,color:N.fg}:void 0,children:[t.jsx(we,{size:16,className:W("absolute motion-safe:transition-all motion-safe:duration-300 motion-safe:ease-out",d?"scale-100 opacity-100":"scale-75 opacity-0"),"aria-hidden":"true"}),t.jsx(X,{size:16,className:W("absolute animate-spin","motion-safe:transition-opacity motion-safe:duration-200",j?"opacity-100":"opacity-0"),"aria-hidden":"true"}),t.jsx(s,{size:16,className:W("absolute motion-safe:transition-opacity motion-safe:duration-200",!d&&!j?"opacity-100":"opacity-0"),"aria-hidden":"true"})]}),t.jsx("span",{className:W("text-base leading-6 motion-safe:transition-colors motion-safe:duration-300",j||d?"text-foreground":"text-muted-foreground"),children:n.label})]},n.label)})})]})}export{Xe as default};
@@ -1 +1 @@
1
- import{c as k,r as z,b1 as S,e as _,q as E,b2 as T,j as o,L as $}from"./index-DGQdC8j6.js";const L="#f6f4ed",P="#ffffff",H=[{src:"/icons/icon-192.png",sizes:"192x192",type:"image/png"},{src:"/icons/icon-512.png",sizes:"512x512",type:"image/png"}];function R(e,n){const t=`${n}/${e.slug}`,i=[...e.logo?[{src:e.logo,sizes:"192x192",purpose:"any"},{src:e.logo,sizes:"512x512",purpose:"any"},{src:e.logo,sizes:"any",purpose:"any"}]:[],...H],l={id:t,name:e.name,short_name:e.name,start_url:t,scope:t,display:"standalone",display_override:["window-controls-overlay"],background_color:P,theme_color:L,icons:i};return`data:application/manifest+json,${encodeURIComponent(JSON.stringify(l))}`}function O(e){const n=document.querySelector(`link[rel="${e}"]`);if(n)return n;const t=document.createElement("link");return t.rel=e,document.head.appendChild(t),t}function U(e){const n=document.querySelector(`meta[name="${e}"]`);if(n)return n;const t=document.createElement("meta");return t.name=e,document.head.appendChild(t),t}function M(e){const n=k.c(5),t=e?.name??"",i=e?.slug??"",l=e?.logo??"";let a,c;n[0]!==l||n[1]!==t||n[2]!==i?(a=()=>{if(!i||!t||typeof document>"u"||typeof window>"u")return;const d=O("manifest"),m=O("apple-touch-icon"),u=U("apple-mobile-web-app-title"),r={manifest:d.getAttribute("href"),appleIcon:m.getAttribute("href"),appleTitle:u.getAttribute("content"),title:document.title};return d.setAttribute("href",R({name:t,slug:i,logo:l||null},window.location.origin)),l&&m.setAttribute("href",l),u.setAttribute("content",t),document.title=t,S(),()=>{r.manifest!==null&&d.setAttribute("href",r.manifest),r.appleIcon!==null&&m.setAttribute("href",r.appleIcon),r.appleTitle!==null&&u.setAttribute("content",r.appleTitle),document.title=r.title,S()}},c=[t,i,l],n[0]=l,n[1]=t,n[2]=i,n[3]=a,n[4]=c):(a=n[3],c=n[4]),z.useLayoutEffect(a,c)}function D(){const e=k.c(31);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},e[0]=n):n=e[0];const{org:t}=_(n),{data:i}=E();let l;e[1]!==i||e[2]!==t?(l=i?.find(N=>N.slug===t),e[1]=i,e[2]=t,e[3]=l):l=e[3];const a=l;let c;e[4]!==a?(c=a?{name:a.name,slug:a.slug,logo:a.logo??null}:null,e[4]=a,e[5]=c):c=e[5],M(c);const{canPrompt:d,installed:m,ios:u,promptInstall:r}=T(),[y,w]=z.useState(null),s=a?.name??"this organization",C=a?.logo;let b;e[6]!==s||e[7]!==r?(b=async()=>{const N=await r();w(N==="accepted"?`Installing ${s}…`:N==="dismissed"?"Install dismissed.":null)},e[6]=s,e[7]=r,e[8]=b):b=e[8];const A=b,I=C||"/icons/icon-192.png";let p;e[9]!==s||e[10]!==I?(p=o.jsx("img",{src:I,alt:s,className:"size-20 rounded-2xl border border-border/50 object-cover"}),e[9]=s,e[10]=I,e[11]=p):p=e[11];let f;e[12]!==s?(f=o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs("h1",{className:"text-xl font-semibold text-foreground",children:["Add ",s," to your Home Screen"]}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Install ",s," as its own app — a standalone window that opens straight into this organization. To install the full deco Studio app instead, use your browser's “Add to Home Screen” from any other page."]})]}),e[12]=s,e[13]=f):f=e[13];let g;e[14]!==d||e[15]!==A||e[16]!==m||e[17]!==u||e[18]!==s||e[19]!==y?(g=m?o.jsxs("p",{className:"rounded-lg bg-muted px-4 py-3 text-sm text-foreground",children:[s," is already installed on this device."]}):u?o.jsxs("div",{className:"flex flex-col gap-2 rounded-lg bg-muted px-4 py-3 text-sm text-foreground",children:[o.jsx("p",{className:"font-medium",children:"Install on iOS"}),o.jsxs("p",{className:"text-muted-foreground",children:["Tap the ",o.jsx("span",{className:"font-medium",children:"Share"})," button, then choose ",o.jsx("span",{className:"font-medium",children:"Add to Home Screen"}),"."]})]}):d?o.jsxs("div",{className:"flex flex-col items-center gap-3",children:[o.jsxs("button",{type:"button",onClick:A,className:"rounded-lg bg-primary px-5 py-2.5 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90",children:["Add ",s," to Home Screen"]}),y&&o.jsx("p",{className:"text-sm text-muted-foreground",children:y})]}):o.jsxs("p",{className:"rounded-lg bg-muted px-4 py-3 text-sm text-muted-foreground",children:["To install, open your browser's menu and choose"," ",o.jsxs("span",{className:"font-medium text-foreground",children:["Install ",s]})," ","(or “Add to Home Screen”). If you don't see it yet, interact with the app for a moment and try again."]}),e[14]=d,e[15]=A,e[16]=m,e[17]=u,e[18]=s,e[19]=y,e[20]=g):g=e[20];const v=t??"";let x;e[21]!==v?(x={org:v},e[21]=v,e[22]=x):x=e[22];let h;e[23]!==s||e[24]!==x?(h=o.jsxs($,{to:"/$org",params:x,className:"text-sm text-primary hover:underline",replace:!0,children:["Back to ",s]}),e[23]=s,e[24]=x,e[25]=h):h=e[25];let j;return e[26]!==h||e[27]!==p||e[28]!==f||e[29]!==g?(j=o.jsx("div",{className:"flex min-h-dvh items-center justify-center bg-background p-6",children:o.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-6 text-center",children:[p,f,g,h]})}),e[26]=h,e[27]=p,e[28]=f,e[29]=g,e[30]=j):j=e[30],j}export{D as default};
1
+ import{c as k,r as z,b1 as S,e as _,q as E,b2 as T,j as o,L as $}from"./index-Dm8PN3sF.js";const L="#f6f4ed",P="#ffffff",H=[{src:"/icons/icon-192.png",sizes:"192x192",type:"image/png"},{src:"/icons/icon-512.png",sizes:"512x512",type:"image/png"}];function R(e,n){const t=`${n}/${e.slug}`,i=[...e.logo?[{src:e.logo,sizes:"192x192",purpose:"any"},{src:e.logo,sizes:"512x512",purpose:"any"},{src:e.logo,sizes:"any",purpose:"any"}]:[],...H],l={id:t,name:e.name,short_name:e.name,start_url:t,scope:t,display:"standalone",display_override:["window-controls-overlay"],background_color:P,theme_color:L,icons:i};return`data:application/manifest+json,${encodeURIComponent(JSON.stringify(l))}`}function O(e){const n=document.querySelector(`link[rel="${e}"]`);if(n)return n;const t=document.createElement("link");return t.rel=e,document.head.appendChild(t),t}function U(e){const n=document.querySelector(`meta[name="${e}"]`);if(n)return n;const t=document.createElement("meta");return t.name=e,document.head.appendChild(t),t}function M(e){const n=k.c(5),t=e?.name??"",i=e?.slug??"",l=e?.logo??"";let a,c;n[0]!==l||n[1]!==t||n[2]!==i?(a=()=>{if(!i||!t||typeof document>"u"||typeof window>"u")return;const d=O("manifest"),m=O("apple-touch-icon"),u=U("apple-mobile-web-app-title"),r={manifest:d.getAttribute("href"),appleIcon:m.getAttribute("href"),appleTitle:u.getAttribute("content"),title:document.title};return d.setAttribute("href",R({name:t,slug:i,logo:l||null},window.location.origin)),l&&m.setAttribute("href",l),u.setAttribute("content",t),document.title=t,S(),()=>{r.manifest!==null&&d.setAttribute("href",r.manifest),r.appleIcon!==null&&m.setAttribute("href",r.appleIcon),r.appleTitle!==null&&u.setAttribute("content",r.appleTitle),document.title=r.title,S()}},c=[t,i,l],n[0]=l,n[1]=t,n[2]=i,n[3]=a,n[4]=c):(a=n[3],c=n[4]),z.useLayoutEffect(a,c)}function D(){const e=k.c(31);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},e[0]=n):n=e[0];const{org:t}=_(n),{data:i}=E();let l;e[1]!==i||e[2]!==t?(l=i?.find(N=>N.slug===t),e[1]=i,e[2]=t,e[3]=l):l=e[3];const a=l;let c;e[4]!==a?(c=a?{name:a.name,slug:a.slug,logo:a.logo??null}:null,e[4]=a,e[5]=c):c=e[5],M(c);const{canPrompt:d,installed:m,ios:u,promptInstall:r}=T(),[y,w]=z.useState(null),s=a?.name??"this organization",C=a?.logo;let b;e[6]!==s||e[7]!==r?(b=async()=>{const N=await r();w(N==="accepted"?`Installing ${s}…`:N==="dismissed"?"Install dismissed.":null)},e[6]=s,e[7]=r,e[8]=b):b=e[8];const A=b,I=C||"/icons/icon-192.png";let p;e[9]!==s||e[10]!==I?(p=o.jsx("img",{src:I,alt:s,className:"size-20 rounded-2xl border border-border/50 object-cover"}),e[9]=s,e[10]=I,e[11]=p):p=e[11];let f;e[12]!==s?(f=o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs("h1",{className:"text-xl font-semibold text-foreground",children:["Add ",s," to your Home Screen"]}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Install ",s," as its own app — a standalone window that opens straight into this organization. To install the full deco Studio app instead, use your browser's “Add to Home Screen” from any other page."]})]}),e[12]=s,e[13]=f):f=e[13];let g;e[14]!==d||e[15]!==A||e[16]!==m||e[17]!==u||e[18]!==s||e[19]!==y?(g=m?o.jsxs("p",{className:"rounded-lg bg-muted px-4 py-3 text-sm text-foreground",children:[s," is already installed on this device."]}):u?o.jsxs("div",{className:"flex flex-col gap-2 rounded-lg bg-muted px-4 py-3 text-sm text-foreground",children:[o.jsx("p",{className:"font-medium",children:"Install on iOS"}),o.jsxs("p",{className:"text-muted-foreground",children:["Tap the ",o.jsx("span",{className:"font-medium",children:"Share"})," button, then choose ",o.jsx("span",{className:"font-medium",children:"Add to Home Screen"}),"."]})]}):d?o.jsxs("div",{className:"flex flex-col items-center gap-3",children:[o.jsxs("button",{type:"button",onClick:A,className:"rounded-lg bg-primary px-5 py-2.5 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90",children:["Add ",s," to Home Screen"]}),y&&o.jsx("p",{className:"text-sm text-muted-foreground",children:y})]}):o.jsxs("p",{className:"rounded-lg bg-muted px-4 py-3 text-sm text-muted-foreground",children:["To install, open your browser's menu and choose"," ",o.jsxs("span",{className:"font-medium text-foreground",children:["Install ",s]})," ","(or “Add to Home Screen”). If you don't see it yet, interact with the app for a moment and try again."]}),e[14]=d,e[15]=A,e[16]=m,e[17]=u,e[18]=s,e[19]=y,e[20]=g):g=e[20];const v=t??"";let x;e[21]!==v?(x={org:v},e[21]=v,e[22]=x):x=e[22];let h;e[23]!==s||e[24]!==x?(h=o.jsxs($,{to:"/$org",params:x,className:"text-sm text-primary hover:underline",replace:!0,children:["Back to ",s]}),e[23]=s,e[24]=x,e[25]=h):h=e[25];let j;return e[26]!==h||e[27]!==p||e[28]!==f||e[29]!==g?(j=o.jsx("div",{className:"flex min-h-dvh items-center justify-center bg-background p-6",children:o.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-6 text-center",children:[p,f,g,h]})}),e[26]=h,e[27]=p,e[28]=f,e[29]=g,e[30]=j):j=e[30],j}export{D as default};
@@ -1 +1 @@
1
- import{c as o,j as r,O as s}from"./index-DGQdC8j6.js";function c(){const e=o.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=r.jsx(s,{}),e[0]=t):t=e[0],t}export{c as default};
1
+ import{c as o,j as r,O as s}from"./index-Dm8PN3sF.js";function c(){const e=o.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=r.jsx(s,{}),e[0]=t):t=e[0],t}export{c as default};
@@ -1 +1 @@
1
- import{c as T,r as U,d as F,j as t,B as J,i as O}from"./index-DGQdC8j6.js";import{A as $}from"./avatar-BumqAYVV.js";async function P(l,e,f){const i=await fetch(l,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({organizationSlug:e})}),r=await i.json();if(!i.ok||!r.success)throw new Error(r.error||f);return r}function K(l){const e=T.c(41),{organizations:f,domain:i,requestedSlugs:r,onRequestedSlug:k,onSelected:p,onJoined:c,onRequestCompleted:y,selectLabel:E}=l,h=E===void 0?"Select":E;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=new Set,e[0]=b):b=e[0];const[M,A]=U.useState(b);let w;e[1]!==k?(w=o=>{A(s=>new Set(s).add(o)),k?.(o)},e[1]=k,e[2]=w):w=e[2];const _=w;let N;e[3]!==c?(N={mutationFn:G,onSuccess:o=>{const{organization:s,slug:x}=o;c?.(s,x)}},e[3]=c,e[4]=N):N=e[4];const n=F(N);let R;e[5]!==_||e[6]!==c||e[7]!==y?(R={mutationFn:D,onSuccess:o=>{const{organization:s,slug:x,alreadyMember:C}=o;if(C&&x){c?.(s,x);return}_(s.slug),y?.(s)}},e[5]=_,e[6]=c,e[7]=y,e[8]=R):R=e[8];const a=F(R);let u;e[9]!==r?(u=r??[],e[9]=r,e[10]=u):u=e[10];let v;e[11]!==M||e[12]!==u?(v=new Set([...u,...M]),e[11]=M,e[12]=u,e[13]=v):v=e[13];const j=v,q=n.variables?.slug??null,S=a.variables?.slug??null;let d;if(e[14]!==i||e[15]!==j||e[16]!==n||e[17]!==p||e[18]!==f||e[19]!==q||e[20]!==S||e[21]!==a||e[22]!==h){let o;e[24]!==i||e[25]!==j||e[26]!==n||e[27]!==p||e[28]!==q||e[29]!==S||e[30]!==a||e[31]!==h?(o=s=>{const x=n.isPending&&q===s.slug,C=a.isPending&&S===s.slug,L=j.has(s.slug),B=s.logo??(i?`https://www.google.com/s2/favicons?domain=${i}&sz=128`:null);return t.jsxs("div",{className:"rounded-xl card-shadow bg-background dark:bg-input/30 p-4 flex items-center gap-4",children:[t.jsx($,{url:B??void 0,fallback:s.name.charAt(0).toUpperCase(),shape:"square",size:"base",className:"h-10 w-10 shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:s.name}),i&&t.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:["@",i]})]}),s.joinMode==="auto"?t.jsx(J,{size:"default",onClick:()=>n.mutate(s),disabled:n.isPending,children:x?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(O,{size:14,className:"animate-spin"})," Joining..."]}):"Join"}):s.joinMode==="request"?L?t.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Request sent"}):t.jsx(J,{size:"default",variant:"outline",onClick:()=>a.mutate(s),disabled:a.isPending,children:C?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(O,{size:14,className:"animate-spin"})," ","Requesting..."]}):"Request to join"}):t.jsx(J,{size:"default",onClick:()=>p?.(s),children:h})]},s.id)},e[24]=i,e[25]=j,e[26]=n,e[27]=p,e[28]=q,e[29]=S,e[30]=a,e[31]=h,e[32]=o):o=e[32],d=f.map(o),e[14]=i,e[15]=j,e[16]=n,e[17]=p,e[18]=f,e[19]=q,e[20]=S,e[21]=a,e[22]=h,e[23]=d}else d=e[23];let m;e[33]!==n.error?(m=n.error&&t.jsx("p",{className:"text-xs text-destructive",role:"alert",children:n.error instanceof Error?n.error.message:"Failed to join organization"}),e[33]=n.error,e[34]=m):m=e[34];let g;e[35]!==a.error?(g=a.error&&t.jsx("p",{className:"text-xs text-destructive",role:"alert",children:a.error instanceof Error?a.error.message:"Failed to request access"}),e[35]=a.error,e[36]=g):g=e[36];let z;return e[37]!==g||e[38]!==d||e[39]!==m?(z=t.jsxs("div",{className:"grid grid-cols-1 gap-2",children:[d,m,g]}),e[37]=g,e[38]=d,e[39]=m,e[40]=z):z=e[40],z}async function D(l){const e=await P("/api/auth/custom/domain-request-join",l.slug,"Failed to request access");return{organization:l,slug:e.slug,alreadyMember:e.alreadyMember}}async function G(l){const e=await P("/api/auth/custom/domain-join",l.slug,"Failed to join organization");return{organization:l,slug:e.slug??l.slug}}export{K as O};
1
+ import{c as T,r as U,d as F,j as t,B as J,i as O}from"./index-Dm8PN3sF.js";import{A as $}from"./avatar-OkMq9Zk7.js";async function P(l,e,f){const i=await fetch(l,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({organizationSlug:e})}),r=await i.json();if(!i.ok||!r.success)throw new Error(r.error||f);return r}function K(l){const e=T.c(41),{organizations:f,domain:i,requestedSlugs:r,onRequestedSlug:k,onSelected:p,onJoined:c,onRequestCompleted:y,selectLabel:E}=l,h=E===void 0?"Select":E;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=new Set,e[0]=b):b=e[0];const[M,A]=U.useState(b);let w;e[1]!==k?(w=o=>{A(s=>new Set(s).add(o)),k?.(o)},e[1]=k,e[2]=w):w=e[2];const _=w;let N;e[3]!==c?(N={mutationFn:G,onSuccess:o=>{const{organization:s,slug:x}=o;c?.(s,x)}},e[3]=c,e[4]=N):N=e[4];const n=F(N);let R;e[5]!==_||e[6]!==c||e[7]!==y?(R={mutationFn:D,onSuccess:o=>{const{organization:s,slug:x,alreadyMember:C}=o;if(C&&x){c?.(s,x);return}_(s.slug),y?.(s)}},e[5]=_,e[6]=c,e[7]=y,e[8]=R):R=e[8];const a=F(R);let u;e[9]!==r?(u=r??[],e[9]=r,e[10]=u):u=e[10];let v;e[11]!==M||e[12]!==u?(v=new Set([...u,...M]),e[11]=M,e[12]=u,e[13]=v):v=e[13];const j=v,q=n.variables?.slug??null,S=a.variables?.slug??null;let d;if(e[14]!==i||e[15]!==j||e[16]!==n||e[17]!==p||e[18]!==f||e[19]!==q||e[20]!==S||e[21]!==a||e[22]!==h){let o;e[24]!==i||e[25]!==j||e[26]!==n||e[27]!==p||e[28]!==q||e[29]!==S||e[30]!==a||e[31]!==h?(o=s=>{const x=n.isPending&&q===s.slug,C=a.isPending&&S===s.slug,L=j.has(s.slug),B=s.logo??(i?`https://www.google.com/s2/favicons?domain=${i}&sz=128`:null);return t.jsxs("div",{className:"rounded-xl card-shadow bg-background dark:bg-input/30 p-4 flex items-center gap-4",children:[t.jsx($,{url:B??void 0,fallback:s.name.charAt(0).toUpperCase(),shape:"square",size:"base",className:"h-10 w-10 shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:s.name}),i&&t.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:["@",i]})]}),s.joinMode==="auto"?t.jsx(J,{size:"default",onClick:()=>n.mutate(s),disabled:n.isPending,children:x?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(O,{size:14,className:"animate-spin"})," Joining..."]}):"Join"}):s.joinMode==="request"?L?t.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Request sent"}):t.jsx(J,{size:"default",variant:"outline",onClick:()=>a.mutate(s),disabled:a.isPending,children:C?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(O,{size:14,className:"animate-spin"})," ","Requesting..."]}):"Request to join"}):t.jsx(J,{size:"default",onClick:()=>p?.(s),children:h})]},s.id)},e[24]=i,e[25]=j,e[26]=n,e[27]=p,e[28]=q,e[29]=S,e[30]=a,e[31]=h,e[32]=o):o=e[32],d=f.map(o),e[14]=i,e[15]=j,e[16]=n,e[17]=p,e[18]=f,e[19]=q,e[20]=S,e[21]=a,e[22]=h,e[23]=d}else d=e[23];let m;e[33]!==n.error?(m=n.error&&t.jsx("p",{className:"text-xs text-destructive",role:"alert",children:n.error instanceof Error?n.error.message:"Failed to join organization"}),e[33]=n.error,e[34]=m):m=e[34];let g;e[35]!==a.error?(g=a.error&&t.jsx("p",{className:"text-xs text-destructive",role:"alert",children:a.error instanceof Error?a.error.message:"Failed to request access"}),e[35]=a.error,e[36]=g):g=e[36];let z;return e[37]!==g||e[38]!==d||e[39]!==m?(z=t.jsxs("div",{className:"grid grid-cols-1 gap-2",children:[d,m,g]}),e[37]=g,e[38]=d,e[39]=m,e[40]=z):z=e[40],z}async function D(l){const e=await P("/api/auth/custom/domain-request-join",l.slug,"Failed to request access");return{organization:l,slug:e.slug,alreadyMember:e.alreadyMember}}async function G(l){const e=await P("/api/auth/custom/domain-join",l.slug,"Failed to join organization");return{organization:l,slug:e.slug??l.slug}}export{K as O};
@@ -1 +1 @@
1
- import{c as I,r as O,m as K,j as s,K as R,n as M,d as Q,B as L,t as k}from"./index-DGQdC8j6.js";import{P as T}from"./index-qg-bT8JA.js";import{C as V}from"./collection-table-wrapper-DPtPbXkO.js";import{E as $}from"./empty-state-LUctNkh2.js";import{S as U}from"./search-input-B0lumlG7.js";import{I as H}from"./input-DwWe5Hqk.js";import{L as J}from"./label-DdsuSm6M.js";import{u as W}from"./use-debounced-value-CMoeorqx.js";import{D as Y,a as G,b as X,c as Z,d as ee,e as te}from"./dialog-hBUfi5DB.js";import{S as se,a as ie,b as ae,c as ne,d as re}from"./select-vVirKMnE.js";import{a as q}from"./admin-fetch-CCSvjTk1.js";import{f as le}from"./format-time-BnbuEtat.js";import"./sidebar-C_llE2r0.js";import"./LayoutLeft-DPtsS7J4.js";import"./use-mobile-DVuyUrh-.js";import"./X-Bs0u_0yh.js";import"./tooltip-CO1zVhUs.js";import"./table-DqN44BtI.js";import"./ArrowUp-OqBYOpu3.js";import"./SearchMd-Di7fRkvt.js";import"./Check-Oxo5mPeL.js";import"./ChevronDown-DCZlSvzQ.js";import"./ChevronUp-BXrO8J56.js";import"./differenceInSeconds-NQ4PDo0z.js";const oe=["owner","admin","user"];function me(t){const e=I.c(49),{org:l}=t,[g,n]=O.useState(!1),[a,p]=O.useState(""),[o,S]=O.useState("user"),x=M();let u;e[0]!==a||e[1]!==l.id||e[2]!==o?(u=()=>q(`/api/_admin/orgs/${l.id}/members`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:a.trim(),role:o})}),e[0]=a,e[1]=l.id,e[2]=o,e[3]=u):u=e[3];let m;e[4]!==a||e[5]!==l.name||e[6]!==x?(m=()=>{k.success(`Added ${a.trim()} to ${l.name}`),x.invalidateQueries({queryKey:R.deploymentAdminOrgsList()}),n(!1),p(""),S("user")},e[4]=a,e[5]=l.name,e[6]=x,e[7]=m):m=e[7];let h;e[8]!==u||e[9]!==m?(h={mutationFn:u,onSuccess:m,onError:de},e[8]=u,e[9]=m,e[10]=h):h=e[10];const i=Q(h);let b;e[11]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(X,{asChild:!0,children:s.jsx(L,{variant:"outline",size:"sm",children:"Add member"})}),e[11]=b):b=e[11];let r;e[12]!==l.name?(r=s.jsx(Y,{children:s.jsxs(G,{children:["Add member to ",l.name]})}),e[12]=l.name,e[13]=r):r=e[13];let c;e[14]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(J,{htmlFor:"admin-add-member-email",children:"Email"}),e[14]=c):c=e[14];let d;e[15]===Symbol.for("react.memo_cache_sentinel")?(d=B=>p(B.target.value),e[15]=d):d=e[15];let f;e[16]!==a||e[17]!==i.isPending?(f=s.jsxs("div",{className:"space-y-2",children:[c,s.jsx(H,{id:"admin-add-member-email",type:"email",value:a,onChange:d,placeholder:"user@example.com",disabled:i.isPending})]}),e[16]=a,e[17]=i.isPending,e[18]=f):f=e[18];let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(ie,{className:"w-full",children:s.jsx(ae,{})}),e[19]=j):j=e[19];let z;e[20]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx(ne,{children:oe.map(ce)}),e[20]=z):z=e[20];let y;e[21]!==i.isPending||e[22]!==o?(y=s.jsxs(se,{value:o,onValueChange:S,disabled:i.isPending,children:[j,z]}),e[21]=i.isPending,e[22]=o,e[23]=y):y=e[23];let _;e[24]!==y||e[25]!==f?(_=s.jsxs("div",{className:"space-y-4",children:[f,y]}),e[24]=y,e[25]=f,e[26]=_):_=e[26];let A;e[27]===Symbol.for("react.memo_cache_sentinel")?(A=()=>n(!1),e[27]=A):A=e[27];let C;e[28]!==i.isPending?(C=s.jsx(L,{variant:"outline",onClick:A,disabled:i.isPending,children:"Cancel"}),e[28]=i.isPending,e[29]=C):C=e[29];let N;e[30]!==i?(N=()=>i.mutate(),e[30]=i,e[31]=N):N=e[31];let P;e[32]!==a||e[33]!==i.isPending?(P=!a.trim()||i.isPending,e[32]=a,e[33]=i.isPending,e[34]=P):P=e[34];const F=i.isPending?"Adding...":"Add member";let v;e[35]!==N||e[36]!==P||e[37]!==F?(v=s.jsx(L,{onClick:N,disabled:P,children:F}),e[35]=N,e[36]=P,e[37]=F,e[38]=v):v=e[38];let w;e[39]!==C||e[40]!==v?(w=s.jsxs(Z,{children:[C,v]}),e[39]=C,e[40]=v,e[41]=w):w=e[41];let E;e[42]!==_||e[43]!==w||e[44]!==r?(E=s.jsxs(ee,{className:"sm:max-w-md",children:[r,_,w]}),e[42]=_,e[43]=w,e[44]=r,e[45]=E):E=e[45];let D;return e[46]!==g||e[47]!==E?(D=s.jsxs(te,{open:g,onOpenChange:n,children:[b,E]}),e[46]=g,e[47]=E,e[48]=D):D=e[48],D}function ce(t){return s.jsx(re,{value:t,children:s.jsx("span",{className:"capitalize",children:t})},t)}function de(t){k.error(t instanceof Error?t.message:"Failed to add member")}function qe(){const t=I.c(24),[e,l]=O.useState("");let g;t[0]!==e?(g=e.trim(),t[0]=e,t[1]=g):g=t[1];const n=W(g,300);let a;t[2]!==n?(a=R.deploymentAdminOrgs(n),t[2]=n,t[3]=a):a=t[3];let p;t[4]!==n?(p=()=>{const j=new URLSearchParams({limit:"100"});return n&&j.set("search",n),q(`/api/_admin/orgs?${j}`)},t[4]=n,t[5]=p):p=t[5];let o;t[6]!==a||t[7]!==p?(o={queryKey:a,queryFn:p},t[6]=a,t[7]=p,t[8]=o):o=t[8];const{data:S,isLoading:x,isError:u}=K(o);let m;t[9]!==S?.organizations?(m=S?.organizations??[],t[9]=S?.organizations,t[10]=m):m=t[10];const h=m;let i;t[11]===Symbol.for("react.memo_cache_sentinel")?(i=[{id:"name",header:"Organization",render:ge,cellClassName:"flex-1 min-w-0"},{id:"members",header:"Members",render:pe,cellClassName:"w-24 shrink-0"},{id:"created",header:"Created",render:ue,cellClassName:"w-48 shrink-0"},{id:"actions",header:"",render:fe,cellClassName:"w-32 shrink-0"}],t[11]=i):i=t[11];const b=i;let r;t[12]!==e?(r=s.jsx(U,{value:e,onChange:l,placeholder:"Search organizations by name or slug...",className:"w-full md:w-[375px]"}),t[12]=e,t[13]=r):r=t[13];let c;t[14]!==n||t[15]!==u?(c=u?s.jsx($,{title:"Failed to load organizations",description:"Something went wrong. Refresh to try again."}):s.jsx($,{title:"No organizations found",description:n?`No organizations match "${n}"`:"No organizations exist yet."}),t[14]=n,t[15]=u,t[16]=c):c=t[16];let d;t[17]!==x||t[18]!==h||t[19]!==c?(d=s.jsx(V,{columns:b,data:h,isLoading:x,emptyState:c}),t[17]=x,t[18]=h,t[19]=c,t[20]=d):d=t[20];let f;return t[21]!==r||t[22]!==d?(f=s.jsx(T,{children:s.jsx(T.Content,{children:s.jsx(T.Body,{children:s.jsxs("div",{className:"flex flex-col gap-6",children:[r,d]})})})}),t[21]=r,t[22]=d,t[23]=f):f=t[23],f}function fe(t){return s.jsx(me,{org:t})}function ue(t){return s.jsx("span",{className:"text-sm text-foreground",children:le(t.createdAt)})}function pe(t){return s.jsx("span",{className:"text-sm text-foreground",children:t.memberCount})}function ge(t){return s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.name}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:t.slug})]})}export{qe as default};
1
+ import{c as I,r as O,m as K,j as s,K as R,n as M,d as Q,B as L,t as k}from"./index-Dm8PN3sF.js";import{P as T}from"./index-C-emgAXU.js";import{C as V}from"./collection-table-wrapper-m26XJ5zy.js";import{E as $}from"./empty-state-CZ_W2Tkk.js";import{S as U}from"./search-input-DDPtoz8G.js";import{I as H}from"./input-BSpKqXLN.js";import{L as J}from"./label-Dpmg8kbt.js";import{u as W}from"./use-debounced-value-HHfWLIor.js";import{D as Y,a as G,b as X,c as Z,d as ee,e as te}from"./dialog-peEhu4Kz.js";import{S as se,a as ie,b as ae,c as ne,d as re}from"./select-klspWFYa.js";import{a as q}from"./admin-fetch-CCSvjTk1.js";import{f as le}from"./format-time-BnbuEtat.js";import"./sidebar-CWl0stLq.js";import"./LayoutLeft-DFAoke9t.js";import"./use-mobile-BgevOYAE.js";import"./X-Ct6uDLb4.js";import"./tooltip-Bk3ktdBG.js";import"./table-BjewzTT6.js";import"./ArrowUp-BULPWB7Z.js";import"./SearchMd-D7SBsVYX.js";import"./Check-DP2mt6rz.js";import"./ChevronDown-CoccBu6f.js";import"./ChevronUp-pTNKSSUr.js";import"./differenceInSeconds-NQ4PDo0z.js";const oe=["owner","admin","user"];function me(t){const e=I.c(49),{org:l}=t,[g,n]=O.useState(!1),[a,p]=O.useState(""),[o,S]=O.useState("user"),x=M();let u;e[0]!==a||e[1]!==l.id||e[2]!==o?(u=()=>q(`/api/_admin/orgs/${l.id}/members`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:a.trim(),role:o})}),e[0]=a,e[1]=l.id,e[2]=o,e[3]=u):u=e[3];let m;e[4]!==a||e[5]!==l.name||e[6]!==x?(m=()=>{k.success(`Added ${a.trim()} to ${l.name}`),x.invalidateQueries({queryKey:R.deploymentAdminOrgsList()}),n(!1),p(""),S("user")},e[4]=a,e[5]=l.name,e[6]=x,e[7]=m):m=e[7];let h;e[8]!==u||e[9]!==m?(h={mutationFn:u,onSuccess:m,onError:de},e[8]=u,e[9]=m,e[10]=h):h=e[10];const i=Q(h);let b;e[11]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(X,{asChild:!0,children:s.jsx(L,{variant:"outline",size:"sm",children:"Add member"})}),e[11]=b):b=e[11];let r;e[12]!==l.name?(r=s.jsx(Y,{children:s.jsxs(G,{children:["Add member to ",l.name]})}),e[12]=l.name,e[13]=r):r=e[13];let c;e[14]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(J,{htmlFor:"admin-add-member-email",children:"Email"}),e[14]=c):c=e[14];let d;e[15]===Symbol.for("react.memo_cache_sentinel")?(d=B=>p(B.target.value),e[15]=d):d=e[15];let f;e[16]!==a||e[17]!==i.isPending?(f=s.jsxs("div",{className:"space-y-2",children:[c,s.jsx(H,{id:"admin-add-member-email",type:"email",value:a,onChange:d,placeholder:"user@example.com",disabled:i.isPending})]}),e[16]=a,e[17]=i.isPending,e[18]=f):f=e[18];let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(ie,{className:"w-full",children:s.jsx(ae,{})}),e[19]=j):j=e[19];let z;e[20]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx(ne,{children:oe.map(ce)}),e[20]=z):z=e[20];let y;e[21]!==i.isPending||e[22]!==o?(y=s.jsxs(se,{value:o,onValueChange:S,disabled:i.isPending,children:[j,z]}),e[21]=i.isPending,e[22]=o,e[23]=y):y=e[23];let _;e[24]!==y||e[25]!==f?(_=s.jsxs("div",{className:"space-y-4",children:[f,y]}),e[24]=y,e[25]=f,e[26]=_):_=e[26];let A;e[27]===Symbol.for("react.memo_cache_sentinel")?(A=()=>n(!1),e[27]=A):A=e[27];let C;e[28]!==i.isPending?(C=s.jsx(L,{variant:"outline",onClick:A,disabled:i.isPending,children:"Cancel"}),e[28]=i.isPending,e[29]=C):C=e[29];let N;e[30]!==i?(N=()=>i.mutate(),e[30]=i,e[31]=N):N=e[31];let P;e[32]!==a||e[33]!==i.isPending?(P=!a.trim()||i.isPending,e[32]=a,e[33]=i.isPending,e[34]=P):P=e[34];const F=i.isPending?"Adding...":"Add member";let v;e[35]!==N||e[36]!==P||e[37]!==F?(v=s.jsx(L,{onClick:N,disabled:P,children:F}),e[35]=N,e[36]=P,e[37]=F,e[38]=v):v=e[38];let w;e[39]!==C||e[40]!==v?(w=s.jsxs(Z,{children:[C,v]}),e[39]=C,e[40]=v,e[41]=w):w=e[41];let E;e[42]!==_||e[43]!==w||e[44]!==r?(E=s.jsxs(ee,{className:"sm:max-w-md",children:[r,_,w]}),e[42]=_,e[43]=w,e[44]=r,e[45]=E):E=e[45];let D;return e[46]!==g||e[47]!==E?(D=s.jsxs(te,{open:g,onOpenChange:n,children:[b,E]}),e[46]=g,e[47]=E,e[48]=D):D=e[48],D}function ce(t){return s.jsx(re,{value:t,children:s.jsx("span",{className:"capitalize",children:t})},t)}function de(t){k.error(t instanceof Error?t.message:"Failed to add member")}function qe(){const t=I.c(24),[e,l]=O.useState("");let g;t[0]!==e?(g=e.trim(),t[0]=e,t[1]=g):g=t[1];const n=W(g,300);let a;t[2]!==n?(a=R.deploymentAdminOrgs(n),t[2]=n,t[3]=a):a=t[3];let p;t[4]!==n?(p=()=>{const j=new URLSearchParams({limit:"100"});return n&&j.set("search",n),q(`/api/_admin/orgs?${j}`)},t[4]=n,t[5]=p):p=t[5];let o;t[6]!==a||t[7]!==p?(o={queryKey:a,queryFn:p},t[6]=a,t[7]=p,t[8]=o):o=t[8];const{data:S,isLoading:x,isError:u}=K(o);let m;t[9]!==S?.organizations?(m=S?.organizations??[],t[9]=S?.organizations,t[10]=m):m=t[10];const h=m;let i;t[11]===Symbol.for("react.memo_cache_sentinel")?(i=[{id:"name",header:"Organization",render:ge,cellClassName:"flex-1 min-w-0"},{id:"members",header:"Members",render:pe,cellClassName:"w-24 shrink-0"},{id:"created",header:"Created",render:ue,cellClassName:"w-48 shrink-0"},{id:"actions",header:"",render:fe,cellClassName:"w-32 shrink-0"}],t[11]=i):i=t[11];const b=i;let r;t[12]!==e?(r=s.jsx(U,{value:e,onChange:l,placeholder:"Search organizations by name or slug...",className:"w-full md:w-[375px]"}),t[12]=e,t[13]=r):r=t[13];let c;t[14]!==n||t[15]!==u?(c=u?s.jsx($,{title:"Failed to load organizations",description:"Something went wrong. Refresh to try again."}):s.jsx($,{title:"No organizations found",description:n?`No organizations match "${n}"`:"No organizations exist yet."}),t[14]=n,t[15]=u,t[16]=c):c=t[16];let d;t[17]!==x||t[18]!==h||t[19]!==c?(d=s.jsx(V,{columns:b,data:h,isLoading:x,emptyState:c}),t[17]=x,t[18]=h,t[19]=c,t[20]=d):d=t[20];let f;return t[21]!==r||t[22]!==d?(f=s.jsx(T,{children:s.jsx(T.Content,{children:s.jsx(T.Body,{children:s.jsxs("div",{className:"flex flex-col gap-6",children:[r,d]})})})}),t[21]=r,t[22]=d,t[23]=f):f=t[23],f}function fe(t){return s.jsx(me,{org:t})}function ue(t){return s.jsx("span",{className:"text-sm text-foreground",children:le(t.createdAt)})}function pe(t){return s.jsx("span",{className:"text-sm text-foreground",children:t.memberCount})}function ge(t){return s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.name}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:t.slug})]})}export{qe as default};