@decocms/mesh 2.71.0 → 2.72.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/dist/client/assets/{AlertCircle-B2r4RYCl.js → AlertCircle-CHm1uTvc.js} +1 -1
  2. package/dist/client/assets/{ArrowUp-DL3E-1B5.js → ArrowUp-CsvTcSKO.js} +1 -1
  3. package/dist/client/assets/{Calendar-BJyFA5MR.js → Calendar-RaRlGUMn.js} +1 -1
  4. package/dist/client/assets/{Check-VEx1ONnd.js → Check-CTaDpFbx.js} +1 -1
  5. package/dist/client/assets/{CheckCircle-hgwi-82I.js → CheckCircle-BUL08lD-.js} +1 -1
  6. package/dist/client/assets/{CheckDone01-DIhXP9ft.js → CheckDone01-C9iBTpWu.js} +1 -1
  7. package/dist/client/assets/{ChevronDown-B9Mxx2fi.js → ChevronDown-BmbIYWgz.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-in3TmXpP.js → ChevronRight-C7PRdwhN.js} +1 -1
  9. package/dist/client/assets/{Code01-QyeCluYo.js → Code01-BHb1dfFm.js} +1 -1
  10. package/dist/client/assets/{Copy01-JjoULgm7.js → Copy01-BHrubS15.js} +1 -1
  11. package/dist/client/assets/{DotsHorizontal-CO7zK7Nc.js → DotsHorizontal-BKEGXeRq.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-DjjH7_Y2.js → DotsVertical-6bV4Jb02.js} +1 -1
  13. package/dist/client/assets/{Download01-CiJpDnb8.js → Download01-DCCcXkST.js} +1 -1
  14. package/dist/client/assets/{Edit01-DUGutI3c.js → Edit01-Ck6L4sn5.js} +1 -1
  15. package/dist/client/assets/{File02-DLP0uk3c.js → File02-Bdk2SiT1.js} +1 -1
  16. package/dist/client/assets/{File06-DCxDcy-i.js → File06-g3-IRgq5.js} +1 -1
  17. package/dist/client/assets/{FilterLines-Cc5F0HuO.js → FilterLines-CZJIfYWV.js} +1 -1
  18. package/dist/client/assets/{Globe02-BWyDEbcv.js → Globe02-nY9R9qg_.js} +1 -1
  19. package/dist/client/assets/{Grid01-DQKfO4pL.js → Grid01-CzUkHZSJ.js} +1 -1
  20. package/dist/client/assets/{Home02-DwMa7Dxn.js → Home02-D9mVq7KP.js} +1 -1
  21. package/dist/client/assets/{Image01-CURk6BcD.js → Image01-C213KIPf.js} +1 -1
  22. package/dist/client/assets/{Inbox01-BzO-o9k3.js → Inbox01-CXr_wpYC.js} +1 -1
  23. package/dist/client/assets/{InfoCircle-CwNQC8tM.js → InfoCircle-DEUMb_Ke.js} +1 -1
  24. package/dist/client/assets/{LinkExternal01-Css-DquB.js → LinkExternal01-CmQ2HPM6.js} +1 -1
  25. package/dist/client/assets/{List-CavdzHis.js → List-hntTIiNx.js} +1 -1
  26. package/dist/client/assets/{Loading01-CM7djb9Q.js → Loading01-B78uc8_j.js} +1 -1
  27. package/dist/client/assets/{Lock01-B6ThbWMN.js → Lock01-rY0GklCm.js} +1 -1
  28. package/dist/client/assets/{Pin01-D3bkVyHA.js → Pin01-B6bFgA7L.js} +1 -1
  29. package/dist/client/assets/{Play-BoQgM5dI.js → Play-CMxteKat.js} +1 -1
  30. package/dist/client/assets/{Plus-BhKqidCj.js → Plus-B1DSIk_Y.js} +1 -1
  31. package/dist/client/assets/{SearchMd-DZNqxRa2.js → SearchMd-rxhL9uWW.js} +1 -1
  32. package/dist/client/assets/{Settings01-P-PH04Nm.js → Settings01-BBpmfPia.js} +1 -1
  33. package/dist/client/assets/{Share07-BUD3TbCH.js → Share07-DNr4Gv0F.js} +1 -1
  34. package/dist/client/assets/{Terminal-CI6nX2Ah.js → Terminal-CvqFIFfF.js} +1 -1
  35. package/dist/client/assets/{Tool01-CMlMVnUR.js → Tool01-BWEJZQCA.js} +1 -1
  36. package/dist/client/assets/{Trash01-SLyaMDks.js → Trash01-CNJdNb2Z.js} +1 -1
  37. package/dist/client/assets/{Upload01-D7JbiLex.js → Upload01-CtypJgSZ.js} +1 -1
  38. package/dist/client/assets/{Users03-Chku9Yx2.js → Users03-B_SbeQBk.js} +1 -1
  39. package/dist/client/assets/{X-2IB63Q0x.js → X-mZzFkOTX.js} +1 -1
  40. package/dist/client/assets/{XClose-DSG07tz8.js → XClose-BwAC8sFB.js} +1 -1
  41. package/dist/client/assets/{agent-connections-preview-d9Roi18q.js → agent-connections-preview-DieWCUjN.js} +1 -1
  42. package/dist/client/assets/agent-detail-CViIjBwu.js +1 -0
  43. package/dist/client/assets/{agents-DdS_0nX9.js → agents-CyHP3pcb.js} +1 -1
  44. package/dist/client/assets/{alert-dialog-BmBtcfYg.js → alert-dialog-BN06wH-l.js} +1 -1
  45. package/dist/client/assets/{auth-catchall-DxqNbjWx.js → auth-catchall-DXrXBOXl.js} +1 -1
  46. package/dist/client/assets/{avatar-ydfTe0xi.js → avatar-2G5ouaDu.js} +1 -1
  47. package/dist/client/assets/{badge-B4Hap73o.js → badge-tOUVTd9z.js} +1 -1
  48. package/dist/client/assets/{binder-BMOA5_jw.js → binder-CbgCr5Rm.js} +1 -1
  49. package/dist/client/assets/{breadcrumb-CfCt3BHC.js → breadcrumb-JfdGMaRd.js} +1 -1
  50. package/dist/client/assets/{button-CIJQcfm2.js → button-BKtq_PYU.js} +1 -1
  51. package/dist/client/assets/{card-v4WZxiU8.js → card-C0u1Pmkw.js} +1 -1
  52. package/dist/client/assets/{checkbox-C09bNjVn.js → checkbox-DmCTNQLX.js} +1 -1
  53. package/dist/client/assets/{circle-alert-DuIKlbT4.js → circle-alert-BNmG-8Wh.js} +1 -1
  54. package/dist/client/assets/{collection-detail-C72vEJV3.js → collection-detail-CGH1Knd0.js} +3 -3
  55. package/dist/client/assets/{collection-search-BhGdJARf.js → collection-search-MQc1JOFA.js} +1 -1
  56. package/dist/client/assets/{collection-tab-D7lvZwh_.js → collection-tab-qHWWI3bH.js} +1 -1
  57. package/dist/client/assets/{collection-table-wrapper-BXL-ZhOo.js → collection-table-wrapper-L4Z0dyO1.js} +1 -1
  58. package/dist/client/assets/{collection-tabs-mdXwReEh.js → collection-tabs-CyRXUdkR.js} +1 -1
  59. package/dist/client/assets/{command-CwW6gorP.js → command-Bqwb_7NQ.js} +1 -1
  60. package/dist/client/assets/{connect-BW6N8ux-.js → connect-D30M34Bx.js} +1 -1
  61. package/dist/client/assets/{connection-card-DNYtrXwy.js → connection-card-CMQL70VR.js} +1 -1
  62. package/dist/client/assets/connection-detail-CQNN_rRv.js +1 -0
  63. package/dist/client/assets/{connections-CUhitW1a.js → connections-B7K4OdQw.js} +1 -1
  64. package/dist/client/assets/constants-DIAAKB_c.js +1 -0
  65. package/dist/client/assets/{constants-BQDDq09c.js → constants-PBHJ4h9F.js} +1 -1
  66. package/dist/client/assets/{create-organization-dialog-BIoGwH68.js → create-organization-dialog-BOgbyqMq.js} +1 -1
  67. package/dist/client/assets/{create-project-dialog-CfrpB8Yx.js → create-project-dialog-BxxiVX3V.js} +1 -1
  68. package/dist/client/assets/{dialog-Dn-qFsZM.js → dialog-B8Jtq_Yp.js} +1 -1
  69. package/dist/client/assets/{dropdown-menu-CFkIMuHp.js → dropdown-menu-C6Z4raJE.js} +1 -1
  70. package/dist/client/assets/{dynamic-plugin-layout-zcSRj9Fz.js → dynamic-plugin-layout-CDgkhjuC.js} +1 -1
  71. package/dist/client/assets/{empty-state-Bu5U3yVT.js → empty-state-B8XrD0Ub.js} +1 -1
  72. package/dist/client/assets/{empty-state-DfPGxaKS.js → empty-state-BXisfxVt.js} +1 -1
  73. package/dist/client/assets/{env-vars-editor-C889wc3R.js → env-vars-editor-8a4L674b.js} +1 -1
  74. package/dist/client/assets/{error-boundary-DRPYIYcG.js → error-boundary-D9qG4zZt.js} +1 -1
  75. package/dist/client/assets/{extract-connection-data-5ZTgwgJP.js → extract-connection-data-CCyj_Y1X.js} +1 -1
  76. package/dist/client/assets/{file-browser-CXMrgCnS.js → file-browser-DInIgvl2.js} +2 -2
  77. package/dist/client/assets/{form-CfZFG_36.js → form-DQap4sDh.js} +1 -1
  78. package/dist/client/assets/{grid-view-Chlr-V3g.js → grid-view-BKnSWUuB.js} +1 -1
  79. package/dist/client/assets/{home-CpZLe8AA.js → home-DvvANWHB.js} +1 -1
  80. package/dist/client/assets/{index-C4bOwCDG.js → index--tmJoUux.js} +6 -6
  81. package/dist/client/assets/{index-9tcRb7FE.js → index-BMXxQz0A.js} +1 -1
  82. package/dist/client/assets/index-C76QOf8q.js +1 -0
  83. package/dist/client/assets/{index-D5tmQFLM.js → index-CCcWAtA_.js} +27 -27
  84. package/dist/client/assets/{index-C6nYoI1C.css → index-CP_rYaE5.css} +1 -1
  85. package/dist/client/assets/{index-C9OcAHbi.js → index-D12lWWsR.js} +1 -1
  86. package/dist/client/assets/index-D5w8F0R7.js +1 -0
  87. package/dist/client/assets/{index-DtXqymrr.js → index-DFZdUy6e.js} +1 -1
  88. package/dist/client/assets/{index-BN26Duct.js → index-UwBLOz8J.js} +1 -1
  89. package/dist/client/assets/index-sFvIWgLs.js +1 -0
  90. package/dist/client/assets/{infiniteQueryObserver-CraWSqSX.js → infiniteQueryObserver-BdhSYRBe.js} +1 -1
  91. package/dist/client/assets/{input-BPn8NjNN.js → input-Dh6Cjukb.js} +1 -1
  92. package/dist/client/assets/{integration-icon-W7oxbRNq.js → integration-icon-Biu6JpM0.js} +1 -1
  93. package/dist/client/assets/{layout-BJr5Ak4k.js → layout-DWXfRazY.js} +1 -1
  94. package/dist/client/assets/{localstorage-keys-D5oAXPM1.js → localstorage-keys-BWsOCDUX.js} +1 -1
  95. package/dist/client/assets/{login-D4OqmnB6.js → login-DoPkmmdP.js} +1 -1
  96. package/dist/client/assets/{mcp-oauth-CNM1XpIG.js → mcp-oauth-BQMyy4a5.js} +1 -1
  97. package/dist/client/assets/{mcp-server-card-DesKazdH.js → mcp-server-card-DxnHyWDy.js} +1 -1
  98. package/dist/client/assets/{mcp-server-detail-Ys0ijxeQ.js → mcp-server-detail-BzBDrjZ5.js} +2 -2
  99. package/dist/client/assets/members-pjR_l8r-.js +3 -0
  100. package/dist/client/assets/{monaco-editor-CXE6czoW.js → monaco-editor-XyXN2SEV.js} +1 -1
  101. package/dist/client/assets/{monitoring-dsK6d0ku.js → monitoring-BiXkhP0l.js} +1 -1
  102. package/dist/client/assets/{oauth-callback-Cm1jfTrr.js → oauth-callback-COK_3Woz.js} +1 -1
  103. package/dist/client/assets/{page-Csuu4Y_T.js → page-Ca4TsO7U.js} +1 -1
  104. package/dist/client/assets/page-zhioOXqc.js +1 -0
  105. package/dist/client/assets/{plugin-empty-state-DGmTq0Hq.js → plugin-empty-state-BWDzgwMT.js} +1 -1
  106. package/dist/client/assets/{plugin-header-DS1bXx8D.js → plugin-header-Dm-T5OvY.js} +1 -1
  107. package/dist/client/assets/{popover-BnV2Ekkf.js → popover-Bn1QrYWJ.js} +1 -1
  108. package/dist/client/assets/{project-layout-DTHugbyC.js → project-layout-DQQxPJ7M.js} +1 -1
  109. package/dist/client/assets/{project-settings-UiQng0xL.js → project-settings-Bq572DKS.js} +1 -1
  110. package/dist/client/assets/{projects-list-B5fuxwCT.js → projects-list-D2y67tOl.js} +1 -1
  111. package/dist/client/assets/{registry-utils-DRiNpsKU.js → registry-utils-eTnhYK1Z.js} +1 -1
  112. package/dist/client/assets/{resizable-SZr0q_hI.js → resizable-Cth4qfOJ.js} +1 -1
  113. package/dist/client/assets/{select-iLE4SSQV.js → select-CJ01X7RE.js} +1 -1
  114. package/dist/client/assets/{shell-layout-Dvp4ZClm.js → shell-layout-Dmklwlc_.js} +2 -2
  115. package/dist/client/assets/{spinner-RsSCOmvl.js → spinner-CoIaSc2j.js} +1 -1
  116. package/dist/client/assets/{store-invite-DfN36OHe.js → store-invite-CM-bUgIj.js} +1 -1
  117. package/dist/client/assets/{switch-CZLIUnPD.js → switch-TZYuSAHJ.js} +1 -1
  118. package/dist/client/assets/{table-r40t1ij6.js → table-B7Ue2bk2.js} +1 -1
  119. package/dist/client/assets/{tasks-CnTQLuu3.js → tasks-DvdoE4Ok.js} +1 -1
  120. package/dist/client/assets/{textarea-CCeQpN_N.js → textarea-D6y1LKj_.js} +1 -1
  121. package/dist/client/assets/{tools-list-C3NaEQdF.js → tools-list-fxJEZlSp.js} +1 -1
  122. package/dist/client/assets/{typewriter-title-DESUJewE.js → typewriter-title-DR6tdNBL.js} +1 -1
  123. package/dist/client/assets/{use-binding-DMMSXp8M.js → use-binding-ucSDtQ56.js} +1 -1
  124. package/dist/client/assets/{use-connection-BSXprdTB.js → use-connection-BCPygOxC.js} +1 -1
  125. package/dist/client/assets/{use-create-virtual-mcp-Ca9rNRBg.js → use-create-virtual-mcp-u-AAtHmy.js} +1 -1
  126. package/dist/client/assets/use-deco-chat-open-DsNk3kZu.js +23 -0
  127. package/dist/client/assets/{use-install-from-registry-Bo257Imu.js → use-install-from-registry-f8JxKFFW.js} +1 -1
  128. package/dist/client/assets/{use-list-state-oI5CPziH.js → use-list-state-oNgAMbdK.js} +1 -1
  129. package/dist/client/assets/use-llm-Lxpo1ior.js +1 -0
  130. package/dist/client/assets/{use-mcp-prompts-IDdNIVsz.js → use-mcp-prompts-WwyO9-Nk.js} +1 -1
  131. package/dist/client/assets/{use-mcp-tools-1PW8j013.js → use-mcp-tools-eSLltC3i.js} +1 -1
  132. package/dist/client/assets/{use-mobile-Bji8rN8h.js → use-mobile-BUK8Wer1.js} +1 -1
  133. package/dist/client/assets/{use-organization-settings-DGMFFXzb.js → use-organization-settings-BR3GSp3x.js} +1 -1
  134. package/dist/client/assets/{use-project-Cs5eD30p.js → use-project-DLsFLh3O.js} +1 -1
  135. package/dist/client/assets/{use-virtual-mcp-CK08RGTF.js → use-virtual-mcp-ByfXJ3SB.js} +1 -1
  136. package/dist/client/assets/useInfiniteQuery-BcqgMbS1.js +1 -0
  137. package/dist/client/assets/{useMutation-CapnNHWF.js → useMutation-Cn2d2ilG.js} +1 -1
  138. package/dist/client/assets/useQuery-Dp4Sp9Q1.js +1 -0
  139. package/dist/client/assets/utils-CnoQZeDK.js +1 -0
  140. package/dist/client/assets/{view-mode-toggle-CoDook_S.js → view-mode-toggle-BJkt6e92.js} +1 -1
  141. package/dist/client/assets/{workflow-DDUMG-O3.js → workflow-BP45xRRH.js} +1 -1
  142. package/dist/client/index.html +2 -2
  143. package/dist/server/cli.js +167 -167
  144. package/dist/server/migrate.js +106 -106
  145. package/dist/server/server.js +146 -146
  146. package/package.json +1 -1
  147. package/dist/client/assets/agent-detail-DJwQyYDX.js +0 -1
  148. package/dist/client/assets/connection-detail-LtP9Y3ux.js +0 -1
  149. package/dist/client/assets/constants-CaS5DRuf.js +0 -1
  150. package/dist/client/assets/index-Bq-YlXEQ.js +0 -1
  151. package/dist/client/assets/index-C4-4zqx1.js +0 -1
  152. package/dist/client/assets/index-N9GUWdsk.js +0 -1
  153. package/dist/client/assets/members-Dg6HqXRE.js +0 -3
  154. package/dist/client/assets/page-BHnHevI-.js +0 -1
  155. package/dist/client/assets/use-deco-chat-open-C4c4LN3K.js +0 -23
  156. package/dist/client/assets/useInfiniteQuery-23ZWmdg7.js +0 -1
  157. package/dist/client/assets/useQuery-C7wGFtkw.js +0 -1
  158. package/dist/client/assets/utils-63Yxgxyo.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as T,c as j,j as l,T as z,w as E,R as H,x as L,B as D,y as V,D as I}from"./index-D5tmQFLM.js";import{I as R}from"./input-BPn8NjNN.js";import{i as A}from"./X-2IB63Q0x.js";import{c as b}from"./utils-63Yxgxyo.js";import{i as M}from"./SearchMd-DZNqxRa2.js";const O=({size:n=24,color:e="currentColor",...t})=>T.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},T.createElement("path",{d:"m22.7 13.5-2-2-2 2M21 12a9 9 0 1 1-1.245-4.57M12 7v5l3 2"}));O.displayName="ClockRewind";const B=({size:n=24,color:e="currentColor",...t})=>T.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},T.createElement("path",{d:"m10 15-3.075 3.114c-.43.434-.644.651-.828.666a.5.5 0 0 1-.421-.172c-.12-.14-.12-.446-.12-1.056v-1.56c0-.548-.449-.944-.99-1.024v0a3 3 0 0 1-2.534-2.533C2 12.219 2 11.96 2 11.445V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C4.28 2 5.12 2 6.8 2h7.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C19 4.28 19 5.12 19 6.8V11m0 11-2.176-1.513c-.306-.213-.46-.32-.626-.395a2.002 2.002 0 0 0-.462-.145c-.18-.033-.367-.033-.74-.033H13.2c-1.12 0-1.68 0-2.108-.218a2 2 0 0 1-.874-.874C10 18.394 10 17.834 10 16.714V14.2c0-1.12 0-1.68.218-2.108a2 2 0 0 1 .874-.874C11.52 11 12.08 11 13.2 11h5.6c1.12 0 1.68 0 2.108.218a2 2 0 0 1 .874.874C22 12.52 22 13.08 22 14.2v2.714c0 .932 0 1.398-.152 1.766a2 2 0 0 1-1.083 1.082c-.367.152-.833.152-1.765.152V22Z"}));B.displayName="MessageChatSquare";function W(n){const e=j.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let s;return e[2]!==t?(s=l.jsx(H,{"data-slot":"sheet",...t}),e[2]=t,e[3]=s):s=e[3],s}function P(n){const e=j.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let s;return e[2]!==t?(s=l.jsx(L,{"data-slot":"sheet-portal",...t}),e[2]=t,e[3]=s):s=e[3],s}function Q(n){const e=j.c(8);let t,s;e[0]!==n?({className:t,...s}=n,e[0]=n,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=b("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=l.jsx(V,{"data-slot":"sheet-overlay",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function q(n){const e=j.c(17);let t,s,a,o;e[0]!==n?({className:s,children:t,side:o,...a}=n,e[0]=n,e[1]=t,e[2]=s,e[3]=a,e[4]=o):(t=e[1],s=e[2],a=e[3],o=e[4]);const c=o===void 0?"right":o;let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=l.jsx(Q,{}),e[5]=h):h=e[5];const d=c==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",i=c==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",r=c==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",v=c==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t";let m;e[6]!==s||e[7]!==d||e[8]!==i||e[9]!==r||e[10]!==v?(m=b("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",d,i,r,v,s),e[6]=s,e[7]=d,e[8]=i,e[9]=r,e[10]=v,e[11]=m):m=e[11];let u;e[12]===Symbol.for("react.memo_cache_sentinel")?(u=l.jsxs(D,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[l.jsx(A,{className:"size-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]}),e[12]=u):u=e[12];let f;return e[13]!==t||e[14]!==a||e[15]!==m?(f=l.jsxs(P,{children:[h,l.jsxs(E,{"data-slot":"sheet-content",className:m,...a,children:[t,u]})]}),e[13]=t,e[14]=a,e[15]=m,e[16]=f):f=e[16],f}function F(n){const e=j.c(8);let t,s;e[0]!==n?({className:t,...s}=n,e[0]=n,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=b("flex flex-col gap-1.5 p-4",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=l.jsx("div",{"data-slot":"sheet-header",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function Z(n){const e=j.c(8);let t,s;e[0]!==n?({className:t,...s}=n,e[0]=n,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=b("text-foreground font-semibold",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=l.jsx(z,{"data-slot":"sheet-title",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function Y(n){const e=j.c(8);let t,s;e[0]!==n?({className:t,...s}=n,e[0]=n,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=b("text-muted-foreground text-sm",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=l.jsx(I,{"data-slot":"sheet-description",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function _(n){const e=j.c(24),{threads:t,activeThreadId:s,onThreadSelect:a,onClose:o,showHeader:c,showBackButton:h}=n,d=c===void 0?!0:c,i=h===void 0?!1:h,[r,v]=T.useState("");let m;e[0]!==r||e[1]!==t?(m=r.trim()?t.filter(p=>(p.title||"New chat").toLowerCase().includes(r.toLowerCase())):t,e[0]=r,e[1]=t,e[2]=m):m=e[2];const u=m;let f;e[3]!==o||e[4]!==a?(f=p=>{a(p),o&&o()},e[3]=o,e[4]=a,e[5]=f):f=e[5];const k=f;let y;e[6]!==o||e[7]!==i||e[8]!==d?(y=d&&l.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b shrink-0",children:[l.jsx("span",{className:"text-sm font-medium",children:"Chat History"}),i&&l.jsx("button",{type:"button",onClick:o,className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:"Back to chat"})]}),e[6]=o,e[7]=i,e[8]=d,e[9]=y):y=e[9];let C;e[10]===Symbol.for("react.memo_cache_sentinel")?(C=b("px-3 py-3 border-b","shrink-0"),e[10]=C):C=e[10];let S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S=l.jsx(M,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),e[11]=S):S=e[11];let g;e[12]===Symbol.for("react.memo_cache_sentinel")?(g=p=>v(p.target.value),e[12]=g):g=e[12];let x;e[13]!==r?(x=l.jsx("div",{className:C,children:l.jsxs("div",{className:"relative",children:[S,l.jsx(R,{type:"text",placeholder:"Search conversations...",value:r,onChange:g,className:"pl-9 h-9 text-sm"})]})}),e[13]=r,e[14]=x):x=e[14];let w;e[15]!==s||e[16]!==u||e[17]!==k||e[18]!==r?(w=l.jsx("div",{className:"flex-1 overflow-y-auto",children:u.length===0?l.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-12 px-4 text-center",children:[l.jsx("div",{className:"size-12 rounded-full bg-muted/50 flex items-center justify-center",children:l.jsx(B,{size:24,className:"text-muted-foreground"})}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:r?"No results found":"No conversations yet"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:r?"Try a different search term":"Start a new chat to see your history here"})]})]}):l.jsx("div",{className:"flex flex-col py-2",children:u.map(p=>{const $=p.id===s;return l.jsx("button",{type:"button",onClick:()=>k(p.id),className:b("flex items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-accent/50",$&&"bg-accent/50"),children:l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:b("text-sm truncate",$?"font-medium text-foreground":"text-muted-foreground"),children:p.title||"New chat"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:new Date(p.updatedAt).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]})},p.id)})})}),e[15]=s,e[16]=u,e[17]=k,e[18]=r,e[19]=w):w=e[19];let N;return e[20]!==w||e[21]!==y||e[22]!==x?(N=l.jsxs(l.Fragment,{children:[y,x,w]}),e[20]=w,e[21]=y,e[22]=x,e[23]=N):N=e[23],N}function ee(n){const e=j.c(9),{open:t,onOpenChange:s,threads:a,activeThreadId:o,onThreadSelect:c}=n;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=l.jsx(F,{className:"h-12 px-4 flex flex-row items-center justify-between border-b shrink-0",children:l.jsx(Z,{className:"text-sm font-medium",children:"Chat History"})}),e[0]=h):h=e[0];let d;e[1]!==o||e[2]!==c||e[3]!==a?(d=l.jsxs(q,{side:"right",className:"w-[320px] sm:w-[380px] p-0 flex flex-col",children:[h,l.jsx(_,{threads:a,activeThreadId:o,onThreadSelect:c,showHeader:!1})]}),e[1]=o,e[2]=c,e[3]=a,e[4]=d):d=e[4];let i;return e[5]!==s||e[6]!==t||e[7]!==d?(i=l.jsx(W,{open:t,onOpenChange:s,children:d}),e[5]=s,e[6]=t,e[7]=d,e[8]=i):i=e[8],i}function te(n){const e=j.c(5),{threads:t,activeThreadId:s,onThreadSelect:a,onClose:o}=n;let c;return e[0]!==s||e[1]!==o||e[2]!==a||e[3]!==t?(c=l.jsx("div",{className:"flex flex-col h-full w-full bg-background",children:l.jsx(_,{threads:t,activeThreadId:s,onThreadSelect:a,onClose:o,showBackButton:!0})}),e[0]=s,e[1]=o,e[2]=a,e[3]=t,e[4]=c):c=e[4],c}function se(n){const e=j.c(22),{text:t,className:s,speed:a}=n,o=s===void 0?"":s,c=a===void 0?30:a,[h,d]=T.useState(!1),i=t.length/c*1e3,r=t.length,v=`${t.length}ch`;let m;e[0]!==i?(m=()=>{d(!1);const p=setTimeout(()=>{d(!0)},i);return()=>clearTimeout(p)},e[0]=i,e[1]=m):m=e[1];let u;e[2]!==i||e[3]!==t?(u=[t,i],e[2]=i,e[3]=t,e[4]=u):u=e[4],T.useEffect(m,u);let f;e[5]!==o?(f=b(o,"block overflow-hidden inline-flex"),e[5]=o,e[6]=f):f=e[6];const k=`${i}ms`;let y;e[7]!==v||e[8]!==r||e[9]!==k?(y={"--typewriter-duration":k,"--typewriter-steps":r,"--typewriter-max-width":v},e[7]=v,e[8]=r,e[9]=k,e[10]=y):y=e[10];const C=y,S=h&&"truncate";let g;e[11]!==S?(g=b("typewriter-text",S),e[11]=S,e[12]=g):g=e[12];let x;e[13]!==g||e[14]!==t?(x=l.jsx("span",{className:g,children:t}),e[13]=g,e[14]=t,e[15]=x):x=e[15];let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=l.jsx("style",{children:`
1
+ import{r as T,c as j,j as l,T as z,w as E,R as H,x as L,B as D,y as V,D as I}from"./index-CCcWAtA_.js";import{I as R}from"./input-Dh6Cjukb.js";import{i as A}from"./X-mZzFkOTX.js";import{c as b}from"./utils-CnoQZeDK.js";import{i as M}from"./SearchMd-rxhL9uWW.js";const O=({size:n=24,color:e="currentColor",...t})=>T.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},T.createElement("path",{d:"m22.7 13.5-2-2-2 2M21 12a9 9 0 1 1-1.245-4.57M12 7v5l3 2"}));O.displayName="ClockRewind";const B=({size:n=24,color:e="currentColor",...t})=>T.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},T.createElement("path",{d:"m10 15-3.075 3.114c-.43.434-.644.651-.828.666a.5.5 0 0 1-.421-.172c-.12-.14-.12-.446-.12-1.056v-1.56c0-.548-.449-.944-.99-1.024v0a3 3 0 0 1-2.534-2.533C2 12.219 2 11.96 2 11.445V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C4.28 2 5.12 2 6.8 2h7.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C19 4.28 19 5.12 19 6.8V11m0 11-2.176-1.513c-.306-.213-.46-.32-.626-.395a2.002 2.002 0 0 0-.462-.145c-.18-.033-.367-.033-.74-.033H13.2c-1.12 0-1.68 0-2.108-.218a2 2 0 0 1-.874-.874C10 18.394 10 17.834 10 16.714V14.2c0-1.12 0-1.68.218-2.108a2 2 0 0 1 .874-.874C11.52 11 12.08 11 13.2 11h5.6c1.12 0 1.68 0 2.108.218a2 2 0 0 1 .874.874C22 12.52 22 13.08 22 14.2v2.714c0 .932 0 1.398-.152 1.766a2 2 0 0 1-1.083 1.082c-.367.152-.833.152-1.765.152V22Z"}));B.displayName="MessageChatSquare";function W(n){const e=j.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let s;return e[2]!==t?(s=l.jsx(H,{"data-slot":"sheet",...t}),e[2]=t,e[3]=s):s=e[3],s}function P(n){const e=j.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let s;return e[2]!==t?(s=l.jsx(L,{"data-slot":"sheet-portal",...t}),e[2]=t,e[3]=s):s=e[3],s}function Q(n){const e=j.c(8);let t,s;e[0]!==n?({className:t,...s}=n,e[0]=n,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=b("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=l.jsx(V,{"data-slot":"sheet-overlay",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function q(n){const e=j.c(17);let t,s,a,o;e[0]!==n?({className:s,children:t,side:o,...a}=n,e[0]=n,e[1]=t,e[2]=s,e[3]=a,e[4]=o):(t=e[1],s=e[2],a=e[3],o=e[4]);const c=o===void 0?"right":o;let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=l.jsx(Q,{}),e[5]=h):h=e[5];const d=c==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",i=c==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",r=c==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",v=c==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t";let m;e[6]!==s||e[7]!==d||e[8]!==i||e[9]!==r||e[10]!==v?(m=b("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",d,i,r,v,s),e[6]=s,e[7]=d,e[8]=i,e[9]=r,e[10]=v,e[11]=m):m=e[11];let u;e[12]===Symbol.for("react.memo_cache_sentinel")?(u=l.jsxs(D,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[l.jsx(A,{className:"size-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]}),e[12]=u):u=e[12];let f;return e[13]!==t||e[14]!==a||e[15]!==m?(f=l.jsxs(P,{children:[h,l.jsxs(E,{"data-slot":"sheet-content",className:m,...a,children:[t,u]})]}),e[13]=t,e[14]=a,e[15]=m,e[16]=f):f=e[16],f}function F(n){const e=j.c(8);let t,s;e[0]!==n?({className:t,...s}=n,e[0]=n,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=b("flex flex-col gap-1.5 p-4",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=l.jsx("div",{"data-slot":"sheet-header",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function Z(n){const e=j.c(8);let t,s;e[0]!==n?({className:t,...s}=n,e[0]=n,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=b("text-foreground font-semibold",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=l.jsx(z,{"data-slot":"sheet-title",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function Y(n){const e=j.c(8);let t,s;e[0]!==n?({className:t,...s}=n,e[0]=n,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=b("text-muted-foreground text-sm",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=l.jsx(I,{"data-slot":"sheet-description",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function _(n){const e=j.c(24),{threads:t,activeThreadId:s,onThreadSelect:a,onClose:o,showHeader:c,showBackButton:h}=n,d=c===void 0?!0:c,i=h===void 0?!1:h,[r,v]=T.useState("");let m;e[0]!==r||e[1]!==t?(m=r.trim()?t.filter(p=>(p.title||"New chat").toLowerCase().includes(r.toLowerCase())):t,e[0]=r,e[1]=t,e[2]=m):m=e[2];const u=m;let f;e[3]!==o||e[4]!==a?(f=p=>{a(p),o&&o()},e[3]=o,e[4]=a,e[5]=f):f=e[5];const k=f;let y;e[6]!==o||e[7]!==i||e[8]!==d?(y=d&&l.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b shrink-0",children:[l.jsx("span",{className:"text-sm font-medium",children:"Chat History"}),i&&l.jsx("button",{type:"button",onClick:o,className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:"Back to chat"})]}),e[6]=o,e[7]=i,e[8]=d,e[9]=y):y=e[9];let C;e[10]===Symbol.for("react.memo_cache_sentinel")?(C=b("px-3 py-3 border-b","shrink-0"),e[10]=C):C=e[10];let S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S=l.jsx(M,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),e[11]=S):S=e[11];let g;e[12]===Symbol.for("react.memo_cache_sentinel")?(g=p=>v(p.target.value),e[12]=g):g=e[12];let x;e[13]!==r?(x=l.jsx("div",{className:C,children:l.jsxs("div",{className:"relative",children:[S,l.jsx(R,{type:"text",placeholder:"Search conversations...",value:r,onChange:g,className:"pl-9 h-9 text-sm"})]})}),e[13]=r,e[14]=x):x=e[14];let w;e[15]!==s||e[16]!==u||e[17]!==k||e[18]!==r?(w=l.jsx("div",{className:"flex-1 overflow-y-auto",children:u.length===0?l.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-12 px-4 text-center",children:[l.jsx("div",{className:"size-12 rounded-full bg-muted/50 flex items-center justify-center",children:l.jsx(B,{size:24,className:"text-muted-foreground"})}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:r?"No results found":"No conversations yet"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:r?"Try a different search term":"Start a new chat to see your history here"})]})]}):l.jsx("div",{className:"flex flex-col py-2",children:u.map(p=>{const $=p.id===s;return l.jsx("button",{type:"button",onClick:()=>k(p.id),className:b("flex items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-accent/50",$&&"bg-accent/50"),children:l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:b("text-sm truncate",$?"font-medium text-foreground":"text-muted-foreground"),children:p.title||"New chat"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:new Date(p.updatedAt).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]})},p.id)})})}),e[15]=s,e[16]=u,e[17]=k,e[18]=r,e[19]=w):w=e[19];let N;return e[20]!==w||e[21]!==y||e[22]!==x?(N=l.jsxs(l.Fragment,{children:[y,x,w]}),e[20]=w,e[21]=y,e[22]=x,e[23]=N):N=e[23],N}function ee(n){const e=j.c(9),{open:t,onOpenChange:s,threads:a,activeThreadId:o,onThreadSelect:c}=n;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=l.jsx(F,{className:"h-12 px-4 flex flex-row items-center justify-between border-b shrink-0",children:l.jsx(Z,{className:"text-sm font-medium",children:"Chat History"})}),e[0]=h):h=e[0];let d;e[1]!==o||e[2]!==c||e[3]!==a?(d=l.jsxs(q,{side:"right",className:"w-[320px] sm:w-[380px] p-0 flex flex-col",children:[h,l.jsx(_,{threads:a,activeThreadId:o,onThreadSelect:c,showHeader:!1})]}),e[1]=o,e[2]=c,e[3]=a,e[4]=d):d=e[4];let i;return e[5]!==s||e[6]!==t||e[7]!==d?(i=l.jsx(W,{open:t,onOpenChange:s,children:d}),e[5]=s,e[6]=t,e[7]=d,e[8]=i):i=e[8],i}function te(n){const e=j.c(5),{threads:t,activeThreadId:s,onThreadSelect:a,onClose:o}=n;let c;return e[0]!==s||e[1]!==o||e[2]!==a||e[3]!==t?(c=l.jsx("div",{className:"flex flex-col h-full w-full bg-background",children:l.jsx(_,{threads:t,activeThreadId:s,onThreadSelect:a,onClose:o,showBackButton:!0})}),e[0]=s,e[1]=o,e[2]=a,e[3]=t,e[4]=c):c=e[4],c}function se(n){const e=j.c(22),{text:t,className:s,speed:a}=n,o=s===void 0?"":s,c=a===void 0?30:a,[h,d]=T.useState(!1),i=t.length/c*1e3,r=t.length,v=`${t.length}ch`;let m;e[0]!==i?(m=()=>{d(!1);const p=setTimeout(()=>{d(!0)},i);return()=>clearTimeout(p)},e[0]=i,e[1]=m):m=e[1];let u;e[2]!==i||e[3]!==t?(u=[t,i],e[2]=i,e[3]=t,e[4]=u):u=e[4],T.useEffect(m,u);let f;e[5]!==o?(f=b(o,"block overflow-hidden inline-flex"),e[5]=o,e[6]=f):f=e[6];const k=`${i}ms`;let y;e[7]!==v||e[8]!==r||e[9]!==k?(y={"--typewriter-duration":k,"--typewriter-steps":r,"--typewriter-max-width":v},e[7]=v,e[8]=r,e[9]=k,e[10]=y):y=e[10];const C=y,S=h&&"truncate";let g;e[11]!==S?(g=b("typewriter-text",S),e[11]=S,e[12]=g):g=e[12];let x;e[13]!==g||e[14]!==t?(x=l.jsx("span",{className:g,children:t}),e[13]=g,e[14]=t,e[15]=x):x=e[15];let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=l.jsx("style",{children:`
2
2
  .typewriter-text {
3
3
  display: inline-block;
4
4
  width: 0;
@@ -1,4 +1,4 @@
1
- import{a as v}from"./binder-BMOA5_jw.js";import{b8 as T,G as O,o as t,s as e,b9 as p,ae as l,ba as c,bb as R,bc as U,bd as i,af as x,be as u,bf as g,bg as n,bh as b,bi as L,bj as B,bk as C}from"./index-D5tmQFLM.js";const W=O.extend({avatar:e().describe("URL or data URI to the assistant's avatar image"),system_prompt:e().describe("System prompt that defines the assistant's behavior"),virtual_mcp_id:e().describe("Virtual MCP ID to use for this assistant"),model:t({id:e().describe("Model ID"),connectionId:e().describe("Connection ID that provides the model")}).describe("Selected model reference for this assistant")}),F=T("assistant",W),G=[...F],w=L(()=>u([B(),e(),i(),g(),p(e(),w),l(w)])),f=p(e(),p(e(),w)).optional().describe("Additional provider-specific options. Outer record keyed by provider name, inner by option key"),E=t({type:n("text"),text:e().describe("The text content"),providerOptions:f}),q=t({type:n("text"),text:e().describe("The text content"),providerMetadata:c().optional().describe("Additional provider-specific metadata")}),j=e().describe("File data as URL string"),k=t({type:n("file"),filename:e().optional().describe("Optional filename of the file"),data:j,mediaType:e().describe("IANA media type of the file (e.g., image/png, audio/mp3)"),providerOptions:f}),$=t({type:n("file"),mediaType:e().describe("IANA media type of the file (e.g., image/png, audio/mp3)"),data:e().describe("Generated file data as base64 encoded string")}),J=t({type:n("reasoning"),text:e().describe("The reasoning text"),providerOptions:f}),K=t({type:n("reasoning"),text:e().describe("The reasoning text"),providerMetadata:c().optional().describe("Additional provider-specific metadata")}),V=t({type:n("tool-call"),toolCallId:e().describe("ID of the tool call, used to match with tool result"),toolName:e().describe("Name of the tool being called"),input:e().describe("Arguments of the tool call (JSON-serializable object matching tool input schema)"),providerExecuted:g().optional().describe("Whether the tool call will be executed by the provider"),providerOptions:f}),z=t({type:n("tool-call"),toolCallId:e().describe("ID of the tool call"),toolName:e().describe("Name of the tool being called"),input:e().describe("Stringified JSON object with the tool call arguments"),providerExecuted:g().optional().describe("Whether the tool call will be executed by the provider"),providerMetadata:c().optional().describe("Additional provider-specific metadata")}),H=u([t({type:n("text"),value:e()}),t({type:n("json"),value:w}),t({type:n("error-text"),value:e()}),t({type:n("error-json"),value:w}),t({type:n("content"),value:l(u([t({type:n("text"),text:e().describe("Text content")}),t({type:n("media"),data:e().describe("Base-64 encoded media data"),mediaType:e().describe("IANA media type")})]))})]),A=t({type:n("tool-result"),toolCallId:e().describe("ID of the tool call that this result is associated with"),toolName:e().describe("Name of the tool that generated this result"),output:H.describe("Result of the tool call"),result:b().describe("Unknown result of the tool call"),providerOptions:f}),X=t({type:n("tool-result"),toolCallId:e().describe("ID of the tool call that this result is associated with"),toolName:e().describe("Name of the tool that generated this result"),result:c().describe("Result of the tool call (JSON-serializable)"),isError:g().optional().describe("Whether the result is an error or error message"),providerExecuted:g().optional().describe("Whether the tool result was generated by the provider"),providerMetadata:c().optional().describe("Additional provider-specific metadata")}),Y=u([t({type:n("source"),sourceType:n("url"),id:e().describe("The ID of the source"),url:e().describe("The URL of the source"),title:e().optional().describe("The title of the source"),providerMetadata:c().optional().describe("Additional provider-specific metadata")}),t({type:n("source"),sourceType:n("document"),id:e().describe("The ID of the source"),mediaType:e().describe("IANA media type of the document (e.g., application/pdf)"),title:e().describe("The title of the document"),filename:e().optional().describe("Optional filename of the document"),providerMetadata:c().optional().describe("Additional provider-specific metadata")})]),Z=t({role:n("system"),content:e().describe("System message content"),providerOptions:f}),Q=t({role:n("user"),content:l(u([E,k])).describe("User message content parts (text or file)"),providerOptions:f}),ee=t({role:n("assistant"),content:l(u([E,k,J,V,A])).describe("Assistant message content parts (text, file, reasoning, tool-call, or tool-result)"),providerOptions:f}),te=t({role:n("tool"),content:l(A).describe("Tool message content (tool results)"),providerOptions:f}),oe=u([Z,Q,ee,te]),ae=l(oe).describe("A list of messages forming the prompt"),ie=t({prompt:ae.describe("A language model prompt is a standardized prompt type (array of messages with roles: system, user, assistant, tool)"),maxOutputTokens:i().optional().describe("Maximum number of tokens to generate"),temperature:i().optional().describe("Temperature setting. The range depends on the provider and model"),topP:i().optional().describe("Nucleus sampling parameter"),topK:i().optional().describe("Only sample from the top K options for each subsequent token. Used to remove long tail low probability responses"),presencePenalty:i().optional().describe("Presence penalty setting. It affects the likelihood of the model to repeat information that is already in the prompt"),frequencyPenalty:i().optional().describe("Frequency penalty setting. It affects the likelihood of the model to repeatedly use the same words or phrases"),seed:i().optional().describe("The seed (integer) to use for random sampling. If set and supported by the model, calls will generate deterministic results"),stopSequences:l(e()).optional().describe("Stop sequences. If set, the model will stop generating text when one of the stop sequences is generated"),responseFormat:u([t({type:n("text")}),t({type:n("json"),schema:c().optional().describe("JSON schema that the generated output should conform to"),name:e().optional().describe("Name of output that should be generated"),description:e().optional().describe("Description of the output that should be generated")})]).optional().describe("Response format. The output can either be text or JSON. Default is text"),tools:l(c()).optional().describe("The tools that are available for the model"),toolChoice:c().optional().describe("Specifies how the tool should be selected. Defaults to 'auto'"),includeRawChunks:g().optional().describe("Include raw chunks in the stream. Only applicable for streaming calls"),abortSignal:c().optional().describe("Abort signal for cancelling the operation"),providerOptions:c().optional().describe("Additional provider-specific options")}),ne=t({content:l(u([q,$,K,z,X,Y])).describe("Ordered content that the model has generated (text, tool-calls, reasoning, files, sources)"),finishReason:x(["stop","length","content-filter","tool-calls","error","other","unknown"]).describe("Reason why generation stopped"),usage:U({inputTokens:i().optional(),outputTokens:i().optional(),totalTokens:i().optional(),reasoningTokens:i().optional()}).describe("Usage information for the language model call"),providerMetadata:c().optional().describe("Additional provider-specific metadata"),request:t({body:c().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:t({id:e().optional().describe("ID for the generated response"),timestamp:R().optional().describe("Timestamp for the start of the generated response"),modelId:e().optional().describe("The ID of the response model that was used"),headers:p(e(),e()).optional().describe("Response headers"),body:c().optional().describe("Response HTTP body")}).optional().describe("Optional response information for telemetry and debugging"),warnings:l(c()).describe("Warnings for the call, e.g. unsupported settings")});t({stream:c().describe("ReadableStream of LanguageModelV2StreamPart"),request:t({body:c().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:t({headers:p(e(),e()).optional().describe("Response headers")}).optional().describe("Optional response data")});const se=t({supportedUrls:p(e(),l(e())).describe("Supported URL patterns by media type for the provider")});t({modelId:e().describe("The ID of the model"),logo:e().nullable(),description:e().nullable(),capabilities:l(e()),limits:t({contextWindow:i(),maxOutputTokens:i()}).nullable(),costs:t({input:i(),output:i()}).nullable(),provider:x(["openai","anthropic","google","x-ai","deepseek","openai-compatible","openrouter"]).nullable()});const N=t({modelId:e().describe("The ID of the model"),callOptions:ie}),re=O.extend({logo:e().nullable(),description:e().nullable(),capabilities:l(e()),limits:t({contextWindow:i(),maxOutputTokens:i()}).nullable(),costs:t({input:i(),output:i()}).nullable(),provider:x(["openai","anthropic","google","xai","deepseek","openai-compatible","openrouter"]).nullable()}),le=T("llm",re,{readOnly:!0}),ce=[{name:"LLM_METADATA",inputSchema:t({modelId:e().describe("The ID of the model")}),outputSchema:se},{name:"LLM_DO_STREAM",inputSchema:N,streamable:!0},{name:"LLM_DO_GENERATE",inputSchema:N,outputSchema:ne},...le],de=t({scopes:l(e()).describe("List of scopes available"),stateSchema:p(e(),b()).describe("JSON Schema (draft-07) defining the state structure")}),pe=[{name:"MCP_CONFIGURATION",inputSchema:t({}),outputSchema:de}],ue=t({toolName:e().describe("Name of the tool to invoke on that connection"),transformCode:e().optional().describe("Pure TypeScript function for data transformation of the tool call result. Must be a TypeScript file that declares the Output interface and exports a default function: `interface Output { ... } export default async function(input): Output { ... }`\n The input will match with the tool call outputSchema. If transformCode is not provided, the tool call result will be used as the step output. \n Providing an transformCode is recommended because it both allows you to transform the data and validate it against a JSON Schema - tools are ephemeral and may return unexpected data.")}),me=t({code:e().describe(`Pure TypeScript function for data transformation. Useful to merge data from multiple steps and transform it. Must be a TypeScript file that declares the Output interface and exports a default function: \`interface Output { ... } export default async function(input): Output { ... }\`
1
+ import{a as v}from"./binder-CbgCr5Rm.js";import{b9 as T,G as O,o as t,s as e,ba as p,ae as l,bb as c,bc as R,bd as U,be as i,af as x,bf as u,bg as g,bh as n,bi as b,bj as L,bk as B,bl as C}from"./index-CCcWAtA_.js";const W=O.extend({avatar:e().describe("URL or data URI to the assistant's avatar image"),system_prompt:e().describe("System prompt that defines the assistant's behavior"),virtual_mcp_id:e().describe("Virtual MCP ID to use for this assistant"),model:t({id:e().describe("Model ID"),connectionId:e().describe("Connection ID that provides the model")}).describe("Selected model reference for this assistant")}),F=T("assistant",W),G=[...F],w=L(()=>u([B(),e(),i(),g(),p(e(),w),l(w)])),f=p(e(),p(e(),w)).optional().describe("Additional provider-specific options. Outer record keyed by provider name, inner by option key"),E=t({type:n("text"),text:e().describe("The text content"),providerOptions:f}),q=t({type:n("text"),text:e().describe("The text content"),providerMetadata:c().optional().describe("Additional provider-specific metadata")}),j=e().describe("File data as URL string"),k=t({type:n("file"),filename:e().optional().describe("Optional filename of the file"),data:j,mediaType:e().describe("IANA media type of the file (e.g., image/png, audio/mp3)"),providerOptions:f}),$=t({type:n("file"),mediaType:e().describe("IANA media type of the file (e.g., image/png, audio/mp3)"),data:e().describe("Generated file data as base64 encoded string")}),J=t({type:n("reasoning"),text:e().describe("The reasoning text"),providerOptions:f}),K=t({type:n("reasoning"),text:e().describe("The reasoning text"),providerMetadata:c().optional().describe("Additional provider-specific metadata")}),V=t({type:n("tool-call"),toolCallId:e().describe("ID of the tool call, used to match with tool result"),toolName:e().describe("Name of the tool being called"),input:e().describe("Arguments of the tool call (JSON-serializable object matching tool input schema)"),providerExecuted:g().optional().describe("Whether the tool call will be executed by the provider"),providerOptions:f}),z=t({type:n("tool-call"),toolCallId:e().describe("ID of the tool call"),toolName:e().describe("Name of the tool being called"),input:e().describe("Stringified JSON object with the tool call arguments"),providerExecuted:g().optional().describe("Whether the tool call will be executed by the provider"),providerMetadata:c().optional().describe("Additional provider-specific metadata")}),H=u([t({type:n("text"),value:e()}),t({type:n("json"),value:w}),t({type:n("error-text"),value:e()}),t({type:n("error-json"),value:w}),t({type:n("content"),value:l(u([t({type:n("text"),text:e().describe("Text content")}),t({type:n("media"),data:e().describe("Base-64 encoded media data"),mediaType:e().describe("IANA media type")})]))})]),A=t({type:n("tool-result"),toolCallId:e().describe("ID of the tool call that this result is associated with"),toolName:e().describe("Name of the tool that generated this result"),output:H.describe("Result of the tool call"),result:b().describe("Unknown result of the tool call"),providerOptions:f}),X=t({type:n("tool-result"),toolCallId:e().describe("ID of the tool call that this result is associated with"),toolName:e().describe("Name of the tool that generated this result"),result:c().describe("Result of the tool call (JSON-serializable)"),isError:g().optional().describe("Whether the result is an error or error message"),providerExecuted:g().optional().describe("Whether the tool result was generated by the provider"),providerMetadata:c().optional().describe("Additional provider-specific metadata")}),Y=u([t({type:n("source"),sourceType:n("url"),id:e().describe("The ID of the source"),url:e().describe("The URL of the source"),title:e().optional().describe("The title of the source"),providerMetadata:c().optional().describe("Additional provider-specific metadata")}),t({type:n("source"),sourceType:n("document"),id:e().describe("The ID of the source"),mediaType:e().describe("IANA media type of the document (e.g., application/pdf)"),title:e().describe("The title of the document"),filename:e().optional().describe("Optional filename of the document"),providerMetadata:c().optional().describe("Additional provider-specific metadata")})]),Z=t({role:n("system"),content:e().describe("System message content"),providerOptions:f}),Q=t({role:n("user"),content:l(u([E,k])).describe("User message content parts (text or file)"),providerOptions:f}),ee=t({role:n("assistant"),content:l(u([E,k,J,V,A])).describe("Assistant message content parts (text, file, reasoning, tool-call, or tool-result)"),providerOptions:f}),te=t({role:n("tool"),content:l(A).describe("Tool message content (tool results)"),providerOptions:f}),oe=u([Z,Q,ee,te]),ae=l(oe).describe("A list of messages forming the prompt"),ie=t({prompt:ae.describe("A language model prompt is a standardized prompt type (array of messages with roles: system, user, assistant, tool)"),maxOutputTokens:i().optional().describe("Maximum number of tokens to generate"),temperature:i().optional().describe("Temperature setting. The range depends on the provider and model"),topP:i().optional().describe("Nucleus sampling parameter"),topK:i().optional().describe("Only sample from the top K options for each subsequent token. Used to remove long tail low probability responses"),presencePenalty:i().optional().describe("Presence penalty setting. It affects the likelihood of the model to repeat information that is already in the prompt"),frequencyPenalty:i().optional().describe("Frequency penalty setting. It affects the likelihood of the model to repeatedly use the same words or phrases"),seed:i().optional().describe("The seed (integer) to use for random sampling. If set and supported by the model, calls will generate deterministic results"),stopSequences:l(e()).optional().describe("Stop sequences. If set, the model will stop generating text when one of the stop sequences is generated"),responseFormat:u([t({type:n("text")}),t({type:n("json"),schema:c().optional().describe("JSON schema that the generated output should conform to"),name:e().optional().describe("Name of output that should be generated"),description:e().optional().describe("Description of the output that should be generated")})]).optional().describe("Response format. The output can either be text or JSON. Default is text"),tools:l(c()).optional().describe("The tools that are available for the model"),toolChoice:c().optional().describe("Specifies how the tool should be selected. Defaults to 'auto'"),includeRawChunks:g().optional().describe("Include raw chunks in the stream. Only applicable for streaming calls"),abortSignal:c().optional().describe("Abort signal for cancelling the operation"),providerOptions:c().optional().describe("Additional provider-specific options")}),ne=t({content:l(u([q,$,K,z,X,Y])).describe("Ordered content that the model has generated (text, tool-calls, reasoning, files, sources)"),finishReason:x(["stop","length","content-filter","tool-calls","error","other","unknown"]).describe("Reason why generation stopped"),usage:U({inputTokens:i().optional(),outputTokens:i().optional(),totalTokens:i().optional(),reasoningTokens:i().optional()}).describe("Usage information for the language model call"),providerMetadata:c().optional().describe("Additional provider-specific metadata"),request:t({body:c().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:t({id:e().optional().describe("ID for the generated response"),timestamp:R().optional().describe("Timestamp for the start of the generated response"),modelId:e().optional().describe("The ID of the response model that was used"),headers:p(e(),e()).optional().describe("Response headers"),body:c().optional().describe("Response HTTP body")}).optional().describe("Optional response information for telemetry and debugging"),warnings:l(c()).describe("Warnings for the call, e.g. unsupported settings")});t({stream:c().describe("ReadableStream of LanguageModelV2StreamPart"),request:t({body:c().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:t({headers:p(e(),e()).optional().describe("Response headers")}).optional().describe("Optional response data")});const se=t({supportedUrls:p(e(),l(e())).describe("Supported URL patterns by media type for the provider")});t({modelId:e().describe("The ID of the model"),logo:e().nullable(),description:e().nullable(),capabilities:l(e()),limits:t({contextWindow:i(),maxOutputTokens:i()}).nullable(),costs:t({input:i(),output:i()}).nullable(),provider:x(["openai","anthropic","google","x-ai","deepseek","openai-compatible","openrouter"]).nullable()});const N=t({modelId:e().describe("The ID of the model"),callOptions:ie}),re=O.extend({logo:e().nullable(),description:e().nullable(),capabilities:l(e()),limits:t({contextWindow:i(),maxOutputTokens:i()}).nullable(),costs:t({input:i(),output:i()}).nullable(),provider:x(["openai","anthropic","google","xai","deepseek","openai-compatible","openrouter"]).nullable()}),le=T("llm",re,{readOnly:!0}),ce=[{name:"LLM_METADATA",inputSchema:t({modelId:e().describe("The ID of the model")}),outputSchema:se},{name:"LLM_DO_STREAM",inputSchema:N,streamable:!0},{name:"LLM_DO_GENERATE",inputSchema:N,outputSchema:ne},...le],de=t({scopes:l(e()).describe("List of scopes available"),stateSchema:p(e(),b()).describe("JSON Schema (draft-07) defining the state structure")}),pe=[{name:"MCP_CONFIGURATION",inputSchema:t({}),outputSchema:de}],ue=t({toolName:e().describe("Name of the tool to invoke on that connection"),transformCode:e().optional().describe("Pure TypeScript function for data transformation of the tool call result. Must be a TypeScript file that declares the Output interface and exports a default function: `interface Output { ... } export default async function(input): Output { ... }`\n The input will match with the tool call outputSchema. If transformCode is not provided, the tool call result will be used as the step output. \n Providing an transformCode is recommended because it both allows you to transform the data and validate it against a JSON Schema - tools are ephemeral and may return unexpected data.")}),me=t({code:e().describe(`Pure TypeScript function for data transformation. Useful to merge data from multiple steps and transform it. Must be a TypeScript file that declares the Output interface and exports a default function: \`interface Output { ... } export default async function(input): Output { ... }\`
2
2
  The input is the resolved value of the references in the input field. Example:
3
3
  {
4
4
  "input": {
@@ -1 +1 @@
1
- import{q as P,c as w,v as Q,t as h,u as v}from"./index-D5tmQFLM.js";import{u as F}from"./useMutation-CapnNHWF.js";import{K as x,a as q,u as U}from"./constants-BQDDq09c.js";function b(o,n,s){const e=[];if(o?.trim()){const t=o.trim(),r=s.map(a=>({field:[String(a)],operator:"contains",value:t}));r.length===1&&r[0]?e.push(r[0]):r.length>1&&e.push({operator:"or",conditions:r})}if(n&&n.length>0)for(const t of n)e.push({field:[t.column],operator:"eq",value:t.value});if(e.length!==0)return e.length===1?e[0]:{operator:"and",conditions:e}}function D(o,n,s){const e=o??s,t=n??"asc";return[{field:[String(e)],direction:t}]}function I(o){if(!o||typeof o!="object")throw new Error("Invalid result");if("isError"in o&&o.isError)throw new Error("content"in o&&Array.isArray(o.content)&&o.content[0]?.type==="text"?o.content[0].text:"Unknown error");if("structuredContent"in o)return o.structuredContent;throw new Error("No structured content found")}function k(o,n,s,e){const t=w.c(13);let r;t[0]!==n?(r=n.toUpperCase(),t[0]=n,t[1]=r):r=t[1];const i=`COLLECTION_${r}_GET`;let c;t[2]!==e||t[3]!==i||t[4]!==s?(c=x.mcpToolCall(e,i,s??""),t[2]=e,t[3]=i,t[4]=s,t[5]=c):c=t[5];let l;t[6]!==e||t[7]!==i||t[8]!==s?(l=async()=>{if(!s)return{item:null};const p=await e.callTool({name:i,arguments:{id:s}});return I(p)},t[6]=e,t[7]=i,t[8]=s,t[9]=l):l=t[9];let d;t[10]!==c||t[11]!==l?(d={queryKey:c,queryFn:l,staleTime:6e4},t[10]=c,t[11]=l,t[12]=d):d=t[12];const{data:f}=P(d);return f?.item??null}const B={structuredContent:{items:[]},isError:!1};function R(o,n,s,e={}){const{searchTerm:t,filters:r,sortKey:a,sortDirection:i,searchFields:c=["title","description"],defaultSortKey:l="updated_at",pageSize:d=100}=e,p=`COLLECTION_${n.toUpperCase()}_LIST`,m=b(t,r,c),y=D(a,i,l),E={...m&&{where:m},...y&&{orderBy:y},limit:d,offset:0},C=JSON.stringify(E),g=x.mcpToolCall(s,p,C),{data:N}=P({queryKey:g,queryFn:async()=>s?await s.callTool({name:p,arguments:E}):B,staleTime:3e4,retry:!1,select:S=>I(S??{})?.items??[]});return N}function X(o,n,s,e={}){const{searchTerm:t,filters:r,sortKey:a,sortDirection:i,searchFields:c=["title","description"],defaultSortKey:l="updated_at",pageSize:d=100}=e,p=`COLLECTION_${n.toUpperCase()}_LIST`,m=b(t,r,c),y=D(a,i,l),E={...m&&{where:m},...y&&{orderBy:y},limit:d,offset:0},C=JSON.stringify(E);return x.mcpToolCall(o,p,C)}function j(o,n,s){const e=w.c(33),t=Q();let r;e[0]!==n?(r=n.toUpperCase(),e[0]=n,e[1]=r):r=e[1];const a=r,i=`COLLECTION_${a}_CREATE`,c=`COLLECTION_${a}_UPDATE`,l=`COLLECTION_${a}_DELETE`;let d;e[2]!==t||e[3]!==a?(d=()=>{t.invalidateQueries({predicate:_=>{const u=_.queryKey;if(u[0]!=="mcp"||u[1]!=="client"||u[3]!=="tool-call")return!1;const L=u[4];return typeof L=="string"&&L.startsWith(`COLLECTION_${a}_`)}})},e[2]=t,e[3]=a,e[4]=d):d=e[4];const f=d;let p;e[5]!==s||e[6]!==i?(p=async _=>{const u=await s.callTool({name:i,arguments:{data:_}});if(u.isError)throw new Error(Array.isArray(u.content)?u.content[0]?.text:String(u.content));return I(u).item},e[5]=s,e[6]=i,e[7]=p):p=e[7];let m;e[8]!==f?(m=()=>{f(),h.success("Item created successfully")},e[8]=f,e[9]=m):m=e[9];let y;e[10]!==p||e[11]!==m?(y={mutationFn:p,onSuccess:m,onError:W},e[10]=p,e[11]=m,e[12]=y):y=e[12];const E=F(y);let C;e[13]!==s||e[14]!==c?(C=async _=>{const{id:u,data:L}=_,M=await s.callTool({name:c,arguments:{id:u,data:L}});return I(M).item},e[13]=s,e[14]=c,e[15]=C):C=e[15];let g;e[16]!==f?(g=()=>{f(),h.success("Item updated successfully")},e[16]=f,e[17]=g):g=e[17];let N;e[18]!==C||e[19]!==g?(N={mutationFn:C,onSuccess:g,onError:J},e[18]=C,e[19]=g,e[20]=N):N=e[20];const S=F(N);let T;e[21]!==s||e[22]!==l?(T=async _=>{const u=await s.callTool({name:l,arguments:{id:_}});return I(u).item.id},e[21]=s,e[22]=l,e[23]=T):T=e[23];let O;e[24]!==f?(O=()=>{f(),h.success("Item deleted successfully")},e[24]=f,e[25]=O):O=e[25];let K;e[26]!==T||e[27]!==O?(K={mutationFn:T,onSuccess:O,onError:z},e[26]=T,e[27]=O,e[28]=K):K=e[28];const A=F(K);let $;return e[29]!==E||e[30]!==A||e[31]!==S?($={create:E,update:S,delete:A},e[29]=E,e[30]=A,e[31]=S,e[32]=$):$=e[32],$}function z(o){const n=o instanceof Error?o.message:String(o);h.error(`Failed to delete item: ${n}`)}function J(o){const n=o instanceof Error?o.message:String(o);h.error(`Failed to update item: ${n}`)}function W(o){const n=o instanceof Error?o.message:String(o);h.error(`Failed to create item: ${n}`)}function Z(o){const n=w.c(4);let s;n[0]!==o?(s=o===void 0?{}:o,n[0]=o,n[1]=s):s=n[1];const e=s,{org:t}=v();let r;n[2]!==t.id?(r={connectionId:q,orgId:t.id},n[2]=t.id,n[3]=r):r=n[3];const a=U(r);return R(t.id,"CONNECTIONS",a,e)}function ee(o){const n=w.c(2),{org:s}=v();let e;n[0]!==s.id?(e={connectionId:q,orgId:s.id},n[0]=s.id,n[1]=e):e=n[1];const t=U(e);return k(s.id,"CONNECTIONS",o,t)}function te(){const o=w.c(2),{org:n}=v();let s;o[0]!==n.id?(s={connectionId:q,orgId:n.id},o[0]=n.id,o[1]=s):s=o[1];const e=U(s);return j(n.id,"CONNECTIONS",e)}export{B as E,D as a,X as b,b as c,k as d,R as e,ee as f,te as g,Z as h,j as u};
1
+ import{q as P,c as w,v as Q,t as h,u as v}from"./index-CCcWAtA_.js";import{u as F}from"./useMutation-Cn2d2ilG.js";import{K as x,a as q,u as U}from"./constants-PBHJ4h9F.js";function b(o,n,s){const e=[];if(o?.trim()){const t=o.trim(),r=s.map(a=>({field:[String(a)],operator:"contains",value:t}));r.length===1&&r[0]?e.push(r[0]):r.length>1&&e.push({operator:"or",conditions:r})}if(n&&n.length>0)for(const t of n)e.push({field:[t.column],operator:"eq",value:t.value});if(e.length!==0)return e.length===1?e[0]:{operator:"and",conditions:e}}function D(o,n,s){const e=o??s,t=n??"asc";return[{field:[String(e)],direction:t}]}function I(o){if(!o||typeof o!="object")throw new Error("Invalid result");if("isError"in o&&o.isError)throw new Error("content"in o&&Array.isArray(o.content)&&o.content[0]?.type==="text"?o.content[0].text:"Unknown error");if("structuredContent"in o)return o.structuredContent;throw new Error("No structured content found")}function k(o,n,s,e){const t=w.c(13);let r;t[0]!==n?(r=n.toUpperCase(),t[0]=n,t[1]=r):r=t[1];const i=`COLLECTION_${r}_GET`;let c;t[2]!==e||t[3]!==i||t[4]!==s?(c=x.mcpToolCall(e,i,s??""),t[2]=e,t[3]=i,t[4]=s,t[5]=c):c=t[5];let l;t[6]!==e||t[7]!==i||t[8]!==s?(l=async()=>{if(!s)return{item:null};const p=await e.callTool({name:i,arguments:{id:s}});return I(p)},t[6]=e,t[7]=i,t[8]=s,t[9]=l):l=t[9];let d;t[10]!==c||t[11]!==l?(d={queryKey:c,queryFn:l,staleTime:6e4},t[10]=c,t[11]=l,t[12]=d):d=t[12];const{data:f}=P(d);return f?.item??null}const B={structuredContent:{items:[]},isError:!1};function R(o,n,s,e={}){const{searchTerm:t,filters:r,sortKey:a,sortDirection:i,searchFields:c=["title","description"],defaultSortKey:l="updated_at",pageSize:d=100}=e,p=`COLLECTION_${n.toUpperCase()}_LIST`,m=b(t,r,c),y=D(a,i,l),E={...m&&{where:m},...y&&{orderBy:y},limit:d,offset:0},C=JSON.stringify(E),g=x.mcpToolCall(s,p,C),{data:N}=P({queryKey:g,queryFn:async()=>s?await s.callTool({name:p,arguments:E}):B,staleTime:3e4,retry:!1,select:S=>I(S??{})?.items??[]});return N}function X(o,n,s,e={}){const{searchTerm:t,filters:r,sortKey:a,sortDirection:i,searchFields:c=["title","description"],defaultSortKey:l="updated_at",pageSize:d=100}=e,p=`COLLECTION_${n.toUpperCase()}_LIST`,m=b(t,r,c),y=D(a,i,l),E={...m&&{where:m},...y&&{orderBy:y},limit:d,offset:0},C=JSON.stringify(E);return x.mcpToolCall(o,p,C)}function j(o,n,s){const e=w.c(33),t=Q();let r;e[0]!==n?(r=n.toUpperCase(),e[0]=n,e[1]=r):r=e[1];const a=r,i=`COLLECTION_${a}_CREATE`,c=`COLLECTION_${a}_UPDATE`,l=`COLLECTION_${a}_DELETE`;let d;e[2]!==t||e[3]!==a?(d=()=>{t.invalidateQueries({predicate:_=>{const u=_.queryKey;if(u[0]!=="mcp"||u[1]!=="client"||u[3]!=="tool-call")return!1;const L=u[4];return typeof L=="string"&&L.startsWith(`COLLECTION_${a}_`)}})},e[2]=t,e[3]=a,e[4]=d):d=e[4];const f=d;let p;e[5]!==s||e[6]!==i?(p=async _=>{const u=await s.callTool({name:i,arguments:{data:_}});if(u.isError)throw new Error(Array.isArray(u.content)?u.content[0]?.text:String(u.content));return I(u).item},e[5]=s,e[6]=i,e[7]=p):p=e[7];let m;e[8]!==f?(m=()=>{f(),h.success("Item created successfully")},e[8]=f,e[9]=m):m=e[9];let y;e[10]!==p||e[11]!==m?(y={mutationFn:p,onSuccess:m,onError:W},e[10]=p,e[11]=m,e[12]=y):y=e[12];const E=F(y);let C;e[13]!==s||e[14]!==c?(C=async _=>{const{id:u,data:L}=_,M=await s.callTool({name:c,arguments:{id:u,data:L}});return I(M).item},e[13]=s,e[14]=c,e[15]=C):C=e[15];let g;e[16]!==f?(g=()=>{f(),h.success("Item updated successfully")},e[16]=f,e[17]=g):g=e[17];let N;e[18]!==C||e[19]!==g?(N={mutationFn:C,onSuccess:g,onError:J},e[18]=C,e[19]=g,e[20]=N):N=e[20];const S=F(N);let T;e[21]!==s||e[22]!==l?(T=async _=>{const u=await s.callTool({name:l,arguments:{id:_}});return I(u).item.id},e[21]=s,e[22]=l,e[23]=T):T=e[23];let O;e[24]!==f?(O=()=>{f(),h.success("Item deleted successfully")},e[24]=f,e[25]=O):O=e[25];let K;e[26]!==T||e[27]!==O?(K={mutationFn:T,onSuccess:O,onError:z},e[26]=T,e[27]=O,e[28]=K):K=e[28];const A=F(K);let $;return e[29]!==E||e[30]!==A||e[31]!==S?($={create:E,update:S,delete:A},e[29]=E,e[30]=A,e[31]=S,e[32]=$):$=e[32],$}function z(o){const n=o instanceof Error?o.message:String(o);h.error(`Failed to delete item: ${n}`)}function J(o){const n=o instanceof Error?o.message:String(o);h.error(`Failed to update item: ${n}`)}function W(o){const n=o instanceof Error?o.message:String(o);h.error(`Failed to create item: ${n}`)}function Z(o){const n=w.c(4);let s;n[0]!==o?(s=o===void 0?{}:o,n[0]=o,n[1]=s):s=n[1];const e=s,{org:t}=v();let r;n[2]!==t.id?(r={connectionId:q,orgId:t.id},n[2]=t.id,n[3]=r):r=n[3];const a=U(r);return R(t.id,"CONNECTIONS",a,e)}function ee(o){const n=w.c(2),{org:s}=v();let e;n[0]!==s.id?(e={connectionId:q,orgId:s.id},n[0]=s.id,n[1]=e):e=n[1];const t=U(e);return k(s.id,"CONNECTIONS",o,t)}function te(){const o=w.c(2),{org:n}=v();let s;o[0]!==n.id?(s={connectionId:q,orgId:n.id},o[0]=n.id,o[1]=s):s=o[1];const e=U(s);return j(n.id,"CONNECTIONS",e)}export{B as E,D as a,X as b,b as c,k as d,R as e,ee as f,te as g,Z as h,j as u};
@@ -1 +1 @@
1
- import{c as p,u as m,m as C,O as f}from"./index-D5tmQFLM.js";import{a as v}from"./use-virtual-mcp-CK08RGTF.js";function M(s){const e=p.c(10);let a;e[0]!==s?(a=s===void 0?{}:s,e[0]=s,e[1]=a):a=e[1];const d=a,{navigateOnCreate:l}=d,o=l===void 0?!1:l,{org:r}=m(),c=C(),t=v();let n;e[2]!==t.create||e[3]!==c||e[4]!==o||e[5]!==r?(n=async()=>{const g=await t.create.mutateAsync({title:"New Agent",description:"Agents let you securely expose integrated tools to the outside world.",status:"active",connections:[]});return o&&c({to:"/$org/$project/agents/$agentId",params:{org:r.slug,project:f,agentId:g.id}}),{id:g.id,virtualMcp:g}},e[2]=t.create,e[3]=c,e[4]=o,e[5]=r,e[6]=n):n=e[6];const u=n;let i;return e[7]!==t.create.isPending||e[8]!==u?(i={createVirtualMCP:u,isCreating:t.create.isPending},e[7]=t.create.isPending,e[8]=u,e[9]=i):i=e[9],i}export{M as u};
1
+ import{c as p,u as m,m as C,O as f}from"./index-CCcWAtA_.js";import{a as v}from"./use-virtual-mcp-ByfXJ3SB.js";function M(s){const e=p.c(10);let a;e[0]!==s?(a=s===void 0?{}:s,e[0]=s,e[1]=a):a=e[1];const d=a,{navigateOnCreate:l}=d,o=l===void 0?!1:l,{org:r}=m(),c=C(),t=v();let n;e[2]!==t.create||e[3]!==c||e[4]!==o||e[5]!==r?(n=async()=>{const g=await t.create.mutateAsync({title:"New Agent",description:"Agents let you securely expose integrated tools to the outside world.",status:"active",connections:[]});return o&&c({to:"/$org/$project/agents/$agentId",params:{org:r.slug,project:f,agentId:g.id}}),{id:g.id,virtualMcp:g}},e[2]=t.create,e[3]=c,e[4]=o,e[5]=r,e[6]=n):n=e[6];const u=n;let i;return e[7]!==t.create.isPending||e[8]!==u?(i={createVirtualMCP:u,isCreating:t.create.isPending},e[7]=t.create.isPending,e[8]=u,e[9]=i):i=e[9],i}export{M as u};
@@ -0,0 +1,23 @@
1
+ import{r as C,bw as Ga,bx as Ya,F as Qa,bf as z,s as y,by as We,bz as na,bj as Xa,bk as Ka,be as es,bg as F,ba as Te,ae as Pe,o as P,bh as I,bi as ce,bA as ts,bB as O,af as as,b5 as ss,c as $,u as Ie,K as Oe,a as ia,v as vt,t as yt,j as d,g as rs,am as os,_ as xt,at as ns,an as is,aq as ls,av as cs,al as us,b0 as ds}from"./index-CCcWAtA_.js";import{u as bt,a as _t,d as ps}from"./constants-PBHJ4h9F.js";import{b as ms}from"./use-virtual-mcp-ByfXJ3SB.js";import{a as fs,u as Et}from"./use-llm-Lxpo1ior.js";import{u as hs}from"./useQuery-Dp4Sp9Q1.js";import{b as It,c as gs,a as vs,e as ys}from"./use-connection-BCPygOxC.js";import{u as xs}from"./Code01-BHb1dfFm.js";import{u as Ae,L as Ge}from"./localstorage-keys-BWsOCDUX.js";import{B as bs}from"./button-BKtq_PYU.js";import{I as _s}from"./input-Dh6Cjukb.js";import{P as Es,a as Is,b as Ss}from"./popover-Bn1QrYWJ.js";import{S as ws,a as Ns,b as Cs,c as Ts,d as As}from"./select-CJ01X7RE.js";import{c as St}from"./utils-CnoQZeDK.js";import{t as Dt}from"./ChevronDown-BmbIYWgz.js";import{i as Ms}from"./File06-g3-IRgq5.js";import{c as Rs}from"./Grid01-CzUkHZSJ.js";import{a as js}from"./Image01-C213KIPf.js";import{i as la}from"./SearchMd-rxhL9uWW.js";var Me;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function a(r){throw new Error}t.assertNever=a,t.arrayToEnum=r=>{const o={};for(const i of r)o[i]=i;return o},t.getValidEnumValues=r=>{const o=t.objectKeys(r).filter(n=>typeof r[r[n]]!="number"),i={};for(const n of o)i[n]=r[n];return t.objectValues(i)},t.objectValues=r=>t.objectKeys(r).map(function(o){return r[o]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const o=[];for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&o.push(i);return o},t.find=(r,o)=>{for(const i of r)if(o(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 s(r,o=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}t.joinValues=s,t.jsonStringifyReplacer=(r,o)=>typeof o=="bigint"?o.toString():o})(Me||(Me={}));var $t;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})($t||($t={}));Me.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);Me.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 Je extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){const a=e||function(o){return o.message},s={_errors:[]},r=o=>{for(const i of o.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)s._errors.push(a(i));else{let n=s,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(n[l]=n[l]||{_errors:[]},n[l]._errors.push(a(i))):n[l]=n[l]||{_errors:[]},n=n[l],c++}}};return r(this),s}static assert(e){if(!(e instanceof Je))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Me.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){const a=Object.create(null),s=[];for(const r of this.issues)if(r.path.length>0){const o=r.path[0];a[o]=a[o]||[],a[o].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:a}}get formErrors(){return this.flatten()}}Je.create=t=>new Je(t);var Lt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Lt||(Lt={}));var N;(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"})(N||(N={}));const Ps=({size:t=24,color:e="currentColor",...a})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},C.createElement("path",{d:"M4 7h11m0 0-4 4m4-4-4-4M4 17h16m0 0-4 4m4-4-4-4"}));Ps.displayName="ArrowsRight";const ca=({size:t=24,color:e="currentColor",...a})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},C.createElement("path",{d:"m7 15 5 5 5-5M7 9l5-5 5 5"}));ca.displayName="ChevronSelectorVertical";const ua=({size:t=24,color:e="currentColor",...a})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},C.createElement("path",{d:"M6 16a4 4 0 0 0 4 4h4a4 4 0 0 0 0-8h-4a4 4 0 0 1 0-8h4a4 4 0 0 1 4 4m-6-6v20"}));ua.displayName="CurrencyDollar";const Os=({size:t=24,color:e="currentColor",...a})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},C.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"}));Os.displayName="Lightbulb02";const da=({size:t=24,color:e="currentColor",...a})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},C.createElement("path",{d:"m18 8 4 4m0 0-4 4m4-4H9m6-7.796A8.383 8.383 0 0 0 10.667 3C5.88 3 2 7.03 2 12s3.88 9 8.667 9A8.384 8.384 0 0 0 15 19.796"}));da.displayName="LogOut04";const pa=({size:t=24,color:e="currentColor",...a})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},C.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"}));pa.displayName="Stars01";var ma="vercel.ai.error",ks=Symbol.for(ma),Zt,Ft,oe=class fa extends(Ft=Error,Zt=ks,Ft){constructor({name:e,message:a,cause:s}){super(a),this[Zt]=!0,this.name=e,this.cause=s}static isInstance(e){return fa.hasMarker(e,ma)}static hasMarker(e,a){const s=Symbol.for(a);return e!=null&&typeof e=="object"&&s in e&&typeof e[s]=="boolean"&&e[s]===!0}};function ha(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var ga="AI_InvalidArgumentError",va=`vercel.ai.error.${ga}`,Ds=Symbol.for(va),Ut,zt,$s=class extends(zt=oe,Ut=Ds,zt){constructor({message:t,cause:e,argument:a}){super({name:ga,message:t,cause:e}),this[Ut]=!0,this.argument=a}static isInstance(t){return oe.hasMarker(t,va)}},ya="AI_JSONParseError",xa=`vercel.ai.error.${ya}`,Ls=Symbol.for(xa),Bt,Vt,qt=class extends(Vt=oe,Bt=Ls,Vt){constructor({text:t,cause:e}){super({name:ya,message:`JSON parsing failed: Text: ${t}.
2
+ Error message: ${ha(e)}`,cause:e}),this[Bt]=!0,this.text=t}static isInstance(t){return oe.hasMarker(t,xa)}},ba="AI_TypeValidationError",_a=`vercel.ai.error.${ba}`,Zs=Symbol.for(_a),Ht,Wt,Ee=class ct extends(Wt=oe,Ht=Zs,Wt){constructor({value:e,cause:a,context:s}){let r="Type validation failed";if(s?.field&&(r+=` for ${s.field}`),s?.entityName||s?.entityId){r+=" (";const o=[];s.entityName&&o.push(s.entityName),s.entityId&&o.push(`id: "${s.entityId}"`),r+=o.join(", "),r+=")"}super({name:ba,message:`${r}: Value: ${JSON.stringify(e)}.
3
+ Error message: ${ha(a)}`,cause:a}),this[Ht]=!0,this.value=e,this.context=s}static isInstance(e){return oe.hasMarker(e,_a)}static wrap({value:e,cause:a,context:s}){var r,o,i;return ct.isInstance(a)&&a.value===e&&((r=a.context)==null?void 0:r.field)===s?.field&&((o=a.context)==null?void 0:o.entityName)===s?.entityName&&((i=a.context)==null?void 0:i.entityId)===s?.entityId?a:new ct({value:e,cause:a,context:s})}},ke=({prefix:t,size:e=16,alphabet:a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:s="-"}={})=>{const r=()=>{const o=a.length,i=new Array(e);for(let n=0;n<e;n++)i[n]=a[Math.random()*o|0];return i.join("")};if(t==null)return r;if(a.includes(s))throw new $s({argument:"separator",message:`The separator "${s}" must not be part of the alphabet "${a}".`});return()=>`${t}${s}${r()}`},Fs=ke();function Jt(t=globalThis){var e,a,s;return t.window?"runtime/browser":(e=t.navigator)!=null&&e.userAgent?`runtime/${t.navigator.userAgent.toLowerCase()}`:(s=(a=t.process)==null?void 0:a.versions)!=null&&s.node?`runtime/node.js/${t.process.version.substring(0)}`:t.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function fe(t){if(t==null)return{};const e={};if(t instanceof Headers)t.forEach((a,s)=>{e[s.toLowerCase()]=a});else{Array.isArray(t)||(t=Object.entries(t));for(const[a,s]of t)s!=null&&(e[a.toLowerCase()]=s)}return e}function Gt(t,...e){const a=new Headers(fe(t)),s=a.get("user-agent")||"";return a.set("user-agent",[s,...e].filter(Boolean).join(" ")),Object.fromEntries(a.entries())}var Us=/"__proto__"\s*:/,zs=/"constructor"\s*:/;function Yt(t){const e=JSON.parse(t);return e===null||typeof e!="object"||Us.test(t)===!1&&zs.test(t)===!1?e:Bs(e)}function Bs(t){let e=[t];for(;e.length;){const a=e;e=[];for(const s of a){if(Object.prototype.hasOwnProperty.call(s,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(s,"constructor")&&Object.prototype.hasOwnProperty.call(s.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const r in s){const o=s[r];o&&typeof o=="object"&&e.push(o)}}}return t}function Vs(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return Yt(t)}try{return Yt(t)}finally{Error.stackTraceLimit=e}}function wt(t){if(t.type==="object"||Array.isArray(t.type)&&t.type.includes("object")){t.additionalProperties=!1;const{properties:a}=t;if(a!=null)for(const s of Object.keys(a))a[s]=me(a[s])}t.items!=null&&(t.items=Array.isArray(t.items)?t.items.map(me):me(t.items)),t.anyOf!=null&&(t.anyOf=t.anyOf.map(me)),t.allOf!=null&&(t.allOf=t.allOf.map(me)),t.oneOf!=null&&(t.oneOf=t.oneOf.map(me));const{definitions:e}=t;if(e!=null)for(const a of Object.keys(e))e[a]=me(e[a]);return t}function me(t){return typeof t=="boolean"?t:wt(t)}var qs=Symbol("Let zodToJsonSchema decide on which parser to use"),Qt={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"},Hs=t=>typeof t=="string"?{...Qt,name:t}:{...Qt,...t};function V(){return{}}function Ws(t,e){var a,s,r;const o={type:"array"};return(a=t.type)!=null&&a._def&&((r=(s=t.type)==null?void 0:s._def)==null?void 0:r.typeName)!==N.ZodAny&&(o.items=R(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(o.minItems=t.minLength.value),t.maxLength&&(o.maxItems=t.maxLength.value),t.exactLength&&(o.minItems=t.exactLength.value,o.maxItems=t.exactLength.value),o}function Js(t){const e={type:"integer",format:"int64"};if(!t.checks)return e;for(const a of t.checks)switch(a.kind){case"min":a.inclusive?e.minimum=a.value:e.exclusiveMinimum=a.value;break;case"max":a.inclusive?e.maximum=a.value:e.exclusiveMaximum=a.value;break;case"multipleOf":e.multipleOf=a.value;break}return e}function Gs(){return{type:"boolean"}}function Ea(t,e){return R(t.type._def,e)}var Ys=(t,e)=>R(t.innerType._def,e);function Ia(t,e,a){const s=a??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,o)=>Ia(t,e,r))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Qs(t)}}var Qs=t=>{const e={type:"integer",format:"unix-time"};for(const a of t.checks)switch(a.kind){case"min":e.minimum=a.value;break;case"max":e.maximum=a.value;break}return e};function Xs(t,e){return{...R(t.innerType._def,e),default:t.defaultValue()}}function Ks(t,e){return e.effectStrategy==="input"?R(t.schema._def,e):V()}function er(t){return{type:"string",enum:Array.from(t.values)}}var tr=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function ar(t,e){const a=[R(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),R(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(r=>!!r),s=[];return a.forEach(r=>{if(tr(r))s.push(...r.allOf);else{let o=r;if("additionalProperties"in r&&r.additionalProperties===!1){const{additionalProperties:i,...n}=r;o=n}s.push(o)}}),s.length?{allOf:s}:void 0}function sr(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 nt=void 0,Y={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:()=>(nt===void 0&&(nt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),nt),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 Sa(t,e){const a={type:"string"};if(t.checks)for(const s of t.checks)switch(s.kind){case"min":a.minLength=typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value;break;case"max":a.maxLength=typeof a.maxLength=="number"?Math.min(a.maxLength,s.value):s.value;break;case"email":switch(e.emailStrategy){case"format:email":Q(a,"email",s.message,e);break;case"format:idn-email":Q(a,"idn-email",s.message,e);break;case"pattern:zod":Z(a,Y.email,s.message,e);break}break;case"url":Q(a,"uri",s.message,e);break;case"uuid":Q(a,"uuid",s.message,e);break;case"regex":Z(a,s.regex,s.message,e);break;case"cuid":Z(a,Y.cuid,s.message,e);break;case"cuid2":Z(a,Y.cuid2,s.message,e);break;case"startsWith":Z(a,RegExp(`^${it(s.value,e)}`),s.message,e);break;case"endsWith":Z(a,RegExp(`${it(s.value,e)}$`),s.message,e);break;case"datetime":Q(a,"date-time",s.message,e);break;case"date":Q(a,"date",s.message,e);break;case"time":Q(a,"time",s.message,e);break;case"duration":Q(a,"duration",s.message,e);break;case"length":a.minLength=typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value,a.maxLength=typeof a.maxLength=="number"?Math.min(a.maxLength,s.value):s.value;break;case"includes":{Z(a,RegExp(it(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&Q(a,"ipv4",s.message,e),s.version!=="v4"&&Q(a,"ipv6",s.message,e);break}case"base64url":Z(a,Y.base64url,s.message,e);break;case"jwt":Z(a,Y.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&Z(a,Y.ipv4Cidr,s.message,e),s.version!=="v4"&&Z(a,Y.ipv6Cidr,s.message,e);break}case"emoji":Z(a,Y.emoji(),s.message,e);break;case"ulid":{Z(a,Y.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Q(a,"binary",s.message,e);break}case"contentEncoding:base64":{a.contentEncoding="base64";break}case"pattern:zod":{Z(a,Y.base64,s.message,e);break}}break}case"nanoid":Z(a,Y.nanoid,s.message,e)}return a}function it(t,e){return e.patternStrategy==="escape"?or(t):t}var rr=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function or(t){let e="";for(let a=0;a<t.length;a++)rr.has(t[a])||(e+="\\"),e+=t[a];return e}function Q(t,e,a,s){var r;t.format||(r=t.anyOf)!=null&&r.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format}),delete t.format),t.anyOf.push({format:e,...a&&s.errorMessages&&{errorMessage:{format:a}}})):t.format=e}function Z(t,e,a,s){var r;t.pattern||(r=t.allOf)!=null&&r.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern}),delete t.pattern),t.allOf.push({pattern:Xt(e,s),...a&&s.errorMessages&&{errorMessage:{pattern:a}}})):t.pattern=Xt(e,s)}function Xt(t,e){var a;if(!e.applyRegexFlags||!t.flags)return t.source;const s={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},r=s.i?t.source.toLowerCase():t.source;let o="",i=!1,n=!1,c=!1;for(let l=0;l<r.length;l++){if(i){o+=r[l],i=!1;continue}if(s.i){if(n){if(r[l].match(/[a-z]/)){c?(o+=r[l],o+=`${r[l-2]}-${r[l]}`.toUpperCase(),c=!1):r[l+1]==="-"&&((a=r[l+2])!=null&&a.match(/[a-z]/))?(o+=r[l],c=!0):o+=`${r[l]}${r[l].toUpperCase()}`;continue}}else if(r[l].match(/[a-z]/)){o+=`[${r[l]}${r[l].toUpperCase()}]`;continue}}if(s.m){if(r[l]==="^"){o+=`(^|(?<=[\r
4
+ ]))`;continue}else if(r[l]==="$"){o+=`($|(?=[\r
5
+ ]))`;continue}}if(s.s&&r[l]==="."){o+=n?`${r[l]}\r
6
+ `:`[${r[l]}\r
7
+ ]`;continue}o+=r[l],r[l]==="\\"?i=!0:n&&r[l]==="]"?n=!1:!n&&r[l]==="["&&(n=!0)}try{new RegExp(o)}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 o}function wa(t,e){var a,s,r,o,i,n;const c={type:"object",additionalProperties:(a=R(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?a:e.allowedAdditionalProperties};if(((s=t.keyType)==null?void 0:s._def.typeName)===N.ZodString&&((r=t.keyType._def.checks)!=null&&r.length)){const{type:l,...p}=Sa(t.keyType._def,e);return{...c,propertyNames:p}}else{if(((o=t.keyType)==null?void 0:o._def.typeName)===N.ZodEnum)return{...c,propertyNames:{enum:t.keyType._def.values}};if(((i=t.keyType)==null?void 0:i._def.typeName)===N.ZodBranded&&t.keyType._def.type._def.typeName===N.ZodString&&((n=t.keyType._def.type._def.checks)!=null&&n.length)){const{type:l,...p}=Ea(t.keyType._def,e);return{...c,propertyNames:p}}}return c}function nr(t,e){if(e.mapStrategy==="record")return wa(t,e);const a=R(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||V(),s=R(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||V();return{type:"array",maxItems:125,items:{type:"array",items:[a,s],minItems:2,maxItems:2}}}function ir(t){const e=t.values,s=Object.keys(t.values).filter(o=>typeof e[e[o]]!="number").map(o=>e[o]),r=Array.from(new Set(s.map(o=>typeof o)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:s}}function lr(){return{not:V()}}function cr(){return{type:"null"}}var ut={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function ur(t,e){const a=t.options instanceof Map?Array.from(t.options.values()):t.options;if(a.every(s=>s._def.typeName in ut&&(!s._def.checks||!s._def.checks.length))){const s=a.reduce((r,o)=>{const i=ut[o._def.typeName];return i&&!r.includes(i)?[...r,i]:r},[]);return{type:s.length>1?s:s[0]}}else if(a.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){const s=a.reduce((r,o)=>{const i=typeof o._def.value;switch(i){case"string":case"number":case"boolean":return[...r,i];case"bigint":return[...r,"integer"];case"object":if(o._def.value===null)return[...r,"null"];default:return r}},[]);if(s.length===a.length){const r=s.filter((o,i,n)=>n.indexOf(o)===i);return{type:r.length>1?r:r[0],enum:a.reduce((o,i)=>o.includes(i._def.value)?o:[...o,i._def.value],[])}}}else if(a.every(s=>s._def.typeName==="ZodEnum"))return{type:"string",enum:a.reduce((s,r)=>[...s,...r._def.values.filter(o=>!s.includes(o))],[])};return dr(t,e)}var dr=(t,e)=>{const a=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((s,r)=>R(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return a.length?{anyOf:a}:void 0};function pr(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[ut[t.innerType._def.typeName],"null"]};const a=R(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}function mr(t){const e={type:"number"};if(!t.checks)return e;for(const a of t.checks)switch(a.kind){case"int":e.type="integer";break;case"min":a.inclusive?e.minimum=a.value:e.exclusiveMinimum=a.value;break;case"max":a.inclusive?e.maximum=a.value:e.exclusiveMaximum=a.value;break;case"multipleOf":e.multipleOf=a.value;break}return e}function fr(t,e){const a={type:"object",properties:{}},s=[],r=t.shape();for(const i in r){let n=r[i];if(n===void 0||n._def===void 0)continue;const c=gr(n),l=R(n._def,{...e,currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]});l!==void 0&&(a.properties[i]=l,c||s.push(i))}s.length&&(a.required=s);const o=hr(t,e);return o!==void 0&&(a.additionalProperties=o),a}function hr(t,e){if(t.catchall._def.typeName!=="ZodNever")return R(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 gr(t){try{return t.isOptional()}catch{return!0}}var vr=(t,e)=>{var a;if(e.currentPath.toString()===((a=e.propertyPath)==null?void 0:a.toString()))return R(t.innerType._def,e);const s=R(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return s?{anyOf:[{not:V()},s]}:V()},yr=(t,e)=>{if(e.pipeStrategy==="input")return R(t.in._def,e);if(e.pipeStrategy==="output")return R(t.out._def,e);const a=R(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=R(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",a?"1":"0"]});return{allOf:[a,s].filter(r=>r!==void 0)}};function xr(t,e){return R(t.type._def,e)}function br(t,e){const s={type:"array",uniqueItems:!0,items:R(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(s.minItems=t.minSize.value),t.maxSize&&(s.maxItems=t.maxSize.value),s}function _r(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((a,s)=>R(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[]),additionalItems:R(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((a,s)=>R(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[])}}function Er(){return{not:V()}}function Ir(){return V()}var Sr=(t,e)=>R(t.innerType._def,e),wr=(t,e,a)=>{switch(e){case N.ZodString:return Sa(t,a);case N.ZodNumber:return mr(t);case N.ZodObject:return fr(t,a);case N.ZodBigInt:return Js(t);case N.ZodBoolean:return Gs();case N.ZodDate:return Ia(t,a);case N.ZodUndefined:return Er();case N.ZodNull:return cr();case N.ZodArray:return Ws(t,a);case N.ZodUnion:case N.ZodDiscriminatedUnion:return ur(t,a);case N.ZodIntersection:return ar(t,a);case N.ZodTuple:return _r(t,a);case N.ZodRecord:return wa(t,a);case N.ZodLiteral:return sr(t);case N.ZodEnum:return er(t);case N.ZodNativeEnum:return ir(t);case N.ZodNullable:return pr(t,a);case N.ZodOptional:return vr(t,a);case N.ZodMap:return nr(t,a);case N.ZodSet:return br(t,a);case N.ZodLazy:return()=>t.getter()._def;case N.ZodPromise:return xr(t,a);case N.ZodNaN:case N.ZodNever:return lr();case N.ZodEffects:return Ks(t,a);case N.ZodAny:return V();case N.ZodUnknown:return Ir();case N.ZodDefault:return Xs(t,a);case N.ZodBranded:return Ea(t,a);case N.ZodReadonly:return Sr(t,a);case N.ZodCatch:return Ys(t,a);case N.ZodPipeline:return yr(t,a);case N.ZodFunction:case N.ZodVoid:case N.ZodSymbol:return;default:return(s=>{})()}},Nr=(t,e)=>{let a=0;for(;a<t.length&&a<e.length&&t[a]===e[a];a++);return[(t.length-a).toString(),...e.slice(a)].join("/")};function R(t,e,a=!1){var s;const r=e.seen.get(t);if(e.override){const c=(s=e.override)==null?void 0:s.call(e,t,e,r,a);if(c!==qs)return c}if(r&&!a){const c=Cr(r,e);if(c!==void 0)return c}const o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);const i=wr(t,t.typeName,e),n=typeof i=="function"?R(i(),e):i;if(n&&Tr(t,e,n),e.postProcess){const c=e.postProcess(n,t,e);return o.jsonSchema=n,c}return o.jsonSchema=n,n}var Cr=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Nr(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((a,s)=>e.currentPath[s]===a)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),V()):e.$refStrategy==="seen"?V():void 0}},Tr=(t,e,a)=>(t.description&&(a.description=t.description),a),Ar=t=>{const e=Hs(t),a=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:a,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([s,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}},Mr=(t,e)=>{var a;const s=Ar(e);let r=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[p,m])=>{var h;return{...l,[p]:(h=R(m._def,{...s,currentPath:[...s.basePath,s.definitionPath,p]},!0))!=null?h:V()}},{}):void 0;const o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=(a=R(t._def,o===void 0?s:{...s,currentPath:[...s.basePath,s.definitionPath,o]},!1))!=null?a:V(),n=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;n!==void 0&&(i.title=n);const c=o===void 0?r?{...i,[s.definitionPath]:r}:i:{$ref:[...s.$refStrategy==="relative"?[]:s.basePath,s.definitionPath,o].join("/"),[s.definitionPath]:{...r,[o]:i}};return c.$schema="http://json-schema.org/draft-07/schema#",c},dt=Symbol.for("vercel.ai.schema");function Rr(t){let e;return()=>(e==null&&(e=t()),e)}function Ye(t,{validate:e}={}){return{[dt]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function jr(t){return typeof t=="object"&&t!==null&&dt in t&&t[dt]===!0&&"jsonSchema"in t&&"validate"in t}function Nt(t){return t==null?Ye({properties:{},additionalProperties:!1}):jr(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?Na(t):Pr(t):t()}function Pr(t){return Ye(()=>wt(t["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async e=>{const a=await t["~standard"].validate(e);return"value"in a?{success:!0,value:a.value}:{success:!1,error:new Ee({value:e,cause:a.issues})}}})}function Or(t,e){var a;const s=(a=void 0)!=null?a:!1;return Ye(()=>Mr(t,{$refStrategy:s?"root":"none"}),{validate:async r=>{const o=await t.safeParseAsync(r);return o.success?{success:!0,value:o.data}:{success:!1,error:o.error}}})}function kr(t,e){var a;const s=(a=void 0)!=null?a:!1;return Ye(()=>wt(Qa(t,{target:"draft-7",io:"input",reused:s?"ref":"inline"})),{validate:async r=>{const o=await Ya(t,r);return o.success?{success:!0,value:o.data}:{success:!1,error:o.error}}})}function Dr(t){return"_zod"in t}function Na(t,e){return Dr(t)?kr(t):Or(t)}async function Kt({value:t,schema:e,context:a}){const s=await Re({value:t,schema:e,context:a});if(!s.success)throw Ee.wrap({value:t,cause:s.error,context:a});return s.value}async function Re({value:t,schema:e,context:a}){const s=Nt(e);try{if(s.validate==null)return{success:!0,value:t,rawValue:t};const r=await s.validate(t);return r.success?{success:!0,value:r.value,rawValue:t}:{success:!1,error:Ee.wrap({value:t,cause:r.error,context:a}),rawValue:t}}catch(r){return{success:!1,error:Ee.wrap({value:t,cause:r,context:a}),rawValue:t}}}async function he({text:t,schema:e}){try{const a=Vs(t);return e==null?{success:!0,value:a,rawValue:a}:await Re({value:a,schema:e})}catch(a){return{success:!1,error:qt.isInstance(a)?a:new qt({text:t,cause:a}),rawValue:void 0}}}function $r({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new Ga).pipeThrough(new TransformStream({async transform({data:a},s){a!=="[DONE]"&&s.enqueue(await he({text:a,schema:e}))}}))}async function de(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var Lr=Object.defineProperty,Zr=(t,e)=>{for(var a in e)Lr(t,a,{get:e[a],enumerable:!0})},Ca="AI_NoObjectGeneratedError",Ta=`vercel.ai.error.${Ca}`,Fr=Symbol.for(Ta),Aa,pe=class extends oe{constructor({message:t="No object generated.",cause:e,text:a,response:s,usage:r,finishReason:o}){super({name:Ca,message:t,cause:e}),this[Aa]=!0,this.text=a,this.response=s,this.usage=r,this.finishReason=o}static isInstance(t){return oe.hasMarker(t,Ta)}};Aa=Fr;var Ma="AI_UIMessageStreamError",Ra=`vercel.ai.error.${Ma}`,Ur=Symbol.for(Ra),ja,xe=class extends oe{constructor({chunkType:t,chunkId:e,message:a}){super({name:Ma,message:a}),this[ja]=!0,this.chunkType=t,this.chunkId=e}static isInstance(t){return oe.hasMarker(t,Ra)}};ja=Ur;var ea="6.0.72",Pa=z([y(),We(Uint8Array),We(ArrayBuffer),na(t=>{var e,a;return(a=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?a:!1},{message:"Must be a Buffer"})]),je=Xa(()=>z([Ka(),y(),es(),F(),Te(y(),je.optional()),Pe(je)])),A=Te(y(),Te(y(),je.optional())),Oa=P({type:I("text"),text:y(),providerOptions:A.optional()}),zr=P({type:I("image"),image:z([Pa,We(URL)]),mediaType:y().optional(),providerOptions:A.optional()}),ka=P({type:I("file"),data:z([Pa,We(URL)]),filename:y().optional(),mediaType:y(),providerOptions:A.optional()}),Br=P({type:I("reasoning"),text:y(),providerOptions:A.optional()}),Vr=P({type:I("tool-call"),toolCallId:y(),toolName:y(),input:ce(),providerOptions:A.optional(),providerExecuted:F().optional()}),qr=ts("type",[P({type:I("text"),value:y(),providerOptions:A.optional()}),P({type:I("json"),value:je,providerOptions:A.optional()}),P({type:I("execution-denied"),reason:y().optional(),providerOptions:A.optional()}),P({type:I("error-text"),value:y(),providerOptions:A.optional()}),P({type:I("error-json"),value:je,providerOptions:A.optional()}),P({type:I("content"),value:Pe(z([P({type:I("text"),text:y(),providerOptions:A.optional()}),P({type:I("media"),data:y(),mediaType:y()}),P({type:I("file-data"),data:y(),mediaType:y(),filename:y().optional(),providerOptions:A.optional()}),P({type:I("file-url"),url:y(),providerOptions:A.optional()}),P({type:I("file-id"),fileId:z([y(),Te(y(),y())]),providerOptions:A.optional()}),P({type:I("image-data"),data:y(),mediaType:y(),providerOptions:A.optional()}),P({type:I("image-url"),url:y(),providerOptions:A.optional()}),P({type:I("image-file-id"),fileId:z([y(),Te(y(),y())]),providerOptions:A.optional()}),P({type:I("custom"),providerOptions:A.optional()})]))})]),Da=P({type:I("tool-result"),toolCallId:y(),toolName:y(),output:qr,providerOptions:A.optional()}),Hr=P({type:I("tool-approval-request"),approvalId:y(),toolCallId:y()}),Wr=P({type:I("tool-approval-response"),approvalId:y(),approved:F(),reason:y().optional()}),Jr=P({role:I("system"),content:y(),providerOptions:A.optional()}),Gr=P({role:I("user"),content:z([y(),Pe(z([Oa,zr,ka]))]),providerOptions:A.optional()}),Yr=P({role:I("assistant"),content:z([y(),Pe(z([Oa,ka,Br,Vr,Da,Hr]))]),providerOptions:A.optional()}),Qr=P({role:I("tool"),content:Pe(z([Da,Wr])),providerOptions:A.optional()});z([Jr,Gr,Yr,Qr]);function $a(t,e){if(t===void 0&&e===void 0)return;if(t===void 0)return e;if(e===void 0)return t;const a={...t};for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)){const r=e[s];if(r===void 0)continue;const o=s in t?t[s]:void 0,i=r!==null&&typeof r=="object"&&!Array.isArray(r)&&!(r instanceof Date)&&!(r instanceof RegExp),n=o!=null&&typeof o=="object"&&!Array.isArray(o)&&!(o instanceof Date)&&!(o instanceof RegExp);i&&n?a[s]=$a(o,r):a[s]=r}return a}var Xr={};Zr(Xr,{array:()=>ao,choice:()=>so,json:()=>ro,object:()=>to,text:()=>eo});function Kr(t){const e=["ROOT"];let a=-1,s=null;function r(c,l,p){switch(c){case'"':{a=l,e.pop(),e.push(p),e.push("INSIDE_STRING");break}case"f":case"t":case"n":{a=l,s=l,e.pop(),e.push(p),e.push("INSIDE_LITERAL");break}case"-":{e.pop(),e.push(p),e.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{a=l,e.pop(),e.push(p),e.push("INSIDE_NUMBER");break}case"{":{a=l,e.pop(),e.push(p),e.push("INSIDE_OBJECT_START");break}case"[":{a=l,e.pop(),e.push(p),e.push("INSIDE_ARRAY_START");break}}}function o(c,l){switch(c){case",":{e.pop(),e.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{a=l,e.pop();break}}}function i(c,l){switch(c){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{a=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"}":{a=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":{o(l,c);break}case"INSIDE_STRING":{switch(l){case'"':{e.pop(),a=c;break}case"\\":{e.push("INSIDE_STRING_ESCAPE");break}default:a=c}break}case"INSIDE_ARRAY_START":{l==="]"?(a=c,e.pop()):(a=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"]":{a=c,e.pop();break}default:{a=c;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{r(l,c,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{e.pop(),a=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":{a=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"&&o(l,c);break}case"}":{e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&o(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(s,c+1);!"false".startsWith(m)&&!"true".startsWith(m)&&!"null".startsWith(m)?(e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?o(l,c):e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(l,c)):a=c;break}}}let n=t.slice(0,a+1);for(let c=e.length-1;c>=0;c--)switch(e[c]){case"INSIDE_STRING":{n+='"';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":{n+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{n+="]";break}case"INSIDE_LITERAL":{const p=t.substring(s,t.length);"true".startsWith(p)?n+="true".slice(p.length):"false".startsWith(p)?n+="false".slice(p.length):"null".startsWith(p)&&(n+="null".slice(p.length))}}return n}async function De(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await he({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await he({text:Kr(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var eo=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}},createElementStreamTransform(){}}),to=({schema:t,name:e,description:a})=>{const s=Nt(t);return{name:"object",responseFormat:de(s.jsonSchema).then(r=>({type:"json",schema:r,...e!=null&&{name:e},...a!=null&&{description:a}})),async parseCompleteOutput({text:r},o){const i=await he({text:r});if(!i.success)throw new pe({message:"No object generated: could not parse the response.",cause:i.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});const n=await Re({value:i.value,schema:s});if(!n.success)throw new pe({message:"No object generated: response did not match schema.",cause:n.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});return n.value},async parsePartialOutput({text:r}){const o=await De(r);switch(o.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:o.value}}},createElementStreamTransform(){}}},ao=({element:t,name:e,description:a})=>{const s=Nt(t);return{name:"array",responseFormat:de(s.jsonSchema).then(r=>{const{$schema:o,...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},...a!=null&&{description:a}}}),async parseCompleteOutput({text:r},o){const i=await he({text:r});if(!i.success)throw new pe({message:"No object generated: could not parse the response.",cause:i.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});const n=i.value;if(n==null||typeof n!="object"||!("elements"in n)||!Array.isArray(n.elements))throw new pe({message:"No object generated: response did not match schema.",cause:new Ee({value:n,cause:"response must be an object with an elements array"}),text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});for(const c of n.elements){const l=await Re({value:c,schema:s});if(!l.success)throw new pe({message:"No object generated: response did not match schema.",cause:l.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason})}return n.elements},async parsePartialOutput({text:r}){const o=await De(r);switch(o.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const i=o.value;if(i==null||typeof i!="object"||!("elements"in i)||!Array.isArray(i.elements))return;const n=o.state==="repaired-parse"&&i.elements.length>0?i.elements.slice(0,-1):i.elements,c=[];for(const l of n){const p=await Re({value:l,schema:s});p.success&&c.push(p.value)}return{partial:c}}}},createElementStreamTransform(){let r=0;return new TransformStream({transform({partialOutput:o},i){if(o!=null)for(;r<o.length;r++)i.enqueue(o[r])}})}}},so=({options:t,name:e,description:a})=>({name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:t}},required:["result"],additionalProperties:!1},...e!=null&&{name:e},...a!=null&&{description:a}}),async parseCompleteOutput({text:s},r){const o=await he({text:s});if(!o.success)throw new pe({message:"No object generated: could not parse the response.",cause:o.error,text:s,response:r.response,usage:r.usage,finishReason:r.finishReason});const i=o.value;if(i==null||typeof i!="object"||!("result"in i)||typeof i.result!="string"||!t.includes(i.result))throw new pe({message:"No object generated: response did not match schema.",cause:new Ee({value:i,cause:"response must be an object that contains a choice value."}),text:s,response:r.response,usage:r.usage,finishReason:r.finishReason});return i.result},async parsePartialOutput({text:s}){const r=await De(s);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const o=r.value;if(o==null||typeof o!="object"||!("result"in o)||typeof o.result!="string")return;const i=t.filter(n=>n.startsWith(o.result));return r.state==="successful-parse"?i.includes(o.result)?{partial:o.result}:void 0:i.length===1?{partial:i[0]}:void 0}}},createElementStreamTransform(){}}),ro=({name:t,description:e}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...t!=null&&{name:t},...e!=null&&{description:e}}),async parseCompleteOutput({text:a},s){const r=await he({text:a});if(!r.success)throw new pe({message:"No object generated: could not parse the response.",cause:r.error,text:a,response:s.response,usage:s.usage,finishReason:s.finishReason});return r.value},async parsePartialOutput({text:a}){const s=await De(a);switch(s.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return s.value===void 0?void 0:{partial:s.value}}},createElementStreamTransform(){}});ke({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 oo=Rr(()=>Na(z([O({type:I("text-start"),id:y(),providerMetadata:A.optional()}),O({type:I("text-delta"),id:y(),delta:y(),providerMetadata:A.optional()}),O({type:I("text-end"),id:y(),providerMetadata:A.optional()}),O({type:I("error"),errorText:y()}),O({type:I("tool-input-start"),toolCallId:y(),toolName:y(),providerExecuted:F().optional(),providerMetadata:A.optional(),dynamic:F().optional(),title:y().optional()}),O({type:I("tool-input-delta"),toolCallId:y(),inputTextDelta:y()}),O({type:I("tool-input-available"),toolCallId:y(),toolName:y(),input:ce(),providerExecuted:F().optional(),providerMetadata:A.optional(),dynamic:F().optional(),title:y().optional()}),O({type:I("tool-input-error"),toolCallId:y(),toolName:y(),input:ce(),providerExecuted:F().optional(),providerMetadata:A.optional(),dynamic:F().optional(),errorText:y(),title:y().optional()}),O({type:I("tool-approval-request"),approvalId:y(),toolCallId:y()}),O({type:I("tool-output-available"),toolCallId:y(),output:ce(),providerExecuted:F().optional(),dynamic:F().optional(),preliminary:F().optional()}),O({type:I("tool-output-error"),toolCallId:y(),errorText:y(),providerExecuted:F().optional(),dynamic:F().optional()}),O({type:I("tool-output-denied"),toolCallId:y()}),O({type:I("reasoning-start"),id:y(),providerMetadata:A.optional()}),O({type:I("reasoning-delta"),id:y(),delta:y(),providerMetadata:A.optional()}),O({type:I("reasoning-end"),id:y(),providerMetadata:A.optional()}),O({type:I("source-url"),sourceId:y(),url:y(),title:y().optional(),providerMetadata:A.optional()}),O({type:I("source-document"),sourceId:y(),mediaType:y(),title:y(),filename:y().optional(),providerMetadata:A.optional()}),O({type:I("file"),url:y(),mediaType:y(),providerMetadata:A.optional()}),O({type:na(t=>typeof t=="string"&&t.startsWith("data-"),{message:'Type must start with "data-"'}),id:y().optional(),data:ce(),transient:F().optional()}),O({type:I("start-step")}),O({type:I("finish-step")}),O({type:I("start"),messageId:y().optional(),messageMetadata:ce().optional()}),O({type:I("finish"),finishReason:as(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:ce().optional()}),O({type:I("abort"),reason:y().optional()}),O({type:I("message-metadata"),messageMetadata:ce()})])));function no(t){return t.type.startsWith("data-")}function pt(t){return t.type.startsWith("tool-")}function io(t){return t.type==="dynamic-tool"}function mt(t){return pt(t)||io(t)}function ta(t){return t.type.split("-").slice(1).join("-")}function lo({lastMessage:t,messageId:e}){return{message:t?.role==="assistant"?t:{id:e,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function co({stream:t,messageMetadataSchema:e,dataPartSchemas:a,runUpdateMessageJob:s,onError:r,onToolCall:o,onData:i}){return t.pipeThrough(new TransformStream({async transform(n,c){await s(async({state:l,write:p})=>{var m,h,v,g;function _(u){const T=l.message.parts.filter(mt).find(w=>w.toolCallId===u);if(T==null)throw new xe({chunkType:"tool-invocation",chunkId:u,message:`No tool invocation found for tool call ID "${u}".`});return T}function b(u){var E;const T=l.message.parts.find(j=>pt(j)&&j.toolCallId===u.toolCallId),w=u,S=T;T!=null?(T.state=u.state,S.input=w.input,S.output=w.output,S.errorText=w.errorText,S.rawInput=w.rawInput,S.preliminary=w.preliminary,u.title!==void 0&&(S.title=u.title),S.providerExecuted=(E=w.providerExecuted)!=null?E:T.providerExecuted,w.providerMetadata!=null&&(T.callProviderMetadata=w.providerMetadata)):l.message.parts.push({type:`tool-${u.toolName}`,toolCallId:u.toolCallId,state:u.state,title:u.title,input:w.input,output:w.output,rawInput:w.rawInput,errorText:w.errorText,providerExecuted:w.providerExecuted,preliminary:w.preliminary,...w.providerMetadata!=null?{callProviderMetadata:w.providerMetadata}:{}})}function f(u){var E,T;const w=l.message.parts.find(L=>L.type==="dynamic-tool"&&L.toolCallId===u.toolCallId),S=u,j=w;w!=null?(w.state=u.state,j.toolName=u.toolName,j.input=S.input,j.output=S.output,j.errorText=S.errorText,j.rawInput=(E=S.rawInput)!=null?E:j.rawInput,j.preliminary=S.preliminary,u.title!==void 0&&(j.title=u.title),j.providerExecuted=(T=S.providerExecuted)!=null?T:w.providerExecuted,S.providerMetadata!=null&&(w.callProviderMetadata=S.providerMetadata)):l.message.parts.push({type:"dynamic-tool",toolName:u.toolName,toolCallId:u.toolCallId,state:u.state,input:S.input,output:S.output,errorText:S.errorText,preliminary:S.preliminary,providerExecuted:S.providerExecuted,title:u.title,...S.providerMetadata!=null?{callProviderMetadata:S.providerMetadata}:{}})}async function x(u){if(u!=null){const E=l.message.metadata!=null?$a(l.message.metadata,u):u;e!=null&&await Kt({value:E,schema:e,context:{field:"message.metadata",entityId:l.message.id}}),l.message.metadata=E}}switch(n.type){case"text-start":{const u={type:"text",text:"",providerMetadata:n.providerMetadata,state:"streaming"};l.activeTextParts[n.id]=u,l.message.parts.push(u),p();break}case"text-delta":{const u=l.activeTextParts[n.id];if(u==null)throw new xe({chunkType:"text-delta",chunkId:n.id,message:`Received text-delta for missing text part with ID "${n.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});u.text+=n.delta,u.providerMetadata=(m=n.providerMetadata)!=null?m:u.providerMetadata,p();break}case"text-end":{const u=l.activeTextParts[n.id];if(u==null)throw new xe({chunkType:"text-end",chunkId:n.id,message:`Received text-end for missing text part with ID "${n.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});u.state="done",u.providerMetadata=(h=n.providerMetadata)!=null?h:u.providerMetadata,delete l.activeTextParts[n.id],p();break}case"reasoning-start":{const u={type:"reasoning",text:"",providerMetadata:n.providerMetadata,state:"streaming"};l.activeReasoningParts[n.id]=u,l.message.parts.push(u),p();break}case"reasoning-delta":{const u=l.activeReasoningParts[n.id];if(u==null)throw new xe({chunkType:"reasoning-delta",chunkId:n.id,message:`Received reasoning-delta for missing reasoning part with ID "${n.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});u.text+=n.delta,u.providerMetadata=(v=n.providerMetadata)!=null?v:u.providerMetadata,p();break}case"reasoning-end":{const u=l.activeReasoningParts[n.id];if(u==null)throw new xe({chunkType:"reasoning-end",chunkId:n.id,message:`Received reasoning-end for missing reasoning part with ID "${n.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});u.providerMetadata=(g=n.providerMetadata)!=null?g:u.providerMetadata,u.state="done",delete l.activeReasoningParts[n.id],p();break}case"file":{l.message.parts.push({type:"file",mediaType:n.mediaType,url:n.url}),p();break}case"source-url":{l.message.parts.push({type:"source-url",sourceId:n.sourceId,url:n.url,title:n.title,providerMetadata:n.providerMetadata}),p();break}case"source-document":{l.message.parts.push({type:"source-document",sourceId:n.sourceId,mediaType:n.mediaType,title:n.title,filename:n.filename,providerMetadata:n.providerMetadata}),p();break}case"tool-input-start":{const u=l.message.parts.filter(pt);l.partialToolCalls[n.toolCallId]={text:"",toolName:n.toolName,index:u.length,dynamic:n.dynamic,title:n.title},n.dynamic?f({toolCallId:n.toolCallId,toolName:n.toolName,state:"input-streaming",input:void 0,providerExecuted:n.providerExecuted,title:n.title,providerMetadata:n.providerMetadata}):b({toolCallId:n.toolCallId,toolName:n.toolName,state:"input-streaming",input:void 0,providerExecuted:n.providerExecuted,title:n.title,providerMetadata:n.providerMetadata}),p();break}case"tool-input-delta":{const u=l.partialToolCalls[n.toolCallId];if(u==null)throw new xe({chunkType:"tool-input-delta",chunkId:n.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${n.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});u.text+=n.inputTextDelta;const{value:E}=await De(u.text);u.dynamic?f({toolCallId:n.toolCallId,toolName:u.toolName,state:"input-streaming",input:E,title:u.title}):b({toolCallId:n.toolCallId,toolName:u.toolName,state:"input-streaming",input:E,title:u.title}),p();break}case"tool-input-available":{n.dynamic?f({toolCallId:n.toolCallId,toolName:n.toolName,state:"input-available",input:n.input,providerExecuted:n.providerExecuted,providerMetadata:n.providerMetadata,title:n.title}):b({toolCallId:n.toolCallId,toolName:n.toolName,state:"input-available",input:n.input,providerExecuted:n.providerExecuted,providerMetadata:n.providerMetadata,title:n.title}),p(),o&&!n.providerExecuted&&await o({toolCall:n});break}case"tool-input-error":{n.dynamic?f({toolCallId:n.toolCallId,toolName:n.toolName,state:"output-error",input:n.input,errorText:n.errorText,providerExecuted:n.providerExecuted,providerMetadata:n.providerMetadata}):b({toolCallId:n.toolCallId,toolName:n.toolName,state:"output-error",input:void 0,rawInput:n.input,errorText:n.errorText,providerExecuted:n.providerExecuted,providerMetadata:n.providerMetadata}),p();break}case"tool-approval-request":{const u=_(n.toolCallId);u.state="approval-requested",u.approval={id:n.approvalId},p();break}case"tool-output-denied":{const u=_(n.toolCallId);u.state="output-denied",p();break}case"tool-output-available":{const u=_(n.toolCallId);u.type==="dynamic-tool"?f({toolCallId:n.toolCallId,toolName:u.toolName,state:"output-available",input:u.input,output:n.output,preliminary:n.preliminary,providerExecuted:n.providerExecuted,title:u.title}):b({toolCallId:n.toolCallId,toolName:ta(u),state:"output-available",input:u.input,output:n.output,providerExecuted:n.providerExecuted,preliminary:n.preliminary,title:u.title}),p();break}case"tool-output-error":{const u=_(n.toolCallId);u.type==="dynamic-tool"?f({toolCallId:n.toolCallId,toolName:u.toolName,state:"output-error",input:u.input,errorText:n.errorText,providerExecuted:n.providerExecuted,title:u.title}):b({toolCallId:n.toolCallId,toolName:ta(u),state:"output-error",input:u.input,rawInput:u.rawInput,errorText:n.errorText,providerExecuted:n.providerExecuted,title:u.title}),p();break}case"start-step":{l.message.parts.push({type:"step-start"});break}case"finish-step":{l.activeTextParts={},l.activeReasoningParts={};break}case"start":{n.messageId!=null&&(l.message.id=n.messageId),await x(n.messageMetadata),(n.messageId!=null||n.messageMetadata!=null)&&p();break}case"finish":{n.finishReason!=null&&(l.finishReason=n.finishReason),await x(n.messageMetadata),n.messageMetadata!=null&&p();break}case"message-metadata":{await x(n.messageMetadata),n.messageMetadata!=null&&p();break}case"error":{r?.(new Error(n.errorText));break}default:if(no(n)){if(a?.[n.type]!=null){const T=l.message.parts.findIndex(S=>"id"in S&&"data"in S&&S.id===n.id&&S.type===n.type),w=T>=0?T:l.message.parts.length;await Kt({value:n.data,schema:a[n.type],context:{field:`message.parts[${w}].data`,entityName:n.type,entityId:n.id}})}const u=n;if(u.transient){i?.(u);break}const E=u.id!=null?l.message.parts.find(T=>u.type===T.type&&u.id===T.id):void 0;E!=null?E.data=u.data:l.message.parts.push(u),i?.(u),p()}}c.enqueue(n)})}}))}async function uo({stream:t,onError:e}){const a=t.getReader();try{for(;;){const{done:s}=await a.read();if(s)break}}catch(s){e?.(s)}finally{a.releaseLock()}}ke({prefix:"aitxt",size:24});ke({prefix:"aiobj",size:24});var po=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(t){return new Promise((e,a)=>{this.queue.push(async()=>{try{await t(),e()}catch(s){a(s)}}),this.processQueue()})}};ke({prefix:"aiobj",size:24});async function mo(t){if(t==null)return[];if(!globalThis.FileList||!(t instanceof globalThis.FileList))throw new Error("FileList is not supported in the current environment");return Promise.all(Array.from(t).map(async e=>{const{name:a,type:s}=e,r=await new Promise((o,i)=>{const n=new FileReader;n.onload=c=>{var l;o((l=c.target)==null?void 0:l.result)},n.onerror=c=>i(c),n.readAsDataURL(e)});return{type:"file",mediaType:s,filename:a,url:r}}))}var fo=class{constructor({api:t="/api/chat",credentials:e,headers:a,body:s,fetch:r,prepareSendMessagesRequest:o,prepareReconnectToStreamRequest:i}){this.api=t,this.credentials=e,this.headers=a,this.body=s,this.fetch=r,this.prepareSendMessagesRequest=o,this.prepareReconnectToStreamRequest=i}async sendMessages({abortSignal:t,...e}){var a,s,r,o,i;const n=await de(this.body),c=await de(this.headers),l=await de(this.credentials),p={...fe(c),...fe(e.headers)},m=await((a=this.prepareSendMessagesRequest)==null?void 0:a.call(this,{api:this.api,id:e.chatId,messages:e.messages,body:{...n,...e.body},headers:p,credentials:l,requestMetadata:e.metadata,trigger:e.trigger,messageId:e.messageId})),h=(s=m?.api)!=null?s:this.api,v=m?.headers!==void 0?fe(m.headers):p,g=m?.body!==void 0?m.body:{...n,...e.body,id:e.chatId,messages:e.messages,trigger:e.trigger,messageId:e.messageId},_=(r=m?.credentials)!=null?r:l,f=await((o=this.fetch)!=null?o:globalThis.fetch)(h,{method:"POST",headers:Gt({"Content-Type":"application/json",...v},`ai-sdk/${ea}`,Jt()),body:JSON.stringify(g),credentials:_,signal:t});if(!f.ok)throw new Error((i=await f.text())!=null?i:"Failed to fetch the chat response.");if(!f.body)throw new Error("The response body is empty.");return this.processResponseStream(f.body)}async reconnectToStream(t){var e,a,s,r,o;const i=await de(this.body),n=await de(this.headers),c=await de(this.credentials),l={...fe(n),...fe(t.headers)},p=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=(a=p?.api)!=null?a:`${this.api}/${t.chatId}/stream`,h=p?.headers!==void 0?fe(p.headers):l,v=(s=p?.credentials)!=null?s:c,_=await((r=this.fetch)!=null?r:globalThis.fetch)(m,{method:"GET",headers:Gt(h,`ai-sdk/${ea}`,Jt()),credentials:v});if(_.status===204)return null;if(!_.ok)throw new Error((o=await _.text())!=null?o:"Failed to fetch the chat response.");if(!_.body)throw new Error("The response body is empty.");return this.processResponseStream(_.body)}},La=class extends fo{constructor(t={}){super(t)}processResponseStream(t){return $r({stream:t,schema:oo}).pipeThrough(new TransformStream({async transform(e,a){if(!e.success)throw e.error;a.enqueue(e.value)}}))}},ho=class{constructor({generateId:t=Fs,id:e=t(),transport:a=new La,messageMetadataSchema:s,dataPartSchemas:r,state:o,onError:i,onToolCall:n,onFinish:c,onData:l,sendAutomaticallyWhen:p}){this.activeResponse=void 0,this.jobExecutor=new po,this.sendMessage=async(m,h)=>{var v,g,_,b;if(m==null){await this.makeRequest({trigger:"submit-message",messageId:(v=this.lastMessage)==null?void 0:v.id,...h});return}let f;if("text"in m||"files"in m?f={parts:[...Array.isArray(m.files)?m.files:await mo(m.files),..."text"in m&&m.text!=null?[{type:"text",text:m.text}]:[]]}:f=m,m.messageId!=null){const x=this.state.messages.findIndex(u=>u.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,{...f,id:m.messageId,role:(g=f.role)!=null?g:"user",metadata:m.metadata})}else this.state.pushMessage({...f,id:(_=f.id)!=null?_:this.generateId(),role:(b=f.role)!=null?b:"user",metadata:m.metadata});await this.makeRequest({trigger:"submit-message",messageId:m.messageId,...h})},this.regenerate=async({messageId:m,...h}={})=>{const v=m==null?this.state.messages.length-1:this.state.messages.findIndex(g=>g.id===m);if(v===-1)throw new Error(`message ${m} not found`);this.state.messages=this.state.messages.slice(0,this.messages[v].role==="assistant"?v:v+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:v})=>this.jobExecutor.run(async()=>{const g=this.state.messages,_=g[g.length-1],b=f=>mt(f)&&f.state==="approval-requested"&&f.approval.id===m?{...f,state:"approval-responded",approval:{id:m,approved:h,reason:v}}:f;this.state.replaceMessage(g.length-1,{..._,parts:_.parts.map(b)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(b)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(f=>{var x;f&&this.makeRequest({trigger:"submit-message",messageId:(x=this.lastMessage)==null?void 0:x.id})})}),this.addToolOutput=async({state:m="output-available",tool:h,toolCallId:v,output:g,errorText:_})=>this.jobExecutor.run(async()=>{const b=this.state.messages,f=b[b.length-1],x=u=>mt(u)&&u.toolCallId===v?{...u,state:m,output:g,errorText:_}:u;this.state.replaceMessage(b.length-1,{...f,parts:f.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(u=>{var E;u&&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=a,this.generateId=t,this.messageMetadataSchema=s,this.dataPartSchemas=r,this.state=o,this.onError=i,this.onToolCall=n,this.onFinish=c,this.onData=l,this.sendAutomaticallyWhen=p}get status(){return this.state.status}setStatus({status:t,error:e}){this.status!==t&&(this.state.status=t,this.state.error=e)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(t){this.state.messages=t}async shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;const t=this.sendAutomaticallyWhen({messages:this.state.messages});return t&&typeof t=="object"&&"then"in t?await t:t}async makeRequest({trigger:t,metadata:e,headers:a,body:s,messageId:r}){var o,i,n;this.setStatus({status:"submitted",error:void 0});const c=this.lastMessage;let l=!1,p=!1,m=!1;try{const h={state:lo({lastMessage:this.state.snapshot(c),messageId:this.generateId()}),abortController:new AbortController};h.abortController.signal.addEventListener("abort",()=>{l=!0}),this.activeResponse=h;let v;if(t==="resume-stream"){const _=await this.transport.reconnectToStream({chatId:this.id,metadata:e,headers:a,body:s});if(_==null){this.setStatus({status:"ready"});return}v=_}else v=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:h.abortController.signal,metadata:e,headers:a,body:s,trigger:t,messageId:r});const g=_=>this.jobExecutor.run(()=>_({state:h.state,write:()=>{var b;this.setStatus({status:"streaming"}),h.state.message.id===((b=this.lastMessage)==null?void 0:b.id)?this.state.replaceMessage(this.state.messages.length-1,h.state.message):this.state.pushMessage(h.state.message)}}));await uo({stream:co({stream:v,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:g,onError:_=>{throw _}}),onError:_=>{throw _}}),this.setStatus({status:"ready"})}catch(h){if(l||h.name==="AbortError")return l=!0,this.setStatus({status:"ready"}),null;m=!0,h instanceof TypeError&&(h.message.toLowerCase().includes("fetch")||h.message.toLowerCase().includes("network"))&&(p=!0),this.onError&&h instanceof Error&&this.onError(h),this.setStatus({status:"error",error:h})}finally{try{(i=this.onFinish)==null||i.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:l,isDisconnect:p,isError:m,finishReason:(o=this.activeResponse)==null?void 0:o.state.finishReason})}catch(h){console.error(h)}this.activeResponse=void 0}!m&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:"submit-message",messageId:(n=this.lastMessage)==null?void 0:n.id,metadata:e,headers:a,body:s})}},lt,aa;function go(){if(aa)return lt;aa=1;function t(e,a){if(typeof e!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let s,r=0;return function(...i){clearTimeout(s);const n=Date.now(),c=n-r,l=a-c;l<=0?(r=n,e.apply(this,i)):s=setTimeout(()=>{r=Date.now(),e.apply(this,i)},l)}}return lt=t,lt}var vo=go();const yo=ss(vo);var Za=(t,e,a)=>{if(!e.has(t))throw TypeError("Cannot "+a)},k=(t,e,a)=>(Za(t,e,"read from private field"),a?a.call(t):e.get(t)),re=(t,e,a)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,a)},ue=(t,e,a,s)=>(Za(t,e,"write to private field"),e.set(t,a),a);function xo(t,e){return e!=null?yo(t,e):t}var q,qe,He,we,Ne,Ce,be,ft,ht,bo=class{constructor(t=[]){re(this,q,void 0),re(this,qe,"ready"),re(this,He,void 0),re(this,we,new Set),re(this,Ne,new Set),re(this,Ce,new Set),this.pushMessage=e=>{ue(this,q,k(this,q).concat(e)),k(this,be).call(this)},this.popMessage=()=>{ue(this,q,k(this,q).slice(0,-1)),k(this,be).call(this)},this.replaceMessage=(e,a)=>{ue(this,q,[...k(this,q).slice(0,e),this.snapshot(a),...k(this,q).slice(e+1)]),k(this,be).call(this)},this.snapshot=e=>structuredClone(e),this["~registerMessagesCallback"]=(e,a)=>{const s=a?xo(e,a):e;return k(this,we).add(s),()=>{k(this,we).delete(s)}},this["~registerStatusCallback"]=e=>(k(this,Ne).add(e),()=>{k(this,Ne).delete(e)}),this["~registerErrorCallback"]=e=>(k(this,Ce).add(e),()=>{k(this,Ce).delete(e)}),re(this,be,()=>{k(this,we).forEach(e=>e())}),re(this,ft,()=>{k(this,Ne).forEach(e=>e())}),re(this,ht,()=>{k(this,Ce).forEach(e=>e())}),ue(this,q,t)}get status(){return k(this,qe)}set status(t){ue(this,qe,t),k(this,ft).call(this)}get error(){return k(this,He)}set error(t){ue(this,He,t),k(this,ht).call(this)}get messages(){return k(this,q)}set messages(t){ue(this,q,[...t]),k(this,be).call(this)}};q=new WeakMap;qe=new WeakMap;He=new WeakMap;we=new WeakMap;Ne=new WeakMap;Ce=new WeakMap;be=new WeakMap;ft=new WeakMap;ht=new WeakMap;var _e,sa=class extends ho{constructor({messages:t,...e}){const a=new bo(t);super({...e,state:a}),re(this,_e,void 0),this["~registerMessagesCallback"]=(s,r)=>k(this,_e)["~registerMessagesCallback"](s,r),this["~registerStatusCallback"]=s=>k(this,_e)["~registerStatusCallback"](s),this["~registerErrorCallback"]=s=>k(this,_e)["~registerErrorCallback"](s),ue(this,_e,a)}};_e=new WeakMap;function _o({experimental_throttle:t,resume:e=!1,...a}={}){const s=C.useRef("chat"in a?{}:{onToolCall:a.onToolCall,onData:a.onData,onFinish:a.onFinish,onError:a.onError,sendAutomaticallyWhen:a.sendAutomaticallyWhen});"chat"in a||(s.current={onToolCall:a.onToolCall,onData:a.onData,onFinish:a.onFinish,onError:a.onError,sendAutomaticallyWhen:a.sendAutomaticallyWhen});const r={...a,onToolCall:h=>{var v,g;return(g=(v=s.current).onToolCall)==null?void 0:g.call(v,h)},onData:h=>{var v,g;return(g=(v=s.current).onData)==null?void 0:g.call(v,h)},onFinish:h=>{var v,g;return(g=(v=s.current).onFinish)==null?void 0:g.call(v,h)},onError:h=>{var v,g;return(g=(v=s.current).onError)==null?void 0:g.call(v,h)},sendAutomaticallyWhen:h=>{var v,g,_;return(_=(g=(v=s.current).sendAutomaticallyWhen)==null?void 0:g.call(v,h))!=null?_:!1}},o=C.useRef("chat"in a?a.chat:new sa(r));("chat"in a&&a.chat!==o.current||"id"in a&&o.current.id!==a.id)&&(o.current="chat"in a?a.chat:new sa(r));const n=C.useCallback(h=>o.current["~registerMessagesCallback"](h,t),[t,o.current.id]),c=C.useSyncExternalStore(n,()=>o.current.messages,()=>o.current.messages),l=C.useSyncExternalStore(o.current["~registerStatusCallback"],()=>o.current.status,()=>o.current.status),p=C.useSyncExternalStore(o.current["~registerErrorCallback"],()=>o.current.error,()=>o.current.error),m=C.useCallback(h=>{typeof h=="function"&&(h=h(o.current.messages)),o.current.messages=h},[o]);return C.useEffect(()=>{e&&o.current.resumeStream()},[e,o]),{id:o.current.id,messages:c,setMessages:m,sendMessage:o.current.sendMessage,regenerate:o.current.regenerate,clearError:o.current.clearError,stop:o.current.stop,error:p,resumeStream:o.current.resumeStream,status:l,addToolResult:o.current.addToolOutput,addToolOutput:o.current.addToolOutput,addToolApprovalResponse:o.current.addToolApprovalResponse}}function Fa(){const t=$.c(17),{locator:e,org:a}=Ie();let s;t[0]!==e?(s=Oe.allowedModels(e),t[0]=e,t[1]=s):s=t[1];let r;t[2]!==a?(r=async()=>{const g=await fetch(`/api/${a.slug}/decopilot/allowed-models`,{credentials:"include"});return g.ok?g.json():{allowAll:!0,models:{}}},t[2]=a,t[3]=r):r=t[3];let o;t[4]!==s||t[5]!==r?(o={queryKey:s,queryFn:r,staleTime:3e4},t[4]=s,t[5]=r,t[6]=o):o=t[6];const{data:i,isLoading:n}=hs(o),c=i?.allowAll??!0;let l;t[7]!==i?.models?(l=i?.models??{},t[7]=i?.models,t[8]=l):l=t[8];const p=l;let m;t[9]!==c||t[10]!==p?(m=(g,_)=>{if(c)return!0;const b=p[g];return b?b.includes("*")||b.includes(_):p["*"]?.includes("*")??!1},t[9]=c,t[10]=p,t[11]=m):m=t[11];const h=m;let v;return t[12]!==c||t[13]!==n||t[14]!==h||t[15]!==p?(v={allowAll:c,models:p,isLoading:n,isModelAllowed:h},t[12]=c,t[13]=n,t[14]=h,t[15]=p,t[16]=v):v=t[16],v}function Eo(t){const e=$.c(10);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},e[0]=a):a=e[0];const s=ia(a);let r;if(e[1]!==s.collectionName||e[2]!==s.connectionId||e[3]!==s.itemId||e[4]!==t){r=[],t&&r.push(`### Selected Agent
12
+ - ID: ${t}`);let o;e[6]!==s.collectionName||e[7]!==s.connectionId||e[8]!==s.itemId?(o=[],s.connectionId&&o.push(`- Connection ID: ${s.connectionId}`),s.collectionName&&o.push(`- Collection: ${s.collectionName}`),s.itemId&&o.push(`- Item ID: ${s.itemId}`),e[6]=s.collectionName,e[7]=s.connectionId,e[8]=s.itemId,e[9]=o):o=e[9],o.length>0&&r.push(`### Current Resource
13
+ The user is viewing the following resource:
14
+ ${o.join(`
15
+ `)}
16
+
17
+ Help the user understand and work with this resource.`),e[1]=s.collectionName,e[2]=s.connectionId,e[3]=s.itemId,e[4]=t,e[5]=r}else r=e[5];return r.join(`
18
+
19
+ `)}function Io(){const t=$.c(2),e=vt();let a;return t[0]!==e?(a={prefillCollectionCache:(r,o,i,n)=>{if(!r)return;const c=It(r,o,i,n);if(e.getQueryData(c))return;const p={structuredContent:{items:[]},isError:!1};e.setQueryData(c,p)}},t[0]=e,t[1]=a):a=t[1],a}const ne={THREAD_MESSAGES_PAGE_SIZE:100,THREADS_PAGE_SIZE:50,QUERY_STALE_TIME:3e4};function ra(t,e,a,s){const r=Oe.threads(e),o=t.getQueryData(r);if(!o)return;const i=o.pages.map(c=>{const l=c.items.findIndex(v=>v.id===a);if(l===-1)return c;const p=[...c.items],m=p[l];if(!m)return c;const h={id:m.id,title:s.title??m.title,createdAt:m.createdAt,updatedAt:s.updatedAt??m.updatedAt,hidden:s.hidden??m.hidden};return p[l]=h,{...c,items:p}});i.some((c,l)=>c.items.length!==o.pages[l]?.items.length||c.items.some((p,m)=>p.id===a&&p!==o.pages[l]?.items[m]))&&t.setQueryData(r,{...o,pages:i})}function So(t,e,a){const s=Oe.threads(e),r=t.getQueryData(s);if(!r){t.setQueryData(s,{pages:[{items:[a],hasMore:!1,totalCount:1}],pageParams:[0]});return}if(r.pages.some(n=>n.items.some(c=>c.id===a.id)))return;const i=r.pages[0];if(i){const n={...i,items:[a,...i.items],totalCount:(i.totalCount??i.items.length)+1};t.setQueryData(s,{...r,pages:[n,...r.pages.slice(1)]})}else t.setQueryData(s,{...r,pages:[{items:[a],hasMore:!1,totalCount:1}]})}async function wo(t,e,a,s){if(!e)return;const r=It(e,"THREAD_MESSAGES",a,{filters:[{column:"threadId",value:s}],pageSize:ne.THREAD_MESSAGES_PAGE_SIZE});if(!r||t.getQueryData(r))return;const i="COLLECTION_THREAD_MESSAGES_LIST",n=gs(void 0,[{column:"threadId",value:s}],[]),c=vs(void 0,void 0,"updated_at"),l={...n&&{where:n},...c&&{orderBy:c},limit:ne.THREAD_MESSAGES_PAGE_SIZE,offset:0};await t.fetchQuery({queryKey:r,queryFn:async()=>await e.callTool({name:i,arguments:l}),staleTime:ne.QUERY_STALE_TIME,retry:!1})}function No(t,e,a,s,r){if(!e)return;const o=It(e,"THREAD_MESSAGES",a,{filters:[{column:"threadId",value:s}],pageSize:ne.THREAD_MESSAGES_PAGE_SIZE});o&&t.setQueryData(o,{structuredContent:{items:r},isError:!1})}async function Co(t,e,a){if(!t)throw new Error("MCP client is not available");const s=await t.callTool({name:"COLLECTION_THREADS_UPDATE",arguments:{id:e,data:a}});return(s.structuredContent??s).item}function To(t){const e=new Date().toISOString();return{id:t,title:"New chat",createdAt:e,updatedAt:e}}function Ao(t,e){return t.find(a=>a.id!==e)??null}function Mo(){const t=$.c(17),{locator:e,org:a}=Ie();let s;t[0]!==a.id?(s={connectionId:_t,orgId:a.id},t[0]=a.id,t[1]=s):s=t[1];const r=bt(s);let o;t[2]!==e?(o=Oe.threads(e),t[2]=e,t[3]=o):o=t[3];let i;t[4]!==r?(i=async b=>{const{pageParam:f}=b,x=f===void 0?0:f;if(!r)throw new Error("MCP client is not available");const u={limit:ne.THREADS_PAGE_SIZE,offset:x},E=await r.callTool({name:"COLLECTION_THREADS_LIST",arguments:u}),T=E.structuredContent??E;return{items:T.items??[],hasMore:T.hasMore??!1,totalCount:T.totalCount}},t[4]=r,t[5]=i):i=t[5];let n;t[6]!==o||t[7]!==i?(n={queryKey:o,queryFn:i,getNextPageParam:jo,initialPageParam:0,staleTime:ne.QUERY_STALE_TIME},t[6]=o,t[7]=i,t[8]=n):n=t[8];const{data:c,fetchNextPage:l,hasNextPage:p,isFetchingNextPage:m,refetch:h}=xs(n);let v;t[9]!==c?.pages?(v=c?.pages.flatMap(Ro)??[],t[9]=c?.pages,t[10]=v):v=t[10];const g=v;let _;return t[11]!==l||t[12]!==p||t[13]!==m||t[14]!==h||t[15]!==g?(_={threads:g,refetch:h,hasNextPage:p,isFetchingNextPage:m,fetchNextPage:l},t[11]=l,t[12]=p,t[13]=m,t[14]=h,t[15]=g,t[16]=_):_=t[16],_}function Ro(t){return t.items}function jo(t,e){if(t.hasMore)return e.length*ne.THREADS_PAGE_SIZE}function Po(t){const e=$.c(6),{org:a}=Ie();let s;e[0]!==a.id?(s={connectionId:_t,orgId:a.id},e[0]=a.id,e[1]=s):s=e[1];const r=bt(s);let o;e[2]!==t?(o={filters:t?[{column:"threadId",value:t}]:[],pageSize:ne.THREAD_MESSAGES_PAGE_SIZE},e[2]=t,e[3]=o):o=e[3];const i=ys(a.id,"THREAD_MESSAGES",r,o);let n;return e[4]!==i?(n=i??[],e[4]=i,e[5]=n):n=e[5],n}function Oo(){const{locator:t,org:e}=Ie(),a=vt(),{prefillCollectionCache:s}=Io(),{threads:r,hasNextPage:o,isFetchingNextPage:i,fetchNextPage:n}=Mo(),c=bt({connectionId:_t,orgId:e.id}),[l,p]=Ae(Ge.assistantChatActiveThread(t),r[0]?.id??crypto.randomUUID()),m=Po(l),h=()=>{const f=crypto.randomUUID(),x=To(f);So(a,t,x),c&&s(c,"THREAD_MESSAGES",e.id,{filters:[{column:"threadId",value:f}],pageSize:ne.THREAD_MESSAGES_PAGE_SIZE}),p(f)},v=async f=>{await wo(a,c,e.id,f),p(f)};return{threads:r,activeThreadId:l,messages:m,hasNextPage:o,isFetchingNextPage:i,fetchNextPage:n,createThread:h,switchThread:v,updateThread:(f,x)=>{ra(a,t,f,x)},hideThread:async f=>{try{const x=await Co(c,f,{hidden:!0});if(x){if(f===l){const E=Ao(r,f);E?await v(E.id):h()}ra(a,t,f,{hidden:!0,updatedAt:x.updatedAt??new Date().toISOString()})}}catch(x){const u=x;yt.error(`Failed to update thread: ${u.message}`),console.error("[chat] Failed to update thread:",x)}},updateMessagesCache:(f,x)=>{No(a,c,e.id,f,x)}}}function ko(){const t=$.c(5),e=vt(),{org:a}=Ie();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={strict:!1},t[0]=s):s=t[0];const r=ia(s);let o;return t[1]!==a||t[2]!==r||t[3]!==e?(o=i=>{const c=i.toolCall.toolName.match(/^COLLECTION_([A-Z_]+)_(CREATE|UPDATE|DELETE)$/);if(!c||!c[1])return;const l=c[1],p=r.connectionId;if(!p)return;e.invalidateQueries({queryKey:Oe.collection(a.slug,p,l)});const m=l.toLowerCase().replace(/_/g," ");yt.success(`${m} updated`)},t[1]=a,t[2]=r,t[3]=e,t[4]=o):o=t[4],o}function U(t){const e=$.c(8);let a,s;e[0]!==t?({className:a,...s}=t,e[0]=t,e[1]=a,e[2]=s):(a=e[1],s=e[2]);let r;e[3]!==a?(r=St("bg-accent animate-pulse rounded-md",a),e[3]=a,e[4]=r):r=e[4];let o;return e[5]!==s||e[6]!==r?(o=d.jsx("div",{"data-slot":"skeleton",className:r,...s}),e[5]=s,e[6]=r,e[7]=o):o=e[7],o}const Do=["x-ai/grok-code-fast-1","anthropic/claude-sonnet-4.5","google/gemini-2.5-flash","xiaomi/mimo-v2-flash:free","google/gemini-3-flash-preview","deepseek/deepseek-v3.2","anthropic/claude-opus-4.5","x-ai/grok-4.1-fast","google/gemini-2.5-flash-lite","google/gemini-2.0-flash-001"],gt=new Map;Do.forEach((t,e)=>{gt.set(t,e)});function Ct(t){const e=$.c(3);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={pageSize:999},e[0]=a):a=e[0];const s=fs(t??void 0,a);let r;return e[1]!==s?(r=s.filter(Lo).sort($o),e[1]=s,e[2]=r):r=e[2],r}function $o(t,e){const a=gt.get(t.id),s=gt.get(e.id);return a!==void 0&&s!==void 0?a-s:a!==void 0?-1:s!==void 0?1:t.title.localeCompare(e.title)}function Lo(t){return t.limits?.contextWindow&&t.limits?.maxOutputTokens}const Zo={reasoning:{icon:d.jsx(pa,{className:"size-4"}),label:"Reasoning"},"image-upload":{icon:d.jsx(js,{className:"size-4"}),label:"Can analyze images"},"file-upload":{icon:d.jsx(Ms,{className:"size-4"}),label:"Can analyze files"},"web-search":{icon:d.jsx(la,{className:"size-4"}),label:"Can search the web to answer questions"}};function Ua(t){const e=$.c(10),{capability:a}=t,s=Zo[a];let r,o;e[0]!==a||e[1]!==s?(r=s||{icon:null,label:a},o=r.label.split("-").map(Fo).join(" "),e[0]=a,e[1]=s,e[2]=r,e[3]=o):(r=e[2],o=e[3]);const i=o;let n;e[4]===Symbol.for("react.memo_cache_sentinel")?(n={backgroundColor:"color-mix(in oklch, var(--chart-1) 15%, transparent)",color:"var(--chart-1)"},e[4]=n):n=e[4];let c;e[5]!==i?(c=d.jsx("span",{children:i}),e[5]=i,e[6]=c):c=e[6];let l;return e[7]!==r.icon||e[8]!==c?(l=d.jsxs("div",{className:"flex items-center gap-1.5 py-0.5 px-1.5 rounded-md text-xs font-medium",style:n,children:[r.icon,c]}),e[7]=r.icon,e[8]=c,e[9]=l):l=e[9],l}function Fo(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Uo(t){const e=$.c(53),{model:a,compact:s}=t,r=s===void 0?!1:s;if(!a){let b;return e[0]===Symbol.for("react.memo_cache_sentinel")?(b=d.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Hover to preview"}),e[0]=b):b=e[0],b}const o=a.limits?.contextWindow||a.costs?.input||a.costs?.output||a.limits?.maxOutputTokens;if(!o&&!r){let b;e[1]!==a.logo||e[2]!==a.title?(b=a.logo&&d.jsx("img",{src:a.logo,className:"w-6 h-6",alt:a.title}),e[1]=a.logo,e[2]=a.title,e[3]=b):b=e[3];let f;e[4]!==a.title?(f=d.jsx("p",{className:"text-lg font-medium leading-7",children:a.title}),e[4]=a.title,e[5]=f):f=e[5];let x;e[6]!==b||e[7]!==f?(x=d.jsxs("div",{className:"flex items-center gap-3 py-2 px-0",children:[b,f]}),e[6]=b,e[7]=f,e[8]=x):x=e[8];let u;e[9]!==a.description?(u=a.description&&d.jsx("p",{className:"text-sm text-muted-foreground",children:a.description}),e[9]=a.description,e[10]=u):u=e[10];let E;return e[11]!==x||e[12]!==u?(E=d.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[x,u]}),e[11]=x,e[12]=u,e[13]=E):E=e[13],E}if(!o&&r)return null;if(r){let b;e[14]!==a.limits?(b=a.limits?.contextWindow&&d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-muted-foreground",children:"Context"}),d.jsxs("span",{className:"text-foreground font-medium",children:[a.limits.contextWindow.toLocaleString()," tokens"]})]}),e[14]=a.limits,e[15]=b):b=e[15];let f;e[16]!==a.costs?(f=a.costs?.input&&d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-muted-foreground",children:"Input cost"}),d.jsxs("span",{className:"text-foreground font-medium",children:["$",a.costs.input.toFixed(2)," / 1M"]})]}),e[16]=a.costs,e[17]=f):f=e[17];let x;e[18]!==a.costs?(x=a.costs?.output&&d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-muted-foreground",children:"Output cost"}),d.jsxs("span",{className:"text-foreground font-medium",children:["$",a.costs.output.toFixed(2)," / 1M"]})]}),e[18]=a.costs,e[19]=x):x=e[19];let u;e[20]!==a.limits?(u=a.limits?.maxOutputTokens&&d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-muted-foreground",children:"Output limit"}),d.jsxs("span",{className:"text-foreground font-medium",children:[a.limits.maxOutputTokens.toLocaleString()," tokens"]})]}),e[20]=a.limits,e[21]=u):u=e[21];let E;return e[22]!==b||e[23]!==f||e[24]!==x||e[25]!==u?(E=d.jsxs("div",{className:"flex flex-col gap-2.5 pt-3 pb-3 px-3 rounded-b-lg text-xs",children:[b,f,x,u]}),e[22]=b,e[23]=f,e[24]=x,e[25]=u,e[26]=E):E=e[26],E}let i;e[27]!==a.logo||e[28]!==a.title?(i=a.logo&&d.jsx("img",{src:a.logo,className:"w-6 h-6 shrink-0",alt:a.title}),e[27]=a.logo,e[28]=a.title,e[29]=i):i=e[29];let n;e[30]!==a.title?(n=d.jsx("p",{className:"text-lg font-medium leading-7 wrap-break-word min-w-0",children:a.title}),e[30]=a.title,e[31]=n):n=e[31];let c;e[32]!==i||e[33]!==n?(c=d.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[i,n]}),e[32]=i,e[33]=n,e[34]=c):c=e[34];let l;e[35]!==a.capabilities?(l=a.capabilities&&a.capabilities.length>0&&d.jsx("div",{className:"flex items-center gap-2",children:a.capabilities.map(zo)}),e[35]=a.capabilities,e[36]=l):l=e[36];let p;e[37]!==c||e[38]!==l?(p=d.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[c,l]}),e[37]=c,e[38]=l,e[39]=p):p=e[39];let m;e[40]!==a.limits?(m=a.limits?.contextWindow&&d.jsxs("div",{className:"flex flex-col gap-1.5",children:[d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Rs,{className:"w-3.5 h-3.5 text-muted-foreground"}),d.jsx("p",{className:"text-sm text-foreground",children:"Context window"})]}),d.jsxs("p",{className:"text-sm text-muted-foreground",children:[a.limits.contextWindow.toLocaleString()," tokens"]})]}),e[40]=a.limits,e[41]=m):m=e[41];let h;e[42]!==a.costs?(h=(a.costs?.input||a.costs?.output)&&d.jsxs("div",{className:"flex flex-col gap-1.5",children:[d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(ua,{className:"w-3.5 h-3.5 text-muted-foreground"}),d.jsx("p",{className:"text-sm text-foreground",children:"Costs"})]}),d.jsxs("div",{className:"flex flex-col gap-0.5",children:[a.costs?.input!==null&&a.costs?.input!==void 0&&d.jsxs("p",{className:"text-sm text-muted-foreground",children:["$",a.costs.input.toFixed(2)," / 1M tokens (input)"]}),a.costs?.output!==null&&a.costs?.output!==void 0&&d.jsxs("p",{className:"text-sm text-muted-foreground",children:["$",a.costs.output.toFixed(2)," / 1M tokens (output)"]})]})]}),e[42]=a.costs,e[43]=h):h=e[43];let v;e[44]!==a.limits?(v=a.limits?.maxOutputTokens&&d.jsxs("div",{className:"flex flex-col gap-1.5",children:[d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(da,{className:"w-4.5 h-4.5 text-muted-foreground/70"}),d.jsx("p",{className:"text-sm text-foreground",children:"Output limit"})]}),d.jsxs("p",{className:"text-sm text-muted-foreground",children:[a.limits.maxOutputTokens.toLocaleString()," token limit"]})]}),e[44]=a.limits,e[45]=v):v=e[45];let g;e[46]!==m||e[47]!==h||e[48]!==v?(g=d.jsxs("div",{className:"flex flex-col gap-4",children:[m,h,v]}),e[46]=m,e[47]=h,e[48]=v,e[49]=g):g=e[49];let _;return e[50]!==g||e[51]!==p?(_=d.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[p,g]}),e[50]=g,e[51]=p,e[52]=_):_=e[52],_}function zo(t){return d.jsx(Ua,{capability:t},t)}function Bo(t){const e=$.c(15),{model:a,onHover:s}=t;let r;e[0]!==a||e[1]!==s?(r=()=>s(a),e[0]=a,e[1]=s,e[2]=r):r=e[2];let o;e[3]!==a.logo||e[4]!==a.title?(o=a.logo&&d.jsx("img",{src:a.logo,className:"w-5 h-5 shrink-0",alt:a.title}),e[3]=a.logo,e[4]=a.title,e[5]=o):o=e[5];let i;e[6]!==a.title?(i=d.jsx("span",{className:"text-sm text-foreground flex-1 min-w-0 line-clamp-1",children:a.title}),e[6]=a.title,e[7]=i):i=e[7];let n;e[8]!==a.capabilities?(n=a.capabilities&&a.capabilities.length>0&&d.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:a.capabilities.slice(0,2).map(Vo)}),e[8]=a.capabilities,e[9]=n):n=e[9];let c;return e[10]!==r||e[11]!==o||e[12]!==i||e[13]!==n?(c=d.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:r,children:[o,i,n]}),e[10]=r,e[11]=o,e[12]=i,e[13]=n,e[14]=c):c=e[14],c}function Vo(t){return d.jsx(Ua,{capability:t},t)}function qo(t){const e=$.c(14),{model:a,placeholder:s}=t,r=s===void 0?"Select model":s;if(!a){let l;e[0]!==r?(l=d.jsx("span",{className:"text-sm text-muted-foreground",children:r}),e[0]=r,e[1]=l):l=e[1];let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=d.jsx(Dt,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[2]=p):p=e[2];let m;return e[3]!==l?(m=d.jsxs("div",{className:"flex items-center gap-1.5",children:[l,p]}),e[3]=l,e[4]=m):m=e[4],m}let o;e[5]!==a.logo||e[6]!==a.title?(o=a.logo&&d.jsx("img",{src:a.logo,className:"w-5 h-5 shrink-0 rounded-sm",alt:a.title}),e[5]=a.logo,e[6]=a.title,e[7]=o):o=e[7];let i;e[8]!==a.title?(i=d.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground group-data-[state=open]:text-foreground truncate whitespace-nowrap max-w-0 opacity-0 group-hover:max-w-[150px] group-hover:opacity-100 group-data-[state=open]:max-w-[150px] group-data-[state=open]:opacity-100 transition-all duration-200 ease-in-out overflow-hidden",children:a.title}),e[8]=a.title,e[9]=i):i=e[9];let n;e[10]===Symbol.for("react.memo_cache_sentinel")?(n=d.jsx(Dt,{size:14,className:"text-muted-foreground opacity-0 max-w-0 group-hover:opacity-50 group-hover:max-w-[14px] group-data-[state=open]:opacity-50 group-data-[state=open]:max-w-[14px] shrink-0 transition-all duration-200 ease-in-out overflow-hidden"}),e[10]=n):n=e[10];let c;return e[11]!==o||e[12]!==i?(c=d.jsxs("div",{className:"flex items-center gap-0 group-hover:gap-2 group-data-[state=open]:gap-2 min-w-0 overflow-hidden transition-all duration-200",children:[o,i,n]}),e[11]=o,e[12]=i,e[13]=c):c=e[13],c}function Rn(t){return t?.capabilities?.includes("vision")===!0}function Ho(){const t=$.c(6);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=d.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:d.jsxs("div",{className:"flex items-center gap-2.5 h-12 px-4",children:[d.jsx(U,{className:"size-4 shrink-0"}),d.jsx(U,{className:"flex-1 h-6"}),d.jsx(U,{className:"w-[140px] h-8 shrink-0"})]})}),t[0]=e):e=t[0];let a;t[1]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[400px] md:min-w-[400px]",children:[e,d.jsx("div",{className:"flex-1 overflow-y-auto px-0.5 pt-2 space-y-1",children:Array.from({length:6}).map(Wo)})]}),t[1]=a):a=t[1];let s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=d.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[d.jsx(U,{className:"size-6 shrink-0"}),d.jsx(U,{className:"h-6 w-32"})]}),t[2]=s):s=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[s,d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(U,{className:"h-6 w-20 rounded-md"}),d.jsx(U,{className:"h-6 w-24 rounded-md"})]})]}),t[3]=r):r=t[3];let o;t[4]===Symbol.for("react.memo_cache_sentinel")?(o=d.jsxs("div",{className:"flex flex-col gap-1.5",children:[d.jsx(U,{className:"h-4 w-24"}),d.jsx(U,{className:"h-4 w-32"})]}),t[4]=o):o=t[4];let i;return t[5]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsxs("div",{className:"flex flex-col md:flex-row h-[350px]",children:[a,d.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:d.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[r,d.jsxs("div",{className:"flex flex-col gap-4",children:[o,d.jsxs("div",{className:"flex flex-col gap-1.5",children:[d.jsx(U,{className:"h-4 w-16"}),d.jsx(U,{className:"h-4 w-40"})]})]})]})})]}),t[5]=i):i=t[5],i}function Wo(t,e){return d.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[d.jsx(U,{className:"size-5 shrink-0 rounded-sm"}),d.jsx(U,{className:"flex-1 h-4"}),d.jsx(U,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function Jo(t){const e=$.c(44),{selectedModel:a,onModelChange:s,onClose:r,modelsConnections:o}=t,[i,n]=C.useState(null),[c,l]=C.useState(""),p=C.useRef(null),[m,h]=C.useState(a?.connectionId??null),v=Et(),g=o??v,{isModelAllowed:_,allowAll:b}=Fa(),f=g,x=Ct(m??void 0);let u;e[0]!==x||e[1]!==b||e[2]!==_||e[3]!==m?(u=b?x:x.filter(D=>m&&_(m,D.id)),e[0]=x,e[1]=b,e[2]=_,e[3]=m,e[4]=u):u=e[4];const E=u;let T,w;e[5]===Symbol.for("react.memo_cache_sentinel")?(T=()=>{setTimeout(()=>{p.current?.focus()},0)},w=[],e[5]=T,e[6]=w):(T=e[5],w=e[6]),C.useEffect(T,w);let S;e[7]!==E||e[8]!==c?(S=c.trim()?E.filter(D=>{const G=c.toLowerCase();return D.title.toLowerCase().includes(G)||D.provider?.toLowerCase().includes(G)||D.description?.toLowerCase().includes(G)}):E,e[7]=E,e[8]=c,e[9]=S):S=e[9];const j=S;let L;e[10]===Symbol.for("react.memo_cache_sentinel")?(L=D=>{h(D)},e[10]=L):L=e[10];const H=L;let X;e[11]!==E||e[12]!==r||e[13]!==s||e[14]!==m?(X=D=>{const G=E.find(ye=>ye.id===D);!G||!m||(s({id:G.id,connectionId:m,provider:G.provider??void 0}),l(""),r())},e[11]=E,e[12]=r,e[13]=s,e[14]=m,e[15]=X):X=e[15];const ie=X;let le;e[16]===Symbol.for("react.memo_cache_sentinel")?(le=d.jsx(la,{size:16,className:"text-muted-foreground shrink-0"}),e[16]=le):le=e[16];let ge;e[17]===Symbol.for("react.memo_cache_sentinel")?(ge=D=>l(D.target.value),e[17]=ge):ge=e[17];let W;e[18]!==c?(W=d.jsx(_s,{ref:p,type:"text",placeholder:"Search for a model...",value:c,onChange:ge,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[18]=c,e[19]=W):W=e[19];let M;e[20]!==f||e[21]!==m?(M=f.length>0&&d.jsxs(ws,{value:m??"",onValueChange:H,children:[d.jsxs(Ns,{size:"sm",className:"w-auto min-w-[140px] h-8 shrink-0 [&>svg:last-child]:hidden",onClick:Yo,children:[d.jsx(Cs,{placeholder:"Select connection"}),d.jsx(ca,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),d.jsx(Ts,{children:f.map(Go)})]}),e[20]=f,e[21]=m,e[22]=M):M=e[22];let K;e[23]!==M||e[24]!==W?(K=d.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:d.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 cursor-text",children:[le,W,M]})}),e[23]=M,e[24]=W,e[25]=K):K=e[25];let ee;e[26]!==j||e[27]!==ie||e[28]!==a?.id?(ee=j.length>0?j.map(D=>{const G=D.id===a?.id;return d.jsx("div",{onClick:()=>ie(D.id),className:St("rounded-lg mb-1",G&&"bg-accent"),children:d.jsx(Bo,{model:D,onHover:n})},D.id)}):d.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No models found"}),e[26]=j,e[27]=ie,e[28]=a?.id,e[29]=ee):ee=e[29];let te;e[30]!==ee?(te=d.jsx("div",{className:"flex-1 overflow-y-auto px-0.5 pt-2",children:ee}),e[30]=ee,e[31]=te):te=e[31];let ae;e[32]!==K||e[33]!==te?(ae=d.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[400px] md:min-w-[400px]",children:[K,te]}),e[32]=K,e[33]=te,e[34]=ae):ae=e[34];let se;e[35]!==i||e[36]!==E||e[37]!==a?(se=i||(a?E.find(D=>D.id===a.id):null)||null,e[35]=i,e[36]=E,e[37]=a,e[38]=se):se=e[38];let J;e[39]!==se?(J=d.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:d.jsx(Uo,{model:se})}),e[39]=se,e[40]=J):J=e[40];let ve;return e[41]!==ae||e[42]!==J?(ve=d.jsxs("div",{className:"flex flex-col md:flex-row h-[350px]",children:[ae,J]}),e[41]=ae,e[42]=J,e[43]=ve):ve=e[43],ve}function Go(t){return d.jsx(As,{value:t.id,children:d.jsxs("div",{className:"flex items-center gap-2",children:[t.icon?d.jsx("img",{src:t.icon,alt:t.title,className:"w-4 h-4 rounded"}):d.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()}),d.jsx("span",{children:t.title})]})},t.id)}function Yo(t){return t.stopPropagation()}function jn(t){const e=$.c(23),{selectedModel:a,onModelChange:s,modelsConnections:r,variant:o,className:i,placeholder:n}=t,c=o===void 0?"borderless":o,l=n===void 0?"Select model":n,[p,m]=C.useState(!1),h=Et(),v=r??h,g=a?.connectionId??null,_=Ct(g??void 0);let b;e[0]!==_||e[1]!==a?(b=a?_.find(X=>X.id===a.id):void 0,e[0]=_,e[1]=a,e[2]=b):b=e[2];const f=b;if(v.length===0)return null;const x=c==="borderless"?"ghost":"outline",u=c==="borderless"&&"md:border-none";let E;e[3]!==i||e[4]!==u?(E=St("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",u,i),e[3]=i,e[4]=u,e[5]=E):E=e[5];let T;e[6]!==f||e[7]!==l?(T=d.jsx(qo,{model:f,placeholder:l}),e[6]=f,e[7]=l,e[8]=T):T=e[8];let w;e[9]!==x||e[10]!==E||e[11]!==T?(w=d.jsx(Es,{asChild:!0,children:d.jsx(bs,{variant:x,size:"sm",className:E,children:T})}),e[9]=x,e[10]=E,e[11]=T,e[12]=w):w=e[12];let S;e[13]===Symbol.for("react.memo_cache_sentinel")?(S=d.jsx(Ho,{}),e[13]=S):S=e[13];let j;e[14]===Symbol.for("react.memo_cache_sentinel")?(j=()=>m(!1),e[14]=j):j=e[14];let L;e[15]!==v||e[16]!==s||e[17]!==a?(L=d.jsx(Is,{className:"w-full md:w-auto p-0",align:"start",side:"bottom",sideOffset:8,children:d.jsx(C.Suspense,{fallback:S,children:d.jsx(Jo,{selectedModel:a,onModelChange:s,onClose:j,modelsConnections:v})})}),e[15]=v,e[16]=s,e[17]=a,e[18]=L):L=e[18];let H;return e[19]!==p||e[20]!==L||e[21]!==w?(H=d.jsxs(Ss,{open:p,onOpenChange:m,children:[w,L]}),e[19]=p,e[20]=L,e[21]=w,e[22]=H):H=e[22],H}const Qo=t=>new La({api:`/api/${t}/decopilot/stream`,credentials:"include",prepareSendMessagesRequest:({messages:e,requestMetadata:a={}})=>{const{system:s,tiptapDoc:r,...o}=a,i=s?{id:crypto.randomUUID(),role:"system",parts:[{type:"text",text:s}]}:null,n=e.slice(-1).filter(Boolean);return{body:{messages:i?[i,...n]:n,...o}}}}),oa=(t,e)=>t?.find(a=>a.id===e)??t?.[0]??null,Xo=(t,e)=>{const a=$.c(12);let s;a[0]!==t?(s=Ge.chatSelectedModel(t),a[0]=t,a[1]=s):s=a[1];const[r,o]=Ae(s,null),{isModelAllowed:i,allowAll:n}=Fa(),c=oa(e,r?.connectionId),l=Ct(c?.id),p=n||!c?.id?l:l.filter(x=>i(c.id,x.id)),m=p.filter(on).reduce(nn,void 0),h=r?.id;let v;a[2]!==p||a[3]!==h?(v=oa(p,h),a[2]=p,a[3]=h,a[4]=v):v=a[4];const g=v;let _;a[5]!==m?.id||a[6]!==c||a[7]!==g?(_=g&&c?.id?{id:g.id,provider:g.provider,limits:g.limits,capabilities:g.capabilities,connectionId:c.id,fastId:m?.id}:null,a[5]=m?.id,a[6]=c,a[7]=g,a[8]=_):_=a[8];const b=_;let f;return a[9]!==b||a[10]!==o?(f=[b,o],a[9]=b,a[10]=o,a[11]=f):f=a[11],f},za={tiptapDoc:void 0,parentThread:null,finishReason:null};function Ko(t,e){switch(e.type){case"SET_TIPTAP_DOC":return{...t,tiptapDoc:e.payload};case"CLEAR_TIPTAP_DOC":return{...t,tiptapDoc:void 0};case"START_BRANCH":return{...t,parentThread:e.payload};case"CLEAR_BRANCH":return{...t,parentThread:null};case"SET_FINISH_REASON":return{...t,finishReason:e.payload};case"CLEAR_FINISH_REASON":return{...t,finishReason:null};case"RESET":return za;default:return t}}function en(t,e){const a=[];for(const s of t)"text"in s&&s.text?a.push({type:"text",text:`[${e}]
20
+ ${s.text}`}):"blob"in s&&s.blob&&s.mimeType&&a.push({type:"file",url:`data:${s.mimeType};base64,${s.blob}`,filename:String(s.uri),mediaType:String(s.mimeType)});return a}function tn(t,e){const a=[];for(const s of t){if(s.role!=="user"||!s.content)continue;const r=Array.isArray(s.content)?s.content:[s.content];for(const o of r)switch(o.type){case"text":{const i=o.text?.trim();if(!i)continue;a.push({type:"text",text:`[${e}]
21
+ ${i}`});break}case"image":case"audio":{if(!o.data||!o.mimeType)continue;a.push({type:"file",url:`data:${o.mimeType};base64,${o.data}`,mediaType:o.mimeType});break}case"resource":{const i=o.resource;if(!i||!i.mimeType)continue;i&&("text"in i&&i.text?a.push({type:"text",text:`[${e}]
22
+ ${i.text}`}):"blob"in i&&i.blob&&i.mimeType&&a.push({type:"file",url:`data:${i.mimeType};base64,${i.blob}`,filename:String(i.uri),mediaType:String(i.mimeType)}));break}}}return a}function an(t,e){const{mimeType:a,data:s}=t;if(a.startsWith("text/"))try{const r=atob(s);return[{type:"text",text:`${e}
23
+ ${r}`}]}catch(r){console.error("Failed to decode text file:",r)}return[{type:"file",url:`data:${a};base64,${s}`,filename:e,mediaType:a}]}function sn(t){if(!t)return[];const e=[];let a="";const s=r=>{if(r){if(r.type==="text"&&"text"in r&&typeof r.text=="string")a+=r.text;else if(r.type==="mention"&&r.attrs){const o=r.attrs.char??"/",i=`${o}${r.attrs.name}`;if(a+=i,o==="@"){const n=r.attrs.metadata||[];e.push(...en(n,i))}else{const n=r.attrs.metadata||r.attrs.prompts||[];e.push(...tn(n,i))}}else if(r.type==="file"&&r.attrs){const o=r.attrs,i=`[file:://${encodeURIComponent(o.name)}]`;a+=i,e.push(...an(o,i))}if("content"in r&&Array.isArray(r.content))for(const o of r.content)s(o)}};return s(t),a.trim()&&e.unshift({type:"text",text:a.trim()}),e}const Ba=C.createContext(null);function Pn(t){const e=$.c(68),{children:a}=t,{locator:s,org:r}=Ie(),o=Oo(),{data:i}=rs.useSession(),n=i?.user??null,[c,l]=C.useReducer(Ko,za),p=ms(),[m,h]=Ae(`${s}:selected-virtual-mcp-id`,null),v=Et(),[g,_]=Xo(s,v);let b;e[0]!==s?(b=Ge.chatSelectedMode(s),e[0]=s,e[1]=b):b=e[1];const[f,x]=Ae(b,"code_execution"),u=o.messages,E=Eo(m),T=ko();let w;e[2]!==m||e[3]!==p?(w=m?p.find(B=>B.id===m)??null:null,e[2]=m,e[3]=p,e[4]=w):w=e[4];const S=w;let j;e[5]!==r.id?(j=ps(r.id),e[5]=r.id,e[6]=j):j=e[6];const L=j.id;let H;e[7]!==r.slug?(H=Qo(r.slug),e[7]=r.slug,e[8]=H):H=e[8];const X=H;let ie;e[9]!==o?(ie=async B=>{const{finishReason:Se,isAbort:Ve,isDisconnect:st,isError:rt,message:Wa,messages:Ja}=B;if(l({type:"SET_FINISH_REASON",payload:Se??null}),Se!=="stop"||Ve||st||rt)return;const{title:Ot,thread_id:ot,created_at:kt}=Wa.metadata??{};!ot||!Ot||!kt||(o.updateMessagesCache(ot,Ja),o.updateThread(ot,{title:Ot,updatedAt:new Date(kt).toISOString()}))},e[9]=o,e[10]=ie):ie=e[10];const le=ie,ge=rn;let W;e[11]!==u||e[12]!==le||e[13]!==T||e[14]!==o.activeThreadId||e[15]!==X?(W={id:o.activeThreadId,messages:u,transport:X,onFinish:le,onToolCall:T,onError:ge},e[11]=u,e[12]=le,e[13]=T,e[14]=o.activeThreadId,e[15]=X,e[16]=W):W=e[16];const M=_o(W),K=M.status==="submitted"||M.status==="streaming",ee=M.messages.length===0,te=o.createThread,ae=o.switchThread,se=o.hideThread;let J;e[17]===Symbol.for("react.memo_cache_sentinel")?(J=B=>l({type:"SET_TIPTAP_DOC",payload:B}),e[17]=J):J=e[17];const ve=J;let D;e[18]===Symbol.for("react.memo_cache_sentinel")?(D=()=>l({type:"CLEAR_TIPTAP_DOC"}),e[18]=D):D=e[18];const G=D;let ye;e[19]===Symbol.for("react.memo_cache_sentinel")?(ye=()=>l({type:"RESET"}),e[19]=ye):ye=e[19];const Pt=ye;let $e;e[20]!==h?($e=B=>{h(B)},e[20]=h,e[21]=$e):$e=e[21];const Xe=$e;let Le;e[22]!==_?(Le=B=>{_({id:B.id,connectionId:B.connectionId})},e[22]=_,e[23]=Le):Le=e[23];const Ke=Le;let Ze;e[24]!==M||e[25]!==E||e[26]!==L||e[27]!==f||e[28]!==g||e[29]!==S?.id||e[30]!==o.activeThreadId||e[31]!==n?.image||e[32]!==n?.name?(Ze=async B=>{if(!g){yt.error("No model configured");return}const Se=sn(B);if(Se.length===0)return;Pt();const Ve={tiptapDoc:B,created_at:new Date().toISOString(),thread_id:o.activeThreadId,agent:{id:S?.id??L,mode:f},user:{avatar:n?.image??void 0,name:n?.name??"you"}},st={...Ve,system:E,model:{id:g.id,connectionId:g.connectionId,provider:g.provider??void 0,limits:g.limits??void 0,capabilities:{vision:g.capabilities?.includes("vision")??void 0,text:g.capabilities?.includes("text")??void 0,tools:g.capabilities?.includes("tools")??void 0},fastId:g.fastId}},rt={id:crypto.randomUUID(),role:"user",parts:Se,metadata:Ve};await M.sendMessage(rt,{metadata:st})},e[24]=M,e[25]=E,e[26]=L,e[27]=f,e[28]=g,e[29]=S?.id,e[30]=o.activeThreadId,e[31]=n?.image,e[32]=n?.name,e[33]=Ze):Ze=e[33];const et=Ze;let Fe;e[34]!==M?(Fe=()=>M.stop(),e[34]=M,e[35]=Fe):Fe=e[35];const tt=Fe;let Ue;e[36]===Symbol.for("react.memo_cache_sentinel")?(Ue=()=>l({type:"CLEAR_FINISH_REASON"}),e[36]=Ue):Ue=e[36];const Ha=Ue;let ze;e[37]!==M.clearError||e[38]!==M.error||e[39]!==M.messages||e[40]!==M.setMessages||e[41]!==M.status||e[42]!==c.finishReason||e[43]!==c.tiptapDoc||e[44]!==te||e[45]!==se||e[46]!==ee||e[47]!==K||e[48]!==v||e[49]!==f||e[50]!==g||e[51]!==S||e[52]!==et||e[53]!==x||e[54]!==Ke||e[55]!==Xe||e[56]!==tt||e[57]!==ae||e[58]!==o.activeThreadId||e[59]!==o.fetchNextPage||e[60]!==o.hasNextPage||e[61]!==o.isFetchingNextPage||e[62]!==o.threads||e[63]!==p?(ze={tiptapDoc:c.tiptapDoc,setTiptapDoc:ve,clearTiptapDoc:G,resetInteraction:Pt,activeThreadId:o.activeThreadId,threads:o.threads,createThread:te,switchToThread:ae,hideThread:se,hasNextPage:o.hasNextPage,isFetchingNextPage:o.isFetchingNextPage,fetchNextPage:o.fetchNextPage,virtualMcps:p,selectedVirtualMcp:S,setVirtualMcpId:Xe,modelsConnections:v,selectedModel:g,setSelectedModel:Ke,selectedMode:f,setSelectedMode:x,messages:M.messages,chatStatus:M.status,isStreaming:K,isChatEmpty:ee,sendMessage:et,stopStreaming:tt,setMessages:M.setMessages,chatError:M.error,clearChatError:M.clearError,finishReason:c.finishReason,clearFinishReason:Ha},e[37]=M.clearError,e[38]=M.error,e[39]=M.messages,e[40]=M.setMessages,e[41]=M.status,e[42]=c.finishReason,e[43]=c.tiptapDoc,e[44]=te,e[45]=se,e[46]=ee,e[47]=K,e[48]=v,e[49]=f,e[50]=g,e[51]=S,e[52]=et,e[53]=x,e[54]=Ke,e[55]=Xe,e[56]=tt,e[57]=ae,e[58]=o.activeThreadId,e[59]=o.fetchNextPage,e[60]=o.hasNextPage,e[61]=o.isFetchingNextPage,e[62]=o.threads,e[63]=p,e[64]=ze):ze=e[64];const at=ze;let Be;return e[65]!==a||e[66]!==at?(Be=d.jsx(Ba.Provider,{value:at,children:a}),e[65]=a,e[66]=at,e[67]=Be):Be=e[67],Be}function rn(t){console.error("[chat] Error",t)}function On(){const t=C.useContext(Ba);if(!t)throw new Error("useChat must be used within a ChatProvider");return t}function on(t){return(t.costs?.input??0)+(t.costs?.output??0)>0}function nn(t,e){const a=e.costs?.input??0,s=e.costs?.output??0,r=(t?.costs?.input??0)+(t?.costs?.output??0);return!t||r===0||a+s<r?e:t}var Qe="Collapsible",[ln,kn]=ls(Qe),[cn,Tt]=ln(Qe),Va=C.forwardRef((t,e)=>{const{__scopeCollapsible:a,open:s,defaultOpen:r,disabled:o,onOpenChange:i,...n}=t,[c,l]=os({prop:s,defaultProp:r??!1,onChange:i,caller:Qe});return d.jsx(cn,{scope:a,disabled:o,contentId:ns(),open:c,onOpenToggle:C.useCallback(()=>l(p=>!p),[l]),children:d.jsx(xt.div,{"data-state":jt(c),"data-disabled":o?"":void 0,...n,ref:e})})});Va.displayName=Qe;var qa="CollapsibleTrigger",At=C.forwardRef((t,e)=>{const{__scopeCollapsible:a,...s}=t,r=Tt(qa,a);return d.jsx(xt.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":jt(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...s,ref:e,onClick:is(t.onClick,r.onOpenToggle)})});At.displayName=qa;var Mt="CollapsibleContent",Rt=C.forwardRef((t,e)=>{const{forceMount:a,...s}=t,r=Tt(Mt,t.__scopeCollapsible);return d.jsx(cs,{present:a||r.open,children:({present:o})=>d.jsx(un,{...s,ref:e,present:o})})});Rt.displayName=Mt;var un=C.forwardRef((t,e)=>{const{__scopeCollapsible:a,present:s,children:r,...o}=t,i=Tt(Mt,a),[n,c]=C.useState(s),l=C.useRef(null),p=us(e,l),m=C.useRef(0),h=m.current,v=C.useRef(0),g=v.current,_=i.open||n,b=C.useRef(_),f=C.useRef(void 0);return C.useEffect(()=>{const x=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(x)},[]),ds(()=>{const x=l.current;if(x){f.current=f.current||{transitionDuration:x.style.transitionDuration,animationName:x.style.animationName},x.style.transitionDuration="0s",x.style.animationName="none";const u=x.getBoundingClientRect();m.current=u.height,v.current=u.width,b.current||(x.style.transitionDuration=f.current.transitionDuration,x.style.animationName=f.current.animationName),c(s)}},[i.open,s]),d.jsx(xt.div,{"data-state":jt(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!_,...o,ref:p,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...t.style},children:_&&r})});function jt(t){return t?"open":"closed"}var dn=Va,Dn=At,$n=Rt;function Ln(t){const e=$.c(4);let a;e[0]!==t?({...a}=t,e[0]=t,e[1]=a):a=e[1];let s;return e[2]!==a?(s=d.jsx(dn,{"data-slot":"collapsible",...a}),e[2]=a,e[3]=s):s=e[3],s}function Zn(t){const e=$.c(4);let a;e[0]!==t?({...a}=t,e[0]=t,e[1]=a):a=e[1];let s;return e[2]!==a?(s=d.jsx(At,{"data-slot":"collapsible-trigger",...a}),e[2]=a,e[3]=s):s=e[3],s}function Fn(t){const e=$.c(4);let a;e[0]!==t?({...a}=t,e[0]=t,e[1]=a):a=e[1];let s;return e[2]!==a?(s=d.jsx(Rt,{"data-slot":"collapsible-content",...a}),e[2]=a,e[3]=s):s=e[3],s}function Un(){const t=$.c(4);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=Ge.decoChatOpen(),t[0]=e):e=t[0];const[a,s]=Ae(e,pn);let r;return t[1]!==a||t[2]!==s?(r=[a,s],t[1]=a,t[2]=s,t[3]=r):r=t[3],r}function pn(t){return!!(t??!0)}export{Ln as C,jn as M,dn as R,U as S,Dn as T,Os as a,Un as b,Zn as c,ca as d,$n as e,kn as f,Fn as g,Pn as h,Ps as i,Rn as m,pa as t,On as u};
@@ -1 +1 @@
1
- import{u as g,g as y,t as e}from"./index-D5tmQFLM.js";import{u as C}from"./use-binding-DMMSXp8M.js";import{g as S,h as v}from"./use-connection-BSXprdTB.js";import{e as B}from"./extract-connection-data-5ZTgwgJP.js";import{f as I,c as P,e as _}from"./registry-utils-DRiNpsKU.js";function w(t){return t.startsWith("@")?t:`@${t}`}function F(){const{org:t}=g(),{data:s}=y.useSession(),i=S(),l=v(),u=C(l);return{installByBinding:async r=>{if(!t||!s?.user?.id){e.error("Not authenticated");return}const d=w(r),a=(await Promise.all(u.map(async o=>{const c=I(o.tools);if(!c)return null;try{const p=await P(o.id,t.id,c,{where:{appName:d}});return _(p??[])[0]??null}catch{return null}}))).find(o=>o!==null);if(!a){e.error(`MCP Server not found in registry: ${r}`);return}const n=B(a,t.id,s.user.id),m=n.connection_type==="STDIO",f=!!n.connection_url,h=m&&n.connection_headers&&typeof n.connection_headers=="object"&&"command"in n.connection_headers;if(!f&&!h){e.error("This MCP Server cannot be connected: no connection method available");return}return await i.create.mutateAsync(n),{id:n.id,connection:n}},isInstalling:i.create.isPending}}export{F as u};
1
+ import{u as g,g as y,t as e}from"./index-CCcWAtA_.js";import{u as C}from"./use-binding-ucSDtQ56.js";import{g as S,h as v}from"./use-connection-BCPygOxC.js";import{e as B}from"./extract-connection-data-CCyj_Y1X.js";import{f as I,c as P,e as _}from"./registry-utils-eTnhYK1Z.js";function w(t){return t.startsWith("@")?t:`@${t}`}function F(){const{org:t}=g(),{data:s}=y.useSession(),i=S(),l=v(),u=C(l);return{installByBinding:async r=>{if(!t||!s?.user?.id){e.error("Not authenticated");return}const d=w(r),a=(await Promise.all(u.map(async o=>{const c=I(o.tools);if(!c)return null;try{const p=await P(o.id,t.id,c,{where:{appName:d}});return _(p??[])[0]??null}catch{return null}}))).find(o=>o!==null);if(!a){e.error(`MCP Server not found in registry: ${r}`);return}const n=B(a,t.id,s.user.id),m=n.connection_type==="STDIO",f=!!n.connection_url,h=m&&n.connection_headers&&typeof n.connection_headers=="object"&&"command"in n.connection_headers;if(!f&&!h){e.error("This MCP Server cannot be connected: no connection method available");return}return await i.create.mutateAsync(n),{id:n.id,connection:n}},isInstalling:i.create.isPending}}export{F as u};
@@ -1 +1 @@
1
- import{r as b,c as N,u as B,K as I,j as x}from"./index-D5tmQFLM.js";import{A as _}from"./avatar-ydfTe0xi.js";import{c as C}from"./utils-63Yxgxyo.js";import{u as L}from"./useQuery-C7wGFtkw.js";import{a as U,u as D}from"./constants-BQDDq09c.js";import{u as P}from"./use-mobile-Bji8rN8h.js";const A=({size:i=24,color:e="currentColor",...t})=>b.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},b.createElement("path",{d:"M2.42 12.713c-.136-.215-.204-.323-.242-.49a1.173 1.173 0 0 1 0-.446c.038-.167.106-.274.242-.49C3.546 9.505 6.895 5 12 5s8.455 4.505 9.58 6.287c.137.215.205.323.243.49.029.125.029.322 0 .446-.038.167-.106.274-.242.49C20.455 14.495 17.105 19 12 19c-5.106 0-8.455-4.505-9.58-6.287Z"}),b.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}));A.displayName="Eye";function R(i){const e=N.c(11),{org:t}=B();let c;e[0]!==t.id?(c={connectionId:U,orgId:t.id},e[0]=t.id,e[1]=c):c=e[1];const r=D(c);let s;e[2]!==i?(s=I.user(i),e[2]=i,e[3]=s):s=e[3];let o;e[4]!==r||e[5]!==i?(o=async()=>{const p=await r.callTool({name:"USER_GET",arguments:{id:i}});return(p.structuredContent??p).user},e[4]=r,e[5]=i,e[6]=o):o=e[6];const a=!!i;let l;return e[7]!==s||e[8]!==o||e[9]!==a?(l={queryKey:s,queryFn:o,staleTime:3e5,retry:1,enabled:a},e[7]=s,e[8]=o,e[9]=a,e[10]=l):l=e[10],L(l)}function H(i){const e=N.c(39),{id:t,size:c,showEmail:r,className:s}=i,o=c===void 0?"xs":c,a=r===void 0?!1:r,{data:l,isLoading:p,isError:j}=R(t);if(p){let u;e[0]!==s?(u=C("flex items-center gap-2",s),e[0]=s,e[1]=u):u=e[1];let n;e[2]!==o?(n=x.jsx(_.Skeleton,{shape:"circle",size:o}),e[2]=o,e[3]=n):n=e[3];let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=x.jsx("div",{className:"h-3 w-24 bg-muted animate-pulse rounded"}),e[4]=g):g=e[4];let h;e[5]!==a?(h=a&&x.jsx("div",{className:"h-2 w-32 bg-muted animate-pulse rounded"}),e[5]=a,e[6]=h):h=e[6];let w;e[7]!==h?(w=x.jsxs("div",{className:"flex flex-col gap-1",children:[g,h]}),e[7]=h,e[8]=w):w=e[8];let M;return e[9]!==u||e[10]!==n||e[11]!==w?(M=x.jsxs("div",{className:u,children:[n,w]}),e[9]=u,e[10]=n,e[11]=w,e[12]=M):M=e[12],M}if(j||!l){let u;e[13]!==s?(u=C("flex items-center gap-2",s),e[13]=s,e[14]=u):u=e[14];let n;e[15]!==o?(n=x.jsx(_,{shape:"circle",size:o,fallback:"?",muted:!0}),e[15]=o,e[16]=n):n=e[16];let g;e[17]===Symbol.for("react.memo_cache_sentinel")?(g=x.jsx("div",{className:"flex flex-col",children:x.jsx("div",{className:"text-sm text-muted-foreground",children:"Unknown User"})}),e[17]=g):g=e[17];let h;return e[18]!==u||e[19]!==n?(h=x.jsxs("div",{className:u,children:[n,g]}),e[18]=u,e[19]=n,e[20]=h):h=e[20],h}let v;e[21]!==s?(v=C("flex items-center gap-2",s),e[21]=s,e[22]=v):v=e[22];const y=l.image??void 0;let m;e[23]!==o||e[24]!==y||e[25]!==l.name?(m=x.jsx(_,{shape:"circle",size:o,url:y,fallback:l.name}),e[23]=o,e[24]=y,e[25]=l.name,e[26]=m):m=e[26];let d;e[27]!==l.name?(d=x.jsx("div",{className:"text-sm font-medium",children:l.name}),e[27]=l.name,e[28]=d):d=e[28];let f;e[29]!==a||e[30]!==l.email?(f=a&&x.jsx("div",{className:"text-xs text-muted-foreground",children:l.email}),e[29]=a,e[30]=l.email,e[31]=f):f=e[31];let S;e[32]!==d||e[33]!==f?(S=x.jsxs("div",{className:"flex flex-col",children:[d,f]}),e[32]=d,e[33]=f,e[34]=S):S=e[34];let E;return e[35]!==v||e[36]!==m||e[37]!==S?(E=x.jsxs("div",{className:v,children:[m,S]}),e[35]=v,e[36]=m,e[37]=S,e[38]=E):E=e[38],E}function W(i){const e=`deco-filters-${i}`,[t,c]=b.useState(()=>{try{const s=globalThis.localStorage?.getItem(e);if(s)return JSON.parse(s)}catch(s){console.error("Failed to parse stored filters:",s)}return[]});return[t,s=>{c(s);try{globalThis.localStorage?.setItem(e,JSON.stringify(s))}catch(o){console.error("Failed to save filters:",o)}}]}function z(i){const e=N.c(7),[t,c]=b.useState(i),[r,s]=b.useState(i?"desc":null);let o;e[0]!==r||e[1]!==t?(o=p=>{t!==p?(c(p),s("asc")):r==="asc"?s("desc"):r==="desc"&&(c(void 0),s(null))},e[0]=r,e[1]=t,e[2]=o):o=e[2];const a=o;let l;return e[3]!==a||e[4]!==r||e[5]!==t?(l={sortKey:t,sortDirection:r,handleSort:a},e[3]=a,e[4]=r,e[5]=t,e[6]=l):l=e[6],l}function q(i,e){const t=N.c(12),c=e===void 0?"cards":e,r=P(),s=b.useRef(r),o=i?`deco-view-mode-${i}`:"deco-view-mode";let a;t[0]!==c||t[1]!==o?(a=()=>{const f=globalThis.localStorage?.getItem(o);return f==="cards"||f==="table"?f:c},t[0]=c,t[1]=o,t[2]=a):a=t[2];const[l,p]=b.useState(a);let j;t[3]!==o?(j=f=>{p(f),globalThis.localStorage?.setItem(o,f)},t[3]=o,t[4]=j):j=t[4];const v=j;let y,m;t[5]!==r||t[6]!==l?(y=()=>{!s.current&&r&&l==="table"&&p("cards"),s.current=r},m=[r,l],t[5]=r,t[6]=l,t[7]=y,t[8]=m):(y=t[7],m=t[8]),b.useEffect(y,m);let d;return t[9]!==v||t[10]!==l?(d=[l,v],t[9]=v,t[10]=l,t[11]=d):d=t[11],d}function X(i){const e=N.c(20),{namespace:t,resource:c,defaultSortKey:r,defaultViewMode:s}=i,o=r===void 0?"title":r,a=s===void 0?"table":s,[l,p]=b.useState(""),j=b.useDeferredValue(l),v=`${t}-${c}`,[y,m]=W(v),d=`mesh-${c}-filter-visible-${t}`;let f;e[0]!==d?(f=()=>globalThis.localStorage?.getItem(d)==="true",e[0]=d,e[1]=f):f=e[1];const[S,E]=b.useState(f);let u;e[2]!==d?(u=T=>{E(T),globalThis.localStorage?.setItem(d,String(T))},e[2]=d,e[3]=u):u=e[3];const n=u;let g;e[4]!==S||e[5]!==n?(g=()=>{n(!S)},e[4]=S,e[5]=n,e[6]=g):g=e[6];const h=g,[w,M]=q(`mesh-${c}-${t}`,a),{sortKey:k,sortDirection:K,handleSort:F}=z(o),V=k;let $;return e[7]!==S||e[8]!==y||e[9]!==F||e[10]!==l||e[11]!==j||e[12]!==n||e[13]!==m||e[14]!==M||e[15]!==K||e[16]!==V||e[17]!==h||e[18]!==w?($={search:l,searchTerm:j,setSearch:p,filters:y,setFilters:m,filterBarVisible:S,setFilterBarVisible:n,toggleFilterBar:h,viewMode:w,setViewMode:M,sortKey:V,sortDirection:K,handleSort:F},e[7]=S,e[8]=y,e[9]=F,e[10]=l,e[11]=j,e[12]=n,e[13]=m,e[14]=M,e[15]=K,e[16]=V,e[17]=h,e[18]=w,e[19]=$):$=e[19],$}export{H as U,A as s,X as u};
1
+ import{r as b,c as N,u as B,K as I,j as x}from"./index-CCcWAtA_.js";import{A as _}from"./avatar-2G5ouaDu.js";import{c as C}from"./utils-CnoQZeDK.js";import{u as L}from"./useQuery-Dp4Sp9Q1.js";import{a as U,u as D}from"./constants-PBHJ4h9F.js";import{u as P}from"./use-mobile-BUK8Wer1.js";const A=({size:i=24,color:e="currentColor",...t})=>b.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},b.createElement("path",{d:"M2.42 12.713c-.136-.215-.204-.323-.242-.49a1.173 1.173 0 0 1 0-.446c.038-.167.106-.274.242-.49C3.546 9.505 6.895 5 12 5s8.455 4.505 9.58 6.287c.137.215.205.323.243.49.029.125.029.322 0 .446-.038.167-.106.274-.242.49C20.455 14.495 17.105 19 12 19c-5.106 0-8.455-4.505-9.58-6.287Z"}),b.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}));A.displayName="Eye";function R(i){const e=N.c(11),{org:t}=B();let c;e[0]!==t.id?(c={connectionId:U,orgId:t.id},e[0]=t.id,e[1]=c):c=e[1];const r=D(c);let s;e[2]!==i?(s=I.user(i),e[2]=i,e[3]=s):s=e[3];let o;e[4]!==r||e[5]!==i?(o=async()=>{const p=await r.callTool({name:"USER_GET",arguments:{id:i}});return(p.structuredContent??p).user},e[4]=r,e[5]=i,e[6]=o):o=e[6];const a=!!i;let l;return e[7]!==s||e[8]!==o||e[9]!==a?(l={queryKey:s,queryFn:o,staleTime:3e5,retry:1,enabled:a},e[7]=s,e[8]=o,e[9]=a,e[10]=l):l=e[10],L(l)}function H(i){const e=N.c(39),{id:t,size:c,showEmail:r,className:s}=i,o=c===void 0?"xs":c,a=r===void 0?!1:r,{data:l,isLoading:p,isError:j}=R(t);if(p){let u;e[0]!==s?(u=C("flex items-center gap-2",s),e[0]=s,e[1]=u):u=e[1];let n;e[2]!==o?(n=x.jsx(_.Skeleton,{shape:"circle",size:o}),e[2]=o,e[3]=n):n=e[3];let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=x.jsx("div",{className:"h-3 w-24 bg-muted animate-pulse rounded"}),e[4]=g):g=e[4];let h;e[5]!==a?(h=a&&x.jsx("div",{className:"h-2 w-32 bg-muted animate-pulse rounded"}),e[5]=a,e[6]=h):h=e[6];let w;e[7]!==h?(w=x.jsxs("div",{className:"flex flex-col gap-1",children:[g,h]}),e[7]=h,e[8]=w):w=e[8];let M;return e[9]!==u||e[10]!==n||e[11]!==w?(M=x.jsxs("div",{className:u,children:[n,w]}),e[9]=u,e[10]=n,e[11]=w,e[12]=M):M=e[12],M}if(j||!l){let u;e[13]!==s?(u=C("flex items-center gap-2",s),e[13]=s,e[14]=u):u=e[14];let n;e[15]!==o?(n=x.jsx(_,{shape:"circle",size:o,fallback:"?",muted:!0}),e[15]=o,e[16]=n):n=e[16];let g;e[17]===Symbol.for("react.memo_cache_sentinel")?(g=x.jsx("div",{className:"flex flex-col",children:x.jsx("div",{className:"text-sm text-muted-foreground",children:"Unknown User"})}),e[17]=g):g=e[17];let h;return e[18]!==u||e[19]!==n?(h=x.jsxs("div",{className:u,children:[n,g]}),e[18]=u,e[19]=n,e[20]=h):h=e[20],h}let v;e[21]!==s?(v=C("flex items-center gap-2",s),e[21]=s,e[22]=v):v=e[22];const y=l.image??void 0;let m;e[23]!==o||e[24]!==y||e[25]!==l.name?(m=x.jsx(_,{shape:"circle",size:o,url:y,fallback:l.name}),e[23]=o,e[24]=y,e[25]=l.name,e[26]=m):m=e[26];let d;e[27]!==l.name?(d=x.jsx("div",{className:"text-sm font-medium",children:l.name}),e[27]=l.name,e[28]=d):d=e[28];let f;e[29]!==a||e[30]!==l.email?(f=a&&x.jsx("div",{className:"text-xs text-muted-foreground",children:l.email}),e[29]=a,e[30]=l.email,e[31]=f):f=e[31];let S;e[32]!==d||e[33]!==f?(S=x.jsxs("div",{className:"flex flex-col",children:[d,f]}),e[32]=d,e[33]=f,e[34]=S):S=e[34];let E;return e[35]!==v||e[36]!==m||e[37]!==S?(E=x.jsxs("div",{className:v,children:[m,S]}),e[35]=v,e[36]=m,e[37]=S,e[38]=E):E=e[38],E}function W(i){const e=`deco-filters-${i}`,[t,c]=b.useState(()=>{try{const s=globalThis.localStorage?.getItem(e);if(s)return JSON.parse(s)}catch(s){console.error("Failed to parse stored filters:",s)}return[]});return[t,s=>{c(s);try{globalThis.localStorage?.setItem(e,JSON.stringify(s))}catch(o){console.error("Failed to save filters:",o)}}]}function z(i){const e=N.c(7),[t,c]=b.useState(i),[r,s]=b.useState(i?"desc":null);let o;e[0]!==r||e[1]!==t?(o=p=>{t!==p?(c(p),s("asc")):r==="asc"?s("desc"):r==="desc"&&(c(void 0),s(null))},e[0]=r,e[1]=t,e[2]=o):o=e[2];const a=o;let l;return e[3]!==a||e[4]!==r||e[5]!==t?(l={sortKey:t,sortDirection:r,handleSort:a},e[3]=a,e[4]=r,e[5]=t,e[6]=l):l=e[6],l}function q(i,e){const t=N.c(12),c=e===void 0?"cards":e,r=P(),s=b.useRef(r),o=i?`deco-view-mode-${i}`:"deco-view-mode";let a;t[0]!==c||t[1]!==o?(a=()=>{const f=globalThis.localStorage?.getItem(o);return f==="cards"||f==="table"?f:c},t[0]=c,t[1]=o,t[2]=a):a=t[2];const[l,p]=b.useState(a);let j;t[3]!==o?(j=f=>{p(f),globalThis.localStorage?.setItem(o,f)},t[3]=o,t[4]=j):j=t[4];const v=j;let y,m;t[5]!==r||t[6]!==l?(y=()=>{!s.current&&r&&l==="table"&&p("cards"),s.current=r},m=[r,l],t[5]=r,t[6]=l,t[7]=y,t[8]=m):(y=t[7],m=t[8]),b.useEffect(y,m);let d;return t[9]!==v||t[10]!==l?(d=[l,v],t[9]=v,t[10]=l,t[11]=d):d=t[11],d}function X(i){const e=N.c(20),{namespace:t,resource:c,defaultSortKey:r,defaultViewMode:s}=i,o=r===void 0?"title":r,a=s===void 0?"table":s,[l,p]=b.useState(""),j=b.useDeferredValue(l),v=`${t}-${c}`,[y,m]=W(v),d=`mesh-${c}-filter-visible-${t}`;let f;e[0]!==d?(f=()=>globalThis.localStorage?.getItem(d)==="true",e[0]=d,e[1]=f):f=e[1];const[S,E]=b.useState(f);let u;e[2]!==d?(u=T=>{E(T),globalThis.localStorage?.setItem(d,String(T))},e[2]=d,e[3]=u):u=e[3];const n=u;let g;e[4]!==S||e[5]!==n?(g=()=>{n(!S)},e[4]=S,e[5]=n,e[6]=g):g=e[6];const h=g,[w,M]=q(`mesh-${c}-${t}`,a),{sortKey:k,sortDirection:K,handleSort:F}=z(o),V=k;let $;return e[7]!==S||e[8]!==y||e[9]!==F||e[10]!==l||e[11]!==j||e[12]!==n||e[13]!==m||e[14]!==M||e[15]!==K||e[16]!==V||e[17]!==h||e[18]!==w?($={search:l,searchTerm:j,setSearch:p,filters:y,setFilters:m,filterBarVisible:S,setFilterBarVisible:n,toggleFilterBar:h,viewMode:w,setViewMode:M,sortKey:V,sortDirection:K,handleSort:F},e[7]=S,e[8]=y,e[9]=F,e[10]=l,e[11]=j,e[12]=n,e[13]=m,e[14]=M,e[15]=K,e[16]=V,e[17]=h,e[18]=w,e[19]=$):$=e[19],$}export{H as U,A as s,X as u};
@@ -0,0 +1 @@
1
+ import{c,u}from"./index-CCcWAtA_.js";import{h as m,e as a}from"./use-connection-BCPygOxC.js";import{j as p}from"./constants-PBHJ4h9F.js";import{a as C}from"./use-binding-ucSDtQ56.js";function x(n,s){const o=c.c(5);let e;o[0]!==s?(e=s===void 0?{}:s,o[0]=s,o[1]=e):e=o[1];const r=e,{org:i}=u();let t;o[2]!==n||o[3]!==i.id?(t={connectionId:n,orgId:i.id},o[2]=n,o[3]=i.id,o[4]=t):t=o[4];const l=p(t);return a(n??"no-connection","LLM",l,r)}function j(){const n=c.c(2),s=m();let o;return n[0]!==s?(o={connections:s,binding:"LLMS"},n[0]=s,n[1]=o):o=n[1],C(o)}export{x as a,j as u};
@@ -1 +1 @@
1
- import{c as u,q as c}from"./index-D5tmQFLM.js";import{u as p}from"./useQuery-C7wGFtkw.js";import{K as n}from"./constants-BQDDq09c.js";async function f(l){return l.getServerCapabilities()?.resources?await l.listResources():{resources:[]}}async function b(l,e){return await l.readResource({uri:e})}function R(l){const e=u.c(12);let t,s;e[0]!==l?({client:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let r;e[3]!==t?(r=n.mcpResourcesList(t),e[3]=t,e[4]=r):r=e[4];let i;e[5]!==t?(i=()=>f(t),e[5]=t,e[6]=i):i=e[6];const o=s.staleTime??3e4;let a;return e[7]!==s||e[8]!==r||e[9]!==i||e[10]!==o?(a={...s,queryKey:r,queryFn:i,staleTime:o,retry:!1},e[7]=s,e[8]=r,e[9]=i,e[10]=o,e[11]=a):a=e[11],c(a)}function L(l){const e=u.c(12);let t,s;e[0]!==l?({client:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let r;e[3]!==t?(r=n.mcpResourcesList(t),e[3]=t,e[4]=r):r=e[4];let i;e[5]!==t?(i=()=>f(t),e[5]=t,e[6]=i):i=e[6];const o=s.staleTime??3e4;let a;return e[7]!==s||e[8]!==r||e[9]!==i||e[10]!==o?(a={...s,queryKey:r,queryFn:i,staleTime:o,retry:!1},e[7]=s,e[8]=r,e[9]=i,e[10]=o,e[11]=a):a=e[11],p(a)}async function m(l){return l.getServerCapabilities()?.prompts?await l.listPrompts():{prompts:[]}}async function T(l,e,t){if(!l.getServerCapabilities()?.prompts)throw new Error("Prompts capability not supported");return await l.getPrompt({name:e,arguments:t??{}})}function g(l){const e=u.c(12);let t,s;e[0]!==l?({client:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let r;e[3]!==t?(r=n.mcpPromptsList(t),e[3]=t,e[4]=r):r=e[4];let i;e[5]!==t?(i=()=>m(t),e[5]=t,e[6]=i):i=e[6];const o=s.staleTime??3e4;let a;return e[7]!==s||e[8]!==r||e[9]!==i||e[10]!==o?(a={...s,queryKey:r,queryFn:i,staleTime:o,retry:!1},e[7]=s,e[8]=r,e[9]=i,e[10]=o,e[11]=a):a=e[11],c(a)}function C(l){const e=u.c(12);let t,s;e[0]!==l?({client:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let r;e[3]!==t?(r=n.mcpPromptsList(t),e[3]=t,e[4]=r):r=e[4];let i;e[5]!==t?(i=()=>m(t),e[5]=t,e[6]=i):i=e[6];const o=s.staleTime??3e4;let a;return e[7]!==s||e[8]!==r||e[9]!==i||e[10]!==o?(a={...s,queryKey:r,queryFn:i,staleTime:o,retry:!1},e[7]=s,e[8]=r,e[9]=i,e[10]=o,e[11]=a):a=e[11],p(a)}export{f as a,C as b,R as c,L as d,T as g,m as l,b as r,g as u};
1
+ import{c as u,q as c}from"./index-CCcWAtA_.js";import{u as p}from"./useQuery-Dp4Sp9Q1.js";import{K as n}from"./constants-PBHJ4h9F.js";async function f(l){return l.getServerCapabilities()?.resources?await l.listResources():{resources:[]}}async function b(l,e){return await l.readResource({uri:e})}function R(l){const e=u.c(12);let t,s;e[0]!==l?({client:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let r;e[3]!==t?(r=n.mcpResourcesList(t),e[3]=t,e[4]=r):r=e[4];let i;e[5]!==t?(i=()=>f(t),e[5]=t,e[6]=i):i=e[6];const o=s.staleTime??3e4;let a;return e[7]!==s||e[8]!==r||e[9]!==i||e[10]!==o?(a={...s,queryKey:r,queryFn:i,staleTime:o,retry:!1},e[7]=s,e[8]=r,e[9]=i,e[10]=o,e[11]=a):a=e[11],c(a)}function L(l){const e=u.c(12);let t,s;e[0]!==l?({client:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let r;e[3]!==t?(r=n.mcpResourcesList(t),e[3]=t,e[4]=r):r=e[4];let i;e[5]!==t?(i=()=>f(t),e[5]=t,e[6]=i):i=e[6];const o=s.staleTime??3e4;let a;return e[7]!==s||e[8]!==r||e[9]!==i||e[10]!==o?(a={...s,queryKey:r,queryFn:i,staleTime:o,retry:!1},e[7]=s,e[8]=r,e[9]=i,e[10]=o,e[11]=a):a=e[11],p(a)}async function m(l){return l.getServerCapabilities()?.prompts?await l.listPrompts():{prompts:[]}}async function T(l,e,t){if(!l.getServerCapabilities()?.prompts)throw new Error("Prompts capability not supported");return await l.getPrompt({name:e,arguments:t??{}})}function g(l){const e=u.c(12);let t,s;e[0]!==l?({client:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let r;e[3]!==t?(r=n.mcpPromptsList(t),e[3]=t,e[4]=r):r=e[4];let i;e[5]!==t?(i=()=>m(t),e[5]=t,e[6]=i):i=e[6];const o=s.staleTime??3e4;let a;return e[7]!==s||e[8]!==r||e[9]!==i||e[10]!==o?(a={...s,queryKey:r,queryFn:i,staleTime:o,retry:!1},e[7]=s,e[8]=r,e[9]=i,e[10]=o,e[11]=a):a=e[11],c(a)}function C(l){const e=u.c(12);let t,s;e[0]!==l?({client:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let r;e[3]!==t?(r=n.mcpPromptsList(t),e[3]=t,e[4]=r):r=e[4];let i;e[5]!==t?(i=()=>m(t),e[5]=t,e[6]=i):i=e[6];const o=s.staleTime??3e4;let a;return e[7]!==s||e[8]!==r||e[9]!==i||e[10]!==o?(a={...s,queryKey:r,queryFn:i,staleTime:o,retry:!1},e[7]=s,e[8]=r,e[9]=i,e[10]=o,e[11]=a):a=e[11],p(a)}export{f as a,C as b,R as c,L as d,T as g,m as l,b as r,g as u};
@@ -1 +1 @@
1
- import{c as m,q as p}from"./index-D5tmQFLM.js";import{u as q}from"./useQuery-C7wGFtkw.js";import{u as C}from"./useMutation-CapnNHWF.js";import{K as T}from"./constants-BQDDq09c.js";function w(r){const e=m.c(12);let t,s;e[0]!==r?({client:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let l;e[3]!==t?(l=T.mcpToolsList(t),e[3]=t,e[4]=l):l=e[4];let o;e[5]!==t?(o=async()=>await t.listTools(),e[5]=t,e[6]=o):o=e[6];const i=s.staleTime??3e4;let n;return e[7]!==s||e[8]!==l||e[9]!==o||e[10]!==i?(n={...s,queryKey:l,queryFn:o,staleTime:i,retry:!1},e[7]=s,e[8]=l,e[9]=o,e[10]=i,e[11]=n):n=e[11],p(n)}function F(r){const e=m.c(12);let t,s;e[0]!==r?({client:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let l;e[3]!==t?(l=T.mcpToolsList(t),e[3]=t,e[4]=l):l=e[4];let o;e[5]!==t?(o=async()=>await t.listTools(),e[5]=t,e[6]=o):o=e[6];const i=s.staleTime??3e4;let n;return e[7]!==s||e[8]!==l||e[9]!==o||e[10]!==i?(n={...s,queryKey:l,queryFn:o,staleTime:i,retry:!1},e[7]=s,e[8]=l,e[9]=o,e[10]=i,e[11]=n):n=e[11],q(n)}function P(r){const e=m.c(21);let t,s,l,o;e[0]!==r?({client:t,toolName:o,toolArguments:l,...s}=r,e[0]=r,e[1]=t,e[2]=s,e[3]=l,e[4]=o):(t=e[1],s=e[2],l=e[3],o=e[4]);let i,n,u;if(e[5]!==t||e[6]!==s||e[7]!==l||e[8]!==o){const y=JSON.stringify(l??{});u=p,i=s,n=T.mcpToolCall(t,o,y),e[5]=t,e[6]=s,e[7]=l,e[8]=o,e[9]=i,e[10]=n,e[11]=u}else i=e[9],n=e[10],u=e[11];let a;e[12]!==t||e[13]!==l||e[14]!==o?(a=async()=>await t.callTool({name:o,arguments:l}),e[12]=t,e[13]=l,e[14]=o,e[15]=a):a=e[15];const f=s.staleTime??3e4;let c;return e[16]!==i||e[17]!==n||e[18]!==a||e[19]!==f?(c={...i,queryKey:n,queryFn:a,staleTime:f,retry:!1},e[16]=i,e[17]=n,e[18]=a,e[19]=f,e[20]=c):c=e[20],u(c)}function $(r){const e=m.c(21);let t,s,l,o;e[0]!==r?({client:t,toolName:o,toolArguments:l,...s}=r,e[0]=r,e[1]=t,e[2]=s,e[3]=l,e[4]=o):(t=e[1],s=e[2],l=e[3],o=e[4]);let i,n,u;if(e[5]!==t||e[6]!==s||e[7]!==l||e[8]!==o){const y=JSON.stringify(l??{});u=q,i=s,n=T.mcpToolCall(t,o,y),e[5]=t,e[6]=s,e[7]=l,e[8]=o,e[9]=i,e[10]=n,e[11]=u}else i=e[9],n=e[10],u=e[11];let a;e[12]!==t||e[13]!==l||e[14]!==o?(a=async()=>await t.callTool({name:o,arguments:l}),e[12]=t,e[13]=l,e[14]=o,e[15]=a):a=e[15];const f=s.staleTime??3e4;let c;return e[16]!==i||e[17]!==n||e[18]!==a||e[19]!==f?(c={...i,queryKey:n,queryFn:a,staleTime:f,retry:!1},e[16]=i,e[17]=n,e[18]=a,e[19]=f,e[20]=c):c=e[20],u(c)}function L(r){const e=m.c(8);let t,s;e[0]!==r?({client:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let l;e[3]!==t?(l=async i=>await t.callTool(i),e[3]=t,e[4]=l):l=e[4];let o;return e[5]!==s||e[6]!==l?(o={...s,mutationFn:l},e[5]=s,e[6]=l,e[7]=o):o=e[7],C(o)}export{L as a,$ as b,w as c,F as d,P as u};
1
+ import{c as m,q as p}from"./index-CCcWAtA_.js";import{u as q}from"./useQuery-Dp4Sp9Q1.js";import{u as C}from"./useMutation-Cn2d2ilG.js";import{K as T}from"./constants-PBHJ4h9F.js";function w(r){const e=m.c(12);let t,s;e[0]!==r?({client:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let l;e[3]!==t?(l=T.mcpToolsList(t),e[3]=t,e[4]=l):l=e[4];let o;e[5]!==t?(o=async()=>await t.listTools(),e[5]=t,e[6]=o):o=e[6];const i=s.staleTime??3e4;let n;return e[7]!==s||e[8]!==l||e[9]!==o||e[10]!==i?(n={...s,queryKey:l,queryFn:o,staleTime:i,retry:!1},e[7]=s,e[8]=l,e[9]=o,e[10]=i,e[11]=n):n=e[11],p(n)}function F(r){const e=m.c(12);let t,s;e[0]!==r?({client:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let l;e[3]!==t?(l=T.mcpToolsList(t),e[3]=t,e[4]=l):l=e[4];let o;e[5]!==t?(o=async()=>await t.listTools(),e[5]=t,e[6]=o):o=e[6];const i=s.staleTime??3e4;let n;return e[7]!==s||e[8]!==l||e[9]!==o||e[10]!==i?(n={...s,queryKey:l,queryFn:o,staleTime:i,retry:!1},e[7]=s,e[8]=l,e[9]=o,e[10]=i,e[11]=n):n=e[11],q(n)}function P(r){const e=m.c(21);let t,s,l,o;e[0]!==r?({client:t,toolName:o,toolArguments:l,...s}=r,e[0]=r,e[1]=t,e[2]=s,e[3]=l,e[4]=o):(t=e[1],s=e[2],l=e[3],o=e[4]);let i,n,u;if(e[5]!==t||e[6]!==s||e[7]!==l||e[8]!==o){const y=JSON.stringify(l??{});u=p,i=s,n=T.mcpToolCall(t,o,y),e[5]=t,e[6]=s,e[7]=l,e[8]=o,e[9]=i,e[10]=n,e[11]=u}else i=e[9],n=e[10],u=e[11];let a;e[12]!==t||e[13]!==l||e[14]!==o?(a=async()=>await t.callTool({name:o,arguments:l}),e[12]=t,e[13]=l,e[14]=o,e[15]=a):a=e[15];const f=s.staleTime??3e4;let c;return e[16]!==i||e[17]!==n||e[18]!==a||e[19]!==f?(c={...i,queryKey:n,queryFn:a,staleTime:f,retry:!1},e[16]=i,e[17]=n,e[18]=a,e[19]=f,e[20]=c):c=e[20],u(c)}function $(r){const e=m.c(21);let t,s,l,o;e[0]!==r?({client:t,toolName:o,toolArguments:l,...s}=r,e[0]=r,e[1]=t,e[2]=s,e[3]=l,e[4]=o):(t=e[1],s=e[2],l=e[3],o=e[4]);let i,n,u;if(e[5]!==t||e[6]!==s||e[7]!==l||e[8]!==o){const y=JSON.stringify(l??{});u=q,i=s,n=T.mcpToolCall(t,o,y),e[5]=t,e[6]=s,e[7]=l,e[8]=o,e[9]=i,e[10]=n,e[11]=u}else i=e[9],n=e[10],u=e[11];let a;e[12]!==t||e[13]!==l||e[14]!==o?(a=async()=>await t.callTool({name:o,arguments:l}),e[12]=t,e[13]=l,e[14]=o,e[15]=a):a=e[15];const f=s.staleTime??3e4;let c;return e[16]!==i||e[17]!==n||e[18]!==a||e[19]!==f?(c={...i,queryKey:n,queryFn:a,staleTime:f,retry:!1},e[16]=i,e[17]=n,e[18]=a,e[19]=f,e[20]=c):c=e[20],u(c)}function L(r){const e=m.c(8);let t,s;e[0]!==r?({client:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let l;e[3]!==t?(l=async i=>await t.callTool(i),e[3]=t,e[4]=l):l=e[4];let o;return e[5]!==s||e[6]!==l?(o={...s,mutationFn:l},e[5]=s,e[6]=l,e[7]=o):o=e[7],C(o)}export{L as a,$ as b,w as c,F as d,P as u};
@@ -1 +1 @@
1
- import{c as m,r}from"./index-D5tmQFLM.js";const a=768,o=()=>globalThis.innerWidth<a;function u(){const e=m.c(2),[l,n]=r.useState(o);let t,s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>{const i=()=>n(o),c=globalThis.matchMedia(`(max-width: ${a-1}px)`);return c.addEventListener("change",i),n(o),()=>c.removeEventListener("change",i)},s=[],e[0]=t,e[1]=s):(t=e[0],s=e[1]),r.useEffect(t,s),l}export{u};
1
+ import{c as m,r}from"./index-CCcWAtA_.js";const a=768,o=()=>globalThis.innerWidth<a;function u(){const e=m.c(2),[l,n]=r.useState(o);let t,s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>{const i=()=>n(o),c=globalThis.matchMedia(`(max-width: ${a-1}px)`);return c.addEventListener("change",i),n(o),()=>c.removeEventListener("change",i)},s=[],e[0]=t,e[1]=s):(t=e[0],s=e[1]),r.useEffect(t,s),l}export{u};
@@ -1 +1 @@
1
- import{c as m,u as T,q as d,v as y,K as g}from"./index-D5tmQFLM.js";import{u as _}from"./useMutation-CapnNHWF.js";import{a as p,u as A}from"./constants-BQDDq09c.js";function D(e){const t=m.c(10),{org:i}=T();let l;t[0]!==i.id?(l={connectionId:p,orgId:i.id},t[0]=i.id,t[1]=l):l=t[1];const c=A(l);let u;t[2]!==e?(u=g.organizationSettings(e),t[2]=e,t[3]=u):u=t[3];let s;t[4]!==c||t[5]!==e?(s=async()=>{const a=await c.callTool({name:"ORGANIZATION_SETTINGS_GET",arguments:{}}),r=a.structuredContent??a;return r||{organizationId:e,sidebar_items:null,enabled_plugins:null,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}},t[4]=c,t[5]=e,t[6]=s):s=t[6];let n;t[7]!==u||t[8]!==s?(n={queryKey:u,queryFn:s,staleTime:6e4},t[7]=u,t[8]=s,t[9]=n):n=t[9];const{data:o}=d(n);return o}function G(e){const t=m.c(13),i=y(),{org:l}=T();let c;t[0]!==l.id?(c={connectionId:p,orgId:l.id},t[0]=l.id,t[1]=c):c=t[1];const u=A(c);let s;t[2]!==u||t[3]!==e?(s=async S=>{const f=await u.callTool({name:"ORGANIZATION_SETTINGS_UPDATE",arguments:{organizationId:e,...S}});return f.structuredContent??f},t[2]=u,t[3]=e,t[4]=s):s=t[4];let n;t[5]!==e||t[6]!==i?(n=S=>{i.setQueryData(g.organizationSettings(e),S)},t[5]=e,t[6]=i,t[7]=n):n=t[7];let o;t[8]!==s||t[9]!==n?(o={mutationFn:s,onSuccess:n},t[8]=s,t[9]=n,t[10]=o):o=t[10];const a=_(o);let r;return t[11]!==a?(r={update:a},t[11]=a,t[12]=r):r=t[12],r}export{G as a,D as u};
1
+ import{c as m,u as T,q as d,v as y,K as g}from"./index-CCcWAtA_.js";import{u as _}from"./useMutation-Cn2d2ilG.js";import{a as p,u as A}from"./constants-PBHJ4h9F.js";function D(e){const t=m.c(10),{org:i}=T();let l;t[0]!==i.id?(l={connectionId:p,orgId:i.id},t[0]=i.id,t[1]=l):l=t[1];const c=A(l);let u;t[2]!==e?(u=g.organizationSettings(e),t[2]=e,t[3]=u):u=t[3];let s;t[4]!==c||t[5]!==e?(s=async()=>{const a=await c.callTool({name:"ORGANIZATION_SETTINGS_GET",arguments:{}}),r=a.structuredContent??a;return r||{organizationId:e,sidebar_items:null,enabled_plugins:null,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}},t[4]=c,t[5]=e,t[6]=s):s=t[6];let n;t[7]!==u||t[8]!==s?(n={queryKey:u,queryFn:s,staleTime:6e4},t[7]=u,t[8]=s,t[9]=n):n=t[9];const{data:o}=d(n);return o}function G(e){const t=m.c(13),i=y(),{org:l}=T();let c;t[0]!==l.id?(c={connectionId:p,orgId:l.id},t[0]=l.id,t[1]=c):c=t[1];const u=A(c);let s;t[2]!==u||t[3]!==e?(s=async S=>{const f=await u.callTool({name:"ORGANIZATION_SETTINGS_UPDATE",arguments:{organizationId:e,...S}});return f.structuredContent??f},t[2]=u,t[3]=e,t[4]=s):s=t[4];let n;t[5]!==e||t[6]!==i?(n=S=>{i.setQueryData(g.organizationSettings(e),S)},t[5]=e,t[6]=i,t[7]=n):n=t[7];let o;t[8]!==s||t[9]!==n?(o={mutationFn:s,onSuccess:n},t[8]=s,t[9]=n,t[10]=o):o=t[10];const a=_(o);let r;return t[11]!==a?(r={update:a},t[11]=a,t[12]=r):r=t[12],r}export{G as a,D as u};
@@ -1 +1 @@
1
- import{K as m,c as C}from"./index-D5tmQFLM.js";import{u as y}from"./useQuery-C7wGFtkw.js";import{u as f,a}from"./constants-BQDDq09c.js";function q(t,s){const e=C.c(13);let l;e[0]!==t?(l={connectionId:a,orgId:t},e[0]=t,e[1]=l):l=e[1];const u=f(l);let r;e[2]!==t||e[3]!==s?(r=m.project(t,s),e[2]=t,e[3]=s,e[4]=r):r=e[4];let c;e[5]!==u||e[6]!==t||e[7]!==s?(c=async()=>{const p=await u.callTool({name:"PROJECT_GET",arguments:{organizationId:t,slug:s}});return(p.structuredContent??p).project},e[5]=u,e[6]=t,e[7]=s,e[8]=c):c=e[8];const n=!!t&&!!s;let o;return e[9]!==r||e[10]!==c||e[11]!==n?(o={queryKey:r,queryFn:c,enabled:n,staleTime:3e4},e[9]=r,e[10]=c,e[11]=n,e[12]=o):o=e[12],y(o)}function _(t,s){const e=f({connectionId:a,orgId:t}),l={queryKey:m.projects(t),queryFn:async()=>{const u=await e.callTool({name:"PROJECT_LIST",arguments:{organizationId:t}});return(u.structuredContent??u).projects.map(c=>({...c,organizationId:t}))},staleTime:3e4};return y({...l,enabled:!!t})}export{_ as a,q as u};
1
+ import{K as m,c as C}from"./index-CCcWAtA_.js";import{u as y}from"./useQuery-Dp4Sp9Q1.js";import{u as f,a}from"./constants-PBHJ4h9F.js";function q(t,s){const e=C.c(13);let l;e[0]!==t?(l={connectionId:a,orgId:t},e[0]=t,e[1]=l):l=e[1];const u=f(l);let r;e[2]!==t||e[3]!==s?(r=m.project(t,s),e[2]=t,e[3]=s,e[4]=r):r=e[4];let c;e[5]!==u||e[6]!==t||e[7]!==s?(c=async()=>{const p=await u.callTool({name:"PROJECT_GET",arguments:{organizationId:t,slug:s}});return(p.structuredContent??p).project},e[5]=u,e[6]=t,e[7]=s,e[8]=c):c=e[8];const n=!!t&&!!s;let o;return e[9]!==r||e[10]!==c||e[11]!==n?(o={queryKey:r,queryFn:c,enabled:n,staleTime:3e4},e[9]=r,e[10]=c,e[11]=n,e[12]=o):o=e[12],y(o)}function _(t,s){const e=f({connectionId:a,orgId:t}),l={queryKey:m.projects(t),queryFn:async()=>{const u=await e.callTool({name:"PROJECT_LIST",arguments:{organizationId:t}});return(u.structuredContent??u).projects.map(c=>({...c,organizationId:t}))},staleTime:3e4};return y({...l,enabled:!!t})}export{_ as a,q as u};
@@ -1 +1 @@
1
- import{c,u as r}from"./index-D5tmQFLM.js";import{e as a,u as C,d as I}from"./use-connection-BSXprdTB.js";import{a as l,u}from"./constants-BQDDq09c.js";function m(i){const t=c.c(4);let o;t[0]!==i?(o=i===void 0?{}:i,t[0]=i,t[1]=o):o=t[1];const n=o,{org:e}=r();let s;t[2]!==e.id?(s={connectionId:l,orgId:e.id},t[2]=e.id,t[3]=s):s=t[3];const d=u(s);return a(e.id,"VIRTUAL_MCP",d,n)}function V(i){const t=c.c(2),{org:o}=r();let n;t[0]!==o.id?(n={connectionId:l,orgId:o.id},t[0]=o.id,t[1]=n):n=t[1];const e=u(n);return I(o.id,"VIRTUAL_MCP",i??void 0,e)}function p(){const i=c.c(2),{org:t}=r();let o;i[0]!==t.id?(o={connectionId:l,orgId:t.id},i[0]=t.id,i[1]=o):o=i[1];const n=u(o);return C(t.id,"VIRTUAL_MCP",n)}export{p as a,m as b,V as u};
1
+ import{c,u as r}from"./index-CCcWAtA_.js";import{e as a,u as C,d as I}from"./use-connection-BCPygOxC.js";import{a as l,u}from"./constants-PBHJ4h9F.js";function m(i){const t=c.c(4);let o;t[0]!==i?(o=i===void 0?{}:i,t[0]=i,t[1]=o):o=t[1];const n=o,{org:e}=r();let s;t[2]!==e.id?(s={connectionId:l,orgId:e.id},t[2]=e.id,t[3]=s):s=t[3];const d=u(s);return a(e.id,"VIRTUAL_MCP",d,n)}function V(i){const t=c.c(2),{org:o}=r();let n;t[0]!==o.id?(n={connectionId:l,orgId:o.id},t[0]=o.id,t[1]=n):n=t[1];const e=u(n);return I(o.id,"VIRTUAL_MCP",i??void 0,e)}function p(){const i=c.c(2),{org:t}=r();let o;i[0]!==t.id?(o={connectionId:l,orgId:t.id},i[0]=t.id,i[1]=o):o=i[1];const n=u(o);return C(t.id,"VIRTUAL_MCP",n)}export{p as a,m as b,V as u};
@@ -0,0 +1 @@
1
+ import{I as u}from"./infiniteQueryObserver-BdhSYRBe.js";import{a0 as i}from"./index-CCcWAtA_.js";function t(e,r){return i(e,u,r)}export{t as u};
@@ -1 +1 @@
1
- import{aP as l,aQ as p,aR as n,aS as d,aT as h,v as b,r as o,aU as m,aV as v}from"./index-D5tmQFLM.js";var f=class extends l{#s;#i=void 0;#t;#e;constructor(t,s){super(),this.#s=t,this.setOptions(s),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const s=this.options;this.options=this.#s.defaultMutationOptions(t),p(this.options,s)||this.#s.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#t,observer:this}),s?.mutationKey&&this.options.mutationKey&&n(s.mutationKey)!==n(this.options.mutationKey)?this.reset():this.#t?.state.status==="pending"&&this.#t.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#t?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#o(t)}getCurrentResult(){return this.#i}reset(){this.#t?.removeObserver(this),this.#t=void 0,this.#r(),this.#o()}mutate(t,s){return this.#e=s,this.#t?.removeObserver(this),this.#t=this.#s.getMutationCache().build(this.#s,this.options),this.#t.addObserver(this),this.#t.execute(t)}#r(){const t=this.#t?.state??d();this.#i={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#o(t){h.batch(()=>{if(this.#e&&this.hasListeners()){const s=this.#i.variables,i=this.#i.context,e={client:this.#s,meta:this.options.meta,mutationKey:this.options.mutationKey};t?.type==="success"?(this.#e.onSuccess?.(t.data,s,i,e),this.#e.onSettled?.(t.data,null,s,i,e)):t?.type==="error"&&(this.#e.onError?.(t.error,s,i,e),this.#e.onSettled?.(void 0,t.error,s,i,e))}this.listeners.forEach(s=>{s(this.#i)})})}};function O(t,s){const i=b(s),[e]=o.useState(()=>new f(i,t));o.useEffect(()=>{e.setOptions(t)},[e,t]);const r=o.useSyncExternalStore(o.useCallback(a=>e.subscribe(h.batchCalls(a)),[e]),()=>e.getCurrentResult(),()=>e.getCurrentResult()),u=o.useCallback((a,c)=>{e.mutate(a,c).catch(m)},[e]);if(r.error&&v(e.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:u,mutateAsync:r.mutate}}export{O as u};
1
+ import{aP as l,aQ as p,aR as n,aS as d,aT as h,v as b,r as o,aU as m,aV as v}from"./index-CCcWAtA_.js";var f=class extends l{#s;#i=void 0;#t;#e;constructor(t,s){super(),this.#s=t,this.setOptions(s),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const s=this.options;this.options=this.#s.defaultMutationOptions(t),p(this.options,s)||this.#s.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#t,observer:this}),s?.mutationKey&&this.options.mutationKey&&n(s.mutationKey)!==n(this.options.mutationKey)?this.reset():this.#t?.state.status==="pending"&&this.#t.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#t?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#o(t)}getCurrentResult(){return this.#i}reset(){this.#t?.removeObserver(this),this.#t=void 0,this.#r(),this.#o()}mutate(t,s){return this.#e=s,this.#t?.removeObserver(this),this.#t=this.#s.getMutationCache().build(this.#s,this.options),this.#t.addObserver(this),this.#t.execute(t)}#r(){const t=this.#t?.state??d();this.#i={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#o(t){h.batch(()=>{if(this.#e&&this.hasListeners()){const s=this.#i.variables,i=this.#i.context,e={client:this.#s,meta:this.options.meta,mutationKey:this.options.mutationKey};t?.type==="success"?(this.#e.onSuccess?.(t.data,s,i,e),this.#e.onSettled?.(t.data,null,s,i,e)):t?.type==="error"&&(this.#e.onError?.(t.error,s,i,e),this.#e.onSettled?.(void 0,t.error,s,i,e))}this.listeners.forEach(s=>{s(this.#i)})})}};function O(t,s){const i=b(s),[e]=o.useState(()=>new f(i,t));o.useEffect(()=>{e.setOptions(t)},[e,t]);const r=o.useSyncExternalStore(o.useCallback(a=>e.subscribe(h.batchCalls(a)),[e]),()=>e.getCurrentResult(),()=>e.getCurrentResult()),u=o.useCallback((a,c)=>{e.mutate(a,c).catch(m)},[e]);if(r.error&&v(e.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:u,mutateAsync:r.mutate}}export{O as u};
@@ -0,0 +1 @@
1
+ import{a0 as u,a3 as s}from"./index-CCcWAtA_.js";function o(e,r){return u(e,s,r)}export{o as u};
@@ -0,0 +1 @@
1
+ import{a7 as a,a8 as t}from"./index-CCcWAtA_.js";function e(...r){return a(t(r))}export{e as c};