decocms 3.68.1 → 3.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/dist/client/assets/{AlertCircle-B-Zk3zY-.js → AlertCircle-Dnqz3IxM.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-DrUVVTac.js → ArrowUpRight-B2NXgTf2.js} +1 -1
  3. package/dist/client/assets/{CheckCircle-DgjXE82G.js → CheckCircle-D9OslXZP.js} +1 -1
  4. package/dist/client/assets/{ChevronDown-DAwDO8g3.js → ChevronDown-BldydMJ0.js} +1 -1
  5. package/dist/client/assets/{ChevronLeft-BoWRf6EK.js → ChevronLeft-CXmppBJO.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-CxzKR4UY.js → ChevronRight-BsknZQE_.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-Bu9JV4C-.js → ChevronUp-CjDXfs3K.js} +1 -1
  8. package/dist/client/assets/{DotsVertical-CSx815oq.js → DotsVertical-Ci1mVPsb.js} +1 -1
  9. package/dist/client/assets/{Eye-Clz4yV9V.js → Eye-DifA9NHq.js} +1 -1
  10. package/dist/client/assets/{FilterLines-CCXAkAAh.js → FilterLines-CV07u96M.js} +1 -1
  11. package/dist/client/assets/{Globe01-rz2h7Ebm.js → Globe01-CMUrlGmF.js} +1 -1
  12. package/dist/client/assets/{Globe04-ZAH-y7Tv.js → Globe04-BplUDurZ.js} +1 -1
  13. package/dist/client/assets/{HardDrive-CdL1msYN.js → HardDrive-B6V7BYZB.js} +1 -1
  14. package/dist/client/assets/{Key01-Cd33I9n1.js → Key01-DGn_JEBu.js} +1 -1
  15. package/dist/client/assets/{LayoutLeft-Cx1gVHzQ.js → LayoutLeft-BI32Ru47.js} +1 -1
  16. package/dist/client/assets/{LinkExternal01-DQqosIE7.js → LinkExternal01-DwIqUvLe.js} +1 -1
  17. package/dist/client/assets/{Monitor01-DtUT2Llg.js → Monitor01-C-tOv611.js} +1 -1
  18. package/dist/client/assets/{Palette-CS46pFVA.js → Palette-pjBymHRy.js} +1 -1
  19. package/dist/client/assets/{Play-CFAWCyYY.js → Play-BEuZCxsN.js} +1 -1
  20. package/dist/client/assets/{Plus-Cl80ngk-.js → Plus-DHJbi1i9.js} +1 -1
  21. package/dist/client/assets/{SearchMd-DtbjJ0sS.js → SearchMd-yvCGxslh.js} +1 -1
  22. package/dist/client/assets/{Settings02-BX75SJ47.js → Settings02-BcW_Yd93.js} +1 -1
  23. package/dist/client/assets/{Shield01-CY7h3_lL.js → Shield01-DXFrycnj.js} +1 -1
  24. package/dist/client/assets/{Star01-CqiKSE8w.js → Star01-DxJIcjLz.js} +1 -1
  25. package/dist/client/assets/{Stars01-CfOrOYJQ.js → Stars01-Dr_rOBxK.js} +1 -1
  26. package/dist/client/assets/{Stars02-CCs6aX7m.js → Stars02-CB3UMWzf.js} +1 -1
  27. package/dist/client/assets/{Sun-0mP8ve2O.js → Sun-CTchQz03.js} +1 -1
  28. package/dist/client/assets/{SwitchHorizontal01-BVb8cFOW.js → SwitchHorizontal01-Ca_h3hG5.js} +1 -1
  29. package/dist/client/assets/{Tool01-DpllcZ_x.js → Tool01-B4m3Gnpd.js} +1 -1
  30. package/dist/client/assets/{Trash01-B4p5GuSp.js → Trash01-BDNQcRq9.js} +1 -1
  31. package/dist/client/assets/{Upload01--GcqA8-Q.js → Upload01-CuyZwIAy.js} +1 -1
  32. package/dist/client/assets/{User01-DxuO8uwX.js → User01-kj3Bxvgl.js} +1 -1
  33. package/dist/client/assets/{Users01-a4XMjW3H.js → Users01-DM4FmEoT.js} +1 -1
  34. package/dist/client/assets/{Users03-D3FPHz00.js → Users03-CJ4lkyfr.js} +1 -1
  35. package/dist/client/assets/{X-ciDfeMTV.js → X-Botvp-t_.js} +1 -1
  36. package/dist/client/assets/{XCircle-DheND3p1.js → XCircle-CpovmLEO.js} +1 -1
  37. package/dist/client/assets/{XClose-BGdHen0O.js → XClose-CnYr1LOo.js} +1 -1
  38. package/dist/client/assets/{Zap-Dc-gCUi7.js → Zap-8NdOr1pq.js} +1 -1
  39. package/dist/client/assets/{ZapSquare-BILpiibq.js → ZapSquare-ChOMpHGM.js} +1 -1
  40. package/dist/client/assets/{ZoomOut-B_lAoymB.js → ZoomOut-DYeUJTmS.js} +1 -1
  41. package/dist/client/assets/{access-gate-DpAJKNDg.js → access-gate-lRgnLhCg.js} +1 -1
  42. package/dist/client/assets/{add-section-modal-08fudMVv.js → add-section-modal-CZwFVJh7.js} +1 -1
  43. package/dist/client/assets/{agent-icon-CS5ajDLh.js → agent-icon-B1KjkGhC.js} +1 -1
  44. package/dist/client/assets/{agents-list-DxGlqMqe.js → agents-list-BeGasDr4.js} +1 -1
  45. package/dist/client/assets/{ai-providers-B7vfwAb0.js → ai-providers-DhEaZvB4.js} +1 -1
  46. package/dist/client/assets/{alert-C5GST-R3.js → alert-DVl9GMhN.js} +1 -1
  47. package/dist/client/assets/{alert-dialog-BzcSSmOH.js → alert-dialog-DvJDYQsM.js} +1 -1
  48. package/dist/client/assets/app-editor-Dd12zl9_.js +1 -0
  49. package/dist/client/assets/{auth-D8scdv8L.js → auth-DA6X7KBB.js} +1 -1
  50. package/dist/client/assets/{auth-catchall-DH4AcuId.js → auth-catchall-BljhiRu2.js} +1 -1
  51. package/dist/client/assets/{auth-split-layout-5KVfL-AQ.js → auth-split-layout-DeC-35_z.js} +1 -1
  52. package/dist/client/assets/{automation-list-row-BBCpkdMa.js → automation-list-row-BIiojY8I.js} +1 -1
  53. package/dist/client/assets/{automation-runs-C_CK9GUW.js → automation-runs-CHVaaxN6.js} +1 -1
  54. package/dist/client/assets/{automations-B_7k54-x.js → automations-BZ212IOj.js} +1 -1
  55. package/dist/client/assets/{avatar-CCN_co-X.js → avatar-D7wKrjgH.js} +1 -1
  56. package/dist/client/assets/{badge-BPsAZTXm.js → badge-Rj4w6Y9D.js} +1 -1
  57. package/dist/client/assets/{block-document-DLpzkGGl.js → block-document-Dr1GbIJR.js} +1 -1
  58. package/dist/client/assets/{brand-context-bYYUkcDs.js → brand-context-BHLNO4fC.js} +1 -1
  59. package/dist/client/assets/{buckets-C4Z9fF_s.js → buckets-C3GJftau.js} +1 -1
  60. package/dist/client/assets/{calendar-BCaGHasm.js → calendar-BETEvsL1.js} +1 -1
  61. package/dist/client/assets/{capability-load-error-B0DXeXNJ.js → capability-load-error-Caduk_d2.js} +1 -1
  62. package/dist/client/assets/{card-BTSltukm.js → card-BtNxdFil.js} +1 -1
  63. package/dist/client/assets/category-editor-D8faJ1-Q.js +1 -0
  64. package/dist/client/assets/{chat-context-BsFLDszr.js → chat-context-B_U1gcun.js} +1 -1
  65. package/dist/client/assets/{checkbox-M3DdO4ws.js → checkbox-CzoSEbjC.js} +1 -1
  66. package/dist/client/assets/{cli-auth-success-6Lg0rHoz.js → cli-auth-success-BaHruqex.js} +1 -1
  67. package/dist/client/assets/{collection-detail-BJzSsRXi.js → collection-detail-Dlkc-Hxo.js} +1 -1
  68. package/dist/client/assets/{collection-display-button-C4uiztpf.js → collection-display-button-4X_RKgcc.js} +1 -1
  69. package/dist/client/assets/{collection-search-lIRYT3yV.js → collection-search-BSHmVsv0.js} +1 -1
  70. package/dist/client/assets/{collection-tabs-DjP3Ny2m.js → collection-tabs-CghGabs6.js} +1 -1
  71. package/dist/client/assets/{command-CrEXCPCP.js → command-CYqVDIDi.js} +1 -1
  72. package/dist/client/assets/{connect-desktop-dialog-CRKR2Xhc.js → connect-desktop-dialog-Cq5se3ri.js} +1 -1
  73. package/dist/client/assets/{connection-card-Ci8mCMyz.js → connection-card-CzT4sqi7.js} +1 -1
  74. package/dist/client/assets/{connection-detail-Cg5wteNS.js → connection-detail-BCjmmJh1.js} +1 -1
  75. package/dist/client/assets/{connection-form-helpers-Dl_gZPK3.js → connection-form-helpers-CuaSwKDp.js} +1 -1
  76. package/dist/client/assets/{connections-DSdlpl8m.js → connections-BEh7d4ax.js} +1 -1
  77. package/dist/client/assets/{context-menu-9HQTa5U2.js → context-menu-CtPFsuQw.js} +1 -1
  78. package/dist/client/assets/{decopilot-Cd6VUSpu.js → decopilot-Bw9nv9Fa.js} +1 -1
  79. package/dist/client/assets/{decopilot-sse-pool-BP59aBkW.js → decopilot-sse-pool-DdZSTixQ.js} +1 -1
  80. package/dist/client/assets/{dialog-DXahQA5F.js → dialog-BMBVdX8K.js} +1 -1
  81. package/dist/client/assets/{domain-settings-B2G69X9h.js → domain-settings-GHKCO0j2.js} +1 -1
  82. package/dist/client/assets/{drawer-BBC9hSU8.js → drawer-TLQRWcN-.js} +1 -1
  83. package/dist/client/assets/{dropdown-menu-6REDhV5o.js → dropdown-menu-gXn3xVef.js} +1 -1
  84. package/dist/client/assets/{empty-state-DXDAVywR.js → empty-state-SvMp_sYN.js} +1 -1
  85. package/dist/client/assets/{extract-connection-data-CyP5_ll7.js → extract-connection-data-BsbTS0uC.js} +1 -1
  86. package/dist/client/assets/{file-explorer-DvIndLZ2.js → file-explorer-C5eBRtME.js} +1 -1
  87. package/dist/client/assets/{file-type-icon-CD_RZ8rl.js → file-type-icon-DURyeK9L.js} +1 -1
  88. package/dist/client/assets/{files-C7AHzVIO.js → files-B43hGcq-.js} +1 -1
  89. package/dist/client/assets/{form-C9CSHpUw.js → form-CdGhzS_x.js} +1 -1
  90. package/dist/client/assets/{general-Do4Aw_UB.js → general-D01YsmbR.js} +1 -1
  91. package/dist/client/assets/{github-repo-picker-Duq8-HaY.js → github-repo-picker-Db3xiFzy.js} +1 -1
  92. package/dist/client/assets/{hooks-C1I2Fhg2.js → hooks-DlDryoZW.js} +1 -1
  93. package/dist/client/assets/{image-field-CRd85u-i.js → image-field-ZYWbFFqt.js} +1 -1
  94. package/dist/client/assets/{import-from-deco-dialog-B7gbIQKu.js → import-from-deco-dialog-wt_cQutp.js} +1 -1
  95. package/dist/client/assets/{index-CN18RaKp.js → index-B66xjk-i.js} +1 -1
  96. package/dist/client/assets/{index-UgUz8dNz.js → index-BW5f_EaT.js} +4 -4
  97. package/dist/client/assets/{index-CVsiyRJv.js → index-C35Pm7iN.js} +1 -1
  98. package/dist/client/assets/{index-D6izOmjj.js → index-COlSsy5J.js} +3 -3
  99. package/dist/client/assets/{index-BrlqF8mC.js → index-C_H1H79r.js} +1 -1
  100. package/dist/client/assets/{index-B62gT9En.js → index-CkC7ek4r.js} +1 -1
  101. package/dist/client/assets/{index-VDwoBUQS.js → index-CvuV8zWk.js} +1 -1
  102. package/dist/client/assets/{index-CDIbVALl.js → index-D0cczQd_.js} +1 -1
  103. package/dist/client/assets/{index-DQcT764V.js → index-D4WUCfu0.js} +1 -1
  104. package/dist/client/assets/{index-CZ67kZ1v.js → index-DEanDL8Y.js} +1 -1
  105. package/dist/client/assets/{index-Dyus5M1c.js → index-DWvgpCdb.js} +1 -1
  106. package/dist/client/assets/{index-uQZXfeqC.js → index-H-_VOpOu.js} +1 -1
  107. package/dist/client/assets/{index-CflKuA1L.js → index-dlN4JEF9.js} +1 -1
  108. package/dist/client/assets/{index-redirect-IkyQEw8C.js → index-redirect-CDQ9iDF3.js} +1 -1
  109. package/dist/client/assets/{index-a_lJlgHU.js → index-swPX_OFH.js} +1 -1
  110. package/dist/client/assets/{input-DP3XvpLN.js → input-CuVtlRv5.js} +1 -1
  111. package/dist/client/assets/{integration-icon-DZ46sqDL.js → integration-icon-RqT66_6U.js} +1 -1
  112. package/dist/client/assets/{label-CVIIqU26.js → label-BCRIEPd0.js} +1 -1
  113. package/dist/client/assets/{login-D9Jd5dPi.js → login-ByPZpD-o.js} +1 -1
  114. package/dist/client/assets/{mcp-oauth-MmhxfzLz.js → mcp-oauth-kSTvScdZ.js} +1 -1
  115. package/dist/client/assets/{members-DY9kX_sz.js → members-AD1fVrNE.js} +1 -1
  116. package/dist/client/assets/{monaco-editor-BqXgJc7f.js → monaco-editor-DNLiFjHn.js} +1 -1
  117. package/dist/client/assets/{monitoring-stats-row-BsB6GRCy.js → monitoring-stats-row-Bsctnbru.js} +1 -1
  118. package/dist/client/assets/{oauth-callback-PLImtAXE.js → oauth-callback-B6I9yHDk.js} +1 -1
  119. package/dist/client/assets/{oauth-callback-ai-provider-BH-Rswm0.js → oauth-callback-ai-provider-D0iCPw3h.js} +1 -1
  120. package/dist/client/assets/{onboarding-DqZTmtt-.js → onboarding-1ssRVacT.js} +1 -1
  121. package/dist/client/assets/{org-install-Bt9032_8.js → org-install-r5xxUZ8-.js} +1 -1
  122. package/dist/client/assets/{org-layout-BFcVcec6.js → org-layout-i53vnou1.js} +1 -1
  123. package/dist/client/assets/{page-seo-form-BYKfoIdi.js → page-seo-form-BRpnzyUP.js} +1 -1
  124. package/dist/client/assets/page-seo-sheet-C8gLGTPM.js +1 -0
  125. package/dist/client/assets/{popover-B5LJwz0j.js → popover-rRtv1RUJ.js} +1 -1
  126. package/dist/client/assets/{post-editor-DHf_pKD_.js → post-editor-B3yACnM8.js} +1 -1
  127. package/dist/client/assets/{preview-dialog-NbAEidmd.js → preview-dialog-HeEAXFdp.js} +1 -1
  128. package/dist/client/assets/{primitives-C9XYnbHN.js → primitives-DOHAd4Be.js} +1 -1
  129. package/dist/client/assets/{profile-BIh6zBqL.js → profile-DxKVe_bi.js} +1 -1
  130. package/dist/client/assets/project-app-view-C1SP7U91.js +1 -0
  131. package/dist/client/assets/record-editor-CmQTYxNi.js +1 -0
  132. package/dist/client/assets/registry-BLAsKSMe.js +2 -0
  133. package/dist/client/assets/{registry-layout-CpLwJOk1.js → registry-layout-Cqo7HGa-.js} +1 -1
  134. package/dist/client/assets/{require-capability-BCughBI7.js → require-capability-GPOwZTVN.js} +1 -1
  135. package/dist/client/assets/{required-auth-layout-Czm4wEhq.js → required-auth-layout-D9YU16Eu.js} +1 -1
  136. package/dist/client/assets/{reset-password-CZGPwq_U.js → reset-password-BvvmcRor.js} +1 -1
  137. package/dist/client/assets/{roles-1pSXErEv.js → roles-BG01ewdV.js} +1 -1
  138. package/dist/client/assets/save-referenced-block-qVgXMpcz.js +1 -0
  139. package/dist/client/assets/{save-status-BbqkL83O.js → save-status-2WDTqRnj.js} +1 -1
  140. package/dist/client/assets/{schema-form-B4m0eDMT.js → schema-form-hXy8-pLC.js} +1 -1
  141. package/dist/client/assets/{scroll-area-D-wTiagO.js → scroll-area-DOnfhZQE.js} +1 -1
  142. package/dist/client/assets/{search-input-BpXZI4wE.js → search-input-Dh2xeHiv.js} +1 -1
  143. package/dist/client/assets/{secrets-e1cmnWWE.js → secrets-x-a9-QDY.js} +1 -1
  144. package/dist/client/assets/{sections-editor-BPDMVhPi.js → sections-editor-DpVqLaiP.js} +1 -1
  145. package/dist/client/assets/{select-CjjjXRUS.js → select-Dqs7Z4yG.js} +1 -1
  146. package/dist/client/assets/{select-model-DuC4X2jB.js → select-model-bXVR8jvT.js} +1 -1
  147. package/dist/client/assets/{seo-editor-DIker3a9.js → seo-editor-d5x7SvAU.js} +1 -1
  148. package/dist/client/assets/{settings-layout-becrO5TI.js → settings-layout-CpPje1Xl.js} +1 -1
  149. package/dist/client/assets/{settings-section-Cj3AwHej.js → settings-section-BqnJtUWr.js} +1 -1
  150. package/dist/client/assets/{sheet-CGQ0l6o4.js → sheet-Cn8FwYbD.js} +1 -1
  151. package/dist/client/assets/{shell-controls-rLEkFMFT.js → shell-controls-nCD3gP3E.js} +1 -1
  152. package/dist/client/assets/{shell-layout-BuKC3YO-.js → shell-layout-Cx--9PV8.js} +1 -1
  153. package/dist/client/assets/{shell-route-loading-CvANTPJP.js → shell-route-loading-Brmd2_HQ.js} +1 -1
  154. package/dist/client/assets/{sidebar-Bf91anCU.js → sidebar-D1LCPjC8.js} +1 -1
  155. package/dist/client/assets/{skeleton-C_vWUNwW.js → skeleton-Bo_6Cq99.js} +1 -1
  156. package/dist/client/assets/{sortable.esm-BDQeT5mM.js → sortable.esm-yJWb24sN.js} +1 -1
  157. package/dist/client/assets/{sso-s9GwOpzF.js → sso-DhhZEU-d.js} +1 -1
  158. package/dist/client/assets/{store-Bpiz0D_I.js → store-COjaCE4s.js} +1 -1
  159. package/dist/client/assets/store-registry-nvoM6APm.js +2 -0
  160. package/dist/client/assets/{studio-tools-BBnH3MVd.js → studio-tools-CyTucPcW.js} +1 -1
  161. package/dist/client/assets/{switch-D5j5jKzb.js → switch-CorAlxCf.js} +1 -1
  162. package/dist/client/assets/{table-HxKELBdZ.js → table-Gv4tJy7V.js} +1 -1
  163. package/dist/client/assets/{tabs-DY3LqT6S.js → tabs-DAvIQWby.js} +1 -1
  164. package/dist/client/assets/{task-status-D5hR8PPt.js → task-status-BfeF--n0.js} +1 -1
  165. package/dist/client/assets/{textarea-DNK54KKl.js → textarea-DsT2vsGj.js} +1 -1
  166. package/dist/client/assets/{toggle-group-CYBCkLka.js → toggle-group-WKZVvwQm.js} +1 -1
  167. package/dist/client/assets/{toolbar-L8diPmJo.js → toolbar-BfY48AQu.js} +1 -1
  168. package/dist/client/assets/{tooltip-Bk2FCtKr.js → tooltip-D5U362dF.js} +1 -1
  169. package/dist/client/assets/{types-CR3zyk0T.js → types-C-QYkfD4.js} +1 -1
  170. package/dist/client/assets/{use-ai-providers-BuPYcyWU.js → use-ai-providers-CLZQ64DO.js} +1 -1
  171. package/dist/client/assets/{use-automations-3CJWtIS7.js → use-automations-DNKM1hXI.js} +1 -1
  172. package/dist/client/assets/{use-capability-C1x5gZYr.js → use-capability-XIhIuFk7.js} +1 -1
  173. package/dist/client/assets/{use-clock-tick-CpGRUyLX.js → use-clock-tick-DkwKhG1v.js} +1 -1
  174. package/dist/client/assets/{use-collections-CCMEiGqY.js → use-collections-D4JsVK-B.js} +1 -1
  175. package/dist/client/assets/{use-connection-rF7aVJWi.js → use-connection-C7Z8M26w.js} +1 -1
  176. package/dist/client/assets/{use-copy-B9rnfiig.js → use-copy-CqTP6NE5.js} +1 -1
  177. package/dist/client/assets/{use-create-virtual-mcp-BnWFpzrZ.js → use-create-virtual-mcp-fk0U59RA.js} +1 -1
  178. package/dist/client/assets/{use-debounced-autosave-BoaPkBFT.js → use-debounced-autosave-B8dr6XMC.js} +1 -1
  179. package/dist/client/assets/{use-deco-credits-DkHNnq8a.js → use-deco-credits-Cm6qycwc.js} +1 -1
  180. package/dist/client/assets/{use-delete-connection-DfIaQmJb.js → use-delete-connection-DTrOkfly.js} +1 -1
  181. package/dist/client/assets/{use-file-configs-e6Y2envv.js → use-file-configs-DKTLvOxt.js} +1 -1
  182. package/dist/client/assets/{use-infinite-scroll-MECqtkyO.js → use-infinite-scroll-SjuQvrxH.js} +1 -1
  183. package/dist/client/assets/{use-join-requests-BWwov4uy.js → use-join-requests-DmU4yvI-.js} +1 -1
  184. package/dist/client/assets/{use-mcp-client-vlTb1_vQ.js → use-mcp-client-CK2bE_Wl.js} +1 -1
  185. package/dist/client/assets/{use-mcp-prompts-CGFuFPsL.js → use-mcp-prompts--L5Py2oF.js} +1 -1
  186. package/dist/client/assets/{use-mcp-tools-Dl-9pwtN.js → use-mcp-tools-B7wduqbV.js} +1 -1
  187. package/dist/client/assets/{use-members-DZbTKLCa.js → use-members-CYuArAru.js} +1 -1
  188. package/dist/client/assets/{use-navigate-to-agent-CKBlqEnY.js → use-navigate-to-agent-C2rXzvAb.js} +1 -1
  189. package/dist/client/assets/{use-org-auth-client-D79Jyhhp.js → use-org-auth-client-BYQp-Udb.js} +1 -1
  190. package/dist/client/assets/{use-org-sso-CGb3XUqQ.js → use-org-sso-Dh5HCYSJ.js} +1 -1
  191. package/dist/client/assets/{use-organization-roles-CyuVLsgC.js → use-organization-roles-BR95hkZY.js} +1 -1
  192. package/dist/client/assets/{use-organization-settings-BBq2AfS3.js → use-organization-settings-CiSDOMOC.js} +1 -1
  193. package/dist/client/assets/{use-registry-connections-Qh4o2c-N.js → use-registry-connections-rHz6zGP7.js} +1 -1
  194. package/dist/client/assets/{use-secrets-C45eD7gN.js → use-secrets-DLuniCTL.js} +1 -1
  195. package/dist/client/assets/{use-status-sounds-CqqJRu1j.js → use-status-sounds-BmR3uEUx.js} +1 -1
  196. package/dist/client/assets/{use-view-mode-CY-JucZM.js → use-view-mode-CCFkxJ0W.js} +1 -1
  197. package/dist/client/assets/{use-virtual-mcp-D63srVIz.js → use-virtual-mcp-DPWDEWCb.js} +1 -1
  198. package/dist/client/assets/useInfiniteQuery-BS_m7Y7W.js +1 -0
  199. package/dist/client/assets/{useRouterState-Cy8ALVZD.js → useRouterState-q7ojL5Do.js} +1 -1
  200. package/dist/client/assets/useSuspenseInfiniteQuery-CHHT-uCm.js +1 -0
  201. package/dist/client/assets/{view-mode-toggle-DNC_S7KK.js → view-mode-toggle-CeXLSv0R.js} +1 -1
  202. package/dist/client/index.html +1 -1
  203. package/dist/server/cli.js +525 -521
  204. package/dist/server/migrate.js +113 -109
  205. package/dist/server/server.js +368 -368
  206. package/package.json +1 -1
  207. package/dist/client/assets/app-editor-hpV9V9bT.js +0 -1
  208. package/dist/client/assets/category-editor-DDTndAHq.js +0 -1
  209. package/dist/client/assets/page-seo-sheet-Bpi2JjCw.js +0 -1
  210. package/dist/client/assets/project-app-view-Doem9rkZ.js +0 -1
  211. package/dist/client/assets/record-editor-C4dB5nQE.js +0 -1
  212. package/dist/client/assets/registry-Cbr661Wc.js +0 -2
  213. package/dist/client/assets/save-referenced-block-DcQjO7ah.js +0 -1
  214. package/dist/client/assets/store-registry-B0DZBOpl.js +0 -2
  215. package/dist/client/assets/useInfiniteQuery-Dtdh4OJ7.js +0 -1
  216. package/dist/client/assets/useSuspenseInfiniteQuery-DcCILGRB.js +0 -1
