decocms 4.29.1 → 4.30.1

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 (284) hide show
  1. package/dist/client/assets/{AlertCircle-D90xu5-8.js → AlertCircle-DQZIoZK3.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-B1XPsNPZ.js → ArrowUpRight-BXPXISIu.js} +1 -1
  3. package/dist/client/assets/{Check-BqH5cjqe.js → Check-s3en6K6a.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-CebfgxLq.js → CheckCircle-6oFE8RZY.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-DhzhS3K5.js → ChevronDown-DfbvlHGm.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-DntNgeBz.js → ChevronRight-BbMxA_we.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-DPJfOoQR.js → ChevronUp-CSojtzH5.js} +1 -1
  8. package/dist/client/assets/{Circle-umqkxNwx.js → Circle-4U8mdxgJ.js} +1 -1
  9. package/dist/client/assets/{Copy01-YBIj7O7M.js → Copy01-CIuFqZaz.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-DoxN78H8.js → DotsVertical-CcXsbxkI.js} +1 -1
  11. package/dist/client/assets/{Eye-o8ajkfvt.js → Eye-C-Ii0MmZ.js} +1 -1
  12. package/dist/client/assets/{FilterLines-CEBhmChB.js → FilterLines-CRqtZMw9.js} +1 -1
  13. package/dist/client/assets/{Globe01-D3NrpjPq.js → Globe01-CdJefkBr.js} +1 -1
  14. package/dist/client/assets/{Globe04-6xG6GU2e.js → Globe04-BrDmMJuA.js} +1 -1
  15. package/dist/client/assets/{HardDrive-CDBenwE2.js → HardDrive-C1TfsRRw.js} +1 -1
  16. package/dist/client/assets/{Key01-CwgjH_um.js → Key01-BuAYoLgF.js} +1 -1
  17. package/dist/client/assets/{LayoutLeft-CKcHwaHf.js → LayoutLeft-BuFW-ud0.js} +1 -1
  18. package/dist/client/assets/{LinkExternal01-DBFEHO3t.js → LinkExternal01-DMcxPOk0.js} +1 -1
  19. package/dist/client/assets/{List-s8AZWxpk.js → List-Dg43Ye3O.js} +1 -1
  20. package/dist/client/assets/{Loading02-DaLVACu2.js → Loading02-CLjf_mWB.js} +1 -1
  21. package/dist/client/assets/{Monitor01-lxPxQ2fk.js → Monitor01-DP1X3LaS.js} +1 -1
  22. package/dist/client/assets/{Palette-DHyTdFqR.js → Palette-6OTpcgOT.js} +1 -1
  23. package/dist/client/assets/{Play-TOCBGzP9.js → Play-C-6p0BcA.js} +1 -1
  24. package/dist/client/assets/{Plus-DkGwhdIW.js → Plus-DI8G3hjD.js} +1 -1
  25. package/dist/client/assets/{SearchLg-C9MBYrXH.js → SearchLg-CeBJHSxD.js} +1 -1
  26. package/dist/client/assets/{SearchMd-Dhz0UROc.js → SearchMd-BK3G07RD.js} +1 -1
  27. package/dist/client/assets/{Settings02-COfrOHpp.js → Settings02-Cc5NwEaN.js} +1 -1
  28. package/dist/client/assets/{Shield01-BrK-9cDf.js → Shield01-CSmFJ1RP.js} +1 -1
  29. package/dist/client/assets/{Star01-twQgP5oO.js → Star01-CWyyx_CI.js} +1 -1
  30. package/dist/client/assets/{Stars01-C27kMlCK.js → Stars01-CNNiBNAJ.js} +1 -1
  31. package/dist/client/assets/{Stars02-sR281nUk.js → Stars02-zuQltjIB.js} +1 -1
  32. package/dist/client/assets/{Sun-DTFx5jn8.js → Sun-Cm9IedwX.js} +1 -1
  33. package/dist/client/assets/{SwitchHorizontal01-Bu9ipsE_.js → SwitchHorizontal01-Cw76bjm8.js} +1 -1
  34. package/dist/client/assets/{Tool01-DJgxsN47.js → Tool01-CTeGQUqF.js} +1 -1
  35. package/dist/client/assets/{Trash01-myAGgKHr.js → Trash01-CeLlU9Hr.js} +1 -1
  36. package/dist/client/assets/{Upload01-m0ny4YmQ.js → Upload01-DeL5atjC.js} +1 -1
  37. package/dist/client/assets/{User01-DuGAbO5F.js → User01-CVy-WVkE.js} +1 -1
  38. package/dist/client/assets/{Users01-e9Wb8IJU.js → Users01-gmVxoI-k.js} +1 -1
  39. package/dist/client/assets/{Users03-JTfAuK6m.js → Users03-Ba1rCL5_.js} +1 -1
  40. package/dist/client/assets/{X-DRR7RtBP.js → X-B4fK1PSH.js} +1 -1
  41. package/dist/client/assets/{XCircle-Cz7czjsw.js → XCircle-D680rHaa.js} +1 -1
  42. package/dist/client/assets/{XClose-eEYHZsPT.js → XClose-DZ-fbd9x.js} +1 -1
  43. package/dist/client/assets/{Zap-CMZ9cCJz.js → Zap-CHM8jc7i.js} +1 -1
  44. package/dist/client/assets/{ZapSquare-Ch518nCD.js → ZapSquare-BjByOqyA.js} +1 -1
  45. package/dist/client/assets/{ZoomOut-Chl8lvun.js → ZoomOut-Dt1IXaRq.js} +1 -1
  46. package/dist/client/assets/{access-gate-Cf-kJrg7.js → access-gate-w4EKvoEv.js} +1 -1
  47. package/dist/client/assets/{add-section-modal-COVSQJFG.js → add-section-modal-DogHlV9_.js} +1 -1
  48. package/dist/client/assets/agent-capabilities-giK3bRW-.js +1 -0
  49. package/dist/client/assets/agent-icon-N5U1HeY1.js +1 -0
  50. package/dist/client/assets/agents-list-CqlyAaPn.js +1 -0
  51. package/dist/client/assets/ai-providers--EA2lMFo.js +1 -0
  52. package/dist/client/assets/{alert-C-n1SZ0O.js → alert-Bdmkn5IA.js} +1 -1
  53. package/dist/client/assets/{alert-dialog-wgrcUQ0O.js → alert-dialog-DQf3rZVT.js} +3 -3
  54. package/dist/client/assets/app-editor-k0YPL4X-.js +1 -0
  55. package/dist/client/assets/{auth-B8jeHTDK.js → auth-DLezYwI7.js} +1 -1
  56. package/dist/client/assets/{auth-catchall-f5qF8zoS.js → auth-catchall-v82GytbP.js} +1 -1
  57. package/dist/client/assets/{auth-entry-BwlcwCMz.js → auth-entry-verdsuvy.js} +1 -1
  58. package/dist/client/assets/{auth-split-layout-DiG8voFB.js → auth-split-layout-D3EcXAD7.js} +1 -1
  59. package/dist/client/assets/{authenticate-and-persist-oauth-ezeRyKPp.js → authenticate-and-persist-oauth-B89lyITx.js} +1 -1
  60. package/dist/client/assets/{automation-list-row-CeLhtWjA.js → automation-list-row-o2_pLOr4.js} +1 -1
  61. package/dist/client/assets/automation-runs-Dmwa3j9k.js +188 -0
  62. package/dist/client/assets/automations-3TEWqXty.js +1 -0
  63. package/dist/client/assets/autosend-e3cesngm.js +1 -0
  64. package/dist/client/assets/{avatar-BrhzNA4d.js → avatar-0pAXOhlp.js} +1 -1
  65. package/dist/client/assets/{badge-B5li3mFX.js → badge-DdUP-taI.js} +1 -1
  66. package/dist/client/assets/{block-document-BKVlkRQG.js → block-document-B5oKLw65.js} +3 -3
  67. package/dist/client/assets/brand-context-DYt7cXJ_.js +1 -0
  68. package/dist/client/assets/{breadcrumb-BPYlrjmj.js → breadcrumb-Dx2G4VO9.js} +1 -1
  69. package/dist/client/assets/buckets-BDVtaRLE.js +1 -0
  70. package/dist/client/assets/bulk-category-panel-DJTbN1Qa.js +1 -0
  71. package/dist/client/assets/{calendar-C0u4vRHU.js → calendar-CcJoOwrC.js} +1 -1
  72. package/dist/client/assets/capability-load-error-kAN6hK8J.js +1 -0
  73. package/dist/client/assets/{card-CCFrbS6S.js → card-CLNI5vTb.js} +1 -1
  74. package/dist/client/assets/category-editor-C-c4TOvs.js +1 -0
  75. package/dist/client/assets/{chat-context-XoGdeFE9.js → chat-context-CDLyvKdU.js} +5 -5
  76. package/dist/client/assets/{checkbox-D2NBps_s.js → checkbox-BCSDUgIe.js} +1 -1
  77. package/dist/client/assets/{cli-auth-success-DG3-YXKw.js → cli-auth-success-BMRSWJHK.js} +1 -1
  78. package/dist/client/assets/collection-detail-BxQm_7ex.js +1 -0
  79. package/dist/client/assets/{collection-display-button-Bvtt9j_H.js → collection-display-button-DgkDwQx3.js} +1 -1
  80. package/dist/client/assets/{collection-search-BHb176G9.js → collection-search-EDEWD1X9.js} +1 -1
  81. package/dist/client/assets/{collection-table-wrapper-BBBMMDK4.js → collection-table-wrapper-tJUZOEkF.js} +1 -1
  82. package/dist/client/assets/{collection-tabs-CCdUJRcj.js → collection-tabs-Cq6azV_u.js} +1 -1
  83. package/dist/client/assets/{command-CGbsZOaN.js → command-DHmaE9JT.js} +1 -1
  84. package/dist/client/assets/commerce-onboarding-DNPVnUn4.js +1 -0
  85. package/dist/client/assets/{connect-desktop-dialog-CRhRTOUc.js → connect-desktop-dialog-DGh-1tLq.js} +1 -1
  86. package/dist/client/assets/{connection-card-DGNqtPoP.js → connection-card-DT-riPtN.js} +1 -1
  87. package/dist/client/assets/connection-detail-DfM_VWgx.js +1 -0
  88. package/dist/client/assets/{connection-form-helpers-Bs8LNNlp.js → connection-form-helpers-DioUFOWc.js} +1 -1
  89. package/dist/client/assets/connections-bwhbNn_9.js +1 -0
  90. package/dist/client/assets/constants-B72Xmt_K.js +1 -0
  91. package/dist/client/assets/{decopilot-sse-pool-B7Qe588m.js → decopilot-sse-pool-BOi7-S8l.js} +1 -1
  92. package/dist/client/assets/{dialog-C2MVTIBt.js → dialog-C1_sXCgH.js} +1 -1
  93. package/dist/client/assets/{domain-settings-Dk68eaoE.js → domain-settings-BZ3H97uq.js} +1 -1
  94. package/dist/client/assets/{drawer-BGO4iAk0.js → drawer-BstQPSyC.js} +1 -1
  95. package/dist/client/assets/{dropdown-menu-BPps0Iqr.js → dropdown-menu-BXGfrSiX.js} +1 -1
  96. package/dist/client/assets/{empty-state-BUKBmmAV.js → empty-state-CSs6-Bdi.js} +1 -1
  97. package/dist/client/assets/{extract-connection-data-Dq7vx8cX.js → extract-connection-data-mdwVf3Kr.js} +1 -1
  98. package/dist/client/assets/file-explorer-BCjGBw7c.js +2 -0
  99. package/dist/client/assets/{file-type-icon-DIgcp2MN.js → file-type-icon-C_PHmk0C.js} +1 -1
  100. package/dist/client/assets/{files-CIXCBIkO.js → files-DJf6oJKs.js} +1 -1
  101. package/dist/client/assets/{form-TSiFK-dI.js → form-BB8De_xV.js} +1 -1
  102. package/dist/client/assets/general-BgbMP2m7.js +1 -0
  103. package/dist/client/assets/github-repo-picker-aJftKcC0.js +1 -0
  104. package/dist/client/assets/{hooks-BKW8thdS.js → hooks-CksaF-ej.js} +6 -6
  105. package/dist/client/assets/{index-Btxmdruq.js → index-BTvzEEE4.js} +3 -3
  106. package/dist/client/assets/index-BYSbf1og.css +1 -0
  107. package/dist/client/assets/{index-BZQALusN.js → index-B_a3RFg9.js} +1 -1
  108. package/dist/client/assets/{index-9kwnfSCp.js → index-BgeQc437.js} +3 -3
  109. package/dist/client/assets/{index-DNvozpHG.js → index-BlHRIOF6.js} +1 -1
  110. package/dist/client/assets/{index-d52A49fX.js → index-ByOvX_ve.js} +4 -4
  111. package/dist/client/assets/{index-CIZOVv5V.js → index-C0ZQYTpQ.js} +1 -1
  112. package/dist/client/assets/{index-BibhmEoM.js → index-C0ZnJYy-.js} +1 -1
  113. package/dist/client/assets/{index-Bsex2T4n.js → index-C34RmICP.js} +3 -3
  114. package/dist/client/assets/index-CQvqUcGM.js +1 -0
  115. package/dist/client/assets/index-DDp5gOuw.js +1 -0
  116. package/dist/client/assets/index-PwHmdceA.js +519 -0
  117. package/dist/client/assets/{index-BlJ4j0DM.js → index-SAeZ5DI1.js} +1 -1
  118. package/dist/client/assets/{index-CKKQLGcV.js → index-_3KKuOg4.js} +1 -1
  119. package/dist/client/assets/{index-B09DUV7c.js → index-eWA8xKaL.js} +1 -1
  120. package/dist/client/assets/{index-redirect-BsNOVzi9.js → index-redirect-uNIA84_Q.js} +1 -1
  121. package/dist/client/assets/{input-B_5YyJ8y.js → input-Bt7D33rg.js} +1 -1
  122. package/dist/client/assets/{integration-icon-DXGEOTjP.js → integration-icon-C5KirdUg.js} +1 -1
  123. package/dist/client/assets/{invite-member-dialog-YIBgjb89.js → invite-member-dialog-BuARwphh.js} +2 -2
  124. package/dist/client/assets/{label-CWqrShVu.js → label-BxgEeCbJ.js} +1 -1
  125. package/dist/client/assets/{login-Da99hiOC.js → login-CaG_4y_B.js} +1 -1
  126. package/dist/client/assets/{mcp-oauth-CSUfdVCn.js → mcp-oauth-CL0sljW9.js} +1 -1
  127. package/dist/client/assets/members--hV2Q0Ot.js +1 -0
  128. package/dist/client/assets/monaco-editor-CbUVJEKg.js +9 -0
  129. package/dist/client/assets/{monitoring-stats-row-DixOHH_R.js → monitoring-stats-row-DFi_Kdkh.js} +1 -1
  130. package/dist/client/assets/{oauth-callback-BaDQ-n27.js → oauth-callback-DAhYaKj8.js} +1 -1
  131. package/dist/client/assets/{oauth-callback-ai-provider-I3h8vdSk.js → oauth-callback-ai-provider-CR0F-hQD.js} +1 -1
  132. package/dist/client/assets/{onboarding-B1EOLElh.js → onboarding-BUFWneNv.js} +1 -1
  133. package/dist/client/assets/org-install-Bb2jIZ-L.js +1 -0
  134. package/dist/client/assets/{org-layout-NnaVwU9k.js → org-layout-D_gYV_Zs.js} +1 -1
  135. package/dist/client/assets/{organization-choice-C-TyyEjY.js → organization-choice-BvtQGOSW.js} +1 -1
  136. package/dist/client/assets/page-seo-form-BWWbOuxt.js +1 -0
  137. package/dist/client/assets/page-seo-sheet-98Jl6iTy.js +1 -0
  138. package/dist/client/assets/{popover-DlszYF1R.js → popover-DzPhoKNT.js} +1 -1
  139. package/dist/client/assets/post-editor-Dl6eFOA9.js +1 -0
  140. package/dist/client/assets/primitives-CHpgu7zx.js +1 -0
  141. package/dist/client/assets/profile-CuDAW9Ii.js +1 -0
  142. package/dist/client/assets/project-app-view-BkSNyja3.js +1 -0
  143. package/dist/client/assets/record-editor-D5qjtt77.js +1 -0
  144. package/dist/client/assets/registry-Dw9uBZ7-.js +2 -0
  145. package/dist/client/assets/{registry-layout-zFAhrTof.js → registry-layout-BkbFqKCh.js} +1 -1
  146. package/dist/client/assets/{require-capability-C135EIMf.js → require-capability-DGTSD8vx.js} +1 -1
  147. package/dist/client/assets/{required-auth-layout-CEAeU4UY.js → required-auth-layout-BjrbsMWm.js} +1 -1
  148. package/dist/client/assets/{reset-password-D_zECCKz.js → reset-password-BiKRZoQ2.js} +1 -1
  149. package/dist/client/assets/reusable-new-chat-qqWu133U.js +1 -0
  150. package/dist/client/assets/roles-zCiQqsuK.js +1 -0
  151. package/dist/client/assets/{search-input-DccF25qw.js → search-input-kWxNIRnl.js} +1 -1
  152. package/dist/client/assets/secrets-viO9Xl5S.js +1 -0
  153. package/dist/client/assets/sections-editor-W7VOMkOG.js +2 -0
  154. package/dist/client/assets/{select-DdHVdWXn.js → select-8JaYnS6d.js} +1 -1
  155. package/dist/client/assets/select-model-B-2xubIJ.js +4 -0
  156. package/dist/client/assets/seo-editor-CFGBoPWr.js +1 -0
  157. package/dist/client/assets/settings-layout-DNdkL202.js +1 -0
  158. package/dist/client/assets/{settings-section-eWkjB3kv.js → settings-section-CAqTmyhS.js} +1 -1
  159. package/dist/client/assets/shell-controls-Yg88zbSN.js +1 -0
  160. package/dist/client/assets/shell-layout-k2JSKYlm.js +1 -0
  161. package/dist/client/assets/sidebar-C761eQb1.js +1 -0
  162. package/dist/client/assets/{skeleton-Bl9k4gft.js → skeleton-DSJYqmzp.js} +1 -1
  163. package/dist/client/assets/sso-CWcGb61Y.js +1 -0
  164. package/dist/client/assets/store-DxbT2BKV.js +1 -0
  165. package/dist/client/assets/store-registry-B_vQy0r8.js +2 -0
  166. package/dist/client/assets/{studio-tools-nA7ZTnFV.js → studio-tools-CgfSo7j_.js} +1 -1
  167. package/dist/client/assets/{switch-CuT_exNr.js → switch-DhJhR8Ba.js} +1 -1
  168. package/dist/client/assets/tab-id-yjGvxWDL.js +1 -0
  169. package/dist/client/assets/{table-CWyE2zgw.js → table-CDz46PoK.js} +1 -1
  170. package/dist/client/assets/{tabs-DRqPX6Mz.js → tabs-BUhcO-L3.js} +1 -1
  171. package/dist/client/assets/{textarea-B3Rf9sP3.js → textarea-BYx7whqS.js} +1 -1
  172. package/dist/client/assets/{toggle-group-BuLxG5r3.js → toggle-group-BZ189fjx.js} +1 -1
  173. package/dist/client/assets/toolbar-C5VXYU-N.js +1 -0
  174. package/dist/client/assets/{toolbar-icon-button-CwCDO4L5.js → toolbar-icon-button-DrS8O_Iq.js} +1 -1
  175. package/dist/client/assets/tools-list-DlkGTda2.js +1 -0
  176. package/dist/client/assets/tooltip-B3P4mjnJ.js +1 -0
  177. package/dist/client/assets/{types-B2Xs3OM7.js → types-CcSVLYhO.js} +1 -1
  178. package/dist/client/assets/{use-ai-providers-CW0jtnuO.js → use-ai-providers-CprIzBUo.js} +1 -1
  179. package/dist/client/assets/{use-automations-CuWiOTtv.js → use-automations-2Be9XmPq.js} +1 -1
  180. package/dist/client/assets/{use-capability-C9whYnsG.js → use-capability-BPxQX6Oj.js} +1 -1
  181. package/dist/client/assets/use-clock-tick-BjAPnH4G.js +1 -0
  182. package/dist/client/assets/use-collections-b46PF-FB.js +1 -0
  183. package/dist/client/assets/{use-connection-BLVjIktc.js → use-connection-DeGbigio.js} +1 -1
  184. package/dist/client/assets/{use-copy-_bA4U2MU.js → use-copy-D_xDaGph.js} +1 -1
  185. package/dist/client/assets/{use-create-virtual-mcp-DAOEgAsA.js → use-create-virtual-mcp-B-FWLpM6.js} +1 -1
  186. package/dist/client/assets/{use-debounced-autosave-D34fr9f_.js → use-debounced-autosave-BuGW5-NP.js} +1 -1
  187. package/dist/client/assets/{use-debounced-value-DxBLMeqg.js → use-debounced-value-CFIePpm0.js} +1 -1
  188. package/dist/client/assets/{use-decopilot-events-Dk3_PQZu.js → use-decopilot-events-BLTRVndf.js} +1 -1
  189. package/dist/client/assets/{use-delete-connection-CkaRxWAn.js → use-delete-connection-Dl2mZ81L.js} +1 -1
  190. package/dist/client/assets/{use-file-configs-Td4k8wTj.js → use-file-configs-BTnwV_7n.js} +1 -1
  191. package/dist/client/assets/use-infinite-scroll-ChaGSzFC.js +1 -0
  192. package/dist/client/assets/{use-join-requests-DoInaUWb.js → use-join-requests-BMDS7ZyH.js} +1 -1
  193. package/dist/client/assets/{use-mcp-client-QTh-uqf4.js → use-mcp-client-u24P-s4P.js} +2 -2
  194. package/dist/client/assets/{use-mcp-prompts-5W77PpYc.js → use-mcp-prompts-BDBVNTlN.js} +1 -1
  195. package/dist/client/assets/use-mcp-tools-CocIQ7qB.js +1 -0
  196. package/dist/client/assets/{use-members-Cc48Xacn.js → use-members-Bus4og0A.js} +1 -1
  197. package/dist/client/assets/{use-mobile-Cqur1PpI.js → use-mobile-C93OYfHB.js} +1 -1
  198. package/dist/client/assets/use-navigate-to-agent-DjAWkSGL.js +1 -0
  199. package/dist/client/assets/{use-org-auth-client-C5lRdd5o.js → use-org-auth-client-CA5gjmgW.js} +1 -1
  200. package/dist/client/assets/{use-org-sso-DGL7haeQ.js → use-org-sso-CFBLq8qg.js} +1 -1
  201. package/dist/client/assets/{use-organization-roles-UeKRVQhu.js → use-organization-roles-h9scR-Kp.js} +1 -1
  202. package/dist/client/assets/{use-organization-settings-CnPdR5CP.js → use-organization-settings-EwmFXWWf.js} +1 -1
  203. package/dist/client/assets/{use-registry-connections-HQM1hA3o.js → use-registry-connections-D8Q8D5kz.js} +1 -1
  204. package/dist/client/assets/{use-secrets-D-GN3cJh.js → use-secrets-W7_VRgqz.js} +1 -1
  205. package/dist/client/assets/use-status-sounds-DJJd7nCb.js +1 -0
  206. package/dist/client/assets/{use-view-mode-BMlb6QOX.js → use-view-mode-B0A1elcL.js} +1 -1
  207. package/dist/client/assets/use-virtual-mcp-Bc6ku1ke.js +1 -0
  208. package/dist/client/assets/useInfiniteQuery-CwXupu4y.js +1 -0
  209. package/dist/client/assets/useSuspenseInfiniteQuery-ahqYuudo.js +1 -0
  210. package/dist/client/assets/variant-calendar-DdJwieRy.js +1 -0
  211. package/dist/client/assets/{view-mode-toggle-D0e_xb-Q.js → view-mode-toggle-BDMYTtyJ.js} +1 -1
  212. package/dist/client/index.html +2 -2
  213. package/dist/server/cli.js +3 -3
  214. package/dist/server/server.js +3 -3
  215. package/package.json +1 -1
  216. package/dist/client/assets/agent-capabilities-Cpju5Yfe.js +0 -1
  217. package/dist/client/assets/agent-icon-BvZm1osM.js +0 -1
  218. package/dist/client/assets/agents-list-BzkaDxFg.js +0 -1
  219. package/dist/client/assets/ai-providers-DadR3aQt.js +0 -1
  220. package/dist/client/assets/app-editor-CAH73t0u.js +0 -1
  221. package/dist/client/assets/automation-runs-CmgFzJTt.js +0 -1
  222. package/dist/client/assets/automations-D21tUX_h.js +0 -1
  223. package/dist/client/assets/brand-context-DHuctVxS.js +0 -1
  224. package/dist/client/assets/buckets-CZdkIll2.js +0 -1
  225. package/dist/client/assets/bulk-category-panel-DBxbY94B.js +0 -1
  226. package/dist/client/assets/capability-load-error-D7uMbvO0.js +0 -1
  227. package/dist/client/assets/category-editor-DJYxfrMo.js +0 -1
  228. package/dist/client/assets/collection-detail-uY6XXgWz.js +0 -1
  229. package/dist/client/assets/commerce-onboarding-DtUMhwdU.js +0 -1
  230. package/dist/client/assets/connection-detail-DlI7-vLh.js +0 -1
  231. package/dist/client/assets/connections-Ci34jtNe.js +0 -1
  232. package/dist/client/assets/constants-nH3qQ_1f.js +0 -1
  233. package/dist/client/assets/content-blocks-o63cs2vh.js +0 -1
  234. package/dist/client/assets/decopilot--vqccpDb.js +0 -4
  235. package/dist/client/assets/file-explorer-BGhwIot0.js +0 -2
  236. package/dist/client/assets/general-D5as9e6z.js +0 -1
  237. package/dist/client/assets/github-repo-picker-B3tomRAJ.js +0 -1
  238. package/dist/client/assets/index-5uzKO7q6.css +0 -1
  239. package/dist/client/assets/index-C7DWYqRh.js +0 -1
  240. package/dist/client/assets/index-CEE6U8OI.js +0 -1
  241. package/dist/client/assets/index-ELtqDe0g.js +0 -513
  242. package/dist/client/assets/library-tab-BBr_dx-g.js +0 -7
  243. package/dist/client/assets/members-BboKmC5r.js +0 -1
  244. package/dist/client/assets/monaco-editor-xlUuBDU4.js +0 -9
  245. package/dist/client/assets/org-install-CDUCFQCm.js +0 -1
  246. package/dist/client/assets/page-seo-form-Cfv9ng9q.js +0 -1
  247. package/dist/client/assets/page-seo-sheet-CIF4tqJJ.js +0 -1
  248. package/dist/client/assets/post-editor-BiHws1oe.js +0 -1
  249. package/dist/client/assets/primitives-0HgpGbC7.js +0 -1
  250. package/dist/client/assets/profile-ZMZrPNFW.js +0 -1
  251. package/dist/client/assets/project-app-view-O-o90Cxo.js +0 -1
  252. package/dist/client/assets/record-editor-BZ3V6i3V.js +0 -1
  253. package/dist/client/assets/registry-DzfT-ESq.js +0 -2
  254. package/dist/client/assets/roles-DYzEztRG.js +0 -1
  255. package/dist/client/assets/scroll-area-Bsik7Uif.js +0 -188
  256. package/dist/client/assets/secrets-DJrAzRmE.js +0 -1
  257. package/dist/client/assets/sections-editor-i5xgzCTq.js +0 -2
  258. package/dist/client/assets/select-model-C49KT9p5.js +0 -1
  259. package/dist/client/assets/seo-editor-C38OT2eM.js +0 -1
  260. package/dist/client/assets/settings-layout-DePsodvD.js +0 -1
  261. package/dist/client/assets/sheet-DSSfro03.js +0 -1
  262. package/dist/client/assets/shell-controls-DMbQmeKU.js +0 -1
  263. package/dist/client/assets/shell-layout-DdmjIlR4.js +0 -1
  264. package/dist/client/assets/sidebar-BJwboMe2.js +0 -1
  265. package/dist/client/assets/sso-xj4rMylh.js +0 -1
  266. package/dist/client/assets/store-DlhSxr4k.js +0 -1
  267. package/dist/client/assets/store-registry-BayPiGW-.js +0 -2
  268. package/dist/client/assets/tab-id-Bgchl1bv.js +0 -1
  269. package/dist/client/assets/task-row-DzSs63v5.js +0 -1
  270. package/dist/client/assets/task-status-CNEAWeje.js +0 -1
  271. package/dist/client/assets/toolbar-CVjg3TEd.js +0 -1
  272. package/dist/client/assets/tools-list-Dzc5vr-A.js +0 -1
  273. package/dist/client/assets/tooltip-Bzas0fb8.js +0 -1
  274. package/dist/client/assets/use-clock-tick-B6ygxook.js +0 -1
  275. package/dist/client/assets/use-collections-BP4R8sI-.js +0 -1
  276. package/dist/client/assets/use-infinite-scroll-1VhU5Q3H.js +0 -1
  277. package/dist/client/assets/use-mcp-tools-BTYjbm6L.js +0 -1
  278. package/dist/client/assets/use-navigate-to-agent-CaUSC1CF.js +0 -1
  279. package/dist/client/assets/use-status-sounds-DEhedUWx.js +0 -1
  280. package/dist/client/assets/use-virtual-mcp-n0IfHFn6.js +0 -1
  281. package/dist/client/assets/useInfiniteQuery-DEG0qlSd.js +0 -1
  282. package/dist/client/assets/useSuspenseInfiniteQuery-DzP8_asj.js +0 -1
  283. package/dist/client/assets/useSuspenseQueries-CI8oYgcQ.js +0 -1
  284. package/dist/client/assets/variant-calendar-CIBbpgAR.js +0 -1
