@decocms/mesh 2.79.0 → 2.79.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/dist/client/assets/{AlertCircle-CW4Sk6oX.js → AlertCircle-CjljO9_K.js} +1 -1
  2. package/dist/client/assets/{ArrowUp-BYWpc5ll.js → ArrowUp-DlHoNDRH.js} +1 -1
  3. package/dist/client/assets/{Calendar-DqEWNnZU.js → Calendar-BzfXEzG1.js} +1 -1
  4. package/dist/client/assets/{Check-DculLwTY.js → Check-Cx0Fc2ER.js} +1 -1
  5. package/dist/client/assets/{CheckCircle-CFbpmHek.js → CheckCircle-BHqfI-oc.js} +1 -1
  6. package/dist/client/assets/{CheckDone01-RxqaDdtn.js → CheckDone01-JeEywSHq.js} +1 -1
  7. package/dist/client/assets/{ChevronDown-B5ggjsm4.js → ChevronDown-CYzQevGE.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-Cr5VG3Nc.js → ChevronRight-ZFn5_7l2.js} +1 -1
  9. package/dist/client/assets/{Code01-BJFbEZeL.js → Code01-BHoiimgb.js} +1 -1
  10. package/dist/client/assets/{Copy01-BH-w-33C.js → Copy01-DMVE1jMt.js} +1 -1
  11. package/dist/client/assets/{DotsHorizontal-B_eY4QXm.js → DotsHorizontal-B8VSxmKN.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-CGVY_YBm.js → DotsVertical-DmgtVWCP.js} +1 -1
  13. package/dist/client/assets/{Download01-BwbEB5IK.js → Download01-DZAgFAa5.js} +1 -1
  14. package/dist/client/assets/{Edit01-BaE3BPjc.js → Edit01-xS3_fhS5.js} +1 -1
  15. package/dist/client/assets/{File02-BkqkoK7w.js → File02-CPn42A_T.js} +1 -1
  16. package/dist/client/assets/{File06-DleIBFfH.js → File06-BHrPxaod.js} +1 -1
  17. package/dist/client/assets/{FilterLines-CFTanTPx.js → FilterLines-OjKAkVgU.js} +1 -1
  18. package/dist/client/assets/{Globe02-BQodJ72t.js → Globe02-DANRNzsK.js} +1 -1
  19. package/dist/client/assets/{Grid01-Cs53CS-5.js → Grid01-DfoEVHbX.js} +1 -1
  20. package/dist/client/assets/{Home02-BKkdPhDR.js → Home02-mm2kWrdz.js} +1 -1
  21. package/dist/client/assets/{Image01-BbLbts0-.js → Image01-BqS-Pbmk.js} +1 -1
  22. package/dist/client/assets/{Inbox01-CHIpR88t.js → Inbox01-GbeCfKmy.js} +1 -1
  23. package/dist/client/assets/{InfoCircle-D7HNKLr2.js → InfoCircle-B8VcezQA.js} +1 -1
  24. package/dist/client/assets/{LinkExternal01-BPoC5CFu.js → LinkExternal01-Ba4Ansgj.js} +1 -1
  25. package/dist/client/assets/{List-zFjtXH7P.js → List-C89gZK5m.js} +1 -1
  26. package/dist/client/assets/{Loading01-Dg8JaI39.js → Loading01-nhRm_OwM.js} +1 -1
  27. package/dist/client/assets/{Lock01-C1503dNT.js → Lock01-BIksl5Jz.js} +1 -1
  28. package/dist/client/assets/{Pin01-DYTDZ7D6.js → Pin01-B9_xrwWT.js} +1 -1
  29. package/dist/client/assets/{Play-DBpOK3b7.js → Play-YTrai4me.js} +1 -1
  30. package/dist/client/assets/{Plus-C8DbMf_J.js → Plus-DVfCRM0e.js} +1 -1
  31. package/dist/client/assets/{RefreshCcw01-DtnaLwoS.js → RefreshCcw01-DhKbWajd.js} +1 -1
  32. package/dist/client/assets/{SearchMd-DNCMhpiT.js → SearchMd-Btq9JQM1.js} +1 -1
  33. package/dist/client/assets/{Settings01-CU0gXyZH.js → Settings01-n5GEFijK.js} +1 -1
  34. package/dist/client/assets/{Settings02-Dg5kYnY7.js → Settings02-DmQ47Bo8.js} +1 -1
  35. package/dist/client/assets/{Share07-BTsPL8Sl.js → Share07-C0an8t9N.js} +1 -1
  36. package/dist/client/assets/{Terminal-BGujo_7N.js → Terminal-COlc6e5_.js} +1 -1
  37. package/dist/client/assets/{Tool01-DEyQj-x1.js → Tool01-syn058fN.js} +1 -1
  38. package/dist/client/assets/{Trash01-CYpnoP-g.js → Trash01-pKL0Dwki.js} +1 -1
  39. package/dist/client/assets/{Upload01-DbeFuIZX.js → Upload01-Cny6KgII.js} +1 -1
  40. package/dist/client/assets/{Users03-FTbxLrX1.js → Users03-DxSocU5u.js} +1 -1
  41. package/dist/client/assets/{X-BHkQr7S5.js → X-orwHLQvA.js} +1 -1
  42. package/dist/client/assets/{XClose-BaQSBowg.js → XClose-BvifwoiV.js} +1 -1
  43. package/dist/client/assets/{agent-connections-preview-BKia17Fm.js → agent-connections-preview-Ci_AKj2E.js} +1 -1
  44. package/dist/client/assets/{agent-detail-DbrCQHp5.js → agent-detail-BJ18jZ58.js} +1 -1
  45. package/dist/client/assets/{agents-UkogY57M.js → agents-PSoG53JZ.js} +1 -1
  46. package/dist/client/assets/{alert-dialog-DsKCxNpH.js → alert-dialog-DWDyfsZl.js} +1 -1
  47. package/dist/client/assets/{auth-catchall-DobN6c6b.js → auth-catchall-ePyrAyIw.js} +1 -1
  48. package/dist/client/assets/{avatar-B6qEKauK.js → avatar-CHzxmS3u.js} +1 -1
  49. package/dist/client/assets/{badge-U-QkTmUB.js → badge-DjX7aMc2.js} +1 -1
  50. package/dist/client/assets/{binder-DuGu2Eod.js → binder-boG-N4DJ.js} +1 -1
  51. package/dist/client/assets/{breadcrumb-i0S-E8eB.js → breadcrumb-C8uFp6Bl.js} +1 -1
  52. package/dist/client/assets/{button-DGRUBvcD.js → button-jVZoVSEf.js} +1 -1
  53. package/dist/client/assets/{card-CF_w5KfE.js → card-B1o7ZI1_.js} +1 -1
  54. package/dist/client/assets/{checkbox-Cb9HGfzM.js → checkbox-DBFzFvmQ.js} +1 -1
  55. package/dist/client/assets/{circle-alert-BXNGxCxL.js → circle-alert-BFldEkBf.js} +1 -1
  56. package/dist/client/assets/{collection-detail-DL0lHr4-.js → collection-detail-V5sA0ljc.js} +1 -1
  57. package/dist/client/assets/{collection-search-CdM4I7S4.js → collection-search-BcVP-V1Z.js} +1 -1
  58. package/dist/client/assets/{collection-tab-Cqdbtlxx.js → collection-tab-Ch7kudcF.js} +1 -1
  59. package/dist/client/assets/{collection-table-wrapper-C42UImDn.js → collection-table-wrapper-DuHnl5-M.js} +1 -1
  60. package/dist/client/assets/{collection-tabs-OYYKkvGS.js → collection-tabs-BoHGtImC.js} +1 -1
  61. package/dist/client/assets/{command-DfV3VJkg.js → command-CyNsts_0.js} +1 -1
  62. package/dist/client/assets/{connect-CUnCmHOL.js → connect-TCaIRpLI.js} +1 -1
  63. package/dist/client/assets/{connection-card-FtaHCc1W.js → connection-card-DvxLz7vp.js} +1 -1
  64. package/dist/client/assets/{connection-detail-DVoSxX6D.js → connection-detail-BcHSi6_W.js} +1 -1
  65. package/dist/client/assets/{connections-J0i0cah0.js → connections-DhYeAlGi.js} +1 -1
  66. package/dist/client/assets/{constants-C6ocvgwp.js → constants-B1K1ZOHV.js} +1 -1
  67. package/dist/client/assets/constants-BeVRY8ix.js +1 -0
  68. package/dist/client/assets/{create-organization-dialog-Cv4neTqS.js → create-organization-dialog-uaL-GIH0.js} +1 -1
  69. package/dist/client/assets/{create-project-dialog-C8n2M8aF.js → create-project-dialog-CF32CwsT.js} +1 -1
  70. package/dist/client/assets/{dialog-CumDMG4H.js → dialog-CD9Wwmjj.js} +1 -1
  71. package/dist/client/assets/{dropdown-menu-BtVTRE5a.js → dropdown-menu-1_TCBXfB.js} +1 -1
  72. package/dist/client/assets/{dynamic-plugin-layout-C19q7JxX.js → dynamic-plugin-layout-DATDpm42.js} +1 -1
  73. package/dist/client/assets/{empty-state-5XVaRkUc.js → empty-state-BbUfTlym.js} +1 -1
  74. package/dist/client/assets/{empty-state-DLHD7du3.js → empty-state-Diyqgtl1.js} +1 -1
  75. package/dist/client/assets/{env-vars-editor-CmZxKywt.js → env-vars-editor-C3mU-QJJ.js} +1 -1
  76. package/dist/client/assets/{error-boundary-CNjRJe61.js → error-boundary-BmGvCwcM.js} +1 -1
  77. package/dist/client/assets/{extract-connection-data-Ne-EkFUj.js → extract-connection-data-B-iX5ruo.js} +1 -1
  78. package/dist/client/assets/{file-browser-6JIAg27Y.js → file-browser-8RURV0zK.js} +2 -2
  79. package/dist/client/assets/{form-B_XcpyvU.js → form-CuPB-18q.js} +1 -1
  80. package/dist/client/assets/{grid-view-oc3e-Ime.js → grid-view-rXagJOfe.js} +1 -1
  81. package/dist/client/assets/{home-C88FY3Yv.js → home-C-ymc_Us.js} +1 -1
  82. package/dist/client/assets/{index-DkFIKpZ2.js → index-BZHmd1qO.js} +1 -1
  83. package/dist/client/assets/{index-BH2tQE-f.js → index-BfmXZUrD.js} +1 -1
  84. package/dist/client/assets/{index-C_0Oc8Tt.js → index-C2FQIz_S.js} +1 -1
  85. package/dist/client/assets/{index-B6qF8ORC.js → index-CFsUbpkt.js} +1 -1
  86. package/dist/client/assets/{index-C1Ep5ACS.js → index-Cl_5HyRE.js} +1 -1
  87. package/dist/client/assets/{index-AQn2B6oA.js → index-D3nlG5Bn.js} +2 -2
  88. package/dist/client/assets/{index-Br3ZyCcI.js → index-DNnTxMe0.js} +1 -1
  89. package/dist/client/assets/{index-DAXkxwPy.js → index-DUZGLwaX.js} +1 -1
  90. package/dist/client/assets/{index-Dcs09BQv.js → index-Dlv6gV0o.js} +1 -1
  91. package/dist/client/assets/{infiniteQueryObserver-BRf5xKc1.js → infiniteQueryObserver-C_2kO8fk.js} +1 -1
  92. package/dist/client/assets/{input-DhfWuIb9.js → input-Cfb0z5LB.js} +1 -1
  93. package/dist/client/assets/{integration-icon-qRP5Qh2F.js → integration-icon-DgoP3aRm.js} +1 -1
  94. package/dist/client/assets/{label-CMn17rPi.js → label-DLjBs6VT.js} +1 -1
  95. package/dist/client/assets/{layout-B4BICzsl.js → layout-CGitH7Eg.js} +1 -1
  96. package/dist/client/assets/{localstorage-keys-t7irYGPh.js → localstorage-keys-Dcw7WgCK.js} +1 -1
  97. package/dist/client/assets/{login-B2yTclVQ.js → login-uEE_LxIh.js} +1 -1
  98. package/dist/client/assets/{mcp-oauth-yR3SoghA.js → mcp-oauth-DcMlPST3.js} +1 -1
  99. package/dist/client/assets/{mcp-server-card-Bt67N5q-.js → mcp-server-card-Dp5-CXOE.js} +1 -1
  100. package/dist/client/assets/{mcp-server-detail-DkDSGvP4.js → mcp-server-detail-CxmJ9qyx.js} +2 -2
  101. package/dist/client/assets/{members-CSoRln0N.js → members-Fnrk53kf.js} +1 -1
  102. package/dist/client/assets/{monaco-editor-BoePktJa.js → monaco-editor-4bQew_dQ.js} +1 -1
  103. package/dist/client/assets/{monitoring-gIfkkQCL.js → monitoring-zeSCmmDz.js} +1 -1
  104. package/dist/client/assets/{oauth-callback-OtBrWcBZ.js → oauth-callback-BSP6Sdix.js} +1 -1
  105. package/dist/client/assets/{page-BqYhqjdR.js → page-BPzxTPAI.js} +1 -1
  106. package/dist/client/assets/{page-CwvG8qtj.js → page-CXTaRAHP.js} +1 -1
  107. package/dist/client/assets/{plugin-empty-state-MQXudPMn.js → plugin-empty-state-BlSVDzFR.js} +1 -1
  108. package/dist/client/assets/{plugin-header-C0hAoHms.js → plugin-header-CRX8X2CA.js} +1 -1
  109. package/dist/client/assets/{popover-Ca3E0O8V.js → popover-DZy413j4.js} +1 -1
  110. package/dist/client/assets/{project-layout-D8J94IO0.js → project-layout-CJ4kCybp.js} +1 -1
  111. package/dist/client/assets/{project-settings-CCP_F_Wt.js → project-settings-DFgohQs-.js} +1 -1
  112. package/dist/client/assets/{projects-list-BsgxXDEu.js → projects-list-C0t46Vb3.js} +1 -1
  113. package/dist/client/assets/{registry-utils-TpelbVAM.js → registry-utils-CTumh--w.js} +1 -1
  114. package/dist/client/assets/{resizable-Bz6b4Mq8.js → resizable-Do2pmnrG.js} +1 -1
  115. package/dist/client/assets/{select-CjMmbGNa.js → select-Dl5SsVsF.js} +1 -1
  116. package/dist/client/assets/{shell-layout-Z8NbFRul.js → shell-layout-FBb2Axq6.js} +1 -1
  117. package/dist/client/assets/{spinner-BOgwG_73.js → spinner-DA06y-h7.js} +1 -1
  118. package/dist/client/assets/{store-invite-Cfb6Kzed.js → store-invite-DbeHutGf.js} +1 -1
  119. package/dist/client/assets/{switch-C5h5o6_J.js → switch-CQszwSv3.js} +1 -1
  120. package/dist/client/assets/{table-WwRTCgkR.js → table-Cc1VTSqr.js} +1 -1
  121. package/dist/client/assets/{tasks-Bwxdnwhy.js → tasks-2vErKOnA.js} +1 -1
  122. package/dist/client/assets/{textarea-UP8jF7gS.js → textarea-CQw4c4vg.js} +1 -1
  123. package/dist/client/assets/{tools-list-B0Gj9Q0p.js → tools-list-BDp18Pgp.js} +1 -1
  124. package/dist/client/assets/{topbar-portal-DCNNdxZi.js → topbar-portal-BgZ57TAJ.js} +1 -1
  125. package/dist/client/assets/{typewriter-title-CBSurYu8.js → typewriter-title-B5Ki7tQ5.js} +1 -1
  126. package/dist/client/assets/{use-binding-BrQDsE_i.js → use-binding-TgcVoQAA.js} +1 -1
  127. package/dist/client/assets/{use-connection-Bre57mou.js → use-connection-Crfe-Ixd.js} +1 -1
  128. package/dist/client/assets/{use-create-virtual-mcp-ClgUJLXV.js → use-create-virtual-mcp-dLbcBuVS.js} +1 -1
  129. package/dist/client/assets/{use-deco-chat-open-BxVNBOmP.js → use-deco-chat-open-D-wIsSOI.js} +3 -3
  130. package/dist/client/assets/{use-install-from-registry-D7eJMUjn.js → use-install-from-registry-CNM1pBya.js} +1 -1
  131. package/dist/client/assets/{use-list-state-B85onKJV.js → use-list-state-COXmj0f_.js} +1 -1
  132. package/dist/client/assets/{use-llm-BTt8_Fcb.js → use-llm-rvFAkGsK.js} +1 -1
  133. package/dist/client/assets/{use-mcp-prompts-6h1nLjW3.js → use-mcp-prompts-DC9szL21.js} +1 -1
  134. package/dist/client/assets/{use-mcp-tools-Bvkiv86t.js → use-mcp-tools-CvRTK2tY.js} +1 -1
  135. package/dist/client/assets/{use-mobile-BWTl24se.js → use-mobile-Do_29jRD.js} +1 -1
  136. package/dist/client/assets/{use-organization-settings-BO_njizG.js → use-organization-settings-CuBKNeOw.js} +1 -1
  137. package/dist/client/assets/{use-project-Dig-ifvE.js → use-project-HGqdCewl.js} +1 -1
  138. package/dist/client/assets/{use-virtual-mcp-DO0h8U7s.js → use-virtual-mcp-VgOM6PoP.js} +1 -1
  139. package/dist/client/assets/useInfiniteQuery-DKdNavme.js +1 -0
  140. package/dist/client/assets/{useMutation-D2f0MLmt.js → useMutation-9v6OVjLU.js} +1 -1
  141. package/dist/client/assets/useQuery-CQyI9lob.js +1 -0
  142. package/dist/client/assets/utils-ChMoRSU0.js +1 -0
  143. package/dist/client/assets/{view-mode-toggle-DEbTV5rq.js → view-mode-toggle-B7iYwEYq.js} +1 -1
  144. package/dist/client/assets/{workflow-DYHGx0HO.js → workflow-BkMudwRR.js} +1 -1
  145. package/dist/client/index.html +1 -1
  146. package/dist/server/cli.js +1 -1
  147. package/dist/server/server.js +1 -1
  148. package/package.json +1 -1
  149. package/dist/client/assets/constants-31WgPf81.js +0 -1
  150. package/dist/client/assets/useInfiniteQuery-CvKzYFcZ.js +0 -1
  151. package/dist/client/assets/useQuery-BVNep5UM.js +0 -1
  152. package/dist/client/assets/utils-IhRriFes.js +0 -1
