totem-llm 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/README.md +12 -0
  2. package/package.json +1 -1
  3. package/server/models/systemSettings.js +1 -1
  4. package/server/models/workspace.js +2 -2
  5. package/server/public/assets/{404-b5c6b0dc.js → 404-56d107aa.js} +1 -1
  6. package/server/public/assets/RunDetailPage-da6aa377.js +1 -0
  7. package/server/public/assets/RunHistoryPage-2fcb4325.js +1 -0
  8. package/server/public/assets/{Trans-ca8f9cfe.js → Trans-820f1dad.js} +1 -1
  9. package/server/public/assets/{cron-1f15870f.js → cron-307d3fc6.js} +1 -1
  10. package/server/public/assets/{files-e19b0187.js → files-676613ed.js} +1 -1
  11. package/server/public/assets/index-01932fa1.js +1 -0
  12. package/server/public/assets/{index-a6e642d7.js → index-0bf4fb6b.js} +1 -1
  13. package/server/public/assets/index-166e238c.js +1 -0
  14. package/server/public/assets/{index-f86e167c.js → index-1c653bbf.js} +2 -2
  15. package/server/public/assets/index-1fe43260.js +1 -0
  16. package/server/public/assets/index-27cc497c.js +1 -0
  17. package/server/public/assets/{index-9cc77cb6.js → index-2aac91d0.js} +3 -3
  18. package/server/public/assets/index-2d84e5fe.js +1 -0
  19. package/server/public/assets/index-33ded078.js +1 -0
  20. package/server/public/assets/{index-2f526c2a.js → index-3cb59d82.js} +1 -1
  21. package/server/public/assets/{index-92d3b7bc.js → index-4277cf52.js} +1 -1
  22. package/server/public/assets/index-44ab5f11.js +1 -0
  23. package/server/public/assets/index-4750915e.js +1 -0
  24. package/server/public/assets/{index-ab72b353.js → index-574ed823.js} +2 -2
  25. package/server/public/assets/{index-3a2c5fd7.js → index-631fc042.js} +1 -1
  26. package/server/public/assets/index-65184421.js +1 -0
  27. package/server/public/assets/index-6679334a.js +1 -0
  28. package/server/public/assets/{index-6cdecde9.js → index-6bd7928a.js} +9 -9
  29. package/server/public/assets/index-6d56c896.js +18 -0
  30. package/server/public/assets/{index-925792fe.js → index-72544df5.js} +1 -1
  31. package/server/public/assets/index-80edec8f.js +1 -0
  32. package/server/public/assets/index-83825216.js +1 -0
  33. package/server/public/assets/index-841db586.js +1 -0
  34. package/server/public/assets/index-882e468e.js +1 -0
  35. package/server/public/assets/{index-ab35fb74.js → index-8c2371f5.js} +1 -1
  36. package/server/public/assets/{index-8eb228e2.js → index-9ab52cfb.js} +3 -3
  37. package/server/public/assets/{index-ad8e77d2.js → index-a2978aa0.js} +2 -2
  38. package/server/public/assets/index-a29a8c19.js +3 -0
  39. package/server/public/assets/{index-62fee0f9.js → index-ae4f557d.js} +2 -2
  40. package/server/public/assets/{index-8132c765.js → index-b49f94f1.js} +1 -1
  41. package/server/public/assets/{index-52850dde.js → index-c453ccc8.js} +1 -1
  42. package/server/public/assets/index-cd6bc090.js +1 -0
  43. package/server/public/assets/{index-c391a2fa.js → index-d1d3d69a.js} +1 -1
  44. package/server/public/assets/index-d29fdeda.js +1 -0
  45. package/server/public/assets/index-d54b0575.js +1 -0
  46. package/server/public/assets/index-dcc00e8c.js +3 -0
  47. package/server/public/assets/index-e58bf860.js +1 -0
  48. package/server/public/assets/index-ec3efa1e.js +1 -0
  49. package/server/public/assets/index-ed9034ac.js +1 -0
  50. package/server/public/assets/{index-92574f3a.js → index-efee6d1f.js} +1 -1
  51. package/server/public/assets/index-f9305828.js +1 -0
  52. package/server/public/assets/index-fce187ac.js +1 -0
  53. package/server/public/assets/{main-8ad4162f.js → main-0b9e408b.js} +1 -1
  54. package/server/public/assets/{mcpServers-a175e8cf.js → mcpServers-1686e782.js} +1 -1
  55. package/server/public/assets/{moment-8a59df1b.js → moment-75486807.js} +1 -1
  56. package/server/public/assets/{purify-fbc9e8e2.js → purify-eb750cf4.js} +1 -1
  57. package/server/public/assets/{react-beautiful-dnd.esm-45ea8487.js → react-beautiful-dnd.esm-bb85eef1.js} +1 -1
  58. package/server/public/assets/{truncate-352eb33b.js → truncate-06273256.js} +1 -1
  59. package/server/public/index.js +27 -27
  60. package/server/utils/AiProviders/ollama/index.js +2 -0
  61. package/server/utils/chats/agents.js +7 -1
  62. package/server/utils/telegramBot/utils/verification.js +1 -1
  63. package/totem.features.cjs +5 -108
  64. package/server/public/assets/RunDetailPage-74b1e63a.js +0 -1
  65. package/server/public/assets/RunHistoryPage-9609436a.js +0 -1
  66. package/server/public/assets/index-25b2660c.js +0 -1
  67. package/server/public/assets/index-2a7c0b04.js +0 -1
  68. package/server/public/assets/index-35b0a39b.js +0 -3
  69. package/server/public/assets/index-3643e990.js +0 -1
  70. package/server/public/assets/index-39899779.js +0 -1
  71. package/server/public/assets/index-51f23c79.js +0 -1
  72. package/server/public/assets/index-56bb11a0.js +0 -1
  73. package/server/public/assets/index-65801ac6.js +0 -1
  74. package/server/public/assets/index-6710499a.js +0 -1
  75. package/server/public/assets/index-73aba4c6.js +0 -3
  76. package/server/public/assets/index-837868b3.js +0 -1
  77. package/server/public/assets/index-86e8a6b4.js +0 -1
  78. package/server/public/assets/index-8e43159f.js +0 -1
  79. package/server/public/assets/index-994c849a.js +0 -1
  80. package/server/public/assets/index-9f71774b.js +0 -1
  81. package/server/public/assets/index-9f7dabd6.js +0 -1
  82. package/server/public/assets/index-a0e2be61.js +0 -1
  83. package/server/public/assets/index-ac4d4b42.js +0 -1
  84. package/server/public/assets/index-c9b59c35.js +0 -1
  85. package/server/public/assets/index-dad0fb8d.js +0 -18
  86. package/server/public/assets/index-dd210692.js +0 -1
  87. package/server/public/assets/index-e28b0ead.js +0 -1
  88. package/server/public/assets/index-e6c540e1.js +0 -1
  89. package/server/public/assets/index-f984ef26.js +0 -1
  90. package/server/public/assets/index-fb26b60a.js +0 -1