@@ -1 +1 @@
1
- import{e as v,c as N,j as t}from"./index-D6izOmjj.js";function y(){const x=v.c(1);let e;return x[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("img",{src:"/empty-state-cards.png",alt:"",width:336,height:320,"aria-hidden":"true"}),x[0]=e):e=x[0],e}function C(x){const e=v.c(24),{image:f,title:p,description:u,actions:o,className:h,descriptionClassName:j,actionsClassName:g}=x;let s;e[0]!==h?(s=N("flex flex-1 flex-col items-center justify-center gap-8 p-4",h),e[0]=h,e[1]=s):s=e[1];let l;e[2]!==f?(l=f!==null&&t.jsx("div",{className:"flex items-center justify-center",children:f??t.jsx(y,{})}),e[2]=f,e[3]=l):l=e[3];let i;e[4]!==p?(i=t.jsx("h3",{className:"text-lg font-medium text-foreground",children:p}),e[4]=p,e[5]=i):i=e[5];let c;e[6]!==j?(c=N("text-sm text-muted-foreground text-center max-w-[300px]",j),e[6]=j,e[7]=c):c=e[7];let a;e[8]!==u||e[9]!==c?(a=t.jsx("div",{className:c,children:u}),e[8]=u,e[9]=c,e[10]=a):a=e[10];let n;e[11]!==i||e[12]!==a?(n=t.jsxs("div",{className:"flex flex-col items-center gap-2",children:[i,a]}),e[11]=i,e[12]=a,e[13]=n):n=e[13];let r;e[14]!==o||e[15]!==g?(r=o&&t.jsx("div",{className:N("flex items-center gap-2",g),children:o}),e[14]=o,e[15]=g,e[16]=r):r=e[16];let m;e[17]!==n||e[18]!==r?(m=t.jsxs("div",{className:"flex flex-col items-center gap-4",children:[n,r]}),e[17]=n,e[18]=r,e[19]=m):m=e[19];let d;return e[20]!==s||e[21]!==l||e[22]!==m?(d=t.jsxs("div",{className:s,children:[l,m]}),e[20]=s,e[21]=l,e[22]=m,e[23]=d):d=e[23],d}export{C as E};
1
+ import{e as v,c as N,j as t}from"./index-COlSsy5J.js";function y(){const x=v.c(1);let e;return x[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("img",{src:"/empty-state-cards.png",alt:"",width:336,height:320,"aria-hidden":"true"}),x[0]=e):e=x[0],e}function C(x){const e=v.c(24),{image:f,title:p,description:u,actions:o,className:h,descriptionClassName:j,actionsClassName:g}=x;let s;e[0]!==h?(s=N("flex flex-1 flex-col items-center justify-center gap-8 p-4",h),e[0]=h,e[1]=s):s=e[1];let l;e[2]!==f?(l=f!==null&&t.jsx("div",{className:"flex items-center justify-center",children:f??t.jsx(y,{})}),e[2]=f,e[3]=l):l=e[3];let i;e[4]!==p?(i=t.jsx("h3",{className:"text-lg font-medium text-foreground",children:p}),e[4]=p,e[5]=i):i=e[5];let c;e[6]!==j?(c=N("text-sm text-muted-foreground text-center max-w-[300px]",j),e[6]=j,e[7]=c):c=e[7];let a;e[8]!==u||e[9]!==c?(a=t.jsx("div",{className:c,children:u}),e[8]=u,e[9]=c,e[10]=a):a=e[10];let n;e[11]!==i||e[12]!==a?(n=t.jsxs("div",{className:"flex flex-col items-center gap-2",children:[i,a]}),e[11]=i,e[12]=a,e[13]=n):n=e[13];let r;e[14]!==o||e[15]!==g?(r=o&&t.jsx("div",{className:N("flex items-center gap-2",g),children:o}),e[14]=o,e[15]=g,e[16]=r):r=e[16];let m;e[17]!==n||e[18]!==r?(m=t.jsxs("div",{className:"flex flex-col items-center gap-4",children:[n,r]}),e[17]=n,e[18]=r,e[19]=m):m=e[19];let d;return e[20]!==s||e[21]!==l||e[22]!==m?(d=t.jsxs("div",{className:s,children:[l,m]}),e[20]=s,e[21]=l,e[22]=m,e[23]=d):d=e[23],d}export{C as E};
@@ -1 +1 @@
1
- import"./index-D6izOmjj.js";import{W as T,d as O}from"./use-mcp-client-vlTb1_vQ.js";const x="mcp.mesh";function U(e){if(!e)return null;const t=typeof e=="string"?e:e.url;if(!t)return null;const n=t.match(/github\.com[/:]([^/]+)\/([^/]+?)(?:\.git)?\/?$/);return n?{owner:n[1]||"",repo:n[2]||""}:null}function H(e){const t=U(e);if(!t)return null;const n=`https://github.com/${t.owner}.png`;return`https://images.weserv.nl/?url=${encodeURIComponent(n)}&output=webp`}function L(e,t){return e===T.REGISTRY(t)||e===T.COMMUNITY_REGISTRY(t)}function q(e,t){return L(e,t)?"COLLECTION_REGISTRY_APP_LIST":"REGISTRY_ITEM_LIST"}function B(e){if(!e)return[];const t=[];for(const n of e){let a=[];if(Array.isArray(n))a=n;else if(typeof n=="object"&&n!==null){const r=Object.keys(n).find(o=>Array.isArray(n[o]));r&&(a=n[r])}t.push(...a)}return t}const Y={"streamable-http":"HTTP",http:"HTTP",sse:"SSE",stdio:"STDIO",websocket:"Websocket"};function D(e){return e?Y[e]??e.toUpperCase():null}function J(e){if(!e)return[];if(Array.isArray(e))return e;if(typeof e=="object"&&e!==null){const t=Object.keys(e).find(n=>Array.isArray(e[n]));if(t)return e[t]}return[]}async function Q(e,t,n,a,r){const o=await O({connectionId:e,orgId:t,orgSlug:n});try{const s=await o.callTool({name:a,arguments:r});return s.structuredContent??s}finally{await o.close().catch(console.error)}}let G="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",$=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=G[n[e]&63];return t};function j(e){return`${e}_${$()}`}function K(e){return e._meta?.["mcp.mesh"]?.appName||e.server?.name||null}function V(e){if(!e?.url)return"Unknown";try{return new URL(e.url).hostname}catch{return e.url}}function W(e){const t=e?.identifier||e?.name;return t?t.replace(/^@[^/]+\//,"").replace(/[-_]/g," ").replace(/\b\w/g,a=>a.toUpperCase()):"Unknown"}function X(e,t,n,a){const r=e.server,o=e._meta?.[x],s=new Date().toISOString(),I=o?.friendlyName||o?.friendly_name||e.title||r?.title||r?.name||"Unnamed MCP Server",R=r?.description||null,k=r?.icons?.[0]?.src||H(r?.repository)||null,i=o?.oauth_config,w=i&&typeof i.authorizationEndpoint=="string"&&typeof i.tokenEndpoint=="string"&&typeof i.clientId=="string"&&Array.isArray(i.scopes)&&(i.grantType==="authorization_code"||i.grantType==="client_credentials")?i:null,A=o?.configuration_state,C=o?.configuration_scopes,P=r?.repository?{url:r.repository.url,source:r.repository.source,subfolder:r.repository.subfolder}:null,p=r?.packages??[],m=r?.remotes??[],v=a?.packageIndex??0,S=a?.remoteIndex??0,y=p.length>0&&a?.packageIndex!==void 0,c=y?p[v]:null,l=y?null:m[S];let u,f,h=null;if(c){const _=c.identifier||c.name;u="STDIO",f="";const d={};if(c.environmentVariables)for(const b of c.environmentVariables)b.name&&(d[b.name]="");h={command:"npx",args:_?["-y",_]:[],...Object.keys(d).length>0&&{envVars:d}}}else l?(u=D(l.type)||"HTTP",f=l.url||""):(u="HTTP",f="");const N=m.length>1,M=p.length>1;let g="";c&&M?g=` (${W(c)})`:l&&N&&(g=` (${V(l)})`);const E=I+g;return{id:j("conn"),title:E,description:R,icon:k,app_name:K(e),app_id:o?.id||e.id||null,connection_type:u,connection_url:f,connection_token:null,connection_headers:h,oauth_config:w,configuration_state:A??null,configuration_scopes:C??null,metadata:{source:"store",registry_item_id:e.id,verified:o?.verified??!1,scopeName:o?.scopeName??null,toolsCount:o?.tools?.length??0,publishedAt:o?.publishedAt??null,repository:P},created_at:s,updated_at:s,created_by:n,organization_id:t,tools:null,bindings:null,status:"inactive"}}export{K as a,H as b,Q as c,J as d,X as e,B as f,j as g,q as i};
1
+ import"./index-COlSsy5J.js";import{W as T,d as O}from"./use-mcp-client-CK2bE_Wl.js";const x="mcp.mesh";function U(e){if(!e)return null;const t=typeof e=="string"?e:e.url;if(!t)return null;const n=t.match(/github\.com[/:]([^/]+)\/([^/]+?)(?:\.git)?\/?$/);return n?{owner:n[1]||"",repo:n[2]||""}:null}function H(e){const t=U(e);if(!t)return null;const n=`https://github.com/${t.owner}.png`;return`https://images.weserv.nl/?url=${encodeURIComponent(n)}&output=webp`}function L(e,t){return e===T.REGISTRY(t)||e===T.COMMUNITY_REGISTRY(t)}function q(e,t){return L(e,t)?"COLLECTION_REGISTRY_APP_LIST":"REGISTRY_ITEM_LIST"}function B(e){if(!e)return[];const t=[];for(const n of e){let a=[];if(Array.isArray(n))a=n;else if(typeof n=="object"&&n!==null){const r=Object.keys(n).find(o=>Array.isArray(n[o]));r&&(a=n[r])}t.push(...a)}return t}const Y={"streamable-http":"HTTP",http:"HTTP",sse:"SSE",stdio:"STDIO",websocket:"Websocket"};function D(e){return e?Y[e]??e.toUpperCase():null}function J(e){if(!e)return[];if(Array.isArray(e))return e;if(typeof e=="object"&&e!==null){const t=Object.keys(e).find(n=>Array.isArray(e[n]));if(t)return e[t]}return[]}async function Q(e,t,n,a,r){const o=await O({connectionId:e,orgId:t,orgSlug:n});try{const s=await o.callTool({name:a,arguments:r});return s.structuredContent??s}finally{await o.close().catch(console.error)}}let G="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",$=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=G[n[e]&63];return t};function j(e){return`${e}_${$()}`}function K(e){return e._meta?.["mcp.mesh"]?.appName||e.server?.name||null}function V(e){if(!e?.url)return"Unknown";try{return new URL(e.url).hostname}catch{return e.url}}function W(e){const t=e?.identifier||e?.name;return t?t.replace(/^@[^/]+\//,"").replace(/[-_]/g," ").replace(/\b\w/g,a=>a.toUpperCase()):"Unknown"}function X(e,t,n,a){const r=e.server,o=e._meta?.[x],s=new Date().toISOString(),I=o?.friendlyName||o?.friendly_name||e.title||r?.title||r?.name||"Unnamed MCP Server",R=r?.description||null,k=r?.icons?.[0]?.src||H(r?.repository)||null,i=o?.oauth_config,w=i&&typeof i.authorizationEndpoint=="string"&&typeof i.tokenEndpoint=="string"&&typeof i.clientId=="string"&&Array.isArray(i.scopes)&&(i.grantType==="authorization_code"||i.grantType==="client_credentials")?i:null,A=o?.configuration_state,C=o?.configuration_scopes,P=r?.repository?{url:r.repository.url,source:r.repository.source,subfolder:r.repository.subfolder}:null,p=r?.packages??[],m=r?.remotes??[],v=a?.packageIndex??0,S=a?.remoteIndex??0,y=p.length>0&&a?.packageIndex!==void 0,c=y?p[v]:null,l=y?null:m[S];let u,f,h=null;if(c){const _=c.identifier||c.name;u="STDIO",f="";const d={};if(c.environmentVariables)for(const b of c.environmentVariables)b.name&&(d[b.name]="");h={command:"npx",args:_?["-y",_]:[],...Object.keys(d).length>0&&{envVars:d}}}else l?(u=D(l.type)||"HTTP",f=l.url||""):(u="HTTP",f="");const N=m.length>1,M=p.length>1;let g="";c&&M?g=` (${W(c)})`:l&&N&&(g=` (${V(l)})`);const E=I+g;return{id:j("conn"),title:E,description:R,icon:k,app_name:K(e),app_id:o?.id||e.id||null,connection_type:u,connection_url:f,connection_token:null,connection_headers:h,oauth_config:w,configuration_state:A??null,configuration_scopes:C??null,metadata:{source:"store",registry_item_id:e.id,verified:o?.verified??!1,scopeName:o?.scopeName??null,toolsCount:o?.tools?.length??0,publishedAt:o?.publishedAt??null,repository:P},created_at:s,updated_at:s,created_by:n,organization_id:t,tools:null,bindings:null,status:"inactive"}}export{K as a,H as b,Q as c,J as d,X as e,B as f,j as g,q as i};
@@ -1,2 +1,2 @@
1
- import{e as Ke,r as l,j as i,l as re,B as fe,c as Ve,F as ut,n as $,K as Te}from"./index-D6izOmjj.js";import{F as mt,l as pt}from"./index-BrlqF8mC.js";import{e as ht,at as xt,au as gt,av as ae,aw as yt,N as $e}from"./agent-icon-CS5ajDLh.js";import{a as wt}from"./Tool01-DpllcZ_x.js";import{s as jt}from"./XClose-BGdHen0O.js";import{S as bt}from"./scroll-area-D-wTiagO.js";import{b as Oe,T as Re,a as ze}from"./tooltip-Bk2FCtKr.js";import{f as vt,a as Ct,b as Nt,c as St,d as Dt,e as kt,A as Ft,g as Lt}from"./alert-dialog-BzcSSmOH.js";import{u as Et}from"./chat-context-BsFLDszr.js";import{b as Pt}from"./shell-layout-BuKC3YO-.js";import{ac as le,ad as Ae,ae as Tt}from"./index-UgUz8dNz.js";import{a as $t,b as Ot,D as Rt,e as zt,c as At,d as Wt}from"./dialog-DXahQA5F.js";import{I as We}from"./input-DP3XvpLN.js";import{b as It,C as _,a as Ie,c as Mt,d as Kt}from"./context-menu-9HQTa5U2.js";import{t as Vt}from"./ChevronDown-DAwDO8g3.js";import{i as Bt}from"./ChevronRight-CxzKR4UY.js";import{a as Gt}from"./ZoomOut-B_lAoymB.js";import{E as qt,z as Me,A as he,B as Qt,C as Ut,D as Jt,G as M,I as ce,g as xe,J as ge,K as Ht,M as Xt,N as ye,O as de,P as we,Q as Yt,U as Zt}from"./preview-dialog-NbAEidmd.js";import"./AlertCircle-B-Zk3zY-.js";import"./SwitchHorizontal01-BVb8cFOW.js";import"./Settings02-BX75SJ47.js";import"./XCircle-DheND3p1.js";import"./ArrowUpRight-DrUVVTac.js";import"./ZapSquare-BILpiibq.js";import"./Users03-D3FPHz00.js";import"./CheckCircle-DgjXE82G.js";import"./ChevronUp-Bu9JV4C-.js";import"./ChevronLeft-BoWRf6EK.js";import"./DotsVertical-CSx815oq.js";import"./Stars02-CCs6aX7m.js";import"./Eye-Clz4yV9V.js";import"./Globe01-rz2h7Ebm.js";import"./FilterLines-CCXAkAAh.js";import"./Star01-CqiKSE8w.js";import"./Globe04-ZAH-y7Tv.js";import"./HardDrive-CdL1msYN.js";import"./Key01-Cd33I9n1.js";import"./LayoutLeft-Cx1gVHzQ.js";import"./LinkExternal01-DQqosIE7.js";import"./Monitor01-DtUT2Llg.js";import"./Sun-0mP8ve2O.js";import"./Palette-CS46pFVA.js";import"./Play-CFAWCyYY.js";import"./Plus-Cl80ngk-.js";import"./SearchMd-DtbjJ0sS.js";import"./Shield01-CY7h3_lL.js";import"./Stars01-CfOrOYJQ.js";import"./Trash01-B4p5GuSp.js";import"./Upload01--GcqA8-Q.js";import"./User01-DxuO8uwX.js";import"./Users01-a4XMjW3H.js";import"./X-ciDfeMTV.js";import"./Zap-Dc-gCUi7.js";import"./use-clock-tick-CpGRUyLX.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-B9rnfiig.js";import"./file-type-icon-CD_RZ8rl.js";import"./tab-id-BptcWVWa.js";import"./content-blocks-o63cs2vh.js";import"./types-CR3zyk0T.js";import"./use-mcp-client-vlTb1_vQ.js";import"./auth-D8scdv8L.js";import"./hooks-C1I2Fhg2.js";import"./decopilot-sse-pool-BP59aBkW.js";import"./studio-tools-BBnH3MVd.js";import"./sheet-CGQ0l6o4.js";import"./integration-icon-DZ46sqDL.js";import"./use-virtual-mcp-D63srVIz.js";import"./use-collections-CCMEiGqY.js";import"./use-navigate-to-agent-CKBlqEnY.js";import"./use-connection-rF7aVJWi.js";import"./use-mcp-prompts-CGFuFPsL.js";import"./form-C9CSHpUw.js";import"./label-CVIIqU26.js";import"./select-CjjjXRUS.js";import"./use-ai-providers-BuPYcyWU.js";import"./use-organization-settings-BBq2AfS3.js";import"./avatar-CCN_co-X.js";import"./required-auth-layout-Czm4wEhq.js";import"./useRouterState-Cy8ALVZD.js";import"./use-org-sso-CGb3XUqQ.js";import"./index-CZ67kZ1v.js";import"./drawer-BBC9hSU8.js";import"./collection-search-lIRYT3yV.js";import"./tabs-DY3LqT6S.js";import"./toggle-group-CYBCkLka.js";import"./use-deco-credits-DkHNnq8a.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-Ci8mCMyz.js";import"./use-registry-connections-Qh4o2c-N.js";import"./useInfiniteQuery-Dtdh4OJ7.js";import"./use-infinite-scroll-MECqtkyO.js";import"./extract-connection-data-CyP5_ll7.js";import"./card-BTSltukm.js";import"./collection-tabs-DjP3Ny2m.js";import"./badge-BPsAZTXm.js";import"./textarea-DNK54KKl.js";import"./connection-form-helpers-Dl_gZPK3.js";import"./useSuspenseInfiniteQuery-DcCILGRB.js";import"./mcp-oauth-MmhxfzLz.js";import"./connect-desktop-dialog-CRKR2Xhc.js";import"./decopilot-Cd6VUSpu.js";import"./checkbox-M3DdO4ws.js";import"./skeleton-C_vWUNwW.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-Cj3AwHej.js";import"./popover-B5LJwz0j.js";import"./command-CrEXCPCP.js";import"./index-DQcT764V.js";import"./dropdown-menu-6REDhV5o.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-CqqJRu1j.js";import"./empty-state-DXDAVywR.js";import"./toolbar-L8diPmJo.js";import"./use-mcp-tools-Dl-9pwtN.js";import"./use-capability-C1x5gZYr.js";import"./shell-route-loading-CvANTPJP.js";import"./index-CN18RaKp.js";import"./switch-D5j5jKzb.js";import"./use-debounced-autosave-BoaPkBFT.js";import"./index-B62gT9En.js";import"./sidebar-Bf91anCU.js";import"./search-input-BpXZI4wE.js";import"./github-repo-picker-Duq8-HaY.js";import"./use-secrets-C45eD7gN.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./view-mode-toggle-DNC_S7KK.js";import"./select-model-DuC4X2jB.js";import"./use-automations-3CJWtIS7.js";import"./monaco-editor-BqXgJc7f.js";import"./automation-runs-C_CK9GUW.js";import"./table-HxKELBdZ.js";import"./use-members-DZbTKLCa.js";import"./use-org-auth-client-D79Jyhhp.js";import"./task-status-D5hR8PPt.js";import"./automation-list-row-BBCpkdMa.js";const _t={"new-file":{title:"New File",description:"Enter a name for the new file.",submit:"Create",placeholder:"filename.ts"},"new-folder":{title:"New Folder",description:"Enter a name for the new folder.",submit:"Create",placeholder:"folder-name"},rename:{title:"Rename",description:"Enter a new name for this item.",submit:"Rename",placeholder:"new-name"}};function en(y){const e=Ke.c(51),{open:c,mode:K,initialName:X,parentLabel:Q,isPending:A,onSubmit:V,onOpenChange:P}=y,W=X===void 0?"":X,o=A===void 0?!1:A,[p,O]=l.useState(W),[I,B]=l.useState(c),f=_t[K];c!==I&&(B(c),c&&O(W));let F;e[0]!==o||e[1]!==P?(F=E=>{!E&&!o&&P(!1)},e[0]=o,e[1]=P,e[2]=F):F=e[2];const U=F;let G;e[3]!==o||e[4]!==p||e[5]!==V?(G=async E=>{E.preventDefault();const z=p.trim();!z||o||await V(z)},e[3]=o,e[4]=p,e[5]=V,e[6]=G):G=e[6];const q=G;let L;e[7]!==f.title?(L=i.jsx($t,{children:f.title}),e[7]=f.title,e[8]=L):L=e[8];let N;e[9]!==f.description?(N=i.jsx(Ot,{children:f.description}),e[9]=f.description,e[10]=N):N=e[10];let R;e[11]!==L||e[12]!==N?(R=i.jsxs(Rt,{children:[L,N]}),e[11]=L,e[12]=N,e[13]=R):R=e[13];let S;e[14]!==Q?(S=Q&&i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Location"}),i.jsx(We,{value:Q,readOnly:!0,disabled:!0,className:"font-mono text-xs"})]}),e[14]=Q,e[15]=S):S=e[15];let D;e[16]===Symbol.for("react.memo_cache_sentinel")?(D=i.jsx("label",{htmlFor:"file-explorer-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[16]=D):D=e[16];let j;e[17]===Symbol.for("react.memo_cache_sentinel")?(j=E=>O(E.target.value),e[17]=j):j=e[17];let b;e[18]!==f.placeholder||e[19]!==o||e[20]!==p?(b=i.jsxs("div",{className:"space-y-1.5",children:[D,i.jsx(We,{id:"file-explorer-name",value:p,onChange:j,placeholder:f.placeholder,autoFocus:!0,disabled:o})]}),e[18]=f.placeholder,e[19]=o,e[20]=p,e[21]=b):b=e[21];let h;e[22]!==b||e[23]!==S?(h=i.jsxs("div",{className:"space-y-4 py-4",children:[S,b]}),e[22]=b,e[23]=S,e[24]=h):h=e[24];let x;e[25]!==P?(x=()=>P(!1),e[25]=P,e[26]=x):x=e[26];let v;e[27]!==o||e[28]!==x?(v=i.jsx(fe,{type:"button",variant:"outline",onClick:x,disabled:o,children:"Cancel"}),e[27]=o,e[28]=x,e[29]=v):v=e[29];let C;e[30]!==o||e[31]!==p?(C=!p.trim()||o,e[30]=o,e[31]=p,e[32]=C):C=e[32];let u;e[33]!==f.submit||e[34]!==o?(u=o?i.jsxs(i.Fragment,{children:[i.jsx(re,{size:14,className:"animate-spin"}),"Saving…"]}):f.submit,e[33]=f.submit,e[34]=o,e[35]=u):u=e[35];let k;e[36]!==C||e[37]!==u?(k=i.jsx(fe,{type:"submit",disabled:C,children:u}),e[36]=C,e[37]=u,e[38]=k):k=e[38];let m;e[39]!==v||e[40]!==k?(m=i.jsxs(zt,{children:[v,k]}),e[39]=v,e[40]=k,e[41]=m):m=e[41];let g;e[42]!==q||e[43]!==h||e[44]!==m||e[45]!==R?(g=i.jsx(At,{className:"sm:max-w-md",children:i.jsxs("form",{onSubmit:q,children:[R,h,m]})}),e[42]=q,e[43]=h,e[44]=m,e[45]=R,e[46]=g):g=e[46];let T;return e[47]!==U||e[48]!==c||e[49]!==g?(T=i.jsx(Wt,{open:c,onOpenChange:U,children:g}),e[47]=U,e[48]=c,e[49]=g,e[50]=T):T=e[50],T}const tn="#d9a441";function nn(y){const e=Ke.c(45),{node:c,depth:K,isExpanded:X,isSelected:Q,isLoading:A,fileVisual:V,onOpen:P,onSelect:W,onNewFile:o,onNewFolder:p,onCopyPath:O,onCopyRelativePath:I,onRename:B,onDelete:f}=y,F=A===void 0?!1:A,U=c.kind==="directory",{Icon:G,color:q}=V,L=Q&&"bg-accent";let N;e[0]!==L?(N=Ve("flex w-full items-center gap-1.5 px-2 py-1.5 text-left text-[13px] hover:bg-accent transition-colors",L),e[0]=L,e[1]=N):N=e[1];const R=`${K*14+8}px`;let S;e[2]!==R?(S={paddingLeft:R},e[2]=R,e[3]=S):S=e[3];let D;e[4]!==P||e[5]!==W?(D=()=>{W(),P()},e[4]=P,e[5]=W,e[6]=D):D=e[6];let j;e[7]!==G||e[8]!==q||e[9]!==U||e[10]!==X||e[11]!==F?(j=U?i.jsxs(i.Fragment,{children:[F?i.jsx(re,{size:14,className:"shrink-0 animate-spin text-muted-foreground"}):X?i.jsx(Vt,{size:14,className:"shrink-0 text-muted-foreground"}):i.jsx(Bt,{size:14,className:"shrink-0 text-muted-foreground"}),i.jsx(Gt,{size:16,className:"shrink-0",style:{color:tn}})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"w-3.5 shrink-0"}),i.jsx(G,{size:16,className:"shrink-0",style:{color:q}})]}),e[7]=G,e[8]=q,e[9]=U,e[10]=X,e[11]=F,e[12]=j):j=e[12];let b;e[13]!==c.name?(b=i.jsx("span",{className:"truncate",children:c.name}),e[13]=c.name,e[14]=b):b=e[14];let h;e[15]!==N||e[16]!==S||e[17]!==D||e[18]!==j||e[19]!==b?(h=i.jsx(It,{asChild:!0,children:i.jsxs("button",{type:"button",className:N,style:S,onClick:D,children:[j,b]})}),e[15]=N,e[16]=S,e[17]=D,e[18]=j,e[19]=b,e[20]=h):h=e[20];let x;e[21]!==o?(x=i.jsx(_,{onSelect:o,children:"New File"}),e[21]=o,e[22]=x):x=e[22];let v;e[23]!==p?(v=i.jsx(_,{onSelect:p,children:"New Folder"}),e[23]=p,e[24]=v):v=e[24];let C;e[25]===Symbol.for("react.memo_cache_sentinel")?(C=i.jsx(Ie,{}),e[25]=C):C=e[25];let u;e[26]!==O?(u=i.jsx(_,{onSelect:O,children:"Copy Path"}),e[26]=O,e[27]=u):u=e[27];let k;e[28]!==I?(k=i.jsx(_,{onSelect:I,children:"Copy Relative Path"}),e[28]=I,e[29]=k):k=e[29];let m;e[30]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(Ie,{}),e[30]=m):m=e[30];let g;e[31]!==B?(g=i.jsx(_,{onSelect:B,children:"Rename"}),e[31]=B,e[32]=g):g=e[32];let T;e[33]!==f?(T=i.jsx(_,{variant:"destructive",onSelect:f,children:"Delete"}),e[33]=f,e[34]=T):T=e[34];let E;e[35]!==x||e[36]!==v||e[37]!==u||e[38]!==k||e[39]!==g||e[40]!==T?(E=i.jsxs(Mt,{className:"w-52",children:[x,v,C,u,k,m,g,T]}),e[35]=x,e[36]=v,e[37]=u,e[38]=k,e[39]=g,e[40]=T,e[41]=E):E=e[41];let z;return e[42]!==E||e[43]!==h?(z=i.jsxs(Kt,{children:[h,E]}),e[42]=E,e[43]=h,e[44]=z):z=e[44],z}pt.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.0/min/vs"}});function je(y,e,c,K){return`/api/${y}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(c)}/${K}`}function rn(y){const e=M(y);return!e||e.includes("..")||e.includes("\\")?!1:e.startsWith(".deco/blocks/")||!e.startsWith("/")&&!e.includes("://")}const sn="#94a3b8";function on(y){const e=y.toLowerCase();return e.endsWith(".tsx")||e.endsWith(".ts")?{Icon:ae,color:"#3b82f6"}:e.endsWith(".jsx")||e.endsWith(".js")||e.endsWith(".mjs")||e.endsWith(".cjs")?{Icon:ae,color:"#d9a441"}:e.endsWith(".json")?{Icon:yt,color:"#cb9b3f"}:e.endsWith(".css")||e.endsWith(".scss")?{Icon:ae,color:"#06b6d4"}:e.endsWith(".html")||e.endsWith(".xml")?{Icon:ae,color:"#f97316"}:/\.(png|jpe?g|gif|webp|avif|ico|svg)$/.test(e)?{Icon:wt,color:"#a855f7"}:e.endsWith(".md")||e.endsWith(".mdx")?{Icon:$e,color:"#64748b"}:{Icon:$e,color:sn}}function Ri({orgSlug:y,virtualMcpId:e,branch:c,openPath:K}){const[X,Q]=l.useState({files:[],directories:[],truncated:!1}),{files:A,directories:V}=X,[P,W]=l.useState(new Set),[o,p]=l.useState(null),[O,I]=l.useState(null),[B,f]=l.useState([]),[F,U]=l.useState(""),[G,q]=l.useState(!1),[L,N]=l.useState(!1),[,R]=l.useState(new Set),[S,D]=l.useState(new Set),j=l.useRef(0),b=l.useRef(null),h=l.useRef(new Set),x=l.useRef(new Map);function v(t){R(n=>{const r=typeof t=="function"?t(n):t;return h.current=r,r})}const[C,u]=l.useState(new Map),k=l.useRef(null),[m,g]=l.useState(null),{sendMessage:T}=Et(),{setChatOpen:E}=Pt(),z=ut(),[w,J]=l.useState(null),[H,ue]=l.useState(null),[ee,ie]=l.useState(!1);async function te(t,n){const r=await fetch(je(y,e,c,t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)});if(!r.ok){const s=await r.json().catch(()=>({}));throw new Error(s.error??`Request failed (${r.status})`)}return r.json()}async function se(){z.invalidateQueries({queryKey:Ae(y,e,c)})}function be(t,n){navigator.clipboard.writeText(n).then(()=>$.success(`${t} copied`),()=>$.error(`Failed to copy ${t.toLowerCase()}`))}function Be(t){const n=Yt(t);if(!n)return;const r=`${y}/${e}/${c}`;z.setQueryData(Te.decofile(r),s=>{if(!s)return s;const{[n]:a,...d}=s;return d}),z.invalidateQueries({queryKey:Te.liveMeta(r)})}function Ge(t){const n=t.kind==="file"?[t.path]:A.filter(r=>r.startsWith(".deco/blocks/")).map(r=>ce(r)).filter(r=>r===t.path||r.startsWith(`${t.path}/`));for(const r of n)Be(r)}function qe(t){const n=ce(t);return B.filter(r=>{if(r!==n&&!r.startsWith(`${n}/`))return!1;const s=C.get(r);return!!(s?.loaded&&s.editorValue!==s.savedContent)})}function ve(t){f(n=>n.map(r=>t(r)).filter(r=>r!==null)),p(n=>n&&t(n)),u(n=>{const r=new Map;for(const[s,a]of n){const d=t(s);d&&r.set(d,a)}return r}),I(n=>{if(!n)return n;const r=t(n.path);return r?r===n.path?n:{...n,path:r,name:r.split("/").pop()??r}:null})}function Qe(t){const n=ce(t);I(r=>r&&(r.path===n||r.path.startsWith(`${n}/`)?null:r)),ve(r=>r===n||r.startsWith(`${n}/`)?null:r)}async function Ue(t){if(!w)return;const n=de(w.parentDir,t);if(we(n,A,V))throw new Error(`"${t}" already exists`);await te("write",{path:M(n),content:""}),await ne(),await se(),J(null),me(n)}async function Je(t){if(!w)return;const n=de(w.parentDir,t);if(we(n,A,V))throw new Error(`"${t}" already exists`);const r=M(n);await te("mkdir",{path:r}),Q(s=>({...s,directories:s.directories.includes(r)?s.directories:[...s.directories,r]})),await ne(),await se(),J(null),W(s=>{const a=new Set(s);for(const d of he(n))a.add(d);return a.add(n),a}),I({name:t,path:n,kind:"directory",children:[]})}async function He(t){if(!w)return;const n=w.node.path,r=ye(n),s=de(r,t);if(s===n){J(null);return}if(we(s,A,V))throw new Error(`"${t}" already exists`);await te("rename",{from:M(n),to:M(s)}),ve(a=>a===n?s:a.startsWith(`${n}/`)?de(s,a.slice(n.length+1)):a),await ne(),await se(),J(null)}async function Xe(t){ie(!0);try{await te("unlink",{path:M(t.path),recursive:t.kind==="directory"}),Ge(t),Qe(t.path),await ne(),await se(),ue(null),$.success(`Deleted "${t.name}"`)}catch(n){$.error(n instanceof Error?n.message:"Delete failed")}finally{ie(!1)}}async function Ye(t){const n=Xt(t);if(n){$.error(n);return}ie(!0);try{w?.mode==="new-file"?(await Ue(t),$.success(`Created "${t}"`)):w?.mode==="new-folder"?(await Je(t),$.success(`Created folder "${t}"`)):w?.mode==="rename"&&(await He(t),$.success(`Renamed to "${t}"`))}catch(r){$.error(r instanceof Error?r.message:"Operation failed")}finally{ie(!1)}}const Ce=l.useRef(!1);Ce.current||(Ce.current=!0,b.current=ne());const[Ze,_e]=l.useState(null);if(K&&K!==Ze){_e(K);const t=K;queueMicrotask(()=>{rn(t)&&me(t).catch(n=>{$.error(n instanceof Error?n.message:"Failed to open file")})})}async function Ne(t){const n=await te("glob",t);return{files:n.files??[],directories:n.directories??[],truncated:n.truncated}}function Se(t,n,r){if(r!==j.current)return!1;let s=!1;return Q(a=>{const d=n?Zt(a.files,a.directories,t,a.truncated):{files:t.files,directories:t.directories??[],truncated:!!t.truncated};return s=!!d.truncated,{files:d.files,directories:d.directories,truncated:s}}),s&&$.warning("File list truncated — some files may be hidden"),s}async function et(t){const n=x.current.get(t);if(n)return n;const r=j.current,s=(async()=>{const a=await Ne({pattern:"**/*",path:M(t),limit:Me}),d=Se(a,!0,r);return!d&&r===j.current&&v(Y=>{const oe=new Set(Y);return oe.add(t),oe}),d})();x.current.set(t,s);try{return await s}finally{x.current.delete(t)}}async function De(t){if(!ge(t,h.current))return!1;D(n=>new Set(n).add(t));try{return await et(t)}finally{D(n=>{const r=new Set(n);return r.delete(t),r})}}async function tt(t){const n=new Set(h.current);for(const r of he(t)){if(!ge(r,n))continue;if(await De(r))throw new Error("Folder listing truncated — expand again to load more");n.add(r)}}async function ne(){const t=++j.current;x.current.clear(),q(!0),v(new Set),W(new Set),D(new Set);try{const n=await Ne({pattern:"**/*",limit:Me,maxDepth:qt});Se(n,!1,t),N(!0)}catch{L&&$.error("Failed to refresh file tree")}finally{q(!1)}}async function ke(t){if(!C.get(t)?.loaded){u(r=>{const s=new Map(r);return s.set(t,{savedContent:"",editorValue:"",loaded:!1}),s});try{const r=await fetch(je(y,e,c,"read"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:M(t),full:!0})});if(!r.ok)return;const s=await r.json(),a=Ht(s.content??"");u(d=>{const Y=new Map(d);return Y.set(t,{savedContent:a,editorValue:a,loaded:!0}),Y})}catch{}}}async function nt(t,n){try{const r=await fetch(je(y,e,c,"write"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:M(t),content:n})});if(!r.ok){le("file save failed",{path:t,status:r.status});return}le("file saved via sandbox /write",{path:t}),z.invalidateQueries({queryKey:Ae(y,e,c)});try{const s=await Tt(y,e,c);le("git status after save",s)}catch(s){le("git status after save failed",{path:t,error:s instanceof Error?s.message:String(s)})}u(s=>{const a=new Map(s),d=a.get(t);return d&&a.set(t,{...d,savedContent:n}),a})}catch{}}function rt(t){p(t),I({name:t.split("/").pop()??t,path:t,kind:"file",children:[]}),g(null),B.includes(t)||f(n=>[...n,t]),ke(t)}function it(t){f(n=>{const r=n.filter(s=>s!==t);return o===t&&p(r[r.length-1]??null),r}),u(n=>{const r=new Map(n);return r.delete(t),r})}function Fe(t){W(n=>{const r=new Set(n);return r.has(t)?r.delete(t):r.add(t),r})}async function st(t){if(ge(t,h.current))try{if(await De(t))return}catch(n){$.error(n instanceof Error?n.message:"Failed to load folder");return}Fe(t)}async function ot(t,n){if(n){Fe(t);return}await st(t)}async function me(t){await b.current,await tt(t);const n=he(t);W(r=>{const s=new Set(r);for(const a of n)s.add(a);return s}),rt(t)}function at(){return O?.kind==="directory"?O.path:O?.kind==="file"?ye(O.path):o?ye(o):"/"}function Le(t){const n=at();J({mode:t,parentDir:n,node:{name:"",path:n,kind:"directory",children:[]}})}const lt=Qt(A,V),Ee=Ut(lt,P),Pe=F?Ee.filter(t=>t.node.name.toLowerCase().includes(F.toLowerCase())):Ee,Z=o?C.get(o):null,ct=Z?.loaded&&Z.editorValue!==Z.savedContent,pe=H?qe(H.path):[],dt=(t,n)=>{k.current=t,t.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.KeyS,async()=>{if(!o)return;const r=t.getValue();await nt(o,r)}),t.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.KeyK,()=>{const r=t.getSelection(),s=t.getModel();if(!r||!s||!o)return;const a=s.getValueInRange(r);g({filePath:o,lineStart:r.startLineNumber,lineEnd:r.endLineNumber,selectedCode:a})})};function ft(t){if(!m)return;const n=[`The user selected code in the file explorer and asked: **"${t.trim()}"**`,"",`**File:** \`${m.filePath}\``,`**Lines:** ${m.lineStart}–${m.lineEnd}`];if(m.selectedCode){const r=xe(m.filePath),s=m.selectedCode.replace(/```/g,"`` `");n.push("","**Selected code:**","```"+r,s,"```")}n.push("","Please read the source file, locate the code, and apply the requested change."),E(!0),T({parts:[{type:"text",text:n.join(`
1
+ import{e as Ke,r as l,j as i,l as re,B as fe,c as Ve,F as ut,n as $,K as Te}from"./index-COlSsy5J.js";import{F as mt,l as pt}from"./index-C_H1H79r.js";import{e as ht,at as xt,au as gt,av as ae,aw as yt,N as $e}from"./agent-icon-B1KjkGhC.js";import{a as wt}from"./Tool01-B4m3Gnpd.js";import{s as jt}from"./XClose-CnYr1LOo.js";import{S as bt}from"./scroll-area-DOnfhZQE.js";import{b as Oe,T as Re,a as ze}from"./tooltip-D5U362dF.js";import{f as vt,a as Ct,b as Nt,c as St,d as Dt,e as kt,A as Ft,g as Lt}from"./alert-dialog-DvJDYQsM.js";import{u as Et}from"./chat-context-B_U1gcun.js";import{b as Pt}from"./shell-layout-Cx--9PV8.js";import{ac as le,ad as Ae,ae as Tt}from"./index-BW5f_EaT.js";import{a as $t,b as Ot,D as Rt,e as zt,c as At,d as Wt}from"./dialog-BMBVdX8K.js";import{I as We}from"./input-CuVtlRv5.js";import{b as It,C as _,a as Ie,c as Mt,d as Kt}from"./context-menu-CtPFsuQw.js";import{t as Vt}from"./ChevronDown-BldydMJ0.js";import{i as Bt}from"./ChevronRight-BsknZQE_.js";import{a as Gt}from"./ZoomOut-DYeUJTmS.js";import{E as qt,z as Me,A as he,B as Qt,C as Ut,D as Jt,G as M,I as ce,g as xe,J as ge,K as Ht,M as Xt,N as ye,O as de,P as we,Q as Yt,U as Zt}from"./preview-dialog-HeEAXFdp.js";import"./AlertCircle-Dnqz3IxM.js";import"./SwitchHorizontal01-Ca_h3hG5.js";import"./Settings02-BcW_Yd93.js";import"./XCircle-CpovmLEO.js";import"./ArrowUpRight-B2NXgTf2.js";import"./ZapSquare-ChOMpHGM.js";import"./Users03-CJ4lkyfr.js";import"./CheckCircle-D9OslXZP.js";import"./ChevronUp-CjDXfs3K.js";import"./ChevronLeft-CXmppBJO.js";import"./DotsVertical-Ci1mVPsb.js";import"./Stars02-CB3UMWzf.js";import"./Eye-DifA9NHq.js";import"./Globe01-CMUrlGmF.js";import"./FilterLines-CV07u96M.js";import"./Star01-DxJIcjLz.js";import"./Globe04-BplUDurZ.js";import"./HardDrive-B6V7BYZB.js";import"./Key01-DGn_JEBu.js";import"./LayoutLeft-BI32Ru47.js";import"./LinkExternal01-DwIqUvLe.js";import"./Monitor01-C-tOv611.js";import"./Sun-CTchQz03.js";import"./Palette-pjBymHRy.js";import"./Play-BEuZCxsN.js";import"./Plus-DHJbi1i9.js";import"./SearchMd-yvCGxslh.js";import"./Shield01-DXFrycnj.js";import"./Stars01-Dr_rOBxK.js";import"./Trash01-BDNQcRq9.js";import"./Upload01-CuyZwIAy.js";import"./User01-kj3Bxvgl.js";import"./Users01-DM4FmEoT.js";import"./X-Botvp-t_.js";import"./Zap-8NdOr1pq.js";import"./use-clock-tick-DkwKhG1v.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-CqTP6NE5.js";import"./file-type-icon-DURyeK9L.js";import"./tab-id-BptcWVWa.js";import"./content-blocks-o63cs2vh.js";import"./types-C-QYkfD4.js";import"./use-mcp-client-CK2bE_Wl.js";import"./auth-DA6X7KBB.js";import"./hooks-DlDryoZW.js";import"./decopilot-sse-pool-DdZSTixQ.js";import"./studio-tools-CyTucPcW.js";import"./sheet-Cn8FwYbD.js";import"./integration-icon-RqT66_6U.js";import"./use-virtual-mcp-DPWDEWCb.js";import"./use-collections-D4JsVK-B.js";import"./use-navigate-to-agent-C2rXzvAb.js";import"./use-connection-C7Z8M26w.js";import"./use-mcp-prompts--L5Py2oF.js";import"./form-CdGhzS_x.js";import"./label-BCRIEPd0.js";import"./select-Dqs7Z4yG.js";import"./use-ai-providers-CLZQ64DO.js";import"./use-organization-settings-CiSDOMOC.js";import"./avatar-D7wKrjgH.js";import"./required-auth-layout-D9YU16Eu.js";import"./useRouterState-q7ojL5Do.js";import"./use-org-sso-Dh5HCYSJ.js";import"./index-DEanDL8Y.js";import"./drawer-TLQRWcN-.js";import"./collection-search-BSHmVsv0.js";import"./tabs-DAvIQWby.js";import"./toggle-group-WKZVvwQm.js";import"./use-deco-credits-Cm6qycwc.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-CzT4sqi7.js";import"./use-registry-connections-rHz6zGP7.js";import"./useInfiniteQuery-BS_m7Y7W.js";import"./use-infinite-scroll-SjuQvrxH.js";import"./extract-connection-data-BsbTS0uC.js";import"./card-BtNxdFil.js";import"./collection-tabs-CghGabs6.js";import"./badge-Rj4w6Y9D.js";import"./textarea-DsT2vsGj.js";import"./connection-form-helpers-CuaSwKDp.js";import"./useSuspenseInfiniteQuery-CHHT-uCm.js";import"./mcp-oauth-kSTvScdZ.js";import"./connect-desktop-dialog-Cq5se3ri.js";import"./decopilot-Bw9nv9Fa.js";import"./checkbox-CzoSEbjC.js";import"./skeleton-Bo_6Cq99.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-BqnJtUWr.js";import"./popover-rRtv1RUJ.js";import"./command-CYqVDIDi.js";import"./index-D4WUCfu0.js";import"./dropdown-menu-gXn3xVef.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-BmR3uEUx.js";import"./empty-state-SvMp_sYN.js";import"./toolbar-BfY48AQu.js";import"./use-mcp-tools-B7wduqbV.js";import"./use-capability-XIhIuFk7.js";import"./shell-route-loading-Brmd2_HQ.js";import"./index-B66xjk-i.js";import"./switch-CorAlxCf.js";import"./use-debounced-autosave-B8dr6XMC.js";import"./index-CkC7ek4r.js";import"./sidebar-D1LCPjC8.js";import"./search-input-Dh2xeHiv.js";import"./github-repo-picker-Db3xiFzy.js";import"./use-secrets-DLuniCTL.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./view-mode-toggle-CeXLSv0R.js";import"./select-model-bXVR8jvT.js";import"./use-automations-DNKM1hXI.js";import"./monaco-editor-DNLiFjHn.js";import"./automation-runs-CHVaaxN6.js";import"./table-Gv4tJy7V.js";import"./use-members-CYuArAru.js";import"./use-org-auth-client-BYQp-Udb.js";import"./task-status-BfeF--n0.js";import"./automation-list-row-BIiojY8I.js";const _t={"new-file":{title:"New File",description:"Enter a name for the new file.",submit:"Create",placeholder:"filename.ts"},"new-folder":{title:"New Folder",description:"Enter a name for the new folder.",submit:"Create",placeholder:"folder-name"},rename:{title:"Rename",description:"Enter a new name for this item.",submit:"Rename",placeholder:"new-name"}};function en(y){const e=Ke.c(51),{open:c,mode:K,initialName:X,parentLabel:Q,isPending:A,onSubmit:V,onOpenChange:P}=y,W=X===void 0?"":X,o=A===void 0?!1:A,[p,O]=l.useState(W),[I,B]=l.useState(c),f=_t[K];c!==I&&(B(c),c&&O(W));let F;e[0]!==o||e[1]!==P?(F=E=>{!E&&!o&&P(!1)},e[0]=o,e[1]=P,e[2]=F):F=e[2];const U=F;let G;e[3]!==o||e[4]!==p||e[5]!==V?(G=async E=>{E.preventDefault();const z=p.trim();!z||o||await V(z)},e[3]=o,e[4]=p,e[5]=V,e[6]=G):G=e[6];const q=G;let L;e[7]!==f.title?(L=i.jsx($t,{children:f.title}),e[7]=f.title,e[8]=L):L=e[8];let N;e[9]!==f.description?(N=i.jsx(Ot,{children:f.description}),e[9]=f.description,e[10]=N):N=e[10];let R;e[11]!==L||e[12]!==N?(R=i.jsxs(Rt,{children:[L,N]}),e[11]=L,e[12]=N,e[13]=R):R=e[13];let S;e[14]!==Q?(S=Q&&i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Location"}),i.jsx(We,{value:Q,readOnly:!0,disabled:!0,className:"font-mono text-xs"})]}),e[14]=Q,e[15]=S):S=e[15];let D;e[16]===Symbol.for("react.memo_cache_sentinel")?(D=i.jsx("label",{htmlFor:"file-explorer-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[16]=D):D=e[16];let j;e[17]===Symbol.for("react.memo_cache_sentinel")?(j=E=>O(E.target.value),e[17]=j):j=e[17];let b;e[18]!==f.placeholder||e[19]!==o||e[20]!==p?(b=i.jsxs("div",{className:"space-y-1.5",children:[D,i.jsx(We,{id:"file-explorer-name",value:p,onChange:j,placeholder:f.placeholder,autoFocus:!0,disabled:o})]}),e[18]=f.placeholder,e[19]=o,e[20]=p,e[21]=b):b=e[21];let h;e[22]!==b||e[23]!==S?(h=i.jsxs("div",{className:"space-y-4 py-4",children:[S,b]}),e[22]=b,e[23]=S,e[24]=h):h=e[24];let x;e[25]!==P?(x=()=>P(!1),e[25]=P,e[26]=x):x=e[26];let v;e[27]!==o||e[28]!==x?(v=i.jsx(fe,{type:"button",variant:"outline",onClick:x,disabled:o,children:"Cancel"}),e[27]=o,e[28]=x,e[29]=v):v=e[29];let C;e[30]!==o||e[31]!==p?(C=!p.trim()||o,e[30]=o,e[31]=p,e[32]=C):C=e[32];let u;e[33]!==f.submit||e[34]!==o?(u=o?i.jsxs(i.Fragment,{children:[i.jsx(re,{size:14,className:"animate-spin"}),"Saving…"]}):f.submit,e[33]=f.submit,e[34]=o,e[35]=u):u=e[35];let k;e[36]!==C||e[37]!==u?(k=i.jsx(fe,{type:"submit",disabled:C,children:u}),e[36]=C,e[37]=u,e[38]=k):k=e[38];let m;e[39]!==v||e[40]!==k?(m=i.jsxs(zt,{children:[v,k]}),e[39]=v,e[40]=k,e[41]=m):m=e[41];let g;e[42]!==q||e[43]!==h||e[44]!==m||e[45]!==R?(g=i.jsx(At,{className:"sm:max-w-md",children:i.jsxs("form",{onSubmit:q,children:[R,h,m]})}),e[42]=q,e[43]=h,e[44]=m,e[45]=R,e[46]=g):g=e[46];let T;return e[47]!==U||e[48]!==c||e[49]!==g?(T=i.jsx(Wt,{open:c,onOpenChange:U,children:g}),e[47]=U,e[48]=c,e[49]=g,e[50]=T):T=e[50],T}const tn="#d9a441";function nn(y){const e=Ke.c(45),{node:c,depth:K,isExpanded:X,isSelected:Q,isLoading:A,fileVisual:V,onOpen:P,onSelect:W,onNewFile:o,onNewFolder:p,onCopyPath:O,onCopyRelativePath:I,onRename:B,onDelete:f}=y,F=A===void 0?!1:A,U=c.kind==="directory",{Icon:G,color:q}=V,L=Q&&"bg-accent";let N;e[0]!==L?(N=Ve("flex w-full items-center gap-1.5 px-2 py-1.5 text-left text-[13px] hover:bg-accent transition-colors",L),e[0]=L,e[1]=N):N=e[1];const R=`${K*14+8}px`;let S;e[2]!==R?(S={paddingLeft:R},e[2]=R,e[3]=S):S=e[3];let D;e[4]!==P||e[5]!==W?(D=()=>{W(),P()},e[4]=P,e[5]=W,e[6]=D):D=e[6];let j;e[7]!==G||e[8]!==q||e[9]!==U||e[10]!==X||e[11]!==F?(j=U?i.jsxs(i.Fragment,{children:[F?i.jsx(re,{size:14,className:"shrink-0 animate-spin text-muted-foreground"}):X?i.jsx(Vt,{size:14,className:"shrink-0 text-muted-foreground"}):i.jsx(Bt,{size:14,className:"shrink-0 text-muted-foreground"}),i.jsx(Gt,{size:16,className:"shrink-0",style:{color:tn}})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"w-3.5 shrink-0"}),i.jsx(G,{size:16,className:"shrink-0",style:{color:q}})]}),e[7]=G,e[8]=q,e[9]=U,e[10]=X,e[11]=F,e[12]=j):j=e[12];let b;e[13]!==c.name?(b=i.jsx("span",{className:"truncate",children:c.name}),e[13]=c.name,e[14]=b):b=e[14];let h;e[15]!==N||e[16]!==S||e[17]!==D||e[18]!==j||e[19]!==b?(h=i.jsx(It,{asChild:!0,children:i.jsxs("button",{type:"button",className:N,style:S,onClick:D,children:[j,b]})}),e[15]=N,e[16]=S,e[17]=D,e[18]=j,e[19]=b,e[20]=h):h=e[20];let x;e[21]!==o?(x=i.jsx(_,{onSelect:o,children:"New File"}),e[21]=o,e[22]=x):x=e[22];let v;e[23]!==p?(v=i.jsx(_,{onSelect:p,children:"New Folder"}),e[23]=p,e[24]=v):v=e[24];let C;e[25]===Symbol.for("react.memo_cache_sentinel")?(C=i.jsx(Ie,{}),e[25]=C):C=e[25];let u;e[26]!==O?(u=i.jsx(_,{onSelect:O,children:"Copy Path"}),e[26]=O,e[27]=u):u=e[27];let k;e[28]!==I?(k=i.jsx(_,{onSelect:I,children:"Copy Relative Path"}),e[28]=I,e[29]=k):k=e[29];let m;e[30]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(Ie,{}),e[30]=m):m=e[30];let g;e[31]!==B?(g=i.jsx(_,{onSelect:B,children:"Rename"}),e[31]=B,e[32]=g):g=e[32];let T;e[33]!==f?(T=i.jsx(_,{variant:"destructive",onSelect:f,children:"Delete"}),e[33]=f,e[34]=T):T=e[34];let E;e[35]!==x||e[36]!==v||e[37]!==u||e[38]!==k||e[39]!==g||e[40]!==T?(E=i.jsxs(Mt,{className:"w-52",children:[x,v,C,u,k,m,g,T]}),e[35]=x,e[36]=v,e[37]=u,e[38]=k,e[39]=g,e[40]=T,e[41]=E):E=e[41];let z;return e[42]!==E||e[43]!==h?(z=i.jsxs(Kt,{children:[h,E]}),e[42]=E,e[43]=h,e[44]=z):z=e[44],z}pt.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.0/min/vs"}});function je(y,e,c,K){return`/api/${y}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(c)}/${K}`}function rn(y){const e=M(y);return!e||e.includes("..")||e.includes("\\")?!1:e.startsWith(".deco/blocks/")||!e.startsWith("/")&&!e.includes("://")}const sn="#94a3b8";function on(y){const e=y.toLowerCase();return e.endsWith(".tsx")||e.endsWith(".ts")?{Icon:ae,color:"#3b82f6"}:e.endsWith(".jsx")||e.endsWith(".js")||e.endsWith(".mjs")||e.endsWith(".cjs")?{Icon:ae,color:"#d9a441"}:e.endsWith(".json")?{Icon:yt,color:"#cb9b3f"}:e.endsWith(".css")||e.endsWith(".scss")?{Icon:ae,color:"#06b6d4"}:e.endsWith(".html")||e.endsWith(".xml")?{Icon:ae,color:"#f97316"}:/\.(png|jpe?g|gif|webp|avif|ico|svg)$/.test(e)?{Icon:wt,color:"#a855f7"}:e.endsWith(".md")||e.endsWith(".mdx")?{Icon:$e,color:"#64748b"}:{Icon:$e,color:sn}}function Ri({orgSlug:y,virtualMcpId:e,branch:c,openPath:K}){const[X,Q]=l.useState({files:[],directories:[],truncated:!1}),{files:A,directories:V}=X,[P,W]=l.useState(new Set),[o,p]=l.useState(null),[O,I]=l.useState(null),[B,f]=l.useState([]),[F,U]=l.useState(""),[G,q]=l.useState(!1),[L,N]=l.useState(!1),[,R]=l.useState(new Set),[S,D]=l.useState(new Set),j=l.useRef(0),b=l.useRef(null),h=l.useRef(new Set),x=l.useRef(new Map);function v(t){R(n=>{const r=typeof t=="function"?t(n):t;return h.current=r,r})}const[C,u]=l.useState(new Map),k=l.useRef(null),[m,g]=l.useState(null),{sendMessage:T}=Et(),{setChatOpen:E}=Pt(),z=ut(),[w,J]=l.useState(null),[H,ue]=l.useState(null),[ee,ie]=l.useState(!1);async function te(t,n){const r=await fetch(je(y,e,c,t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)});if(!r.ok){const s=await r.json().catch(()=>({}));throw new Error(s.error??`Request failed (${r.status})`)}return r.json()}async function se(){z.invalidateQueries({queryKey:Ae(y,e,c)})}function be(t,n){navigator.clipboard.writeText(n).then(()=>$.success(`${t} copied`),()=>$.error(`Failed to copy ${t.toLowerCase()}`))}function Be(t){const n=Yt(t);if(!n)return;const r=`${y}/${e}/${c}`;z.setQueryData(Te.decofile(r),s=>{if(!s)return s;const{[n]:a,...d}=s;return d}),z.invalidateQueries({queryKey:Te.liveMeta(r)})}function Ge(t){const n=t.kind==="file"?[t.path]:A.filter(r=>r.startsWith(".deco/blocks/")).map(r=>ce(r)).filter(r=>r===t.path||r.startsWith(`${t.path}/`));for(const r of n)Be(r)}function qe(t){const n=ce(t);return B.filter(r=>{if(r!==n&&!r.startsWith(`${n}/`))return!1;const s=C.get(r);return!!(s?.loaded&&s.editorValue!==s.savedContent)})}function ve(t){f(n=>n.map(r=>t(r)).filter(r=>r!==null)),p(n=>n&&t(n)),u(n=>{const r=new Map;for(const[s,a]of n){const d=t(s);d&&r.set(d,a)}return r}),I(n=>{if(!n)return n;const r=t(n.path);return r?r===n.path?n:{...n,path:r,name:r.split("/").pop()??r}:null})}function Qe(t){const n=ce(t);I(r=>r&&(r.path===n||r.path.startsWith(`${n}/`)?null:r)),ve(r=>r===n||r.startsWith(`${n}/`)?null:r)}async function Ue(t){if(!w)return;const n=de(w.parentDir,t);if(we(n,A,V))throw new Error(`"${t}" already exists`);await te("write",{path:M(n),content:""}),await ne(),await se(),J(null),me(n)}async function Je(t){if(!w)return;const n=de(w.parentDir,t);if(we(n,A,V))throw new Error(`"${t}" already exists`);const r=M(n);await te("mkdir",{path:r}),Q(s=>({...s,directories:s.directories.includes(r)?s.directories:[...s.directories,r]})),await ne(),await se(),J(null),W(s=>{const a=new Set(s);for(const d of he(n))a.add(d);return a.add(n),a}),I({name:t,path:n,kind:"directory",children:[]})}async function He(t){if(!w)return;const n=w.node.path,r=ye(n),s=de(r,t);if(s===n){J(null);return}if(we(s,A,V))throw new Error(`"${t}" already exists`);await te("rename",{from:M(n),to:M(s)}),ve(a=>a===n?s:a.startsWith(`${n}/`)?de(s,a.slice(n.length+1)):a),await ne(),await se(),J(null)}async function Xe(t){ie(!0);try{await te("unlink",{path:M(t.path),recursive:t.kind==="directory"}),Ge(t),Qe(t.path),await ne(),await se(),ue(null),$.success(`Deleted "${t.name}"`)}catch(n){$.error(n instanceof Error?n.message:"Delete failed")}finally{ie(!1)}}async function Ye(t){const n=Xt(t);if(n){$.error(n);return}ie(!0);try{w?.mode==="new-file"?(await Ue(t),$.success(`Created "${t}"`)):w?.mode==="new-folder"?(await Je(t),$.success(`Created folder "${t}"`)):w?.mode==="rename"&&(await He(t),$.success(`Renamed to "${t}"`))}catch(r){$.error(r instanceof Error?r.message:"Operation failed")}finally{ie(!1)}}const Ce=l.useRef(!1);Ce.current||(Ce.current=!0,b.current=ne());const[Ze,_e]=l.useState(null);if(K&&K!==Ze){_e(K);const t=K;queueMicrotask(()=>{rn(t)&&me(t).catch(n=>{$.error(n instanceof Error?n.message:"Failed to open file")})})}async function Ne(t){const n=await te("glob",t);return{files:n.files??[],directories:n.directories??[],truncated:n.truncated}}function Se(t,n,r){if(r!==j.current)return!1;let s=!1;return Q(a=>{const d=n?Zt(a.files,a.directories,t,a.truncated):{files:t.files,directories:t.directories??[],truncated:!!t.truncated};return s=!!d.truncated,{files:d.files,directories:d.directories,truncated:s}}),s&&$.warning("File list truncated — some files may be hidden"),s}async function et(t){const n=x.current.get(t);if(n)return n;const r=j.current,s=(async()=>{const a=await Ne({pattern:"**/*",path:M(t),limit:Me}),d=Se(a,!0,r);return!d&&r===j.current&&v(Y=>{const oe=new Set(Y);return oe.add(t),oe}),d})();x.current.set(t,s);try{return await s}finally{x.current.delete(t)}}async function De(t){if(!ge(t,h.current))return!1;D(n=>new Set(n).add(t));try{return await et(t)}finally{D(n=>{const r=new Set(n);return r.delete(t),r})}}async function tt(t){const n=new Set(h.current);for(const r of he(t)){if(!ge(r,n))continue;if(await De(r))throw new Error("Folder listing truncated — expand again to load more");n.add(r)}}async function ne(){const t=++j.current;x.current.clear(),q(!0),v(new Set),W(new Set),D(new Set);try{const n=await Ne({pattern:"**/*",limit:Me,maxDepth:qt});Se(n,!1,t),N(!0)}catch{L&&$.error("Failed to refresh file tree")}finally{q(!1)}}async function ke(t){if(!C.get(t)?.loaded){u(r=>{const s=new Map(r);return s.set(t,{savedContent:"",editorValue:"",loaded:!1}),s});try{const r=await fetch(je(y,e,c,"read"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:M(t),full:!0})});if(!r.ok)return;const s=await r.json(),a=Ht(s.content??"");u(d=>{const Y=new Map(d);return Y.set(t,{savedContent:a,editorValue:a,loaded:!0}),Y})}catch{}}}async function nt(t,n){try{const r=await fetch(je(y,e,c,"write"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:M(t),content:n})});if(!r.ok){le("file save failed",{path:t,status:r.status});return}le("file saved via sandbox /write",{path:t}),z.invalidateQueries({queryKey:Ae(y,e,c)});try{const s=await Tt(y,e,c);le("git status after save",s)}catch(s){le("git status after save failed",{path:t,error:s instanceof Error?s.message:String(s)})}u(s=>{const a=new Map(s),d=a.get(t);return d&&a.set(t,{...d,savedContent:n}),a})}catch{}}function rt(t){p(t),I({name:t.split("/").pop()??t,path:t,kind:"file",children:[]}),g(null),B.includes(t)||f(n=>[...n,t]),ke(t)}function it(t){f(n=>{const r=n.filter(s=>s!==t);return o===t&&p(r[r.length-1]??null),r}),u(n=>{const r=new Map(n);return r.delete(t),r})}function Fe(t){W(n=>{const r=new Set(n);return r.has(t)?r.delete(t):r.add(t),r})}async function st(t){if(ge(t,h.current))try{if(await De(t))return}catch(n){$.error(n instanceof Error?n.message:"Failed to load folder");return}Fe(t)}async function ot(t,n){if(n){Fe(t);return}await st(t)}async function me(t){await b.current,await tt(t);const n=he(t);W(r=>{const s=new Set(r);for(const a of n)s.add(a);return s}),rt(t)}function at(){return O?.kind==="directory"?O.path:O?.kind==="file"?ye(O.path):o?ye(o):"/"}function Le(t){const n=at();J({mode:t,parentDir:n,node:{name:"",path:n,kind:"directory",children:[]}})}const lt=Qt(A,V),Ee=Ut(lt,P),Pe=F?Ee.filter(t=>t.node.name.toLowerCase().includes(F.toLowerCase())):Ee,Z=o?C.get(o):null,ct=Z?.loaded&&Z.editorValue!==Z.savedContent,pe=H?qe(H.path):[],dt=(t,n)=>{k.current=t,t.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.KeyS,async()=>{if(!o)return;const r=t.getValue();await nt(o,r)}),t.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.KeyK,()=>{const r=t.getSelection(),s=t.getModel();if(!r||!s||!o)return;const a=s.getValueInRange(r);g({filePath:o,lineStart:r.startLineNumber,lineEnd:r.endLineNumber,selectedCode:a})})};function ft(t){if(!m)return;const n=[`The user selected code in the file explorer and asked: **"${t.trim()}"**`,"",`**File:** \`${m.filePath}\``,`**Lines:** ${m.lineStart}–${m.lineEnd}`];if(m.selectedCode){const r=xe(m.filePath),s=m.selectedCode.replace(/```/g,"`` `");n.push("","**Selected code:**","```"+r,s,"```")}n.push("","Please read the source file, locate the code, and apply the requested change."),E(!0),T({parts:[{type:"text",text:n.join(`
2
2
  `)}]}),g(null)}return G&&!L?i.jsx("div",{className:"flex items-center justify-center h-full w-full",children:i.jsx(re,{size:20,className:"animate-spin text-muted-foreground"})}):i.jsxs("div",{className:"flex h-full w-full overflow-hidden",children:[i.jsxs("div",{className:"w-64 shrink-0 border-r flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex items-center gap-1 p-2 border-b",children:[i.jsxs("div",{className:"relative min-w-0 flex-1",children:[i.jsx(ht,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground"}),i.jsx("input",{type:"text",value:F,onChange:t=>U(t.target.value),placeholder:"Search files...","aria-label":"Search files",className:"w-full rounded-md border border-input bg-transparent pl-7 pr-2 py-1.5 text-xs outline-none placeholder:text-muted-foreground focus:ring-1 focus:ring-ring"})]}),i.jsxs(Oe,{children:[i.jsx(Re,{asChild:!0,children:i.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":"New file",onClick:()=>Le("new-file"),children:i.jsx(xt,{size:14})})}),i.jsx(ze,{side:"bottom",children:"New file"})]}),i.jsxs(Oe,{children:[i.jsx(Re,{asChild:!0,children:i.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":"New folder",onClick:()=>Le("new-folder"),children:i.jsx(gt,{size:14})})}),i.jsx(ze,{side:"bottom",children:"New folder"})]})]}),i.jsx(bt,{className:"flex-1",children:i.jsxs("div",{className:"py-1",children:[Pe.map(t=>{const{node:n,depth:r}=t,s=n.kind==="directory",a=P.has(n.path),d=O?.path===n.path,Y=Jt(n.path,n.kind),oe=s&&S.has(n.path);return i.jsx(nn,{node:n,depth:r,isExpanded:a,isSelected:d,isLoading:oe,fileVisual:on(n.name),onSelect:()=>I(n),onOpen:()=>{s?ot(n.path,a):me(n.path)},onNewFile:()=>J({mode:"new-file",node:n,parentDir:Y}),onNewFolder:()=>J({mode:"new-folder",node:n,parentDir:Y}),onCopyPath:()=>be("Path",ce(n.path)),onCopyRelativePath:()=>be("Relative path",M(n.path)),onRename:()=>J({mode:"rename",node:n,parentDir:Y}),onDelete:()=>ue(n)},n.path)}),L&&Pe.length===0&&i.jsx("div",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:F?`No files match "${F}"`:"No files found"})]})})]}),i.jsxs("div",{className:"relative flex-1 flex flex-col overflow-hidden",children:[B.length>0&&i.jsx("div",{className:"flex items-center border-b overflow-x-auto shrink-0",children:B.map(t=>{const n=C.get(t),r=n?.loaded&&n.editorValue!==n.savedContent,s=o===t,a=t.split("/").pop()??t;return i.jsxs("div",{className:Ve("flex items-center gap-1 px-3 py-1.5 text-xs border-r cursor-pointer transition-colors",s?"bg-background text-foreground":"bg-muted/50 text-muted-foreground hover:bg-accent"),onClick:()=>{p(t),ke(t)},onKeyDown:()=>{},role:"tab",tabIndex:0,"aria-selected":s,children:[i.jsx("span",{className:"truncate max-w-32",children:a}),r&&i.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-foreground/60 shrink-0"}),i.jsx("button",{type:"button",className:"ml-1 rounded p-0.5 hover:bg-accent-foreground/10",onClick:d=>{d.stopPropagation(),it(t)},children:i.jsx(jt,{size:12})})]},t)})}),m&&i.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 z-20 mt-2",style:{width:"360px"},children:i.jsxs("form",{className:"flex w-full items-center gap-1.5 rounded-xl border border-border bg-background/95 px-3 py-1.5 shadow-lg backdrop-blur",onSubmit:t=>{t.preventDefault();const r=t.currentTarget.elements.namedItem("askAiInput");r.value.trim()&&ft(r.value)},children:[i.jsx("input",{name:"askAiInput",autoFocus:!0,type:"text",placeholder:"Ask the AI...",className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground",onKeyDown:t=>{t.stopPropagation(),t.key==="Escape"&&g(null)}}),i.jsx("button",{type:"submit",className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-foreground text-background transition-opacity",title:"Send",children:i.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:[i.jsx("title",{children:"Send"}),i.jsx("path",{d:"M5 9V1M1 5l4-4 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})}),i.jsx("div",{className:"flex-1 overflow-hidden",children:o&&Z?.loaded?i.jsx(mt,{language:xe(o),theme:document.documentElement.classList.contains("dark")?"vs-dark":"light",value:Z.editorValue,path:o,onChange:t=>{const n=o;n&&u(r=>{const s=new Map(r),a=s.get(n);return a&&s.set(n,{...a,editorValue:t??""}),s})},onMount:dt,loading:i.jsx("div",{className:"flex items-center justify-center h-full w-full",children:i.jsx(re,{size:20,className:"animate-spin text-muted-foreground"})}),options:{fontSize:13,scrollBeyondLastLine:!1,automaticLayout:!0,lineNumbersMinChars:2,wordWrap:"on",minimap:{enabled:!1},padding:{top:12,bottom:12},scrollbar:{vertical:"auto",horizontal:"auto",verticalScrollbarSize:8,horizontalScrollbarSize:8}}},o):o&&!Z?.loaded?i.jsx("div",{className:"flex items-center justify-center h-full w-full",children:i.jsx(re,{size:20,className:"animate-spin text-muted-foreground"})}):i.jsx("div",{className:"flex items-center justify-center h-full w-full text-sm text-muted-foreground",children:"Select a file to edit"})}),o&&i.jsxs("div",{className:"flex items-center justify-between px-3 py-1 border-t text-[11px] text-muted-foreground shrink-0",children:[i.jsx("span",{className:"truncate",children:o}),i.jsxs("span",{children:[ct?"Modified":"Saved"," ·"," ",xe(o)]})]})]}),i.jsx(en,{open:w!==null,mode:w?.mode??"new-file",initialName:w?.mode==="rename"?w.node.name:"",parentLabel:w&&w.mode!=="rename"?w.parentDir==="/"?"/":M(w.parentDir):void 0,isPending:ee,onSubmit:Ye,onOpenChange:t=>{!t&&!ee&&J(null)}}),i.jsx(vt,{open:H!==null,onOpenChange:t=>{!t&&!ee&&ue(null)},children:i.jsxs(Ct,{children:[i.jsxs(Nt,{children:[i.jsxs(St,{children:["Delete ",H?.kind==="directory"?"folder":"file","?"]}),i.jsxs(Dt,{children:["This will permanently delete"," ",i.jsx("span",{className:"font-mono",children:H?.name}),H?.kind==="directory"?" and everything inside it.":".",pe.length>0&&i.jsxs(i.Fragment,{children:[" ",pe.length===1?"One open file has unsaved changes that will be lost.":`${pe.length} open files have unsaved changes that will be lost.`]})]})]}),i.jsxs(kt,{children:[i.jsx(Ft,{disabled:ee,children:"Cancel"}),i.jsx(Lt,{disabled:ee||!H,onClick:t=>{t.preventDefault(),H&&Xe(H)},children:"Delete"})]})]})})]})}export{Ri as FileExplorer};
@@ -1,4 +1,4 @@
1
- import{bw as zl,j as q,af as lt,bO as zn,r as Ve,bP as b0,c as Gb,e as Ke,f as E0,g as T0,B as $b}from"./index-D6izOmjj.js";import{i as zb}from"./ChevronUp-Bu9JV4C-.js";import{a as jb}from"./Eye-Clz4yV9V.js";import{d as S0,g as y0,h as A0,a as _0}from"./dialog-DXahQA5F.js";import{n as I0}from"./Globe01-rz2h7Ebm.js";import{j as k0,n as R0}from"./ZoomOut-B_lAoymB.js";import{u as N0}from"./tooltip-Bk2FCtKr.js";import{m as C0}from"./tab-id-BptcWVWa.js";function jl(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Nt=jl();function Vb(e){Nt=e}var ln={exec:()=>null};function le(e,t=""){let n=typeof e=="string"?e:e.source;const r={replace:(a,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(xe.caret,"$1"),n=n.replace(a,o),r},getRegex:()=>new RegExp(n,t)};return r}var xe={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},v0=/^(?:[ \t]*(?:\n|$))+/,w0=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,x0=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,_n=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,O0=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Vl=/(?:[*+-]|\d{1,9}[.)])/,Yb=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Wb=le(Yb).replace(/bull/g,Vl).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),L0=le(Yb).replace(/bull/g,Vl).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Yl=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,D0=/^[^\n]+/,Wl=/(?!\s*\])(?:\\.|[^\[\]\\])+/,M0=le(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Wl).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),P0=le(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Vl).getRegex(),er="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Kl=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,F0=le("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Kl).replace("tag",er).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Kb=le(Yl).replace("hr",_n).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",er).getRegex(),B0=le(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Kb).getRegex(),Xl={blockquote:B0,code:w0,def:M0,fences:x0,heading:O0,hr:_n,html:F0,lheading:Wb,list:P0,newline:v0,paragraph:Kb,table:ln,text:D0},Mc=le("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",_n).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",er).getRegex(),U0={...Xl,lheading:L0,table:Mc,paragraph:le(Yl).replace("hr",_n).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Mc).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",er).getRegex()},H0={...Xl,html:le(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Kl).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:ln,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:le(Yl).replace("hr",_n).replace("heading",` *#{1,6} *[^
1
+ import{bw as zl,j as q,af as lt,bO as zn,r as Ve,bP as b0,c as Gb,e as Ke,f as E0,g as T0,B as $b}from"./index-COlSsy5J.js";import{i as zb}from"./ChevronUp-CjDXfs3K.js";import{a as jb}from"./Eye-DifA9NHq.js";import{d as S0,g as y0,h as A0,a as _0}from"./dialog-BMBVdX8K.js";import{n as I0}from"./Globe01-CMUrlGmF.js";import{j as k0,n as R0}from"./ZoomOut-DYeUJTmS.js";import{u as N0}from"./tooltip-D5U362dF.js";import{m as C0}from"./tab-id-BptcWVWa.js";function jl(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Nt=jl();function Vb(e){Nt=e}var ln={exec:()=>null};function le(e,t=""){let n=typeof e=="string"?e:e.source;const r={replace:(a,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(xe.caret,"$1"),n=n.replace(a,o),r},getRegex:()=>new RegExp(n,t)};return r}var xe={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},v0=/^(?:[ \t]*(?:\n|$))+/,w0=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,x0=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,_n=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,O0=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Vl=/(?:[*+-]|\d{1,9}[.)])/,Yb=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Wb=le(Yb).replace(/bull/g,Vl).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),L0=le(Yb).replace(/bull/g,Vl).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Yl=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,D0=/^[^\n]+/,Wl=/(?!\s*\])(?:\\.|[^\[\]\\])+/,M0=le(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Wl).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),P0=le(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Vl).getRegex(),er="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Kl=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,F0=le("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Kl).replace("tag",er).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Kb=le(Yl).replace("hr",_n).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",er).getRegex(),B0=le(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Kb).getRegex(),Xl={blockquote:B0,code:w0,def:M0,fences:x0,heading:O0,hr:_n,html:F0,lheading:Wb,list:P0,newline:v0,paragraph:Kb,table:ln,text:D0},Mc=le("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",_n).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",er).getRegex(),U0={...Xl,lheading:L0,table:Mc,paragraph:le(Yl).replace("hr",_n).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Mc).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",er).getRegex()},H0={...Xl,html:le(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Kl).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:ln,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:le(Yl).replace("hr",_n).replace("heading",` *#{1,6} *[^
2
2
  ]`).replace("lheading",Wb).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},q0=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,G0=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Xb=/^( {2,}|\\)\n(?!\s*$)/,$0=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,tr=/[\p{P}\p{S}]/u,Zl=/[\s\p{P}\p{S}]/u,Zb=/[^\s\p{P}\p{S}]/u,z0=le(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Zl).getRegex(),Qb=/(?!~)[\p{P}\p{S}]/u,j0=/(?!~)[\s\p{P}\p{S}]/u,V0=/(?:[^\s\p{P}\p{S}]|~)/u,Y0=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Jb=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,W0=le(Jb,"u").replace(/punct/g,tr).getRegex(),K0=le(Jb,"u").replace(/punct/g,Qb).getRegex(),eE="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",X0=le(eE,"gu").replace(/notPunctSpace/g,Zb).replace(/punctSpace/g,Zl).replace(/punct/g,tr).getRegex(),Z0=le(eE,"gu").replace(/notPunctSpace/g,V0).replace(/punctSpace/g,j0).replace(/punct/g,Qb).getRegex(),Q0=le("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Zb).replace(/punctSpace/g,Zl).replace(/punct/g,tr).getRegex(),J0=le(/\\(punct)/,"gu").replace(/punct/g,tr).getRegex(),eS=le(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),tS=le(Kl).replace("(?:-->|$)","-->").getRegex(),nS=le("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",tS).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),jn=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,rS=le(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",jn).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),tE=le(/^!?\[(label)\]\[(ref)\]/).replace("label",jn).replace("ref",Wl).getRegex(),nE=le(/^!?\[(ref)\](?:\[\])?/).replace("ref",Wl).getRegex(),aS=le("reflink|nolink(?!\\()","g").replace("reflink",tE).replace("nolink",nE).getRegex(),Ql={_backpedal:ln,anyPunctuation:J0,autolink:eS,blockSkip:Y0,br:Xb,code:G0,del:ln,emStrongLDelim:W0,emStrongRDelimAst:X0,emStrongRDelimUnd:Q0,escape:q0,link:rS,nolink:nE,punctuation:z0,reflink:tE,reflinkSearch:aS,tag:nS,text:$0,url:ln},iS={...Ql,link:le(/^!?\[(label)\]\((.*?)\)/).replace("label",jn).getRegex(),reflink:le(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",jn).getRegex()},_l={...Ql,emStrongRDelimAst:Z0,emStrongLDelim:K0,url:le(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},oS={..._l,br:le(Xb).replace("{2,}","*").getRegex(),text:le(_l.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},xn={normal:Xl,gfm:U0,pedantic:H0},Jt={normal:Ql,gfm:_l,breaks:oS,pedantic:iS},sS={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Pc=e=>sS[e];function Je(e,t){if(t){if(xe.escapeTest.test(e))return e.replace(xe.escapeReplace,Pc)}else if(xe.escapeTestNoEncode.test(e))return e.replace(xe.escapeReplaceNoEncode,Pc);return e}function Fc(e){try{e=encodeURI(e).replace(xe.percentDecode,"%")}catch{return null}return e}function Bc(e,t){const n=e.replace(xe.findPipe,(i,o,s)=>{let u=!1,l=o;for(;--l>=0&&s[l]==="\\";)u=!u;return u?"|":" |"}),r=n.split(xe.splitPipe);let a=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;a<r.length;a++)r[a]=r[a].trim().replace(xe.slashPipe,"|");return r}function en(e,t,n){const r=e.length;if(r===0)return"";let a=0;for(;a<r&&e.charAt(r-a-1)===t;)a++;return e.slice(0,r-a)}function uS(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function Uc(e,t,n,r,a){const i=t.href,o=t.title||null,s=e[1].replace(a.other.outputLinkReplace,"$1");r.state.inLink=!0;const u={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,u}function lS(e,t,n){const r=e.match(n.other.indentCodeCompensation);if(r===null)return t;const a=r[1];return t.split(`
