@decocms/mesh 2.133.1 → 2.134.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-C_-Exi_n.js → AlertCircle-dxGFeayp.js} +1 -1
- package/dist/client/assets/{AlignLeft-DU7XXs04.js → AlignLeft-zf4ygcA_.js} +1 -1
- package/dist/client/assets/{ArrowDown-Ci69NI9T.js → ArrowDown-BfANN175.js} +1 -1
- package/dist/client/assets/{ArrowLeft-DiQ6H1qe.js → ArrowLeft-DKmEJ5pf.js} +1 -1
- package/dist/client/assets/{ArrowUp-YaPl1lq-.js → ArrowUp-BNm6R5tp.js} +1 -1
- package/dist/client/assets/{Check-AlxQ-j2G.js → Check-BuBqfL8V.js} +1 -1
- package/dist/client/assets/{CheckCircle-BQbEhLAd.js → CheckCircle-B-t884rD.js} +1 -1
- package/dist/client/assets/{CheckDone01-CnA5MJ5u.js → CheckDone01-C_N43WOE.js} +1 -1
- package/dist/client/assets/{CheckVerified02-9ppFNPbL.js → CheckVerified02-CF--qrDr.js} +1 -1
- package/dist/client/assets/{ChevronDown-Bt1ewsqh.js → ChevronDown-D15Vpp0r.js} +1 -1
- package/dist/client/assets/{ChevronLeft-ZjYcxOdo.js → ChevronLeft-CJX984rp.js} +1 -1
- package/dist/client/assets/{ChevronRight-sqD7LMFa.js → ChevronRight-u7jqeZNG.js} +1 -1
- package/dist/client/assets/{Clock-CGeVATg-.js → Clock-B88-VhpY.js} +1 -1
- package/dist/client/assets/{Code01-X9LTEq8d.js → Code01-DhSY1b20.js} +1 -1
- package/dist/client/assets/{Container-Dt3fts2O.js → Container-CFxptFeR.js} +1 -1
- package/dist/client/assets/{Copy01-yMwUMo5Y.js → Copy01-D2l3XUry.js} +1 -1
- package/dist/client/assets/{Dataflow03-GEBPM69Y.js → Dataflow03-TMmWfgl9.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-rnia2dDb.js → DotsHorizontal-CZq86zFa.js} +1 -1
- package/dist/client/assets/{DotsVertical-DxigKHHt.js → DotsVertical-B78gtBdB.js} +1 -1
- package/dist/client/assets/{Download01-axlmJqAw.js → Download01-DDJLkXru.js} +1 -1
- package/dist/client/assets/{Edit01-Cg13Y9IR.js → Edit01-CbZPkCJz.js} +1 -1
- package/dist/client/assets/{Eye-D5VDCdLP.js → Eye-vR70tVFn.js} +1 -1
- package/dist/client/assets/{File02-DasnEozT.js → File02-B1NunE2J.js} +1 -1
- package/dist/client/assets/{File06-B5xn-On2.js → File06-D8w_IYOr.js} +1 -1
- package/dist/client/assets/{FilterLines-7rCsQUMC.js → FilterLines-BY-bo6_s.js} +1 -1
- package/dist/client/assets/{Globe01-DghE3nSS.js → Globe01-CL7GrOsx.js} +1 -1
- package/dist/client/assets/{Globe02-DsDY7_VG.js → Globe02-6j3SB4QZ.js} +1 -1
- package/dist/client/assets/{Grid01-C3osH3dx.js → Grid01-DjcW2Js4.js} +1 -1
- package/dist/client/assets/{Hash02-D2cqLEQA.js → Hash02-BMwtcDtI.js} +1 -1
- package/dist/client/assets/{Home02-BwxX5zad.js → Home02-CMWrNstp.js} +1 -1
- package/dist/client/assets/{Image01-Dk65YqxA.js → Image01-oZtE9Z5q.js} +1 -1
- package/dist/client/assets/{Inbox01-kmB3TeMO.js → Inbox01-xF_R8liT.js} +1 -1
- package/dist/client/assets/{InfoCircle-C0U8p7zQ.js → InfoCircle-B_WtF_e0.js} +1 -1
- package/dist/client/assets/{Key01-CqhHrRJL.js → Key01-Cvjt_ykt.js} +1 -1
- package/dist/client/assets/{LayersTwo01-BFhpnCtq.js → LayersTwo01-f778oNbj.js} +1 -1
- package/dist/client/assets/{LayoutLeft-CW10Mj8C.js → LayoutLeft-BXJHafgx.js} +1 -1
- package/dist/client/assets/{LinkExternal01-DdPfa8wq.js → LinkExternal01-DY3cItdE.js} +1 -1
- package/dist/client/assets/{List-iHNJ390y.js → List-Be3XBHwN.js} +1 -1
- package/dist/client/assets/{Loading01-SjZGs3Wk.js → Loading01-BLoQsWVt.js} +1 -1
- package/dist/client/assets/{Lock01-CryAxM1F.js → Lock01-Cj3RiFKG.js} +1 -1
- package/dist/client/assets/{Play-CKKDGI7M.js → Play-CCz3CWMJ.js} +1 -1
- package/dist/client/assets/{Plus-DXYydVCi.js → Plus-4zX3n4bH.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-DT9wSPl_.js → RefreshCcw01-DzE0Vt_s.js} +1 -1
- package/dist/client/assets/{Save01-w3vLU2XF.js → Save01-DiUMsefH.js} +1 -1
- package/dist/client/assets/{SearchMd-CSKcblxx.js → SearchMd-BvHN4xgB.js} +1 -1
- package/dist/client/assets/{Settings01-Dkx2ZoN9.js → Settings01-B5kunEo2.js} +1 -1
- package/dist/client/assets/{Shield01-BqITe6MU.js → Shield01-DrTQ94s0.js} +1 -1
- package/dist/client/assets/{Terminal-B4v75vOD.js → Terminal-DQnj9LXz.js} +1 -1
- package/dist/client/assets/{Trash01-CDDpTvNv.js → Trash01-BvIumE4M.js} +1 -1
- package/dist/client/assets/{Upload01-DAiUnxPv.js → Upload01-DLPOqCLa.js} +1 -1
- package/dist/client/assets/{Users03-BXHamAas.js → Users03-CUxh9_Jy.js} +1 -1
- package/dist/client/assets/{X-BHBlYu74.js → X-CpsrVd7E.js} +1 -1
- package/dist/client/assets/{XCircle-Bm1DtLmf.js → XCircle-BcvU_Xzf.js} +1 -1
- package/dist/client/assets/{XClose-B0OIa3qG.js → XClose-CnTCpAeI.js} +1 -1
- package/dist/client/assets/{Zap-DYif66ZC.js → Zap-BACXfgKn.js} +1 -1
- package/dist/client/assets/{agent-connections-preview-131FyINm.js → agent-connections-preview-BTescy5G.js} +1 -1
- package/dist/client/assets/{agent-detail-BQD2V8eu.js → agent-detail-C9_VIiuY.js} +1 -1
- package/dist/client/assets/{agents-BChxlMJi.js → agents-DkUxuyJc.js} +1 -1
- package/dist/client/assets/{alert-dialog-DRnSCcWl.js → alert-dialog-B0yEBEkb.js} +1 -1
- package/dist/client/assets/{auth-catchall-qZjolz1d.js → auth-catchall-CZYx2ePL.js} +1 -1
- package/dist/client/assets/{avatar-BsFgSPZd.js → avatar-BeiX4aSz.js} +1 -1
- package/dist/client/assets/{badge-BZU2aZ4g.js → badge-UPowR1Nj.js} +1 -1
- package/dist/client/assets/{binder-CXy7pGaI.js → binder-DUACCYIe.js} +1 -1
- package/dist/client/assets/{breadcrumb-CkhUU1qO.js → breadcrumb-DxXcAXh7.js} +1 -1
- package/dist/client/assets/{card-BiGYvdPr.js → card-BRjix5ol.js} +1 -1
- package/dist/client/assets/{chart-x30PoZrw.js → chart-FIHtzVp6.js} +1 -1
- package/dist/client/assets/{checkbox-DaiL5KlM.js → checkbox-Df-Mj-oX.js} +1 -1
- package/dist/client/assets/{circle-alert-D5aKQND0.js → circle-alert-CHATLFG-.js} +1 -1
- package/dist/client/assets/collapsible-CG7okAAn.js +23 -0
- package/dist/client/assets/{collection-detail-Bder-uOv.js → collection-detail-DnFoqwX5.js} +1 -1
- package/dist/client/assets/{collection-search-Bkt-jVWx.js → collection-search-BgstpGbD.js} +1 -1
- package/dist/client/assets/{collection-tab-DILgyiiN.js → collection-tab-CkymCS_K.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-c85b97QJ.js → collection-table-wrapper-B7II4YYC.js} +1 -1
- package/dist/client/assets/{collection-tabs-ywHh3L-3.js → collection-tabs-nglpt7Dm.js} +1 -1
- package/dist/client/assets/{command-BLXAYQCa.js → command-BvChE5AN.js} +1 -1
- package/dist/client/assets/{connect-BJqi59zN.js → connect-C_zUgms_.js} +1 -1
- package/dist/client/assets/{connection-card-CRg7yGx3.js → connection-card-DE2PfyYV.js} +1 -1
- package/dist/client/assets/{connection-detail-D1-5uzSn.js → connection-detail-CIlY792n.js} +1 -1
- package/dist/client/assets/{connections-D1tXy5Nn.js → connections-e6eEADmb.js} +1 -1
- package/dist/client/assets/{constants-2Gp-yGJ1.js → constants--aQ9HnxF.js} +1 -1
- package/dist/client/assets/constants-DoLvwboP.js +1 -0
- package/dist/client/assets/{create-organization-dialog-CtQ-v5j4.js → create-organization-dialog-BW4s7GqS.js} +1 -1
- package/dist/client/assets/{create-project-dialog-DpFucZww.js → create-project-dialog-BMiLf2Mr.js} +1 -1
- package/dist/client/assets/{danger-CHhKecE7.js → danger-BAlOLeDE.js} +1 -1
- package/dist/client/assets/{danger-zone-B1ksqQ3N.js → danger-zone-PDtJsuS3.js} +1 -1
- package/dist/client/assets/{decopilot-events-DlkvGkzj.js → decopilot-events-DZodCqX1.js} +1 -1
- package/dist/client/assets/{dependencies-DO7dUDR7.js → dependencies-DOcreK8_.js} +1 -1
- package/dist/client/assets/{dialog-BeE7uUPn.js → dialog-CrYlSCa6.js} +1 -1
- package/dist/client/assets/{dropdown-menu-B0Dgts11.js → dropdown-menu-DvfBJ25L.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-ChmoTPch.js → dynamic-plugin-layout-1UBvkRf8.js} +1 -1
- package/dist/client/assets/{editable-task-title--9hhF-R6.js → editable-task-title-emHsd6RF.js} +1 -1
- package/dist/client/assets/{empty-state-DE4SQU5S.js → empty-state-C2LU6BeW.js} +1 -1
- package/dist/client/assets/{env-vars-editor-CBMsqTh6.js → env-vars-editor-DM7ragIP.js} +1 -1
- package/dist/client/assets/{extract-connection-data-0trSaHAT.js → extract-connection-data-DtOGbK2O.js} +1 -1
- package/dist/client/assets/{file-browser-0DYVKNPK.js → file-browser-dzB3GMud.js} +2 -2
- package/dist/client/assets/{form-DNs_mLgF.js → form-DKOb9Dxi.js} +1 -1
- package/dist/client/assets/{general-CC_F5c1Q.js → general-C8KCERL-.js} +1 -1
- package/dist/client/assets/{grid-view-Y6fAVOxf.js → grid-view-Dp6SbR5A.js} +1 -1
- package/dist/client/assets/{home-DXg-PZRS.js → home-DpLONLMM.js} +1 -1
- package/dist/client/assets/{index-BMtw0aq_.js → index-B4YFEuZr.js} +1 -1
- package/dist/client/assets/{index-DTgZok4N.js → index-BkxNgQ-z.js} +3 -3
- package/dist/client/assets/{index-C6fMaWPS.js → index-Bq_4mEQF.js} +1 -1
- package/dist/client/assets/{index-eYcb2Cm9.js → index-CKt9M-ST.js} +1 -1
- package/dist/client/assets/{index--9MdKIVD.js → index-CuJORTyw.js} +1 -1
- package/dist/client/assets/{index-DqmnWcee.js → index-UbMd2WCz.js} +1 -1
- package/dist/client/assets/{index-C_SwSaaG.js → index-ZJA9ZP0w.js} +1 -1
- package/dist/client/assets/{index-BG6VshDR.js → index-dKQNml8k.js} +1 -1
- package/dist/client/assets/{index-Gr3qtElA.js → index-u5kBBr5i.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-Dy7IOO2y.js → infiniteQueryObserver-DFroUYRE.js} +1 -1
- package/dist/client/assets/{input-CjsuYubG.js → input-BxWPl4Ur.js} +1 -1
- package/dist/client/assets/{integration-icon-BqSOA-1d.js → integration-icon-DqBJsR0X.js} +1 -1
- package/dist/client/assets/{label-ND6ncjGS.js → label-DQ6CQRMq.js} +1 -1
- package/dist/client/assets/{layout-CKzU3ZCb.js → layout-0mFUwCP9.js} +1 -1
- package/dist/client/assets/{layout-K29HidGl.js → layout-rnNZXdmD.js} +1 -1
- package/dist/client/assets/{localstorage-keys-Cenhbz-P.js → localstorage-keys-2beZrYfY.js} +1 -1
- package/dist/client/assets/{login-oxVPXFpk.js → login-DcPWsiJb.js} +1 -1
- package/dist/client/assets/{markdown-DI_NQ3zj.js → markdown-08iefd1w.js} +1 -1
- package/dist/client/assets/{mcp-app-renderer-D2qbe9d6.js → mcp-app-renderer-DlqJcoS_.js} +1 -1
- package/dist/client/assets/{mcp-oauth-BGy49NaP.js → mcp-oauth-hrdldmcp.js} +1 -1
- package/dist/client/assets/{mcp-server-card-Dn8mS4B0.js → mcp-server-card-DopVvusq.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-BJrSdPXE.js → mcp-server-detail-6bJ8ASSa.js} +2 -2
- package/dist/client/assets/{members-DZd5xLHT.js → members-Do6CpQ6P.js} +1 -1
- package/dist/client/assets/{monitoring-DpcldHRD.js → monitoring-CKBrV8zM.js} +1 -1
- package/dist/client/assets/{monitoring-dashboard-edit-Dua9qsND.js → monitoring-dashboard-edit-CisDX-AH.js} +1 -1
- package/dist/client/assets/{monitoring-dashboard-view-X9A7Dt7e.js → monitoring-dashboard-view-CLglwuRf.js} +1 -1
- package/dist/client/assets/{oauth-callback-CsqoN40N.js → oauth-callback-EWqhoS77.js} +1 -1
- package/dist/client/assets/{page-CLamcNIQ.js → page-BIGqii57.js} +1 -1
- package/dist/client/assets/{page-Cx3Xt8ip.js → page-CrIdFE4e.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-BV6g5sMv.js → plugin-empty-state-AsJFZqlq.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-Df_tIhim.js → plugin-empty-state-DgfbXovL.js} +1 -1
- package/dist/client/assets/{plugin-header-CsoLpSwS.js → plugin-header-CdB0sXQc.js} +1 -1
- package/dist/client/assets/{plugin-header-ClbYQgeN.js → plugin-header-DMTu3kKy.js} +1 -1
- package/dist/client/assets/plugins-AJrV2JnY.js +1 -0
- package/dist/client/assets/{popover-C2X8YaiC.js → popover-CJnKtmVV.js} +1 -1
- package/dist/client/assets/{project-app-view-CkhQ-sFM.js → project-app-view-CrOJlRSX.js} +1 -1
- package/dist/client/assets/{project-layout-DcmZkb79.js → project-layout-CxbfzuHT.js} +1 -1
- package/dist/client/assets/{project-plugins-BxtIWCHr.js → project-plugins-OrxVzBYc.js} +1 -1
- package/dist/client/assets/{projects-list-B9ZNjsmc.js → projects-list-CaeO-dsb.js} +1 -1
- package/dist/client/assets/purify.es-C0_7NiBM.js +2 -0
- package/dist/client/assets/{readme-viewer-DQ57Paqf.js → readme-viewer-CvFtkeFt.js} +1 -1
- package/dist/client/assets/{registry-layout-BOuKDda5.js → registry-layout-C_lUsUO4.js} +1 -1
- package/dist/client/assets/{registry-utils-BFXjOPvi.js → registry-utils-Bm8aYhvn.js} +1 -1
- package/dist/client/assets/{reports-layout-_5crmBff.js → reports-layout-COQgk5-M.js} +1 -1
- package/dist/client/assets/{reset-password-Qo3jQxbB.js → reset-password-BHTKtR6U.js} +1 -1
- package/dist/client/assets/{resizable-BotMD0Ea.js → resizable-DNctE6m6.js} +1 -1
- package/dist/client/assets/{save-actions-BGfSClkF.js → save-actions-DgW9lLRI.js} +1 -1
- package/dist/client/assets/{scroll-area-CiqOJ4_4.js → scroll-area-Ce3JzMbc.js} +1 -1
- package/dist/client/assets/{select-CwGh16En.js → select-CHQkyynJ.js} +1 -1
- package/dist/client/assets/{shell-layout-DOy4fAYb.js → shell-layout-CZrDFZIJ.js} +2 -2
- package/dist/client/assets/{sidebar-settings-Ctg4uu33.js → sidebar-settings-C8pM5SP-.js} +1 -1
- package/dist/client/assets/{skeleton-DZ7Qc_fE.js → skeleton-Bla1LCSZ.js} +1 -1
- package/dist/client/assets/{spinner-CF1sqMoC.js → spinner-B_k6AtHn.js} +1 -1
- package/dist/client/assets/{store-invite-BbaXHihy.js → store-invite-CVXBjHsb.js} +1 -1
- package/dist/client/assets/{switch-BO1AHmQl.js → switch-BX7m8ylT.js} +1 -1
- package/dist/client/assets/{table-CZRzSdcB.js → table-BJ3W5Geb.js} +1 -1
- package/dist/client/assets/{tabs-DkvkxCCI.js → tabs-tcquyh90.js} +1 -1
- package/dist/client/assets/tasks-CJro_3w3.js +1 -0
- package/dist/client/assets/{tasks-panel-Bl5BMQl6.js → tasks-panel-CIityBOn.js} +1 -1
- package/dist/client/assets/{textarea-Cp-ThsnH.js → textarea-CceQB-N2.js} +1 -1
- package/dist/client/assets/{time-range-picker-CXsB0sBK.js → time-range-picker-B9lHM6xz.js} +1 -1
- package/dist/client/assets/{toggle-group-CIpiKQbG.js → toggle-group-KbsXFu3M.js} +1 -1
- package/dist/client/assets/{tools-list-BYhjzTws.js → tools-list-Cb9H3DsC.js} +1 -1
- package/dist/client/assets/{tooltip-B2vpv_WH.js → tooltip-DvMRS01W.js} +1 -1
- package/dist/client/assets/{topbar-portal-Dy36ZPgB.js → topbar-portal-CyxFPAeb.js} +1 -1
- package/dist/client/assets/{types-DeMEWRHV.js → types-9lUbCnT7.js} +1 -1
- package/dist/client/assets/{use-binding-CXeaDqWF.js → use-binding-CVLYzFG-.js} +1 -1
- package/dist/client/assets/{use-connection-Du5eRm0t.js → use-connection-DjiXkPUz.js} +1 -1
- package/dist/client/assets/{use-copy-5Xu6yo2D.js → use-copy-DiVO6tbG.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-EqzJGE7y.js → use-create-virtual-mcp-DnOGpm5h.js} +1 -1
- package/dist/client/assets/{use-install-from-registry-D98zOCZs.js → use-install-from-registry-kgqBLGhb.js} +1 -1
- package/dist/client/assets/{use-list-state-Dxk-n9cc.js → use-list-state-CCFlT7yz.js} +1 -1
- package/dist/client/assets/{use-llm-B4rO8f2r.js → use-llm-Bkjj502R.js} +1 -1
- package/dist/client/assets/{use-mcp-resources-Bf8HKw75.js → use-mcp-resources-DS8p1Owh.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-v3YYc4L1.js → use-mcp-tools-CHOGR3no.js} +1 -1
- package/dist/client/assets/{use-members-D4kqyRbv.js → use-members-94lmhn12.js} +1 -1
- package/dist/client/assets/{use-mobile-II1SQS1g.js → use-mobile-BArkW6j1.js} +1 -1
- package/dist/client/assets/{use-project-DEgKISl8.js → use-project-BRlk9_cU.js} +1 -1
- package/dist/client/assets/{use-settings-modal-BJVHprSk.js → use-settings-modal-QjZt77PI.js} +1 -1
- package/dist/client/assets/{use-view-mode-D38VMwz6.js → use-view-mode-3_G2qIMG.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-CS7dIIbK.js → use-virtual-mcp-Wj5StsuR.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-cPtxg-KP.js +1 -0
- package/dist/client/assets/{useMutation-B99hCaMl.js → useMutation-DtOoZO7h.js} +1 -1
- package/dist/client/assets/useQuery-Cj-miqA2.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-D62VIKAF.js +1 -0
- package/dist/client/assets/{user-BncBYJfn.js → user-BcEL6pjj.js} +1 -1
- package/dist/client/assets/{workflow-DS5DwWhu.js → workflow-Bdyylvch.js} +1 -1
- package/dist/client/index.html +1 -1
- package/package.json +1 -1
- package/dist/client/assets/collapsible-Bqyw5z5a.js +0 -23
- package/dist/client/assets/constants-DTNMmCfY.js +0 -1
- package/dist/client/assets/plugins-BA5p5lXm.js +0 -1
- package/dist/client/assets/purify.es-Bzr520pe.js +0 -2
- package/dist/client/assets/tasks-BSVHqtcQ.js +0 -1
- package/dist/client/assets/useInfiniteQuery-DvriYWG_.js +0 -1
- package/dist/client/assets/useQuery-C-DbMOQt.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-CX_HgzHm.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as d,v as n,j as c,at as l,au as m}from"./index-
|
|
1
|
+
import{c as d,v as n,j as c,at as l,au as m}from"./index-BkxNgQ-z.js";import{i as b}from"./Check-BuBqfL8V.js";function x(o){const e=d.c(9);let r,a;e[0]!==o?({className:r,...a}=o,e[0]=o,e[1]=r,e[2]=a):(r=e[1],a=e[2]);let i;e[3]!==r?(i=n("peer border-foreground dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-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 size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",r),e[3]=r,e[4]=i):i=e[4];let t;e[5]===Symbol.for("react.memo_cache_sentinel")?(t=c.jsx(m,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-primary-foreground transition-none",children:c.jsx(b,{className:"size-3.5"})}),e[5]=t):t=e[5];let s;return e[6]!==a||e[7]!==i?(s=c.jsx(l,{"data-slot":"checkbox",className:i,...a,children:t}),e[6]=a,e[7]=i,e[8]=s):s=e[8],s}export{x as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c}from"./index-
|
|
1
|
+
import{r as c}from"./index-BkxNgQ-z.js";const h=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),y=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,o)=>o?o.toUpperCase():r.toLowerCase()),i=t=>{const e=y(t);return e.charAt(0).toUpperCase()+e.slice(1)},l=(...t)=>t.filter((e,r,o)=>!!e&&e.trim()!==""&&o.indexOf(e)===r).join(" ").trim(),f=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var k={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const w=c.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:s="",children:a,iconNode:p,...n},d)=>c.createElement("svg",{ref:d,...k,width:e,height:e,stroke:t,strokeWidth:o?Number(r)*24/Number(e):r,className:l("lucide",s),...!a&&!f(n)&&{"aria-hidden":"true"},...n},[...p.map(([m,C])=>c.createElement(m,C)),...Array.isArray(a)?a:[a]]));const u=(t,e)=>{const r=c.forwardRef(({className:o,...s},a)=>c.createElement(w,{ref:a,iconNode:e,className:l(`lucide-${h(i(t))}`,`lucide-${t}`,o),...s}));return r.displayName=i(t),r};const g=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],b=u("check",g);const x=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],L=u("circle-alert",x);export{L as C,b as a,u as c};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import{r as I,c7 as oa,c8 as ia,a0 as la,bN as G,s as S,c9 as Qe,ca as fs,bR as ca,bS as ua,bM as da,bO as J,bI as Fe,aF as qe,o as D,bP as T,bQ as me,cb as pa,cc as $,aG as ma,bG as fa,c as Z,u as Se,K as _e,e as hs,n as tt,t as ke,v as Ue,j as u,E as _t,B as Ke,b as ha,O as ga,_ as va,d as ya,G as xa,H as Et,aH as ba,M as Sa,U as _a,T as Ea,I as Ia,bC as wa}from"./index-BkxNgQ-z.js";import{u as It,a as wt,d as Na}from"./constants--aQ9HnxF.js";import{b as Ca}from"./use-virtual-mcp-Wj5StsuR.js";import{A as Zt,D as lt}from"./decopilot-events-DZodCqX1.js";import{u as Nt,a as Ta}from"./use-llm-Bkjj502R.js";import{u as Aa}from"./useQuery-Cj-miqA2.js";import{u as Xe,L as Ct}from"./localstorage-keys-2beZrYfY.js";import{u as Ma}from"./tabs-tcquyh90.js";import{C as ja}from"./checkbox-Df-Mj-oX.js";import{I as ka}from"./input-BxWPl4Ur.js";import{f as Ra,c as Oa,a as Pa,D as Da}from"./dialog-CrYlSCa6.js";import{S as $a,a as La,b as Za,c as Fa,d as Ua}from"./select-CHQkyynJ.js";import{S as V}from"./skeleton-Bla1LCSZ.js";import{i as za}from"./AlignLeft-zf4ygcA_.js";import{i as Ba}from"./ArrowLeft-DKmEJ5pf.js";import{t as ft}from"./ChevronDown-D15Vpp0r.js";import{a as Va}from"./Image01-oZtE9Z5q.js";import{s as qa}from"./RefreshCcw01-DzE0Vt_s.js";import{i as gs}from"./SearchMd-BvHN4xgB.js";import{t as Tt}from"./Settings01-B5kunEo2.js";import{b as At,c as Wa,a as Ja,e as Ha}from"./use-connection-DjiXkPUz.js";import{u as Ga}from"./useSuspenseInfiniteQuery-D62VIKAF.js";const Ya=({size:t=24,color:e="currentColor",...s})=>I.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},I.createElement("path",{d:"M4 7h11m0 0-4 4m4-4-4-4M4 17h16m0 0-4 4m4-4-4-4"}));Ya.displayName="ArrowsRight";const vs=({size:t=24,color:e="currentColor",...s})=>I.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},I.createElement("path",{d:"m7 15 5 5 5-5M7 9l5-5 5 5"}));vs.displayName="ChevronSelectorVertical";const Qa=({size:t=24,color:e="currentColor",...s})=>I.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},I.createElement("path",{d:"M10 17.659V20a2 2 0 1 0 4 0v-2.341M12 2v1m-9 9H2m3.5-6.5-.6-.6m13.6.6.6-.6M22 12h-1m-3 0a6 6 0 1 1-12 0 6 6 0 0 1 12 0Z"}));Qa.displayName="Lightbulb02";const ys=({size:t=24,color:e="currentColor",...s})=>I.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},I.createElement("path",{d:"m6.5 13 .784 1.569c.266.53.399.796.576 1.026a3 3 0 0 0 .545.545c.23.177.495.31 1.026.575L11 17.5l-1.569.785c-.53.265-.796.398-1.026.575a3 3 0 0 0-.545.545c-.177.23-.31.495-.576 1.026L6.5 22l-.784-1.569c-.266-.53-.399-.796-.576-1.026a3 3 0 0 0-.545-.545c-.23-.177-.495-.31-1.026-.575L2 17.5l1.569-.785c.53-.265.796-.398 1.026-.575a3 3 0 0 0 .545-.545c.177-.23.31-.495.576-1.026L6.5 13ZM15 2l1.179 3.064c.282.734.423 1.1.642 1.409a3 3 0 0 0 .706.706c.309.22.675.36 1.409.642L22 9l-3.064 1.179c-.734.282-1.1.423-1.409.642a3 3 0 0 0-.706.706c-.22.309-.36.675-.642 1.409L15 16l-1.179-3.064c-.282-.734-.423-1.1-.642-1.409a3 3 0 0 0-.706-.706c-.309-.22-.675-.36-1.409-.642L8 9l3.064-1.179c.734-.282 1.1-.423 1.409-.642a3 3 0 0 0 .706-.706c.22-.309.36-.675.642-1.409L15 2Z"}));ys.displayName="Stars01";const xs=({size:t=24,color:e="currentColor",...s})=>I.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},I.createElement("path",{d:"M15.631 7.631c-.396-.396-.594-.594-.668-.822a1 1 0 0 1 0-.618c.074-.228.272-.426.668-.822L18.47 2.53a6 6 0 0 0-8.3 6.895c.12.49.179.734.168.888a.849.849 0 0 1-.11.392c-.07.138-.207.274-.48.547L3.5 17.5a2.121 2.121 0 0 0 3 3l6.248-6.248c.273-.273.41-.41.547-.48a.849.849 0 0 1 .392-.11c.154-.011.399.049.888.168a6 6 0 0 0 6.895-8.3l-2.84 2.84c-.396.396-.594.594-.822.668a1 1 0 0 1-.618 0c-.228-.074-.426-.272-.822-.668l-.738-.738Z"}));xs.displayName="Tool01";var ze;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function s(r){throw new Error}t.assertNever=s,t.arrayToEnum=r=>{const n={};for(const i of r)n[i]=i;return n},t.getValidEnumValues=r=>{const n=t.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),i={};for(const o of n)i[o]=r[o];return t.objectValues(i)},t.objectValues=r=>t.objectKeys(r).map(function(n){return r[n]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const n=[];for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&n.push(i);return n},t.find=(r,n)=>{for(const i of r)if(n(i))return i},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function a(r,n=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(n)}t.joinValues=a,t.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(ze||(ze={}));var Ft;(function(t){t.mergeShapes=(e,s)=>({...e,...s})})(Ft||(Ft={}));ze.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);ze.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 et extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};const s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=e}format(e){const s=e||function(n){return n.message},a={_errors:[]},r=n=>{for(const i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)a._errors.push(s(i));else{let o=a,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(s(i))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return r(this),a}static assert(e){if(!(e instanceof et))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ze.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=s=>s.message){const s=Object.create(null),a=[];for(const r of this.issues)if(r.path.length>0){const n=r.path[0];s[n]=s[n]||[],s[n].push(e(r))}else a.push(e(r));return{formErrors:a,fieldErrors:s}}get formErrors(){return this.flatten()}}et.create=t=>new et(t);var Ut;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Ut||(Ut={}));var M;(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"})(M||(M={}));var bs="vercel.ai.error",Ka=Symbol.for(bs),zt,Bt,re=class Ss extends(Bt=Error,zt=Ka,Bt){constructor({name:e,message:s,cause:a}){super(s),this[zt]=!0,this.name=e,this.cause=a}static isInstance(e){return Ss.hasMarker(e,bs)}static hasMarker(e,s){const a=Symbol.for(s);return e!=null&&typeof e=="object"&&a in e&&typeof e[a]=="boolean"&&e[a]===!0}};function _s(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var Es="AI_InvalidArgumentError",Is=`vercel.ai.error.${Es}`,Xa=Symbol.for(Is),Vt,qt,er=class extends(qt=re,Vt=Xa,qt){constructor({message:t,cause:e,argument:s}){super({name:Es,message:t,cause:e}),this[Vt]=!0,this.argument=s}static isInstance(t){return re.hasMarker(t,Is)}},ws="AI_JSONParseError",Ns=`vercel.ai.error.${ws}`,tr=Symbol.for(Ns),Wt,Jt,Ht=class extends(Jt=re,Wt=tr,Jt){constructor({text:t,cause:e}){super({name:ws,message:`JSON parsing failed: Text: ${t}.
|
|
2
|
+
Error message: ${_s(e)}`,cause:e}),this[Wt]=!0,this.text=t}static isInstance(t){return re.hasMarker(t,Ns)}},Cs="AI_TypeValidationError",Ts=`vercel.ai.error.${Cs}`,sr=Symbol.for(Ts),Gt,Yt,Re=class ht extends(Yt=re,Gt=sr,Yt){constructor({value:e,cause:s,context:a}){let r="Type validation failed";if(a?.field&&(r+=` for ${a.field}`),a?.entityName||a?.entityId){r+=" (";const n=[];a.entityName&&n.push(a.entityName),a.entityId&&n.push(`id: "${a.entityId}"`),r+=n.join(", "),r+=")"}super({name:Cs,message:`${r}: Value: ${JSON.stringify(e)}.
|
|
3
|
+
Error message: ${_s(s)}`,cause:s}),this[Gt]=!0,this.value=e,this.context=a}static isInstance(e){return re.hasMarker(e,Ts)}static wrap({value:e,cause:s,context:a}){var r,n,i;return ht.isInstance(s)&&s.value===e&&((r=s.context)==null?void 0:r.field)===a?.field&&((n=s.context)==null?void 0:n.entityName)===a?.entityName&&((i=s.context)==null?void 0:i.entityId)===a?.entityId?s:new ht({value:e,cause:s,context:a})}},We=({prefix:t,size:e=16,alphabet:s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:a="-"}={})=>{const r=()=>{const n=s.length,i=new Array(e);for(let o=0;o<e;o++)i[o]=s[Math.random()*n|0];return i.join("")};if(t==null)return r;if(s.includes(a))throw new er({argument:"separator",message:`The separator "${a}" must not be part of the alphabet "${s}".`});return()=>`${t}${a}${r()}`},ar=We();function Qt(t=globalThis){var e,s,a;return t.window?"runtime/browser":(e=t.navigator)!=null&&e.userAgent?`runtime/${t.navigator.userAgent.toLowerCase()}`:(a=(s=t.process)==null?void 0:s.versions)!=null&&a.node?`runtime/node.js/${t.process.version.substring(0)}`:t.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function xe(t){if(t==null)return{};const e={};if(t instanceof Headers)t.forEach((s,a)=>{e[a.toLowerCase()]=s});else{Array.isArray(t)||(t=Object.entries(t));for(const[s,a]of t)a!=null&&(e[s.toLowerCase()]=a)}return e}function Kt(t,...e){const s=new Headers(xe(t)),a=s.get("user-agent")||"";return s.set("user-agent",[a,...e].filter(Boolean).join(" ")),Object.fromEntries(s.entries())}var rr=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,nr=/"(?: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 Xt(t){const e=JSON.parse(t);return e===null||typeof e!="object"||rr.test(t)===!1&&nr.test(t)===!1?e:or(e)}function or(t){let e=[t];for(;e.length;){const s=e;e=[];for(const a of s){if(Object.prototype.hasOwnProperty.call(a,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(a,"constructor")&&a.constructor!==null&&typeof a.constructor=="object"&&Object.prototype.hasOwnProperty.call(a.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const r in a){const n=a[r];n&&typeof n=="object"&&e.push(n)}}}return t}function ir(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return Xt(t)}try{return Xt(t)}finally{Error.stackTraceLimit=e}}function Mt(t){if(t.type==="object"||Array.isArray(t.type)&&t.type.includes("object")){t.additionalProperties=!1;const{properties:s}=t;if(s!=null)for(const a of Object.keys(s))s[a]=ye(s[a])}t.items!=null&&(t.items=Array.isArray(t.items)?t.items.map(ye):ye(t.items)),t.anyOf!=null&&(t.anyOf=t.anyOf.map(ye)),t.allOf!=null&&(t.allOf=t.allOf.map(ye)),t.oneOf!=null&&(t.oneOf=t.oneOf.map(ye));const{definitions:e}=t;if(e!=null)for(const s of Object.keys(e))e[s]=ye(e[s]);return t}function ye(t){return typeof t=="boolean"?t:Mt(t)}var lr=Symbol("Let zodToJsonSchema decide on which parser to use"),es={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"},cr=t=>typeof t=="string"?{...es,name:t}:{...es,...t};function Y(){return{}}function ur(t,e){var s,a,r;const n={type:"array"};return(s=t.type)!=null&&s._def&&((r=(a=t.type)==null?void 0:a._def)==null?void 0:r.typeName)!==M.ZodAny&&(n.items=P(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 dr(t){const e={type:"integer",format:"int64"};if(!t.checks)return e;for(const s of t.checks)switch(s.kind){case"min":s.inclusive?e.minimum=s.value:e.exclusiveMinimum=s.value;break;case"max":s.inclusive?e.maximum=s.value:e.exclusiveMaximum=s.value;break;case"multipleOf":e.multipleOf=s.value;break}return e}function pr(){return{type:"boolean"}}function As(t,e){return P(t.type._def,e)}var mr=(t,e)=>P(t.innerType._def,e);function Ms(t,e,s){const a=s??e.dateStrategy;if(Array.isArray(a))return{anyOf:a.map((r,n)=>Ms(t,e,r))};switch(a){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return fr(t)}}var fr=t=>{const e={type:"integer",format:"unix-time"};for(const s of t.checks)switch(s.kind){case"min":e.minimum=s.value;break;case"max":e.maximum=s.value;break}return e};function hr(t,e){return{...P(t.innerType._def,e),default:t.defaultValue()}}function gr(t,e){return e.effectStrategy==="input"?P(t.schema._def,e):Y()}function vr(t){return{type:"string",enum:Array.from(t.values)}}var yr=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function xr(t,e){const s=[P(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),P(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(r=>!!r),a=[];return s.forEach(r=>{if(yr(r))a.push(...r.allOf);else{let n=r;if("additionalProperties"in r&&r.additionalProperties===!1){const{additionalProperties:i,...o}=r;n=o}a.push(n)}}),a.length?{allOf:a}:void 0}function br(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 ct=void 0,X={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:()=>(ct===void 0&&(ct=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),ct),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 js(t,e){const s={type:"string"};if(t.checks)for(const a of t.checks)switch(a.kind){case"min":s.minLength=typeof s.minLength=="number"?Math.max(s.minLength,a.value):a.value;break;case"max":s.maxLength=typeof s.maxLength=="number"?Math.min(s.maxLength,a.value):a.value;break;case"email":switch(e.emailStrategy){case"format:email":ee(s,"email",a.message,e);break;case"format:idn-email":ee(s,"idn-email",a.message,e);break;case"pattern:zod":W(s,X.email,a.message,e);break}break;case"url":ee(s,"uri",a.message,e);break;case"uuid":ee(s,"uuid",a.message,e);break;case"regex":W(s,a.regex,a.message,e);break;case"cuid":W(s,X.cuid,a.message,e);break;case"cuid2":W(s,X.cuid2,a.message,e);break;case"startsWith":W(s,RegExp(`^${ut(a.value,e)}`),a.message,e);break;case"endsWith":W(s,RegExp(`${ut(a.value,e)}$`),a.message,e);break;case"datetime":ee(s,"date-time",a.message,e);break;case"date":ee(s,"date",a.message,e);break;case"time":ee(s,"time",a.message,e);break;case"duration":ee(s,"duration",a.message,e);break;case"length":s.minLength=typeof s.minLength=="number"?Math.max(s.minLength,a.value):a.value,s.maxLength=typeof s.maxLength=="number"?Math.min(s.maxLength,a.value):a.value;break;case"includes":{W(s,RegExp(ut(a.value,e)),a.message,e);break}case"ip":{a.version!=="v6"&&ee(s,"ipv4",a.message,e),a.version!=="v4"&&ee(s,"ipv6",a.message,e);break}case"base64url":W(s,X.base64url,a.message,e);break;case"jwt":W(s,X.jwt,a.message,e);break;case"cidr":{a.version!=="v6"&&W(s,X.ipv4Cidr,a.message,e),a.version!=="v4"&&W(s,X.ipv6Cidr,a.message,e);break}case"emoji":W(s,X.emoji(),a.message,e);break;case"ulid":{W(s,X.ulid,a.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{ee(s,"binary",a.message,e);break}case"contentEncoding:base64":{s.contentEncoding="base64";break}case"pattern:zod":{W(s,X.base64,a.message,e);break}}break}case"nanoid":W(s,X.nanoid,a.message,e)}return s}function ut(t,e){return e.patternStrategy==="escape"?_r(t):t}var Sr=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function _r(t){let e="";for(let s=0;s<t.length;s++)Sr.has(t[s])||(e+="\\"),e+=t[s];return e}function ee(t,e,s,a){var r;t.format||(r=t.anyOf)!=null&&r.some(n=>n.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format}),delete t.format),t.anyOf.push({format:e,...s&&a.errorMessages&&{errorMessage:{format:s}}})):t.format=e}function W(t,e,s,a){var r;t.pattern||(r=t.allOf)!=null&&r.some(n=>n.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern}),delete t.pattern),t.allOf.push({pattern:ts(e,a),...s&&a.errorMessages&&{errorMessage:{pattern:s}}})):t.pattern=ts(e,a)}function ts(t,e){var s;if(!e.applyRegexFlags||!t.flags)return t.source;const a={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},r=a.i?t.source.toLowerCase():t.source;let n="",i=!1,o=!1,c=!1;for(let l=0;l<r.length;l++){if(i){n+=r[l],i=!1;continue}if(a.i){if(o){if(r[l].match(/[a-z]/)){c?(n+=r[l],n+=`${r[l-2]}-${r[l]}`.toUpperCase(),c=!1):r[l+1]==="-"&&((s=r[l+2])!=null&&s.match(/[a-z]/))?(n+=r[l],c=!0):n+=`${r[l]}${r[l].toUpperCase()}`;continue}}else if(r[l].match(/[a-z]/)){n+=`[${r[l]}${r[l].toUpperCase()}]`;continue}}if(a.m){if(r[l]==="^"){n+=`(^|(?<=[\r
|
|
4
|
+
]))`;continue}else if(r[l]==="$"){n+=`($|(?=[\r
|
|
5
|
+
]))`;continue}}if(a.s&&r[l]==="."){n+=o?`${r[l]}\r
|
|
6
|
+
`:`[${r[l]}\r
|
|
7
|
+
]`;continue}n+=r[l],r[l]==="\\"?i=!0:o&&r[l]==="]"?o=!1:!o&&r[l]==="["&&(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 ks(t,e){var s,a,r,n,i,o;const c={type:"object",additionalProperties:(s=P(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?s:e.allowedAdditionalProperties};if(((a=t.keyType)==null?void 0:a._def.typeName)===M.ZodString&&((r=t.keyType._def.checks)!=null&&r.length)){const{type:l,...d}=js(t.keyType._def,e);return{...c,propertyNames:d}}else{if(((n=t.keyType)==null?void 0:n._def.typeName)===M.ZodEnum)return{...c,propertyNames:{enum:t.keyType._def.values}};if(((i=t.keyType)==null?void 0:i._def.typeName)===M.ZodBranded&&t.keyType._def.type._def.typeName===M.ZodString&&((o=t.keyType._def.type._def.checks)!=null&&o.length)){const{type:l,...d}=As(t.keyType._def,e);return{...c,propertyNames:d}}}return c}function Er(t,e){if(e.mapStrategy==="record")return ks(t,e);const s=P(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Y(),a=P(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||Y();return{type:"array",maxItems:125,items:{type:"array",items:[s,a],minItems:2,maxItems:2}}}function Ir(t){const e=t.values,a=Object.keys(t.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),r=Array.from(new Set(a.map(n=>typeof n)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:a}}function wr(){return{not:Y()}}function Nr(){return{type:"null"}}var gt={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Cr(t,e){const s=t.options instanceof Map?Array.from(t.options.values()):t.options;if(s.every(a=>a._def.typeName in gt&&(!a._def.checks||!a._def.checks.length))){const a=s.reduce((r,n)=>{const i=gt[n._def.typeName];return i&&!r.includes(i)?[...r,i]:r},[]);return{type:a.length>1?a:a[0]}}else if(s.every(a=>a._def.typeName==="ZodLiteral"&&!a.description)){const a=s.reduce((r,n)=>{const i=typeof n._def.value;switch(i){case"string":case"number":case"boolean":return[...r,i];case"bigint":return[...r,"integer"];case"object":if(n._def.value===null)return[...r,"null"];default:return r}},[]);if(a.length===s.length){const r=a.filter((n,i,o)=>o.indexOf(n)===i);return{type:r.length>1?r:r[0],enum:s.reduce((n,i)=>n.includes(i._def.value)?n:[...n,i._def.value],[])}}}else if(s.every(a=>a._def.typeName==="ZodEnum"))return{type:"string",enum:s.reduce((a,r)=>[...a,...r._def.values.filter(n=>!a.includes(n))],[])};return Tr(t,e)}var Tr=(t,e)=>{const s=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((a,r)=>P(a._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(a=>!!a&&(!e.strictUnions||typeof a=="object"&&Object.keys(a).length>0));return s.length?{anyOf:s}:void 0};function Ar(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[gt[t.innerType._def.typeName],"null"]};const s=P(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return s&&{anyOf:[s,{type:"null"}]}}function Mr(t){const e={type:"number"};if(!t.checks)return e;for(const s of t.checks)switch(s.kind){case"int":e.type="integer";break;case"min":s.inclusive?e.minimum=s.value:e.exclusiveMinimum=s.value;break;case"max":s.inclusive?e.maximum=s.value:e.exclusiveMaximum=s.value;break;case"multipleOf":e.multipleOf=s.value;break}return e}function jr(t,e){const s={type:"object",properties:{}},a=[],r=t.shape();for(const i in r){let o=r[i];if(o===void 0||o._def===void 0)continue;const c=Rr(o),l=P(o._def,{...e,currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]});l!==void 0&&(s.properties[i]=l,c||a.push(i))}a.length&&(s.required=a);const n=kr(t,e);return n!==void 0&&(s.additionalProperties=n),s}function kr(t,e){if(t.catchall._def.typeName!=="ZodNever")return P(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 Rr(t){try{return t.isOptional()}catch{return!0}}var Or=(t,e)=>{var s;if(e.currentPath.toString()===((s=e.propertyPath)==null?void 0:s.toString()))return P(t.innerType._def,e);const a=P(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return a?{anyOf:[{not:Y()},a]}:Y()},Pr=(t,e)=>{if(e.pipeStrategy==="input")return P(t.in._def,e);if(e.pipeStrategy==="output")return P(t.out._def,e);const s=P(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),a=P(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",s?"1":"0"]});return{allOf:[s,a].filter(r=>r!==void 0)}};function Dr(t,e){return P(t.type._def,e)}function $r(t,e){const a={type:"array",uniqueItems:!0,items:P(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(a.minItems=t.minSize.value),t.maxSize&&(a.maxItems=t.maxSize.value),a}function Lr(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((s,a)=>P(s._def,{...e,currentPath:[...e.currentPath,"items",`${a}`]})).reduce((s,a)=>a===void 0?s:[...s,a],[]),additionalItems:P(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((s,a)=>P(s._def,{...e,currentPath:[...e.currentPath,"items",`${a}`]})).reduce((s,a)=>a===void 0?s:[...s,a],[])}}function Zr(){return{not:Y()}}function Fr(){return Y()}var Ur=(t,e)=>P(t.innerType._def,e),zr=(t,e,s)=>{switch(e){case M.ZodString:return js(t,s);case M.ZodNumber:return Mr(t);case M.ZodObject:return jr(t,s);case M.ZodBigInt:return dr(t);case M.ZodBoolean:return pr();case M.ZodDate:return Ms(t,s);case M.ZodUndefined:return Zr();case M.ZodNull:return Nr();case M.ZodArray:return ur(t,s);case M.ZodUnion:case M.ZodDiscriminatedUnion:return Cr(t,s);case M.ZodIntersection:return xr(t,s);case M.ZodTuple:return Lr(t,s);case M.ZodRecord:return ks(t,s);case M.ZodLiteral:return br(t);case M.ZodEnum:return vr(t);case M.ZodNativeEnum:return Ir(t);case M.ZodNullable:return Ar(t,s);case M.ZodOptional:return Or(t,s);case M.ZodMap:return Er(t,s);case M.ZodSet:return $r(t,s);case M.ZodLazy:return()=>t.getter()._def;case M.ZodPromise:return Dr(t,s);case M.ZodNaN:case M.ZodNever:return wr();case M.ZodEffects:return gr(t,s);case M.ZodAny:return Y();case M.ZodUnknown:return Fr();case M.ZodDefault:return hr(t,s);case M.ZodBranded:return As(t,s);case M.ZodReadonly:return Ur(t,s);case M.ZodCatch:return mr(t,s);case M.ZodPipeline:return Pr(t,s);case M.ZodFunction:case M.ZodVoid:case M.ZodSymbol:return;default:return(a=>{})()}},Br=(t,e)=>{let s=0;for(;s<t.length&&s<e.length&&t[s]===e[s];s++);return[(t.length-s).toString(),...e.slice(s)].join("/")};function P(t,e,s=!1){var a;const r=e.seen.get(t);if(e.override){const c=(a=e.override)==null?void 0:a.call(e,t,e,r,s);if(c!==lr)return c}if(r&&!s){const c=Vr(r,e);if(c!==void 0)return c}const n={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,n);const i=zr(t,t.typeName,e),o=typeof i=="function"?P(i(),e):i;if(o&&qr(t,e,o),e.postProcess){const c=e.postProcess(o,t,e);return n.jsonSchema=o,c}return n.jsonSchema=o,o}var Vr=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Br(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((s,a)=>e.currentPath[a]===s)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),Y()):e.$refStrategy==="seen"?Y():void 0}},qr=(t,e,s)=>(t.description&&(s.description=t.description),s),Wr=t=>{const e=cr(t),s=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:s,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([a,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,a],jsonSchema:void 0}]))}},Jr=(t,e)=>{var s;const a=Wr(e);let r=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[d,m])=>{var h;return{...l,[d]:(h=P(m._def,{...a,currentPath:[...a.basePath,a.definitionPath,d]},!0))!=null?h:Y()}},{}):void 0;const n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=(s=P(t._def,n===void 0?a:{...a,currentPath:[...a.basePath,a.definitionPath,n]},!1))!=null?s:Y(),o=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;o!==void 0&&(i.title=o);const c=n===void 0?r?{...i,[a.definitionPath]:r}:i:{$ref:[...a.$refStrategy==="relative"?[]:a.basePath,a.definitionPath,n].join("/"),[a.definitionPath]:{...r,[n]:i}};return c.$schema="http://json-schema.org/draft-07/schema#",c},vt=Symbol.for("vercel.ai.schema");function Hr(t){let e;return()=>(e==null&&(e=t()),e)}function st(t,{validate:e}={}){return{[vt]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function Gr(t){return typeof t=="object"&&t!==null&&vt in t&&t[vt]===!0&&"jsonSchema"in t&&"validate"in t}function jt(t){return t==null?st({properties:{},additionalProperties:!1}):Gr(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?Rs(t):Yr(t):t()}function Yr(t){return st(()=>Mt(t["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async e=>{const s=await t["~standard"].validate(e);return"value"in s?{success:!0,value:s.value}:{success:!1,error:new Re({value:e,cause:s.issues})}}})}function Qr(t,e){var s;const a=(s=void 0)!=null?s:!1;return st(()=>Jr(t,{$refStrategy:a?"root":"none"}),{validate:async r=>{const n=await t.safeParseAsync(r);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function Kr(t,e){var s;const a=(s=void 0)!=null?s:!1;return st(()=>Mt(la(t,{target:"draft-7",io:"input",reused:a?"ref":"inline"})),{validate:async r=>{const n=await ia(t,r);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function Xr(t){return"_zod"in t}function Rs(t,e){return Xr(t)?Kr(t):Qr(t)}async function ss({value:t,schema:e,context:s}){const a=await Be({value:t,schema:e,context:s});if(!a.success)throw Re.wrap({value:t,cause:a.error,context:s});return a.value}async function Be({value:t,schema:e,context:s}){const a=jt(e);try{if(a.validate==null)return{success:!0,value:t,rawValue:t};const r=await a.validate(t);return r.success?{success:!0,value:r.value,rawValue:t}:{success:!1,error:Re.wrap({value:t,cause:r.error,context:s}),rawValue:t}}catch(r){return{success:!1,error:Re.wrap({value:t,cause:r,context:s}),rawValue:t}}}async function be({text:t,schema:e}){try{const s=ir(t);return e==null?{success:!0,value:s,rawValue:s}:await Be({value:s,schema:e})}catch(s){return{success:!1,error:Ht.isInstance(s)?s:new Ht({text:t,cause:s}),rawValue:void 0}}}function en({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new oa).pipeThrough(new TransformStream({async transform({data:s},a){s!=="[DONE]"&&a.enqueue(await be({text:s,schema:e}))}}))}async function he(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var tn=Object.defineProperty,sn=(t,e)=>{for(var s in e)tn(t,s,{get:e[s],enumerable:!0})},Os="AI_NoObjectGeneratedError",Ps=`vercel.ai.error.${Os}`,an=Symbol.for(Ps),Ds,ge=class extends re{constructor({message:t="No object generated.",cause:e,text:s,response:a,usage:r,finishReason:n}){super({name:Os,message:t,cause:e}),this[Ds]=!0,this.text=s,this.response=a,this.usage=r,this.finishReason=n}static isInstance(t){return re.hasMarker(t,Ps)}};Ds=an;var $s="AI_UIMessageStreamError",Ls=`vercel.ai.error.${$s}`,rn=Symbol.for(Ls),Zs,Ae=class extends re{constructor({chunkType:t,chunkId:e,message:s}){super({name:$s,message:s}),this[Zs]=!0,this.chunkType=t,this.chunkId=e}static isInstance(t){return re.hasMarker(t,Ls)}};Zs=rn;var as="6.0.116",Fs=G([S(),Qe(Uint8Array),Qe(ArrayBuffer),fs(t=>{var e,s;return(s=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?s:!1},{message:"Must be a Buffer"})]),Ve=ca(()=>G([ua(),S(),da(),J(),Fe(S(),Ve.optional()),qe(Ve)])),j=Fe(S(),Fe(S(),Ve.optional())),Us=D({type:T("text"),text:S(),providerOptions:j.optional()}),nn=D({type:T("image"),image:G([Fs,Qe(URL)]),mediaType:S().optional(),providerOptions:j.optional()}),zs=D({type:T("file"),data:G([Fs,Qe(URL)]),filename:S().optional(),mediaType:S(),providerOptions:j.optional()}),on=D({type:T("reasoning"),text:S(),providerOptions:j.optional()}),ln=D({type:T("tool-call"),toolCallId:S(),toolName:S(),input:me(),providerOptions:j.optional(),providerExecuted:J().optional()}),cn=pa("type",[D({type:T("text"),value:S(),providerOptions:j.optional()}),D({type:T("json"),value:Ve,providerOptions:j.optional()}),D({type:T("execution-denied"),reason:S().optional(),providerOptions:j.optional()}),D({type:T("error-text"),value:S(),providerOptions:j.optional()}),D({type:T("error-json"),value:Ve,providerOptions:j.optional()}),D({type:T("content"),value:qe(G([D({type:T("text"),text:S(),providerOptions:j.optional()}),D({type:T("media"),data:S(),mediaType:S()}),D({type:T("file-data"),data:S(),mediaType:S(),filename:S().optional(),providerOptions:j.optional()}),D({type:T("file-url"),url:S(),providerOptions:j.optional()}),D({type:T("file-id"),fileId:G([S(),Fe(S(),S())]),providerOptions:j.optional()}),D({type:T("image-data"),data:S(),mediaType:S(),providerOptions:j.optional()}),D({type:T("image-url"),url:S(),providerOptions:j.optional()}),D({type:T("image-file-id"),fileId:G([S(),Fe(S(),S())]),providerOptions:j.optional()}),D({type:T("custom"),providerOptions:j.optional()})]))})]),Bs=D({type:T("tool-result"),toolCallId:S(),toolName:S(),output:cn,providerOptions:j.optional()}),un=D({type:T("tool-approval-request"),approvalId:S(),toolCallId:S()}),dn=D({type:T("tool-approval-response"),approvalId:S(),approved:J(),reason:S().optional()}),pn=D({role:T("system"),content:S(),providerOptions:j.optional()}),mn=D({role:T("user"),content:G([S(),qe(G([Us,nn,zs]))]),providerOptions:j.optional()}),fn=D({role:T("assistant"),content:G([S(),qe(G([Us,zs,on,ln,Bs,un]))]),providerOptions:j.optional()}),hn=D({role:T("tool"),content:qe(G([Bs,dn])),providerOptions:j.optional()});G([pn,mn,fn,hn]);function Vs(t,e){if(t===void 0&&e===void 0)return;if(t===void 0)return e;if(e===void 0)return t;const s={...t};for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)){const r=e[a];if(r===void 0)continue;const n=a in t?t[a]:void 0,i=r!==null&&typeof r=="object"&&!Array.isArray(r)&&!(r instanceof Date)&&!(r instanceof RegExp),o=n!=null&&typeof n=="object"&&!Array.isArray(n)&&!(n instanceof Date)&&!(n instanceof RegExp);i&&o?s[a]=Vs(n,r):s[a]=r}return s}var gn={};sn(gn,{array:()=>bn,choice:()=>Sn,json:()=>_n,object:()=>xn,text:()=>yn});function vn(t){const e=["ROOT"];let s=-1,a=null;function r(c,l,d){switch(c){case'"':{s=l,e.pop(),e.push(d),e.push("INSIDE_STRING");break}case"f":case"t":case"n":{s=l,a=l,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":{s=l,e.pop(),e.push(d),e.push("INSIDE_NUMBER");break}case"{":{s=l,e.pop(),e.push(d),e.push("INSIDE_OBJECT_START");break}case"[":{s=l,e.pop(),e.push(d),e.push("INSIDE_ARRAY_START");break}}}function n(c,l){switch(c){case",":{e.pop(),e.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{s=l,e.pop();break}}}function i(c,l){switch(c){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{s=l,e.pop();break}}}for(let c=0;c<t.length;c++){const l=t[c];switch(e[e.length-1]){case"ROOT":r(l,c,"FINISH");break;case"INSIDE_OBJECT_START":{switch(l){case'"':{e.pop(),e.push("INSIDE_OBJECT_KEY");break}case"}":{s=c,e.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{l==='"'&&(e.pop(),e.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{l==='"'&&(e.pop(),e.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{l===":"&&(e.pop(),e.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{r(l,c,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{n(l,c);break}case"INSIDE_STRING":{switch(l){case'"':{e.pop(),s=c;break}case"\\":{e.push("INSIDE_STRING_ESCAPE");break}default:s=c}break}case"INSIDE_ARRAY_START":{l==="]"?(s=c,e.pop()):(s=c,r(l,c,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(l){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{s=c,e.pop();break}default:{s=c;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{r(l,c,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{e.pop(),s=c;break}case"INSIDE_NUMBER":{switch(l){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{s=c;break}case"e":case"E":case"-":case".":break;case",":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(l,c),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&n(l,c);break}case"}":{e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&n(l,c);break}case"]":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(l,c);break}default:{e.pop();break}}break}case"INSIDE_LITERAL":{const m=t.substring(a,c+1);!"false".startsWith(m)&&!"true".startsWith(m)&&!"null".startsWith(m)?(e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?n(l,c):e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(l,c)):s=c;break}}}let o=t.slice(0,s+1);for(let c=e.length-1;c>=0;c--)switch(e[c]){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(a,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 be({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await be({text:vn(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var yn=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}},createElementStreamTransform(){}}),xn=({schema:t,name:e,description:s})=>{const a=jt(t);return{name:"object",responseFormat:he(a.jsonSchema).then(r=>({type:"json",schema:r,...e!=null&&{name:e},...s!=null&&{description:s}})),async parseCompleteOutput({text:r},n){const i=await be({text:r});if(!i.success)throw new ge({message:"No object generated: could not parse the response.",cause:i.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});const o=await Be({value:i.value,schema:a});if(!o.success)throw new ge({message:"No object generated: response did not match schema.",cause:o.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});return o.value},async parsePartialOutput({text:r}){const n=await Je(r);switch(n.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:n.value}}},createElementStreamTransform(){}}},bn=({element:t,name:e,description:s})=>{const a=jt(t);return{name:"array",responseFormat:he(a.jsonSchema).then(r=>{const{$schema:n,...i}=r;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},...s!=null&&{description:s}}}),async parseCompleteOutput({text:r},n){const i=await be({text:r});if(!i.success)throw new ge({message:"No object generated: could not parse the response.",cause:i.error,text:r,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 ge({message:"No object generated: response did not match schema.",cause:new Re({value:o,cause:"response must be an object with an elements array"}),text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});for(const c of o.elements){const l=await Be({value:c,schema:a});if(!l.success)throw new ge({message:"No object generated: response did not match schema.",cause:l.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason})}return o.elements},async parsePartialOutput({text:r}){const n=await Je(r);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,c=[];for(const l of o){const d=await Be({value:l,schema:a});d.success&&c.push(d.value)}return{partial:c}}}},createElementStreamTransform(){let r=0;return new TransformStream({transform({partialOutput:n},i){if(n!=null)for(;r<n.length;r++)i.enqueue(n[r])}})}}},Sn=({options:t,name:e,description:s})=>({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},...s!=null&&{description:s}}),async parseCompleteOutput({text:a},r){const n=await be({text:a});if(!n.success)throw new ge({message:"No object generated: could not parse the response.",cause:n.error,text:a,response:r.response,usage:r.usage,finishReason:r.finishReason});const i=n.value;if(i==null||typeof i!="object"||!("result"in i)||typeof i.result!="string"||!t.includes(i.result))throw new ge({message:"No object generated: response did not match schema.",cause:new Re({value:i,cause:"response must be an object that contains a choice value."}),text:a,response:r.response,usage:r.usage,finishReason:r.finishReason});return i.result},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":{const n=r.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 r.state==="successful-parse"?i.includes(n.result)?{partial:n.result}:void 0:i.length===1?{partial:i[0]}:void 0}}},createElementStreamTransform(){}}),_n=({name:t,description:e}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...t!=null&&{name:t},...e!=null&&{description:e}}),async parseCompleteOutput({text:s},a){const r=await be({text:s});if(!r.success)throw new ge({message:"No object generated: could not parse the response.",cause:r.error,text:s,response:a.response,usage:a.usage,finishReason:a.finishReason});return r.value},async parsePartialOutput({text:s}){const a=await Je(s);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return a.value===void 0?void 0:{partial:a.value}}},createElementStreamTransform(){}});We({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 En=Hr(()=>Rs(G([$({type:T("text-start"),id:S(),providerMetadata:j.optional()}),$({type:T("text-delta"),id:S(),delta:S(),providerMetadata:j.optional()}),$({type:T("text-end"),id:S(),providerMetadata:j.optional()}),$({type:T("error"),errorText:S()}),$({type:T("tool-input-start"),toolCallId:S(),toolName:S(),providerExecuted:J().optional(),providerMetadata:j.optional(),dynamic:J().optional(),title:S().optional()}),$({type:T("tool-input-delta"),toolCallId:S(),inputTextDelta:S()}),$({type:T("tool-input-available"),toolCallId:S(),toolName:S(),input:me(),providerExecuted:J().optional(),providerMetadata:j.optional(),dynamic:J().optional(),title:S().optional()}),$({type:T("tool-input-error"),toolCallId:S(),toolName:S(),input:me(),providerExecuted:J().optional(),providerMetadata:j.optional(),dynamic:J().optional(),errorText:S(),title:S().optional()}),$({type:T("tool-approval-request"),approvalId:S(),toolCallId:S()}),$({type:T("tool-output-available"),toolCallId:S(),output:me(),providerExecuted:J().optional(),dynamic:J().optional(),preliminary:J().optional()}),$({type:T("tool-output-error"),toolCallId:S(),errorText:S(),providerExecuted:J().optional(),dynamic:J().optional()}),$({type:T("tool-output-denied"),toolCallId:S()}),$({type:T("reasoning-start"),id:S(),providerMetadata:j.optional()}),$({type:T("reasoning-delta"),id:S(),delta:S(),providerMetadata:j.optional()}),$({type:T("reasoning-end"),id:S(),providerMetadata:j.optional()}),$({type:T("source-url"),sourceId:S(),url:S(),title:S().optional(),providerMetadata:j.optional()}),$({type:T("source-document"),sourceId:S(),mediaType:S(),title:S(),filename:S().optional(),providerMetadata:j.optional()}),$({type:T("file"),url:S(),mediaType:S(),providerMetadata:j.optional()}),$({type:fs(t=>typeof t=="string"&&t.startsWith("data-"),{message:'Type must start with "data-"'}),id:S().optional(),data:me(),transient:J().optional()}),$({type:T("start-step")}),$({type:T("finish-step")}),$({type:T("start"),messageId:S().optional(),messageMetadata:me().optional()}),$({type:T("finish"),finishReason:ma(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:me().optional()}),$({type:T("abort"),reason:S().optional()}),$({type:T("message-metadata"),messageMetadata:me()})])));function In(t){return t.type.startsWith("data-")}function yt(t){return t.type.startsWith("tool-")}function wn(t){return t.type==="dynamic-tool"}function Oe(t){return yt(t)||wn(t)}function rs(t){return t.type.split("-").slice(1).join("-")}function Nn({lastMessage:t,messageId:e}){return{message:t?.role==="assistant"?t:{id:e,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function Cn({stream:t,messageMetadataSchema:e,dataPartSchemas:s,runUpdateMessageJob:a,onError:r,onToolCall:n,onData:i}){return t.pipeThrough(new TransformStream({async transform(o,c){await a(async({state:l,write:d})=>{var m,h,f,v;function b(p){const w=l.message.parts.filter(Oe).find(C=>C.toolCallId===p);if(w==null)throw new Ae({chunkType:"tool-invocation",chunkId:p,message:`No tool invocation found for tool call ID "${p}".`});return w}function _(p){var E;const w=l.message.parts.find(N=>yt(N)&&N.toolCallId===p.toolCallId),C=p,g=w;w!=null?(w.state=p.state,g.input=C.input,g.output=C.output,g.errorText=C.errorText,g.rawInput=C.rawInput,g.preliminary=C.preliminary,p.title!==void 0&&(g.title=p.title),g.providerExecuted=(E=C.providerExecuted)!=null?E:w.providerExecuted,C.providerMetadata!=null&&(w.callProviderMetadata=C.providerMetadata)):l.message.parts.push({type:`tool-${p.toolName}`,toolCallId:p.toolCallId,state:p.state,title:p.title,input:C.input,output:C.output,rawInput:C.rawInput,errorText:C.errorText,providerExecuted:C.providerExecuted,preliminary:C.preliminary,...C.providerMetadata!=null?{callProviderMetadata:C.providerMetadata}:{}})}function y(p){var E,w;const C=l.message.parts.find(A=>A.type==="dynamic-tool"&&A.toolCallId===p.toolCallId),g=p,N=C;C!=null?(C.state=p.state,N.toolName=p.toolName,N.input=g.input,N.output=g.output,N.errorText=g.errorText,N.rawInput=(E=g.rawInput)!=null?E:N.rawInput,N.preliminary=g.preliminary,p.title!==void 0&&(N.title=p.title),N.providerExecuted=(w=g.providerExecuted)!=null?w:C.providerExecuted,g.providerMetadata!=null&&(C.callProviderMetadata=g.providerMetadata)):l.message.parts.push({type:"dynamic-tool",toolName:p.toolName,toolCallId:p.toolCallId,state:p.state,input:g.input,output:g.output,errorText:g.errorText,preliminary:g.preliminary,providerExecuted:g.providerExecuted,title:p.title,...g.providerMetadata!=null?{callProviderMetadata:g.providerMetadata}:{}})}async function x(p){if(p!=null){const E=l.message.metadata!=null?Vs(l.message.metadata,p):p;e!=null&&await ss({value:E,schema:e,context:{field:"message.metadata",entityId:l.message.id}}),l.message.metadata=E}}switch(o.type){case"text-start":{const p={type:"text",text:"",providerMetadata:o.providerMetadata,state:"streaming"};l.activeTextParts[o.id]=p,l.message.parts.push(p),d();break}case"text-delta":{const p=l.activeTextParts[o.id];if(p==null)throw new Ae({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.`});p.text+=o.delta,p.providerMetadata=(m=o.providerMetadata)!=null?m:p.providerMetadata,d();break}case"text-end":{const p=l.activeTextParts[o.id];if(p==null)throw new Ae({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.`});p.state="done",p.providerMetadata=(h=o.providerMetadata)!=null?h:p.providerMetadata,delete l.activeTextParts[o.id],d();break}case"reasoning-start":{const p={type:"reasoning",text:"",providerMetadata:o.providerMetadata,state:"streaming"};l.activeReasoningParts[o.id]=p,l.message.parts.push(p),d();break}case"reasoning-delta":{const p=l.activeReasoningParts[o.id];if(p==null)throw new Ae({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.`});p.text+=o.delta,p.providerMetadata=(f=o.providerMetadata)!=null?f:p.providerMetadata,d();break}case"reasoning-end":{const p=l.activeReasoningParts[o.id];if(p==null)throw new Ae({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.`});p.providerMetadata=(v=o.providerMetadata)!=null?v:p.providerMetadata,p.state="done",delete l.activeReasoningParts[o.id],d();break}case"file":{l.message.parts.push({type:"file",mediaType:o.mediaType,url:o.url,...o.providerMetadata!=null?{providerMetadata:o.providerMetadata}:{}}),d();break}case"source-url":{l.message.parts.push({type:"source-url",sourceId:o.sourceId,url:o.url,title:o.title,providerMetadata:o.providerMetadata}),d();break}case"source-document":{l.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 p=l.message.parts.filter(yt);l.partialToolCalls[o.toolCallId]={text:"",toolName:o.toolName,index:p.length,dynamic:o.dynamic,title:o.title},o.dynamic?y({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-streaming",input:void 0,providerExecuted:o.providerExecuted,title:o.title,providerMetadata:o.providerMetadata}):_({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 p=l.partialToolCalls[o.toolCallId];if(p==null)throw new Ae({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.`});p.text+=o.inputTextDelta;const{value:E}=await Je(p.text);p.dynamic?y({toolCallId:o.toolCallId,toolName:p.toolName,state:"input-streaming",input:E,title:p.title}):_({toolCallId:o.toolCallId,toolName:p.toolName,state:"input-streaming",input:E,title:p.title}),d();break}case"tool-input-available":{o.dynamic?y({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-available",input:o.input,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata,title:o.title}):_({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 p=l.message.parts.filter(Oe).find(w=>w.toolCallId===o.toolCallId);(p!=null?p.type==="dynamic-tool":!!o.dynamic)?y({toolCallId:o.toolCallId,toolName:o.toolName,state:"output-error",input:o.input,errorText:o.errorText,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata}):_({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 p=b(o.toolCallId);p.state="approval-requested",p.approval={id:o.approvalId},d();break}case"tool-output-denied":{const p=b(o.toolCallId);p.state="output-denied",d();break}case"tool-output-available":{const p=b(o.toolCallId);p.type==="dynamic-tool"?y({toolCallId:o.toolCallId,toolName:p.toolName,state:"output-available",input:p.input,output:o.output,preliminary:o.preliminary,providerExecuted:o.providerExecuted,title:p.title}):_({toolCallId:o.toolCallId,toolName:rs(p),state:"output-available",input:p.input,output:o.output,providerExecuted:o.providerExecuted,preliminary:o.preliminary,title:p.title}),d();break}case"tool-output-error":{const p=b(o.toolCallId);p.type==="dynamic-tool"?y({toolCallId:o.toolCallId,toolName:p.toolName,state:"output-error",input:p.input,errorText:o.errorText,providerExecuted:o.providerExecuted,title:p.title}):_({toolCallId:o.toolCallId,toolName:rs(p),state:"output-error",input:p.input,rawInput:p.rawInput,errorText:o.errorText,providerExecuted:o.providerExecuted,title:p.title}),d();break}case"start-step":{l.message.parts.push({type:"step-start"});break}case"finish-step":{l.activeTextParts={},l.activeReasoningParts={};break}case"start":{o.messageId!=null&&(l.message.id=o.messageId),await x(o.messageMetadata),(o.messageId!=null||o.messageMetadata!=null)&&d();break}case"finish":{o.finishReason!=null&&(l.finishReason=o.finishReason),await x(o.messageMetadata),o.messageMetadata!=null&&d();break}case"message-metadata":{await x(o.messageMetadata),o.messageMetadata!=null&&d();break}case"error":{r?.(new Error(o.errorText));break}default:if(In(o)){if(s?.[o.type]!=null){const w=l.message.parts.findIndex(g=>"id"in g&&"data"in g&&g.id===o.id&&g.type===o.type),C=w>=0?w:l.message.parts.length;await ss({value:o.data,schema:s[o.type],context:{field:`message.parts[${C}].data`,entityName:o.type,entityId:o.id}})}const p=o;if(p.transient){i?.(p);break}const E=p.id!=null?l.message.parts.find(w=>p.type===w.type&&p.id===w.id):void 0;E!=null?E.data=p.data:l.message.parts.push(p),i?.(p),d()}}c.enqueue(o)})}}))}async function Tn({stream:t,onError:e}){const s=t.getReader();try{for(;;){const{done:a}=await s.read();if(a)break}}catch(a){e?.(a)}finally{s.releaseLock()}}We({prefix:"aitxt",size:24});We({prefix:"aiobj",size:24});var An=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,s)=>{this.queue.push(async()=>{try{await t(),e()}catch(a){s(a)}}),this.processQueue()})}};We({prefix:"aiobj",size:24});async function Mn(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:s,type:a}=e,r=await new Promise((n,i)=>{const o=new FileReader;o.onload=c=>{var l;n((l=c.target)==null?void 0:l.result)},o.onerror=c=>i(c),o.readAsDataURL(e)});return{type:"file",mediaType:a,filename:s,url:r}}))}var jn=class{constructor({api:t="/api/chat",credentials:e,headers:s,body:a,fetch:r,prepareSendMessagesRequest:n,prepareReconnectToStreamRequest:i}){this.api=t,this.credentials=e,this.headers=s,this.body=a,this.fetch=r,this.prepareSendMessagesRequest=n,this.prepareReconnectToStreamRequest=i}async sendMessages({abortSignal:t,...e}){var s,a,r,n,i;const o=await he(this.body),c=await he(this.headers),l=await he(this.credentials),d={...xe(c),...xe(e.headers)},m=await((s=this.prepareSendMessagesRequest)==null?void 0:s.call(this,{api:this.api,id:e.chatId,messages:e.messages,body:{...o,...e.body},headers:d,credentials:l,requestMetadata:e.metadata,trigger:e.trigger,messageId:e.messageId})),h=(a=m?.api)!=null?a:this.api,f=m?.headers!==void 0?xe(m.headers):d,v=m?.body!==void 0?m.body:{...o,...e.body,id:e.chatId,messages:e.messages,trigger:e.trigger,messageId:e.messageId},b=(r=m?.credentials)!=null?r:l,y=await((n=this.fetch)!=null?n:globalThis.fetch)(h,{method:"POST",headers:Kt({"Content-Type":"application/json",...f},`ai-sdk/${as}`,Qt()),body:JSON.stringify(v),credentials:b,signal:t});if(!y.ok)throw new Error((i=await y.text())!=null?i:"Failed to fetch the chat response.");if(!y.body)throw new Error("The response body is empty.");return this.processResponseStream(y.body)}async reconnectToStream(t){var e,s,a,r,n;const i=await he(this.body),o=await he(this.headers),c=await he(this.credentials),l={...xe(o),...xe(t.headers)},d=await((e=this.prepareReconnectToStreamRequest)==null?void 0:e.call(this,{api:this.api,id:t.chatId,body:{...i,...t.body},headers:l,credentials:c,requestMetadata:t.metadata})),m=(s=d?.api)!=null?s:`${this.api}/${t.chatId}/stream`,h=d?.headers!==void 0?xe(d.headers):l,f=(a=d?.credentials)!=null?a:c,b=await((r=this.fetch)!=null?r:globalThis.fetch)(m,{method:"GET",headers:Kt(h,`ai-sdk/${as}`,Qt()),credentials:f});if(b.status===204)return null;if(!b.ok)throw new Error((n=await b.text())!=null?n:"Failed to fetch the chat response.");if(!b.body)throw new Error("The response body is empty.");return this.processResponseStream(b.body)}},qs=class extends jn{constructor(t={}){super(t)}processResponseStream(t){return en({stream:t,schema:En}).pipeThrough(new TransformStream({async transform(e,s){if(!e.success)throw e.error;s.enqueue(e.value)}}))}},kn=class{constructor({generateId:t=ar,id:e=t(),transport:s=new qs,messageMetadataSchema:a,dataPartSchemas:r,state:n,onError:i,onToolCall:o,onFinish:c,onData:l,sendAutomaticallyWhen:d}){this.activeResponse=void 0,this.jobExecutor=new An,this.sendMessage=async(m,h)=>{var f,v,b,_;if(m==null){await this.makeRequest({trigger:"submit-message",messageId:(f=this.lastMessage)==null?void 0:f.id,...h});return}let y;if("text"in m||"files"in m?y={parts:[...Array.isArray(m.files)?m.files:await Mn(m.files),..."text"in m&&m.text!=null?[{type:"text",text:m.text}]:[]]}:y=m,m.messageId!=null){const x=this.state.messages.findIndex(p=>p.id===m.messageId);if(x===-1)throw new Error(`message with id ${m.messageId} not found`);if(this.state.messages[x].role!=="user")throw new Error(`message with id ${m.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,x+1),this.state.replaceMessage(x,{...y,id:m.messageId,role:(v=y.role)!=null?v:"user",metadata:m.metadata})}else this.state.pushMessage({...y,id:(b=y.id)!=null?b:this.generateId(),role:(_=y.role)!=null?_:"user",metadata:m.metadata});await this.makeRequest({trigger:"submit-message",messageId:m.messageId,...h})},this.regenerate=async({messageId:m,...h}={})=>{const f=m==null?this.state.messages.length-1:this.state.messages.findIndex(v=>v.id===m);if(f===-1)throw new Error(`message ${m} 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:m,...h})},this.resumeStream=async(m={})=>{await this.makeRequest({trigger:"resume-stream",...m})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:m,approved:h,reason:f})=>this.jobExecutor.run(async()=>{const v=this.state.messages,b=v[v.length-1],_=y=>Oe(y)&&y.state==="approval-requested"&&y.approval.id===m?{...y,state:"approval-responded",approval:{id:m,approved:h,reason:f}}:y;this.state.replaceMessage(v.length-1,{...b,parts:b.parts.map(_)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(_)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(y=>{var x;y&&this.makeRequest({trigger:"submit-message",messageId:(x=this.lastMessage)==null?void 0:x.id})})}),this.addToolOutput=async({state:m="output-available",tool:h,toolCallId:f,output:v,errorText:b})=>this.jobExecutor.run(async()=>{const _=this.state.messages,y=_[_.length-1],x=p=>Oe(p)&&p.toolCallId===f?{...p,state:m,output:v,errorText:b}:p;this.state.replaceMessage(_.length-1,{...y,parts:y.parts.map(x)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(x)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(p=>{var E;p&&this.makeRequest({trigger:"submit-message",messageId:(E=this.lastMessage)==null?void 0:E.id})})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var m;this.status!=="streaming"&&this.status!=="submitted"||(m=this.activeResponse)!=null&&m.abortController&&this.activeResponse.abortController.abort()},this.id=e,this.transport=s,this.generateId=t,this.messageMetadataSchema=a,this.dataPartSchemas=r,this.state=n,this.onError=i,this.onToolCall=o,this.onFinish=c,this.onData=l,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:s,body:a,messageId:r}){var n,i,o;let c;if(t==="resume-stream")try{const f=await this.transport.reconnectToStream({chatId:this.id,metadata:e,headers:s,body:a});if(f==null)return;c=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 l=this.lastMessage;let d=!1,m=!1,h=!1;try{const f={state:Nn({lastMessage:this.state.snapshot(l),messageId:this.generateId()}),abortController:new AbortController};f.abortController.signal.addEventListener("abort",()=>{d=!0}),this.activeResponse=f;let v;t==="resume-stream"?v=c:v=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:f.abortController.signal,metadata:e,headers:s,body:a,trigger:t,messageId:r});const b=_=>this.jobExecutor.run(()=>_({state:f.state,write:()=>{var y;this.setStatus({status:"streaming"}),f.state.message.id===((y=this.lastMessage)==null?void 0:y.id)?this.state.replaceMessage(this.state.messages.length-1,f.state.message):this.state.pushMessage(f.state.message)}}));await Tn({stream:Cn({stream:v,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:b,onError:_=>{throw _}}),onError:_=>{throw _}}),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"))&&(m=!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:m,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:s,body:a})}};function Rn({messages:t}){const e=t[t.length-1];if(!e||e.role!=="assistant")return!1;const s=e.parts.reduce((r,n,i)=>n.type==="step-start"?i:r,-1),a=e.parts.slice(s+1).filter(Oe).filter(r=>!r.providerExecuted);return a.filter(r=>r.state==="approval-responded").length>0&&a.every(r=>r.state==="output-available"||r.state==="output-error"||r.state==="approval-responded")}function On({messages:t}){const e=t[t.length-1];if(!e||e.role!=="assistant")return!1;const s=e.parts.reduce((r,n,i)=>n.type==="step-start"?i:r,-1),a=e.parts.slice(s+1).filter(Oe).filter(r=>!r.providerExecuted);return a.length>0&&a.every(r=>r.state==="output-available"||r.state==="output-error")}var dt,ns;function Pn(){if(ns)return dt;ns=1;function t(e,s){if(typeof e!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let a,r=0;return function(...i){clearTimeout(a);const o=Date.now(),c=o-r,l=s-c;l<=0?(r=o,e.apply(this,i)):a=setTimeout(()=>{r=Date.now(),e.apply(this,i)},l)}}return dt=t,dt}var Dn=Pn();const $n=fa(Dn);var Ws=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)},L=(t,e,s)=>(Ws(t,e,"read from private field"),s?s.call(t):e.get(t)),ae=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)},fe=(t,e,s,a)=>(Ws(t,e,"write to private field"),e.set(t,s),s);function Ln(t,e){return e!=null?$n(t,e):t}var Q,Ge,Ye,$e,Le,Ze,Me,xt,bt,Zn=class{constructor(t=[]){ae(this,Q,void 0),ae(this,Ge,"ready"),ae(this,Ye,void 0),ae(this,$e,new Set),ae(this,Le,new Set),ae(this,Ze,new Set),this.pushMessage=e=>{fe(this,Q,L(this,Q).concat(e)),L(this,Me).call(this)},this.popMessage=()=>{fe(this,Q,L(this,Q).slice(0,-1)),L(this,Me).call(this)},this.replaceMessage=(e,s)=>{fe(this,Q,[...L(this,Q).slice(0,e),this.snapshot(s),...L(this,Q).slice(e+1)]),L(this,Me).call(this)},this.snapshot=e=>structuredClone(e),this["~registerMessagesCallback"]=(e,s)=>{const a=s?Ln(e,s):e;return L(this,$e).add(a),()=>{L(this,$e).delete(a)}},this["~registerStatusCallback"]=e=>(L(this,Le).add(e),()=>{L(this,Le).delete(e)}),this["~registerErrorCallback"]=e=>(L(this,Ze).add(e),()=>{L(this,Ze).delete(e)}),ae(this,Me,()=>{L(this,$e).forEach(e=>e())}),ae(this,xt,()=>{L(this,Le).forEach(e=>e())}),ae(this,bt,()=>{L(this,Ze).forEach(e=>e())}),fe(this,Q,t)}get status(){return L(this,Ge)}set status(t){fe(this,Ge,t),L(this,xt).call(this)}get error(){return L(this,Ye)}set error(t){fe(this,Ye,t),L(this,bt).call(this)}get messages(){return L(this,Q)}set messages(t){fe(this,Q,[...t]),L(this,Me).call(this)}};Q=new WeakMap;Ge=new WeakMap;Ye=new WeakMap;$e=new WeakMap;Le=new WeakMap;Ze=new WeakMap;Me=new WeakMap;xt=new WeakMap;bt=new WeakMap;var je,os=class extends kn{constructor({messages:t,...e}){const s=new Zn(t);super({...e,state:s}),ae(this,je,void 0),this["~registerMessagesCallback"]=(a,r)=>L(this,je)["~registerMessagesCallback"](a,r),this["~registerStatusCallback"]=a=>L(this,je)["~registerStatusCallback"](a),this["~registerErrorCallback"]=a=>L(this,je)["~registerErrorCallback"](a),fe(this,je,s)}};je=new WeakMap;function Fn({experimental_throttle:t,resume:e=!1,...s}={}){const a=I.useRef("chat"in s?{}:{onToolCall:s.onToolCall,onData:s.onData,onFinish:s.onFinish,onError:s.onError,sendAutomaticallyWhen:s.sendAutomaticallyWhen});"chat"in s||(a.current={onToolCall:s.onToolCall,onData:s.onData,onFinish:s.onFinish,onError:s.onError,sendAutomaticallyWhen:s.sendAutomaticallyWhen});const r={...s,onToolCall:h=>{var f,v;return(v=(f=a.current).onToolCall)==null?void 0:v.call(f,h)},onData:h=>{var f,v;return(v=(f=a.current).onData)==null?void 0:v.call(f,h)},onFinish:h=>{var f,v;return(v=(f=a.current).onFinish)==null?void 0:v.call(f,h)},onError:h=>{var f,v;return(v=(f=a.current).onError)==null?void 0:v.call(f,h)},sendAutomaticallyWhen:h=>{var f,v,b;return(b=(v=(f=a.current).sendAutomaticallyWhen)==null?void 0:v.call(f,h))!=null?b:!1}},n=I.useRef("chat"in s?s.chat:new os(r));("chat"in s&&s.chat!==n.current||"id"in s&&n.current.id!==s.id)&&(n.current="chat"in s?s.chat:new os(r));const o=I.useCallback(h=>n.current["~registerMessagesCallback"](h,t),[t,n.current.id]),c=I.useSyncExternalStore(o,()=>n.current.messages,()=>n.current.messages),l=I.useSyncExternalStore(n.current["~registerStatusCallback"],()=>n.current.status,()=>n.current.status),d=I.useSyncExternalStore(n.current["~registerErrorCallback"],()=>n.current.error,()=>n.current.error),m=I.useCallback(h=>{typeof h=="function"&&(h=h(n.current.messages)),n.current.messages=h},[n]);return I.useEffect(()=>{e&&n.current.resumeStream()},[e,n]),{id:n.current.id,messages:c,setMessages:m,sendMessage:n.current.sendMessage,regenerate:n.current.regenerate,clearError:n.current.clearError,stop:n.current.stop,error:d,resumeStream:n.current.resumeStream,status:l,addToolResult:n.current.addToolOutput,addToolOutput:n.current.addToolOutput,addToolApprovalResponse:n.current.addToolApprovalResponse}}function Un(t){const{buildUrl:e,eventTypes:s}=t,a=new Map;function r(n){let i=a.get(n);if(!i){const o=new EventSource(e(n));i={es:o,refCount:0},a.set(n,i),o.onerror=()=>{o.readyState===EventSource.CLOSED&&a.delete(n)}}return i}return{subscribe(n,i){const o=r(n);o.refCount++;for(const l of s)o.es.addEventListener(l,i);let c=!1;return()=>{if(!c){c=!0;for(const l of s)o.es.removeEventListener(l,i);o.refCount--,o.refCount<=0&&(o.es.close(),a.delete(n))}}}}}const zn=Un({buildUrl:t=>{const e=Zt.join(",");return`/org/${t}/watch?types=${e}`},eventTypes:[...Zt]}),is=()=>0;function Bn(t){const{orgId:e,taskId:s,enabled:a=!0,onStep:r,onFinish:n,onTaskStatus:i}=t,o=I.useRef({taskId:s,onStep:r,onFinish:n,onTaskStatus:i});o.current={taskId:s,onStep:r,onFinish:n,onTaskStatus:i};const c=I.useRef(null),l=I.useRef(a),d=I.useRef(e);(!c.current||l.current!==a||d.current!==e)&&(l.current=a,d.current=e,c.current=m=>{if(!a||!e)return()=>{};const h=f=>{let v;try{v=JSON.parse(f.data)}catch{return}const b=o.current;if(!(b.taskId&&v.subject!==b.taskId)){switch(v.type){case lt.STEP:b.onStep?.(v);break;case lt.FINISH:b.onFinish?.(v);break;case lt.THREAD_STATUS:b.onTaskStatus?.(v);break}m()}};return zn.subscribe(e,h)}),I.useSyncExternalStore(c.current,is,is)}function Js(){const t=Z.c(21),{locator:e,org:s}=Se();let a;t[0]!==e?(a=_e.allowedModels(e),t[0]=e,t[1]=a):a=t[1];let r;t[2]!==s?(r=async()=>{const _=await fetch(`/api/${s.slug}/decopilot/allowed-models`,{credentials:"include"});return _.ok?_.json():{allowAll:!0,models:{}}},t[2]=s,t[3]=r):r=t[3];let n;t[4]!==a||t[5]!==r?(n={queryKey:a,queryFn:r,staleTime:3e4},t[4]=a,t[5]=r,t[6]=n):n=t[6];const{data:i,isLoading:o}=Aa(n),c=i?.allowAll??!0;let l;t[7]!==i?.models?(l=i?.models??{},t[7]=i?.models,t[8]=l):l=t[8];const d=l;let m;t[9]!==c||t[10]!==d?(m=(_,y)=>{if(c)return!0;const x=d[_];return x?x.includes("*")||x.includes(y):d["*"]?.includes("*")??!1},t[9]=c,t[10]=d,t[11]=m):m=t[11];const h=m;let f;t[12]!==c||t[13]!==d?(f=_=>{if(c)return!0;const y=d[_];if(y&&y.length>0)return!0;const x=d["*"];return x?x.length>0:!1},t[12]=c,t[13]=d,t[14]=f):f=t[14];const v=f;let b;return t[15]!==c||t[16]!==v||t[17]!==o||t[18]!==h||t[19]!==d?(b={allowAll:c,models:d,isLoading:o,isModelAllowed:h,hasConnectionModels:v},t[15]=c,t[16]=v,t[17]=o,t[18]=h,t[19]=d,t[20]=b):b=t[20],b}function Vn(t){const e=Z.c(10);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={strict:!1},e[0]=s):s=e[0];const a=hs(s);let r;if(e[1]!==a.collectionName||e[2]!==a.connectionId||e[3]!==a.itemId||e[4]!==t){r=[],t&&r.push(`### Selected Agent
|
|
12
|
+
- ID: ${t}`);let n;e[6]!==a.collectionName||e[7]!==a.connectionId||e[8]!==a.itemId?(n=[],a.connectionId&&n.push(`- Connection ID: ${a.connectionId}`),a.collectionName&&n.push(`- Collection: ${a.collectionName}`),a.itemId&&n.push(`- Item ID: ${a.itemId}`),e[6]=a.collectionName,e[7]=a.connectionId,e[8]=a.itemId,e[9]=n):n=e[9],n.length>0&&r.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]=a.collectionName,e[2]=a.connectionId,e[3]=a.itemId,e[4]=t,e[5]=r}else r=e[5];return r.join(`
|
|
18
|
+
|
|
19
|
+
`)}function qn(){const t=Z.c(5),e=tt(),{org:s}=Se();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},t[0]=a):a=t[0];const r=hs(a);let n;return t[1]!==s||t[2]!==r||t[3]!==e?(n=i=>{const c=i.toolCall.toolName.match(/^COLLECTION_([A-Z_]+)_(CREATE|UPDATE|DELETE)$/);if(!c||!c[1])return;const l=c[1],d=r.connectionId;if(!d)return;e.invalidateQueries({queryKey:_e.collection(s.slug,d,l)});const m=l.toLowerCase().replace(/_/g," ");ke.success(`${m} updated`)},t[1]=s,t[2]=r,t[3]=e,t[4]=n):n=t[4],n}const pt=(()=>{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 Wn(){return{showNotification:async e=>{const{title:s,body:a,icon:r="/favicon.svg",tag:n}=e;if(typeof Notification>"u")return;if(Notification.permission!=="granted"){Notification.requestPermission().then(o=>{o==="denied"&&ke.error("Notifications denied. Please enable them in your browser settings.")});return}if(document?.hasFocus())return;pt&&(pt.currentTime=0,pt.play().catch(o=>{console.warn("Failed to play notification sound:",o)}));const i=new Notification(s,{body:a,icon:r,tag:n});i.onclick=()=>{window.focus(),i.close()}}}}const ls=["smarter","faster","cheaper"],cs={smarter:"Smarter",faster:"Faster",cheaper:"Cheaper"},Jn=[{tier:"smarter",prefixes:["anthropic/claude-4.6-opus","anthropic/claude-opus-4.6","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","openai/gpt-5.3-codex","google/gemini-3-pro","google/gemini-2.5-pro","cohere/command-r-plus","cohere/command-a"]},{tier:"faster",prefixes:["anthropic/claude-haiku-4.5","anthropic/claude-4.5-haiku","google/gemini-3-flash","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast","x-ai/grok-3","mistralai/mistral-large","mistralai/codestral","mistralai/mistral-medium","qwen/qwen-plus","qwen/qwen-turbo","qwen/qwen3-235b","minimax/minimax-m1"]},{tier:"cheaper",prefixes:["google/gemini-2.5-flash-lite","google/gemini-2.5-flash","google/gemini-2.0-flash","deepseek/deepseek-v3","openai/gpt-oss-120b","mistralai/mistral-small","mistralai/pixtral","qwen/qwen-long","cohere/command-r"]}],Hn=":free",Gn=Jn.flatMap(({tier:t,prefixes:e})=>e.map(s=>({tier:t,prefix:s}))).sort((t,e)=>e.prefix.length-t.prefix.length),Yn=new Set(["google/gemini-2.5-pro"]);function Qn(t){if(t.endsWith(Hn))return"cheaper";for(const{tier:e,prefix:s}of Gn)if(t.startsWith(s)){if(Yn.has(s)&&t.length>s.length&&t[s.length]==="-"){const r=t[s.length+1];if(!r||!/\d/.test(r))continue}return e}return null}const Hs=["anthropic/claude-4.6-opus-20260205","anthropic/claude-opus-4.6","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","anthropic/claude-sonnet-4.6:extended","openai/gpt-5.3-codex","google/gemini-3-pro-preview","google/gemini-2.5-pro","anthropic/claude-haiku-4.5","anthropic/claude-haiku-4.5-20251001","anthropic/claude-4.5-haiku","google/gemini-3-flash-preview","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast-1","google/gemini-2.5-flash","deepseek/deepseek-v3.2","google/gemini-2.5-flash-lite","openai/gpt-oss-120b:free"],us=new Set(Hs),St=new Map;Hs.forEach((t,e)=>St.set(t,e));const Gs="mesh:model-shortlist:";function Kn(t){try{const e=localStorage.getItem(Gs+t);return e?JSON.parse(e):null}catch{return null}}function Xn(t,e){localStorage.setItem(Gs+t,JSON.stringify(e))}function kt(t){const e=Z.c(3);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={pageSize:999},e[0]=s):s=e[0];const a=Ta(t??void 0,s);let r;return e[1]!==a?(r=a.filter(to).sort(eo),e[1]=a,e[2]=r):r=e[2],r}function eo(t,e){const s=St.get(t.id),a=St.get(e.id);return s!==void 0&&a!==void 0?s-a:s!==void 0?-1:a!==void 0?1:t.title.localeCompare(e.title)}function to(t){return t.limits?.contextWindow&&t.limits?.maxOutputTokens}function so(t){return t<32e3?{level:1,label:"Small",description:"Short conversations"}:t<2e5?{level:2,label:"Medium",description:"Good for most tasks"}:t<5e5?{level:3,label:"Large",description:"Long projects & research"}:{level:4,label:"Very large",description:"Massive files & data"}}const ao=["bg-destructive","bg-warning","bg-success","bg-success"],ro=["text-success","text-warning","text-warning","text-destructive"];function no(t){const e=Math.round(t*.75/1e3);return e>=1?`~${e}K words`:`~${Math.round(t*.75)} words`}function oo(t){return t<1?{level:1,label:"Cheap"}:t<5?{level:2,label:"Moderate"}:t<15?{level:3,label:"High"}:{level:4,label:"Expensive"}}const io={text:{icon:u.jsx(za,{className:"size-3.5"}),label:"Text"},vision:{icon:u.jsx(Va,{className:"size-3.5"}),label:"Vision"},tools:{icon:u.jsx(xs,{className:"size-3.5"}),label:"Tools"},reasoning:{icon:u.jsx(ys,{className:"size-3.5"}),label:"Reasoning"},"web-search":{icon:u.jsx(gs,{className:"size-3.5"}),label:"Web search"}};function lo(t){const e=Z.c(5),{capability:s}=t;let a;e[0]!==s?(a=io[s]??{icon:null,label:s.charAt(0).toUpperCase()+s.slice(1)},e[0]=s,e[1]=a):a=e[1];const r=a;let n;return e[2]!==r.icon||e[3]!==r.label?(n=u.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:[r.icon,r.label]}),e[2]=r.icon,e[3]=r.label,e[4]=n):n=e[4],n}function co(t){const e=Z.c(53),{model:s,compact:a}=t,r=a===void 0?!1:a;if(!s){let g;return e[0]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Hover to preview"}),e[0]=g):g=e[0],g}const n=s.costs?.input!=null?s.costs.input*1e6:null,i=s.costs?.output!=null?s.costs.output*1e6:null;let o;e[1]!==s.id||e[2]!==s.provider||e[3]!==s.title?(o=s.title.includes(": ")?s.title.split(": ")[0]:s.provider??s.id.split("/")[0],e[1]=s.id,e[2]=s.provider,e[3]=s.title,e[4]=o):o=e[4];const c=o;let l;e[5]!==s.title?(l=s.title.includes(": ")?s.title.split(": ").slice(1).join(": "):s.title,e[5]=s.title,e[6]=l):l=e[6];const d=l;if(r){let g;e[7]!==s.limits?(g=s.limits?.contextWindow&&u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("span",{className:"text-muted-foreground",children:"Context"}),u.jsxs("span",{className:"text-foreground font-medium",children:[s.limits.contextWindow.toLocaleString()," tokens"]})]}),e[7]=s.limits,e[8]=g):g=e[8];let N;e[9]!==n?(N=n!=null&&u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("span",{className:"text-muted-foreground",children:"Input"}),u.jsxs("span",{className:"text-foreground font-medium",children:["$",n.toFixed(2)," / 1M"]})]}),e[9]=n,e[10]=N):N=e[10];let A;e[11]!==i?(A=i!=null&&u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("span",{className:"text-muted-foreground",children:"Output"}),u.jsxs("span",{className:"text-foreground font-medium",children:["$",i.toFixed(2)," / 1M"]})]}),e[11]=i,e[12]=A):A=e[12];let O;e[13]!==s.limits?(O=s.limits?.maxOutputTokens&&u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("span",{className:"text-muted-foreground",children:"Output limit"}),u.jsxs("span",{className:"text-foreground font-medium",children:[s.limits.maxOutputTokens.toLocaleString()," tokens"]})]}),e[13]=s.limits,e[14]=O):O=e[14];let k;return e[15]!==g||e[16]!==N||e[17]!==A||e[18]!==O?(k=u.jsxs("div",{className:"flex flex-col gap-2 pt-3 pb-3 px-3 text-xs",children:[g,N,A,O]}),e[15]=g,e[16]=N,e[17]=A,e[18]=O,e[19]=k):k=e[19],k}let m;e[20]!==c?(m=u.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:c}),e[20]=c,e[21]=m):m=e[21];let h;e[22]!==s.logo||e[23]!==s.title?(h=s.logo&&u.jsx("img",{src:s.logo,className:"size-6 shrink-0 rounded-md",alt:s.title}),e[22]=s.logo,e[23]=s.title,e[24]=h):h=e[24];let f;e[25]!==d?(f=u.jsx("p",{className:"text-lg font-semibold leading-snug tracking-tight",children:d}),e[25]=d,e[26]=f):f=e[26];let v;e[27]!==h||e[28]!==f?(v=u.jsxs("div",{className:"flex items-center gap-2.5",children:[h,f]}),e[27]=h,e[28]=f,e[29]=v):v=e[29];let b;e[30]!==s.id?(b=u.jsx("p",{className:"text-xs text-muted-foreground/50 font-mono",children:s.id}),e[30]=s.id,e[31]=b):b=e[31];let _;e[32]!==m||e[33]!==v||e[34]!==b?(_=u.jsxs("div",{className:"flex flex-col gap-1 pt-1 pr-6",children:[m,v,b]}),e[32]=m,e[33]=v,e[34]=b,e[35]=_):_=e[35];let y;e[36]!==s.capabilities?(y=s.capabilities&&s.capabilities.length>0&&u.jsx("div",{className:"flex flex-wrap items-center gap-1.5 pb-4 border-b border-border",children:s.capabilities.map(uo)}),e[36]=s.capabilities,e[37]=y):y=e[37];let x;e[38]!==s.limits?(x=s.limits?.contextWindow&&(()=>{const{level:g,label:N,description:A}=so(s.limits.contextWindow);return u.jsxs("div",{className:"flex flex-col gap-1.5",children:[u.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Context window"}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("div",{className:"flex items-center gap-0.5",children:[1,2,3,4].map(O=>u.jsx("div",{className:Ue("w-2 h-2 rounded-full",O<=g?ao[g-1]:"bg-muted")},O))}),u.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:N}),u.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",A]})]}),u.jsxs("span",{className:"text-sm text-muted-foreground",children:[s.limits.contextWindow.toLocaleString()," tokens"]})]})})(),e[38]=s.limits,e[39]=x):x=e[39];let p;e[40]!==s.limits?(p=s.limits?.maxOutputTokens&&u.jsxs("div",{className:"flex flex-col gap-1",children:[u.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Output limit"}),u.jsxs("div",{className:"flex items-baseline gap-2",children:[u.jsxs("span",{className:"text-sm text-foreground",children:[s.limits.maxOutputTokens.toLocaleString()," tokens"]}),u.jsx("span",{className:"text-sm text-muted-foreground",children:no(s.limits.maxOutputTokens)})]})]}),e[40]=s.limits,e[41]=p):p=e[41];let E;e[42]!==n||e[43]!==i?(E=(n!=null||i!=null)&&(()=>{const{level:g,label:N}=n!=null?oo(n):{level:0,label:""};return u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Pricing"}),n!=null&&u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("div",{className:"flex items-center",children:[1,2,3,4].map(A=>u.jsx("span",{className:Ue("text-sm font-bold leading-none",A<=g?ro[g-1]:"text-muted-foreground/20"),children:"$"},A))}),u.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:N})]}),u.jsxs("div",{className:"flex flex-col gap-1",children:[n!=null&&u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsx("span",{className:"text-xs text-muted-foreground",children:"Input"}),u.jsxs("span",{className:"text-xs text-foreground",children:["$",n.toFixed(2)," / 1M tokens"]})]}),i!=null&&u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsx("span",{className:"text-xs text-muted-foreground",children:"Output"}),u.jsxs("span",{className:"text-xs text-foreground",children:["$",i.toFixed(2)," / 1M tokens"]})]})]})]})})(),e[42]=n,e[43]=i,e[44]=E):E=e[44];let w;e[45]!==x||e[46]!==p||e[47]!==E?(w=u.jsxs("div",{className:"flex flex-col gap-6",children:[x,p,E]}),e[45]=x,e[46]=p,e[47]=E,e[48]=w):w=e[48];let C;return e[49]!==y||e[50]!==w||e[51]!==_?(C=u.jsxs("div",{className:"flex flex-col gap-5 py-1 px-1.5",children:[_,y,w]}),e[49]=y,e[50]=w,e[51]=_,e[52]=C):C=e[52],C}function uo(t){return u.jsx(lo,{capability:t},t)}function ds(t){const e=Z.c(23),{model:s,onHover:a}=t;let r;e[0]!==s.title?(r=s.title.includes(": ")?s.title.split(": ").slice(1).join(": "):s.title,e[0]=s.title,e[1]=r):r=e[1];const n=r;let i;e[2]!==s.id||e[3]!==s.provider||e[4]!==s.title?(i=s.title.includes(": ")?s.title.split(": ")[0]:s.provider??s.id.split("/")[0],e[2]=s.id,e[3]=s.provider,e[4]=s.title,e[5]=i):i=e[5];const o=i;let c;e[6]!==s||e[7]!==a?(c=()=>a(s),e[6]=s,e[7]=a,e[8]=c):c=e[8];let l;e[9]!==s.logo||e[10]!==s.title?(l=s.logo&&u.jsx("img",{src:s.logo,className:"w-4 h-4 shrink-0 rounded-sm",alt:s.title}),e[9]=s.logo,e[10]=s.title,e[11]=l):l=e[11];let d;e[12]!==n?(d=u.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:n}),e[12]=n,e[13]=d):d=e[13];let m;e[14]!==o?(m=u.jsx("span",{className:"text-xs text-muted-foreground/60 leading-tight",children:o}),e[14]=o,e[15]=m):m=e[15];let h;e[16]!==d||e[17]!==m?(h=u.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[d,m]}),e[16]=d,e[17]=m,e[18]=h):h=e[18];let f;return e[19]!==c||e[20]!==l||e[21]!==h?(f=u.jsxs("div",{className:"flex items-center gap-2.5 py-2 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:c,children:[l,h]}),e[19]=c,e[20]=l,e[21]=h,e[22]=f):f=e[22],f}function po(t){const e=Z.c(21),{error:s,onRetry:a,connectionId:r,orgSlug:n}=t,i=ha();let o;e[0]!==r||e[1]!==i||e[2]!==n?(o=()=>{!r||!n||i({to:"/$org/$project/mcps/$connectionId",params:{org:n,project:ga,connectionId:r}})},e[0]=r,e[1]=i,e[2]=n,e[3]=o):o=e[3];const c=o;let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx("div",{className:"bg-destructive/10 p-2 rounded-full",children:u.jsx(va,{className:"size-5 text-destructive"})}),e[4]=l):l=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx("p",{className:"text-sm font-medium text-foreground",children:"Failed to load models"}),e[5]=d):d=e[5];const m=s?.message||"Could not fetch models from this provider.";let h;e[6]!==m?(h=u.jsxs("div",{className:"flex flex-col gap-1",children:[d,u.jsxs("p",{className:"text-xs text-muted-foreground max-w-[260px]",children:[m," Try another provider or retry."]})]}),e[6]=m,e[7]=h):h=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(qa,{className:"size-3.5"}),e[8]=f):f=e[8];let v;e[9]!==a?(v=u.jsxs(Ke,{variant:"outline",size:"sm",onClick:a,className:"gap-1.5",children:[f,"Retry"]}),e[9]=a,e[10]=v):v=e[10];let b;e[11]!==r||e[12]!==c||e[13]!==n?(b=r&&n&&u.jsxs(Ke,{variant:"outline",size:"sm",onClick:c,className:"gap-1.5",children:[u.jsx(Tt,{className:"size-3.5"}),"Configure"]}),e[11]=r,e[12]=c,e[13]=n,e[14]=b):b=e[14];let _;e[15]!==v||e[16]!==b?(_=u.jsxs("div",{className:"flex items-center gap-2",children:[v,b]}),e[15]=v,e[16]=b,e[17]=_):_=e[17];let y;return e[18]!==h||e[19]!==_?(y=u.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-4 py-8 text-center",children:[l,h,_]}),e[18]=h,e[19]=_,e[20]=y):y=e[20],y}function mo(){const t=Z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:6}).map(fo)}),t[0]=e):e=t[0],e}function fo(t,e){return u.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[u.jsx(V,{className:"size-5 shrink-0 rounded-sm"}),u.jsx(V,{className:"flex-1 h-4"}),u.jsx(V,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function ho({connectionId:t,allowAll:e,isModelAllowed:s,searchTerm:a,selectedModel:r,onModelSelect:n,onHover:i,managing:o,onToggleManage:c,allModelsRef:l,onSelectedModelResolved:d}){const m=kt(t??void 0);l.current=m,I.useEffect(()=>{if(r&&m.length>0){const g=m.find(N=>N.id===r.thinking.id)??null;g&&d(g)}},[r,m,d]);const h=e?m:m.filter(g=>t&&s(t,g.id)),[f,v]=I.useState(0),b=t?Kn(t):null,_=b?new Set(b):us,y=g=>{const N={smarter:[],faster:[],cheaper:[],other:[]};for(const A of g){const O=Qn(A.id);N[O??"other"].push(A)}for(const A of Object.keys(N))N[A].sort((O,k)=>O.title.localeCompare(k.title));return N};if(o){const g=a.trim()?h.filter(k=>{const U=a.toLowerCase();return k.title.toLowerCase().includes(U)||k.provider?.toLowerCase().includes(U)}):h,N=y(g),A=k=>{if(!t)return;const U=b??[...us],z=U.includes(k)?U.filter(ve=>ve!==k):[...U,k];Xn(t,z),v(ve=>ve+1)},O=(k,U)=>U.length===0?null:u.jsxs("div",{children:[u.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:k}),U.map(z=>u.jsxs("label",{className:"flex items-center gap-3 min-h-8 py-2.5 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:()=>i(z),children:[u.jsx(ja,{checked:_.has(z.id),onCheckedChange:()=>A(z.id)}),z.logo&&u.jsx("img",{src:z.logo,className:"w-5 h-5 shrink-0",alt:z.title}),u.jsx("span",{className:"text-sm text-foreground flex-1 min-w-0 line-clamp-1",children:z.title})]},z.id))]},k);return u.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[u.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[u.jsxs("button",{type:"button",onClick:c,className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground cursor-pointer",children:[u.jsx(Ba,{size:14}),"Back"]}),u.jsxs("span",{className:"text-xs text-muted-foreground",children:[h.filter(k=>_.has(k.id)).length," selected"]})]}),u.jsxs("div",{className:"flex-1 overflow-y-auto px-0.5 pt-1",children:[ls.map(k=>O(cs[k],N[k])),O("Other",N.other)]})]})}const x=h.filter(g=>_.has(g.id)),p=x.length>0?x:h,E=a.trim()?p.filter(g=>{const N=a.toLowerCase();return g.title.toLowerCase().includes(N)||g.provider?.toLowerCase().includes(N)||g.description?.toLowerCase().includes(N)}):p;if(E.length===0)return u.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center py-8 gap-3",children:[u.jsx("p",{className:"text-sm text-muted-foreground",children:"No models found"}),u.jsxs(Ke,{variant:"outline",size:"sm",onClick:c,className:"gap-1.5",children:[u.jsx(Tt,{className:"size-3.5"}),"Manage models"]})]});if(a.trim().length>0)return u.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:E.map(g=>{const N=g.id===r?.thinking.id;return u.jsx("div",{onClick:()=>n(g),className:Ue("rounded-lg mb-1",N&&"bg-accent/50"),children:u.jsx(ds,{model:g,onHover:i})},g.id)})});const w=y(E),C=(g,N)=>N.length===0?null:u.jsxs("div",{children:[u.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:g}),N.map(A=>{const O=A.id===r?.thinking.id;return u.jsx("div",{onClick:()=>n(A),className:Ue("rounded-lg mb-1",O&&"bg-accent/50"),children:u.jsx(ds,{model:A,onHover:i})},A.id)})]},g);return u.jsxs("div",{className:"flex-1 overflow-y-auto p-2",children:[ls.map(g=>C(cs[g],w[g])),w.other.length>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"mx-3 my-2 border-t border-border"}),C("Other",w.other)]})]})}function Rt(t){const e=Z.c(16),{model:s,placeholder:a}=t,r=a===void 0?"Select model":a;if(!s){let m;e[0]!==r?(m=u.jsx("span",{className:"text-sm text-muted-foreground",children:r}),e[0]=r,e[1]=m):m=e[1];let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(ft,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[2]=h):h=e[2];let f;return e[3]!==m?(f=u.jsxs("div",{className:"flex items-center gap-1.5",children:[m,h]}),e[3]=m,e[4]=f):f=e[4],f}let n;e[5]!==s.title?(n=s.title.includes(": ")?s.title.split(": ").slice(1).join(": "):s.title,e[5]=s.title,e[6]=n):n=e[6];const i=n;let o;e[7]!==s.logo||e[8]!==s.title?(o=s.logo&&u.jsx("img",{src:s.logo,className:"w-5 h-5 shrink-0 rounded-sm",alt:s.title}),e[7]=s.logo,e[8]=s.title,e[9]=o):o=e[9];let c;e[10]!==i?(c=u.jsx("span",{className:"text-sm text-muted-foreground truncate whitespace-nowrap hidden md:inline",children:i}),e[10]=i,e[11]=c):c=e[11];let l;e[12]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(ft,{size:14,className:"text-muted-foreground opacity-50 shrink-0 hidden md:inline"}),e[12]=l):l=e[12];let d;return e[13]!==o||e[14]!==c?(d=u.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[o,c,l]}),e[13]=o,e[14]=c,e[15]=d):d=e[15],d}function wi(t){return t?.thinking?.capabilities?.vision===!0}function go(){const t=Z.c(6);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:u.jsxs("div",{className:"flex items-center gap-2.5 h-12 px-4",children:[u.jsx(V,{className:"size-4 shrink-0"}),u.jsx(V,{className:"flex-1 h-6"}),u.jsx(V,{className:"w-[140px] h-8 shrink-0"})]})}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px]",children:[e,u.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:8}).map(vo)})]}),t[1]=s):s=t[1];let a;t[2]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[u.jsx(V,{className:"size-6 shrink-0"}),u.jsx(V,{className:"h-6 w-32"})]}),t[2]=a):a=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[a,u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(V,{className:"h-6 w-20 rounded-md"}),u.jsx(V,{className:"h-6 w-24 rounded-md"})]})]}),t[3]=r):r=t[3];let n;t[4]===Symbol.for("react.memo_cache_sentinel")?(n=u.jsxs("div",{className:"flex flex-col gap-1.5",children:[u.jsx(V,{className:"h-4 w-24"}),u.jsx(V,{className:"h-4 w-32"})]}),t[4]=n):n=t[4];let i;return t[5]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsxs("div",{className:"flex flex-col md:flex-row h-[460px]",children:[s,u.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:u.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[r,u.jsxs("div",{className:"flex flex-col gap-4",children:[n,u.jsxs("div",{className:"flex flex-col gap-1.5",children:[u.jsx(V,{className:"h-4 w-16"}),u.jsx(V,{className:"h-4 w-40"})]})]})]})})]}),t[5]=i):i=t[5],i}function vo(t,e){return u.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[u.jsx(V,{className:"size-5 shrink-0 rounded-sm"}),u.jsx(V,{className:"flex-1 h-4"}),u.jsx(V,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function yo(t){const e=Z.c(51),{selectedModel:s,onModelChange:a,onClose:r,modelsConnections:n}=t,[i,o]=I.useState(null),[c,l]=I.useState(""),[d,m]=I.useState(!1),h=I.useRef(null);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[0]=f):f=e[0];const v=I.useRef(f),[b,_]=I.useState(null),{org:y}=Se(),x=Nt(),p=n??x,{isModelAllowed:E,allowAll:w,hasConnectionModels:C}=Js();let g;e[1]!==p||e[2]!==w||e[3]!==C?(g=w?p:p.filter(q=>C(q.id)),e[1]=p,e[2]=w,e[3]=C,e[4]=g):g=e[4];const N=g,[A,O]=I.useState(s?.connectionId??N[0]?.id??null);let k,U;e[5]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{setTimeout(()=>{h.current?.focus()},0)},U=[],e[5]=k,e[6]=U):(k=e[5],U=e[6]),I.useEffect(k,U);let z;e[7]===Symbol.for("react.memo_cache_sentinel")?(z=q=>{O(q),o(null)},e[7]=z):z=e[7];const ve=z;let Ee;e[8]!==r||e[9]!==a||e[10]!==A?(Ee=q=>{A&&(a({id:q.id,connectionId:A,provider:q.provider??void 0,capabilities:q.capabilities,limits:q.limits??void 0}),l(""),r())},e[8]=r,e[9]=a,e[10]=A,e[11]=Ee):Ee=e[11];const Pe=Ee;let F;e[12]===Symbol.for("react.memo_cache_sentinel")?(F=u.jsx(gs,{size:16,className:"text-muted-foreground shrink-0"}),e[12]=F):F=e[12];const ne=d?"Search all models...":"Search for a model...";let Ie;e[13]===Symbol.for("react.memo_cache_sentinel")?(Ie=q=>l(q.target.value),e[13]=Ie):Ie=e[13];let ie;e[14]!==c||e[15]!==ne?(ie=u.jsx(ka,{ref:h,type:"text",placeholder:ne,value:c,onChange:Ie,className:"flex-1 border-0 shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"}),e[14]=c,e[15]=ne,e[16]=ie):ie=e[16];let te;e[17]!==N||e[18]!==A?(te=N.length>0&&u.jsxs($a,{value:A??"",onValueChange:ve,children:[u.jsxs(La,{size:"sm",className:"w-auto min-w-[140px] h-8 shrink-0 [&>svg:last-child]:hidden",onClick:So,children:[u.jsx(Za,{placeholder:"Select connection"}),u.jsx(vs,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),u.jsx(Fa,{children:N.map(bo)})]}),e[17]=N,e[18]=A,e[19]=te):te=e[19];let le;e[20]!==ie||e[21]!==te?(le=u.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:u.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 cursor-text",children:[F,ie,te]})}),e[20]=ie,e[21]=te,e[22]=le):le=e[22];let H;e[23]!==y.slug||e[24]!==A?(H=q=>{const{error:rt,resetError:nt}=q;return u.jsx(po,{error:rt,onRetry:nt,connectionId:A,orgSlug:y.slug})},e[23]=y.slug,e[24]=A,e[25]=H):H=e[25];let we;e[26]===Symbol.for("react.memo_cache_sentinel")?(we=u.jsx(mo,{}),e[26]=we):we=e[26];let Ne;e[27]===Symbol.for("react.memo_cache_sentinel")?(Ne=()=>m(xo),e[27]=Ne):Ne=e[27];let ce;e[28]!==w||e[29]!==Pe||e[30]!==E||e[31]!==d||e[32]!==c||e[33]!==A||e[34]!==s?(ce=u.jsx(I.Suspense,{fallback:we,children:u.jsx(ho,{connectionId:A,allowAll:w,isModelAllowed:E,searchTerm:c,selectedModel:s,onModelSelect:Pe,onHover:o,managing:d,onToggleManage:Ne,allModelsRef:v,onSelectedModelResolved:_})}),e[28]=w,e[29]=Pe,e[30]=E,e[31]=d,e[32]=c,e[33]=A,e[34]=s,e[35]=ce):ce=e[35];let ue;e[36]!==A||e[37]!==H||e[38]!==ce?(ue=u.jsx(_t,{fallback:H,children:ce},A),e[36]=A,e[37]=H,e[38]=ce,e[39]=ue):ue=e[39];let de;e[40]!==d?(de=!d&&u.jsx("div",{className:"border-t border-border",children:u.jsxs("button",{type:"button",onClick:()=>m(!0),className:"flex items-center gap-2 w-full px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[u.jsx(Tt,{className:"size-3.5 shrink-0"}),"Manage models"]})}),e[40]=d,e[41]=de):de=e[41];let se;e[42]!==le||e[43]!==ue||e[44]!==de?(se=u.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px]",children:[le,ue,de]}),e[42]=le,e[43]=ue,e[44]=de,e[45]=se):se=e[45];const De=i??b;let pe;e[46]!==De?(pe=u.jsx("div",{className:"hidden md:flex md:flex-col md:w-[320px] md:shrink-0 p-3",children:u.jsx(co,{model:De})}),e[46]=De,e[47]=pe):pe=e[47];let Ce;return e[48]!==se||e[49]!==pe?(Ce=u.jsxs("div",{className:"flex flex-col md:flex-row h-[460px]",children:[se,pe]}),e[48]=se,e[49]=pe,e[50]=Ce):Ce=e[50],Ce}function xo(t){return!t}function bo(t){return u.jsx(Ua,{value:t.id,children:u.jsxs("div",{className:"flex items-center gap-2",children:[t.icon?u.jsx("img",{src:t.icon,alt:t.title,className:"w-4 h-4 rounded"}):u.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:t.title.slice(0,1).toUpperCase()}),u.jsx("span",{children:t.title})]})},t.id)}function So(t){return t.stopPropagation()}function _o(t){const e=Z.c(6),{selectedModel:s,placeholder:a}=t,r=s?.connectionId??void 0,n=kt(r);let i;e[0]!==n||e[1]!==s?(i=s?n.find(l=>l.id===s.thinking.id):void 0,e[0]=n,e[1]=s,e[2]=i):i=e[2];const o=i;let c;return e[3]!==o||e[4]!==a?(c=u.jsx(Rt,{model:o,placeholder:a}),e[3]=o,e[4]=a,e[5]=c):c=e[5],c}function Eo(t){const e=Z.c(9),{selectedModel:s,placeholder:a}=t;if(!s){let d;return e[0]!==a?(d=u.jsx(Rt,{model:void 0,placeholder:a}),e[0]=a,e[1]=d):d=e[1],d}const r=s.thinking.id;let n;e[2]!==r?(n=r.split("/").pop()??r,e[2]=r,e[3]=n):n=e[3];const i=n;let o;e[4]!==i?(o=u.jsx("span",{className:"text-sm text-muted-foreground truncate whitespace-nowrap hidden md:inline",children:i}),e[4]=i,e[5]=o):o=e[5];let c;e[6]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(ft,{size:14,className:"text-muted-foreground opacity-50 shrink-0 hidden md:inline"}),e[6]=c):c=e[6];let l;return e[7]!==o?(l=u.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[o,c]}),e[7]=o,e[8]=l):l=e[8],l}function Ni(t){const e=Z.c(32),{selectedModel:s,onModelChange:a,modelsConnections:r,variant:n,className:i,placeholder:o}=t,c=n===void 0?"borderless":n,l=o===void 0?"Select model":o,[d,m]=I.useState(!1),h=Nt(),f=r??h;if(f.length===0)return null;const v=c==="borderless"?"ghost":"outline",b=c==="borderless"&&"md:border-none";let _;e[0]!==i||e[1]!==b?(_=Ue("text-sm hover:bg-accent rounded-lg py-0.5 px-1 gap-1 shadow-none cursor-pointer border-0 group focus-visible:ring-0 focus-visible:ring-offset-0 min-w-0 shrink justify-start overflow-hidden",b,i),e[0]=i,e[1]=b,e[2]=_):_=e[2];let y;e[3]!==l||e[4]!==s?(y=u.jsx(Eo,{selectedModel:s,placeholder:l}),e[3]=l,e[4]=s,e[5]=y):y=e[5];let x;e[6]!==l?(x=u.jsx(Rt,{model:void 0,placeholder:l}),e[6]=l,e[7]=x):x=e[7];let p;e[8]!==l||e[9]!==s?(p=u.jsx(_o,{selectedModel:s,placeholder:l}),e[8]=l,e[9]=s,e[10]=p):p=e[10];let E;e[11]!==x||e[12]!==p?(E=u.jsx(I.Suspense,{fallback:x,children:p}),e[11]=x,e[12]=p,e[13]=E):E=e[13];let w;e[14]!==y||e[15]!==E?(w=u.jsx(_t,{fallback:y,children:E}),e[14]=y,e[15]=E,e[16]=w):w=e[16];let C;e[17]!==w||e[18]!==v||e[19]!==_?(C=u.jsx(Ra,{asChild:!0,children:u.jsx(Ke,{variant:v,size:"sm",className:_,children:w})}),e[17]=w,e[18]=v,e[19]=_,e[20]=C):C=e[20];let g;e[21]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx(Oa,{className:"sr-only",children:"Select model"}),e[21]=g):g=e[21];let N;e[22]===Symbol.for("react.memo_cache_sentinel")?(N=u.jsx(go,{}),e[22]=N):N=e[22];let A;e[23]===Symbol.for("react.memo_cache_sentinel")?(A=()=>m(!1),e[23]=A):A=e[23];let O;e[24]!==f||e[25]!==a||e[26]!==s?(O=u.jsxs(Pa,{className:"p-0 gap-0 sm:max-w-fit overflow-hidden",closeButtonClassName:"top-3.5 right-3.5 z-20",children:[g,u.jsx(I.Suspense,{fallback:N,children:u.jsx(yo,{selectedModel:s,onModelChange:a,onClose:A,modelsConnections:f})})]}),e[24]=f,e[25]=a,e[26]=s,e[27]=O):O=e[27];let k;return e[28]!==d||e[29]!==C||e[30]!==O?(k=u.jsxs(Da,{open:d,onOpenChange:m,children:[C,O]}),e[28]=d,e[29]=C,e[30]=O,e[31]=k):k=e[31],k}function Io(){const t=Z.c(2),e=tt();let s;return t[0]!==e?(s={prefillCollectionCache:(r,n,i,o)=>{if(!r)return;const c=At(r,n,i,o);if(e.getQueryData(c))return;const d={structuredContent:{items:[]},isError:!1};e.setQueryData(c,d)}},t[0]=e,t[1]=s):s=t[1],s}const oe={TASK_MESSAGES_PAGE_SIZE:100,TASKS_PAGE_SIZE:50,QUERY_STALE_TIME:3e4};function mt(t,e,s,a){const r=_e.tasks(e),n=t.getQueryData(r);if(!n)return;const i=n.pages.map(c=>{const l=c.items.findIndex(f=>f.id===s);if(l===-1)return c;const d=[...c.items],m=d[l];if(!m)return c;const h={id:m.id,title:a.title??m.title,created_at:m.created_at,updated_at:a.updated_at??m.updated_at,hidden:a.hidden??m.hidden,status:a.status??m.status};return d[l]=h,{...c,items:d}});i.some((c,l)=>c.items.length!==n.pages[l]?.items.length||c.items.some((d,m)=>d.id===s&&d!==n.pages[l]?.items[m]))&&t.setQueryData(r,{...n,pages:i})}function wo(t,e,s){const a=_e.tasks(e),r=t.getQueryData(a);if(!r){t.setQueryData(a,{pages:[{items:[s],hasMore:!1,totalCount:1}],pageParams:[0]});return}if(r.pages.some(o=>o.items.some(c=>c.id===s.id)))return;const i=r.pages[0];if(i){const o={...i,items:[s,...i.items],totalCount:(i.totalCount??i.items.length)+1};t.setQueryData(a,{...r,pages:[o,...r.pages.slice(1)]})}else t.setQueryData(a,{...r,pages:[{items:[s],hasMore:!1,totalCount:1}]})}async function No(t,e,s,a){if(!e)return;const r=At(e,"THREAD_MESSAGES",s,{filters:[{column:"thread_id",value:a}],pageSize:oe.TASK_MESSAGES_PAGE_SIZE});if(!r||t.getQueryData(r))return;const i="COLLECTION_THREAD_MESSAGES_LIST",o=Wa(void 0,[{column:"thread_id",value:a}],[]),c=Ja(void 0,void 0,"updated_at"),l={...o&&{where:o},...c&&{orderBy:c},limit:oe.TASK_MESSAGES_PAGE_SIZE,offset:0};await t.fetchQuery({queryKey:r,queryFn:async()=>await e.callTool({name:i,arguments:l}),staleTime:oe.QUERY_STALE_TIME,retry:!1})}function Co(t,e,s,a,r){if(!e)return;const n=At(e,"THREAD_MESSAGES",s,{filters:[{column:"thread_id",value:a}],pageSize:oe.TASK_MESSAGES_PAGE_SIZE});n&&t.setQueryData(n,{structuredContent:{items:r},isError:!1})}async function ps(t,e,s){if(!t)throw new Error("MCP client is not available");const a=await t.callTool({name:"COLLECTION_THREADS_UPDATE",arguments:{id:e,data:s}});return(a.structuredContent??a).item}function To(t){const e=new Date().toISOString();return{id:t,title:"New chat",created_at:e,updated_at:e}}function Ao(t,e){return t.find(s=>s.id!==e)??null}function Mo(){const t=Z.c(17),{locator:e,org:s}=Se();let a;t[0]!==s.id?(a={connectionId:wt,orgId:s.id},t[0]=s.id,t[1]=a):a=t[1];const r=It(a);let n;t[2]!==e?(n=_e.tasks(e),t[2]=e,t[3]=n):n=t[3];let i;t[4]!==r?(i=async _=>{const{pageParam:y}=_,x=y===void 0?0:y;if(!r)throw new Error("MCP client is not available");const p={limit:oe.TASKS_PAGE_SIZE,offset:x},E=await r.callTool({name:"COLLECTION_THREADS_LIST",arguments:p}),w=E.structuredContent??E;return{items:w.items??[],hasMore:w.hasMore??!1,totalCount:w.totalCount}},t[4]=r,t[5]=i):i=t[5];let o;t[6]!==n||t[7]!==i?(o={queryKey:n,queryFn:i,getNextPageParam:ko,initialPageParam:0,staleTime:oe.QUERY_STALE_TIME},t[6]=n,t[7]=i,t[8]=o):o=t[8];const{data:c,fetchNextPage:l,hasNextPage:d,isFetchingNextPage:m,refetch:h}=Ga(o);let f;t[9]!==c?.pages?(f=c?.pages.flatMap(jo)??[],t[9]=c?.pages,t[10]=f):f=t[10];const v=f;let b;return t[11]!==l||t[12]!==d||t[13]!==m||t[14]!==h||t[15]!==v?(b={tasks:v,refetch:h,hasNextPage:d,isFetchingNextPage:m,fetchNextPage:l},t[11]=l,t[12]=d,t[13]=m,t[14]=h,t[15]=v,t[16]=b):b=t[16],b}function jo(t){return t.items}function ko(t,e){if(t.hasMore)return e.length*oe.TASKS_PAGE_SIZE}function Ro(t){const e=Z.c(6),{org:s}=Se();let a;e[0]!==s.id?(a={connectionId:wt,orgId:s.id},e[0]=s.id,e[1]=a):a=e[1];const r=It(a);let n;e[2]!==t?(n={filters:t?[{column:"thread_id",value:t}]:[],pageSize:oe.TASK_MESSAGES_PAGE_SIZE},e[2]=t,e[3]=n):n=e[3];const i=Ha(s.id,"THREAD_MESSAGES",r,n);let o;return e[4]!==i?(o=i??[],e[4]=i,e[5]=o):o=e[5],o}function Oo(){const{locator:t,org:e}=Se(),s=tt(),{prefillCollectionCache:a}=Io(),{tasks:r,hasNextPage:n,isFetchingNextPage:i,fetchNextPage:o}=Mo(),c=It({connectionId:wt,orgId:e.id}),[l,d]=Xe(Ct.assistantChatActiveTask(t),r[0]?.id??crypto.randomUUID()),m=Ro(l),h=()=>{const x=crypto.randomUUID(),p=To(x);wo(s,t,p),c&&a(c,"THREAD_MESSAGES",e.id,{filters:[{column:"thread_id",value:x}],pageSize:oe.TASK_MESSAGES_PAGE_SIZE}),d(x)},f=async x=>{await No(s,c,e.id,x),d(x)};return{tasks:r,activeTaskId:l,messages:m,hasNextPage:n,isFetchingNextPage:i,fetchNextPage:o,createTask:h,switchToTask:f,updateTask:(x,p)=>{mt(s,t,x,p)},renameTask:async(x,p)=>{try{const E=await ps(c,x,{title:p});E&&mt(s,t,x,{title:p,updated_at:E.updated_at??new Date().toISOString()})}catch(E){const w=E;ke.error(`Failed to rename task: ${w.message}`),console.error("[chat] Failed to rename task:",E)}},hideTask:async x=>{try{const p=await ps(c,x,{hidden:!0});if(p){if(x===l){const w=Ao(r,x);w?await f(w.id):h()}mt(s,t,x,{hidden:!0,updated_at:p.updated_at??new Date().toISOString()})}}catch(p){const E=p;ke.error(`Failed to update task: ${E.message}`),console.error("[chat] Failed to update task:",p)}},updateMessagesCache:(x,p)=>{Co(s,c,e.id,x,p)}}}const Ys={parentTask:null,finishReason:null};function Po(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 Ys;default:return t}}const Do=(t,e)=>new qs({api:`/api/${t}/decopilot/stream`,credentials:"include",prepareReconnectToStreamRequest:({id:s})=>({api:`/api/${t}/decopilot/attach/${s}`}),prepareSendMessagesRequest:({messages:s,requestMetadata:a={}})=>{const{system:r,tiptapDoc:n,...i}=a,o=r?{id:crypto.randomUUID(),role:"system",parts:[{type:"text",text:r}]}:null,c=s.slice(-1).filter(Boolean),l=o?[o,...c]:c,d=s.at(-1)?.metadata??{},m={...i,agent:i.agent??d.agent,models:i.models??d.models,thread_id:i.thread_id??d.thread_id};return{body:{messages:l,...m,...e.current&&{toolApprovalLevel:e.current}}}}}),$o=(t,e)=>t?.find(s=>s.id===e)??t?.[0]??null,Lo=(t,e)=>{const s=Z.c(11);let a;s[0]!==t?(a=Ct.chatSelectedModel(t),s[0]=t,s[1]=a):a=s[1];const[r,n]=Xe(a,null),i=r?.connectionId;let o;s[2]!==e||s[3]!==i?(o=$o(e,i),s[2]=e,s[3]=i,s[4]=o):o=s[4];const c=o;let l;s[5]!==r||s[6]!==c?(l=r&&c?{connectionId:c.id,thinking:{id:r.id,provider:r.provider,capabilities:r.capabilities?{vision:r.capabilities.includes("vision")?!0:void 0,text:r.capabilities.includes("text")?!0:void 0,tools:r.capabilities.includes("tools")?!0:void 0}:void 0,limits:r.limits}}:null,s[5]=r,s[6]=c,s[7]=l):l=s[7];const d=l;let m;return s[8]!==d||s[9]!==n?(m=[d,n],s[8]=d,s[9]=n,s[10]=m):m=s[10],m};function Zo(t,e){const s=[];for(const a of t)"text"in a&&a.text?s.push({type:"text",text:`[${e}]
|
|
20
|
+
${a.text}`}):"blob"in a&&a.blob&&a.mimeType&&s.push({type:"file",url:`data:${a.mimeType};base64,${a.blob}`,filename:String(a.uri),mediaType:String(a.mimeType)});return s}function Fo(t,e){const s=[];for(const a of t){if(a.role!=="user"||!a.content)continue;const r=Array.isArray(a.content)?a.content:[a.content];for(const n of r)switch(n.type){case"text":{const i=n.text?.trim();if(!i)continue;s.push({type:"text",text:`[${e}]
|
|
21
|
+
${i}`});break}case"image":case"audio":{if(!n.data||!n.mimeType)continue;s.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?s.push({type:"text",text:`[${e}]
|
|
22
|
+
${i.text}`}):"blob"in i&&i.blob&&i.mimeType&&s.push({type:"file",url:`data:${i.mimeType};base64,${i.blob}`,filename:String(i.uri),mediaType:String(i.mimeType)}));break}}}return s}function Uo(t,e){const{mimeType:s,data:a}=t;if(s.startsWith("text/"))try{const r=atob(a);return[{type:"text",text:`${e}
|
|
23
|
+
${r}`}]}catch(r){console.error("Failed to decode text file:",r)}return[{type:"file",url:`data:${s};base64,${a}`,filename:e,mediaType:s}]}function zo(t){if(!t)return[];const e=[];let s="";const a=r=>{if(r){if(r.type==="text"&&"text"in r&&typeof r.text=="string")s+=r.text;else if(r.type==="mention"&&r.attrs){const n=r.attrs.char??"/",i=`${n}${r.attrs.name}`;if(s+=i,n==="@"){const o=r.attrs.metadata||[];e.push(...Zo(o,i))}else{const o=r.attrs.metadata||r.attrs.prompts||[];e.push(...Fo(o,i))}}else if(r.type==="file"&&r.attrs){const n=r.attrs,i=`[file:://${encodeURIComponent(n.name)}]`;s+=i,e.push(...Uo(n,i))}if("content"in r&&Array.isArray(r.content))for(const n of r.content)a(n)}};return a(t),s.trim()&&e.unshift({type:"text",text:s.trim()}),e}const Qs=I.createContext(null),Ks=I.createContext(null);function Bo(t){const e=Z.c(8),{modelsConnections:s,currentConfig:a,onAutoSelect:r,allowAll:n,isModelAllowed:i}=t,o=s[0],c=kt(o?.id);let l,d;return e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==i||e[4]!==c||e[5]!==r?(l=()=>{if(a||!o||c.length===0)return;const m=n?c:c.filter(v=>i(o.id,v.id)),f=m.find(Jo)??m.find(Wo)??m.find(qo)??m.find(Vo)??m[0];f&&r({id:f.id,connectionId:o.id,provider:f.provider??void 0,capabilities:f.capabilities??void 0,limits:f.limits??void 0})},d=[c,a,o,r,n,i],e[0]=n,e[1]=a,e[2]=o,e[3]=i,e[4]=c,e[5]=r,e[6]=l,e[7]=d):(l=e[6],d=e[7]),I.useEffect(l,d),null}function Vo(t){return t.id.includes("claude-sonnet")}function qo(t){return t.id.includes("claude-sonnet-4.6")}function Wo(t){return t.id.includes("claude-opus-4.6")}function Jo(t){return t.id.includes("claude-4.6-opus")}const Ho=3e4,ms=()=>0;function Go(t){const e=Z.c(24),{taskId:s,activeTask:a,isStreaming:r,chatRef:n,queryClient:i,locator:o,orgId:c}=t,l=I.useRef(null),d=I.useRef(0);let m;e[0]!==o||e[1]!==i||e[2]!==s?(m=()=>{i.invalidateQueries({queryKey:_e.tasks(o)}),s&&i.invalidateQueries({predicate:C=>{const g=C.queryKey;return g[3]!=="collection"||g[4]!=="THREAD_MESSAGES"?!1:(typeof g[6]=="string"?g[6]:"").includes(s)}})},e[0]=o,e[1]=i,e[2]=s,e[3]=m):m=e[3];const h=m;let f;e[4]!==n||e[5]!==h||e[6]!==s?(f=C=>{!s||l.current===s||d.current>=3||(l.current=s,console.log(`[chat] resumeStream (${C})`,s),n.current.resumeStream().catch(g=>{console.error("[chat] resumeStream error",g),d.current=d.current+1,l.current=null,h()}))},e[4]=n,e[5]=h,e[6]=s,e[7]=f):f=e[7];const v=f;let b;e[8]!==v?(b=()=>v("sse-step"),e[8]=v,e[9]=b):b=e[9];let _,y;e[10]!==h||e[11]!==r?(_=()=>{l.current=null,d.current=0,r||h()},y=()=>{r||h()},e[10]=h,e[11]=r,e[12]=_,e[13]=y):(_=e[12],y=e[13]);let x;e[14]!==c||e[15]!==b||e[16]!==_||e[17]!==y||e[18]!==s?(x={orgId:c,taskId:s,onStep:b,onFinish:_,onTaskStatus:y},e[14]=c,e[15]=b,e[16]=_,e[17]=y,e[18]=s,e[19]=x):x=e[19],Bn(x);const p=(a?.status==="in_progress"||a?.status==="expired")&&!r;let E;e[20]!==h||e[21]!==p||e[22]!==v?(E=C=>{if(!p)return Yo;v("page-load");const g=setInterval(()=>h(),Ho);return()=>clearInterval(g)},e[20]=h,e[21]=p,e[22]=v,e[23]=E):E=e[23];const w=E;return I.useSyncExternalStore(w,ms,ms),null}function Yo(){}function Ci({children:t}){const{locator:e,org:s}=Se(),a=tt(),r=Oo(),{data:n}=ya.useSession(),i=n?.user??null,[o]=Ma(),[c,l]=I.useReducer(Po,Ys),d=I.useRef(void 0),m=I.useRef(o.toolApprovalLevel);m.current=o.toolApprovalLevel;const h=Ca(),[f,v]=Xe(`${e}:selected-virtual-mcp-id`,null),b=Nt(),{hasConnectionModels:_,isModelAllowed:y,allowAll:x}=Js(),p=b.filter(R=>_(R.id)),[E,w]=Lo(e,p),[C,g]=Xe(Ct.chatSelectedMode(e),"code_execution"),N=r.messages,A=Vn(f),O=qn(),{showNotification:k}=Wn(),U=f?h.find(R=>R.id===f)??null:null,z=Na(s.id).id,ve=Do(s.slug,m),Ee=async({finishReason:R,isAbort:B,isDisconnect:K,isError:ot,message:it,messages:He})=>{l({type:"SET_FINISH_REASON",payload:R??null});const Te=it.metadata?.thread_id??r.activeTaskId;if(B||K||ot){Te&&He.length>0&&r.updateMessagesCache(Te,He);return}Te&&(He.length>0&&r.updateMessagesCache(Te,He),o.enableNotifications&&k({tag:`chat-${Te}`,title:"Decopilot is waiting for your input at",body:r.tasks.find(na=>na.id===Te)?.title??"New chat"}))},Pe=R=>{console.error("[chat] Error",R)},F=Fn({id:r.activeTaskId,messages:N,transport:ve,sendAutomaticallyWhen:({messages:R})=>On({messages:R})||Rn({messages:R}),onFinish:Ee,onToolCall:O,onError:Pe,onData:({data:R,type:B})=>{if(B==="data-thread-title"){const{title:K}=R;if(!K)return;r.updateTask(r.activeTaskId,{title:K,updated_at:new Date().toISOString()})}}}),ne=F.status==="submitted"||F.status==="streaming",Ie=(()=>{const R=F.messages.at(-1);return!R||R.role!=="assistant"?!1:R.parts.some(B=>"state"in B&&B.state==="approval-requested")})(),ie=F.messages.length===0&&r.messages.length===0,te=r.tasks.find(R=>R.id===r.activeTaskId),le=(te?.status==="in_progress"||te?.status==="expired")&&!ne,H=I.useRef(F);H.current=F;const we=ne?F.messages:r.messages,Ne=()=>{se(),r.createTask()},ce=r.switchToTask,ue=r.renameTask,de=r.hideTask,se=()=>l({type:"RESET"}),De=R=>{v(R)},pe=R=>{w({id:R.id,connectionId:R.connectionId,provider:R.provider,capabilities:R.capabilities,limits:R.limits})},Ce=async R=>{if(!E){ke.error("No model configured");return}const B=zo(R);if(B.length===0)return;r.messages.length>0&&H.current.setMessages(r.messages),se();const K={tiptapDoc:R,created_at:new Date().toISOString(),thread_id:r.activeTaskId,agent:{id:U?.id??z,mode:C},user:{avatar:i?.image??void 0,name:i?.name??"you"}},ot={...K,system:A,models:E},it={id:crypto.randomUUID(),role:"user",parts:B,metadata:K};await H.current.sendMessage(it,{metadata:ot})},q=async()=>{const R=r.activeTaskId;if(R){H.current.messages.length>0&&r.updateMessagesCache(R,H.current.messages),H.current.stop();try{const B=await fetch(`/api/${s.slug}/decopilot/cancel/${R}`,{method:"POST",credentials:"include"});if(!B.ok){const K=await B.json().catch(()=>({}));throw new Error(K.message??`Cancel failed: ${B.status}`)}await a.invalidateQueries({queryKey:_e.tasks(e)})}catch(B){const K=B instanceof Error?B.message:"Failed to cancel";ke.error(K),console.error("[chat] cancelRun",B)}}},rt=()=>{ne&&q(),F.stop()},nt=()=>(rt(),Promise.resolve()),ta=()=>l({type:"CLEAR_FINISH_REASON"}),sa=I.useDeferredValue(we),aa={tiptapDocRef:d,resetInteraction:se,activeTaskId:r.activeTaskId,tasks:r.tasks,createTask:Ne,switchToTask:ce,renameTask:ue,hideTask:de,hasNextPage:r.hasNextPage,isFetchingNextPage:r.isFetchingNextPage,fetchNextPage:r.fetchNextPage,virtualMcps:h,selectedVirtualMcp:U,setVirtualMcpId:De,modelsConnections:p,selectedModel:E,setSelectedModel:pe,selectedMode:C,setSelectedMode:g,sendMessage:Ce,cancelRun:q},ra={messages:sa,status:F.status,setMessages:F.setMessages,error:F.error,clearError:F.clearError,stop:nt,addToolOutput:F.addToolOutput,addToolApprovalResponse:F.addToolApprovalResponse,isStreaming:ne,isChatEmpty:ie,finishReason:c.finishReason,clearFinishReason:ta,isWaitingForApprovals:Ie,isRunInProgress:le};return u.jsx(Qs.Provider,{value:aa,children:u.jsxs(Ks.Provider,{value:ra,children:[u.jsx(_t,{fallback:null,children:u.jsxs(I.Suspense,{fallback:null,children:[u.jsx(Bo,{modelsConnections:p,currentConfig:E,onAutoSelect:w,allowAll:x,isModelAllowed:y}),u.jsx(Go,{taskId:r.activeTaskId,activeTask:te,isStreaming:ne,chatRef:H,queryClient:a,locator:e,orgId:s.id},r.activeTaskId)]})}),t]})})}function Qo(){const t=I.useContext(Qs);if(!t)throw new Error("useChatStable must be used within a ChatProvider");return t}function Ko(){const t=I.useContext(Ks);if(!t)throw new Error("useChatStream must be used within a ChatProvider");return t}function Ti(){const t=Z.c(3),e=Qo(),s=Ko();let a;return t[0]!==e||t[1]!==s?(a={...e,...s},t[0]=e,t[1]=s,t[2]=a):a=t[2],a}var at="Collapsible",[Xo,Ai]=_a(at),[ei,Ot]=Xo(at),Xs=I.forwardRef((t,e)=>{const{__scopeCollapsible:s,open:a,defaultOpen:r,disabled:n,onOpenChange:i,...o}=t,[c,l]=xa({prop:a,defaultProp:r??!1,onChange:i,caller:at});return u.jsx(ei,{scope:s,disabled:n,contentId:ba(),open:c,onOpenToggle:I.useCallback(()=>l(d=>!d),[l]),children:u.jsx(Et.div,{"data-state":Lt(c),"data-disabled":n?"":void 0,...o,ref:e})})});Xs.displayName=at;var ea="CollapsibleTrigger",Pt=I.forwardRef((t,e)=>{const{__scopeCollapsible:s,...a}=t,r=Ot(ea,s);return u.jsx(Et.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":Lt(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...a,ref:e,onClick:Sa(t.onClick,r.onOpenToggle)})});Pt.displayName=ea;var Dt="CollapsibleContent",$t=I.forwardRef((t,e)=>{const{forceMount:s,...a}=t,r=Ot(Dt,t.__scopeCollapsible);return u.jsx(Ea,{present:s||r.open,children:({present:n})=>u.jsx(ti,{...a,ref:e,present:n})})});$t.displayName=Dt;var ti=I.forwardRef((t,e)=>{const{__scopeCollapsible:s,present:a,children:r,...n}=t,i=Ot(Dt,s),[o,c]=I.useState(a),l=I.useRef(null),d=Ia(e,l),m=I.useRef(0),h=m.current,f=I.useRef(0),v=f.current,b=i.open||o,_=I.useRef(b),y=I.useRef(void 0);return I.useEffect(()=>{const x=requestAnimationFrame(()=>_.current=!1);return()=>cancelAnimationFrame(x)},[]),wa(()=>{const x=l.current;if(x){y.current=y.current||{transitionDuration:x.style.transitionDuration,animationName:x.style.animationName},x.style.transitionDuration="0s",x.style.animationName="none";const p=x.getBoundingClientRect();m.current=p.height,f.current=p.width,_.current||(x.style.transitionDuration=y.current.transitionDuration,x.style.animationName=y.current.animationName),c(a)}},[i.open,a]),u.jsx(Et.div,{"data-state":Lt(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!b,...n,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...t.style},children:b&&r})});function Lt(t){return t?"open":"closed"}var si=Xs,Mi=Pt,ji=$t;function ki(t){const e=Z.c(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let a;return e[2]!==s?(a=u.jsx(si,{"data-slot":"collapsible",...s}),e[2]=s,e[3]=a):a=e[3],a}function Ri(t){const e=Z.c(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let a;return e[2]!==s?(a=u.jsx(Pt,{"data-slot":"collapsible-trigger",...s}),e[2]=s,e[3]=a):a=e[3],a}function Oi(t){const e=Z.c(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let a;return e[2]!==s?(a=u.jsx($t,{"data-slot":"collapsible-content",...s}),e[2]=s,e[3]=a):a=e[3],a}export{ki as C,Ni as M,si as R,Mi as T,Ti as a,xs as b,Qa as c,Ri as d,vs as e,Oi as f,ji as g,Ai as h,Ya as i,Un as j,Ci as k,wi as m,ys as t,Qo as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b9 as re,r as k,o as Qs,s as Et,c as N,j as o,E as $n,u as Z,l as Ys,v as R,z as eo,e as pe,a as to,aD as Ye,O as et,B as X,t as On,bF as K,cf as no,cg as so,aU as oo,H as Ht,M as de,T as Rn,aV as ro,G as Vt,aW as io,aX as An,I as Mn,aY as lo,aZ as co,U as Pn,a$ as ao,ch as Ut,ci as uo,aH as fo,bD as mo,D as po,n as xo,cj as ho,ck as go,cl as Ln}from"./index-DTgZok4N.js";import{E as Dn}from"./collection-search-Bkt-jVWx.js";import{d as Bt,u as qt,f as dt,h as bo}from"./use-connection-Du5eRm0t.js";import{u as ie,g as Ue,i as jo}from"./constants-2Gp-yGJ1.js";import{F as Tt,a as vo,b as Kt,d as Jt}from"./form-DNs_mLgF.js";import{I as Gt}from"./input-CjsuYubG.js";import{T as Lt}from"./textarea-Cp-ThsnH.js";import{V as zn,b as Wn,a as he}from"./layout-K29HidGl.js";import{S as Fn}from"./save-actions-BGfSClkF.js";import{M as So}from"./mcp-app-renderer-D2qbe9d6.js";import{g as yo,M as gn}from"./types-DeMEWRHV.js";import{S as Hn,a as Vn,b as Un,c as Bn,d as tt}from"./select-CwGh16En.js";import{c as Xt,T as nt,a as st,b as ot}from"./tooltip-B2vpv_WH.js";import{i as wo}from"./AlertCircle-C_-Exi_n.js";import{s as No}from"./Clock-CGeVATg-.js";import{i as bn}from"./Code01-X9LTEq8d.js";import{a as Co}from"./Copy01-yMwUMo5Y.js";import{s as ko}from"./LayersTwo01-BFhpnCtq.js";import{i as ut}from"./Loading01-SjZGs3Wk.js";import{i as Zt}from"./Play-CKKDGI7M.js";import{B as qn,a as Kn,b as Pe,d as rt,e as it,c as Jn}from"./breadcrumb-CkhUU1qO.js";import{u as Io,O as _o,M as Eo,F as To,v as $o}from"./index-C_SwSaaG.js";import{d as Qt,b as Yt,a as en}from"./use-mcp-tools-v3YYc4L1.js";import{I as ft}from"./integration-icon-BqSOA-1d.js";import{a as Oo}from"./tools-list-BYhjzTws.js";import{M as Le,n as Ro,S as Ao,a as Mo}from"./scroll-area-CiqOJ4_4.js";import{E as tn}from"./empty-state-DE4SQU5S.js";import{n as Po}from"./Container-Dt3fts2O.js";import{b as Gn}from"./use-virtual-mcp-CS7dIIbK.js";import{b as Lo,R as jn,a as Do}from"./resizable-BotMD0Ea.js";import{B as me}from"./badge-BZU2aZ4g.js";import{S as mt}from"./spinner-CF1sqMoC.js";import{V as zo}from"./collection-table-wrapper-c85b97QJ.js";import{N as Wo,S as Fo,a as Ho,c as Vo,m as Xe,P as Uo,i as Bo,R as qo,u as Ko,b as Jo,d as vn,E as Go,e as Xo}from"./index-Gr3qtElA.js";import{a as Zo}from"./use-binding-CXeaDqWF.js";import{b as Qo,c as Yo,d as er,e as tr,a as nr,D as sr}from"./dialog-BeE7uUPn.js";import"./index--9MdKIVD.js";import{s as Xn}from"./Plus-DXYydVCi.js";import{i as pt}from"./Check-AlxQ-j2G.js";import{i as or}from"./DotsHorizontal-rnia2dDb.js";import{b as rr,T as ir,R as lr,g as cr,h as Zn,j as ar}from"./collapsible-Bqyw5z5a.js";import{s as nn}from"./XClose-B0OIa3qG.js";import{D as dr,a as ur,b as fr,c as Sn}from"./dropdown-menu-B0Dgts11.js";import{i as mr}from"./ChevronRight-sqD7LMFa.js";import{i as Qn}from"./X-BHBlYu74.js";import"./SearchMd-CSKcblxx.js";import"./useMutation-B99hCaMl.js";import"./label-ND6ncjGS.js";import"./index-BMtw0aq_.js";import"./localstorage-keys-Cenhbz-P.js";import"./useQuery-C-DbMOQt.js";import"./Save01-w3vLU2XF.js";import"./use-mcp-resources-Bf8HKw75.js";import"./index-BG6VshDR.js";import"./ChevronDown-Bt1ewsqh.js";import"./mcp-oauth-BGy49NaP.js";import"./File06-B5xn-On2.js";import"./Key01-CqhHrRJL.js";import"./constants-DTNMmCfY.js";import"./registry-utils-BFXjOPvi.js";import"./extract-connection-data-0trSaHAT.js";import"./github-icon-Dp3wHhYE.js";import"./generate-id-Dyweu44Y.js";import"./use-install-from-registry-D98zOCZs.js";import"./circle-alert-D5aKQND0.js";import"./index-C6fMaWPS.js";import"./index-eYcb2Cm9.js";import"./card-BiGYvdPr.js";import"./Eye-D5VDCdLP.js";import"./Globe02-DsDY7_VG.js";import"./ArrowDown-Ci69NI9T.js";import"./ArrowUp-YaPl1lq-.js";import"./Grid01-C3osH3dx.js";import"./List-iHNJ390y.js";import"./table-CZRzSdcB.js";import"./popover-C2X8YaiC.js";import"./skeleton-DZ7Qc_fE.js";import"./decopilot-events-DlkvGkzj.js";import"./usage-B8eRkRZY.js";import"./Edit01-Cg13Y9IR.js";import"./Users03-BXHamAas.js";import"./XCircle-Bm1DtLmf.js";import"./tabs-DkvkxCCI.js";import"./ArrowLeft-DiQ6H1qe.js";import"./use-copy-5Xu6yo2D.js";import"./use-create-virtual-mcp-EqzJGE7y.js";import"./marked.esm-BaswSlok.js";import"./markdown-DI_NQ3zj.js";import"./Trash01-CDDpTvNv.js";import"./binder-CXy7pGaI.js";import"./use-llm-B4rO8f2r.js";import"./checkbox-DaiL5KlM.js";import"./AlignLeft-DU7XXs04.js";import"./Image01-Dk65YqxA.js";import"./RefreshCcw01-DT9wSPl_.js";import"./Settings01-Dkx2ZoN9.js";import"./useSuspenseInfiniteQuery-CX_HgzHm.js";import"./infiniteQueryObserver-Dy7IOO2y.js";const Yn=re("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);const es=re("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);const sn=re("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const on=re("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const pr=re("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const xr=re("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const hr=re("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const ts=re("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const ns=re("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);const ss=re("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);const gr=re("OctagonAlert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]);const os=re("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);const rs=re("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]),rn=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M12 8v4m0 4h.01M2 8.523v6.954c0 .245 0 .367.028.482a1 1 0 0 0 .12.29c.061.1.148.187.32.36l4.923 4.922c.173.173.26.26.36.322.09.054.188.095.29.12.115.027.237.027.482.027h6.954c.245 0 .367 0 .482-.028a.998.998 0 0 0 .29-.12c.1-.061.187-.148.36-.32l4.922-4.923c.173-.173.26-.26.322-.36a.998.998 0 0 0 .12-.29c.027-.115.027-.237.027-.482V8.523c0-.245 0-.367-.028-.482a.998.998 0 0 0-.12-.29c-.061-.1-.148-.187-.32-.36L16.608 2.47c-.173-.173-.26-.26-.36-.322a1 1 0 0 0-.29-.12C15.844 2 15.722 2 15.477 2H8.523c-.245 0-.367 0-.482.028a1 1 0 0 0-.29.12c-.1.061-.187.148-.36.32L2.47 7.392c-.173.173-.26.26-.322.36a1 1 0 0 0-.12.29C2 8.156 2 8.278 2 8.523Z"}));rn.displayName="AlertOctagon";const is=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M20.5 8v8.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.22 21 17.38 21 15.7 21H8.3c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3.5 18.72 3.5 17.88 3.5 16.2V8m.1-5h16.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C22 3.76 22 4.04 22 4.6v1.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C21.24 8 20.96 8 20.4 8H3.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C2 7.24 2 6.96 2 6.4V4.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C2.76 3 3.04 3 3.6 3Zm6 8.5h4.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C16 12.26 16 12.54 16 13.1v.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437c-.214.109-.494.109-1.054.109H9.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C8 14.74 8 14.46 8 13.9v-.8c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C8.76 11.5 9.04 11.5 9.6 11.5Z"}));is.displayName="Box";const ls=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"m22.7 11.5-2 2-2-2m2.245 1.5A9 9 0 1 0 19 17.657M12 7v5l3 2"}));ls.displayName="ClockFastForward";const cs=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"m17 17 5-5-5-5M7 7l-5 5 5 5m7-14-4 18"}));cs.displayName="Code02";const Ze=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M6.8 3h-.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C3 4.52 3 5.08 3 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C4.52 21 5.08 21 6.2 21h.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C10 19.48 10 18.92 10 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C8.48 3 7.92 3 6.8 3Zm11 0h-.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C14 4.52 14 5.08 14 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C15.52 21 16.08 21 17.2 21h.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C21 19.48 21 18.92 21 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C19.48 3 18.92 3 17.8 3Z"}));Ze.displayName="Columns01";const as=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M4 4v1.4c0 3.36 0 5.04.654 6.324a6 6 0 0 0 2.622 2.622C8.56 15 10.24 15 13.6 15H20m0 0-5-5m5 5-5 5"}));as.displayName="CornerDownRight";const ds=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M21 5c0 1.657-4.03 3-9 3S3 6.657 3 5m18 0c0-1.657-4.03-3-9-3S3 3.343 3 5m18 0v14c0 1.66-4 3-9 3s-9-1.34-9-3V5m18 7c0 1.66-4 3-9 3s-9-1.34-9-3"}));ds.displayName="Database01";const us=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M3 3v10.2c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C5.28 18 6.12 18 7.8 18H15m0 0a3 3 0 1 0 6 0 3 3 0 0 0-6 0ZM3 8h12m0 0a3 3 0 1 0 6 0 3 3 0 0 0-6 0Z"}));us.displayName="GitBranch01";const fs=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"m13 22-3-3m0 0 3-3m-3 3h5a7 7 0 0 0 3-13.326M6 18.326A7 7 0 0 1 9 5h5m0 0-3-3m3 3-3 3"}));fs.displayName="Repeat03";const ms=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.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"}),k.createElement("path",{d:"M8 9.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C8.76 8 9.04 8 9.6 8h4.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C16 8.76 16 9.04 16 9.6v4.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C15.24 16 14.96 16 14.4 16H9.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C8 15.24 8 14.96 8 14.4V9.6Z"}));ms.displayName="StopCircle";Qs({title:Et().min(1),description:Et().nullable(),body:Et()});function $t(t){for(const e of t.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function br(){const t=window.location.pathname.split("/").filter(Boolean),e=t.findIndex(s=>s==="mcps"),n=e>=0?t[e+1]:void 0;return n?decodeURIComponent(n):void 0}function jr(t){const e=N.c(13),{form:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"text-sm font-medium text-foreground",children:"Details"}),e[0]=s):s=e[0];let i;e[1]!==n.control?(i=o.jsxs("div",{className:"flex flex-col gap-4",children:[s,o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsx(Tt,{control:n.control,name:"title",render:yr}),o.jsx(Tt,{control:n.control,name:"description",render:Sr})]})]}),e[1]=n.control,e[2]=i):i=e[2];let r,l;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("div",{className:"text-sm font-medium text-foreground",children:"Message"}),l=o.jsx("div",{className:"text-xs text-muted-foreground",children:"This becomes the user message in the prompt."}),e[3]=r,e[4]=l):(r=e[3],l=e[4]);let c;e[5]!==n.control?(c=o.jsxs("div",{className:"flex flex-col gap-2",children:[r,l,o.jsx(Tt,{control:n.control,name:"body",render:vr})]}),e[5]=n.control,e[6]=c):c=e[6];let a;e[7]!==i||e[8]!==c?(a=o.jsxs("div",{className:"h-full py-6 flex flex-col max-w-3xl mx-auto w-full min-w-0 gap-8 overflow-y-auto px-4",children:[i,c]}),e[7]=i,e[8]=c,e[9]=a):a=e[9];let d;return e[10]!==n||e[11]!==a?(d=o.jsx(vo,{...n,children:a}),e[10]=n,e[11]=a,e[12]=d):d=e[12],d}function vr(t){const{field:e}=t;return o.jsx(Kt,{children:o.jsx(Jt,{children:o.jsx(Lt,{...e,value:e.value??"",placeholder:"Write the prompt message…",className:"min-h-[240px] resize-none text-base leading-relaxed font-normal rounded-xl border border-border bg-muted/20 px-4 py-3 shadow-none focus-visible:ring-0"})})})}function Sr(t){const{field:e}=t;return o.jsxs(Kt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),o.jsx(Jt,{children:o.jsx(Gt,{...e,value:e.value??"",placeholder:"Add a description…",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function yr(t){const{field:e}=t;return o.jsxs(Kt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),o.jsx(Jt,{children:o.jsx(Gt,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function wr(t){const e=N.c(35),{providerId:n,promptId:s}=t,{org:i}=Z(),r=n||null;let l;e[0]!==i.id||e[1]!==r?(l={connectionId:r,orgId:i.id},e[0]=i.id,e[1]=r,e[2]=l):l=e[2];const c=ie(l),a=Bt(n,"PROMPT",s,c),d=qt(n,"PROMPT",c),u=d.update.isPending;let f;e[3]!==a?(f=a?{title:a.title,description:a.description??null,body:$t(a)}:void 0,e[3]=a,e[4]=f):f=e[4];let m;e[5]!==f?(m={values:f},e[5]=f,e[6]=m):m=e[6];const x=Ys(m);let p;e[7]!==x||e[8]!==a?(p=()=>{a&&x.reset({title:a.title,description:a.description??null,body:$t(a)})},e[7]=x,e[8]=a,e[9]=p):p=e[9];const h=p;let g;e[10]!==d.update||e[11]!==x||e[12]!==s?(g=x.handleSubmit(async I=>{const $=await d.update.mutateAsync({id:s,data:{title:I.title,description:I.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:I.body}}]}});x.reset({title:$.title,description:$.description??null,body:$t($)})}),e[10]=d.update,e[11]=x,e[12]=s,e[13]=g):g=e[13];const b=g;if(!a){let I;return e[14]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Dn,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[14]=I):I=e[14],I}let j;e[15]!==a.title?(j=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:a.title}),e[15]=a.title,e[16]=j):j=e[16];let S;e[17]!==a.description?(S=a.description?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),o.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:a.description})]}):null,e[17]=a.description,e[18]=S):S=e[18];let y;e[19]!==j||e[20]!==S?(y=o.jsx(Wn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[j,S]})}),e[19]=j,e[20]=S,e[21]=y):y=e[21];let v;e[22]!==b?(v=()=>{b()},e[22]=b,e[23]=v):v=e[23];let w;e[24]!==x.formState.isDirty||e[25]!==u||e[26]!==h||e[27]!==v?(w=o.jsx(zn,{children:o.jsx(Fn,{onSave:v,onUndo:h,isDirty:x.formState.isDirty,isSaving:u})}),e[24]=x.formState.isDirty,e[25]=u,e[26]=h,e[27]=v,e[28]=w):w=e[28];let C;e[29]!==x?(C=o.jsx("div",{className:"h-full",children:o.jsx(jr,{form:x})}),e[29]=x,e[30]=C):C=e[30];let _;return e[31]!==w||e[32]!==C||e[33]!==y?(_=o.jsxs(he,{children:[y,w,C]}),e[31]=w,e[32]=C,e[33]=y,e[34]=_):_=e[34],_}function Nr(t){const e=N.c(4),{itemId:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=br(),e[0]=s):s=e[0];const i=s;if(!i){let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Dn,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=l):l=e[1],l}let r;return e[2]!==n?(r=o.jsx($n,{children:o.jsx(k.Suspense,{fallback:null,children:o.jsx(wr,{providerId:i,promptId:n})})}),e[2]=n,e[3]=r):r=e[3],r}const Cr=eo("relative w-full rounded-lg border px-4 py-3 text-sm flex items-start gap-3 [&>svg]:size-4 [&>svg]:flex-shrink-0 [&>svg]:mt-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-destructive/5 text-destructive border-destructive/25 [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-warning/10 text-warning-foreground border-warning [&>svg]:text-current *:data-[slot=alert-description]:text-warning-foreground/90",success:"bg-success/10 text-success-foreground border-success [&>svg]:text-current *:data-[slot=alert-description]:text-success-foreground/90",info:"bg-card text-card-foreground border-border [&>svg]:text-current *:data-[slot=alert-description]:text-muted-foreground/90"}},defaultVariants:{variant:"default"}});function kr(t){const e=N.c(10);let n,s,i;e[0]!==t?({className:n,variant:i,...s}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=i):(n=e[1],s=e[2],i=e[3]);let r;e[4]!==n||e[5]!==i?(r=R(Cr({variant:i}),n),e[4]=n,e[5]=i,e[6]=r):r=e[6];let l;return e[7]!==s||e[8]!==r?(l=o.jsx("div",{"data-slot":"alert",role:"alert",className:r,...s}),e[7]=s,e[8]=r,e[9]=l):l=e[9],l}function Ir(t){const e=N.c(8);let n,s;e[0]!==t?({className:n,...s}=t,e[0]=t,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let i;e[3]!==n?(i=R("line-clamp-1 min-h-4 font-medium tracking-tight",n),e[3]=n,e[4]=i):i=e[4];let r;return e[5]!==s||e[6]!==i?(r=o.jsx("div",{"data-slot":"alert-title",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}function _r(t){const e=N.c(8);let n,s;e[0]!==t?({className:n,...s}=t,e[0]=t,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let i;e[3]!==n?(i=R("text-muted-foreground leading-relaxed",n),e[3]=n,e[4]=i):i=e[4];let r;return e[5]!==s||e[6]!==i?(r=o.jsx("div",{"data-slot":"alert-description",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}const Er=t=>t.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function Tr(t){const e=N.c(9),{toolName:n,connectionId:s,onBack:i}=t;let r;e[0]!==s?(r={connectionId:s},e[0]=s,e[1]=r):r=e[1];const l=Io(r);if(!l.isAuthenticated){let d;return e[2]!==l.supportsOAuth||e[3]!==i?(d=o.jsx("div",{className:"flex h-full items-center justify-center",children:l.supportsOAuth?o.jsx(_o,{onAuthenticate:()=>i(),buttonText:"Go back to authenticate"}):o.jsx(Eo,{hasReadme:!1})}),e[2]=l.supportsOAuth,e[3]=i,e[4]=d):d=e[4],d}const c=`${s}:${n}`;let a;return e[5]!==s||e[6]!==c||e[7]!==n?(a=o.jsx($r,{toolName:n,connectionId:s},c),e[5]=s,e[6]=c,e[7]=n,e[8]=a):a=e[8],a}function $r({toolName:t,connectionId:e}){const{replayId:n}=to({strict:!1}),s=(()=>{if(!n)return null;const E=`replay-${n}`,O=sessionStorage.getItem(E);if(!O)return null;sessionStorage.removeItem(E);try{return JSON.parse(O)}catch{return null}})(),i=(()=>{if(!s)return null;const E={};for(const[O,P]of Object.entries(s))P!==null&&typeof P=="object"?E[O]=JSON.stringify(P,null,2):E[O]=P;return E})(),[r,l]=k.useState(i??{}),[c,a]=k.useState(s?JSON.stringify(s,null,2):"{}"),[d,u]=k.useState(null),[f,m]=k.useState(null),[x,p]=k.useState(null),[h,g]=k.useState(null),[b,j]=k.useState(!1),[S,y]=k.useState(null),{org:v}=Z(),w=dt(e),C=ie({connectionId:e,orgId:v.id}),_=Qt({client:C}),I=_.data?.tools?.find(E=>E.name===t),$=yo(I?._meta),[A,W]=k.useState("json"),[T,M]=k.useState(!1);$&&!T&&(W("ui"),M(!0));const H=I?.inputSchema?.properties,F=H?Object.keys(H):[],B=F.length>0,V={};if(B&&I?.inputSchema?.properties)for(const E of F)V[E]=I.inputSchema.required?.includes(E)?"":void 0;const z=E=>Object.prototype.hasOwnProperty.call(r,E),Q=async()=>{j(!0),g(null),u(null),m(null),p(null),y(null);const E=performance.now();try{if(!C)throw new Error("MCP client is not available");const O=B?{...V,...r}:(()=>{const G=c.trim();if(!G)return{};const D=JSON.parse(G);if(D&&typeof D=="object")return D;throw new Error("Raw JSON input must be an object.")})();B&&I?.inputSchema?.properties&&Object.entries(I.inputSchema.properties).forEach(([G,D])=>{if((D.type==="object"||D.type==="array")&&typeof O[G]=="string")try{O[G]=JSON.parse(O[G])}catch{}});const P=await C.callTool({name:t,arguments:O}),Y=P.structuredContent??P,le=performance.now(),oe=Math.round(le-E);u(Y),m(P),p(O);const ce=JSON.stringify(Y),te=new TextEncoder().encode(ce).length;y({duration:`${oe}ms`,bytes:`${te} bytes`,tokens:`~${Math.ceil(te/4)} tokens`,cost:"$0.0000"})}catch(O){const P=O instanceof Error?O.message:String(O);g(P||"Unknown error occurred");const Y=performance.now();y({duration:`${Math.round(Y-E)}ms`})}finally{j(!1)}},se=(E,O)=>{l(P=>({...P,[E]:O}))},ee=()=>{u(null),m(null),p(null),g(null),y(null)},U=I?.name??Er(t),J=o.jsx(qn,{children:o.jsxs(Kn,{children:[o.jsx(Pe,{children:o.jsx(rt,{asChild:!0,children:o.jsx(Ye,{to:"/$org/$project/mcps",params:{org:v.slug,project:et},children:"Connections"})})}),o.jsx(it,{}),w&&o.jsxs(o.Fragment,{children:[o.jsx(Pe,{children:o.jsx(rt,{asChild:!0,children:o.jsx(Ye,{to:"/$org/$project/mcps/$connectionId",params:{org:v.slug,project:et,connectionId:e},search:{tab:"tools"},children:w.title})})}),o.jsx(it,{})]}),o.jsx(Pe,{children:o.jsx(Jn,{children:U})})]})});return o.jsx(he,{breadcrumb:J,children:o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 h-full",children:[o.jsx("div",{className:"flex flex-col border-r border-border overflow-hidden",children:o.jsxs("div",{className:"flex-1 overflow-auto",children:[o.jsx("div",{className:"flex flex-col gap-4 p-6 border-b border-border min-h-28",children:o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(ft,{icon:w?.icon||null,name:w?.title||t,size:"sm",className:"shadow-sm shrink-0"}),o.jsx("h1",{className:"text-lg font-medium text-foreground leading-none",children:t}),o.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1 bg-muted/50 rounded-md h-fit",children:[_.isSuccess?o.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):_.isLoading?o.jsx(ut,{size:10,className:"animate-spin text-yellow-500 shrink-0"}):o.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-red-500 shrink-0"}),o.jsx("span",{className:"font-mono text-xs capitalize text-muted-foreground leading-none",children:_.isSuccess?"ready":_.isLoading?"connecting":"error"})]})]}),o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:I?.description||"No description available"})]})}),o.jsxs("div",{className:"flex flex-col p-6 gap-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h2",{className:"text-sm font-semibold text-foreground uppercase tracking-wide",children:"Parameters"}),I?.inputSchema?.required&&I.inputSchema.required.length>0&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:[o.jsx("span",{className:"text-red-500",children:"*"})," Required"]})]}),o.jsx("div",{className:"space-y-4",children:B&&I?.inputSchema?.properties?Object.entries(I.inputSchema.properties).map(([E,O])=>o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("label",{className:"text-sm font-medium leading-none flex items-center gap-1.5",children:[E,I.inputSchema?.required?.includes(E)&&o.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),o.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:O.type})]}),O.description&&o.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:O.description}),O.type==="object"||O.type==="array"?o.jsx(Lt,{className:"font-mono text-xs",value:z(E)?r[E]??"":V[E]??"",onChange:P=>se(E,P.target.value),placeholder:`Enter ${E} as JSON...`,rows:3}):O.type==="boolean"?o.jsxs(Hn,{value:z(E)?String(r[E]??""):"",onValueChange:P=>se(E,P==="true"),children:[o.jsx(Vn,{children:o.jsx(Un,{placeholder:"Select true or false..."})}),o.jsxs(Bn,{children:[o.jsx(tt,{value:"true",children:"true"}),o.jsx(tt,{value:"false",children:"false"})]})]}):o.jsx(Gt,{value:z(E)?r[E]??"":V[E]??"",onChange:P=>se(E,P.target.value),placeholder:`Enter ${E}...`})]},E)):I?.inputSchema&&!B?o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),o.jsx(Lt,{className:"font-mono text-xs min-h-[120px]",value:c,onChange:E=>a(E.target.value),placeholder:'e.g. { "foo": "bar" }'})]}):o.jsx("div",{className:"flex items-center justify-center p-8 bg-muted/30 rounded-lg border border-dashed border-border",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"No parameters required"})})})]})]})}),o.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-t lg:border-t-0 border-b border-border bg-background",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),o.jsx(Oo,{annotations:I?.annotations,_meta:I?._meta})]}),S&&o.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(No,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:S.duration})]}),S.tokens&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(is,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:S.tokens})]}),S.bytes&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(ds,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:S.bytes})]}),S.cost&&o.jsx("div",{className:"flex items-center gap-1.5",children:o.jsx("span",{className:"font-mono text-foreground",children:S.cost})})]})]}),o.jsxs("div",{className:"flex items-center justify-end lg:justify-between px-4 h-14 border-b border-border bg-background",children:[o.jsx("div",{className:"flex items-center gap-2 w-full lg:w-auto",children:b?o.jsxs(X,{size:"sm",variant:"destructive",className:"h-8 gap-2 flex-1 lg:flex-none",onClick:ee,children:[o.jsx(ms,{className:"h-3.5 w-3.5"}),"Cancel"]}):o.jsxs(X,{size:"sm",variant:"default",className:"h-8 gap-2 flex-1 lg:flex-none",onClick:Q,children:[o.jsx(Zt,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})}),$&&o.jsx(Xt,{children:o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsxs(nt,{children:[o.jsx(st,{asChild:!0,children:o.jsx(X,{size:"icon",variant:A==="ui"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>W("ui"),children:o.jsx(ko,{size:14})})}),o.jsx(ot,{children:"Interactive view"})]}),o.jsxs(nt,{children:[o.jsx(st,{asChild:!0,children:o.jsx(X,{size:"icon",variant:A==="json"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>W("json"),children:o.jsx(bn,{size:14})})}),o.jsx(ot,{children:"JSON view"})]})]})})]}),h&&o.jsx("div",{className:"px-6 py-4 bg-background",children:o.jsx(kr,{variant:"destructive",children:o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(wo,{className:"h-4 w-4"}),o.jsx(Ir,{className:"mb-0",children:"Execution Failed"})]}),o.jsx(_r,{className:"text-xs text-destructive",children:h})]})})}),o.jsx("div",{className:"relative flex-1 overflow-auto bg-muted/50",children:$&&A==="ui"&&C?o.jsx(k.Suspense,{fallback:o.jsx("div",{className:"flex items-center justify-center h-48",children:o.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[o.jsx("div",{className:"size-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),o.jsx("span",{className:"text-sm",children:"Loading app..."})]})}),children:o.jsx(So,{resourceURI:$,toolName:t,toolInput:x??void 0,toolResult:f??void 0,displayMode:"fullscreen",minHeight:gn.view.minHeight,maxHeight:gn.view.maxHeight,client:C,className:"h-full"})}):d?o.jsxs(o.Fragment,{children:[o.jsx(Le,{code:JSON.stringify(d,null,2),language:"json",height:"100%",readOnly:!0}),o.jsx(X,{size:"icon",variant:"ghost",className:"absolute top-4 right-4 h-8 w-8 bg-background/80 hover:bg-background border border-border shadow-sm",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(d,null,2)),On.success("Copied to clipboard")},children:o.jsx(Co,{className:"h-3.5 w-3.5"})})]}):o.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:[o.jsx(bn,{className:"h-12 w-12 mb-3 opacity-40"}),o.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]})]})})}function Or(t){const e=N.c(7),{itemId:n,onBack:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[0]=i):i=e[0];const l=pe(i).connectionId;if(!dt(l)||!l){let u;return e[1]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"Connection not found"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection may have been deleted or you may not have access."})]})}),e[1]=u):u=e[1],u}let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(ut,{size:32,className:"animate-spin text-muted-foreground"})}),e[2]=a):a=e[2];let d;return e[3]!==l||e[4]!==s||e[5]!==n?(d=o.jsx(k.Suspense,{fallback:a,children:o.jsx(Tr,{toolName:n,connectionId:l,onBack:s})}),e[3]=l,e[4]=s,e[5]=n,e[6]=d):d=e[6],d}const yn=t=>{let e;const n=new Set,s=(d,u)=>{const f=typeof d=="function"?d(e):d;if(!Object.is(f,e)){const m=e;e=u??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(x=>x(e,m))}},i=()=>e,c={setState:s,getState:i,getInitialState:()=>a,subscribe:d=>(n.add(d),()=>n.delete(d))},a=e=t(s,i,c);return c},ln=(t=>t?yn(t):yn),Rr=t=>t;function Dt(t,e=Rr){const n=K.useSyncExternalStore(t.subscribe,K.useCallback(()=>e(t.getState()),[t,e]),K.useCallback(()=>e(t.getInitialState()),[t,e]));return K.useDebugValue(n),n}const Ar=t=>{const e=ln(t),n=s=>Dt(e,s);return Object.assign(n,e),n},Mr=(t=>Ar);function ps(t,e){let n;try{n=t()}catch{return}return{getItem:i=>{var r;const l=a=>a===null?null:JSON.parse(a,void 0),c=(r=n.getItem(i))!=null?r:null;return c instanceof Promise?c.then(l):l(c)},setItem:(i,r)=>n.setItem(i,JSON.stringify(r,void 0)),removeItem:i=>n.removeItem(i)}}const zt=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(s){return zt(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return zt(s)(n)}}}},Pr=(t,e)=>(n,s,i)=>{let r={storage:ps(()=>window.localStorage),partialize:g=>g,version:0,merge:(g,b)=>({...b,...g}),...e},l=!1,c=0;const a=new Set,d=new Set;let u=r.storage;if(!u)return t((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${r.name}', the given storage is currently unavailable.`),n(...g)},s,i);const f=()=>{const g=r.partialize({...s()});return u.setItem(r.name,{state:g,version:r.version})},m=i.setState;i.setState=(g,b)=>(m(g,b),f());const x=t((...g)=>(n(...g),f()),s,i);i.getInitialState=()=>x;let p;const h=()=>{var g,b;if(!u)return;const j=++c;l=!1,a.forEach(y=>{var v;return y((v=s())!=null?v:x)});const S=((b=r.onRehydrateStorage)==null?void 0:b.call(r,(g=s())!=null?g:x))||void 0;return zt(u.getItem.bind(u))(r.name).then(y=>{if(y)if(typeof y.version=="number"&&y.version!==r.version){if(r.migrate){const v=r.migrate(y.state,y.version);return v instanceof Promise?v.then(w=>[!0,w]):[!0,v]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,y.state];return[!1,void 0]}).then(y=>{var v;if(j!==c)return;const[w,C]=y;if(p=r.merge(C,(v=s())!=null?v:x),n(p,!0),w)return f()}).then(()=>{j===c&&(S?.(p,void 0),p=s(),l=!0,d.forEach(y=>y(p)))}).catch(y=>{j===c&&S?.(void 0,y)})};return i.persist={setOptions:g=>{r={...r,...g},g.storage&&(u=g.storage)},clearStorage:()=>{u?.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>h(),hasHydrated:()=>l,onHydrate:g=>(a.add(g),()=>{a.delete(g)}),onFinishHydration:g=>(d.add(g),()=>{d.delete(g)})},r.skipHydration||h(),p||x},xs=Pr,{useSyncExternalStoreWithSelector:Lr}=no,Dr=t=>t;function zr(t,e=Dr,n){const s=Lr(t.subscribe,t.getState,t.getInitialState,e,n);return K.useDebugValue(s),s}const wn=t=>Symbol.iterator in t,Nn=t=>"entries"in t,Cn=(t,e)=>{const n=t instanceof Map?t:new Map(t.entries()),s=e instanceof Map?e:new Map(e.entries());if(n.size!==s.size)return!1;for(const[i,r]of n)if(!s.has(i)||!Object.is(r,s.get(i)))return!1;return!0},Wr=(t,e)=>{const n=t[Symbol.iterator](),s=e[Symbol.iterator]();let i=n.next(),r=s.next();for(;!i.done&&!r.done;){if(!Object.is(i.value,r.value))return!1;i=n.next(),r=s.next()}return!!i.done&&!!r.done};function Fr(t,e){return Object.is(t,e)?!0:typeof t!="object"||t===null||typeof e!="object"||e===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e)?!1:wn(t)&&wn(e)?Nn(t)&&Nn(e)?Cn(t,e):Wr(t,e):Cn({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function Hr(t,e="Output"){if(!t)return`interface ${e} {}`;function n(r){if(!r||typeof r!="object")return"unknown";const l=r.type;if(Array.isArray(l))return l.map(c=>s(c)).join(" | ");switch(l){case"string":return r.enum?r.enum.map(c=>`"${c}"`).join(" | "):"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";case"array":{const c=r.items;return c?`${n(c)}[]`:"unknown[]"}case"object":return i(r);default:return r.anyOf?r.anyOf.map(n).join(" | "):r.oneOf?r.oneOf.map(n).join(" | "):r.allOf?r.allOf.map(n).join(" & "):"unknown"}}function s(r){switch(r){case"string":return"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";default:return"unknown"}}function i(r){const l=r.properties;if(!l)return"Record<string, unknown>";const c=new Set(r.required||[]);return`{
|
|
1
|
+
import{b9 as re,r as k,o as Qs,s as Et,c as N,j as o,E as $n,u as Z,l as Ys,v as R,z as eo,e as pe,a as to,aD as Ye,O as et,B as X,t as On,bF as K,cf as no,cg as so,aU as oo,H as Ht,M as de,T as Rn,aV as ro,G as Vt,aW as io,aX as An,I as Mn,aY as lo,aZ as co,U as Pn,a$ as ao,ch as Ut,ci as uo,aH as fo,bD as mo,D as po,n as xo,cj as ho,ck as go,cl as Ln}from"./index-BkxNgQ-z.js";import{E as Dn}from"./collection-search-BgstpGbD.js";import{d as Bt,u as qt,f as dt,h as bo}from"./use-connection-DjiXkPUz.js";import{u as ie,g as Ue,i as jo}from"./constants--aQ9HnxF.js";import{F as Tt,a as vo,b as Kt,d as Jt}from"./form-DKOb9Dxi.js";import{I as Gt}from"./input-BxWPl4Ur.js";import{T as Lt}from"./textarea-CceQB-N2.js";import{V as zn,b as Wn,a as he}from"./layout-rnNZXdmD.js";import{S as Fn}from"./save-actions-DgW9lLRI.js";import{M as So}from"./mcp-app-renderer-DlqJcoS_.js";import{g as yo,M as gn}from"./types-9lUbCnT7.js";import{S as Hn,a as Vn,b as Un,c as Bn,d as tt}from"./select-CHQkyynJ.js";import{c as Xt,T as nt,a as st,b as ot}from"./tooltip-DvMRS01W.js";import{i as wo}from"./AlertCircle-dxGFeayp.js";import{s as No}from"./Clock-B88-VhpY.js";import{i as bn}from"./Code01-DhSY1b20.js";import{a as Co}from"./Copy01-D2l3XUry.js";import{s as ko}from"./LayersTwo01-f778oNbj.js";import{i as ut}from"./Loading01-BLoQsWVt.js";import{i as Zt}from"./Play-CCz3CWMJ.js";import{B as qn,a as Kn,b as Pe,d as rt,e as it,c as Jn}from"./breadcrumb-DxXcAXh7.js";import{u as Io,O as _o,M as Eo,F as To,v as $o}from"./index-ZJA9ZP0w.js";import{d as Qt,b as Yt,a as en}from"./use-mcp-tools-CHOGR3no.js";import{I as ft}from"./integration-icon-DqBJsR0X.js";import{a as Oo}from"./tools-list-Cb9H3DsC.js";import{M as Le,n as Ro,S as Ao,a as Mo}from"./scroll-area-Ce3JzMbc.js";import{E as tn}from"./empty-state-C2LU6BeW.js";import{n as Po}from"./Container-CFxptFeR.js";import{b as Gn}from"./use-virtual-mcp-Wj5StsuR.js";import{b as Lo,R as jn,a as Do}from"./resizable-DNctE6m6.js";import{B as me}from"./badge-UPowR1Nj.js";import{S as mt}from"./spinner-B_k6AtHn.js";import{V as zo}from"./collection-table-wrapper-B7II4YYC.js";import{N as Wo,S as Fo,a as Ho,c as Vo,m as Xe,P as Uo,i as Bo,R as qo,u as Ko,b as Jo,d as vn,E as Go,e as Xo}from"./index-u5kBBr5i.js";import{a as Zo}from"./use-binding-CVLYzFG-.js";import{b as Qo,c as Yo,d as er,e as tr,a as nr,D as sr}from"./dialog-CrYlSCa6.js";import"./index-CuJORTyw.js";import{s as Xn}from"./Plus-4zX3n4bH.js";import{i as pt}from"./Check-BuBqfL8V.js";import{i as or}from"./DotsHorizontal-CZq86zFa.js";import{b as rr,T as ir,R as lr,g as cr,h as Zn,j as ar}from"./collapsible-CG7okAAn.js";import{s as nn}from"./XClose-CnTCpAeI.js";import{D as dr,a as ur,b as fr,c as Sn}from"./dropdown-menu-DvfBJ25L.js";import{i as mr}from"./ChevronRight-u7jqeZNG.js";import{i as Qn}from"./X-CpsrVd7E.js";import"./SearchMd-BvHN4xgB.js";import"./useMutation-DtOoZO7h.js";import"./label-DQ6CQRMq.js";import"./index-B4YFEuZr.js";import"./localstorage-keys-2beZrYfY.js";import"./useQuery-Cj-miqA2.js";import"./Save01-DiUMsefH.js";import"./use-mcp-resources-DS8p1Owh.js";import"./index-dKQNml8k.js";import"./ChevronDown-D15Vpp0r.js";import"./mcp-oauth-hrdldmcp.js";import"./File06-D8w_IYOr.js";import"./Key01-Cvjt_ykt.js";import"./constants-DoLvwboP.js";import"./registry-utils-Bm8aYhvn.js";import"./extract-connection-data-DtOGbK2O.js";import"./github-icon-Dp3wHhYE.js";import"./generate-id-Dyweu44Y.js";import"./use-install-from-registry-kgqBLGhb.js";import"./circle-alert-CHATLFG-.js";import"./index-Bq_4mEQF.js";import"./index-CKt9M-ST.js";import"./card-BRjix5ol.js";import"./Eye-vR70tVFn.js";import"./Globe02-6j3SB4QZ.js";import"./ArrowDown-BfANN175.js";import"./ArrowUp-BNm6R5tp.js";import"./Grid01-DjcW2Js4.js";import"./List-Be3XBHwN.js";import"./table-BJ3W5Geb.js";import"./popover-CJnKtmVV.js";import"./skeleton-Bla1LCSZ.js";import"./decopilot-events-DZodCqX1.js";import"./usage-B8eRkRZY.js";import"./Edit01-CbZPkCJz.js";import"./Users03-CUxh9_Jy.js";import"./XCircle-BcvU_Xzf.js";import"./tabs-tcquyh90.js";import"./ArrowLeft-DKmEJ5pf.js";import"./use-copy-DiVO6tbG.js";import"./use-create-virtual-mcp-DnOGpm5h.js";import"./marked.esm-BaswSlok.js";import"./markdown-08iefd1w.js";import"./Trash01-BvIumE4M.js";import"./binder-DUACCYIe.js";import"./use-llm-Bkjj502R.js";import"./checkbox-Df-Mj-oX.js";import"./AlignLeft-zf4ygcA_.js";import"./Image01-oZtE9Z5q.js";import"./RefreshCcw01-DzE0Vt_s.js";import"./Settings01-B5kunEo2.js";import"./useSuspenseInfiniteQuery-D62VIKAF.js";import"./infiniteQueryObserver-DFroUYRE.js";const Yn=re("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);const es=re("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);const sn=re("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const on=re("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const pr=re("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const xr=re("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const hr=re("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const ts=re("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const ns=re("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);const ss=re("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);const gr=re("OctagonAlert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]);const os=re("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);const rs=re("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]),rn=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M12 8v4m0 4h.01M2 8.523v6.954c0 .245 0 .367.028.482a1 1 0 0 0 .12.29c.061.1.148.187.32.36l4.923 4.922c.173.173.26.26.36.322.09.054.188.095.29.12.115.027.237.027.482.027h6.954c.245 0 .367 0 .482-.028a.998.998 0 0 0 .29-.12c.1-.061.187-.148.36-.32l4.922-4.923c.173-.173.26-.26.322-.36a.998.998 0 0 0 .12-.29c.027-.115.027-.237.027-.482V8.523c0-.245 0-.367-.028-.482a.998.998 0 0 0-.12-.29c-.061-.1-.148-.187-.32-.36L16.608 2.47c-.173-.173-.26-.26-.36-.322a1 1 0 0 0-.29-.12C15.844 2 15.722 2 15.477 2H8.523c-.245 0-.367 0-.482.028a1 1 0 0 0-.29.12c-.1.061-.187.148-.36.32L2.47 7.392c-.173.173-.26.26-.322.36a1 1 0 0 0-.12.29C2 8.156 2 8.278 2 8.523Z"}));rn.displayName="AlertOctagon";const is=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M20.5 8v8.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.22 21 17.38 21 15.7 21H8.3c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3.5 18.72 3.5 17.88 3.5 16.2V8m.1-5h16.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C22 3.76 22 4.04 22 4.6v1.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C21.24 8 20.96 8 20.4 8H3.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C2 7.24 2 6.96 2 6.4V4.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C2.76 3 3.04 3 3.6 3Zm6 8.5h4.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C16 12.26 16 12.54 16 13.1v.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437c-.214.109-.494.109-1.054.109H9.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C8 14.74 8 14.46 8 13.9v-.8c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C8.76 11.5 9.04 11.5 9.6 11.5Z"}));is.displayName="Box";const ls=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"m22.7 11.5-2 2-2-2m2.245 1.5A9 9 0 1 0 19 17.657M12 7v5l3 2"}));ls.displayName="ClockFastForward";const cs=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"m17 17 5-5-5-5M7 7l-5 5 5 5m7-14-4 18"}));cs.displayName="Code02";const Ze=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M6.8 3h-.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C3 4.52 3 5.08 3 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C4.52 21 5.08 21 6.2 21h.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C10 19.48 10 18.92 10 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C8.48 3 7.92 3 6.8 3Zm11 0h-.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C14 4.52 14 5.08 14 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C15.52 21 16.08 21 17.2 21h.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C21 19.48 21 18.92 21 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C19.48 3 18.92 3 17.8 3Z"}));Ze.displayName="Columns01";const as=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M4 4v1.4c0 3.36 0 5.04.654 6.324a6 6 0 0 0 2.622 2.622C8.56 15 10.24 15 13.6 15H20m0 0-5-5m5 5-5 5"}));as.displayName="CornerDownRight";const ds=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M21 5c0 1.657-4.03 3-9 3S3 6.657 3 5m18 0c0-1.657-4.03-3-9-3S3 3.343 3 5m18 0v14c0 1.66-4 3-9 3s-9-1.34-9-3V5m18 7c0 1.66-4 3-9 3s-9-1.34-9-3"}));ds.displayName="Database01";const us=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M3 3v10.2c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C5.28 18 6.12 18 7.8 18H15m0 0a3 3 0 1 0 6 0 3 3 0 0 0-6 0ZM3 8h12m0 0a3 3 0 1 0 6 0 3 3 0 0 0-6 0Z"}));us.displayName="GitBranch01";const fs=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"m13 22-3-3m0 0 3-3m-3 3h5a7 7 0 0 0 3-13.326M6 18.326A7 7 0 0 1 9 5h5m0 0-3-3m3 3-3 3"}));fs.displayName="Repeat03";const ms=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.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"}),k.createElement("path",{d:"M8 9.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C8.76 8 9.04 8 9.6 8h4.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C16 8.76 16 9.04 16 9.6v4.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C15.24 16 14.96 16 14.4 16H9.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C8 15.24 8 14.96 8 14.4V9.6Z"}));ms.displayName="StopCircle";Qs({title:Et().min(1),description:Et().nullable(),body:Et()});function $t(t){for(const e of t.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function br(){const t=window.location.pathname.split("/").filter(Boolean),e=t.findIndex(s=>s==="mcps"),n=e>=0?t[e+1]:void 0;return n?decodeURIComponent(n):void 0}function jr(t){const e=N.c(13),{form:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"text-sm font-medium text-foreground",children:"Details"}),e[0]=s):s=e[0];let i;e[1]!==n.control?(i=o.jsxs("div",{className:"flex flex-col gap-4",children:[s,o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsx(Tt,{control:n.control,name:"title",render:yr}),o.jsx(Tt,{control:n.control,name:"description",render:Sr})]})]}),e[1]=n.control,e[2]=i):i=e[2];let r,l;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("div",{className:"text-sm font-medium text-foreground",children:"Message"}),l=o.jsx("div",{className:"text-xs text-muted-foreground",children:"This becomes the user message in the prompt."}),e[3]=r,e[4]=l):(r=e[3],l=e[4]);let c;e[5]!==n.control?(c=o.jsxs("div",{className:"flex flex-col gap-2",children:[r,l,o.jsx(Tt,{control:n.control,name:"body",render:vr})]}),e[5]=n.control,e[6]=c):c=e[6];let a;e[7]!==i||e[8]!==c?(a=o.jsxs("div",{className:"h-full py-6 flex flex-col max-w-3xl mx-auto w-full min-w-0 gap-8 overflow-y-auto px-4",children:[i,c]}),e[7]=i,e[8]=c,e[9]=a):a=e[9];let d;return e[10]!==n||e[11]!==a?(d=o.jsx(vo,{...n,children:a}),e[10]=n,e[11]=a,e[12]=d):d=e[12],d}function vr(t){const{field:e}=t;return o.jsx(Kt,{children:o.jsx(Jt,{children:o.jsx(Lt,{...e,value:e.value??"",placeholder:"Write the prompt message…",className:"min-h-[240px] resize-none text-base leading-relaxed font-normal rounded-xl border border-border bg-muted/20 px-4 py-3 shadow-none focus-visible:ring-0"})})})}function Sr(t){const{field:e}=t;return o.jsxs(Kt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),o.jsx(Jt,{children:o.jsx(Gt,{...e,value:e.value??"",placeholder:"Add a description…",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function yr(t){const{field:e}=t;return o.jsxs(Kt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),o.jsx(Jt,{children:o.jsx(Gt,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function wr(t){const e=N.c(35),{providerId:n,promptId:s}=t,{org:i}=Z(),r=n||null;let l;e[0]!==i.id||e[1]!==r?(l={connectionId:r,orgId:i.id},e[0]=i.id,e[1]=r,e[2]=l):l=e[2];const c=ie(l),a=Bt(n,"PROMPT",s,c),d=qt(n,"PROMPT",c),u=d.update.isPending;let f;e[3]!==a?(f=a?{title:a.title,description:a.description??null,body:$t(a)}:void 0,e[3]=a,e[4]=f):f=e[4];let m;e[5]!==f?(m={values:f},e[5]=f,e[6]=m):m=e[6];const x=Ys(m);let p;e[7]!==x||e[8]!==a?(p=()=>{a&&x.reset({title:a.title,description:a.description??null,body:$t(a)})},e[7]=x,e[8]=a,e[9]=p):p=e[9];const h=p;let g;e[10]!==d.update||e[11]!==x||e[12]!==s?(g=x.handleSubmit(async I=>{const $=await d.update.mutateAsync({id:s,data:{title:I.title,description:I.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:I.body}}]}});x.reset({title:$.title,description:$.description??null,body:$t($)})}),e[10]=d.update,e[11]=x,e[12]=s,e[13]=g):g=e[13];const b=g;if(!a){let I;return e[14]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Dn,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[14]=I):I=e[14],I}let j;e[15]!==a.title?(j=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:a.title}),e[15]=a.title,e[16]=j):j=e[16];let S;e[17]!==a.description?(S=a.description?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),o.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:a.description})]}):null,e[17]=a.description,e[18]=S):S=e[18];let y;e[19]!==j||e[20]!==S?(y=o.jsx(Wn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[j,S]})}),e[19]=j,e[20]=S,e[21]=y):y=e[21];let v;e[22]!==b?(v=()=>{b()},e[22]=b,e[23]=v):v=e[23];let w;e[24]!==x.formState.isDirty||e[25]!==u||e[26]!==h||e[27]!==v?(w=o.jsx(zn,{children:o.jsx(Fn,{onSave:v,onUndo:h,isDirty:x.formState.isDirty,isSaving:u})}),e[24]=x.formState.isDirty,e[25]=u,e[26]=h,e[27]=v,e[28]=w):w=e[28];let C;e[29]!==x?(C=o.jsx("div",{className:"h-full",children:o.jsx(jr,{form:x})}),e[29]=x,e[30]=C):C=e[30];let _;return e[31]!==w||e[32]!==C||e[33]!==y?(_=o.jsxs(he,{children:[y,w,C]}),e[31]=w,e[32]=C,e[33]=y,e[34]=_):_=e[34],_}function Nr(t){const e=N.c(4),{itemId:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=br(),e[0]=s):s=e[0];const i=s;if(!i){let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Dn,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=l):l=e[1],l}let r;return e[2]!==n?(r=o.jsx($n,{children:o.jsx(k.Suspense,{fallback:null,children:o.jsx(wr,{providerId:i,promptId:n})})}),e[2]=n,e[3]=r):r=e[3],r}const Cr=eo("relative w-full rounded-lg border px-4 py-3 text-sm flex items-start gap-3 [&>svg]:size-4 [&>svg]:flex-shrink-0 [&>svg]:mt-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-destructive/5 text-destructive border-destructive/25 [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-warning/10 text-warning-foreground border-warning [&>svg]:text-current *:data-[slot=alert-description]:text-warning-foreground/90",success:"bg-success/10 text-success-foreground border-success [&>svg]:text-current *:data-[slot=alert-description]:text-success-foreground/90",info:"bg-card text-card-foreground border-border [&>svg]:text-current *:data-[slot=alert-description]:text-muted-foreground/90"}},defaultVariants:{variant:"default"}});function kr(t){const e=N.c(10);let n,s,i;e[0]!==t?({className:n,variant:i,...s}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=i):(n=e[1],s=e[2],i=e[3]);let r;e[4]!==n||e[5]!==i?(r=R(Cr({variant:i}),n),e[4]=n,e[5]=i,e[6]=r):r=e[6];let l;return e[7]!==s||e[8]!==r?(l=o.jsx("div",{"data-slot":"alert",role:"alert",className:r,...s}),e[7]=s,e[8]=r,e[9]=l):l=e[9],l}function Ir(t){const e=N.c(8);let n,s;e[0]!==t?({className:n,...s}=t,e[0]=t,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let i;e[3]!==n?(i=R("line-clamp-1 min-h-4 font-medium tracking-tight",n),e[3]=n,e[4]=i):i=e[4];let r;return e[5]!==s||e[6]!==i?(r=o.jsx("div",{"data-slot":"alert-title",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}function _r(t){const e=N.c(8);let n,s;e[0]!==t?({className:n,...s}=t,e[0]=t,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let i;e[3]!==n?(i=R("text-muted-foreground leading-relaxed",n),e[3]=n,e[4]=i):i=e[4];let r;return e[5]!==s||e[6]!==i?(r=o.jsx("div",{"data-slot":"alert-description",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}const Er=t=>t.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function Tr(t){const e=N.c(9),{toolName:n,connectionId:s,onBack:i}=t;let r;e[0]!==s?(r={connectionId:s},e[0]=s,e[1]=r):r=e[1];const l=Io(r);if(!l.isAuthenticated){let d;return e[2]!==l.supportsOAuth||e[3]!==i?(d=o.jsx("div",{className:"flex h-full items-center justify-center",children:l.supportsOAuth?o.jsx(_o,{onAuthenticate:()=>i(),buttonText:"Go back to authenticate"}):o.jsx(Eo,{hasReadme:!1})}),e[2]=l.supportsOAuth,e[3]=i,e[4]=d):d=e[4],d}const c=`${s}:${n}`;let a;return e[5]!==s||e[6]!==c||e[7]!==n?(a=o.jsx($r,{toolName:n,connectionId:s},c),e[5]=s,e[6]=c,e[7]=n,e[8]=a):a=e[8],a}function $r({toolName:t,connectionId:e}){const{replayId:n}=to({strict:!1}),s=(()=>{if(!n)return null;const E=`replay-${n}`,O=sessionStorage.getItem(E);if(!O)return null;sessionStorage.removeItem(E);try{return JSON.parse(O)}catch{return null}})(),i=(()=>{if(!s)return null;const E={};for(const[O,P]of Object.entries(s))P!==null&&typeof P=="object"?E[O]=JSON.stringify(P,null,2):E[O]=P;return E})(),[r,l]=k.useState(i??{}),[c,a]=k.useState(s?JSON.stringify(s,null,2):"{}"),[d,u]=k.useState(null),[f,m]=k.useState(null),[x,p]=k.useState(null),[h,g]=k.useState(null),[b,j]=k.useState(!1),[S,y]=k.useState(null),{org:v}=Z(),w=dt(e),C=ie({connectionId:e,orgId:v.id}),_=Qt({client:C}),I=_.data?.tools?.find(E=>E.name===t),$=yo(I?._meta),[A,W]=k.useState("json"),[T,M]=k.useState(!1);$&&!T&&(W("ui"),M(!0));const H=I?.inputSchema?.properties,F=H?Object.keys(H):[],B=F.length>0,V={};if(B&&I?.inputSchema?.properties)for(const E of F)V[E]=I.inputSchema.required?.includes(E)?"":void 0;const z=E=>Object.prototype.hasOwnProperty.call(r,E),Q=async()=>{j(!0),g(null),u(null),m(null),p(null),y(null);const E=performance.now();try{if(!C)throw new Error("MCP client is not available");const O=B?{...V,...r}:(()=>{const G=c.trim();if(!G)return{};const D=JSON.parse(G);if(D&&typeof D=="object")return D;throw new Error("Raw JSON input must be an object.")})();B&&I?.inputSchema?.properties&&Object.entries(I.inputSchema.properties).forEach(([G,D])=>{if((D.type==="object"||D.type==="array")&&typeof O[G]=="string")try{O[G]=JSON.parse(O[G])}catch{}});const P=await C.callTool({name:t,arguments:O}),Y=P.structuredContent??P,le=performance.now(),oe=Math.round(le-E);u(Y),m(P),p(O);const ce=JSON.stringify(Y),te=new TextEncoder().encode(ce).length;y({duration:`${oe}ms`,bytes:`${te} bytes`,tokens:`~${Math.ceil(te/4)} tokens`,cost:"$0.0000"})}catch(O){const P=O instanceof Error?O.message:String(O);g(P||"Unknown error occurred");const Y=performance.now();y({duration:`${Math.round(Y-E)}ms`})}finally{j(!1)}},se=(E,O)=>{l(P=>({...P,[E]:O}))},ee=()=>{u(null),m(null),p(null),g(null),y(null)},U=I?.name??Er(t),J=o.jsx(qn,{children:o.jsxs(Kn,{children:[o.jsx(Pe,{children:o.jsx(rt,{asChild:!0,children:o.jsx(Ye,{to:"/$org/$project/mcps",params:{org:v.slug,project:et},children:"Connections"})})}),o.jsx(it,{}),w&&o.jsxs(o.Fragment,{children:[o.jsx(Pe,{children:o.jsx(rt,{asChild:!0,children:o.jsx(Ye,{to:"/$org/$project/mcps/$connectionId",params:{org:v.slug,project:et,connectionId:e},search:{tab:"tools"},children:w.title})})}),o.jsx(it,{})]}),o.jsx(Pe,{children:o.jsx(Jn,{children:U})})]})});return o.jsx(he,{breadcrumb:J,children:o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 h-full",children:[o.jsx("div",{className:"flex flex-col border-r border-border overflow-hidden",children:o.jsxs("div",{className:"flex-1 overflow-auto",children:[o.jsx("div",{className:"flex flex-col gap-4 p-6 border-b border-border min-h-28",children:o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(ft,{icon:w?.icon||null,name:w?.title||t,size:"sm",className:"shadow-sm shrink-0"}),o.jsx("h1",{className:"text-lg font-medium text-foreground leading-none",children:t}),o.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1 bg-muted/50 rounded-md h-fit",children:[_.isSuccess?o.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):_.isLoading?o.jsx(ut,{size:10,className:"animate-spin text-yellow-500 shrink-0"}):o.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-red-500 shrink-0"}),o.jsx("span",{className:"font-mono text-xs capitalize text-muted-foreground leading-none",children:_.isSuccess?"ready":_.isLoading?"connecting":"error"})]})]}),o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:I?.description||"No description available"})]})}),o.jsxs("div",{className:"flex flex-col p-6 gap-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h2",{className:"text-sm font-semibold text-foreground uppercase tracking-wide",children:"Parameters"}),I?.inputSchema?.required&&I.inputSchema.required.length>0&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:[o.jsx("span",{className:"text-red-500",children:"*"})," Required"]})]}),o.jsx("div",{className:"space-y-4",children:B&&I?.inputSchema?.properties?Object.entries(I.inputSchema.properties).map(([E,O])=>o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("label",{className:"text-sm font-medium leading-none flex items-center gap-1.5",children:[E,I.inputSchema?.required?.includes(E)&&o.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),o.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:O.type})]}),O.description&&o.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:O.description}),O.type==="object"||O.type==="array"?o.jsx(Lt,{className:"font-mono text-xs",value:z(E)?r[E]??"":V[E]??"",onChange:P=>se(E,P.target.value),placeholder:`Enter ${E} as JSON...`,rows:3}):O.type==="boolean"?o.jsxs(Hn,{value:z(E)?String(r[E]??""):"",onValueChange:P=>se(E,P==="true"),children:[o.jsx(Vn,{children:o.jsx(Un,{placeholder:"Select true or false..."})}),o.jsxs(Bn,{children:[o.jsx(tt,{value:"true",children:"true"}),o.jsx(tt,{value:"false",children:"false"})]})]}):o.jsx(Gt,{value:z(E)?r[E]??"":V[E]??"",onChange:P=>se(E,P.target.value),placeholder:`Enter ${E}...`})]},E)):I?.inputSchema&&!B?o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),o.jsx(Lt,{className:"font-mono text-xs min-h-[120px]",value:c,onChange:E=>a(E.target.value),placeholder:'e.g. { "foo": "bar" }'})]}):o.jsx("div",{className:"flex items-center justify-center p-8 bg-muted/30 rounded-lg border border-dashed border-border",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"No parameters required"})})})]})]})}),o.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-t lg:border-t-0 border-b border-border bg-background",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),o.jsx(Oo,{annotations:I?.annotations,_meta:I?._meta})]}),S&&o.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(No,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:S.duration})]}),S.tokens&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(is,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:S.tokens})]}),S.bytes&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(ds,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:S.bytes})]}),S.cost&&o.jsx("div",{className:"flex items-center gap-1.5",children:o.jsx("span",{className:"font-mono text-foreground",children:S.cost})})]})]}),o.jsxs("div",{className:"flex items-center justify-end lg:justify-between px-4 h-14 border-b border-border bg-background",children:[o.jsx("div",{className:"flex items-center gap-2 w-full lg:w-auto",children:b?o.jsxs(X,{size:"sm",variant:"destructive",className:"h-8 gap-2 flex-1 lg:flex-none",onClick:ee,children:[o.jsx(ms,{className:"h-3.5 w-3.5"}),"Cancel"]}):o.jsxs(X,{size:"sm",variant:"default",className:"h-8 gap-2 flex-1 lg:flex-none",onClick:Q,children:[o.jsx(Zt,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})}),$&&o.jsx(Xt,{children:o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsxs(nt,{children:[o.jsx(st,{asChild:!0,children:o.jsx(X,{size:"icon",variant:A==="ui"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>W("ui"),children:o.jsx(ko,{size:14})})}),o.jsx(ot,{children:"Interactive view"})]}),o.jsxs(nt,{children:[o.jsx(st,{asChild:!0,children:o.jsx(X,{size:"icon",variant:A==="json"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>W("json"),children:o.jsx(bn,{size:14})})}),o.jsx(ot,{children:"JSON view"})]})]})})]}),h&&o.jsx("div",{className:"px-6 py-4 bg-background",children:o.jsx(kr,{variant:"destructive",children:o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(wo,{className:"h-4 w-4"}),o.jsx(Ir,{className:"mb-0",children:"Execution Failed"})]}),o.jsx(_r,{className:"text-xs text-destructive",children:h})]})})}),o.jsx("div",{className:"relative flex-1 overflow-auto bg-muted/50",children:$&&A==="ui"&&C?o.jsx(k.Suspense,{fallback:o.jsx("div",{className:"flex items-center justify-center h-48",children:o.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[o.jsx("div",{className:"size-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),o.jsx("span",{className:"text-sm",children:"Loading app..."})]})}),children:o.jsx(So,{resourceURI:$,toolName:t,toolInput:x??void 0,toolResult:f??void 0,displayMode:"fullscreen",minHeight:gn.view.minHeight,maxHeight:gn.view.maxHeight,client:C,className:"h-full"})}):d?o.jsxs(o.Fragment,{children:[o.jsx(Le,{code:JSON.stringify(d,null,2),language:"json",height:"100%",readOnly:!0}),o.jsx(X,{size:"icon",variant:"ghost",className:"absolute top-4 right-4 h-8 w-8 bg-background/80 hover:bg-background border border-border shadow-sm",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(d,null,2)),On.success("Copied to clipboard")},children:o.jsx(Co,{className:"h-3.5 w-3.5"})})]}):o.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:[o.jsx(bn,{className:"h-12 w-12 mb-3 opacity-40"}),o.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]})]})})}function Or(t){const e=N.c(7),{itemId:n,onBack:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[0]=i):i=e[0];const l=pe(i).connectionId;if(!dt(l)||!l){let u;return e[1]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"Connection not found"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection may have been deleted or you may not have access."})]})}),e[1]=u):u=e[1],u}let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(ut,{size:32,className:"animate-spin text-muted-foreground"})}),e[2]=a):a=e[2];let d;return e[3]!==l||e[4]!==s||e[5]!==n?(d=o.jsx(k.Suspense,{fallback:a,children:o.jsx(Tr,{toolName:n,connectionId:l,onBack:s})}),e[3]=l,e[4]=s,e[5]=n,e[6]=d):d=e[6],d}const yn=t=>{let e;const n=new Set,s=(d,u)=>{const f=typeof d=="function"?d(e):d;if(!Object.is(f,e)){const m=e;e=u??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(x=>x(e,m))}},i=()=>e,c={setState:s,getState:i,getInitialState:()=>a,subscribe:d=>(n.add(d),()=>n.delete(d))},a=e=t(s,i,c);return c},ln=(t=>t?yn(t):yn),Rr=t=>t;function Dt(t,e=Rr){const n=K.useSyncExternalStore(t.subscribe,K.useCallback(()=>e(t.getState()),[t,e]),K.useCallback(()=>e(t.getInitialState()),[t,e]));return K.useDebugValue(n),n}const Ar=t=>{const e=ln(t),n=s=>Dt(e,s);return Object.assign(n,e),n},Mr=(t=>Ar);function ps(t,e){let n;try{n=t()}catch{return}return{getItem:i=>{var r;const l=a=>a===null?null:JSON.parse(a,void 0),c=(r=n.getItem(i))!=null?r:null;return c instanceof Promise?c.then(l):l(c)},setItem:(i,r)=>n.setItem(i,JSON.stringify(r,void 0)),removeItem:i=>n.removeItem(i)}}const zt=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(s){return zt(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return zt(s)(n)}}}},Pr=(t,e)=>(n,s,i)=>{let r={storage:ps(()=>window.localStorage),partialize:g=>g,version:0,merge:(g,b)=>({...b,...g}),...e},l=!1,c=0;const a=new Set,d=new Set;let u=r.storage;if(!u)return t((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${r.name}', the given storage is currently unavailable.`),n(...g)},s,i);const f=()=>{const g=r.partialize({...s()});return u.setItem(r.name,{state:g,version:r.version})},m=i.setState;i.setState=(g,b)=>(m(g,b),f());const x=t((...g)=>(n(...g),f()),s,i);i.getInitialState=()=>x;let p;const h=()=>{var g,b;if(!u)return;const j=++c;l=!1,a.forEach(y=>{var v;return y((v=s())!=null?v:x)});const S=((b=r.onRehydrateStorage)==null?void 0:b.call(r,(g=s())!=null?g:x))||void 0;return zt(u.getItem.bind(u))(r.name).then(y=>{if(y)if(typeof y.version=="number"&&y.version!==r.version){if(r.migrate){const v=r.migrate(y.state,y.version);return v instanceof Promise?v.then(w=>[!0,w]):[!0,v]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,y.state];return[!1,void 0]}).then(y=>{var v;if(j!==c)return;const[w,C]=y;if(p=r.merge(C,(v=s())!=null?v:x),n(p,!0),w)return f()}).then(()=>{j===c&&(S?.(p,void 0),p=s(),l=!0,d.forEach(y=>y(p)))}).catch(y=>{j===c&&S?.(void 0,y)})};return i.persist={setOptions:g=>{r={...r,...g},g.storage&&(u=g.storage)},clearStorage:()=>{u?.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>h(),hasHydrated:()=>l,onHydrate:g=>(a.add(g),()=>{a.delete(g)}),onFinishHydration:g=>(d.add(g),()=>{d.delete(g)})},r.skipHydration||h(),p||x},xs=Pr,{useSyncExternalStoreWithSelector:Lr}=no,Dr=t=>t;function zr(t,e=Dr,n){const s=Lr(t.subscribe,t.getState,t.getInitialState,e,n);return K.useDebugValue(s),s}const wn=t=>Symbol.iterator in t,Nn=t=>"entries"in t,Cn=(t,e)=>{const n=t instanceof Map?t:new Map(t.entries()),s=e instanceof Map?e:new Map(e.entries());if(n.size!==s.size)return!1;for(const[i,r]of n)if(!s.has(i)||!Object.is(r,s.get(i)))return!1;return!0},Wr=(t,e)=>{const n=t[Symbol.iterator](),s=e[Symbol.iterator]();let i=n.next(),r=s.next();for(;!i.done&&!r.done;){if(!Object.is(i.value,r.value))return!1;i=n.next(),r=s.next()}return!!i.done&&!!r.done};function Fr(t,e){return Object.is(t,e)?!0:typeof t!="object"||t===null||typeof e!="object"||e===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e)?!1:wn(t)&&wn(e)?Nn(t)&&Nn(e)?Cn(t,e):Wr(t,e):Cn({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function Hr(t,e="Output"){if(!t)return`interface ${e} {}`;function n(r){if(!r||typeof r!="object")return"unknown";const l=r.type;if(Array.isArray(l))return l.map(c=>s(c)).join(" | ");switch(l){case"string":return r.enum?r.enum.map(c=>`"${c}"`).join(" | "):"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";case"array":{const c=r.items;return c?`${n(c)}[]`:"unknown[]"}case"object":return i(r);default:return r.anyOf?r.anyOf.map(n).join(" | "):r.oneOf?r.oneOf.map(n).join(" | "):r.allOf?r.allOf.map(n).join(" & "):"unknown"}}function s(r){switch(r){case"string":return"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";default:return"unknown"}}function i(r){const l=r.properties;if(!l)return"Record<string, unknown>";const c=new Set(r.required||[]);return`{
|
|
2
2
|
${Object.entries(l).map(([d,u])=>{const f=c.has(d)?"":"?";return`${u.description?` /** ${u.description} */
|
|
3
3
|
`:""} ${d}${f}: ${n(u)};`}).join(`
|
|
4
4
|
`)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as v,v as N,j as t}from"./index-
|
|
1
|
+
import{c as v,v as N,j as t}from"./index-BkxNgQ-z.js";import{i as y}from"./Loading01-BLoQsWVt.js";import{i as C}from"./SearchMd-BvHN4xgB.js";import{I as w}from"./input-BxWPl4Ur.js";function S(){const u=v.c(1);let e;return u[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("img",{src:"/empty-state-cards.png",alt:"",width:336,height:320,"aria-hidden":"true"}),u[0]=e):e=u[0],e}function z(u){const e=v.c(24),{image:f,title:h,description:j,actions:d,className:p,descriptionClassName:g,actionsClassName:x}=u;let c;e[0]!==p?(c=N("flex flex-1 flex-col items-center justify-center gap-8 p-4",p),e[0]=p,e[1]=c):c=e[1];let s;e[2]!==f?(s=f!==null&&t.jsx("div",{className:"flex items-center justify-center",children:f??t.jsx(S,{})}),e[2]=f,e[3]=s):s=e[3];let o;e[4]!==h?(o=t.jsx("h3",{className:"text-lg font-medium text-foreground",children:h}),e[4]=h,e[5]=o):o=e[5];let l;e[6]!==g?(l=N("text-sm text-muted-foreground text-center max-w-[300px]",g),e[6]=g,e[7]=l):l=e[7];let i;e[8]!==j||e[9]!==l?(i=t.jsx("div",{className:l,children:j}),e[8]=j,e[9]=l,e[10]=i):i=e[10];let r;e[11]!==o||e[12]!==i?(r=t.jsxs("div",{className:"flex flex-col items-center gap-2",children:[o,i]}),e[11]=o,e[12]=i,e[13]=r):r=e[13];let a;e[14]!==d||e[15]!==x?(a=d&&t.jsx("div",{className:N("flex items-center gap-2",x),children:d}),e[14]=d,e[15]=x,e[16]=a):a=e[16];let n;e[17]!==r||e[18]!==a?(n=t.jsxs("div",{className:"flex flex-col items-center gap-4",children:[r,a]}),e[17]=r,e[18]=a,e[19]=n):n=e[19];let m;return e[20]!==c||e[21]!==s||e[22]!==n?(m=t.jsxs("div",{className:c,children:[s,n]}),e[20]=c,e[21]=s,e[22]=n,e[23]=m):m=e[23],m}function R(u){const e=v.c(21),{value:f,onChange:h,placeholder:j,onKeyDown:d,className:p,isSearching:g,disabled:x}=u,c=j===void 0?"Search...":j;let s;e[0]!==p?(s=N("shrink-0 w-full border-b border-border h-12",p),e[0]=p,e[1]=s):s=e[1];const o=x?"cursor-not-allowed opacity-50":"cursor-text";let l;e[2]!==o?(l=N("flex items-center gap-2.5 h-12 px-4",o),e[2]=o,e[3]=l):l=e[3];let i;e[4]!==g?(i=g?t.jsx(y,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):t.jsx(C,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=g,e[5]=i):i=e[5];let r;e[6]!==h?(r=b=>h(b.target.value),e[6]=h,e[7]=r):r=e[7];let a;e[8]!==x||e[9]!==d||e[10]!==c||e[11]!==r||e[12]!==f?(a=t.jsx(w,{value:f,onChange:r,onKeyDown:d,placeholder:c,disabled:x,className:"flex-1 border-0 shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"}),e[8]=x,e[9]=d,e[10]=c,e[11]=r,e[12]=f,e[13]=a):a=e[13];let n;e[14]!==l||e[15]!==i||e[16]!==a?(n=t.jsxs("label",{className:l,children:[i,a]}),e[14]=l,e[15]=i,e[16]=a,e[17]=n):n=e[17];let m;return e[18]!==s||e[19]!==n?(m=t.jsx("div",{className:s,children:n}),e[18]=s,e[19]=n,e[20]=m):m=e[20],m}export{R as C,z as E};
|