totem-llm 0.3.4 → 0.3.6

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 (58) hide show
  1. package/lib/launcher.js +3 -2
  2. package/lib/setup.js +0 -1
  3. package/package.json +1 -1
  4. package/server/public/_index.html +7 -7
  5. package/server/public/assets/{404-56d107aa.js → 404-b9e84316.js} +1 -1
  6. package/server/public/assets/{RunDetailPage-da6aa377.js → RunDetailPage-f74368e1.js} +1 -1
  7. package/server/public/assets/{RunHistoryPage-2fcb4325.js → RunHistoryPage-432358df.js} +1 -1
  8. package/server/public/assets/{Trans-820f1dad.js → Trans-308f36d6.js} +1 -1
  9. package/server/public/assets/{cron-307d3fc6.js → cron-dfd47d9d.js} +1 -1
  10. package/server/public/assets/{files-676613ed.js → files-40998f84.js} +1 -1
  11. package/server/public/assets/{index-65184421.js → index-04b8b272.js} +1 -1
  12. package/server/public/assets/{index-ec3efa1e.js → index-0e2cd529.js} +1 -1
  13. package/server/public/assets/{index-671239cd.js → index-14be6ea8.js} +1 -1
  14. package/server/public/assets/{index-2aac91d0.js → index-1ee26989.js} +3 -3
  15. package/server/public/assets/{index-f9305828.js → index-202992ed.js} +1 -1
  16. package/server/public/assets/{index-df293c50.js → index-21157170.js} +1 -1
  17. package/server/public/assets/{index-72544df5.js → index-2317e7bf.js} +1 -1
  18. package/server/public/assets/{index-44ab5f11.js → index-28476ae3.js} +1 -1
  19. package/server/public/assets/{index-4750915e.js → index-2a122ffc.js} +1 -1
  20. package/server/public/assets/{index-d29fdeda.js → index-305b79a5.js} +1 -1
  21. package/server/public/assets/{index-d54b0575.js → index-34fe9c27.js} +1 -1
  22. package/server/public/assets/{index-3cb59d82.js → index-36acf56a.js} +1 -1
  23. package/server/public/assets/{index-a2978aa0.js → index-387c6117.js} +2 -2
  24. package/server/public/assets/{index-2d84e5fe.js → index-41afab73.js} +1 -1
  25. package/server/public/assets/{index-841db586.js → index-449280b3.js} +1 -1
  26. package/server/public/assets/{index-80edec8f.js → index-4aa70062.js} +1 -1
  27. package/server/public/assets/{index-cd6bc090.js → index-5911cdab.js} +1 -1
  28. package/server/public/assets/{index-efee6d1f.js → index-620c8910.js} +1 -1
  29. package/server/public/assets/{index-33ded078.js → index-6615fb87.js} +1 -1
  30. package/server/public/assets/{index-b49f94f1.js → index-69339b2c.js} +1 -1
  31. package/server/public/assets/{index-631fc042.js → index-70110b81.js} +1 -1
  32. package/server/public/assets/{index-574ed823.js → index-72879f52.js} +2 -2
  33. package/server/public/assets/{index-882e468e.js → index-7a4311ac.js} +1 -1
  34. package/server/public/assets/{index-fce187ac.js → index-823d8660.js} +1 -1
  35. package/server/public/assets/{index-1fe43260.js → index-874c0495.js} +1 -1
  36. package/server/public/assets/{index-6679334a.js → index-895c8c16.js} +1 -1
  37. package/server/public/assets/{index-6d56c896.js → index-93558484.js} +2 -2
  38. package/server/public/assets/{index-ed9034ac.js → index-988da2b0.js} +1 -1
  39. package/server/public/assets/{index-01932fa1.js → index-a14b4fe3.js} +1 -1
  40. package/server/public/assets/{index-0bf4fb6b.js → index-a8fe483a.js} +1 -1
  41. package/server/public/assets/{index-ae4f557d.js → index-aca9b702.js} +2 -2
  42. package/server/public/assets/{index-1c653bbf.js → index-b31c3faf.js} +2 -2
  43. package/server/public/assets/{index-4277cf52.js → index-c712996e.js} +1 -1
  44. package/server/public/assets/{index-391c1474.js → index-d948bb92.js} +3 -3
  45. package/server/public/assets/{index-a253e180.js → index-e28b4d22.js} +2 -2
  46. package/server/public/assets/{index-6bd7928a.js → index-ed14fe75.js} +1 -1
  47. package/server/public/assets/{index-e58bf860.js → index-f696a7cf.js} +1 -1
  48. package/server/public/assets/{index-4ce77c64.js → index-f6b98bbf.js} +1 -1
  49. package/server/public/assets/{index-27cc497c.js → index-fc994fe1.js} +1 -1
  50. package/server/public/assets/{main-0b9e408b.js → main-34958ff6.js} +1 -1
  51. package/server/public/assets/{mcpServers-1686e782.js → mcpServers-9495fe60.js} +1 -1
  52. package/server/public/assets/{moment-75486807.js → moment-49fc1b76.js} +1 -1
  53. package/server/public/assets/{purify-eb750cf4.js → purify-17c89583.js} +1 -1
  54. package/server/public/assets/{react-beautiful-dnd.esm-bb85eef1.js → react-beautiful-dnd.esm-149a7a55.js} +1 -1
  55. package/server/public/assets/{truncate-06273256.js → truncate-dd7b0c29.js} +1 -1
  56. package/server/public/favicon.ico +0 -0
  57. package/server/public/index.js +27 -27
  58. package/server/utils/files/multer.js +2 -8