@@ -1 +1 @@
1
- import{y as P,c as w,z as Q,t as h,u as v}from"./index-AQn2B6oA.js";import{u as F}from"./useMutation-D2f0MLmt.js";import{K as x,a as q,u as U}from"./constants-C6ocvgwp.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 z={structuredContent:{items:[]},isError:!1};function B(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}):z,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 R(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:j},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 j(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 B(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 R(n.id,"CONNECTIONS",e)}export{z as E,D as a,X as b,b as c,k as d,B as e,ee as f,te as g,Z as h,R as u};
1
+ import{y as P,c as w,z as Q,t as h,u as v}from"./index-D3nlG5Bn.js";import{u as F}from"./useMutation-9v6OVjLU.js";import{K as x,a as q,u as U}from"./constants-B1K1ZOHV.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 z={structuredContent:{items:[]},isError:!1};function B(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}):z,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 R(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:j},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 j(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 B(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 R(n.id,"CONNECTIONS",e)}export{z as E,D as a,X as b,b as c,k as d,B as e,ee as f,te as g,Z as h,R as u};
@@ -1 +1 @@
1
- import{c as p,u as m,m as C,O as f}from"./index-AQn2B6oA.js";import{a as v}from"./use-virtual-mcp-DO0h8U7s.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-D3nlG5Bn.js";import{a as v}from"./use-virtual-mcp-VgOM6PoP.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,10 +1,10 @@
1
- import{r as S,bu as ts,bv as as,M as ss,be as B,s as b,bw as qe,bx as ca,bi as rs,bj as os,bd as ns,bf as z,b9 as Ie,aj as Te,o as R,bg as I,bh as ie,by as is,bz as O,ak as ls,b4 as cs,c as k,u as xe,K as Ae,a as da,z as xt,t as bt,j as d,g as ds,am as us,a3 as _t,at as ps,an as ms,aq as fs,av as hs,al as gs,a$ as vs}from"./index-AQn2B6oA.js";import{u as Et,a as It,d as ys}from"./constants-C6ocvgwp.js";import{b as xs}from"./use-virtual-mcp-DO0h8U7s.js";import{a as bs,u as St}from"./use-llm-BTt8_Fcb.js";import{u as _s}from"./useQuery-BVNep5UM.js";import{b as wt,c as Es,a as Is,e as Ss}from"./use-connection-Bre57mou.js";import{u as ws}from"./Code01-BJFbEZeL.js";import{u as Se,L as We}from"./localstorage-keys-t7irYGPh.js";import{B as ua}from"./button-DGRUBvcD.js";import{I as Ns}from"./input-DhfWuIb9.js";import{P as Cs,a as Ts,b as As}from"./popover-Ca3E0O8V.js";import{S as Ms,a as js,b as Rs,c as Ps,d as ks}from"./select-CjMmbGNa.js";import{c as Nt}from"./utils-IhRriFes.js";import{E as pa,i as Os}from"./error-boundary-CNjRJe61.js";import{t as dt}from"./ChevronDown-B5ggjsm4.js";import{i as Ds}from"./File06-DleIBFfH.js";import{c as $s}from"./Grid01-Cs53CS-5.js";import{a as Ls}from"./Image01-BbLbts0-.js";import{s as Zs}from"./RefreshCcw01-DtnaLwoS.js";import{i as ma}from"./SearchMd-DNCMhpiT.js";var we;(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})(we||(we={}));var Ft;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(Ft||(Ft={}));we.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);we.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 He 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 He))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,we.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()}}He.create=t=>new He(t);var Ut;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Ut||(Ut={}));var w;(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"})(w||(w={}));const Fs=({size:t=24,color:e="currentColor",...a})=>S.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},S.createElement("path",{d:"M4 7h11m0 0-4 4m4-4-4-4M4 17h16m0 0-4 4m4-4-4-4"}));Fs.displayName="ArrowsRight";const fa=({size:t=24,color:e="currentColor",...a})=>S.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},S.createElement("path",{d:"m7 15 5 5 5-5M7 9l5-5 5 5"}));fa.displayName="ChevronSelectorVertical";const ha=({size:t=24,color:e="currentColor",...a})=>S.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},S.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"}));ha.displayName="CurrencyDollar";const Us=({size:t=24,color:e="currentColor",...a})=>S.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},S.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"}));Us.displayName="Lightbulb02";const ga=({size:t=24,color:e="currentColor",...a})=>S.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},S.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"}));ga.displayName="LogOut04";const va=({size:t=24,color:e="currentColor",...a})=>S.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},S.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"}));va.displayName="Stars01";var ya="vercel.ai.error",zs=Symbol.for(ya),zt,Bt,te=class xa extends(Bt=Error,zt=zs,Bt){constructor({name:e,message:a,cause:s}){super(a),this[zt]=!0,this.name=e,this.cause=s}static isInstance(e){return xa.hasMarker(e,ya)}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 ba(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var _a="AI_InvalidArgumentError",Ea=`vercel.ai.error.${_a}`,Bs=Symbol.for(Ea),Vt,qt,Vs=class extends(qt=te,Vt=Bs,qt){constructor({message:t,cause:e,argument:a}){super({name:_a,message:t,cause:e}),this[Vt]=!0,this.argument=a}static isInstance(t){return te.hasMarker(t,Ea)}},Ia="AI_JSONParseError",Sa=`vercel.ai.error.${Ia}`,qs=Symbol.for(Sa),Ht,Wt,Jt=class extends(Wt=te,Ht=qs,Wt){constructor({text:t,cause:e}){super({name:Ia,message:`JSON parsing failed: Text: ${t}.
1
+ import{r as S,bu as ts,bv as as,M as ss,be as B,s as b,bw as qe,bx as ca,bi as rs,bj as os,bd as ns,bf as z,b9 as Ie,aj as Te,o as R,bg as I,bh as ie,by as is,bz as O,ak as ls,b4 as cs,c as k,u as xe,K as Ae,a as da,z as xt,t as bt,j as d,g as ds,am as us,a3 as _t,at as ps,an as ms,aq as fs,av as hs,al as gs,a$ as vs}from"./index-D3nlG5Bn.js";import{u as Et,a as It,d as ys}from"./constants-B1K1ZOHV.js";import{b as xs}from"./use-virtual-mcp-VgOM6PoP.js";import{a as bs,u as St}from"./use-llm-rvFAkGsK.js";import{u as _s}from"./useQuery-CQyI9lob.js";import{b as wt,c as Es,a as Is,e as Ss}from"./use-connection-Crfe-Ixd.js";import{u as ws}from"./Code01-BHoiimgb.js";import{u as Se,L as We}from"./localstorage-keys-Dcw7WgCK.js";import{B as ua}from"./button-jVZoVSEf.js";import{I as Ns}from"./input-Cfb0z5LB.js";import{P as Cs,a as Ts,b as As}from"./popover-DZy413j4.js";import{S as Ms,a as js,b as Rs,c as Ps,d as ks}from"./select-Dl5SsVsF.js";import{c as Nt}from"./utils-ChMoRSU0.js";import{E as pa,i as Os}from"./error-boundary-BmGvCwcM.js";import{t as dt}from"./ChevronDown-CYzQevGE.js";import{i as Ds}from"./File06-BHrPxaod.js";import{c as $s}from"./Grid01-DfoEVHbX.js";import{a as Ls}from"./Image01-BqS-Pbmk.js";import{s as Zs}from"./RefreshCcw01-DhKbWajd.js";import{i as ma}from"./SearchMd-Btq9JQM1.js";var we;(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})(we||(we={}));var Ft;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(Ft||(Ft={}));we.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);we.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 He 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 He))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,we.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()}}He.create=t=>new He(t);var Ut;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Ut||(Ut={}));var w;(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"})(w||(w={}));const Fs=({size:t=24,color:e="currentColor",...a})=>S.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},S.createElement("path",{d:"M4 7h11m0 0-4 4m4-4-4-4M4 17h16m0 0-4 4m4-4-4-4"}));Fs.displayName="ArrowsRight";const fa=({size:t=24,color:e="currentColor",...a})=>S.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},S.createElement("path",{d:"m7 15 5 5 5-5M7 9l5-5 5 5"}));fa.displayName="ChevronSelectorVertical";const ha=({size:t=24,color:e="currentColor",...a})=>S.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},S.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"}));ha.displayName="CurrencyDollar";const Us=({size:t=24,color:e="currentColor",...a})=>S.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},S.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"}));Us.displayName="Lightbulb02";const ga=({size:t=24,color:e="currentColor",...a})=>S.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},S.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"}));ga.displayName="LogOut04";const va=({size:t=24,color:e="currentColor",...a})=>S.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},S.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"}));va.displayName="Stars01";var ya="vercel.ai.error",zs=Symbol.for(ya),zt,Bt,te=class xa extends(Bt=Error,zt=zs,Bt){constructor({name:e,message:a,cause:s}){super(a),this[zt]=!0,this.name=e,this.cause=s}static isInstance(e){return xa.hasMarker(e,ya)}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 ba(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var _a="AI_InvalidArgumentError",Ea=`vercel.ai.error.${_a}`,Bs=Symbol.for(Ea),Vt,qt,Vs=class extends(qt=te,Vt=Bs,qt){constructor({message:t,cause:e,argument:a}){super({name:_a,message:t,cause:e}),this[Vt]=!0,this.argument=a}static isInstance(t){return te.hasMarker(t,Ea)}},Ia="AI_JSONParseError",Sa=`vercel.ai.error.${Ia}`,qs=Symbol.for(Sa),Ht,Wt,Jt=class extends(Wt=te,Ht=qs,Wt){constructor({text:t,cause:e}){super({name:Ia,message:`JSON parsing failed: Text: ${t}.
2
2
  Error message: ${ba(e)}`,cause:e}),this[Ht]=!0,this.text=t}static isInstance(t){return te.hasMarker(t,Sa)}},wa="AI_TypeValidationError",Na=`vercel.ai.error.${wa}`,Hs=Symbol.for(Na),Gt,Yt,ye=class ut extends(Yt=te,Gt=Hs,Yt){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:wa,message:`${r}: Value: ${JSON.stringify(e)}.