3
3
  `).map(i=>{const o=i.match(n.other.beginningSpace);if(o===null)return i;const[s]=o;return s.length>=a.length?i.slice(a.length):i}).join(`
4
4
  `)}var Vn=class{options;rules;lexer;constructor(e){this.options=e||Nt}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:en(n,`
@@ -1 +1 @@
1
- import{e as a,g as o,j as i,N as l}from"./index-D6izOmjj.js";function m(){const e=a.c(3);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t={strict:!1},e[0]=t):t=e[0];const{org:r}=o(t);let s;return e[1]!==r?(s=i.jsx(l,{to:"/$org/files",params:{org:r},replace:!0}),e[1]=r,e[2]=s):s=e[2],s}export{m as default};
1
+ import{e as a,g as o,j as i,N as l}from"./index-COlSsy5J.js";function m(){const e=a.c(3);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t={strict:!1},e[0]=t):t=e[0];const{org:r}=o(t);let s;return e[1]!==r?(s=i.jsx(l,{to:"/$org/files",params:{org:r},replace:!0}),e[1]=r,e[2]=s):s=e[2],s}export{m as default};
@@ -1 +1 @@
1
- import{cE as C,e as f,j as c,ad as b,r as d,c as p,bb as j,cF as v,cG as h}from"./index-D6izOmjj.js";import{L as N}from"./label-CVIIqU26.js";const D=C,g=d.createContext({}),M=t=>{const e=f.c(9);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let o;e[2]!==s.name?(o={name:s.name},e[2]=s.name,e[3]=o):o=e[3];let n;e[4]!==s?(n=c.jsx(b,{...s}),e[4]=s,e[5]=n):n=e[5];let r;return e[6]!==o||e[7]!==n?(r=c.jsx(g.Provider,{value:o,children:n}),e[6]=o,e[7]=n,e[8]=r):r=e[8],r},x=()=>{const t=f.c(13),e=d.useContext(g),s=d.useContext($),{getFieldState:o}=v();let n;t[0]!==e.name?(n={name:e.name},t[0]=e.name,t[1]=n):n=t[1];const r=h(n);let a;t[2]!==e.name||t[3]!==r||t[4]!==o?(a=o(e.name,r),t[2]=e.name,t[3]=r,t[4]=o,t[5]=a):a=t[5];const l=a;if(!e)throw new Error("useFormField should be used within <FormField>");const{id:i}=s,m=`${i}-form-item`,F=`${i}-form-item-description`,I=`${i}-form-item-message`;let u;return t[6]!==e.name||t[7]!==l||t[8]!==i||t[9]!==m||t[10]!==F||t[11]!==I?(u={id:i,name:e.name,formItemId:m,formDescriptionId:F,formMessageId:I,...l},t[6]=e.name,t[7]=l,t[8]=i,t[9]=m,t[10]=F,t[11]=I,t[12]=u):u=t[12],u},$=d.createContext({});function w(t){const e=f.c(13);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const n=d.useId();let r;e[3]!==n?(r={id:n},e[3]=n,e[4]=r):r=e[4];let a;e[5]!==s?(a=p("grid gap-2",s),e[5]=s,e[6]=a):a=e[6];let l;e[7]!==o||e[8]!==a?(l=c.jsx("div",{"data-slot":"form-item",className:a,...o}),e[7]=o,e[8]=a,e[9]=l):l=e[9];let i;return e[10]!==r||e[11]!==l?(i=c.jsx($.Provider,{value:r,children:l}),e[10]=r,e[11]=l,e[12]=i):i=e[12],i}function L(t){const e=f.c(10);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{error:n,formItemId:r}=x(),a=!!n;let l;e[3]!==s?(l=p("text-foreground data-[error=true]:text-destructive",s),e[3]=s,e[4]=l):l=e[4];let i;return e[5]!==r||e[6]!==o||e[7]!==a||e[8]!==l?(i=c.jsx(N,{"data-slot":"form-label","data-error":a,className:l,htmlFor:r,...o}),e[5]=r,e[6]=o,e[7]=a,e[8]=l,e[9]=i):i=e[9],i}function P(t){const e=f.c(7);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];const{error:o,formItemId:n,formDescriptionId:r,formMessageId:a}=x(),l=o?`${r} ${a}`:`${r}`,i=!!o;let m;return e[2]!==n||e[3]!==s||e[4]!==l||e[5]!==i?(m=c.jsx(j,{"data-slot":"form-control",id:n,"aria-describedby":l,"aria-invalid":i,...s}),e[2]=n,e[3]=s,e[4]=l,e[5]=i,e[6]=m):m=e[6],m}function y(t){const e=f.c(9);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{formDescriptionId:n}=x();let r;e[3]!==s?(r=p("text-muted-foreground text-sm",s),e[3]=s,e[4]=r):r=e[4];let a;return e[5]!==n||e[6]!==o||e[7]!==r?(a=c.jsx("p",{"data-slot":"form-description",id:n,className:r,...o}),e[5]=n,e[6]=o,e[7]=r,e[8]=a):a=e[8],a}function R(t){const e=f.c(10);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{error:n,formMessageId:r}=x(),a=n?String(n?.message??""):o.children;if(!a)return null;let l;e[3]!==s?(l=p("text-destructive text-sm",s),e[3]=s,e[4]=l):l=e[4];let i;return e[5]!==a||e[6]!==r||e[7]!==o||e[8]!==l?(i=c.jsx("p",{"data-slot":"form-message",id:r,className:l,...o,children:a}),e[5]=a,e[6]=r,e[7]=o,e[8]=l,e[9]=i):i=e[9],i}export{M as F,D as a,w as b,L as c,P as d,y as e,R as f};
1
+ import{cE as C,e as f,j as c,ad as b,r as d,c as p,bb as j,cF as v,cG as h}from"./index-COlSsy5J.js";import{L as N}from"./label-BCRIEPd0.js";const D=C,g=d.createContext({}),M=t=>{const e=f.c(9);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let o;e[2]!==s.name?(o={name:s.name},e[2]=s.name,e[3]=o):o=e[3];let n;e[4]!==s?(n=c.jsx(b,{...s}),e[4]=s,e[5]=n):n=e[5];let r;return e[6]!==o||e[7]!==n?(r=c.jsx(g.Provider,{value:o,children:n}),e[6]=o,e[7]=n,e[8]=r):r=e[8],r},x=()=>{const t=f.c(13),e=d.useContext(g),s=d.useContext($),{getFieldState:o}=v();let n;t[0]!==e.name?(n={name:e.name},t[0]=e.name,t[1]=n):n=t[1];const r=h(n);let a;t[2]!==e.name||t[3]!==r||t[4]!==o?(a=o(e.name,r),t[2]=e.name,t[3]=r,t[4]=o,t[5]=a):a=t[5];const l=a;if(!e)throw new Error("useFormField should be used within <FormField>");const{id:i}=s,m=`${i}-form-item`,F=`${i}-form-item-description`,I=`${i}-form-item-message`;let u;return t[6]!==e.name||t[7]!==l||t[8]!==i||t[9]!==m||t[10]!==F||t[11]!==I?(u={id:i,name:e.name,formItemId:m,formDescriptionId:F,formMessageId:I,...l},t[6]=e.name,t[7]=l,t[8]=i,t[9]=m,t[10]=F,t[11]=I,t[12]=u):u=t[12],u},$=d.createContext({});function w(t){const e=f.c(13);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const n=d.useId();let r;e[3]!==n?(r={id:n},e[3]=n,e[4]=r):r=e[4];let a;e[5]!==s?(a=p("grid gap-2",s),e[5]=s,e[6]=a):a=e[6];let l;e[7]!==o||e[8]!==a?(l=c.jsx("div",{"data-slot":"form-item",className:a,...o}),e[7]=o,e[8]=a,e[9]=l):l=e[9];let i;return e[10]!==r||e[11]!==l?(i=c.jsx($.Provider,{value:r,children:l}),e[10]=r,e[11]=l,e[12]=i):i=e[12],i}function L(t){const e=f.c(10);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{error:n,formItemId:r}=x(),a=!!n;let l;e[3]!==s?(l=p("text-foreground data-[error=true]:text-destructive",s),e[3]=s,e[4]=l):l=e[4];let i;return e[5]!==r||e[6]!==o||e[7]!==a||e[8]!==l?(i=c.jsx(N,{"data-slot":"form-label","data-error":a,className:l,htmlFor:r,...o}),e[5]=r,e[6]=o,e[7]=a,e[8]=l,e[9]=i):i=e[9],i}function P(t){const e=f.c(7);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];const{error:o,formItemId:n,formDescriptionId:r,formMessageId:a}=x(),l=o?`${r} ${a}`:`${r}`,i=!!o;let m;return e[2]!==n||e[3]!==s||e[4]!==l||e[5]!==i?(m=c.jsx(j,{"data-slot":"form-control",id:n,"aria-describedby":l,"aria-invalid":i,...s}),e[2]=n,e[3]=s,e[4]=l,e[5]=i,e[6]=m):m=e[6],m}function y(t){const e=f.c(9);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{formDescriptionId:n}=x();let r;e[3]!==s?(r=p("text-muted-foreground text-sm",s),e[3]=s,e[4]=r):r=e[4];let a;return e[5]!==n||e[6]!==o||e[7]!==r?(a=c.jsx("p",{"data-slot":"form-description",id:n,className:r,...o}),e[5]=n,e[6]=o,e[7]=r,e[8]=a):a=e[8],a}function R(t){const e=f.c(10);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{error:n,formMessageId:r}=x(),a=n?String(n?.message??""):o.children;if(!a)return null;let l;e[3]!==s?(l=p("text-destructive text-sm",s),e[3]=s,e[4]=l):l=e[4];let i;return e[5]!==a||e[6]!==r||e[7]!==o||e[8]!==l?(i=c.jsx("p",{"data-slot":"form-message",id:r,className:l,...o,children:a}),e[5]=a,e[6]=r,e[7]=o,e[8]=l,e[9]=i):i=e[9],i}export{M as F,D as a,w as b,L as c,P as d,y as e,R as f};
@@ -1 +1 @@
1
- import{f as M,p as $,F as U,x as Q,w as H,a as q,t as P,n as w,K as I,j as n,ad as L,s as Y,v as k,e as F,r as T,B as Z,a2 as B,H as J}from"./index-D6izOmjj.js";import{P as N}from"./index-B62gT9En.js";import{u as W}from"./use-org-auth-client-D79Jyhhp.js";import{u as X}from"./use-debounced-autosave-BoaPkBFT.js";import{A as ee}from"./avatar-CCN_co-X.js";import{I as V}from"./input-DP3XvpLN.js";import{S as K,a as G,b as A,c as te}from"./settings-section-Cj3AwHej.js";import{D as ne}from"./domain-settings-B2G69X9h.js";import{u as ae}from"./studio-tools-BBnH3MVd.js";import{c as se,b as oe,d as ie,A as re,e as le,g as ce,a as ue,f as de}from"./alert-dialog-BzcSSmOH.js";import{R as me}from"./require-capability-BCughBI7.js";import"./sidebar-Bf91anCU.js";import"./LayoutLeft-Cx1gVHzQ.js";import"./tooltip-Bk2FCtKr.js";import"./sheet-CGQ0l6o4.js";import"./X-ciDfeMTV.js";import"./User01-DxuO8uwX.js";import"./card-BTSltukm.js";import"./ArrowUpRight-DrUVVTac.js";import"./badge-BPsAZTXm.js";import"./select-CjjjXRUS.js";import"./ChevronUp-Bu9JV4C-.js";import"./ChevronDown-DAwDO8g3.js";import"./use-capability-C1x5gZYr.js";import"./access-gate-DpAJKNDg.js";import"./capability-load-error-B0DXeXNJ.js";const ge=Y({name:k().min(1,"Name is required").max(255,"Name is too long"),slug:k().min(1,"Slug is required").max(50,"Slug is too long").regex(/^[a-z0-9-]+$/,"Slug must contain only lowercase letters, numbers, and hyphens"),logo:k().optional()});function fe(e){const t=F.c(13),{value:v,onChange:h,name:o,disabled:d}=e,m=T.useRef(null);let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>m.current?.click(),t[0]=l):l=t[0];const r=l;let c;t[1]!==h?(c=x=>{const j=x.target.files?.[0];if(!j)return;if(j.size>2097152){w.error("Image must be smaller than 2MB");return}const u=new FileReader;u.onerror=pe,u.onloadend=()=>{u.result&&h(u.result),m.current&&(m.current.value="")},u.readAsDataURL(j)},t[1]=h,t[2]=c):c=t[2];const a=c;let s;t[3]!==d||t[4]!==a?(s=n.jsx("input",{ref:m,type:"file",accept:"image/*",onChange:a,className:"hidden",disabled:d}),t[3]=d,t[4]=a,t[5]=s):s=t[5];const i=v||void 0,p=o??"?";let g;t[6]!==i||t[7]!==p?(g=n.jsx(ee,{url:i,fallback:p,shape:"square",size:"base"}),t[6]=i,t[7]=p,t[8]=g):g=t[8];let f;return t[9]!==d||t[10]!==s||t[11]!==g?(f=n.jsxs("button",{type:"button",onClick:r,disabled:d,className:"rounded-lg overflow-hidden hover:ring-2 hover:ring-border transition-all disabled:opacity-50","aria-label":"Upload organization logo",children:[s,g]}),t[9]=d,t[10]=s,t[11]=g,t[12]=f):f=t[12],f}function pe(){return w.error("Failed to read image")}function he(){const e=M(),{org:t}=$(),v=W(),h=U(),o=Q({resolver:H(ge),values:{name:t.name??"",slug:t.slug??"",logo:t.logo??""}}),d=q({mutationFn:async a=>{const s={name:a.name,slug:a.slug};a.logo&&(s.logo=a.logo);const i=await v.organization.update({data:s});if(i?.error)throw new Error(i.error.message||"Failed to update organization");return i},onSuccess:(a,s)=>{P("organization_settings_updated",{organization_id:t.id,fields:Object.keys(s)}),h.invalidateQueries({queryKey:I.organizations()}),h.invalidateQueries({queryKey:I.activeOrganization(t.slug)}),w.success("Organization updated successfully"),a?.data?.slug&&a.data.slug!==t.slug&&e({to:"/$org/settings/general",params:{org:a.data.slug}})},onError:(a,s)=>{P("organization_settings_update_failed",{organization_id:t.id,fields:Object.keys(s),error:a instanceof Error?a.message:String(a)}),w.error(a instanceof Error?a.message:"Failed to update organization")}}),{schedule:m,flush:l}=X({save:async()=>{const a=o.control._formState.dirtyFields;if(Object.keys(a).length===0||!await o.trigger())return;const i=o.getValues(),p=o.control._defaultValues;o.reset(i,{keepValues:!0});try{await d.mutateAsync(i)}catch{o.reset(p,{keepValues:!0})}}}),r=o.formState.errors,c=typeof window<"u"?`${window.location.host}/`:"";return n.jsx(K,{children:n.jsxs(G,{children:[n.jsx(A,{title:"Logo",description:"Recommended size is 256x256px",action:n.jsx(fe,{value:o.watch("logo"),onChange:a=>{o.setValue("logo",a??"",{shouldDirty:!0}),l()},name:o.watch("name")})}),n.jsx(A,{title:"Name",action:n.jsx(L,{control:o.control,name:"name",render:({field:a})=>n.jsx(V,{id:"org-name",...a,onChange:s=>{a.onChange(s),m()},onBlur:()=>{a.onBlur(),l()},placeholder:"Organization name",className:"w-[280px]"})})}),n.jsx(A,{title:"URL",action:n.jsxs("div",{className:"flex items-center w-[280px] rounded-md border border-input bg-input/30 focus-within:ring-2 focus-within:ring-ring/50 overflow-hidden",children:[c&&n.jsx("span",{className:"pl-3 text-sm text-muted-foreground select-none",children:c}),n.jsx(L,{control:o.control,name:"slug",render:({field:a})=>n.jsx("input",{id:"org-slug",value:a.value??"",name:a.name,ref:a.ref,placeholder:"my-organization",className:"flex-1 min-w-0 bg-transparent px-2 py-1.5 text-sm text-foreground placeholder:text-muted-foreground/60 outline-none",onChange:s=>{const i=s.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");o.setValue("slug",i,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0}),m()},onBlur:()=>{a.onBlur(),l()}})})]})}),(r.name||r.slug||r.logo)&&n.jsxs("div",{className:"px-5 pb-3 flex flex-col gap-1",children:[r.name&&n.jsx("p",{className:"text-xs text-destructive",children:r.name.message}),r.slug&&n.jsx("p",{className:"text-xs text-destructive",children:r.slug.message}),r.logo&&n.jsx("p",{className:"text-xs text-destructive",children:r.logo.message})]})]})})}function xe(){const e=F.c(42),{org:t}=$(),[v,h]=T.useState(!1),[o,d]=T.useState(""),m=ae();let l;e[0]!==t.id||e[1]!==m?(l=async()=>{await m.call("ORGANIZATION_DELETE",{id:t.id})},e[0]=t.id,e[1]=m,e[2]=l):l=e[2];let r;e[3]!==t.id||e[4]!==t.slug?(r=()=>{P("organization_deleted",{organization_id:t.id}),localStorage.getItem(B.lastOrgSlug())===t.slug&&localStorage.removeItem(B.lastOrgSlug()),J(),w.success("Organization deleted"),window.location.href="/"},e[3]=t.id,e[4]=t.slug,e[5]=r):r=e[5];let c;e[6]!==l||e[7]!==r?(c={mutationFn:l,onSuccess:r,onError:je},e[6]=l,e[7]=r,e[8]=c):c=e[8];const a=q(c);let s;e[9]===Symbol.for("react.memo_cache_sentinel")?(s=()=>h(!0),e[9]=s):s=e[9];let i;e[10]!==a.isPending?(i=n.jsx(K,{title:"Danger Zone",description:"Irreversible actions that affect your entire organization.",children:n.jsx(G,{className:"border-destructive/40",children:n.jsx(A,{title:"Delete organization",description:"Permanently delete this organization and all of its data. This action cannot be undone.",action:n.jsx(Z,{variant:"destructive",size:"sm",onClick:s,disabled:a.isPending,children:"Delete"})})})}),e[10]=a.isPending,e[11]=i):i=e[11];let p;e[12]===Symbol.for("react.memo_cache_sentinel")?(p=O=>{h(O),O||d("")},e[12]=p):p=e[12];let g;e[13]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(se,{children:"Delete Organization?"}),e[13]=g):g=e[13];let f;e[14]!==t.name?(f=n.jsxs("p",{children:["This will permanently delete all data associated with"," ",n.jsx("span",{className:"font-medium text-foreground",children:t.name}),". This action cannot be undone."]}),e[14]=t.name,e[15]=f):f=e[15];let x;e[16]!==t.name?(x=n.jsxs("p",{className:"mt-3 mb-1.5",children:["Type"," ",n.jsx("span",{className:"font-medium text-foreground",children:t.name})," ","to confirm:"]}),e[16]=t.name,e[17]=x):x=e[17];let j;e[18]===Symbol.for("react.memo_cache_sentinel")?(j=O=>d(O.target.value),e[18]=j):j=e[18];let u;e[19]!==o||e[20]!==t.name?(u=n.jsx(V,{value:o,onChange:j,placeholder:t.name,autoFocus:!0}),e[19]=o,e[20]=t.name,e[21]=u):u=e[21];let y;e[22]!==u||e[23]!==f||e[24]!==x?(y=n.jsxs(oe,{children:[g,n.jsx(ie,{asChild:!0,children:n.jsxs("div",{children:[f,x,u]})})]}),e[22]=u,e[23]=f,e[24]=x,e[25]=y):y=e[25];let D;e[26]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsx(re,{children:"Cancel"}),e[26]=D):D=e[26];let b;e[27]!==a?(b=()=>a.mutate(),e[27]=a,e[28]=b):b=e[28];const E=o!==t.name||a.isPending,R=a.isPending?"Deleting…":"Delete organization";let S;e[29]!==b||e[30]!==E||e[31]!==R?(S=n.jsxs(le,{children:[D,n.jsx(ce,{onClick:b,disabled:E,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:opacity-50",children:R})]}),e[29]=b,e[30]=E,e[31]=R,e[32]=S):S=e[32];let z;e[33]!==y||e[34]!==S?(z=n.jsxs(ue,{children:[y,S]}),e[33]=y,e[34]=S,e[35]=z):z=e[35];let C;e[36]!==v||e[37]!==z?(C=n.jsx(de,{open:v,onOpenChange:p,children:z}),e[36]=v,e[37]=z,e[38]=C):C=e[38];let _;return e[39]!==C||e[40]!==i?(_=n.jsxs(n.Fragment,{children:[i,C]}),e[39]=C,e[40]=i,e[41]=_):_=e[41],_}function je(e){w.error(e instanceof Error?e.message:"Failed to delete organization")}function ve(){const e=F.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(N,{children:n.jsx(N.Content,{children:n.jsx(N.Body,{children:n.jsxs(te,{children:[n.jsx(N.Title,{children:"Organization"}),n.jsx(he,{}),n.jsx(ne,{}),n.jsx(xe,{})]})})})}),e[0]=t):t=e[0],t}function Ue(){const e=F.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(me,{capability:"org:manage",area:"general settings",children:n.jsx(ve,{})}),e[0]=t):t=e[0],t}export{Ue as default};
1
+ import{f as M,p as $,F as U,x as Q,w as H,a as q,t as P,n as w,K as I,j as n,ad as L,s as Y,v as k,e as F,r as T,B as Z,a2 as B,H as J}from"./index-COlSsy5J.js";import{P as N}from"./index-CkC7ek4r.js";import{u as W}from"./use-org-auth-client-BYQp-Udb.js";import{u as X}from"./use-debounced-autosave-B8dr6XMC.js";import{A as ee}from"./avatar-D7wKrjgH.js";import{I as V}from"./input-CuVtlRv5.js";import{S as K,a as G,b as A,c as te}from"./settings-section-BqnJtUWr.js";import{D as ne}from"./domain-settings-GHKCO0j2.js";import{u as ae}from"./studio-tools-CyTucPcW.js";import{c as se,b as oe,d as ie,A as re,e as le,g as ce,a as ue,f as de}from"./alert-dialog-DvJDYQsM.js";import{R as me}from"./require-capability-GPOwZTVN.js";import"./sidebar-D1LCPjC8.js";import"./LayoutLeft-BI32Ru47.js";import"./tooltip-D5U362dF.js";import"./sheet-Cn8FwYbD.js";import"./X-Botvp-t_.js";import"./User01-kj3Bxvgl.js";import"./card-BtNxdFil.js";import"./ArrowUpRight-B2NXgTf2.js";import"./badge-Rj4w6Y9D.js";import"./select-Dqs7Z4yG.js";import"./ChevronUp-CjDXfs3K.js";import"./ChevronDown-BldydMJ0.js";import"./use-capability-XIhIuFk7.js";import"./access-gate-lRgnLhCg.js";import"./capability-load-error-Caduk_d2.js";const ge=Y({name:k().min(1,"Name is required").max(255,"Name is too long"),slug:k().min(1,"Slug is required").max(50,"Slug is too long").regex(/^[a-z0-9-]+$/,"Slug must contain only lowercase letters, numbers, and hyphens"),logo:k().optional()});function fe(e){const t=F.c(13),{value:v,onChange:h,name:o,disabled:d}=e,m=T.useRef(null);let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>m.current?.click(),t[0]=l):l=t[0];const r=l;let c;t[1]!==h?(c=x=>{const j=x.target.files?.[0];if(!j)return;if(j.size>2097152){w.error("Image must be smaller than 2MB");return}const u=new FileReader;u.onerror=pe,u.onloadend=()=>{u.result&&h(u.result),m.current&&(m.current.value="")},u.readAsDataURL(j)},t[1]=h,t[2]=c):c=t[2];const a=c;let s;t[3]!==d||t[4]!==a?(s=n.jsx("input",{ref:m,type:"file",accept:"image/*",onChange:a,className:"hidden",disabled:d}),t[3]=d,t[4]=a,t[5]=s):s=t[5];const i=v||void 0,p=o??"?";let g;t[6]!==i||t[7]!==p?(g=n.jsx(ee,{url:i,fallback:p,shape:"square",size:"base"}),t[6]=i,t[7]=p,t[8]=g):g=t[8];let f;return t[9]!==d||t[10]!==s||t[11]!==g?(f=n.jsxs("button",{type:"button",onClick:r,disabled:d,className:"rounded-lg overflow-hidden hover:ring-2 hover:ring-border transition-all disabled:opacity-50","aria-label":"Upload organization logo",children:[s,g]}),t[9]=d,t[10]=s,t[11]=g,t[12]=f):f=t[12],f}function pe(){return w.error("Failed to read image")}function he(){const e=M(),{org:t}=$(),v=W(),h=U(),o=Q({resolver:H(ge),values:{name:t.name??"",slug:t.slug??"",logo:t.logo??""}}),d=q({mutationFn:async a=>{const s={name:a.name,slug:a.slug};a.logo&&(s.logo=a.logo);const i=await v.organization.update({data:s});if(i?.error)throw new Error(i.error.message||"Failed to update organization");return i},onSuccess:(a,s)=>{P("organization_settings_updated",{organization_id:t.id,fields:Object.keys(s)}),h.invalidateQueries({queryKey:I.organizations()}),h.invalidateQueries({queryKey:I.activeOrganization(t.slug)}),w.success("Organization updated successfully"),a?.data?.slug&&a.data.slug!==t.slug&&e({to:"/$org/settings/general",params:{org:a.data.slug}})},onError:(a,s)=>{P("organization_settings_update_failed",{organization_id:t.id,fields:Object.keys(s),error:a instanceof Error?a.message:String(a)}),w.error(a instanceof Error?a.message:"Failed to update organization")}}),{schedule:m,flush:l}=X({save:async()=>{const a=o.control._formState.dirtyFields;if(Object.keys(a).length===0||!await o.trigger())return;const i=o.getValues(),p=o.control._defaultValues;o.reset(i,{keepValues:!0});try{await d.mutateAsync(i)}catch{o.reset(p,{keepValues:!0})}}}),r=o.formState.errors,c=typeof window<"u"?`${window.location.host}/`:"";return n.jsx(K,{children:n.jsxs(G,{children:[n.jsx(A,{title:"Logo",description:"Recommended size is 256x256px",action:n.jsx(fe,{value:o.watch("logo"),onChange:a=>{o.setValue("logo",a??"",{shouldDirty:!0}),l()},name:o.watch("name")})}),n.jsx(A,{title:"Name",action:n.jsx(L,{control:o.control,name:"name",render:({field:a})=>n.jsx(V,{id:"org-name",...a,onChange:s=>{a.onChange(s),m()},onBlur:()=>{a.onBlur(),l()},placeholder:"Organization name",className:"w-[280px]"})})}),n.jsx(A,{title:"URL",action:n.jsxs("div",{className:"flex items-center w-[280px] rounded-md border border-input bg-input/30 focus-within:ring-2 focus-within:ring-ring/50 overflow-hidden",children:[c&&n.jsx("span",{className:"pl-3 text-sm text-muted-foreground select-none",children:c}),n.jsx(L,{control:o.control,name:"slug",render:({field:a})=>n.jsx("input",{id:"org-slug",value:a.value??"",name:a.name,ref:a.ref,placeholder:"my-organization",className:"flex-1 min-w-0 bg-transparent px-2 py-1.5 text-sm text-foreground placeholder:text-muted-foreground/60 outline-none",onChange:s=>{const i=s.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");o.setValue("slug",i,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0}),m()},onBlur:()=>{a.onBlur(),l()}})})]})}),(r.name||r.slug||r.logo)&&n.jsxs("div",{className:"px-5 pb-3 flex flex-col gap-1",children:[r.name&&n.jsx("p",{className:"text-xs text-destructive",children:r.name.message}),r.slug&&n.jsx("p",{className:"text-xs text-destructive",children:r.slug.message}),r.logo&&n.jsx("p",{className:"text-xs text-destructive",children:r.logo.message})]})]})})}function xe(){const e=F.c(42),{org:t}=$(),[v,h]=T.useState(!1),[o,d]=T.useState(""),m=ae();let l;e[0]!==t.id||e[1]!==m?(l=async()=>{await m.call("ORGANIZATION_DELETE",{id:t.id})},e[0]=t.id,e[1]=m,e[2]=l):l=e[2];let r;e[3]!==t.id||e[4]!==t.slug?(r=()=>{P("organization_deleted",{organization_id:t.id}),localStorage.getItem(B.lastOrgSlug())===t.slug&&localStorage.removeItem(B.lastOrgSlug()),J(),w.success("Organization deleted"),window.location.href="/"},e[3]=t.id,e[4]=t.slug,e[5]=r):r=e[5];let c;e[6]!==l||e[7]!==r?(c={mutationFn:l,onSuccess:r,onError:je},e[6]=l,e[7]=r,e[8]=c):c=e[8];const a=q(c);let s;e[9]===Symbol.for("react.memo_cache_sentinel")?(s=()=>h(!0),e[9]=s):s=e[9];let i;e[10]!==a.isPending?(i=n.jsx(K,{title:"Danger Zone",description:"Irreversible actions that affect your entire organization.",children:n.jsx(G,{className:"border-destructive/40",children:n.jsx(A,{title:"Delete organization",description:"Permanently delete this organization and all of its data. This action cannot be undone.",action:n.jsx(Z,{variant:"destructive",size:"sm",onClick:s,disabled:a.isPending,children:"Delete"})})})}),e[10]=a.isPending,e[11]=i):i=e[11];let p;e[12]===Symbol.for("react.memo_cache_sentinel")?(p=O=>{h(O),O||d("")},e[12]=p):p=e[12];let g;e[13]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(se,{children:"Delete Organization?"}),e[13]=g):g=e[13];let f;e[14]!==t.name?(f=n.jsxs("p",{children:["This will permanently delete all data associated with"," ",n.jsx("span",{className:"font-medium text-foreground",children:t.name}),". This action cannot be undone."]}),e[14]=t.name,e[15]=f):f=e[15];let x;e[16]!==t.name?(x=n.jsxs("p",{className:"mt-3 mb-1.5",children:["Type"," ",n.jsx("span",{className:"font-medium text-foreground",children:t.name})," ","to confirm:"]}),e[16]=t.name,e[17]=x):x=e[17];let j;e[18]===Symbol.for("react.memo_cache_sentinel")?(j=O=>d(O.target.value),e[18]=j):j=e[18];let u;e[19]!==o||e[20]!==t.name?(u=n.jsx(V,{value:o,onChange:j,placeholder:t.name,autoFocus:!0}),e[19]=o,e[20]=t.name,e[21]=u):u=e[21];let y;e[22]!==u||e[23]!==f||e[24]!==x?(y=n.jsxs(oe,{children:[g,n.jsx(ie,{asChild:!0,children:n.jsxs("div",{children:[f,x,u]})})]}),e[22]=u,e[23]=f,e[24]=x,e[25]=y):y=e[25];let D;e[26]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsx(re,{children:"Cancel"}),e[26]=D):D=e[26];let b;e[27]!==a?(b=()=>a.mutate(),e[27]=a,e[28]=b):b=e[28];const E=o!==t.name||a.isPending,R=a.isPending?"Deleting…":"Delete organization";let S;e[29]!==b||e[30]!==E||e[31]!==R?(S=n.jsxs(le,{children:[D,n.jsx(ce,{onClick:b,disabled:E,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:opacity-50",children:R})]}),e[29]=b,e[30]=E,e[31]=R,e[32]=S):S=e[32];let z;e[33]!==y||e[34]!==S?(z=n.jsxs(ue,{children:[y,S]}),e[33]=y,e[34]=S,e[35]=z):z=e[35];let C;e[36]!==v||e[37]!==z?(C=n.jsx(de,{open:v,onOpenChange:p,children:z}),e[36]=v,e[37]=z,e[38]=C):C=e[38];let _;return e[39]!==C||e[40]!==i?(_=n.jsxs(n.Fragment,{children:[i,C]}),e[39]=C,e[40]=i,e[41]=_):_=e[41],_}function je(e){w.error(e instanceof Error?e.message:"Failed to delete organization")}function ve(){const e=F.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(N,{children:n.jsx(N.Content,{children:n.jsx(N.Body,{children:n.jsxs(te,{children:[n.jsx(N.Title,{children:"Organization"}),n.jsx(he,{}),n.jsx(ne,{}),n.jsx(xe,{})]})})})}),e[0]=t):t=e[0],t}function Ue(){const e=F.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(me,{capability:"org:manage",area:"general settings",children:n.jsx(ve,{})}),e[0]=t):t=e[0],t}export{Ue as default};
@@ -1 +1 @@
1
- import{e as P,j as t,p as Q,b as te,F as W,r as O,a4 as B,l as F,a as ne,n as z,K as V,m as se,c as K,a5 as oe,ae as re}from"./index-D6izOmjj.js";import{D as ie,a as ae,c as le,d as ce}from"./dialog-DXahQA5F.js";import{C as J}from"./checkbox-M3DdO4ws.js";import{C as ue}from"./collection-search-lIRYT3yV.js";import{b as de,u as me}from"./use-connection-rF7aVJWi.js";import{W as fe,u as H,S as X}from"./use-mcp-client-vlTb1_vQ.js";import{i as Z}from"./Settings02-BX75SJ47.js";import{v as pe}from"./agent-icon-CS5ajDLh.js";import{i as ge,a as he}from"./mcp-oauth-MmhxfzLz.js";import{u as xe}from"./use-mcp-tools-Dl-9pwtN.js";import{e as ye}from"./extract-connection-data-CyP5_ll7.js";import{m as be}from"./use-navigate-to-agent-CKBlqEnY.js";function U(s){const e=P.c(4),{size:n,className:o}=s;let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z"}),e[0]=u):u=e[0];let a;return e[1]!==o||e[2]!==n?(a=t.jsx("svg",{width:n,height:n,viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:o,children:u}),e[1]=o,e[2]=n,e[3]=a):a=e[3],a}function we(s,e){const n=P.c(12),{org:o}=Q();let u;n[0]!==o.id?(u=fe.REGISTRY(o.id),n[0]=o.id,n[1]=u):u=n[1];const a=u;let r;n[2]!==o.id||n[3]!==o.slug||n[4]!==a?(r={connectionId:a,orgId:o.id,orgSlug:o.slug},n[2]=o.id,n[3]=o.slug,n[4]=a,n[5]=r):r=n[5];const f=H(r);let p;n[6]!==s?(p={name:s},n[6]=s,n[7]=p):p=n[7];const i=e?.enabled??!0;let h;return n[8]!==f||n[9]!==p||n[10]!==i?(h={client:f,toolName:"COLLECTION_REGISTRY_APP_GET",toolArguments:p,enabled:i,staleTime:3e5,select:Ne},n[8]=f,n[9]=p,n[10]=i,n[11]=h):h=n[11],xe(h)}function Ne(s){return s.structuredContent?.item??null}const Ie="deco/mcp-github";function Se(s){const{org:e}=Q(),{data:n}=te.useSession(),o=de(),u=W(),[a,r]=O.useState("idle"),[f,p]=O.useState(null),[i,h]=O.useState(null),{data:g,isLoading:c}=we(Ie,{enabled:s.enabled}),w=O.useRef(!1);s.enabled&&g&&!c&&!w.current&&n?.user?.id&&a==="idle"&&(w.current=!0,y());async function y(){if(!(!g||!n?.user?.id||!e))try{r("installing"),p(null);const x=ye(g,e.id,n.user.id,{remoteIndex:0});if(!x.connection_url)throw new Error("Registry item is missing a remote URL for mcp-github");const{id:b}=await o.create.mutateAsync(x);r("authenticating");const I=new URL(`/api/${e.slug}/mcp/${b}`,window.location.origin),d=await ge({url:I.href,token:null,orgId:e.id});if(d.supportsOAuth&&!d.isAuthenticated){const{token:j,tokenInfo:l,error:C}=await he({connectionId:b,orgSlug:e.slug,scope:"offline_access"});if(C||!j){try{await o.delete.mutateAsync(b)}catch{}throw new Error(C??"No token received from GitHub")}if(l)try{(await fetch(`/api/${e.slug}/connections/${b}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:l.accessToken,refreshToken:l.refreshToken,expiresIn:l.expiresIn,scope:l.scope,clientId:l.clientId,clientSecret:l.clientSecret,tokenEndpoint:l.tokenEndpoint})})).ok||await o.update.mutateAsync({id:b,data:{connection_token:j}})}catch{await o.update.mutateAsync({id:b,data:{connection_token:j}})}}B(u,e.id),h(x),r("ready")}catch(x){p(x instanceof Error?x.message:String(x)),r("error")}}function N(){r("idle"),p(null),h(null),w.current=!1}return s.enabled&&c&&a==="idle"?{status:"installing",error:null,connection:null,retry:N}:{status:a,error:f,connection:i,retry:N}}const M={contents:"write",metadata:"read",pull_requests:"write",issues:"write"};function je(s){if(!s||typeof s!="object"||Array.isArray(s))return M;const e=s;return Object.values(e).some(n=>typeof n!="string")?M:e}function Ce(s){if(!(typeof s!="number"||!Number.isFinite(s)||!Number.isInteger(s)||s<=0))return s}function Te(s){const e=s.metadata?.repoScope;if(!e||typeof e.installationId!="number"||!Number.isFinite(e.installationId)||!Number.isInteger(e.installationId)||e.installationId<=0||typeof e.owner!="string"||typeof e.repo!="string"||e.owner.length===0||e.repo.length===0)return null;const n=Ce(e.repositoryId);return{sourceConnectionId:typeof e.sourceConnectionId=="string"?e.sourceConnectionId:void 0,installationId:e.installationId,repositoryId:n,owner:e.owner,repo:e.repo,permissions:je(e.permissions),grantProvider:e.grantProvider==="github-mcp"?"github-mcp":void 0}}function Ee(s){return(s??[]).filter(e=>Te(e)===null)}async function ve(s,e){const o=(await s({name:"GITHUB_LIST_USER_ORGS",arguments:{connectionId:e}})).content?.[0]?.text;if(!o)throw new Error("No response from GITHUB_LIST_USER_ORGS");try{return JSON.parse(o)}catch{throw new Error("Invalid response from GITHUB_LIST_USER_ORGS")}}function Xe(s,e){const n=e.toLowerCase();return s.find(o=>o.login.toLowerCase()===n)}const Y="GitHub MCP did not return refreshable repo grant metadata";function L(s){if(typeof s!="string")return null;const e=s.trim();return e.length>0?e:null}function _e(s){try{const e=new URL(s);return(e.protocol==="http:"||e.protocol==="https:")&&!e.username&&!e.password}catch{return!1}}function ke(s){return typeof s=="number"&&Number.isFinite(s)&&Number.isInteger(s)&&s>0?s:void 0}async function Re(s){const{orgSlug:e,sourceConnection:n,installationId:o,owner:u,repo:a,githubCallTool:r,selfCallTool:f}=s,p=await r({name:"MINT_REPO_TOKEN",arguments:{installationId:o,owner:u,repo:a,permissions:M}}),i=p.structuredContent;if(p.isError||!i?.token){const v=p.content?.find(T=>T.type==="text")?.text;throw new Error(v?`Failed to mint a repo-scoped GitHub token: ${v}`:"Failed to mint a repo-scoped GitHub token")}const h=L(i.refreshToken),g=L(i.tokenEndpoint),c=L(i.clientId);if(!h||!g||!c)throw new Error(Y);if(!_e(g))throw new Error(Y);const w=L(i.repository?.owner),y=L(i.repository?.name),N="GitHub MCP returned refresh metadata for a different repository";if(i.repository?.owner!==void 0&&(!w||w.toLowerCase()!==u.toLowerCase()))throw new Error(N);if(i.repository?.name!==void 0&&(!y||y.toLowerCase()!==a.toLowerCase()))throw new Error(N);const x=ke(i.repository?.id),S=i.expiresAt?Date.parse(i.expiresAt):NaN,b=Number.isFinite(S)?Math.max(0,Math.floor((S-Date.now())/1e3)):null,d=(typeof i.expiresIn=="number"&&Number.isFinite(i.expiresIn)&&Number.isInteger(i.expiresIn)&&i.expiresIn>0?i.expiresIn:null)??b,j=await f({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:{title:`GitHub: ${u}/${a}`,description:`Repo-scoped GitHub access for ${u}/${a}`,icon:n.icon,app_name:n.app_name,app_id:n.app_id,connection_type:n.connection_type,connection_url:n.connection_url,metadata:{repoScope:{installationId:o,repositoryId:x,owner:u,repo:a,permissions:M,grantProvider:"github-mcp"}}}}}),l=j.structuredContent??j,C=l.item?.id??l.id;if(!C)throw new Error("Failed to create the repo-scoped GitHub connection");if(!(await fetch(`/api/${e}/connections/${C}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:i.token,refreshToken:h,expiresIn:d,scope:i.scope??null,clientId:c,tokenEndpoint:g})})).ok)throw await f({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:C,force:!0}}).catch(()=>{}),new Error("Failed to persist the repo-scoped token");return{childConnectionId:C}}function Ae(s,e){const n=P.c(4),[o,u]=O.useState(s);let a,r;return n[0]!==e||n[1]!==s?(a=()=>{const f=setTimeout(()=>u(s),e);return()=>clearTimeout(f)},r=[s,e],n[0]=e,n[1]=s,n[2]=a,n[3]=r):(a=n[2],r=n[3]),O.useEffect(a,r),o}const D=[{key:"auto-respond-to-issues",triggerType:"github.issues.opened",nameSuffix:"auto-respond to issues",label:"Auto-respond to new issues",defaultEnabled:!0,instructions:({owner:s,name:e})=>`A new GitHub issue has been opened in ${s}/${e}. Read the issue, explore relevant code, create a branch, implement the fix, and open a PR referencing the issue number.`},{key:"review-incoming-prs",triggerType:"github.pull_request.opened",nameSuffix:"review incoming PRs",label:"Review incoming pull requests",defaultEnabled:!0,instructions:({owner:s,name:e})=>`A pull request was opened in ${s}/${e}. Read the diff, summarize what changed, flag risks (security, perf, breaking changes), and leave a review comment.`},{key:"note-merged-prs",triggerType:"github.pull_request.closed",nameSuffix:"note merged/closed PRs",label:"Note merged or closed PRs",defaultEnabled:!1,instructions:({owner:s,name:e})=>`A pull request was closed in ${s}/${e}. If it was merged, update changelog/release notes as appropriate.`}];function Oe(s,e){const n=new Set;if(s.paramsSchema)for(const u of Object.keys(s.paramsSchema))n.add(u);if(Array.isArray(s.params))for(const u of s.params)n.add(u.name);else if(s.params&&typeof s.params=="object")for(const u of Object.keys(s.params))n.add(u);if(n.has("repo"))return{repo:`${e.owner}/${e.name}`};const o={};return n.has("owner")&&(o.owner=e.owner),n.has("name")&&(o.name=e.name),n.has("repository")&&(o.repository=`${e.owner}/${e.name}`),o}async function Ge({githubCallTool:s,selfCallTool:e,virtualMcpId:n,repo:o,connectionId:u,selectedKeys:a}){const r=await s({name:"TRIGGER_LIST",arguments:{}}),f=r.structuredContent??r,p=new Map((f.triggers??[]).map(c=>[c.type,c])),i=D.filter(c=>a.has(c.key)),h=await Promise.allSettled(i.map(async c=>{const w=p.get(c.triggerType);if(!w)throw new Error(`Trigger ${c.triggerType} not exposed`);const y=await e({name:"AUTOMATION_CREATE",arguments:{name:`${o.name}: ${c.nameSuffix}`,virtual_mcp_id:n,messages:c.instructions(o),active:!0}}),N=(y.structuredContent??y).id;if(!N)throw new Error(`AUTOMATION_CREATE returned no id for ${c.key}`);await e({name:"AUTOMATION_TRIGGER_ADD",arguments:{automation_id:N,type:"event",connection_id:u,event_type:c.triggerType,params:Oe(w,o)}})})),g=h.filter(c=>c.status==="rejected").length;return g>0&&console.error("Some GitHub automations failed to set up:",h.filter(c=>c.status==="rejected")),{total:h.length,failed:g}}function Ze(s){const e=P.c(22),{open:n,onOpenChange:o,title:u,hideAutoRespondCheckbox:a,onImportComplete:r}=s,f=u===void 0?"Import from GitHub":u,p=a===void 0?!1:a,[i,h]=O.useState(null);let g;e[0]!==f?(g=t.jsx(ie,{className:"sr-only",children:t.jsx(ae,{children:f})}),e[0]=f,e[1]=g):g=e[1];let c;e[2]!==i||e[3]!==f?(c=t.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3 shrink-0",children:i?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:()=>h(null),className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors shrink-0","aria-label":"Back to accounts",children:t.jsx(Z,{size:16})}),t.jsx("img",{src:i.avatarUrl,alt:i.login,className:"size-5 rounded-full ring-1 ring-border shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:i.login})]}):t.jsxs(t.Fragment,{children:[t.jsx(U,{className:"size-4 text-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:f})]})}),e[2]=i,e[3]=f,e[4]=c):c=e[4];let w;e[5]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(F,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=w):w=e[5];let y;e[6]!==o?(y=()=>o(!1),e[6]=o,e[7]=y):y=e[7];let N;e[8]!==p||e[9]!==r||e[10]!==n||e[11]!==i||e[12]!==y?(N=t.jsx("div",{className:"flex-1 overflow-hidden flex flex-col min-w-0",children:t.jsx(O.Suspense,{fallback:w,children:t.jsx($e,{open:n,onComplete:y,selectedInstallation:i,onSelectInstallation:h,hideAutoRespondCheckbox:p,onImportComplete:r})})}),e[8]=p,e[9]=r,e[10]=n,e[11]=i,e[12]=y,e[13]=N):N=e[13];let x;e[14]!==g||e[15]!==c||e[16]!==N?(x=t.jsxs(le,{className:"sm:max-w-[560px] h-[85svh] sm:h-[520px] p-0 gap-0 overflow-hidden flex flex-col",children:[g,c,N]}),e[14]=g,e[15]=c,e[16]=N,e[17]=x):x=e[17];let S;return e[18]!==o||e[19]!==n||e[20]!==x?(S=t.jsx(ce,{open:n,onOpenChange:o,children:x}),e[18]=o,e[19]=n,e[20]=x,e[21]=S):S=e[21],S}function $e({open:s,onComplete:e,selectedInstallation:n,onSelectInstallation:o,hideAutoRespondCheckbox:u,onImportComplete:a}){const{org:r}=Q(),f=W(),p=be(),[i,h]=O.useState(null),[g,c]=O.useState(!0),[w,y]=O.useState(()=>new Set(D.filter(m=>m.defaultEnabled).map(m=>m.key))),N=D.filter(m=>m.defaultEnabled).map(m=>m.key),x=u?new Set(N):g?w:new Set,S=me({slug:"mcp-github"}),b=Ee(S),I=Se({enabled:s&&b.length===0}),d=b.length===1?b[0]??null:i,j=H({connectionId:d?.id??"",orgId:r.id,orgSlug:r.slug}),l=H({connectionId:X,orgId:r.id,orgSlug:r.slug}),C=async(m,E)=>{try{const G=await j.callTool({name:"get_file_contents",arguments:{owner:m.owner,repo:m.name,path:E}});if(G.isError)return null;const $=G.content?.find(A=>A.type==="resource")?.resource?.text;if(!$)return null;try{const A=JSON.parse($);return typeof A=="string"?A:JSON.stringify(A)}catch{return $}}catch{return null}},k=(m,E)=>{Promise.all([C(E,"AGENTS.md"),C(E,"CLAUDE.md")]).then(async([R,G])=>{const _=R??G??null;_&&(await l.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:m,data:{metadata:{instructions:_}}}}),B(f,r.id))}).catch(R=>{console.error("GitHub instructions fetch failed:",R)})},v=async({virtualMcpId:m,repo:E,connectionId:R,selectedKeys:G})=>{const{total:_,failed:$}=await Ge({githubCallTool:A=>j.callTool(A),selfCallTool:A=>l.callTool(A),virtualMcpId:m,repo:E,connectionId:R,selectedKeys:G});$>0&&z.warning(`Set up ${_-$}/${_} GitHub automations. Add the rest from the automations view.`)},T=ne({mutationFn:async m=>{if(!d||!n)throw new Error("No GitHub connection or installation");const E=n.installationId,{childConnectionId:R}=await Re({orgSlug:r.slug,sourceConnection:d,installationId:E,owner:m.owner,repo:m.name,githubCallTool:_=>j.callTool(_),selfCallTool:_=>l.callTool(_)});let G=null;try{const _=await l.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:m.name,description:m.description||"Imported from GitHub",pinned:!1,icon:null,metadata:{githubRepo:{owner:m.owner,name:m.name,url:m.url,installationId:E,connectionId:R},instructions:null,ui:{pinnedViews:null,layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}},connections:[{connection_id:R}]}}}),$=_.structuredContent??_,A=$.item?.id;if(!$.item||!A)throw new Error("Failed to create the imported agent");return G=A,x.size>0&&await v({virtualMcpId:A,repo:m,connectionId:R,selectedKeys:x}).catch(ee=>{console.error("Failed to set up GitHub automations:",ee),z.warning("Imported repo, but failed to set up GitHub automations. You can add triggers manually from the automations view.")}),{virtualMcpId:A,repo:m,connectionId:R,item:$.item}}catch(_){throw G&&await l.callTool({name:"COLLECTION_VIRTUAL_MCP_DELETE",arguments:{id:G}}).catch(()=>{}),await l.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:R,force:!0}}).catch(()=>{}),_}},onSuccess:({virtualMcpId:m,repo:E,connectionId:R,item:G})=>{if(f.setQueryData(V.collectionItem(l,r.id,"","VIRTUAL_MCP",m),{item:G}),B(f,r.id),k(m,E),a){a({virtualMcpId:m,repo:E,connectionId:R});return}z.success(`Imported ${E.name} from GitHub`),e(),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),p(m)},onError:m=>{z.error("Failed to import repo: "+(m instanceof Error?m.message:"Unknown error"))}});return I.status==="installing"||I.status==="authenticating"?t.jsx(q,{status:I.status,error:null,retry:I.retry}):I.status==="error"?t.jsx(q,{status:"error",error:I.error,retry:I.retry}):b.length===0&&I.status==="idle"?t.jsx(q,{status:"installing",error:null,retry:I.retry}):b.length>1&&!d?t.jsxs("div",{className:"flex flex-col py-2",children:[t.jsx("div",{className:"px-4 py-2",children:t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Select a connection"})}),b.map(m=>t.jsxs("button",{type:"button",onClick:()=>h(m),className:"flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left",children:[m.icon?t.jsx("img",{src:m.icon,alt:m.title,className:"size-7 rounded-full shrink-0"}):t.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:t.jsx(U,{className:"size-3.5 text-muted-foreground"})}),t.jsx("span",{className:"text-sm font-medium",children:m.title})]},m.id))]}):d?n?t.jsx(Le,{connectionId:d.id,orgId:r.id,orgSlug:r.slug,installation:n,onSelectRepo:m=>T.mutate(m),isSaving:T.isPending,autoRespondEnabled:g,onAutoRespondChange:c,selectedAutomationKeys:w,onAutomationKeysChange:y,hideAutoRespondCheckbox:u}):t.jsx(Pe,{connectionId:d.id,orgId:r.id,orgSlug:r.slug,onSelect:o,showBackButton:b.length>1,onBack:()=>h(null)}):null}function Pe(s){const e=P.c(31),{connectionId:n,orgId:o,orgSlug:u,onSelect:a,showBackButton:r,onBack:f}=s;let p;e[0]!==o||e[1]!==u?(p={connectionId:X,orgId:o,orgSlug:u},e[0]=o,e[1]=u,e[2]=p):p=e[2];const i=H(p);let h;e[3]!==n||e[4]!==o?(h=V.githubUserOrgs(o,n),e[3]=n,e[4]=o,e[5]=h):h=e[5];let g;e[6]!==n||e[7]!==i?(g=()=>ve(l=>i.callTool(l),n),e[6]=n,e[7]=i,e[8]=g):g=e[8];let c;e[9]!==h||e[10]!==g?(c={queryKey:h,queryFn:g},e[9]=h,e[10]=g,e[11]=c):c=e[11];const w=se(c);if(w.isLoading){let l;return e[12]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(F,{size:18,className:"animate-spin text-muted-foreground"})}),e[12]=l):l=e[12],l}if(w.isError){let l;return e[13]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-destructive",children:"Failed to load GitHub accounts"})}),e[13]=l):l=e[13],l}const y=w.data;if(!y)return null;let N;e[14]!==f||e[15]!==r?(N=r&&t.jsx("div",{className:"flex items-center gap-1 px-4 pt-3 pb-1 shrink-0",children:t.jsxs("button",{type:"button",onClick:f,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Z,{size:12}),"Change connection"]})}),e[14]=f,e[15]=r,e[16]=N):N=e[16];let x;if(e[17]!==y.installations||e[18]!==a){let l;e[20]!==a?(l=C=>t.jsxs("button",{type:"button",onClick:()=>a(C),className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left group",children:[t.jsx("img",{src:C.avatarUrl,alt:C.login,className:"size-7 rounded-full shrink-0 ring-1 ring-border"}),t.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[t.jsx("span",{className:"text-sm font-medium leading-none",children:C.login}),C.type==="User"&&t.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"Personal account"})]}),t.jsx("span",{className:"text-xs text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:"Select →"})]},C.installationId),e[20]=a,e[21]=l):l=e[21],x=y.installations.map(l),e[17]=y.installations,e[18]=a,e[19]=x}else x=e[19];let S;e[22]!==x?(S=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden [scrollbar-gutter:stable]",children:x}),e[22]=x,e[23]=S):S=e[23];const b=y.appSlug?`https://github.com/apps/${y.appSlug}/installations/new`:"https://github.com/settings/installations";let I;e[24]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("span",{className:"underline underline-offset-2",children:"Install the GitHub App"}),e[24]=I):I=e[24];let d;e[25]!==b?(d=t.jsx("div",{className:"px-4 py-3 border-t border-border shrink-0",children:t.jsxs("a",{href:b,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:["Account not listed?"," ",I]})}),e[25]=b,e[26]=d):d=e[26];let j;return e[27]!==d||e[28]!==N||e[29]!==S?(j=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[N,S,d]}),e[27]=d,e[28]=N,e[29]=S,e[30]=j):j=e[30],j}function Le(s){const e=P.c(27),{connectionId:n,orgId:o,orgSlug:u,installation:a,onSelectRepo:r,isSaving:f,autoRespondEnabled:p,onAutoRespondChange:i,selectedAutomationKeys:h,onAutomationKeysChange:g,hideAutoRespondCheckbox:c}=s,[w,y]=O.useState(""),N=Ae(w,300),x=O.useDeferredValue(N),S=w!==x;let b;e[0]!==S||e[1]!==w?(b=t.jsx(ue,{placeholder:"Search repositories...",value:w,onChange:y,isSearching:S}),e[0]=S,e[1]=w,e[2]=b):b=e[2];const I=S?"opacity-40":"opacity-100";let d;e[3]!==I?(d=K("flex-1 overflow-hidden flex flex-col transition-opacity duration-150",I),e[3]=I,e[4]=d):d=e[4];let j;e[5]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(F,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=j):j=e[5];let l;e[6]!==n||e[7]!==x||e[8]!==a||e[9]!==f||e[10]!==r||e[11]!==o||e[12]!==u?(l=t.jsx(O.Suspense,{fallback:j,children:t.jsx(He,{connectionId:n,orgId:o,orgSlug:u,installation:a,query:x,onSelectRepo:r,isSaving:f})}),e[6]=n,e[7]=x,e[8]=a,e[9]=f,e[10]=r,e[11]=o,e[12]=u,e[13]=l):l=e[13];let C;e[14]!==d||e[15]!==l?(C=t.jsx("div",{className:d,children:l}),e[14]=d,e[15]=l,e[16]=C):C=e[16];let k;e[17]!==p||e[18]!==c||e[19]!==i||e[20]!==g||e[21]!==h?(k=!c&&t.jsxs("div",{className:"border-t border-border shrink-0",children:[t.jsxs("label",{className:"flex items-center gap-2 px-4 py-3 cursor-pointer select-none",children:[t.jsx(J,{checked:p,onCheckedChange:T=>i(T===!0)}),t.jsx("span",{className:"text-xs text-foreground",children:"Set up GitHub automations for this repo"})]}),p&&t.jsx("div",{className:"px-4 pb-3 pl-9 flex flex-col gap-1.5",children:D.map(T=>t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[t.jsx(J,{checked:h.has(T.key),onCheckedChange:m=>{const E=new Set(h);m===!0?E.add(T.key):E.delete(T.key),g(E)}}),t.jsx("span",{className:"text-xs text-muted-foreground",children:T.label})]},T.key))})]}),e[17]=p,e[18]=c,e[19]=i,e[20]=g,e[21]=h,e[22]=k):k=e[22];let v;return e[23]!==b||e[24]!==C||e[25]!==k?(v=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[b,C,k]}),e[23]=b,e[24]=C,e[25]=k,e[26]=v):v=e[26],v}function He(s){const e=P.c(29),{connectionId:n,orgId:o,orgSlug:u,installation:a,query:r,onSelectRepo:f,isSaving:p}=s;let i;e[0]!==n||e[1]!==o||e[2]!==u?(i={connectionId:n,orgId:o,orgSlug:u},e[0]=n,e[1]=o,e[2]=u,e[3]=i):i=e[3];const h=H(i),g=a.type==="User"?"user":"org",c=r?`${g}:${a.login} ${r} in:name`:`${g}:${a.login}`;let w;e[4]!==n||e[5]!==a.login||e[6]!==o||e[7]!==r?(w=V.githubOrgRepos(o,n,a.login,r),e[4]=n,e[5]=a.login,e[6]=o,e[7]=r,e[8]=w):w=e[8];let y;e[9]!==h||e[10]!==c?(y=async I=>{const{signal:d}=I,l=(await h.callTool({name:"search_repositories",arguments:{query:c,page:1,perPage:30}},void 0,{signal:d})).content?.[0]?.text;if(!l)throw new Error("No response from search_repositories");return(JSON.parse(l).items??[]).map(Ue)},e[9]=h,e[10]=c,e[11]=y):y=e[11];let N;e[12]!==w||e[13]!==y?(N={queryKey:w,queryFn:y},e[12]=w,e[13]=y,e[14]=N):N=e[14];const{data:x}=oe(N);if(x.length===0){let I;e[15]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("p",{className:"text-sm text-muted-foreground",children:"No repositories found"}),e[15]=I):I=e[15];let d;e[16]!==r?(d=r&&t.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Try a different search term"}),e[16]=r,e[17]=d):d=e[17];let j;return e[18]!==d?(j=t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-1",children:[I,d]}),e[18]=d,e[19]=j):j=e[19],j}let S;if(e[20]!==p||e[21]!==f||e[22]!==x){let I;e[24]!==p||e[25]!==f?(I=d=>t.jsxs("button",{type:"button",onClick:()=>f(d),disabled:p,className:"flex items-start gap-3 px-4 py-3 hover:bg-accent transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",children:[t.jsx(U,{className:"size-4 text-muted-foreground mt-0.5 shrink-0"}),t.jsx("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:t.jsx("span",{className:"text-sm font-medium truncate",children:d.name})}),t.jsxs("span",{className:"flex items-center gap-1 text-xs font-medium text-muted-foreground border border-border rounded px-1.5 py-0.5 shrink-0 leading-none",children:[d.private?t.jsx(re,{size:10}):t.jsx(pe,{size:10}),d.private?"Private":"Public"]})]},d.fullName),e[24]=p,e[25]=f,e[26]=I):I=e[26],S=x.map(I),e[20]=p,e[21]=f,e[22]=x,e[23]=S}else S=e[23];let b;return e[27]!==S?(b=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden flex flex-col [scrollbar-gutter:stable]",children:S}),e[27]=S,e[28]=b):b=e[28],b}function Ue(s){return{name:s.name,fullName:s.full_name,owner:s.full_name.split("/")[0]??"",url:s.html_url,private:s.private,description:s.description,updatedAt:s.updated_at}}function q(s){const e=P.c(33),{status:n,error:o,retry:u}=s;if(n==="error"){let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("div",{className:"size-10 rounded-full bg-destructive/10 flex items-center justify-center",children:t.jsx(U,{className:"size-5 text-destructive"})}),e[0]=l):l=e[0];let C;e[1]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx("p",{className:"text-sm font-medium",children:"Connection failed"}),e[1]=C):C=e[1];const k=o??"Something went wrong while connecting to GitHub.";let v;e[2]!==k?(v=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[C,t.jsx("p",{className:"text-xs text-muted-foreground max-w-[260px] leading-relaxed",children:k})]}),e[2]=k,e[3]=v):v=e[3];let T;e[4]!==u?(T=t.jsx("button",{type:"button",onClick:u,className:"text-xs font-medium text-foreground border border-border rounded-md px-3 py-1.5 hover:bg-accent transition-colors",children:"Try again"}),e[4]=u,e[5]=T):T=e[5];let m;return e[6]!==v||e[7]!==T?(m=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[l,v,T]}),e[6]=v,e[7]=T,e[8]=m):m=e[8],m}const a=n==="authenticating";let r;e[9]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{className:"size-10 rounded-full bg-muted flex items-center justify-center",children:t.jsx(U,{className:"size-5 text-foreground"})}),e[9]=r):r=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsxs("div",{className:"relative size-10",children:[r,t.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 size-4 rounded-full bg-background flex items-center justify-center",children:t.jsx(F,{size:12,className:"animate-spin text-muted-foreground"})})]}),e[10]=f):f=e[10];const p=a?"Authenticating with GitHub":"Setting up GitHub";let i;e[11]!==p?(i=t.jsx("p",{className:"text-sm font-medium",children:p}),e[11]=p,e[12]=i):i=e[12];const h=a?"Complete the OAuth flow in your browser":"Installing the GitHub connection...";let g;e[13]!==h?(g=t.jsx("p",{className:"text-xs text-muted-foreground",children:h}),e[13]=h,e[14]=g):g=e[14];let c;e[15]!==i||e[16]!==g?(c=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[i,g]}),e[15]=i,e[16]=g,e[17]=c):c=e[17];const w=a?"bg-muted-foreground/30":"bg-foreground animate-pulse";let y;e[18]!==w?(y=K("size-1.5 rounded-full",w),e[18]=w,e[19]=y):y=e[19];let N;e[20]!==y?(N=t.jsx("span",{className:y}),e[20]=y,e[21]=N):N=e[21];const x=a?"bg-foreground animate-pulse":"bg-muted-foreground/30";let S;e[22]!==x?(S=K("size-1.5 rounded-full",x),e[22]=x,e[23]=S):S=e[23];let b;e[24]!==S?(b=t.jsx("span",{className:S}),e[24]=S,e[25]=b):b=e[25];let I;e[26]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("span",{className:"size-1.5 rounded-full bg-muted-foreground/30"}),e[26]=I):I=e[26];let d;e[27]!==N||e[28]!==b?(d=t.jsxs("div",{className:"flex items-center gap-1.5",children:[N,b,I]}),e[27]=N,e[28]=b,e[29]=d):d=e[29];let j;return e[30]!==d||e[31]!==c?(j=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[f,c,d]}),e[30]=d,e[31]=c,e[32]=j):j=e[32],j}export{Ze as G,U as a,Xe as b,ve as f,Ee as g,Re as p,Se as u};
1
+ import{e as P,j as t,p as Q,b as te,F as W,r as O,a4 as B,l as F,a as ne,n as z,K as V,m as se,c as K,a5 as oe,ae as re}from"./index-COlSsy5J.js";import{D as ie,a as ae,c as le,d as ce}from"./dialog-BMBVdX8K.js";import{C as J}from"./checkbox-CzoSEbjC.js";import{C as ue}from"./collection-search-BSHmVsv0.js";import{b as de,u as me}from"./use-connection-C7Z8M26w.js";import{W as fe,u as H,S as X}from"./use-mcp-client-CK2bE_Wl.js";import{i as Z}from"./Settings02-BcW_Yd93.js";import{v as pe}from"./agent-icon-B1KjkGhC.js";import{i as ge,a as he}from"./mcp-oauth-kSTvScdZ.js";import{u as xe}from"./use-mcp-tools-B7wduqbV.js";import{e as ye}from"./extract-connection-data-BsbTS0uC.js";import{m as be}from"./use-navigate-to-agent-C2rXzvAb.js";function U(s){const e=P.c(4),{size:n,className:o}=s;let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z"}),e[0]=u):u=e[0];let a;return e[1]!==o||e[2]!==n?(a=t.jsx("svg",{width:n,height:n,viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:o,children:u}),e[1]=o,e[2]=n,e[3]=a):a=e[3],a}function we(s,e){const n=P.c(12),{org:o}=Q();let u;n[0]!==o.id?(u=fe.REGISTRY(o.id),n[0]=o.id,n[1]=u):u=n[1];const a=u;let r;n[2]!==o.id||n[3]!==o.slug||n[4]!==a?(r={connectionId:a,orgId:o.id,orgSlug:o.slug},n[2]=o.id,n[3]=o.slug,n[4]=a,n[5]=r):r=n[5];const f=H(r);let p;n[6]!==s?(p={name:s},n[6]=s,n[7]=p):p=n[7];const i=e?.enabled??!0;let h;return n[8]!==f||n[9]!==p||n[10]!==i?(h={client:f,toolName:"COLLECTION_REGISTRY_APP_GET",toolArguments:p,enabled:i,staleTime:3e5,select:Ne},n[8]=f,n[9]=p,n[10]=i,n[11]=h):h=n[11],xe(h)}function Ne(s){return s.structuredContent?.item??null}const Ie="deco/mcp-github";function Se(s){const{org:e}=Q(),{data:n}=te.useSession(),o=de(),u=W(),[a,r]=O.useState("idle"),[f,p]=O.useState(null),[i,h]=O.useState(null),{data:g,isLoading:c}=we(Ie,{enabled:s.enabled}),w=O.useRef(!1);s.enabled&&g&&!c&&!w.current&&n?.user?.id&&a==="idle"&&(w.current=!0,y());async function y(){if(!(!g||!n?.user?.id||!e))try{r("installing"),p(null);const x=ye(g,e.id,n.user.id,{remoteIndex:0});if(!x.connection_url)throw new Error("Registry item is missing a remote URL for mcp-github");const{id:b}=await o.create.mutateAsync(x);r("authenticating");const I=new URL(`/api/${e.slug}/mcp/${b}`,window.location.origin),d=await ge({url:I.href,token:null,orgId:e.id});if(d.supportsOAuth&&!d.isAuthenticated){const{token:j,tokenInfo:l,error:C}=await he({connectionId:b,orgSlug:e.slug,scope:"offline_access"});if(C||!j){try{await o.delete.mutateAsync(b)}catch{}throw new Error(C??"No token received from GitHub")}if(l)try{(await fetch(`/api/${e.slug}/connections/${b}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:l.accessToken,refreshToken:l.refreshToken,expiresIn:l.expiresIn,scope:l.scope,clientId:l.clientId,clientSecret:l.clientSecret,tokenEndpoint:l.tokenEndpoint})})).ok||await o.update.mutateAsync({id:b,data:{connection_token:j}})}catch{await o.update.mutateAsync({id:b,data:{connection_token:j}})}}B(u,e.id),h(x),r("ready")}catch(x){p(x instanceof Error?x.message:String(x)),r("error")}}function N(){r("idle"),p(null),h(null),w.current=!1}return s.enabled&&c&&a==="idle"?{status:"installing",error:null,connection:null,retry:N}:{status:a,error:f,connection:i,retry:N}}const M={contents:"write",metadata:"read",pull_requests:"write",issues:"write"};function je(s){if(!s||typeof s!="object"||Array.isArray(s))return M;const e=s;return Object.values(e).some(n=>typeof n!="string")?M:e}function Ce(s){if(!(typeof s!="number"||!Number.isFinite(s)||!Number.isInteger(s)||s<=0))return s}function Te(s){const e=s.metadata?.repoScope;if(!e||typeof e.installationId!="number"||!Number.isFinite(e.installationId)||!Number.isInteger(e.installationId)||e.installationId<=0||typeof e.owner!="string"||typeof e.repo!="string"||e.owner.length===0||e.repo.length===0)return null;const n=Ce(e.repositoryId);return{sourceConnectionId:typeof e.sourceConnectionId=="string"?e.sourceConnectionId:void 0,installationId:e.installationId,repositoryId:n,owner:e.owner,repo:e.repo,permissions:je(e.permissions),grantProvider:e.grantProvider==="github-mcp"?"github-mcp":void 0}}function Ee(s){return(s??[]).filter(e=>Te(e)===null)}async function ve(s,e){const o=(await s({name:"GITHUB_LIST_USER_ORGS",arguments:{connectionId:e}})).content?.[0]?.text;if(!o)throw new Error("No response from GITHUB_LIST_USER_ORGS");try{return JSON.parse(o)}catch{throw new Error("Invalid response from GITHUB_LIST_USER_ORGS")}}function Xe(s,e){const n=e.toLowerCase();return s.find(o=>o.login.toLowerCase()===n)}const Y="GitHub MCP did not return refreshable repo grant metadata";function L(s){if(typeof s!="string")return null;const e=s.trim();return e.length>0?e:null}function _e(s){try{const e=new URL(s);return(e.protocol==="http:"||e.protocol==="https:")&&!e.username&&!e.password}catch{return!1}}function ke(s){return typeof s=="number"&&Number.isFinite(s)&&Number.isInteger(s)&&s>0?s:void 0}async function Re(s){const{orgSlug:e,sourceConnection:n,installationId:o,owner:u,repo:a,githubCallTool:r,selfCallTool:f}=s,p=await r({name:"MINT_REPO_TOKEN",arguments:{installationId:o,owner:u,repo:a,permissions:M}}),i=p.structuredContent;if(p.isError||!i?.token){const v=p.content?.find(T=>T.type==="text")?.text;throw new Error(v?`Failed to mint a repo-scoped GitHub token: ${v}`:"Failed to mint a repo-scoped GitHub token")}const h=L(i.refreshToken),g=L(i.tokenEndpoint),c=L(i.clientId);if(!h||!g||!c)throw new Error(Y);if(!_e(g))throw new Error(Y);const w=L(i.repository?.owner),y=L(i.repository?.name),N="GitHub MCP returned refresh metadata for a different repository";if(i.repository?.owner!==void 0&&(!w||w.toLowerCase()!==u.toLowerCase()))throw new Error(N);if(i.repository?.name!==void 0&&(!y||y.toLowerCase()!==a.toLowerCase()))throw new Error(N);const x=ke(i.repository?.id),S=i.expiresAt?Date.parse(i.expiresAt):NaN,b=Number.isFinite(S)?Math.max(0,Math.floor((S-Date.now())/1e3)):null,d=(typeof i.expiresIn=="number"&&Number.isFinite(i.expiresIn)&&Number.isInteger(i.expiresIn)&&i.expiresIn>0?i.expiresIn:null)??b,j=await f({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:{title:`GitHub: ${u}/${a}`,description:`Repo-scoped GitHub access for ${u}/${a}`,icon:n.icon,app_name:n.app_name,app_id:n.app_id,connection_type:n.connection_type,connection_url:n.connection_url,metadata:{repoScope:{installationId:o,repositoryId:x,owner:u,repo:a,permissions:M,grantProvider:"github-mcp"}}}}}),l=j.structuredContent??j,C=l.item?.id??l.id;if(!C)throw new Error("Failed to create the repo-scoped GitHub connection");if(!(await fetch(`/api/${e}/connections/${C}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:i.token,refreshToken:h,expiresIn:d,scope:i.scope??null,clientId:c,tokenEndpoint:g})})).ok)throw await f({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:C,force:!0}}).catch(()=>{}),new Error("Failed to persist the repo-scoped token");return{childConnectionId:C}}function Ae(s,e){const n=P.c(4),[o,u]=O.useState(s);let a,r;return n[0]!==e||n[1]!==s?(a=()=>{const f=setTimeout(()=>u(s),e);return()=>clearTimeout(f)},r=[s,e],n[0]=e,n[1]=s,n[2]=a,n[3]=r):(a=n[2],r=n[3]),O.useEffect(a,r),o}const D=[{key:"auto-respond-to-issues",triggerType:"github.issues.opened",nameSuffix:"auto-respond to issues",label:"Auto-respond to new issues",defaultEnabled:!0,instructions:({owner:s,name:e})=>`A new GitHub issue has been opened in ${s}/${e}. Read the issue, explore relevant code, create a branch, implement the fix, and open a PR referencing the issue number.`},{key:"review-incoming-prs",triggerType:"github.pull_request.opened",nameSuffix:"review incoming PRs",label:"Review incoming pull requests",defaultEnabled:!0,instructions:({owner:s,name:e})=>`A pull request was opened in ${s}/${e}. Read the diff, summarize what changed, flag risks (security, perf, breaking changes), and leave a review comment.`},{key:"note-merged-prs",triggerType:"github.pull_request.closed",nameSuffix:"note merged/closed PRs",label:"Note merged or closed PRs",defaultEnabled:!1,instructions:({owner:s,name:e})=>`A pull request was closed in ${s}/${e}. If it was merged, update changelog/release notes as appropriate.`}];function Oe(s,e){const n=new Set;if(s.paramsSchema)for(const u of Object.keys(s.paramsSchema))n.add(u);if(Array.isArray(s.params))for(const u of s.params)n.add(u.name);else if(s.params&&typeof s.params=="object")for(const u of Object.keys(s.params))n.add(u);if(n.has("repo"))return{repo:`${e.owner}/${e.name}`};const o={};return n.has("owner")&&(o.owner=e.owner),n.has("name")&&(o.name=e.name),n.has("repository")&&(o.repository=`${e.owner}/${e.name}`),o}async function Ge({githubCallTool:s,selfCallTool:e,virtualMcpId:n,repo:o,connectionId:u,selectedKeys:a}){const r=await s({name:"TRIGGER_LIST",arguments:{}}),f=r.structuredContent??r,p=new Map((f.triggers??[]).map(c=>[c.type,c])),i=D.filter(c=>a.has(c.key)),h=await Promise.allSettled(i.map(async c=>{const w=p.get(c.triggerType);if(!w)throw new Error(`Trigger ${c.triggerType} not exposed`);const y=await e({name:"AUTOMATION_CREATE",arguments:{name:`${o.name}: ${c.nameSuffix}`,virtual_mcp_id:n,messages:c.instructions(o),active:!0}}),N=(y.structuredContent??y).id;if(!N)throw new Error(`AUTOMATION_CREATE returned no id for ${c.key}`);await e({name:"AUTOMATION_TRIGGER_ADD",arguments:{automation_id:N,type:"event",connection_id:u,event_type:c.triggerType,params:Oe(w,o)}})})),g=h.filter(c=>c.status==="rejected").length;return g>0&&console.error("Some GitHub automations failed to set up:",h.filter(c=>c.status==="rejected")),{total:h.length,failed:g}}function Ze(s){const e=P.c(22),{open:n,onOpenChange:o,title:u,hideAutoRespondCheckbox:a,onImportComplete:r}=s,f=u===void 0?"Import from GitHub":u,p=a===void 0?!1:a,[i,h]=O.useState(null);let g;e[0]!==f?(g=t.jsx(ie,{className:"sr-only",children:t.jsx(ae,{children:f})}),e[0]=f,e[1]=g):g=e[1];let c;e[2]!==i||e[3]!==f?(c=t.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3 shrink-0",children:i?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:()=>h(null),className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors shrink-0","aria-label":"Back to accounts",children:t.jsx(Z,{size:16})}),t.jsx("img",{src:i.avatarUrl,alt:i.login,className:"size-5 rounded-full ring-1 ring-border shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:i.login})]}):t.jsxs(t.Fragment,{children:[t.jsx(U,{className:"size-4 text-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:f})]})}),e[2]=i,e[3]=f,e[4]=c):c=e[4];let w;e[5]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(F,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=w):w=e[5];let y;e[6]!==o?(y=()=>o(!1),e[6]=o,e[7]=y):y=e[7];let N;e[8]!==p||e[9]!==r||e[10]!==n||e[11]!==i||e[12]!==y?(N=t.jsx("div",{className:"flex-1 overflow-hidden flex flex-col min-w-0",children:t.jsx(O.Suspense,{fallback:w,children:t.jsx($e,{open:n,onComplete:y,selectedInstallation:i,onSelectInstallation:h,hideAutoRespondCheckbox:p,onImportComplete:r})})}),e[8]=p,e[9]=r,e[10]=n,e[11]=i,e[12]=y,e[13]=N):N=e[13];let x;e[14]!==g||e[15]!==c||e[16]!==N?(x=t.jsxs(le,{className:"sm:max-w-[560px] h-[85svh] sm:h-[520px] p-0 gap-0 overflow-hidden flex flex-col",children:[g,c,N]}),e[14]=g,e[15]=c,e[16]=N,e[17]=x):x=e[17];let S;return e[18]!==o||e[19]!==n||e[20]!==x?(S=t.jsx(ce,{open:n,onOpenChange:o,children:x}),e[18]=o,e[19]=n,e[20]=x,e[21]=S):S=e[21],S}function $e({open:s,onComplete:e,selectedInstallation:n,onSelectInstallation:o,hideAutoRespondCheckbox:u,onImportComplete:a}){const{org:r}=Q(),f=W(),p=be(),[i,h]=O.useState(null),[g,c]=O.useState(!0),[w,y]=O.useState(()=>new Set(D.filter(m=>m.defaultEnabled).map(m=>m.key))),N=D.filter(m=>m.defaultEnabled).map(m=>m.key),x=u?new Set(N):g?w:new Set,S=me({slug:"mcp-github"}),b=Ee(S),I=Se({enabled:s&&b.length===0}),d=b.length===1?b[0]??null:i,j=H({connectionId:d?.id??"",orgId:r.id,orgSlug:r.slug}),l=H({connectionId:X,orgId:r.id,orgSlug:r.slug}),C=async(m,E)=>{try{const G=await j.callTool({name:"get_file_contents",arguments:{owner:m.owner,repo:m.name,path:E}});if(G.isError)return null;const $=G.content?.find(A=>A.type==="resource")?.resource?.text;if(!$)return null;try{const A=JSON.parse($);return typeof A=="string"?A:JSON.stringify(A)}catch{return $}}catch{return null}},k=(m,E)=>{Promise.all([C(E,"AGENTS.md"),C(E,"CLAUDE.md")]).then(async([R,G])=>{const _=R??G??null;_&&(await l.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:m,data:{metadata:{instructions:_}}}}),B(f,r.id))}).catch(R=>{console.error("GitHub instructions fetch failed:",R)})},v=async({virtualMcpId:m,repo:E,connectionId:R,selectedKeys:G})=>{const{total:_,failed:$}=await Ge({githubCallTool:A=>j.callTool(A),selfCallTool:A=>l.callTool(A),virtualMcpId:m,repo:E,connectionId:R,selectedKeys:G});$>0&&z.warning(`Set up ${_-$}/${_} GitHub automations. Add the rest from the automations view.`)},T=ne({mutationFn:async m=>{if(!d||!n)throw new Error("No GitHub connection or installation");const E=n.installationId,{childConnectionId:R}=await Re({orgSlug:r.slug,sourceConnection:d,installationId:E,owner:m.owner,repo:m.name,githubCallTool:_=>j.callTool(_),selfCallTool:_=>l.callTool(_)});let G=null;try{const _=await l.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:m.name,description:m.description||"Imported from GitHub",pinned:!1,icon:null,metadata:{githubRepo:{owner:m.owner,name:m.name,url:m.url,installationId:E,connectionId:R},instructions:null,ui:{pinnedViews:null,layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}},connections:[{connection_id:R}]}}}),$=_.structuredContent??_,A=$.item?.id;if(!$.item||!A)throw new Error("Failed to create the imported agent");return G=A,x.size>0&&await v({virtualMcpId:A,repo:m,connectionId:R,selectedKeys:x}).catch(ee=>{console.error("Failed to set up GitHub automations:",ee),z.warning("Imported repo, but failed to set up GitHub automations. You can add triggers manually from the automations view.")}),{virtualMcpId:A,repo:m,connectionId:R,item:$.item}}catch(_){throw G&&await l.callTool({name:"COLLECTION_VIRTUAL_MCP_DELETE",arguments:{id:G}}).catch(()=>{}),await l.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:R,force:!0}}).catch(()=>{}),_}},onSuccess:({virtualMcpId:m,repo:E,connectionId:R,item:G})=>{if(f.setQueryData(V.collectionItem(l,r.id,"","VIRTUAL_MCP",m),{item:G}),B(f,r.id),k(m,E),a){a({virtualMcpId:m,repo:E,connectionId:R});return}z.success(`Imported ${E.name} from GitHub`),e(),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),p(m)},onError:m=>{z.error("Failed to import repo: "+(m instanceof Error?m.message:"Unknown error"))}});return I.status==="installing"||I.status==="authenticating"?t.jsx(q,{status:I.status,error:null,retry:I.retry}):I.status==="error"?t.jsx(q,{status:"error",error:I.error,retry:I.retry}):b.length===0&&I.status==="idle"?t.jsx(q,{status:"installing",error:null,retry:I.retry}):b.length>1&&!d?t.jsxs("div",{className:"flex flex-col py-2",children:[t.jsx("div",{className:"px-4 py-2",children:t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Select a connection"})}),b.map(m=>t.jsxs("button",{type:"button",onClick:()=>h(m),className:"flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left",children:[m.icon?t.jsx("img",{src:m.icon,alt:m.title,className:"size-7 rounded-full shrink-0"}):t.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:t.jsx(U,{className:"size-3.5 text-muted-foreground"})}),t.jsx("span",{className:"text-sm font-medium",children:m.title})]},m.id))]}):d?n?t.jsx(Le,{connectionId:d.id,orgId:r.id,orgSlug:r.slug,installation:n,onSelectRepo:m=>T.mutate(m),isSaving:T.isPending,autoRespondEnabled:g,onAutoRespondChange:c,selectedAutomationKeys:w,onAutomationKeysChange:y,hideAutoRespondCheckbox:u}):t.jsx(Pe,{connectionId:d.id,orgId:r.id,orgSlug:r.slug,onSelect:o,showBackButton:b.length>1,onBack:()=>h(null)}):null}function Pe(s){const e=P.c(31),{connectionId:n,orgId:o,orgSlug:u,onSelect:a,showBackButton:r,onBack:f}=s;let p;e[0]!==o||e[1]!==u?(p={connectionId:X,orgId:o,orgSlug:u},e[0]=o,e[1]=u,e[2]=p):p=e[2];const i=H(p);let h;e[3]!==n||e[4]!==o?(h=V.githubUserOrgs(o,n),e[3]=n,e[4]=o,e[5]=h):h=e[5];let g;e[6]!==n||e[7]!==i?(g=()=>ve(l=>i.callTool(l),n),e[6]=n,e[7]=i,e[8]=g):g=e[8];let c;e[9]!==h||e[10]!==g?(c={queryKey:h,queryFn:g},e[9]=h,e[10]=g,e[11]=c):c=e[11];const w=se(c);if(w.isLoading){let l;return e[12]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(F,{size:18,className:"animate-spin text-muted-foreground"})}),e[12]=l):l=e[12],l}if(w.isError){let l;return e[13]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-destructive",children:"Failed to load GitHub accounts"})}),e[13]=l):l=e[13],l}const y=w.data;if(!y)return null;let N;e[14]!==f||e[15]!==r?(N=r&&t.jsx("div",{className:"flex items-center gap-1 px-4 pt-3 pb-1 shrink-0",children:t.jsxs("button",{type:"button",onClick:f,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Z,{size:12}),"Change connection"]})}),e[14]=f,e[15]=r,e[16]=N):N=e[16];let x;if(e[17]!==y.installations||e[18]!==a){let l;e[20]!==a?(l=C=>t.jsxs("button",{type:"button",onClick:()=>a(C),className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left group",children:[t.jsx("img",{src:C.avatarUrl,alt:C.login,className:"size-7 rounded-full shrink-0 ring-1 ring-border"}),t.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[t.jsx("span",{className:"text-sm font-medium leading-none",children:C.login}),C.type==="User"&&t.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"Personal account"})]}),t.jsx("span",{className:"text-xs text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:"Select →"})]},C.installationId),e[20]=a,e[21]=l):l=e[21],x=y.installations.map(l),e[17]=y.installations,e[18]=a,e[19]=x}else x=e[19];let S;e[22]!==x?(S=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden [scrollbar-gutter:stable]",children:x}),e[22]=x,e[23]=S):S=e[23];const b=y.appSlug?`https://github.com/apps/${y.appSlug}/installations/new`:"https://github.com/settings/installations";let I;e[24]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("span",{className:"underline underline-offset-2",children:"Install the GitHub App"}),e[24]=I):I=e[24];let d;e[25]!==b?(d=t.jsx("div",{className:"px-4 py-3 border-t border-border shrink-0",children:t.jsxs("a",{href:b,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:["Account not listed?"," ",I]})}),e[25]=b,e[26]=d):d=e[26];let j;return e[27]!==d||e[28]!==N||e[29]!==S?(j=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[N,S,d]}),e[27]=d,e[28]=N,e[29]=S,e[30]=j):j=e[30],j}function Le(s){const e=P.c(27),{connectionId:n,orgId:o,orgSlug:u,installation:a,onSelectRepo:r,isSaving:f,autoRespondEnabled:p,onAutoRespondChange:i,selectedAutomationKeys:h,onAutomationKeysChange:g,hideAutoRespondCheckbox:c}=s,[w,y]=O.useState(""),N=Ae(w,300),x=O.useDeferredValue(N),S=w!==x;let b;e[0]!==S||e[1]!==w?(b=t.jsx(ue,{placeholder:"Search repositories...",value:w,onChange:y,isSearching:S}),e[0]=S,e[1]=w,e[2]=b):b=e[2];const I=S?"opacity-40":"opacity-100";let d;e[3]!==I?(d=K("flex-1 overflow-hidden flex flex-col transition-opacity duration-150",I),e[3]=I,e[4]=d):d=e[4];let j;e[5]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(F,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=j):j=e[5];let l;e[6]!==n||e[7]!==x||e[8]!==a||e[9]!==f||e[10]!==r||e[11]!==o||e[12]!==u?(l=t.jsx(O.Suspense,{fallback:j,children:t.jsx(He,{connectionId:n,orgId:o,orgSlug:u,installation:a,query:x,onSelectRepo:r,isSaving:f})}),e[6]=n,e[7]=x,e[8]=a,e[9]=f,e[10]=r,e[11]=o,e[12]=u,e[13]=l):l=e[13];let C;e[14]!==d||e[15]!==l?(C=t.jsx("div",{className:d,children:l}),e[14]=d,e[15]=l,e[16]=C):C=e[16];let k;e[17]!==p||e[18]!==c||e[19]!==i||e[20]!==g||e[21]!==h?(k=!c&&t.jsxs("div",{className:"border-t border-border shrink-0",children:[t.jsxs("label",{className:"flex items-center gap-2 px-4 py-3 cursor-pointer select-none",children:[t.jsx(J,{checked:p,onCheckedChange:T=>i(T===!0)}),t.jsx("span",{className:"text-xs text-foreground",children:"Set up GitHub automations for this repo"})]}),p&&t.jsx("div",{className:"px-4 pb-3 pl-9 flex flex-col gap-1.5",children:D.map(T=>t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[t.jsx(J,{checked:h.has(T.key),onCheckedChange:m=>{const E=new Set(h);m===!0?E.add(T.key):E.delete(T.key),g(E)}}),t.jsx("span",{className:"text-xs text-muted-foreground",children:T.label})]},T.key))})]}),e[17]=p,e[18]=c,e[19]=i,e[20]=g,e[21]=h,e[22]=k):k=e[22];let v;return e[23]!==b||e[24]!==C||e[25]!==k?(v=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[b,C,k]}),e[23]=b,e[24]=C,e[25]=k,e[26]=v):v=e[26],v}function He(s){const e=P.c(29),{connectionId:n,orgId:o,orgSlug:u,installation:a,query:r,onSelectRepo:f,isSaving:p}=s;let i;e[0]!==n||e[1]!==o||e[2]!==u?(i={connectionId:n,orgId:o,orgSlug:u},e[0]=n,e[1]=o,e[2]=u,e[3]=i):i=e[3];const h=H(i),g=a.type==="User"?"user":"org",c=r?`${g}:${a.login} ${r} in:name`:`${g}:${a.login}`;let w;e[4]!==n||e[5]!==a.login||e[6]!==o||e[7]!==r?(w=V.githubOrgRepos(o,n,a.login,r),e[4]=n,e[5]=a.login,e[6]=o,e[7]=r,e[8]=w):w=e[8];let y;e[9]!==h||e[10]!==c?(y=async I=>{const{signal:d}=I,l=(await h.callTool({name:"search_repositories",arguments:{query:c,page:1,perPage:30}},void 0,{signal:d})).content?.[0]?.text;if(!l)throw new Error("No response from search_repositories");return(JSON.parse(l).items??[]).map(Ue)},e[9]=h,e[10]=c,e[11]=y):y=e[11];let N;e[12]!==w||e[13]!==y?(N={queryKey:w,queryFn:y},e[12]=w,e[13]=y,e[14]=N):N=e[14];const{data:x}=oe(N);if(x.length===0){let I;e[15]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("p",{className:"text-sm text-muted-foreground",children:"No repositories found"}),e[15]=I):I=e[15];let d;e[16]!==r?(d=r&&t.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Try a different search term"}),e[16]=r,e[17]=d):d=e[17];let j;return e[18]!==d?(j=t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-1",children:[I,d]}),e[18]=d,e[19]=j):j=e[19],j}let S;if(e[20]!==p||e[21]!==f||e[22]!==x){let I;e[24]!==p||e[25]!==f?(I=d=>t.jsxs("button",{type:"button",onClick:()=>f(d),disabled:p,className:"flex items-start gap-3 px-4 py-3 hover:bg-accent transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",children:[t.jsx(U,{className:"size-4 text-muted-foreground mt-0.5 shrink-0"}),t.jsx("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:t.jsx("span",{className:"text-sm font-medium truncate",children:d.name})}),t.jsxs("span",{className:"flex items-center gap-1 text-xs font-medium text-muted-foreground border border-border rounded px-1.5 py-0.5 shrink-0 leading-none",children:[d.private?t.jsx(re,{size:10}):t.jsx(pe,{size:10}),d.private?"Private":"Public"]})]},d.fullName),e[24]=p,e[25]=f,e[26]=I):I=e[26],S=x.map(I),e[20]=p,e[21]=f,e[22]=x,e[23]=S}else S=e[23];let b;return e[27]!==S?(b=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden flex flex-col [scrollbar-gutter:stable]",children:S}),e[27]=S,e[28]=b):b=e[28],b}function Ue(s){return{name:s.name,fullName:s.full_name,owner:s.full_name.split("/")[0]??"",url:s.html_url,private:s.private,description:s.description,updatedAt:s.updated_at}}function q(s){const e=P.c(33),{status:n,error:o,retry:u}=s;if(n==="error"){let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("div",{className:"size-10 rounded-full bg-destructive/10 flex items-center justify-center",children:t.jsx(U,{className:"size-5 text-destructive"})}),e[0]=l):l=e[0];let C;e[1]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx("p",{className:"text-sm font-medium",children:"Connection failed"}),e[1]=C):C=e[1];const k=o??"Something went wrong while connecting to GitHub.";let v;e[2]!==k?(v=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[C,t.jsx("p",{className:"text-xs text-muted-foreground max-w-[260px] leading-relaxed",children:k})]}),e[2]=k,e[3]=v):v=e[3];let T;e[4]!==u?(T=t.jsx("button",{type:"button",onClick:u,className:"text-xs font-medium text-foreground border border-border rounded-md px-3 py-1.5 hover:bg-accent transition-colors",children:"Try again"}),e[4]=u,e[5]=T):T=e[5];let m;return e[6]!==v||e[7]!==T?(m=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[l,v,T]}),e[6]=v,e[7]=T,e[8]=m):m=e[8],m}const a=n==="authenticating";let r;e[9]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{className:"size-10 rounded-full bg-muted flex items-center justify-center",children:t.jsx(U,{className:"size-5 text-foreground"})}),e[9]=r):r=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsxs("div",{className:"relative size-10",children:[r,t.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 size-4 rounded-full bg-background flex items-center justify-center",children:t.jsx(F,{size:12,className:"animate-spin text-muted-foreground"})})]}),e[10]=f):f=e[10];const p=a?"Authenticating with GitHub":"Setting up GitHub";let i;e[11]!==p?(i=t.jsx("p",{className:"text-sm font-medium",children:p}),e[11]=p,e[12]=i):i=e[12];const h=a?"Complete the OAuth flow in your browser":"Installing the GitHub connection...";let g;e[13]!==h?(g=t.jsx("p",{className:"text-xs text-muted-foreground",children:h}),e[13]=h,e[14]=g):g=e[14];let c;e[15]!==i||e[16]!==g?(c=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[i,g]}),e[15]=i,e[16]=g,e[17]=c):c=e[17];const w=a?"bg-muted-foreground/30":"bg-foreground animate-pulse";let y;e[18]!==w?(y=K("size-1.5 rounded-full",w),e[18]=w,e[19]=y):y=e[19];let N;e[20]!==y?(N=t.jsx("span",{className:y}),e[20]=y,e[21]=N):N=e[21];const x=a?"bg-foreground animate-pulse":"bg-muted-foreground/30";let S;e[22]!==x?(S=K("size-1.5 rounded-full",x),e[22]=x,e[23]=S):S=e[23];let b;e[24]!==S?(b=t.jsx("span",{className:S}),e[24]=S,e[25]=b):b=e[25];let I;e[26]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("span",{className:"size-1.5 rounded-full bg-muted-foreground/30"}),e[26]=I):I=e[26];let d;e[27]!==N||e[28]!==b?(d=t.jsxs("div",{className:"flex items-center gap-1.5",children:[N,b,I]}),e[27]=N,e[28]=b,e[29]=d):d=e[29];let j;return e[30]!==d||e[31]!==c?(j=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[f,c,d]}),e[30]=d,e[31]=c,e[32]=j):j=e[32],j}export{Ze as G,U as a,Xe as b,ve as f,Ee as g,Re as p,Se as u};
@@ -1,4 +1,4 @@
1
- import{a2 as St,cu as Et,cv as It,bh as C,v as c,cw as ue,bn as ze,bu as Tt,bg as wt,aj as At,aE as O,aD as z,aB as ne,s as S,bi as m,b2 as U,cx as Mt,cy as E,aC as Ot,n as ve,r as V,e as Ie,p as Ct,j as Rt}from"./index-D6izOmjj.js";import{S as Nt,u as xt}from"./use-mcp-client-vlTb1_vQ.js";import{e as Pt,d as Dt,D as Lt}from"./decopilot-sse-pool-BP59aBkW.js";var re;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function a(s){throw new Error}t.assertNever=a,t.arrayToEnum=s=>{const o={};for(const i of s)o[i]=i;return o},t.getValidEnumValues=s=>{const o=t.objectKeys(s).filter(n=>typeof s[s[n]]!="number"),i={};for(const n of o)i[n]=s[n];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(o){return s[o]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const o=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},t.find=(s,o)=>{for(const i of s)if(o(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}t.joinValues=r,t.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(re||(re={}));var Me;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(Me||(Me={}));re.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);re.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class de extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){const a=e||function(o){return o.message},r={_errors:[]},s=o=>{for(const i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)r._errors.push(a(i));else{let n=r,p=0;for(;p<i.path.length;){const u=i.path[p];p===i.path.length-1?(n[u]=n[u]||{_errors:[]},n[u]._errors.push(a(i))):n[u]=n[u]||{_errors:[]},n=n[u],p++}}};return s(this),r}static assert(e){if(!(e instanceof de))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,re.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){const a=Object.create(null),r=[];for(const s of this.issues)if(s.path.length>0){const o=s.path[0];a[o]=a[o]||[],a[o].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:a}}get formErrors(){return this.flatten()}}de.create=t=>new de(t);var Oe;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Oe||(Oe={}));var h;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(h||(h={}));const jt=1e4,Yr="true";function pe(t,e){return St.chatAutosend(t,e)}function kt(t){return t==="pending"||t==="sending"}function Zt(t){if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}return!e||typeof e!="object"||typeof e.createdAt!="number"||typeof e.message!="object"||!kt(e.status)?null:e}function Wr(t,e,a,r,s=Date.now()){const o={message:r,createdAt:s,status:"pending"};return t.setItem(pe(e,a),JSON.stringify(o)),o}function $t(t,e,a){const r=pe(e,a),s=Zt(t.getItem(r));return s||(t.removeItem(r),null)}function Hr(t,e,a,r=Date.now()){const s=pe(e,a),o=$t(t,e,a);return!o||o.status!=="pending"?null:r-o.createdAt>=jt?(t.removeItem(s),null):(t.setItem(s,JSON.stringify({...o,status:"sending"})),{message:o.message,createdAt:o.createdAt})}function qr(t,e,a){t.removeItem(pe(e,a))}var Je="vercel.ai.error",Ut=Symbol.for(Je),Ce,Re,D=class Ye extends(Re=Error,Ce=Ut,Re){constructor({name:e,message:a,cause:r}){super(a),this[Ce]=!0,this.name=e,this.cause=r}static isInstance(e){return Ye.hasMarker(e,Je)}static hasMarker(e,a){const r=Symbol.for(a);return e!=null&&typeof e=="object"&&r in e&&typeof e[r]=="boolean"&&e[r]===!0}};function We(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var He="AI_InvalidArgumentError",qe=`vercel.ai.error.${He}`,Bt=Symbol.for(qe),Ne,xe,Ft=class extends(xe=D,Ne=Bt,xe){constructor({message:t,cause:e,argument:a}){super({name:He,message:t,cause:e}),this[Ne]=!0,this.argument=a}static isInstance(t){return D.hasMarker(t,qe)}},Ge="AI_JSONParseError",Xe=`vercel.ai.error.${Ge}`,Vt=Symbol.for(Xe),Pe,De,Le=class extends(De=D,Pe=Vt,De){constructor({text:t,cause:e}){super({name:Ge,message:`JSON parsing failed: Text: ${t}.
1
+ import{a2 as St,cu as Et,cv as It,bh as C,v as c,cw as ue,bn as ze,bu as Tt,bg as wt,aj as At,aE as O,aD as z,aB as ne,s as S,bi as m,b2 as U,cx as Mt,cy as E,aC as Ot,n as ve,r as V,e as Ie,p as Ct,j as Rt}from"./index-COlSsy5J.js";import{S as Nt,u as xt}from"./use-mcp-client-CK2bE_Wl.js";import{e as Pt,d as Dt,D as Lt}from"./decopilot-sse-pool-DdZSTixQ.js";var re;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function a(s){throw new Error}t.assertNever=a,t.arrayToEnum=s=>{const o={};for(const i of s)o[i]=i;return o},t.getValidEnumValues=s=>{const o=t.objectKeys(s).filter(n=>typeof s[s[n]]!="number"),i={};for(const n of o)i[n]=s[n];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(o){return s[o]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const o=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},t.find=(s,o)=>{for(const i of s)if(o(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}t.joinValues=r,t.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(re||(re={}));var Me;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(Me||(Me={}));re.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);re.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class de extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){const a=e||function(o){return o.message},r={_errors:[]},s=o=>{for(const i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)r._errors.push(a(i));else{let n=r,p=0;for(;p<i.path.length;){const u=i.path[p];p===i.path.length-1?(n[u]=n[u]||{_errors:[]},n[u]._errors.push(a(i))):n[u]=n[u]||{_errors:[]},n=n[u],p++}}};return s(this),r}static assert(e){if(!(e instanceof de))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,re.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){const a=Object.create(null),r=[];for(const s of this.issues)if(s.path.length>0){const o=s.path[0];a[o]=a[o]||[],a[o].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:a}}get formErrors(){return this.flatten()}}de.create=t=>new de(t);var Oe;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Oe||(Oe={}));var h;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(h||(h={}));const jt=1e4,Yr="true";function pe(t,e){return St.chatAutosend(t,e)}function kt(t){return t==="pending"||t==="sending"}function Zt(t){if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}return!e||typeof e!="object"||typeof e.createdAt!="number"||typeof e.message!="object"||!kt(e.status)?null:e}function Wr(t,e,a,r,s=Date.now()){const o={message:r,createdAt:s,status:"pending"};return t.setItem(pe(e,a),JSON.stringify(o)),o}function $t(t,e,a){const r=pe(e,a),s=Zt(t.getItem(r));return s||(t.removeItem(r),null)}function Hr(t,e,a,r=Date.now()){const s=pe(e,a),o=$t(t,e,a);return!o||o.status!=="pending"?null:r-o.createdAt>=jt?(t.removeItem(s),null):(t.setItem(s,JSON.stringify({...o,status:"sending"})),{message:o.message,createdAt:o.createdAt})}function qr(t,e,a){t.removeItem(pe(e,a))}var Je="vercel.ai.error",Ut=Symbol.for(Je),Ce,Re,D=class Ye extends(Re=Error,Ce=Ut,Re){constructor({name:e,message:a,cause:r}){super(a),this[Ce]=!0,this.name=e,this.cause=r}static isInstance(e){return Ye.hasMarker(e,Je)}static hasMarker(e,a){const r=Symbol.for(a);return e!=null&&typeof e=="object"&&r in e&&typeof e[r]=="boolean"&&e[r]===!0}};function We(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var He="AI_InvalidArgumentError",qe=`vercel.ai.error.${He}`,Bt=Symbol.for(qe),Ne,xe,Ft=class extends(xe=D,Ne=Bt,xe){constructor({message:t,cause:e,argument:a}){super({name:He,message:t,cause:e}),this[Ne]=!0,this.argument=a}static isInstance(t){return D.hasMarker(t,qe)}},Ge="AI_JSONParseError",Xe=`vercel.ai.error.${Ge}`,Vt=Symbol.for(Xe),Pe,De,Le=class extends(De=D,Pe=Vt,De){constructor({text:t,cause:e}){super({name:Ge,message:`JSON parsing failed: Text: ${t}.
2
2
  Error message: ${We(e)}`,cause:e}),this[Pe]=!0,this.text=t}static isInstance(t){return D.hasMarker(t,Xe)}},Qe="AI_TypeValidationError",Ke=`vercel.ai.error.${Qe}`,zt=Symbol.for(Ke),je,ke,X=class ye extends(ke=D,je=zt,ke){constructor({value:e,cause:a,context:r}){let s="Type validation failed";if(r?.field&&(s+=` for ${r.field}`),r?.entityName||r?.entityId){s+=" (";const o=[];r.entityName&&o.push(r.entityName),r.entityId&&o.push(`id: "${r.entityId}"`),s+=o.join(", "),s+=")"}super({name:Qe,message:`${s}: Value: ${JSON.stringify(e)}.
3
3
  Error message: ${We(a)}`,cause:a}),this[je]=!0,this.value=e,this.context=r}static isInstance(e){return D.hasMarker(e,Ke)}static wrap({value:e,cause:a,context:r}){var s,o,i;return ye.isInstance(a)&&a.value===e&&((s=a.context)==null?void 0:s.field)===r?.field&&((o=a.context)==null?void 0:o.entityName)===r?.entityName&&((i=a.context)==null?void 0:i.entityId)===r?.entityId?a:new ye({value:e,cause:a,context:r})}},oe=({prefix:t,size:e=16,alphabet:a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:r="-"}={})=>{const s=()=>{const o=a.length,i=new Array(e);for(let n=0;n<e;n++)i[n]=a[Math.random()*o|0];return i.join("")};if(t==null)return s;if(a.includes(r))throw new Ft({argument:"separator",message:`The separator "${r}" must not be part of the alphabet "${a}".`});return()=>`${t}${r}${s()}`};oe();var Jt=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,Yt=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function Ze(t){const e=JSON.parse(t);return e===null||typeof e!="object"||Jt.test(t)===!1&&Yt.test(t)===!1?e:Wt(e)}function Wt(t){let e=[t];for(;e.length;){const a=e;e=[];for(const r of a){if(Object.prototype.hasOwnProperty.call(r,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(r,"constructor")&&r.constructor!==null&&typeof r.constructor=="object"&&Object.prototype.hasOwnProperty.call(r.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const s in r){const o=r[s];o&&typeof o=="object"&&e.push(o)}}}return t}function Ht(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return Ze(t)}try{return Ze(t)}finally{Error.stackTraceLimit=e}}function Te(t){if(t.type==="object"||Array.isArray(t.type)&&t.type.includes("object")){t.additionalProperties=!1;const{properties:a}=t;if(a!=null)for(const r of Object.keys(a))a[r]=F(a[r])}t.items!=null&&(t.items=Array.isArray(t.items)?t.items.map(F):F(t.items)),t.anyOf!=null&&(t.anyOf=t.anyOf.map(F)),t.allOf!=null&&(t.allOf=t.allOf.map(F)),t.oneOf!=null&&(t.oneOf=t.oneOf.map(F));const{definitions:e}=t;if(e!=null)for(const a of Object.keys(e))e[a]=F(e[a]);return t}function F(t){return typeof t=="boolean"?t:Te(t)}var qt=Symbol("Let zodToJsonSchema decide on which parser to use"),$e={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},Gt=t=>typeof t=="string"?{...$e,name:t}:{...$e,...t};function R(){return{}}function Xt(t,e){var a,r,s;const o={type:"array"};return(a=t.type)!=null&&a._def&&((s=(r=t.type)==null?void 0:r._def)==null?void 0:s.typeName)!==h.ZodAny&&(o.items=b(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(o.minItems=t.minLength.value),t.maxLength&&(o.maxItems=t.maxLength.value),t.exactLength&&(o.minItems=t.exactLength.value,o.maxItems=t.exactLength.value),o}function Qt(t){const e={type:"integer",format:"int64"};if(!t.checks)return e;for(const a of t.checks)switch(a.kind){case"min":a.inclusive?e.minimum=a.value:e.exclusiveMinimum=a.value;break;case"max":a.inclusive?e.maximum=a.value:e.exclusiveMaximum=a.value;break;case"multipleOf":e.multipleOf=a.value;break}return e}function Kt(){return{type:"boolean"}}function et(t,e){return b(t.type._def,e)}var ea=(t,e)=>b(t.innerType._def,e);function tt(t,e,a){const r=a??e.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((s,o)=>tt(t,e,s))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return ta(t)}}var ta=t=>{const e={type:"integer",format:"unix-time"};for(const a of t.checks)switch(a.kind){case"min":e.minimum=a.value;break;case"max":e.maximum=a.value;break}return e};function aa(t,e){return{...b(t.innerType._def,e),default:t.defaultValue()}}function ra(t,e){return e.effectStrategy==="input"?b(t.schema._def,e):R()}function sa(t){return{type:"string",enum:Array.from(t.values)}}var na=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function oa(t,e){const a=[b(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),b(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(s=>!!s),r=[];return a.forEach(s=>{if(na(s))r.push(...s.allOf);else{let o=s;if("additionalProperties"in s&&s.additionalProperties===!1){const{additionalProperties:i,...n}=s;o=n}r.push(o)}}),r.length?{allOf:r}:void 0}function ia(t){const e=typeof t.value;return e!=="bigint"&&e!=="number"&&e!=="boolean"&&e!=="string"?{type:Array.isArray(t.value)?"array":"object"}:{type:e==="bigint"?"integer":e,const:t.value}}var me=void 0,N={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(me===void 0&&(me=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),me),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function at(t,e){const a={type:"string"};if(t.checks)for(const r of t.checks)switch(r.kind){case"min":a.minLength=typeof a.minLength=="number"?Math.max(a.minLength,r.value):r.value;break;case"max":a.maxLength=typeof a.maxLength=="number"?Math.min(a.maxLength,r.value):r.value;break;case"email":switch(e.emailStrategy){case"format:email":x(a,"email",r.message,e);break;case"format:idn-email":x(a,"idn-email",r.message,e);break;case"pattern:zod":M(a,N.email,r.message,e);break}break;case"url":x(a,"uri",r.message,e);break;case"uuid":x(a,"uuid",r.message,e);break;case"regex":M(a,r.regex,r.message,e);break;case"cuid":M(a,N.cuid,r.message,e);break;case"cuid2":M(a,N.cuid2,r.message,e);break;case"startsWith":M(a,RegExp(`^${he(r.value,e)}`),r.message,e);break;case"endsWith":M(a,RegExp(`${he(r.value,e)}$`),r.message,e);break;case"datetime":x(a,"date-time",r.message,e);break;case"date":x(a,"date",r.message,e);break;case"time":x(a,"time",r.message,e);break;case"duration":x(a,"duration",r.message,e);break;case"length":a.minLength=typeof a.minLength=="number"?Math.max(a.minLength,r.value):r.value,a.maxLength=typeof a.maxLength=="number"?Math.min(a.maxLength,r.value):r.value;break;case"includes":{M(a,RegExp(he(r.value,e)),r.message,e);break}case"ip":{r.version!=="v6"&&x(a,"ipv4",r.message,e),r.version!=="v4"&&x(a,"ipv6",r.message,e);break}case"base64url":M(a,N.base64url,r.message,e);break;case"jwt":M(a,N.jwt,r.message,e);break;case"cidr":{r.version!=="v6"&&M(a,N.ipv4Cidr,r.message,e),r.version!=="v4"&&M(a,N.ipv6Cidr,r.message,e);break}case"emoji":M(a,N.emoji(),r.message,e);break;case"ulid":{M(a,N.ulid,r.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{x(a,"binary",r.message,e);break}case"contentEncoding:base64":{a.contentEncoding="base64";break}case"pattern:zod":{M(a,N.base64,r.message,e);break}}break}case"nanoid":M(a,N.nanoid,r.message,e)}return a}function he(t,e){return e.patternStrategy==="escape"?ua(t):t}var la=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function ua(t){let e="";for(let a=0;a<t.length;a++)la.has(t[a])||(e+="\\"),e+=t[a];return e}function x(t,e,a,r){var s;t.format||(s=t.anyOf)!=null&&s.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format}),delete t.format),t.anyOf.push({format:e,...a&&r.errorMessages&&{errorMessage:{format:a}}})):t.format=e}function M(t,e,a,r){var s;t.pattern||(s=t.allOf)!=null&&s.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern}),delete t.pattern),t.allOf.push({pattern:Ue(e,r),...a&&r.errorMessages&&{errorMessage:{pattern:a}}})):t.pattern=Ue(e,r)}function Ue(t,e){var a;if(!e.applyRegexFlags||!t.flags)return t.source;const r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},s=r.i?t.source.toLowerCase():t.source;let o="",i=!1,n=!1,p=!1;for(let u=0;u<s.length;u++){if(i){o+=s[u],i=!1;continue}if(r.i){if(n){if(s[u].match(/[a-z]/)){p?(o+=s[u],o+=`${s[u-2]}-${s[u]}`.toUpperCase(),p=!1):s[u+1]==="-"&&((a=s[u+2])!=null&&a.match(/[a-z]/))?(o+=s[u],p=!0):o+=`${s[u]}${s[u].toUpperCase()}`;continue}}else if(s[u].match(/[a-z]/)){o+=`[${s[u]}${s[u].toUpperCase()}]`;continue}}if(r.m){if(s[u]==="^"){o+=`(^|(?<=[\r
4
4
  ]))`;continue}else if(s[u]==="$"){o+=`($|(?=[\r