@@ -1 +1 @@
1
- import{R as o,r as d,g as H,u as E,j as e,M as Z,k as C,v as V,p as L,c as A,I as M,a9 as $,aD as q,a8 as U,a5 as K,a4 as G,bv as J,aC 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(C,{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(""))}},S=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:()=>S(n),className:"border-none text-theme-text-primary hover:text-theme-text-secondary cursor-pointer",children:e.jsx(C,{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(C,{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 S=p+l.length+3;m.setSelectionRange(S,S),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(C,{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(C,{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 Ce(){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 Se({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(Se,{...l});case f.FINISH:return e.jsx(Ce,{});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(C,{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(""))}},S=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:()=>S(n),className:"border-none text-theme-text-primary hover:text-theme-text-secondary cursor-pointer",children:e.jsx(C,{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(""))}},S=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:()=>S(n),className:"border-none text-theme-text-primary hover:text-theme-text-secondary cursor-pointer",children:e.jsx(C,{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(C,{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,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 +1 @@
1
- import{j as e,ac as a,k as i}from"../index.js";function n({warningText:t="",onClose:r,onConfirm:s}){return e.jsxs("div",{className:"w-full max-w-2xl bg-theme-bg-secondary rounded-lg shadow border-2 border-theme-modal-border overflow-hidden z-9999",children:[e.jsxs("div",{className:"relative px-6 py-5 border-b rounded-t border-theme-modal-border",children:[e.jsxs("div",{className:"w-full flex gap-x-2 items-center",children:[e.jsx(a,{className:"text-red-500 w-6 h-6",weight:"fill"}),e.jsx("h3",{className:"text-xl font-semibold text-red-500 overflow-hidden overflow-ellipsis whitespace-nowrap",children:"WARNING - This action is irreversible"})]}),e.jsx("button",{onClick:r,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(i,{size:24,weight:"bold",className:"text-white"})})]}),e.jsx("div",{className:"h-full w-full overflow-y-auto",style:{maxHeight:"calc(100vh - 200px)"},children:e.jsx("div",{className:"py-7 px-9 space-y-2 flex-col",children:e.jsxs("p",{className:"text-white",children:[t.split("\\n").map((o,l)=>e.jsxs("span",{children:[o,e.jsx("br",{})]},l)),e.jsx("br",{}),e.jsx("br",{}),"Are you sure you want to proceed?"]})})}),e.jsxs("div",{className:"flex w-full justify-end items-center p-6 space-x-2 border-t border-theme-modal-border rounded-b",children:[e.jsx("button",{onClick:r,type:"button",className:"transition-all duration-300 bg-transparent text-white hover:opacity-60 px-4 py-2 rounded-lg text-sm border-none",children:"Cancel"}),e.jsx("button",{onClick:s,type:"submit",className:"transition-all duration-300 bg-red-500 light:text-white text-white hover:opacity-60 px-4 py-2 rounded-lg text-sm border-none",children:"Confirm"})]})]})}export{n as C};
1
+ import{j as e,ae as a,k as i}from"../index.js";function n({warningText:t="",onClose:r,onConfirm:s}){return e.jsxs("div",{className:"w-full max-w-2xl bg-theme-bg-secondary rounded-lg shadow border-2 border-theme-modal-border overflow-hidden z-9999",children:[e.jsxs("div",{className:"relative px-6 py-5 border-b rounded-t border-theme-modal-border",children:[e.jsxs("div",{className:"w-full flex gap-x-2 items-center",children:[e.jsx(a,{className:"text-red-500 w-6 h-6",weight:"fill"}),e.jsx("h3",{className:"text-xl font-semibold text-red-500 overflow-hidden overflow-ellipsis whitespace-nowrap",children:"WARNING - This action is irreversible"})]}),e.jsx("button",{onClick:r,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(i,{size:24,weight:"bold",className:"text-white"})})]}),e.jsx("div",{className:"h-full w-full overflow-y-auto",style:{maxHeight:"calc(100vh - 200px)"},children:e.jsx("div",{className:"py-7 px-9 space-y-2 flex-col",children:e.jsxs("p",{className:"text-white",children:[t.split("\\n").map((o,l)=>e.jsxs("span",{children:[o,e.jsx("br",{})]},l)),e.jsx("br",{}),e.jsx("br",{}),"Are you sure you want to proceed?"]})})}),e.jsxs("div",{className:"flex w-full justify-end items-center p-6 space-x-2 border-t border-theme-modal-border rounded-b",children:[e.jsx("button",{onClick:r,type:"button",className:"transition-all duration-300 bg-transparent text-white hover:opacity-60 px-4 py-2 rounded-lg text-sm border-none",children:"Cancel"}),e.jsx("button",{onClick:s,type:"submit",className:"transition-all duration-300 bg-red-500 light:text-white text-white hover:opacity-60 px-4 py-2 rounded-lg text-sm border-none",children:"Confirm"})]})]})}export{n as C};
@@ -0,0 +1 @@
1
+ import{r as c,j as e,aF as j,aU as y,v,p as h,t as w,c as d,i as f,e as N,aV as x,a1 as F,aE as _,M as S}from"../index.js";import{A as u}from"./admin-04b020fe.js";function L({enabled:t=!1,onToggle:l}){const[s,a]=c.useState(t);async function i(){if(!await w.experimentalFeatures.liveSync.toggleFeature(!s))return d("Failed to update status of feature.","error",{clear:!0}),!1;a(!s),d(`Live document content sync has been ${s?"disabled":"enabled"}.`,"success",{clear:!0}),l()}return e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex flex-col gap-y-6 max-w-[500px]",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-theme-text-primary text-md font-bold",children:"Automatic Document Content Sync"}),e.jsx(j,{size:"lg",enabled:s,onChange:i})]}),e.jsxs("div",{className:"flex flex-col space-y-4",children:[e.jsx("p",{className:"text-theme-text-secondary text-sm",children:`Enable the ability to specify a document to be "watched". Watched document's content will be regularly fetched and updated in AnythingLLM.`}),e.jsx("p",{className:"text-theme-text-secondary text-sm",children:"Watched documents will automatically update in all workspaces they are referenced in at the same time of update."}),e.jsx("p",{className:"text-theme-text-secondary text-xs italic",children:"This feature only applies to web-based content, such as websites, Confluence, YouTube, and GitHub files."})]})]}),e.jsx("div",{className:"mt-8",children:e.jsxs("ul",{className:"space-y-2",children:[e.jsx("li",{children:e.jsxs("a",{href:"https://docs.anythingllm.com/beta-preview/active-features/live-document-sync",target:"_blank",className:"text-sm text-blue-400 light:text-blue-500 hover:underline flex items-center gap-x-1",rel:"noreferrer",children:[e.jsx(y,{size:14}),e.jsx("span",{children:"Feature Documentation and Warnings"})]})}),e.jsx("li",{children:e.jsx(v,{to:h.experimental.liveDocumentSync.manage(),className:"text-sm text-blue-400 light:text-blue-500 hover:underline",children:"Manage Watched Documents →"})})]})})]})}const o={experimental_live_file_sync:{title:"Live Document Sync",component:L,key:"experimental_live_file_sync"}};function z(){const[t,l]=c.useState({}),[s,a]=c.useState(!0),[i,m]=c.useState("experimental_live_file_sync");c.useEffect(()=>{async function n(){a(!0);const{settings:r}=await u.systemPreferencesByFields(["feature_flags"]);l((r==null?void 0:r.feature_flags)??{}),a(!1)}n()},[]);const p=async()=>{const{settings:n}=await u.systemPreferencesByFields(["feature_flags"]);l((n==null?void 0:n.feature_flags)??{})};return s?e.jsx("div",{style:{height:f?"100%":"calc(100% - 32px)"},className:"relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] w-full h-full flex justify-center items-center",children:e.jsx(N,{})}):e.jsx(k,{children:e.jsxs("div",{className:"flex-1 flex gap-x-6 p-4 mt-10",children:[e.jsxs("div",{className:"flex flex-col gap-y-[18px]",children:[e.jsxs("div",{className:"text-white flex items-center gap-x-2",children:[e.jsx(x,{size:24}),e.jsx("p",{className:"text-lg font-medium",children:"Experimental Features"})]}),e.jsx("div",{className:"bg-theme-bg-secondary text-white rounded-xl min-w-[360px] w-fit",children:Object.values(o).map((n,r)=>{const g=r===0,b=r===Object.values(o).length-1;return e.jsx(T,{feature:n,isSelected:i===n.key,isActive:t[n.key],handleClick:m,borderClass:[...g?["rounded-t-xl"]:[],...b?["rounded-b-xl"]:["border-b border-white/10"]].join(" ")},n.key)})})]}),e.jsx(A,{children:e.jsx("div",{className:"flex-[2] flex flex-col gap-y-[18px] mt-10",children:e.jsx("div",{className:"bg-theme-bg-secondary text-white rounded-xl flex-1 p-4",children:i?e.jsx(E,{feature:o[i],settings:t,refresh:p}):e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-white/60",children:[e.jsx(x,{size:40}),e.jsx("p",{className:"font-medium",children:"Select an experimental feature"})]})})})})]})})}function k({children:t}){return e.jsxs("div",{id:"workspace-feature-settings-container",className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex md:mt-0 mt-6",children:[e.jsx(F,{}),e.jsx("div",{style:{height:f?"100%":"calc(100% - 32px)"},className:"relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] w-full h-full flex",children:t})]})}function T({feature:t={},isSelected:l=!1,isActive:s=!1,handleClick:a=()=>{},borderClass:i="border-b border-white/10"}){return e.jsxs("div",{className:`py-3 px-4 flex items-center justify-between cursor-pointer transition-all duration-300 hover:bg-white/5 ${i} ${l?"bg-white/10 light:bg-theme-bg-sidebar":""}`,onClick:()=>{t!=null&&t.href?window.location=t.href:a==null||a(t.key)},children:[e.jsx("div",{className:"text-sm font-light",children:t.title}),e.jsx("div",{className:"flex items-center gap-x-2",children:t.autoEnabled?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-sm text-theme-text-secondary font-medium",children:"On"}),e.jsx("div",{className:"w-[14px]"})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-sm text-theme-text-secondary font-medium",children:s?"On":"Off"}),e.jsx(_,{size:14,weight:"bold",className:"text-theme-text-secondary"})]})})]},t.key)}function E({feature:t,settings:l,refresh:s}){const a=t==null?void 0:t.component;return a?e.jsx(a,{enabled:l[t.key],feature:t.key,onToggle:s}):null}function A({children:t}){if(!window.localStorage.getItem("anythingllm_tos_experimental_feature_set")){let l=function(s){s.preventDefault(),window.localStorage.setItem("anythingllm_tos_experimental_feature_set","accepted"),d("Experimental Feature set enabled. Reloading the page.","success"),setTimeout(()=>{window.location.reload()},2500)};return e.jsxs(e.Fragment,{children:[e.jsx(S,{isOpen:!0,children:e.jsxs("div",{className:"w-full max-w-2xl bg-theme-bg-secondary rounded-lg shadow border-2 border-theme-modal-border overflow-hidden",children:[e.jsx("div",{className:"relative p-6 border-b rounded-t border-theme-modal-border",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x,{size:24,className:"text-theme-text-primary"}),e.jsx("h3",{className:"text-xl font-semibold text-white",children:"Terms of use for experimental features"})]})}),e.jsxs("form",{onSubmit:l,children:[e.jsx("div",{className:"py-7 px-9 space-y-4 flex-col",children:e.jsxs("div",{className:"w-full text-white text-md flex flex-col gap-y-4",children:[e.jsxs("p",{children:["Experimental features of AnythingLLM are features that we are piloting and are ",e.jsx("b",{children:"opt-in"}),". We proactively will condition or warn you on any potential concerns should any exist prior to approval of any feature."]}),e.jsxs("div",{children:[e.jsx("p",{children:"Use of any feature on this page can result in, but not limited to, the following possibilities."}),e.jsxs("ul",{className:"list-disc ml-6 text-sm font-mono mt-2",children:[e.jsx("li",{children:"Loss of data."}),e.jsx("li",{children:"Change in quality of results."}),e.jsx("li",{children:"Increased storage."}),e.jsx("li",{children:"Increased resource consumption."}),e.jsx("li",{children:"Increased cost or use of any connected LLM or embedding provider."}),e.jsx("li",{children:"Potential bugs or issues using AnythingLLM."})]})]}),e.jsxs("div",{children:[e.jsx("p",{children:"Use of an experimental feature also comes with the following list of non-exhaustive conditions."}),e.jsxs("ul",{className:"list-disc ml-6 text-sm font-mono mt-2",children:[e.jsx("li",{children:"Feature may not exist in future updates."}),e.jsx("li",{children:"The feature being used is not currently stable."}),e.jsx("li",{children:"The feature may not be available in future versions, configurations, or subscriptions of AnythingLLM."}),e.jsxs("li",{children:["Your privacy settings ",e.jsx("b",{children:"will be honored"})," with use of any beta feature."]}),e.jsx("li",{children:"These conditions may change in future updates."})]})]}),e.jsxs("p",{children:["Access to any features requires approval of this modal. If you would like to read more you can refer to"," ",e.jsx("a",{href:"https://docs.anythingllm.com/beta-preview/overview",className:"underline text-blue-500",children:"docs.anythingllm.com"})," ","or email"," ",e.jsx("a",{href:"mailto:team@mintplexlabs.com",className:"underline text-blue-500",children:"team@mintplexlabs.com"})]})]})}),e.jsxs("div",{className:"flex w-full justify-between items-center p-6 space-x-2 border-t border-theme-modal-border rounded-b",children:[e.jsx("a",{href:h.home(),className:"transition-all duration-300 bg-transparent text-white hover:bg-red-500/50 light:hover:bg-red-300/50 px-4 py-2 rounded-lg text-sm border border-theme-modal-border",children:"Reject & close"}),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 border border-theme-modal-border",children:"I understand"})]})]})]})}),t]})}return e.jsx(e.Fragment,{children:t})}export{z as default};
@@ -0,0 +1 @@
1
+ import{j as e,a1 as t,i as l}from"../index.js";import{H as r}from"./index-b49f94f1.js";import"./communityHub-aba61686.js";import"./Eye-9f033dc0.js";import"./truncate-06273256.js";function o(){return e.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex",children:[e.jsx(t,{}),e.jsx("div",{style:{height:l?"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-theme-text-primary",children:"Community Hub"})}),e.jsx("p",{className:"text-xs leading-[18px] font-base text-theme-text-secondary",children:"Share and collaborate with the AnythingLLM community."})]}),e.jsx(r,{})]})})]})}export{o as default};
@@ -1,4 +1,4 @@
1
- import{R as r,r as l,g as C,j as e,O as S,aU as V,k as E,c as M,W as I,q as A,$ as Z,i as H,C as L,S as O,M as $}from"../index.js";import{A as f}from"./admin-04b020fe.js";import{w as F}from"./Check-7e83fb0d.js";import{C as W}from"./Copy-d323e545.js";const z=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M224,44H32A12,12,0,0,0,20,56V192a20,20,0,0,0,20,20H216a20,20,0,0,0,20-20V56A12,12,0,0,0,224,44ZM193.15,68,128,127.72,62.85,68ZM44,188V83.28l75.89,69.57a12,12,0,0,0,16.22,0L212,83.28V188Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M224,56l-96,88L32,56Z",opacity:"0.2"}),r.createElement("path",{d:"M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM203.43,64,128,133.15,52.57,64ZM216,192H40V74.19l82.59,75.71a8,8,0,0,0,10.82,0L216,74.19V192Z"}))],["fill",r.createElement(r.Fragment,null,r.createElement("path",{d:"M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48Zm-8,144H40V74.19l82.59,75.71a8,8,0,0,0,10.82,0L216,74.19V192Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M224,50H32a6,6,0,0,0-6,6V192a14,14,0,0,0,14,14H216a14,14,0,0,0,14-14V56A6,6,0,0,0,224,50ZM208.58,62,128,135.86,47.42,62ZM216,194H40a2,2,0,0,1-2-2V69.64l86,78.78a6,6,0,0,0,8.1,0L218,69.64V192A2,2,0,0,1,216,194Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM203.43,64,128,133.15,52.57,64ZM216,192H40V74.19l82.59,75.71a8,8,0,0,0,10.82,0L216,74.19V192Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M224,52H32a4,4,0,0,0-4,4V192a12,12,0,0,0,12,12H216a12,12,0,0,0,12-12V56A4,4,0,0,0,224,52Zm-10.28,8L128,138.57,42.28,60ZM216,196H40a4,4,0,0,1-4-4V65.09L125.3,147a4,4,0,0,0,5.4,0L220,65.09V192A4,4,0,0,1,216,196Z"}))]]);var T=Object.defineProperty,B=Object.defineProperties,P=Object.getOwnPropertyDescriptors,w=Object.getOwnPropertySymbols,R=Object.prototype.hasOwnProperty,D=Object.prototype.propertyIsEnumerable,v=(t,s,a)=>s in t?T(t,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[s]=a,Y=(t,s)=>{for(var a in s||(s={}))R.call(s,a)&&v(t,a,s[a]);if(w)for(var a of w(s))D.call(s,a)&&v(t,a,s[a]);return t},_=(t,s)=>B(t,P(s));const y=l.forwardRef((t,s)=>r.createElement(C,_(Y({ref:s},t),{weights:z})));y.displayName="EnvelopeSimple";function q({invite:t}){var i,u;const s=l.useRef(null),[a,p]=l.useState(t.status),[o,c]=l.useState(!1),d=async()=>{if(!window.confirm(`Are you sure you want to deactivate this invite?
1
+ import{R as r,r as l,g as C,j as e,Q as S,aW as V,k as E,c as M,W as I,q as A,a1 as Z,i as H,C as L,S as O,M as F}from"../index.js";import{A as f}from"./admin-04b020fe.js";import{w as W}from"./Check-7e83fb0d.js";import{C as $}from"./Copy-d323e545.js";const z=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M224,44H32A12,12,0,0,0,20,56V192a20,20,0,0,0,20,20H216a20,20,0,0,0,20-20V56A12,12,0,0,0,224,44ZM193.15,68,128,127.72,62.85,68ZM44,188V83.28l75.89,69.57a12,12,0,0,0,16.22,0L212,83.28V188Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M224,56l-96,88L32,56Z",opacity:"0.2"}),r.createElement("path",{d:"M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM203.43,64,128,133.15,52.57,64ZM216,192H40V74.19l82.59,75.71a8,8,0,0,0,10.82,0L216,74.19V192Z"}))],["fill",r.createElement(r.Fragment,null,r.createElement("path",{d:"M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48Zm-8,144H40V74.19l82.59,75.71a8,8,0,0,0,10.82,0L216,74.19V192Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M224,50H32a6,6,0,0,0-6,6V192a14,14,0,0,0,14,14H216a14,14,0,0,0,14-14V56A6,6,0,0,0,224,50ZM208.58,62,128,135.86,47.42,62ZM216,194H40a2,2,0,0,1-2-2V69.64l86,78.78a6,6,0,0,0,8.1,0L218,69.64V192A2,2,0,0,1,216,194Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM203.43,64,128,133.15,52.57,64ZM216,192H40V74.19l82.59,75.71a8,8,0,0,0,10.82,0L216,74.19V192Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M224,52H32a4,4,0,0,0-4,4V192a12,12,0,0,0,12,12H216a12,12,0,0,0,12-12V56A4,4,0,0,0,224,52Zm-10.28,8L128,138.57,42.28,60ZM216,196H40a4,4,0,0,1-4-4V65.09L125.3,147a4,4,0,0,0,5.4,0L220,65.09V192A4,4,0,0,1,216,196Z"}))]]);var T=Object.defineProperty,B=Object.defineProperties,P=Object.getOwnPropertyDescriptors,w=Object.getOwnPropertySymbols,R=Object.prototype.hasOwnProperty,D=Object.prototype.propertyIsEnumerable,v=(t,s,a)=>s in t?T(t,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[s]=a,Y=(t,s)=>{for(var a in s||(s={}))R.call(s,a)&&v(t,a,s[a]);if(w)for(var a of w(s))D.call(s,a)&&v(t,a,s[a]);return t},_=(t,s)=>B(t,P(s));const y=l.forwardRef((t,s)=>r.createElement(C,_(Y({ref:s},t),{weights:z})));y.displayName="EnvelopeSimple";function q({invite:t}){var i,u;const s=l.useRef(null),[a,p]=l.useState(t.status),[o,c]=l.useState(!1),d=async()=>{if(!window.confirm(`Are you sure you want to deactivate this invite?
2
2
  After you do this it will not longer be useable.
3
3
 
4
- This action is irreversible.`))return!1;s!=null&&s.current&&(s.current.children[0].innerText="Disabled"),p("disabled"),await f.disableInvite(t.id)},m=()=>{if(!t)return!1;window.navigator.clipboard.writeText(`${window.location.origin}/accept-invite/${t.code}`),c(!0)};return l.useEffect(()=>{function h(){if(!o)return!1;setTimeout(()=>{c(!1)},3e3)}h()},[o]),e.jsx(e.Fragment,{children:e.jsxs("tr",{ref:s,className:"bg-transparent text-white text-opacity-80 text-xs font-medium border-b border-white/10 h-10",children:[e.jsx("td",{scope:"row",className:"px-6 whitespace-nowrap",children:S(a)}),e.jsx("td",{className:"px-6",children:t.claimedBy?((i=t.claimedBy)==null?void 0:i.username)||"deleted user":"--"}),e.jsx("td",{className:"px-6",children:((u=t.createdBy)==null?void 0:u.username)||"deleted user"}),e.jsx("td",{className:"px-6",children:t.createdAt}),e.jsx("td",{className:"px-6 flex items-center gap-x-6 h-full mt-1",children:a==="pending"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:m,disabled:o,className:"text-xs font-medium text-blue-300 rounded-lg hover:text-blue-400 hover:underline",children:o?"Copied":"Copy Invite Link"}),e.jsx("button",{onClick:d,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:e.jsx(V,{className:"h-5 w-5"})})]})})]})})}function J({closeModal:t,onSuccess:s}){const[a,p]=l.useState(null),[o,c]=l.useState(null),[d,m]=l.useState(!1),[i,u]=l.useState([]),[h,g]=l.useState([]),j=async n=>{c(null),n.preventDefault();const{invite:x,error:b}=await f.newInvite({role:null,workspaceIds:h});x&&(p(x),s()),c(b)},N=()=>{if(!a)return!1;window.navigator.clipboard.writeText(`${window.location.origin}/accept-invite/${a.code}`),m(!0),M("Invite link copied to clipboard","success",{clear:!0})},k=n=>{if(h.includes(n)){const x=h.filter(b=>b!==n);g(x);return}g([...h,n])};return l.useEffect(()=>{function n(){if(!d)return!1;setTimeout(()=>{m(!1)},3e3)}n()},[d]),l.useEffect(()=>{async function n(){I.all().then(x=>u(x)).catch(()=>u([]))}n()},[]),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:"Create new invite"})}),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(E,{size:24,weight:"bold",className:"text-white"})})]}),e.jsx("div",{className:"p-6",children:e.jsxs("form",{onSubmit:j,children:[e.jsxs("div",{className:"space-y-4",children:[o&&e.jsxs("p",{className:"text-red-400 text-sm",children:["Error: ",o]}),a&&e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"url",defaultValue:`${window.location.origin}/accept-invite/${a.code}`,disabled:!0,className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg outline-none block w-full p-2.5 pr-10"}),e.jsx("button",{type:"button",onClick:N,disabled:d,className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded-md hover:bg-theme-modal-border transition-all duration-300",children:d?e.jsx(F,{size:20,className:"text-green-400",weight:"bold"}):e.jsx(W,{size:20,className:"text-white",weight:"bold"})})]}),e.jsxs("p",{className:"text-white text-opacity-60 text-xs md:text-sm",children:["After creation you will be able to copy the invite and send it to a new user where they can create an account as the"," ",e.jsx("b",{children:"default"})," role and automatically be added to workspaces selected."]})]}),i.length>0&&!a&&e.jsx("div",{className:"mt-6",children:e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"flex flex-col gap-y-1 mb-2",children:[e.jsx("label",{htmlFor:"workspaces",className:"block text-sm font-medium text-white",children:"Auto-add invitee to workspaces"}),e.jsx("p",{className:"text-white text-opacity-60 text-xs",children:"You can optionally automatically assign the user to the workspaces below by selecting them. By default, the user will not have any workspaces visible. You can assign workspaces later post-invite acceptance."})]}),e.jsx("div",{className:"flex flex-col gap-y-2 mt-2",children:i.map(n=>e.jsx(U,{workspace:n,selected:h.includes(n.id),toggleSelection:k},n.id))})]})}),e.jsx("div",{className:"flex justify-end items-center mt-6 pt-6 border-t border-theme-modal-border",children:a?e.jsx("button",{onClick:t,type:"button",className:"transition-all duration-300 text-white hover:bg-zinc-700 px-4 py-2 rounded-lg text-sm",children:"Close"}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:t,type:"button",className:"transition-all duration-300 text-white hover:bg-zinc-700 px-4 py-2 rounded-lg text-sm mr-2",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:"Create Invite"})]})})]})})]})})}function U({workspace:t,selected:s,toggleSelection:a}){return e.jsxs("button",{type:"button",onClick:()=>a(t.id),className:`transition-all duration-300 w-full h-11 p-2.5 rounded-lg flex justify-start items-center gap-2.5 cursor-pointer border ${s?"border-theme-sidebar-item-workspace-active bg-theme-bg-secondary":"border-theme-sidebar-border"} hover:border-theme-sidebar-border hover:bg-theme-bg-secondary`,children:[e.jsx("input",{type:"radio",name:"workspace",value:t.id,checked:s,className:"hidden"}),e.jsx("div",{className:`w-4 h-4 rounded-full border-2 border-theme-sidebar-border mr-2 ${s?"bg-[var(--theme-sidebar-item-workspace-active)]":""}`}),e.jsx("div",{className:"text-theme-text-primary text-sm font-medium font-['Plus Jakarta Sans'] leading-tight",children:t.name})]})}function ee(){const{isOpen:t,openModal:s,closeModal:a}=A(),[p,o]=l.useState(!0),[c,d]=l.useState([]),m=async()=>{const i=await f.invites();d(i),o(!1)};return l.useEffect(()=>{m()},[]),e.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex",children:[e.jsx(Z,{}),e.jsxs("div",{style:{height:H?"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:"Invitations"})}),e.jsx("p",{className:"text-xs leading-[18px] font-base text-theme-text-secondary mt-2",children:"Create invitation links for people in your organization to accept and sign up with. Invitations can only be used by a single user."})]}),e.jsx("div",{className:"w-full justify-end flex",children:e.jsxs(L,{onClick:s,className:"mt-3 mr-0 mb-4 md:-mb-12 z-10",children:[e.jsx(y,{className:"h-4 w-4",weight:"bold"})," Create Invite Link"]})}),e.jsx("div",{className:"overflow-x-auto mt-6",children:p?e.jsx(O,{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",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:"Status"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Accepted By"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Created By"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Created"}),e.jsx("th",{scope:"col",className:"px-6 py-3 rounded-tr-lg",children:" "})]})}),e.jsx("tbody",{children:c.length===0?e.jsx("tr",{className:"bg-transparent text-theme-text-secondary text-sm font-medium",children:e.jsx("td",{colSpan:"5",className:"px-6 py-4 text-center",children:"No invitations found"})}):c.map(i=>e.jsx(q,{invite:i},i.id))})]})})]}),e.jsx($,{isOpen:t,children:e.jsx(J,{closeModal:a,onSuccess:m})})]})]})}export{ee as default};
4
+ This action is irreversible.`))return!1;s!=null&&s.current&&(s.current.children[0].innerText="Disabled"),p("disabled"),await f.disableInvite(t.id)},m=()=>{if(!t)return!1;window.navigator.clipboard.writeText(`${window.location.origin}/accept-invite/${t.code}`),c(!0)};return l.useEffect(()=>{function h(){if(!o)return!1;setTimeout(()=>{c(!1)},3e3)}h()},[o]),e.jsx(e.Fragment,{children:e.jsxs("tr",{ref:s,className:"bg-transparent text-white text-opacity-80 text-xs font-medium border-b border-white/10 h-10",children:[e.jsx("td",{scope:"row",className:"px-6 whitespace-nowrap",children:S(a)}),e.jsx("td",{className:"px-6",children:t.claimedBy?((i=t.claimedBy)==null?void 0:i.username)||"deleted user":"--"}),e.jsx("td",{className:"px-6",children:((u=t.createdBy)==null?void 0:u.username)||"deleted user"}),e.jsx("td",{className:"px-6",children:t.createdAt}),e.jsx("td",{className:"px-6 flex items-center gap-x-6 h-full mt-1",children:a==="pending"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:m,disabled:o,className:"text-xs font-medium text-blue-300 rounded-lg hover:text-blue-400 hover:underline",children:o?"Copied":"Copy Invite Link"}),e.jsx("button",{onClick:d,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:e.jsx(V,{className:"h-5 w-5"})})]})})]})})}function J({closeModal:t,onSuccess:s}){const[a,p]=l.useState(null),[o,c]=l.useState(null),[d,m]=l.useState(!1),[i,u]=l.useState([]),[h,g]=l.useState([]),j=async n=>{c(null),n.preventDefault();const{invite:x,error:b}=await f.newInvite({role:null,workspaceIds:h});x&&(p(x),s()),c(b)},N=()=>{if(!a)return!1;window.navigator.clipboard.writeText(`${window.location.origin}/accept-invite/${a.code}`),m(!0),M("Invite link copied to clipboard","success",{clear:!0})},k=n=>{if(h.includes(n)){const x=h.filter(b=>b!==n);g(x);return}g([...h,n])};return l.useEffect(()=>{function n(){if(!d)return!1;setTimeout(()=>{m(!1)},3e3)}n()},[d]),l.useEffect(()=>{async function n(){I.all().then(x=>u(x)).catch(()=>u([]))}n()},[]),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:"Create new invite"})}),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(E,{size:24,weight:"bold",className:"text-white"})})]}),e.jsx("div",{className:"p-6",children:e.jsxs("form",{onSubmit:j,children:[e.jsxs("div",{className:"space-y-4",children:[o&&e.jsxs("p",{className:"text-red-400 text-sm",children:["Error: ",o]}),a&&e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"url",defaultValue:`${window.location.origin}/accept-invite/${a.code}`,disabled:!0,className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg outline-none block w-full p-2.5 pr-10"}),e.jsx("button",{type:"button",onClick:N,disabled:d,className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded-md hover:bg-theme-modal-border transition-all duration-300",children:d?e.jsx(W,{size:20,className:"text-green-400",weight:"bold"}):e.jsx($,{size:20,className:"text-white",weight:"bold"})})]}),e.jsxs("p",{className:"text-white text-opacity-60 text-xs md:text-sm",children:["After creation you will be able to copy the invite and send it to a new user where they can create an account as the"," ",e.jsx("b",{children:"default"})," role and automatically be added to workspaces selected."]})]}),i.length>0&&!a&&e.jsx("div",{className:"mt-6",children:e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"flex flex-col gap-y-1 mb-2",children:[e.jsx("label",{htmlFor:"workspaces",className:"block text-sm font-medium text-white",children:"Auto-add invitee to workspaces"}),e.jsx("p",{className:"text-white text-opacity-60 text-xs",children:"You can optionally automatically assign the user to the workspaces below by selecting them. By default, the user will not have any workspaces visible. You can assign workspaces later post-invite acceptance."})]}),e.jsx("div",{className:"flex flex-col gap-y-2 mt-2",children:i.map(n=>e.jsx(Q,{workspace:n,selected:h.includes(n.id),toggleSelection:k},n.id))})]})}),e.jsx("div",{className:"flex justify-end items-center mt-6 pt-6 border-t border-theme-modal-border",children:a?e.jsx("button",{onClick:t,type:"button",className:"transition-all duration-300 text-white hover:bg-zinc-700 px-4 py-2 rounded-lg text-sm",children:"Close"}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:t,type:"button",className:"transition-all duration-300 text-white hover:bg-zinc-700 px-4 py-2 rounded-lg text-sm mr-2",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:"Create Invite"})]})})]})})]})})}function Q({workspace:t,selected:s,toggleSelection:a}){return e.jsxs("button",{type:"button",onClick:()=>a(t.id),className:`transition-all duration-300 w-full h-11 p-2.5 rounded-lg flex justify-start items-center gap-2.5 cursor-pointer border ${s?"border-theme-sidebar-item-workspace-active bg-theme-bg-secondary":"border-theme-sidebar-border"} hover:border-theme-sidebar-border hover:bg-theme-bg-secondary`,children:[e.jsx("input",{type:"radio",name:"workspace",value:t.id,checked:s,className:"hidden"}),e.jsx("div",{className:`w-4 h-4 rounded-full border-2 border-theme-sidebar-border mr-2 ${s?"bg-[var(--theme-sidebar-item-workspace-active)]":""}`}),e.jsx("div",{className:"text-theme-text-primary text-sm font-medium font-['Plus Jakarta Sans'] leading-tight",children:t.name})]})}function ee(){const{isOpen:t,openModal:s,closeModal:a}=A(),[p,o]=l.useState(!0),[c,d]=l.useState([]),m=async()=>{const i=await f.invites();d(i),o(!1)};return l.useEffect(()=>{m()},[]),e.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex",children:[e.jsx(Z,{}),e.jsxs("div",{style:{height:H?"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:"Invitations"})}),e.jsx("p",{className:"text-xs leading-[18px] font-base text-theme-text-secondary mt-2",children:"Create invitation links for people in your organization to accept and sign up with. Invitations can only be used by a single user."})]}),e.jsx("div",{className:"w-full justify-end flex",children:e.jsxs(L,{onClick:s,className:"mt-3 mr-0 mb-4 md:-mb-12 z-10",children:[e.jsx(y,{className:"h-4 w-4",weight:"bold"})," Create Invite Link"]})}),e.jsx("div",{className:"overflow-x-auto mt-6",children:p?e.jsx(O,{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",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:"Status"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Accepted By"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Created By"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Created"}),e.jsx("th",{scope:"col",className:"px-6 py-3 rounded-tr-lg",children:" "})]})}),e.jsx("tbody",{children:c.length===0?e.jsx("tr",{className:"bg-transparent text-theme-text-secondary text-sm font-medium",children:e.jsx("td",{colSpan:"5",className:"px-6 py-4 text-center",children:"No invitations found"})}):c.map(i=>e.jsx(q,{invite:i},i.id))})]})})]}),e.jsx(F,{isOpen:t,children:e.jsx(J,{closeModal:a,onSuccess:m})})]})]})}export{ee as default};
@@ -1 +1 @@
1
- import{r as c,j as e,aU as i,t as o,i as x,S as m}from"../index.js";import{s as p,a as h}from"./index-6cdecde9.js";import{h as r}from"./moment-8a59df1b.js";import"./truncate-352eb33b.js";import"./XCircle-edfe554c.js";import"./File-b92df2f3.js";import"./Eye-9f033dc0.js";import"./index-4fb4d421.js";import"./react-beautiful-dnd.esm-45ea8487.js";function u({queue:t}){const s=c.useRef(null),n=async()=>{var a;(a=s==null?void 0:s.current)==null||a.remove(),await o.experimentalFeatures.liveSync.setWatchStatusForDocument(t.workspaceDoc.workspace.slug,t.workspaceDoc.docpath,!1)};return e.jsx(e.Fragment,{children:e.jsxs("tr",{ref:s,className:"bg-transparent text-white text-opacity-80 text-sm font-medium",children:[e.jsx("td",{scope:"row",className:"px-6 py-4 whitespace-nowrap",children:p(t.workspaceDoc.filename)}),e.jsx("td",{className:"px-6 py-4",children:r(t.lastSyncedAt).fromNow()}),e.jsxs("td",{className:"px-6 py-4",children:[r(t.nextSyncAt).format("lll"),e.jsxs("i",{className:"text-xs px-2",children:["(",r(t.nextSyncAt).fromNow(),")"]})]}),e.jsx("td",{className:"px-6 py-4",children:r(t.createdAt).format("lll")}),e.jsx("td",{className:"px-6 py-4 flex items-center gap-x-6",children:e.jsx("button",{onClick:n,className:"border-none font-medium px-2 py-1 rounded-lg text-theme-text-primary hover:text-red-500",children:e.jsx(i,{className:"h-5 w-5"})})})]})})}function k(){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:x?"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:"Watched documents"})}),e.jsx("p",{className:"text-xs leading-[18px] font-base text-theme-text-secondary",children:"These are all the documents that are currently being watched in your instance. The content of these documents will be periodically synced."})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsx(f,{})})]})})]})}function f(){const[t,s]=c.useState(!0),[n,a]=c.useState([]);return c.useEffect(()=>{async function l(){const d=await o.experimentalFeatures.liveSync.queues();a(d),s(!1)}l()},[]),t?e.jsx(m,{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-6",containerClassName:"flex w-full"}):e.jsxs("table",{className:"w-full text-sm text-left rounded-lg mt-6 min-w-[640px]",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:"Document Name"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Last Synced"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Time until next refresh"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Created On"}),e.jsx("th",{scope:"col",className:"px-6 py-3 rounded-tr-lg",children:" "})]})}),e.jsx("tbody",{children:n.map(l=>e.jsx(u,{queue:l},l.id))})]})}export{k as default};
1
+ import{r as c,j as e,aW as i,t as o,i as x,S as m}from"../index.js";import{s as p,a as h}from"./index-6bd7928a.js";import{h as r}from"./moment-75486807.js";import"./truncate-06273256.js";import"./XCircle-edfe554c.js";import"./File-b92df2f3.js";import"./Eye-9f033dc0.js";import"./index-4fb4d421.js";import"./react-beautiful-dnd.esm-bb85eef1.js";function u({queue:t}){const s=c.useRef(null),n=async()=>{var a;(a=s==null?void 0:s.current)==null||a.remove(),await o.experimentalFeatures.liveSync.setWatchStatusForDocument(t.workspaceDoc.workspace.slug,t.workspaceDoc.docpath,!1)};return e.jsx(e.Fragment,{children:e.jsxs("tr",{ref:s,className:"bg-transparent text-white text-opacity-80 text-sm font-medium",children:[e.jsx("td",{scope:"row",className:"px-6 py-4 whitespace-nowrap",children:p(t.workspaceDoc.filename)}),e.jsx("td",{className:"px-6 py-4",children:r(t.lastSyncedAt).fromNow()}),e.jsxs("td",{className:"px-6 py-4",children:[r(t.nextSyncAt).format("lll"),e.jsxs("i",{className:"text-xs px-2",children:["(",r(t.nextSyncAt).fromNow(),")"]})]}),e.jsx("td",{className:"px-6 py-4",children:r(t.createdAt).format("lll")}),e.jsx("td",{className:"px-6 py-4 flex items-center gap-x-6",children:e.jsx("button",{onClick:n,className:"border-none font-medium px-2 py-1 rounded-lg text-theme-text-primary hover:text-red-500",children:e.jsx(i,{className:"h-5 w-5"})})})]})})}function k(){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:x?"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:"Watched documents"})}),e.jsx("p",{className:"text-xs leading-[18px] font-base text-theme-text-secondary",children:"These are all the documents that are currently being watched in your instance. The content of these documents will be periodically synced."})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsx(f,{})})]})})]})}function f(){const[t,s]=c.useState(!0),[n,a]=c.useState([]);return c.useEffect(()=>{async function l(){const d=await o.experimentalFeatures.liveSync.queues();a(d),s(!1)}l()},[]),t?e.jsx(m,{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-6",containerClassName:"flex w-full"}):e.jsxs("table",{className:"w-full text-sm text-left rounded-lg mt-6 min-w-[640px]",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:"Document Name"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Last Synced"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Time until next refresh"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Created On"}),e.jsx("th",{scope:"col",className:"px-6 py-3 rounded-tr-lg",children:" "})]})}),e.jsx("tbody",{children:n.map(l=>e.jsx(u,{queue:l},l.id))})]})}export{k as default};
@@ -0,0 +1 @@
1
+ import{u as b,r as l,j as e,aW as k,aX as f,t as g,k as C,p as j,q as S,a1 as A,i as K,C as M,S as z,M as E}from"../index.js";import{C as T}from"./PlusCircle-31c6a8d8.js";import{A as w}from"./admin-04b020fe.js";import{w as D}from"./Check-7e83fb0d.js";import{C as R}from"./Copy-d323e545.js";function F({apiKey:a,removeApiKey:m}){var r;const{t:s}=b(),[t,d]=l.useState(!1),c=async()=>{if(!window.confirm(s("api.row.deleteConfirm")))return!1;await(f()?w:g).deleteApiKey(a.id),m(a.id)},x=()=>{if(!a)return!1;window.navigator.clipboard.writeText(a.secret),d(!0)};return l.useEffect(()=>{function i(){if(!t)return!1;setTimeout(()=>{d(!1)},3e3)}i()},[t]),e.jsx(e.Fragment,{children:e.jsxs("tr",{className:"bg-transparent text-white text-opacity-80 text-xs font-medium border-b border-white/10",children:[e.jsx("td",{scope:"row",className:"px-6 py-3 whitespace-nowrap align-middle",children:a.name||s("api.row.unnamed")}),e.jsx("td",{scope:"row",className:"px-6 py-3 align-middle",children:e.jsx("code",{className:"font-mono text-[11px] break-all text-theme-text-primary",children:a.secret})}),e.jsx("td",{className:"px-6 py-3 text-left align-middle",children:((r=a.createdBy)==null?void 0:r.username)||"--"}),e.jsx("td",{className:"px-6 py-3 whitespace-nowrap align-middle",children:new Date(a.createdAt).toLocaleString()}),e.jsx("td",{className:"px-6 py-3 align-middle",children:e.jsxs("div",{className:"flex items-center gap-x-6",children:[e.jsx("button",{onClick:x,disabled:t,className:"text-xs font-medium text-blue-300 rounded-lg hover:text-white hover:light:text-blue-500 hover:text-opacity-60 hover:underline",children:s(t?"api.row.copied":"api.row.copy")}),e.jsx("button",{onClick:c,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:e.jsx(k,{className:"h-5 w-5"})})]})})]})})}function _({closeModal:a,onSuccess:m}){const{t:s}=b(),[t,d]=l.useState(null),[c,x]=l.useState(""),[r,i]=l.useState(null),[n,o]=l.useState(!1),p=async u=>{i(null),u.preventDefault();const N=f()?w:g,{apiKey:y,error:v}=await N.generateApiKey({name:c});y&&(d(y),m()),i(v)},h=()=>{if(!t)return!1;window.navigator.clipboard.writeText(t.secret),o(!0)};return l.useEffect(()=>{function u(){if(!n)return!1;setTimeout(()=>{o(!1)},3e3)}u()},[n]),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:s("api.modal.title")})}),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(C,{size:24,weight:"bold",className:"text-white"})})]}),e.jsx("div",{className:"px-7 py-6",children:e.jsxs("form",{onSubmit:p,children:[e.jsxs("div",{className:"space-y-6 max-h-[60vh] overflow-y-auto pr-2",children:[r&&e.jsx("p",{className:"text-red-400 text-sm",children:s("api.messages.error",{error:r})}),!t&&e.jsxs("div",{children:[e.jsx("label",{className:"block mb-2 text-sm font-medium text-white",children:s("api.modal.name.label")}),e.jsx("input",{type:"text",value:c,onChange:u=>x(u.target.value),placeholder:s("api.modal.name.placeholder"),className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg outline-none block w-full p-2.5"}),e.jsx("p",{className:"text-white text-opacity-60 text-xs md:text-sm mt-2",children:s("api.modal.name.helper")})]}),t&&e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"text",defaultValue:`${t.secret}`,disabled:!0,className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg outline-none block w-full p-2.5 pr-10"}),e.jsx("button",{type:"button",onClick:h,disabled:n,className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded-md hover:bg-theme-modal-border transition-all duration-300",children:n?e.jsx(D,{size:20,className:"text-green-400",weight:"bold"}):e.jsx(R,{size:20,className:"text-white",weight:"bold"})})]}),e.jsx("p",{className:"text-white text-opacity-60 text-xs md:text-sm",children:s("api.modal.helper")}),e.jsx("a",{href:j.apiDocs(),target:"_blank",rel:"noreferrer",className:"text-blue-400 hover:underline",children:"Read the API documentation →"})]}),e.jsx("div",{className:"flex justify-end items-center mt-6 pt-6 border-t border-theme-modal-border",children:t?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:s("api.modal.close")}):e.jsxs(e.Fragment,{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 mr-2",children:s("api.modal.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:s("api.modal.create")})]})})]})})]})})}function O(){const{isOpen:a,openModal:m,closeModal:s}=S(),{t}=b(),[d,c]=l.useState(!0),[x,r]=l.useState([]),i=async()=>{const p=f()?w:g,{apiKeys:h}=await p.getApiKeys();r(h),c(!1)};l.useEffect(()=>{i()},[]);const n=o=>{r(p=>p.filter(h=>h.id!==o))};return e.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex",children:[e.jsx(A,{}),e.jsxs("div",{style:{height:K?"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:t("api.title")})}),e.jsx("p",{className:"text-xs leading-[18px] font-base text-theme-text-secondary mt-2",children:t("api.description")}),e.jsxs("a",{href:j.apiDocs(),target:"_blank",rel:"noreferrer",className:"text-xs leading-[18px] font-base text-blue-300 light:text-blue-500 hover:underline mt-1",children:[t("api.link")," →"]})]}),e.jsx("div",{className:"w-full justify-end flex",children:e.jsxs(M,{onClick:m,className:"mt-3 mr-0 mb-4 md:-mb-14 z-10",children:[e.jsx(T,{className:"h-4 w-4",weight:"bold"})," ",t("api.generate")]})}),e.jsx("div",{className:"overflow-x-auto mt-6",children:d?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",containerClassName:"flex w-full"}):e.jsxs("table",{className:"w-full text-xs text-left rounded-lg min-w-[720px] border-spacing-0 md:mt-6 mt-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:t("api.table.name")}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:t("api.table.key")}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:t("api.table.by")}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:t("api.table.created")}),e.jsx("th",{scope:"col",className:"px-6 py-3 rounded-tr-lg",children:t("api.actions")})]})}),e.jsx("tbody",{children:x.length===0?e.jsx("tr",{className:"bg-transparent text-theme-text-secondary text-sm font-medium",children:e.jsx("td",{colSpan:"5",className:"px-6 py-4 text-center",children:t("api.empty")})}):x.map(o=>e.jsx(F,{apiKey:o,removeApiKey:n},o.id))})]})})]}),e.jsx(E,{isOpen:a,children:e.jsx(_,{closeModal:s,onSuccess:i})})]})]})}export{O as default};
@@ -0,0 +1 @@
1
+ import{R as r,r as s,g as f,A as x,m as v,j as t,M as L,k as F,v as g,p as H,h as O,c as b,q as $,a1 as D,i as S,C as k,S as P}from"../index.js";import{Q as R}from"./index-08cd0bc2.js";import{L as I}from"./anything-llm-infinity-0d7244a1.js";import{h as z}from"./moment-75486807.js";const G=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M227,168a12,12,0,0,0-4.21-5.09C207.25,152.22,204,133.68,204,120c0-16.17,12.68-30.6,20.25-37.76a12,12,0,0,0,0-17.43C210.89,52.17,188.81,44,168,44a76.29,76.29,0,0,0-40,11.37,75.59,75.59,0,0,0-93.58,11A78.64,78.64,0,0,0,12,123.51,131,131,0,0,0,53.43,216,43.81,43.81,0,0,0,83.6,228h87.69a43.87,43.87,0,0,0,32.05-13.85,127.63,127.63,0,0,0,18.4-25.39c1.57-2.88,3-5.71,4.14-8.41C227.47,176.67,229.12,172.87,227,168Zm-41.23,29.82A19.78,19.78,0,0,1,171.29,204H83.6a19.85,19.85,0,0,1-13.7-5.42A107.18,107.18,0,0,1,36,122.88,54.49,54.49,0,0,1,51.5,83.28,50.86,50.86,0,0,1,88,68h.72A51.5,51.5,0,0,1,120.48,79.4a12,12,0,0,0,15,0A51.41,51.41,0,0,1,168,68a67.24,67.24,0,0,1,29.88,7.4C186.26,89.66,180,105.13,180,120c0,23.33,7.47,42.89,21.25,56.19A103.3,103.3,0,0,1,185.76,197.81ZM128.75,13A43.83,43.83,0,0,1,142.17,1.51a12,12,0,0,1,11.64,21,19.84,19.84,0,0,0-6.11,5.24A12,12,0,0,1,128.75,13Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M216,73.52Zm0,99.26c-16.79-11.53-24-30.87-24-52.78,0-18.3,11.68-34.81,24-46.48C204.53,62.66,185,56,168,56a63.72,63.72,0,0,0-40,14h0A63.71,63.71,0,0,0,88.88,56C52,55.5,23.06,86.3,24,123.19a119.62,119.62,0,0,0,37.65,84.12A32,32,0,0,0,83.6,216h87.7a31.75,31.75,0,0,0,23.26-10c15.85-17,21.44-33.2,21.44-33.2Z",opacity:"0.2"}),r.createElement("path",{d:"M223.3,169.59a8.07,8.07,0,0,0-2.8-3.4C203.53,154.53,200,134.64,200,120c0-17.67,13.47-33.06,21.5-40.67a8,8,0,0,0,0-11.62C208.82,55.74,187.82,48,168,48a72.23,72.23,0,0,0-40,12.13,71.56,71.56,0,0,0-90.71,9.09A74.63,74.63,0,0,0,16,123.4a127,127,0,0,0,40.14,89.73A39.8,39.8,0,0,0,83.59,224h87.68a39.84,39.84,0,0,0,29.12-12.57,125,125,0,0,0,17.82-24.6C225.23,174,224.33,172,223.3,169.59Zm-34.63,30.94a23.76,23.76,0,0,1-17.4,7.47H83.59a23.82,23.82,0,0,1-16.44-6.51A111.14,111.14,0,0,1,32,123,58.5,58.5,0,0,1,48.65,80.47,54.81,54.81,0,0,1,88,64h.78A55.45,55.45,0,0,1,123,76.28a8,8,0,0,0,10,0A55.39,55.39,0,0,1,168,64a70.64,70.64,0,0,1,36,10.35c-13,14.52-20,30.47-20,45.65,0,23.77,7.64,42.73,22.18,55.3A105.52,105.52,0,0,1,188.67,200.53ZM128.23,30A40,40,0,0,1,167,0h1a8,8,0,0,1,0,16h-1a24,24,0,0,0-23.24,18,8,8,0,1,1-15.5-4Z"}))],["fill",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128.23,30A40,40,0,0,1,167,0h1a8,8,0,0,1,0,16h-1a24,24,0,0,0-23.24,18,8,8,0,1,1-15.5-4ZM223.3,169.59a8.07,8.07,0,0,0-2.8-3.4C203.53,154.53,200,134.64,200,120c0-17.67,13.47-33.06,21.5-40.67a8,8,0,0,0,0-11.62C208.82,55.74,187.82,48,168,48a72.23,72.23,0,0,0-40,12.13,71.56,71.56,0,0,0-90.71,9.09A74.63,74.63,0,0,0,16,123.4a127,127,0,0,0,40.14,89.73A39.8,39.8,0,0,0,83.59,224h87.68a39.84,39.84,0,0,0,29.12-12.57,125,125,0,0,0,17.82-24.6C225.23,174,224.33,172,223.3,169.59Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M219.4,167.84C201.71,155.69,198,135.12,198,120c0-18.42,13.86-34.29,22.12-42.12a6,6,0,0,0,0-8.71C208,57.7,187.07,50,168,50a70.23,70.23,0,0,0-40,12.55,69.6,69.6,0,0,0-89.31,8.08A72.63,72.63,0,0,0,18,123.35a125.11,125.11,0,0,0,39.53,88.33A37.85,37.85,0,0,0,83.6,222h87.7A37.83,37.83,0,0,0,199,210.07a122.6,122.6,0,0,0,17.54-24.2c6.55-12,5.77-13.75,5-15.48A6.07,6.07,0,0,0,219.4,167.84Zm-29.23,34A25.82,25.82,0,0,1,171.3,210H83.6A25.85,25.85,0,0,1,65.78,203,113.21,113.21,0,0,1,30,123a60.55,60.55,0,0,1,17.21-44A56.82,56.82,0,0,1,88,62h.81a57.35,57.35,0,0,1,35.44,12.71,6,6,0,0,0,7.5,0A57.39,57.39,0,0,1,168,62c13.89,0,28.81,4.68,39.11,12-9.44,10.14-21.1,26.59-21.1,46,0,23.78,7.81,42.6,22.66,54.77A107.33,107.33,0,0,1,190.17,201.89Zm-60-171.39A38,38,0,0,1,167,2h1a6,6,0,0,1,0,12h-1a26,26,0,0,0-25.18,19.5,6,6,0,1,1-11.62-3Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M223.3,169.59a8.07,8.07,0,0,0-2.8-3.4C203.53,154.53,200,134.64,200,120c0-17.67,13.47-33.06,21.5-40.67a8,8,0,0,0,0-11.62C208.82,55.74,187.82,48,168,48a72.2,72.2,0,0,0-40,12.13,71.56,71.56,0,0,0-90.71,9.09A74.63,74.63,0,0,0,16,123.4a127.06,127.06,0,0,0,40.14,89.73A39.8,39.8,0,0,0,83.59,224h87.68a39.84,39.84,0,0,0,29.12-12.57,125,125,0,0,0,17.82-24.6C225.23,174,224.33,172,223.3,169.59Zm-34.63,30.94a23.76,23.76,0,0,1-17.4,7.47H83.59a23.82,23.82,0,0,1-16.44-6.51A111.14,111.14,0,0,1,32,123,58.5,58.5,0,0,1,48.65,80.47,54.81,54.81,0,0,1,88,64h.78A55.45,55.45,0,0,1,123,76.28a8,8,0,0,0,10,0A55.44,55.44,0,0,1,168,64a70.64,70.64,0,0,1,36,10.35c-13,14.52-20,30.47-20,45.65,0,23.77,7.64,42.73,22.18,55.3A105.82,105.82,0,0,1,188.67,200.53ZM128.23,30A40,40,0,0,1,167,0h1a8,8,0,0,1,0,16h-1a24,24,0,0,0-23.24,18,8,8,0,1,1-15.5-4Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M218.27,169.49C199.86,156.84,196,135.6,196,120c0-19.17,14.25-35.53,22.75-43.57a4,4,0,0,0,0-5.81C207,59.48,186.59,52,168,52a68.3,68.3,0,0,0-40,13,67.61,67.61,0,0,0-87.88,7A70.65,70.65,0,0,0,20,123.3a123.11,123.11,0,0,0,38.9,86.92A35.81,35.81,0,0,0,83.6,220h87.7a35.84,35.84,0,0,0,26.19-11.3,119.93,119.93,0,0,0,17.24-23.79c6.08-11.1,5.42-12.62,4.94-13.72A4,4,0,0,0,218.27,169.49Zm-26.64,33.77A27.83,27.83,0,0,1,171.3,212H83.6a27.84,27.84,0,0,1-19.19-7.6A115.15,115.15,0,0,1,28,123.09,62.55,62.55,0,0,1,45.81,77.66,58.78,58.78,0,0,1,88,60h.84a59.37,59.37,0,0,1,36.66,13.15,4,4,0,0,0,5,0A59.35,59.35,0,0,1,168,60c15.12,0,31.45,5.41,42.11,13.73C200.68,83.42,188,100.16,188,120c0,23.79,8,42.44,23.12,54.17A107.64,107.64,0,0,1,191.63,203.26ZM132.13,31A36,36,0,0,1,167,4h1a4,4,0,0,1,0,8h-1a28,28,0,0,0-27.12,21A4,4,0,0,1,136,36a3.87,3.87,0,0,1-1-.13A4,4,0,0,1,132.13,31Z"}))]]);var U=Object.defineProperty,Q=Object.defineProperties,T=Object.getOwnPropertyDescriptors,A=Object.getOwnPropertySymbols,B=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable,y=(e,a,n)=>a in e?U(e,a,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[a]=n,_=(e,a)=>{for(var n in a||(a={}))B.call(a,n)&&y(e,n,a[n]);if(A)for(var n of A(a))W.call(a,n)&&y(e,n,a[n]);return e},q=(e,a)=>Q(e,T(a));const V=s.forwardRef((e,a)=>r.createElement(f,q(_({ref:a},e),{weights:G})));V.displayName="AppleLogo";const J=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M197.35,51.62l11.14-11.13a12,12,0,1,0-17-17L179.34,35.69a91.84,91.84,0,0,0-102.68,0L64.49,23.51a12,12,0,0,0-17,17L58.65,51.62A91.58,91.58,0,0,0,36,112v40a92,92,0,0,0,184,0V112A91.58,91.58,0,0,0,197.35,51.62ZM196,112v4H60v-4a68,68,0,0,1,136,0ZM128,220a68.07,68.07,0,0,1-68-68V140H196v12A68.07,68.07,0,0,1,128,220ZM140,88a16,16,0,1,1,16,16A16,16,0,0,1,140,88ZM84,88a16,16,0,1,1,16,16A16,16,0,0,1,84,88Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M208,128v24a80,80,0,0,1-160,0V128Z",opacity:"0.2"}),r.createElement("path",{d:"M191.83,51.48l13.83-13.82a8,8,0,0,0-11.32-11.32L179.79,40.9a87.81,87.81,0,0,0-103.58,0L61.66,26.34A8,8,0,0,0,50.34,37.66L64.17,51.48A87.72,87.72,0,0,0,40,112v40a88,88,0,0,0,176,0V112A87.72,87.72,0,0,0,191.83,51.48ZM128,40a72.08,72.08,0,0,1,72,72v8H56v-8A72.08,72.08,0,0,1,128,40Zm0,184a72.08,72.08,0,0,1-72-72V136H200v16A72.08,72.08,0,0,1,128,224ZM144,92a12,12,0,1,1,12,12A12,12,0,0,1,144,92ZM88,92a12,12,0,1,1,12,12A12,12,0,0,1,88,92Z"}))],["fill",r.createElement(r.Fragment,null,r.createElement("path",{d:"M191.83,51.48l13.83-13.82a8,8,0,0,0-11.32-11.32L179.79,40.9a87.81,87.81,0,0,0-103.58,0L61.66,26.34A8,8,0,0,0,50.34,37.66L64.17,51.48A87.72,87.72,0,0,0,40,112v40a88,88,0,0,0,176,0V112A87.72,87.72,0,0,0,191.83,51.48ZM128,40a72.08,72.08,0,0,1,72,72v8H56v-8A72.08,72.08,0,0,1,128,40Zm16,52a12,12,0,1,1,12,12A12,12,0,0,1,144,92ZM88,92a12,12,0,1,1,12,12A12,12,0,0,1,88,92Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M189,51.47l15.22-15.23a6,6,0,1,0-8.48-8.48L180,43.54A85.76,85.76,0,0,0,76,43.54L60.24,27.76a6,6,0,0,0-8.48,8.48L67,51.47A85.7,85.7,0,0,0,42,112v40a86,86,0,0,0,172,0V112A85.7,85.7,0,0,0,189,51.47ZM128,38a74.09,74.09,0,0,1,74,74v10H54V112A74.09,74.09,0,0,1,128,38Zm0,188a74.09,74.09,0,0,1-74-74V134H202v18A74.09,74.09,0,0,1,128,226ZM146,92a10,10,0,1,1,10,10A10,10,0,0,1,146,92ZM90,92a10,10,0,1,1,10,10A10,10,0,0,1,90,92Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M191.83,51.48l13.83-13.82a8,8,0,0,0-11.32-11.32L179.79,40.9a87.81,87.81,0,0,0-103.58,0L61.66,26.34A8,8,0,0,0,50.34,37.66L64.17,51.48A87.72,87.72,0,0,0,40,112v40a88,88,0,0,0,176,0V112A87.72,87.72,0,0,0,191.83,51.48ZM128,40a72.08,72.08,0,0,1,72,72v8H56v-8A72.08,72.08,0,0,1,128,40Zm0,184a72.08,72.08,0,0,1-72-72V136H200v16A72.08,72.08,0,0,1,128,224ZM144,92a12,12,0,1,1,12,12A12,12,0,0,1,144,92ZM88,92a12,12,0,1,1,12,12A12,12,0,0,1,88,92Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M186.17,51.49l16.66-16.66a4,4,0,1,0-5.66-5.66l-17,17a83.72,83.72,0,0,0-104.26,0l-17-17a4,4,0,0,0-5.66,5.66L69.83,51.49A83.75,83.75,0,0,0,44,112v40a84,84,0,0,0,168,0V112A83.75,83.75,0,0,0,186.17,51.49ZM128,36a76.08,76.08,0,0,1,76,76v12H52V112A76.08,76.08,0,0,1,128,36Zm0,192a76.08,76.08,0,0,1-76-76V132H204v20A76.08,76.08,0,0,1,128,228ZM148,92a8,8,0,1,1,8,8A8,8,0,0,1,148,92ZM92,92a8,8,0,1,1,8,8A8,8,0,0,1,92,92Z"}))]]);var K=Object.defineProperty,X=Object.defineProperties,Y=Object.getOwnPropertyDescriptors,Z=Object.getOwnPropertySymbols,e0=Object.prototype.hasOwnProperty,t0=Object.prototype.propertyIsEnumerable,w=(e,a,n)=>a in e?K(e,a,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[a]=n,a0=(e,a)=>{for(var n in a||(a={}))e0.call(a,n)&&w(e,n,a[n]);if(Z)for(var n of Z(a))t0.call(a,n)&&w(e,n,a[n]);return e},r0=(e,a)=>X(e,Y(a));const E=s.forwardRef((e,a)=>r.createElement(f,r0(a0({ref:a},e),{weights:J})));E.displayName="BugDroid";const n0=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M100,36H56A20,20,0,0,0,36,56v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V56A20,20,0,0,0,100,36ZM96,96H60V60H96Zm4,40H56a20,20,0,0,0-20,20v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V156A20,20,0,0,0,100,136Zm-4,60H60V160H96ZM200,36H156a20,20,0,0,0-20,20v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,60H160V60h36Zm-60,76V148a12,12,0,0,1,24,0v24a12,12,0,0,1-24,0Zm84-8a12,12,0,0,1-12,12H196v32a12,12,0,0,1-12,12H148a12,12,0,0,1,0-24h24V148a12,12,0,0,1,24,0v4h12A12,12,0,0,1,220,164Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M112,56v48a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8h48A8,8,0,0,1,112,56Zm-8,88H56a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h48a8,8,0,0,0,8-8V152A8,8,0,0,0,104,144Zm96-96H152a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h48a8,8,0,0,0,8-8V56A8,8,0,0,0,200,48Z",opacity:"0.2"}),r.createElement("path",{d:"M104,40H56A16,16,0,0,0,40,56v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,104,40Zm0,64H56V56h48v48Zm0,32H56a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,104,136Zm0,64H56V152h48v48ZM200,40H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,64H152V56h48v48Zm-64,72V144a8,8,0,0,1,16,0v32a8,8,0,0,1-16,0Zm80-16a8,8,0,0,1-8,8H184v40a8,8,0,0,1-8,8H144a8,8,0,0,1,0-16h24V144a8,8,0,0,1,16,0v8h24A8,8,0,0,1,216,160Zm0,32v16a8,8,0,0,1-16,0V192a8,8,0,0,1,16,0Z"}))],["fill",r.createElement(r.Fragment,null,r.createElement("path",{d:"M120,56v48a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40h48A16,16,0,0,1,120,56Zm-16,80H56a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,104,136Zm96-96H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40ZM144,184a8,8,0,0,0,8-8V144a8,8,0,0,0-16,0v32A8,8,0,0,0,144,184Zm64-32H184v-8a8,8,0,0,0-16,0v56H144a8,8,0,0,0,0,16h32a8,8,0,0,0,8-8V168h24a8,8,0,0,0,0-16Zm0,32a8,8,0,0,0-8,8v16a8,8,0,0,0,16,0V192A8,8,0,0,0,208,184Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M104,42H56A14,14,0,0,0,42,56v48a14,14,0,0,0,14,14h48a14,14,0,0,0,14-14V56A14,14,0,0,0,104,42Zm2,62a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V56a2,2,0,0,1,2-2h48a2,2,0,0,1,2,2Zm-2,34H56a14,14,0,0,0-14,14v48a14,14,0,0,0,14,14h48a14,14,0,0,0,14-14V152A14,14,0,0,0,104,138Zm2,62a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V152a2,2,0,0,1,2-2h48a2,2,0,0,1,2,2ZM200,42H152a14,14,0,0,0-14,14v48a14,14,0,0,0,14,14h48a14,14,0,0,0,14-14V56A14,14,0,0,0,200,42Zm2,62a2,2,0,0,1-2,2H152a2,2,0,0,1-2-2V56a2,2,0,0,1,2-2h48a2,2,0,0,1,2,2Zm-64,72V144a6,6,0,0,1,12,0v32a6,6,0,0,1-12,0Zm76-16a6,6,0,0,1-6,6H182v42a6,6,0,0,1-6,6H144a6,6,0,0,1,0-12h26V144a6,6,0,0,1,12,0v10h26A6,6,0,0,1,214,160Zm0,32v16a6,6,0,0,1-12,0V192a6,6,0,0,1,12,0Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M104,40H56A16,16,0,0,0,40,56v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,104,40Zm0,64H56V56h48v48Zm0,32H56a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,104,136Zm0,64H56V152h48v48ZM200,40H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,64H152V56h48v48Zm-64,72V144a8,8,0,0,1,16,0v32a8,8,0,0,1-16,0Zm80-16a8,8,0,0,1-8,8H184v40a8,8,0,0,1-8,8H144a8,8,0,0,1,0-16h24V144a8,8,0,0,1,16,0v8h24A8,8,0,0,1,216,160Zm0,32v16a8,8,0,0,1-16,0V192a8,8,0,0,1,16,0Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M104,44H56A12,12,0,0,0,44,56v48a12,12,0,0,0,12,12h48a12,12,0,0,0,12-12V56A12,12,0,0,0,104,44Zm4,60a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V56a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4Zm-4,36H56a12,12,0,0,0-12,12v48a12,12,0,0,0,12,12h48a12,12,0,0,0,12-12V152A12,12,0,0,0,104,140Zm4,60a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V152a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4ZM200,44H152a12,12,0,0,0-12,12v48a12,12,0,0,0,12,12h48a12,12,0,0,0,12-12V56A12,12,0,0,0,200,44Zm4,60a4,4,0,0,1-4,4H152a4,4,0,0,1-4-4V56a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4Zm-64,72V144a4,4,0,0,1,8,0v32a4,4,0,0,1-8,0Zm72-16a4,4,0,0,1-4,4H180v44a4,4,0,0,1-4,4H144a4,4,0,0,1,0-8h28V144a4,4,0,0,1,8,0v12h28A4,4,0,0,1,212,160Zm0,32v16a4,4,0,0,1-8,0V192a4,4,0,0,1,8,0Z"}))]]);var l0=Object.defineProperty,s0=Object.defineProperties,o0=Object.getOwnPropertyDescriptors,j=Object.getOwnPropertySymbols,c0=Object.prototype.hasOwnProperty,i0=Object.prototype.propertyIsEnumerable,M=(e,a,n)=>a in e?l0(e,a,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[a]=n,h0=(e,a)=>{for(var n in a||(a={}))c0.call(a,n)&&M(e,n,a[n]);if(j)for(var n of j(a))i0.call(a,n)&&M(e,n,a[n]);return e},m0=(e,a)=>s0(e,o0(a));const N=s.forwardRef((e,a)=>r.createElement(f,m0(h0({ref:a},e),{weights:n0})));N.displayName="QrCode";const u={getConnectionInfo:async function(){return await fetch(`${x}/mobile/connect-info`,{headers:v()}).then(e=>e.json()).catch(()=>!1)},getDevices:async function(){return await fetch(`${x}/mobile/devices`,{headers:v()}).then(e=>e.json()).then(e=>e.devices||[]).catch(()=>[])},deleteDevice:async function(e){return await fetch(`${x}/mobile/${e}`,{method:"DELETE",headers:v()}).then(a=>a.json()).catch(()=>!1)},updateDevice:async function(e,a={}){return await fetch(`${x}/mobile/update/${e}`,{method:"POST",body:JSON.stringify(a),headers:v()}).then(n=>n.json()).catch(()=>!1)}},d0="/bg.png",p0="/gplay-badge.svg";function x0({isOpen:e,onClose:a}){return t.jsx(L,{isOpen:e,children:t.jsxs("div",{className:"relative w-full rounded-lg shadow",style:{minHeight:"60vh",maxWidth:"70vw",backgroundImage:`url(${d0})`,backgroundSize:"cover",backgroundPosition:"center"},children:[t.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:t.jsx(F,{size:24,weight:"bold",className:"text-[#FFF]"})}),t.jsxs("div",{className:"flex w-full h-full justify-between p-[35px]",children:[t.jsxs("div",{className:"flex flex-col w-1/2 gap-y-[16px]",children:[t.jsx("p",{className:"text-[#FFF] text-xl font-bold",children:"Go mobile. Stay local. AnythingLLM Mobile."}),t.jsxs("p",{className:"text-[#FFF] text-lg",children:["AnythingLLM for mobile allows you to connect to your workspace's chats, threads, tools, and documents for you to use on the go.",t.jsx("br",{}),t.jsx("br",{}),"Run with local models on your phone privately or relay chats directly to this instance seamlessly."]}),t.jsx(g,{to:"https://play.google.com/store/apps/details?id=com.anythingllm",target:"_blank",children:t.jsx("img",{src:p0,alt:"Get on Google Play",className:"w-[150px] h-auto"})})]}),t.jsxs("div",{className:"flex flex-col items-center justify-center shrink-0 w-1/2 gap-y-[16px]",children:[t.jsx("div",{className:"bg-white/10 rounded-lg p-[40px] w-[300px] h-[300px] flex flex-col gap-y-[16px] items-center justify-center",children:t.jsx(u0,{isOpen:e})}),t.jsxs("p",{className:"text-[#FFF] text-sm w-[300px] text-center",children:["Scan the QR code with the AnythingLLM Mobile app to enable live sync of your workspaces, chats, threads and documents.",t.jsx("br",{}),t.jsx(g,{to:H.documentation.mobileIntroduction(),className:"text-cta-button font-semibold",children:"Learn more"})]})]})]})]})})}function v0(e){if(e.startsWith("http"))return new URL(e);const a=new URL(`${window.location.origin}${e}`);if(["localhost","127.0.0.1","0.0.0.0"].includes(a.hostname))throw new Error("Please open this page via your machines private IP address or custom domain. Localhost URLs will not work with the mobile app.");return a.toString()}const u0=({isOpen:e})=>{const[a,n]=s.useState(null),[h,m]=s.useState(!1),[o,d]=s.useState(null);if(s.useEffect(()=>{e&&(m(!0),u.getConnectionInfo().then(i=>{if(i.error)throw new Error(i.error);const l=v0(i.connectionUrl);n(l)}).catch(i=>{d(i.message)}).finally(()=>{m(!1)}))},[e]),h)return t.jsx(O,{size:"[100px]"});if(o)return t.jsx("p",{className:"text-red-500 text-sm w-[300px] p-4 text-center",children:o});const c={width:35*1.5,height:22*1.5};return t.jsx(R,{value:a,size:300,bgColor:"transparent",fgColor:"white",level:"L",imageSettings:{src:I,x:300/2-c.width/2,y:300/2-c.height/2,height:c.height,width:c.width,excavate:!0}})};function g0({device:e,removeDevice:a}){const[n,h]=s.useState(e.approved),m=async()=>{await u.updateDevice(e.id,{approved:!0}),b("Device access granted","info"),h(!0)},o=async()=>{await u.deleteDevice(e.id),b("Device access denied","info"),h(!1),a(e.id)};return t.jsx(t.Fragment,{children:t.jsxs("tr",{className:"bg-transparent text-white text-opacity-80 text-xs font-medium border-b border-white/10 h-10",children:[t.jsx("td",{scope:"row",className:"px-6 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center gap-x-2",children:[e.deviceOs==="ios"?t.jsx(V,{weight:"fill",size:16,className:"fill-theme-text-primary"}):t.jsx(E,{weight:"fill",size:16,className:"fill-theme-text-primary"}),t.jsx("span",{className:"text-sm",children:e.deviceName})]})}),t.jsx("td",{className:"px-6",children:t.jsxs("div",{className:"flex items-center gap-x-2",children:[z(e.createdAt).format("lll"),e.user&&t.jsxs("div",{className:"flex items-center gap-x-1",children:[t.jsx("span",{className:"text-xs text-theme-text-secondary",children:"by"}),t.jsx(g,{to:H.settings.users(),className:"text-xs text-theme-text-secondary hover:underline hover:text-cta-button",children:e.user.username})]})]})}),t.jsx("td",{className:"px-6 flex items-center gap-x-6 h-full mt-1",children:n?t.jsx("button",{onClick:o,className:"border-none flex items-center justify-center text-xs font-medium text-white/80 light:text-black/80 rounded-lg p-1 hover:bg-white hover:light:bg-red-50 hover:bg-opacity-10",children:"Revoke"}):t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:m,className:"border-none flex items-center justify-center text-xs font-medium text-white/80 light:text-black/80 rounded-lg p-1 hover:bg-white hover:bg-opacity-10 hover:light:bg-green-50 hover:light:text-green-500 hover:text-green-300",children:"Approve Access"}),t.jsx("button",{onClick:o,className:"border-none flex items-center justify-center text-xs font-medium text-white/80 light:text-black/80 rounded-lg p-1 hover:bg-white hover:bg-opacity-10 hover:light:bg-red-50 hover:light:text-red-500 hover:text-red-300",children:"Deny"})]})})]})})}function Z0(){const{isOpen:e,openModal:a,closeModal:n}=$(),[h,m]=s.useState(!0),[o,d]=s.useState([]),c=async()=>{const l=await u.getDevices();return d(l),l.length!==0&&!e&&n(),l};s.useEffect(()=>{c().then(p=>(p.length===0&&a(),p)).finally(()=>{m(!1)});const l=setInterval(c,5e3);return()=>clearInterval(l)},[]);const i=l=>{d(p=>p.filter(C=>C.id!==l))};return t.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex md:mt-0 mt-6",children:[t.jsx(D,{}),t.jsx("div",{style:{height:S?"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:t.jsxs("div",{className:"flex flex-col w-full px-1 md:pl-6 md:pr-[50px] md:py-6 py-16",children:[t.jsxs("div",{className:"w-full flex flex-col gap-y-1 pb-6 border-white/10 border-b-2",children:[t.jsx("div",{className:"items-center flex gap-x-4",children:t.jsx("p",{className:"text-lg leading-6 font-bold text-theme-text-primary",children:"Connected Mobile Devices"})}),t.jsx("p",{className:"text-xs leading-[18px] font-base text-theme-text-secondary mt-2",children:"These are the devices that are connected to your desktop application to sync chats, workspaces, and more."})]}),t.jsx("div",{className:"w-full justify-end flex",children:t.jsxs(k,{onClick:a,className:"mt-3 mr-0 mb-4 md:-mb-14 z-10",children:[t.jsx(N,{className:"h-4 w-4",weight:"bold"})," Register New Device"]})}),t.jsx("div",{className:"overflow-x-auto mt-6",children:h?t.jsx(P,{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",containerClassName:"flex w-full"}):t.jsxs("table",{className:"w-full text-xs text-left rounded-lg min-w-[640px] border-spacing-0",children:[t.jsx("thead",{className:"text-theme-text-secondary text-xs leading-[18px] font-bold uppercase border-white/10 border-b",children:t.jsxs("tr",{children:[t.jsx("th",{scope:"col",className:"px-6 py-3",children:"Device Name"}),t.jsx("th",{scope:"col",className:"px-6 py-3",children:"Registered"}),t.jsx("th",{scope:"col",className:"px-6 py-3",children:" "})]})}),t.jsx("tbody",{children:o.length===0?t.jsx("tr",{className:"bg-transparent text-theme-text-secondary text-sm font-medium",children:t.jsx("td",{colSpan:"4",className:"px-6 py-4 text-center",children:"No devices found"})}):o.map(l=>t.jsx(g0,{device:l,removeDevice:i},l.id))})]})})]})}),t.jsx(x0,{isOpen:e,onClose:n})]})}export{Z0 as default};