decocms 2.167.0 → 2.167.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 (235) hide show
  1. package/dist/client/assets/{AlertCircle-48gOoEWA.js → AlertCircle-CRefRGB6.js} +1 -1
  2. package/dist/client/assets/{AlignLeft-CKoC1cMY.js → AlignLeft-DCeZyfUv.js} +1 -1
  3. package/dist/client/assets/{ArrowDown-_L7cw1A8.js → ArrowDown-Ddd2bFCq.js} +1 -1
  4. package/dist/client/assets/{ArrowLeft-jV1c6x3k.js → ArrowLeft-COkllC0A.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-DKc3SUsQ.js → ArrowUp-D8-wpLhK.js} +1 -1
  6. package/dist/client/assets/{Check-BWCeXHN7.js → Check-DFFtcHrw.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-DZcEBbaZ.js → CheckCircle-DFbYHiLE.js} +1 -1
  8. package/dist/client/assets/{CheckDone01-CsC_Ltj-.js → CheckDone01-JzYSoDE1.js} +1 -1
  9. package/dist/client/assets/{CheckVerified02-UCZI60jf.js → CheckVerified02-DfPGhpKJ.js} +1 -1
  10. package/dist/client/assets/{ChevronDown-B15SC8MA.js → ChevronDown-DkB2aRG4.js} +1 -1
  11. package/dist/client/assets/{ChevronLeft-BjnPH80Y.js → ChevronLeft-BGM38xu6.js} +1 -1
  12. package/dist/client/assets/{ChevronRight-DNq10e3Z.js → ChevronRight-ACRFNNEg.js} +1 -1
  13. package/dist/client/assets/{ChevronUp-Be0WocGY.js → ChevronUp-Bs9Ot1hj.js} +1 -1
  14. package/dist/client/assets/{Clock-CbBdVVok.js → Clock-VRCh834Q.js} +1 -1
  15. package/dist/client/assets/{Code01-BDvBTEm7.js → Code01-C8PssGbH.js} +1 -1
  16. package/dist/client/assets/{Coins01-CGSgNFIJ.js → Coins01-TB9HLbQn.js} +1 -1
  17. package/dist/client/assets/{Container-C4I-ZzWI.js → Container-B7oSS_-y.js} +1 -1
  18. package/dist/client/assets/{Copy01-BJVPuQbm.js → Copy01-CgUyGO9-.js} +1 -1
  19. package/dist/client/assets/{Dataflow03-CdPLEX-g.js → Dataflow03-8QP7Bqkf.js} +1 -1
  20. package/dist/client/assets/{DotsHorizontal-zwvwj18G.js → DotsHorizontal-DP-ax0xe.js} +1 -1
  21. package/dist/client/assets/{DotsVertical-DUf6cEvO.js → DotsVertical-D0oq2fjv.js} +1 -1
  22. package/dist/client/assets/{Download01-BwJBKvsx.js → Download01-DfOkRvOp.js} +1 -1
  23. package/dist/client/assets/{Edit01-BM5GDmTx.js → Edit01-odlMa8iv.js} +1 -1
  24. package/dist/client/assets/{Edit05-FVXfLA6i.js → Edit05-BbP5Wuhr.js} +1 -1
  25. package/dist/client/assets/{Eye-DkD5as17.js → Eye-DvVdD51j.js} +1 -1
  26. package/dist/client/assets/{EyeOff-BeKLPveV.js → EyeOff-CuPz9L1S.js} +1 -1
  27. package/dist/client/assets/{File02-C6fFP8wJ.js → File02-Cj1i35zl.js} +1 -1
  28. package/dist/client/assets/{File06-NiquJK6U.js → File06-DT_blB7L.js} +1 -1
  29. package/dist/client/assets/{FilterLines-Cn-l4hcD.js → FilterLines-DIdq4C3O.js} +1 -1
  30. package/dist/client/assets/{Globe01-oM7Jrrrb.js → Globe01-De8m2Ley.js} +1 -1
  31. package/dist/client/assets/{Globe02-BtYVEi0C.js → Globe02-C_VB-hTP.js} +1 -1
  32. package/dist/client/assets/{Grid01-Cj17P1tC.js → Grid01-Sp0biDxT.js} +1 -1
  33. package/dist/client/assets/{Hash02-BdiI1XxB.js → Hash02-DVmJlk2n.js} +1 -1
  34. package/dist/client/assets/{Home02-BGdlx1AT.js → Home02-C6yMcBVZ.js} +1 -1
  35. package/dist/client/assets/{Image01-CHkBHANF.js → Image01-DqXOaj2A.js} +1 -1
  36. package/dist/client/assets/{Inbox01-BxbPwF62.js → Inbox01-BtrVazQu.js} +1 -1
  37. package/dist/client/assets/{InfoCircle-BqEmSE9k.js → InfoCircle-t2WPl417.js} +1 -1
  38. package/dist/client/assets/{Key01-Be9_ogDx.js → Key01-FZzH7KSv.js} +1 -1
  39. package/dist/client/assets/{LayersTwo01-CqPgQoaH.js → LayersTwo01-DpY-ll-F.js} +1 -1
  40. package/dist/client/assets/{LayoutLeft-z9_XAaYG.js → LayoutLeft-Bt0zvSW4.js} +1 -1
  41. package/dist/client/assets/{Link01-DXpyb1VQ.js → Link01-emFpE4io.js} +1 -1
  42. package/dist/client/assets/{LinkExternal01--09S5N5q.js → LinkExternal01-BDorTcHT.js} +1 -1
  43. package/dist/client/assets/{List-c0L2g9Qy.js → List-ClxAjgXZ.js} +1 -1
  44. package/dist/client/assets/{Loading01-BUlApwyE.js → Loading01-CmbgGBJZ.js} +1 -1
  45. package/dist/client/assets/{Lock01-D2mdnqp4.js → Lock01-Xr17_tjV.js} +1 -1
  46. package/dist/client/assets/{Play-a4a9k_A2.js → Play-DJ6yCSJw.js} +1 -1
  47. package/dist/client/assets/{Plus-CiuqWk7L.js → Plus-BYkvGXiG.js} +1 -1
  48. package/dist/client/assets/{RefreshCcw01-CpK4UKE8.js → RefreshCcw01-CS4ZawZZ.js} +1 -1
  49. package/dist/client/assets/{Save01-CGK6rW3l.js → Save01-egVkGifz.js} +1 -1
  50. package/dist/client/assets/{SearchMd-D_8XQU19.js → SearchMd-JEgBfhSx.js} +1 -1
  51. package/dist/client/assets/{Settings01-BXea0IX5.js → Settings01-D4taEXIn.js} +1 -1
  52. package/dist/client/assets/{Shield01-xSYnh-yR.js → Shield01-Dd_1pv5e.js} +1 -1
  53. package/dist/client/assets/{Terminal-CJ1WAC7b.js → Terminal-LTVNn-ZQ.js} +1 -1
  54. package/dist/client/assets/{Trash01-CHv5mU8b.js → Trash01-Cw6VFCl2.js} +1 -1
  55. package/dist/client/assets/{Upload01-CquOr5qE.js → Upload01-CN7lXpcp.js} +1 -1
  56. package/dist/client/assets/{Users03-DBQP_ao_.js → Users03-B92JA0ax.js} +1 -1
  57. package/dist/client/assets/{X-CC0aD5R8.js → X-Coju733X.js} +1 -1
  58. package/dist/client/assets/{XCircle-CuIPHDkx.js → XCircle-BwKPKfX4.js} +1 -1
  59. package/dist/client/assets/{XClose-B-kxIP35.js → XClose-B27D0Pes.js} +1 -1
  60. package/dist/client/assets/{Zap-w2d1hiBo.js → Zap-Bt5a3_xw.js} +1 -1
  61. package/dist/client/assets/{agent-connections-preview-dUyrsdf1.js → agent-connections-preview-BAKS5gJJ.js} +1 -1
  62. package/dist/client/assets/agent-detail-h81X2k4_.js +2 -0
  63. package/dist/client/assets/{agents-NISG8LkE.js → agents-C2VjCuoK.js} +1 -1
  64. package/dist/client/assets/{alert-dialog-CpiIzpaw.js → alert-dialog-BP-z4Ogy.js} +2 -2
  65. package/dist/client/assets/{auth-catchall-Dmbx7J6q.js → auth-catchall-D7kGH0lg.js} +1 -1
  66. package/dist/client/assets/automation-detail-BDUvniQC.js +1 -0
  67. package/dist/client/assets/{automations-CQIWjBPD.js → automations-CChtinnU.js} +1 -1
  68. package/dist/client/assets/{avatar-CbDE9O_w.js → avatar-BCqIRh9w.js} +1 -1
  69. package/dist/client/assets/{badge-BiElTurh.js → badge-CDP8kbvH.js} +1 -1
  70. package/dist/client/assets/{binder-DAywY5NR.js → binder-DCIUHgMq.js} +1 -1
  71. package/dist/client/assets/{breadcrumb-U9pZLesK.js → breadcrumb-jhLLcaSq.js} +1 -1
  72. package/dist/client/assets/{card-DXYG1PJt.js → card-Bby2NP30.js} +1 -1
  73. package/dist/client/assets/{chart-BbEOfgV-.js → chart-DSgLCPFS.js} +1 -1
  74. package/dist/client/assets/{checkbox-7ZiSm3FO.js → checkbox-CXNIiG-w.js} +1 -1
  75. package/dist/client/assets/{circle-alert-DJViAw6g.js → circle-alert-CK8igi7e.js} +1 -1
  76. package/dist/client/assets/{collapsible-B9yZLN6Y.js → collapsible-C7W88NZ4.js} +1 -1
  77. package/dist/client/assets/{collection-detail-Clb7680a.js → collection-detail-uSo4M9af.js} +2 -2
  78. package/dist/client/assets/{collection-display-button-BKC7veh8.js → collection-display-button-771l7C-D.js} +1 -1
  79. package/dist/client/assets/{collection-search-DwGryXKM.js → collection-search-BcxXiwnM.js} +1 -1
  80. package/dist/client/assets/{collection-tab-Bo-9KEsf.js → collection-tab-Ca4vJhb7.js} +1 -1
  81. package/dist/client/assets/{collection-table-wrapper-CLdf4mbp.js → collection-table-wrapper-DRSC2j3q.js} +1 -1
  82. package/dist/client/assets/{collection-tabs-CPmBQ0Ih.js → collection-tabs-VNdwgO9D.js} +1 -1
  83. package/dist/client/assets/{command-BvPYgT3U.js → command-Ce4RvYhe.js} +1 -1
  84. package/dist/client/assets/{connect-DfhSkdZH.js → connect-BK7xH19m.js} +1 -1
  85. package/dist/client/assets/{connection-card-C48yZP0o.js → connection-card-8C6CCQg8.js} +1 -1
  86. package/dist/client/assets/{connection-detail-UUX3N3PI.js → connection-detail-DCm0Gf7T.js} +1 -1
  87. package/dist/client/assets/{connection-status-EaZNPeGi.js → connection-status-D82b0hJj.js} +1 -1
  88. package/dist/client/assets/{connections-DuZzWjnz.js → connections-eH8HE_fN.js} +1 -1
  89. package/dist/client/assets/{constants-BtZ3fAEQ.js → constants-CzDvwmSY.js} +1 -1
  90. package/dist/client/assets/constants-o-H0wcv5.js +1 -0
  91. package/dist/client/assets/context-DWa5-aY3.js +21 -0
  92. package/dist/client/assets/{create-organization-dialog-CUI7nss-.js → create-organization-dialog-D8Pt61pM.js} +1 -1
  93. package/dist/client/assets/{create-project-dialog-DI59mOlr.js → create-project-dialog-KRfVbR_V.js} +1 -1
  94. package/dist/client/assets/{danger-CgyY9J87.js → danger-lBuPJ9ow.js} +1 -1
  95. package/dist/client/assets/{danger-zone-CDTRHqoC.js → danger-zone-DwgtnkJb.js} +1 -1
  96. package/dist/client/assets/decopilot-events-Brt4gAR6.js +1 -0
  97. package/dist/client/assets/{dependencies-C-LUznBo.js → dependencies-ByapbBJ1.js} +1 -1
  98. package/dist/client/assets/dialog-DVrvUtp4.js +1 -0
  99. package/dist/client/assets/{dropdown-menu-W_lhWsM7.js → dropdown-menu-_sgnI8Sd.js} +1 -1
  100. package/dist/client/assets/{dynamic-plugin-layout-CLOgUYdt.js → dynamic-plugin-layout-EARuow4v.js} +1 -1
  101. package/dist/client/assets/{editable-task-title-DPm5hTsj.js → editable-task-title-DhgWYKTG.js} +1 -1
  102. package/dist/client/assets/{empty-state-DgczK1zq.js → empty-state-Cm3pZKVF.js} +1 -1
  103. package/dist/client/assets/{empty-state-Dz90tIjg.js → empty-state-VXOPlUbP.js} +1 -1
  104. package/dist/client/assets/{env-vars-editor-_us1Wsrd.js → env-vars-editor-CP22lwO9.js} +1 -1
  105. package/dist/client/assets/{extract-connection-data-4B_VINLV.js → extract-connection-data-DtmJqtHf.js} +1 -1
  106. package/dist/client/assets/{file-browser-07_p2xwc.js → file-browser-DhXVJnGT.js} +2 -2
  107. package/dist/client/assets/{form-BcVHSZnK.js → form-CRKVnCMR.js} +1 -1
  108. package/dist/client/assets/{general-ByH8NK66.js → general-RoGak9EH.js} +1 -1
  109. package/dist/client/assets/{grid-view-G5Ljiye5.js → grid-view-DeQZC1Ad.js} +1 -1
  110. package/dist/client/assets/{home-CdGGIEZY.js → home-DDWI0l_A.js} +1 -1
  111. package/dist/client/assets/{icon-picker-BR9TG3fC.js → icon-picker-C7pK4XCN.js} +1 -1
  112. package/dist/client/assets/{index-DbAOnuVY.js → index-B8JTf3bb.js} +1 -1
  113. package/dist/client/assets/{index-C4stU7_X.js → index-BE_3KD3M.js} +1 -1
  114. package/dist/client/assets/{index-EJhirEgi.js → index-BwxEZIQr.js} +32 -32
  115. package/dist/client/assets/{index-DJJzspJA.js → index-CO5ACses.js} +1 -1
  116. package/dist/client/assets/{index-BLjdA58H.js → index-D4QMenD_.js} +1 -1
  117. package/dist/client/assets/{index-6R2fscZr.js → index-DBuq81UB.js} +1 -1
  118. package/dist/client/assets/index-DIpn2laL.js +1 -0
  119. package/dist/client/assets/{index-D9aD7jmG.js → index-DRz1LsGS.js} +1 -1
  120. package/dist/client/assets/{index-Dv4huKa6.js → index-DzqmGhb3.js} +1 -1
  121. package/dist/client/assets/index-mgXzNPbR.js +1 -0
  122. package/dist/client/assets/{infiniteQueryObserver--lmuu5bR.js → infiniteQueryObserver-CZi5HeDN.js} +1 -1
  123. package/dist/client/assets/{input-23yd6VmI.js → input-Fhdajp_c.js} +1 -1
  124. package/dist/client/assets/{integration-icon-DnuBmEuk.js → integration-icon-TkiXAcCx.js} +1 -1
  125. package/dist/client/assets/{label-t2hx_05l.js → label-BLns8yFo.js} +1 -1
  126. package/dist/client/assets/{layout-Bw9dlo1E.js → layout-DQ81Lcct.js} +1 -1
  127. package/dist/client/assets/{layout-PA5WM8-4.js → layout-DeyJpCSu.js} +1 -1
  128. package/dist/client/assets/{login-n1KLhNbG.js → login-0CbZQiT4.js} +1 -1
  129. package/dist/client/assets/{logo-upload-B8w0TwVt.js → logo-upload-DUpx1K3j.js} +1 -1
  130. package/dist/client/assets/{markdown-D-1lsMgV.js → markdown-nhoc672y.js} +8 -8
  131. package/dist/client/assets/{mcp-app-renderer-YYUTU_-w.js → mcp-app-renderer-Czr8i4GK.js} +1 -1
  132. package/dist/client/assets/{mcp-server-card-d9n08Fh_.js → mcp-server-card-CWmebPs2.js} +1 -1
  133. package/dist/client/assets/mcp-server-detail-CbDJjQnJ.js +2 -0
  134. package/dist/client/assets/{members-1p11_2SS.js → members-EshNMuE5.js} +1 -1
  135. package/dist/client/assets/{monaco-editor-u58hRDQ4.js → monaco-editor-B6P_dgEC.js} +1 -1
  136. package/dist/client/assets/{monitoring-BB5FmWMv.js → monitoring-Dp7ndAsk.js} +11 -11
  137. package/dist/client/assets/{monitoring-dashboard-edit--q5QEX5i.js → monitoring-dashboard-edit-ClBenkfK.js} +1 -1
  138. package/dist/client/assets/{monitoring-dashboard-view-UsQjkLki.js → monitoring-dashboard-view-DS6l3WrT.js} +1 -1
  139. package/dist/client/assets/{oauth-callback-BL_sqHVU.js → oauth-callback-C1BG3W1h.js} +1 -1
  140. package/dist/client/assets/{oauth-callback-ai-provider-Cx3DblLQ.js → oauth-callback-ai-provider-DZLVWOw_.js} +1 -1
  141. package/dist/client/assets/org-ai-providers-DyjPbDPw.js +1 -0
  142. package/dist/client/assets/page-Dm5wW5_4.js +1 -0
  143. package/dist/client/assets/page-R2MxmNee.js +1 -0
  144. package/dist/client/assets/{plugin-empty-state-DgqJPRi5.js → plugin-empty-state-DILviBJd.js} +1 -1
  145. package/dist/client/assets/{plugin-empty-state-CJh4Lqbf.js → plugin-empty-state-DOItggu9.js} +1 -1
  146. package/dist/client/assets/{plugin-header-KT2ilJzM.js → plugin-header-BPoTqcJO.js} +1 -1
  147. package/dist/client/assets/{plugin-header-DDT-qUkq.js → plugin-header-CmM0hhfH.js} +1 -1
  148. package/dist/client/assets/plugins-Cp4R69Ly.js +1 -0
  149. package/dist/client/assets/{popover-Cmt-BFZN.js → popover-PQM18UlA.js} +1 -1
  150. package/dist/client/assets/project-app-view-CO-ltixT.js +1 -0
  151. package/dist/client/assets/project-layout-CRYoVp6K.js +1 -0
  152. package/dist/client/assets/{project-plugins-Caet_L4_.js → project-plugins-_fYzNgni.js} +1 -1
  153. package/dist/client/assets/{projects-list-DWFSv3Ix.js → projects-list-BPNPhjeN.js} +1 -1
  154. package/dist/client/assets/{readme-viewer-Xgb_lJQx.js → readme-viewer-Bxl1dElh.js} +1 -1
  155. package/dist/client/assets/{registry-layout-M9XW6rhp.js → registry-layout-zDOn9GUq.js} +1 -1
  156. package/dist/client/assets/{registry-utils-Bc7JySBD.js → registry-utils-BSSbBnO1.js} +1 -1
  157. package/dist/client/assets/{reports-layout-DiGXJ7eO.js → reports-layout-D4qhgPNX.js} +1 -1
  158. package/dist/client/assets/{reset-password-CwVXb38O.js → reset-password-fmyW6U2y.js} +1 -1
  159. package/dist/client/assets/{resizable-ghy0Xufz.js → resizable-Cm6dp-B2.js} +1 -1
  160. package/dist/client/assets/{save-actions-DvQBIk-t.js → save-actions-DuKbd0Td.js} +1 -1
  161. package/dist/client/assets/{scroll-area-DzWnDQB-.js → scroll-area-B-Ee7B_j.js} +1 -1
  162. package/dist/client/assets/{select-B2Bho1QQ.js → select-1RddZ4CO.js} +1 -1
  163. package/dist/client/assets/{select-virtual-mcp-Tk-m3Fu9.js → select-virtual-mcp-DGdxHoQi.js} +1 -1
  164. package/dist/client/assets/shell-layout-Ca0m0ZLh.js +3 -0
  165. package/dist/client/assets/{sidebar-settings-BTY81fOZ.js → sidebar-settings-De4sr2dR.js} +1 -1
  166. package/dist/client/assets/{skeleton-BDMxlKkg.js → skeleton-DJF7tug6.js} +1 -1
  167. package/dist/client/assets/{spinner-DcYxwnHl.js → spinner-BnxbYYlb.js} +1 -1
  168. package/dist/client/assets/{store-invite-CDA2bein.js → store-invite-oCuf7I6o.js} +1 -1
  169. package/dist/client/assets/{switch-DRgBKNMz.js → switch-Bq8IUh07.js} +1 -1
  170. package/dist/client/assets/{table-Bs6V2h_N.js → table-BqV5DzoG.js} +1 -1
  171. package/dist/client/assets/{tabs-Cbvel-f6.js → tabs-C5hfwptf.js} +1 -1
  172. package/dist/client/assets/{task-status-B95CCzhX.js → task-status-Bl9QTmtn.js} +30 -22
  173. package/dist/client/assets/tasks-0Eg7ZyIZ.js +1 -0
  174. package/dist/client/assets/{tasks-panel-BGarv8W1.js → tasks-panel-OJ8S6gUG.js} +1 -1
  175. package/dist/client/assets/{textarea--Uagmopx.js → textarea-Bz-C9pBX.js} +1 -1
  176. package/dist/client/assets/{time-range-picker-Vb_Ca2x7.js → time-range-picker-BTo-nySJ.js} +1 -1
  177. package/dist/client/assets/{toggle-group-CnbQDoAl.js → toggle-group-P3u85xuW.js} +1 -1
  178. package/dist/client/assets/{tools-list-Cd5xU46X.js → tools-list-CAH2xsXw.js} +1 -1
  179. package/dist/client/assets/{tooltip-BXI94UP3.js → tooltip-aT8SYWF_.js} +1 -1
  180. package/dist/client/assets/{topbar-portal-BgYtwYtw.js → topbar-portal-C-sDPeUg.js} +1 -1
  181. package/dist/client/assets/{types-CdefEA9e.js → types-Dpvg5M06.js} +1 -1
  182. package/dist/client/assets/usage-t6qWPVZ4.js +1 -0
  183. package/dist/client/assets/{use-automations-3lm8AX10.js → use-automations-qsid-9wy.js} +1 -1
  184. package/dist/client/assets/{use-binding-THgLcp9C.js → use-binding-BmEXmDTS.js} +1 -1
  185. package/dist/client/assets/{use-collections-B4b2cHqe.js → use-collections-L9vgkwE-.js} +1 -1
  186. package/dist/client/assets/{use-connection-DrhtnyBi.js → use-connection-DneEev9a.js} +1 -1
  187. package/dist/client/assets/{use-copy-BAQklmkz.js → use-copy-D_A8LaGR.js} +1 -1
  188. package/dist/client/assets/{use-create-virtual-mcp-DLy6t37V.js → use-create-virtual-mcp-CWD_gaUu.js} +1 -1
  189. package/dist/client/assets/{use-install-from-registry-EOOhwh-F.js → use-install-from-registry--Cp53uqX.js} +1 -1
  190. package/dist/client/assets/{use-list-state-BXqBxE3W.js → use-list-state-CcAjjCVm.js} +1 -1
  191. package/dist/client/assets/{use-llm-B0ZUgM3D.js → use-llm-uI2ZLalw.js} +1 -1
  192. package/dist/client/assets/use-local-storage-CI_WEqce.js +1 -0
  193. package/dist/client/assets/{use-mcp-prompts-LuO7HYtE.js → use-mcp-prompts-CpqNoP0o.js} +1 -1
  194. package/dist/client/assets/{use-mcp-resources-Dk6zV1FV.js → use-mcp-resources-BsCeSR2x.js} +1 -1
  195. package/dist/client/assets/{use-mcp-tools-CKkWOyR2.js → use-mcp-tools-DNu930_U.js} +1 -1
  196. package/dist/client/assets/{use-members-DQi2Ov4F.js → use-members-DpuzXMS1.js} +1 -1
  197. package/dist/client/assets/{use-mobile-DwOvFQ5A.js → use-mobile-DFD6SQiI.js} +1 -1
  198. package/dist/client/assets/{use-project-UxeKn7lk.js → use-project-BAPzM4i4.js} +1 -1
  199. package/dist/client/assets/{use-view-mode-CkJMVXNZ.js → use-view-mode-2oXrhkvB.js} +1 -1
  200. package/dist/client/assets/{use-virtual-mcp-D_iE9Cdz.js → use-virtual-mcp-CvmGsLOT.js} +1 -1
  201. package/dist/client/assets/useInfiniteQuery-D9IG6LkB.js +1 -0
  202. package/dist/client/assets/{useMutation-ClueFvpj.js → useMutation-xr8MgEC0.js} +1 -1
  203. package/dist/client/assets/useQuery-BMWtXZn8.js +1 -0
  204. package/dist/client/assets/useSuspenseInfiniteQuery-DIDJd1Uk.js +1 -0
  205. package/dist/client/assets/{user-CmrAywRT.js → user-Ye6g7e7k.js} +1 -1
  206. package/dist/client/assets/{workflow-DUiHQumC.js → workflow-ckfsqQYq.js} +1 -1
  207. package/dist/client/index.html +11 -2
  208. package/dist/client/og-image.png +0 -0
  209. package/dist/server/cli.js +219 -219
  210. package/dist/server/migrate.js +1 -1
  211. package/dist/server/server.js +134 -134
  212. package/package.json +1 -1
  213. package/dist/client/assets/agent-detail-gWgaUo37.js +0 -2
  214. package/dist/client/assets/automation-detail-pgXQ6r-z.js +0 -1
  215. package/dist/client/assets/constants-DCSMrWwu.js +0 -1
  216. package/dist/client/assets/context-228p0Ol2.js +0 -29
  217. package/dist/client/assets/default-model-D8jxKXJs.js +0 -1
  218. package/dist/client/assets/dialog-DD3DgOo2.js +0 -1
  219. package/dist/client/assets/index-BL4eeGnH.js +0 -1
  220. package/dist/client/assets/index-wbJeckpV.js +0 -1
  221. package/dist/client/assets/localstorage-keys-CyCsfmz2.js +0 -1
  222. package/dist/client/assets/mcp-server-detail-CK4-sRdM.js +0 -2
  223. package/dist/client/assets/org-ai-providers-DEZEBxef.js +0 -1
  224. package/dist/client/assets/page-4As1cwNm.js +0 -1
  225. package/dist/client/assets/page-bNXst3ko.js +0 -1
  226. package/dist/client/assets/plugins-s9Jf7v31.js +0 -1
  227. package/dist/client/assets/project-app-view-DhZEpR7h.js +0 -1
  228. package/dist/client/assets/project-layout-7FJbf_iM.js +0 -1
  229. package/dist/client/assets/shell-layout-ChsgawOS.js +0 -3
  230. package/dist/client/assets/tasks-C8R0uxcK.js +0 -1
  231. package/dist/client/assets/usage-B8eRkRZY.js +0 -1
  232. package/dist/client/assets/use-preferences-D5crHwiP.js +0 -1
  233. package/dist/client/assets/useInfiniteQuery-Dg54E7EH.js +0 -1
  234. package/dist/client/assets/useQuery-mGiR1oLn.js +0 -1
  235. package/dist/client/assets/useSuspenseInfiniteQuery-DUeEwu4s.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "decocms",
3
- "version": "2.167.0",
3
+ "version": "2.167.1",
4
4
  "description": "Deco Studio — Self-hostable MCP Gateway for managing AI connections and tools",
5
5
  "author": "Deco team",