@@ -1 +1 @@
1
- import{R as o,r as d,g as H,u as E,j as e,M as Z,k as S,v as V,p as L,c as A,I as M,ab as $,aF as q,aa as U,a7 as K,a6 as G,bx as J,aE as Q}from"../index.js";import{C as T}from"./communityHub-aba61686.js";import{I as Y}from"./Brain-24e386d5.js";import{I as X}from"./Browser-1820fad0.js";const ee=new Map([["bold",o.createElement(o.Fragment,null,o.createElement("path",{d:"M54.8,119.49A35.06,35.06,0,0,1,49.05,128a35.06,35.06,0,0,1,5.75,8.51C60,147.24,60,159.83,60,172c0,25.94,1.84,32,20,32a12,12,0,0,1,0,24c-19.14,0-32.2-6.9-38.8-20.51C36,196.76,36,184.17,36,172c0-25.94-1.84-32-20-32a12,12,0,0,1,0-24c18.16,0,20-6.06,20-32,0-12.17,0-24.76,5.2-35.49C47.8,34.9,60.86,28,80,28a12,12,0,0,1,0,24c-18.16,0-20,6.06-20,32C60,96.17,60,108.76,54.8,119.49ZM240,116c-18.16,0-20-6.06-20-32,0-12.17,0-24.76-5.2-35.49C208.2,34.9,195.14,28,176,28a12,12,0,0,0,0,24c18.16,0,20,6.06,20,32,0,12.17,0,24.76,5.2,35.49A35.06,35.06,0,0,0,207,128a35.06,35.06,0,0,0-5.75,8.51C196,147.24,196,159.83,196,172c0,25.94-1.84,32-20,32a12,12,0,0,0,0,24c19.14,0,32.2-6.9,38.8-20.51C220,196.76,220,184.17,220,172c0-25.94,1.84-32,20-32a12,12,0,0,0,0-24Z"}))],["duotone",o.createElement(o.Fragment,null,o.createElement("path",{d:"M240,128c-64,0,0,88-64,88H80c-64,0,0-88-64-88,64,0,0-88,64-88h96C240,40,176,128,240,128Z",opacity:"0.2"}),o.createElement("path",{d:"M43.18,128a29.78,29.78,0,0,1,8,10.26c4.8,9.9,4.8,22,4.8,33.74,0,24.31,1,36,24,36a8,8,0,0,1,0,16c-17.48,0-29.32-6.14-35.2-18.26-4.8-9.9-4.8-22-4.8-33.74,0-24.31-1-36-24-36a8,8,0,0,1,0-16c23,0,24-11.69,24-36,0-11.72,0-23.84,4.8-33.74C50.68,38.14,62.52,32,80,32a8,8,0,0,1,0,16C57,48,56,59.69,56,84c0,11.72,0,23.84-4.8,33.74A29.78,29.78,0,0,1,43.18,128ZM240,120c-23,0-24-11.69-24-36,0-11.72,0-23.84-4.8-33.74C205.32,38.14,193.48,32,176,32a8,8,0,0,0,0,16c23,0,24,11.69,24,36,0,11.72,0,23.84,4.8,33.74a29.78,29.78,0,0,0,8,10.26,29.78,29.78,0,0,0-8,10.26c-4.8,9.9-4.8,22-4.8,33.74,0,24.31-1,36-24,36a8,8,0,0,0,0,16c17.48,0,29.32-6.14,35.2-18.26,4.8-9.9,4.8-22,4.8-33.74,0-24.31,1-36,24-36a8,8,0,0,0,0-16Z"}))],["fill",o.createElement(o.Fragment,null,o.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM88,155.84c.29,14.26.41,20.16,16,20.16a8,8,0,0,1,0,16c-31.27,0-31.72-22.43-32-35.84C71.71,141.9,71.59,136,56,136a8,8,0,0,1,0-16c15.59,0,15.71-5.9,16-20.16C72.28,86.43,72.73,64,104,64a8,8,0,0,1,0,16c-15.59,0-15.71,5.9-16,20.16-.17,8.31-.41,20.09-8,27.84C87.59,135.75,87.83,147.53,88,155.84ZM200,136c-15.59,0-15.71,5.9-16,20.16-.28,13.41-.73,35.84-32,35.84a8,8,0,0,1,0-16c15.59,0,15.71-5.9,16-20.16.17-8.31.41-20.09,8-27.84-7.6-7.75-7.84-19.53-8-27.84C167.71,85.9,167.59,80,152,80a8,8,0,0,1,0-16c31.27,0,31.72,22.43,32,35.84.29,14.26.41,20.16,16,20.16a8,8,0,0,1,0,16Z"}))],["light",o.createElement(o.Fragment,null,o.createElement("path",{d:"M39.91,128a27.68,27.68,0,0,1,9.49,11.13C54,148.62,54,160.51,54,172c0,24.27,1.21,38,26,38a6,6,0,0,1,0,12c-16.88,0-27.81-5.6-33.4-17.13C42,195.38,42,183.49,42,172c0-24.27-1.21-38-26-38a6,6,0,0,1,0-12c24.79,0,26-13.73,26-38,0-11.49,0-23.38,4.6-32.87C52.19,39.6,63.12,34,80,34a6,6,0,0,1,0,12C55.21,46,54,59.73,54,84c0,11.49,0,23.38-4.6,32.87A27.68,27.68,0,0,1,39.91,128ZM240,122c-24.79,0-26-13.73-26-38,0-11.49,0-23.38-4.6-32.87C203.81,39.6,192.88,34,176,34a6,6,0,0,0,0,12c24.79,0,26,13.73,26,38,0,11.49,0,23.38,4.6,32.87A27.68,27.68,0,0,0,216.09,128a27.68,27.68,0,0,0-9.49,11.13C202,148.62,202,160.51,202,172c0,24.27-1.21,38-26,38a6,6,0,0,0,0,12c16.88,0,27.81-5.6,33.4-17.13,4.6-9.49,4.6-21.38,4.6-32.87,0-24.27,1.21-38,26-38a6,6,0,0,0,0-12Z"}))],["regular",o.createElement(o.Fragment,null,o.createElement("path",{d:"M43.18,128a29.78,29.78,0,0,1,8,10.26c4.8,9.9,4.8,22,4.8,33.74,0,24.31,1,36,24,36a8,8,0,0,1,0,16c-17.48,0-29.32-6.14-35.2-18.26-4.8-9.9-4.8-22-4.8-33.74,0-24.31-1-36-24-36a8,8,0,0,1,0-16c23,0,24-11.69,24-36,0-11.72,0-23.84,4.8-33.74C50.68,38.14,62.52,32,80,32a8,8,0,0,1,0,16C57,48,56,59.69,56,84c0,11.72,0,23.84-4.8,33.74A29.78,29.78,0,0,1,43.18,128ZM240,120c-23,0-24-11.69-24-36,0-11.72,0-23.84-4.8-33.74C205.32,38.14,193.48,32,176,32a8,8,0,0,0,0,16c23,0,24,11.69,24,36,0,11.72,0,23.84,4.8,33.74a29.78,29.78,0,0,0,8,10.26,29.78,29.78,0,0,0-8,10.26c-4.8,9.9-4.8,22-4.8,33.74,0,24.31-1,36-24,36a8,8,0,0,0,0,16c17.48,0,29.32-6.14,35.2-18.26,4.8-9.9,4.8-22,4.8-33.74,0-24.31,1-36,24-36a8,8,0,0,0,0-16Z"}))],["thin",o.createElement(o.Fragment,null,o.createElement("path",{d:"M35.89,128C52,136.23,52,155.64,52,172c0,24.8,1.35,40,28,40a4,4,0,0,1,0,8c-36,0-36-26.61-36-48,0-24.8-1.35-40-28-40a4,4,0,0,1,0-8c26.65,0,28-15.2,28-40,0-21.39,0-48,36-48a4,4,0,0,1,0,8C53.35,44,52,59.2,52,84,52,100.36,52,119.77,35.89,128ZM240,124c-26.65,0-28-15.2-28-40,0-21.39,0-48-36-48a4,4,0,0,0,0,8c26.65,0,28,15.2,28,40,0,16.36,0,35.77,16.11,44C204,136.23,204,155.64,204,172c0,24.8-1.35,40-28,40a4,4,0,0,0,0,8c36,0,36-26.61,36-48,0-24.8,1.35-40,28-40a4,4,0,0,0,0-8Z"}))]]);var te=Object.defineProperty,se=Object.defineProperties,ae=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,re=Object.prototype.hasOwnProperty,le=Object.prototype.propertyIsEnumerable,O=(s,t,r)=>t in s?te(s,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[t]=r,ne=(s,t)=>{for(var r in t||(t={}))re.call(t,r)&&O(s,r,t[r]);if(R)for(var r of R(t))le.call(t,r)&&O(s,r,t[r]);return s},ie=(s,t)=>se(s,ae(t));const B=d.forwardRef((s,t)=>o.createElement(H,ie(ne({ref:t},s),{weights:ee})));B.displayName="BracketsCurly";const oe=new Map([["bold",o.createElement(o.Fragment,null,o.createElement("path",{d:"M40.14,46.88A12,12,0,0,0,36,56V224a12,12,0,0,0,24,0V181.72c22.84-17.12,42.1-9.12,70.68,5,16.23,8,34.74,17.2,54.8,17.2,14.72,0,30.28-4.94,46.38-18.88A12,12,0,0,0,236,176V56a12,12,0,0,0-19.86-9.07c-24.71,21.41-44.53,13.31-74.82-1.68C113.19,31.27,78.17,13.94,40.14,46.88ZM212,170.26c-22.84,17.13-42.1,9.11-70.68-5C118.16,153.76,90.33,140,60,153.87V61.69c22.84-17.12,42.1-9.12,70.68,5,16.23,8,34.74,17.2,54.8,17.2A63,63,0,0,0,212,78.08Z"}))],["duotone",o.createElement(o.Fragment,null,o.createElement("path",{d:"M224,56V176c-64,55.43-112-55.43-176,0V56C112,.57,160,111.43,224,56Z",opacity:"0.2"}),o.createElement("path",{d:"M42.76,50A8,8,0,0,0,40,56V224a8,8,0,0,0,16,0V179.77c26.79-21.16,49.87-9.75,76.45,3.41,16.4,8.11,34.06,16.85,53,16.85,13.93,0,28.54-4.75,43.82-18a8,8,0,0,0,2.76-6V56A8,8,0,0,0,218.76,50c-28,24.23-51.72,12.49-79.21-1.12C111.07,34.76,78.78,18.79,42.76,50ZM216,172.25c-26.79,21.16-49.87,9.74-76.45-3.41-25-12.35-52.81-26.13-83.55-8.4V59.79c26.79-21.16,49.87-9.75,76.45,3.4,25,12.35,52.82,26.13,83.55,8.4Z"}))],["fill",o.createElement(o.Fragment,null,o.createElement("path",{d:"M232,56V176a8,8,0,0,1-2.76,6c-15.28,13.23-29.89,18-43.82,18-18.91,0-36.57-8.74-53-16.85C105.87,170,82.79,158.61,56,179.77V224a8,8,0,0,1-16,0V56a8,8,0,0,1,2.77-6h0c36-31.18,68.31-15.21,96.79-1.12C167,62.46,190.79,74.2,218.76,50A8,8,0,0,1,232,56Z"}))],["light",o.createElement(o.Fragment,null,o.createElement("path",{d:"M44.08,51.37A6,6,0,0,0,42,55.9V224a6,6,0,0,0,12,0V178.78c28.08-22.79,51.88-11,79.34,2.57,16.12,8,33.49,16.58,52,16.58,13.57,0,27.76-4.6,42.56-17.42A6,6,0,0,0,230,176V55.9a6,6,0,0,0-9.93-4.54c-29,25.12-53.28,13.09-81.41-.84C110.77,36.71,79,21.16,44.08,51.37ZM218,173.17c-28.08,22.8-51.88,11-79.34-2.58C113.4,158.08,85.09,144.07,54,164V58.72c28.08-22.8,51.88-11,79.34,2.56C158.6,73.79,186.91,87.8,218,67.91Z"}))],["regular",o.createElement(o.Fragment,null,o.createElement("path",{d:"M42.76,50A8,8,0,0,0,40,56V224a8,8,0,0,0,16,0V179.77c26.79-21.16,49.87-9.75,76.45,3.41,16.4,8.11,34.06,16.85,53,16.85,13.93,0,28.54-4.75,43.82-18a8,8,0,0,0,2.76-6V56A8,8,0,0,0,218.76,50c-28,24.23-51.72,12.49-79.21-1.12C111.07,34.76,78.78,18.79,42.76,50ZM216,172.25c-26.79,21.16-49.87,9.74-76.45-3.41-25-12.35-52.81-26.13-83.55-8.4V59.79c26.79-21.16,49.87-9.75,76.45,3.4,25,12.35,52.82,26.13,83.55,8.4Z"}))],["thin",o.createElement(o.Fragment,null,o.createElement("path",{d:"M45.39,53.06a4,4,0,0,0-1.39,3V224a4,4,0,0,0,8,0V177.87c29.41-24.39,55.08-11.69,82.23,1.73,16.5,8.17,33.33,16.5,51.13,16.5,13.14,0,26.81-4.55,41.26-17.06a4,4,0,0,0,1.38-3v-120a4,4,0,0,0-6.62-3c-30,26-56,13.07-83.61-.57C109.07,38.28,79.4,23.62,45.39,53.06ZM220,174.17c-29.41,24.4-55.08,11.7-82.23-1.73-26.82-13.27-54.5-27-85.77-4.66V57.92c29.41-24.4,55.08-11.7,82.23,1.73,26.82,13.27,54.5,27,85.77,4.66Z"}))]]);var me=Object.defineProperty,ce=Object.defineProperties,ue=Object.getOwnPropertyDescriptors,P=Object.getOwnPropertySymbols,de=Object.prototype.hasOwnProperty,he=Object.prototype.propertyIsEnumerable,D=(s,t,r)=>t in s?me(s,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[t]=r,pe=(s,t)=>{for(var r in t||(t={}))de.call(t,r)&&D(s,r,t[r]);if(P)for(var r of P(t))he.call(t,r)&&D(s,r,t[r]);return s},xe=(s,t)=>ce(s,ue(t));const W=d.forwardRef((s,t)=>o.createElement(H,xe(pe({ref:t},s),{weights:oe})));W.displayName="Flag";function be(){const[s,t]=d.useState(!1),[r,a]=d.useState(!0);return d.useEffect(()=>{async function h(){a(!0);try{const{connectionKey:c}=await T.getSettings();t(!!c)}catch(c){console.error("Error checking hub auth:",c),t(!1)}finally{a(!1)}}h()},[]),{isAuthenticated:s,loading:r}}function ye({show:s,onClose:t}){const{t:r}=E();return s?e.jsx(Z,{isOpen:s,children:e.jsx("div",{className:"relative w-[400px] max-w-full bg-theme-bg-primary rounded-lg shadow border border-theme-modal-border",children:e.jsxs("div",{className:"p-6",children:[e.jsx("button",{onClick:t,type:"button",className:"absolute top-4 right-4 transition-all duration-300 bg-transparent rounded-lg text-sm p-1 inline-flex items-center hover:bg-theme-modal-border hover:border-theme-modal-border hover:border-opacity-50 border-transparent border",children:e.jsx(S,{size:18,weight:"bold",className:"text-white"})}),e.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-white",children:r("community_hub.publish.generic.unauthenticated.title")}),e.jsx("p",{className:"text-lg text-white text-center max-w-[300px]",children:r("community_hub.publish.generic.unauthenticated.description")}),e.jsx(V,{to:L.communityHub.authentication(),className:"w-[265px] bg-theme-bg-secondary hover:bg-theme-sidebar-item-hover text-theme-text-primary py-2 px-4 rounded-lg transition-colors mt-4 text-sm font-semibold text-center",children:r("community_hub.publish.generic.unauthenticated.button")})]})]})})}):null}function ge({entity:s}){const{t}=E(),r=d.useRef(null),[a,h]=d.useState(!1),[c,b]=d.useState([]),[g,v]=d.useState(""),[j,u]=d.useState("public"),[l,m]=d.useState(!1),[p,x]=d.useState(null),w=async n=>{n.preventDefault(),n.stopPropagation(),h(!0);try{const i=new FormData(r.current),y={name:i.get("name"),description:i.get("description"),prompt:i.get("prompt"),tags:c,visibility:j},{success:N,error:_,itemId:I}=await T.createSystemPrompt(y);if(!N)throw new Error(_);x(I),m(!0)}catch(i){console.error("Failed to publish prompt:",i),A(`Failed to publish prompt: ${i.message}`,"error",{clear:!0})}finally{h(!1)}},k=n=>{if(n.key==="Enter"||n.key===","){n.preventDefault();const i=g.trim();if(i.length>20)return;i&&!c.includes(i)&&(b(y=>[...y,i].slice(0,5)),v(""))}},C=n=>{b(c.filter(i=>i!==n))};return l?e.jsx("div",{className:"p-6 -mt-12 w-[400px]",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-2",children:[e.jsx("h3",{className:"text-lg font-semibold text-theme-text-primary",children:t("community_hub.publish.system_prompt.success_title")}),e.jsx("p",{className:"text-lg text-theme-text-primary text-center max-w-2xl",children:t("community_hub.publish.system_prompt.success_description")}),e.jsx("p",{className:"text-theme-text-secondary text-center text-sm",children:t("community_hub.publish.system_prompt.success_thank_you")}),e.jsx(V,{to:L.communityHub.viewItem("system-prompt",p),target:"_blank",rel:"noreferrer",className:"w-[265px] bg-theme-bg-secondary hover:bg-theme-sidebar-item-hover text-theme-text-primary py-2 px-4 rounded-lg transition-colors mt-4 text-sm font-semibold text-center",children:t("community_hub.publish.system_prompt.view_on_hub")})]})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-full flex gap-x-2 items-center mb-3 -mt-8",children:e.jsx("h3",{className:"text-xl font-semibold text-theme-text-primary px-6 py-3",children:t("community_hub.publish.system_prompt.modal_title")})}),e.jsxs("form",{ref:r,className:"flex",onSubmit:w,children:[e.jsxs("div",{className:"w-1/2 p-6 pt-0 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-theme-text-primary mb-1",children:t("community_hub.publish.system_prompt.name_label")}),e.jsx("div",{className:"text-xs text-theme-text-secondary mb-2",children:t("community_hub.publish.system_prompt.name_description")}),e.jsx("input",{type:"text",name:"name",required:!0,minLength:3,maxLength:300,placeholder:t("community_hub.publish.system_prompt.name_placeholder"),className:"border-none w-full bg-theme-bg-secondary rounded-lg p-2 text-theme-text-primary text-sm focus:outline-primary-button active:outline-primary-button outline-none placeholder:text-theme-text-placeholder"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-theme-text-primary mb-1",children:t("community_hub.publish.system_prompt.description_label")}),e.jsx("div",{className:"text-xs text-white/60 mb-2",children:t("community_hub.publish.system_prompt.description_description")}),e.jsx("textarea",{name:"description",required:!0,minLength:10,maxLength:1e3,placeholder:t("community_hub.publish.system_prompt.description_description"),className:"border-none w-full bg-theme-bg-secondary rounded-lg p-2 text-white text-sm focus:outline-primary-button active:outline-primary-button outline-none min-h-[80px] placeholder:text-theme-text-placeholder"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-white mb-1",children:t("community_hub.publish.system_prompt.tags_label")}),e.jsx("div",{className:"text-xs text-white/60 mb-2",children:t("community_hub.publish.system_prompt.tags_description")}),e.jsxs("div",{className:"flex flex-wrap gap-2 p-2 bg-theme-bg-secondary rounded-lg min-h-[42px]",children:[c.map((n,i)=>e.jsxs("span",{className:"flex items-center gap-1 px-2 py-1 text-sm text-theme-text-primary bg-white/10 light:bg-black/10 rounded-md",children:[n,e.jsx("button",{type:"button",onClick:()=>C(n),className:"border-none text-theme-text-primary hover:text-theme-text-secondary cursor-pointer",children:e.jsx(S,{size:14})})]},i)),e.jsx("input",{type:"text",value:g,onChange:n=>v(n.target.value),onKeyDown:k,placeholder:t("community_hub.publish.system_prompt.tags_placeholder"),className:"flex-1 min-w-[200px] border-none text-sm bg-transparent text-theme-text-primary placeholder:text-theme-text-placeholder p-0 h-[24px] focus:outline-none"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-white mb-1",children:t("community_hub.publish.system_prompt.visibility_label")}),e.jsx("div",{className:"text-xs text-white/60 mb-2",children:t(j==="public"?"community_hub.publish.system_prompt.public_description":"community_hub.publish.system_prompt.private_description")}),e.jsx("div",{className:"w-fit h-[42px] bg-theme-bg-secondary rounded-lg p-0.5",children:e.jsxs("div",{className:"flex items-center",role:"group",children:[e.jsx("input",{type:"radio",id:"public",name:"visibility",value:"public",className:"peer/public hidden",defaultChecked:!0,onChange:n=>u(n.target.value)}),e.jsx("input",{type:"radio",id:"private",name:"visibility",value:"private",className:"peer/private hidden",onChange:n=>u(n.target.value)}),e.jsx("label",{htmlFor:"public",className:"h-[36px] px-4 rounded-lg text-sm font-medium transition-all duration-200 cursor-pointer text-theme-text-primary hover:text-theme-text-secondary peer-checked/public:bg-theme-sidebar-item-hover peer-checked/public:text-theme-primary-button flex items-center justify-center",children:"Public"}),e.jsx("label",{htmlFor:"private",className:"h-[36px] px-4 rounded-lg text-sm font-medium transition-all duration-200 cursor-pointer text-theme-text-primary hover:text-theme-text-secondary peer-checked/private:bg-theme-sidebar-item-hover peer-checked/private:text-theme-primary-button flex items-center justify-center",children:"Private"})]})})]})]}),e.jsxs("div",{className:"w-1/2 p-6 pt-0 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-white mb-1",children:t("community_hub.publish.system_prompt.prompt_label")}),e.jsx("div",{className:"text-xs text-white/60 mb-2",children:t("community_hub.publish.system_prompt.prompt_description")}),e.jsx("textarea",{name:"prompt",required:!0,minLength:10,defaultValue:s,placeholder:t("community_hub.publish.system_prompt.prompt_placeholder"),className:"border-none w-full bg-theme-bg-secondary rounded-lg p-2 text-white text-sm focus:outline-primary-button active:outline-primary-button outline-none min-h-[300px] placeholder:text-theme-text-placeholder"})]}),e.jsx("button",{type:"submit",disabled:a,className:"border-none w-full bg-cta-button hover:opacity-80 text-theme-text-primary font-medium py-2 px-4 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:t(a?"community_hub.publish.system_prompt.submitting":"community_hub.publish.system_prompt.publish_button")})]})]})]})}function fe({config:s,onConfigChange:t,onDeleteVariable:r}){const a=(h,c)=>{r(c);const b=s.variables.filter((g,v)=>v!==h);t({variables:b})};return e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium text-theme-text-primary",children:"Variables"}),s.variables.map((h,c)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",placeholder:"Variable name",value:h.name,onChange:b=>{const g=[...s.variables];g[c].name=b.target.value,t({variables:g})},className:"flex-1 border-none bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5",autoComplete:"off",spellCheck:!1}),e.jsx("input",{type:"text",placeholder:"Initial value",value:h.value,onChange:b=>{const g=[...s.variables];g[c].value=b.target.value,t({variables:g})},className:"flex-1 border-none bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5",autoComplete:"off",spellCheck:!1}),s.variables.length>1&&e.jsx("button",{onClick:()=>a(c,h.name),className:"p-2.5 rounded-lg border-none bg-theme-settings-input-bg text-theme-text-primary hover:text-red-500 hover:border-red-500/20 hover:bg-red-500/10 transition-colors duration-300",title:"Delete variable",children:e.jsx(S,{className:"w-4 h-4"})}),c===s.variables.length-1&&e.jsx("button",{onClick:()=>{const b=[...s.variables,{name:"",value:""}];t({variables:b})},className:"p-2.5 rounded-lg border-none bg-theme-settings-input-bg text-theme-text-primary hover:bg-theme-action-menu-item-hover transition-colors duration-300",title:"Add variable",children:e.jsx(M,{className:"w-4 h-4"})})]},c))]})}function ve({config:s,onConfigChange:t,renderVariableSelect:r}){const a=d.useRef(null),[h,c]=d.useState(!1),b=d.useRef(null),g=(l,m,p)=>{const x=[...s.headers||[]];x[l]={...x[l],[m]:p},t({headers:x})},v=()=>{const l=[...s.headers||[],{key:"",value:""}];t({headers:l})},j=l=>{const m=[...s.headers||[]].filter((p,x)=>x!==l);t({headers:m})},u=l=>{if(!a.current)return;const m=a.current,p=m.selectionStart,x=m.selectionEnd,w=s.url,k=w.substring(0,p)+"${"+l+"}"+w.substring(x);t({url:k}),c(!1),setTimeout(()=>{const C=p+l.length+3;m.setSelectionRange(C,C),m.focus()},0)};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-theme-text-primary mb-2",children:"URL"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:a,type:"text",placeholder:"https://api.example.com/endpoint",value:s.url,onChange:l=>t({url:l.target.value}),className:"flex-1 border-none bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5",autoComplete:"off",spellCheck:!1}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{ref:b,onClick:()=>c(!h),className:"h-full px-3 rounded-lg border-none bg-theme-settings-input-bg text-theme-text-primary hover:bg-theme-action-menu-item-hover transition-colors duration-300 flex items-center gap-1",title:"Insert variable",children:[e.jsx(M,{className:"w-4 h-4"}),e.jsx($,{className:"w-3 h-3"})]}),h&&e.jsx("div",{className:"absolute right-0 top-[calc(100%+4px)] w-48 bg-theme-settings-input-bg border-none rounded-lg shadow-lg z-10",children:r("",u,"Select variable to insert",!0)})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-theme-text-primary mb-2",children:"Method"}),e.jsx("select",{value:s.method,onChange:l=>t({method:l.target.value}),className:"w-full border-none bg-theme-settings-input-bg text-theme-text-primary text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5",children:["GET","POST","DELETE","PUT","PATCH"].map(l=>e.jsx("option",{value:l,className:"bg-theme-settings-input-bg",children:l},l))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"text-sm font-medium text-theme-text-primary",children:"Headers"}),e.jsx("button",{onClick:v,className:"p-1.5 rounded-lg border-none bg-theme-settings-input-bg text-theme-text-primary hover:bg-theme-action-menu-item-hover transition-colors duration-300",title:"Add header",children:e.jsx(M,{className:"w-3.5 h-3.5"})})]}),e.jsx("div",{className:"space-y-2",children:(s.headers||[]).map((l,m)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",placeholder:"Header name",value:l.key,onChange:p=>g(m,"key",p.target.value),className:"flex-1 border-none bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5",autoComplete:"off",spellCheck:!1}),e.jsx("input",{type:"text",placeholder:"Value",value:l.value,onChange:p=>g(m,"value",p.target.value),className:"flex-1 border-none bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5",autoComplete:"off",spellCheck:!1}),e.jsx("button",{onClick:()=>j(m),className:"p-2.5 rounded-lg border-none bg-theme-settings-input-bg text-theme-text-primary hover:text-red-500 hover:border-red-500/20 hover:bg-red-500/10 transition-colors duration-300",title:"Remove header",children:e.jsx(S,{className:"w-4 h-4"})})]},m))})]}),["POST","PUT","PATCH"].includes(s.method)&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-theme-text-primary mb-2",children:"Request Body"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("select",{value:s.bodyType||"json",onChange:l=>t({bodyType:l.target.value}),className:"w-full p-2.5 text-sm rounded-lg bg-theme-bg-primary border border-white/5 text-theme-text-primary focus:border-primary-button focus:ring-1 focus:ring-primary-button outline-none light:bg-theme-settings-input-bg light:border-black/10",children:[e.jsx("option",{value:"json",className:"bg-theme-bg-primary light:bg-theme-settings-input-bg",children:"JSON"}),e.jsx("option",{value:"text",className:"bg-theme-bg-primary light:bg-theme-settings-input-bg",children:"Raw Text"}),e.jsx("option",{value:"form",className:"bg-theme-bg-primary light:bg-theme-settings-input-bg",children:"Form Data"})]}),s.bodyType==="json"?e.jsx("textarea",{placeholder:'{"key": "value"}',value:s.body,onChange:l=>t({body:l.target.value}),className:"w-full p-2.5 text-sm rounded-lg bg-theme-bg-primary border border-white/5 text-theme-text-primary placeholder:text-theme-text-secondary/20 focus:border-primary-button focus:ring-1 focus:ring-primary-button outline-none light:bg-theme-settings-input-bg light:border-black/10 font-mono",rows:4,autoComplete:"off",spellCheck:!1}):s.bodyType==="form"?e.jsxs("div",{className:"space-y-2",children:[(s.formData||[]).map((l,m)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",placeholder:"Key",value:l.key,onChange:p=>{const x=[...s.formData||[]];x[m]={...l,key:p.target.value},t({formData:x})},className:"flex-1 p-2.5 text-sm rounded-lg bg-theme-bg-primary border border-white/5 text-theme-text-primary placeholder:text-theme-text-secondary/20 focus:border-primary-button focus:ring-1 focus:ring-primary-button outline-none light:bg-theme-settings-input-bg light:border-black/10",autoComplete:"off",spellCheck:!1}),e.jsx("input",{type:"text",placeholder:"Value",value:l.value,onChange:p=>{const x=[...s.formData||[]];x[m]={...l,value:p.target.value},t({formData:x})},className:"flex-1 p-2.5 text-sm rounded-lg bg-theme-bg-primary border border-white/5 text-theme-text-primary placeholder:text-theme-text-secondary/20 focus:border-primary-button focus:ring-1 focus:ring-primary-button outline-none light:bg-theme-settings-input-bg light:border-black/10",autoComplete:"off",spellCheck:!1}),e.jsx("button",{onClick:()=>{const p=[...s.formData||[]].filter((x,w)=>w!==m);t({formData:p})},className:"p-2.5 rounded-lg bg-theme-bg-primary border border-white/5 text-theme-text-primary hover:text-red-500 hover:border-red-500/20 hover:bg-red-500/10 transition-colors duration-300 light:bg-theme-settings-input-bg light:border-black/10",title:"Remove field",children:e.jsx(S,{className:"w-4 h-4"})})]},m)),e.jsx("button",{onClick:()=>{const l=[...s.formData||[],{key:"",value:""}];t({formData:l})},className:"w-full p-2.5 rounded-lg border-none bg-theme-settings-input-bg text-theme-text-primary hover:bg-theme-action-menu-item-hover transition-colors duration-300 text-sm",children:"Add Form Field"})]}):e.jsx("textarea",{placeholder:"Raw request body...",value:s.body,onChange:l=>t({body:l.target.value}),className:"w-full border-none bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5",rows:4,autoComplete:"off",spellCheck:!1})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-theme-text-primary mb-2",children:"Store Response In"}),r(s.responseVariable,l=>t({responseVariable:l}),"Select or create variable")]})]})}function je({config:s,onConfigChange:t,renderVariableSelect:r}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"URL"}),e.jsx("input",{type:"text",placeholder:"https://example.com",value:s.url,onChange:a=>t({url:a.target.value}),className:"w-full p-2.5 text-sm rounded-lg bg-theme-bg-primary border border-white/5 text-white placeholder:text-white/20 focus:border-primary-button focus:ring-1 focus:ring-primary-button outline-none",autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"Action"}),e.jsxs("select",{value:s.action,onChange:a=>t({action:a.target.value}),className:"w-full p-2.5 text-sm rounded-lg bg-theme-bg-primary border border-white/5 text-white focus:border-primary-button focus:ring-1 focus:ring-primary-button outline-none",children:[e.jsx("option",{value:"read",className:"bg-theme-bg-primary",children:"Read Content"}),e.jsx("option",{value:"click",className:"bg-theme-bg-primary",children:"Click Element"}),e.jsx("option",{value:"type",className:"bg-theme-bg-primary",children:"Type Text"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"CSS Selector"}),e.jsx("input",{type:"text",placeholder:"#element-id or .class-name",value:s.selector,onChange:a=>t({selector:a.target.value}),className:"w-full p-2.5 text-sm rounded-lg bg-theme-bg-primary border border-white/5 text-white placeholder:text-white/20 focus:border-primary-button focus:ring-1 focus:ring-primary-button outline-none",autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"Store Result In"}),r(s.resultVariable,a=>t({resultVariable:a}),"Select or create variable")]})]})}function we({config:s,onConfigChange:t,renderVariableSelect:r}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"Operation"}),e.jsxs("select",{value:s.operation,onChange:a=>t({operation:a.target.value}),className:"w-full p-2.5 text-sm rounded-lg bg-theme-bg-primary border border-white/5 text-white focus:border-primary-button focus:ring-1 focus:ring-primary-button outline-none",children:[e.jsx("option",{value:"read",className:"bg-theme-bg-primary",children:"Read File"}),e.jsx("option",{value:"write",className:"bg-theme-bg-primary",children:"Write File"}),e.jsx("option",{value:"append",className:"bg-theme-bg-primary",children:"Append to File"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"File Path"}),e.jsx("input",{type:"text",placeholder:"/path/to/file",value:s.path,onChange:a=>t({path:a.target.value}),className:"w-full p-2.5 text-sm rounded-lg bg-theme-bg-primary border border-white/5 text-white placeholder:text-white/20 focus:border-primary-button focus:ring-1 focus:ring-primary-button outline-none",autoComplete:"off",spellCheck:!1})]}),s.operation!=="read"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"Content"}),e.jsx("textarea",{placeholder:"File content...",value:s.content,onChange:a=>t({content:a.target.value}),className:"w-full p-2.5 text-sm rounded-lg bg-theme-bg-primary border border-white/5 text-white placeholder:text-white/20 focus:border-primary-button focus:ring-1 focus:ring-primary-button outline-none",rows:3,autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"Store Result In"}),r(s.resultVariable,a=>t({resultVariable:a}),"Select or create variable")]})]})}function Ne({config:s,onConfigChange:t,renderVariableSelect:r}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"Language"}),e.jsxs("select",{value:s.language,onChange:a=>t({language:a.target.value}),className:"w-full p-2.5 text-sm rounded-lg bg-theme-bg-primary border border-white/5 text-white focus:border-primary-button focus:ring-1 focus:ring-primary-button outline-none",children:[e.jsx("option",{value:"javascript",className:"bg-theme-bg-primary",children:"JavaScript"}),e.jsx("option",{value:"python",className:"bg-theme-bg-primary",children:"Python"}),e.jsx("option",{value:"shell",className:"bg-theme-bg-primary",children:"Shell"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"Code"}),e.jsx("textarea",{placeholder:"Enter code...",value:s.code,onChange:a=>t({code:a.target.value}),className:"w-full p-2.5 text-sm rounded-lg bg-theme-bg-primary border border-white/5 text-white placeholder:text-white/20 focus:border-primary-button focus:ring-1 focus:ring-primary-button outline-none font-mono",rows:5,autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"Store Result In"}),r(s.resultVariable,a=>t({resultVariable:a}),"Select or create variable")]})]})}function _e({config:s,onConfigChange:t,renderVariableSelect:r}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-theme-text-primary mb-2",children:"Instruction"}),e.jsx("textarea",{value:(s==null?void 0:s.instruction)||"",onChange:a=>t({...s,instruction:a.target.value}),className:"w-full border-none bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5",rows:3,placeholder:"Enter instructions for the LLM..."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-theme-text-primary mb-2",children:"Result Variable"}),r(s.resultVariable,a=>t({...s,resultVariable:a}),"Select or create variable",!0)]})]})}function Se(){return e.jsx("div",{className:"text-sm text-white/60",children:"This is the end of your agent flow. All steps above will be executed in sequence."})}function Ce({config:s,onConfigChange:t,renderVariableSelect:r}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-theme-text-primary mb-2",children:"URL to Scrape"}),e.jsx("input",{type:"url",value:(s==null?void 0:s.url)||"",onChange:a=>t({...s,url:a.target.value}),className:"w-full border-none bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5",placeholder:"https://example.com"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-theme-text-primary mb-2",children:"Capture Page Content As"}),e.jsx("select",{value:s.captureAs,onChange:a=>t({...s,captureAs:a.target.value}),className:"w-full border-none bg-theme-settings-input-bg text-theme-text-primary text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5",children:[{label:"Text content only",value:"text"},{label:"Raw HTML",value:"html"},{label:"CSS Query Selector",value:"querySelector"}].map(a=>e.jsx("option",{value:a.value,className:"bg-theme-settings-input-bg",children:a.label},a.value))})]}),s.captureAs==="querySelector"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-theme-text-primary mb-2",children:"Query Selector"}),e.jsx("p",{className:"text-xs text-theme-text-secondary mb-2",children:"Enter a valid CSS selector to scrape the content of the page."}),e.jsx("input",{value:s.querySelector,onChange:a=>t({...s,querySelector:a.target.value}),placeholder:".article-content, #content, .main-content, etc.",className:"w-full border-none bg-theme-settings-input-bg text-theme-text-primary text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5"})]}),e.jsx(q,{size:"md",variant:"horizontal",label:"Content Summarization",hint:"content-summarization-tooltip",enabled:s.enableSummarization??!0,onChange:a=>t({...s,enableSummarization:a})}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-theme-text-primary mb-2",children:"Result Variable"}),r(s.resultVariable,a=>t({...s,resultVariable:a}),"Select or create variable",!0)]})]})}const z=d.forwardRef(({config:s,onConfigChange:t},r)=>e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-theme-text-primary mb-2",children:"Flow Name"}),e.jsxs("div",{className:"flex flex-col text-xs text-theme-text-secondary mt-2 mb-3",children:[e.jsx("p",{className:"",children:"It is important to give your flow a name that an LLM can easily understand."}),e.jsx("p",{children:'"SendMessageToDiscord", "CheckStockPrice", "CheckWeather"'})]}),e.jsx("input",{id:"agent-flow-name-input",ref:r==null?void 0:r.nameRef,type:"text",placeholder:"Enter flow name",value:(s==null?void 0:s.name)||"",onChange:a=>t({...s,name:a.target.value}),className:"w-full border-none bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5",autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-theme-text-primary mb-2",children:"Description"}),e.jsx("div",{className:"flex flex-col text-xs text-theme-text-secondary mt-2 mb-3",children:e.jsx("p",{className:"",children:"It is equally important to give your flow a description that an LLM can easily understand. Be sure to include the purpose of the flow, the context it will be used in, and any other relevant information."})}),e.jsx("textarea",{ref:r==null?void 0:r.descriptionRef,value:(s==null?void 0:s.description)||"",onChange:a=>t({...s,description:a.target.value}),className:"w-full border-none bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5",rows:3,placeholder:"Enter flow description"})]})]}));z.displayName="FlowInfoNode";const f={FLOW_INFO:"flowInfo",START:"start",API_CALL:"apiCall",LLM_INSTRUCTION:"llmInstruction",WEB_SCRAPING:"webScraping",FINISH:"finish"},F={[f.FLOW_INFO]:{label:"Flow Information",icon:e.jsx(G,{className:"w-5 h-5 text-theme-text-primary"}),description:"Basic flow information",defaultConfig:{name:"",description:""},getSummary:s=>s.name||"Untitled Flow"},[f.START]:{label:"Flow Variables",icon:e.jsx(B,{className:"w-5 h-5 text-theme-text-primary"}),description:"Configure agent variables and settings",getSummary:s=>{var r,a;const t=((a=(r=s.variables)==null?void 0:r.filter(h=>h.name))==null?void 0:a.length)||0;return`${t} variable${t!==1?"s":""} defined`}},[f.API_CALL]:{label:"API Call",icon:e.jsx(J,{className:"w-5 h-5 text-theme-text-primary"}),description:"Make an HTTP request",defaultConfig:{url:"",method:"GET",headers:[],bodyType:"json",body:"",formData:[],responseVariable:"",directOutput:!1},getSummary:s=>`${s.method||"GET"} ${s.url||"(no URL)"}`},[f.LLM_INSTRUCTION]:{label:"LLM Instruction",icon:e.jsx(Y,{className:"w-5 h-5 text-theme-text-primary"}),description:"Process data using LLM instructions",defaultConfig:{instruction:"",resultVariable:"",directOutput:!1},getSummary:s=>s.instruction||"No instruction"},[f.WEB_SCRAPING]:{label:"Web Scraping",icon:e.jsx(X,{className:"w-5 h-5 text-theme-text-primary"}),description:"Scrape content from a webpage",defaultConfig:{url:"",captureAs:"text",querySelector:"",resultVariable:"",directOutput:!1},getSummary:s=>s.url||"No URL specified"},[f.FINISH]:{label:"Flow Complete",icon:e.jsx(W,{className:"w-4 h-4"}),description:"End of agent flow",getSummary:()=>"Flow will end here",defaultConfig:{},renderConfig:()=>null}};function Te({blocks:s,updateBlockConfig:t,removeBlock:r,toggleBlockExpansion:a,renderVariableSelect:h,onDeleteVariable:c,moveBlock:b,refs:g}){const v=u=>{var p;const l=((p=s[s.length-2])==null?void 0:p.id)===u.id,m={config:u.config,onConfigChange:x=>t(u.id,x),renderVariableSelect:h,onDeleteVariable:c};return l&&u.type!==f.START&&u.type!==f.FLOW_INFO?e.jsxs("div",{className:"space-y-4",children:[j(u,m),e.jsx("div",{className:"pt-4 border-t border-white/10",children:e.jsx(q,{size:"md",variant:"horizontal",label:"Direct Output",description:"The output of this block will be returned directly to the chat. This will prevent any further tool calls from being executed.",enabled:m.config.directOutput||!1,onChange:x=>m.onConfigChange({...m.config,directOutput:x})})})]}):j(u,m)},j=(u,l)=>{switch(u.type){case f.FLOW_INFO:return e.jsx(z,{...l,ref:g});case f.START:return e.jsx(fe,{...l});case f.API_CALL:return e.jsx(ve,{...l});case f.WEBSITE:return e.jsx(je,{...l});case f.FILE:return e.jsx(we,{...l});case f.CODE:return e.jsx(Ne,{...l});case f.LLM_INSTRUCTION:return e.jsx(_e,{...l});case f.WEB_SCRAPING:return e.jsx(Ce,{...l});case f.FINISH:return e.jsx(Se,{});default:return e.jsx("div",{children:"Configuration options coming soon..."})}};return e.jsxs("div",{className:"space-y-1",children:[s.map((u,l)=>e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:`bg-theme-action-menu-bg border border-white/10 rounded-lg overflow-hidden transition-all duration-300 ${u.isExpanded?"w-full":"w-[280px] mx-auto"}`,children:[e.jsxs("div",{onClick:()=>a(u.id),className:"w-full p-4 flex items-center justify-between hover:bg-theme-action-menu-item-hover transition-colors duration-300 group cursor-pointer",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-7 h-7 rounded-lg bg-white/10 light:bg-white flex items-center justify-center",children:o.cloneElement(F[u.type].icon,{className:"w-4 h-4 text-white"})}),e.jsxs("div",{className:"flex-1 text-left min-w-0 max-w-[115px]",children:[e.jsx("span",{className:"text-sm font-medium text-white block",children:F[u.type].label}),!u.isExpanded&&e.jsx("p",{className:"text-xs text-white/60 truncate",children:F[u.type].getSummary(u.config)})]})]}),e.jsx("div",{className:"flex items-center",children:u.id!=="start"&&u.type!==f.FINISH&&u.type!==f.FLOW_INFO&&e.jsxs("div",{className:"flex items-center gap-1",children:[l>2&&e.jsx("button",{onClick:m=>{m.stopPropagation(),b(l,l-1)},className:"w-7 h-7 flex items-center justify-center rounded-lg bg-theme-bg-primary border border-white/5 text-white hover:bg-theme-action-menu-item-hover transition-colors duration-300","data-tooltip-id":"block-action","data-tooltip-content":"Move block up",children:e.jsx(U,{className:"w-3.5 h-3.5"})}),l<s.length-2&&e.jsx("button",{onClick:m=>{m.stopPropagation(),b(l,l+1)},className:"w-7 h-7 flex items-center justify-center rounded-lg bg-theme-bg-primary border border-white/5 text-white hover:bg-theme-action-menu-item-hover transition-colors duration-300","data-tooltip-id":"block-action","data-tooltip-content":"Move block down",children:e.jsx($,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:m=>{m.stopPropagation(),r(u.id)},className:"w-7 h-7 flex items-center justify-center rounded-lg bg-theme-bg-primary border border-white/5 text-red-400 hover:bg-red-500/10 hover:border-red-500/20 transition-colors duration-300","data-tooltip-id":"block-action","data-tooltip-content":"Delete block",children:e.jsx(S,{className:"w-3.5 h-3.5"})})]})})]}),e.jsx("div",{className:`overflow-hidden transition-all duration-300 ease-in-out ${u.isExpanded?"max-h-[1000px] opacity-100":"max-h-0 opacity-0"}`,children:e.jsx("div",{className:"border-t border-white/10 p-4 bg-theme-bg-secondary rounded-b-lg",children:v(u)})})]}),l<s.length-1&&e.jsx("div",{className:"flex justify-center my-1",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-white/40 light:invert",children:e.jsx("path",{d:"M12 4L12 20M12 20L6 14M12 20L18 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},u.id)),e.jsx(K,{id:"block-action",place:"bottom",delayShow:300,className:"tooltip !text-xs"})]})}function ke({entity:s}){const{t}=E(),r=d.useRef(null),[a,h]=d.useState(!1),[c,b]=d.useState([]),[g,v]=d.useState(""),[j,u]=d.useState(!1),[l,m]=d.useState(null),[p,x]=d.useState(null),w=async n=>{n.preventDefault(),n.stopPropagation(),h(!0);try{const i=new FormData(r.current),y={name:i.get("name"),description:i.get("description"),tags:c,visibility:"private",flow:JSON.stringify({name:i.get("name"),description:i.get("description"),steps:s.steps,tags:c,visibility:"private"})},{success:N,error:_,itemId:I}=await T.createAgentFlow(y);if(!N)throw new Error(_);m(I),u(!0)}catch(i){console.error("Failed to publish agent flow:",i),A(`Failed to publish agent flow: ${i.message}`,"error",{clear:!0})}finally{h(!1)}},k=n=>{if(n.key==="Enter"||n.key===","){n.preventDefault();const i=g.trim();if(i.length>20)return;i&&!c.includes(i)&&(b(y=>[...y,i].slice(0,5)),v(""))}},C=n=>{b(c.filter(i=>i!==n))};return j?e.jsx("div",{className:"p-6 -mt-12 w-[400px]",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-2",children:[e.jsx("h3",{className:"text-lg font-semibold text-theme-text-primary",children:t("community_hub.publish.agent_flow.success_title")}),e.jsx("p",{className:"text-lg text-theme-text-primary text-center max-w-2xl",children:t("community_hub.publish.agent_flow.success_description")}),e.jsx("p",{className:"text-theme-text-secondary text-center text-sm",children:t("community_hub.publish.agent_flow.success_thank_you")}),e.jsx(V,{to:L.communityHub.viewItem("agent-flow",l),target:"_blank",rel:"noreferrer",className:"w-[265px] bg-theme-bg-secondary hover:bg-theme-sidebar-item-hover text-theme-text-primary py-2 px-4 rounded-lg transition-colors mt-4 text-sm font-semibold text-center",children:t("community_hub.publish.agent_flow.view_on_hub")})]})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-full flex gap-x-2 items-center mb-3 -mt-8",children:e.jsx("h3",{className:"text-xl font-semibold text-theme-text-primary px-6 py-3",children:t("community_hub.publish.agent_flow.modal_title")})}),e.jsxs("form",{ref:r,className:"flex",onSubmit:w,children:[e.jsxs("div",{className:"w-1/2 p-6 pt-0 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-theme-text-primary mb-1",children:t("community_hub.publish.agent_flow.name_label")}),e.jsx("div",{className:"text-xs text-theme-text-secondary mb-2",children:t("community_hub.publish.agent_flow.name_description")}),e.jsx("input",{type:"text",name:"name",required:!0,minLength:3,maxLength:300,defaultValue:s.name,placeholder:t("community_hub.publish.agent_flow.name_placeholder"),className:"border-none w-full bg-theme-bg-secondary rounded-lg p-2 text-theme-text-primary text-sm focus:outline-primary-button active:outline-primary-button outline-none placeholder:text-theme-text-placeholder"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-theme-text-primary mb-1",children:t("community_hub.publish.agent_flow.description_label")}),e.jsx("div",{className:"text-xs text-white/60 mb-2",children:t("community_hub.publish.agent_flow.description_description")}),e.jsx("textarea",{name:"description",required:!0,minLength:10,maxLength:1e3,defaultValue:s.description,placeholder:t("community_hub.publish.agent_flow.description_description"),className:"border-none w-full bg-theme-bg-secondary rounded-lg p-2 text-white text-sm focus:outline-primary-button active:outline-primary-button outline-none min-h-[80px] placeholder:text-theme-text-placeholder"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-white mb-1",children:t("community_hub.publish.agent_flow.tags_label")}),e.jsx("div",{className:"text-xs text-white/60 mb-2",children:t("community_hub.publish.agent_flow.tags_description")}),e.jsxs("div",{className:"flex flex-wrap gap-2 p-2 bg-theme-bg-secondary rounded-lg min-h-[42px]",children:[c.map((n,i)=>e.jsxs("span",{className:"flex items-center gap-1 px-2 py-1 text-sm text-theme-text-primary bg-white/10 light:bg-black/10 rounded-md",children:[n,e.jsx("button",{type:"button",onClick:()=>C(n),className:"border-none text-theme-text-primary hover:text-theme-text-secondary cursor-pointer",children:e.jsx(S,{size:14})})]},i)),e.jsx("input",{type:"text",value:g,onChange:n=>v(n.target.value),onKeyDown:k,placeholder:t("community_hub.publish.agent_flow.tags_placeholder"),className:"flex-1 min-w-[200px] border-none text-sm bg-transparent text-theme-text-primary placeholder:text-theme-text-placeholder p-0 h-[24px] focus:outline-none"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-white",children:t("community_hub.publish.agent_flow.visibility_label")}),e.jsx("span",{className:"text-xs text-theme-text-secondary",children:t("community_hub.publish.agent_flow.privacy_note")})]})]}),e.jsxs("div",{className:"w-1/2 p-6 pt-0 flex flex-col gap-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-theme-text-primary mb-1",children:"Flow Steps"}),e.jsx("div",{className:"text-xs text-white/60",children:"The steps the agent will follow when the flow is triggered."})]}),e.jsx("div",{className:"flex flex-col gap-y-0.5",children:s.steps&&s.steps.length>0?s.steps.map((n,i)=>{const y=F[n.type],N=p===i,_=y!=null&&y.getSummary?y.getSummary(n.config):"";return e.jsxs("div",{className:"flex flex-col items-center w-full",children:[e.jsxs("div",{className:"flex flex-col bg-theme-bg-secondary rounded-lg px-3 py-2 w-full cursor-pointer group",onClick:()=>x(N?null:i),children:[e.jsxs("div",{className:"flex items-center gap-x-3 w-full",children:[e.jsx("span",{children:y==null?void 0:y.icon}),e.jsx("span",{className:"text-theme-text-primary text-sm font-medium flex-1",children:(y==null?void 0:y.label)||n.type}),!N&&e.jsx("span",{className:"text-theme-text-secondary text-xs ml-2 overflow-hidden text-ellipsis whitespace-nowrap max-w-[120px] min-w-0",children:_}),e.jsx("span",{className:`ml-2 text-theme-text-secondary transition-transform duration-200 ${N?"rotate-90":""}`,children:e.jsx(Q,{size:16})})]}),N&&_&&e.jsx("div",{className:"w-full text-theme-text-secondary text-xs mt-1 whitespace-pre-line break-words",children:_})]}),i<s.steps.length-1&&e.jsx("span",{className:"text-theme-text-secondary text-lg my-1",children:"↓"})]},i)}):e.jsx("div",{className:"text-theme-text-secondary text-xs",children:"No steps defined."})}),e.jsx("button",{type:"submit",disabled:a,className:"border-none mt-4 w-full bg-cta-button hover:opacity-80 text-theme-text-primary font-medium py-2 px-4 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:t(a?"community_hub.publish.agent_flow.submitting":"community_hub.publish.agent_flow.submit")})]})]})]})}function Ie({entity:s}){const{t}=E(),r=d.useRef(null),[a,h]=d.useState(!1),[c,b]=d.useState([]),[g,v]=d.useState(""),[j,u]=d.useState("public"),[l,m]=d.useState(!1),[p,x]=d.useState(null),w=async n=>{n.preventDefault(),n.stopPropagation(),h(!0);try{const i=new FormData(r.current),y={name:i.get("name"),description:i.get("description"),command:s.command,prompt:i.get("prompt"),tags:c,visibility:j},{success:N,error:_,itemId:I}=await T.createSlashCommand(y);if(!N)throw new Error(_);x(I),m(!0)}catch(i){console.error("Failed to publish slash command:",i),A(`Failed to publish slash command: ${i.message}`,"error",{clear:!0})}finally{h(!1)}},k=n=>{if(n.key==="Enter"||n.key===","){n.preventDefault();const i=g.trim();if(i.length>20)return;i&&!c.includes(i)&&(b(y=>[...y,i].slice(0,5)),v(""))}},C=n=>{b(c.filter(i=>i!==n))};return l?e.jsx("div",{className:"p-6 -mt-12 w-[400px]",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-2",children:[e.jsx("h3",{className:"text-lg font-semibold text-theme-text-primary",children:t("community_hub.publish.slash_command.success_title")}),e.jsx("p",{className:"text-lg text-theme-text-primary text-center max-w-2xl",children:t("community_hub.publish.slash_command.success_description")}),e.jsx("p",{className:"text-theme-text-secondary text-center text-sm",children:t("community_hub.publish.slash_command.success_thank_you")}),e.jsx(V,{to:L.communityHub.viewItem("slash-command",p),target:"_blank",rel:"noreferrer",className:"w-[265px] bg-theme-bg-secondary hover:bg-theme-sidebar-item-hover text-theme-text-primary py-2 px-4 rounded-lg transition-colors mt-4 text-sm font-semibold text-center",children:t("community_hub.publish.slash_command.view_on_hub")})]})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-full flex gap-x-2 items-center mb-3 -mt-8",children:e.jsxs("h3",{className:"text-xl font-semibold text-theme-text-primary px-6 py-3 flex items-center gap-x-2",children:[t("community_hub.publish.slash_command.modal_title"),e.jsx("code",{className:"bg-theme-bg-secondary rounded-lg px-1 text-theme-text-secondary text-lg font-mono",children:s.command})]})}),e.jsxs("form",{ref:r,className:"flex",onSubmit:w,children:[e.jsxs("div",{className:"w-1/2 p-6 pt-0 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-theme-text-primary mb-1",children:t("community_hub.publish.slash_command.name_label")}),e.jsx("div",{className:"text-xs text-theme-text-secondary mb-2",children:t("community_hub.publish.slash_command.name_description")}),e.jsx("input",{type:"text",name:"name",required:!0,minLength:3,maxLength:300,defaultValue:s.name,placeholder:t("community_hub.publish.slash_command.name_placeholder"),className:"border-none w-full bg-theme-bg-secondary rounded-lg p-2 text-theme-text-primary text-sm focus:outline-primary-button active:outline-primary-button outline-none placeholder:text-theme-text-placeholder"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-theme-text-primary mb-1",children:t("community_hub.publish.slash_command.description_label")}),e.jsx("div",{className:"text-xs text-white/60 mb-2",children:t("community_hub.publish.slash_command.description_description")}),e.jsx("textarea",{name:"description",required:!0,minLength:10,maxLength:1e3,defaultValue:s.description,placeholder:t("community_hub.publish.slash_command.description_description"),className:"border-none w-full bg-theme-bg-secondary rounded-lg p-2 text-white text-sm focus:outline-primary-button active:outline-primary-button outline-none min-h-[80px] placeholder:text-theme-text-placeholder"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-white mb-1",children:t("community_hub.publish.slash_command.tags_label")}),e.jsx("div",{className:"text-xs text-white/60 mb-2",children:t("community_hub.publish.slash_command.tags_description")}),e.jsxs("div",{className:"flex flex-wrap gap-2 p-2 bg-theme-bg-secondary rounded-lg min-h-[42px]",children:[c.map((n,i)=>e.jsxs("span",{className:"flex items-center gap-1 px-2 py-1 text-sm text-theme-text-primary bg-white/10 light:bg-black/10 rounded-md",children:[n,e.jsx("button",{type:"button",onClick:()=>C(n),className:"border-none text-theme-text-primary hover:text-theme-text-secondary cursor-pointer",children:e.jsx(S,{size:14})})]},i)),e.jsx("input",{type:"text",value:g,onChange:n=>v(n.target.value),onKeyDown:k,placeholder:t("community_hub.publish.slash_command.tags_placeholder"),className:"flex-1 min-w-[200px] border-none text-sm bg-transparent text-theme-text-primary placeholder:text-theme-text-placeholder p-0 h-[24px] focus:outline-none"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-white mb-1",children:t("community_hub.publish.slash_command.visibility_label")}),e.jsx("div",{className:"text-xs text-white/60 mb-2",children:t(j==="public"?"community_hub.publish.slash_command.public_description":"community_hub.publish.slash_command.private_description")}),e.jsx("div",{className:"w-fit h-[42px] bg-theme-bg-secondary rounded-lg p-0.5",children:e.jsxs("div",{className:"flex items-center",role:"group",children:[e.jsx("input",{type:"radio",id:"public",name:"visibility",value:"public",className:"peer/public hidden",defaultChecked:!0,onChange:n=>u(n.target.value)}),e.jsx("input",{type:"radio",id:"private",name:"visibility",value:"private",className:"peer/private hidden",onChange:n=>u(n.target.value)}),e.jsx("label",{htmlFor:"public",className:"h-[36px] px-4 rounded-lg text-sm font-medium transition-all duration-200 cursor-pointer text-theme-text-primary hover:text-theme-text-secondary peer-checked/public:bg-theme-sidebar-item-hover peer-checked/public:text-theme-primary-button flex items-center justify-center",children:"Public"}),e.jsx("label",{htmlFor:"private",className:"h-[36px] px-4 rounded-lg text-sm font-medium transition-all duration-200 cursor-pointer text-theme-text-primary hover:text-theme-text-secondary peer-checked/private:bg-theme-sidebar-item-hover peer-checked/private:text-theme-primary-button flex items-center justify-center",children:"Private"})]})})]})]}),e.jsxs("div",{className:"w-1/2 p-6 pt-0 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-white mb-1",children:t("community_hub.publish.slash_command.prompt_label")}),e.jsx("div",{className:"text-xs text-white/60 mb-2",children:t("community_hub.publish.slash_command.prompt_description")}),e.jsx("textarea",{name:"prompt",required:!0,minLength:10,defaultValue:s.prompt,placeholder:t("community_hub.publish.slash_command.prompt_placeholder"),className:"border-none w-full bg-theme-bg-secondary rounded-lg p-2 text-white text-sm focus:outline-primary-button active:outline-primary-button outline-none min-h-[300px] placeholder:text-theme-text-placeholder"})]}),e.jsx("button",{type:"submit",disabled:a,className:"border-none w-full bg-cta-button hover:opacity-80 text-theme-text-primary font-medium py-2 px-4 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:t(a?"community_hub.publish.slash_command.submitting":"community_hub.publish.slash_command.publish_button")})]})]})]})}function Me({show:s,onClose:t,entityType:r,entity:a}){const{isAuthenticated:h,loading:c}=be();if(!s||c)return null;if(!h)return e.jsx(ye,{show:s,onClose:t});const b=()=>{switch(r){case"system-prompt":return e.jsx(ge,{entity:a});case"agent-flow":return e.jsx(ke,{entity:a});case"slash-command":return e.jsx(Ie,{entity:a});default:return null}};return e.jsx(Z,{isOpen:s,children:e.jsxs("div",{className:"relative max-w-[900px] bg-theme-bg-primary rounded-lg shadow border border-theme-modal-border",children:[e.jsx("div",{className:"relative p-6",children:e.jsx("button",{onClick:t,type:"button",className:"absolute top-4 right-4 transition-all duration-300 bg-transparent rounded-lg text-sm p-1 inline-flex items-center hover:bg-theme-modal-border hover:border-theme-modal-border hover:border-opacity-50 border-transparent border",children:e.jsx(S,{size:18,weight:"bold",className:"text-white"})})}),b()]})})}export{F as B,Me as P,f as a,Te as b};
1
+ import{R as o,r as d,g as H,u as E,j as e,M as Z,k as S,v as V,p as L,c as A,I as M,ac as $,aG as q,ab as U,a8 as K,a7 as G,by as J,aF as Q}from"../index.js";import{C as T}from"./communityHub-aba61686.js";import{I as Y}from"./Brain-24e386d5.js";import{I as X}from"./Browser-1820fad0.js";const ee=new Map([["bold",o.createElement(o.Fragment,null,o.createElement("path",{d:"M54.8,119.49A35.06,35.06,0,0,1,49.05,128a35.06,35.06,0,0,1,5.75,8.51C60,147.24,60,159.83,60,172c0,25.94,1.84,32,20,32a12,12,0,0,1,0,24c-19.14,0-32.2-6.9-38.8-20.51C36,196.76,36,184.17,36,172c0-25.94-1.84-32-20-32a12,12,0,0,1,0-24c18.16,0,20-6.06,20-32,0-12.17,0-24.76,5.2-35.49C47.8,34.9,60.86,28,80,28a12,12,0,0,1,0,24c-18.16,0-20,6.06-20,32C60,96.17,60,108.76,54.8,119.49ZM240,116c-18.16,0-20-6.06-20-32,0-12.17,0-24.76-5.2-35.49C208.2,34.9,195.14,28,176,28a12,12,0,0,0,0,24c18.16,0,20,6.06,20,32,0,12.17,0,24.76,5.2,35.49A35.06,35.06,0,0,0,207,128a35.06,35.06,0,0,0-5.75,8.51C196,147.24,196,159.83,196,172c0,25.94-1.84,32-20,32a12,12,0,0,0,0,24c19.14,0,32.2-6.9,38.8-20.51C220,196.76,220,184.17,220,172c0-25.94,1.84-32,20-32a12,12,0,0,0,0-24Z"}))],["duotone",o.createElement(o.Fragment,null,o.createElement("path",{d:"M240,128c-64,0,0,88-64,88H80c-64,0,0-88-64-88,64,0,0-88,64-88h96C240,40,176,128,240,128Z",opacity:"0.2"}),o.createElement("path",{d:"M43.18,128a29.78,29.78,0,0,1,8,10.26c4.8,9.9,4.8,22,4.8,33.74,0,24.31,1,36,24,36a8,8,0,0,1,0,16c-17.48,0-29.32-6.14-35.2-18.26-4.8-9.9-4.8-22-4.8-33.74,0-24.31-1-36-24-36a8,8,0,0,1,0-16c23,0,24-11.69,24-36,0-11.72,0-23.84,4.8-33.74C50.68,38.14,62.52,32,80,32a8,8,0,0,1,0,16C57,48,56,59.69,56,84c0,11.72,0,23.84-4.8,33.74A29.78,29.78,0,0,1,43.18,128ZM240,120c-23,0-24-11.69-24-36,0-11.72,0-23.84-4.8-33.74C205.32,38.14,193.48,32,176,32a8,8,0,0,0,0,16c23,0,24,11.69,24,36,0,11.72,0,23.84,4.8,33.74a29.78,29.78,0,0,0,8,10.26,29.78,29.78,0,0,0-8,10.26c-4.8,9.9-4.8,22-4.8,33.74,0,24.31-1,36-24,36a8,8,0,0,0,0,16c17.48,0,29.32-6.14,35.2-18.26,4.8-9.9,4.8-22,4.8-33.74,0-24.31,1-36,24-36a8,8,0,0,0,0-16Z"}))],["fill",o.createElement(o.Fragment,null,o.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM88,155.84c.29,14.26.41,20.16,16,20.16a8,8,0,0,1,0,16c-31.27,0-31.72-22.43-32-35.84C71.71,141.9,71.59,136,56,136a8,8,0,0,1,0-16c15.59,0,15.71-5.9,16-20.16C72.28,86.43,72.73,64,104,64a8,8,0,0,1,0,16c-15.59,0-15.71,5.9-16,20.16-.17,8.31-.41,20.09-8,27.84C87.59,135.75,87.83,147.53,88,155.84ZM200,136c-15.59,0-15.71,5.9-16,20.16-.28,13.41-.73,35.84-32,35.84a8,8,0,0,1,0-16c15.59,0,15.71-5.9,16-20.16.17-8.31.41-20.09,8-27.84-7.6-7.75-7.84-19.53-8-27.84C167.71,85.9,167.59,80,152,80a8,8,0,0,1,0-16c31.27,0,31.72,22.43,32,35.84.29,14.26.41,20.16,16,20.16a8,8,0,0,1,0,16Z"}))],["light",o.createElement(o.Fragment,null,o.createElement("path",{d:"M39.91,128a27.68,27.68,0,0,1,9.49,11.13C54,148.62,54,160.51,54,172c0,24.27,1.21,38,26,38a6,6,0,0,1,0,12c-16.88,0-27.81-5.6-33.4-17.13C42,195.38,42,183.49,42,172c0-24.27-1.21-38-26-38a6,6,0,0,1,0-12c24.79,0,26-13.73,26-38,0-11.49,0-23.38,4.6-32.87C52.19,39.6,63.12,34,80,34a6,6,0,0,1,0,12C55.21,46,54,59.73,54,84c0,11.49,0,23.38-4.6,32.87A27.68,27.68,0,0,1,39.91,128ZM240,122c-24.79,0-26-13.73-26-38,0-11.49,0-23.38-4.6-32.87C203.81,39.6,192.88,34,176,34a6,6,0,0,0,0,12c24.79,0,26,13.73,26,38,0,11.49,0,23.38,4.6,32.87A27.68,27.68,0,0,0,216.09,128a27.68,27.68,0,0,0-9.49,11.13C202,148.62,202,160.51,202,172c0,24.27-1.21,38-26,38a6,6,0,0,0,0,12c16.88,0,27.81-5.6,33.4-17.13,4.6-9.49,4.6-21.38,4.6-32.87,0-24.27,1.21-38,26-38a6,6,0,0,0,0-12Z"}))],["regular",o.createElement(o.Fragment,null,o.createElement("path",{d:"M43.18,128a29.78,29.78,0,0,1,8,10.26c4.8,9.9,4.8,22,4.8,33.74,0,24.31,1,36,24,36a8,8,0,0,1,0,16c-17.48,0-29.32-6.14-35.2-18.26-4.8-9.9-4.8-22-4.8-33.74,0-24.31-1-36-24-36a8,8,0,0,1,0-16c23,0,24-11.69,24-36,0-11.72,0-23.84,4.8-33.74C50.68,38.14,62.52,32,80,32a8,8,0,0,1,0,16C57,48,56,59.69,56,84c0,11.72,0,23.84-4.8,33.74A29.78,29.78,0,0,1,43.18,128ZM240,120c-23,0-24-11.69-24-36,0-11.72,0-23.84-4.8-33.74C205.32,38.14,193.48,32,176,32a8,8,0,0,0,0,16c23,0,24,11.69,24,36,0,11.72,0,23.84,4.8,33.74a29.78,29.78,0,0,0,8,10.26,29.78,29.78,0,0,0-8,10.26c-4.8,9.9-4.8,22-4.8,33.74,0,24.31-1,36-24,36a8,8,0,0,0,0,16c17.48,0,29.32-6.14,35.2-18.26,4.8-9.9,4.8-22,4.8-33.74,0-24.31,1-36,24-36a8,8,0,0,0,0-16Z"}))],["thin",o.createElement(o.Fragment,null,o.createElement("path",{d:"M35.89,128C52,136.23,52,155.64,52,172c0,24.8,1.35,40,28,40a4,4,0,0,1,0,8c-36,0-36-26.61-36-48,0-24.8-1.35-40-28-40a4,4,0,0,1,0-8c26.65,0,28-15.2,28-40,0-21.39,0-48,36-48a4,4,0,0,1,0,8C53.35,44,52,59.2,52,84,52,100.36,52,119.77,35.89,128ZM240,124c-26.65,0-28-15.2-28-40,0-21.39,0-48-36-48a4,4,0,0,0,0,8c26.65,0,28,15.2,28,40,0,16.36,0,35.77,16.11,44C204,136.23,204,155.64,204,172c0,24.8-1.35,40-28,40a4,4,0,0,0,0,8c36,0,36-26.61,36-48,0-24.8,1.35-40,28-40a4,4,0,0,0,0-8Z"}))]]);var te=Object.defineProperty,se=Object.defineProperties,ae=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,re=Object.prototype.hasOwnProperty,le=Object.prototype.propertyIsEnumerable,O=(s,t,r)=>t in s?te(s,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[t]=r,ne=(s,t)=>{for(var r in t||(t={}))re.call(t,r)&&O(s,r,t[r]);if(R)for(var r of R(t))le.call(t,r)&&O(s,r,t[r]);return s},ie=(s,t)=>se(s,ae(t));const B=d.forwardRef((s,t)=>o.createElement(H,ie(ne({ref:t},s),{weights:ee})));B.displayName="BracketsCurly";const oe=new Map([["bold",o.createElement(o.Fragment,null,o.createElement("path",{d:"M40.14,46.88A12,12,0,0,0,36,56V224a12,12,0,0,0,24,0V181.72c22.84-17.12,42.1-9.12,70.68,5,16.23,8,34.74,17.2,54.8,17.2,14.72,0,30.28-4.94,46.38-18.88A12,12,0,0,0,236,176V56a12,12,0,0,0-19.86-9.07c-24.71,21.41-44.53,13.31-74.82-1.68C113.19,31.27,78.17,13.94,40.14,46.88ZM212,170.26c-22.84,17.13-42.1,9.11-70.68-5C118.16,153.76,90.33,140,60,153.87V61.69c22.84-17.12,42.1-9.12,70.68,5,16.23,8,34.74,17.2,54.8,17.2A63,63,0,0,0,212,78.08Z"}))],["duotone",o.createElement(o.Fragment,null,o.createElement("path",{d:"M224,56V176c-64,55.43-112-55.43-176,0V56C112,.57,160,111.43,224,56Z",opacity:"0.2"}),o.createElement("path",{d:"M42.76,50A8,8,0,0,0,40,56V224a8,8,0,0,0,16,0V179.77c26.79-21.16,49.87-9.75,76.45,3.41,16.4,8.11,34.06,16.85,53,16.85,13.93,0,28.54-4.75,43.82-18a8,8,0,0,0,2.76-6V56A8,8,0,0,0,218.76,50c-28,24.23-51.72,12.49-79.21-1.12C111.07,34.76,78.78,18.79,42.76,50ZM216,172.25c-26.79,21.16-49.87,9.74-76.45-3.41-25-12.35-52.81-26.13-83.55-8.4V59.79c26.79-21.16,49.87-9.75,76.45,3.4,25,12.35,52.82,26.13,83.55,8.4Z"}))],["fill",o.createElement(o.Fragment,null,o.createElement("path",{d:"M232,56V176a8,8,0,0,1-2.76,6c-15.28,13.23-29.89,18-43.82,18-18.91,0-36.57-8.74-53-16.85C105.87,170,82.79,158.61,56,179.77V224a8,8,0,0,1-16,0V56a8,8,0,0,1,2.77-6h0c36-31.18,68.31-15.21,96.79-1.12C167,62.46,190.79,74.2,218.76,50A8,8,0,0,1,232,56Z"}))],["light",o.createElement(o.Fragment,null,o.createElement("path",{d:"M44.08,51.37A6,6,0,0,0,42,55.9V224a6,6,0,0,0,12,0V178.78c28.08-22.79,51.88-11,79.34,2.57,16.12,8,33.49,16.58,52,16.58,13.57,0,27.76-4.6,42.56-17.42A6,6,0,0,0,230,176V55.9a6,6,0,0,0-9.93-4.54c-29,25.12-53.28,13.09-81.41-.84C110.77,36.71,79,21.16,44.08,51.37ZM218,173.17c-28.08,22.8-51.88,11-79.34-2.58C113.4,158.08,85.09,144.07,54,164V58.72c28.08-22.8,51.88-11,79.34,2.56C158.6,73.79,186.91,87.8,218,67.91Z"}))],["regular",o.createElement(o.Fragment,null,o.createElement("path",{d:"M42.76,50A8,8,0,0,0,40,56V224a8,8,0,0,0,16,0V179.77c26.79-21.16,49.87-9.75,76.45,3.41,16.4,8.11,34.06,16.85,53,16.85,13.93,0,28.54-4.75,43.82-18a8,8,0,0,0,2.76-6V56A8,8,0,0,0,218.76,50c-28,24.23-51.72,12.49-79.21-1.12C111.07,34.76,78.78,18.79,42.76,50ZM216,172.25c-26.79,21.16-49.87,9.74-76.45-3.41-25-12.35-52.81-26.13-83.55-8.4V59.79c26.79-21.16,49.87-9.75,76.45,3.4,25,12.35,52.82,26.13,83.55,8.4Z"}))],["thin",o.createElement(o.Fragment,null,o.createElement("path",{d:"M45.39,53.06a4,4,0,0,0-1.39,3V224a4,4,0,0,0,8,0V177.87c29.41-24.39,55.08-11.69,82.23,1.73,16.5,8.17,33.33,16.5,51.13,16.5,13.14,0,26.81-4.55,41.26-17.06a4,4,0,0,0,1.38-3v-120a4,4,0,0,0-6.62-3c-30,26-56,13.07-83.61-.57C109.07,38.28,79.4,23.62,45.39,53.06ZM220,174.17c-29.41,24.4-55.08,11.7-82.23-1.73-26.82-13.27-54.5-27-85.77-4.66V57.92c29.41-24.4,55.08-11.7,82.23,1.73,26.82,13.27,54.5,27,85.77,4.66Z"}))]]);var me=Object.defineProperty,ce=Object.defineProperties,ue=Object.getOwnPropertyDescriptors,P=Object.getOwnPropertySymbols,de=Object.prototype.hasOwnProperty,he=Object.prototype.propertyIsEnumerable,D=(s,t,r)=>t in s?me(s,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[t]=r,pe=(s,t)=>{for(var r in t||(t={}))de.call(t,r)&&D(s,r,t[r]);if(P)for(var r of P(t))he.call(t,r)&&D(s,r,t[r]);return s},xe=(s,t)=>ce(s,ue(t));const W=d.forwardRef((s,t)=>o.createElement(H,xe(pe({ref:t},s),{weights:oe})));W.displayName="Flag";function be(){const[s,t]=d.useState(!1),[r,a]=d.useState(!0);return d.useEffect(()=>{async function h(){a(!0);try{const{connectionKey:c}=await T.getSettings();t(!!c)}catch(c){console.error("Error checking hub auth:",c),t(!1)}finally{a(!1)}}h()},[]),{isAuthenticated:s,loading:r}}function ye({show:s,onClose:t}){const{t:r}=E();return s?e.jsx(Z,{isOpen:s,children:e.jsx("div",{className:"relative w-[400px] max-w-full bg-theme-bg-primary rounded-lg shadow border border-theme-modal-border",children:e.jsxs("div",{className:"p-6",children:[e.jsx("button",{onClick:t,type:"button",className:"absolute top-4 right-4 transition-all duration-300 bg-transparent rounded-lg text-sm p-1 inline-flex items-center hover:bg-theme-modal-border hover:border-theme-modal-border hover:border-opacity-50 border-transparent border",children:e.jsx(S,{size:18,weight:"bold",className:"text-white"})}),e.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-white",children:r("community_hub.publish.generic.unauthenticated.title")}),e.jsx("p",{className:"text-lg text-white text-center max-w-[300px]",children:r("community_hub.publish.generic.unauthenticated.description")}),e.jsx(V,{to:L.communityHub.authentication(),className:"w-[265px] bg-theme-bg-secondary hover:bg-theme-sidebar-item-hover text-theme-text-primary py-2 px-4 rounded-lg transition-colors mt-4 text-sm font-semibold text-center",children:r("community_hub.publish.generic.unauthenticated.button")})]})]})})}):null}function ge({entity:s}){const{t}=E(),r=d.useRef(null),[a,h]=d.useState(!1),[c,b]=d.useState([]),[g,v]=d.useState(""),[j,u]=d.useState("public"),[l,m]=d.useState(!1),[p,x]=d.useState(null),w=async n=>{n.preventDefault(),n.stopPropagation(),h(!0);try{const i=new FormData(r.current),y={name:i.get("name"),description:i.get("description"),prompt:i.get("prompt"),tags:c,visibility:j},{success:N,error:_,itemId:I}=await T.createSystemPrompt(y);if(!N)throw new Error(_);x(I),m(!0)}catch(i){console.error("Failed to publish prompt:",i),A(`Failed to publish prompt: ${i.message}`,"error",{clear:!0})}finally{h(!1)}},k=n=>{if(n.key==="Enter"||n.key===","){n.preventDefault();const i=g.trim();if(i.length>20)return;i&&!c.includes(i)&&(b(y=>[...y,i].slice(0,5)),v(""))}},C=n=>{b(c.filter(i=>i!==n))};return l?e.jsx("div",{className:"p-6 -mt-12 w-[400px]",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-2",children:[e.jsx("h3",{className:"text-lg font-semibold text-theme-text-primary",children:t("community_hub.publish.system_prompt.success_title")}),e.jsx("p",{className:"text-lg text-theme-text-primary text-center max-w-2xl",children:t("community_hub.publish.system_prompt.success_description")}),e.jsx("p",{className:"text-theme-text-secondary text-center text-sm",children:t("community_hub.publish.system_prompt.success_thank_you")}),e.jsx(V,{to:L.communityHub.viewItem("system-prompt",p),target:"_blank",rel:"noreferrer",className:"w-[265px] bg-theme-bg-secondary hover:bg-theme-sidebar-item-hover text-theme-text-primary py-2 px-4 rounded-lg transition-colors mt-4 text-sm font-semibold text-center",children:t("community_hub.publish.system_prompt.view_on_hub")})]})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-full flex gap-x-2 items-center mb-3 -mt-8",children:e.jsx("h3",{className:"text-xl font-semibold text-theme-text-primary px-6 py-3",children:t("community_hub.publish.system_prompt.modal_title")})}),e.jsxs("form",{ref:r,className:"flex",onSubmit:w,children:[e.jsxs("div",{className:"w-1/2 p-6 pt-0 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-theme-text-primary mb-1",children:t("community_hub.publish.system_prompt.name_label")}),e.jsx("div",{className:"text-xs text-theme-text-secondary mb-2",children:t("community_hub.publish.system_prompt.name_description")}),e.jsx("input",{type:"text",name:"name",required:!0,minLength:3,maxLength:300,placeholder:t("community_hub.publish.system_prompt.name_placeholder"),className:"border-none w-full bg-theme-bg-secondary rounded-lg p-2 text-theme-text-primary text-sm focus:outline-primary-button active:outline-primary-button outline-none placeholder:text-theme-text-placeholder"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-theme-text-primary mb-1",children:t("community_hub.publish.system_prompt.description_label")}),e.jsx("div",{className:"text-xs text-white/60 mb-2",children:t("community_hub.publish.system_prompt.description_description")}),e.jsx("textarea",{name:"description",required:!0,minLength:10,maxLength:1e3,placeholder:t("community_hub.publish.system_prompt.description_description"),className:"border-none w-full bg-theme-bg-secondary rounded-lg p-2 text-white text-sm focus:outline-primary-button active:outline-primary-button outline-none min-h-[80px] placeholder:text-theme-text-placeholder"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-white mb-1",children:t("community_hub.publish.system_prompt.tags_label")}),e.jsx("div",{className:"text-xs text-white/60 mb-2",children:t("community_hub.publish.system_prompt.tags_description")}),e.jsxs("div",{className:"flex flex-wrap gap-2 p-2 bg-theme-bg-secondary rounded-lg min-h-[42px]",children:[c.map((n,i)=>e.jsxs("span",{className:"flex items-center gap-1 px-2 py-1 text-sm text-theme-text-primary bg-white/10 light:bg-black/10 rounded-md",children:[n,e.jsx("button",{type:"button",onClick:()=>C(n),className:"border-none text-theme-text-primary hover:text-theme-text-secondary cursor-pointer",children:e.jsx(S,{size:14})})]},i)),e.jsx("input",{type:"text",value:g,onChange:n=>v(n.target.value),onKeyDown:k,placeholder:t("community_hub.publish.system_prompt.tags_placeholder"),className:"flex-1 min-w-[200px] border-none text-sm bg-transparent text-theme-text-primary placeholder:text-theme-text-placeholder p-0 h-[24px] focus:outline-none"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-white mb-1",children:t("community_hub.publish.system_prompt.visibility_label")}),e.jsx("div",{className:"text-xs text-white/60 mb-2",children:t(j==="public"?"community_hub.publish.system_prompt.public_description":"community_hub.publish.system_prompt.private_description")}),e.jsx("div",{className:"w-fit h-[42px] bg-theme-bg-secondary rounded-lg p-0.5",children:e.jsxs("div",{className:"flex items-center",role:"group",children:[e.jsx("input",{type:"radio",id:"public",name:"visibility",value:"public",className:"peer/public hidden",defaultChecked:!0,onChange:n=>u(n.target.value)}),e.jsx("input",{type:"radio",id:"private",name:"visibility",value:"private",className:"peer/private hidden",onChange:n=>u(n.target.value)}),e.jsx("label",{htmlFor:"public",className:"h-[36px] px-4 rounded-lg text-sm font-medium transition-all duration-200 cursor-pointer text-theme-text-primary hover:text-theme-text-secondary peer-checked/public:bg-theme-sidebar-item-hover peer-checked/public:text-theme-primary-button flex items-center justify-center",children:"Public"}),e.jsx("label",{htmlFor:"private",className:"h-[36px] px-4 rounded-lg text-sm font-medium transition-all duration-200 cursor-pointer text-theme-text-primary hover:text-theme-text-secondary peer-checked/private:bg-theme-sidebar-item-hover peer-checked/private:text-theme-primary-button flex items-center justify-center",children:"Private"})]})})]})]}),e.jsxs("div",{className:"w-1/2 p-6 pt-0 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-white mb-1",children:t("community_hub.publish.system_prompt.prompt_label")}),e.jsx("div",{className:"text-xs text-white/60 mb-2",children:t("community_hub.publish.system_prompt.prompt_description")}),e.jsx("textarea",{name:"prompt",required:!0,minLength:10,defaultValue:s,placeholder:t("community_hub.publish.system_prompt.prompt_placeholder"),className:"border-none w-full bg-theme-bg-secondary rounded-lg p-2 text-white text-sm focus:outline-primary-button active:outline-primary-button outline-none min-h-[300px] placeholder:text-theme-text-placeholder"})]}),e.jsx("button",{type:"submit",disabled:a,className:"border-none w-full bg-cta-button hover:opacity-80 text-theme-text-primary font-medium py-2 px-4 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:t(a?"community_hub.publish.system_prompt.submitting":"community_hub.publish.system_prompt.publish_button")})]})]})]})}function fe({config:s,onConfigChange:t,onDeleteVariable:r}){const a=(h,c)=>{r(c);const b=s.variables.filter((g,v)=>v!==h);t({variables:b})};return e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium text-theme-text-primary",children:"Variables"}),s.variables.map((h,c)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",placeholder:"Variable name",value:h.name,onChange:b=>{const g=[...s.variables];g[c].name=b.target.value,t({variables:g})},className:"flex-1 border-none bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5",autoComplete:"off",spellCheck:!1}),e.jsx("input",{type:"text",placeholder:"Initial value",value:h.value,onChange:b=>{const g=[...s.variables];g[c].value=b.target.value,t({variables:g})},className:"flex-1 border-none bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5",autoComplete:"off",spellCheck:!1}),s.variables.length>1&&e.jsx("button",{onClick:()=>a(c,h.name),className:"p-2.5 rounded-lg border-none bg-theme-settings-input-bg text-theme-text-primary hover:text-red-500 hover:border-red-500/20 hover:bg-red-500/10 transition-colors duration-300",title:"Delete variable",children:e.jsx(S,{className:"w-4 h-4"})}),c===s.variables.length-1&&e.jsx("button",{onClick:()=>{const b=[...s.variables,{name:"",value:""}];t({variables:b})},className:"p-2.5 rounded-lg border-none bg-theme-settings-input-bg text-theme-text-primary hover:bg-theme-action-menu-item-hover transition-colors duration-300",title:"Add variable",children:e.jsx(M,{className:"w-4 h-4"})})]},c))]})}function ve({config:s,onConfigChange:t,renderVariableSelect:r}){const a=d.useRef(null),[h,c]=d.useState(!1),b=d.useRef(null),g=(l,m,p)=>{const x=[...s.headers||[]];x[l]={...x[l],[m]:p},t({headers:x})},v=()=>{const l=[...s.headers||[],{key:"",value:""}];t({headers:l})},j=l=>{const m=[...s.headers||[]].filter((p,x)=>x!==l);t({headers:m})},u=l=>{if(!a.current)return;const m=a.current,p=m.selectionStart,x=m.selectionEnd,w=s.url,k=w.substring(0,p)+"${"+l+"}"+w.substring(x);t({url:k}),c(!1),setTimeout(()=>{const C=p+l.length+3;m.setSelectionRange(C,C),m.focus()},0)};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-theme-text-primary mb-2",children:"URL"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:a,type:"text",placeholder:"https://api.example.com/endpoint",value:s.url,onChange:l=>t({url:l.target.value}),className:"flex-1 border-none bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5",autoComplete:"off",spellCheck:!1}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{ref:b,onClick:()=>c(!h),className:"h-full px-3 rounded-lg border-none bg-theme-settings-input-bg text-theme-text-primary hover:bg-theme-action-menu-item-hover transition-colors duration-300 flex items-center gap-1",title:"Insert variable",children:[e.jsx(M,{className:"w-4 h-4"}),e.jsx($,{className:"w-3 h-3"})]}),h&&e.jsx("div",{className:"absolute right-0 top-[calc(100%+4px)] w-48 bg-theme-settings-input-bg border-none rounded-lg shadow-lg z-10",children:r("",u,"Select variable to insert",!0)})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-theme-text-primary mb-2",children:"Method"}),e.jsx("select",{value:s.method,onChange:l=>t({method:l.target.value}),className:"w-full border-none bg-theme-settings-input-bg text-theme-text-primary text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5",children:["GET","POST","DELETE","PUT","PATCH"].map(l=>e.jsx("option",{value:l,className:"bg-theme-settings-input-bg",children:l},l))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"text-sm font-medium text-theme-text-primary",children:"Headers"}),e.jsx("button",{onClick:v,className:"p-1.5 rounded-lg border-none bg-theme-settings-input-bg text-theme-text-primary hover:bg-theme-action-menu-item-hover transition-colors duration-300",title:"Add header",children:e.jsx(M,{className:"w-3.5 h-3.5"})})]}),e.jsx("div",{className:"space-y-2",children:(s.headers||[]).map((l,m)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",placeholder:"Header name",value:l.key,onChange:p=>g(m,"key",p.target.value),className:"flex-1 border-none bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5",autoComplete:"off",spellCheck:!1}),e.jsx("input",{type:"text",placeholder:"Value",value:l.value,onChange:p=>g(m,"value",p.target.value),className:"flex-1 border-none bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5",autoComplete:"off",spellCheck:!1}),e.jsx("button",{onClick:()=>j(m),className:"p-2.5 rounded-lg border-none bg-theme-settings-input-bg text-theme-text-primary hover:text-red-500 hover:border-red-500/20 hover:bg-red-500/10 transition-colors duration-300",title:"Remove header",children:e.jsx(S,{className:"w-4 h-4"})})]},m))})]}),["POST","PUT","PATCH"].includes(s.method)&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-theme-text-primary mb-2",children:"Request Body"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("select",{value:s.bodyType||"json",onChange:l=>t({bodyType:l.target.value}),className:"w-full p-2.5 text-sm rounded-lg bg-theme-bg-primary border border-white/5 text-theme-text-primary focus:border-primary-button focus:ring-1 focus:ring-primary-button outline-none light:bg-theme-settings-input-bg light:border-black/10",children:[e.jsx("option",{value:"json",className:"bg-theme-bg-primary light:bg-theme-settings-input-bg",children:"JSON"}),e.jsx("option",{value:"text",className:"bg-theme-bg-primary light:bg-theme-settings-input-bg",children:"Raw Text"}),e.jsx("option",{value:"form",className:"bg-theme-bg-primary light:bg-theme-settings-input-bg",children:"Form Data"})]}),s.bodyType==="json"?e.jsx("textarea",{placeholder:'{"key": "value"}',value:s.body,onChange:l=>t({body:l.target.value}),className:"w-full p-2.5 text-sm rounded-lg bg-theme-bg-primary border border-white/5 text-theme-text-primary placeholder:text-theme-text-secondary/20 focus:border-primary-button focus:ring-1 focus:ring-primary-button outline-none light:bg-theme-settings-input-bg light:border-black/10 font-mono",rows:4,autoComplete:"off",spellCheck:!1}):s.bodyType==="form"?e.jsxs("div",{className:"space-y-2",children:[(s.formData||[]).map((l,m)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",placeholder:"Key",value:l.key,onChange:p=>{const x=[...s.formData||[]];x[m]={...l,key:p.target.value},t({formData:x})},className:"flex-1 p-2.5 text-sm rounded-lg bg-theme-bg-primary border border-white/5 text-theme-text-primary placeholder:text-theme-text-secondary/20 focus:border-primary-button focus:ring-1 focus:ring-primary-button outline-none light:bg-theme-settings-input-bg light:border-black/10",autoComplete:"off",spellCheck:!1}),e.jsx("input",{type:"text",placeholder:"Value",value:l.value,onChange:p=>{const x=[...s.formData||[]];x[m]={...l,value:p.target.value},t({formData:x})},className:"flex-1 p-2.5 text-sm rounded-lg bg-theme-bg-primary border border-white/5 text-theme-text-primary placeholder:text-theme-text-secondary/20 focus:border-primary-button focus:ring-1 focus:ring-primary-button outline-none light:bg-theme-settings-input-bg light:border-black/10",autoComplete:"off",spellCheck:!1}),e.jsx("button",{onClick:()=>{const p=[...s.formData||[]].filter((x,w)=>w!==m);t({formData:p})},className:"p-2.5 rounded-lg bg-theme-bg-primary border border-white/5 text-theme-text-primary hover:text-red-500 hover:border-red-500/20 hover:bg-red-500/10 transition-colors duration-300 light:bg-theme-settings-input-bg light:border-black/10",title:"Remove field",children:e.jsx(S,{className:"w-4 h-4"})})]},m)),e.jsx("button",{onClick:()=>{const l=[...s.formData||[],{key:"",value:""}];t({formData:l})},className:"w-full p-2.5 rounded-lg border-none bg-theme-settings-input-bg text-theme-text-primary hover:bg-theme-action-menu-item-hover transition-colors duration-300 text-sm",children:"Add Form Field"})]}):e.jsx("textarea",{placeholder:"Raw request body...",value:s.body,onChange:l=>t({body:l.target.value}),className:"w-full border-none bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5",rows:4,autoComplete:"off",spellCheck:!1})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-theme-text-primary mb-2",children:"Store Response In"}),r(s.responseVariable,l=>t({responseVariable:l}),"Select or create variable")]})]})}function je({config:s,onConfigChange:t,renderVariableSelect:r}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"URL"}),e.jsx("input",{type:"text",placeholder:"https://example.com",value:s.url,onChange:a=>t({url:a.target.value}),className:"w-full p-2.5 text-sm rounded-lg bg-theme-bg-primary border border-white/5 text-white placeholder:text-white/20 focus:border-primary-button focus:ring-1 focus:ring-primary-button outline-none",autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"Action"}),e.jsxs("select",{value:s.action,onChange:a=>t({action:a.target.value}),className:"w-full p-2.5 text-sm rounded-lg bg-theme-bg-primary border border-white/5 text-white focus:border-primary-button focus:ring-1 focus:ring-primary-button outline-none",children:[e.jsx("option",{value:"read",className:"bg-theme-bg-primary",children:"Read Content"}),e.jsx("option",{value:"click",className:"bg-theme-bg-primary",children:"Click Element"}),e.jsx("option",{value:"type",className:"bg-theme-bg-primary",children:"Type Text"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"CSS Selector"}),e.jsx("input",{type:"text",placeholder:"#element-id or .class-name",value:s.selector,onChange:a=>t({selector:a.target.value}),className:"w-full p-2.5 text-sm rounded-lg bg-theme-bg-primary border border-white/5 text-white placeholder:text-white/20 focus:border-primary-button focus:ring-1 focus:ring-primary-button outline-none",autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"Store Result In"}),r(s.resultVariable,a=>t({resultVariable:a}),"Select or create variable")]})]})}function we({config:s,onConfigChange:t,renderVariableSelect:r}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"Operation"}),e.jsxs("select",{value:s.operation,onChange:a=>t({operation:a.target.value}),className:"w-full p-2.5 text-sm rounded-lg bg-theme-bg-primary border border-white/5 text-white focus:border-primary-button focus:ring-1 focus:ring-primary-button outline-none",children:[e.jsx("option",{value:"read",className:"bg-theme-bg-primary",children:"Read File"}),e.jsx("option",{value:"write",className:"bg-theme-bg-primary",children:"Write File"}),e.jsx("option",{value:"append",className:"bg-theme-bg-primary",children:"Append to File"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"File Path"}),e.jsx("input",{type:"text",placeholder:"/path/to/file",value:s.path,onChange:a=>t({path:a.target.value}),className:"w-full p-2.5 text-sm rounded-lg bg-theme-bg-primary border border-white/5 text-white placeholder:text-white/20 focus:border-primary-button focus:ring-1 focus:ring-primary-button outline-none",autoComplete:"off",spellCheck:!1})]}),s.operation!=="read"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"Content"}),e.jsx("textarea",{placeholder:"File content...",value:s.content,onChange:a=>t({content:a.target.value}),className:"w-full p-2.5 text-sm rounded-lg bg-theme-bg-primary border border-white/5 text-white placeholder:text-white/20 focus:border-primary-button focus:ring-1 focus:ring-primary-button outline-none",rows:3,autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"Store Result In"}),r(s.resultVariable,a=>t({resultVariable:a}),"Select or create variable")]})]})}function Ne({config:s,onConfigChange:t,renderVariableSelect:r}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"Language"}),e.jsxs("select",{value:s.language,onChange:a=>t({language:a.target.value}),className:"w-full p-2.5 text-sm rounded-lg bg-theme-bg-primary border border-white/5 text-white focus:border-primary-button focus:ring-1 focus:ring-primary-button outline-none",children:[e.jsx("option",{value:"javascript",className:"bg-theme-bg-primary",children:"JavaScript"}),e.jsx("option",{value:"python",className:"bg-theme-bg-primary",children:"Python"}),e.jsx("option",{value:"shell",className:"bg-theme-bg-primary",children:"Shell"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"Code"}),e.jsx("textarea",{placeholder:"Enter code...",value:s.code,onChange:a=>t({code:a.target.value}),className:"w-full p-2.5 text-sm rounded-lg bg-theme-bg-primary border border-white/5 text-white placeholder:text-white/20 focus:border-primary-button focus:ring-1 focus:ring-primary-button outline-none font-mono",rows:5,autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"Store Result In"}),r(s.resultVariable,a=>t({resultVariable:a}),"Select or create variable")]})]})}function _e({config:s,onConfigChange:t,renderVariableSelect:r}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-theme-text-primary mb-2",children:"Instruction"}),e.jsx("textarea",{value:(s==null?void 0:s.instruction)||"",onChange:a=>t({...s,instruction:a.target.value}),className:"w-full border-none bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5",rows:3,placeholder:"Enter instructions for the LLM..."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-theme-text-primary mb-2",children:"Result Variable"}),r(s.resultVariable,a=>t({...s,resultVariable:a}),"Select or create variable",!0)]})]})}function Se(){return e.jsx("div",{className:"text-sm text-white/60",children:"This is the end of your agent flow. All steps above will be executed in sequence."})}function Ce({config:s,onConfigChange:t,renderVariableSelect:r}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-theme-text-primary mb-2",children:"URL to Scrape"}),e.jsx("input",{type:"url",value:(s==null?void 0:s.url)||"",onChange:a=>t({...s,url:a.target.value}),className:"w-full border-none bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5",placeholder:"https://example.com"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-theme-text-primary mb-2",children:"Capture Page Content As"}),e.jsx("select",{value:s.captureAs,onChange:a=>t({...s,captureAs:a.target.value}),className:"w-full border-none bg-theme-settings-input-bg text-theme-text-primary text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5",children:[{label:"Text content only",value:"text"},{label:"Raw HTML",value:"html"},{label:"CSS Query Selector",value:"querySelector"}].map(a=>e.jsx("option",{value:a.value,className:"bg-theme-settings-input-bg",children:a.label},a.value))})]}),s.captureAs==="querySelector"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-theme-text-primary mb-2",children:"Query Selector"}),e.jsx("p",{className:"text-xs text-theme-text-secondary mb-2",children:"Enter a valid CSS selector to scrape the content of the page."}),e.jsx("input",{value:s.querySelector,onChange:a=>t({...s,querySelector:a.target.value}),placeholder:".article-content, #content, .main-content, etc.",className:"w-full border-none bg-theme-settings-input-bg text-theme-text-primary text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5"})]}),e.jsx(q,{size:"md",variant:"horizontal",label:"Content Summarization",hint:"content-summarization-tooltip",enabled:s.enableSummarization??!0,onChange:a=>t({...s,enableSummarization:a})}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-theme-text-primary mb-2",children:"Result Variable"}),r(s.resultVariable,a=>t({...s,resultVariable:a}),"Select or create variable",!0)]})]})}const z=d.forwardRef(({config:s,onConfigChange:t},r)=>e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-theme-text-primary mb-2",children:"Flow Name"}),e.jsxs("div",{className:"flex flex-col text-xs text-theme-text-secondary mt-2 mb-3",children:[e.jsx("p",{className:"",children:"It is important to give your flow a name that an LLM can easily understand."}),e.jsx("p",{children:'"SendMessageToDiscord", "CheckStockPrice", "CheckWeather"'})]}),e.jsx("input",{id:"agent-flow-name-input",ref:r==null?void 0:r.nameRef,type:"text",placeholder:"Enter flow name",value:(s==null?void 0:s.name)||"",onChange:a=>t({...s,name:a.target.value}),className:"w-full border-none bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5",autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-theme-text-primary mb-2",children:"Description"}),e.jsx("div",{className:"flex flex-col text-xs text-theme-text-secondary mt-2 mb-3",children:e.jsx("p",{className:"",children:"It is equally important to give your flow a description that an LLM can easily understand. Be sure to include the purpose of the flow, the context it will be used in, and any other relevant information."})}),e.jsx("textarea",{ref:r==null?void 0:r.descriptionRef,value:(s==null?void 0:s.description)||"",onChange:a=>t({...s,description:a.target.value}),className:"w-full border-none bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none p-2.5",rows:3,placeholder:"Enter flow description"})]})]}));z.displayName="FlowInfoNode";const f={FLOW_INFO:"flowInfo",START:"start",API_CALL:"apiCall",LLM_INSTRUCTION:"llmInstruction",WEB_SCRAPING:"webScraping",FINISH:"finish"},F={[f.FLOW_INFO]:{label:"Flow Information",icon:e.jsx(G,{className:"w-5 h-5 text-theme-text-primary"}),description:"Basic flow information",defaultConfig:{name:"",description:""},getSummary:s=>s.name||"Untitled Flow"},[f.START]:{label:"Flow Variables",icon:e.jsx(B,{className:"w-5 h-5 text-theme-text-primary"}),description:"Configure agent variables and settings",getSummary:s=>{var r,a;const t=((a=(r=s.variables)==null?void 0:r.filter(h=>h.name))==null?void 0:a.length)||0;return`${t} variable${t!==1?"s":""} defined`}},[f.API_CALL]:{label:"API Call",icon:e.jsx(J,{className:"w-5 h-5 text-theme-text-primary"}),description:"Make an HTTP request",defaultConfig:{url:"",method:"GET",headers:[],bodyType:"json",body:"",formData:[],responseVariable:"",directOutput:!1},getSummary:s=>`${s.method||"GET"} ${s.url||"(no URL)"}`},[f.LLM_INSTRUCTION]:{label:"LLM Instruction",icon:e.jsx(Y,{className:"w-5 h-5 text-theme-text-primary"}),description:"Process data using LLM instructions",defaultConfig:{instruction:"",resultVariable:"",directOutput:!1},getSummary:s=>s.instruction||"No instruction"},[f.WEB_SCRAPING]:{label:"Web Scraping",icon:e.jsx(X,{className:"w-5 h-5 text-theme-text-primary"}),description:"Scrape content from a webpage",defaultConfig:{url:"",captureAs:"text",querySelector:"",resultVariable:"",directOutput:!1},getSummary:s=>s.url||"No URL specified"},[f.FINISH]:{label:"Flow Complete",icon:e.jsx(W,{className:"w-4 h-4"}),description:"End of agent flow",getSummary:()=>"Flow will end here",defaultConfig:{},renderConfig:()=>null}};function Te({blocks:s,updateBlockConfig:t,removeBlock:r,toggleBlockExpansion:a,renderVariableSelect:h,onDeleteVariable:c,moveBlock:b,refs:g}){const v=u=>{var p;const l=((p=s[s.length-2])==null?void 0:p.id)===u.id,m={config:u.config,onConfigChange:x=>t(u.id,x),renderVariableSelect:h,onDeleteVariable:c};return l&&u.type!==f.START&&u.type!==f.FLOW_INFO?e.jsxs("div",{className:"space-y-4",children:[j(u,m),e.jsx("div",{className:"pt-4 border-t border-white/10",children:e.jsx(q,{size:"md",variant:"horizontal",label:"Direct Output",description:"The output of this block will be returned directly to the chat. This will prevent any further tool calls from being executed.",enabled:m.config.directOutput||!1,onChange:x=>m.onConfigChange({...m.config,directOutput:x})})})]}):j(u,m)},j=(u,l)=>{switch(u.type){case f.FLOW_INFO:return e.jsx(z,{...l,ref:g});case f.START:return e.jsx(fe,{...l});case f.API_CALL:return e.jsx(ve,{...l});case f.WEBSITE:return e.jsx(je,{...l});case f.FILE:return e.jsx(we,{...l});case f.CODE:return e.jsx(Ne,{...l});case f.LLM_INSTRUCTION:return e.jsx(_e,{...l});case f.WEB_SCRAPING:return e.jsx(Ce,{...l});case f.FINISH:return e.jsx(Se,{});default:return e.jsx("div",{children:"Configuration options coming soon..."})}};return e.jsxs("div",{className:"space-y-1",children:[s.map((u,l)=>e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:`bg-theme-action-menu-bg border border-white/10 rounded-lg overflow-hidden transition-all duration-300 ${u.isExpanded?"w-full":"w-[280px] mx-auto"}`,children:[e.jsxs("div",{onClick:()=>a(u.id),className:"w-full p-4 flex items-center justify-between hover:bg-theme-action-menu-item-hover transition-colors duration-300 group cursor-pointer",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-7 h-7 rounded-lg bg-white/10 light:bg-white flex items-center justify-center",children:o.cloneElement(F[u.type].icon,{className:"w-4 h-4 text-white"})}),e.jsxs("div",{className:"flex-1 text-left min-w-0 max-w-[115px]",children:[e.jsx("span",{className:"text-sm font-medium text-white block",children:F[u.type].label}),!u.isExpanded&&e.jsx("p",{className:"text-xs text-white/60 truncate",children:F[u.type].getSummary(u.config)})]})]}),e.jsx("div",{className:"flex items-center",children:u.id!=="start"&&u.type!==f.FINISH&&u.type!==f.FLOW_INFO&&e.jsxs("div",{className:"flex items-center gap-1",children:[l>2&&e.jsx("button",{onClick:m=>{m.stopPropagation(),b(l,l-1)},className:"w-7 h-7 flex items-center justify-center rounded-lg bg-theme-bg-primary border border-white/5 text-white hover:bg-theme-action-menu-item-hover transition-colors duration-300","data-tooltip-id":"block-action","data-tooltip-content":"Move block up",children:e.jsx(U,{className:"w-3.5 h-3.5"})}),l<s.length-2&&e.jsx("button",{onClick:m=>{m.stopPropagation(),b(l,l+1)},className:"w-7 h-7 flex items-center justify-center rounded-lg bg-theme-bg-primary border border-white/5 text-white hover:bg-theme-action-menu-item-hover transition-colors duration-300","data-tooltip-id":"block-action","data-tooltip-content":"Move block down",children:e.jsx($,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:m=>{m.stopPropagation(),r(u.id)},className:"w-7 h-7 flex items-center justify-center rounded-lg bg-theme-bg-primary border border-white/5 text-red-400 hover:bg-red-500/10 hover:border-red-500/20 transition-colors duration-300","data-tooltip-id":"block-action","data-tooltip-content":"Delete block",children:e.jsx(S,{className:"w-3.5 h-3.5"})})]})})]}),e.jsx("div",{className:`overflow-hidden transition-all duration-300 ease-in-out ${u.isExpanded?"max-h-[1000px] opacity-100":"max-h-0 opacity-0"}`,children:e.jsx("div",{className:"border-t border-white/10 p-4 bg-theme-bg-secondary rounded-b-lg",children:v(u)})})]}),l<s.length-1&&e.jsx("div",{className:"flex justify-center my-1",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-white/40 light:invert",children:e.jsx("path",{d:"M12 4L12 20M12 20L6 14M12 20L18 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},u.id)),e.jsx(K,{id:"block-action",place:"bottom",delayShow:300,className:"tooltip !text-xs"})]})}function ke({entity:s}){const{t}=E(),r=d.useRef(null),[a,h]=d.useState(!1),[c,b]=d.useState([]),[g,v]=d.useState(""),[j,u]=d.useState(!1),[l,m]=d.useState(null),[p,x]=d.useState(null),w=async n=>{n.preventDefault(),n.stopPropagation(),h(!0);try{const i=new FormData(r.current),y={name:i.get("name"),description:i.get("description"),tags:c,visibility:"private",flow:JSON.stringify({name:i.get("name"),description:i.get("description"),steps:s.steps,tags:c,visibility:"private"})},{success:N,error:_,itemId:I}=await T.createAgentFlow(y);if(!N)throw new Error(_);m(I),u(!0)}catch(i){console.error("Failed to publish agent flow:",i),A(`Failed to publish agent flow: ${i.message}`,"error",{clear:!0})}finally{h(!1)}},k=n=>{if(n.key==="Enter"||n.key===","){n.preventDefault();const i=g.trim();if(i.length>20)return;i&&!c.includes(i)&&(b(y=>[...y,i].slice(0,5)),v(""))}},C=n=>{b(c.filter(i=>i!==n))};return j?e.jsx("div",{className:"p-6 -mt-12 w-[400px]",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-2",children:[e.jsx("h3",{className:"text-lg font-semibold text-theme-text-primary",children:t("community_hub.publish.agent_flow.success_title")}),e.jsx("p",{className:"text-lg text-theme-text-primary text-center max-w-2xl",children:t("community_hub.publish.agent_flow.success_description")}),e.jsx("p",{className:"text-theme-text-secondary text-center text-sm",children:t("community_hub.publish.agent_flow.success_thank_you")}),e.jsx(V,{to:L.communityHub.viewItem("agent-flow",l),target:"_blank",rel:"noreferrer",className:"w-[265px] bg-theme-bg-secondary hover:bg-theme-sidebar-item-hover text-theme-text-primary py-2 px-4 rounded-lg transition-colors mt-4 text-sm font-semibold text-center",children:t("community_hub.publish.agent_flow.view_on_hub")})]})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-full flex gap-x-2 items-center mb-3 -mt-8",children:e.jsx("h3",{className:"text-xl font-semibold text-theme-text-primary px-6 py-3",children:t("community_hub.publish.agent_flow.modal_title")})}),e.jsxs("form",{ref:r,className:"flex",onSubmit:w,children:[e.jsxs("div",{className:"w-1/2 p-6 pt-0 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-theme-text-primary mb-1",children:t("community_hub.publish.agent_flow.name_label")}),e.jsx("div",{className:"text-xs text-theme-text-secondary mb-2",children:t("community_hub.publish.agent_flow.name_description")}),e.jsx("input",{type:"text",name:"name",required:!0,minLength:3,maxLength:300,defaultValue:s.name,placeholder:t("community_hub.publish.agent_flow.name_placeholder"),className:"border-none w-full bg-theme-bg-secondary rounded-lg p-2 text-theme-text-primary text-sm focus:outline-primary-button active:outline-primary-button outline-none placeholder:text-theme-text-placeholder"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-theme-text-primary mb-1",children:t("community_hub.publish.agent_flow.description_label")}),e.jsx("div",{className:"text-xs text-white/60 mb-2",children:t("community_hub.publish.agent_flow.description_description")}),e.jsx("textarea",{name:"description",required:!0,minLength:10,maxLength:1e3,defaultValue:s.description,placeholder:t("community_hub.publish.agent_flow.description_description"),className:"border-none w-full bg-theme-bg-secondary rounded-lg p-2 text-white text-sm focus:outline-primary-button active:outline-primary-button outline-none min-h-[80px] placeholder:text-theme-text-placeholder"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-white mb-1",children:t("community_hub.publish.agent_flow.tags_label")}),e.jsx("div",{className:"text-xs text-white/60 mb-2",children:t("community_hub.publish.agent_flow.tags_description")}),e.jsxs("div",{className:"flex flex-wrap gap-2 p-2 bg-theme-bg-secondary rounded-lg min-h-[42px]",children:[c.map((n,i)=>e.jsxs("span",{className:"flex items-center gap-1 px-2 py-1 text-sm text-theme-text-primary bg-white/10 light:bg-black/10 rounded-md",children:[n,e.jsx("button",{type:"button",onClick:()=>C(n),className:"border-none text-theme-text-primary hover:text-theme-text-secondary cursor-pointer",children:e.jsx(S,{size:14})})]},i)),e.jsx("input",{type:"text",value:g,onChange:n=>v(n.target.value),onKeyDown:k,placeholder:t("community_hub.publish.agent_flow.tags_placeholder"),className:"flex-1 min-w-[200px] border-none text-sm bg-transparent text-theme-text-primary placeholder:text-theme-text-placeholder p-0 h-[24px] focus:outline-none"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-white",children:t("community_hub.publish.agent_flow.visibility_label")}),e.jsx("span",{className:"text-xs text-theme-text-secondary",children:t("community_hub.publish.agent_flow.privacy_note")})]})]}),e.jsxs("div",{className:"w-1/2 p-6 pt-0 flex flex-col gap-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-theme-text-primary mb-1",children:"Flow Steps"}),e.jsx("div",{className:"text-xs text-white/60",children:"The steps the agent will follow when the flow is triggered."})]}),e.jsx("div",{className:"flex flex-col gap-y-0.5",children:s.steps&&s.steps.length>0?s.steps.map((n,i)=>{const y=F[n.type],N=p===i,_=y!=null&&y.getSummary?y.getSummary(n.config):"";return e.jsxs("div",{className:"flex flex-col items-center w-full",children:[e.jsxs("div",{className:"flex flex-col bg-theme-bg-secondary rounded-lg px-3 py-2 w-full cursor-pointer group",onClick:()=>x(N?null:i),children:[e.jsxs("div",{className:"flex items-center gap-x-3 w-full",children:[e.jsx("span",{children:y==null?void 0:y.icon}),e.jsx("span",{className:"text-theme-text-primary text-sm font-medium flex-1",children:(y==null?void 0:y.label)||n.type}),!N&&e.jsx("span",{className:"text-theme-text-secondary text-xs ml-2 overflow-hidden text-ellipsis whitespace-nowrap max-w-[120px] min-w-0",children:_}),e.jsx("span",{className:`ml-2 text-theme-text-secondary transition-transform duration-200 ${N?"rotate-90":""}`,children:e.jsx(Q,{size:16})})]}),N&&_&&e.jsx("div",{className:"w-full text-theme-text-secondary text-xs mt-1 whitespace-pre-line break-words",children:_})]}),i<s.steps.length-1&&e.jsx("span",{className:"text-theme-text-secondary text-lg my-1",children:"↓"})]},i)}):e.jsx("div",{className:"text-theme-text-secondary text-xs",children:"No steps defined."})}),e.jsx("button",{type:"submit",disabled:a,className:"border-none mt-4 w-full bg-cta-button hover:opacity-80 text-theme-text-primary font-medium py-2 px-4 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:t(a?"community_hub.publish.agent_flow.submitting":"community_hub.publish.agent_flow.submit")})]})]})]})}function Ie({entity:s}){const{t}=E(),r=d.useRef(null),[a,h]=d.useState(!1),[c,b]=d.useState([]),[g,v]=d.useState(""),[j,u]=d.useState("public"),[l,m]=d.useState(!1),[p,x]=d.useState(null),w=async n=>{n.preventDefault(),n.stopPropagation(),h(!0);try{const i=new FormData(r.current),y={name:i.get("name"),description:i.get("description"),command:s.command,prompt:i.get("prompt"),tags:c,visibility:j},{success:N,error:_,itemId:I}=await T.createSlashCommand(y);if(!N)throw new Error(_);x(I),m(!0)}catch(i){console.error("Failed to publish slash command:",i),A(`Failed to publish slash command: ${i.message}`,"error",{clear:!0})}finally{h(!1)}},k=n=>{if(n.key==="Enter"||n.key===","){n.preventDefault();const i=g.trim();if(i.length>20)return;i&&!c.includes(i)&&(b(y=>[...y,i].slice(0,5)),v(""))}},C=n=>{b(c.filter(i=>i!==n))};return l?e.jsx("div",{className:"p-6 -mt-12 w-[400px]",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-2",children:[e.jsx("h3",{className:"text-lg font-semibold text-theme-text-primary",children:t("community_hub.publish.slash_command.success_title")}),e.jsx("p",{className:"text-lg text-theme-text-primary text-center max-w-2xl",children:t("community_hub.publish.slash_command.success_description")}),e.jsx("p",{className:"text-theme-text-secondary text-center text-sm",children:t("community_hub.publish.slash_command.success_thank_you")}),e.jsx(V,{to:L.communityHub.viewItem("slash-command",p),target:"_blank",rel:"noreferrer",className:"w-[265px] bg-theme-bg-secondary hover:bg-theme-sidebar-item-hover text-theme-text-primary py-2 px-4 rounded-lg transition-colors mt-4 text-sm font-semibold text-center",children:t("community_hub.publish.slash_command.view_on_hub")})]})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-full flex gap-x-2 items-center mb-3 -mt-8",children:e.jsxs("h3",{className:"text-xl font-semibold text-theme-text-primary px-6 py-3 flex items-center gap-x-2",children:[t("community_hub.publish.slash_command.modal_title"),e.jsx("code",{className:"bg-theme-bg-secondary rounded-lg px-1 text-theme-text-secondary text-lg font-mono",children:s.command})]})}),e.jsxs("form",{ref:r,className:"flex",onSubmit:w,children:[e.jsxs("div",{className:"w-1/2 p-6 pt-0 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-theme-text-primary mb-1",children:t("community_hub.publish.slash_command.name_label")}),e.jsx("div",{className:"text-xs text-theme-text-secondary mb-2",children:t("community_hub.publish.slash_command.name_description")}),e.jsx("input",{type:"text",name:"name",required:!0,minLength:3,maxLength:300,defaultValue:s.name,placeholder:t("community_hub.publish.slash_command.name_placeholder"),className:"border-none w-full bg-theme-bg-secondary rounded-lg p-2 text-theme-text-primary text-sm focus:outline-primary-button active:outline-primary-button outline-none placeholder:text-theme-text-placeholder"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-theme-text-primary mb-1",children:t("community_hub.publish.slash_command.description_label")}),e.jsx("div",{className:"text-xs text-white/60 mb-2",children:t("community_hub.publish.slash_command.description_description")}),e.jsx("textarea",{name:"description",required:!0,minLength:10,maxLength:1e3,defaultValue:s.description,placeholder:t("community_hub.publish.slash_command.description_description"),className:"border-none w-full bg-theme-bg-secondary rounded-lg p-2 text-white text-sm focus:outline-primary-button active:outline-primary-button outline-none min-h-[80px] placeholder:text-theme-text-placeholder"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-white mb-1",children:t("community_hub.publish.slash_command.tags_label")}),e.jsx("div",{className:"text-xs text-white/60 mb-2",children:t("community_hub.publish.slash_command.tags_description")}),e.jsxs("div",{className:"flex flex-wrap gap-2 p-2 bg-theme-bg-secondary rounded-lg min-h-[42px]",children:[c.map((n,i)=>e.jsxs("span",{className:"flex items-center gap-1 px-2 py-1 text-sm text-theme-text-primary bg-white/10 light:bg-black/10 rounded-md",children:[n,e.jsx("button",{type:"button",onClick:()=>C(n),className:"border-none text-theme-text-primary hover:text-theme-text-secondary cursor-pointer",children:e.jsx(S,{size:14})})]},i)),e.jsx("input",{type:"text",value:g,onChange:n=>v(n.target.value),onKeyDown:k,placeholder:t("community_hub.publish.slash_command.tags_placeholder"),className:"flex-1 min-w-[200px] border-none text-sm bg-transparent text-theme-text-primary placeholder:text-theme-text-placeholder p-0 h-[24px] focus:outline-none"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-white mb-1",children:t("community_hub.publish.slash_command.visibility_label")}),e.jsx("div",{className:"text-xs text-white/60 mb-2",children:t(j==="public"?"community_hub.publish.slash_command.public_description":"community_hub.publish.slash_command.private_description")}),e.jsx("div",{className:"w-fit h-[42px] bg-theme-bg-secondary rounded-lg p-0.5",children:e.jsxs("div",{className:"flex items-center",role:"group",children:[e.jsx("input",{type:"radio",id:"public",name:"visibility",value:"public",className:"peer/public hidden",defaultChecked:!0,onChange:n=>u(n.target.value)}),e.jsx("input",{type:"radio",id:"private",name:"visibility",value:"private",className:"peer/private hidden",onChange:n=>u(n.target.value)}),e.jsx("label",{htmlFor:"public",className:"h-[36px] px-4 rounded-lg text-sm font-medium transition-all duration-200 cursor-pointer text-theme-text-primary hover:text-theme-text-secondary peer-checked/public:bg-theme-sidebar-item-hover peer-checked/public:text-theme-primary-button flex items-center justify-center",children:"Public"}),e.jsx("label",{htmlFor:"private",className:"h-[36px] px-4 rounded-lg text-sm font-medium transition-all duration-200 cursor-pointer text-theme-text-primary hover:text-theme-text-secondary peer-checked/private:bg-theme-sidebar-item-hover peer-checked/private:text-theme-primary-button flex items-center justify-center",children:"Private"})]})})]})]}),e.jsxs("div",{className:"w-1/2 p-6 pt-0 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-white mb-1",children:t("community_hub.publish.slash_command.prompt_label")}),e.jsx("div",{className:"text-xs text-white/60 mb-2",children:t("community_hub.publish.slash_command.prompt_description")}),e.jsx("textarea",{name:"prompt",required:!0,minLength:10,defaultValue:s.prompt,placeholder:t("community_hub.publish.slash_command.prompt_placeholder"),className:"border-none w-full bg-theme-bg-secondary rounded-lg p-2 text-white text-sm focus:outline-primary-button active:outline-primary-button outline-none min-h-[300px] placeholder:text-theme-text-placeholder"})]}),e.jsx("button",{type:"submit",disabled:a,className:"border-none w-full bg-cta-button hover:opacity-80 text-theme-text-primary font-medium py-2 px-4 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:t(a?"community_hub.publish.slash_command.submitting":"community_hub.publish.slash_command.publish_button")})]})]})]})}function Me({show:s,onClose:t,entityType:r,entity:a}){const{isAuthenticated:h,loading:c}=be();if(!s||c)return null;if(!h)return e.jsx(ye,{show:s,onClose:t});const b=()=>{switch(r){case"system-prompt":return e.jsx(ge,{entity:a});case"agent-flow":return e.jsx(ke,{entity:a});case"slash-command":return e.jsx(Ie,{entity:a});default:return null}};return e.jsx(Z,{isOpen:s,children:e.jsxs("div",{className:"relative max-w-[900px] bg-theme-bg-primary rounded-lg shadow border border-theme-modal-border",children:[e.jsx("div",{className:"relative p-6",children:e.jsx("button",{onClick:t,type:"button",className:"absolute top-4 right-4 transition-all duration-300 bg-transparent rounded-lg text-sm p-1 inline-flex items-center hover:bg-theme-modal-border hover:border-theme-modal-border hover:border-opacity-50 border-transparent border",children:e.jsx(S,{size:18,weight:"bold",className:"text-white"})})}),b()]})})}export{F as B,Me as P,f as a,Te as b};
@@ -1,5 +1,5 @@
1
- import{R as l,r as c,g as U,u as C,j as e,k as M,Y as k,Z as A,_ as E,$ as V,q as S,Q as O,M as L,c as w,aX as D,a1 as P,i as T,C as _,a as q,S as z,aF as I}from"../index.js";import{A as f}from"./admin-04b020fe.js";const $=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M256,136a12,12,0,0,1-12,12h-8v8a12,12,0,0,1-24,0v-8h-8a12,12,0,0,1,0-24h8v-8a12,12,0,0,1,24,0v8h8A12,12,0,0,1,256,136Zm-54.81,56.28a12,12,0,1,1-18.38,15.44C169.12,191.42,145,172,108,172c-28.89,0-55.46,12.68-74.81,35.72a12,12,0,0,1-18.38-15.44A124.08,124.08,0,0,1,63.5,156.53a72,72,0,1,1,89,0A124,124,0,0,1,201.19,192.28ZM108,148a48,48,0,1,0-48-48A48.05,48.05,0,0,0,108,148Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M168,100a60,60,0,1,1-60-60A60,60,0,0,1,168,100Z",opacity:"0.2"}),l.createElement("path",{d:"M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136ZM144,157.68a68,68,0,1,0-71.9,0c-20.65,6.76-39.23,19.39-54.17,37.17A8,8,0,0,0,24,208H192a8,8,0,0,0,6.13-13.15C183.18,177.07,164.6,164.44,144,157.68Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M254,136a6,6,0,0,1-6,6H230v18a6,6,0,0,1-12,0V142H200a6,6,0,0,1,0-12h18V112a6,6,0,0,1,12,0v18h18A6,6,0,0,1,254,136Zm-57.41,60.14a6,6,0,1,1-9.18,7.72C166.9,179.45,138.69,166,108,166s-58.89,13.45-79.41,37.86a6,6,0,0,1-9.18-7.72C35.14,177.41,55,164.48,77,158.25a66,66,0,1,1,62,0C161,164.48,180.86,177.41,196.59,196.14ZM108,154a54,54,0,1,0-54-54A54.06,54.06,0,0,0,108,154Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M252,136a4,4,0,0,1-4,4H228v20a4,4,0,0,1-8,0V140H200a4,4,0,0,1,0-8h20V112a4,4,0,0,1,8,0v20h20A4,4,0,0,1,252,136Zm-56.94,61.43a4,4,0,0,1-6.12,5.14C168,177.7,139.3,164,108,164s-60,13.7-80.94,38.57a4,4,0,1,1-6.12-5.14c16.71-19.9,38.13-33.13,61.89-38.59a64,64,0,1,1,50.34,0C156.93,164.3,178.35,177.53,195.06,197.43ZM108,156a56,56,0,1,0-56-56A56.06,56.06,0,0,0,108,156Z"}))]]);var B=Object.defineProperty,G=Object.defineProperties,X=Object.getOwnPropertyDescriptors,y=Object.getOwnPropertySymbols,J=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,N=(s,t,a)=>t in s?B(s,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):s[t]=a,W=(s,t)=>{for(var a in t||(t={}))J.call(t,a)&&N(s,a,t[a]);if(y)for(var a of y(t))Q.call(t,a)&&N(s,a,t[a]);return s},Y=(s,t)=>G(s,X(t));const F=c.forwardRef((s,t)=>l.createElement(U,Y(W({ref:t},s),{weights:$})));F.displayName="UserPlus";function K({currentUser:s,user:t,closeModal:a}){const[d,r]=c.useState(t.role),[n,m]=c.useState(null),[h,b]=c.useState({enabled:t.dailyMessageLimit!==null,limit:t.dailyMessageLimit||10}),{t:x}=C(),u=async o=>{m(null),o.preventDefault();const i={},p=new FormData(o.target);for(var[v,g]of p.entries())!g||g===null||(i[v]=g);h.enabled?i.dailyMessageLimit=h.limit:i.dailyMessageLimit=null;const{success:j,error:H}=await f.updateUser(t.id,i);j&&(s&&s.id===t.id&&(s.username=i.username,s.bio=i.bio,s.role=i.role,localStorage.setItem(V,JSON.stringify(s))),window.location.reload()),m(H)};return e.jsx("div",{className:"fixed inset-0 z-50 overflow-auto bg-black bg-opacity-50 flex items-center justify-center",children:e.jsxs("div",{className:"relative w-full max-w-2xl bg-theme-bg-secondary rounded-lg shadow border-2 border-theme-modal-border",children:[e.jsxs("div",{className:"relative p-6 border-b rounded-t border-theme-modal-border",children:[e.jsx("div",{className:"w-full flex gap-x-2 items-center",children:e.jsxs("h3",{className:"text-xl font-semibold text-white overflow-hidden overflow-ellipsis whitespace-nowrap",children:["Edit ",t.username]})}),e.jsx("button",{onClick:a,type:"button",className:"absolute top-4 right-4 transition-all duration-300 bg-transparent rounded-lg text-sm p-1 inline-flex items-center hover:bg-theme-modal-border hover:border-theme-modal-border hover:border-opacity-50 border-transparent border",children:e.jsx(M,{size:24,weight:"bold",className:"text-white"})})]}),e.jsx("div",{className:"p-6",children:e.jsxs("form",{onSubmit:u,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"username",className:"block mb-2 text-sm font-medium text-white",children:"Username"}),e.jsx("input",{name:"username",type:"text",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's username",defaultValue:t.username,minLength:k,maxLength:A,pattern:E,required:!0,autoComplete:"off"}),e.jsx("p",{className:"mt-2 text-xs text-white/60",children:x("common.username_requirements")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block mb-2 text-sm font-medium text-white",children:"New Password"}),e.jsx("input",{name:"password",type:"text",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:`${t.username}'s new password`,autoComplete:"off",minLength:8}),e.jsx("p",{className:"mt-2 text-xs text-white/60",children:"Password must be at least 8 characters long"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"bio",className:"block mb-2 text-sm font-medium text-white",children:"Bio"}),e.jsx("textarea",{name:"bio",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's bio",defaultValue:t.bio,autoComplete:"off",rows:3})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"role",className:"block mb-2 text-sm font-medium text-white",children:"Role"}),e.jsxs("select",{name:"role",required:!0,defaultValue:t.role,onChange:o=>r(o.target.value),className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",children:[e.jsx("option",{value:"default",children:"Default"}),e.jsx("option",{value:"manager",children:"Manager"}),(s==null?void 0:s.role)==="admin"&&e.jsx("option",{value:"admin",children:"Administrator"})]}),e.jsx(R,{role:d})]}),e.jsx(Z,{role:d,enabled:h.enabled,limit:h.limit,updateState:b}),n&&e.jsxs("p",{className:"text-red-400 text-sm",children:["Error: ",n]})]}),e.jsxs("div",{className:"flex justify-between items-center mt-6 pt-6 border-t border-theme-modal-border",children:[e.jsx("button",{onClick:a,type:"button",className:"transition-all duration-300 text-white hover:bg-zinc-700 px-4 py-2 rounded-lg text-sm",children:"Cancel"}),e.jsx("button",{type:"submit",className:"transition-all duration-300 bg-white text-black hover:opacity-60 px-4 py-2 rounded-lg text-sm",children:"Update user"})]})]})})]})})}const ee={admin:["admin","manager","default"],manager:["manager","default"],default:[]};function te({currUser:s,user:t}){const a=c.useRef(null),d=ee[(s==null?void 0:s.role)||"default"].includes(t.role),[r,n]=c.useState(t.suspended===1),{isOpen:m,openModal:h,closeModal:b}=S(),x=async()=>{if(!window.confirm(`Are you sure you want to suspend ${t.username}?
1
+ import{R as l,r as c,g as U,u as C,j as e,k as M,Y as k,Z as A,_ as E,$ as V,q as S,Q as O,M as L,c as w,aY as D,a1 as P,i as T,C as _,a as q,S as z,aG as I}from"../index.js";import{A as f}from"./admin-04b020fe.js";const $=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M256,136a12,12,0,0,1-12,12h-8v8a12,12,0,0,1-24,0v-8h-8a12,12,0,0,1,0-24h8v-8a12,12,0,0,1,24,0v8h8A12,12,0,0,1,256,136Zm-54.81,56.28a12,12,0,1,1-18.38,15.44C169.12,191.42,145,172,108,172c-28.89,0-55.46,12.68-74.81,35.72a12,12,0,0,1-18.38-15.44A124.08,124.08,0,0,1,63.5,156.53a72,72,0,1,1,89,0A124,124,0,0,1,201.19,192.28ZM108,148a48,48,0,1,0-48-48A48.05,48.05,0,0,0,108,148Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M168,100a60,60,0,1,1-60-60A60,60,0,0,1,168,100Z",opacity:"0.2"}),l.createElement("path",{d:"M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136ZM144,157.68a68,68,0,1,0-71.9,0c-20.65,6.76-39.23,19.39-54.17,37.17A8,8,0,0,0,24,208H192a8,8,0,0,0,6.13-13.15C183.18,177.07,164.6,164.44,144,157.68Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M254,136a6,6,0,0,1-6,6H230v18a6,6,0,0,1-12,0V142H200a6,6,0,0,1,0-12h18V112a6,6,0,0,1,12,0v18h18A6,6,0,0,1,254,136Zm-57.41,60.14a6,6,0,1,1-9.18,7.72C166.9,179.45,138.69,166,108,166s-58.89,13.45-79.41,37.86a6,6,0,0,1-9.18-7.72C35.14,177.41,55,164.48,77,158.25a66,66,0,1,1,62,0C161,164.48,180.86,177.41,196.59,196.14ZM108,154a54,54,0,1,0-54-54A54.06,54.06,0,0,0,108,154Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M252,136a4,4,0,0,1-4,4H228v20a4,4,0,0,1-8,0V140H200a4,4,0,0,1,0-8h20V112a4,4,0,0,1,8,0v20h20A4,4,0,0,1,252,136Zm-56.94,61.43a4,4,0,0,1-6.12,5.14C168,177.7,139.3,164,108,164s-60,13.7-80.94,38.57a4,4,0,1,1-6.12-5.14c16.71-19.9,38.13-33.13,61.89-38.59a64,64,0,1,1,50.34,0C156.93,164.3,178.35,177.53,195.06,197.43ZM108,156a56,56,0,1,0-56-56A56.06,56.06,0,0,0,108,156Z"}))]]);var B=Object.defineProperty,G=Object.defineProperties,Y=Object.getOwnPropertyDescriptors,y=Object.getOwnPropertySymbols,J=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,N=(s,t,a)=>t in s?B(s,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):s[t]=a,W=(s,t)=>{for(var a in t||(t={}))J.call(t,a)&&N(s,a,t[a]);if(y)for(var a of y(t))Q.call(t,a)&&N(s,a,t[a]);return s},X=(s,t)=>G(s,Y(t));const R=c.forwardRef((s,t)=>l.createElement(U,X(W({ref:t},s),{weights:$})));R.displayName="UserPlus";function K({currentUser:s,user:t,closeModal:a}){const[d,r]=c.useState(t.role),[n,m]=c.useState(null),[h,b]=c.useState({enabled:t.dailyMessageLimit!==null,limit:t.dailyMessageLimit||10}),{t:x}=C(),u=async o=>{m(null),o.preventDefault();const i={},p=new FormData(o.target);for(var[v,g]of p.entries())!g||g===null||(i[v]=g);h.enabled?i.dailyMessageLimit=h.limit:i.dailyMessageLimit=null;const{success:j,error:H}=await f.updateUser(t.id,i);j&&(s&&s.id===t.id&&(s.username=i.username,s.bio=i.bio,s.role=i.role,localStorage.setItem(V,JSON.stringify(s))),window.location.reload()),m(H)};return e.jsx("div",{className:"fixed inset-0 z-50 overflow-auto bg-black bg-opacity-50 flex items-center justify-center",children:e.jsxs("div",{className:"relative w-full max-w-2xl bg-theme-bg-secondary rounded-lg shadow border-2 border-theme-modal-border",children:[e.jsxs("div",{className:"relative p-6 border-b rounded-t border-theme-modal-border",children:[e.jsx("div",{className:"w-full flex gap-x-2 items-center",children:e.jsxs("h3",{className:"text-xl font-semibold text-white overflow-hidden overflow-ellipsis whitespace-nowrap",children:["Edit ",t.username]})}),e.jsx("button",{onClick:a,type:"button",className:"absolute top-4 right-4 transition-all duration-300 bg-transparent rounded-lg text-sm p-1 inline-flex items-center hover:bg-theme-modal-border hover:border-theme-modal-border hover:border-opacity-50 border-transparent border",children:e.jsx(M,{size:24,weight:"bold",className:"text-white"})})]}),e.jsx("div",{className:"p-6",children:e.jsxs("form",{onSubmit:u,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"username",className:"block mb-2 text-sm font-medium text-white",children:"Username"}),e.jsx("input",{name:"username",type:"text",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's username",defaultValue:t.username,minLength:k,maxLength:A,pattern:E,required:!0,autoComplete:"off"}),e.jsx("p",{className:"mt-2 text-xs text-white/60",children:x("common.username_requirements")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block mb-2 text-sm font-medium text-white",children:"New Password"}),e.jsx("input",{name:"password",type:"text",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:`${t.username}'s new password`,autoComplete:"off",minLength:8}),e.jsx("p",{className:"mt-2 text-xs text-white/60",children:"Password must be at least 8 characters long"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"bio",className:"block mb-2 text-sm font-medium text-white",children:"Bio"}),e.jsx("textarea",{name:"bio",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's bio",defaultValue:t.bio,autoComplete:"off",rows:3})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"role",className:"block mb-2 text-sm font-medium text-white",children:"Role"}),e.jsxs("select",{name:"role",required:!0,defaultValue:t.role,onChange:o=>r(o.target.value),className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",children:[e.jsx("option",{value:"default",children:"Default"}),e.jsx("option",{value:"manager",children:"Manager"}),(s==null?void 0:s.role)==="admin"&&e.jsx("option",{value:"admin",children:"Administrator"})]}),e.jsx(F,{role:d})]}),e.jsx(Z,{role:d,enabled:h.enabled,limit:h.limit,updateState:b}),n&&e.jsxs("p",{className:"text-red-400 text-sm",children:["Error: ",n]})]}),e.jsxs("div",{className:"flex justify-between items-center mt-6 pt-6 border-t border-theme-modal-border",children:[e.jsx("button",{onClick:a,type:"button",className:"transition-all duration-300 text-white hover:bg-zinc-700 px-4 py-2 rounded-lg text-sm",children:"Cancel"}),e.jsx("button",{type:"submit",className:"transition-all duration-300 bg-white text-black hover:opacity-60 px-4 py-2 rounded-lg text-sm",children:"Update user"})]})]})})]})})}const ee={admin:["admin","manager","default"],manager:["manager","default"],default:[]};function te({currUser:s,user:t}){const a=c.useRef(null),d=ee[(s==null?void 0:s.role)||"default"].includes(t.role),[r,n]=c.useState(t.suspended===1),{isOpen:m,openModal:h,closeModal:b}=S(),x=async()=>{if(!window.confirm(`Are you sure you want to suspend ${t.username}?
2
2
  After you do this they will be logged out and unable to log back into this instance of AnythingLLM until unsuspended by an admin.`))return!1;const{success:o,error:i}=await f.updateUser(t.id,{suspended:r?0:1});o||w(i,"error",{clear:!0}),o&&(w(`User ${r?"is no longer suspended":"has been suspended"}.`,"success",{clear:!0}),n(!r))},u=async()=>{var p;if(!window.confirm(`Are you sure you want to delete ${t.username}?
3
3
  After you do this they will be logged out and unable to use this instance of AnythingLLM.
4
4
 
5
- This action is irreversible.`))return!1;const{success:o,error:i}=await f.deleteUser(t.id);o||w(i,"error",{clear:!0}),o&&((p=a==null?void 0:a.current)==null||p.remove(),w("User deleted from system.","success",{clear:!0}))};return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{ref:a,className:"bg-transparent text-white text-opacity-80 text-xs font-medium border-b border-white/10 h-10",children:[e.jsx("th",{scope:"row",className:"px-6 whitespace-nowrap",children:t.username}),e.jsx("td",{className:"px-6",children:O(t.role)}),e.jsx("td",{className:"px-6",children:t.createdAt}),e.jsxs("td",{className:"px-6 flex items-center gap-x-6 h-full mt-2",children:[d&&e.jsx("button",{onClick:h,className:"text-xs font-medium text-white/80 light:text-black/80 rounded-lg hover:text-white hover:light:text-gray-500 px-2 py-1 hover:bg-white hover:bg-opacity-10",children:"Edit"}),(s==null?void 0:s.id)!==t.id&&d&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:x,className:"text-xs font-medium text-white/80 light:text-black/80 hover:light:text-orange-500 hover:text-orange-300 rounded-lg px-2 py-1 hover:bg-white hover:light:bg-orange-50 hover:bg-opacity-10",children:r?"Unsuspend":"Suspend"}),e.jsx("button",{onClick:u,className:"text-xs font-medium text-white/80 light:text-black/80 hover:light:text-red-500 hover:text-red-300 rounded-lg px-2 py-1 hover:bg-white hover:light:bg-red-50 hover:bg-opacity-10",children:"Delete"})]})]})]}),e.jsx(L,{isOpen:m,children:e.jsx(K,{currentUser:s,user:t,closeModal:b})})]})}function se({closeModal:s}){const[t,a]=c.useState(null),[d,r]=c.useState("default"),[n,m]=c.useState({enabled:!1,limit:10}),{t:h}=C(),b=async u=>{a(null),u.preventDefault();const o={},i=new FormData(u.target);for(var[p,v]of i.entries())o[p]=v;o.dailyMessageLimit=n.enabled?n.limit:null;const{user:g,error:j}=await f.newUser(o);g&&window.location.reload(),a(j)},x=D();return e.jsx("div",{className:"fixed inset-0 z-50 overflow-auto bg-black bg-opacity-50 flex items-center justify-center",children:e.jsxs("div",{className:"relative w-full max-w-2xl bg-theme-bg-secondary rounded-lg shadow border-2 border-theme-modal-border",children:[e.jsxs("div",{className:"relative p-6 border-b rounded-t border-theme-modal-border",children:[e.jsx("div",{className:"w-full flex gap-x-2 items-center",children:e.jsx("h3",{className:"text-xl font-semibold text-white overflow-hidden overflow-ellipsis whitespace-nowrap",children:"Add user to instance"})}),e.jsx("button",{onClick:s,type:"button",className:"absolute top-4 right-4 transition-all duration-300 bg-transparent rounded-lg text-sm p-1 inline-flex items-center hover:bg-theme-modal-border hover:border-theme-modal-border hover:border-opacity-50 border-transparent border",children:e.jsx(M,{size:24,weight:"bold",className:"text-white"})})]}),e.jsx("div",{className:"p-6",children:e.jsxs("form",{onSubmit:b,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"username",className:"block mb-2 text-sm font-medium text-white",children:"Username"}),e.jsx("input",{name:"username",type:"text",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's username",minLength:k,maxLength:A,pattern:E,required:!0,autoComplete:"off"}),e.jsx("p",{className:"mt-2 text-xs text-white/60",children:h("common.username_requirements")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block mb-2 text-sm font-medium text-white",children:"Password"}),e.jsx("input",{name:"password",type:"text",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's initial password",required:!0,autoComplete:"off",minLength:8}),e.jsx("p",{className:"mt-2 text-xs text-white/60",children:"Password must be at least 8 characters long"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"bio",className:"block mb-2 text-sm font-medium text-white",children:"Bio"}),e.jsx("textarea",{name:"bio",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's bio",autoComplete:"off",rows:3})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"role",className:"block mb-2 text-sm font-medium text-white",children:"Role"}),e.jsxs("select",{name:"role",required:!0,defaultValue:"default",onChange:u=>r(u.target.value),className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",children:[e.jsx("option",{value:"default",children:"Default"}),e.jsx("option",{value:"manager",children:"Manager"}),(x==null?void 0:x.role)==="admin"&&e.jsx("option",{value:"admin",children:"Administrator"})]}),e.jsx(R,{role:d})]}),e.jsx(Z,{role:d,enabled:n.enabled,limit:n.limit,updateState:m}),t&&e.jsxs("p",{className:"text-red-400 text-sm",children:["Error: ",t]}),e.jsx("p",{className:"text-white text-xs md:text-sm",children:"After creating a user they will need to login with their initial login to get access."})]}),e.jsxs("div",{className:"flex justify-between items-center mt-6 pt-6 border-t border-theme-modal-border",children:[e.jsx("button",{onClick:s,type:"button",className:"transition-all duration-300 text-white hover:bg-zinc-700 px-4 py-2 rounded-lg text-sm",children:"Cancel"}),e.jsx("button",{type:"submit",className:"transition-all duration-300 bg-white text-black hover:opacity-60 px-4 py-2 rounded-lg text-sm",children:"Add user"})]})]})})]})})}function oe(){const{isOpen:s,openModal:t,closeModal:a}=S();return e.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex",children:[e.jsx(P,{}),e.jsxs("div",{style:{height:T?"100%":"calc(100% - 32px)"},className:"relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-theme-bg-secondary w-full h-full overflow-y-scroll p-4 md:p-0",children:[e.jsxs("div",{className:"flex flex-col w-full px-1 md:pl-6 md:pr-[50px] md:py-6 py-16",children:[e.jsxs("div",{className:"w-full flex flex-col gap-y-1 pb-6 border-white/10 border-b-2",children:[e.jsx("div",{className:"items-center flex gap-x-4",children:e.jsx("p",{className:"text-lg leading-6 font-bold text-theme-text-primary",children:"Users"})}),e.jsx("p",{className:"text-xs leading-[18px] font-base text-theme-text-secondary",children:"These are all the accounts which have an account on this instance. Removing an account will instantly remove their access to this instance."})]}),e.jsx("div",{className:"w-full justify-end flex",children:e.jsxs(_,{onClick:t,className:"mt-3 mr-0 mb-4 md:-mb-6 z-10",children:[e.jsx(F,{className:"h-4 w-4",weight:"bold"})," Add user"]})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsx(ae,{})})]}),e.jsx(L,{isOpen:s,children:e.jsx(se,{closeModal:a})})]})]})}function ae(){const{user:s}=q(),[t,a]=c.useState(!0),[d,r]=c.useState([]);return c.useEffect(()=>{async function n(){const m=await f.users();r(m),a(!1)}n()},[]),t?e.jsx(z,{height:"80vh",width:"100%",highlightColor:"var(--theme-bg-primary)",baseColor:"var(--theme-bg-secondary)",count:1,className:"w-full p-4 rounded-b-2xl rounded-tr-2xl rounded-tl-sm mt-8",containerClassName:"flex w-full"}):e.jsxs("table",{className:"w-full text-xs text-left rounded-lg min-w-[640px] border-spacing-0",children:[e.jsx("thead",{className:"text-theme-text-secondary text-xs leading-[18px] font-bold uppercase border-white/10 border-b",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"px-6 py-3 rounded-tl-lg",children:"Username"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Role"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Date Added"}),e.jsx("th",{scope:"col",className:"px-6 py-3 rounded-tr-lg",children:" "})]})}),e.jsx("tbody",{children:d.map(n=>e.jsx(te,{currUser:s,user:n},n.id))})]})}const le={default:["Can only send chats with workspaces they are added to by admin or managers.","Cannot modify any settings at all."],manager:["Can view, create, and delete any workspaces and modify workspace-specific settings.","Can create, update and invite new users to the instance.","Cannot modify LLM, vectorDB, embedding, or other connections."],admin:["Highest user level privilege.","Can see and do everything across the system."]};function R({role:s}){return e.jsxs("div",{className:"flex flex-col gap-y-1 py-1 pb-4",children:[e.jsx("p",{className:"text-sm font-medium text-theme-text-primary",children:"Permissions"}),e.jsx("ul",{className:"flex flex-col gap-y-1 list-disc px-4",children:le[s??"default"].map((t,a)=>e.jsx("li",{className:"text-xs text-theme-text-secondary",children:t},a))})]})}function Z({enabled:s,limit:t,updateState:a,role:d}){return d==="admin"?null:e.jsxs("div",{className:"mt-4 mb-8",children:[e.jsx(I,{size:"md",variant:"horizontal",label:"Limit messages per day",description:"Restrict this user to a number of successful queries or chats within a 24 hour window.",enabled:s,onChange:r=>{a(n=>({...n,enabled:r}))}}),s&&e.jsxs("div",{className:"mt-4",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-4",children:"Message limit per day"}),e.jsx("div",{className:"relative mt-2",children:e.jsx("input",{type:"number",onScroll:r=>r.target.blur(),onChange:r=>{var n;a({enabled:!0,limit:Number(((n=r==null?void 0:r.target)==null?void 0:n.value)||0)})},value:t,min:1,className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5"})})]})]})}export{Z as MessageLimitInput,R as RoleHintDisplay,oe as default};
5
+ This action is irreversible.`))return!1;const{success:o,error:i}=await f.deleteUser(t.id);o||w(i,"error",{clear:!0}),o&&((p=a==null?void 0:a.current)==null||p.remove(),w("User deleted from system.","success",{clear:!0}))};return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{ref:a,className:"bg-transparent text-white text-opacity-80 text-xs font-medium border-b border-white/10 h-10",children:[e.jsx("th",{scope:"row",className:"px-6 whitespace-nowrap",children:t.username}),e.jsx("td",{className:"px-6",children:O(t.role)}),e.jsx("td",{className:"px-6",children:t.createdAt}),e.jsxs("td",{className:"px-6 flex items-center gap-x-6 h-full mt-2",children:[d&&e.jsx("button",{onClick:h,className:"text-xs font-medium text-white/80 light:text-black/80 rounded-lg hover:text-white hover:light:text-gray-500 px-2 py-1 hover:bg-white hover:bg-opacity-10",children:"Edit"}),(s==null?void 0:s.id)!==t.id&&d&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:x,className:"text-xs font-medium text-white/80 light:text-black/80 hover:light:text-orange-500 hover:text-orange-300 rounded-lg px-2 py-1 hover:bg-white hover:light:bg-orange-50 hover:bg-opacity-10",children:r?"Unsuspend":"Suspend"}),e.jsx("button",{onClick:u,className:"text-xs font-medium text-white/80 light:text-black/80 hover:light:text-red-500 hover:text-red-300 rounded-lg px-2 py-1 hover:bg-white hover:light:bg-red-50 hover:bg-opacity-10",children:"Delete"})]})]})]}),e.jsx(L,{isOpen:m,children:e.jsx(K,{currentUser:s,user:t,closeModal:b})})]})}function se({closeModal:s}){const[t,a]=c.useState(null),[d,r]=c.useState("default"),[n,m]=c.useState({enabled:!1,limit:10}),{t:h}=C(),b=async u=>{a(null),u.preventDefault();const o={},i=new FormData(u.target);for(var[p,v]of i.entries())o[p]=v;o.dailyMessageLimit=n.enabled?n.limit:null;const{user:g,error:j}=await f.newUser(o);g&&window.location.reload(),a(j)},x=D();return e.jsx("div",{className:"fixed inset-0 z-50 overflow-auto bg-black bg-opacity-50 flex items-center justify-center",children:e.jsxs("div",{className:"relative w-full max-w-2xl bg-theme-bg-secondary rounded-lg shadow border-2 border-theme-modal-border",children:[e.jsxs("div",{className:"relative p-6 border-b rounded-t border-theme-modal-border",children:[e.jsx("div",{className:"w-full flex gap-x-2 items-center",children:e.jsx("h3",{className:"text-xl font-semibold text-white overflow-hidden overflow-ellipsis whitespace-nowrap",children:"Add user to instance"})}),e.jsx("button",{onClick:s,type:"button",className:"absolute top-4 right-4 transition-all duration-300 bg-transparent rounded-lg text-sm p-1 inline-flex items-center hover:bg-theme-modal-border hover:border-theme-modal-border hover:border-opacity-50 border-transparent border",children:e.jsx(M,{size:24,weight:"bold",className:"text-white"})})]}),e.jsx("div",{className:"p-6",children:e.jsxs("form",{onSubmit:b,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"username",className:"block mb-2 text-sm font-medium text-white",children:"Username"}),e.jsx("input",{name:"username",type:"text",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's username",minLength:k,maxLength:A,pattern:E,required:!0,autoComplete:"off"}),e.jsx("p",{className:"mt-2 text-xs text-white/60",children:h("common.username_requirements")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block mb-2 text-sm font-medium text-white",children:"Password"}),e.jsx("input",{name:"password",type:"text",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's initial password",required:!0,autoComplete:"off",minLength:8}),e.jsx("p",{className:"mt-2 text-xs text-white/60",children:"Password must be at least 8 characters long"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"bio",className:"block mb-2 text-sm font-medium text-white",children:"Bio"}),e.jsx("textarea",{name:"bio",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's bio",autoComplete:"off",rows:3})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"role",className:"block mb-2 text-sm font-medium text-white",children:"Role"}),e.jsxs("select",{name:"role",required:!0,defaultValue:"default",onChange:u=>r(u.target.value),className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",children:[e.jsx("option",{value:"default",children:"Default"}),e.jsx("option",{value:"manager",children:"Manager"}),(x==null?void 0:x.role)==="admin"&&e.jsx("option",{value:"admin",children:"Administrator"})]}),e.jsx(F,{role:d})]}),e.jsx(Z,{role:d,enabled:n.enabled,limit:n.limit,updateState:m}),t&&e.jsxs("p",{className:"text-red-400 text-sm",children:["Error: ",t]}),e.jsx("p",{className:"text-white text-xs md:text-sm",children:"After creating a user they will need to login with their initial login to get access."})]}),e.jsxs("div",{className:"flex justify-between items-center mt-6 pt-6 border-t border-theme-modal-border",children:[e.jsx("button",{onClick:s,type:"button",className:"transition-all duration-300 text-white hover:bg-zinc-700 px-4 py-2 rounded-lg text-sm",children:"Cancel"}),e.jsx("button",{type:"submit",className:"transition-all duration-300 bg-white text-black hover:opacity-60 px-4 py-2 rounded-lg text-sm",children:"Add user"})]})]})})]})})}function oe(){const{isOpen:s,openModal:t,closeModal:a}=S();return e.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex",children:[e.jsx(P,{}),e.jsxs("div",{style:{height:T?"100%":"calc(100% - 32px)"},className:"relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-theme-bg-secondary w-full h-full overflow-y-scroll p-4 md:p-0",children:[e.jsxs("div",{className:"flex flex-col w-full px-1 md:pl-6 md:pr-[50px] md:py-6 py-16",children:[e.jsxs("div",{className:"w-full flex flex-col gap-y-1 pb-6 border-white/10 border-b-2",children:[e.jsx("div",{className:"items-center flex gap-x-4",children:e.jsx("p",{className:"text-lg leading-6 font-bold text-theme-text-primary",children:"Users"})}),e.jsx("p",{className:"text-xs leading-[18px] font-base text-theme-text-secondary",children:"These are all the accounts which have an account on this instance. Removing an account will instantly remove their access to this instance."})]}),e.jsx("div",{className:"w-full justify-end flex",children:e.jsxs(_,{onClick:t,className:"mt-3 mr-0 mb-4 md:-mb-6 z-10",children:[e.jsx(R,{className:"h-4 w-4",weight:"bold"})," Add user"]})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsx(ae,{})})]}),e.jsx(L,{isOpen:s,children:e.jsx(se,{closeModal:a})})]})]})}function ae(){const{user:s}=q(),[t,a]=c.useState(!0),[d,r]=c.useState([]);return c.useEffect(()=>{async function n(){const m=await f.users();r(m),a(!1)}n()},[]),t?e.jsx(z,{height:"80vh",width:"100%",highlightColor:"var(--theme-bg-primary)",baseColor:"var(--theme-bg-secondary)",count:1,className:"w-full p-4 rounded-b-2xl rounded-tr-2xl rounded-tl-sm mt-8",containerClassName:"flex w-full"}):e.jsxs("table",{className:"w-full text-xs text-left rounded-lg min-w-[640px] border-spacing-0",children:[e.jsx("thead",{className:"text-theme-text-secondary text-xs leading-[18px] font-bold uppercase border-white/10 border-b",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"px-6 py-3 rounded-tl-lg",children:"Username"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Role"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Date Added"}),e.jsx("th",{scope:"col",className:"px-6 py-3 rounded-tr-lg",children:" "})]})}),e.jsx("tbody",{children:d.map(n=>e.jsx(te,{currUser:s,user:n},n.id))})]})}const le={default:["Can only send chats with workspaces they are added to by admin or managers.","Cannot modify any settings at all."],manager:["Can view, create, and delete any workspaces and modify workspace-specific settings.","Can create, update and invite new users to the instance.","Cannot modify LLM, vectorDB, embedding, or other connections."],admin:["Highest user level privilege.","Can see and do everything across the system."]};function F({role:s}){return e.jsxs("div",{className:"flex flex-col gap-y-1 py-1 pb-4",children:[e.jsx("p",{className:"text-sm font-medium text-theme-text-primary",children:"Permissions"}),e.jsx("ul",{className:"flex flex-col gap-y-1 list-disc px-4",children:le[s??"default"].map((t,a)=>e.jsx("li",{className:"text-xs text-theme-text-secondary",children:t},a))})]})}function Z({enabled:s,limit:t,updateState:a,role:d}){return d==="admin"?null:e.jsxs("div",{className:"mt-4 mb-8",children:[e.jsx(I,{size:"md",variant:"horizontal",label:"Limit messages per day",description:"Restrict this user to a number of successful queries or chats within a 24 hour window.",enabled:s,onChange:r=>{a(n=>({...n,enabled:r}))}}),s&&e.jsxs("div",{className:"mt-4",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-4",children:"Message limit per day"}),e.jsx("div",{className:"relative mt-2",children:e.jsx("input",{type:"number",onScroll:r=>r.target.blur(),onChange:r=>{var n;a({enabled:!0,limit:Number(((n=r==null?void 0:r.target)==null?void 0:n.value)||0)})},value:t,min:1,className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5"})})]})]})}export{Z as MessageLimitInput,F as RoleHintDisplay,oe as default};
@@ -1 +1 @@
1
- import{j as e,u as z,a6 as A,a7 as D,r as o,q as H,a1 as Z,i as V,h as F,C as $,K as U,k as Y,N as X,M as _,au as J,av as ee,aw as P,ax as te,ay as le,az as ae,aA as oe,aB as se,aC as ne,t as B,c as S}from"../index.js";import{C as re}from"./index-4277cf52.js";function ie({name:t,value:r,image:c,description:n,checked:d,onClick:h}){return e.jsxs("div",{onClick:()=>h(r),className:`w-full p-2 rounded-md hover:cursor-pointer hover:bg-theme-bg-secondary ${d?"bg-theme-bg-secondary":""}`,children:[e.jsx("input",{type:"checkbox",value:r,className:"peer hidden",checked:d,readOnly:!0,formNoValidate:!0}),e.jsxs("div",{className:"flex gap-x-4 items-center",children:[e.jsx("img",{src:c,alt:`${t} logo`,className:"w-10 h-10 rounded-md"}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"text-sm font-semibold text-white",children:t}),e.jsx("div",{className:"mt-1 text-xs text-description",children:n})]})]})]})}function ce(){const{t}=z();return e.jsx("div",{className:"w-full h-10 items-center flex",children:e.jsx("p",{className:"text-sm font-base text-white text-opacity-60",children:t("vector.provider.description")})})}function de({settings:t}){return e.jsx("div",{className:"w-full flex flex-col gap-y-7",children:e.jsxs("div",{className:"w-full flex items-center gap-[36px] mt-1.5",children:[e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"Chroma Endpoint"}),e.jsx("input",{type:"url",name:"ChromaEndpoint",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"http://localhost:8000",defaultValue:t==null?void 0:t.ChromaEndpoint,required:!0,autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"API Header"}),e.jsx("input",{name:"ChromaApiHeader",autoComplete:"off",type:"text",defaultValue:t==null?void 0:t.ChromaApiHeader,className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"X-Api-Key"})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"API Key"}),e.jsx("input",{name:"ChromaApiKey",autoComplete:"off",type:"password",defaultValue:t!=null&&t.ChromaApiKey?"*".repeat(20):"",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"sk-myApiKeyToAccessMyChromaInstance"})]})]})})}function ue({settings:t}){return e.jsx("div",{className:"w-full flex flex-col gap-y-7",children:e.jsxs("div",{className:"w-full flex items-center gap-[36px] mt-1.5",children:[e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"API Key"}),e.jsx("input",{type:"password",name:"ChromaCloudApiKey",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"ck-your-api-key-here",defaultValue:t!=null&&t.ChromaCloudApiKey?"*".repeat(20):"",required:!0,autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"Tenant ID"}),e.jsx("input",{name:"ChromaCloudTenant",autoComplete:"off",type:"text",defaultValue:t==null?void 0:t.ChromaCloudTenant,className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"your-tenant-id-here",required:!0})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"Database Name"}),e.jsx("input",{name:"ChromaCloudDatabase",autoComplete:"off",type:"text",defaultValue:t==null?void 0:t.ChromaCloudDatabase,className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"your-database-name",required:!0})]})]})})}function me({settings:t}){return e.jsx("div",{className:"w-full flex flex-col gap-y-7",children:e.jsxs("div",{className:"w-full flex items-center gap-[36px] mt-1.5",children:[e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"Pinecone DB API Key"}),e.jsx("input",{type:"password",name:"PineConeKey",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"Pinecone API Key",defaultValue:t!=null&&t.PineConeKey?"*".repeat(20):"",required:!0,autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"Pinecone Index Name"}),e.jsx("input",{type:"text",name:"PineConeIndex",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"my-index",defaultValue:t==null?void 0:t.PineConeIndex,required:!0,autoComplete:"off",spellCheck:!1})]})]})})}function pe({settings:t}){return e.jsx("div",{className:"w-full flex flex-col gap-y-7",children:e.jsxs("div",{className:"w-full flex items-center gap-[36px] mt-1.5",children:[e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"Weaviate Endpoint"}),e.jsx("input",{type:"url",name:"WeaviateEndpoint",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"http://localhost:8080",defaultValue:t==null?void 0:t.WeaviateEndpoint,required:!0,autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"API Key"}),e.jsx("input",{type:"password",name:"WeaviateApiKey",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"sk-123Abcweaviate",defaultValue:t!=null&&t.WeaviateApiKey?"*".repeat(20):"",autoComplete:"off",spellCheck:!1})]})]})})}function xe({settings:t}){return e.jsx("div",{className:"w-full flex flex-col gap-y-7",children:e.jsxs("div",{className:"w-full flex items-center gap-[36px] mt-1.5",children:[e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"QDrant API Endpoint"}),e.jsx("input",{type:"url",name:"QdrantEndpoint",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"http://localhost:6633",defaultValue:t==null?void 0:t.QdrantEndpoint,required:!0,autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"API Key"}),e.jsx("input",{type:"password",name:"QdrantApiKey",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"wOeqxsYP4....1244sba",defaultValue:t!=null&&t.QdrantApiKey?"*".repeat(20):"",autoComplete:"off",spellCheck:!1})]})]})})}function he({settings:t}){return e.jsx("div",{className:"w-full flex flex-col gap-y-7",children:e.jsxs("div",{className:"w-full flex items-center gap-[36px] mt-1.5",children:[e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"Milvus DB Address"}),e.jsx("input",{type:"text",name:"MilvusAddress",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"http://localhost:19530",defaultValue:t==null?void 0:t.MilvusAddress,required:!0,autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"Milvus Username"}),e.jsx("input",{type:"text",name:"MilvusUsername",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"username",defaultValue:t==null?void 0:t.MilvusUsername,autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"Milvus Password"}),e.jsx("input",{type:"password",name:"MilvusPassword",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"password",defaultValue:t!=null&&t.MilvusPassword?"*".repeat(20):"",autoComplete:"off",spellCheck:!1})]})]})})}function fe({settings:t}){return e.jsx("div",{className:"w-full flex flex-col gap-y-4",children:e.jsxs("div",{className:"w-full flex items-center gap-[36px] mt-1.5",children:[e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"Cluster Endpoint"}),e.jsx("input",{type:"text",name:"ZillizEndpoint",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"https://sample.api.gcp-us-west1.zillizcloud.com",defaultValue:t==null?void 0:t.ZillizEndpoint,required:!0,autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"API Token"}),e.jsx("input",{type:"password",name:"ZillizApiToken",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"Zilliz cluster API Token",defaultValue:t!=null&&t.ZillizApiToken?"*".repeat(20):"",autoComplete:"off",spellCheck:!1})]})]})})}function be({settings:t}){return e.jsx("div",{className:"w-full flex flex-col gap-y-7",children:e.jsxs("div",{className:"w-full flex items-center gap-[36px] mt-1.5",children:[e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"Astra DB Endpoint"}),e.jsx("input",{type:"url",name:"AstraDBEndpoint",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"Astra DB API endpoint",defaultValue:t==null?void 0:t.AstraDBEndpoint,required:!0,autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"Astra DB Application Token"}),e.jsx("input",{type:"password",name:"AstraDBApplicationToken",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"AstraCS:...",defaultValue:t!=null&&t.AstraDBApplicationToken?"*".repeat(20):"",required:!0,autoComplete:"off",spellCheck:!1})]})]})})}function we({settings:t}){return e.jsx("div",{className:"w-full flex flex-col gap-y-7",children:e.jsxs("div",{className:"w-full flex items-center gap-[36px] mt-1.5",children:[e.jsxs("div",{className:"flex flex-col w-96",children:[e.jsxs("div",{className:"flex items-center gap-x-1 mb-3",children:[e.jsx("label",{className:"text-white text-sm font-semibold block",children:"Postgres Connection String"}),e.jsx(A,{size:16,className:"text-theme-text-secondary cursor-pointer","data-tooltip-id":"pgvector-connection-string-tooltip","data-tooltip-place":"right"}),e.jsx(D,{delayHide:300,id:"pgvector-connection-string-tooltip",className:"max-w-md z-99",clickable:!0,children:e.jsxs("p",{className:"text-md whitespace-pre-line break-words",children:["This is the connection string for the Postgres database in the format of ",e.jsx("br",{}),e.jsx("code",{children:"postgresql://username:password@host:port/database"}),e.jsx("br",{}),e.jsx("br",{}),"The user for the database must have the following permissions:",e.jsxs("ul",{className:"list-disc list-inside",children:[e.jsx("li",{children:"Read access to the database"}),e.jsx("li",{children:"Read access to the database schema"}),e.jsx("li",{children:"Create access to the database"})]}),e.jsx("br",{}),e.jsx("b",{children:"You must have the pgvector extension installed on the database."})]})})]}),e.jsx("input",{type:"text",name:"PGVectorConnectionString",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"postgresql://username:password@host:port/database",defaultValue:t!=null&&t.PGVectorConnectionString?"*".repeat(20):"",required:!0,autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsxs("div",{className:"flex items-center gap-x-1 mb-3",children:[e.jsx("label",{className:"text-white text-sm font-semibold block",children:"Vector Table Name"}),e.jsx(A,{size:16,className:"text-theme-text-secondary cursor-pointer","data-tooltip-id":"pgvector-table-name-tooltip","data-tooltip-place":"right"}),e.jsx(D,{delayHide:300,id:"pgvector-table-name-tooltip",className:"max-w-md z-99",clickable:!0,children:e.jsxs("p",{className:"text-md whitespace-pre-line break-words",children:["This is the name of the table in the Postgres database that will store the vectors.",e.jsx("br",{}),e.jsx("br",{}),"By default, the table name is ",e.jsx("code",{children:"anythingllm_vectors"}),".",e.jsx("br",{}),e.jsx("br",{}),e.jsx("b",{children:"This table must not already exist on the database - it will be created automatically."})]})})]}),e.jsx("input",{type:"text",name:"PGVectorTableName",autoComplete:"off",defaultValue:t==null?void 0:t.PGVectorTableName,className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"vector_table"})]})]})})}const x=[{name:"LanceDB",value:"lancedb",logo:J,options:t=>e.jsx(ce,{}),description:"100% local vector DB that runs on the same instance as AnythingLLM."},{name:"PGVector",value:"pgvector",logo:ee,options:t=>e.jsx(we,{settings:t}),description:"Vector search powered by PostgreSQL."},{name:"Chroma",value:"chroma",logo:P,options:t=>e.jsx(de,{settings:t}),description:"Open source vector database you can host yourself or on the cloud."},{name:"Chroma Cloud",value:"chromacloud",logo:P,options:t=>e.jsx(ue,{settings:t}),description:"Fully managed Chroma cloud service with enterprise features and support."},{name:"Pinecone",value:"pinecone",logo:te,options:t=>e.jsx(me,{settings:t}),description:"100% cloud-based vector database for enterprise use cases."},{name:"Zilliz Cloud",value:"zilliz",logo:le,options:t=>e.jsx(fe,{settings:t}),description:"Cloud hosted vector database built for enterprise with SOC 2 compliance."},{name:"QDrant",value:"qdrant",logo:ae,options:t=>e.jsx(xe,{settings:t}),description:"Open source local and distributed cloud vector database."},{name:"Weaviate",value:"weaviate",logo:oe,options:t=>e.jsx(pe,{settings:t}),description:"Open source local and cloud hosted multi-modal vector database."},{name:"Milvus",value:"milvus",logo:se,options:t=>e.jsx(he,{settings:t}),description:"Open-source, highly scalable, and blazing fast."},{name:"AstraDB",value:"astra",logo:ne,options:t=>e.jsx(be,{settings:t}),description:"Vector Search for Real-world GenAI."}];function je(){var C;const[t,r]=o.useState(!1),[c,n]=o.useState(!1),[d,h]=o.useState(!1),[u,E]=o.useState({}),[M,T]=o.useState(!0),[f,b]=o.useState(""),[O,K]=o.useState([]),[s,y]=o.useState(null),[w,m]=o.useState(!1),v=o.useRef(null),{isOpen:I,openModal:L,closeModal:j}=H(),{t:i}=z(),g=async l=>{l.preventDefault(),s!==(u==null?void 0:u.VectorDB)&&c&&d?L():await N()},N=async()=>{r(!0);const l=document.getElementById("vectordb-form"),a={},W=new FormData(l);a.VectorDB=s;for(var[G,R]of W.entries())a[G]=R;const{error:k}=await B.updateSystem(a);k?(S(`Failed to save vector database settings: ${k}`,"error"),n(!0)):(S("Vector database preferences saved successfully.","success"),n(!1)),r(!1),j()},q=l=>{b(""),y(l),m(!1),n(!0)},Q=()=>{f.length>0?(b(""),v.current&&(v.current.value="")):m(!w)};o.useEffect(()=>{async function l(){const a=await B.keys();E(a),y((a==null?void 0:a.VectorDB)||"lancedb"),h((a==null?void 0:a.HasExistingEmbeddings)||!1),T(!1)}l()},[]),o.useEffect(()=>{const l=x.filter(a=>a.name.toLowerCase().includes(f.toLowerCase()));K(l)},[f,s]);const p=x.find(l=>l.value===s)??x[0];return e.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex",children:[e.jsx(Z,{}),M?e.jsx("div",{style:{height:V?"100%":"calc(100% - 32px)"},className:"relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-theme-bg-secondary w-full h-full overflow-y-scroll p-4 md:p-0",children:e.jsx("div",{className:"w-full h-full flex justify-center items-center",children:e.jsx(F,{})})}):e.jsx("div",{style:{height:V?"100%":"calc(100% - 32px)"},className:"relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-theme-bg-secondary w-full h-full overflow-y-scroll p-4 md:p-0",children:e.jsx("form",{id:"vectordb-form",onSubmit:g,className:"flex w-full",children:e.jsxs("div",{className:"flex flex-col w-full px-1 md:pl-6 md:pr-[50px] py-16 md:py-6",children:[e.jsxs("div",{className:"w-full flex flex-col gap-y-1 pb-6 border-white light:border-theme-sidebar-border border-b-2 border-opacity-10",children:[e.jsx("div",{className:"flex gap-x-4 items-center",children:e.jsx("p",{className:"text-lg leading-6 font-bold text-white",children:i("vector.title")})}),e.jsx("p",{className:"text-xs leading-[18px] font-base text-white text-opacity-60",children:i("vector.description")})]}),e.jsx("div",{className:"w-full justify-end flex",children:c&&e.jsx($,{onClick:()=>g(),className:"mt-3 mr-0 -mb-14 z-10",children:i(t?"common.saving":"common.save")})}),e.jsx("div",{className:"text-base font-bold text-white mt-6 mb-4",children:i("vector.provider.title")}),e.jsxs("div",{className:"relative",children:[w&&e.jsx("div",{className:"fixed top-0 left-0 w-full h-full bg-black bg-opacity-70 backdrop-blur-sm z-10",onClick:()=>m(!1)}),w?e.jsx("div",{className:"absolute top-0 left-0 w-full max-w-[640px] max-h-[310px] min-h-[64px] bg-theme-settings-input-bg rounded-lg flex flex-col justify-between cursor-pointer border-2 border-primary-button z-20",children:e.jsxs("div",{className:"w-full flex flex-col gap-y-1",children:[e.jsxs("div",{className:"flex items-center sticky top-0 z-10 border-b border-[#9CA3AF] mx-4 bg-theme-settings-input-bg",children:[e.jsx(U,{size:20,weight:"bold",className:"absolute left-4 z-30 text-theme-text-primary -ml-4 my-2"}),e.jsx("input",{type:"text",name:"vdb-search",autoComplete:"off",placeholder:"Search all vector database providers",className:"border-none -ml-4 my-2 bg-transparent z-20 pl-12 h-[38px] w-full px-4 py-1 text-sm outline-none text-theme-text-primary placeholder:text-theme-text-primary placeholder:font-medium",onChange:l=>b(l.target.value),ref:v,onKeyDown:l=>{l.key==="Enter"&&l.preventDefault()}}),e.jsx(Y,{size:20,weight:"bold",className:"cursor-pointer text-white hover:text-x-button",onClick:Q})]}),e.jsx("div",{className:"flex-1 pl-4 pr-2 flex flex-col gap-y-1 overflow-y-auto white-scrollbar pb-4 max-h-[245px]",children:O.map(l=>e.jsx(ie,{name:l.name,value:l.value,image:l.logo,description:l.description,checked:s===l.value,onClick:()=>q(l.value)},l.name))})]})}):e.jsxs("button",{className:"w-full max-w-[640px] h-[64px] bg-theme-settings-input-bg rounded-lg flex items-center p-[14px] justify-between cursor-pointer border-2 border-transparent hover:border-primary-button transition-all duration-300",type:"button",onClick:()=>m(!0),children:[e.jsxs("div",{className:"flex gap-x-4 items-center",children:[e.jsx("img",{src:p.logo,alt:`${p.name} logo`,className:"w-10 h-10 rounded-md"}),e.jsxs("div",{className:"flex flex-col text-left",children:[e.jsx("div",{className:"text-sm font-semibold text-white",children:p.name}),e.jsx("div",{className:"mt-1 text-xs text-description",children:p.description})]})]}),e.jsx(X,{size:24,weight:"bold",className:"text-white"})]})]}),e.jsx("div",{onChange:()=>n(!0),className:"mt-4 flex flex-col gap-y-1",children:s&&((C=x.find(l=>l.value===s))==null?void 0:C.options(u))})]})})}),e.jsx(_,{isOpen:I,children:e.jsx(re,{warningText:"Switching the vector database will reset all previously embedded documents in all workspaces.\\n\\nConfirming will clear all embeddings from your vector database and remove all documents from your workspaces. Your uploaded documents will not be deleted, they will be available for re-embedding.",onClose:j,onConfirm:N})})]})}export{je as default};
1
+ import{j as e,u as z,a7 as A,a8 as D,r as o,q as H,a1 as Z,i as V,h as F,C as $,K as U,k as Y,N as X,M as _,av as J,aw as ee,ax as P,ay as te,az as le,aA as ae,aB as oe,aC as se,aD as ne,t as B,c as S}from"../index.js";import{C as re}from"./index-c712996e.js";function ie({name:t,value:r,image:c,description:n,checked:d,onClick:h}){return e.jsxs("div",{onClick:()=>h(r),className:`w-full p-2 rounded-md hover:cursor-pointer hover:bg-theme-bg-secondary ${d?"bg-theme-bg-secondary":""}`,children:[e.jsx("input",{type:"checkbox",value:r,className:"peer hidden",checked:d,readOnly:!0,formNoValidate:!0}),e.jsxs("div",{className:"flex gap-x-4 items-center",children:[e.jsx("img",{src:c,alt:`${t} logo`,className:"w-10 h-10 rounded-md"}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"text-sm font-semibold text-white",children:t}),e.jsx("div",{className:"mt-1 text-xs text-description",children:n})]})]})]})}function ce(){const{t}=z();return e.jsx("div",{className:"w-full h-10 items-center flex",children:e.jsx("p",{className:"text-sm font-base text-white text-opacity-60",children:t("vector.provider.description")})})}function de({settings:t}){return e.jsx("div",{className:"w-full flex flex-col gap-y-7",children:e.jsxs("div",{className:"w-full flex items-center gap-[36px] mt-1.5",children:[e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"Chroma Endpoint"}),e.jsx("input",{type:"url",name:"ChromaEndpoint",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"http://localhost:8000",defaultValue:t==null?void 0:t.ChromaEndpoint,required:!0,autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"API Header"}),e.jsx("input",{name:"ChromaApiHeader",autoComplete:"off",type:"text",defaultValue:t==null?void 0:t.ChromaApiHeader,className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"X-Api-Key"})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"API Key"}),e.jsx("input",{name:"ChromaApiKey",autoComplete:"off",type:"password",defaultValue:t!=null&&t.ChromaApiKey?"*".repeat(20):"",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"sk-myApiKeyToAccessMyChromaInstance"})]})]})})}function ue({settings:t}){return e.jsx("div",{className:"w-full flex flex-col gap-y-7",children:e.jsxs("div",{className:"w-full flex items-center gap-[36px] mt-1.5",children:[e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"API Key"}),e.jsx("input",{type:"password",name:"ChromaCloudApiKey",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"ck-your-api-key-here",defaultValue:t!=null&&t.ChromaCloudApiKey?"*".repeat(20):"",required:!0,autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"Tenant ID"}),e.jsx("input",{name:"ChromaCloudTenant",autoComplete:"off",type:"text",defaultValue:t==null?void 0:t.ChromaCloudTenant,className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"your-tenant-id-here",required:!0})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"Database Name"}),e.jsx("input",{name:"ChromaCloudDatabase",autoComplete:"off",type:"text",defaultValue:t==null?void 0:t.ChromaCloudDatabase,className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"your-database-name",required:!0})]})]})})}function me({settings:t}){return e.jsx("div",{className:"w-full flex flex-col gap-y-7",children:e.jsxs("div",{className:"w-full flex items-center gap-[36px] mt-1.5",children:[e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"Pinecone DB API Key"}),e.jsx("input",{type:"password",name:"PineConeKey",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"Pinecone API Key",defaultValue:t!=null&&t.PineConeKey?"*".repeat(20):"",required:!0,autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"Pinecone Index Name"}),e.jsx("input",{type:"text",name:"PineConeIndex",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"my-index",defaultValue:t==null?void 0:t.PineConeIndex,required:!0,autoComplete:"off",spellCheck:!1})]})]})})}function pe({settings:t}){return e.jsx("div",{className:"w-full flex flex-col gap-y-7",children:e.jsxs("div",{className:"w-full flex items-center gap-[36px] mt-1.5",children:[e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"Weaviate Endpoint"}),e.jsx("input",{type:"url",name:"WeaviateEndpoint",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"http://localhost:8080",defaultValue:t==null?void 0:t.WeaviateEndpoint,required:!0,autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"API Key"}),e.jsx("input",{type:"password",name:"WeaviateApiKey",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"sk-123Abcweaviate",defaultValue:t!=null&&t.WeaviateApiKey?"*".repeat(20):"",autoComplete:"off",spellCheck:!1})]})]})})}function xe({settings:t}){return e.jsx("div",{className:"w-full flex flex-col gap-y-7",children:e.jsxs("div",{className:"w-full flex items-center gap-[36px] mt-1.5",children:[e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"QDrant API Endpoint"}),e.jsx("input",{type:"url",name:"QdrantEndpoint",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"http://localhost:6633",defaultValue:t==null?void 0:t.QdrantEndpoint,required:!0,autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"API Key"}),e.jsx("input",{type:"password",name:"QdrantApiKey",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"wOeqxsYP4....1244sba",defaultValue:t!=null&&t.QdrantApiKey?"*".repeat(20):"",autoComplete:"off",spellCheck:!1})]})]})})}function he({settings:t}){return e.jsx("div",{className:"w-full flex flex-col gap-y-7",children:e.jsxs("div",{className:"w-full flex items-center gap-[36px] mt-1.5",children:[e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"Milvus DB Address"}),e.jsx("input",{type:"text",name:"MilvusAddress",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"http://localhost:19530",defaultValue:t==null?void 0:t.MilvusAddress,required:!0,autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"Milvus Username"}),e.jsx("input",{type:"text",name:"MilvusUsername",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"username",defaultValue:t==null?void 0:t.MilvusUsername,autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"Milvus Password"}),e.jsx("input",{type:"password",name:"MilvusPassword",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"password",defaultValue:t!=null&&t.MilvusPassword?"*".repeat(20):"",autoComplete:"off",spellCheck:!1})]})]})})}function fe({settings:t}){return e.jsx("div",{className:"w-full flex flex-col gap-y-4",children:e.jsxs("div",{className:"w-full flex items-center gap-[36px] mt-1.5",children:[e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"Cluster Endpoint"}),e.jsx("input",{type:"text",name:"ZillizEndpoint",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"https://sample.api.gcp-us-west1.zillizcloud.com",defaultValue:t==null?void 0:t.ZillizEndpoint,required:!0,autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"API Token"}),e.jsx("input",{type:"password",name:"ZillizApiToken",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"Zilliz cluster API Token",defaultValue:t!=null&&t.ZillizApiToken?"*".repeat(20):"",autoComplete:"off",spellCheck:!1})]})]})})}function be({settings:t}){return e.jsx("div",{className:"w-full flex flex-col gap-y-7",children:e.jsxs("div",{className:"w-full flex items-center gap-[36px] mt-1.5",children:[e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"Astra DB Endpoint"}),e.jsx("input",{type:"url",name:"AstraDBEndpoint",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"Astra DB API endpoint",defaultValue:t==null?void 0:t.AstraDBEndpoint,required:!0,autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:"Astra DB Application Token"}),e.jsx("input",{type:"password",name:"AstraDBApplicationToken",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"AstraCS:...",defaultValue:t!=null&&t.AstraDBApplicationToken?"*".repeat(20):"",required:!0,autoComplete:"off",spellCheck:!1})]})]})})}function we({settings:t}){return e.jsx("div",{className:"w-full flex flex-col gap-y-7",children:e.jsxs("div",{className:"w-full flex items-center gap-[36px] mt-1.5",children:[e.jsxs("div",{className:"flex flex-col w-96",children:[e.jsxs("div",{className:"flex items-center gap-x-1 mb-3",children:[e.jsx("label",{className:"text-white text-sm font-semibold block",children:"Postgres Connection String"}),e.jsx(A,{size:16,className:"text-theme-text-secondary cursor-pointer","data-tooltip-id":"pgvector-connection-string-tooltip","data-tooltip-place":"right"}),e.jsx(D,{delayHide:300,id:"pgvector-connection-string-tooltip",className:"max-w-md z-99",clickable:!0,children:e.jsxs("p",{className:"text-md whitespace-pre-line break-words",children:["This is the connection string for the Postgres database in the format of ",e.jsx("br",{}),e.jsx("code",{children:"postgresql://username:password@host:port/database"}),e.jsx("br",{}),e.jsx("br",{}),"The user for the database must have the following permissions:",e.jsxs("ul",{className:"list-disc list-inside",children:[e.jsx("li",{children:"Read access to the database"}),e.jsx("li",{children:"Read access to the database schema"}),e.jsx("li",{children:"Create access to the database"})]}),e.jsx("br",{}),e.jsx("b",{children:"You must have the pgvector extension installed on the database."})]})})]}),e.jsx("input",{type:"text",name:"PGVectorConnectionString",className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"postgresql://username:password@host:port/database",defaultValue:t!=null&&t.PGVectorConnectionString?"*".repeat(20):"",required:!0,autoComplete:"off",spellCheck:!1})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsxs("div",{className:"flex items-center gap-x-1 mb-3",children:[e.jsx("label",{className:"text-white text-sm font-semibold block",children:"Vector Table Name"}),e.jsx(A,{size:16,className:"text-theme-text-secondary cursor-pointer","data-tooltip-id":"pgvector-table-name-tooltip","data-tooltip-place":"right"}),e.jsx(D,{delayHide:300,id:"pgvector-table-name-tooltip",className:"max-w-md z-99",clickable:!0,children:e.jsxs("p",{className:"text-md whitespace-pre-line break-words",children:["This is the name of the table in the Postgres database that will store the vectors.",e.jsx("br",{}),e.jsx("br",{}),"By default, the table name is ",e.jsx("code",{children:"anythingllm_vectors"}),".",e.jsx("br",{}),e.jsx("br",{}),e.jsx("b",{children:"This table must not already exist on the database - it will be created automatically."})]})})]}),e.jsx("input",{type:"text",name:"PGVectorTableName",autoComplete:"off",defaultValue:t==null?void 0:t.PGVectorTableName,className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"vector_table"})]})]})})}const x=[{name:"LanceDB",value:"lancedb",logo:J,options:t=>e.jsx(ce,{}),description:"100% local vector DB that runs on the same instance as AnythingLLM."},{name:"PGVector",value:"pgvector",logo:ee,options:t=>e.jsx(we,{settings:t}),description:"Vector search powered by PostgreSQL."},{name:"Chroma",value:"chroma",logo:P,options:t=>e.jsx(de,{settings:t}),description:"Open source vector database you can host yourself or on the cloud."},{name:"Chroma Cloud",value:"chromacloud",logo:P,options:t=>e.jsx(ue,{settings:t}),description:"Fully managed Chroma cloud service with enterprise features and support."},{name:"Pinecone",value:"pinecone",logo:te,options:t=>e.jsx(me,{settings:t}),description:"100% cloud-based vector database for enterprise use cases."},{name:"Zilliz Cloud",value:"zilliz",logo:le,options:t=>e.jsx(fe,{settings:t}),description:"Cloud hosted vector database built for enterprise with SOC 2 compliance."},{name:"QDrant",value:"qdrant",logo:ae,options:t=>e.jsx(xe,{settings:t}),description:"Open source local and distributed cloud vector database."},{name:"Weaviate",value:"weaviate",logo:oe,options:t=>e.jsx(pe,{settings:t}),description:"Open source local and cloud hosted multi-modal vector database."},{name:"Milvus",value:"milvus",logo:se,options:t=>e.jsx(he,{settings:t}),description:"Open-source, highly scalable, and blazing fast."},{name:"AstraDB",value:"astra",logo:ne,options:t=>e.jsx(be,{settings:t}),description:"Vector Search for Real-world GenAI."}];function je(){var C;const[t,r]=o.useState(!1),[c,n]=o.useState(!1),[d,h]=o.useState(!1),[u,E]=o.useState({}),[M,T]=o.useState(!0),[f,b]=o.useState(""),[O,K]=o.useState([]),[s,y]=o.useState(null),[w,m]=o.useState(!1),v=o.useRef(null),{isOpen:I,openModal:L,closeModal:j}=H(),{t:i}=z(),g=async l=>{l.preventDefault(),s!==(u==null?void 0:u.VectorDB)&&c&&d?L():await N()},N=async()=>{r(!0);const l=document.getElementById("vectordb-form"),a={},W=new FormData(l);a.VectorDB=s;for(var[G,R]of W.entries())a[G]=R;const{error:k}=await B.updateSystem(a);k?(S(`Failed to save vector database settings: ${k}`,"error"),n(!0)):(S("Vector database preferences saved successfully.","success"),n(!1)),r(!1),j()},q=l=>{b(""),y(l),m(!1),n(!0)},Q=()=>{f.length>0?(b(""),v.current&&(v.current.value="")):m(!w)};o.useEffect(()=>{async function l(){const a=await B.keys();E(a),y((a==null?void 0:a.VectorDB)||"lancedb"),h((a==null?void 0:a.HasExistingEmbeddings)||!1),T(!1)}l()},[]),o.useEffect(()=>{const l=x.filter(a=>a.name.toLowerCase().includes(f.toLowerCase()));K(l)},[f,s]);const p=x.find(l=>l.value===s)??x[0];return e.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex",children:[e.jsx(Z,{}),M?e.jsx("div",{style:{height:V?"100%":"calc(100% - 32px)"},className:"relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-theme-bg-secondary w-full h-full overflow-y-scroll p-4 md:p-0",children:e.jsx("div",{className:"w-full h-full flex justify-center items-center",children:e.jsx(F,{})})}):e.jsx("div",{style:{height:V?"100%":"calc(100% - 32px)"},className:"relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-theme-bg-secondary w-full h-full overflow-y-scroll p-4 md:p-0",children:e.jsx("form",{id:"vectordb-form",onSubmit:g,className:"flex w-full",children:e.jsxs("div",{className:"flex flex-col w-full px-1 md:pl-6 md:pr-[50px] py-16 md:py-6",children:[e.jsxs("div",{className:"w-full flex flex-col gap-y-1 pb-6 border-white light:border-theme-sidebar-border border-b-2 border-opacity-10",children:[e.jsx("div",{className:"flex gap-x-4 items-center",children:e.jsx("p",{className:"text-lg leading-6 font-bold text-white",children:i("vector.title")})}),e.jsx("p",{className:"text-xs leading-[18px] font-base text-white text-opacity-60",children:i("vector.description")})]}),e.jsx("div",{className:"w-full justify-end flex",children:c&&e.jsx($,{onClick:()=>g(),className:"mt-3 mr-0 -mb-14 z-10",children:i(t?"common.saving":"common.save")})}),e.jsx("div",{className:"text-base font-bold text-white mt-6 mb-4",children:i("vector.provider.title")}),e.jsxs("div",{className:"relative",children:[w&&e.jsx("div",{className:"fixed top-0 left-0 w-full h-full bg-black bg-opacity-70 backdrop-blur-sm z-10",onClick:()=>m(!1)}),w?e.jsx("div",{className:"absolute top-0 left-0 w-full max-w-[640px] max-h-[310px] min-h-[64px] bg-theme-settings-input-bg rounded-lg flex flex-col justify-between cursor-pointer border-2 border-primary-button z-20",children:e.jsxs("div",{className:"w-full flex flex-col gap-y-1",children:[e.jsxs("div",{className:"flex items-center sticky top-0 z-10 border-b border-[#9CA3AF] mx-4 bg-theme-settings-input-bg",children:[e.jsx(U,{size:20,weight:"bold",className:"absolute left-4 z-30 text-theme-text-primary -ml-4 my-2"}),e.jsx("input",{type:"text",name:"vdb-search",autoComplete:"off",placeholder:"Search all vector database providers",className:"border-none -ml-4 my-2 bg-transparent z-20 pl-12 h-[38px] w-full px-4 py-1 text-sm outline-none text-theme-text-primary placeholder:text-theme-text-primary placeholder:font-medium",onChange:l=>b(l.target.value),ref:v,onKeyDown:l=>{l.key==="Enter"&&l.preventDefault()}}),e.jsx(Y,{size:20,weight:"bold",className:"cursor-pointer text-white hover:text-x-button",onClick:Q})]}),e.jsx("div",{className:"flex-1 pl-4 pr-2 flex flex-col gap-y-1 overflow-y-auto white-scrollbar pb-4 max-h-[245px]",children:O.map(l=>e.jsx(ie,{name:l.name,value:l.value,image:l.logo,description:l.description,checked:s===l.value,onClick:()=>q(l.value)},l.name))})]})}):e.jsxs("button",{className:"w-full max-w-[640px] h-[64px] bg-theme-settings-input-bg rounded-lg flex items-center p-[14px] justify-between cursor-pointer border-2 border-transparent hover:border-primary-button transition-all duration-300",type:"button",onClick:()=>m(!0),children:[e.jsxs("div",{className:"flex gap-x-4 items-center",children:[e.jsx("img",{src:p.logo,alt:`${p.name} logo`,className:"w-10 h-10 rounded-md"}),e.jsxs("div",{className:"flex flex-col text-left",children:[e.jsx("div",{className:"text-sm font-semibold text-white",children:p.name}),e.jsx("div",{className:"mt-1 text-xs text-description",children:p.description})]})]}),e.jsx(X,{size:24,weight:"bold",className:"text-white"})]})]}),e.jsx("div",{onChange:()=>n(!0),className:"mt-4 flex flex-col gap-y-1",children:s&&((C=x.find(l=>l.value===s))==null?void 0:C.options(u))})]})})}),e.jsx(_,{isOpen:I,children:e.jsx(re,{warningText:"Switching the vector database will reset all previously embedded documents in all workspaces.\\n\\nConfirming will clear all embeddings from your vector database and remove all documents from your workspaces. Your uploaded documents will not be deleted, they will be available for re-embedding.",onClose:j,onConfirm:N})})]})}export{je as default};
@@ -1 +1 @@
1
- import{r as i,u,j as e,aF as p,aT as c,a1 as h,i as m}from"../index.js";function g(){const[n,r]=i.useState(!1),[l,o]=i.useState(!0),{t:a}=u(),d=async t=>{o(t),r(!0);try{c.updateSettings({autoSubmitSttInput:t})}catch(s){console.error("Failed to update appearance settings:",s),o(!t)}r(!1)};return i.useEffect(()=>{function t(){const s=c.getSettings();o(s.autoSubmitSttInput??!0)}t()},[]),e.jsx("div",{className:"my-4",children:e.jsx(p,{size:"md",variant:"horizontal",enabled:l,onChange:d,disabled:n,label:a("customization.chat.auto_submit.title"),description:a("customization.chat.auto_submit.description")})})}function S(){const[n,r]=i.useState(!1),[l,o]=i.useState(!1),{t:a}=u(),d=async t=>{o(t),r(!0);try{c.updateSettings({autoPlayAssistantTtsResponse:t})}catch(s){console.error("Failed to update appearance settings:",s),o(!t)}r(!1)};return i.useEffect(()=>{function t(){const s=c.getSettings();o(s.autoPlayAssistantTtsResponse??!1)}t()},[]),e.jsx("div",{className:"my-4",children:e.jsx(p,{size:"md",variant:"horizontal",enabled:l,onChange:d,disabled:n,label:a("customization.chat.auto_speak.title"),description:a("customization.chat.auto_speak.description")})})}function f(){const{t:n}=u(),[r,l]=i.useState(!1),[o,a]=i.useState(c.get("enableSpellCheck")),d=async t=>{a(t),l(!0);try{c.set("enableSpellCheck",t)}catch(s){console.error("Failed to update appearance settings:",s),a(!t)}l(!1)};return e.jsx("div",{className:"my-4",children:e.jsx(p,{size:"md",variant:"horizontal",enabled:o,onChange:d,disabled:r,label:n("customization.chat.spellcheck.title"),description:n("customization.chat.spellcheck.description")})})}function b(){const{t:n}=u(),[r,l]=i.useState(!1),[o,a]=i.useState(!1),d=async t=>{a(t),l(!0);try{c.updateSettings({showScrollbar:t})}catch(s){console.error("Failed to update appearance settings:",s),a(!t)}l(!1)};return i.useEffect(()=>{function t(){const s=c.getSettings();a(s.showScrollbar)}t()},[]),e.jsx("div",{className:"my-4",children:e.jsx(p,{size:"md",variant:"horizontal",enabled:o,onChange:d,disabled:r,label:n("customization.items.show-scrollbar.title"),description:n("customization.items.show-scrollbar.description")})})}function x(){const{t:n}=u(),[r,l]=i.useState(!1),[o,a]=i.useState(!1),d=async t=>{a(t),l(!0);try{c.updateSettings({renderHTML:t})}catch(s){console.error("Failed to update appearance settings:",s),a(!t)}l(!1)};return i.useEffect(()=>{function t(){const s=c.getSettings();a(s.renderHTML)}t()},[]),e.jsx("div",{className:"my-4",children:e.jsx(p,{size:"md",variant:"horizontal",enabled:o,onChange:d,disabled:r,label:n("customization.items.render-html.title"),description:n("customization.items.render-html.description")})})}function y(){const{t:n}=u();return e.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex",children:[e.jsx(h,{}),e.jsx("div",{style:{height:m?"100%":"calc(100% - 32px)"},className:"relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-theme-bg-secondary w-full h-full overflow-y-scroll p-4 md:p-0",children:e.jsxs("div",{className:"flex flex-col w-full px-1 md:pl-6 md:pr-[86px] md:py-6 py-16",children:[e.jsxs("div",{className:"w-full flex flex-col gap-y-1 pb-6 border-white light:border-theme-sidebar-border border-b-2 border-opacity-10",children:[e.jsx("div",{className:"items-center",children:e.jsx("p",{className:"text-lg leading-6 font-bold text-white",children:n("customization.chat.title")})}),e.jsx("p",{className:"text-xs leading-[18px] font-base text-white text-opacity-60",children:n("customization.chat.description")})]}),e.jsx(g,{}),e.jsx(S,{}),e.jsx(f,{}),e.jsx(b,{}),e.jsx(x,{})]})})]})}export{y as default};
1
+ import{r as i,u,j as e,aG as p,aU as c,a1 as h,i as m}from"../index.js";function g(){const[n,r]=i.useState(!1),[l,o]=i.useState(!0),{t:a}=u(),d=async t=>{o(t),r(!0);try{c.updateSettings({autoSubmitSttInput:t})}catch(s){console.error("Failed to update appearance settings:",s),o(!t)}r(!1)};return i.useEffect(()=>{function t(){const s=c.getSettings();o(s.autoSubmitSttInput??!0)}t()},[]),e.jsx("div",{className:"my-4",children:e.jsx(p,{size:"md",variant:"horizontal",enabled:l,onChange:d,disabled:n,label:a("customization.chat.auto_submit.title"),description:a("customization.chat.auto_submit.description")})})}function S(){const[n,r]=i.useState(!1),[l,o]=i.useState(!1),{t:a}=u(),d=async t=>{o(t),r(!0);try{c.updateSettings({autoPlayAssistantTtsResponse:t})}catch(s){console.error("Failed to update appearance settings:",s),o(!t)}r(!1)};return i.useEffect(()=>{function t(){const s=c.getSettings();o(s.autoPlayAssistantTtsResponse??!1)}t()},[]),e.jsx("div",{className:"my-4",children:e.jsx(p,{size:"md",variant:"horizontal",enabled:l,onChange:d,disabled:n,label:a("customization.chat.auto_speak.title"),description:a("customization.chat.auto_speak.description")})})}function f(){const{t:n}=u(),[r,l]=i.useState(!1),[o,a]=i.useState(c.get("enableSpellCheck")),d=async t=>{a(t),l(!0);try{c.set("enableSpellCheck",t)}catch(s){console.error("Failed to update appearance settings:",s),a(!t)}l(!1)};return e.jsx("div",{className:"my-4",children:e.jsx(p,{size:"md",variant:"horizontal",enabled:o,onChange:d,disabled:r,label:n("customization.chat.spellcheck.title"),description:n("customization.chat.spellcheck.description")})})}function b(){const{t:n}=u(),[r,l]=i.useState(!1),[o,a]=i.useState(!1),d=async t=>{a(t),l(!0);try{c.updateSettings({showScrollbar:t})}catch(s){console.error("Failed to update appearance settings:",s),a(!t)}l(!1)};return i.useEffect(()=>{function t(){const s=c.getSettings();a(s.showScrollbar)}t()},[]),e.jsx("div",{className:"my-4",children:e.jsx(p,{size:"md",variant:"horizontal",enabled:o,onChange:d,disabled:r,label:n("customization.items.show-scrollbar.title"),description:n("customization.items.show-scrollbar.description")})})}function x(){const{t:n}=u(),[r,l]=i.useState(!1),[o,a]=i.useState(!1),d=async t=>{a(t),l(!0);try{c.updateSettings({renderHTML:t})}catch(s){console.error("Failed to update appearance settings:",s),a(!t)}l(!1)};return i.useEffect(()=>{function t(){const s=c.getSettings();a(s.renderHTML)}t()},[]),e.jsx("div",{className:"my-4",children:e.jsx(p,{size:"md",variant:"horizontal",enabled:o,onChange:d,disabled:r,label:n("customization.items.render-html.title"),description:n("customization.items.render-html.description")})})}function y(){const{t:n}=u();return e.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex",children:[e.jsx(h,{}),e.jsx("div",{style:{height:m?"100%":"calc(100% - 32px)"},className:"relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-theme-bg-secondary w-full h-full overflow-y-scroll p-4 md:p-0",children:e.jsxs("div",{className:"flex flex-col w-full px-1 md:pl-6 md:pr-[86px] md:py-6 py-16",children:[e.jsxs("div",{className:"w-full flex flex-col gap-y-1 pb-6 border-white light:border-theme-sidebar-border border-b-2 border-opacity-10",children:[e.jsx("div",{className:"items-center",children:e.jsx("p",{className:"text-lg leading-6 font-bold text-white",children:n("customization.chat.title")})}),e.jsx("p",{className:"text-xs leading-[18px] font-base text-white text-opacity-60",children:n("customization.chat.description")})]}),e.jsx(g,{}),e.jsx(S,{}),e.jsx(f,{}),e.jsx(b,{}),e.jsx(x,{})]})})]})}export{y as default};