@@ -1,4 +0,0 @@
1
- import{r as L,ae as Ye,c as V,j as s,o as Oe,s as re,D as le,m as me,n as Ae,p as Te,d as ce,K as ee,t as J,B as Z,v as Q,z as Xe,l as de,k as Qe,b as Je,E as Ze,W as et}from"./index-d52A49fX.js";import{C as tt}from"./checkbox-D2NBps_s.js";import{I as ne}from"./input-B_5YyJ8y.js";import{d as st,S as it,a as nt,b as lt,c as ot}from"./select-DdHVdWXn.js";import{S as H}from"./skeleton-Bl9k4gft.js";import{i as ze,b as Re,c as rt,a as at,s as ct}from"./Settings02-COfrOHpp.js";import{d as dt,b as ut,a as mt,i as ht}from"./Tool01-DJgxsN47.js";import{i as ft}from"./Key01-CwgjH_um.js";import{i as Pe}from"./SearchMd-Dhz0UROc.js";import{c as he,u as pt,b as xt}from"./use-ai-providers-CW0jtnuO.js";import{S as ge,b as gt}from"./chat-context-XoGdeFE9.js";import{g as fe}from"./ai-providers-logos-DD3qZ33J.js";import{i as vt}from"./Monitor01-lxPxQ2fk.js";import{i as bt}from"./AlertCircle-D90xu5-8.js";import{D as Le,e as yt,d as jt,c as St,a as Nt,b as kt}from"./dialog-C2MVTIBt.js";import{u as ue}from"./studio-tools-nA7ZTnFV.js";import{i as wt}from"./ChevronRight-DntNgeBz.js";import{A as _t}from"./avatar-BrhzNA4d.js";import{S as ve,a as be,b as $e}from"./settings-section-eWkjB3kv.js";import{s as Fe}from"./Eye-o8ajkfvt.js";import{u as Ct,C as It}from"./connect-desktop-dialog-CRhRTOUc.js";import{t as ye}from"./ChevronDown-DhzhS3K5.js";import{t as Et}from"./Stars01-C27kMlCK.js";function ie(i,e,t){let n=t.initialDeps??[],l,o=!0;function r(){var a,c,u;let d;t.key&&((a=t.debug)!=null&&a.call(t))&&(d=Date.now());const f=i();if(!(f.length!==n.length||f.some((b,g)=>n[g]!==b)))return l;n=f;let m;if(t.key&&((c=t.debug)!=null&&c.call(t))&&(m=Date.now()),l=e(...f),t.key&&((u=t.debug)!=null&&u.call(t))){const b=Math.round((Date.now()-d)*100)/100,g=Math.round((Date.now()-m)*100)/100,y=g/16,j=(_,N)=>{for(_=String(_);_.length<N;)_=" "+_;return _};console.info(`%c⏱ ${j(g,5)} /${j(b,5)} ms`,`
2
- font-size: .6rem;
3
- font-weight: bold;
4
- color: hsl(${Math.max(0,Math.min(120-120*y,120))}deg 100% 31%);`,t?.key)}return t?.onChange&&!(o&&t.skipInitialOnChange)&&t.onChange(l),o=!1,l}return r.updateDeps=a=>{n=a},r}function je(i,e){if(i===void 0)throw new Error("Unexpected undefined");return i}const Mt=(i,e)=>Math.abs(i-e)<1.01,Ot=(i,e,t)=>{let n;return function(...l){i.clearTimeout(n),n=i.setTimeout(()=>e.apply(this,l),t)}},Se=i=>{const{offsetWidth:e,offsetHeight:t}=i;return{width:e,height:t}},At=i=>i,Tt=i=>{const e=Math.max(i.startIndex-i.overscan,0),t=Math.min(i.endIndex+i.overscan,i.count-1),n=[];for(let l=e;l<=t;l++)n.push(l);return n},zt=(i,e)=>{const t=i.scrollElement;if(!t)return;const n=i.targetWindow;if(!n)return;const l=r=>{const{width:a,height:c}=r;e({width:Math.round(a),height:Math.round(c)})};if(l(Se(t)),!n.ResizeObserver)return()=>{};const o=new n.ResizeObserver(r=>{const a=()=>{const c=r[0];if(c?.borderBoxSize){const u=c.borderBoxSize[0];if(u){l({width:u.inlineSize,height:u.blockSize});return}}l(Se(t))};i.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return o.observe(t,{box:"border-box"}),()=>{o.unobserve(t)}},Ne={passive:!0},ke=typeof window>"u"?!0:"onscrollend"in window,Rt=(i,e)=>{const t=i.scrollElement;if(!t)return;const n=i.targetWindow;if(!n)return;let l=0;const o=i.options.useScrollendEvent&&ke?()=>{}:Ot(n,()=>{e(l,!1)},i.options.isScrollingResetDelay),r=d=>()=>{const{horizontal:f,isRtl:p}=i.options;l=f?t.scrollLeft*(p&&-1||1):t.scrollTop,o(),e(l,d)},a=r(!0),c=r(!1);t.addEventListener("scroll",a,Ne);const u=i.options.useScrollendEvent&&ke;return u&&t.addEventListener("scrollend",c,Ne),()=>{t.removeEventListener("scroll",a),u&&t.removeEventListener("scrollend",c)}},Pt=(i,e,t)=>{if(e?.borderBoxSize){const n=e.borderBoxSize[0];if(n)return Math.round(n[t.options.horizontal?"inlineSize":"blockSize"])}return i[t.options.horizontal?"offsetWidth":"offsetHeight"]},Lt=(i,{adjustments:e=0,behavior:t},n)=>{var l,o;const r=i+e;(o=(l=n.scrollElement)==null?void 0:l.scrollTo)==null||o.call(l,{[n.options.horizontal?"left":"top"]:r,behavior:t})};class $t{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var t,n,l;return((l=(n=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:n.now)==null?void 0:l.call(n))??Date.now()},this.observer=(()=>{let t=null;const n=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(l=>{l.forEach(o=>{const r=()=>{const a=o.target,c=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(a,o,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()})}));return{disconnect:()=>{var l;(l=n())==null||l.disconnect(),t=null},observe:l=>{var o;return(o=n())==null?void 0:o.observe(l,{box:"border-box"})},unobserve:l=>{var o;return(o=n())==null?void 0:o.unobserve(l)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([n,l])=>{typeof l>"u"&&delete t[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:At,rangeExtractor:Tt,onChange:()=>{},measureElement:Pt,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...t}},this.notify=t=>{var n,l;(l=(n=this.options).onChange)==null||l.call(n,this,t)},this.maybeNotify=ie(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(l=>{this.observer.observe(l)}),this.unsubs.push(this.options.observeElementRect(this,l=>{this.scrollRect=l,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(l,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<l?"forward":"backward":null,this.scrollOffset=l,this.isScrolling=o,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,n)=>{const l=new Map,o=new Map;for(let r=n-1;r>=0;r--){const a=t[r];if(l.has(a.lane))continue;const c=o.get(a.lane);if(c==null||a.end>c.end?o.set(a.lane,a):a.end<c.end&&l.set(a.lane,!0),l.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((r,a)=>r.end===a.end?r.index-a.index:r.end-a.end)[0]:void 0},this.getMeasurementOptions=ie(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(t,n,l,o,r,a,c)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:n,scrollMargin:l,getItemKey:o,enabled:r,lanes:a,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=ie(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:n,scrollMargin:l,getItemKey:o,enabled:r,lanes:a,laneAssignmentMode:c},u)=>{if(!r)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const m of this.laneAssignments.keys())m>=t&&this.laneAssignments.delete(m);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(m=>{this.itemSizeCache.set(m.key,m.size)}));const d=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1);const f=this.measurementsCache.slice(0,d),p=new Array(a).fill(void 0);for(let m=0;m<d;m++){const b=f[m];b&&(p[b.lane]=m)}for(let m=d;m<t;m++){const b=o(m),g=this.laneAssignments.get(m);let y,j;const _=c==="estimate"||u.has(b);if(g!==void 0&&this.options.lanes>1){y=g;const v=p[y],k=v!==void 0?f[v]:void 0;j=k?k.end+this.options.gap:n+l}else{const v=this.options.lanes===1?f[m-1]:this.getFurthestMeasurement(f,m);j=v?v.end+this.options.gap:n+l,y=v?v.lane:m%this.options.lanes,this.options.lanes>1&&_&&this.laneAssignments.set(m,y)}const N=u.get(b),I=typeof N=="number"?N:this.options.estimateSize(m),E=j+I;f[m]={index:m,start:j,size:I,end:E,key:b,lane:y},p[y]=m}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=ie(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,n,l,o)=>this.range=t.length>0&&n>0?Ft({measurements:t,outerSize:n,scrollOffset:l,lanes:o}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=ie(()=>{let t=null,n=null;const l=this.calculateRange();return l&&(t=l.startIndex,n=l.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,n]},(t,n,l,o,r)=>o===null||r===null?[]:t({startIndex:o,endIndex:r,overscan:n,count:l}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const n=this.options.indexAttribute,l=t.getAttribute(n);return l?parseInt(l,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const l=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(l!==void 0&&this.range){const o=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,l-o),a=Math.min(this.options.count-1,l+o);return t>=r&&t<=a}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((r,a)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(a))});return}const n=this.indexFromElement(t),l=this.options.getItemKey(n),o=this.elementsCache.get(l);o!==t&&(o&&this.observer.unobserve(o),this.observer.observe(t),this.elementsCache.set(l,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,n)=>{var l;const o=this.measurementsCache[t];if(!o)return;const r=this.itemSizeCache.get(o.key)??o.size,a=n-r;a!==0&&(((l=this.scrollState)==null?void 0:l.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,a,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(o.index),this.itemSizeCache=new Map(this.itemSizeCache.set(o.key,n)),this.notify(!1))},this.getVirtualItems=ie(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,n)=>{const l=[];for(let o=0,r=t.length;o<r;o++){const a=t[o],c=n[a];l.push(c)}return l},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const n=this.getMeasurements();if(n.length!==0)return je(n[Ke(0,n.length-1,l=>je(n[l]).start,t)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(t,n,l=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),r=this.getScrollOffset();n==="auto"&&(n=t>=r+o?"end":"start"),n==="center"?t+=(l-o)/2:n==="end"&&(t-=o);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,t),0)},this.getOffsetForIndex=(t,n="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const l=this.getSize(),o=this.getScrollOffset(),r=this.measurementsCache[t];if(!r)return;if(n==="auto")if(r.end>=o+l-this.options.scrollPaddingEnd)n="end";else if(r.start<=o+this.options.scrollPaddingStart)n="start";else return[o,n];if(n==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),n];const a=n==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,n,r.size),n]},this.scrollToOffset=(t,{align:n="start",behavior:l="auto"}={})=>{const o=this.getOffsetForAlignment(t,n),r=this.now();this.scrollState={index:null,align:n,behavior:l,startedAt:r,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:l}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:n="auto",behavior:l="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const o=this.getOffsetForIndex(t,n);if(!o)return;const[r,a]=o,c=this.now();this.scrollState={index:t,align:a,behavior:l,startedAt:c,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:l}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:n="auto"}={})=>{const l=this.getScrollOffset()+t,o=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:o,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var t;const n=this.getMeasurements();let l;if(n.length===0)l=this.options.paddingStart;else if(this.options.lanes===1)l=((t=n[n.length-1])==null?void 0:t.end)??0;else{const o=Array(this.options.lanes).fill(null);let r=n.length-1;for(;r>=0&&o.some(a=>a===null);){const a=n[r];o[a.lane]===null&&(o[a.lane]=a.end),r--}l=Math.max(...o.filter(a=>a!==null))}return Math.max(l-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:n,behavior:l})=>{this.options.scrollToFn(t,{behavior:l,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const n=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,l=n?n[0]:this.scrollState.lastTargetOffset,o=1,r=l!==this.scrollState.lastTargetOffset;if(!r&&Mt(l,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=o){this.scrollState=null;return}}else this.scrollState.stableFrames=0,r&&(this.scrollState.lastTargetOffset=l,this.scrollState.behavior="auto",this._scrollToOffset(l,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const Ke=(i,e,t,n)=>{for(;i<=e;){const l=(i+e)/2|0,o=t(l);if(o<n)i=l+1;else if(o>n)e=l-1;else return l}return i>0?i-1:0};function Ft({measurements:i,outerSize:e,scrollOffset:t,lanes:n}){const l=i.length-1,o=c=>i[c].start;if(i.length<=n)return{startIndex:0,endIndex:l};let r=Ke(0,l,o,t),a=r;if(n===1)for(;a<l&&i[a].end<t+e;)a++;else if(n>1){const c=Array(n).fill(0);for(;a<l&&c.some(d=>d<t+e);){const d=i[a];c[d.lane]=d.end,a++}const u=Array(n).fill(t+e);for(;r>=0&&u.some(d=>d>=t);){const d=i[r];u[d.lane]=d.start,r--}r=Math.max(0,r-r%n),a=Math.min(l,a+(n-1-a%n))}return{startIndex:r,endIndex:a}}const we=typeof document<"u"?L.useLayoutEffect:L.useEffect;function Kt({useFlushSync:i=!0,...e}){const t=L.useReducer(()=>({}),{})[1],n={...e,onChange:(o,r)=>{var a;i&&r?Ye.flushSync(t):t(),(a=e.onChange)==null||a.call(e,o,r)}},[l]=L.useState(()=>new $t(n));return l.setOptions(n),we(()=>l._didMount(),[]),we(()=>l._willUpdate()),l}function Dt(i){return Kt({observeElementRect:zt,observeElementOffset:Rt,scrollToFn:Lt,...i})}const ae=[{id:"openai",name:"OpenAI",description:"GPT-4, GPT-5, and other OpenAI models",logo:"https://decoims.com/decocms/b51001ef-ae58-4db4-8a75-9e6d2df2dd8e/openai.png",baseUrlPlaceholder:"https://api.openai.com/v1",defaultBaseUrl:"https://api.openai.com/v1",apiKeyRecommended:!0,helpText:"Use your OpenAI API key (starts with sk-)."},{id:"litellm",name:"LiteLLM",description:"Connect to a LiteLLM gateway your team manages",logo:"https://decoims.com/decocms/e974ae05-ad64-4b4a-8444-d9705f019b85/litellm.png",baseUrlPlaceholder:"http://localhost:4000",apiKeyRecommended:!0,helpText:"Point at your LiteLLM proxy. The base URL should be the root of the proxy (we'll append /v1)."},{id:"ollama",name:"Ollama",description:"Run open-source models on your own computer",logo:"https://decoims.com/decocms/2bb2f822-5288-4b7c-a541-dcbef76525a0/ollama.png",baseUrlPlaceholder:"http://localhost:11434",apiKeyRecommended:!1,helpText:"Ollama exposes /v1 by default — no API key required for local use."},{id:"lm-studio",name:"LM Studio",description:"Open models running through LM Studio",logo:"https://decoims.com/decocms/9f0ab1a9-d2d5-4f3e-9de0-aadd4926428d/lmstudio.webp",baseUrlPlaceholder:"http://localhost:1234",apiKeyRecommended:!1,helpText:"Start the local server in LM Studio, then paste its base URL here."},{id:"vllm",name:"vLLM",description:"Connect to your team's self-hosted vLLM server",logo:"https://decoims.com/decocms/b6c60e4f-a4aa-443c-981f-ad0f31640e22/vllm.png",baseUrlPlaceholder:"http://localhost:8000",apiKeyRecommended:!1}];function _e(i){if(i)return ae.find(e=>e.id===i)}const Ce=4;function oe(i){const e=V.c(8),{logo:t,name:n,description:l,onClick:o}=i;let r;e[0]!==t||e[1]!==n?(r=t?s.jsx("img",{src:t,alt:n,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(_t,{fallback:n.charAt(0),className:"size-8 bg-primary/10 text-primary"}),e[0]=t,e[1]=n,e[2]=r):r=e[2];let a;return e[3]!==l||e[4]!==n||e[5]!==o||e[6]!==r?(a=s.jsx($e,{onClick:o,icon:r,title:n,description:l}),e[3]=l,e[4]=n,e[5]=o,e[6]=r,e[7]=a):a=e[7],a}function De(i){const e=V.c(32),{providers:t,onSelect:n,onShowAll:l}=i;let o;e[0]!==t?(o=t.find(Ht),e[0]=t,e[1]=o):o=e[1];const r=o;let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a={openrouter:0,llmapi:1,anthropic:2,google:3},e[2]=a):a=e[2];const c=a;let u;if(e[3]!==n||e[4]!==t){let N;e[6]===Symbol.for("react.memo_cache_sentinel")?(N=(x,O)=>{const A=c[x.id]??Number.MAX_SAFE_INTEGER,z=c[O.id]??Number.MAX_SAFE_INTEGER;return A-z},e[6]=N):N=e[6];const I=t.filter(Vt).sort(N);let E;e[7]!==t?(E=t.find(Wt),e[7]=t,e[8]=E):E=e[8];const v=E;let k;e[9]===Symbol.for("react.memo_cache_sentinel")?(k=ae.find(Bt),e[9]=k):k=e[9];const C=k;let w;e[10]!==n?(w=x=>s.jsx(oe,{logo:x.logo,name:x.name,description:x.description,onClick:()=>n({kind:"provider",provider:x})},x.id),e[10]=n,e[11]=w):w=e[11];let h,S;e[12]!==n||e[13]!==v?(h=v&&C?[s.jsx(oe,{logo:C.logo,name:C.name,description:C.description,onClick:()=>n({kind:"openai-compatible",provider:v,preset:C})},C.id)]:[],S=v?[...ae.filter(Ut).map(x=>s.jsx(oe,{logo:x.logo,name:x.name,description:x.description,onClick:()=>n({kind:"openai-compatible",provider:v,preset:x})},x.id)),s.jsx(oe,{logo:v.logo,name:"Custom OpenAI-compatible",description:"Bring your own model server (advanced)",onClick:()=>n({kind:"openai-compatible",provider:v,preset:null})},"custom")]:[],e[12]=n,e[13]=v,e[14]=h,e[15]=S):(h=e[14],S=e[15]),u=[...I.map(w),...h,...S],e[3]=n,e[4]=t,e[5]=u}else u=e[5];const d=u,f=d.length-Ce,p=!!l&&f>0;let m;e[16]!==d||e[17]!==p?(m=p?d.slice(0,Ce):d,e[16]=d,e[17]=p,e[18]=m):m=e[18];const b=m;let g;e[19]!==r||e[20]!==n?(g=r&&s.jsx(ve,{children:s.jsxs("div",{className:"relative rounded-xl border border-violet-400/30 bg-gradient-to-br from-violet-50/50 via-transparent to-lime-50/30 dark:from-violet-950/20 dark:to-lime-950/10 p-1.5",children:[s.jsx("div",{className:"absolute inset-0 rounded-xl bg-gradient-to-br from-violet-400/5 to-lime-400/5 pointer-events-none"}),s.jsx("p",{className:"text-xs font-medium text-violet-700 dark:text-violet-400 mb-1.5 px-2 pt-2 relative",children:"Recommended — 100+ models, pay as you go"}),s.jsx(be,{className:"relative",children:s.jsx(oe,{logo:r.logo,name:r.name,description:r.description,onClick:()=>n({kind:"provider",provider:r})})})]})}),e[19]=r,e[20]=n,e[21]=g):g=e[21];let y;e[22]!==f||e[23]!==l||e[24]!==p?(y=p&&s.jsx($e,{onClick:l,title:`${f} more provider${f===1?"":"s"}`,action:s.jsx(wt,{size:16,className:"text-muted-foreground"})}),e[22]=f,e[23]=l,e[24]=p,e[25]=y):y=e[25];let j;e[26]!==y||e[27]!==b?(j=s.jsx(ve,{children:s.jsxs(be,{children:[b,y]})}),e[26]=y,e[27]=b,e[28]=j):j=e[28];let _;return e[29]!==g||e[30]!==j?(_=s.jsxs("div",{className:"flex flex-col gap-6",children:[g,j]}),e[29]=g,e[30]=j,e[31]=_):_=e[31],_}function Ut(i){return i.id!=="openai"}function Bt(i){return i.id==="openai"}function Wt(i){return i.id==="openai-compatible"}function Vt(i){return i.id!=="deco"&&i.id!=="openai-compatible"}function Ht(i){return i.id==="deco"}const qt=Oe({label:re().optional(),apiKey:re().min(1,"API key is required")});function Gt(i){const e=V.c(59),{providerId:t,onCancel:n,onSuccess:l}=i,{org:o}=le(),r=ue(),a=me(),[c,u]=L.useState(!1);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d={resolver:Ae(qt),defaultValues:{label:"",apiKey:""}},e[0]=d):d=e[0];const{register:f,handleSubmit:p,formState:m}=Te(d),{errors:b}=m;let g;e[1]!==t||e[2]!==r?(g=async M=>{await r.call("AI_PROVIDER_KEY_CREATE",{providerId:t,label:M.label||"Personal key",apiKey:M.apiKey})},e[1]=t,e[2]=r,e[3]=g):g=e[3];let y;e[4]!==l||e[5]!==o||e[6]!==a?(y=()=>{a.invalidateQueries({queryKey:ee.aiProviderKeys(o.id)}),a.invalidateQueries({queryKey:ee.aiProviders(o.id)}),J.success("Key saved successfully"),l()},e[4]=l,e[5]=o,e[6]=a,e[7]=y):y=e[7];let j;e[8]!==g||e[9]!==y?(j={mutationFn:g,onSuccess:y,onError:Yt},e[8]=g,e[9]=y,e[10]=j):j=e[10];const{mutate:_,isPending:N,error:I}=ce(j);let E;e[11]!==_?(E=M=>_(M),e[11]=_,e[12]=E):E=e[12];let v;e[13]!==p||e[14]!==E?(v=p(E),e[13]=p,e[14]=E,e[15]=v):v=e[15];let k;e[16]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Label"}),e[16]=k):k=e[16];let C;e[17]!==f?(C=f("label"),e[17]=f,e[18]=C):C=e[18];let w;e[19]!==C?(w=s.jsxs("div",{className:"space-y-1",children:[k,s.jsx(ne,{placeholder:"e.g. Personal key",...C,className:"h-8 text-sm"})]}),e[19]=C,e[20]=w):w=e[20];let h;e[21]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"API Key"}),e[21]=h):h=e[21];const S=c?"text":"password";let x;e[22]!==f?(x=f("apiKey"),e[22]=f,e[23]=x):x=e[23];let O;e[24]!==S||e[25]!==x?(O=s.jsx(ne,{type:S,placeholder:"sk-...",...x,className:"ph-no-capture h-8 text-sm pr-8"}),e[24]=S,e[25]=x,e[26]=O):O=e[26];let A;e[27]!==c?(A=()=>u(!c),e[27]=c,e[28]=A):A=e[28];let z;e[29]!==c?(z=c?s.jsx(ze,{size:14}):s.jsx(Fe,{size:14}),e[29]=c,e[30]=z):z=e[30];let T;e[31]!==A||e[32]!==z?(T=s.jsx("button",{type:"button",onClick:A,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:z}),e[31]=A,e[32]=z,e[33]=T):T=e[33];let U;e[34]!==O||e[35]!==T?(U=s.jsxs("div",{className:"relative",children:[O,T]}),e[34]=O,e[35]=T,e[36]=U):U=e[36];let $;e[37]!==b.apiKey?($=b.apiKey&&s.jsx("p",{className:"text-xs text-destructive",children:b.apiKey.message}),e[37]=b.apiKey,e[38]=$):$=e[38];let R;e[39]!==U||e[40]!==$?(R=s.jsxs("div",{className:"space-y-1",children:[h,U,$]}),e[39]=U,e[40]=$,e[41]=R):R=e[41];let K;e[42]!==I?(K=I&&s.jsx("p",{className:"text-xs text-destructive",children:I.message}),e[42]=I,e[43]=K):K=e[43];let F;e[44]!==N||e[45]!==n?(F=s.jsx(Z,{type:"button",variant:"ghost",size:"sm",onClick:n,disabled:N,children:"Cancel"}),e[44]=N,e[45]=n,e[46]=F):F=e[46];const B=N?"Saving...":"Save Key";let D;e[47]!==N||e[48]!==B?(D=s.jsx(Z,{type:"submit",size:"sm",disabled:N,children:B}),e[47]=N,e[48]=B,e[49]=D):D=e[49];let P;e[50]!==F||e[51]!==D?(P=s.jsxs(Le,{children:[F,D]}),e[50]=F,e[51]=D,e[52]=P):P=e[52];let W;return e[53]!==w||e[54]!==R||e[55]!==K||e[56]!==P||e[57]!==v?(W=s.jsxs("form",{onSubmit:v,className:"space-y-3",children:[w,R,K,P]}),e[53]=w,e[54]=R,e[55]=K,e[56]=P,e[57]=v,e[58]=W):W=e[58],W}function Yt(i){J.error(`Failed to save key: ${i.message}`)}const Xt=Oe({label:re().optional(),baseUrl:re().min(1,"Base URL is required"),apiKey:re().optional()});function Qt(i){const e=V.c(70),{preset:t,onCancel:n,onSuccess:l}=i,{org:o}=le(),r=ue(),a=me(),[c,u]=L.useState(!1);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=Ae(Xt),e[0]=d):d=e[0];const f=t?.defaultBaseUrl??"";let p;e[1]!==f?(p={resolver:d,defaultValues:{label:"",baseUrl:f,apiKey:""}},e[1]=f,e[2]=p):p=e[2];const{register:m,handleSubmit:b,formState:g}=Te(p),{errors:y}=g;let j;e[3]!==t||e[4]!==r?(j=async se=>{const Ge=JSON.stringify({baseUrl:se.baseUrl,apiKey:se.apiKey||""});await r.call("AI_PROVIDER_KEY_CREATE",{providerId:"openai-compatible",label:se.label||t?.name||se.baseUrl,apiKey:Ge,...t?{presetId:t.id}:{}})},e[3]=t,e[4]=r,e[5]=j):j=e[5];let _;e[6]!==l||e[7]!==o||e[8]!==a?(_=()=>{a.invalidateQueries({queryKey:ee.aiProviderKeys(o.id)}),a.invalidateQueries({queryKey:ee.aiProviders(o.id)}),J.success("Connection saved successfully"),l()},e[6]=l,e[7]=o,e[8]=a,e[9]=_):_=e[9];let N;e[10]!==j||e[11]!==_?(N={mutationFn:j,onSuccess:_,onError:Jt},e[10]=j,e[11]=_,e[12]=N):N=e[12];const{mutate:I,isPending:E,error:v}=ce(N),k=t?`e.g. ${t.name} prod, ${t.name} dev`:"e.g. My OpenAI-compatible server",C=t?.baseUrlPlaceholder??"http://localhost:4000/v1";let w;e[13]!==I?(w=se=>I(se),e[13]=I,e[14]=w):w=e[14];let h;e[15]!==b||e[16]!==w?(h=b(w),e[15]=b,e[16]=w,e[17]=h):h=e[17];let S;e[18]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Label"}),e[18]=S):S=e[18];let x;e[19]!==m?(x=m("label"),e[19]=m,e[20]=x):x=e[20];let O;e[21]!==k||e[22]!==x?(O=s.jsxs("div",{className:"space-y-1",children:[S,s.jsx(ne,{placeholder:k,...x,className:"h-8 text-sm"})]}),e[21]=k,e[22]=x,e[23]=O):O=e[23];let A;e[24]!==C||e[25]!==y||e[26]!==t?.defaultBaseUrl||e[27]!==m?(A=t?.defaultBaseUrl?s.jsx("input",{type:"hidden",...m("baseUrl")}):s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Base URL"}),s.jsx(ne,{type:"url",placeholder:C,...m("baseUrl"),className:"h-8 text-sm"}),y.baseUrl&&s.jsx("p",{className:"text-xs text-destructive",children:y.baseUrl.message})]}),e[24]=C,e[25]=y,e[26]=t?.defaultBaseUrl,e[27]=m,e[28]=A):A=e[28];const z=t?.apiKeyRecommended?"recommended":"optional";let T;e[29]!==z?(T=s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["API Key"," ",s.jsxs("span",{className:"text-muted-foreground/60",children:["(",z,")"]})]}),e[29]=z,e[30]=T):T=e[30];const U=c?"text":"password";let $;e[31]!==m?($=m("apiKey"),e[31]=m,e[32]=$):$=e[32];let R;e[33]!==U||e[34]!==$?(R=s.jsx(ne,{type:U,placeholder:"sk-...",...$,className:"ph-no-capture h-8 text-sm pr-8"}),e[33]=U,e[34]=$,e[35]=R):R=e[35];let K;e[36]!==c?(K=()=>u(!c),e[36]=c,e[37]=K):K=e[37];let F;e[38]!==c?(F=c?s.jsx(ze,{size:14}):s.jsx(Fe,{size:14}),e[38]=c,e[39]=F):F=e[39];let B;e[40]!==K||e[41]!==F?(B=s.jsx("button",{type:"button",onClick:K,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:F}),e[40]=K,e[41]=F,e[42]=B):B=e[42];let D;e[43]!==R||e[44]!==B?(D=s.jsxs("div",{className:"relative",children:[R,B]}),e[43]=R,e[44]=B,e[45]=D):D=e[45];let P;e[46]!==T||e[47]!==D?(P=s.jsxs("div",{className:"space-y-1",children:[T,D]}),e[46]=T,e[47]=D,e[48]=P):P=e[48];let W;e[49]!==t?(W=t?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:t.helpText}),e[49]=t,e[50]=W):W=e[50];let M;e[51]!==v?(M=v&&s.jsx("p",{className:"text-xs text-destructive",children:v.message}),e[51]=v,e[52]=M):M=e[52];let q;e[53]!==E||e[54]!==n?(q=s.jsx(Z,{type:"button",variant:"ghost",size:"sm",onClick:n,disabled:E,children:"Cancel"}),e[53]=E,e[54]=n,e[55]=q):q=e[55];const X=E?"Saving...":"Save Connection";let Y;e[56]!==E||e[57]!==X?(Y=s.jsx(Z,{type:"submit",size:"sm",disabled:E,children:X}),e[56]=E,e[57]=X,e[58]=Y):Y=e[58];let G;e[59]!==q||e[60]!==Y?(G=s.jsxs(Le,{children:[q,Y]}),e[59]=q,e[60]=Y,e[61]=G):G=e[61];let te;return e[62]!==O||e[63]!==A||e[64]!==P||e[65]!==W||e[66]!==M||e[67]!==G||e[68]!==h?(te=s.jsxs("form",{onSubmit:h,className:"space-y-3",children:[O,A,P,W,M,G]}),e[62]=O,e[63]=A,e[64]=P,e[65]=W,e[66]=M,e[67]=G,e[68]=h,e[69]=te):te=e[69],te}function Jt(i){J.error(`Failed to save connection: ${i.message}`)}const Zt={kind:"closed"};function es(i,e){switch(e.type){case"open":return i.kind==="closed"?{kind:"grid"}:i;case"close":return{kind:"closed"};case"back":switch(i.kind){case"form":case"oauth-pending":case"provision-pending":case"provision-error":return{kind:"grid"};default:return i}case"select-form":return i.kind!=="grid"?i:{kind:"form",providerId:e.providerId,presetId:e.presetId};case"select-oauth":return i.kind!=="grid"?i:{kind:"oauth-pending",providerId:e.providerId,stateToken:e.stateToken};case"oauth-failed":return i.kind==="oauth-pending"?{kind:"grid"}:i;case"select-provision":return i.kind!=="grid"?i:{kind:"provision-pending",providerId:e.providerId};case"provision-error":return i.kind!=="provision-pending"?i:{kind:"provision-error",providerId:i.providerId,error:e.error};case"retry-provision":return i.kind!=="provision-error"?i:{kind:"provision-pending",providerId:i.providerId}}}function ts(i){switch(i.kind){case"form":case"oauth-pending":case"provision-pending":case"provision-error":return i.providerId;default:return null}}function ss({open:i,onOpenChange:e,initialProvider:t}){const l=he()?.providers??[],{org:o}=le(),r=ue(),a=me(),[c,u]=L.useReducer(es,Zt),d=L.useRef(!1);L.useEffect(()=>{i&&c.kind==="closed"?u({type:"open"}):!i&&c.kind!=="closed"&&u({type:"close"})},[i,c.kind]);const f=()=>{d.current=!1,u({type:"close"}),e(!1)},p=()=>{a.invalidateQueries({queryKey:ee.aiProviderKeys(o.id)}),a.invalidateQueries({queryKey:ee.aiProviders(o.id)})},{mutate:m}=ce({mutationFn:async({providerId:h,code:S,stateToken:x,label:O})=>(await r.call("AI_PROVIDER_OAUTH_EXCHANGE",{providerId:h,code:S,stateToken:x,label:O}),h),onSuccess:h=>{Q("ai_provider_oauth_succeeded",{provider_id:h}),p();const S=l.find(x=>x.id===h);J.success(`${S?.name??"Provider"} connected successfully`),f()},onError:(h,S)=>{Q("ai_provider_oauth_failed",{provider_id:S.providerId,error:h.message}),J.error(`OAuth connection failed: ${h.message}`),u({type:"oauth-failed"})}}),{mutate:b}=ce({mutationFn:async h=>(await r.call("AI_PROVIDER_PROVISION_KEY",{providerId:h}),h),onSuccess:h=>{Q("ai_provider_provision_succeeded",{provider_id:h}),p();const S=l.find(x=>x.id===h);J.success(`${S?.name??"Provider"} connected successfully`),f()},onError:(h,S)=>{Q("ai_provider_provision_failed",{provider_id:S,error:h.message}),u({type:"provision-error",error:h.message})}}),g=async h=>{const{provider:S}=h,x=h.kind==="openai-compatible"?h.preset?.id??null:null,O=S.supportedMethods.includes("oauth-pkce"),A=S.supportedMethods.includes("api-key");if(S.supportsProvision===!0){Q("ai_provider_connect_clicked",{provider_id:S.id,method:"provision"}),u({type:"select-provision",providerId:S.id}),b(S.id);return}if(O){Q("ai_provider_connect_clicked",{provider_id:S.id,method:"oauth-pkce"});try{const T=await r.call("AI_PROVIDER_OAUTH_URL",{providerId:S.id,callbackUrl:`${window.location.origin}/oauth/callback/ai-provider`});if(!T?.url)throw new Error("Invalid response from AI_PROVIDER_OAUTH_URL");u({type:"select-oauth",providerId:S.id,stateToken:T.stateToken}),window.open(T.url,"AiProviderOAuth","width=600,height=700")}catch(T){J.error(`Failed to start OAuth: ${T instanceof Error?T.message:String(T)}`)}return}A&&(Q("ai_provider_connect_clicked",{provider_id:S.id,...x!==null?{preset_id:x}:{},method:"api-key"}),u({type:"select-form",providerId:S.id,presetId:x}))},y=L.useRef(g);y.current=g;const j=L.useRef(t);j.current=t,L.useEffect(()=>{!j.current||c.kind!=="grid"||d.current||(d.current=!0,y.current(j.current))},[c.kind]);const _=c.kind==="oauth-pending"?c.stateToken:null,N=c.kind==="oauth-pending"?c.providerId:null;L.useEffect(()=>{if(c.kind!=="oauth-pending")return;let h=!1;const S=c.stateToken,x=c.providerId,O=z=>{if(z.origin!==window.location.origin||z.data?.type!=="AI_PROVIDER_OAUTH_CALLBACK")return;const{code:T,stateToken:U}=z.data;if(U!==S){J.error("Security check failed: State token mismatch"),u({type:"oauth-failed"});return}h=!0;const $=l.find(R=>R.id===x);m({providerId:x,code:T,stateToken:S,label:$?.name??x})};window.addEventListener("message",O);const A=setTimeout(()=>{h||(Q("ai_provider_oauth_timeout",{provider_id:x}),u({type:"oauth-failed"}),J.error("Connection timed out"))},12e4);return()=>{window.removeEventListener("message",O),clearTimeout(A)}},[c.kind,_,N,m]);const I=ts(c),E=I?l.find(h=>h.id===I):null,k=(c.kind==="form"&&c.presetId?ae.find(h=>h.id===c.presetId):null)?.name??E?.name??"Connect an AI provider",C=c.kind!=="grid"&&c.kind!=="closed",w=()=>{t?f():u({type:"back"})};return s.jsx(yt,{open:c.kind!=="closed",onOpenChange:h=>!h&&f(),children:s.jsxs(jt,{className:"sm:max-w-md max-h-[90vh] overflow-y-auto",children:[s.jsxs(St,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[C&&s.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:w,children:s.jsx(Re,{size:16})}),s.jsx(Nt,{children:k})]}),c.kind==="grid"&&!t&&s.jsx(kt,{children:"Pick a provider — we'll handle the rest."})]}),c.kind==="grid"&&!t&&s.jsx(De,{providers:l,onSelect:g}),c.kind==="form"&&(c.providerId==="openai-compatible"?s.jsx(Qt,{preset:c.presetId?ae.find(h=>h.id===c.presetId):void 0,onCancel:()=>u({type:"back"}),onSuccess:()=>{p(),f()}}):s.jsx(Gt,{providerId:c.providerId,onCancel:()=>u({type:"back"}),onSuccess:()=>{p(),f()}})),c.kind==="oauth-pending"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[s.jsx(ge,{size:"lg"}),s.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"Authorize the connection in the popup window. This dialog will close once authorization completes."})]}),c.kind==="provision-pending"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[s.jsx(ge,{size:"lg"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Connecting…"})]}),c.kind==="provision-error"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-6",children:[s.jsx(bt,{size:28,className:"text-destructive"}),s.jsx("p",{className:"text-sm text-foreground text-center",children:c.error}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Z,{variant:"outline",size:"sm",onClick:()=>u({type:"back"}),children:"Back"}),s.jsx(Z,{size:"sm",onClick:()=>{u({type:"retry-provision"}),b(c.providerId)},children:"Retry"})]})]})]})})}function is(){const i=V.c(7),{org:e}=le(),t=ue();let n;i[0]!==e.id?(n=ee.defaultBrand(e.id),i[0]=e.id,i[1]=n):n=i[1];let l;i[2]!==t?(l=async()=>{const{items:a}=await t.call("BRAND_CONTEXT_LIST",{});return(Array.isArray(a)?a:[]).find(ns)??null},i[2]=t,i[3]=l):l=i[3];let o;i[4]!==n||i[5]!==l?(o={queryKey:n,queryFn:l},i[4]=n,i[5]=l,i[6]=o):o=i[6];const{data:r}=Qe(o);return r??null}function ns(i){return i.isDefault&&!i.archivedAt}function ls(i){const e=i.colors;if(!e)return null;if(Array.isArray(e)){const t=e.find(l=>typeof l=="object"&&l!==null&&"label"in l&&/primary|brand|main/i.test(l.label)),n=t?t.value:e[0]?.value;return typeof n=="string"?n:null}if(typeof e=="object"){const t=e;return t.primary??Object.values(t)[0]??null}return null}function os(i){const e=V.c(39);let t;e[0]!==i?(t=i===void 0?{}:i,e[0]=i,e[1]=t):t=e[1];const{title:n,description:l}=t,{org:o}=le(),{localMode:r}=Xe(),a=is(),c=Ct(),[u,d]=L.useState(null),[f,p]=L.useState(!1),[m,b]=L.useState(!1),g=he();let y;e[2]!==g?.providers?(y=g?.providers??[],e[2]=g?.providers,e[3]=y):y=e[3];const j=y,_=o.name;let N;e[4]!==a?(N=a?ls(a):null,e[4]=a,e[5]=N):N=e[5];const I=N,E=a?.favicon??a?.logo??null,v=n??(_?`${_} is ready for agents`:"Your agents are almost ready"),k=l??(r?"Connect a provider, or run `bunx decocms@latest link` on your desktop for Claude Code, Codex, and local files.":"Connect a provider — or run `bunx decocms@latest link` on your desktop to use Claude Code, Codex, or your local files."),C=!!(E||I);let w;e[6]!==I?(w=I?{backgroundColor:`${I}18`,borderColor:`${I}30`}:void 0,e[6]=I,e[7]=w):w=e[7];const h=w,S=C?"flex items-center justify-center size-14 rounded-2xl border":"flex items-center justify-center size-14 rounded-2xl bg-muted border border-border";let x;e[8]!==S||e[9]!==h||e[10]!==E||e[11]!==c||e[12]!==I?(x=E?s.jsx("div",{className:S,style:h,children:s.jsx("img",{src:E,alt:"",className:"size-7 rounded object-contain"})}):s.jsx("button",{type:"button",onClick:()=>b(!0),"aria-label":c.online?"Desktop linked":"Connect your desktop",className:de(S,"cursor-pointer transition-colors hover:bg-accent"),style:h,children:s.jsxs("span",{className:"relative inline-flex items-center justify-center",children:[s.jsx(vt,{size:24,style:I?{color:I}:void 0,className:de(!I&&"text-muted-foreground")}),c.online&&s.jsx("span",{className:"absolute -top-0.5 -right-0.5 size-2.5 rounded-full bg-success ring-2 ring-background animate-pulse"})]})}),e[8]=S,e[9]=h,e[10]=E,e[11]=c,e[12]=I,e[13]=x):x=e[13];let O;e[14]!==v?(O=s.jsx("p",{className:"text-xl font-semibold text-foreground tracking-tight",children:v}),e[14]=v,e[15]=O):O=e[15];let A;e[16]!==k?(A=s.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:k}),e[16]=k,e[17]=A):A=e[17];let z;e[18]!==O||e[19]!==A?(z=s.jsxs("div",{className:"space-y-2",children:[O,A]}),e[18]=O,e[19]=A,e[20]=z):z=e[20];let T;e[21]!==x||e[22]!==z?(T=s.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[x,z]}),e[21]=x,e[22]=z,e[23]=T):T=e[23];let U,$;e[24]===Symbol.for("react.memo_cache_sentinel")?(U=M=>d(M),$=()=>p(!0),e[24]=U,e[25]=$):(U=e[24],$=e[25]);let R;e[26]!==j?(R=s.jsx("div",{className:"w-full",children:s.jsx(De,{providers:j,onSelect:U,onShowAll:$})}),e[26]=j,e[27]=R):R=e[27];const K=u!==null||f;let F;e[28]===Symbol.for("react.memo_cache_sentinel")?(F=M=>{M||(d(null),p(!1))},e[28]=F):F=e[28];const B=u??void 0;let D;e[29]!==K||e[30]!==B?(D=s.jsx(ss,{open:K,onOpenChange:F,initialProvider:B}),e[29]=K,e[30]=B,e[31]=D):D=e[31];let P;e[32]!==m?(P=s.jsx(It,{open:m,onOpenChange:b}),e[32]=m,e[33]=P):P=e[33];let W;return e[34]!==R||e[35]!==D||e[36]!==P||e[37]!==T?(W=s.jsxs("div",{className:"flex flex-col items-center gap-8 w-full max-w-3xl px-4",children:[T,R,D,P]}),e[34]=R,e[35]=D,e[36]=P,e[37]=T,e[38]=W):W=e[38],W}function pe(i){const e=i.title.includes(": ");return{provider:e?i.title.split(": ")[0]??"":i.modelId.split("/")[0]??"",displayName:e?i.title.split(": ").slice(1).join(": "):i.title}}function rs(i){return i<32e3?{level:1,label:"Small",description:"Short conversations"}:i<2e5?{level:2,label:"Medium",description:"Good for most tasks"}:i<5e5?{level:3,label:"Large",description:"Long projects & research"}:{level:4,label:"Very large",description:"Massive files & data"}}const as=["bg-destructive","bg-warning","bg-success","bg-success"],cs=["text-success","text-warning","text-warning","text-destructive"];function ds(i){const e=Math.round(i*.75/1e3);return e>=1?`~${e}K words`:`~${Math.round(i*.75)} words`}function us(i){return i<1?{level:1,label:"Cheap"}:i<5?{level:2,label:"Moderate"}:i<15?{level:3,label:"High"}:{level:4,label:"Expensive"}}const ms={text:{icon:s.jsx(mt,{className:"size-3.5"}),label:"Text"},vision:{icon:s.jsx(ut,{className:"size-3.5"}),label:"Vision"},image:{icon:s.jsx(rt,{className:"size-3.5"}),label:"Image"},tools:{icon:s.jsx(dt,{className:"size-3.5"}),label:"Tools"},reasoning:{icon:s.jsx(Et,{className:"size-3.5"}),label:"Reasoning"},"web-search":{icon:s.jsx(Pe,{className:"size-3.5"}),label:"Web search"}};function hs(i){const e=V.c(5),{capability:t}=i;let n;e[0]!==t?(n=ms[t]??{icon:null,label:t.charAt(0).toUpperCase()+t.slice(1)},e[0]=t,e[1]=n):n=e[1];const l=n;let o;return e[2]!==l.icon||e[3]!==l.label?(o=s.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:[l.icon,l.label]}),e[2]=l.icon,e[3]=l.label,e[4]=o):o=e[4],o}function fs(i){const e=V.c(49),{model:t,compact:n}=i,l=n===void 0?!1:n;if(!t){let v;return e[0]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Hover to preview"}),e[0]=v):v=e[0],v}const o=t.costs?.input!=null?t.costs.input*1e6:null,r=t.costs?.output!=null?t.costs.output*1e6:null;let a;e[1]!==t?(a=pe(t),e[1]=t,e[2]=a):a=e[2];const{provider:c,displayName:u}=a;if(l){let v;e[3]!==t.limits?(v=t.limits?.contextWindow&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"Context"}),s.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.contextWindow.toLocaleString()," tokens"]})]}),e[3]=t.limits,e[4]=v):v=e[4];let k;e[5]!==o?(k=o!=null&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"Input"}),s.jsxs("span",{className:"text-foreground font-medium",children:["$",o.toFixed(2)," / 1M"]})]}),e[5]=o,e[6]=k):k=e[6];let C;e[7]!==r?(C=r!=null&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"Output"}),s.jsxs("span",{className:"text-foreground font-medium",children:["$",r.toFixed(2)," / 1M"]})]}),e[7]=r,e[8]=C):C=e[8];let w;e[9]!==t.limits?(w=t.limits?.maxOutputTokens&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"Output limit"}),s.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.maxOutputTokens.toLocaleString()," tokens"]})]}),e[9]=t.limits,e[10]=w):w=e[10];let h;return e[11]!==v||e[12]!==k||e[13]!==C||e[14]!==w?(h=s.jsxs("div",{className:"flex flex-col gap-2 pt-3 pb-3 px-3 text-xs",children:[v,k,C,w]}),e[11]=v,e[12]=k,e[13]=C,e[14]=w,e[15]=h):h=e[15],h}let d;e[16]!==c?(d=s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:c}),e[16]=c,e[17]=d):d=e[17];let f;e[18]!==t.logo||e[19]!==t.title?(f=t.logo&&s.jsx("img",{src:t.logo,className:"size-6 shrink-0 rounded-md dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[18]=t.logo,e[19]=t.title,e[20]=f):f=e[20];let p;e[21]!==u?(p=s.jsx("p",{className:"text-lg font-semibold leading-snug tracking-tight",children:u}),e[21]=u,e[22]=p):p=e[22];let m;e[23]!==f||e[24]!==p?(m=s.jsxs("div",{className:"flex items-center gap-2.5",children:[f,p]}),e[23]=f,e[24]=p,e[25]=m):m=e[25];let b;e[26]!==t.modelId?(b=s.jsx("p",{className:"text-xs text-muted-foreground/50 font-mono",children:t.modelId}),e[26]=t.modelId,e[27]=b):b=e[27];let g;e[28]!==d||e[29]!==m||e[30]!==b?(g=s.jsxs("div",{className:"flex flex-col gap-1 pt-1 pr-6",children:[d,m,b]}),e[28]=d,e[29]=m,e[30]=b,e[31]=g):g=e[31];let y;e[32]!==t.capabilities?(y=t.capabilities&&t.capabilities.length>0&&s.jsx("div",{className:"flex flex-wrap items-center gap-1.5 pb-4 border-b border-border",children:[...new Set(t.capabilities)].map(ps)}),e[32]=t.capabilities,e[33]=y):y=e[33];let j;e[34]!==t.limits?(j=t.limits?.contextWindow&&(()=>{const{level:v,label:k,description:C}=rs(t.limits.contextWindow);return s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Context window"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex items-center gap-0.5",children:[1,2,3,4].map(w=>s.jsx("div",{className:de("w-2 h-2 rounded-full",w<=v?as[v-1]:"bg-muted")},w))}),s.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:k}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",C]})]}),s.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.limits.contextWindow.toLocaleString()," tokens"]})]})})(),e[34]=t.limits,e[35]=j):j=e[35];let _;e[36]!==t.limits?(_=t.limits?.maxOutputTokens&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Output limit"}),s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsxs("span",{className:"text-sm text-foreground",children:[t.limits.maxOutputTokens.toLocaleString()," tokens"]}),s.jsx("span",{className:"text-sm text-muted-foreground",children:ds(t.limits.maxOutputTokens)})]})]}),e[36]=t.limits,e[37]=_):_=e[37];let N;e[38]!==o||e[39]!==r?(N=(o!=null||r!=null)&&(()=>{const{level:v,label:k}=o!=null?us(o):{level:0,label:""};return s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Pricing"}),o!=null&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex items-center",children:[1,2,3,4].map(C=>s.jsx("span",{className:de("text-sm font-bold leading-none",C<=v?cs[v-1]:"text-muted-foreground/20"),children:"$"},C))}),s.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:k})]}),s.jsxs("div",{className:"flex flex-col gap-1",children:[o!=null&&s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Input"}),s.jsxs("span",{className:"text-xs text-foreground",children:["$",o.toFixed(2)," / 1M tokens"]})]}),r!=null&&s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Output"}),s.jsxs("span",{className:"text-xs text-foreground",children:["$",r.toFixed(2)," / 1M tokens"]})]})]})]})})(),e[38]=o,e[39]=r,e[40]=N):N=e[40];let I;e[41]!==j||e[42]!==_||e[43]!==N?(I=s.jsxs("div",{className:"flex flex-col gap-6",children:[j,_,N]}),e[41]=j,e[42]=_,e[43]=N,e[44]=I):I=e[44];let E;return e[45]!==I||e[46]!==g||e[47]!==y?(E=s.jsxs("div",{className:"flex flex-col gap-5 py-1 px-1.5",children:[g,y,I]}),e[45]=I,e[46]=g,e[47]=y,e[48]=E):E=e[48],E}function ps(i){return s.jsx(hs,{capability:i},i)}function ai(i){const e=V.c(19),{model:t,placeholder:n,isLoading:l}=i,o=n===void 0?"Select model":n;if(l===void 0?!1:l){let g;return e[0]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(H,{className:"w-5 h-5 rounded-sm shrink-0"}),s.jsx(H,{className:"w-16 h-3 hidden md:block"})]}),e[0]=g):g=e[0],g}if(!t){let g;e[1]!==o?(g=s.jsx("span",{className:"text-sm text-muted-foreground",children:o}),e[1]=o,e[2]=g):g=e[2];let y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(ye,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[3]=y):y=e[3];let j;return e[4]!==g?(j=s.jsxs("div",{className:"flex items-center gap-1.5",children:[g,y]}),e[4]=g,e[5]=j):j=e[5],j}let a;e[6]!==t?(a=pe(t),e[6]=t,e[7]=a):a=e[7];const{displayName:c}=a;let u;e[8]!==t?(u=fe(t),e[8]=t,e[9]=u):u=e[9];const d=u;let f;e[10]!==t.title||e[11]!==d?(f=s.jsx("img",{src:d,className:"w-3.5 h-3.5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[10]=t.title,e[11]=d,e[12]=f):f=e[12];let p;e[13]!==c?(p=s.jsx("span",{className:"text-sm truncate whitespace-nowrap text-muted-foreground max-w-[100px] sm:max-w-none",children:c}),e[13]=c,e[14]=p):p=e[14];let m;e[15]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(ye,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[15]=m):m=e[15];let b;return e[16]!==f||e[17]!==p?(b=s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[f,p,m]}),e[16]=f,e[17]=p,e[18]=b):b=e[18],b}const xs=["vision","image","file","audio","video"],Ue=["image/png","image/jpeg","image/gif","image/webp"],Be=["application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"];function xe(i){const e=i?.capabilities;return e?xs.some(t=>e.includes(t)):!1}function ci(i,e){if(!i)return!1;if(i.startsWith("text/"))return!0;const t=e?.capabilities??[],n=t.includes("vision")||t.includes("image"),l=t.includes("file"),o=t.includes("audio"),r=t.includes("video");return!!(n&&Ue.includes(i)||l&&i==="application/pdf"||o&&i.startsWith("audio/")||r&&i.startsWith("video/")||xe(e)&&Be.includes(i))}function di(i){const e=i?.capabilities??[],t=["text/*"];return(e.includes("vision")||e.includes("image"))&&t.push(...Ue),e.includes("file")&&t.push("application/pdf"),e.includes("audio")&&t.push("audio/*"),e.includes("video")&&t.push("video/*"),xe(i)&&t.push(...Be),t.join(",")}function ui(i){const e=i?.capabilities??[],t=[];return(e.includes("vision")||e.includes("image"))&&t.push("images"),e.includes("file")&&t.push("PDFs"),e.includes("audio")&&t.push("audio"),e.includes("video")&&t.push("video"),xe(i)&&t.push("Office files"),t.length===0?"text only":t.length===1?t[0]:t.length===2?`${t[0]} and ${t[1]}`:`${t.slice(0,-1).join(", ")}, and ${t.at(-1)}`}const We=["smarter","faster","cheaper"],Ve={smarter:"Smarter",faster:"Faster",cheaper:"Cheaper"},gs=[{tier:"smarter",prefixes:["anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","openai/gpt-5.3-codex","google/gemini-3-pro","google/gemini-2.5-pro","cohere/command-r-plus","cohere/command-a"]},{tier:"faster",prefixes:["anthropic/claude-haiku-4.5","anthropic/claude-4.5-haiku","google/gemini-3-flash","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast","x-ai/grok-3","mistralai/mistral-large","mistralai/codestral","mistralai/mistral-medium","minimax/minimax-m1"]},{tier:"cheaper",prefixes:["google/gemini-2.5-flash-lite","google/gemini-2.5-flash","google/gemini-2.0-flash","deepseek/deepseek-v3","openai/gpt-oss-120b","mistralai/mistral-small","mistralai/pixtral","cohere/command-r"]}],vs=gs.flatMap(({tier:i,prefixes:e})=>e.map(t=>({tier:i,prefix:t}))).sort((i,e)=>e.prefix.length-i.prefix.length),bs="google/gemini-2.5-pro",Ie=new Map;function ys(i){const e=Ie.get(i);if(e!==void 0)return e;let t=null;if(i.endsWith(":free"))t="cheaper";else for(const{tier:n,prefix:l}of vs)if(i.startsWith(l)){if(l===bs&&i.length>l.length&&i[l.length]==="-"){const r=i[l.length+1];if(!r||!/\d/.test(r))continue}t=n;break}return Ie.set(i,t),t}function Ee(i){const e={smarter:[],faster:[],cheaper:[],other:[]};for(const t of i){const n=ys(t.modelId);e[n??"other"].push(t)}for(const t of Object.keys(e))e[t].sort((n,l)=>n.title.localeCompare(l.title));return e}const He="mesh:model-shortlist:",js=new Set(["anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","anthropic/claude-sonnet-4.6:extended","openai/gpt-5.3-codex","google/gemini-3-pro-preview","google/gemini-2.5-pro","anthropic/claude-haiku-4.5","anthropic/claude-haiku-4.5-20251001","anthropic/claude-4.5-haiku","google/gemini-3-flash-preview","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast-1","google/gemini-2.5-flash","deepseek/deepseek-v3.2","google/gemini-2.5-flash-lite","openai/gpt-oss-120b:free"]);function Ss(i){try{const e=localStorage.getItem(He+i);return e?new Set(JSON.parse(e)):null}catch{return null}}function Ns(i,e){localStorage.setItem(He+i,JSON.stringify([...e]))}function ks(i){const e=V.c(21),{model:t,onHover:n}=i;let l;e[0]!==t?(l=pe(t),e[0]=t,e[1]=l):l=e[1];const{displayName:o,provider:r}=l;let a;e[2]!==t?(a=fe(t),e[2]=t,e[3]=a):a=e[3];const c=a;let u;e[4]!==t||e[5]!==n?(u=()=>n(t),e[4]=t,e[5]=n,e[6]=u):u=e[6];let d;e[7]!==t.title||e[8]!==c?(d=s.jsx("img",{src:c,className:"w-4 h-4 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[7]=t.title,e[8]=c,e[9]=d):d=e[9];let f;e[10]!==o?(f=s.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:o}),e[10]=o,e[11]=f):f=e[11];let p;e[12]!==r?(p=s.jsx("span",{className:"text-xs text-muted-foreground/60 leading-tight",children:r}),e[12]=r,e[13]=p):p=e[13];let m;e[14]!==f||e[15]!==p?(m=s.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[f,p]}),e[14]=f,e[15]=p,e[16]=m):m=e[16];let b;return e[17]!==u||e[18]!==d||e[19]!==m?(b=s.jsxs("div",{className:"flex items-center gap-2.5 py-2 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:u,children:[d,m]}),e[17]=u,e[18]=d,e[19]=m,e[20]=b):b=e[20],b}function ws(i){const e=V.c(10),{error:t,onRetry:n}=i;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"bg-destructive/10 p-2 rounded-full",children:s.jsx(et,{className:"size-5 text-destructive"})}),e[0]=l):l=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("p",{className:"text-sm font-medium text-foreground",children:"Failed to load models"}),e[1]=o):o=e[1];const r=t?.message||"Could not fetch models from this provider.";let a;e[2]!==r?(a=s.jsxs("div",{className:"flex flex-col gap-1",children:[o,s.jsxs("p",{className:"text-xs text-muted-foreground max-w-[260px]",children:[r," Try another provider or retry."]})]}),e[2]=r,e[3]=a):a=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(ct,{className:"size-3.5"}),e[4]=c):c=e[4];let u;e[5]!==n?(u=s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(Z,{variant:"outline",size:"sm",onClick:n,className:"gap-1.5",children:[c,"Retry"]})}),e[5]=n,e[6]=u):u=e[6];let d;return e[7]!==a||e[8]!==u?(d=s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-4 py-8 text-center",children:[l,a,u]}),e[7]=a,e[8]=u,e[9]=d):d=e[9],d}function _s(){const i=V.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:6}).map(Cs)}),i[0]=e):e=i[0],e}function Cs(i,e){return s.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[s.jsx(H,{className:"size-5 shrink-0 rounded-sm"}),s.jsx(H,{className:"flex-1 h-4"}),s.jsx(H,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function Me(i){const e=V.c(12),{label:t,models:n,onSelect:l,onHover:o}=i;if(n.length===0)return null;let r;e[0]!==t?(r=s.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:t}),e[0]=t,e[1]=r):r=e[1];let a;if(e[2]!==n||e[3]!==o||e[4]!==l){let u;e[6]!==o||e[7]!==l?(u=d=>s.jsx("div",{onClick:()=>l(d),className:"cursor-pointer",children:s.jsx(ks,{model:d,onHover:o})},d.modelId),e[6]=o,e[7]=l,e[8]=u):u=e[8],a=n.map(u),e[2]=n,e[3]=o,e[4]=l,e[5]=a}else a=e[5];let c;return e[9]!==r||e[10]!==a?(c=s.jsxs("div",{children:[r,a]}),e[9]=r,e[10]=a,e[11]=c):c=e[11],c}function Is(i){const e=V.c(21),{model:t,isChecked:n,onToggle:l,onHover:o}=i,[r,a]=L.useState(n);r!==n&&a(n);let c;e[0]!==t?(c=fe(t),e[0]=t,e[1]=c):c=e[1];const u=c;let d;e[2]!==t||e[3]!==o?(d=()=>o(t),e[2]=t,e[3]=o,e[4]=d):d=e[4];let f;e[5]!==t.modelId||e[6]!==l?(f=()=>{a(Es),l(t.modelId)},e[5]=t.modelId,e[6]=l,e[7]=f):f=e[7];let p;e[8]!==r||e[9]!==f?(p=s.jsx(tt,{checked:r,onCheckedChange:f}),e[8]=r,e[9]=f,e[10]=p):p=e[10];let m;e[11]!==u||e[12]!==t.title?(m=s.jsx("img",{src:u,className:"w-5 h-5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[11]=u,e[12]=t.title,e[13]=m):m=e[13];let b;e[14]!==t.title?(b=s.jsx("span",{className:"text-sm text-foreground flex-1 min-w-0 line-clamp-1",children:t.title}),e[14]=t.title,e[15]=b):b=e[15];let g;return e[16]!==d||e[17]!==p||e[18]!==m||e[19]!==b?(g=s.jsxs("label",{className:"flex items-center gap-3 min-h-8 py-2.5 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:d,children:[p,m,b]}),e[16]=d,e[17]=p,e[18]=m,e[19]=b,e[20]=g):g=e[20],g}function Es(i){return!i}function Ms(i){const e=[];for(const t of We)if(i[t].length>0){e.push({type:"header",label:Ve[t]});for(const n of i[t])e.push({type:"model",model:n})}if(i.other.length>0){e.push({type:"header",label:"Other"});for(const t of i.other)e.push({type:"model",model:t})}return e}function Os({items:i,shortlistSet:e,onToggle:t,onHover:n}){const l=L.useRef(null),o=Dt({count:i.length,getScrollElement:()=>l.current,estimateSize:r=>i[r]?.type==="header"?36:44,overscan:6});return s.jsx("div",{ref:l,className:"flex-1 overflow-y-auto",children:s.jsx("div",{className:"relative",style:{height:o.getTotalSize()},children:o.getVirtualItems().map(r=>{const a=i[r.index];return a?s.jsx("div",{"data-index":r.index,ref:o.measureElement,className:"absolute left-0 right-0 top-0 px-0.5",style:{transform:`translateY(${r.start}px)`},children:a.type==="header"?s.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:a.label}):s.jsx(Is,{model:a.model,isChecked:e.has(a.model.modelId),onToggle:t,onHover:n})},r.key):null})})})}function As(i){const e=V.c(23),{keyId:t,searchTerm:n,onHover:l,onModelSelect:o,managing:r,onToggleManage:a,filterModels:c}=i,{models:u}=xt(t),d=c?u.filter(c):u.filter(Ts);let f;e[0]!==t?(f=()=>(t?Ss(t):null)??js,e[0]=t,e[1]=f):f=e[1];const[p,m]=L.useState(f),[,b]=L.useTransition();let g;e[2]!==t||e[3]!==b?(g=h=>{t&&b(()=>{m(S=>{const x=new Set(S);return x.has(h)?x.delete(h):x.add(h),Ns(t,x),x})})},e[2]=t,e[3]=b,e[4]=g):g=e[4];const y=g,j=n.toLowerCase().trim(),_=h=>j?h.filter(S=>S.title.toLowerCase().includes(j)||S.modelId.toLowerCase().includes(j)):h;if(r){const h=Ee(_(d)),S=Ms(h);let x;e[5]!==p?(x=T=>p.has(T.modelId),e[5]=p,e[6]=x):x=e[6];const O=d.filter(x).length;let A;e[7]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(Re,{size:14}),e[7]=A):A=e[7];let z;return e[8]!==a?(z=s.jsxs("button",{type:"button",onClick:a,className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground cursor-pointer",children:[A,"Back"]}),e[8]=a,e[9]=z):z=e[9],s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[z,s.jsxs("span",{className:"text-xs text-muted-foreground",children:[O," selected"]})]}),s.jsx(Os,{items:S,shortlistSet:p,onToggle:y,onHover:l})]})}let N;e[10]!==p?(N=h=>p.has(h.modelId),e[10]=p,e[11]=N):N=e[11];const I=d.filter(N),E=I.length>0?I:d,v=Ee(_(E));let k;e[12]!==v||e[13]!==l||e[14]!==o?(k=We.map(h=>s.jsx(Me,{label:Ve[h],models:v[h],onSelect:o,onHover:l},h)),e[12]=v,e[13]=l,e[14]=o,e[15]=k):k=e[15];let C;e[16]!==v.other||e[17]!==l||e[18]!==o?(C=s.jsx(Me,{label:"Other",models:v.other,onSelect:o,onHover:l}),e[16]=v.other,e[17]=l,e[18]=o,e[19]=C):C=e[19];let w;return e[20]!==k||e[21]!==C?(w=s.jsxs("div",{className:"flex-1 overflow-y-auto px-0.5 pt-1 [touch-action:pan-y]",children:[k,C]}),e[20]=k,e[21]=C,e[22]=w):w=e[22],w}function Ts(i){return i.asyncResearch!==!0}function mi(){const i=V.c(6);let e;i[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:s.jsxs("div",{className:"flex items-center gap-2.5 h-12 px-4",children:[s.jsx(H,{className:"size-4 shrink-0"}),s.jsx(H,{className:"flex-1 h-6"}),s.jsx(H,{className:"w-[140px] h-8 shrink-0"})]})}),i[0]=e):e=i[0];let t;i[1]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px] min-h-0 overflow-hidden",children:[e,s.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:8}).map(zs)})]}),i[1]=t):t=i[1];let n;i[2]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(H,{className:"size-6 shrink-0"}),s.jsx(H,{className:"h-6 w-32"})]}),i[2]=n):n=i[2];let l;i[3]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[n,s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(H,{className:"h-6 w-20 rounded-md"}),s.jsx(H,{className:"h-6 w-24 rounded-md"})]})]}),i[3]=l):l=i[3];let o;i[4]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(H,{className:"h-4 w-24"}),s.jsx(H,{className:"h-4 w-32"})]}),i[4]=o):o=i[4];let r;return i[5]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("div",{className:"flex flex-col md:flex-row h-full sm:h-[460px] min-h-0",children:[t,s.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:s.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[l,s.jsxs("div",{className:"flex flex-col gap-4",children:[o,s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(H,{className:"h-4 w-16"}),s.jsx(H,{className:"h-4 w-40"})]})]})]})})]}),i[5]=r):r=i[5],r}function zs(i,e){return s.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[s.jsx(H,{className:"size-5 shrink-0 rounded-sm"}),s.jsx(H,{className:"flex-1 h-4"}),s.jsx(H,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function qe(i){const e=V.c(49),{onClose:t,credentialId:n,onCredentialChange:l,selectedModel:o,onModelChange:r,filterModels:a}=i,[c,u]=L.useState(null),[d,f]=L.useState(""),[p,m]=L.useState(!1),b=L.useRef(null),g=he(),y=pt();let j;e[0]!==g?.providers?(j=Object.fromEntries((g?.providers??[]).map(Ls)),e[0]=g?.providers,e[1]=j):j=e[1];const _=j,N=Je(),{org:I}=le();let E;e[2]!==l?(E=M=>{l(M),u(null)},e[2]=l,e[3]=E):E=e[3];const v=E;let k;e[4]!==n||e[5]!==t||e[6]!==r?(k=M=>{n&&(r(M),f(""),t())},e[4]=n,e[5]=t,e[6]=r,e[7]=k):k=e[7];const C=k;if(y.length===0){let M;return e[8]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsx("div",{className:"flex items-center justify-center p-8 w-full sm:w-[740px]",children:s.jsx(os,{})}),e[8]=M):M=e[8],M}let w;e[9]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(Pe,{size:16,className:"text-muted-foreground shrink-0"}),e[9]=w):w=e[9];const h=p?"Search all models...":"Search for a model...";let S;e[10]===Symbol.for("react.memo_cache_sentinel")?(S=M=>f(M.target.value),e[10]=S):S=e[10];let x;e[11]!==d||e[12]!==h?(x=s.jsx(ne,{ref:b,type:"text",placeholder:h,value:d,onChange:S,className:"flex-1 min-w-0 border-0 !shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"}),e[11]=d,e[12]=h,e[13]=x):x=e[13];let O;e[14]!==n||e[15]!==v||e[16]!==y||e[17]!==_?(O=y.length>0&&s.jsxs(st,{value:n??"",onValueChange:v,children:[s.jsxs(it,{size:"sm",className:"w-auto max-w-[140px] h-8 shrink-0 gap-1.5 px-2 [&>svg:last-child]:hidden",onClick:Ps,children:[s.jsx(nt,{placeholder:"Key",children:(()=>{const M=y.find(te=>te.id===n),q=M?_[M.providerId]:void 0,X=_e(M?.presetId),Y=X?.logo??q?.logo,G=X?.name??q?.name??M?.providerId??"Key";return s.jsxs("span",{className:"flex items-center gap-1.5 min-w-0",children:[Y?s.jsx("img",{src:Y,alt:G,className:"w-4 h-4 rounded shrink-0 dark:bg-white dark:rounded-sm dark:p-px"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary shrink-0",children:G.slice(0,1).toUpperCase()}),s.jsx("span",{className:"text-xs truncate",children:G})]})})()}),s.jsx(ht,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),s.jsx(lt,{children:y.map(M=>{const q=_[M.providerId],X=_e(M.presetId),Y=X?.logo??q?.logo,G=X?.name??q?.name??M.providerId;return s.jsx(ot,{value:M.id,children:s.jsxs("div",{className:"flex items-center gap-2",children:[Y?s.jsx("img",{src:Y,alt:G,className:"w-4 h-4 rounded dark:bg-white dark:rounded-sm dark:p-px"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:G.slice(0,1).toUpperCase()}),s.jsxs("span",{children:[G," — ",M.label]})]})},M.id)})})]}),e[14]=n,e[15]=v,e[16]=y,e[17]=_,e[18]=O):O=e[18];let A;e[19]!==x||e[20]!==O?(A=s.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:s.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 pr-12 md:pr-4 cursor-text",children:[w,x,O]})}),e[19]=x,e[20]=O,e[21]=A):A=e[21];let z;e[22]!==n?(z=M=>{const{error:q,resetError:X}=M;return s.jsx(ws,{error:q,onRetry:X,credentialId:n??void 0})},e[22]=n,e[23]=z):z=e[23];let T;e[24]===Symbol.for("react.memo_cache_sentinel")?(T=s.jsx(_s,{}),e[24]=T):T=e[24];const U=n??void 0;let $;e[25]===Symbol.for("react.memo_cache_sentinel")?($=()=>m(Rs),e[25]=$):$=e[25];let R;e[26]!==a||e[27]!==C||e[28]!==p||e[29]!==d||e[30]!==U?(R=s.jsx(L.Suspense,{fallback:T,children:s.jsx(As,{keyId:U,searchTerm:d,onHover:u,onModelSelect:C,managing:p,onToggleManage:$,filterModels:a})}),e[26]=a,e[27]=C,e[28]=p,e[29]=d,e[30]=U,e[31]=R):R=e[31];let K;e[32]!==n||e[33]!==z||e[34]!==R?(K=s.jsx(Ze,{fallback:z,children:R},n),e[32]=n,e[33]=z,e[34]=R,e[35]=K):K=e[35];let F;e[36]!==p||e[37]!==N||e[38]!==I?(F=!p&&s.jsxs("div",{className:"border-t border-border flex",children:[s.jsxs("button",{type:"button",onClick:()=>L.startTransition(()=>m(!0)),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[s.jsx(at,{className:"size-3.5 shrink-0"}),"Manage models"]}),s.jsx("div",{className:"w-px bg-border shrink-0"}),s.jsxs("button",{type:"button",onClick:()=>N({to:"/$org/settings/ai-providers",params:{org:I.slug}}),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[s.jsx(ft,{className:"size-3.5 shrink-0"}),"Manage API keys"]})]}),e[36]=p,e[37]=N,e[38]=I,e[39]=F):F=e[39];let B;e[40]!==K||e[41]!==F||e[42]!==A?(B=s.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px] min-h-0 overflow-hidden",children:[A,K,F]}),e[40]=K,e[41]=F,e[42]=A,e[43]=B):B=e[43];const D=c??o??null;let P;e[44]!==D?(P=s.jsx("div",{className:"hidden md:flex md:flex-col md:w-[320px] md:shrink-0 p-3",children:s.jsx(fs,{model:D})}),e[44]=D,e[45]=P):P=e[45];let W;return e[46]!==B||e[47]!==P?(W=s.jsxs("div",{className:"flex flex-col md:flex-row h-full sm:h-[460px] min-h-0",children:[B,P]}),e[46]=B,e[47]=P,e[48]=W):W=e[48],W}function Rs(i){return!i}function Ps(i){return i.stopPropagation()}function Ls(i){return[i.id,i]}function $s(i){const e=V.c(12),{onClose:t}=i,{credentialId:n,setCredentialId:l,selectedModel:o,setModel:r}=gt();let a;e[0]!==l?(a=d=>{Q("chat_credential_changed",{credential_id:d}),l(d)},e[0]=l,e[1]=a):a=e[1];let c;e[2]!==n||e[3]!==o?.modelId||e[4]!==r?(c=d=>{n&&(Q("chat_model_changed",{from_model_id:o?.modelId??null,to_model_id:d.modelId,to_model_provider:d.providerId??null,credential_id:n}),r({...d,keyId:n}))},e[2]=n,e[3]=o?.modelId,e[4]=r,e[5]=c):c=e[5];let u;return e[6]!==n||e[7]!==t||e[8]!==o||e[9]!==a||e[10]!==c?(u=s.jsx(qe,{onClose:t,credentialId:n,onCredentialChange:a,selectedModel:o,onModelChange:c}),e[6]=n,e[7]=t,e[8]=o,e[9]=a,e[10]=c,e[11]=u):u=e[11],u}function hi(i){const e=V.c(2),{onClose:t}=i;let n;return e[0]!==t?(n=s.jsx($s,{onClose:t}),e[0]=t,e[1]=n):n=e[1],n}function fi(i){const e=V.c(2);let t;return e[0]!==i?(t=s.jsx(qe,{...i}),e[0]=i,e[1]=t):t=e[1],t}export{ss as C,fi as D,mi as M,os as N,ae as O,De as P,ai as S,di as a,hi as b,ui as g,ci as i,xe as m};
@@ -1,2 +0,0 @@
1
- import{c as Z,r as u,j as r,i as se,B as he,dZ as Mt,a4 as Dt,aa as ie,d_ as Rt,d$ as Pt,e0 as Et,e1 as kt,bK as Tt,e2 as Ot,e3 as qe,a6 as At,e4 as Lt,e5 as Ft,e6 as It,e7 as $t,e8 as _t,e9 as zt,ea as Wt,eb as Gt,ec as Kt,l as ae,m as Bt,t as W,K as $e}from"./index-d52A49fX.js";import{F as Vt,l as Ut}from"./index-9kwnfSCp.js";import{i as qt,aA as Qt,aB as Ht,aC as ue,aD as Xt,_ as _e}from"./agent-icon-BvZm1osM.js";import{b as Jt}from"./Tool01-DJgxsN47.js";import{s as Yt}from"./XClose-eEYHZsPT.js";import{S as Zt}from"./scroll-area-Bsik7Uif.js";import{T as ze,a as We,b as Ge}from"./tooltip-Bzas0fb8.js";import{f as en,a as tn,b as nn,c as rn,d as on,e as sn,A as an,g as ln}from"./alert-dialog-wgrcUQ0O.js";import{u as cn}from"./chat-context-XoGdeFE9.js";import{b as dn}from"./shell-layout-DdmjIlR4.js";import{s as fe,a as Ke,f as un}from"./index-ELtqDe0g.js";import{a as fn,b as mn,c as pn,D as xn,d as hn,e as gn}from"./dialog-C2MVTIBt.js";import{I as Be}from"./input-B_5YyJ8y.js";import{t as vn}from"./ChevronDown-DhzhS3K5.js";import{i as yn}from"./ChevronRight-DntNgeBz.js";import{a as Cn}from"./ZoomOut-Chl8lvun.js";import{E as wn,v as Ve,w as Ce,x as bn,y as jn,z as Nn,A as V,C as me,g as we,D as be,G as Sn,I as Mn,J as je,K as pe,M as Ne,N as Dn,O as Rn}from"./index-Btxmdruq.js";import"./AlertCircle-D90xu5-8.js";import"./SwitchHorizontal01-Bu9ipsE_.js";import"./Settings02-COfrOHpp.js";import"./XCircle-Cz7czjsw.js";import"./ArrowUpRight-B1XPsNPZ.js";import"./ZapSquare-Ch518nCD.js";import"./Users03-JTfAuK6m.js";import"./Loading02-DaLVACu2.js";import"./CheckCircle-CebfgxLq.js";import"./Check-BqH5cjqe.js";import"./ChevronUp-DPJfOoQR.js";import"./Circle-umqkxNwx.js";import"./Stars02-sR281nUk.js";import"./Copy01-YBIj7O7M.js";import"./DotsVertical-DoxN78H8.js";import"./Globe01-D3NrpjPq.js";import"./Eye-o8ajkfvt.js";import"./FilterLines-CEBhmChB.js";import"./Star01-twQgP5oO.js";import"./Globe04-6xG6GU2e.js";import"./HardDrive-CDBenwE2.js";import"./Key01-CwgjH_um.js";import"./LayoutLeft-CKcHwaHf.js";import"./LinkExternal01-DBFEHO3t.js";import"./List-s8AZWxpk.js";import"./Monitor01-lxPxQ2fk.js";import"./Sun-DTFx5jn8.js";import"./Palette-DHyTdFqR.js";import"./Play-TOCBGzP9.js";import"./Plus-DkGwhdIW.js";import"./SearchLg-C9MBYrXH.js";import"./SearchMd-Dhz0UROc.js";import"./Shield01-BrK-9cDf.js";import"./Stars01-C27kMlCK.js";import"./Trash01-myAGgKHr.js";import"./Upload01-m0ny4YmQ.js";import"./User01-DuGAbO5F.js";import"./Users01-e9Wb8IJU.js";import"./X-DRR7RtBP.js";import"./Zap-CMZ9cCJz.js";import"./format-time-Cy7tTmZp.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-_bA4U2MU.js";import"./file-type-icon-DIgcp2MN.js";import"./use-mobile-Cqur1PpI.js";import"./tab-id-Bgchl1bv.js";import"./content-blocks-o63cs2vh.js";import"./types-B2Xs3OM7.js";import"./use-mcp-client-QTh-uqf4.js";import"./constants-nH3qQ_1f.js";import"./auth-B8jeHTDK.js";import"./hooks-BKW8thdS.js";import"./decopilot-sse-pool-B7Qe588m.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./studio-tools-nA7ZTnFV.js";import"./use-clock-tick-B6ygxook.js";import"./sheet-DSSfro03.js";import"./integration-icon-DXGEOTjP.js";import"./use-virtual-mcp-n0IfHFn6.js";import"./use-collections-BP4R8sI-.js";import"./use-navigate-to-agent-CaUSC1CF.js";import"./use-connection-BLVjIktc.js";import"./use-mcp-prompts-5W77PpYc.js";import"./form-TSiFK-dI.js";import"./label-CWqrShVu.js";import"./select-DdHVdWXn.js";import"./use-ai-providers-CW0jtnuO.js";import"./use-decopilot-events-Dk3_PQZu.js";import"./use-organization-settings-CnPdR5CP.js";import"./avatar-BrhzNA4d.js";import"./required-auth-layout-CEAeU4UY.js";import"./use-org-sso-DGL7haeQ.js";import"./library-tab-BBr_dx-g.js";import"./drawer-BGO4iAk0.js";import"./collection-search-BHb176G9.js";import"./tabs-DRqPX6Mz.js";import"./toggle-group-BuLxG5r3.js";import"./agent-capabilities-Cpju5Yfe.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-DGNqtPoP.js";import"./use-registry-connections-HQM1hA3o.js";import"./useInfiniteQuery-DEG0qlSd.js";import"./use-infinite-scroll-1VhU5Q3H.js";import"./extract-connection-data-Dq7vx8cX.js";import"./card-CCFrbS6S.js";import"./collection-tabs-CCdUJRcj.js";import"./badge-B5li3mFX.js";import"./textarea-B3Rf9sP3.js";import"./connection-form-helpers-Bs8LNNlp.js";import"./authenticate-and-persist-oauth-ezeRyKPp.js";import"./mcp-oauth-CSUfdVCn.js";import"./useSuspenseInfiniteQuery-DzP8_asj.js";import"./connect-desktop-dialog-CRhRTOUc.js";import"./decopilot--vqccpDb.js";import"./checkbox-D2NBps_s.js";import"./skeleton-Bl9k4gft.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-eWkjB3kv.js";import"./popover-DlszYF1R.js";import"./command-CGbsZOaN.js";import"./index-BlJ4j0DM.js";import"./dropdown-menu-BPps0Iqr.js";import"./question-004-sINsf4GQ.js";import"./task-row-DzSs63v5.js";import"./task-status-CNEAWeje.js";import"./use-status-sounds-DEhedUWx.js";import"./empty-state-BUKBmmAV.js";import"./toolbar-CVjg3TEd.js";import"./use-mcp-tools-BTYjbm6L.js";import"./use-capability-C9whYnsG.js";import"./tools-list-Dzc5vr-A.js";import"./switch-CuT_exNr.js";import"./use-debounced-autosave-D34fr9f_.js";import"./index-BZQALusN.js";import"./sidebar-BJwboMe2.js";import"./search-input-DccF25qw.js";import"./github-repo-picker-B3tomRAJ.js";import"./use-debounced-value-DxBLMeqg.js";import"./github-installations-DzN1UQ4x.js";import"./use-secrets-D-GN3cJh.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./toolbar-icon-button-CwCDO4L5.js";import"./calendar-C0u4vRHU.js";import"./use-file-configs-Td4k8wTj.js";import"./monaco-editor-xlUuBDU4.js";import"./select-model-C49KT9p5.js";import"./use-automations-CuWiOTtv.js";import"./automation-runs-CmgFzJTt.js";import"./table-CWyE2zgw.js";import"./use-members-Cc48Xacn.js";import"./use-org-auth-client-C5lRdd5o.js";import"./automation-list-row-CeLhtWjA.js";const Pn={"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(s){const e=Z.c(51),{open:i,mode:a,initialName:c,parentLabel:m,isPending:x,onSubmit:p,onOpenChange:g}=s,M=c===void 0?"":c,d=x===void 0?!1:x,[h,y]=u.useState(M),[B,U]=u.useState(i),C=Pn[a];i!==B&&(U(i),i&&y(M));let I;e[0]!==d||e[1]!==g?(I=_=>{!_&&!d&&g(!1)},e[0]=d,e[1]=g,e[2]=I):I=e[2];const H=I;let q;e[3]!==d||e[4]!==h||e[5]!==p?(q=async _=>{_.preventDefault();const K=h.trim();!K||d||await p(K)},e[3]=d,e[4]=h,e[5]=p,e[6]=q):q=e[6];const Q=q;let $;e[7]!==C.title?($=r.jsx(fn,{children:C.title}),e[7]=C.title,e[8]=$):$=e[8];let T;e[9]!==C.description?(T=r.jsx(mn,{children:C.description}),e[9]=C.description,e[10]=T):T=e[10];let G;e[11]!==$||e[12]!==T?(G=r.jsxs(pn,{children:[$,T]}),e[11]=$,e[12]=T,e[13]=G):G=e[13];let O;e[14]!==m?(O=m&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Location"}),r.jsx(Be,{value:m,readOnly:!0,disabled:!0,className:"font-mono text-xs"})]}),e[14]=m,e[15]=O):O=e[15];let A;e[16]===Symbol.for("react.memo_cache_sentinel")?(A=r.jsx("label",{htmlFor:"file-explorer-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[16]=A):A=e[16];let R;e[17]===Symbol.for("react.memo_cache_sentinel")?(R=_=>y(_.target.value),e[17]=R):R=e[17];let P;e[18]!==C.placeholder||e[19]!==d||e[20]!==h?(P=r.jsxs("div",{className:"space-y-1.5",children:[A,r.jsx(Be,{id:"file-explorer-name",value:h,onChange:R,placeholder:C.placeholder,autoFocus:!0,disabled:d})]}),e[18]=C.placeholder,e[19]=d,e[20]=h,e[21]=P):P=e[21];let j;e[22]!==P||e[23]!==O?(j=r.jsxs("div",{className:"space-y-4 py-4",children:[O,P]}),e[22]=P,e[23]=O,e[24]=j):j=e[24];let N;e[25]!==g?(N=()=>g(!1),e[25]=g,e[26]=N):N=e[26];let E;e[27]!==d||e[28]!==N?(E=r.jsx(he,{type:"button",variant:"outline",onClick:N,disabled:d,children:"Cancel"}),e[27]=d,e[28]=N,e[29]=E):E=e[29];let k;e[30]!==d||e[31]!==h?(k=!h.trim()||d,e[30]=d,e[31]=h,e[32]=k):k=e[32];let w;e[33]!==C.submit||e[34]!==d?(w=d?r.jsxs(r.Fragment,{children:[r.jsx(se,{size:14,className:"animate-spin"}),"Saving…"]}):C.submit,e[33]=C.submit,e[34]=d,e[35]=w):w=e[35];let L;e[36]!==k||e[37]!==w?(L=r.jsx(he,{type:"submit",disabled:k,children:w}),e[36]=k,e[37]=w,e[38]=L):L=e[38];let b;e[39]!==E||e[40]!==L?(b=r.jsxs(xn,{children:[E,L]}),e[39]=E,e[40]=L,e[41]=b):b=e[41];let S;e[42]!==Q||e[43]!==j||e[44]!==b||e[45]!==G?(S=r.jsx(hn,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:Q,children:[G,j,b]})}),e[42]=Q,e[43]=j,e[44]=b,e[45]=G,e[46]=S):S=e[46];let z;return e[47]!==H||e[48]!==i||e[49]!==S?(z=r.jsx(gn,{open:i,onOpenChange:H,children:S}),e[47]=H,e[48]=i,e[49]=S,e[50]=z):z=e[50],z}var Me="ContextMenu",[kn]=At(Me,[qe]),F=qe(),[Tn,Qe]=kn(Me),He=s=>{const{__scopeContextMenu:e,children:i,onOpenChange:a,dir:c,modal:m=!0}=s,[x,p]=u.useState(!1),g=F(e),M=Tt(a),d=u.useCallback(h=>{p(h),M(h)},[M]);return r.jsx(Tn,{scope:e,open:x,onOpenChange:d,modal:m,children:r.jsx(Ot,{...g,dir:c,open:x,onOpenChange:d,modal:m,children:i})})};He.displayName=Me;var Xe="ContextMenuTrigger",Je=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,disabled:a=!1,...c}=s,m=Qe(Xe,i),x=F(i),p=u.useRef({x:0,y:0}),g=u.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...p.current})}),M=u.useRef(0),d=u.useCallback(()=>window.clearTimeout(M.current),[]),h=y=>{p.current={x:y.clientX,y:y.clientY},m.onOpenChange(!0)};return u.useEffect(()=>d,[d]),u.useEffect(()=>{a&&d()},[a,d]),r.jsxs(r.Fragment,{children:[r.jsx(Mt,{...x,virtualRef:g}),r.jsx(Dt.span,{"data-state":m.open?"open":"closed","data-disabled":a?"":void 0,...c,ref:e,style:{WebkitTouchCallout:"none",...s.style},onContextMenu:a?s.onContextMenu:ie(s.onContextMenu,y=>{d(),h(y),y.preventDefault()}),onPointerDown:a?s.onPointerDown:ie(s.onPointerDown,xe(y=>{d(),M.current=window.setTimeout(()=>h(y),700)})),onPointerMove:a?s.onPointerMove:ie(s.onPointerMove,xe(d)),onPointerCancel:a?s.onPointerCancel:ie(s.onPointerCancel,xe(d)),onPointerUp:a?s.onPointerUp:ie(s.onPointerUp,xe(d))})]})});Je.displayName=Xe;var On="ContextMenuPortal",Ye=s=>{const{__scopeContextMenu:e,...i}=s,a=F(e);return r.jsx(Et,{...a,...i})};Ye.displayName=On;var Ze="ContextMenuContent",et=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,...a}=s,c=Qe(Ze,i),m=F(i),x=u.useRef(!1);return r.jsx(kt,{...m,...a,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:p=>{s.onCloseAutoFocus?.(p),!p.defaultPrevented&&x.current&&p.preventDefault(),x.current=!1},onInteractOutside:p=>{s.onInteractOutside?.(p),!p.defaultPrevented&&!c.modal&&(x.current=!0)},style:{...s.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});et.displayName=Ze;var An="ContextMenuGroup",Ln=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,...a}=s,c=F(i);return r.jsx(Lt,{...c,...a,ref:e})});Ln.displayName=An;var Fn="ContextMenuLabel",In=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,...a}=s,c=F(i);return r.jsx(Ft,{...c,...a,ref:e})});In.displayName=Fn;var $n="ContextMenuItem",tt=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,...a}=s,c=F(i);return r.jsx(Rt,{...c,...a,ref:e})});tt.displayName=$n;var _n="ContextMenuCheckboxItem",zn=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,...a}=s,c=F(i);return r.jsx(It,{...c,...a,ref:e})});zn.displayName=_n;var Wn="ContextMenuRadioGroup",Gn=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,...a}=s,c=F(i);return r.jsx($t,{...c,...a,ref:e})});Gn.displayName=Wn;var Kn="ContextMenuRadioItem",Bn=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,...a}=s,c=F(i);return r.jsx(_t,{...c,...a,ref:e})});Bn.displayName=Kn;var Vn="ContextMenuItemIndicator",Un=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,...a}=s,c=F(i);return r.jsx(zt,{...c,...a,ref:e})});Un.displayName=Vn;var qn="ContextMenuSeparator",nt=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,...a}=s,c=F(i);return r.jsx(Pt,{...c,...a,ref:e})});nt.displayName=qn;var Qn="ContextMenuArrow",Hn=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,...a}=s,c=F(i);return r.jsx(Wt,{...c,...a,ref:e})});Hn.displayName=Qn;var Xn="ContextMenuSubTrigger",Jn=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,...a}=s,c=F(i);return r.jsx(Gt,{...c,...a,ref:e})});Jn.displayName=Xn;var Yn="ContextMenuSubContent",Zn=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,...a}=s,c=F(i);return r.jsx(Kt,{...c,...a,ref:e,style:{...s.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Zn.displayName=Yn;function xe(s){return e=>e.pointerType!=="mouse"?s(e):void 0}var er=He,tr=Je,nr=Ye,rr=et,or=tt,ir=nt;function sr(s){const e=Z.c(4);let i;e[0]!==s?({...i}=s,e[0]=s,e[1]=i):i=e[1];let a;return e[2]!==i?(a=r.jsx(er,{"data-slot":"context-menu",...i}),e[2]=i,e[3]=a):a=e[3],a}function ar(s){const e=Z.c(4);let i;e[0]!==s?({...i}=s,e[0]=s,e[1]=i):i=e[1];let a;return e[2]!==i?(a=r.jsx(tr,{"data-slot":"context-menu-trigger",...i}),e[2]=i,e[3]=a):a=e[3],a}function lr(s){const e=Z.c(8);let i,a;e[0]!==s?({className:i,...a}=s,e[0]=s,e[1]=i,e[2]=a):(i=e[1],a=e[2]);let c;e[3]!==i?(c=ae("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",i),e[3]=i,e[4]=c):c=e[4];let m;return e[5]!==a||e[6]!==c?(m=r.jsx(nr,{children:r.jsx(rr,{"data-slot":"context-menu-content",className:c,...a})}),e[5]=a,e[6]=c,e[7]=m):m=e[7],m}function te(s){const e=Z.c(12);let i,a,c,m;e[0]!==s?({className:i,inset:a,variant:m,...c}=s,e[0]=s,e[1]=i,e[2]=a,e[3]=c,e[4]=m):(i=e[1],a=e[2],c=e[3],m=e[4]);const x=m===void 0?"default":m;let p;e[5]!==i?(p=ae("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",i),e[5]=i,e[6]=p):p=e[6];let g;return e[7]!==a||e[8]!==c||e[9]!==p||e[10]!==x?(g=r.jsx(or,{"data-slot":"context-menu-item","data-inset":a,"data-variant":x,className:p,...c}),e[7]=a,e[8]=c,e[9]=p,e[10]=x,e[11]=g):g=e[11],g}function Ue(s){const e=Z.c(8);let i,a;e[0]!==s?({className:i,...a}=s,e[0]=s,e[1]=i,e[2]=a):(i=e[1],a=e[2]);let c;e[3]!==i?(c=ae("bg-border -mx-1 my-1 h-px",i),e[3]=i,e[4]=c):c=e[4];let m;return e[5]!==a||e[6]!==c?(m=r.jsx(ir,{"data-slot":"context-menu-separator",className:c,...a}),e[5]=a,e[6]=c,e[7]=m):m=e[7],m}const cr="#d9a441";function dr(s){const e=Z.c(45),{node:i,depth:a,isExpanded:c,isSelected:m,isLoading:x,fileVisual:p,onOpen:g,onSelect:M,onNewFile:d,onNewFolder:h,onCopyPath:y,onCopyRelativePath:B,onRename:U,onDelete:C}=s,I=x===void 0?!1:x,H=i.kind==="directory",{Icon:q,color:Q}=p,$=m&&"bg-accent";let T;e[0]!==$?(T=ae("flex w-full items-center gap-1.5 px-2 py-1.5 text-left text-[13px] hover:bg-accent transition-colors",$),e[0]=$,e[1]=T):T=e[1];const G=`${a*14+8}px`;let O;e[2]!==G?(O={paddingLeft:G},e[2]=G,e[3]=O):O=e[3];let A;e[4]!==g||e[5]!==M?(A=()=>{M(),g()},e[4]=g,e[5]=M,e[6]=A):A=e[6];let R;e[7]!==q||e[8]!==Q||e[9]!==H||e[10]!==c||e[11]!==I?(R=H?r.jsxs(r.Fragment,{children:[I?r.jsx(se,{size:14,className:"shrink-0 animate-spin text-muted-foreground"}):c?r.jsx(vn,{size:14,className:"shrink-0 text-muted-foreground"}):r.jsx(yn,{size:14,className:"shrink-0 text-muted-foreground"}),r.jsx(Cn,{size:16,className:"shrink-0",style:{color:cr}})]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"w-3.5 shrink-0"}),r.jsx(q,{size:16,className:"shrink-0",style:{color:Q}})]}),e[7]=q,e[8]=Q,e[9]=H,e[10]=c,e[11]=I,e[12]=R):R=e[12];let P;e[13]!==i.name?(P=r.jsx("span",{className:"truncate",children:i.name}),e[13]=i.name,e[14]=P):P=e[14];let j;e[15]!==T||e[16]!==O||e[17]!==A||e[18]!==R||e[19]!==P?(j=r.jsx(ar,{asChild:!0,children:r.jsxs("button",{type:"button",className:T,style:O,onClick:A,children:[R,P]})}),e[15]=T,e[16]=O,e[17]=A,e[18]=R,e[19]=P,e[20]=j):j=e[20];let N;e[21]!==d?(N=r.jsx(te,{onSelect:d,children:"New File"}),e[21]=d,e[22]=N):N=e[22];let E;e[23]!==h?(E=r.jsx(te,{onSelect:h,children:"New Folder"}),e[23]=h,e[24]=E):E=e[24];let k;e[25]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx(Ue,{}),e[25]=k):k=e[25];let w;e[26]!==y?(w=r.jsx(te,{onSelect:y,children:"Copy Path"}),e[26]=y,e[27]=w):w=e[27];let L;e[28]!==B?(L=r.jsx(te,{onSelect:B,children:"Copy Relative Path"}),e[28]=B,e[29]=L):L=e[29];let b;e[30]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx(Ue,{}),e[30]=b):b=e[30];let S;e[31]!==U?(S=r.jsx(te,{onSelect:U,children:"Rename"}),e[31]=U,e[32]=S):S=e[32];let z;e[33]!==C?(z=r.jsx(te,{variant:"destructive",onSelect:C,children:"Delete"}),e[33]=C,e[34]=z):z=e[34];let _;e[35]!==N||e[36]!==E||e[37]!==w||e[38]!==L||e[39]!==S||e[40]!==z?(_=r.jsxs(lr,{className:"w-52",children:[N,E,k,w,L,b,S,z]}),e[35]=N,e[36]=E,e[37]=w,e[38]=L,e[39]=S,e[40]=z,e[41]=_):_=e[41];let K;return e[42]!==_||e[43]!==j?(K=r.jsxs(sr,{children:[j,_]}),e[42]=_,e[43]=j,e[44]=K):K=e[44],K}Ut.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.0/min/vs"}});function Se(s,e,i,a){return`/api/${s}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(i)}/${a}`}function ur(s){const e=V(s);return!e||e.includes("..")||e.includes("\\")?!1:e.startsWith(".deco/blocks/")||!e.startsWith("/")&&!e.includes("://")}const fr="#94a3b8";function mr(s){const e=s.toLowerCase();return e.endsWith(".tsx")||e.endsWith(".ts")?{Icon:ue,color:"#3b82f6"}:e.endsWith(".jsx")||e.endsWith(".js")||e.endsWith(".mjs")||e.endsWith(".cjs")?{Icon:ue,color:"#d9a441"}:e.endsWith(".json")?{Icon:Xt,color:"#cb9b3f"}:e.endsWith(".css")||e.endsWith(".scss")?{Icon:ue,color:"#06b6d4"}:e.endsWith(".html")||e.endsWith(".xml")?{Icon:ue,color:"#f97316"}:/\.(png|jpe?g|gif|webp|avif|ico|svg)$/.test(e)?{Icon:Jt,color:"#a855f7"}:e.endsWith(".md")||e.endsWith(".mdx")?{Icon:_e,color:"#64748b"}:{Icon:_e,color:fr}}function rs({orgSlug:s,virtualMcpId:e,branch:i,openPath:a}){const[c,m]=u.useState({files:[],directories:[],truncated:!1}),{files:x,directories:p}=c,[g,M]=u.useState(new Set),[d,h]=u.useState(null),[y,B]=u.useState(null),[U,C]=u.useState([]),[I,H]=u.useState(""),[q,Q]=u.useState(!1),[$,T]=u.useState(!1),[,G]=u.useState(new Set),[O,A]=u.useState(new Set),R=u.useRef(0),P=u.useRef(null),j=u.useRef(new Set),N=u.useRef(new Map);function E(t){G(n=>{const o=typeof t=="function"?t(n):t;return j.current=o,o})}const[k,w]=u.useState(new Map),L=u.useRef(null),[b,S]=u.useState(null),{sendMessage:z}=cn(),{setChatOpen:_}=dn(),K=Bt(),[D,X]=u.useState(null),[J,ge]=u.useState(null),[ne,le]=u.useState(!1);async function re(t,n){const o=await fetch(Se(s,e,i,t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)});if(!o.ok){const l=await o.json().catch(()=>({}));throw new Error(l.error??`Request failed (${o.status})`)}return o.json()}async function ce(){K.invalidateQueries({queryKey:Ke(s,e,i)})}function De(t,n){navigator.clipboard.writeText(n).then(()=>W.success(`${t} copied`),()=>W.error(`Failed to copy ${t.toLowerCase()}`))}function rt(t){const n=Dn(t);if(!n)return;const o=`${s}/${e}/${i}`;K.setQueryData($e.decofile(o),l=>{if(!l)return l;const{[n]:f,...v}=l;return v}),K.invalidateQueries({queryKey:$e.liveMeta(o)})}function ot(t){const n=t.kind==="file"?[t.path]:x.filter(o=>o.startsWith(".deco/blocks/")).map(o=>me(o)).filter(o=>o===t.path||o.startsWith(`${t.path}/`));for(const o of n)rt(o)}function it(t){const n=me(t);return U.filter(o=>{if(o!==n&&!o.startsWith(`${n}/`))return!1;const l=k.get(o);return!!(l?.loaded&&l.editorValue!==l.savedContent)})}function Re(t){C(n=>n.map(o=>t(o)).filter(o=>o!==null)),h(n=>n&&t(n)),w(n=>{const o=new Map;for(const[l,f]of n){const v=t(l);v&&o.set(v,f)}return o}),B(n=>{if(!n)return n;const o=t(n.path);return o?o===n.path?n:{...n,path:o,name:o.split("/").pop()??o}:null})}function st(t){const n=me(t);B(o=>o&&(o.path===n||o.path.startsWith(`${n}/`)?null:o)),Re(o=>o===n||o.startsWith(`${n}/`)?null:o)}async function at(t){if(!D)return;const n=pe(D.parentDir,t);if(Ne(n,x,p))throw new Error(`"${t}" already exists`);await re("write",{path:V(n),content:""}),await oe(),await ce(),X(null),ve(n)}async function lt(t){if(!D)return;const n=pe(D.parentDir,t);if(Ne(n,x,p))throw new Error(`"${t}" already exists`);const o=V(n);await re("mkdir",{path:o}),m(l=>({...l,directories:l.directories.includes(o)?l.directories:[...l.directories,o]})),await oe(),await ce(),X(null),M(l=>{const f=new Set(l);for(const v of Ce(n))f.add(v);return f.add(n),f}),B({name:t,path:n,kind:"directory",children:[]})}async function ct(t){if(!D)return;const n=D.node.path,o=je(n),l=pe(o,t);if(l===n){X(null);return}if(Ne(l,x,p))throw new Error(`"${t}" already exists`);await re("rename",{from:V(n),to:V(l)}),Re(f=>f===n?l:f.startsWith(`${n}/`)?pe(l,f.slice(n.length+1)):f),await oe(),await ce(),X(null)}async function dt(t){le(!0);try{await re("unlink",{path:V(t.path),recursive:t.kind==="directory"}),ot(t),st(t.path),await oe(),await ce(),ge(null),W.success(`Deleted "${t.name}"`)}catch(n){W.error(n instanceof Error?n.message:"Delete failed")}finally{le(!1)}}async function ut(t){const n=Mn(t);if(n){W.error(n);return}le(!0);try{D?.mode==="new-file"?(await at(t),W.success(`Created "${t}"`)):D?.mode==="new-folder"?(await lt(t),W.success(`Created folder "${t}"`)):D?.mode==="rename"&&(await ct(t),W.success(`Renamed to "${t}"`))}catch(o){W.error(o instanceof Error?o.message:"Operation failed")}finally{le(!1)}}const Pe=u.useRef(!1);Pe.current||(Pe.current=!0,P.current=oe());const[ft,mt]=u.useState(null);if(a&&a!==ft){mt(a);const t=a;queueMicrotask(()=>{ur(t)&&ve(t).catch(n=>{W.error(n instanceof Error?n.message:"Failed to open file")})})}async function Ee(t){const n=await re("glob",t);return{files:n.files??[],directories:n.directories??[],truncated:n.truncated}}function ke(t,n,o){if(o!==R.current)return!1;let l=!1;return m(f=>{const v=n?Rn(f.files,f.directories,t,f.truncated):{files:t.files,directories:t.directories??[],truncated:!!t.truncated};return l=!!v.truncated,{files:v.files,directories:v.directories,truncated:l}}),l&&W.warning("File list truncated — some files may be hidden"),l}async function pt(t){const n=N.current.get(t);if(n)return n;const o=R.current,l=(async()=>{const f=await Ee({pattern:"**/*",path:V(t),limit:Ve}),v=ke(f,!0,o);return!v&&o===R.current&&E(Y=>{const de=new Set(Y);return de.add(t),de}),v})();N.current.set(t,l);try{return await l}finally{N.current.delete(t)}}async function Te(t){if(!be(t,j.current))return!1;A(n=>new Set(n).add(t));try{return await pt(t)}finally{A(n=>{const o=new Set(n);return o.delete(t),o})}}async function xt(t){const n=new Set(j.current);for(const o of Ce(t)){if(!be(o,n))continue;if(await Te(o))throw new Error("Folder listing truncated — expand again to load more");n.add(o)}}async function oe(){const t=++R.current;N.current.clear(),Q(!0),E(new Set),M(new Set),A(new Set);try{const n=await Ee({pattern:"**/*",limit:Ve,maxDepth:wn});ke(n,!1,t),T(!0)}catch{$&&W.error("Failed to refresh file tree")}finally{Q(!1)}}async function Oe(t){if(!k.get(t)?.loaded){w(o=>{const l=new Map(o);return l.set(t,{savedContent:"",editorValue:"",loaded:!1}),l});try{const o=await fetch(Se(s,e,i,"read"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:V(t),full:!0})});if(!o.ok)return;const l=await o.json(),f=Sn(l.content??"");w(v=>{const Y=new Map(v);return Y.set(t,{savedContent:f,editorValue:f,loaded:!0}),Y})}catch{}}}async function ht(t,n){try{const o=await fetch(Se(s,e,i,"write"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:V(t),content:n})});if(!o.ok){fe("file save failed",{path:t,status:o.status});return}fe("file saved via sandbox /write",{path:t}),K.invalidateQueries({queryKey:Ke(s,e,i)});try{const l=await un(s,e,i);fe("git status after save",l)}catch(l){fe("git status after save failed",{path:t,error:l instanceof Error?l.message:String(l)})}w(l=>{const f=new Map(l),v=f.get(t);return v&&f.set(t,{...v,savedContent:n}),f})}catch{}}function gt(t){h(t),B({name:t.split("/").pop()??t,path:t,kind:"file",children:[]}),S(null),U.includes(t)||C(n=>[...n,t]),Oe(t)}function vt(t){C(n=>{const o=n.filter(l=>l!==t);return d===t&&h(o[o.length-1]??null),o}),w(n=>{const o=new Map(n);return o.delete(t),o})}function Ae(t){M(n=>{const o=new Set(n);return o.has(t)?o.delete(t):o.add(t),o})}async function yt(t){if(be(t,j.current))try{if(await Te(t))return}catch(n){W.error(n instanceof Error?n.message:"Failed to load folder");return}Ae(t)}async function Ct(t,n){if(n){Ae(t);return}await yt(t)}async function ve(t){await P.current,await xt(t);const n=Ce(t);M(o=>{const l=new Set(o);for(const f of n)l.add(f);return l}),gt(t)}function wt(){return y?.kind==="directory"?y.path:y?.kind==="file"?je(y.path):d?je(d):"/"}function Le(t){const n=wt();X({mode:t,parentDir:n,node:{name:"",path:n,kind:"directory",children:[]}})}const bt=bn(x,p),Fe=jn(bt,g),Ie=I?Fe.filter(t=>t.node.name.toLowerCase().includes(I.toLowerCase())):Fe,ee=d?k.get(d):null,jt=ee?.loaded&&ee.editorValue!==ee.savedContent,ye=J?it(J.path):[],Nt=(t,n)=>{L.current=t,t.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.KeyS,async()=>{if(!d)return;const o=t.getValue();await ht(d,o)}),t.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.KeyK,()=>{const o=t.getSelection(),l=t.getModel();if(!o||!l||!d)return;const f=l.getValueInRange(o);S({filePath:d,lineStart:o.startLineNumber,lineEnd:o.endLineNumber,selectedCode:f})})};function St(t){if(!b)return;const n=[`The user selected code in the file explorer and asked: **"${t.trim()}"**`,"",`**File:** \`${b.filePath}\``,`**Lines:** ${b.lineStart}–${b.lineEnd}`];if(b.selectedCode){const o=we(b.filePath),l=b.selectedCode.replace(/```/g,"`` `");n.push("","**Selected code:**","```"+o,l,"```")}n.push("","Please read the source file, locate the code, and apply the requested change."),_(!0),z({parts:[{type:"text",text:n.join(`
2
- `)}]}),S(null)}return q&&!$?r.jsx("div",{className:"flex items-center justify-center h-full w-full",children:r.jsx(se,{size:20,className:"animate-spin text-muted-foreground"})}):r.jsxs("div",{className:"flex h-full w-full overflow-hidden",children:[r.jsxs("div",{className:"w-64 shrink-0 border-r flex flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex items-center gap-1 p-2 border-b",children:[r.jsxs("div",{className:"relative min-w-0 flex-1",children:[r.jsx(qt,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{type:"text",value:I,onChange:t=>H(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"})]}),r.jsxs(ze,{children:[r.jsx(We,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":"New file",onClick:()=>Le("new-file"),children:r.jsx(Qt,{size:14})})}),r.jsx(Ge,{side:"bottom",children:"New file"})]}),r.jsxs(ze,{children:[r.jsx(We,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":"New folder",onClick:()=>Le("new-folder"),children:r.jsx(Ht,{size:14})})}),r.jsx(Ge,{side:"bottom",children:"New folder"})]})]}),r.jsx(Zt,{className:"flex-1",children:r.jsxs("div",{className:"py-1",children:[Ie.map(t=>{const{node:n,depth:o}=t,l=n.kind==="directory",f=g.has(n.path),v=y?.path===n.path,Y=Nn(n.path,n.kind),de=l&&O.has(n.path);return r.jsx(dr,{node:n,depth:o,isExpanded:f,isSelected:v,isLoading:de,fileVisual:mr(n.name),onSelect:()=>B(n),onOpen:()=>{l?Ct(n.path,f):ve(n.path)},onNewFile:()=>X({mode:"new-file",node:n,parentDir:Y}),onNewFolder:()=>X({mode:"new-folder",node:n,parentDir:Y}),onCopyPath:()=>De("Path",me(n.path)),onCopyRelativePath:()=>De("Relative path",V(n.path)),onRename:()=>X({mode:"rename",node:n,parentDir:Y}),onDelete:()=>ge(n)},n.path)}),$&&Ie.length===0&&r.jsx("div",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:I?`No files match "${I}"`:"No files found"})]})})]}),r.jsxs("div",{className:"relative flex-1 flex flex-col overflow-hidden",children:[U.length>0&&r.jsx("div",{className:"flex items-center border-b overflow-x-auto shrink-0",children:U.map(t=>{const n=k.get(t),o=n?.loaded&&n.editorValue!==n.savedContent,l=d===t,f=t.split("/").pop()??t;return r.jsxs("div",{className:ae("flex items-center gap-1 px-3 py-1.5 text-xs border-r cursor-pointer transition-colors",l?"bg-background text-foreground":"bg-muted/50 text-muted-foreground hover:bg-accent"),onClick:()=>{h(t),Oe(t)},onKeyDown:()=>{},role:"tab",tabIndex:0,"aria-selected":l,children:[r.jsx("span",{className:"truncate max-w-32",children:f}),o&&r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-foreground/60 shrink-0"}),r.jsx("button",{type:"button",className:"ml-1 rounded p-0.5 hover:bg-accent-foreground/10",onClick:v=>{v.stopPropagation(),vt(t)},children:r.jsx(Yt,{size:12})})]},t)})}),b&&r.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 z-20 mt-2",style:{width:"360px"},children:r.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 o=t.currentTarget.elements.namedItem("askAiInput");o.value.trim()&&St(o.value)},children:[r.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"&&S(null)}}),r.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:r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:[r.jsx("title",{children:"Send"}),r.jsx("path",{d:"M5 9V1M1 5l4-4 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})}),r.jsx("div",{className:"flex-1 overflow-hidden",children:d&&ee?.loaded?r.jsx(Vt,{language:we(d),theme:document.documentElement.classList.contains("dark")?"vs-dark":"light",value:ee.editorValue,path:d,onChange:t=>{const n=d;n&&w(o=>{const l=new Map(o),f=l.get(n);return f&&l.set(n,{...f,editorValue:t??""}),l})},onMount:Nt,loading:r.jsx("div",{className:"flex items-center justify-center h-full w-full",children:r.jsx(se,{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}}},d):d&&!ee?.loaded?r.jsx("div",{className:"flex items-center justify-center h-full w-full",children:r.jsx(se,{size:20,className:"animate-spin text-muted-foreground"})}):r.jsx("div",{className:"flex items-center justify-center h-full w-full text-sm text-muted-foreground",children:"Select a file to edit"})}),d&&r.jsxs("div",{className:"flex items-center justify-between px-3 py-1 border-t text-[11px] text-muted-foreground shrink-0",children:[r.jsx("span",{className:"truncate",children:d}),r.jsxs("span",{children:[jt?"Modified":"Saved"," ·"," ",we(d)]})]})]}),r.jsx(En,{open:D!==null,mode:D?.mode??"new-file",initialName:D?.mode==="rename"?D.node.name:"",parentLabel:D&&D.mode!=="rename"?D.parentDir==="/"?"/":V(D.parentDir):void 0,isPending:ne,onSubmit:ut,onOpenChange:t=>{!t&&!ne&&X(null)}}),r.jsx(en,{open:J!==null,onOpenChange:t=>{!t&&!ne&&ge(null)},children:r.jsxs(tn,{children:[r.jsxs(nn,{children:[r.jsxs(rn,{children:["Delete ",J?.kind==="directory"?"folder":"file","?"]}),r.jsxs(on,{children:["This will permanently delete"," ",r.jsx("span",{className:"font-mono",children:J?.name}),J?.kind==="directory"?" and everything inside it.":".",ye.length>0&&r.jsxs(r.Fragment,{children:[" ",ye.length===1?"One open file has unsaved changes that will be lost.":`${ye.length} open files have unsaved changes that will be lost.`]})]})]}),r.jsxs(sn,{children:[r.jsx(an,{disabled:ne,children:"Cancel"}),r.jsx(ln,{disabled:ne||!J,onClick:t=>{t.preventDefault(),J&&dt(J)},children:"Delete"})]})]})})]})}export{rs as FileExplorer};
@@ -1 +0,0 @@
1
- import{b as G,D as V,m as M,p as Q,n as Y,d as K,v as B,t as w,K as I,j as a,a1 as $,o as Z,s as F,c as _,r as P,B as H,L as q,y as J}from"./index-d52A49fX.js";import{P as k}from"./index-BZQALusN.js";import{u as W}from"./use-org-auth-client-C5lRdd5o.js";import{u as X}from"./use-debounced-autosave-D34fr9f_.js";import{A as ee}from"./avatar-BrhzNA4d.js";import{I as U}from"./input-B_5YyJ8y.js";import{S as R,a as L,b as D,c as te}from"./settings-section-eWkjB3kv.js";import{D as ae}from"./domain-settings-Dk68eaoE.js";import{S as se}from"./switch-CuT_exNr.js";import{u as ne,e as oe}from"./use-organization-settings-CnPdR5CP.js";import{u as ie}from"./studio-tools-nA7ZTnFV.js";import{c as re,b as le,d as ce,A as de,e as ue,g as me,a as ge,f as fe}from"./alert-dialog-wgrcUQ0O.js";import{R as pe}from"./require-capability-C135EIMf.js";import"./sidebar-BJwboMe2.js";import"./LayoutLeft-CKcHwaHf.js";import"./use-mobile-Cqur1PpI.js";import"./sheet-DSSfro03.js";import"./X-DRR7RtBP.js";import"./tooltip-Bzas0fb8.js";import"./User01-DuGAbO5F.js";import"./card-CCFrbS6S.js";import"./ArrowUpRight-B1XPsNPZ.js";import"./badge-B5li3mFX.js";import"./select-DdHVdWXn.js";import"./Check-BqH5cjqe.js";import"./ChevronDown-DhzhS3K5.js";import"./ChevronUp-DPJfOoQR.js";import"./constants-nH3qQ_1f.js";import"./use-capability-C9whYnsG.js";import"./access-gate-Cf-kJrg7.js";import"./capability-load-error-D7uMbvO0.js";const he=Z({name:F().min(1,"Name is required").max(255,"Name is too long"),slug:F().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:F().optional()});function xe(e){const t=_.c(13),{value:f,onChange:d,name:n,disabled:l}=e,u=P.useRef(null);let c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c=()=>u.current?.click(),t[0]=c):c=t[0];const r=c;let m;t[1]!==d?(m=j=>{const b=j.target.files?.[0];if(!b)return;if(b.size>2097152){w.error("Image must be smaller than 2MB");return}const g=new FileReader;g.onerror=je,g.onloadend=()=>{g.result&&d(g.result),u.current&&(u.current.value="")},g.readAsDataURL(b)},t[1]=d,t[2]=m):m=t[2];const s=m;let o;t[3]!==l||t[4]!==s?(o=a.jsx("input",{ref:u,type:"file",accept:"image/*",onChange:s,className:"hidden",disabled:l}),t[3]=l,t[4]=s,t[5]=o):o=t[5];const i=f||void 0,x=n??"?";let p;t[6]!==i||t[7]!==x?(p=a.jsx(ee,{url:i,fallback:x,shape:"square",size:"base"}),t[6]=i,t[7]=x,t[8]=p):p=t[8];let h;return t[9]!==l||t[10]!==o||t[11]!==p?(h=a.jsxs("button",{type:"button",onClick:r,disabled:l,className:"rounded-lg overflow-hidden hover:ring-2 hover:ring-border transition-all disabled:opacity-50","aria-label":"Upload organization logo",children:[o,p]}),t[9]=l,t[10]=o,t[11]=p,t[12]=h):h=t[12],h}function je(){return w.error("Failed to read image")}function be(){const e=G(),{org:t}=V(),f=W(),d=M(),n=Q({resolver:Y(he),values:{name:t.name??"",slug:t.slug??"",logo:t.logo??""}}),l=K({mutationFn:async s=>{const o={name:s.name,slug:s.slug};s.logo&&(o.logo=s.logo);const i=await f.organization.update({data:o});if(i?.error)throw new Error(i.error.message||"Failed to update organization");return i},onSuccess:(s,o)=>{B("organization_settings_updated",{organization_id:t.id,fields:Object.keys(o)}),d.invalidateQueries({queryKey:I.organizations()}),d.invalidateQueries({queryKey:I.activeOrganization(t.slug)}),w.success("Organization updated successfully"),s?.data?.slug&&s.data.slug!==t.slug&&e({to:"/$org/settings/general",params:{org:s.data.slug}})},onError:(s,o)=>{B("organization_settings_update_failed",{organization_id:t.id,fields:Object.keys(o),error:s instanceof Error?s.message:String(s)}),w.error(s instanceof Error?s.message:"Failed to update organization")}}),{schedule:u,flush:c}=X({save:async()=>{const s=n.control._formState.dirtyFields;if(Object.keys(s).length===0||!await n.trigger())return;const i=n.getValues(),x=n.control._defaultValues;n.reset(i,{keepValues:!0});try{await l.mutateAsync(i)}catch{n.reset(x,{keepValues:!0})}}}),r=n.formState.errors,m=typeof window<"u"?`${window.location.host}/`:"";return a.jsx(R,{children:a.jsxs(L,{children:[a.jsx(D,{title:"Logo",description:"Recommended size is 256x256px",action:a.jsx(xe,{value:n.watch("logo"),onChange:s=>{n.setValue("logo",s??"",{shouldDirty:!0}),c()},name:n.watch("name")})}),a.jsx(D,{title:"Name",action:a.jsx($,{control:n.control,name:"name",render:({field:s})=>a.jsx(U,{id:"org-name",...s,onChange:o=>{s.onChange(o),u()},onBlur:()=>{s.onBlur(),c()},placeholder:"Organization name",className:"w-[280px]"})})}),a.jsx(D,{title:"URL",action:a.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:[m&&a.jsx("span",{className:"pl-3 text-sm text-muted-foreground select-none",children:m}),a.jsx($,{control:n.control,name:"slug",render:({field:s})=>a.jsx("input",{id:"org-slug",value:s.value??"",name:s.name,ref:s.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:o=>{const i=o.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");n.setValue("slug",i,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0}),u()},onBlur:()=>{s.onBlur(),c()}})})]})}),(r.name||r.slug||r.logo)&&a.jsxs("div",{className:"px-5 pb-3 flex flex-col gap-1",children:[r.name&&a.jsx("p",{className:"text-xs text-destructive",children:r.name.message}),r.slug&&a.jsx("p",{className:"text-xs text-destructive",children:r.slug.message}),r.logo&&a.jsx("p",{className:"text-xs text-destructive",children:r.logo.message})]})]})})}function ve(){const e=_.c(6),t=ne(),{mutate:f,isPending:d}=oe();let n;e[0]!==f?(n=u=>f(u),e[0]=f,e[1]=n):n=e[1];let l;return e[2]!==t||e[3]!==d||e[4]!==n?(l=a.jsx(R,{title:"Task board",description:"A board for tracking org tasks by status, priority, and assignee.",children:a.jsx(L,{children:a.jsx(D,{title:"Enable task board",description:"Adds a Board entry to the sidebar for this organization.",action:a.jsx(se,{checked:t,disabled:d,onCheckedChange:n})})})}),e[2]=t,e[3]=d,e[4]=n,e[5]=l):l=e[5],l}function ye(){const e=_.c(42),{org:t}=V(),[f,d]=P.useState(!1),[n,l]=P.useState(""),u=ie();let c;e[0]!==t.id||e[1]!==u?(c=async()=>{await u.call("ORGANIZATION_DELETE",{id:t.id})},e[0]=t.id,e[1]=u,e[2]=c):c=e[2];let r;e[3]!==t.id||e[4]!==t.slug?(r=()=>{B("organization_deleted",{organization_id:t.id}),localStorage.getItem(q.lastOrgSlug())===t.slug&&localStorage.removeItem(q.lastOrgSlug()),J(),w.success("Organization deleted"),window.location.href="/"},e[3]=t.id,e[4]=t.slug,e[5]=r):r=e[5];let m;e[6]!==c||e[7]!==r?(m={mutationFn:c,onSuccess:r,onError:Se},e[6]=c,e[7]=r,e[8]=m):m=e[8];const s=K(m);let o;e[9]===Symbol.for("react.memo_cache_sentinel")?(o=()=>d(!0),e[9]=o):o=e[9];let i;e[10]!==s.isPending?(i=a.jsx(R,{title:"Danger Zone",description:"Irreversible actions that affect your entire organization.",children:a.jsx(L,{className:"border-destructive/40",children:a.jsx(D,{title:"Delete organization",description:"Permanently delete this organization and all of its data. This action cannot be undone.",action:a.jsx(H,{variant:"destructive",size:"sm",onClick:o,disabled:s.isPending,children:"Delete"})})})}),e[10]=s.isPending,e[11]=i):i=e[11];let x;e[12]===Symbol.for("react.memo_cache_sentinel")?(x=N=>{d(N),N||l("")},e[12]=x):x=e[12];let p;e[13]===Symbol.for("react.memo_cache_sentinel")?(p=a.jsx(re,{children:"Delete Organization?"}),e[13]=p):p=e[13];let h;e[14]!==t.name?(h=a.jsxs("p",{children:["This will permanently delete all data associated with"," ",a.jsx("span",{className:"font-medium text-foreground",children:t.name}),". This action cannot be undone."]}),e[14]=t.name,e[15]=h):h=e[15];let j;e[16]!==t.name?(j=a.jsxs("p",{className:"mt-3 mb-1.5",children:["Type"," ",a.jsx("span",{className:"font-medium text-foreground",children:t.name})," ","to confirm:"]}),e[16]=t.name,e[17]=j):j=e[17];let b;e[18]===Symbol.for("react.memo_cache_sentinel")?(b=N=>l(N.target.value),e[18]=b):b=e[18];let g;e[19]!==n||e[20]!==t.name?(g=a.jsx(U,{value:n,onChange:b,placeholder:t.name,autoFocus:!0}),e[19]=n,e[20]=t.name,e[21]=g):g=e[21];let v;e[22]!==g||e[23]!==h||e[24]!==j?(v=a.jsxs(le,{children:[p,a.jsx(ce,{asChild:!0,children:a.jsxs("div",{children:[h,j,g]})})]}),e[22]=g,e[23]=h,e[24]=j,e[25]=v):v=e[25];let O;e[26]===Symbol.for("react.memo_cache_sentinel")?(O=a.jsx(de,{children:"Cancel"}),e[26]=O):O=e[26];let y;e[27]!==s?(y=()=>s.mutate(),e[27]=s,e[28]=y):y=e[28];const E=n!==t.name||s.isPending,T=s.isPending?"Deleting…":"Delete organization";let S;e[29]!==y||e[30]!==E||e[31]!==T?(S=a.jsxs(ue,{children:[O,a.jsx(me,{onClick:y,disabled:E,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:opacity-50",children:T})]}),e[29]=y,e[30]=E,e[31]=T,e[32]=S):S=e[32];let z;e[33]!==v||e[34]!==S?(z=a.jsxs(ge,{children:[v,S]}),e[33]=v,e[34]=S,e[35]=z):z=e[35];let C;e[36]!==f||e[37]!==z?(C=a.jsx(fe,{open:f,onOpenChange:x,children:z}),e[36]=f,e[37]=z,e[38]=C):C=e[38];let A;return e[39]!==C||e[40]!==i?(A=a.jsxs(a.Fragment,{children:[i,C]}),e[39]=C,e[40]=i,e[41]=A):A=e[41],A}function Se(e){w.error(e instanceof Error?e.message:"Failed to delete organization")}function ze(){const e=_.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=a.jsx(k,{children:a.jsx(k.Content,{children:a.jsx(k.Body,{children:a.jsxs(te,{children:[a.jsx(k.Title,{children:"Organization"}),a.jsx(be,{}),a.jsx(ae,{}),a.jsx(ve,{}),a.jsx(ye,{})]})})})}),e[0]=t):t=e[0],t}function tt(){const e=_.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=a.jsx(pe,{capability:"org:manage",area:"general settings",children:a.jsx(ze,{})}),e[0]=t):t=e[0],t}export{tt as default};
@@ -1 +0,0 @@
1
- import{c as H,j as t,D as J,a as ie,m as Y,r as $,P as q,i as U,d as ee,t as L,dV as ae,K as F,k as le,B as ce,l as V,q as ue,a2 as de}from"./index-d52A49fX.js";import{c as me,a as fe,d as pe,e as ge}from"./dialog-C2MVTIBt.js";import{C as W}from"./checkbox-D2NBps_s.js";import{C as xe}from"./collection-search-BHb176G9.js";import{u as he}from"./use-debounced-value-DxBLMeqg.js";import{b as te,u as ye}from"./use-connection-BLVjIktc.js";import{u as D}from"./use-mcp-client-QTh-uqf4.js";import{W as be,S as ne}from"./constants-nH3qQ_1f.js";import{a as se}from"./authenticate-and-persist-oauth-ezeRyKPp.js";import{b as oe}from"./Settings02-COfrOHpp.js";import{y as we}from"./agent-icon-BvZm1osM.js";import{u as Ne}from"./use-mcp-tools-BTYjbm6L.js";import{e as Ce}from"./extract-connection-data-Dq7vx8cX.js";import{u as je}from"./use-navigate-to-agent-CaUSC1CF.js";import{f as Ie}from"./github-installations-DzN1UQ4x.js";const B={contents:"write",metadata:"read",pull_requests:"write",issues:"write"};function Se(s){if(!s||typeof s!="object"||Array.isArray(s))return B;const e=s;return Object.values(e).some(n=>typeof n!="string")?B:e}function ve(s){if(!(typeof s!="number"||!Number.isFinite(s)||!Number.isInteger(s)||s<=0))return s}function Ee(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=ve(e.repositoryId);return{sourceConnectionId:typeof e.sourceConnectionId=="string"?e.sourceConnectionId:void 0,installationId:e.installationId,repositoryId:n,owner:e.owner,repo:e.repo,permissions:Se(e.permissions),grantProvider:e.grantProvider==="github-mcp"?"github-mcp":void 0}}function Te(s){return(s??[]).filter(e=>Ee(e)===null)}function rt(s){return s.metadata?.orgShared===!0}function z(s){const e=H.c(4),{size:n,className:o}=s;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=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]=l):l=e[0];let d;return e[1]!==o||e[2]!==n?(d=t.jsx("svg",{width:n,height:n,viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:o,children:l}),e[1]=o,e[2]=n,e[3]=d):d=e[3],d}function ke(s,e){const n=H.c(12),{org:o}=J();let l;n[0]!==o.id?(l=be.REGISTRY(o.id),n[0]=o.id,n[1]=l):l=n[1];const d=l;let f;n[2]!==o.id||n[3]!==o.slug||n[4]!==d?(f={connectionId:d,orgId:o.id,orgSlug:o.slug},n[2]=o.id,n[3]=o.slug,n[4]=d,n[5]=f):f=n[5];const m=D(f);let p;n[6]!==s?(p={name:s},n[6]=s,n[7]=p):p=n[7];const b=e?.enabled??!0;let i;return n[8]!==m||n[9]!==p||n[10]!==b?(i={client:m,toolName:"COLLECTION_REGISTRY_APP_GET",toolArguments:p,enabled:b,staleTime:3e5,select:_e},n[8]=m,n[9]=p,n[10]=b,n[11]=i):i=n[11],Ne(i)}function _e(s){return s.structuredContent?.item??null}const Ae="deco/mcp-github";function Re(s){const{org:e}=J(),{data:n}=ie.useSession(),o=te(),l=Y(),[d,f]=$.useState("idle"),[m,p]=$.useState(null),[b,i]=$.useState(null),{data:h,isLoading:c}=ke(Ae,{enabled:s.enabled}),g=$.useRef(!1);s.enabled&&h&&!c&&!g.current&&n?.user?.id&&d==="idle"&&(g.current=!0,w());async function w(){if(!(!h||!n?.user?.id||!e))try{f("installing"),p(null);const N=Ce(h,e.id,n.user.id,{remoteIndex:0});if(!N.connection_url)throw new Error("Registry item is missing a remote URL for mcp-github");const{id:x}=await o.create.mutateAsync(N);f("authenticating");const u=await se({connectionId:x,orgId:e.id,orgSlug:e.slug,persistFallback:a=>o.update.mutateAsync({id:x,data:{connection_token:a}}).then(()=>{})});if(u.ran&&!u.ok){try{await o.delete.mutateAsync(x)}catch{}throw new Error(u.error&&u.error!=="no token received"?u.error:"No token received from GitHub")}q(l,e.id),i(N),f("ready")}catch(N){p(N instanceof Error?N.message:String(N)),f("error")}}function j(){f("idle"),p(null),i(null),g.current=!1}return s.enabled&&c&&d==="idle"?{status:"installing",error:null,connection:null,retry:j}:{status:d,error:m,connection:b,retry:j}}const K=[{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 l of Object.keys(s.paramsSchema))n.add(l);if(Array.isArray(s.params))for(const l of s.params)n.add(l.name);else if(s.params&&typeof s.params=="object")for(const l of Object.keys(s.params))n.add(l);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:l,selectedKeys:d}){const f=await s({name:"TRIGGER_LIST",arguments:{}}),m=f.structuredContent??f,p=new Map((m.triggers??[]).map(c=>[c.type,c])),b=K.filter(c=>d.has(c.key)),i=await Promise.allSettled(b.map(async c=>{const g=p.get(c.triggerType);if(!g)throw new Error(`Trigger ${c.triggerType} not exposed`);const w=await e({name:"AUTOMATION_CREATE",arguments:{name:`${o.name}: ${c.nameSuffix}`,virtual_mcp_id:n,messages:c.instructions(o),active:!0}}),j=(w.structuredContent??w).id;if(!j)throw new Error(`AUTOMATION_CREATE returned no id for ${c.key}`);await e({name:"AUTOMATION_TRIGGER_ADD",arguments:{automation_id:j,type:"event",connection_id:l,event_type:c.triggerType,params:Oe(g,o)}})})),h=i.filter(c=>c.status==="rejected").length;return h>0&&console.error("Some GitHub automations failed to set up:",i.filter(c=>c.status==="rejected")),{total:i.length,failed:h}}const X="GitHub MCP did not return refreshable repo grant metadata";function M(s){if(typeof s!="string")return null;const e=s.trim();return e.length>0?e:null}function Pe(s){try{const e=new URL(s);return(e.protocol==="http:"||e.protocol==="https:")&&!e.username&&!e.password}catch{return!1}}function $e(s){return typeof s=="number"&&Number.isFinite(s)&&Number.isInteger(s)&&s>0?s:void 0}async function Z(s){const{orgSlug:e,sourceConnection:n,installationId:o,owner:l,repo:d,githubCallTool:f,selfCallTool:m,orgShared:p}=s,b=await f({name:"MINT_REPO_TOKEN",arguments:{installationId:o,owner:l,repo:d,permissions:B}}),i=b.structuredContent;if(b.isError||!i?.token){const y=b.content?.find(T=>T.type==="text")?.text;throw new Error(y?`Failed to mint a repo-scoped GitHub token: ${y}`:"Failed to mint a repo-scoped GitHub token")}const h=M(i.refreshToken),c=M(i.tokenEndpoint),g=M(i.clientId);if(!h||!c||!g)throw new Error(X);if(!Pe(c))throw new Error(X);const w=M(i.repository?.owner),j=M(i.repository?.name),N="GitHub MCP returned refresh metadata for a different repository";if(i.repository?.owner!==void 0&&(!w||w.toLowerCase()!==l.toLowerCase()))throw new Error(N);if(i.repository?.name!==void 0&&(!j||j.toLowerCase()!==d.toLowerCase()))throw new Error(N);const C=$e(i.repository?.id),x=i.expiresAt?Date.parse(i.expiresAt):NaN,u=Number.isFinite(x)?Math.max(0,Math.floor((x-Date.now())/1e3)):null,I=(typeof i.expiresIn=="number"&&Number.isFinite(i.expiresIn)&&Number.isInteger(i.expiresIn)&&i.expiresIn>0?i.expiresIn:null)??u,v=await m({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:{title:`GitHub: ${l}/${d}`,description:`Repo-scoped GitHub access for ${l}/${d}`,icon:n.icon,app_name:n.app_name,app_id:n.app_id,connection_type:n.connection_type,connection_url:n.connection_url,metadata:{...p?{orgShared:!0}:{},repoScope:{installationId:o,repositoryId:C,owner:l,repo:d,permissions:B,grantProvider:"github-mcp"}}}}}),S=v.structuredContent??v,E=S.item?.id??S.id;if(!E)throw new Error("Failed to create the repo-scoped GitHub connection");if(!(await fetch(`/api/${e}/connections/${E}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:i.token,refreshToken:h,expiresIn:I,scope:i.scope??null,clientId:g,tokenEndpoint:c})})).ok)throw await m({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:E,force:!0}}).catch(()=>{}),new Error("Failed to persist the repo-scoped token");return{childConnectionId:E}}function it(s){const e=H.c(23),{open:n,onOpenChange:o,title:l,hideAutoRespondCheckbox:d,onImportComplete:f,mode:m}=s,p=d===void 0?!1:d,b=m===void 0?"agent":m,i=l??(b==="connection"?"Add repo":"Import from GitHub"),[h,c]=$.useState(null);let g;e[0]!==i?(g=t.jsx(me,{className:"sr-only",children:t.jsx(fe,{children:i})}),e[0]=i,e[1]=g):g=e[1];let w;e[2]!==i||e[3]!==h?(w=t.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3 shrink-0",children:h?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:()=>c(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(oe,{size:16})}),t.jsx("img",{src:h.avatarUrl,alt:h.login,className:"size-5 rounded-full ring-1 ring-border shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:h.login})]}):t.jsxs(t.Fragment,{children:[t.jsx(z,{className:"size-4 text-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:i})]})}),e[2]=i,e[3]=h,e[4]=w):w=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(U,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=j):j=e[5];let N;e[6]!==o?(N=()=>o(!1),e[6]=o,e[7]=N):N=e[7];const C=p||b==="connection";let x;e[8]!==b||e[9]!==f||e[10]!==n||e[11]!==h||e[12]!==N||e[13]!==C?(x=t.jsx("div",{className:"flex-1 overflow-hidden flex flex-col min-w-0",children:t.jsx($.Suspense,{fallback:j,children:t.jsx(He,{open:n,onComplete:N,selectedInstallation:h,onSelectInstallation:c,hideAutoRespondCheckbox:C,onImportComplete:f,mode:b})})}),e[8]=b,e[9]=f,e[10]=n,e[11]=h,e[12]=N,e[13]=C,e[14]=x):x=e[14];let u;e[15]!==g||e[16]!==w||e[17]!==x?(u=t.jsxs(pe,{className:"sm:max-w-[560px] h-[85svh] sm:h-[520px] p-0 gap-0 overflow-hidden flex flex-col",children:[g,w,x]}),e[15]=g,e[16]=w,e[17]=x,e[18]=u):u=e[18];let a;return e[19]!==o||e[20]!==n||e[21]!==u?(a=t.jsx(ge,{open:n,onOpenChange:o,children:u}),e[19]=o,e[20]=n,e[21]=u,e[22]=a):a=e[22],a}function He({open:s,onComplete:e,selectedInstallation:n,onSelectInstallation:o,hideAutoRespondCheckbox:l,onImportComplete:d,mode:f="agent"}){const{org:m}=J(),p=Y(),b=je(),[i,h]=$.useState(null),[c,g]=$.useState(!0),[w,j]=$.useState(()=>new Set(K.filter(r=>r.defaultEnabled).map(r=>r.key))),N=K.filter(r=>r.defaultEnabled).map(r=>r.key),C=l?new Set(N):c?w:new Set,x=ye({slug:"mcp-github"}),u=Te(x),a=Re({enabled:s&&u.length===0}),I=u.length===1?u[0]??null:i,v=D({connectionId:I?.id??"",orgId:m.id,orgSlug:m.slug}),S=D({connectionId:ne,orgId:m.id,orgSlug:m.slug}),E=async(r,k)=>{try{const P=await v.callTool({name:"get_file_contents",arguments:{owner:r.owner,repo:r.name,path:k}});if(P.isError)return null;const O=P.content?.find(G=>G.type==="resource")?.resource?.text;if(!O)return null;try{const G=JSON.parse(O);return typeof G=="string"?G:JSON.stringify(G)}catch{return O}}catch{return null}},_=(r,k)=>{Promise.all([E(k,"AGENTS.md"),E(k,"CLAUDE.md")]).then(async([A,P])=>{const R=A??P??null;R&&(await S.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:r,data:{metadata:{instructions:R}}}}),q(p,m.id))}).catch(A=>{console.error("GitHub instructions fetch failed:",A)})},y=async({virtualMcpId:r,repo:k,connectionId:A,selectedKeys:P})=>{const{total:R,failed:O}=await Ge({githubCallTool:G=>v.callTool(G),selfCallTool:G=>S.callTool(G),virtualMcpId:r,repo:k,connectionId:A,selectedKeys:P});O>0&&L.warning(`Set up ${R-O}/${R} GitHub automations. Add the rest from the automations view.`)},T=ee({mutationFn:async r=>{if(!I||!n)throw new Error("No GitHub connection or installation");const k=n.installationId;if(f==="connection"){const{childConnectionId:R}=await Z({orgSlug:m.slug,sourceConnection:I,installationId:k,owner:r.owner,repo:r.name,githubCallTool:O=>v.callTool(O),selfCallTool:O=>S.callTool(O),orgShared:!0});return{virtualMcpId:null,repo:r,connectionId:R,item:null}}const{childConnectionId:A}=await Z({orgSlug:m.slug,sourceConnection:I,installationId:k,owner:r.owner,repo:r.name,githubCallTool:R=>v.callTool(R),selfCallTool:R=>S.callTool(R)});let P=null;try{const R=await S.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:r.name,description:r.description||"Imported from GitHub",pinned:!1,icon:null,metadata:{githubRepo:{owner:r.owner,name:r.name,url:r.url,installationId:k,connectionId:A},instructions:null,ui:{pinnedViews:null,layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}},connections:[{connection_id:A}]}}}),O=R.structuredContent??R,G=O.item?.id;if(!O.item||!G)throw new Error("Failed to create the imported agent");return P=G,C.size>0&&await y({virtualMcpId:G,repo:r,connectionId:A,selectedKeys:C}).catch(re=>{console.error("Failed to set up GitHub automations:",re),L.warning("Imported repo, but failed to set up GitHub automations. You can add triggers manually from the automations view.")}),{virtualMcpId:G,repo:r,connectionId:A,item:O.item}}catch(R){throw P&&await S.callTool({name:"COLLECTION_VIRTUAL_MCP_DELETE",arguments:{id:P}}).catch(()=>{}),await S.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:A,force:!0}}).catch(()=>{}),R}},onSuccess:({virtualMcpId:r,repo:k,connectionId:A,item:P})=>{if(f==="connection"||!r||!P){q(p,m.id),ae(p,m.id),L.success(`Added ${k.name}`),e();return}if(p.setQueryData(F.collectionItem(S,m.id,"","VIRTUAL_MCP",r),{item:P}),q(p,m.id),_(r,k),d){d({virtualMcpId:r,repo:k,connectionId:A});return}L.success(`Imported ${k.name} from GitHub`),e(),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),b(r)},onError:r=>{L.error("Failed to import repo: "+(r instanceof Error?r.message:"Unknown error"))}});return a.status==="installing"||a.status==="authenticating"?t.jsx(Q,{status:a.status,error:null,retry:a.retry}):a.status==="error"?t.jsx(Q,{status:"error",error:a.error,retry:a.retry}):u.length===0&&a.status==="idle"?t.jsx(Q,{status:"installing",error:null,retry:a.retry}):u.length>1&&!I?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"})}),u.map(r=>t.jsxs("button",{type:"button",onClick:()=>h(r),className:"flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left",children:[r.icon?t.jsx("img",{src:r.icon,alt:r.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(z,{className:"size-3.5 text-muted-foreground"})}),t.jsx("span",{className:"text-sm font-medium",children:r.title})]},r.id))]}):I?n?t.jsx(Fe,{connectionId:I.id,orgId:m.id,orgSlug:m.slug,installation:n,onSelectRepo:r=>T.mutate(r),isSaving:T.isPending,autoRespondEnabled:c,onAutoRespondChange:g,selectedAutomationKeys:w,onAutomationKeysChange:j,hideAutoRespondCheckbox:l}):t.jsx(Le,{connectionId:I.id,orgId:m.id,orgSlug:m.slug,onSelect:o,showBackButton:u.length>1,onBack:()=>h(null)}):null}function Le(s){const e=H.c(47),{connectionId:n,orgId:o,orgSlug:l,onSelect:d,showBackButton:f,onBack:m}=s;let p;e[0]!==o||e[1]!==l?(p={connectionId:ne,orgId:o,orgSlug:l},e[0]=o,e[1]=l,e[2]=p):p=e[2];const b=D(p),i=Y(),h=te();let c;e[3]!==n||e[4]!==o?(c=F.githubUserOrgs(o,n),e[3]=n,e[4]=o,e[5]=c):c=e[5];let g;e[6]!==n||e[7]!==b?(g=()=>Ie(y=>b.callTool(y),n),e[6]=n,e[7]=b,e[8]=g):g=e[8];let w;e[9]!==c||e[10]!==g?(w={queryKey:c,queryFn:g},e[9]=c,e[10]=g,e[11]=w):w=e[11];const j=le(w);let N;e[12]!==h||e[13]!==n||e[14]!==j||e[15]!==o||e[16]!==l||e[17]!==i?(N={mutationFn:async()=>{const y=await se({connectionId:n,orgId:o,orgSlug:l,persistFallback:r=>h.update.mutateAsync({id:n,data:{connection_token:r}}).then(Me)});if(y.ran&&!y.ok)throw new Error(y.error??"no token received");const T=new URL(`/api/${l}/mcp/${n}`,window.location.origin);await i.invalidateQueries({queryKey:F.isMCPAuthenticated(T.href,null)}),await i.invalidateQueries({queryKey:F.mcpClientPrefix()}),await j.refetch()},onError:ze},e[12]=h,e[13]=n,e[14]=j,e[15]=o,e[16]=l,e[17]=i,e[18]=N):N=e[18];const C=ee(N);if(j.isLoading){let y;return e[19]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(U,{size:18,className:"animate-spin text-muted-foreground"})}),e[19]=y):y=e[19],y}if(j.isError){let y,T;e[20]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx("p",{className:"text-sm text-destructive",children:"Failed to load GitHub accounts"}),T=t.jsx("p",{className:"text-xs text-muted-foreground max-w-[280px] leading-relaxed",children:"Your GitHub connection may have expired. Reconnect to restore access."}),e[20]=y,e[21]=T):(y=e[20],T=e[21]);let r;e[22]!==C?(r=()=>C.mutate(),e[22]=C,e[23]=r):r=e[23];let k;e[24]!==C.isPending?(k=C.isPending?t.jsx(U,{size:14,className:"animate-spin"}):t.jsx(z,{className:"size-3.5"}),e[24]=C.isPending,e[25]=k):k=e[25];let A;return e[26]!==C.isPending||e[27]!==r||e[28]!==k?(A=t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 text-center",children:[y,T,t.jsxs(ce,{type:"button",variant:"outline",size:"sm",onClick:r,disabled:C.isPending,children:[k,"Reconnect GitHub"]})]}),e[26]=C.isPending,e[27]=r,e[28]=k,e[29]=A):A=e[29],A}const x=j.data;if(!x)return null;let u;e[30]!==m||e[31]!==f?(u=f&&t.jsx("div",{className:"flex items-center gap-1 px-4 pt-3 pb-1 shrink-0",children:t.jsxs("button",{type:"button",onClick:m,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(oe,{size:12}),"Change connection"]})}),e[30]=m,e[31]=f,e[32]=u):u=e[32];let a;if(e[33]!==x.installations||e[34]!==d){let y;e[36]!==d?(y=T=>t.jsxs("button",{type:"button",onClick:()=>d(T),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:T.avatarUrl,alt:T.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:T.login}),T.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 →"})]},T.installationId),e[36]=d,e[37]=y):y=e[37],a=x.installations.map(y),e[33]=x.installations,e[34]=d,e[35]=a}else a=e[35];let I;e[38]!==a?(I=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden [scrollbar-gutter:stable]",children:a}),e[38]=a,e[39]=I):I=e[39];const v=x.appSlug?`https://github.com/apps/${x.appSlug}/installations/new`:"https://github.com/settings/installations";let S;e[40]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx("span",{className:"underline underline-offset-2",children:"Install the GitHub App"}),e[40]=S):S=e[40];let E;e[41]!==v?(E=t.jsx("div",{className:"px-4 py-3 border-t border-border shrink-0",children:t.jsxs("a",{href:v,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:["Account not listed?"," ",S]})}),e[41]=v,e[42]=E):E=e[42];let _;return e[43]!==E||e[44]!==u||e[45]!==I?(_=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[u,I,E]}),e[43]=E,e[44]=u,e[45]=I,e[46]=_):_=e[46],_}function ze(s){L.error("Failed to reconnect GitHub: "+(s instanceof Error?s.message:"Unknown error"))}function Me(){}function Fe(s){const e=H.c(27),{connectionId:n,orgId:o,orgSlug:l,installation:d,onSelectRepo:f,isSaving:m,autoRespondEnabled:p,onAutoRespondChange:b,selectedAutomationKeys:i,onAutomationKeysChange:h,hideAutoRespondCheckbox:c}=s,[g,w]=$.useState(""),j=he(g,300),N=$.useDeferredValue(j),C=g!==N;let x;e[0]!==C||e[1]!==g?(x=t.jsx(xe,{placeholder:"Search repositories...",value:g,onChange:w,isSearching:C}),e[0]=C,e[1]=g,e[2]=x):x=e[2];const u=C?"opacity-40":"opacity-100";let a;e[3]!==u?(a=V("flex-1 overflow-hidden flex flex-col transition-opacity duration-150",u),e[3]=u,e[4]=a):a=e[4];let I;e[5]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(U,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=I):I=e[5];let v;e[6]!==n||e[7]!==N||e[8]!==d||e[9]!==m||e[10]!==f||e[11]!==o||e[12]!==l?(v=t.jsx($.Suspense,{fallback:I,children:t.jsx(Ue,{connectionId:n,orgId:o,orgSlug:l,installation:d,query:N,onSelectRepo:f,isSaving:m})}),e[6]=n,e[7]=N,e[8]=d,e[9]=m,e[10]=f,e[11]=o,e[12]=l,e[13]=v):v=e[13];let S;e[14]!==a||e[15]!==v?(S=t.jsx("div",{className:a,children:v}),e[14]=a,e[15]=v,e[16]=S):S=e[16];let E;e[17]!==p||e[18]!==c||e[19]!==b||e[20]!==h||e[21]!==i?(E=!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(W,{checked:p,onCheckedChange:y=>b(y===!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:K.map(y=>t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[t.jsx(W,{checked:i.has(y.key),onCheckedChange:T=>{const r=new Set(i);T===!0?r.add(y.key):r.delete(y.key),h(r)}}),t.jsx("span",{className:"text-xs text-muted-foreground",children:y.label})]},y.key))})]}),e[17]=p,e[18]=c,e[19]=b,e[20]=h,e[21]=i,e[22]=E):E=e[22];let _;return e[23]!==x||e[24]!==S||e[25]!==E?(_=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[x,S,E]}),e[23]=x,e[24]=S,e[25]=E,e[26]=_):_=e[26],_}function Ue(s){const e=H.c(29),{connectionId:n,orgId:o,orgSlug:l,installation:d,query:f,onSelectRepo:m,isSaving:p}=s;let b;e[0]!==n||e[1]!==o||e[2]!==l?(b={connectionId:n,orgId:o,orgSlug:l},e[0]=n,e[1]=o,e[2]=l,e[3]=b):b=e[3];const i=D(b),h=d.type==="User"?"user":"org",c=f?`${h}:${d.login} ${f} in:name`:`${h}:${d.login}`;let g;e[4]!==n||e[5]!==d.login||e[6]!==o||e[7]!==f?(g=F.githubOrgRepos(o,n,d.login,f),e[4]=n,e[5]=d.login,e[6]=o,e[7]=f,e[8]=g):g=e[8];let w;e[9]!==i||e[10]!==c?(w=async u=>{const{signal:a}=u,v=(await i.callTool({name:"search_repositories",arguments:{query:c,page:1,perPage:30}},void 0,{signal:a})).content?.[0]?.text;if(!v)throw new Error("No response from search_repositories");return(JSON.parse(v).items??[]).map(De)},e[9]=i,e[10]=c,e[11]=w):w=e[11];let j;e[12]!==g||e[13]!==w?(j={queryKey:g,queryFn:w},e[12]=g,e[13]=w,e[14]=j):j=e[14];const{data:N}=ue(j);if(N.length===0){let u;e[15]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("p",{className:"text-sm text-muted-foreground",children:"No repositories found"}),e[15]=u):u=e[15];let a;e[16]!==f?(a=f&&t.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Try a different search term"}),e[16]=f,e[17]=a):a=e[17];let I;return e[18]!==a?(I=t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-1",children:[u,a]}),e[18]=a,e[19]=I):I=e[19],I}let C;if(e[20]!==p||e[21]!==m||e[22]!==N){let u;e[24]!==p||e[25]!==m?(u=a=>t.jsxs("button",{type:"button",onClick:()=>m(a),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(z,{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:a.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:[a.private?t.jsx(de,{size:10}):t.jsx(we,{size:10}),a.private?"Private":"Public"]})]},a.fullName),e[24]=p,e[25]=m,e[26]=u):u=e[26],C=N.map(u),e[20]=p,e[21]=m,e[22]=N,e[23]=C}else C=e[23];let x;return e[27]!==C?(x=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden flex flex-col [scrollbar-gutter:stable]",children:C}),e[27]=C,e[28]=x):x=e[28],x}function De(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=H.c(33),{status:n,error:o,retry:l}=s;if(n==="error"){let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx("div",{className:"size-10 rounded-full bg-destructive/10 flex items-center justify-center",children:t.jsx(z,{className:"size-5 text-destructive"})}),e[0]=v):v=e[0];let S;e[1]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx("p",{className:"text-sm font-medium",children:"Connection failed"}),e[1]=S):S=e[1];const E=o??"Something went wrong while connecting to GitHub.";let _;e[2]!==E?(_=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[S,t.jsx("p",{className:"text-xs text-muted-foreground max-w-[260px] leading-relaxed",children:E})]}),e[2]=E,e[3]=_):_=e[3];let y;e[4]!==l?(y=t.jsx("button",{type:"button",onClick:l,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]=l,e[5]=y):y=e[5];let T;return e[6]!==_||e[7]!==y?(T=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[v,_,y]}),e[6]=_,e[7]=y,e[8]=T):T=e[8],T}const d=n==="authenticating";let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("div",{className:"size-10 rounded-full bg-muted flex items-center justify-center",children:t.jsx(z,{className:"size-5 text-foreground"})}),e[9]=f):f=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs("div",{className:"relative size-10",children:[f,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(U,{size:12,className:"animate-spin text-muted-foreground"})})]}),e[10]=m):m=e[10];const p=d?"Authenticating with GitHub":"Setting up GitHub";let b;e[11]!==p?(b=t.jsx("p",{className:"text-sm font-medium",children:p}),e[11]=p,e[12]=b):b=e[12];const i=d?"Complete the OAuth flow in your browser":"Installing the GitHub connection...";let h;e[13]!==i?(h=t.jsx("p",{className:"text-xs text-muted-foreground",children:i}),e[13]=i,e[14]=h):h=e[14];let c;e[15]!==b||e[16]!==h?(c=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[b,h]}),e[15]=b,e[16]=h,e[17]=c):c=e[17];const g=d?"bg-muted-foreground/30":"bg-foreground animate-pulse";let w;e[18]!==g?(w=V("size-1.5 rounded-full",g),e[18]=g,e[19]=w):w=e[19];let j;e[20]!==w?(j=t.jsx("span",{className:w}),e[20]=w,e[21]=j):j=e[21];const N=d?"bg-foreground animate-pulse":"bg-muted-foreground/30";let C;e[22]!==N?(C=V("size-1.5 rounded-full",N),e[22]=N,e[23]=C):C=e[23];let x;e[24]!==C?(x=t.jsx("span",{className:C}),e[24]=C,e[25]=x):x=e[25];let u;e[26]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("span",{className:"size-1.5 rounded-full bg-muted-foreground/30"}),e[26]=u):u=e[26];let a;e[27]!==j||e[28]!==x?(a=t.jsxs("div",{className:"flex items-center gap-1.5",children:[j,x,u]}),e[27]=j,e[28]=x,e[29]=a):a=e[29];let I;return e[30]!==a||e[31]!==c?(I=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[m,c,a]}),e[30]=a,e[31]=c,e[32]=I):I=e[32],I}export{it as G,z as a,Te as b,Ee as g,rt as i,Z as p,Re as u};