6
6
  "repository": {
@@ -1,2 +0,0 @@
1
- import{r as S,c as k,j as t,E as fe,B as J,z as ae,ae as Je,u as de,V as Ze,n as Qe,w as ce,e as Xe,g as et,O as Fe,t as tt,q as st,at as lt,G as Me}from"./index-EJhirEgi.js";import{u as ot}from"./context-228p0Ol2.js";import{E as nt}from"./empty-state-Dz90tIjg.js";import{I as it}from"./icon-picker-BR9TG3fC.js";import{I as Ae}from"./integration-icon-DnuBmEuk.js";import{u as rt}from"./index-wbJeckpV.js";import{B as Oe}from"./badge-BiElTurh.js";import{i as at,a as ct,C as dt,b as mt}from"./collapsible-B9yZLN6Y.js";import{I as Ve}from"./input-23yd6VmI.js";import{S as ut}from"./switch-DRgBKNMz.js";import{T as ft}from"./textarea--Uagmopx.js";import{a as pe,b as ye,c as xe,T as he}from"./tooltip-BXI94UP3.js";import{b as pt,u as xt}from"./use-connection-DrhtnyBi.js";import{u as ht,a as gt}from"./use-virtual-mcp-D_iE9Cdz.js";import{i as He}from"./ChevronRight-DNq10e3Z.js";import{n as jt}from"./ChevronUp-Be0WocGY.js";import{i as $e}from"./File02-C6fFP8wJ.js";import{i as De}from"./Loading01-BUlApwyE.js";import{i as bt}from"./Play-a4a9k_A2.js";import{s as Be}from"./Plus-CiuqWk7L.js";import{b as Le}from"./index-DbAOnuVY.js";import{t as Nt}from"./Users03-DBQP_ao_.js";import{B as yt,a as vt,b as Ge,d as Ct,e as _t,c as St}from"./breadcrumb-U9pZLesK.js";import{a as Tt,V as kt}from"./layout-PA5WM8-4.js";import{S as wt}from"./save-actions-DvQBIk-t.js";import{C as Et}from"./collection-search-DwGryXKM.js";import{T as It}from"./tools-list-Cd5xU46X.js";import{C as ze}from"./checkbox-7ZiSm3FO.js";import{e as At,a as Ue,D as Ke,b as Ot,c as $t}from"./dialog-DD3DgOo2.js";import{T as ve,a as Dt,b as Ce,c as Lt}from"./tabs-Cbvel-f6.js";import{u as ge,a as zt}from"./constants-BtZ3fAEQ.js";import{c as Rt}from"./use-mcp-tools-CKkWOyR2.js";import{a as Pt}from"./use-mcp-resources-Dk6zV1FV.js";import{u as Mt}from"./use-mcp-prompts-LuO7HYtE.js";import{s as We}from"./slugify-CEUa2lfQ.js";import{I as Vt,R as Bt,a as Gt}from"./index-C4stU7_X.js";import{i as Ft}from"./dropdown-menu-W_lhWsM7.js";import{i as je}from"./Check-BWCeXHN7.js";import{i as Ht}from"./Code01-BDvBTEm7.js";import{a as Re}from"./Copy01-BJVPuQbm.js";import{i as _e}from"./InfoCircle-BqEmSE9k.js";import{i as Ut}from"./Key01-Be9_ogDx.js";import{A as Kt}from"./agent-connections-preview-dUyrsdf1.js";import"./default-model-D8jxKXJs.js";import"./use-llm-B0ZUgM3D.js";import"./useQuery-mGiR1oLn.js";import"./localstorage-keys-CyCsfmz2.js";import"./useMutation-ClueFvpj.js";import"./use-preferences-D5crHwiP.js";import"./use-collections-B4b2cHqe.js";import"./useSuspenseInfiniteQuery-DUeEwu4s.js";import"./infiniteQueryObserver--lmuu5bR.js";import"./popover-Cmt-BFZN.js";import"./scroll-area-DzWnDQB-.js";import"./Container-C4I-ZzWI.js";import"./Edit05-FVXfLA6i.js";import"./Link01-DXpyb1VQ.js";import"./XClose-B-kxIP35.js";import"./index-Dv4huKa6.js";import"./Save01-CGK6rW3l.js";import"./SearchMd-D_8XQU19.js";import"./collection-display-button-BKC7veh8.js";import"./ArrowDown-_L7cw1A8.js";import"./ArrowUp-DKc3SUsQ.js";import"./Grid01-Cj17P1tC.js";import"./List-c0L2g9Qy.js";import"./collection-table-wrapper-CLdf4mbp.js";import"./table-Bs6V2h_N.js";import"./card-DXYG1PJt.js";import"./types-CdefEA9e.js";import"./Eye-DkD5as17.js";import"./Globe02-BtYVEi0C.js";import"./LayersTwo01-CqPgQoaH.js";import"./X-CC0aD5R8.js";const be=({size:o=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"m9.75 20.75 1.473.818c.284.158.425.237.576.268.133.027.27.027.402 0 .15-.031.292-.11.576-.268l1.473-.818m-9-2.5-1.427-.793c-.3-.166-.45-.25-.558-.368a1 1 0 0 1-.215-.364C3 16.573 3 16.401 3 16.06V14.5m0-5V7.942c0-.343 0-.514.05-.667a1 1 0 0 1 .215-.364c.109-.119.258-.202.558-.368L5.25 5.75m4.5-2.5 1.473-.818c.284-.158.425-.237.576-.267a1 1 0 0 1 .402 0c.15.03.292.11.576.267l1.473.818m4.5 2.5 1.427.793c.3.166.45.25.558.368a1 1 0 0 1 .215.364c.05.153.05.324.05.667V9.5m0 5v1.559c0 .342 0 .514-.05.666a.999.999 0 0 1-.215.364c-.109.119-.258.202-.558.368l-1.427.793m-9-7.5L12 12m0 0 2.25-1.25M12 12v2.5M3 7l2.25 1.25m13.5 0L21 7m-9 12.5V22"}));be.displayName="CubeOutline";const Ye=({size:o=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"m12 5.5-4.638 6.747c-.28.406-.42.609-.41.778a.5.5 0 0 0 .195.373c.135.102.38.102.874.102H12v5l4.638-6.747c.28-.406.42-.609.41-.778a.5.5 0 0 0-.195-.373c-.135-.102-.38-.102-.874-.102H12v-5Z"}),S.createElement("path",{d:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"}));Ye.displayName="ZapCircle";function Se(o){return o===null?"all":o?.length??0}function Wt(o,e){const s=o[e];if(!s)return"";const n=[];return s.tools===null?n.push("all tools"):s.tools&&s.tools.length>0&&n.push(`${s.tools.length} tools`),s.resources===null?n.push("all resources"):s.resources&&s.resources.length>0&&n.push(`${s.resources.length} resources`),s.prompts===null?n.push("all prompts"):s.prompts&&s.prompts.length>0&&n.push(`${s.prompts.length} prompts`),n.join(", ")}function Yt(o,e){const s=o[e];return s?!((s.tools===void 0||s.tools!==null&&s.tools.length===0)&&(s.resources===void 0||s.resources!==null&&s.resources.length===0)&&(s.prompts===void 0||s.prompts!==null&&s.prompts.length===0)):!1}const qt={tools:null,resources:null,prompts:null};function Te(){const o=k.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"flex items-center justify-center h-32",children:t.jsx(De,{className:"animate-spin text-muted-foreground",size:24})}),o[0]=e):e=o[0],e}function ke(o){return({error:e})=>e?.message?.includes("Method not found")||e?.code===-32601?t.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:t.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:o})}):t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center h-full p-6 text-center space-y-4",children:[t.jsx("div",{className:"bg-destructive/10 p-3 rounded-full",children:t.jsx(Je,{className:"h-6 w-6 text-destructive"})}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h3",{className:"text-lg font-medium",children:"Something went wrong"}),t.jsx("p",{className:"text-sm text-muted-foreground max-w-xs mx-auto",children:e?.message?e.message.length>200?`${e.message.slice(0,200)}...`:e.message:"An unexpected error occurred"})]})]})}function Jt(o){const e=k.c(23),{item:s,isSelected:n,onToggle:l,disabled:i}=o,d=i?"cursor-not-allowed opacity-50":"cursor-pointer",a=n?"bg-accent/25":"hover:bg-muted/50";let r;e[0]!==d||e[1]!==a?(r=ae("flex items-start gap-3 p-4 rounded-lg transition-colors",d,a),e[0]=d,e[1]=a,e[2]=r):r=e[2];let c;e[3]!==s.name?(c=t.jsx("p",{className:"text-sm font-medium leading-none truncate",children:s.name}),e[3]=s.name,e[4]=c):c=e[4];let x;e[5]!==s.tags?(x=s.tags&&t.jsx("span",{className:"shrink-0",children:s.tags}),e[5]=s.tags,e[6]=x):x=e[6];let g;e[7]!==c||e[8]!==x?(g=t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c,x]}),e[7]=c,e[8]=x,e[9]=g):g=e[9];let p;e[10]!==s.description?(p=s.description&&t.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:s.description}),e[10]=s.description,e[11]=p):p=e[11];let h;e[12]!==g||e[13]!==p?(h=t.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[g,p]}),e[12]=g,e[13]=p,e[14]=h):h=e[14];let u;e[15]!==i||e[16]!==n||e[17]!==l?(u=t.jsx(ze,{checked:n,onCheckedChange:l,disabled:i,className:"mt-0.5"}),e[15]=i,e[16]=n,e[17]=l,e[18]=u):u=e[18];let f;return e[19]!==r||e[20]!==h||e[21]!==u?(f=t.jsxs("label",{className:r,children:[h,u]}),e[19]=r,e[20]=h,e[21]=u,e[22]=f):f=e[22],f}function Pe(o){const e=k.c(32),{items:s,selections:n,onToggle:l,onToggleAll:i,emptyMessage:d,disabled:a}=o;let r,c,x,g,p;if(e[0]!==a||e[1]!==d||e[2]!==s||e[3]!==l||e[4]!==i||e[5]!==n){p=Symbol.for("react.early_return_sentinel");e:{const f=s.map(Zt);if(s.length===0){let v;e[11]!==d?(v=t.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:t.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:d})}),e[11]=d,e[12]=v):v=e[12],p=v;break e}x="flex flex-col h-full";const b=a?"cursor-not-allowed opacity-50":"cursor-pointer";let m;e[13]!==b?(m=ae("flex items-start gap-3 p-4",b),e[13]=b,e[14]=m):m=e[14];let j;e[15]!==s.length?(j=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsxs("span",{className:"text-sm font-medium",children:["Select All (",s.length,")"]})}),e[15]=s.length,e[16]=j):j=e[16];const y=n===null;let C;e[17]!==a||e[18]!==i||e[19]!==y?(C=t.jsx(ze,{checked:y,onCheckedChange:i,disabled:a,className:"mt-0.5"}),e[17]=a,e[18]=i,e[19]=y,e[20]=C):C=e[20],e[21]!==C||e[22]!==m||e[23]!==j?(g=t.jsx("div",{className:"px-4 border-b border-border shrink-0",children:t.jsxs("label",{className:m,children:[j,C]})}),e[21]=C,e[22]=m,e[23]=j,e[24]=g):g=e[24],r="flex-1 overflow-auto px-4 py-3 space-y-1",c=s.map(v=>t.jsx(Jt,{item:v,isSelected:n===null||n?.includes(v.id),onToggle:()=>l(v.id,f),disabled:a},v.id))}e[0]=a,e[1]=d,e[2]=s,e[3]=l,e[4]=i,e[5]=n,e[6]=r,e[7]=c,e[8]=x,e[9]=g,e[10]=p}else r=e[6],c=e[7],x=e[8],g=e[9],p=e[10];if(p!==Symbol.for("react.early_return_sentinel"))return p;let h;e[25]!==r||e[26]!==c?(h=t.jsx("div",{className:r,children:c}),e[25]=r,e[26]=c,e[27]=h):h=e[27];let u;return e[28]!==x||e[29]!==g||e[30]!==h?(u=t.jsxs("div",{className:x,children:[g,h]}),e[28]=x,e[29]=g,e[30]=h,e[31]=u):u=e[31],u}function Zt(o){return o.id}function Qt(o){const e=k.c(13),{connectionId:s,selections:n,onToggle:l,onToggleAll:i,disabled:d}=o,{org:a}=de();let r;e[0]!==s||e[1]!==a.id?(r={connectionId:s,orgId:a.id},e[0]=s,e[1]=a.id,e[2]=r):r=e[2];const c=ge(r);let x;e[3]!==c?(x={client:c},e[3]=c,e[4]=x):x=e[4];const{data:g}=Rt(x);let p;e[5]!==g.tools?(p=g.tools.map(Xt),e[5]=g.tools,e[6]=p):p=e[6];const h=p;let u;return e[7]!==d||e[8]!==h||e[9]!==l||e[10]!==i||e[11]!==n?(u=t.jsx(Pe,{items:h,selections:n,onToggle:l,onToggleAll:i,emptyMessage:"No tools available",disabled:d}),e[7]=d,e[8]=h,e[9]=l,e[10]=i,e[11]=n,e[12]=u):u=e[12],u}function Xt(o){return{id:o.name,name:o.name,description:o.description,tags:t.jsx(It,{annotations:o.annotations,_meta:o._meta})}}function es(o){const e=k.c(13),{connectionId:s,selections:n,onToggle:l,onToggleAll:i,disabled:d}=o,{org:a}=de();let r;e[0]!==s||e[1]!==a.id?(r={connectionId:s,orgId:a.id},e[0]=s,e[1]=a.id,e[2]=r):r=e[2];const c=ge(r);let x;e[3]!==c?(x={client:c},e[3]=c,e[4]=x):x=e[4];const{data:g}=Pt(x);let p;e[5]!==g.resources?(p=g.resources.map(ts),e[5]=g.resources,e[6]=p):p=e[6];const h=p;let u;return e[7]!==d||e[8]!==h||e[9]!==l||e[10]!==i||e[11]!==n?(u=t.jsx(Pe,{items:h,selections:n,onToggle:l,onToggleAll:i,emptyMessage:"No resources available",disabled:d}),e[7]=d,e[8]=h,e[9]=l,e[10]=i,e[11]=n,e[12]=u):u=e[12],u}function ts(o){return{id:o.name||o.uri,name:o.name||o.uri,description:o.description}}function ss(o){const e=k.c(13),{connectionId:s,selections:n,onToggle:l,onToggleAll:i,disabled:d}=o,{org:a}=de();let r;e[0]!==s||e[1]!==a.id?(r={connectionId:s,orgId:a.id},e[0]=s,e[1]=a.id,e[2]=r):r=e[2];const c=ge(r);let x;e[3]!==c?(x={client:c},e[3]=c,e[4]=x):x=e[4];const{data:g}=Mt(x);let p;e[5]!==g.prompts?(p=g.prompts.map(ls),e[5]=g.prompts,e[6]=p):p=e[6];const h=p;let u;return e[7]!==d||e[8]!==h||e[9]!==l||e[10]!==i||e[11]!==n?(u=t.jsx(Pe,{items:h,selections:n,onToggle:l,onToggleAll:i,emptyMessage:"No prompts available",disabled:d}),e[7]=d,e[8]=h,e[9]=l,e[10]=i,e[11]=n,e[12]=u):u=e[12],u}function ls(o){return{id:o.name,name:o.name,description:o.description}}function os(o){const e=k.c(24),{connection:s,isSelected:n,hasSelections:l,summary:i,onClick:d,onToggleAll:a,disabled:r}=o,c=r?"cursor-not-allowed opacity-50":"cursor-pointer",x=n?"bg-accent":"hover:bg-muted/50";let g;e[0]!==c||e[1]!==x?(g=ae("flex items-center gap-2 p-2 h-12 rounded-lg transition-colors",c,x),e[0]=c,e[1]=x,e[2]=g):g=e[2];const p=r?void 0:d;let h;e[3]!==s.icon||e[4]!==s.title?(h=t.jsx(Ae,{icon:s.icon,name:s.title,size:"xs",className:"shrink-0"}),e[3]=s.icon,e[4]=s.title,e[5]=h):h=e[5];let u;e[6]!==s.title?(u=t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:s.title}),e[6]=s.title,e[7]=u):u=e[7];let f;e[8]!==l||e[9]!==i?(f=l&&i&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:i}),e[8]=l,e[9]=i,e[10]=f):f=e[10];let b;e[11]!==u||e[12]!==f?(b=t.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-center",children:[u,f]}),e[11]=u,e[12]=f,e[13]=b):b=e[13];let m;e[14]!==r||e[15]!==l||e[16]!==a?(m=t.jsx(ze,{checked:l,onCheckedChange:a,onClick:ns,disabled:r,className:"shrink-0"}),e[14]=r,e[15]=l,e[16]=a,e[17]=m):m=e[17];let j;return e[18]!==g||e[19]!==p||e[20]!==h||e[21]!==b||e[22]!==m?(j=t.jsxs("div",{className:g,onClick:p,children:[h,b,m]}),e[18]=g,e[19]=p,e[20]=h,e[21]=b,e[22]=m,e[23]=j):j=e[23],j}function ns(o){return o.stopPropagation()}function is(o){const e=k.c(22),{allConnections:s,searchTerm:n,selectedId:l,hasSelections:i,getSelectionSummary:d,onConnectionClick:a,onToggleAll:r,disabled:c}=o;let x;e[0]!==s||e[1]!==n?(x=n?s.filter(u=>u.title.toLowerCase().includes(n.toLowerCase())||u.description?.toLowerCase().includes(n.toLowerCase())):s,e[0]=s,e[1]=n,e[2]=x):x=e[2];const g=x;if(g.length===0){const u=n?"No connections found":"No connections available";let f;return e[3]!==u?(f=t.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground p-4",children:u}),e[3]=u,e[4]=f):f=e[4],f}let p;if(e[5]!==c||e[6]!==g||e[7]!==d||e[8]!==i||e[9]!==a||e[10]!==r||e[11]!==l){let u;e[13]!==c||e[14]!==d||e[15]!==i||e[16]!==a||e[17]!==r||e[18]!==l?(u=f=>t.jsx(os,{connection:f,isSelected:l===f.id,hasSelections:i(f.id),summary:d(f.id),onClick:()=>a(f.id),onToggleAll:()=>r(f.id),disabled:c},f.id),e[13]=c,e[14]=d,e[15]=i,e[16]=a,e[17]=r,e[18]=l,e[19]=u):u=e[19],p=g.map(u),e[5]=c,e[6]=g,e[7]=d,e[8]=i,e[9]=a,e[10]=r,e[11]=l,e[12]=p}else p=e[12];let h;return e[20]!==p?(h=t.jsx("div",{className:"flex flex-col gap-0.5",children:p}),e[20]=p,e[21]=h):h=e[21],h}function rs(o){const e=k.c(75),{currentConnection:s,activeTab:n,selectedId:l,formData:i,toggleTool:d,toggleResource:a,togglePrompt:r,toggleAllTools:c,toggleAllResources:x,toggleAllPrompts:g,onTabChange:p}=o;let h;e[0]!==s.icon||e[1]!==s.title?(h=t.jsx(Ae,{icon:s.icon,name:s.title,size:"md",className:"shrink-0"}),e[0]=s.icon,e[1]=s.title,e[2]=h):h=e[2];let u;e[3]!==s.title?(u=t.jsx("h2",{className:"text-lg font-semibold truncate",children:s.title}),e[3]=s.title,e[4]=u):u=e[4];let f;e[5]!==s.description?(f=s.description&&t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:s.description}),e[5]=s.description,e[6]=f):f=e[6];let b;e[7]!==u||e[8]!==f?(b=t.jsxs("div",{className:"flex-1 min-w-0",children:[u,f]}),e[7]=u,e[8]=f,e[9]=b):b=e[9];let m;e[10]!==h||e[11]!==b?(m=t.jsx("div",{className:"p-6 border-b border-border shrink-0",children:t.jsxs("div",{className:"flex items-center gap-3",children:[h,b]})}),e[10]=h,e[11]=b,e[12]=m):m=e[12];let j;e[13]!==p?(j=M=>p(M),e[13]=p,e[14]=j):j=e[14];let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsxs(ve,{value:"tools",variant:"underline",className:"gap-2",children:[t.jsx(Le,{size:16}),"Tools"]}),e[15]=y):y=e[15];let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsxs(ve,{value:"resources",variant:"underline",className:"gap-2",children:[t.jsx(be,{size:16}),"Resources"]}),e[16]=C):C=e[16];let v;e[17]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsxs(Dt,{variant:"underline",className:"shrink-0 px-6",children:[y,C,t.jsxs(ve,{value:"prompts",variant:"underline",className:"gap-2",children:[t.jsx($e,{size:16}),"Prompts"]})]}),e[17]=v):v=e[17];let V;e[18]===Symbol.for("react.memo_cache_sentinel")?(V=ke("Tools not supported by this server"),e[18]=V):V=e[18];let R;e[19]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx(Te,{}),e[19]=R):R=e[19];let T;e[20]!==i||e[21]!==l?(T=i[l]?i[l].tools:[],e[20]=i,e[21]=l,e[22]=T):T=e[22];let O;e[23]!==l||e[24]!==d?(O=(M,q)=>d(l,M,q),e[23]=l,e[24]=d,e[25]=O):O=e[25];let _;e[26]!==l||e[27]!==c?(_=()=>c(l),e[26]=l,e[27]=c,e[28]=_):_=e[28];let w;e[29]!==l||e[30]!==T||e[31]!==O||e[32]!==_?(w=t.jsx(Ce,{value:"tools",className:"flex-1 overflow-hidden mt-0",children:t.jsx(fe,{fallback:V,children:t.jsx(S.Suspense,{fallback:R,children:t.jsx(Qt,{connectionId:l,selections:T,onToggle:O,onToggleAll:_})})})}),e[29]=l,e[30]=T,e[31]=O,e[32]=_,e[33]=w):w=e[33];let z;e[34]===Symbol.for("react.memo_cache_sentinel")?(z=ke("Resources not supported by this server"),e[34]=z):z=e[34];let $;e[35]===Symbol.for("react.memo_cache_sentinel")?($=t.jsx(Te,{}),e[35]=$):$=e[35];let I;e[36]!==i||e[37]!==l?(I=i[l]?i[l].resources:[],e[36]=i,e[37]=l,e[38]=I):I=e[38];let D;e[39]!==l||e[40]!==a?(D=(M,q)=>a(l,M,q),e[39]=l,e[40]=a,e[41]=D):D=e[41];let A;e[42]!==l||e[43]!==x?(A=()=>x(l),e[42]=l,e[43]=x,e[44]=A):A=e[44];let E;e[45]!==l||e[46]!==I||e[47]!==D||e[48]!==A?(E=t.jsx(Ce,{value:"resources",className:"flex-1 overflow-hidden mt-0",children:t.jsx(fe,{fallback:z,children:t.jsx(S.Suspense,{fallback:$,children:t.jsx(es,{connectionId:l,selections:I,onToggle:D,onToggleAll:A})})})}),e[45]=l,e[46]=I,e[47]=D,e[48]=A,e[49]=E):E=e[49];let B;e[50]===Symbol.for("react.memo_cache_sentinel")?(B=ke("Prompts not supported by this server"),e[50]=B):B=e[50];let P;e[51]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(Te,{}),e[51]=P):P=e[51];let K;e[52]!==i||e[53]!==l?(K=i[l]?i[l].prompts:[],e[52]=i,e[53]=l,e[54]=K):K=e[54];let H;e[55]!==l||e[56]!==r?(H=(M,q)=>r(l,M,q),e[55]=l,e[56]=r,e[57]=H):H=e[57];let W;e[58]!==l||e[59]!==g?(W=()=>g(l),e[58]=l,e[59]=g,e[60]=W):W=e[60];let U;e[61]!==l||e[62]!==K||e[63]!==H||e[64]!==W?(U=t.jsx(Ce,{value:"prompts",className:"flex-1 overflow-hidden mt-0",children:t.jsx(fe,{fallback:B,children:t.jsx(S.Suspense,{fallback:P,children:t.jsx(ss,{connectionId:l,selections:K,onToggle:H,onToggleAll:W})})})}),e[61]=l,e[62]=K,e[63]=H,e[64]=W,e[65]=U):U=e[65];let Y;e[66]!==n||e[67]!==w||e[68]!==E||e[69]!==U||e[70]!==j?(Y=t.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:t.jsxs(Lt,{value:n,onValueChange:j,variant:"underline",className:"flex-1 flex flex-col overflow-hidden",children:[v,w,E,U]})}),e[66]=n,e[67]=w,e[68]=E,e[69]=U,e[70]=j,e[71]=Y):Y=e[71];let Z;return e[72]!==Y||e[73]!==m?(Z=t.jsxs(t.Fragment,{children:[m,Y]}),e[72]=Y,e[73]=m,e[74]=Z):Z=e[74],Z}function as(o){const e={};for(const s of o)e[s.connection_id]={tools:s.selected_tools,resources:s.selected_resources??null,prompts:s.selected_prompts??null};return e}function we(o){return Object.entries(o).map(([e,s])=>({connection_id:e,selected_tools:s.tools,selected_resources:s.resources,selected_prompts:s.prompts}))}function cs(o,e){switch(e.type){case"SET_SEARCH_TERM":return{...o,searchTerm:e.payload};case"SET_SELECTED":return{...o,selectedId:e.payload};case"SET_ACTIVE_TAB":return{...o,activeTab:e.payload};case"RESET":return{searchTerm:"",selectedId:e.payload.selectedId??e.payload.firstConnectionId??null,activeTab:"tools"};case"SELECT_CONNECTION":return{...o,selectedId:e.payload,activeTab:"tools"};default:return o}}const ds=(o,e)=>o.find(s=>s.id===e)??o[0];function ms(o){const e=k.c(77),{open:s,onOpenChange:n,selectedId:l,form:i,connections:d}=o;let a;e[0]!==l?(a={activeTab:"tools",searchTerm:"",selectedId:l},e[0]=l,e[1]=a):a=e[1];const[r,c]=S.useReducer(cs,a),x=S.useDeferredValue(r.searchTerm);let g;e[2]!==x?(g={searchTerm:x},e[2]=x,e[3]=g):g=e[3];const p=pt(g);let h;e[4]!==d?(h=d??[],e[4]=d,e[5]=h):h=e[5];let u;e[6]!==h?(u=as(h),e[6]=h,e[7]=u):u=e[7];const f=u;let b;e[8]!==p||e[9]!==r.selectedId?(b=ds(p,r.selectedId),e[8]=p,e[9]=r.selectedId,e[10]=b):b=e[10];const m=b,j=m?.id??null;let y;e[11]!==f?(y=N=>Yt(f,N),e[11]=f,e[12]=y):y=e[12];const C=y;let v;e[13]!==f?(v=N=>Wt(f,N),e[13]=f,e[14]=v):v=e[14];const V=v;let R;e[15]!==i||e[16]!==f?(R=(N,L,G,Q)=>{const ie=f[N]?.[L];let F;ie===null?F=Q.filter(Ne=>Ne!==G):ie?.includes(G)?F=ie.filter(Ne=>Ne!==G):(F=[...ie??[],G],F.length===Q.length&&(F=null));const re={...f};re[N]?re[N]={...re[N]}:re[N]={tools:null,resources:null,prompts:null},re[N][L]=F,i.setValue("connections",we(re),{shouldDirty:!0,shouldTouch:!0})},e[15]=i,e[16]=f,e[17]=R):R=e[17];const T=R;let O;e[18]!==i||e[19]!==f?(O=(N,L)=>{const ie=f[N]?.[L]===null?[]:null,F={...f};F[N]?F[N]={...F[N]}:F[N]={tools:null,resources:null,prompts:null},F[N][L]=ie,i.setValue("connections",we(F),{shouldDirty:!0,shouldTouch:!0})},e[18]=i,e[19]=f,e[20]=O):O=e[20];const _=O;let w;e[21]!==T?(w=(N,L,G)=>T(N,"tools",L,G),e[21]=T,e[22]=w):w=e[22];const z=w;let $;e[23]!==T?($=(N,L,G)=>T(N,"resources",L,G),e[23]=T,e[24]=$):$=e[24];const I=$;let D;e[25]!==T?(D=(N,L,G)=>T(N,"prompts",L,G),e[25]=T,e[26]=D):D=e[26];const A=D;let E;e[27]!==_?(E=N=>_(N,"tools"),e[27]=_,e[28]=E):E=e[28];const B=E;let P;e[29]!==_?(P=N=>_(N,"resources"),e[29]=_,e[30]=P):P=e[30];const K=P;let H;e[31]!==_?(H=N=>_(N,"prompts"),e[31]=_,e[32]=H):H=e[32];const W=H;let U;e[33]!==i||e[34]!==f?(U=N=>{const L=f[N],G=L&&L.tools===null&&L.resources===null&&L.prompts===null,Q={...f};G?delete Q[N]:Q[N]=qt,i.setValue("connections",we(Q),{shouldDirty:!0,shouldTouch:!0})},e[33]=i,e[34]=f,e[35]=U):U=e[35];const Y=U;let Z;e[36]!==p||e[37]!==n||e[38]!==l?(Z=N=>{N&&c({type:"RESET",payload:{selectedId:l,firstConnectionId:p[0]?.id??null}}),n(N)},e[36]=p,e[37]=n,e[38]=l,e[39]=Z):Z=e[39];const M=Z;let q;e[40]===Symbol.for("react.memo_cache_sentinel")?(q=N=>{c({type:"SELECT_CONNECTION",payload:N})},e[40]=q):q=e[40];const qe=q;let me;e[41]===Symbol.for("react.memo_cache_sentinel")?(me=N=>c({type:"SET_SEARCH_TERM",payload:N}),e[41]=me):me=e[41];let X;e[42]!==r.searchTerm?(X=t.jsx(Et,{value:r.searchTerm,onChange:me,placeholder:"Search connections..."}),e[42]=r.searchTerm,e[43]=X):X=e[43];let ee;e[44]!==p||e[45]!==r.searchTerm||e[46]!==j||e[47]!==V||e[48]!==C||e[49]!==Y?(ee=t.jsx("div",{className:"flex-1 overflow-auto p-2",children:t.jsx(is,{allConnections:p,searchTerm:r.searchTerm,selectedId:j,hasSelections:C,getSelectionSummary:V,onConnectionClick:qe,onToggleAll:Y})}),e[44]=p,e[45]=r.searchTerm,e[46]=j,e[47]=V,e[48]=C,e[49]=Y,e[50]=ee):ee=e[50];let te;e[51]!==X||e[52]!==ee?(te=t.jsxs("div",{className:"w-full sm:w-72 sm:border-r border-b sm:border-b-0 border-border flex flex-col bg-background sm:h-full max-h-[40vh] sm:max-h-full",children:[X,ee]}),e[51]=X,e[52]=ee,e[53]=te):te=e[53];let se;e[54]!==m||e[55]!==r.activeTab||e[56]!==j||e[57]!==f||e[58]!==W||e[59]!==K||e[60]!==B||e[61]!==A||e[62]!==I||e[63]!==z?(se=t.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:m&&j?t.jsx(rs,{currentConnection:m,activeTab:r.activeTab,selectedId:j,formData:f,toggleTool:z,toggleResource:I,togglePrompt:A,toggleAllTools:B,toggleAllResources:K,toggleAllPrompts:W,onTabChange:N=>c({type:"SET_ACTIVE_TAB",payload:N})},j):t.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Select a connection to view its tools, resources, and prompts"})}),e[54]=m,e[55]=r.activeTab,e[56]=j,e[57]=f,e[58]=W,e[59]=K,e[60]=B,e[61]=A,e[62]=I,e[63]=z,e[64]=se):se=e[64];let le;e[65]!==te||e[66]!==se?(le=t.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0 flex-col sm:flex-row",children:[te,se]}),e[65]=te,e[66]=se,e[67]=le):le=e[67];let oe;e[68]!==M?(oe=t.jsx(At,{className:"px-6 py-4 border-t border-border shrink-0",children:t.jsx(J,{variant:"outline",onClick:()=>M(!1),children:"Done"})}),e[68]=M,e[69]=oe):oe=e[69];let ne;e[70]!==le||e[71]!==oe?(ne=t.jsxs(Ue,{className:"sm:max-w-5xl h-[80vh] max-h-[80vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[le,oe]}),e[70]=le,e[71]=oe,e[72]=ne):ne=e[72];let ue;return e[73]!==M||e[74]!==s||e[75]!==ne?(ue=t.jsx(Ke,{open:s,onOpenChange:M,children:ne}),e[73]=M,e[74]=s,e[75]=ne,e[76]=ue):ue=e[76],ue}const us=Ze.pick({title:!0,description:!0,icon:!0,status:!0,metadata:!0,connections:!0}).extend({title:Qe().min(1,"Name is required").max(255)});function fs(o){const e=k.c(8);let s,n;e[0]!==o?({className:s,...n}=o,e[0]=o,e[1]=s,e[2]=n):(s=e[1],n=e[2]);let l;e[3]!==s?(l=ae("grid gap-3",s),e[3]=s,e[4]=l):l=e[4];let i;return e[5]!==n||e[6]!==l?(i=t.jsx(Bt,{"data-slot":"radio-group",className:l,...n}),e[5]=n,e[6]=l,e[7]=i):i=e[7],i}function Ee(o){const e=k.c(9);let s,n;e[0]!==o?({className:s,...n}=o,e[0]=o,e[1]=s,e[2]=n):(s=e[1],n=e[2]);let l;e[3]!==s?(l=ae("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",s),e[3]=s,e[4]=l):l=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Gt,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:t.jsx(Ft,{className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})}),e[5]=i):i=e[5];let d;return e[6]!==n||e[7]!==l?(d=t.jsx(Vt,{"data-slot":"radio-group-item",className:l,...n,children:i}),e[6]=n,e[7]=l,e[8]=d):d=e[8],d}function ps(o){const s=new TextEncoder().encode(o),n=Array.from(s,l=>String.fromCharCode(l)).join("");return btoa(n)}function xs(o){const e=k.c(10),{url:s}=o,[n,l]=S.useState(!1);let i;e[0]!==s?(i=async()=>{await navigator.clipboard.writeText(s),l(!0),ce.success("Agent URL copied to clipboard"),setTimeout(()=>l(!1),2e3)},e[0]=s,e[1]=i):i=e[1];const d=i;let a;e[2]!==n?(a=n?t.jsx(je,{size:20,className:"text-green-600"}):t.jsx(Re,{size:20}),e[2]=n,e[3]=a):a=e[3];const r=n?"Copied!":"Copy URL";let c;e[4]!==r?(c=t.jsx("span",{className:"text-xs font-medium",children:r}),e[4]=r,e[5]=c):c=e[5];let x;return e[6]!==d||e[7]!==a||e[8]!==c?(x=t.jsxs(J,{type:"button",variant:"outline",onClick:d,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[a,c]}),e[6]=d,e[7]=a,e[8]=c,e[9]=x):x=e[9],x}function hs(o){const e=k.c(7),{url:s,serverName:n}=o;let l;e[0]!==n||e[1]!==s?(l=()=>{const c=We(n),g=ps(JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Cursor"}},null,2)),p=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(c)}&config=${encodeURIComponent(g)}`;window.open(p,"_blank"),ce.success("Opening Cursor...")},e[0]=n,e[1]=s,e[2]=l):l=e[2];const i=l;let d,a;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("img",{src:"/logos/cursor.svg",alt:"Cursor",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(11%) sepia(8%) saturate(785%) hue-rotate(1deg) brightness(95%) contrast(89%)"}}),a=t.jsx("span",{className:"text-xs font-medium",children:"Install on Cursor"}),e[3]=d,e[4]=a):(d=e[3],a=e[4]);let r;return e[5]!==i?(r=t.jsxs(J,{type:"button",variant:"outline",onClick:i,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[d,a]}),e[5]=i,e[6]=r):r=e[6],r}function gs(o){const e=k.c(11),{url:s,serverName:n}=o,[l,i]=S.useState(!1);let d;e[0]!==n||e[1]!==s?(d=async()=>{const p=We(n),u=JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Claude Code"}},null,2),f=`claude mcp add-json "${p}" '${u.replace(/'/g,"'\\''")}'`;await navigator.clipboard.writeText(f),i(!0),ce.success("Claude Code command copied to clipboard"),setTimeout(()=>i(!1),2e3)},e[0]=n,e[1]=s,e[2]=d):d=e[2];const a=d;let r;e[3]!==l?(r=l?t.jsx(je,{size:20,className:"text-green-600"}):t.jsx("img",{src:"/logos/Claude Code.svg",alt:"Claude Code",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(55%) sepia(31%) saturate(1264%) hue-rotate(331deg) brightness(92%) contrast(86%)"}}),e[3]=l,e[4]=r):r=e[4];const c=l?"Copied!":"Install on Claude";let x;e[5]!==c?(x=t.jsx("span",{className:"text-xs font-medium",children:c}),e[5]=c,e[6]=x):x=e[6];let g;return e[7]!==a||e[8]!==r||e[9]!==x?(g=t.jsxs(J,{type:"button",variant:"outline",onClick:a,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[r,x]}),e[7]=a,e[8]=r,e[9]=x,e[10]=g):g=e[10],g}function js({virtualMcp:o}){const{org:e}=de(),s=ge({connectionId:zt,orgId:e.id}),[n,l]=S.useState(null),[i,d]=S.useState(!1),[a,r]=S.useState(!1),c=o.id,x=o.title||`agent-${c.slice(0,8)}`,g=n?`bunx @decocms/typegen@latest --mcp ${c} --key ${n} --output client.ts`:`bunx @decocms/typegen@latest --mcp ${c} --key <api-key> --output client.ts`,p=async()=>{d(!0);try{const f=(await s.callTool({name:"API_KEY_CREATE",arguments:{name:`typegen-${x}`,permissions:{[c]:["*"]}}})).structuredContent?.key;if(!f)throw new Error("No key in response");l(f)}catch{ce.error("Failed to generate API key")}finally{d(!1)}},h=async()=>{await navigator.clipboard.writeText(g),r(!0),ce.success("Command copied to clipboard"),setTimeout(()=>r(!1),2e3)};return t.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.jsx("h4",{className:"text-sm font-medium text-foreground",children:"Generate typed client"}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Introspects this agent and writes a typed"," ",t.jsx("code",{className:"font-mono",children:"client.ts"})," you can import directly."]})]}),!n&&t.jsxs(J,{type:"button",variant:"outline",size:"sm",className:"shrink-0 gap-1.5",onClick:p,disabled:i,children:[i?t.jsx(De,{size:14,className:"animate-spin"}):t.jsx(Ut,{size:14}),t.jsx("span",{children:i?"Generating…":"Generate API key"})]})]}),n&&t.jsx("p",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700",children:"Store this key securely — it won't be shown again."}),t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Generate client"}),t.jsx("div",{className:"rounded-md border border-input bg-muted/50 px-3 py-2.5",children:t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx("code",{className:"min-w-0 flex-1 break-all font-mono text-xs text-muted-foreground",children:g}),t.jsx(J,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:h,children:a?t.jsx(je,{size:12,className:"text-green-600"}):t.jsx(Re,{size:12})})]})}),t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Runtime variables"}),t.jsx(bs,{apiKey:n})]})}function bs(o){const e=k.c(19),{apiKey:s}=o,[n,l]=S.useState(!1),i=window.location.origin,d=s?`MESH_API_KEY=${s}`:"MESH_API_KEY=<api-key>",a=`MESH_BASE_URL=${i}`,r=`${d}
2
- ${a}`;let c;e[0]!==r?(c=async()=>{await navigator.clipboard.writeText(r),l(!0),setTimeout(()=>l(!1),2e3)},e[0]=r,e[1]=c):c=e[1];const x=c,g=!s;let p;e[2]!==g?(p=ae({"opacity-50":g}),e[2]=g,e[3]=p):p=e[3];let h;e[4]!==d||e[5]!==p?(h=t.jsx("span",{className:p,children:d}),e[4]=d,e[5]=p,e[6]=h):h=e[6];let u,f;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("br",{}),f=t.jsx("span",{children:a}),e[7]=u,e[8]=f):(u=e[7],f=e[8]);let b;e[9]!==h?(b=t.jsxs("code",{className:"min-w-0 flex-1 font-mono text-xs text-muted-foreground",children:[h,u,f]}),e[9]=h,e[10]=b):b=e[10];let m;e[11]!==n?(m=n?t.jsx(je,{size:12,className:"text-green-600"}):t.jsx(Re,{size:12}),e[11]=n,e[12]=m):m=e[12];let j;e[13]!==x||e[14]!==m?(j=t.jsx(J,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:x,children:m}),e[13]=x,e[14]=m,e[15]=j):j=e[15];let y;return e[16]!==b||e[17]!==j?(y=t.jsx("div",{className:"rounded-md border border-input bg-muted/50 px-3 py-2.5",children:t.jsxs("div",{className:"flex items-start gap-2",children:[b,j]})}),e[16]=b,e[17]=j,e[18]=y):y=e[18],y}function Ns(o){const e=k.c(3),{virtualMcp:s}=o;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("div",{className:"h-20 animate-pulse rounded-md bg-muted"}),e[0]=n):n=e[0];let l;return e[1]!==s?(l=t.jsx(S.Suspense,{fallback:n,children:t.jsx(js,{virtualMcp:s})}),e[1]=s,e[2]=l):l=e[2],l}function ys(o){const e=k.c(44),{open:s,onOpenChange:n,virtualMcp:l}=o,[i,d]=S.useState("code_execution");let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=P=>{(P==="passthrough"||P==="smart_tool_selection"||P==="code_execution")&&d(P)},e[0]=a):a=e[0];const r=a;let c;e[1]!==i||e[2]!==l.id?(c=new URL(`/mcp/virtual-mcp/${l.id}`,window.location.origin),c.searchParams.set("mode",i),e[1]=i,e[2]=l.id,e[3]=c):c=e[3];let x;e[4]!==l.id||e[5]!==l.title?(x=l.title||`agent-${l.id?.slice(0,8)??"default"}`,e[4]=l.id,e[5]=l.title,e[6]=x):x=e[6];const g=x;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Ot,{children:t.jsx($t,{children:"Connect"})}),e[7]=p):p=e[7];let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("div",{children:t.jsx("h4",{className:"text-sm font-medium text-foreground mt-1",children:"How should this agent work?"})}),e[8]=h):h=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(at,{className:"size-5 text-muted-foreground"})}),e[9]=u):u=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Direct access"}),e[10]=f):f=e[10];let b;e[11]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(pe,{asChild:!0,children:t.jsx(_e,{className:"size-3.5 text-muted-foreground"})}),e[11]=b):b=e[11];let m;e[12]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs("label",{htmlFor:"mode-passthrough",className:"flex items-center gap-3 px-3 py-5 rounded-lg border border-border hover:border-ring/50 cursor-pointer transition-colors has-checked:border-ring has-checked:bg-accent/5",children:[u,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[f,t.jsx(ye,{children:t.jsxs(xe,{children:[b,t.jsx(he,{className:"max-w-xs",children:t.jsx("p",{className:"text-xs",children:"All tools are exposed directly via tools/list. Best for small tool surfaces with deterministic behavior."})})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Best for small teams or when you need predictable behavior"})]}),t.jsx(Ee,{id:"mode-passthrough",value:"passthrough"})]}),e[12]=m):m=e[12];let j;e[13]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(ct,{className:"size-5 text-muted-foreground"})}),e[13]=j):j=e[13];let y;e[14]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Smart discovery"}),e[14]=y):y=e[14];let C;e[15]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(pe,{asChild:!0,children:t.jsx(_e,{className:"size-3.5 text-muted-foreground"})}),e[15]=C):C=e[15];let v;e[16]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsxs("label",{htmlFor:"mode-smart",className:"flex items-center gap-3 px-3 py-5 rounded-lg border border-border hover:border-ring/50 cursor-pointer transition-colors has-checked:border-ring has-checked:bg-accent/5",children:[j,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[y,t.jsx(ye,{children:t.jsxs(xe,{children:[C,t.jsx(he,{className:"max-w-xs",children:t.jsx("p",{className:"text-xs",children:"Uses meta-tools (GATEWAY_SEARCH_TOOLS, GATEWAY_DESCRIBE_TOOLS, GATEWAY_CALL_TOOL) to keep the tool list small and request details on demand."})})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Ideal for large teams with many tools - AI finds what it needs"})]}),t.jsx(Ee,{id:"mode-smart",value:"smart_tool_selection"})]}),e[16]=v):v=e[16];let V;e[17]===Symbol.for("react.memo_cache_sentinel")?(V=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(Ht,{className:"size-5 text-muted-foreground"})}),e[17]=V):V=e[17];let R;e[18]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Smart execution"}),e[18]=R):R=e[18];let T;e[19]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx(pe,{asChild:!0,children:t.jsx(_e,{className:"size-3.5 text-muted-foreground"})}),e[19]=T):T=e[19];let O;e[20]===Symbol.for("react.memo_cache_sentinel")?(O=t.jsxs("label",{htmlFor:"mode-code",className:"relative flex items-center gap-3 px-3 py-5 rounded-lg border border-border hover:border-ring/50 cursor-pointer transition-colors has-checked:border-ring has-checked:bg-accent/5",children:[V,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[R,t.jsx(ye,{children:t.jsxs(xe,{children:[T,t.jsx(he,{className:"max-w-xs",children:t.jsx("p",{className:"text-xs",children:"Exposes meta-tools for discovery + sandboxed execution (GATEWAY_RUN_CODE). Reduces overhead on large surfaces by shifting work into a controlled runtime."})})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Maximum flexibility - AI can write code to orchestrate tools"})]}),t.jsx(Ee,{id:"mode-code",value:"code_execution"}),t.jsx(Oe,{variant:"outline",className:"absolute -top-2.5 left-1/2 -translate-x-1/2 bg-background z-10",children:"Recommended"})]}),e[20]=O):O=e[20];let _;e[21]!==i?(_=t.jsxs("div",{className:"flex flex-col gap-3",children:[h,t.jsxs(fs,{value:i,onValueChange:r,className:"flex flex-col gap-4.5",children:[m,v,O]})]}),e[21]=i,e[22]=_):_=e[22];let w;e[23]!==c.href?(w=t.jsx(xs,{url:c.href}),e[23]=c.href,e[24]=w):w=e[24];let z,$;e[25]!==g||e[26]!==c.href?(z=t.jsx(hs,{url:c.href,serverName:g}),$=t.jsx(gs,{url:c.href,serverName:g}),e[25]=g,e[26]=c.href,e[27]=z,e[28]=$):(z=e[27],$=e[28]);let I;e[29]!==w||e[30]!==z||e[31]!==$?(I=t.jsx("div",{className:"flex flex-col gap-3 pt-2",children:t.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[w,z,$]})}),e[29]=w,e[30]=z,e[31]=$,e[32]=I):I=e[32];let D;e[33]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsx("div",{className:"border-t border-border"}),e[33]=D):D=e[33];let A;e[34]!==l?(A=t.jsx(Ns,{virtualMcp:l}),e[34]=l,e[35]=A):A=e[35];let E;e[36]!==_||e[37]!==I||e[38]!==A?(E=t.jsxs(Ue,{className:"max-h-[80vh] overflow-y-auto sm:max-w-2xl",children:[p,t.jsxs("div",{className:"flex flex-col gap-6",children:[_,I,D,A]})]}),e[36]=_,e[37]=I,e[38]=A,e[39]=E):E=e[39];let B;return e[40]!==n||e[41]!==s||e[42]!==E?(B=t.jsx(Ke,{open:s,onOpenChange:n,children:E}),e[40]=n,e[41]=s,e[42]=E,e[43]=B):B=e[43],B}function vs(o,e){switch(e.type){case"SET_SHARE_DIALOG_OPEN":return{...o,shareDialogOpen:e.payload};case"SET_CONNECTION_DIALOG_OPEN":return{...o,connectionDialogOpen:e.payload};case"SET_EDITING_CONNECTION_ID":return{...o,editingConnectionId:e.payload};case"SET_SKILLS_OPEN":return{...o,skillsOpen:e.payload};default:return o}}function Ie(o){const e=k.c(27),{connection_id:s,selected_tools:n,selected_resources:l,selected_prompts:i,onClick:d}=o,a=xt(s);if(!a)return null;let r;e[0]!==n?(r=Se(n),e[0]=n,e[1]=r):r=e[1];const c=r;let x;e[2]!==l?(x=Se(l),e[2]=l,e[3]=x):x=e[3];const g=x;let p;e[4]!==i?(p=Se(i),e[4]=i,e[5]=p):p=e[5];const h=p;let u;e[6]!==a.icon||e[7]!==a.title?(u=t.jsx(Ae,{icon:a.icon,name:a.title,size:"xs"}),e[6]=a.icon,e[7]=a.title,e[8]=u):u=e[8];let f;e[9]!==a.title?(f=t.jsx("p",{className:"flex-1 text-sm font-normal text-foreground truncate",children:a.title}),e[9]=a.title,e[10]=f):f=e[10];let b;e[11]!==c?(b=c!==0&&t.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",children:[t.jsx("span",{children:c==="all"?"all":c}),t.jsx(Le,{size:12})]}),e[11]=c,e[12]=b):b=e[12];let m;e[13]!==g?(m=g!==0&&t.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",children:[t.jsx("span",{children:g==="all"?"all":g}),t.jsx(be,{size:12})]}),e[13]=g,e[14]=m):m=e[14];let j;e[15]!==h?(j=h!==0&&t.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",children:[t.jsx("span",{children:h==="all"?"all":h}),t.jsx($e,{size:12})]}),e[15]=h,e[16]=j):j=e[16];let y;e[17]!==b||e[18]!==m||e[19]!==j?(y=t.jsxs(Oe,{variant:"secondary",className:"bg-muted h-5 gap-2 px-1.5 py-1 flex items-center",children:[b,m,j]}),e[17]=b,e[18]=m,e[19]=j,e[20]=y):y=e[20];let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(He,{size:16,className:"text-muted-foreground shrink-0"}),e[21]=C):C=e[21];let v;return e[22]!==d||e[23]!==u||e[24]!==f||e[25]!==y?(v=t.jsxs("div",{onClick:d,className:"w-full h-12 flex items-center gap-2 px-3 rounded-lg border border-border hover:bg-accent/50 transition-colors cursor-pointer",children:[u,f,y,C]}),e[22]=d,e[23]=u,e[24]=f,e[25]=y,e[26]=v):v=e[26],v}Ie.Fallback=function(){return t.jsxs("div",{className:"w-full h-12 flex items-center gap-2 px-3 rounded-lg border border-border",children:[t.jsx("div",{className:"size-5 rounded bg-muted animate-pulse shrink-0"}),t.jsx("div",{className:"flex-1 h-4 rounded bg-muted animate-pulse"}),t.jsxs(Oe,{variant:"secondary",className:"bg-muted h-5 gap-2 px-1.5 py-1 flex items-center",children:[t.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",children:[t.jsx("div",{className:"w-3 h-3 rounded bg-muted-foreground/20 animate-pulse"}),t.jsx(Le,{size:12})]}),t.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",children:[t.jsx("div",{className:"w-3 h-3 rounded bg-muted-foreground/20 animate-pulse"}),t.jsx(be,{size:12})]}),t.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",children:[t.jsx("div",{className:"w-3 h-3 rounded bg-muted-foreground/20 animate-pulse"}),t.jsx($e,{size:12})]})]}),t.jsx(He,{size:16,className:"text-muted-foreground shrink-0"})]})};function Cs({virtualMcp:o}){const{org:e}=de(),s=gt(),n=tt({resolver:st(us),defaultValues:o}),l=n.watch("connections"),[i,d]=S.useReducer(vs,{shareDialogOpen:!1,connectionDialogOpen:!1,editingConnectionId:null,skillsOpen:!1}),[,a]=rt(),{setVirtualMcpId:r}=ot();S.useEffect(()=>{a(!0),r(o.id)},[o.id]);const c=()=>{r(o.id),a(!0)},x=n.formState.isDirty,g=async()=>{const m=n.getValues(),j=await s.update.mutateAsync({id:o.id,data:m});n.reset(j)},p=()=>{n.reset(o)},h=()=>{d({type:"SET_EDITING_CONNECTION_ID",payload:null}),d({type:"SET_CONNECTION_DIALOG_OPEN",payload:!0})},u=m=>{d({type:"SET_EDITING_CONNECTION_ID",payload:m}),d({type:"SET_CONNECTION_DIALOG_OPEN",payload:!0})},f=s.update.isPending,b=t.jsx(yt,{children:t.jsxs(vt,{children:[t.jsx(Ge,{children:t.jsx(Ct,{asChild:!0,children:t.jsx(lt,{to:"/$org/$project/agents",params:{org:e.slug,project:Fe},children:"Agents"})})}),t.jsx(_t,{}),t.jsx(Ge,{children:t.jsx(St,{children:o.title})})]})});return t.jsxs(Tt,{breadcrumb:b,children:[t.jsxs(kt,{children:[t.jsx(wt,{onSave:g,onUndo:p,isDirty:x,isSaving:f}),t.jsxs(xe,{delayDuration:0,children:[t.jsx(pe,{asChild:!0,children:t.jsx("span",{className:"inline-block",children:t.jsxs(J,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 border border-input",onClick:c,"aria-label":"Test Agent",children:[t.jsx(bt,{size:14}),"Test Agent"]})})}),t.jsx(he,{side:"bottom",children:"Test this agent in chat"})]}),t.jsxs(J,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 border border-input",onClick:()=>d({type:"SET_SHARE_DIALOG_OPEN",payload:!0}),children:[t.jsx(Ye,{size:14}),"Connect"]})]}),t.jsx("div",{className:"flex h-full w-full bg-background overflow-auto",children:t.jsxs("div",{className:"flex flex-col w-full",children:[t.jsxs("div",{className:"flex items-start justify-between gap-4 p-6 shrink-0",children:[t.jsxs("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:[t.jsx(Me,{control:n.control,name:"icon",render:({field:m})=>t.jsx(it,{value:m.value,onChange:m.onChange,name:n.watch("title")||"Agent",size:"lg",className:"shrink-0 shadow-sm",fallbackIcon:t.jsx(Nt,{})})}),t.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[t.jsx(Ve,{...n.register("title"),className:"h-auto py-0.5 text-lg! font-medium leading-7 px-1 -mx-1 border-transparent hover:bg-input/25 focus:border-input bg-transparent transition-all",placeholder:"Agent Name"}),t.jsx(Ve,{...n.register("description"),className:"h-auto py-0.5 text-base text-muted-foreground leading-6 px-1 -mx-1 border-transparent hover:bg-input/25 focus:border-input bg-transparent transition-all",placeholder:"Add a description..."})]})]}),t.jsx("div",{className:"flex items-center gap-2 shrink-0",children:t.jsx(ut,{checked:n.watch("status")==="active",onCheckedChange:m=>n.setValue("status",m?"active":"inactive",{shouldDirty:!0})})})]}),t.jsxs(dt,{open:i.skillsOpen,onOpenChange:m=>d({type:"SET_SKILLS_OPEN",payload:m}),className:"border-t border-border shrink-0 max-h-[400px] overflow-hidden flex flex-col",children:[l.length===0?t.jsxs("button",{type:"button",onClick:h,className:"w-full flex items-center justify-between px-6 py-4 hover:bg-muted/50 transition-colors cursor-pointer",children:[t.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Skills"}),t.jsxs("div",{className:"h-7 px-2 inline-flex items-center justify-center gap-1 rounded-md text-sm text-muted-foreground",children:[t.jsx(Be,{size:14}),"Add"]})]}):t.jsx(mt,{asChild:!0,children:t.jsxs("button",{type:"button",className:"w-full flex items-center justify-between px-6 py-4 hover:bg-muted/50 transition-colors cursor-pointer",children:[t.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Skills"}),t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"ease-(--ease-out-expo)",style:{width:i.skillsOpen?0:"auto",marginRight:i.skillsOpen?0:4,opacity:i.skillsOpen?0:1,pointerEvents:i.skillsOpen?"none":"auto",transitionProperty:"all",transitionDuration:i.skillsOpen?"0ms":"200ms"},children:t.jsx(Kt,{connectionIds:l.map(m=>m.connection_id),maxVisibleIcons:2})}),t.jsxs("div",{role:"button",tabIndex:0,className:"h-7 inline-flex items-center justify-center rounded-md text-sm text-muted-foreground overflow-hidden transition-all duration-200 ease-(--ease-out-expo) hover:bg-accent hover:text-accent-foreground",style:{width:i.skillsOpen?"auto":28,paddingLeft:i.skillsOpen?8:0,paddingRight:i.skillsOpen?8:0,gap:i.skillsOpen?4:0},onPointerDown:m=>{m.stopPropagation()},onClick:m=>{m.stopPropagation(),m.preventDefault(),h()},onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.stopPropagation(),m.preventDefault(),h())},children:[t.jsx(Be,{size:14,className:"shrink-0"}),t.jsx("span",{className:"overflow-hidden whitespace-nowrap transition-all duration-200 ease-(--ease-out-expo)",style:{width:i.skillsOpen?"auto":0,opacity:i.skillsOpen?1:0},children:"Add"})]}),t.jsx("div",{className:"h-7 inline-flex items-center justify-center overflow-hidden transition-all duration-200 ease-(--ease-out-expo)",style:{width:i.skillsOpen?28:0,opacity:i.skillsOpen?1:0},children:t.jsx(jt,{size:16,className:"shrink-0"})})]})]})}),t.jsx("div",{className:"grid overflow-hidden transition-[grid-template-rows] duration-200 ease-(--ease-out-expo)",style:{gridTemplateRows:i.skillsOpen?"1fr":"0fr"},children:t.jsx("div",{className:"min-h-0 overflow-hidden",children:t.jsx("div",{className:"overflow-y-auto max-h-[300px] mask-[linear-gradient(to_bottom,black_calc(100%-40px),transparent_100%)]",children:t.jsx("div",{className:"flex flex-col gap-2 px-6 pb-4 pt-2",children:l.map(m=>t.jsx(S.Suspense,{fallback:t.jsx(Ie.Fallback,{}),children:t.jsx(Ie,{connection_id:m.connection_id,selected_tools:m.selected_tools,selected_resources:m.selected_resources,selected_prompts:m.selected_prompts,onClick:()=>u(m.connection_id)})},m.connection_id))})})})})]}),t.jsxs("div",{className:"flex flex-col flex-1 p-6 border-t border-border overflow-auto",children:[t.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Instructions"}),t.jsx(Me,{name:"metadata.instructions",control:n.control,render:({field:m})=>t.jsx(ft,{...m,value:m.value??"",placeholder:"Write instructions here...",className:"min-h-[200px] resize-none text-sm placeholder:text-muted-foreground/50 leading-relaxed border-0 rounded-none shadow-none px-0 focus-visible:ring-0 focus-visible:ring-offset-0 focus:border-0 bg-transparent"})})]})]})}),t.jsx(ms,{open:i.connectionDialogOpen,onOpenChange:m=>d({type:"SET_CONNECTION_DIALOG_OPEN",payload:m}),selectedId:i.editingConnectionId,form:n,connections:l}),t.jsx(ys,{open:i.shareDialogOpen,onOpenChange:m=>d({type:"SET_SHARE_DIALOG_OPEN",payload:m}),virtualMcp:o})]})}function _s(){const o=k.c(6),e=Xe();let s;o[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/$project/agents/$agentId"},o[0]=s):s=o[0];const n=et(s),{org:l,agentId:i}=n,d=ht(i);if(!d){let r;return o[1]!==e||o[2]!==l?(r=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(nt,{title:"Agent not found",description:"This Agent may have been deleted or you may not have access.",actions:t.jsx(J,{variant:"outline",onClick:()=>e({to:"/$org/$project/agents",params:{org:l,project:Fe}}),children:"Back to agents"})})}),o[1]=e,o[2]=l,o[3]=r):r=o[3],r}let a;return o[4]!==d?(a=t.jsx(Cs,{virtualMcp:d}),o[4]=d,o[5]=a):a=o[5],a}function Ul(){const o=k.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(fe,{children:t.jsx(S.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(De,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(_s,{})})}),o[0]=e):e=o[0],e}export{Ul as default};
@@ -1 +0,0 @@
1
- import{c as te,g as Ee,e as ze,u as ge,r as W,j as r,at as Pe,O as le,w as E,B as V,t as Ie,G as Ue,x as We,K as re}from"./index-EJhirEgi.js";import{E as xe}from"./empty-state-Dz90tIjg.js";import{V as ye,a as Fe}from"./layout-PA5WM8-4.js";import{S as Le}from"./save-actions-DvQBIk-t.js";import{u as ve}from"./use-llm-B0ZUgM3D.js";import{T as $e,a as Ve,M as Be,S as ce}from"./task-status-B95CCzhX.js";import{V as He}from"./select-virtual-mcp-Tk-m3Fu9.js";import{c as Ze,b as Ye,d as qe,e as we,f as Ke}from"./use-automations-3lm8AX10.js";import{u as Te}from"./index-wbJeckpV.js";import{b as Ce,d as je,c as be,A as De,e as Ne,h as _e,a as Se,f as Oe}from"./alert-dialog-CpiIzpaw.js";import{B as Ge}from"./badge-BiElTurh.js";import{b as he,d as Qe,c as Je,e as Xe,B as et,a as tt}from"./breadcrumb-U9pZLesK.js";import{I as ne}from"./input-23yd6VmI.js";import{b as st,P as it,a as rt}from"./popover-Cmt-BFZN.js";import{S as nt}from"./switch-DRgBKNMz.js";import{e as ot,a as at,b as Ae,T as J,d as lt,c as X}from"./table-Bs6V2h_N.js";import{u as ct}from"./useQuery-mGiR1oLn.js";import{u as ht,a as dt}from"./constants-BtZ3fAEQ.js";import{i as de}from"./ArrowLeft-jV1c6x3k.js";import{i as ut}from"./Check-BWCeXHN7.js";import{i as mt}from"./ChevronRight-DNq10e3Z.js";import{s as pt}from"./Clock-CbBdVVok.js";import{i as ft}from"./Edit05-FVXfLA6i.js";import{i as se}from"./Loading01-BUlApwyE.js";import{i as gt}from"./Play-a4a9k_A2.js";import{s as xt}from"./Plus-CiuqWk7L.js";import{i as yt}from"./SearchMd-D_8XQU19.js";import{s as ke}from"./Trash01-CHv5mU8b.js";import{s as vt}from"./XClose-B-kxIP35.js";import{a as oe,t as wt,b as Tt}from"./context-228p0Ol2.js";import{f as Ct}from"./formatDistanceToNow-Cb2QZZJn.js";import"./Save01-CGK6rW3l.js";import"./skeleton-BDMxlKkg.js";import"./spinner-DcYxwnHl.js";import"./tooltip-BXI94UP3.js";import"./index-Dv4huKa6.js";import"./use-mcp-prompts-LuO7HYtE.js";import"./dialog-DD3DgOo2.js";import"./X-CC0aD5R8.js";import"./form-BcVHSZnK.js";import"./label-t2hx_05l.js";import"./index-DJJzspJA.js";import"./usage-B8eRkRZY.js";import"./ArrowUp-DKc3SUsQ.js";import"./ChevronDown-B15SC8MA.js";import"./Edit01-BM5GDmTx.js";import"./Lock01-D2mdnqp4.js";import"./Users03-DBQP_ao_.js";import"./XCircle-CuIPHDkx.js";import"./AlertCircle-48gOoEWA.js";import"./select-B2Bho1QQ.js";import"./ChevronUp-Be0WocGY.js";import"./use-preferences-D5crHwiP.js";import"./localstorage-keys-CyCsfmz2.js";import"./useMutation-ClueFvpj.js";import"./use-copy-BAQklmkz.js";import"./tabs-Cbvel-f6.js";import"./collapsible-B9yZLN6Y.js";import"./index-DbAOnuVY.js";import"./Code01-BDvBTEm7.js";import"./checkbox-7ZiSm3FO.js";import"./AlignLeft-CKoC1cMY.js";import"./Image01-CHkBHANF.js";import"./Key01-Be9_ogDx.js";import"./RefreshCcw01-CpK4UKE8.js";import"./Settings01-BXea0IX5.js";import"./ai-providers-logos-W57Qm-EN.js";import"./org-ai-providers-DEZEBxef.js";import"./EyeOff-BeKLPveV.js";import"./Eye-DkD5as17.js";import"./card-DXYG1PJt.js";import"./avatar-CbDE9O_w.js";import"./use-mcp-resources-Dk6zV1FV.js";import"./Copy01-BJVPuQbm.js";import"./marked.esm-BaswSlok.js";import"./markdown-D-1lsMgV.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-YYUTU_-w.js";import"./types-CdefEA9e.js";import"./Globe02-BtYVEi0C.js";import"./LayersTwo01-CqPgQoaH.js";import"./integration-icon-DnuBmEuk.js";import"./Container-C4I-ZzWI.js";import"./CheckCircle-DZcEBbaZ.js";import"./use-virtual-mcp-D_iE9Cdz.js";import"./use-collections-B4b2cHqe.js";import"./use-create-virtual-mcp-DLy6t37V.js";import"./default-model-D8jxKXJs.js";import"./useSuspenseInfiniteQuery-DUeEwu4s.js";import"./infiniteQueryObserver--lmuu5bR.js";import"./differenceInSeconds-NQ4PDo0z.js";function N(e,t,s,i,o,n,l,a){return N.fromTZ(N.tp(e,t,s,i,o,n,l),a)}N.fromTZISO=(e,t,s)=>N.fromTZ(jt(e,t),s);N.fromTZ=function(e,t){let s=new Date(Date.UTC(e.y,e.m-1,e.d,e.h,e.i,e.s)),i=ie(e.tz,s),o=new Date(s.getTime()-i),n=ie(e.tz,o);if(n-i===0)return o;{let l=new Date(s.getTime()-n),a=ie(e.tz,l);if(a-n===0||!t&&a-n>0)return l;if(t)throw new Error("Invalid date passed to fromTZ()");return o}};N.toTZ=function(e,t){let s=e.toLocaleString("en-US",{timeZone:t}).replace(/[\u202f]/," "),i=new Date(s);return{y:i.getFullYear(),m:i.getMonth()+1,d:i.getDate(),h:i.getHours(),i:i.getMinutes(),s:i.getSeconds(),tz:t}};N.tp=(e,t,s,i,o,n,l)=>({y:e,m:t,d:s,h:i,i:o,s:n,tz:l});function ie(e,t=new Date){let s=t.toLocaleString("en-US",{timeZone:e,timeZoneName:"shortOffset"}).split(" ").slice(-1)[0],i=t.toLocaleString("en-US").replace(/[\u202f]/," ");return Date.parse(`${i} GMT`)-Date.parse(`${i} ${s}`)}function jt(e,t){let s=new Date(Date.parse(e));if(isNaN(s))throw new Error("minitz: Invalid ISO8601 passed to parser.");let i=e.substring(9);return e.includes("Z")||i.includes("-")||i.includes("+")?N.tp(s.getUTCFullYear(),s.getUTCMonth()+1,s.getUTCDate(),s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),"Etc/UTC"):N.tp(s.getFullYear(),s.getMonth()+1,s.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),t)}N.minitz=N;var ae=32,K=31|ae,Re=[1,2,4,8,16],ue=class{pattern;timezone;second;minute;hour;day;month;dayOfWeek;lastDayOfMonth;starDOM;starDOW;constructor(e,t){this.pattern=e,this.timezone=t,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.lastDayOfMonth=!1,this.starDOM=!1,this.starDOW=!1,this.parse()}parse(){if(!(typeof this.pattern=="string"||this.pattern instanceof String))throw new TypeError("CronPattern: Pattern has to be of type string.");this.pattern.indexOf("@")>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let e=this.pattern.replace(/\s+/g," ").split(" ");if(e.length<5||e.length>6)throw new TypeError("CronPattern: invalid configuration format ('"+this.pattern+"'), exactly five or six space separated parts are required.");if(e.length===5&&e.unshift("0"),e[3].indexOf("L")>=0&&(e[3]=e[3].replace("L",""),this.lastDayOfMonth=!0),e[3]=="*"&&(this.starDOM=!0),e[4].length>=3&&(e[4]=this.replaceAlphaMonths(e[4])),e[5].length>=3&&(e[5]=this.replaceAlphaDays(e[5])),e[5]=="*"&&(this.starDOW=!0),this.pattern.indexOf("?")>=0){let t=new I(new Date,this.timezone).getDate(!0);e[0]=e[0].replace("?",t.getSeconds().toString()),e[1]=e[1].replace("?",t.getMinutes().toString()),e[2]=e[2].replace("?",t.getHours().toString()),this.starDOM||(e[3]=e[3].replace("?",t.getDate().toString())),e[4]=e[4].replace("?",(t.getMonth()+1).toString()),this.starDOW||(e[5]=e[5].replace("?",t.getDay().toString()))}this.throwAtIllegalCharacters(e),this.partToArray("second",e[0],0,1),this.partToArray("minute",e[1],0,1),this.partToArray("hour",e[2],0,1),this.partToArray("day",e[3],-1,1),this.partToArray("month",e[4],-1,1),this.partToArray("dayOfWeek",e[5],0,K),this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(e,t,s,i){let o=this[e],n=e==="day"&&this.lastDayOfMonth;if(t===""&&!n)throw new TypeError("CronPattern: configuration entry "+e+" ("+t+") is empty, check for trailing spaces.");if(t==="*")return o.fill(i);let l=t.split(",");if(l.length>1)for(let a=0;a<l.length;a++)this.partToArray(e,l[a],s,i);else t.indexOf("-")!==-1&&t.indexOf("/")!==-1?this.handleRangeWithStepping(t,e,s,i):t.indexOf("-")!==-1?this.handleRange(t,e,s,i):t.indexOf("/")!==-1?this.handleStepping(t,e,s,i):t!==""&&this.handleNumber(t,e,s,i)}throwAtIllegalCharacters(e){for(let t=0;t<e.length;t++)if((t===5?/[^/*0-9,\-#L]+/:/[^/*0-9,-]+/).test(e[t]))throw new TypeError("CronPattern: configuration entry "+t+" ("+e[t]+") contains illegal characters.")}handleNumber(e,t,s,i){let o=this.extractNth(e,t),n=parseInt(o[0],10)+s;if(isNaN(n))throw new TypeError("CronPattern: "+t+" is not a number: '"+e+"'");this.setPart(t,n,o[1]||i)}setPart(e,t,s){if(!Object.prototype.hasOwnProperty.call(this,e))throw new TypeError("CronPattern: Invalid part specified: "+e);if(e==="dayOfWeek"){if(t===7&&(t=0),t<0||t>6)throw new RangeError("CronPattern: Invalid value for dayOfWeek: "+t);this.setNthWeekdayOfMonth(t,s);return}if(e==="second"||e==="minute"){if(t<0||t>=60)throw new RangeError("CronPattern: Invalid value for "+e+": "+t)}else if(e==="hour"){if(t<0||t>=24)throw new RangeError("CronPattern: Invalid value for "+e+": "+t)}else if(e==="day"){if(t<0||t>=31)throw new RangeError("CronPattern: Invalid value for "+e+": "+t)}else if(e==="month"&&(t<0||t>=12))throw new RangeError("CronPattern: Invalid value for "+e+": "+t);this[e][t]=s}handleRangeWithStepping(e,t,s,i){let o=this.extractNth(e,t),n=o[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(n===null)throw new TypeError("CronPattern: Syntax error, illegal range with stepping: '"+e+"'");let[,l,a,c]=n,u=parseInt(l,10)+s,d=parseInt(a,10)+s,x=parseInt(c,10);if(isNaN(u))throw new TypeError("CronPattern: Syntax error, illegal lower range (NaN)");if(isNaN(d))throw new TypeError("CronPattern: Syntax error, illegal upper range (NaN)");if(isNaN(x))throw new TypeError("CronPattern: Syntax error, illegal stepping: (NaN)");if(x===0)throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");if(x>this[t].length)throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[t].length+")");if(u>d)throw new TypeError("CronPattern: From value is larger than to value: '"+e+"'");for(let y=u;y<=d;y+=x)this.setPart(t,y,o[1]||i)}extractNth(e,t){let s=e,i;if(s.includes("#")){if(t!=="dayOfWeek")throw new Error("CronPattern: nth (#) only allowed in day-of-week field");i=s.split("#")[1],s=s.split("#")[0]}return[s,i]}handleRange(e,t,s,i){let o=this.extractNth(e,t),n=o[0].split("-");if(n.length!==2)throw new TypeError("CronPattern: Syntax error, illegal range: '"+e+"'");let l=parseInt(n[0],10)+s,a=parseInt(n[1],10)+s;if(isNaN(l))throw new TypeError("CronPattern: Syntax error, illegal lower range (NaN)");if(isNaN(a))throw new TypeError("CronPattern: Syntax error, illegal upper range (NaN)");if(l>a)throw new TypeError("CronPattern: From value is larger than to value: '"+e+"'");for(let c=l;c<=a;c++)this.setPart(t,c,o[1]||i)}handleStepping(e,t,s,i){let o=this.extractNth(e,t),n=o[0].split("/");if(n.length!==2)throw new TypeError("CronPattern: Syntax error, illegal stepping: '"+e+"'");n[0]===""&&(n[0]="*");let l=0;n[0]!=="*"&&(l=parseInt(n[0],10)+s);let a=parseInt(n[1],10);if(isNaN(a))throw new TypeError("CronPattern: Syntax error, illegal stepping: (NaN)");if(a===0)throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");if(a>this[t].length)throw new TypeError("CronPattern: Syntax error, max steps for part is ("+this[t].length+")");for(let c=l;c<this[t].length;c+=a)this.setPart(t,c,o[1]||i)}replaceAlphaDays(e){return e.replace(/-sun/gi,"-7").replace(/sun/gi,"0").replace(/mon/gi,"1").replace(/tue/gi,"2").replace(/wed/gi,"3").replace(/thu/gi,"4").replace(/fri/gi,"5").replace(/sat/gi,"6")}replaceAlphaMonths(e){return e.replace(/jan/gi,"1").replace(/feb/gi,"2").replace(/mar/gi,"3").replace(/apr/gi,"4").replace(/may/gi,"5").replace(/jun/gi,"6").replace(/jul/gi,"7").replace(/aug/gi,"8").replace(/sep/gi,"9").replace(/oct/gi,"10").replace(/nov/gi,"11").replace(/dec/gi,"12")}handleNicknames(e){let t=e.trim().toLowerCase();return t==="@yearly"||t==="@annually"?"0 0 1 1 *":t==="@monthly"?"0 0 1 * *":t==="@weekly"?"0 0 * * 0":t==="@daily"?"0 0 * * *":t==="@hourly"?"0 * * * *":e}setNthWeekdayOfMonth(e,t){if(typeof t!="number"&&t==="L")this.dayOfWeek[e]=this.dayOfWeek[e]|ae;else if(t===K)this.dayOfWeek[e]=K;else if(t<6&&t>0)this.dayOfWeek[e]=this.dayOfWeek[e]|Re[t-1];else throw new TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${t}, Type: ${typeof t}`)}},me=[31,28,31,30,31,30,31,31,30,31,30,31],$=[["month","year",0],["day","month",-1],["hour","day",0],["minute","hour",0],["second","minute",0]],I=class Me{tz;ms;second;minute;hour;day;month;year;constructor(t,s){if(this.tz=s,t&&t instanceof Date)if(!isNaN(t))this.fromDate(t);else throw new TypeError("CronDate: Invalid date passed to CronDate constructor");else if(t===void 0)this.fromDate(new Date);else if(t&&typeof t=="string")this.fromString(t);else if(t instanceof Me)this.fromCronDate(t);else throw new TypeError("CronDate: Invalid type ("+typeof t+") passed to CronDate constructor")}isNthWeekdayOfMonth(t,s,i,o){let n=new Date(Date.UTC(t,s,i)).getUTCDay(),l=0;for(let a=1;a<=i;a++)new Date(Date.UTC(t,s,a)).getUTCDay()===n&&l++;if(o&K&&Re[l-1]&o)return!0;if(o&ae){let a=new Date(Date.UTC(t,s+1,0)).getUTCDate();for(let c=i+1;c<=a;c++)if(new Date(Date.UTC(t,s,c)).getUTCDay()===n)return!1;return!0}return!1}fromDate(t){if(this.tz!==void 0)if(typeof this.tz=="number")this.ms=t.getUTCMilliseconds(),this.second=t.getUTCSeconds(),this.minute=t.getUTCMinutes()+this.tz,this.hour=t.getUTCHours(),this.day=t.getUTCDate(),this.month=t.getUTCMonth(),this.year=t.getUTCFullYear(),this.apply();else{let s=N.toTZ(t,this.tz);this.ms=t.getMilliseconds(),this.second=s.s,this.minute=s.i,this.hour=s.h,this.day=s.d,this.month=s.m-1,this.year=s.y}else this.ms=t.getMilliseconds(),this.second=t.getSeconds(),this.minute=t.getMinutes(),this.hour=t.getHours(),this.day=t.getDate(),this.month=t.getMonth(),this.year=t.getFullYear()}fromCronDate(t){this.tz=t.tz,this.year=t.year,this.month=t.month,this.day=t.day,this.hour=t.hour,this.minute=t.minute,this.second=t.second,this.ms=t.ms}apply(){if(this.month>11||this.day>me[this.month]||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let t=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=t.getUTCMilliseconds(),this.second=t.getUTCSeconds(),this.minute=t.getUTCMinutes(),this.hour=t.getUTCHours(),this.day=t.getUTCDate(),this.month=t.getUTCMonth(),this.year=t.getUTCFullYear(),!0}else return!1}fromString(t){if(typeof this.tz=="number"){let s=N.fromTZISO(t);this.ms=s.getUTCMilliseconds(),this.second=s.getUTCSeconds(),this.minute=s.getUTCMinutes(),this.hour=s.getUTCHours(),this.day=s.getUTCDate(),this.month=s.getUTCMonth(),this.year=s.getUTCFullYear(),this.apply()}else return this.fromDate(N.fromTZISO(t,this.tz))}findNext(t,s,i,o){let n=this[s],l;i.lastDayOfMonth&&(this.month!==1?l=me[this.month]:l=new Date(Date.UTC(this.year,this.month+1,0,0,0,0,0)).getUTCDate());let a=!i.starDOW&&s=="day"?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0;for(let c=this[s]+o;c<i[s].length;c++){let u=i[s][c];if(s==="day"&&i.lastDayOfMonth&&c-o==l&&(u=1),s==="day"&&!i.starDOW){let d=i.dayOfWeek[(a+(c-o-1))%7];if(d&&d&K)d=this.isNthWeekdayOfMonth(this.year,this.month,c-o,d)?1:0;else if(d)throw new Error(`CronDate: Invalid value for dayOfWeek encountered. ${d}`);t.legacyMode&&!i.starDOM?u=u||d:u=u&&d}if(u)return this[s]=c-o,n!==this[s]?2:1}return 3}recurse(t,s,i){let o=this.findNext(s,$[i][0],t,$[i][2]);if(o>1){let n=i+1;for(;n<$.length;)this[$[n][0]]=-$[n][2],n++;if(o===3)return this[$[i][1]]++,this[$[i][0]]=-$[i][2],this.apply(),this.recurse(t,s,0);if(this.apply())return this.recurse(t,s,i-1)}return i+=1,i>=$.length?this:this.year>=3e3?null:this.recurse(t,s,i)}increment(t,s,i){return this.second+=s.interval!==void 0&&s.interval>1&&i?s.interval:1,this.ms=0,this.apply(),this.recurse(t,s,0)}getDate(t){return t||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz=="number"?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):N.fromTZ(N.tp(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}};function bt(e){if(e===void 0&&(e={}),delete e.name,e.legacyMode=e.legacyMode===void 0?!0:e.legacyMode,e.paused=e.paused===void 0?!1:e.paused,e.maxRuns=e.maxRuns===void 0?1/0:e.maxRuns,e.catch=e.catch===void 0?!1:e.catch,e.interval=e.interval===void 0?0:parseInt(e.interval.toString(),10),e.utcOffset=e.utcOffset===void 0?void 0:parseInt(e.utcOffset.toString(),10),e.unref=e.unref===void 0?!1:e.unref,e.startAt&&(e.startAt=new I(e.startAt,e.timezone)),e.stopAt&&(e.stopAt=new I(e.stopAt,e.timezone)),e.interval!==null){if(isNaN(e.interval))throw new Error("CronOptions: Supplied value for interval is not a number");if(e.interval<0)throw new Error("CronOptions: Supplied value for interval can not be negative")}if(e.utcOffset!==void 0){if(isNaN(e.utcOffset))throw new Error("CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.");if(e.utcOffset<-870||e.utcOffset>870)throw new Error("CronOptions: utcOffset out of bounds.");if(e.utcOffset!==void 0&&e.timezone)throw new Error("CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.")}if(e.unref!==!0&&e.unref!==!1)throw new Error("CronOptions: Unref should be either true, false or undefined(false).");return e}function q(e){return Object.prototype.toString.call(e)==="[object Function]"||typeof e=="function"||e instanceof Function}function Dt(e){return q(e)}function Nt(e){typeof Deno<"u"&&typeof Deno.unrefTimer<"u"?Deno.unrefTimer(e):e&&typeof e.unref<"u"&&e.unref()}var pe=30*1e3,ee=[],_t=class{name;options;_states;fn;constructor(e,t,s){let i,o;if(q(t))o=t;else if(typeof t=="object")i=t;else if(t!==void 0)throw new Error("Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).");if(q(s))o=s;else if(typeof s=="object")i=s;else if(s!==void 0)throw new Error("Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).");if(this.name=i?.name,this.options=bt(i),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:i?i.maxRuns:void 0,paused:i?i.paused:!1,pattern:new ue("* * * * *")},e&&(e instanceof Date||typeof e=="string"&&e.indexOf(":")>0)?this._states.once=new I(e,this.options.timezone||this.options.utcOffset):this._states.pattern=new ue(e,this.options.timezone),this.name){if(ee.find(n=>n.name===this.name))throw new Error("Cron: Tried to initialize new named job '"+this.name+"', but name already taken.");ee.push(this)}return o!==void 0&&Dt(o)&&(this.fn=o,this.schedule()),this}nextRun(e){let t=this._next(e);return t?t.getDate(!1):null}nextRuns(e,t){this._states.maxRuns!==void 0&&e>this._states.maxRuns&&(e=this._states.maxRuns);let s=[],i=t||this._states.currentRun||void 0;for(;e--&&(i=this.nextRun(i));)s.push(i);return s}getPattern(){return this._states.pattern?this._states.pattern.pattern:void 0}isRunning(){let e=this.nextRun(this._states.currentRun),t=!this._states.paused,s=this.fn!==void 0,i=!this._states.kill;return t&&s&&i&&e!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(e){let t=this._next(e);return t?e instanceof I||e instanceof Date?t.getTime()-e.getTime():t.getTime()-new I(e).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let e=ee.indexOf(this);e>=0&&ee.splice(e,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(e){if(e&&this.fn)throw new Error("Cron: It is not allowed to schedule two functions using the same Croner instance.");e&&(this.fn=e);let t=this.msToNext(),s=this.nextRun(this._states.currentRun);return t==null||isNaN(t)||s===null?this:(t>pe&&(t=pe),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(s),t),this._states.currentTimeout&&this.options.unref&&Nt(this._states.currentTimeout),this)}async _trigger(e){if(this._states.blocking=!0,this._states.currentRun=new I(void 0,this.options.timezone||this.options.utcOffset),this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(t){q(this.options.catch)&&this.options.catch(t,this)}else this.fn!==void 0&&await this.fn(this,this.options.context);this._states.previousRun=new I(e,this.options.timezone||this.options.utcOffset),this._states.blocking=!1}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(e){let t=new Date,s=!this._states.paused&&t.getTime()>=e.getTime(),i=this._states.blocking&&this.options.protect;s&&!i?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):s&&i&&q(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(e){let t=!!(e||this._states.currentRun),s=!1;!e&&this.options.startAt&&this.options.interval&&([e,t]=this._calculatePreviousRun(e,t),s=!e),e=new I(e,this.options.timezone||this.options.utcOffset),this.options.startAt&&e&&e.getTime()<this.options.startAt.getTime()&&(e=this.options.startAt);let i=this._states.once||new I(e,this.options.timezone||this.options.utcOffset);return!s&&i!==this._states.once&&(i=i.increment(this._states.pattern,this.options,t)),this._states.once&&this._states.once.getTime()<=e.getTime()||i===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&i.getTime()>=this.options.stopAt.getTime()?null:i}_calculatePreviousRun(e,t){let s=new I(void 0,this.options.timezone||this.options.utcOffset),i=e;if(this.options.startAt.getTime()<=s.getTime()){i=this.options.startAt;let o=i.getTime()+this.options.interval*1e3;for(;o<=s.getTime();)i=new I(i,this.options.timezone||this.options.utcOffset).increment(this._states.pattern,this.options,!0),o=i.getTime()+this.options.interval*1e3;t=!0}return i===null&&(i=void 0),[i,t]}};const fe=[{label:"Minute",cron:"* * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function St(e){const t=te.c(44),{automationId:s}=e,i=we(),[o,n]=W.useState(!1),[l,a]=W.useState("menu"),[c,u]=W.useState(""),[d,x]=W.useState("");let y;if(t[0]===Symbol.for("react.memo_cache_sentinel")){const P=()=>{a("menu"),u(""),x("")};y=R=>{n(R),R||P()},t[0]=y}else y=t[0];const j=y;let m;t[1]!==i||t[2]!==s?(m=async P=>{try{await i.mutateAsync({automation_id:s,type:"cron",cron_expression:P}),E.success("Trigger added"),j(!1)}catch(R){const _=R,M=_ instanceof Error?_.message:"Failed to add trigger";E.error(M)}},t[1]=i,t[2]=s,t[3]=m):m=t[3];const f=m;let g;t[4]!==d||t[5]!==f?(g=()=>{if(!d.trim()){E.error("Cron expression is required");return}f(d.trim())},t[4]=d,t[5]=f,t[6]=g):g=t[6];const p=g;let v,C,b,w,z,h,O,D,A,k;if(t[7]!==i||t[8]!==d||t[9]!==p||t[10]!==o||t[11]!==c||t[12]!==f||t[13]!==l){const P=[...fe.map(T=>({label:`Every ${T.label}`,action:()=>f(T.cron)})),{label:"Custom (cron)",action:()=>a("custom-cron")}],R=c.trim()?P.filter(T=>T.label.toLowerCase().includes(c.toLowerCase())):null;C=st,k=o,b=j,t[24]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx(it,{asChild:!0,children:r.jsxs(V,{variant:"outline",size:"sm",children:[r.jsx(xt,{size:14}),"Add Trigger"]})}),t[24]=w):w=t[24],v=rt,O="w-[280px] p-0",D="end";let _;t[25]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(yt,{size:14,className:"text-muted-foreground pointer-events-none shrink-0"}),t[25]=_):_=t[25];let M;t[26]===Symbol.for("react.memo_cache_sentinel")?(M=T=>u(T.target.value),t[26]=M):M=t[26],t[27]!==c?(A=r.jsx("div",{className:"border-b px-3 py-2",children:r.jsxs("div",{className:"relative flex items-center gap-2",children:[_,r.jsx("input",{type:"text",placeholder:"Search triggers...",value:c,onChange:M,className:"flex-1 text-sm bg-transparent border-0 outline-none placeholder:text-muted-foreground"})]})}),t[27]=c,t[28]=A):A=t[28],z="py-1",h=R?R.length>0?R.map(T=>r.jsx("button",{type:"button",className:"w-full text-left px-3 py-2 text-sm hover:bg-accent cursor-pointer transition-colors",onClick:T.action,disabled:i.isPending,children:T.label},T.label)):r.jsx("div",{className:"px-3 py-4 text-sm text-muted-foreground text-center",children:"No triggers found"}):l==="menu"?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"px-3 py-1.5 text-xs font-medium text-muted-foreground flex items-center gap-1.5",children:[r.jsx(pt,{size:12}),"Scheduled"]}),r.jsxs("button",{type:"button",className:"w-full flex items-center justify-between px-3 py-2 text-sm hover:bg-accent cursor-pointer transition-colors",onClick:()=>a("every"),children:[r.jsx("span",{children:"Every..."}),r.jsx(mt,{size:14,className:"text-muted-foreground"})]}),r.jsx("button",{type:"button",className:"w-full text-left px-3 py-2 text-sm hover:bg-accent cursor-pointer transition-colors",onClick:()=>a("custom-cron"),children:"Custom (cron)"})]}):l==="every"?r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:"w-full flex items-center gap-1.5 px-3 py-2 text-sm hover:bg-accent cursor-pointer transition-colors text-muted-foreground",onClick:()=>a("menu"),children:[r.jsx(de,{size:14}),"Back"]}),fe.map(T=>r.jsxs("button",{type:"button",className:"w-full text-left px-3 py-2 text-sm hover:bg-accent cursor-pointer transition-colors",onClick:()=>f(T.cron),disabled:i.isPending,children:["Every ",T.label]},T.cron))]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:"w-full flex items-center gap-1.5 px-3 py-2 text-sm hover:bg-accent cursor-pointer transition-colors text-muted-foreground",onClick:()=>a("menu"),children:[r.jsx(de,{size:14}),"Back"]}),r.jsxs("div",{className:"px-3 py-2 flex flex-col gap-2",children:[r.jsx(ne,{value:d,onChange:T=>x(T.target.value),placeholder:"*/5 * * * *",className:"h-8 text-sm"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Minimum interval: 60 seconds between runs."}),r.jsxs(V,{size:"sm",className:"w-full",onClick:p,disabled:i.isPending,children:[i.isPending&&r.jsx(se,{size:14,className:"animate-spin"}),"Add Trigger"]})]})]}),t[7]=i,t[8]=d,t[9]=p,t[10]=o,t[11]=c,t[12]=f,t[13]=l,t[14]=v,t[15]=C,t[16]=b,t[17]=w,t[18]=z,t[19]=h,t[20]=O,t[21]=D,t[22]=A,t[23]=k}else v=t[14],C=t[15],b=t[16],w=t[17],z=t[18],h=t[19],O=t[20],D=t[21],A=t[22],k=t[23];let U;t[29]!==z||t[30]!==h?(U=r.jsx("div",{className:z,children:h}),t[29]=z,t[30]=h,t[31]=U):U=t[31];let F;t[32]!==v||t[33]!==U||t[34]!==O||t[35]!==D||t[36]!==A?(F=r.jsxs(v,{className:O,align:D,children:[A,U]}),t[32]=v,t[33]=U,t[34]=O,t[35]=D,t[36]=A,t[37]=F):F=t[37];let L;return t[38]!==C||t[39]!==b||t[40]!==w||t[41]!==F||t[42]!==k?(L=r.jsxs(C,{open:k,onOpenChange:b,children:[w,F]}),t[38]=C,t[39]=b,t[40]=w,t[41]=F,t[42]=k,t[43]=L):L=t[43],L}function Ot({trigger:e,automationId:t}){const s=Ke(),i=we(),[o,n]=W.useState(!1),[l,a]=W.useState(!1),[c,u]=W.useState(e.cron_expression??""),d=s.isPending||i.isPending,x=async()=>{try{await s.mutateAsync({trigger_id:e.id,automation_id:t}),E.success("Trigger removed")}catch{E.error("Failed to remove trigger")}n(!1)},y=async()=>{const g=c.trim();if(!g){E.error("Cron expression is required");return}if(g===e.cron_expression){a(!1);return}try{await i.mutateAsync({automation_id:t,type:"cron",cron_expression:g}),await s.mutateAsync({trigger_id:e.id,automation_id:t}),E.success("Trigger updated"),a(!1)}catch{E.error("Failed to update trigger")}},j=()=>{u(e.cron_expression??""),a(!1)},m=g=>{g.key==="Enter"&&y(),g.key==="Escape"&&j()},f=e.type==="cron";return r.jsxs(r.Fragment,{children:[r.jsxs(Ae,{children:[r.jsx(X,{children:r.jsx(Ge,{variant:"outline",children:f?"Cron":"Event"})}),r.jsx(X,{className:"text-muted-foreground font-mono text-xs",children:l?r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(ne,{value:c,onChange:g=>u(g.target.value),onKeyDown:m,placeholder:"*/5 * * * *",className:"h-7 text-xs font-mono w-36",autoFocus:!0,disabled:d}),r.jsx(V,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:y,disabled:d,children:d?r.jsx(se,{size:14,className:"animate-spin"}):r.jsx(ut,{size:14,className:"text-green-600"})}),r.jsx(V,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:j,disabled:d,children:r.jsx(vt,{size:14,className:"text-muted-foreground"})})]}):f?e.cron_expression:`${e.event_type} @ ${e.connection_id?.slice(0,8)}...`}),r.jsx(X,{className:"text-muted-foreground text-xs",children:(()=>{if(!f||!e.cron_expression)return"-";try{const g=new _t(e.cron_expression,{timezone:"UTC"}).nextRun();return g?g.toLocaleString(void 0,{timeZoneName:"short"}):"-"}catch{return"-"}})()}),r.jsx(X,{children:r.jsxs("div",{className:"flex items-center gap-0.5",children:[f&&!l&&r.jsx(V,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>a(!0),children:r.jsx(ft,{size:14,className:"text-muted-foreground"})}),r.jsx(V,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>n(!0),children:r.jsx(ke,{size:14,className:"text-muted-foreground"})})]})})]}),r.jsx(Oe,{open:o,onOpenChange:n,children:r.jsxs(Se,{children:[r.jsxs(Ce,{children:[r.jsx(be,{children:"Remove Trigger"}),r.jsx(je,{children:"Are you sure you want to remove this trigger? For event triggers, it will also be disabled on the connection."})]}),r.jsxs(Ne,{children:[r.jsx(De,{children:"Cancel"}),r.jsx(_e,{onClick:x,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]})})]})}function At({automationId:e,automation:t}){const s=qe(),{credentialId:i,model:o}=oe(),n=t.messages?.[0]?.metadata?.tiptapDoc??void 0,[l,a]=W.useState(n),[c,u]=W.useState(n),d=W.useRef(!1),x=h=>{a(h),d.current||(d.current=!0,n||u(h))},y=t.models?.credentialId||i||"",j=t.models?.thinking?.id||o?.modelId||"",m=Ie({defaultValues:{name:t.name,active:t.active,agent_id:t.agent?.id??"",credential_id:y,model_id:j}}),f=m.watch("agent_id"),g=m.watch("credential_id"),p=m.watch("model_id"),{models:v,isLoading:C}=ve(g||void 0),b=v.find(h=>h.modelId===p)??null,w=async()=>{const h=m.getValues();try{const O=h.credential_id&&h.model_id?h.credential_id:"",D=h.credential_id&&h.model_id?h.model_id:"";await s.mutateAsync({id:e,name:h.name,active:h.active,agent:{id:h.agent_id,mode:"passthrough"},models:{credentialId:O,thinking:{id:D}},messages:wt(l),temperature:0}),m.reset({...h,credential_id:O,model_id:D}),u(l),E.success("Automation saved")}catch{E.error("Failed to save automation")}},z=()=>{m.reset(),x(c)};return r.jsxs(r.Fragment,{children:[r.jsx(ye,{children:r.jsx(Le,{onSave:w,onUndo:z,isDirty:m.formState.isDirty||JSON.stringify(l??null)!==JSON.stringify(c??null),isSaving:s.isPending})}),r.jsxs("div",{className:"flex flex-col gap-6 p-6",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx(ne,{...m.register("name"),placeholder:"Automation name",className:"flex-1 max-w-xs"}),r.jsx(Ue,{control:m.control,name:"active",render:({field:h})=>r.jsx(nt,{checked:h.value,onCheckedChange:h.onChange,className:"cursor-pointer"})})]}),r.jsx($e,{tiptapDoc:l,setTiptapDoc:x,placeholder:"What should this automation do?",children:r.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[r.jsx(Ve,{virtualMcpId:f||null}),r.jsxs("div",{className:"flex items-center justify-between p-2.5",children:[r.jsx("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:r.jsx(He,{selectedVirtualMcpId:f||null,onVirtualMcpChange:h=>m.setValue("agent_id",h??"",{shouldDirty:!0}),placeholder:"Select Agent"})}),r.jsx("div",{className:"flex items-center gap-1.5",children:r.jsx(Be,{model:b,isLoading:C,credentialId:g||null,onCredentialChange:h=>{m.setValue("credential_id",h??"",{shouldDirty:!0}),m.setValue("model_id","",{shouldDirty:!0})},onModelChange:h=>m.setValue("model_id",h.modelId,{shouldDirty:!0}),placeholder:"Model"})})]})]})}),r.jsxs("div",{className:"flex flex-col gap-3 border-t border-border pt-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-sm font-medium",children:"Triggers"}),r.jsx(St,{automationId:e})]}),t.triggers.length===0?r.jsx("p",{className:"text-sm text-muted-foreground py-4",children:"No triggers configured. Add a cron schedule or event trigger."}):r.jsxs(ot,{children:[r.jsx(at,{children:r.jsxs(Ae,{children:[r.jsx(J,{children:"Type"}),r.jsx(J,{children:"Configuration"}),r.jsx(J,{children:"Next Run"}),r.jsx(J,{className:"w-12"})]})}),r.jsx(lt,{children:t.triggers.map(h=>r.jsx(Ot,{trigger:h,automationId:e},h.id))})]})]}),r.jsxs("div",{className:"flex flex-col gap-3 border-t border-border pt-6",children:[r.jsx("h3",{className:"text-sm font-medium",children:"Run History"}),r.jsx(Rt,{automationId:e,triggerIds:t.triggers.map(h=>h.id)})]})]})]})}function kt(e,t,s){const i=te.c(13);let o;i[0]!==e?(o={connectionId:dt,orgId:e},i[0]=e,i[1]=o):o=i[1];const n=ht(o);let l;i[2]!==t||i[3]!==e||i[4]!==s?(l=re.automationRuns(e,t,s),i[2]=t,i[3]=e,i[4]=s,i[5]=l):l=i[5];let a;i[6]!==n||i[7]!==s?(a=async()=>{if(!n)throw new Error("MCP client not available");const d=await n.callTool({name:"COLLECTION_THREADS_LIST",arguments:{where:{trigger_ids:s},limit:20}});return(d.structuredContent??d).items??[]},i[6]=n,i[7]=s,i[8]=a):a=i[8];const c=s.length>0;let u;return i[9]!==l||i[10]!==a||i[11]!==c?(u={queryKey:l,queryFn:a,enabled:c},i[9]=l,i[10]=a,i[11]=c,i[12]=u):u=i[12],ct(u)}function Rt(e){const t=te.c(22),{automationId:s,triggerIds:i}=e,{org:o}=ge(),{switchToTask:n}=oe(),[,l]=Te(),a=We(),{data:c,isLoading:u}=kt(o.id,s,i),d=i.length>0;let x;t[0]!==s||t[1]!==o.id||t[2]!==a||t[3]!==c||t[4]!==i?(x=p=>{const v=p.subject,C=c??[];C.find(w=>w.id===v)?a.setQueryData(re.automationRuns(o.id,s,i),C.map(w=>w.id===v?{...w,status:p.data.status,updated_at:new Date().toISOString()}:w)):a.invalidateQueries({queryKey:re.automationRuns(o.id,s,i)})},t[0]=s,t[1]=o.id,t[2]=a,t[3]=c,t[4]=i,t[5]=x):x=t[5];let y;if(t[6]!==o.id||t[7]!==d||t[8]!==x?(y={orgId:o.id,enabled:d,onTaskStatus:x},t[6]=o.id,t[7]=d,t[8]=x,t[9]=y):y=t[9],Tt(y),u){let p;return t[10]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(se,{size:18,className:"animate-spin text-muted-foreground"})}),t[10]=p):p=t[10],p}if(!c||c.length===0){let p;return t[11]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(xe,{title:"No run history",description:"Run history will appear here when the automation has been triggered."}),t[11]=p):p=t[11],p}let j;t[12]!==l||t[13]!==n?(j=async p=>{await n(p),l(!0)},t[12]=l,t[13]=n,t[14]=j):j=t[14];const m=j;let f;if(t[15]!==m||t[16]!==c){let p;t[18]!==m?(p=v=>{const C=ce[v.status]??ce.completed,b=C.icon;return r.jsxs("button",{type:"button",className:"flex items-center gap-3 px-1 py-2.5 text-left hover:bg-accent/50 transition-colors cursor-pointer rounded-sm",onClick:()=>m(v.id),children:[r.jsx(b,{size:16,className:C.iconClassName}),r.jsx("span",{className:"flex-1 min-w-0 text-sm truncate",children:v.title}),r.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:Ct(new Date(v.updated_at),{addSuffix:!0})})]},v.id)},t[18]=m,t[19]=p):p=t[19],f=c.map(p),t[15]=m,t[16]=c,t[17]=f}else f=t[17];let g;return t[20]!==f?(g=r.jsx("div",{className:"flex flex-col divide-y divide-border",children:f}),t[20]=f,t[21]=g):g=t[21],g}function gi(){const e=te.c(55);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t={strict:!1},e[0]=t):t=e[0];const{automationId:s}=Ee(t),i=ze(),{org:o}=ge(),{data:n,isLoading:l}=Ze(s),a=Ye(),[c,u]=W.useState(!1),{createTask:d,setVirtualMcpId:x,setSelectedModel:y,setSelectedMode:j,sendMessage:m}=oe(),[,f]=Te(),g=n?.models?.credentialId,p=n?.models?.thinking?.id,{models:v}=ve(g||void 0);let C;e[1]!==p||e[2]!==v?(C=v.find(S=>S.modelId===p)??null,e[1]=p,e[2]=v,e[3]=C):C=e[3];const b=C;let w;e[4]!==n?.agent?.id||e[5]!==n?.messages?.[0]||e[6]!==d||e[7]!==b||e[8]!==m||e[9]!==f||e[10]!==j||e[11]!==y||e[12]!==x?(w=()=>{const S=n?.messages?.[0]?.metadata?.tiptapDoc;if(!S){E.error("No message configured for this automation");return}x(n?.agent?.id??null),j("passthrough"),b&&y(b),f(!0),d(),setTimeout(()=>{m(S)},0)},e[4]=n?.agent?.id,e[5]=n?.messages?.[0],e[6]=d,e[7]=b,e[8]=m,e[9]=f,e[10]=j,e[11]=y,e[12]=x,e[13]=w):w=e[13];const z=w;let h;e[14]!==s||e[15]!==a||e[16]!==i||e[17]!==o?(h=async()=>{try{await a.mutateAsync(s),E.success("Automation deleted"),i({to:"/$org/$project/automations",params:{org:o.slug,project:le}})}catch{E.error("Failed to delete automation")}u(!1)},e[14]=s,e[15]=a,e[16]=i,e[17]=o,e[18]=h):h=e[18];const O=h;if(l){let S;return e[19]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(se,{size:24,className:"animate-spin text-muted-foreground"})}),e[19]=S):S=e[19],S}if(!n){let S;return e[20]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(xe,{title:"Automation not found",description:"This automation may have been deleted."}),e[20]=S):S=e[20],S}let D;e[21]!==o.slug?(D=r.jsx(he,{children:r.jsx(Qe,{asChild:!0,children:r.jsx(Pe,{to:"/$org/$project/automations",params:{org:o.slug,project:le},children:"Automations"})})}),e[21]=o.slug,e[22]=D):D=e[22];let A;e[23]===Symbol.for("react.memo_cache_sentinel")?(A=r.jsx(Xe,{}),e[23]=A):A=e[23];let k;e[24]!==n.name?(k=r.jsx(he,{children:r.jsx(Je,{children:n.name})}),e[24]=n.name,e[25]=k):k=e[25];let U;e[26]!==D||e[27]!==k?(U=r.jsx(et,{children:r.jsxs(tt,{children:[D,A,k]})}),e[26]=D,e[27]=k,e[28]=U):U=e[28];const F=U;let L;e[29]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(gt,{size:14}),e[29]=L):L=e[29];let P;e[30]!==z?(P=r.jsxs(V,{variant:"ghost",size:"sm",className:"h-7",onClick:z,children:[L,"Test Automation"]}),e[30]=z,e[31]=P):P=e[31];let R;e[32]===Symbol.for("react.memo_cache_sentinel")?(R=r.jsxs(V,{variant:"ghost",size:"sm",className:"h-7 text-destructive hover:text-destructive",onClick:()=>u(!0),children:[r.jsx(ke,{size:14}),"Delete"]}),e[32]=R):R=e[32];let _;e[33]!==P?(_=r.jsxs(ye,{children:[P,R]}),e[33]=P,e[34]=_):_=e[34];let M;e[35]!==n||e[36]!==s?(M=r.jsx(At,{automationId:s,automation:n},s),e[35]=n,e[36]=s,e[37]=M):M=e[37];let T;e[38]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx(be,{children:"Delete Automation"}),e[38]=T):T=e[38];let B;e[39]!==n.name?(B=r.jsxs(Ce,{children:[T,r.jsxs(je,{children:['Are you sure you want to delete "',n.name,'"? This action cannot be undone.']})]}),e[39]=n.name,e[40]=B):B=e[40];let G;e[41]===Symbol.for("react.memo_cache_sentinel")?(G=r.jsx(De,{children:"Cancel"}),e[41]=G):G=e[41];let H;e[42]!==O?(H=r.jsxs(Ne,{children:[G,r.jsx(_e,{onClick:O,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),e[42]=O,e[43]=H):H=e[43];let Z;e[44]!==B||e[45]!==H?(Z=r.jsxs(Se,{children:[B,H]}),e[44]=B,e[45]=H,e[46]=Z):Z=e[46];let Y;e[47]!==c||e[48]!==Z?(Y=r.jsx(Oe,{open:c,onOpenChange:u,children:Z}),e[47]=c,e[48]=Z,e[49]=Y):Y=e[49];let Q;return e[50]!==F||e[51]!==_||e[52]!==M||e[53]!==Y?(Q=r.jsxs(Fe,{breadcrumb:F,children:[_,M,Y]}),e[50]=F,e[51]=_,e[52]=M,e[53]=Y,e[54]=Q):Q=e[54],Q}export{gi as default};
@@ -1 +0,0 @@
1
- import{ab as a,ac as t}from"./index-EJhirEgi.js";const e=a(t,{target:"draft-7"});export{e as B};
@@ -1,29 +0,0 @@
1
- import{cc as Ga,cd as Ha,ab as Ya,bC as V,n as m,ce as qe,cf as Vt,bU as Qa,bV as Ka,bA as Xa,bH as Z,bF as Me,D as ke,o as O,bz as y,bG as re,cg as er,ch as k,_ as tr,bP as ar,r as M,c as fe,g as qt,x as ze,u as De,K as ie,w as _e,f as Bt,j as Ae,E as rr}from"./index-EJhirEgi.js";import{u as lt,a as ct,d as sr}from"./constants-BtZ3fAEQ.js";import{b as nr}from"./use-virtual-mcp-D_iE9Cdz.js";import{A as gt,D as Qe,s as or}from"./default-model-D8jxKXJs.js";import{b as ir,u as lr}from"./use-llm-B0ZUgM3D.js";import{u as we,L as Ee}from"./localstorage-keys-CyCsfmz2.js";import{u as cr}from"./use-preferences-D5crHwiP.js";import{b as ut,c as ur,a as dr,e as pr}from"./use-collections-B4b2cHqe.js";import{u as fr}from"./useSuspenseInfiniteQuery-DUeEwu4s.js";var Ne;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function a(s){throw new Error}t.assertNever=a,t.arrayToEnum=s=>{const n={};for(const i of s)n[i]=i;return n},t.getValidEnumValues=s=>{const n=t.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of n)i[o]=s[o];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(n){return s[n]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const n=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&n.push(i);return n},t.find=(s,n)=>{for(const i of s)if(n(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,n=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(n)}t.joinValues=r,t.jsonStringifyReplacer=(s,n)=>typeof n=="bigint"?n.toString():n})(Ne||(Ne={}));var vt;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(vt||(vt={}));Ne.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);Ne.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Be extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){const a=e||function(n){return n.message},r={_errors:[]},s=n=>{for(const i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)r._errors.push(a(i));else{let o=r,l=0;for(;l<i.path.length;){const c=i.path[l];l===i.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(a(i))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return s(this),r}static assert(e){if(!(e instanceof Be))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ne.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){const a=Object.create(null),r=[];for(const s of this.issues)if(s.path.length>0){const n=s.path[0];a[n]=a[n]||[],a[n].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:a}}get formErrors(){return this.flatten()}}Be.create=t=>new Be(t);var yt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(yt||(yt={}));var _;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(_||(_={}));var zt="vercel.ai.error",mr=Symbol.for(zt),bt,Et,Q=class Jt extends(Et=Error,bt=mr,Et){constructor({name:e,message:a,cause:r}){super(a),this[bt]=!0,this.name=e,this.cause=r}static isInstance(e){return Jt.hasMarker(e,zt)}static hasMarker(e,a){const r=Symbol.for(a);return e!=null&&typeof e=="object"&&r in e&&typeof e[r]=="boolean"&&e[r]===!0}};function Wt(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var Gt="AI_InvalidArgumentError",Ht=`vercel.ai.error.${Gt}`,hr=Symbol.for(Ht),_t,It,gr=class extends(It=Q,_t=hr,It){constructor({message:t,cause:e,argument:a}){super({name:Gt,message:t,cause:e}),this[_t]=!0,this.argument=a}static isInstance(t){return Q.hasMarker(t,Ht)}},Yt="AI_JSONParseError",Qt=`vercel.ai.error.${Yt}`,vr=Symbol.for(Qt),St,Tt,At=class extends(Tt=Q,St=vr,Tt){constructor({text:t,cause:e}){super({name:Yt,message:`JSON parsing failed: Text: ${t}.
2
- Error message: ${Wt(e)}`,cause:e}),this[St]=!0,this.text=t}static isInstance(t){return Q.hasMarker(t,Qt)}},Kt="AI_TypeValidationError",Xt=`vercel.ai.error.${Kt}`,yr=Symbol.for(Xt),wt,Ct,Ie=class at extends(Ct=Q,wt=yr,Ct){constructor({value:e,cause:a,context:r}){let s="Type validation failed";if(r?.field&&(s+=` for ${r.field}`),r?.entityName||r?.entityId){s+=" (";const n=[];r.entityName&&n.push(r.entityName),r.entityId&&n.push(`id: "${r.entityId}"`),s+=n.join(", "),s+=")"}super({name:Kt,message:`${s}: Value: ${JSON.stringify(e)}.
3
- Error message: ${Wt(a)}`,cause:a}),this[wt]=!0,this.value=e,this.context=r}static isInstance(e){return Q.hasMarker(e,Xt)}static wrap({value:e,cause:a,context:r}){var s,n,i;return at.isInstance(a)&&a.value===e&&((s=a.context)==null?void 0:s.field)===r?.field&&((n=a.context)==null?void 0:n.entityName)===r?.entityName&&((i=a.context)==null?void 0:i.entityId)===r?.entityId?a:new at({value:e,cause:a,context:r})}},$e=({prefix:t,size:e=16,alphabet:a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:r="-"}={})=>{const s=()=>{const n=a.length,i=new Array(e);for(let o=0;o<e;o++)i[o]=a[Math.random()*n|0];return i.join("")};if(t==null)return s;if(a.includes(r))throw new gr({argument:"separator",message:`The separator "${r}" must not be part of the alphabet "${a}".`});return()=>`${t}${r}${s()}`},br=$e();function xt(t=globalThis){var e,a,r;return t.window?"runtime/browser":(e=t.navigator)!=null&&e.userAgent?`runtime/${t.navigator.userAgent.toLowerCase()}`:(r=(a=t.process)==null?void 0:a.versions)!=null&&r.node?`runtime/node.js/${t.process.version.substring(0)}`:t.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function de(t){if(t==null)return{};const e={};if(t instanceof Headers)t.forEach((a,r)=>{e[r.toLowerCase()]=a});else{Array.isArray(t)||(t=Object.entries(t));for(const[a,r]of t)r!=null&&(e[a.toLowerCase()]=r)}return e}function Rt(t,...e){const a=new Headers(de(t)),r=a.get("user-agent")||"";return a.set("user-agent",[r,...e].filter(Boolean).join(" ")),Object.fromEntries(a.entries())}var Er=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,_r=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function Mt(t){const e=JSON.parse(t);return e===null||typeof e!="object"||Er.test(t)===!1&&_r.test(t)===!1?e:Ir(e)}function Ir(t){let e=[t];for(;e.length;){const a=e;e=[];for(const r of a){if(Object.prototype.hasOwnProperty.call(r,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(r,"constructor")&&r.constructor!==null&&typeof r.constructor=="object"&&Object.prototype.hasOwnProperty.call(r.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const s in r){const n=r[s];n&&typeof n=="object"&&e.push(n)}}}return t}function Sr(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return Mt(t)}try{return Mt(t)}finally{Error.stackTraceLimit=e}}function dt(t){if(t.type==="object"||Array.isArray(t.type)&&t.type.includes("object")){t.additionalProperties=!1;const{properties:a}=t;if(a!=null)for(const r of Object.keys(a))a[r]=ue(a[r])}t.items!=null&&(t.items=Array.isArray(t.items)?t.items.map(ue):ue(t.items)),t.anyOf!=null&&(t.anyOf=t.anyOf.map(ue)),t.allOf!=null&&(t.allOf=t.allOf.map(ue)),t.oneOf!=null&&(t.oneOf=t.oneOf.map(ue));const{definitions:e}=t;if(e!=null)for(const a of Object.keys(e))e[a]=ue(e[a]);return t}function ue(t){return typeof t=="boolean"?t:dt(t)}var Tr=Symbol("Let zodToJsonSchema decide on which parser to use"),Nt={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},Ar=t=>typeof t=="string"?{...Nt,name:t}:{...Nt,...t};function z(){return{}}function wr(t,e){var a,r,s;const n={type:"array"};return(a=t.type)!=null&&a._def&&((s=(r=t.type)==null?void 0:r._def)==null?void 0:s.typeName)!==_.ZodAny&&(n.items=N(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(n.minItems=t.minLength.value),t.maxLength&&(n.maxItems=t.maxLength.value),t.exactLength&&(n.minItems=t.exactLength.value,n.maxItems=t.exactLength.value),n}function Cr(t){const e={type:"integer",format:"int64"};if(!t.checks)return e;for(const a of t.checks)switch(a.kind){case"min":a.inclusive?e.minimum=a.value:e.exclusiveMinimum=a.value;break;case"max":a.inclusive?e.maximum=a.value:e.exclusiveMaximum=a.value;break;case"multipleOf":e.multipleOf=a.value;break}return e}function xr(){return{type:"boolean"}}function ea(t,e){return N(t.type._def,e)}var Rr=(t,e)=>N(t.innerType._def,e);function ta(t,e,a){const r=a??e.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((s,n)=>ta(t,e,s))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Mr(t)}}var Mr=t=>{const e={type:"integer",format:"unix-time"};for(const a of t.checks)switch(a.kind){case"min":e.minimum=a.value;break;case"max":e.maximum=a.value;break}return e};function Nr(t,e){return{...N(t.innerType._def,e),default:t.defaultValue()}}function Or(t,e){return e.effectStrategy==="input"?N(t.schema._def,e):z()}function Pr(t){return{type:"string",enum:Array.from(t.values)}}var kr=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function Dr(t,e){const a=[N(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),N(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(s=>!!s),r=[];return a.forEach(s=>{if(kr(s))r.push(...s.allOf);else{let n=s;if("additionalProperties"in s&&s.additionalProperties===!1){const{additionalProperties:i,...o}=s;n=o}r.push(n)}}),r.length?{allOf:r}:void 0}function $r(t){const e=typeof t.value;return e!=="bigint"&&e!=="number"&&e!=="boolean"&&e!=="string"?{type:Array.isArray(t.value)?"array":"object"}:{type:e==="bigint"?"integer":e,const:t.value}}var Ke=void 0,G={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Ke===void 0&&(Ke=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ke),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function aa(t,e){const a={type:"string"};if(t.checks)for(const r of t.checks)switch(r.kind){case"min":a.minLength=typeof a.minLength=="number"?Math.max(a.minLength,r.value):r.value;break;case"max":a.maxLength=typeof a.maxLength=="number"?Math.min(a.maxLength,r.value):r.value;break;case"email":switch(e.emailStrategy){case"format:email":H(a,"email",r.message,e);break;case"format:idn-email":H(a,"idn-email",r.message,e);break;case"pattern:zod":L(a,G.email,r.message,e);break}break;case"url":H(a,"uri",r.message,e);break;case"uuid":H(a,"uuid",r.message,e);break;case"regex":L(a,r.regex,r.message,e);break;case"cuid":L(a,G.cuid,r.message,e);break;case"cuid2":L(a,G.cuid2,r.message,e);break;case"startsWith":L(a,RegExp(`^${Xe(r.value,e)}`),r.message,e);break;case"endsWith":L(a,RegExp(`${Xe(r.value,e)}$`),r.message,e);break;case"datetime":H(a,"date-time",r.message,e);break;case"date":H(a,"date",r.message,e);break;case"time":H(a,"time",r.message,e);break;case"duration":H(a,"duration",r.message,e);break;case"length":a.minLength=typeof a.minLength=="number"?Math.max(a.minLength,r.value):r.value,a.maxLength=typeof a.maxLength=="number"?Math.min(a.maxLength,r.value):r.value;break;case"includes":{L(a,RegExp(Xe(r.value,e)),r.message,e);break}case"ip":{r.version!=="v6"&&H(a,"ipv4",r.message,e),r.version!=="v4"&&H(a,"ipv6",r.message,e);break}case"base64url":L(a,G.base64url,r.message,e);break;case"jwt":L(a,G.jwt,r.message,e);break;case"cidr":{r.version!=="v6"&&L(a,G.ipv4Cidr,r.message,e),r.version!=="v4"&&L(a,G.ipv6Cidr,r.message,e);break}case"emoji":L(a,G.emoji(),r.message,e);break;case"ulid":{L(a,G.ulid,r.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{H(a,"binary",r.message,e);break}case"contentEncoding:base64":{a.contentEncoding="base64";break}case"pattern:zod":{L(a,G.base64,r.message,e);break}}break}case"nanoid":L(a,G.nanoid,r.message,e)}return a}function Xe(t,e){return e.patternStrategy==="escape"?Lr(t):t}var jr=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Lr(t){let e="";for(let a=0;a<t.length;a++)jr.has(t[a])||(e+="\\"),e+=t[a];return e}function H(t,e,a,r){var s;t.format||(s=t.anyOf)!=null&&s.some(n=>n.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format}),delete t.format),t.anyOf.push({format:e,...a&&r.errorMessages&&{errorMessage:{format:a}}})):t.format=e}function L(t,e,a,r){var s;t.pattern||(s=t.allOf)!=null&&s.some(n=>n.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern}),delete t.pattern),t.allOf.push({pattern:Ot(e,r),...a&&r.errorMessages&&{errorMessage:{pattern:a}}})):t.pattern=Ot(e,r)}function Ot(t,e){var a;if(!e.applyRegexFlags||!t.flags)return t.source;const r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},s=r.i?t.source.toLowerCase():t.source;let n="",i=!1,o=!1,l=!1;for(let c=0;c<s.length;c++){if(i){n+=s[c],i=!1;continue}if(r.i){if(o){if(s[c].match(/[a-z]/)){l?(n+=s[c],n+=`${s[c-2]}-${s[c]}`.toUpperCase(),l=!1):s[c+1]==="-"&&((a=s[c+2])!=null&&a.match(/[a-z]/))?(n+=s[c],l=!0):n+=`${s[c]}${s[c].toUpperCase()}`;continue}}else if(s[c].match(/[a-z]/)){n+=`[${s[c]}${s[c].toUpperCase()}]`;continue}}if(r.m){if(s[c]==="^"){n+=`(^|(?<=[\r
4
- ]))`;continue}else if(s[c]==="$"){n+=`($|(?=[\r
5
- ]))`;continue}}if(r.s&&s[c]==="."){n+=o?`${s[c]}\r
6
- `:`[${s[c]}\r
7
- ]`;continue}n+=s[c],s[c]==="\\"?i=!0:o&&s[c]==="]"?o=!1:!o&&s[c]==="["&&(o=!0)}try{new RegExp(n)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return n}function ra(t,e){var a,r,s,n,i,o;const l={type:"object",additionalProperties:(a=N(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?a:e.allowedAdditionalProperties};if(((r=t.keyType)==null?void 0:r._def.typeName)===_.ZodString&&((s=t.keyType._def.checks)!=null&&s.length)){const{type:c,...d}=aa(t.keyType._def,e);return{...l,propertyNames:d}}else{if(((n=t.keyType)==null?void 0:n._def.typeName)===_.ZodEnum)return{...l,propertyNames:{enum:t.keyType._def.values}};if(((i=t.keyType)==null?void 0:i._def.typeName)===_.ZodBranded&&t.keyType._def.type._def.typeName===_.ZodString&&((o=t.keyType._def.type._def.checks)!=null&&o.length)){const{type:c,...d}=ea(t.keyType._def,e);return{...l,propertyNames:d}}}return l}function Zr(t,e){if(e.mapStrategy==="record")return ra(t,e);const a=N(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||z(),r=N(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||z();return{type:"array",maxItems:125,items:{type:"array",items:[a,r],minItems:2,maxItems:2}}}function Fr(t){const e=t.values,r=Object.keys(t.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),s=Array.from(new Set(r.map(n=>typeof n)));return{type:s.length===1?s[0]==="string"?"string":"number":["string","number"],enum:r}}function Ur(){return{not:z()}}function Vr(){return{type:"null"}}var rt={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function qr(t,e){const a=t.options instanceof Map?Array.from(t.options.values()):t.options;if(a.every(r=>r._def.typeName in rt&&(!r._def.checks||!r._def.checks.length))){const r=a.reduce((s,n)=>{const i=rt[n._def.typeName];return i&&!s.includes(i)?[...s,i]:s},[]);return{type:r.length>1?r:r[0]}}else if(a.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=a.reduce((s,n)=>{const i=typeof n._def.value;switch(i){case"string":case"number":case"boolean":return[...s,i];case"bigint":return[...s,"integer"];case"object":if(n._def.value===null)return[...s,"null"];default:return s}},[]);if(r.length===a.length){const s=r.filter((n,i,o)=>o.indexOf(n)===i);return{type:s.length>1?s:s[0],enum:a.reduce((n,i)=>n.includes(i._def.value)?n:[...n,i._def.value],[])}}}else if(a.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:a.reduce((r,s)=>[...r,...s._def.values.filter(n=>!r.includes(n))],[])};return Br(t,e)}var Br=(t,e)=>{const a=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((r,s)=>N(r._def,{...e,currentPath:[...e.currentPath,"anyOf",`${s}`]})).filter(r=>!!r&&(!e.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return a.length?{anyOf:a}:void 0};function zr(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[rt[t.innerType._def.typeName],"null"]};const a=N(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}function Jr(t){const e={type:"number"};if(!t.checks)return e;for(const a of t.checks)switch(a.kind){case"int":e.type="integer";break;case"min":a.inclusive?e.minimum=a.value:e.exclusiveMinimum=a.value;break;case"max":a.inclusive?e.maximum=a.value:e.exclusiveMaximum=a.value;break;case"multipleOf":e.multipleOf=a.value;break}return e}function Wr(t,e){const a={type:"object",properties:{}},r=[],s=t.shape();for(const i in s){let o=s[i];if(o===void 0||o._def===void 0)continue;const l=Hr(o),c=N(o._def,{...e,currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]});c!==void 0&&(a.properties[i]=c,l||r.push(i))}r.length&&(a.required=r);const n=Gr(t,e);return n!==void 0&&(a.additionalProperties=n),a}function Gr(t,e){if(t.catchall._def.typeName!=="ZodNever")return N(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function Hr(t){try{return t.isOptional()}catch{return!0}}var Yr=(t,e)=>{var a;if(e.currentPath.toString()===((a=e.propertyPath)==null?void 0:a.toString()))return N(t.innerType._def,e);const r=N(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:z()},r]}:z()},Qr=(t,e)=>{if(e.pipeStrategy==="input")return N(t.in._def,e);if(e.pipeStrategy==="output")return N(t.out._def,e);const a=N(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),r=N(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",a?"1":"0"]});return{allOf:[a,r].filter(s=>s!==void 0)}};function Kr(t,e){return N(t.type._def,e)}function Xr(t,e){const r={type:"array",uniqueItems:!0,items:N(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(r.minItems=t.minSize.value),t.maxSize&&(r.maxItems=t.maxSize.value),r}function es(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((a,r)=>N(a._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((a,r)=>r===void 0?a:[...a,r],[]),additionalItems:N(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((a,r)=>N(a._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((a,r)=>r===void 0?a:[...a,r],[])}}function ts(){return{not:z()}}function as(){return z()}var rs=(t,e)=>N(t.innerType._def,e),ss=(t,e,a)=>{switch(e){case _.ZodString:return aa(t,a);case _.ZodNumber:return Jr(t);case _.ZodObject:return Wr(t,a);case _.ZodBigInt:return Cr(t);case _.ZodBoolean:return xr();case _.ZodDate:return ta(t,a);case _.ZodUndefined:return ts();case _.ZodNull:return Vr();case _.ZodArray:return wr(t,a);case _.ZodUnion:case _.ZodDiscriminatedUnion:return qr(t,a);case _.ZodIntersection:return Dr(t,a);case _.ZodTuple:return es(t,a);case _.ZodRecord:return ra(t,a);case _.ZodLiteral:return $r(t);case _.ZodEnum:return Pr(t);case _.ZodNativeEnum:return Fr(t);case _.ZodNullable:return zr(t,a);case _.ZodOptional:return Yr(t,a);case _.ZodMap:return Zr(t,a);case _.ZodSet:return Xr(t,a);case _.ZodLazy:return()=>t.getter()._def;case _.ZodPromise:return Kr(t,a);case _.ZodNaN:case _.ZodNever:return Ur();case _.ZodEffects:return Or(t,a);case _.ZodAny:return z();case _.ZodUnknown:return as();case _.ZodDefault:return Nr(t,a);case _.ZodBranded:return ea(t,a);case _.ZodReadonly:return rs(t,a);case _.ZodCatch:return Rr(t,a);case _.ZodPipeline:return Qr(t,a);case _.ZodFunction:case _.ZodVoid:case _.ZodSymbol:return;default:return(r=>{})()}},ns=(t,e)=>{let a=0;for(;a<t.length&&a<e.length&&t[a]===e[a];a++);return[(t.length-a).toString(),...e.slice(a)].join("/")};function N(t,e,a=!1){var r;const s=e.seen.get(t);if(e.override){const l=(r=e.override)==null?void 0:r.call(e,t,e,s,a);if(l!==Tr)return l}if(s&&!a){const l=os(s,e);if(l!==void 0)return l}const n={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,n);const i=ss(t,t.typeName,e),o=typeof i=="function"?N(i(),e):i;if(o&&is(t,e,o),e.postProcess){const l=e.postProcess(o,t,e);return n.jsonSchema=o,l}return n.jsonSchema=o,o}var os=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:ns(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((a,r)=>e.currentPath[r]===a)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),z()):e.$refStrategy==="seen"?z():void 0}},is=(t,e,a)=>(t.description&&(a.description=t.description),a),ls=t=>{const e=Ar(t),a=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:a,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([r,s])=>[s._def,{def:s._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))}},cs=(t,e)=>{var a;const r=ls(e);let s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[d,p])=>{var h;return{...c,[d]:(h=N(p._def,{...r,currentPath:[...r.basePath,r.definitionPath,d]},!0))!=null?h:z()}},{}):void 0;const n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=(a=N(t._def,n===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,n]},!1))!=null?a:z(),o=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;o!==void 0&&(i.title=o);const l=n===void 0?s?{...i,[r.definitionPath]:s}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,n].join("/"),[r.definitionPath]:{...s,[n]:i}};return l.$schema="http://json-schema.org/draft-07/schema#",l},st=Symbol.for("vercel.ai.schema");function us(t){let e;return()=>(e==null&&(e=t()),e)}function Je(t,{validate:e}={}){return{[st]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function ds(t){return typeof t=="object"&&t!==null&&st in t&&t[st]===!0&&"jsonSchema"in t&&"validate"in t}function pt(t){return t==null?Je({properties:{},additionalProperties:!1}):ds(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?sa(t):ps(t):t()}function ps(t){return Je(()=>dt(t["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async e=>{const a=await t["~standard"].validate(e);return"value"in a?{success:!0,value:a.value}:{success:!1,error:new Ie({value:e,cause:a.issues})}}})}function fs(t,e){var a;const r=(a=void 0)!=null?a:!1;return Je(()=>cs(t,{$refStrategy:r?"root":"none"}),{validate:async s=>{const n=await t.safeParseAsync(s);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function ms(t,e){var a;const r=(a=void 0)!=null?a:!1;return Je(()=>dt(Ya(t,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:async s=>{const n=await Ha(t,s);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function hs(t){return"_zod"in t}function sa(t,e){return hs(t)?ms(t):fs(t)}async function Pt({value:t,schema:e,context:a}){const r=await Oe({value:t,schema:e,context:a});if(!r.success)throw Ie.wrap({value:t,cause:r.error,context:a});return r.value}async function Oe({value:t,schema:e,context:a}){const r=pt(e);try{if(r.validate==null)return{success:!0,value:t,rawValue:t};const s=await r.validate(t);return s.success?{success:!0,value:s.value,rawValue:t}:{success:!1,error:Ie.wrap({value:t,cause:s.error,context:a}),rawValue:t}}catch(s){return{success:!1,error:Ie.wrap({value:t,cause:s,context:a}),rawValue:t}}}async function pe({text:t,schema:e}){try{const a=Sr(t);return e==null?{success:!0,value:a,rawValue:a}:await Oe({value:a,schema:e})}catch(a){return{success:!1,error:At.isInstance(a)?a:new At({text:t,cause:a}),rawValue:void 0}}}function gs({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new Ga).pipeThrough(new TransformStream({async transform({data:a},r){a!=="[DONE]"&&r.enqueue(await pe({text:a,schema:e}))}}))}async function ne(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var vs=Object.defineProperty,ys=(t,e)=>{for(var a in e)vs(t,a,{get:e[a],enumerable:!0})},na="AI_NoObjectGeneratedError",oa=`vercel.ai.error.${na}`,bs=Symbol.for(oa),ia,oe=class extends Q{constructor({message:t="No object generated.",cause:e,text:a,response:r,usage:s,finishReason:n}){super({name:na,message:t,cause:e}),this[ia]=!0,this.text=a,this.response=r,this.usage=s,this.finishReason=n}static isInstance(t){return Q.hasMarker(t,oa)}};ia=bs;var la="AI_UIMessageStreamError",ca=`vercel.ai.error.${la}`,Es=Symbol.for(ca),ua,ve=class extends Q{constructor({chunkType:t,chunkId:e,message:a}){super({name:la,message:a}),this[ua]=!0,this.chunkType=t,this.chunkId=e}static isInstance(t){return Q.hasMarker(t,ca)}};ua=Es;var kt="6.0.116",da=V([m(),qe(Uint8Array),qe(ArrayBuffer),Vt(t=>{var e,a;return(a=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?a:!1},{message:"Must be a Buffer"})]),Pe=Qa(()=>V([Ka(),m(),Xa(),Z(),Me(m(),Pe.optional()),ke(Pe)])),C=Me(m(),Me(m(),Pe.optional())),pa=O({type:y("text"),text:m(),providerOptions:C.optional()}),_s=O({type:y("image"),image:V([da,qe(URL)]),mediaType:m().optional(),providerOptions:C.optional()}),fa=O({type:y("file"),data:V([da,qe(URL)]),filename:m().optional(),mediaType:m(),providerOptions:C.optional()}),Is=O({type:y("reasoning"),text:m(),providerOptions:C.optional()}),Ss=O({type:y("tool-call"),toolCallId:m(),toolName:m(),input:re(),providerOptions:C.optional(),providerExecuted:Z().optional()}),Ts=er("type",[O({type:y("text"),value:m(),providerOptions:C.optional()}),O({type:y("json"),value:Pe,providerOptions:C.optional()}),O({type:y("execution-denied"),reason:m().optional(),providerOptions:C.optional()}),O({type:y("error-text"),value:m(),providerOptions:C.optional()}),O({type:y("error-json"),value:Pe,providerOptions:C.optional()}),O({type:y("content"),value:ke(V([O({type:y("text"),text:m(),providerOptions:C.optional()}),O({type:y("media"),data:m(),mediaType:m()}),O({type:y("file-data"),data:m(),mediaType:m(),filename:m().optional(),providerOptions:C.optional()}),O({type:y("file-url"),url:m(),providerOptions:C.optional()}),O({type:y("file-id"),fileId:V([m(),Me(m(),m())]),providerOptions:C.optional()}),O({type:y("image-data"),data:m(),mediaType:m(),providerOptions:C.optional()}),O({type:y("image-url"),url:m(),providerOptions:C.optional()}),O({type:y("image-file-id"),fileId:V([m(),Me(m(),m())]),providerOptions:C.optional()}),O({type:y("custom"),providerOptions:C.optional()})]))})]),ma=O({type:y("tool-result"),toolCallId:m(),toolName:m(),output:Ts,providerOptions:C.optional()}),As=O({type:y("tool-approval-request"),approvalId:m(),toolCallId:m()}),ws=O({type:y("tool-approval-response"),approvalId:m(),approved:Z(),reason:m().optional()}),Cs=O({role:y("system"),content:m(),providerOptions:C.optional()}),xs=O({role:y("user"),content:V([m(),ke(V([pa,_s,fa]))]),providerOptions:C.optional()}),Rs=O({role:y("assistant"),content:V([m(),ke(V([pa,fa,Is,Ss,ma,As]))]),providerOptions:C.optional()}),Ms=O({role:y("tool"),content:ke(V([ma,ws])),providerOptions:C.optional()});V([Cs,xs,Rs,Ms]);function ha(t,e){if(t===void 0&&e===void 0)return;if(t===void 0)return e;if(e===void 0)return t;const a={...t};for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const s=e[r];if(s===void 0)continue;const n=r in t?t[r]:void 0,i=s!==null&&typeof s=="object"&&!Array.isArray(s)&&!(s instanceof Date)&&!(s instanceof RegExp),o=n!=null&&typeof n=="object"&&!Array.isArray(n)&&!(n instanceof Date)&&!(n instanceof RegExp);i&&o?a[r]=ha(n,s):a[r]=s}return a}var Ns={};ys(Ns,{array:()=>Ds,choice:()=>$s,json:()=>js,object:()=>ks,text:()=>Ps});function Os(t){const e=["ROOT"];let a=-1,r=null;function s(l,c,d){switch(l){case'"':{a=c,e.pop(),e.push(d),e.push("INSIDE_STRING");break}case"f":case"t":case"n":{a=c,r=c,e.pop(),e.push(d),e.push("INSIDE_LITERAL");break}case"-":{e.pop(),e.push(d),e.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{a=c,e.pop(),e.push(d),e.push("INSIDE_NUMBER");break}case"{":{a=c,e.pop(),e.push(d),e.push("INSIDE_OBJECT_START");break}case"[":{a=c,e.pop(),e.push(d),e.push("INSIDE_ARRAY_START");break}}}function n(l,c){switch(l){case",":{e.pop(),e.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{a=c,e.pop();break}}}function i(l,c){switch(l){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{a=c,e.pop();break}}}for(let l=0;l<t.length;l++){const c=t[l];switch(e[e.length-1]){case"ROOT":s(c,l,"FINISH");break;case"INSIDE_OBJECT_START":{switch(c){case'"':{e.pop(),e.push("INSIDE_OBJECT_KEY");break}case"}":{a=l,e.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{c==='"'&&(e.pop(),e.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{c==='"'&&(e.pop(),e.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{c===":"&&(e.pop(),e.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{s(c,l,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{n(c,l);break}case"INSIDE_STRING":{switch(c){case'"':{e.pop(),a=l;break}case"\\":{e.push("INSIDE_STRING_ESCAPE");break}default:a=l}break}case"INSIDE_ARRAY_START":{c==="]"?(a=l,e.pop()):(a=l,s(c,l,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(c){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{a=l,e.pop();break}default:{a=l;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{s(c,l,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{e.pop(),a=l;break}case"INSIDE_NUMBER":{switch(c){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{a=l;break}case"e":case"E":case"-":case".":break;case",":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(c,l),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&n(c,l);break}case"}":{e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&n(c,l);break}case"]":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(c,l);break}default:{e.pop();break}}break}case"INSIDE_LITERAL":{const p=t.substring(r,l+1);!"false".startsWith(p)&&!"true".startsWith(p)&&!"null".startsWith(p)?(e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?n(c,l):e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(c,l)):a=l;break}}}let o=t.slice(0,a+1);for(let l=e.length-1;l>=0;l--)switch(e[l]){case"INSIDE_STRING":{o+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{o+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{o+="]";break}case"INSIDE_LITERAL":{const d=t.substring(r,t.length);"true".startsWith(d)?o+="true".slice(d.length):"false".startsWith(d)?o+="false".slice(d.length):"null".startsWith(d)&&(o+="null".slice(d.length))}}return o}async function je(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await pe({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await pe({text:Os(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var Ps=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}},createElementStreamTransform(){}}),ks=({schema:t,name:e,description:a})=>{const r=pt(t);return{name:"object",responseFormat:ne(r.jsonSchema).then(s=>({type:"json",schema:s,...e!=null&&{name:e},...a!=null&&{description:a}})),async parseCompleteOutput({text:s},n){const i=await pe({text:s});if(!i.success)throw new oe({message:"No object generated: could not parse the response.",cause:i.error,text:s,response:n.response,usage:n.usage,finishReason:n.finishReason});const o=await Oe({value:i.value,schema:r});if(!o.success)throw new oe({message:"No object generated: response did not match schema.",cause:o.error,text:s,response:n.response,usage:n.usage,finishReason:n.finishReason});return o.value},async parsePartialOutput({text:s}){const n=await je(s);switch(n.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:n.value}}},createElementStreamTransform(){}}},Ds=({element:t,name:e,description:a})=>{const r=pt(t);return{name:"array",responseFormat:ne(r.jsonSchema).then(s=>{const{$schema:n,...i}=s;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:i}},required:["elements"],additionalProperties:!1},...e!=null&&{name:e},...a!=null&&{description:a}}}),async parseCompleteOutput({text:s},n){const i=await pe({text:s});if(!i.success)throw new oe({message:"No object generated: could not parse the response.",cause:i.error,text:s,response:n.response,usage:n.usage,finishReason:n.finishReason});const o=i.value;if(o==null||typeof o!="object"||!("elements"in o)||!Array.isArray(o.elements))throw new oe({message:"No object generated: response did not match schema.",cause:new Ie({value:o,cause:"response must be an object with an elements array"}),text:s,response:n.response,usage:n.usage,finishReason:n.finishReason});for(const l of o.elements){const c=await Oe({value:l,schema:r});if(!c.success)throw new oe({message:"No object generated: response did not match schema.",cause:c.error,text:s,response:n.response,usage:n.usage,finishReason:n.finishReason})}return o.elements},async parsePartialOutput({text:s}){const n=await je(s);switch(n.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const i=n.value;if(i==null||typeof i!="object"||!("elements"in i)||!Array.isArray(i.elements))return;const o=n.state==="repaired-parse"&&i.elements.length>0?i.elements.slice(0,-1):i.elements,l=[];for(const c of o){const d=await Oe({value:c,schema:r});d.success&&l.push(d.value)}return{partial:l}}}},createElementStreamTransform(){let s=0;return new TransformStream({transform({partialOutput:n},i){if(n!=null)for(;s<n.length;s++)i.enqueue(n[s])}})}}},$s=({options:t,name:e,description:a})=>({name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:t}},required:["result"],additionalProperties:!1},...e!=null&&{name:e},...a!=null&&{description:a}}),async parseCompleteOutput({text:r},s){const n=await pe({text:r});if(!n.success)throw new oe({message:"No object generated: could not parse the response.",cause:n.error,text:r,response:s.response,usage:s.usage,finishReason:s.finishReason});const i=n.value;if(i==null||typeof i!="object"||!("result"in i)||typeof i.result!="string"||!t.includes(i.result))throw new oe({message:"No object generated: response did not match schema.",cause:new Ie({value:i,cause:"response must be an object that contains a choice value."}),text:r,response:s.response,usage:s.usage,finishReason:s.finishReason});return i.result},async parsePartialOutput({text:r}){const s=await je(r);switch(s.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const n=s.value;if(n==null||typeof n!="object"||!("result"in n)||typeof n.result!="string")return;const i=t.filter(o=>o.startsWith(n.result));return s.state==="successful-parse"?i.includes(n.result)?{partial:n.result}:void 0:i.length===1?{partial:i[0]}:void 0}}},createElementStreamTransform(){}}),js=({name:t,description:e}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...t!=null&&{name:t},...e!=null&&{description:e}}),async parseCompleteOutput({text:a},r){const s=await pe({text:a});if(!s.success)throw new oe({message:"No object generated: could not parse the response.",cause:s.error,text:a,response:r.response,usage:r.usage,finishReason:r.finishReason});return s.value},async parsePartialOutput({text:a}){const r=await je(a);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return r.value===void 0?void 0:{partial:r.value}}},createElementStreamTransform(){}});$e({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(t,e){e.enqueue(`data: ${JSON.stringify(t)}
8
-
9
- `)},flush(t){t.enqueue(`data: [DONE]
10
-
11
- `)}})}});var Ls=us(()=>sa(V([k({type:y("text-start"),id:m(),providerMetadata:C.optional()}),k({type:y("text-delta"),id:m(),delta:m(),providerMetadata:C.optional()}),k({type:y("text-end"),id:m(),providerMetadata:C.optional()}),k({type:y("error"),errorText:m()}),k({type:y("tool-input-start"),toolCallId:m(),toolName:m(),providerExecuted:Z().optional(),providerMetadata:C.optional(),dynamic:Z().optional(),title:m().optional()}),k({type:y("tool-input-delta"),toolCallId:m(),inputTextDelta:m()}),k({type:y("tool-input-available"),toolCallId:m(),toolName:m(),input:re(),providerExecuted:Z().optional(),providerMetadata:C.optional(),dynamic:Z().optional(),title:m().optional()}),k({type:y("tool-input-error"),toolCallId:m(),toolName:m(),input:re(),providerExecuted:Z().optional(),providerMetadata:C.optional(),dynamic:Z().optional(),errorText:m(),title:m().optional()}),k({type:y("tool-approval-request"),approvalId:m(),toolCallId:m()}),k({type:y("tool-output-available"),toolCallId:m(),output:re(),providerExecuted:Z().optional(),dynamic:Z().optional(),preliminary:Z().optional()}),k({type:y("tool-output-error"),toolCallId:m(),errorText:m(),providerExecuted:Z().optional(),dynamic:Z().optional()}),k({type:y("tool-output-denied"),toolCallId:m()}),k({type:y("reasoning-start"),id:m(),providerMetadata:C.optional()}),k({type:y("reasoning-delta"),id:m(),delta:m(),providerMetadata:C.optional()}),k({type:y("reasoning-end"),id:m(),providerMetadata:C.optional()}),k({type:y("source-url"),sourceId:m(),url:m(),title:m().optional(),providerMetadata:C.optional()}),k({type:y("source-document"),sourceId:m(),mediaType:m(),title:m(),filename:m().optional(),providerMetadata:C.optional()}),k({type:y("file"),url:m(),mediaType:m(),providerMetadata:C.optional()}),k({type:Vt(t=>typeof t=="string"&&t.startsWith("data-"),{message:'Type must start with "data-"'}),id:m().optional(),data:re(),transient:Z().optional()}),k({type:y("start-step")}),k({type:y("finish-step")}),k({type:y("start"),messageId:m().optional(),messageMetadata:re().optional()}),k({type:y("finish"),finishReason:tr(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:re().optional()}),k({type:y("abort"),reason:m().optional()}),k({type:y("message-metadata"),messageMetadata:re()})])));function Zs(t){return t.type.startsWith("data-")}function nt(t){return t.type.startsWith("tool-")}function Fs(t){return t.type==="dynamic-tool"}function Se(t){return nt(t)||Fs(t)}function Dt(t){return t.type.split("-").slice(1).join("-")}function Us({lastMessage:t,messageId:e}){return{message:t?.role==="assistant"?t:{id:e,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function Vs({stream:t,messageMetadataSchema:e,dataPartSchemas:a,runUpdateMessageJob:r,onError:s,onToolCall:n,onData:i}){return t.pipeThrough(new TransformStream({async transform(o,l){await r(async({state:c,write:d})=>{var p,h,f,g;function v(u){const w=c.message.parts.filter(Se).find(T=>T.toolCallId===u);if(w==null)throw new ve({chunkType:"tool-invocation",chunkId:u,message:`No tool invocation found for tool call ID "${u}".`});return w}function I(u){var x;const w=c.message.parts.find(P=>nt(P)&&P.toolCallId===u.toolCallId),T=u,S=w;w!=null?(w.state=u.state,S.input=T.input,S.output=T.output,S.errorText=T.errorText,S.rawInput=T.rawInput,S.preliminary=T.preliminary,u.title!==void 0&&(S.title=u.title),S.providerExecuted=(x=T.providerExecuted)!=null?x:w.providerExecuted,T.providerMetadata!=null&&(w.callProviderMetadata=T.providerMetadata)):c.message.parts.push({type:`tool-${u.toolName}`,toolCallId:u.toolCallId,state:u.state,title:u.title,input:T.input,output:T.output,rawInput:T.rawInput,errorText:T.errorText,providerExecuted:T.providerExecuted,preliminary:T.preliminary,...T.providerMetadata!=null?{callProviderMetadata:T.providerMetadata}:{}})}function b(u){var x,w;const T=c.message.parts.find(X=>X.type==="dynamic-tool"&&X.toolCallId===u.toolCallId),S=u,P=T;T!=null?(T.state=u.state,P.toolName=u.toolName,P.input=S.input,P.output=S.output,P.errorText=S.errorText,P.rawInput=(x=S.rawInput)!=null?x:P.rawInput,P.preliminary=S.preliminary,u.title!==void 0&&(P.title=u.title),P.providerExecuted=(w=S.providerExecuted)!=null?w:T.providerExecuted,S.providerMetadata!=null&&(T.callProviderMetadata=S.providerMetadata)):c.message.parts.push({type:"dynamic-tool",toolName:u.toolName,toolCallId:u.toolCallId,state:u.state,input:S.input,output:S.output,errorText:S.errorText,preliminary:S.preliminary,providerExecuted:S.providerExecuted,title:u.title,...S.providerMetadata!=null?{callProviderMetadata:S.providerMetadata}:{}})}async function A(u){if(u!=null){const x=c.message.metadata!=null?ha(c.message.metadata,u):u;e!=null&&await Pt({value:x,schema:e,context:{field:"message.metadata",entityId:c.message.id}}),c.message.metadata=x}}switch(o.type){case"text-start":{const u={type:"text",text:"",providerMetadata:o.providerMetadata,state:"streaming"};c.activeTextParts[o.id]=u,c.message.parts.push(u),d();break}case"text-delta":{const u=c.activeTextParts[o.id];if(u==null)throw new ve({chunkType:"text-delta",chunkId:o.id,message:`Received text-delta for missing text part with ID "${o.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});u.text+=o.delta,u.providerMetadata=(p=o.providerMetadata)!=null?p:u.providerMetadata,d();break}case"text-end":{const u=c.activeTextParts[o.id];if(u==null)throw new ve({chunkType:"text-end",chunkId:o.id,message:`Received text-end for missing text part with ID "${o.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});u.state="done",u.providerMetadata=(h=o.providerMetadata)!=null?h:u.providerMetadata,delete c.activeTextParts[o.id],d();break}case"reasoning-start":{const u={type:"reasoning",text:"",providerMetadata:o.providerMetadata,state:"streaming"};c.activeReasoningParts[o.id]=u,c.message.parts.push(u),d();break}case"reasoning-delta":{const u=c.activeReasoningParts[o.id];if(u==null)throw new ve({chunkType:"reasoning-delta",chunkId:o.id,message:`Received reasoning-delta for missing reasoning part with ID "${o.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});u.text+=o.delta,u.providerMetadata=(f=o.providerMetadata)!=null?f:u.providerMetadata,d();break}case"reasoning-end":{const u=c.activeReasoningParts[o.id];if(u==null)throw new ve({chunkType:"reasoning-end",chunkId:o.id,message:`Received reasoning-end for missing reasoning part with ID "${o.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});u.providerMetadata=(g=o.providerMetadata)!=null?g:u.providerMetadata,u.state="done",delete c.activeReasoningParts[o.id],d();break}case"file":{c.message.parts.push({type:"file",mediaType:o.mediaType,url:o.url,...o.providerMetadata!=null?{providerMetadata:o.providerMetadata}:{}}),d();break}case"source-url":{c.message.parts.push({type:"source-url",sourceId:o.sourceId,url:o.url,title:o.title,providerMetadata:o.providerMetadata}),d();break}case"source-document":{c.message.parts.push({type:"source-document",sourceId:o.sourceId,mediaType:o.mediaType,title:o.title,filename:o.filename,providerMetadata:o.providerMetadata}),d();break}case"tool-input-start":{const u=c.message.parts.filter(nt);c.partialToolCalls[o.toolCallId]={text:"",toolName:o.toolName,index:u.length,dynamic:o.dynamic,title:o.title},o.dynamic?b({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-streaming",input:void 0,providerExecuted:o.providerExecuted,title:o.title,providerMetadata:o.providerMetadata}):I({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-streaming",input:void 0,providerExecuted:o.providerExecuted,title:o.title,providerMetadata:o.providerMetadata}),d();break}case"tool-input-delta":{const u=c.partialToolCalls[o.toolCallId];if(u==null)throw new ve({chunkType:"tool-input-delta",chunkId:o.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${o.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});u.text+=o.inputTextDelta;const{value:x}=await je(u.text);u.dynamic?b({toolCallId:o.toolCallId,toolName:u.toolName,state:"input-streaming",input:x,title:u.title}):I({toolCallId:o.toolCallId,toolName:u.toolName,state:"input-streaming",input:x,title:u.title}),d();break}case"tool-input-available":{o.dynamic?b({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-available",input:o.input,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata,title:o.title}):I({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-available",input:o.input,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata,title:o.title}),d(),n&&!o.providerExecuted&&await n({toolCall:o});break}case"tool-input-error":{const u=c.message.parts.filter(Se).find(w=>w.toolCallId===o.toolCallId);(u!=null?u.type==="dynamic-tool":!!o.dynamic)?b({toolCallId:o.toolCallId,toolName:o.toolName,state:"output-error",input:o.input,errorText:o.errorText,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata}):I({toolCallId:o.toolCallId,toolName:o.toolName,state:"output-error",input:void 0,rawInput:o.input,errorText:o.errorText,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata}),d();break}case"tool-approval-request":{const u=v(o.toolCallId);u.state="approval-requested",u.approval={id:o.approvalId},d();break}case"tool-output-denied":{const u=v(o.toolCallId);u.state="output-denied",d();break}case"tool-output-available":{const u=v(o.toolCallId);u.type==="dynamic-tool"?b({toolCallId:o.toolCallId,toolName:u.toolName,state:"output-available",input:u.input,output:o.output,preliminary:o.preliminary,providerExecuted:o.providerExecuted,title:u.title}):I({toolCallId:o.toolCallId,toolName:Dt(u),state:"output-available",input:u.input,output:o.output,providerExecuted:o.providerExecuted,preliminary:o.preliminary,title:u.title}),d();break}case"tool-output-error":{const u=v(o.toolCallId);u.type==="dynamic-tool"?b({toolCallId:o.toolCallId,toolName:u.toolName,state:"output-error",input:u.input,errorText:o.errorText,providerExecuted:o.providerExecuted,title:u.title}):I({toolCallId:o.toolCallId,toolName:Dt(u),state:"output-error",input:u.input,rawInput:u.rawInput,errorText:o.errorText,providerExecuted:o.providerExecuted,title:u.title}),d();break}case"start-step":{c.message.parts.push({type:"step-start"});break}case"finish-step":{c.activeTextParts={},c.activeReasoningParts={};break}case"start":{o.messageId!=null&&(c.message.id=o.messageId),await A(o.messageMetadata),(o.messageId!=null||o.messageMetadata!=null)&&d();break}case"finish":{o.finishReason!=null&&(c.finishReason=o.finishReason),await A(o.messageMetadata),o.messageMetadata!=null&&d();break}case"message-metadata":{await A(o.messageMetadata),o.messageMetadata!=null&&d();break}case"error":{s?.(new Error(o.errorText));break}default:if(Zs(o)){if(a?.[o.type]!=null){const w=c.message.parts.findIndex(S=>"id"in S&&"data"in S&&S.id===o.id&&S.type===o.type),T=w>=0?w:c.message.parts.length;await Pt({value:o.data,schema:a[o.type],context:{field:`message.parts[${T}].data`,entityName:o.type,entityId:o.id}})}const u=o;if(u.transient){i?.(u);break}const x=u.id!=null?c.message.parts.find(w=>u.type===w.type&&u.id===w.id):void 0;x!=null?x.data=u.data:c.message.parts.push(u),i?.(u),d()}}l.enqueue(o)})}}))}async function qs({stream:t,onError:e}){const a=t.getReader();try{for(;;){const{done:r}=await a.read();if(r)break}}catch(r){e?.(r)}finally{a.releaseLock()}}$e({prefix:"aitxt",size:24});$e({prefix:"aiobj",size:24});var Bs=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(t){return new Promise((e,a)=>{this.queue.push(async()=>{try{await t(),e()}catch(r){a(r)}}),this.processQueue()})}};$e({prefix:"aiobj",size:24});async function zs(t){if(t==null)return[];if(!globalThis.FileList||!(t instanceof globalThis.FileList))throw new Error("FileList is not supported in the current environment");return Promise.all(Array.from(t).map(async e=>{const{name:a,type:r}=e,s=await new Promise((n,i)=>{const o=new FileReader;o.onload=l=>{var c;n((c=l.target)==null?void 0:c.result)},o.onerror=l=>i(l),o.readAsDataURL(e)});return{type:"file",mediaType:r,filename:a,url:s}}))}var Js=class{constructor({api:t="/api/chat",credentials:e,headers:a,body:r,fetch:s,prepareSendMessagesRequest:n,prepareReconnectToStreamRequest:i}){this.api=t,this.credentials=e,this.headers=a,this.body=r,this.fetch=s,this.prepareSendMessagesRequest=n,this.prepareReconnectToStreamRequest=i}async sendMessages({abortSignal:t,...e}){var a,r,s,n,i;const o=await ne(this.body),l=await ne(this.headers),c=await ne(this.credentials),d={...de(l),...de(e.headers)},p=await((a=this.prepareSendMessagesRequest)==null?void 0:a.call(this,{api:this.api,id:e.chatId,messages:e.messages,body:{...o,...e.body},headers:d,credentials:c,requestMetadata:e.metadata,trigger:e.trigger,messageId:e.messageId})),h=(r=p?.api)!=null?r:this.api,f=p?.headers!==void 0?de(p.headers):d,g=p?.body!==void 0?p.body:{...o,...e.body,id:e.chatId,messages:e.messages,trigger:e.trigger,messageId:e.messageId},v=(s=p?.credentials)!=null?s:c,b=await((n=this.fetch)!=null?n:globalThis.fetch)(h,{method:"POST",headers:Rt({"Content-Type":"application/json",...f},`ai-sdk/${kt}`,xt()),body:JSON.stringify(g),credentials:v,signal:t});if(!b.ok)throw new Error((i=await b.text())!=null?i:"Failed to fetch the chat response.");if(!b.body)throw new Error("The response body is empty.");return this.processResponseStream(b.body)}async reconnectToStream(t){var e,a,r,s,n;const i=await ne(this.body),o=await ne(this.headers),l=await ne(this.credentials),c={...de(o),...de(t.headers)},d=await((e=this.prepareReconnectToStreamRequest)==null?void 0:e.call(this,{api:this.api,id:t.chatId,body:{...i,...t.body},headers:c,credentials:l,requestMetadata:t.metadata})),p=(a=d?.api)!=null?a:`${this.api}/${t.chatId}/stream`,h=d?.headers!==void 0?de(d.headers):c,f=(r=d?.credentials)!=null?r:l,v=await((s=this.fetch)!=null?s:globalThis.fetch)(p,{method:"GET",headers:Rt(h,`ai-sdk/${kt}`,xt()),credentials:f});if(v.status===204)return null;if(!v.ok)throw new Error((n=await v.text())!=null?n:"Failed to fetch the chat response.");if(!v.body)throw new Error("The response body is empty.");return this.processResponseStream(v.body)}},ga=class extends Js{constructor(t={}){super(t)}processResponseStream(t){return gs({stream:t,schema:Ls}).pipeThrough(new TransformStream({async transform(e,a){if(!e.success)throw e.error;a.enqueue(e.value)}}))}},Ws=class{constructor({generateId:t=br,id:e=t(),transport:a=new ga,messageMetadataSchema:r,dataPartSchemas:s,state:n,onError:i,onToolCall:o,onFinish:l,onData:c,sendAutomaticallyWhen:d}){this.activeResponse=void 0,this.jobExecutor=new Bs,this.sendMessage=async(p,h)=>{var f,g,v,I;if(p==null){await this.makeRequest({trigger:"submit-message",messageId:(f=this.lastMessage)==null?void 0:f.id,...h});return}let b;if("text"in p||"files"in p?b={parts:[...Array.isArray(p.files)?p.files:await zs(p.files),..."text"in p&&p.text!=null?[{type:"text",text:p.text}]:[]]}:b=p,p.messageId!=null){const A=this.state.messages.findIndex(u=>u.id===p.messageId);if(A===-1)throw new Error(`message with id ${p.messageId} not found`);if(this.state.messages[A].role!=="user")throw new Error(`message with id ${p.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,A+1),this.state.replaceMessage(A,{...b,id:p.messageId,role:(g=b.role)!=null?g:"user",metadata:p.metadata})}else this.state.pushMessage({...b,id:(v=b.id)!=null?v:this.generateId(),role:(I=b.role)!=null?I:"user",metadata:p.metadata});await this.makeRequest({trigger:"submit-message",messageId:p.messageId,...h})},this.regenerate=async({messageId:p,...h}={})=>{const f=p==null?this.state.messages.length-1:this.state.messages.findIndex(g=>g.id===p);if(f===-1)throw new Error(`message ${p} not found`);this.state.messages=this.state.messages.slice(0,this.messages[f].role==="assistant"?f:f+1),await this.makeRequest({trigger:"regenerate-message",messageId:p,...h})},this.resumeStream=async(p={})=>{await this.makeRequest({trigger:"resume-stream",...p})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:p,approved:h,reason:f})=>this.jobExecutor.run(async()=>{const g=this.state.messages,v=g[g.length-1],I=b=>Se(b)&&b.state==="approval-requested"&&b.approval.id===p?{...b,state:"approval-responded",approval:{id:p,approved:h,reason:f}}:b;this.state.replaceMessage(g.length-1,{...v,parts:v.parts.map(I)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(I)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(b=>{var A;b&&this.makeRequest({trigger:"submit-message",messageId:(A=this.lastMessage)==null?void 0:A.id})})}),this.addToolOutput=async({state:p="output-available",tool:h,toolCallId:f,output:g,errorText:v})=>this.jobExecutor.run(async()=>{const I=this.state.messages,b=I[I.length-1],A=u=>Se(u)&&u.toolCallId===f?{...u,state:p,output:g,errorText:v}:u;this.state.replaceMessage(I.length-1,{...b,parts:b.parts.map(A)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(A)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(u=>{var x;u&&this.makeRequest({trigger:"submit-message",messageId:(x=this.lastMessage)==null?void 0:x.id})})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var p;this.status!=="streaming"&&this.status!=="submitted"||(p=this.activeResponse)!=null&&p.abortController&&this.activeResponse.abortController.abort()},this.id=e,this.transport=a,this.generateId=t,this.messageMetadataSchema=r,this.dataPartSchemas=s,this.state=n,this.onError=i,this.onToolCall=o,this.onFinish=l,this.onData=c,this.sendAutomaticallyWhen=d}get status(){return this.state.status}setStatus({status:t,error:e}){this.status!==t&&(this.state.status=t,this.state.error=e)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(t){this.state.messages=t}async shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;const t=this.sendAutomaticallyWhen({messages:this.state.messages});return t&&typeof t=="object"&&"then"in t?await t:t}async makeRequest({trigger:t,metadata:e,headers:a,body:r,messageId:s}){var n,i,o;let l;if(t==="resume-stream")try{const f=await this.transport.reconnectToStream({chatId:this.id,metadata:e,headers:a,body:r});if(f==null)return;l=f}catch(f){this.onError&&f instanceof Error&&this.onError(f),this.setStatus({status:"error",error:f});return}this.setStatus({status:"submitted",error:void 0});const c=this.lastMessage;let d=!1,p=!1,h=!1;try{const f={state:Us({lastMessage:this.state.snapshot(c),messageId:this.generateId()}),abortController:new AbortController};f.abortController.signal.addEventListener("abort",()=>{d=!0}),this.activeResponse=f;let g;t==="resume-stream"?g=l:g=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:f.abortController.signal,metadata:e,headers:a,body:r,trigger:t,messageId:s});const v=I=>this.jobExecutor.run(()=>I({state:f.state,write:()=>{var b;this.setStatus({status:"streaming"}),f.state.message.id===((b=this.lastMessage)==null?void 0:b.id)?this.state.replaceMessage(this.state.messages.length-1,f.state.message):this.state.pushMessage(f.state.message)}}));await qs({stream:Vs({stream:g,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:v,onError:I=>{throw I}}),onError:I=>{throw I}}),this.setStatus({status:"ready"})}catch(f){if(d||f.name==="AbortError")return d=!0,this.setStatus({status:"ready"}),null;h=!0,f instanceof TypeError&&(f.message.toLowerCase().includes("fetch")||f.message.toLowerCase().includes("network"))&&(p=!0),this.onError&&f instanceof Error&&this.onError(f),this.setStatus({status:"error",error:f})}finally{try{(i=this.onFinish)==null||i.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:d,isDisconnect:p,isError:h,finishReason:(n=this.activeResponse)==null?void 0:n.state.finishReason})}catch(f){console.error(f)}this.activeResponse=void 0}!h&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:"submit-message",messageId:(o=this.lastMessage)==null?void 0:o.id,metadata:e,headers:a,body:r})}};function Gs({messages:t}){const e=t[t.length-1];if(!e||e.role!=="assistant")return!1;const a=e.parts.reduce((s,n,i)=>n.type==="step-start"?i:s,-1),r=e.parts.slice(a+1).filter(Se).filter(s=>!s.providerExecuted);return r.filter(s=>s.state==="approval-responded").length>0&&r.every(s=>s.state==="output-available"||s.state==="output-error"||s.state==="approval-responded")}function Hs({messages:t}){const e=t[t.length-1];if(!e||e.role!=="assistant")return!1;const a=e.parts.reduce((s,n,i)=>n.type==="step-start"?i:s,-1),r=e.parts.slice(a+1).filter(Se).filter(s=>!s.providerExecuted);return r.length>0&&r.every(s=>s.state==="output-available"||s.state==="output-error")}var et,$t;function Ys(){if($t)return et;$t=1;function t(e,a){if(typeof e!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let r,s=0;return function(...i){clearTimeout(r);const o=Date.now(),l=o-s,c=a-l;c<=0?(s=o,e.apply(this,i)):r=setTimeout(()=>{s=Date.now(),e.apply(this,i)},c)}}return et=t,et}var Qs=Ys();const Ks=ar(Qs);var va=(t,e,a)=>{if(!e.has(t))throw TypeError("Cannot "+a)},D=(t,e,a)=>(va(t,e,"read from private field"),a?a.call(t):e.get(t)),Y=(t,e,a)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,a)},se=(t,e,a,r)=>(va(t,e,"write to private field"),e.set(t,a),a);function Xs(t,e){return e!=null?Ks(t,e):t}var J,Ue,Ve,Ce,xe,Re,ye,ot,it,en=class{constructor(t=[]){Y(this,J,void 0),Y(this,Ue,"ready"),Y(this,Ve,void 0),Y(this,Ce,new Set),Y(this,xe,new Set),Y(this,Re,new Set),this.pushMessage=e=>{se(this,J,D(this,J).concat(e)),D(this,ye).call(this)},this.popMessage=()=>{se(this,J,D(this,J).slice(0,-1)),D(this,ye).call(this)},this.replaceMessage=(e,a)=>{se(this,J,[...D(this,J).slice(0,e),this.snapshot(a),...D(this,J).slice(e+1)]),D(this,ye).call(this)},this.snapshot=e=>structuredClone(e),this["~registerMessagesCallback"]=(e,a)=>{const r=a?Xs(e,a):e;return D(this,Ce).add(r),()=>{D(this,Ce).delete(r)}},this["~registerStatusCallback"]=e=>(D(this,xe).add(e),()=>{D(this,xe).delete(e)}),this["~registerErrorCallback"]=e=>(D(this,Re).add(e),()=>{D(this,Re).delete(e)}),Y(this,ye,()=>{D(this,Ce).forEach(e=>e())}),Y(this,ot,()=>{D(this,xe).forEach(e=>e())}),Y(this,it,()=>{D(this,Re).forEach(e=>e())}),se(this,J,t)}get status(){return D(this,Ue)}set status(t){se(this,Ue,t),D(this,ot).call(this)}get error(){return D(this,Ve)}set error(t){se(this,Ve,t),D(this,it).call(this)}get messages(){return D(this,J)}set messages(t){se(this,J,[...t]),D(this,ye).call(this)}};J=new WeakMap;Ue=new WeakMap;Ve=new WeakMap;Ce=new WeakMap;xe=new WeakMap;Re=new WeakMap;ye=new WeakMap;ot=new WeakMap;it=new WeakMap;var be,jt=class extends Ws{constructor({messages:t,...e}){const a=new en(t);super({...e,state:a}),Y(this,be,void 0),this["~registerMessagesCallback"]=(r,s)=>D(this,be)["~registerMessagesCallback"](r,s),this["~registerStatusCallback"]=r=>D(this,be)["~registerStatusCallback"](r),this["~registerErrorCallback"]=r=>D(this,be)["~registerErrorCallback"](r),se(this,be,a)}};be=new WeakMap;function tn({experimental_throttle:t,resume:e=!1,...a}={}){const r=M.useRef("chat"in a?{}:{onToolCall:a.onToolCall,onData:a.onData,onFinish:a.onFinish,onError:a.onError,sendAutomaticallyWhen:a.sendAutomaticallyWhen});"chat"in a||(r.current={onToolCall:a.onToolCall,onData:a.onData,onFinish:a.onFinish,onError:a.onError,sendAutomaticallyWhen:a.sendAutomaticallyWhen});const s={...a,onToolCall:h=>{var f,g;return(g=(f=r.current).onToolCall)==null?void 0:g.call(f,h)},onData:h=>{var f,g;return(g=(f=r.current).onData)==null?void 0:g.call(f,h)},onFinish:h=>{var f,g;return(g=(f=r.current).onFinish)==null?void 0:g.call(f,h)},onError:h=>{var f,g;return(g=(f=r.current).onError)==null?void 0:g.call(f,h)},sendAutomaticallyWhen:h=>{var f,g,v;return(v=(g=(f=r.current).sendAutomaticallyWhen)==null?void 0:g.call(f,h))!=null?v:!1}},n=M.useRef("chat"in a?a.chat:new jt(s));("chat"in a&&a.chat!==n.current||"id"in a&&n.current.id!==a.id)&&(n.current="chat"in a?a.chat:new jt(s));const o=M.useCallback(h=>n.current["~registerMessagesCallback"](h,t),[t,n.current.id]),l=M.useSyncExternalStore(o,()=>n.current.messages,()=>n.current.messages),c=M.useSyncExternalStore(n.current["~registerStatusCallback"],()=>n.current.status,()=>n.current.status),d=M.useSyncExternalStore(n.current["~registerErrorCallback"],()=>n.current.error,()=>n.current.error),p=M.useCallback(h=>{typeof h=="function"&&(h=h(n.current.messages)),n.current.messages=h},[n]);return M.useEffect(()=>{e&&n.current.resumeStream()},[e,n]),{id:n.current.id,messages:l,setMessages:p,sendMessage:n.current.sendMessage,regenerate:n.current.regenerate,clearError:n.current.clearError,stop:n.current.stop,error:d,resumeStream:n.current.resumeStream,status:c,addToolResult:n.current.addToolOutput,addToolOutput:n.current.addToolOutput,addToolApprovalResponse:n.current.addToolApprovalResponse}}function an(t){const{buildUrl:e,eventTypes:a}=t,r=new Map;function s(n){let i=r.get(n);if(!i){const o=new EventSource(e(n));i={es:o,refCount:0},r.set(n,i),o.onerror=()=>{o.readyState===EventSource.CLOSED&&r.delete(n)}}return i}return{subscribe(n,i){const o=s(n);o.refCount++;for(const c of a)o.es.addEventListener(c,i);let l=!1;return()=>{if(!l){l=!0;for(const c of a)o.es.removeEventListener(c,i);o.refCount--,o.refCount<=0&&(o.es.close(),r.delete(n))}}}}}const rn=an({buildUrl:t=>{const e=gt.join(",");return`/org/${t}/watch?types=${e}`},eventTypes:[...gt]}),Lt=()=>0;function ya(t){const{orgId:e,taskId:a,enabled:r=!0,onStep:s,onFinish:n,onTaskStatus:i}=t,o=M.useRef({taskId:a,onStep:s,onFinish:n,onTaskStatus:i});o.current={taskId:a,onStep:s,onFinish:n,onTaskStatus:i};const l=M.useRef(null),c=M.useRef(r),d=M.useRef(e);(!l.current||c.current!==r||d.current!==e)&&(c.current=r,d.current=e,l.current=p=>{if(!r||!e)return()=>{};const h=f=>{let g;try{g=JSON.parse(f.data)}catch{return}const v=o.current;if(!(v.taskId&&g.subject!==v.taskId)){switch(g.type){case Qe.STEP:v.onStep?.(g);break;case Qe.FINISH:v.onFinish?.(g);break;case Qe.THREAD_STATUS:v.onTaskStatus?.(g);break}p()}};return rn.subscribe(e,h)}),M.useSyncExternalStore(l.current,Lt,Lt)}function sn(t){const e=fe.c(10);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},e[0]=a):a=e[0];const r=qt(a);let s;if(e[1]!==r.collectionName||e[2]!==r.connectionId||e[3]!==r.itemId||e[4]!==t){s=[],t&&s.push(`### Selected Agent
12
- - ID: ${t}`);let n;e[6]!==r.collectionName||e[7]!==r.connectionId||e[8]!==r.itemId?(n=[],r.connectionId&&n.push(`- Connection ID: ${r.connectionId}`),r.collectionName&&n.push(`- Collection: ${r.collectionName}`),r.itemId&&n.push(`- Item ID: ${r.itemId}`),e[6]=r.collectionName,e[7]=r.connectionId,e[8]=r.itemId,e[9]=n):n=e[9],n.length>0&&s.push(`### Current Resource
13
- The user is viewing the following resource:
14
- ${n.join(`
15
- `)}
16
-
17
- Help the user understand and work with this resource.`),e[1]=r.collectionName,e[2]=r.connectionId,e[3]=r.itemId,e[4]=t,e[5]=s}else s=e[5];return s.join(`
18
-
19
- `)}function nn(){const t=fe.c(5),e=ze(),{org:a}=De();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},t[0]=r):r=t[0];const s=qt(r);let n;return t[1]!==a||t[2]!==s||t[3]!==e?(n=i=>{const l=i.toolCall.toolName.match(/^COLLECTION_([A-Z_]+)_(CREATE|UPDATE|DELETE)$/);if(!l||!l[1])return;const c=l[1],d=s.connectionId;if(!d)return;e.invalidateQueries({queryKey:ie.collection(a.slug,d,c)});const p=c.toLowerCase().replace(/_/g," ");_e.success(`${p} updated`)},t[1]=a,t[2]=s,t[3]=e,t[4]=n):n=t[4],n}const tt=(()=>{if(typeof window>"u")return null;const t=new Audio("/sounds/notification.mp3");return t.preload="auto",t.addEventListener("error",e=>{console.warn("Failed to preload notification sound:",e)}),t.load(),t})();function on(){return{showNotification:async e=>{const{title:a,body:r,icon:s="/favicon.svg",tag:n}=e;if(typeof Notification>"u")return;if(Notification.permission!=="granted"){Notification.requestPermission().then(o=>{o==="denied"&&_e.error("Notifications denied. Please enable them in your browser settings.")});return}if(document?.hasFocus())return;tt&&(tt.currentTime=0,tt.play().catch(o=>{console.warn("Failed to play notification sound:",o)}));const i=new Notification(a,{body:r,icon:s,tag:n});i.onclick=()=>{window.focus(),i.close()}}}}function ln(){const t=fe.c(2),e=ze();let a;return t[0]!==e?(a={prefillCollectionCache:(s,n,i,o)=>{if(!s)return;const l=ut(s,n,i,o);if(e.getQueryData(l))return;const d={structuredContent:{items:[]},isError:!1};e.setQueryData(l,d)}},t[0]=e,t[1]=a):a=t[1],a}const K={TASK_MESSAGES_PAGE_SIZE:100,TASKS_PAGE_SIZE:50,QUERY_STALE_TIME:3e4};function Fe(t,e,a,r,s,n){const i=ie.tasks(e,s,n),o=t.getQueryData(i);if(!o)return;const l=o.pages.map(d=>{const p=d.items.findIndex(v=>v.id===a);if(p===-1)return d;const h=[...d.items],f=h[p];if(!f)return d;const g={...f,title:r.title??f.title,updated_at:r.updated_at??f.updated_at,hidden:r.hidden??f.hidden,status:r.status??f.status};return h[p]=g,{...d,items:h}});l.some((d,p)=>d.items.length!==o.pages[p]?.items.length||d.items.some((h,f)=>h.id===a&&h!==o.pages[p]?.items[f]))&&t.setQueryData(i,{...o,pages:l})}function cn(t,e,a,r,s){const n=ie.tasks(e,r,s),i=t.getQueryData(n);if(!i){t.setQueryData(n,{pages:[{items:[a],hasMore:!1,totalCount:1}],pageParams:[0]});return}if(i.pages.some(c=>c.items.some(d=>d.id===a.id)))return;const l=i.pages[0];if(l){const c={...l,items:[a,...l.items],totalCount:(l.totalCount??l.items.length)+1};t.setQueryData(n,{...i,pages:[c,...i.pages.slice(1)]})}else t.setQueryData(n,{...i,pages:[{items:[a],hasMore:!1,totalCount:1}]})}async function un(t,e,a,r){if(!e)return;const s=ut(e,"THREAD_MESSAGES",a,{filters:[{column:"thread_id",value:r}],pageSize:K.TASK_MESSAGES_PAGE_SIZE});if(!s||t.getQueryData(s))return;const i="COLLECTION_THREAD_MESSAGES_LIST",o=ur(void 0,[{column:"thread_id",value:r}],[]),l=dr(void 0,void 0,"updated_at"),c={...o&&{where:o},...l&&{orderBy:l},limit:K.TASK_MESSAGES_PAGE_SIZE,offset:0};await t.fetchQuery({queryKey:s,queryFn:async()=>await e.callTool({name:i,arguments:c}),staleTime:K.QUERY_STALE_TIME,retry:!1})}function dn(t,e,a,r,s){if(!e)return;const n=ut(e,"THREAD_MESSAGES",a,{filters:[{column:"thread_id",value:r}],pageSize:K.TASK_MESSAGES_PAGE_SIZE});n&&t.setQueryData(n,{structuredContent:{items:s},isError:!1})}async function Zt(t,e,a){if(!t)throw new Error("MCP client is not available");const r=await t.callTool({name:"COLLECTION_THREADS_UPDATE",arguments:{id:e,data:a}});return(r.structuredContent??r).item}function pn(t){const e=new Date().toISOString();return{id:t,title:"New chat",created_at:e,updated_at:e}}function fn(t,e){return t.find(a=>a.id!==e)??null}function mn(t,e){const a=fe.c(21),{locator:r,org:s}=De();let n;a[0]!==s.id?(n={connectionId:ct,orgId:s.id},a[0]=s.id,a[1]=n):n=a[1];const i=lt(n);let o;a[2]!==r||a[3]!==t||a[4]!==e?(o=ie.tasks(r,t,t==="me"?e:void 0),a[2]=r,a[3]=t,a[4]=e,a[5]=o):o=a[5];let l;a[6]!==i||a[7]!==t||a[8]!==e?(l=async A=>{const{pageParam:u}=A,x=u===void 0?0:u;if(!i)throw new Error("MCP client is not available");if(t==="me"&&!e)return{items:[],hasMore:!1,totalCount:0};const w={limit:K.TASKS_PAGE_SIZE,offset:x},T=t==="me"?{...w,where:{created_by:e}}:w,S=await i.callTool({name:"COLLECTION_THREADS_LIST",arguments:T}),P=S.structuredContent??S;return{items:P.items??[],hasMore:P.hasMore??!1,totalCount:P.totalCount}},a[6]=i,a[7]=t,a[8]=e,a[9]=l):l=a[9];let c;a[10]!==o||a[11]!==l?(c={queryKey:o,queryFn:l,getNextPageParam:gn,initialPageParam:0,staleTime:K.QUERY_STALE_TIME},a[10]=o,a[11]=l,a[12]=c):c=a[12];const{data:d,fetchNextPage:p,hasNextPage:h,isFetchingNextPage:f,refetch:g}=fr(c);let v;a[13]!==d?.pages?(v=d?.pages.flatMap(hn)??[],a[13]=d?.pages,a[14]=v):v=a[14];const I=v;let b;return a[15]!==p||a[16]!==h||a[17]!==f||a[18]!==g||a[19]!==I?(b={tasks:I,refetch:g,hasNextPage:h,isFetchingNextPage:f,fetchNextPage:p},a[15]=p,a[16]=h,a[17]=f,a[18]=g,a[19]=I,a[20]=b):b=a[20],b}function hn(t){return t.items}function gn(t,e){if(t.hasMore)return e.length*K.TASKS_PAGE_SIZE}function vn(t){const e=fe.c(6),{org:a}=De();let r;e[0]!==a.id?(r={connectionId:ct,orgId:a.id},e[0]=a.id,e[1]=r):r=e[1];const s=lt(r);let n;e[2]!==t?(n={filters:t?[{column:"thread_id",value:t}]:[],pageSize:K.TASK_MESSAGES_PAGE_SIZE},e[2]=t,e[3]=n):n=e[3];const i=pr(a.id,"THREAD_MESSAGES",s,n);let o;return e[4]!==i?(o=i??[],e[4]=i,e[5]=o):o=e[5],o}function yn(){const{locator:t,org:e}=De(),a=ze(),{prefillCollectionCache:r}=ln(),{data:s}=Bt.useSession(),n=s?.user?.id,i=R=>{try{const $=localStorage.getItem(Ee.chatTaskOwnerFilter(R));return $?JSON.parse($):"me"}catch{return"me"}},[o,l]=M.useState(()=>i(t)),[c,d]=M.useState(t);c!==t&&(d(t),l(i(t)));const[p,h]=M.useTransition(),f=R=>{h(()=>l(R));try{localStorage.setItem(Ee.chatTaskOwnerFilter(t),JSON.stringify(R))}catch{}},{tasks:g,hasNextPage:v,isFetchingNextPage:I,fetchNextPage:b}=mn(o,n),A=lt({connectionId:ct,orgId:e.id}),[u,x]=we(Ee.assistantChatActiveTask(t),g[0]?.id??crypto.randomUUID()),w=vn(u),T=()=>{const R=crypto.randomUUID(),$=pn(R);cn(a,t,$,o,o==="me"?n:void 0),A&&r(A,"THREAD_MESSAGES",e.id,{filters:[{column:"thread_id",value:R}],pageSize:K.TASK_MESSAGES_PAGE_SIZE}),x(R)},S=async R=>{await un(a,A,e.id,R),x(R)},P=(R,$)=>{Fe(a,t,R,$,o,o==="me"?n:void 0)},X=async(R,$)=>{try{const B=await Zt(A,R,{title:$});B&&Fe(a,t,R,{title:$,updated_at:B.updated_at??new Date().toISOString()},o,o==="me"?n:void 0)}catch(B){const ee=B;_e.error(`Failed to rename task: ${ee.message}`),console.error("[chat] Failed to rename task:",B)}},W=async R=>{try{const $=await Zt(A,R,{hidden:!0});if($){if(R===u){const ee=fn(g,R);ee?await S(ee.id):T()}Fe(a,t,R,{hidden:!0,updated_at:$.updated_at??new Date().toISOString()},o,o==="me"?n:void 0)}}catch($){const B=$;_e.error(`Failed to update task: ${B.message}`),console.error("[chat] Failed to update task:",$)}},q=(R,$)=>{dn(a,A,e.id,R,$)};return ya({orgId:e.id,enabled:!0,onTaskStatus:R=>{const $=R.subject,B=R.data.status,ee=R.time;for(const me of["me","everyone"]){const Le=me==="me"?n:void 0;a.getQueryData(ie.tasks(t,me,Le))?.pages.some(Ze=>Ze.items.some(We=>We.id===$))??!1?Fe(a,t,$,{status:B,updated_at:ee},me,Le):me==="everyone"&&a.invalidateQueries({queryKey:ie.tasks(t,"everyone")})}}}),{tasks:g,activeTaskId:u,setActiveTaskId:x,messages:w,hasNextPage:v,isFetchingNextPage:I,fetchNextPage:b,ownerFilter:o,setOwnerFilter:f,isFilterChangePending:p,createTask:T,switchToTask:S,updateTask:P,renameTask:X,hideTask:W,updateMessagesCache:q}}function bn(t,e){const{mimeType:a,data:r}=t;if(a.startsWith("text/"))try{const s=new TextDecoder().decode(Uint8Array.from(atob(r),n=>n.charCodeAt(0)));return[{type:"text",text:`${e}
20
- ${s}`}]}catch(s){console.error("Failed to decode text file:",s)}return[{type:"file",url:`data:${a};base64,${r}`,filename:e,mediaType:a}]}function En(t,e){const a=[];for(const r of t)"text"in r&&r.text?a.push({type:"text",text:`[${e}]
21
- ${r.text}`}):"blob"in r&&r.blob&&r.mimeType&&a.push({type:"file",url:`data:${r.mimeType};base64,${r.blob}`,filename:String(r.uri),mediaType:String(r.mimeType)});return a}function _n(t,e){const a=[];for(const r of t){if(r.role!=="user"||!r.content)continue;const s=Array.isArray(r.content)?r.content:[r.content];for(const n of s)switch(n.type){case"text":{const i=n.text?.trim();if(!i)continue;a.push({type:"text",text:`[${e}]
22
- ${i}`});break}case"image":case"audio":{if(!n.data||!n.mimeType)continue;a.push({type:"file",url:`data:${n.mimeType};base64,${n.data}`,mediaType:n.mimeType});break}case"resource":{const i=n.resource;if(!i||!i.mimeType)continue;i&&("text"in i&&i.text?a.push({type:"text",text:`[${e}]
23
- ${i.text}`}):"blob"in i&&i.blob&&i.mimeType&&a.push({type:"file",url:`data:${i.mimeType};base64,${i.blob}`,filename:String(i.uri),mediaType:String(i.mimeType)}));break}}}return a}function ba(t){if(!t)return[];const e=[];let a="";const r=s=>{if(s){if(s.type==="text"&&"text"in s&&typeof s.text=="string")a+=s.text;else if(s.type==="mention"&&s.attrs){const n=s.attrs.char??"/",i=`${n}${s.attrs.name}`;if(a+=i,n==="@"){const o=s.attrs.metadata||[];e.push(...En(o,i))}else{const o=s.attrs.metadata||s.attrs.prompts||[];e.push(..._n(o,i))}}else if(s.type==="file"&&s.attrs){const n=s.attrs,i=`[file:://${encodeURIComponent(n.name)}]`;a+=i,e.push(...bn(n,i))}if("content"in s&&Array.isArray(s.content))for(const n of s.content)r(n)}};return r(t),a.trim()&&e.unshift({type:"text",text:a.trim()}),e}function Ln(t){const e=ba(t);return e.length===0?[]:[{id:crypto.randomUUID(),role:"user",parts:e,metadata:{tiptapDoc:t}}]}const Ea={parentTask:null,finishReason:null};function In(t,e){switch(e.type){case"START_BRANCH":return{...t,parentTask:e.payload};case"CLEAR_BRANCH":return{...t,parentTask:null};case"SET_FINISH_REASON":return t.finishReason===e.payload?t:{...t,finishReason:e.payload};case"CLEAR_FINISH_REASON":return{...t,finishReason:null};case"RESET":return Ea;default:return t}}function Ft(t){const e=t.capabilities,a=e&&e.length>0?{vision:e.includes("vision")||void 0,text:e.includes("text")||void 0,reasoning:e.includes("reasoning")||void 0}:void 0;return{id:t.modelId,title:t.title,provider:t.providerId,capabilities:a,limits:t.limits?{contextWindow:t.limits.contextWindow,maxOutputTokens:t.limits.maxOutputTokens??void 0}:void 0}}const Sn=(t,e)=>new ga({api:`/api/${t}/decopilot/stream`,credentials:"include",prepareReconnectToStreamRequest:({id:a})=>({api:`/api/${t}/decopilot/attach/${a}`}),prepareSendMessagesRequest:({messages:a,requestMetadata:r={}})=>{const{system:s,tiptapDoc:n,...i}=r,o=s?{id:crypto.randomUUID(),role:"system",parts:[{type:"text",text:s}]}:null,l=a.slice(-1).filter(Boolean),c=o?[o,...l]:l,d=a.at(-1)?.metadata??{},p={...i,agent:i.agent??d.agent,models:i.models??d.models,thread_id:i.thread_id??d.thread_id};return{body:{messages:c,...p,...e.current&&{toolApprovalLevel:e.current}}}}}),_a=M.createContext(null),Ia=M.createContext(null),Tn=3e4,Ut=()=>0;function An(t){const e=fe.c(34),{taskId:a,activeTask:r,isStreaming:s,chatRef:n,queryClient:i,locator:o,orgId:l}=t,c=M.useRef(null),d=M.useRef(0);let p;e[0]!==o||e[1]!==i?(p=()=>{i.invalidateQueries({queryKey:ie.tasks(o)})},e[0]=o,e[1]=i,e[2]=p):p=e[2];const h=p;let f;e[3]!==i||e[4]!==a?(f=()=>{a&&i.invalidateQueries({predicate:W=>{const q=W.queryKey;return q[3]!=="collection"||q[4]!=="THREAD_MESSAGES"?!1:(typeof q[6]=="string"?q[6]:"").includes(a)}})},e[3]=i,e[4]=a,e[5]=f):f=e[5];const g=f;let v;e[6]!==n?(v=()=>{const W=n.current.status;return W==="submitted"||W==="streaming"},e[6]=n,e[7]=v):v=e[7];const I=v;let b;e[8]!==n||e[9]!==g||e[10]!==h||e[11]!==I||e[12]!==a?(b=W=>{!a||c.current===a||d.current>=3||I()||(c.current=a,console.log(`[chat] resumeStream (${W})`,a),n.current.resumeStream().catch(q=>{console.error("[chat] resumeStream error",q),d.current=d.current+1,c.current=null,h(),g()}))},e[8]=n,e[9]=g,e[10]=h,e[11]=I,e[12]=a,e[13]=b):b=e[13];const A=b;let u;e[14]!==A?(u=()=>A("sse-step"),e[14]=A,e[15]=u):u=e[15];let x;e[16]!==g||e[17]!==h||e[18]!==I?(x=()=>{I()||(c.current=null,d.current=0,h(),setTimeout(g,2e3))},e[16]=g,e[17]=h,e[18]=I,e[19]=x):x=e[19];let w;e[20]!==h||e[21]!==I?(w=()=>{I()||h()},e[20]=h,e[21]=I,e[22]=w):w=e[22];let T;e[23]!==l||e[24]!==u||e[25]!==x||e[26]!==w||e[27]!==a?(T={orgId:l,taskId:a,onStep:u,onFinish:x,onTaskStatus:w},e[23]=l,e[24]=u,e[25]=x,e[26]=w,e[27]=a,e[28]=T):T=e[28],ya(T);const S=(r?.status==="in_progress"||r?.status==="expired")&&!s;let P;e[29]!==g||e[30]!==h||e[31]!==S||e[32]!==A?(P=W=>{if(!S)return wn;A("page-load");const q=setInterval(()=>{h(),g()},Tn);return()=>clearInterval(q)},e[29]=g,e[30]=h,e[31]=S,e[32]=A,e[33]=P):P=e[33];const X=P;return M.useSyncExternalStore(X,Ut,Ut),null}function wn(){}function Zn({children:t}){const{locator:e,org:a}=De(),r=ze(),s=ir(),[n,i]=we(Ee.chatSelectedKeyId(e),null),o=s.some(E=>E.id===n)?n:s[0]?.id??null,l=yn(),{data:c}=Bt.useSession(),d=c?.user??null,[p]=cr(),[h,f]=M.useReducer(In,Ea),g=M.useRef(void 0),v=M.useRef({}),I=M.useRef(p.toolApprovalLevel);I.current=p.toolApprovalLevel;const b=nr(),[A,u]=we(`${e}:selected-virtual-mcp-id`,null),x=s,[w,T]=we(Ee.chatSelectedModel(e),null),{models:S,isLoading:P}=lr(o??void 0),X=s.find(E=>E.id===o)?.providerId??"anthropic",W=or(S,X,o??void 0),q=!!w&&typeof w.modelId=="string"&&!!w.title,R=q?w:W,$=!q&&P,[B,ee]=we(Ee.chatSelectedMode(e),"code_execution"),me=l.messages,Le=sn(A),ft=nn(),{showNotification:mt}=on(),Ze=A?b.find(E=>E.id===A)??null:null,We=sr(a.id).id,Sa=Sn(a.slug,I),Ta=async({finishReason:E,isAbort:j,isDisconnect:U,isError:te,message:ce,messages:he})=>{f({type:"SET_FINISH_REASON",payload:E??null});const ge=ce.metadata?.thread_id,ae=ge??l.activeTaskId;if(ge&&ge!==l.activeTaskId&&l.setActiveTaskId(ge),j||U||te){ae&&he.length>0&&l.updateMessagesCache(ae,he);return}ae&&(he.length>0&&l.updateMessagesCache(ae,he),p.enableNotifications&&mt({tag:`chat-${ae}`,title:"Decopilot is waiting for your input at",body:l.tasks.find(Ye=>Ye.id===ae)?.title??"New chat"}))},Aa=E=>{console.error("[chat] Error",E)},F=tn({id:l.activeTaskId,messages:me,transport:Sa,sendAutomaticallyWhen:({messages:E})=>Hs({messages:E})||Gs({messages:E}),onFinish:Ta,onToolCall:ft,onError:Aa,onData:({data:E,type:j})=>{if(j==="data-thread-title"){const{title:U}=E;if(!U)return;l.updateTask(l.activeTaskId,{title:U,updated_at:new Date().toISOString()})}}}),Te=F.status==="submitted"||F.status==="streaming",wa=(()=>{const E=F.messages.at(-1);return!E||E.role!=="assistant"?!1:E.parts.some(j=>"state"in j&&j.state==="approval-requested")})(),Ca=F.messages.length===0&&l.messages.length===0,Ge=l.tasks.find(E=>E.id===l.activeTaskId),xa=(Ge?.status==="in_progress"||Ge?.status==="expired")&&!Te,le=M.useRef(F);le.current=F;const Ra=Te?F.messages:l.messages,Ma=()=>{He(),l.createTask()},Na=l.switchToTask,Oa=l.renameTask,Pa=l.hideTask,He=()=>f({type:"RESET"}),ka=E=>{u(E)},Da=E=>{T({modelId:E.modelId,title:E.title,description:E.description,logo:E.logo,providerId:E.providerId,capabilities:E.capabilities,limits:E.limits,costs:E.costs,keyId:E.keyId})},$a=1e4,ja=10,La=(E,j)=>{const U=[];for(const ce of j.content??[])ce.type==="text"&&ce.text?.trim()&&U.push(ce.text.trim());const te=U.join(`
24
- `);if(!te){delete v.current[E];return}new TextEncoder().encode(te).length>$a||Object.keys(v.current).length>=ja&&!(E in v.current)||(v.current[E]=te)},Za=E=>{delete v.current[E]},Fa=async E=>{if(!R){_e.error("No model configured");return}const j=ba(E);if(j.length===0)return;l.messages.length>0&&le.current.setMessages(l.messages),He();const U={tiptapDoc:E,created_at:new Date().toISOString(),thread_id:l.activeTaskId,agent:{id:Ze?.id??We,mode:B},user:{avatar:d?.image??void 0,name:d?.name??"you"}},te=Object.entries(v.current),ce=te.length>0?te.map(([Ye,Wa])=>`### App Context: ${Ye}
25
- ${Wa}`).join(`
26
-
27
- `):"",he=[Le,ce].filter(Boolean).join(`
28
-
29
- `),ge={...U,system:he,models:{credentialId:R.keyId??o??"",thinking:Ft(R),fast:Ft(R)}},ae={id:crypto.randomUUID(),role:"user",parts:j,metadata:U};await le.current.sendMessage(ae,{metadata:ge})},ht=async()=>{const E=l.activeTaskId;if(E){le.current.messages.length>0&&l.updateMessagesCache(E,le.current.messages),le.current.stop();try{const j=await fetch(`/api/${a.slug}/decopilot/cancel/${E}`,{method:"POST",credentials:"include"});if(!j.ok){const U=await j.json().catch(()=>({}));throw new Error(U.message??`Cancel failed: ${j.status}`)}await r.invalidateQueries({queryKey:ie.tasks(e)})}catch(j){const U=j instanceof Error?j.message:"Failed to cancel";_e.error(U),console.error("[chat] cancelRun",j)}}},Ua=()=>{Te&&ht(),F.stop()},Va=()=>(Ua(),Promise.resolve()),qa=()=>f({type:"CLEAR_FINISH_REASON"}),Ba=M.useDeferredValue(Ra),za={tiptapDocRef:g,resetInteraction:He,activeTaskId:l.activeTaskId,tasks:l.tasks,createTask:Ma,switchToTask:Na,renameTask:Oa,hideTask:Pa,hasNextPage:l.hasNextPage,isFetchingNextPage:l.isFetchingNextPage,fetchNextPage:l.fetchNextPage,ownerFilter:l.ownerFilter,setOwnerFilter:l.setOwnerFilter,isFilterChangePending:l.isFilterChangePending,virtualMcps:b,selectedVirtualMcp:Ze,setVirtualMcpId:ka,model:R,isModelsLoading:$,setSelectedModel:Da,selectedMode:B,setSelectedMode:ee,sendMessage:Fa,cancelRun:ht,setAppContext:La,clearAppContext:Za,allModelsConnections:x,credentialId:o,setCredentialId:i},Ja={messages:Ba,status:F.status,setMessages:F.setMessages,error:F.error,clearError:F.clearError,stop:Va,addToolOutput:F.addToolOutput,addToolApprovalResponse:F.addToolApprovalResponse,isStreaming:Te,isChatEmpty:Ca,finishReason:h.finishReason,clearFinishReason:qa,isWaitingForApprovals:wa,isRunInProgress:xa};return Ae.jsx(_a.Provider,{value:za,children:Ae.jsxs(Ia.Provider,{value:Ja,children:[Ae.jsx(rr,{fallback:null,children:Ae.jsx(M.Suspense,{fallback:null,children:Ae.jsx(An,{taskId:l.activeTaskId,activeTask:Ge,isStreaming:Te,chatRef:le,queryClient:r,locator:e,orgId:a.id},l.activeTaskId)})}),t]})})}function Cn(){const t=M.useContext(_a);if(!t)throw new Error("useChatStable must be used within a ChatProvider");return t}function xn(){const t=M.useContext(Ia);if(!t)throw new Error("useChatStream must be used within a ChatProvider");return t}function Fn(){const t=fe.c(3),e=Cn(),a=xn();let r;return t[0]!==e||t[1]!==a?(r={...e,...a},t[0]=e,t[1]=a,t[2]=r):r=t[2],r}export{Zn as C,Fn as a,ya as b,an as c,Ln as t,Cn as u};
@@ -1 +0,0 @@
1
- const d={STEP:"decopilot.step",FINISH:"decopilot.finish",THREAD_STATUS:"decopilot.thread.status"},u=Object.values(d),r={anthropic:["claude-sonnet-4-6","claude-sonnet","claude"],openrouter:["qwen","anthropic/claude-sonnet-4-6","anthropic/claude-sonnet","anthropic/claude"]};function l(e,i,a){if(e.length===0)return null;const s=r[i]??[],o=t=>a!==void 0?{...t,keyId:a}:t;for(const t of s){const n=e.find(c=>c.modelId===t);if(n)return o(n)}for(const t of s){const n=e.find(c=>c.modelId.includes(t));if(n)return o(n)}return o(e[0])}export{u as A,d as D,r as a,l as s};
@@ -1 +0,0 @@
1
- import{c as n,j as i,T as g,z as c,U as u,W as m,X as x,Y as j,Z as N,$ as b,a0 as D}from"./index-EJhirEgi.js";import{i as h}from"./X-CC0aD5R8.js";function C(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(g,{"data-slot":"dialog",...t}),e[2]=t,e[3]=s):s=e[3],s}function k(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(D,{"data-slot":"dialog-trigger",...t}),e[2]=t,e[3]=s):s=e[3],s}function v(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(j,{"data-slot":"dialog-portal",...t}),e[2]=t,e[3]=s):s=e[3],s}function y(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/45 backdrop-blur-[0.15px]",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(N,{"data-slot":"dialog-overlay",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function $(l){const e=n.c(6),{className:t}=l;let s;e[0]!==t?(s=c("cursor-pointer ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground","absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2","focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),e[0]=t,e[1]=s):s=e[1];let a,o;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(h,{}),o=i.jsx("span",{className:"sr-only",children:"Close"}),e[2]=a,e[3]=o):(a=e[2],o=e[3]);let r;return e[4]!==s?(r=i.jsxs(b,{className:s,children:[a,o]}),e[4]=s,e[5]=r):r=e[5],r}function w(l){const e=n.c(15);let t,s,a,o;e[0]!==l?({className:s,children:t,closeButtonClassName:a,...o}=l,e[0]=l,e[1]=t,e[2]=s,e[3]=a,e[4]=o):(t=e[1],s=e[2],a=e[3],o=e[4]);let r;e[5]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx(y,{}),e[5]=r):r=e[5];let d;e[6]!==s?(d=c("bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border p-6 shadow-md duration-200 sm:max-w-lg",s),e[6]=s,e[7]=d):d=e[7];let f;e[8]!==a?(f=i.jsx($,{className:a}),e[8]=a,e[9]=f):f=e[9];let p;return e[10]!==t||e[11]!==o||e[12]!==d||e[13]!==f?(p=i.jsxs(v,{"data-slot":"dialog-portal",children:[r,i.jsxs(u,{"data-slot":"dialog-content",className:d,...o,children:[t,f]})]}),e[10]=t,e[11]=o,e[12]=d,e[13]=f,e[14]=p):p=e[14],p}function T(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("flex flex-col gap-2 text-center sm:text-left",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx("div",{"data-slot":"dialog-header",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function R(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx("div",{"data-slot":"dialog-footer",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function B(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("text-lg leading-none font-semibold",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(m,{"data-slot":"dialog-title",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function E(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("text-muted-foreground text-sm",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(x,{"data-slot":"dialog-description",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}export{C as D,w as a,T as b,B as c,E as d,R as e,k as f};
@@ -1 +0,0 @@
1
- import{C as i,L as l,O as u,P as n,V as C,a as c,h as P,i as p,b as m,p as M,s as E,u as L}from"./index-EJhirEgi.js";import{E as T,b as g,a as O,c as S,u as x,d as _,e as R}from"./use-collections-B4b2cHqe.js";import{u as y,a as b,b as A}from"./use-connection-DrhtnyBi.js";import{S as e}from"./constants-BtZ3fAEQ.js";import{K as I,a as h,W as V,c as U,g as K,b as W,d as N,e as Q,i as w,u as F,f as Y}from"./constants-BtZ3fAEQ.js";import{u as G,a as k,b as v,c as B,d as H}from"./use-mcp-tools-CKkWOyR2.js";import{l as q,r as z,u as X,a as Z,b as $}from"./use-mcp-resources-Dk6zV1FV.js";import{g as es,l as as,u as ts,a as os}from"./use-mcp-prompts-LuO7HYtE.js";import{u as is,a as ls,b as us}from"./use-virtual-mcp-D_iE9Cdz.js";import{A as Cs,D as cs,a as Ps,s as ps}from"./default-model-D8jxKXJs.js";import{a as Ms,c as Es,e as Ls,g as ds}from"./usage-B8eRkRZY.js";import"./useMutation-ClueFvpj.js";import"./useQuery-mGiR1oLn.js";export{Cs as ALL_DECOPILOT_EVENT_TYPES,i as ConnectionEntitySchema,cs as DECOPILOT_EVENTS,Ps as DEFAULT_MODEL_PREFERENCES,T as EMPTY_COLLECTION_LIST_RESULT,I as KEYS,l as Locator,u as ORG_ADMIN_PROJECT_SLUG,n as ProjectContextProvider,h as SELF_MCP_ALIAS_ID,e as StreamableHTTPClientTransport,C as VirtualMCPEntitySchema,V as WellKnownOrgMCPId,Ms as addUsage,c as authenticateMcp,g as buildCollectionQueryKey,O as buildOrderByExpression,S as buildWhereExpression,Es as calculateUsageStats,U as createMCPClient,Ls as emptyUsageStats,ds as getCostFromUsage,K as getDecopilotId,es as getPrompt,W as getWellKnownCommunityRegistryConnection,N as getWellKnownDecopilotVirtualMCP,Q as getWellKnownRegistryConnection,P as handleOAuthCallback,p as isConnectionAuthenticated,w as isDecopilot,m as isStdioParameters,as as listPrompts,q as listResources,M as parseVirtualUrl,z as readResource,ps as selectDefaultModel,E as setOAuthRedirectOrigin,x as useCollectionActions,_ as useCollectionItem,R as useCollectionList,y as useConnection,b as useConnectionActions,A as useConnections,F as useMCPClient,Y as useMCPClientOptional,ts as useMCPPromptsList,os as useMCPPromptsListQuery,X as useMCPReadResource,Z as useMCPResourcesList,$ as useMCPResourcesListQuery,G as useMCPToolCall,k as useMCPToolCallMutation,v as useMCPToolCallQuery,B as useMCPToolsList,H as useMCPToolsListQuery,L as useProjectContext,is as useVirtualMCP,ls as useVirtualMCPActions,us as useVirtualMCPs};
@@ -1 +0,0 @@
1
- import{r as b,c as u,z as g,j as n,g as $,as as T,B as _}from"./index-EJhirEgi.js";import{u as w,L as S}from"./localstorage-keys-CyCsfmz2.js";import{a as k,T as O,c as R}from"./tooltip-BXI94UP3.js";const v=({size:t=24,color:e="currentColor",...l})=>b.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...l},b.createElement("path",{d:"M8 9.5h4M8 13h7m-3 8a9 9 0 1 0-8.342-5.616c.081.2.122.3.14.381a.907.907 0 0 1 .024.219c0 .083-.015.173-.045.353l-.593 3.558c-.062.373-.093.56-.035.694a.5.5 0 0 0 .262.262c.135.058.321.027.694-.035l3.558-.593c.18-.03.27-.045.353-.045.081 0 .14.006.219.024.08.018.18.059.38.14A8.973 8.973 0 0 0 12 21Z"}));v.displayName="MessageTextCircle02";function y(){const t=u.c(4);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=S.decoChatOpen(),t[0]=e):e=t[0];const[l,o]=w(e,E);let s;return t[1]!==l||t[2]!==o?(s=[l,o],t[1]=l,t[2]=o,t[3]=s):s=t[3],s}function E(t){return!!(t??!0)}function j(t,e){const l=b.Children.toArray(t);for(const o of l)if(b.isValidElement(o)&&o.type===e)return o;return null}function L(){const t=u.c(12),[e,l]=y();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},t[0]=o):o=t[0];const{org:s,project:r}=$(o),{location:h}=T();if(h.pathname===`/${s}/${r}`||h.pathname===`/${s}/${r}/`)return null;const m=e&&"bg-accent text-foreground";let i;t[1]!==m?(i=g("h-7 px-2 gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground",m),t[1]=m,t[2]=i):i=t[2];let c;t[3]!==l?(c=()=>l(P),t[3]=l,t[4]=c):c=t[4];let f;t[5]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(v,{size:14,className:"text-inherit"}),t[5]=f):f=t[5];let a;t[6]!==i||t[7]!==c?(a=n.jsx(k,{asChild:!0,children:n.jsxs(_,{variant:"ghost",className:i,onClick:c,"aria-label":"Toggle Decopilot",children:[f,"Chat"]})}),t[6]=i,t[7]=c,t[8]=a):a=t[8];let d;t[9]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(O,{side:"bottom",children:"Toggle Decopilot"}),t[9]=d):d=t[9];let p;return t[10]!==a?(p=n.jsxs(R,{children:[a,d]}),t[10]=a,t[11]=p):p=t[11],p}function P(t){return!t}function H(t){const e=u.c(5),{children:l,className:o}=t;let s;e[0]!==o?(s=g("flex flex-col h-full bg-background overflow-hidden",o),e[0]=o,e[1]=s):s=e[1];let r;return e[2]!==l||e[3]!==s?(r=n.jsx("div",{className:s,children:l}),e[2]=l,e[3]=s,e[4]=r):r=e[4],r}function B(t){const e=u.c(17),{children:l,className:o,hideSidebarTrigger:s}=t;let r;e[0]!==l?(r=j(l,C),e[0]=l,e[1]=r):r=e[1];const h=r;let x;e[2]!==l?(x=j(l,N),e[2]=l,e[3]=x):x=e[3];const m=x;let i;e[4]!==o?(i=g("shrink-0 w-full border-b border-border/50 h-11 overflow-x-auto","flex items-center justify-between gap-3 pr-2 pl-4 min-w-max",o),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==h?(c=n.jsx("div",{className:"flex items-center gap-1",children:h}),e[6]=h,e[7]=c):c=e[7];let f;e[8]!==s?(f=!s&&n.jsx("div",{className:"flex items-center border-l border-border/50 pl-2 ml-1",children:n.jsx(L,{})}),e[8]=s,e[9]=f):f=e[9];let a;e[10]!==m||e[11]!==f?(a=n.jsxs("div",{className:"flex items-center",children:[m,f]}),e[10]=m,e[11]=f,e[12]=a):a=e[12];let d;return e[13]!==i||e[14]!==c||e[15]!==a?(d=n.jsxs("div",{className:i,children:[c,a]}),e[13]=i,e[14]=c,e[15]=a,e[16]=d):d=e[16],d}function C(t){const e=u.c(5),{children:l,className:o}=t;let s;e[0]!==o?(s=g("flex items-center gap-2 shrink-0 overflow-hidden",o),e[0]=o,e[1]=s):s=e[1];let r;return e[2]!==l||e[3]!==s?(r=n.jsx("div",{className:s,children:l}),e[2]=l,e[3]=s,e[4]=r):r=e[4],r}function N(t){const e=u.c(5),{children:l,className:o}=t;let s;e[0]!==o?(s=g("flex items-center gap-2 shrink-0 overflow-hidden border-l border-border pl-3",o),e[0]=o,e[1]=s):s=e[1];let r;return e[2]!==l||e[3]!==s?(r=n.jsx("div",{className:s,children:l}),e[2]=l,e[3]=s,e[4]=r):r=e[4],r}function A(t){const e=u.c(5),{children:l,className:o}=t;let s;e[0]!==o?(s=g("flex-1 overflow-auto",o),e[0]=o,e[1]=s):s=e[1];let r;return e[2]!==l||e[3]!==s?(r=n.jsx("div",{className:s,children:l}),e[2]=l,e[3]=s,e[4]=r):r=e[4],r}const G=Object.assign(H,{Header:Object.assign(B,{Left:C,Right:N}),Content:A});export{G as P,y as u};
@@ -1 +0,0 @@
1
- import{c as O,x as v}from"./index-EJhirEgi.js";import{u as x}from"./useQuery-mGiR1oLn.js";import{u as T}from"./useMutation-ClueFvpj.js";function L(t){try{return JSON.parse(t)}catch{return}}function y(t,s){const e=localStorage.getItem(t),o=e?L(e):void 0,c=typeof s=="function"?s(o):o??s;if(o===void 0||c!==o)try{const a=JSON.stringify(c);localStorage.setItem(t,a)}catch{}return c}function w(t,s){const e=O.c(25),o=v();let c;e[0]!==t?(c=["localStorage",t],e[0]=t,e[1]=c):c=e[1];const a=c;let r,i;e[2]!==s||e[3]!==t?(r=()=>y(t,s),i=()=>y(t,s),e[2]=s,e[3]=t,e[4]=r,e[5]=i):(r=e[4],i=e[5]);let m;e[6]!==a||e[7]!==r||e[8]!==i?(m={queryKey:a,queryFn:r,initialData:i,staleTime:1/0,gcTime:1/0},e[6]=a,e[7]=r,e[8]=i,e[9]=m):m=e[9];const{data:C}=x(m);let l;e[10]!==t?(l=async n=>{const $=JSON.stringify(n);return localStorage.setItem(t,$),n},e[10]=t,e[11]=l):l=e[11];let h;e[12]!==o||e[13]!==a?(h=n=>{o.setQueryData(a,n)},e[12]=o,e[13]=a,e[14]=h):h=e[14];let u;e[15]!==l||e[16]!==h?(u={mutationFn:l,onSuccess:h},e[15]=l,e[16]=h,e[17]=u):u=e[17];const g=T(u);let f;e[18]!==g||e[19]!==o||e[20]!==a?(f=n=>{const $=o.getQueryData(a),I=typeof n=="function"?n($):n;g.mutate(I)},e[18]=g,e[19]=o,e[20]=a,e[21]=f):f=e[21];const S=f,p=C;let d;return e[22]!==S||e[23]!==p?(d=[p,S],e[22]=S,e[23]=p,e[24]=d):d=e[24],d}const F={assistantChatTasks:t=>`mesh:assistant-chat:tasks:${t}`,messages:(t,s)=>`mesh:messages:${t}:${s}`,decoChatOpen:()=>"mesh:decochat:open",chatSelectedModel:t=>`mesh:chat:selectedModel:${t}`,chatSelectedMode:t=>`mesh:chat:selectedMode:${t}`,chatSelectedKeyId:t=>`mesh:chat:selectedKeyId:${t}`,assistantChatActiveTask:t=>`mesh:assistant-chat:active-task:${t}`,decoChatPanelWidth:()=>"mesh:decochat:panel-width",sidebarOpen:()=>"mesh:sidebar-open",selectedRegistry:t=>`mesh:store:selected-registry:${t}`,orgHomeQuickstart:t=>`mesh:org-home:quickstart:${t}`,storeShowStdio:()=>"mesh:store:show-stdio",preferences:()=>"mesh:user:preferences",pluginConnection:(t,s)=>`mesh:plugin:connection:${t}:${s}`,chatTaskOwnerFilter:t=>`mesh:chat:task-owner-filter:${t}`};export{F as L,w as u};