3
3
  Error message: ${ba(a)}`,cause:a}),this[Gt]=!0,this.value=e,this.context=s}static isInstance(e){return te.hasMarker(e,Na)}static wrap({value:e,cause:a,context:s}){var r,o,i;return ut.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 ut({value:e,cause:a,context:s})}},Me=({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 Vs({argument:"separator",message:`The separator "${s}" must not be part of the alphabet "${a}".`});return()=>`${t}${s}${r()}`},Ws=Me();function Qt(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 me(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 Xt(t,...e){const a=new Headers(me(t)),s=a.get("user-agent")||"";return a.set("user-agent",[s,...e].filter(Boolean).join(" ")),Object.fromEntries(a.entries())}var Js=/"__proto__"\s*:/,Gs=/"constructor"\s*:/;function Kt(t){const e=JSON.parse(t);return e===null||typeof e!="object"||Js.test(t)===!1&&Gs.test(t)===!1?e:Ys(e)}function Ys(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 Qs(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return Kt(t)}try{return Kt(t)}finally{Error.stackTraceLimit=e}}function Ct(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]=pe(a[s])}t.items!=null&&(t.items=Array.isArray(t.items)?t.items.map(pe):pe(t.items)),t.anyOf!=null&&(t.anyOf=t.anyOf.map(pe)),t.allOf!=null&&(t.allOf=t.allOf.map(pe)),t.oneOf!=null&&(t.oneOf=t.oneOf.map(pe));const{definitions:e}=t;if(e!=null)for(const a of Object.keys(e))e[a]=pe(e[a]);return t}function pe(t){return typeof t=="boolean"?t:Ct(t)}var Xs=Symbol("Let zodToJsonSchema decide on which parser to use"),ea={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"},Ks=t=>typeof t=="string"?{...ea,name:t}:{...ea,...t};function V(){return{}}function er(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)!==w.ZodAny&&(o.items=j(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 tr(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 ar(){return{type:"boolean"}}function Ca(t,e){return j(t.type._def,e)}var sr=(t,e)=>j(t.innerType._def,e);function Ta(t,e,a){const s=a??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,o)=>Ta(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 rr(t)}}var rr=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 or(t,e){return{...j(t.innerType._def,e),default:t.defaultValue()}}function nr(t,e){return e.effectStrategy==="input"?j(t.schema._def,e):V()}function ir(t){return{type:"string",enum:Array.from(t.values)}}var lr=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function cr(t,e){const a=[j(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),j(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(r=>!!r),s=[];return a.forEach(r=>{if(lr(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 dr(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 it=void 0,G={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(it===void 0&&(it=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),it),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Aa(t,e){const a={type:"string"};if(t.checks)for(const 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":Y(a,"email",s.message,e);break;case"format:idn-email":Y(a,"idn-email",s.message,e);break;case"pattern:zod":U(a,G.email,s.message,e);break}break;case"url":Y(a,"uri",s.message,e);break;case"uuid":Y(a,"uuid",s.message,e);break;case"regex":U(a,s.regex,s.message,e);break;case"cuid":U(a,G.cuid,s.message,e);break;case"cuid2":U(a,G.cuid2,s.message,e);break;case"startsWith":U(a,RegExp(`^${lt(s.value,e)}`),s.message,e);break;case"endsWith":U(a,RegExp(`${lt(s.value,e)}$`),s.message,e);break;case"datetime":Y(a,"date-time",s.message,e);break;case"date":Y(a,"date",s.message,e);break;case"time":Y(a,"time",s.message,e);break;case"duration":Y(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":{U(a,RegExp(lt(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&Y(a,"ipv4",s.message,e),s.version!=="v4"&&Y(a,"ipv6",s.message,e);break}case"base64url":U(a,G.base64url,s.message,e);break;case"jwt":U(a,G.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&U(a,G.ipv4Cidr,s.message,e),s.version!=="v4"&&U(a,G.ipv6Cidr,s.message,e);break}case"emoji":U(a,G.emoji(),s.message,e);break;case"ulid":{U(a,G.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Y(a,"binary",s.message,e);break}case"contentEncoding:base64":{a.contentEncoding="base64";break}case"pattern:zod":{U(a,G.base64,s.message,e);break}}break}case"nanoid":U(a,G.nanoid,s.message,e)}return a}function lt(t,e){return e.patternStrategy==="escape"?pr(t):t}var ur=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function pr(t){let e="";for(let a=0;a<t.length;a++)ur.has(t[a])||(e+="\\"),e+=t[a];return e}function Y(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 U(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:ta(e,s),...a&&s.errorMessages&&{errorMessage:{pattern:a}}})):t.pattern=ta(e,s)}function ta(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
4
  ]))`;continue}else if(r[l]==="$"){o+=`($|(?=[\r
5
5
  ]))`;continue}}if(s.s&&r[l]==="."){o+=n?`${r[l]}\r
6
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 Ma(t,e){var a,s,r,o,i,n;const c={type:"object",additionalProperties:(a=j(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?a:e.allowedAdditionalProperties};if(((s=t.keyType)==null?void 0:s._def.typeName)===w.ZodString&&((r=t.keyType._def.checks)!=null&&r.length)){const{type:l,...p}=Aa(t.keyType._def,e);return{...c,propertyNames:p}}else{if(((o=t.keyType)==null?void 0:o._def.typeName)===w.ZodEnum)return{...c,propertyNames:{enum:t.keyType._def.values}};if(((i=t.keyType)==null?void 0:i._def.typeName)===w.ZodBranded&&t.keyType._def.type._def.typeName===w.ZodString&&((n=t.keyType._def.type._def.checks)!=null&&n.length)){const{type:l,...p}=Ca(t.keyType._def,e);return{...c,propertyNames:p}}}return c}function mr(t,e){if(e.mapStrategy==="record")return Ma(t,e);const a=j(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||V(),s=j(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 fr(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 hr(){return{not:V()}}function gr(){return{type:"null"}}var pt={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function vr(t,e){const a=t.options instanceof Map?Array.from(t.options.values()):t.options;if(a.every(s=>s._def.typeName in pt&&(!s._def.checks||!s._def.checks.length))){const s=a.reduce((r,o)=>{const i=pt[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 yr(t,e)}var yr=(t,e)=>{const a=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((s,r)=>j(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 xr(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[pt[t.innerType._def.typeName],"null"]};const a=j(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}function br(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 _r(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=Ir(n),l=j(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=Er(t,e);return o!==void 0&&(a.additionalProperties=o),a}function Er(t,e){if(t.catchall._def.typeName!=="ZodNever")return j(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 Ir(t){try{return t.isOptional()}catch{return!0}}var Sr=(t,e)=>{var a;if(e.currentPath.toString()===((a=e.propertyPath)==null?void 0:a.toString()))return j(t.innerType._def,e);const s=j(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return s?{anyOf:[{not:V()},s]}:V()},wr=(t,e)=>{if(e.pipeStrategy==="input")return j(t.in._def,e);if(e.pipeStrategy==="output")return j(t.out._def,e);const a=j(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=j(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",a?"1":"0"]});return{allOf:[a,s].filter(r=>r!==void 0)}};function Nr(t,e){return j(t.type._def,e)}function Cr(t,e){const s={type:"array",uniqueItems:!0,items:j(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 Tr(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((a,s)=>j(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[]),additionalItems:j(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((a,s)=>j(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[])}}function Ar(){return{not:V()}}function Mr(){return V()}var jr=(t,e)=>j(t.innerType._def,e),Rr=(t,e,a)=>{switch(e){case w.ZodString:return Aa(t,a);case w.ZodNumber:return br(t);case w.ZodObject:return _r(t,a);case w.ZodBigInt:return tr(t);case w.ZodBoolean:return ar();case w.ZodDate:return Ta(t,a);case w.ZodUndefined:return Ar();case w.ZodNull:return gr();case w.ZodArray:return er(t,a);case w.ZodUnion:case w.ZodDiscriminatedUnion:return vr(t,a);case w.ZodIntersection:return cr(t,a);case w.ZodTuple:return Tr(t,a);case w.ZodRecord:return Ma(t,a);case w.ZodLiteral:return dr(t);case w.ZodEnum:return ir(t);case w.ZodNativeEnum:return fr(t);case w.ZodNullable:return xr(t,a);case w.ZodOptional:return Sr(t,a);case w.ZodMap:return mr(t,a);case w.ZodSet:return Cr(t,a);case w.ZodLazy:return()=>t.getter()._def;case w.ZodPromise:return Nr(t,a);case w.ZodNaN:case w.ZodNever:return hr();case w.ZodEffects:return nr(t,a);case w.ZodAny:return V();case w.ZodUnknown:return Mr();case w.ZodDefault:return or(t,a);case w.ZodBranded:return Ca(t,a);case w.ZodReadonly:return jr(t,a);case w.ZodCatch:return sr(t,a);case w.ZodPipeline:return wr(t,a);case w.ZodFunction:case w.ZodVoid:case w.ZodSymbol:return;default:return(s=>{})()}},Pr=(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 j(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!==Xs)return c}if(r&&!a){const c=kr(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=Rr(t,t.typeName,e),n=typeof i=="function"?j(i(),e):i;if(n&&Or(t,e,n),e.postProcess){const c=e.postProcess(n,t,e);return o.jsonSchema=n,c}return o.jsonSchema=n,n}var kr=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Pr(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}},Or=(t,e,a)=>(t.description&&(a.description=t.description),a),Dr=t=>{const e=Ks(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}]))}},$r=(t,e)=>{var a;const s=Dr(e);let r=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[p,m])=>{var h;return{...l,[p]:(h=j(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=j(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},mt=Symbol.for("vercel.ai.schema");function Lr(t){let e;return()=>(e==null&&(e=t()),e)}function Je(t,{validate:e}={}){return{[mt]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function Zr(t){return typeof t=="object"&&t!==null&&mt in t&&t[mt]===!0&&"jsonSchema"in t&&"validate"in t}function Tt(t){return t==null?Je({properties:{},additionalProperties:!1}):Zr(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?ja(t):Fr(t):t()}function Fr(t){return Je(()=>Ct(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 ye({value:e,cause:a.issues})}}})}function Ur(t,e){var a;const s=(a=void 0)!=null?a:!1;return Je(()=>$r(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 zr(t,e){var a;const s=(a=void 0)!=null?a:!1;return Je(()=>Ct(ss(t,{target:"draft-7",io:"input",reused:s?"ref":"inline"})),{validate:async r=>{const o=await as(t,r);return o.success?{success:!0,value:o.data}:{success:!1,error:o.error}}})}function Br(t){return"_zod"in t}function ja(t,e){return Br(t)?zr(t):Ur(t)}async function aa({value:t,schema:e,context:a}){const s=await Ne({value:t,schema:e,context:a});if(!s.success)throw ye.wrap({value:t,cause:s.error,context:a});return s.value}async function Ne({value:t,schema:e,context:a}){const s=Tt(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:ye.wrap({value:t,cause:r.error,context:a}),rawValue:t}}catch(r){return{success:!1,error:ye.wrap({value:t,cause:r,context:a}),rawValue:t}}}async function fe({text:t,schema:e}){try{const a=Qs(t);return e==null?{success:!0,value:a,rawValue:a}:await Ne({value:a,schema:e})}catch(a){return{success:!1,error:Jt.isInstance(a)?a:new Jt({text:t,cause:a}),rawValue:void 0}}}function Vr({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new ts).pipeThrough(new TransformStream({async transform({data:a},s){a!=="[DONE]"&&s.enqueue(await fe({text:a,schema:e}))}}))}async function ce(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var qr=Object.defineProperty,Hr=(t,e)=>{for(var a in e)qr(t,a,{get:e[a],enumerable:!0})},Ra="AI_NoObjectGeneratedError",Pa=`vercel.ai.error.${Ra}`,Wr=Symbol.for(Pa),ka,de=class extends te{constructor({message:t="No object generated.",cause:e,text:a,response:s,usage:r,finishReason:o}){super({name:Ra,message:t,cause:e}),this[ka]=!0,this.text=a,this.response=s,this.usage=r,this.finishReason=o}static isInstance(t){return te.hasMarker(t,Pa)}};ka=Wr;var Oa="AI_UIMessageStreamError",Da=`vercel.ai.error.${Oa}`,Jr=Symbol.for(Da),$a,he=class extends te{constructor({chunkType:t,chunkId:e,message:a}){super({name:Oa,message:a}),this[$a]=!0,this.chunkType=t,this.chunkId=e}static isInstance(t){return te.hasMarker(t,Da)}};$a=Jr;var sa="6.0.77",La=B([b(),qe(Uint8Array),qe(ArrayBuffer),ca(t=>{var e,a;return(a=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?a:!1},{message:"Must be a Buffer"})]),Ce=rs(()=>B([os(),b(),ns(),z(),Ie(b(),Ce.optional()),Te(Ce)])),A=Ie(b(),Ie(b(),Ce.optional())),Za=R({type:I("text"),text:b(),providerOptions:A.optional()}),Gr=R({type:I("image"),image:B([La,qe(URL)]),mediaType:b().optional(),providerOptions:A.optional()}),Fa=R({type:I("file"),data:B([La,qe(URL)]),filename:b().optional(),mediaType:b(),providerOptions:A.optional()}),Yr=R({type:I("reasoning"),text:b(),providerOptions:A.optional()}),Qr=R({type:I("tool-call"),toolCallId:b(),toolName:b(),input:ie(),providerOptions:A.optional(),providerExecuted:z().optional()}),Xr=is("type",[R({type:I("text"),value:b(),providerOptions:A.optional()}),R({type:I("json"),value:Ce,providerOptions:A.optional()}),R({type:I("execution-denied"),reason:b().optional(),providerOptions:A.optional()}),R({type:I("error-text"),value:b(),providerOptions:A.optional()}),R({type:I("error-json"),value:Ce,providerOptions:A.optional()}),R({type:I("content"),value:Te(B([R({type:I("text"),text:b(),providerOptions:A.optional()}),R({type:I("media"),data:b(),mediaType:b()}),R({type:I("file-data"),data:b(),mediaType:b(),filename:b().optional(),providerOptions:A.optional()}),R({type:I("file-url"),url:b(),providerOptions:A.optional()}),R({type:I("file-id"),fileId:B([b(),Ie(b(),b())]),providerOptions:A.optional()}),R({type:I("image-data"),data:b(),mediaType:b(),providerOptions:A.optional()}),R({type:I("image-url"),url:b(),providerOptions:A.optional()}),R({type:I("image-file-id"),fileId:B([b(),Ie(b(),b())]),providerOptions:A.optional()}),R({type:I("custom"),providerOptions:A.optional()})]))})]),Ua=R({type:I("tool-result"),toolCallId:b(),toolName:b(),output:Xr,providerOptions:A.optional()}),Kr=R({type:I("tool-approval-request"),approvalId:b(),toolCallId:b()}),eo=R({type:I("tool-approval-response"),approvalId:b(),approved:z(),reason:b().optional()}),to=R({role:I("system"),content:b(),providerOptions:A.optional()}),ao=R({role:I("user"),content:B([b(),Te(B([Za,Gr,Fa]))]),providerOptions:A.optional()}),so=R({role:I("assistant"),content:B([b(),Te(B([Za,Fa,Yr,Qr,Ua,Kr]))]),providerOptions:A.optional()}),ro=R({role:I("tool"),content:Te(B([Ua,eo])),providerOptions:A.optional()});B([to,ao,so,ro]);function za(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]=za(o,r):a[s]=r}return a}var oo={};Hr(oo,{array:()=>co,choice:()=>uo,json:()=>po,object:()=>lo,text:()=>io});function no(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 je(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await fe({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await fe({text:no(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var io=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}},createElementStreamTransform(){}}),lo=({schema:t,name:e,description:a})=>{const s=Tt(t);return{name:"object",responseFormat:ce(s.jsonSchema).then(r=>({type:"json",schema:r,...e!=null&&{name:e},...a!=null&&{description:a}})),async parseCompleteOutput({text:r},o){const i=await fe({text:r});if(!i.success)throw new de({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 Ne({value:i.value,schema:s});if(!n.success)throw new de({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 je(r);switch(o.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:o.value}}},createElementStreamTransform(){}}},co=({element:t,name:e,description:a})=>{const s=Tt(t);return{name:"array",responseFormat:ce(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 fe({text:r});if(!i.success)throw new de({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 de({message:"No object generated: response did not match schema.",cause:new ye({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 Ne({value:c,schema:s});if(!l.success)throw new de({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 je(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 Ne({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])}})}}},uo=({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 fe({text:s});if(!o.success)throw new de({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 de({message:"No object generated: response did not match schema.",cause:new ye({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 je(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(){}}),po=({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 fe({text:a});if(!r.success)throw new de({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 je(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(){}});Me({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(t,e){e.enqueue(`data: ${JSON.stringify(t)}
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 Ma(t,e){var a,s,r,o,i,n;const c={type:"object",additionalProperties:(a=j(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?a:e.allowedAdditionalProperties};if(((s=t.keyType)==null?void 0:s._def.typeName)===w.ZodString&&((r=t.keyType._def.checks)!=null&&r.length)){const{type:l,...p}=Aa(t.keyType._def,e);return{...c,propertyNames:p}}else{if(((o=t.keyType)==null?void 0:o._def.typeName)===w.ZodEnum)return{...c,propertyNames:{enum:t.keyType._def.values}};if(((i=t.keyType)==null?void 0:i._def.typeName)===w.ZodBranded&&t.keyType._def.type._def.typeName===w.ZodString&&((n=t.keyType._def.type._def.checks)!=null&&n.length)){const{type:l,...p}=Ca(t.keyType._def,e);return{...c,propertyNames:p}}}return c}function mr(t,e){if(e.mapStrategy==="record")return Ma(t,e);const a=j(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||V(),s=j(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 fr(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 hr(){return{not:V()}}function gr(){return{type:"null"}}var pt={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function vr(t,e){const a=t.options instanceof Map?Array.from(t.options.values()):t.options;if(a.every(s=>s._def.typeName in pt&&(!s._def.checks||!s._def.checks.length))){const s=a.reduce((r,o)=>{const i=pt[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 yr(t,e)}var yr=(t,e)=>{const a=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((s,r)=>j(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 xr(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[pt[t.innerType._def.typeName],"null"]};const a=j(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}function br(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 _r(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=Ir(n),l=j(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=Er(t,e);return o!==void 0&&(a.additionalProperties=o),a}function Er(t,e){if(t.catchall._def.typeName!=="ZodNever")return j(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 Ir(t){try{return t.isOptional()}catch{return!0}}var Sr=(t,e)=>{var a;if(e.currentPath.toString()===((a=e.propertyPath)==null?void 0:a.toString()))return j(t.innerType._def,e);const s=j(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return s?{anyOf:[{not:V()},s]}:V()},wr=(t,e)=>{if(e.pipeStrategy==="input")return j(t.in._def,e);if(e.pipeStrategy==="output")return j(t.out._def,e);const a=j(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=j(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",a?"1":"0"]});return{allOf:[a,s].filter(r=>r!==void 0)}};function Nr(t,e){return j(t.type._def,e)}function Cr(t,e){const s={type:"array",uniqueItems:!0,items:j(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 Tr(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((a,s)=>j(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[]),additionalItems:j(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((a,s)=>j(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[])}}function Ar(){return{not:V()}}function Mr(){return V()}var jr=(t,e)=>j(t.innerType._def,e),Rr=(t,e,a)=>{switch(e){case w.ZodString:return Aa(t,a);case w.ZodNumber:return br(t);case w.ZodObject:return _r(t,a);case w.ZodBigInt:return tr(t);case w.ZodBoolean:return ar();case w.ZodDate:return Ta(t,a);case w.ZodUndefined:return Ar();case w.ZodNull:return gr();case w.ZodArray:return er(t,a);case w.ZodUnion:case w.ZodDiscriminatedUnion:return vr(t,a);case w.ZodIntersection:return cr(t,a);case w.ZodTuple:return Tr(t,a);case w.ZodRecord:return Ma(t,a);case w.ZodLiteral:return dr(t);case w.ZodEnum:return ir(t);case w.ZodNativeEnum:return fr(t);case w.ZodNullable:return xr(t,a);case w.ZodOptional:return Sr(t,a);case w.ZodMap:return mr(t,a);case w.ZodSet:return Cr(t,a);case w.ZodLazy:return()=>t.getter()._def;case w.ZodPromise:return Nr(t,a);case w.ZodNaN:case w.ZodNever:return hr();case w.ZodEffects:return nr(t,a);case w.ZodAny:return V();case w.ZodUnknown:return Mr();case w.ZodDefault:return or(t,a);case w.ZodBranded:return Ca(t,a);case w.ZodReadonly:return jr(t,a);case w.ZodCatch:return sr(t,a);case w.ZodPipeline:return wr(t,a);case w.ZodFunction:case w.ZodVoid:case w.ZodSymbol:return;default:return(s=>{})()}},Pr=(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 j(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!==Xs)return c}if(r&&!a){const c=kr(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=Rr(t,t.typeName,e),n=typeof i=="function"?j(i(),e):i;if(n&&Or(t,e,n),e.postProcess){const c=e.postProcess(n,t,e);return o.jsonSchema=n,c}return o.jsonSchema=n,n}var kr=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Pr(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}},Or=(t,e,a)=>(t.description&&(a.description=t.description),a),Dr=t=>{const e=Ks(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}]))}},$r=(t,e)=>{var a;const s=Dr(e);let r=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[p,m])=>{var h;return{...l,[p]:(h=j(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=j(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},mt=Symbol.for("vercel.ai.schema");function Lr(t){let e;return()=>(e==null&&(e=t()),e)}function Je(t,{validate:e}={}){return{[mt]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function Zr(t){return typeof t=="object"&&t!==null&&mt in t&&t[mt]===!0&&"jsonSchema"in t&&"validate"in t}function Tt(t){return t==null?Je({properties:{},additionalProperties:!1}):Zr(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?ja(t):Fr(t):t()}function Fr(t){return Je(()=>Ct(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 ye({value:e,cause:a.issues})}}})}function Ur(t,e){var a;const s=(a=void 0)!=null?a:!1;return Je(()=>$r(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 zr(t,e){var a;const s=(a=void 0)!=null?a:!1;return Je(()=>Ct(ss(t,{target:"draft-7",io:"input",reused:s?"ref":"inline"})),{validate:async r=>{const o=await as(t,r);return o.success?{success:!0,value:o.data}:{success:!1,error:o.error}}})}function Br(t){return"_zod"in t}function ja(t,e){return Br(t)?zr(t):Ur(t)}async function aa({value:t,schema:e,context:a}){const s=await Ne({value:t,schema:e,context:a});if(!s.success)throw ye.wrap({value:t,cause:s.error,context:a});return s.value}async function Ne({value:t,schema:e,context:a}){const s=Tt(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:ye.wrap({value:t,cause:r.error,context:a}),rawValue:t}}catch(r){return{success:!1,error:ye.wrap({value:t,cause:r,context:a}),rawValue:t}}}async function fe({text:t,schema:e}){try{const a=Qs(t);return e==null?{success:!0,value:a,rawValue:a}:await Ne({value:a,schema:e})}catch(a){return{success:!1,error:Jt.isInstance(a)?a:new Jt({text:t,cause:a}),rawValue:void 0}}}function Vr({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new ts).pipeThrough(new TransformStream({async transform({data:a},s){a!=="[DONE]"&&s.enqueue(await fe({text:a,schema:e}))}}))}async function ce(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var qr=Object.defineProperty,Hr=(t,e)=>{for(var a in e)qr(t,a,{get:e[a],enumerable:!0})},Ra="AI_NoObjectGeneratedError",Pa=`vercel.ai.error.${Ra}`,Wr=Symbol.for(Pa),ka,de=class extends te{constructor({message:t="No object generated.",cause:e,text:a,response:s,usage:r,finishReason:o}){super({name:Ra,message:t,cause:e}),this[ka]=!0,this.text=a,this.response=s,this.usage=r,this.finishReason=o}static isInstance(t){return te.hasMarker(t,Pa)}};ka=Wr;var Oa="AI_UIMessageStreamError",Da=`vercel.ai.error.${Oa}`,Jr=Symbol.for(Da),$a,he=class extends te{constructor({chunkType:t,chunkId:e,message:a}){super({name:Oa,message:a}),this[$a]=!0,this.chunkType=t,this.chunkId=e}static isInstance(t){return te.hasMarker(t,Da)}};$a=Jr;var sa="6.0.78",La=B([b(),qe(Uint8Array),qe(ArrayBuffer),ca(t=>{var e,a;return(a=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?a:!1},{message:"Must be a Buffer"})]),Ce=rs(()=>B([os(),b(),ns(),z(),Ie(b(),Ce.optional()),Te(Ce)])),A=Ie(b(),Ie(b(),Ce.optional())),Za=R({type:I("text"),text:b(),providerOptions:A.optional()}),Gr=R({type:I("image"),image:B([La,qe(URL)]),mediaType:b().optional(),providerOptions:A.optional()}),Fa=R({type:I("file"),data:B([La,qe(URL)]),filename:b().optional(),mediaType:b(),providerOptions:A.optional()}),Yr=R({type:I("reasoning"),text:b(),providerOptions:A.optional()}),Qr=R({type:I("tool-call"),toolCallId:b(),toolName:b(),input:ie(),providerOptions:A.optional(),providerExecuted:z().optional()}),Xr=is("type",[R({type:I("text"),value:b(),providerOptions:A.optional()}),R({type:I("json"),value:Ce,providerOptions:A.optional()}),R({type:I("execution-denied"),reason:b().optional(),providerOptions:A.optional()}),R({type:I("error-text"),value:b(),providerOptions:A.optional()}),R({type:I("error-json"),value:Ce,providerOptions:A.optional()}),R({type:I("content"),value:Te(B([R({type:I("text"),text:b(),providerOptions:A.optional()}),R({type:I("media"),data:b(),mediaType:b()}),R({type:I("file-data"),data:b(),mediaType:b(),filename:b().optional(),providerOptions:A.optional()}),R({type:I("file-url"),url:b(),providerOptions:A.optional()}),R({type:I("file-id"),fileId:B([b(),Ie(b(),b())]),providerOptions:A.optional()}),R({type:I("image-data"),data:b(),mediaType:b(),providerOptions:A.optional()}),R({type:I("image-url"),url:b(),providerOptions:A.optional()}),R({type:I("image-file-id"),fileId:B([b(),Ie(b(),b())]),providerOptions:A.optional()}),R({type:I("custom"),providerOptions:A.optional()})]))})]),Ua=R({type:I("tool-result"),toolCallId:b(),toolName:b(),output:Xr,providerOptions:A.optional()}),Kr=R({type:I("tool-approval-request"),approvalId:b(),toolCallId:b()}),eo=R({type:I("tool-approval-response"),approvalId:b(),approved:z(),reason:b().optional()}),to=R({role:I("system"),content:b(),providerOptions:A.optional()}),ao=R({role:I("user"),content:B([b(),Te(B([Za,Gr,Fa]))]),providerOptions:A.optional()}),so=R({role:I("assistant"),content:B([b(),Te(B([Za,Fa,Yr,Qr,Ua,Kr]))]),providerOptions:A.optional()}),ro=R({role:I("tool"),content:Te(B([Ua,eo])),providerOptions:A.optional()});B([to,ao,so,ro]);function za(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]=za(o,r):a[s]=r}return a}var oo={};Hr(oo,{array:()=>co,choice:()=>uo,json:()=>po,object:()=>lo,text:()=>io});function no(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 je(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await fe({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await fe({text:no(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var io=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}},createElementStreamTransform(){}}),lo=({schema:t,name:e,description:a})=>{const s=Tt(t);return{name:"object",responseFormat:ce(s.jsonSchema).then(r=>({type:"json",schema:r,...e!=null&&{name:e},...a!=null&&{description:a}})),async parseCompleteOutput({text:r},o){const i=await fe({text:r});if(!i.success)throw new de({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 Ne({value:i.value,schema:s});if(!n.success)throw new de({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 je(r);switch(o.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:o.value}}},createElementStreamTransform(){}}},co=({element:t,name:e,description:a})=>{const s=Tt(t);return{name:"array",responseFormat:ce(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 fe({text:r});if(!i.success)throw new de({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 de({message:"No object generated: response did not match schema.",cause:new ye({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 Ne({value:c,schema:s});if(!l.success)throw new de({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 je(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 Ne({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])}})}}},uo=({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 fe({text:s});if(!o.success)throw new de({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 de({message:"No object generated: response did not match schema.",cause:new ye({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 je(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(){}}),po=({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 fe({text:a});if(!r.success)throw new de({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 je(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(){}});Me({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(t,e){e.enqueue(`data: ${JSON.stringify(t)}
8
8
 
9
9
  `)},flush(t){t.enqueue(`data: [DONE]
10
10
 
@@ -16,7 +16,7 @@ ${o.join(`
16
16
 
17
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
18
 
19
- `)}function Mo(){const t=k.c(2),e=xt();let a;return t[0]!==e?(a={prefillCollectionCache:(r,o,i,n)=>{if(!r)return;const c=wt(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 re={THREAD_MESSAGES_PAGE_SIZE:100,THREADS_PAGE_SIZE:50,QUERY_STALE_TIME:3e4};function ia(t,e,a,s){const r=Ae.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 jo(t,e,a){const s=Ae.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 Ro(t,e,a,s){if(!e)return;const r=wt(e,"THREAD_MESSAGES",a,{filters:[{column:"threadId",value:s}],pageSize:re.THREAD_MESSAGES_PAGE_SIZE});if(!r||t.getQueryData(r))return;const i="COLLECTION_THREAD_MESSAGES_LIST",n=Es(void 0,[{column:"threadId",value:s}],[]),c=Is(void 0,void 0,"updated_at"),l={...n&&{where:n},...c&&{orderBy:c},limit:re.THREAD_MESSAGES_PAGE_SIZE,offset:0};await t.fetchQuery({queryKey:r,queryFn:async()=>await e.callTool({name:i,arguments:l}),staleTime:re.QUERY_STALE_TIME,retry:!1})}function Po(t,e,a,s,r){if(!e)return;const o=wt(e,"THREAD_MESSAGES",a,{filters:[{column:"threadId",value:s}],pageSize:re.THREAD_MESSAGES_PAGE_SIZE});o&&t.setQueryData(o,{structuredContent:{items:r},isError:!1})}async function ko(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 Oo(t){const e=new Date().toISOString();return{id:t,title:"New chat",createdAt:e,updatedAt:e}}function Do(t,e){return t.find(a=>a.id!==e)??null}function $o(){const t=k.c(17),{locator:e,org:a}=xe();let s;t[0]!==a.id?(s={connectionId:It,orgId:a.id},t[0]=a.id,t[1]=s):s=t[1];const r=Et(s);let o;t[2]!==e?(o=Ae.threads(e),t[2]=e,t[3]=o):o=t[3];let i;t[4]!==r?(i=async g=>{const{pageParam:f}=g,x=f===void 0?0:f;if(!r)throw new Error("MCP client is not available");const u={limit:re.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:Zo,initialPageParam:0,staleTime:re.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}=ws(n);let v;t[9]!==c?.pages?(v=c?.pages.flatMap(Lo)??[],t[9]=c?.pages,t[10]=v):v=t[10];const y=v;let _;return t[11]!==l||t[12]!==p||t[13]!==m||t[14]!==h||t[15]!==y?(_={threads:y,refetch:h,hasNextPage:p,isFetchingNextPage:m,fetchNextPage:l},t[11]=l,t[12]=p,t[13]=m,t[14]=h,t[15]=y,t[16]=_):_=t[16],_}function Lo(t){return t.items}function Zo(t,e){if(t.hasMore)return e.length*re.THREADS_PAGE_SIZE}function Fo(t){const e=k.c(6),{org:a}=xe();let s;e[0]!==a.id?(s={connectionId:It,orgId:a.id},e[0]=a.id,e[1]=s):s=e[1];const r=Et(s);let o;e[2]!==t?(o={filters:t?[{column:"threadId",value:t}]:[],pageSize:re.THREAD_MESSAGES_PAGE_SIZE},e[2]=t,e[3]=o):o=e[3];const i=Ss(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 Uo(){const{locator:t,org:e}=xe(),a=xt(),{prefillCollectionCache:s}=Mo(),{threads:r,hasNextPage:o,isFetchingNextPage:i,fetchNextPage:n}=$o(),c=Et({connectionId:It,orgId:e.id}),[l,p]=Se(We.assistantChatActiveThread(t),r[0]?.id??crypto.randomUUID()),m=Fo(l),h=()=>{const f=crypto.randomUUID(),x=Oo(f);jo(a,t,x),c&&s(c,"THREAD_MESSAGES",e.id,{filters:[{column:"threadId",value:f}],pageSize:re.THREAD_MESSAGES_PAGE_SIZE}),p(f)},v=async f=>{await Ro(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)=>{ia(a,t,f,x)},hideThread:async f=>{try{const x=await ko(c,f,{hidden:!0});if(x){if(f===l){const E=Do(r,f);E?await v(E.id):h()}ia(a,t,f,{hidden:!0,updatedAt:x.updatedAt??new Date().toISOString()})}}catch(x){const u=x;bt.error(`Failed to update thread: ${u.message}`),console.error("[chat] Failed to update thread:",x)}},updateMessagesCache:(f,x)=>{Po(a,c,e.id,f,x)}}}function zo(){const t=k.c(5),e=xt(),{org:a}=xe();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={strict:!1},t[0]=s):s=t[0];const r=da(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:Ae.collection(a.slug,p,l)});const m=l.toLowerCase().replace(/_/g," ");bt.success(`${m} updated`)},t[1]=a,t[2]=r,t[3]=e,t[4]=o):o=t[4],o}function Z(t){const e=k.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=Nt("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 Bo=["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"],yt=new Map;Bo.forEach((t,e)=>{yt.set(t,e)});function Mt(t){const e=k.c(3);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={pageSize:999},e[0]=a):a=e[0];const s=bs(t??void 0,a);let r;return e[1]!==s?(r=s.filter(qo).sort(Vo),e[1]=s,e[2]=r):r=e[2],r}function Vo(t,e){const a=yt.get(t.id),s=yt.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 qo(t){return t.limits?.contextWindow&&t.limits?.maxOutputTokens}const Ho={reasoning:{icon:d.jsx(va,{className:"size-4"}),label:"Reasoning"},"image-upload":{icon:d.jsx(Ls,{className:"size-4"}),label:"Can analyze images"},"file-upload":{icon:d.jsx(Ds,{className:"size-4"}),label:"Can analyze files"},"web-search":{icon:d.jsx(ma,{className:"size-4"}),label:"Can search the web to answer questions"}};function qa(t){const e=k.c(10),{capability:a}=t,s=Ho[a];let r,o;e[0]!==a||e[1]!==s?(r=s||{icon:null,label:a},o=r.label.split("-").map(Wo).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 Wo(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Jo(t){const e=k.c(53),{model:a,compact:s}=t,r=s===void 0?!1:s;if(!a){let g;return e[0]===Symbol.for("react.memo_cache_sentinel")?(g=d.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Hover to preview"}),e[0]=g):g=e[0],g}const o=a.limits?.contextWindow||a.costs?.input||a.costs?.output||a.limits?.maxOutputTokens;if(!o&&!r){let g;e[1]!==a.logo||e[2]!==a.title?(g=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]=g):g=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]!==g||e[7]!==f?(x=d.jsxs("div",{className:"flex items-center gap-3 py-2 px-0",children:[g,f]}),e[6]=g,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 g;e[14]!==a.limits?(g=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]=g):g=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]!==g||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:[g,f,x,u]}),e[22]=g,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(Go)}),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($s,{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(ha,{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(ga,{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 y;e[46]!==m||e[47]!==h||e[48]!==v?(y=d.jsxs("div",{className:"flex flex-col gap-4",children:[m,h,v]}),e[46]=m,e[47]=h,e[48]=v,e[49]=y):y=e[49];let _;return e[50]!==y||e[51]!==p?(_=d.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[p,y]}),e[50]=y,e[51]=p,e[52]=_):_=e[52],_}function Go(t){return d.jsx(qa,{capability:t},t)}function Yo(t){const e=k.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(Qo)}),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 Qo(t){return d.jsx(qa,{capability:t},t)}function Xo(t){const e=k.c(10),{error:a,onRetry:s}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsx("div",{className:"bg-destructive/10 p-2 rounded-full",children:d.jsx(Os,{className:"size-5 text-destructive"})}),e[0]=r):r=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=d.jsx("p",{className:"text-sm font-medium text-foreground",children:"Failed to load models"}),e[1]=o):o=e[1];const i=a?.message||"Could not fetch models from this provider.";let n;e[2]!==i?(n=d.jsxs("div",{className:"flex flex-col gap-1",children:[o,d.jsxs("p",{className:"text-xs text-muted-foreground max-w-[260px]",children:[i," Try another provider or retry."]})]}),e[2]=i,e[3]=n):n=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Zs,{className:"size-3.5"}),e[4]=c):c=e[4];let l;e[5]!==s?(l=d.jsxs(ua,{variant:"outline",size:"sm",onClick:s,className:"gap-1.5",children:[c,"Retry"]}),e[5]=s,e[6]=l):l=e[6];let p;return e[7]!==n||e[8]!==l?(p=d.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-4 py-8 text-center",children:[r,n,l]}),e[7]=n,e[8]=l,e[9]=p):p=e[9],p}function Ko(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=d.jsx("div",{className:"flex-1 overflow-y-auto px-0.5 pt-2 space-y-1",children:Array.from({length:6}).map(en)}),t[0]=e):e=t[0],e}function en(t,e){return d.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[d.jsx(Z,{className:"size-5 shrink-0 rounded-sm"}),d.jsx(Z,{className:"flex-1 h-4"}),d.jsx(Z,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function tn(t){const e=k.c(20),{connectionId:a,allowAll:s,isModelAllowed:r,searchTerm:o,selectedModel:i,onModelSelect:n,onHover:c}=t,l=Mt(a??void 0);let p;e[0]!==l||e[1]!==s||e[2]!==a||e[3]!==r?(p=s?l:l.filter(g=>a&&r(a,g.id)),e[0]=l,e[1]=s,e[2]=a,e[3]=r,e[4]=p):p=e[4];const m=p;let h;e[5]!==m||e[6]!==o?(h=o.trim()?m.filter(g=>{const f=o.toLowerCase();return g.title.toLowerCase().includes(f)||g.provider?.toLowerCase().includes(f)||g.description?.toLowerCase().includes(f)}):m,e[5]=m,e[6]=o,e[7]=h):h=e[7];const v=h;if(v.length===0){let g;return e[8]===Symbol.for("react.memo_cache_sentinel")?(g=d.jsx("div",{className:"flex-1 flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No models found"}),e[8]=g):g=e[8],g}let y;if(e[9]!==v||e[10]!==c||e[11]!==n||e[12]!==i?.id){let g;e[14]!==c||e[15]!==n||e[16]!==i?.id?(g=f=>{const x=f.id===i?.id;return d.jsx("div",{onClick:()=>n(f),className:Nt("rounded-lg mb-1",x&&"bg-accent"),children:d.jsx(Yo,{model:f,onHover:c})},f.id)},e[14]=c,e[15]=n,e[16]=i?.id,e[17]=g):g=e[17],y=v.map(g),e[9]=v,e[10]=c,e[11]=n,e[12]=i?.id,e[13]=y}else y=e[13];let _;return e[18]!==y?(_=d.jsx("div",{className:"flex-1 overflow-y-auto px-0.5 pt-2",children:y}),e[18]=y,e[19]=_):_=e[19],_}function jt(t){const e=k.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 Hn(t){return t?.capabilities?.includes("vision")===!0}function an(){const t=k.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(Z,{className:"size-4 shrink-0"}),d.jsx(Z,{className:"flex-1 h-6"}),d.jsx(Z,{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(sn)})]}),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(Z,{className:"size-6 shrink-0"}),d.jsx(Z,{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(Z,{className:"h-6 w-20 rounded-md"}),d.jsx(Z,{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(Z,{className:"h-4 w-24"}),d.jsx(Z,{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(Z,{className:"h-4 w-16"}),d.jsx(Z,{className:"h-4 w-40"})]})]})]})})]}),t[5]=i):i=t[5],i}function sn(t,e){return d.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[d.jsx(Z,{className:"size-5 shrink-0 rounded-sm"}),d.jsx(Z,{className:"flex-1 h-4"}),d.jsx(Z,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function rn(t){const e=k.c(40),{selectedModel:a,onModelChange:s,onClose:r,modelsConnections:o}=t,[i,n]=S.useState(null),[c,l]=S.useState(""),p=S.useRef(null),[m,h]=S.useState(a?.connectionId??null),v=St(),y=o??v,{isModelAllowed:_,allowAll:g,hasConnectionModels:f}=At();let x;e[0]!==y||e[1]!==g||e[2]!==f?(x=g?y:y.filter(q=>f(q.id)),e[0]=y,e[1]=g,e[2]=f,e[3]=x):x=e[3];const u=x;let E,T;e[4]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{setTimeout(()=>{p.current?.focus()},0)},T=[],e[4]=E,e[5]=T):(E=e[4],T=e[5]),S.useEffect(E,T);let N;e[6]===Symbol.for("react.memo_cache_sentinel")?(N=q=>{h(q),n(null)},e[6]=N):N=e[6];const C=N;let P;e[7]!==r||e[8]!==s||e[9]!==m?(P=q=>{m&&(s({id:q.id,connectionId:m,provider:q.provider??void 0}),l(""),r())},e[7]=r,e[8]=s,e[9]=m,e[10]=P):P=e[10];const $=P;let F;e[11]===Symbol.for("react.memo_cache_sentinel")?(F=d.jsx(ma,{size:16,className:"text-muted-foreground shrink-0"}),e[11]=F):F=e[11];let ae;e[12]===Symbol.for("react.memo_cache_sentinel")?(ae=q=>l(q.target.value),e[12]=ae):ae=e[12];let Q;e[13]!==c?(Q=d.jsx(Ns,{ref:p,type:"text",placeholder:"Search for a model...",value:c,onChange:ae,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[13]=c,e[14]=Q):Q=e[14];let W;e[15]!==u||e[16]!==m?(W=u.length>0&&d.jsxs(Ms,{value:m??"",onValueChange:C,children:[d.jsxs(js,{size:"sm",className:"w-auto min-w-[140px] h-8 shrink-0 [&>svg:last-child]:hidden",onClick:ln,children:[d.jsx(Rs,{placeholder:"Select connection"}),d.jsx(fa,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),d.jsx(Ps,{children:u.map(nn)})]}),e[15]=u,e[16]=m,e[17]=W):W=e[17];let X;e[18]!==Q||e[19]!==W?(X=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:[F,Q,W]})}),e[18]=Q,e[19]=W,e[20]=X):X=e[20];let se;e[21]===Symbol.for("react.memo_cache_sentinel")?(se=d.jsx(Ko,{}),e[21]=se):se=e[21];let K;e[22]!==g||e[23]!==$||e[24]!==_||e[25]!==c||e[26]!==m||e[27]!==a?(K=d.jsx(S.Suspense,{fallback:se,children:d.jsx(tn,{connectionId:m,allowAll:g,isModelAllowed:_,searchTerm:c,selectedModel:a,onModelSelect:$,onHover:n})}),e[22]=g,e[23]=$,e[24]=_,e[25]=c,e[26]=m,e[27]=a,e[28]=K):K=e[28];let oe;e[29]!==m||e[30]!==K?(oe=d.jsx(pa,{fallback:on,children:K},m),e[29]=m,e[30]=K,e[31]=oe):oe=e[31];let J;e[32]!==X||e[33]!==oe?(J=d.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[400px] md:min-w-[400px]",children:[X,oe]}),e[32]=X,e[33]=oe,e[34]=J):J=e[34];let M;e[35]!==i?(M=d.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:d.jsx(Jo,{model:i})}),e[35]=i,e[36]=M):M=e[36];let ne;return e[37]!==J||e[38]!==M?(ne=d.jsxs("div",{className:"flex flex-col md:flex-row h-[350px]",children:[J,M]}),e[37]=J,e[38]=M,e[39]=ne):ne=e[39],ne}function on(t){const{error:e,resetError:a}=t;return d.jsx(Xo,{error:e,onRetry:a})}function nn(t){return d.jsx(ks,{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 ln(t){return t.stopPropagation()}function cn(t){const e=k.c(6),{selectedModel:a,placeholder:s}=t,r=a?.connectionId??void 0,o=Mt(r);let i;e[0]!==o||e[1]!==a?(i=a?o.find(l=>l.id===a.id):void 0,e[0]=o,e[1]=a,e[2]=i):i=e[2];const n=i;let c;return e[3]!==n||e[4]!==s?(c=d.jsx(jt,{model:n,placeholder:s}),e[3]=n,e[4]=s,e[5]=c):c=e[5],c}function dn(t){const e=k.c(9),{selectedModel:a,placeholder:s}=t;if(!a){let l;return e[0]!==s?(l=d.jsx(jt,{model:void 0,placeholder:s}),e[0]=s,e[1]=l):l=e[1],l}let r;e[2]!==a.id?(r=a.id.split("/").pop()??a.id,e[2]=a.id,e[3]=r):r=e[3];const o=r;let i;e[4]!==o?(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:o}),e[4]=o,e[5]=i):i=e[5];let n;e[6]===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[6]=n):n=e[6];let c;return e[7]!==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:[i,n]}),e[7]=i,e[8]=c):c=e[8],c}function Wn(t){const e=k.c(31),{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]=S.useState(!1),h=St(),v=r??h;if(v.length===0)return null;const y=c==="borderless"?"ghost":"outline",_=c==="borderless"&&"md:border-none";let g;e[0]!==i||e[1]!==_?(g=Nt("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",_,i),e[0]=i,e[1]=_,e[2]=g):g=e[2];let f;e[3]!==l||e[4]!==a?(f=d.jsx(dn,{selectedModel:a,placeholder:l}),e[3]=l,e[4]=a,e[5]=f):f=e[5];let x;e[6]!==l?(x=d.jsx(jt,{model:void 0,placeholder:l}),e[6]=l,e[7]=x):x=e[7];let u;e[8]!==l||e[9]!==a?(u=d.jsx(cn,{selectedModel:a,placeholder:l}),e[8]=l,e[9]=a,e[10]=u):u=e[10];let E;e[11]!==x||e[12]!==u?(E=d.jsx(S.Suspense,{fallback:x,children:u}),e[11]=x,e[12]=u,e[13]=E):E=e[13];let T;e[14]!==f||e[15]!==E?(T=d.jsx(pa,{fallback:f,children:E}),e[14]=f,e[15]=E,e[16]=T):T=e[16];let N;e[17]!==T||e[18]!==y||e[19]!==g?(N=d.jsx(Cs,{asChild:!0,children:d.jsx(ua,{variant:y,size:"sm",className:g,children:T})}),e[17]=T,e[18]=y,e[19]=g,e[20]=N):N=e[20];let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=d.jsx(an,{}),e[21]=C):C=e[21];let P;e[22]===Symbol.for("react.memo_cache_sentinel")?(P=()=>m(!1),e[22]=P):P=e[22];let $;e[23]!==v||e[24]!==s||e[25]!==a?($=d.jsx(Ts,{className:"w-full md:w-auto p-0",align:"start",side:"bottom",sideOffset:8,children:d.jsx(S.Suspense,{fallback:C,children:d.jsx(rn,{selectedModel:a,onModelChange:s,onClose:P,modelsConnections:v})})}),e[23]=v,e[24]=s,e[25]=a,e[26]=$):$=e[26];let F;return e[27]!==p||e[28]!==N||e[29]!==$?(F=d.jsxs(As,{open:p,onOpenChange:m,children:[N,$]}),e[27]=p,e[28]=N,e[29]=$,e[30]=F):F=e[30],F}const un=t=>new Ba({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}}}}),la=(t,e)=>t?.find(a=>a.id===e)??t?.[0]??null,pn=(t,e)=>{const a=k.c(12);let s;a[0]!==t?(s=We.chatSelectedModel(t),a[0]=t,a[1]=s):s=a[1];const[r,o]=Se(s,null),{isModelAllowed:i,allowAll:n}=At(),c=la(e,r?.connectionId),l=Mt(c?.id),p=n||!c?.id?l:l.filter(x=>i(c.id,x.id)),m=p.filter(xn).reduce(bn,void 0),h=r?.id;let v;a[2]!==p||a[3]!==h?(v=la(p,h),a[2]=p,a[3]=h,a[4]=v):v=a[4];const y=v;let _;a[5]!==m?.id||a[6]!==c||a[7]!==y?(_=y&&c?.id?{id:y.id,provider:y.provider,limits:y.limits,capabilities:y.capabilities,connectionId:c.id,fastId:m?.id}:null,a[5]=m?.id,a[6]=c,a[7]=y,a[8]=_):_=a[8];const g=_;let f;return a[9]!==g||a[10]!==o?(f=[g,o],a[9]=g,a[10]=o,a[11]=f):f=a[11],f},Ha={tiptapDoc:void 0,parentThread:null,finishReason:null};function mn(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 Ha;default:return t}}function fn(t,e){const a=[];for(const s of t)"text"in s&&s.text?a.push({type:"text",text:`[${e}]
19
+ `)}function Mo(){const t=k.c(2),e=xt();let a;return t[0]!==e?(a={prefillCollectionCache:(r,o,i,n)=>{if(!r)return;const c=wt(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 re={THREAD_MESSAGES_PAGE_SIZE:100,THREADS_PAGE_SIZE:50,QUERY_STALE_TIME:3e4};function ia(t,e,a,s){const r=Ae.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 jo(t,e,a){const s=Ae.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 Ro(t,e,a,s){if(!e)return;const r=wt(e,"THREAD_MESSAGES",a,{filters:[{column:"threadId",value:s}],pageSize:re.THREAD_MESSAGES_PAGE_SIZE});if(!r||t.getQueryData(r))return;const i="COLLECTION_THREAD_MESSAGES_LIST",n=Es(void 0,[{column:"threadId",value:s}],[]),c=Is(void 0,void 0,"updated_at"),l={...n&&{where:n},...c&&{orderBy:c},limit:re.THREAD_MESSAGES_PAGE_SIZE,offset:0};await t.fetchQuery({queryKey:r,queryFn:async()=>await e.callTool({name:i,arguments:l}),staleTime:re.QUERY_STALE_TIME,retry:!1})}function Po(t,e,a,s,r){if(!e)return;const o=wt(e,"THREAD_MESSAGES",a,{filters:[{column:"threadId",value:s}],pageSize:re.THREAD_MESSAGES_PAGE_SIZE});o&&t.setQueryData(o,{structuredContent:{items:r},isError:!1})}async function ko(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 Oo(t){const e=new Date().toISOString();return{id:t,title:"New chat",createdAt:e,updatedAt:e}}function Do(t,e){return t.find(a=>a.id!==e)??null}function $o(){const t=k.c(17),{locator:e,org:a}=xe();let s;t[0]!==a.id?(s={connectionId:It,orgId:a.id},t[0]=a.id,t[1]=s):s=t[1];const r=Et(s);let o;t[2]!==e?(o=Ae.threads(e),t[2]=e,t[3]=o):o=t[3];let i;t[4]!==r?(i=async g=>{const{pageParam:f}=g,x=f===void 0?0:f;if(!r)throw new Error("MCP client is not available");const u={limit:re.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:Zo,initialPageParam:0,staleTime:re.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}=ws(n);let v;t[9]!==c?.pages?(v=c?.pages.flatMap(Lo)??[],t[9]=c?.pages,t[10]=v):v=t[10];const y=v;let _;return t[11]!==l||t[12]!==p||t[13]!==m||t[14]!==h||t[15]!==y?(_={threads:y,refetch:h,hasNextPage:p,isFetchingNextPage:m,fetchNextPage:l},t[11]=l,t[12]=p,t[13]=m,t[14]=h,t[15]=y,t[16]=_):_=t[16],_}function Lo(t){return t.items}function Zo(t,e){if(t.hasMore)return e.length*re.THREADS_PAGE_SIZE}function Fo(t){const e=k.c(6),{org:a}=xe();let s;e[0]!==a.id?(s={connectionId:It,orgId:a.id},e[0]=a.id,e[1]=s):s=e[1];const r=Et(s);let o;e[2]!==t?(o={filters:t?[{column:"threadId",value:t}]:[],pageSize:re.THREAD_MESSAGES_PAGE_SIZE},e[2]=t,e[3]=o):o=e[3];const i=Ss(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 Uo(){const{locator:t,org:e}=xe(),a=xt(),{prefillCollectionCache:s}=Mo(),{threads:r,hasNextPage:o,isFetchingNextPage:i,fetchNextPage:n}=$o(),c=Et({connectionId:It,orgId:e.id}),[l,p]=Se(We.assistantChatActiveThread(t),r[0]?.id??crypto.randomUUID()),m=Fo(l),h=()=>{const f=crypto.randomUUID(),x=Oo(f);jo(a,t,x),c&&s(c,"THREAD_MESSAGES",e.id,{filters:[{column:"threadId",value:f}],pageSize:re.THREAD_MESSAGES_PAGE_SIZE}),p(f)},v=async f=>{await Ro(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)=>{ia(a,t,f,x)},hideThread:async f=>{try{const x=await ko(c,f,{hidden:!0});if(x){if(f===l){const E=Do(r,f);E?await v(E.id):h()}ia(a,t,f,{hidden:!0,updatedAt:x.updatedAt??new Date().toISOString()})}}catch(x){const u=x;bt.error(`Failed to update thread: ${u.message}`),console.error("[chat] Failed to update thread:",x)}},updateMessagesCache:(f,x)=>{Po(a,c,e.id,f,x)}}}function zo(){const t=k.c(5),e=xt(),{org:a}=xe();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={strict:!1},t[0]=s):s=t[0];const r=da(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:Ae.collection(a.slug,p,l)});const m=l.toLowerCase().replace(/_/g," ");bt.success(`${m} updated`)},t[1]=a,t[2]=r,t[3]=e,t[4]=o):o=t[4],o}function Z(t){const e=k.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=Nt("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 Bo=["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"],yt=new Map;Bo.forEach((t,e)=>{yt.set(t,e)});function Mt(t){const e=k.c(3);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={pageSize:999},e[0]=a):a=e[0];const s=bs(t??void 0,a);let r;return e[1]!==s?(r=s.filter(qo).sort(Vo),e[1]=s,e[2]=r):r=e[2],r}function Vo(t,e){const a=yt.get(t.id),s=yt.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 qo(t){return t.limits?.contextWindow&&t.limits?.maxOutputTokens}const Ho={reasoning:{icon:d.jsx(va,{className:"size-4"}),label:"Reasoning"},"image-upload":{icon:d.jsx(Ls,{className:"size-4"}),label:"Can analyze images"},"file-upload":{icon:d.jsx(Ds,{className:"size-4"}),label:"Can analyze files"},"web-search":{icon:d.jsx(ma,{className:"size-4"}),label:"Can search the web to answer questions"}};function qa(t){const e=k.c(10),{capability:a}=t,s=Ho[a];let r,o;e[0]!==a||e[1]!==s?(r=s||{icon:null,label:a},o=r.label.split("-").map(Wo).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 Wo(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Jo(t){const e=k.c(53),{model:a,compact:s}=t,r=s===void 0?!1:s;if(!a){let g;return e[0]===Symbol.for("react.memo_cache_sentinel")?(g=d.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Hover to preview"}),e[0]=g):g=e[0],g}const o=a.limits?.contextWindow||a.costs?.input||a.costs?.output||a.limits?.maxOutputTokens;if(!o&&!r){let g;e[1]!==a.logo||e[2]!==a.title?(g=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]=g):g=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]!==g||e[7]!==f?(x=d.jsxs("div",{className:"flex items-center gap-3 py-2 px-0",children:[g,f]}),e[6]=g,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 g;e[14]!==a.limits?(g=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]=g):g=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*1e6).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*1e6).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]!==g||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:[g,f,x,u]}),e[22]=g,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(Go)}),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($s,{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(ha,{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*1e6).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*1e6).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(ga,{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 y;e[46]!==m||e[47]!==h||e[48]!==v?(y=d.jsxs("div",{className:"flex flex-col gap-4",children:[m,h,v]}),e[46]=m,e[47]=h,e[48]=v,e[49]=y):y=e[49];let _;return e[50]!==y||e[51]!==p?(_=d.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[p,y]}),e[50]=y,e[51]=p,e[52]=_):_=e[52],_}function Go(t){return d.jsx(qa,{capability:t},t)}function Yo(t){const e=k.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(Qo)}),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 Qo(t){return d.jsx(qa,{capability:t},t)}function Xo(t){const e=k.c(10),{error:a,onRetry:s}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsx("div",{className:"bg-destructive/10 p-2 rounded-full",children:d.jsx(Os,{className:"size-5 text-destructive"})}),e[0]=r):r=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=d.jsx("p",{className:"text-sm font-medium text-foreground",children:"Failed to load models"}),e[1]=o):o=e[1];const i=a?.message||"Could not fetch models from this provider.";let n;e[2]!==i?(n=d.jsxs("div",{className:"flex flex-col gap-1",children:[o,d.jsxs("p",{className:"text-xs text-muted-foreground max-w-[260px]",children:[i," Try another provider or retry."]})]}),e[2]=i,e[3]=n):n=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Zs,{className:"size-3.5"}),e[4]=c):c=e[4];let l;e[5]!==s?(l=d.jsxs(ua,{variant:"outline",size:"sm",onClick:s,className:"gap-1.5",children:[c,"Retry"]}),e[5]=s,e[6]=l):l=e[6];let p;return e[7]!==n||e[8]!==l?(p=d.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-4 py-8 text-center",children:[r,n,l]}),e[7]=n,e[8]=l,e[9]=p):p=e[9],p}function Ko(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=d.jsx("div",{className:"flex-1 overflow-y-auto px-0.5 pt-2 space-y-1",children:Array.from({length:6}).map(en)}),t[0]=e):e=t[0],e}function en(t,e){return d.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[d.jsx(Z,{className:"size-5 shrink-0 rounded-sm"}),d.jsx(Z,{className:"flex-1 h-4"}),d.jsx(Z,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function tn(t){const e=k.c(20),{connectionId:a,allowAll:s,isModelAllowed:r,searchTerm:o,selectedModel:i,onModelSelect:n,onHover:c}=t,l=Mt(a??void 0);let p;e[0]!==l||e[1]!==s||e[2]!==a||e[3]!==r?(p=s?l:l.filter(g=>a&&r(a,g.id)),e[0]=l,e[1]=s,e[2]=a,e[3]=r,e[4]=p):p=e[4];const m=p;let h;e[5]!==m||e[6]!==o?(h=o.trim()?m.filter(g=>{const f=o.toLowerCase();return g.title.toLowerCase().includes(f)||g.provider?.toLowerCase().includes(f)||g.description?.toLowerCase().includes(f)}):m,e[5]=m,e[6]=o,e[7]=h):h=e[7];const v=h;if(v.length===0){let g;return e[8]===Symbol.for("react.memo_cache_sentinel")?(g=d.jsx("div",{className:"flex-1 flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No models found"}),e[8]=g):g=e[8],g}let y;if(e[9]!==v||e[10]!==c||e[11]!==n||e[12]!==i?.id){let g;e[14]!==c||e[15]!==n||e[16]!==i?.id?(g=f=>{const x=f.id===i?.id;return d.jsx("div",{onClick:()=>n(f),className:Nt("rounded-lg mb-1",x&&"bg-accent"),children:d.jsx(Yo,{model:f,onHover:c})},f.id)},e[14]=c,e[15]=n,e[16]=i?.id,e[17]=g):g=e[17],y=v.map(g),e[9]=v,e[10]=c,e[11]=n,e[12]=i?.id,e[13]=y}else y=e[13];let _;return e[18]!==y?(_=d.jsx("div",{className:"flex-1 overflow-y-auto px-0.5 pt-2",children:y}),e[18]=y,e[19]=_):_=e[19],_}function jt(t){const e=k.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 Hn(t){return t?.capabilities?.includes("vision")===!0}function an(){const t=k.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(Z,{className:"size-4 shrink-0"}),d.jsx(Z,{className:"flex-1 h-6"}),d.jsx(Z,{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(sn)})]}),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(Z,{className:"size-6 shrink-0"}),d.jsx(Z,{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(Z,{className:"h-6 w-20 rounded-md"}),d.jsx(Z,{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(Z,{className:"h-4 w-24"}),d.jsx(Z,{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(Z,{className:"h-4 w-16"}),d.jsx(Z,{className:"h-4 w-40"})]})]})]})})]}),t[5]=i):i=t[5],i}function sn(t,e){return d.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[d.jsx(Z,{className:"size-5 shrink-0 rounded-sm"}),d.jsx(Z,{className:"flex-1 h-4"}),d.jsx(Z,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function rn(t){const e=k.c(40),{selectedModel:a,onModelChange:s,onClose:r,modelsConnections:o}=t,[i,n]=S.useState(null),[c,l]=S.useState(""),p=S.useRef(null),[m,h]=S.useState(a?.connectionId??null),v=St(),y=o??v,{isModelAllowed:_,allowAll:g,hasConnectionModels:f}=At();let x;e[0]!==y||e[1]!==g||e[2]!==f?(x=g?y:y.filter(q=>f(q.id)),e[0]=y,e[1]=g,e[2]=f,e[3]=x):x=e[3];const u=x;let E,T;e[4]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{setTimeout(()=>{p.current?.focus()},0)},T=[],e[4]=E,e[5]=T):(E=e[4],T=e[5]),S.useEffect(E,T);let N;e[6]===Symbol.for("react.memo_cache_sentinel")?(N=q=>{h(q),n(null)},e[6]=N):N=e[6];const C=N;let P;e[7]!==r||e[8]!==s||e[9]!==m?(P=q=>{m&&(s({id:q.id,connectionId:m,provider:q.provider??void 0}),l(""),r())},e[7]=r,e[8]=s,e[9]=m,e[10]=P):P=e[10];const $=P;let F;e[11]===Symbol.for("react.memo_cache_sentinel")?(F=d.jsx(ma,{size:16,className:"text-muted-foreground shrink-0"}),e[11]=F):F=e[11];let ae;e[12]===Symbol.for("react.memo_cache_sentinel")?(ae=q=>l(q.target.value),e[12]=ae):ae=e[12];let Q;e[13]!==c?(Q=d.jsx(Ns,{ref:p,type:"text",placeholder:"Search for a model...",value:c,onChange:ae,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[13]=c,e[14]=Q):Q=e[14];let W;e[15]!==u||e[16]!==m?(W=u.length>0&&d.jsxs(Ms,{value:m??"",onValueChange:C,children:[d.jsxs(js,{size:"sm",className:"w-auto min-w-[140px] h-8 shrink-0 [&>svg:last-child]:hidden",onClick:ln,children:[d.jsx(Rs,{placeholder:"Select connection"}),d.jsx(fa,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),d.jsx(Ps,{children:u.map(nn)})]}),e[15]=u,e[16]=m,e[17]=W):W=e[17];let X;e[18]!==Q||e[19]!==W?(X=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:[F,Q,W]})}),e[18]=Q,e[19]=W,e[20]=X):X=e[20];let se;e[21]===Symbol.for("react.memo_cache_sentinel")?(se=d.jsx(Ko,{}),e[21]=se):se=e[21];let K;e[22]!==g||e[23]!==$||e[24]!==_||e[25]!==c||e[26]!==m||e[27]!==a?(K=d.jsx(S.Suspense,{fallback:se,children:d.jsx(tn,{connectionId:m,allowAll:g,isModelAllowed:_,searchTerm:c,selectedModel:a,onModelSelect:$,onHover:n})}),e[22]=g,e[23]=$,e[24]=_,e[25]=c,e[26]=m,e[27]=a,e[28]=K):K=e[28];let oe;e[29]!==m||e[30]!==K?(oe=d.jsx(pa,{fallback:on,children:K},m),e[29]=m,e[30]=K,e[31]=oe):oe=e[31];let J;e[32]!==X||e[33]!==oe?(J=d.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[400px] md:min-w-[400px]",children:[X,oe]}),e[32]=X,e[33]=oe,e[34]=J):J=e[34];let M;e[35]!==i?(M=d.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:d.jsx(Jo,{model:i})}),e[35]=i,e[36]=M):M=e[36];let ne;return e[37]!==J||e[38]!==M?(ne=d.jsxs("div",{className:"flex flex-col md:flex-row h-[350px]",children:[J,M]}),e[37]=J,e[38]=M,e[39]=ne):ne=e[39],ne}function on(t){const{error:e,resetError:a}=t;return d.jsx(Xo,{error:e,onRetry:a})}function nn(t){return d.jsx(ks,{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 ln(t){return t.stopPropagation()}function cn(t){const e=k.c(6),{selectedModel:a,placeholder:s}=t,r=a?.connectionId??void 0,o=Mt(r);let i;e[0]!==o||e[1]!==a?(i=a?o.find(l=>l.id===a.id):void 0,e[0]=o,e[1]=a,e[2]=i):i=e[2];const n=i;let c;return e[3]!==n||e[4]!==s?(c=d.jsx(jt,{model:n,placeholder:s}),e[3]=n,e[4]=s,e[5]=c):c=e[5],c}function dn(t){const e=k.c(9),{selectedModel:a,placeholder:s}=t;if(!a){let l;return e[0]!==s?(l=d.jsx(jt,{model:void 0,placeholder:s}),e[0]=s,e[1]=l):l=e[1],l}let r;e[2]!==a.id?(r=a.id.split("/").pop()??a.id,e[2]=a.id,e[3]=r):r=e[3];const o=r;let i;e[4]!==o?(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:o}),e[4]=o,e[5]=i):i=e[5];let n;e[6]===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[6]=n):n=e[6];let c;return e[7]!==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:[i,n]}),e[7]=i,e[8]=c):c=e[8],c}function Wn(t){const e=k.c(31),{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]=S.useState(!1),h=St(),v=r??h;if(v.length===0)return null;const y=c==="borderless"?"ghost":"outline",_=c==="borderless"&&"md:border-none";let g;e[0]!==i||e[1]!==_?(g=Nt("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",_,i),e[0]=i,e[1]=_,e[2]=g):g=e[2];let f;e[3]!==l||e[4]!==a?(f=d.jsx(dn,{selectedModel:a,placeholder:l}),e[3]=l,e[4]=a,e[5]=f):f=e[5];let x;e[6]!==l?(x=d.jsx(jt,{model:void 0,placeholder:l}),e[6]=l,e[7]=x):x=e[7];let u;e[8]!==l||e[9]!==a?(u=d.jsx(cn,{selectedModel:a,placeholder:l}),e[8]=l,e[9]=a,e[10]=u):u=e[10];let E;e[11]!==x||e[12]!==u?(E=d.jsx(S.Suspense,{fallback:x,children:u}),e[11]=x,e[12]=u,e[13]=E):E=e[13];let T;e[14]!==f||e[15]!==E?(T=d.jsx(pa,{fallback:f,children:E}),e[14]=f,e[15]=E,e[16]=T):T=e[16];let N;e[17]!==T||e[18]!==y||e[19]!==g?(N=d.jsx(Cs,{asChild:!0,children:d.jsx(ua,{variant:y,size:"sm",className:g,children:T})}),e[17]=T,e[18]=y,e[19]=g,e[20]=N):N=e[20];let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=d.jsx(an,{}),e[21]=C):C=e[21];let P;e[22]===Symbol.for("react.memo_cache_sentinel")?(P=()=>m(!1),e[22]=P):P=e[22];let $;e[23]!==v||e[24]!==s||e[25]!==a?($=d.jsx(Ts,{className:"w-full md:w-auto p-0",align:"start",side:"bottom",sideOffset:8,children:d.jsx(S.Suspense,{fallback:C,children:d.jsx(rn,{selectedModel:a,onModelChange:s,onClose:P,modelsConnections:v})})}),e[23]=v,e[24]=s,e[25]=a,e[26]=$):$=e[26];let F;return e[27]!==p||e[28]!==N||e[29]!==$?(F=d.jsxs(As,{open:p,onOpenChange:m,children:[N,$]}),e[27]=p,e[28]=N,e[29]=$,e[30]=F):F=e[30],F}const un=t=>new Ba({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}}}}),la=(t,e)=>t?.find(a=>a.id===e)??t?.[0]??null,pn=(t,e)=>{const a=k.c(12);let s;a[0]!==t?(s=We.chatSelectedModel(t),a[0]=t,a[1]=s):s=a[1];const[r,o]=Se(s,null),{isModelAllowed:i,allowAll:n}=At(),c=la(e,r?.connectionId),l=Mt(c?.id),p=n||!c?.id?l:l.filter(x=>i(c.id,x.id)),m=p.filter(xn).reduce(bn,void 0),h=r?.id;let v;a[2]!==p||a[3]!==h?(v=la(p,h),a[2]=p,a[3]=h,a[4]=v):v=a[4];const y=v;let _;a[5]!==m?.id||a[6]!==c||a[7]!==y?(_=y&&c?.id?{id:y.id,provider:y.provider,limits:y.limits,capabilities:y.capabilities,connectionId:c.id,fastId:m?.id}:null,a[5]=m?.id,a[6]=c,a[7]=y,a[8]=_):_=a[8];const g=_;let f;return a[9]!==g||a[10]!==o?(f=[g,o],a[9]=g,a[10]=o,a[11]=f):f=a[11],f},Ha={tiptapDoc:void 0,parentThread:null,finishReason:null};function mn(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 Ha;default:return t}}function fn(t,e){const a=[];for(const s of t)"text"in s&&s.text?a.push({type:"text",text:`[${e}]
20
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 hn(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
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
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 gn(t,e){const{mimeType:a,data:s}=t;if(a.startsWith("text/"))try{const r=atob(s);return[{type:"text",text:`${e}
@@ -1 +1 @@
1
- import{u as g,g as y,t as e}from"./index-AQn2B6oA.js";import{u as C}from"./use-binding-BrQDsE_i.js";import{g as S,h as v}from"./use-connection-Bre57mou.js";import{e as B}from"./extract-connection-data-Ne-EkFUj.js";import{f as I,c as P,e as _}from"./registry-utils-TpelbVAM.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-D3nlG5Bn.js";import{u as C}from"./use-binding-TgcVoQAA.js";import{g as S,h as v}from"./use-connection-Crfe-Ixd.js";import{e as B}from"./extract-connection-data-B-iX5ruo.js";import{f as I,c as P,e as _}from"./registry-utils-CTumh--w.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-AQn2B6oA.js";import{A as _}from"./avatar-B6qEKauK.js";import{c as C}from"./utils-IhRriFes.js";import{u as L}from"./useQuery-BVNep5UM.js";import{a as U,u as D}from"./constants-C6ocvgwp.js";import{u as P}from"./use-mobile-BWTl24se.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-D3nlG5Bn.js";import{A as _}from"./avatar-CHzxmS3u.js";import{c as C}from"./utils-ChMoRSU0.js";import{u as L}from"./useQuery-CQyI9lob.js";import{a as U,u as D}from"./constants-B1K1ZOHV.js";import{u as P}from"./use-mobile-Do_29jRD.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 +1 @@
1
- import{c,u}from"./index-AQn2B6oA.js";import{h as m,e as a}from"./use-connection-Bre57mou.js";import{j as p}from"./constants-C6ocvgwp.js";import{a as C}from"./use-binding-BrQDsE_i.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
+ import{c,u}from"./index-D3nlG5Bn.js";import{h as m,e as a}from"./use-connection-Crfe-Ixd.js";import{j as p}from"./constants-B1K1ZOHV.js";import{a as C}from"./use-binding-TgcVoQAA.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,y as c}from"./index-AQn2B6oA.js";import{u as p}from"./useQuery-BVNep5UM.js";import{K as n}from"./constants-C6ocvgwp.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,y as c}from"./index-D3nlG5Bn.js";import{u as p}from"./useQuery-CQyI9lob.js";import{K as n}from"./constants-B1K1ZOHV.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,y as p}from"./index-AQn2B6oA.js";import{u as q}from"./useQuery-BVNep5UM.js";import{u as C}from"./useMutation-D2f0MLmt.js";import{K as T}from"./constants-C6ocvgwp.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,y as p}from"./index-D3nlG5Bn.js";import{u as q}from"./useQuery-CQyI9lob.js";import{u as C}from"./useMutation-9v6OVjLU.js";import{K as T}from"./constants-B1K1ZOHV.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-AQn2B6oA.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-D3nlG5Bn.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,y as A,z as d,K as g}from"./index-AQn2B6oA.js";import{u as _}from"./useMutation-D2f0MLmt.js";import{a as p,u as y}from"./constants-C6ocvgwp.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=y(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}=A(n);return o}function G(e){const t=m.c(13),i=d(),{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=y(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,y as A,z as d,K as g}from"./index-D3nlG5Bn.js";import{u as _}from"./useMutation-9v6OVjLU.js";import{a as p,u as y}from"./constants-B1K1ZOHV.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=y(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}=A(n);return o}function G(e){const t=m.c(13),i=d(),{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=y(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-AQn2B6oA.js";import{u as y}from"./useQuery-BVNep5UM.js";import{u as f,a}from"./constants-C6ocvgwp.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-D3nlG5Bn.js";import{u as y}from"./useQuery-CQyI9lob.js";import{u as f,a}from"./constants-B1K1ZOHV.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-AQn2B6oA.js";import{e as a,u as C,d as I}from"./use-connection-Bre57mou.js";import{a as l,u}from"./constants-C6ocvgwp.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-D3nlG5Bn.js";import{e as a,u as C,d as I}from"./use-connection-Crfe-Ixd.js";import{a as l,u}from"./constants-B1K1ZOHV.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-C_2kO8fk.js";import{a5 as i}from"./index-D3nlG5Bn.js";function t(e,r){return i(e,u,r)}export{t as u};
@@ -1 +1 @@
1
- import{aO as l,aP as p,aQ as n,aR as d,aS as h,z as b,r as o,aT as m,aU as f}from"./index-AQn2B6oA.js";var v=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 v(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&&f(e.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:u,mutateAsync:r.mutate}}export{O as u};
1
+ import{aO as l,aP as p,aQ as n,aR as d,aS as h,z as b,r as o,aT as m,aU as f}from"./index-D3nlG5Bn.js";var v=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 v(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&&f(e.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:u,mutateAsync:r.mutate}}export{O as u};
@@ -0,0 +1 @@
1
+ import{a5 as u,a8 as s}from"./index-D3nlG5Bn.js";function o(e,r){return u(e,s,r)}export{o as u};
@@ -0,0 +1 @@
1
+ import{ac as a,ad as c}from"./index-D3nlG5Bn.js";function e(...r){return a(c(r))}export{e as c};
@@ -1 +1 @@
1
- import{c as Y,r as V,j as i}from"./index-AQn2B6oA.js";import{c as n}from"./utils-IhRriFes.js";const Z={sm:{button:"size-7",icon:"size-4"},md:{button:"size-9",icon:"size-5"},lg:{button:"size-12",icon:"size-6"}};function oe(J){const e=Y.c(66),{value:o,onValueChange:l,options:t,size:D,fullWidth:F,className:W}=J,K=D===void 0?"sm":D,w=F===void 0?!1:F,G=V.useRef(null),H=V.useRef(null);let R;e[0]===Symbol.for("react.memo_cache_sentinel")?(R={left:0,width:0,opacity:0},e[0]=R):R=e[0];const[N,O]=V.useState(R);let _;e[1]===Symbol.for("react.memo_cache_sentinel")?(_=S=>{if(!S.current)return;const{offsetLeft:U,offsetWidth:X}=S.current;O({left:U,width:X,opacity:1})},e[1]=_):_=e[1];const Q=_;let C;e[2]!==t[0].value||e[3]!==o?(C=()=>{const S=o===t[0].value?G:H;Q(S)},e[2]=t[0].value,e[3]=o,e[4]=C):C=e[4];let E;e[5]!==t||e[6]!==o?(E=[o,t],e[5]=t,e[6]=o,e[7]=E):E=e[7],V.useEffect(C,E);const s=Z[K];let a;e[8]!==W?(a=n("relative flex gap-0 bg-muted rounded-lg",W),e[8]=W,e[9]=a):a=e[9];let c;e[10]!==l||e[11]!==t[0].value?(c=()=>l(t[0].value),e[10]=l,e[11]=t[0].value,e[12]=c):c=e[12];const $=w?"flex-1 h-12 px-4":s.button,I=!w&&t[0].label?"px-3":"";let r;e[13]!==I||e[14]!==$?(r=n("relative z-10 flex items-center justify-center gap-2 rounded-lg transition-colors [transition-timing-function:var(--ease-out-cubic)] duration-200",$,I),e[13]=I,e[14]=$,e[15]=r):r=e[15];const P=o===t[0].value?"text-foreground":"text-muted-foreground";let u;e[16]!==s.icon||e[17]!==P?(u=n("transition-colors ease-out duration-200 flex items-center justify-center [&>svg]:size-[1em]",s.icon,P),e[16]=s.icon,e[17]=P,e[18]=u):u=e[18];let f;e[19]!==t[0].icon||e[20]!==u?(f=i.jsx("span",{className:u,children:t[0].icon}),e[19]=t[0].icon,e[20]=u,e[21]=f):f=e[21];let d;e[22]!==t[0].label||e[23]!==t[0].value||e[24]!==o?(d=t[0].label&&i.jsx("span",{className:n("text-xs transition-colors ease-out duration-200 whitespace-nowrap",o===t[0].value?"text-foreground":"text-muted-foreground"),children:t[0].label}),e[22]=t[0].label,e[23]=t[0].value,e[24]=o,e[25]=d):d=e[25];let m;e[26]!==r||e[27]!==f||e[28]!==d||e[29]!==c?(m=i.jsxs("button",{ref:G,type:"button",onClick:c,className:r,children:[f,d]}),e[26]=r,e[27]=f,e[28]=d,e[29]=c,e[30]=m):m=e[30];let x;e[31]!==l||e[32]!==t[1].value?(x=()=>l(t[1].value),e[31]=l,e[32]=t[1].value,e[33]=x):x=e[33];const L=w?"flex-1 h-12 px-4":s.button,M=!w&&t[1].label?"px-3":"";let p;e[34]!==L||e[35]!==M?(p=n("relative z-10 flex items-center justify-center gap-2 rounded-lg transition-colors [transition-timing-function:var(--ease-out-cubic)] duration-200",L,M),e[34]=L,e[35]=M,e[36]=p):p=e[36];const T=o===t[1].value?"text-foreground":"text-muted-foreground";let b;e[37]!==s.icon||e[38]!==T?(b=n("transition-colors ease-out duration-200 flex items-center justify-center [&>svg]:size-[1em]",s.icon,T),e[37]=s.icon,e[38]=T,e[39]=b):b=e[39];let v;e[40]!==t[1].icon||e[41]!==b?(v=i.jsx("span",{className:b,children:t[1].icon}),e[40]=t[1].icon,e[41]=b,e[42]=v):v=e[42];let g;e[43]!==t[1].label||e[44]!==t[1].value||e[45]!==o?(g=t[1].label&&i.jsx("span",{className:n("text-xs transition-colors ease-out duration-200 whitespace-nowrap",o===t[1].value?"text-foreground":"text-muted-foreground"),children:t[1].label}),e[43]=t[1].label,e[44]=t[1].value,e[45]=o,e[46]=g):g=e[46];let h;e[47]!==x||e[48]!==p||e[49]!==v||e[50]!==g?(h=i.jsxs("button",{ref:H,type:"button",onClick:x,className:p,children:[v,g]}),e[47]=x,e[48]=p,e[49]=v,e[50]=g,e[51]=h):h=e[51];const q=w?"h-12":s.button;let y;e[52]!==q?(y=n("absolute z-0 bg-background rounded-lg border-shadow transition-all [transition-timing-function:var(--ease-out-cubic)] duration-200",q),e[52]=q,e[53]=y):y=e[53];const A=`${N.left}px`,B=`${N.width}px`;let j;e[54]!==N.opacity||e[55]!==A||e[56]!==B?(j={left:A,width:B,opacity:N.opacity},e[54]=N.opacity,e[55]=A,e[56]=B,e[57]=j):j=e[57];let z;e[58]!==y||e[59]!==j?(z=i.jsx("div",{className:y,style:j}),e[58]=y,e[59]=j,e[60]=z):z=e[60];let k;return e[61]!==m||e[62]!==h||e[63]!==z||e[64]!==a?(k=i.jsxs("div",{className:a,children:[m,h,z]}),e[61]=m,e[62]=h,e[63]=z,e[64]=a,e[65]=k):k=e[65],k}export{oe as V};
1
+ import{c as Y,r as V,j as i}from"./index-D3nlG5Bn.js";import{c as n}from"./utils-ChMoRSU0.js";const Z={sm:{button:"size-7",icon:"size-4"},md:{button:"size-9",icon:"size-5"},lg:{button:"size-12",icon:"size-6"}};function oe(J){const e=Y.c(66),{value:o,onValueChange:l,options:t,size:D,fullWidth:F,className:W}=J,K=D===void 0?"sm":D,w=F===void 0?!1:F,G=V.useRef(null),H=V.useRef(null);let R;e[0]===Symbol.for("react.memo_cache_sentinel")?(R={left:0,width:0,opacity:0},e[0]=R):R=e[0];const[N,O]=V.useState(R);let _;e[1]===Symbol.for("react.memo_cache_sentinel")?(_=S=>{if(!S.current)return;const{offsetLeft:U,offsetWidth:X}=S.current;O({left:U,width:X,opacity:1})},e[1]=_):_=e[1];const Q=_;let C;e[2]!==t[0].value||e[3]!==o?(C=()=>{const S=o===t[0].value?G:H;Q(S)},e[2]=t[0].value,e[3]=o,e[4]=C):C=e[4];let E;e[5]!==t||e[6]!==o?(E=[o,t],e[5]=t,e[6]=o,e[7]=E):E=e[7],V.useEffect(C,E);const s=Z[K];let a;e[8]!==W?(a=n("relative flex gap-0 bg-muted rounded-lg",W),e[8]=W,e[9]=a):a=e[9];let c;e[10]!==l||e[11]!==t[0].value?(c=()=>l(t[0].value),e[10]=l,e[11]=t[0].value,e[12]=c):c=e[12];const $=w?"flex-1 h-12 px-4":s.button,I=!w&&t[0].label?"px-3":"";let r;e[13]!==I||e[14]!==$?(r=n("relative z-10 flex items-center justify-center gap-2 rounded-lg transition-colors [transition-timing-function:var(--ease-out-cubic)] duration-200",$,I),e[13]=I,e[14]=$,e[15]=r):r=e[15];const P=o===t[0].value?"text-foreground":"text-muted-foreground";let u;e[16]!==s.icon||e[17]!==P?(u=n("transition-colors ease-out duration-200 flex items-center justify-center [&>svg]:size-[1em]",s.icon,P),e[16]=s.icon,e[17]=P,e[18]=u):u=e[18];let f;e[19]!==t[0].icon||e[20]!==u?(f=i.jsx("span",{className:u,children:t[0].icon}),e[19]=t[0].icon,e[20]=u,e[21]=f):f=e[21];let d;e[22]!==t[0].label||e[23]!==t[0].value||e[24]!==o?(d=t[0].label&&i.jsx("span",{className:n("text-xs transition-colors ease-out duration-200 whitespace-nowrap",o===t[0].value?"text-foreground":"text-muted-foreground"),children:t[0].label}),e[22]=t[0].label,e[23]=t[0].value,e[24]=o,e[25]=d):d=e[25];let m;e[26]!==r||e[27]!==f||e[28]!==d||e[29]!==c?(m=i.jsxs("button",{ref:G,type:"button",onClick:c,className:r,children:[f,d]}),e[26]=r,e[27]=f,e[28]=d,e[29]=c,e[30]=m):m=e[30];let x;e[31]!==l||e[32]!==t[1].value?(x=()=>l(t[1].value),e[31]=l,e[32]=t[1].value,e[33]=x):x=e[33];const L=w?"flex-1 h-12 px-4":s.button,M=!w&&t[1].label?"px-3":"";let p;e[34]!==L||e[35]!==M?(p=n("relative z-10 flex items-center justify-center gap-2 rounded-lg transition-colors [transition-timing-function:var(--ease-out-cubic)] duration-200",L,M),e[34]=L,e[35]=M,e[36]=p):p=e[36];const T=o===t[1].value?"text-foreground":"text-muted-foreground";let b;e[37]!==s.icon||e[38]!==T?(b=n("transition-colors ease-out duration-200 flex items-center justify-center [&>svg]:size-[1em]",s.icon,T),e[37]=s.icon,e[38]=T,e[39]=b):b=e[39];let v;e[40]!==t[1].icon||e[41]!==b?(v=i.jsx("span",{className:b,children:t[1].icon}),e[40]=t[1].icon,e[41]=b,e[42]=v):v=e[42];let g;e[43]!==t[1].label||e[44]!==t[1].value||e[45]!==o?(g=t[1].label&&i.jsx("span",{className:n("text-xs transition-colors ease-out duration-200 whitespace-nowrap",o===t[1].value?"text-foreground":"text-muted-foreground"),children:t[1].label}),e[43]=t[1].label,e[44]=t[1].value,e[45]=o,e[46]=g):g=e[46];let h;e[47]!==x||e[48]!==p||e[49]!==v||e[50]!==g?(h=i.jsxs("button",{ref:H,type:"button",onClick:x,className:p,children:[v,g]}),e[47]=x,e[48]=p,e[49]=v,e[50]=g,e[51]=h):h=e[51];const q=w?"h-12":s.button;let y;e[52]!==q?(y=n("absolute z-0 bg-background rounded-lg border-shadow transition-all [transition-timing-function:var(--ease-out-cubic)] duration-200",q),e[52]=q,e[53]=y):y=e[53];const A=`${N.left}px`,B=`${N.width}px`;let j;e[54]!==N.opacity||e[55]!==A||e[56]!==B?(j={left:A,width:B,opacity:N.opacity},e[54]=N.opacity,e[55]=A,e[56]=B,e[57]=j):j=e[57];let z;e[58]!==y||e[59]!==j?(z=i.jsx("div",{className:y,style:j}),e[58]=y,e[59]=j,e[60]=z):z=e[60];let k;return e[61]!==m||e[62]!==h||e[63]!==z||e[64]!==a?(k=i.jsxs("div",{className:a,children:[m,h,z]}),e[61]=m,e[62]=h,e[63]=z,e[64]=a,e[65]=k):k=e[65],k}export{oe as V};