@exulu/frontend 1.0.2 → 1.0.3

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 (238) hide show
  1. package/dist/.env +32 -0
  2. package/dist/.next/BUILD_ID +1 -1
  3. package/dist/.next/app-build-manifest.json +203 -203
  4. package/dist/.next/app-path-routes-manifest.json +1 -1
  5. package/dist/.next/build-manifest.json +3 -3
  6. package/dist/.next/prerender-manifest.json +1 -1
  7. package/dist/.next/required-server-files.json +1 -1
  8. package/dist/.next/server/app/(application)/agents/edit/[id]/page.js +1 -1
  9. package/dist/.next/server/app/(application)/agents/edit/[id]/page.js.nft.json +1 -1
  10. package/dist/.next/server/app/(application)/agents/edit/[id]/page_client-reference-manifest.js +1 -1
  11. package/dist/.next/server/app/(application)/agents/page.js +2 -2
  12. package/dist/.next/server/app/(application)/agents/page.js.nft.json +1 -1
  13. package/dist/.next/server/app/(application)/agents/page_client-reference-manifest.js +1 -1
  14. package/dist/.next/server/app/(application)/chat/[agent]/[session]/page.js +2 -2
  15. package/dist/.next/server/app/(application)/chat/[agent]/[session]/page.js.nft.json +1 -1
  16. package/dist/.next/server/app/(application)/chat/[agent]/[session]/page_client-reference-manifest.js +1 -1
  17. package/dist/.next/server/app/(application)/chat/[agent]/page.js +1 -1
  18. package/dist/.next/server/app/(application)/chat/[agent]/page.js.nft.json +1 -1
  19. package/dist/.next/server/app/(application)/chat/[agent]/page_client-reference-manifest.js +1 -1
  20. package/dist/.next/server/app/(application)/chat/page.js +1 -1
  21. package/dist/.next/server/app/(application)/chat/page.js.nft.json +1 -1
  22. package/dist/.next/server/app/(application)/chat/page_client-reference-manifest.js +1 -1
  23. package/dist/.next/server/app/(application)/configuration/page.js +1 -1
  24. package/dist/.next/server/app/(application)/configuration/page.js.nft.json +1 -1
  25. package/dist/.next/server/app/(application)/configuration/page_client-reference-manifest.js +1 -1
  26. package/dist/.next/server/app/(application)/dashboard/page.js +2 -2
  27. package/dist/.next/server/app/(application)/dashboard/page.js.nft.json +1 -1
  28. package/dist/.next/server/app/(application)/dashboard/page_client-reference-manifest.js +1 -1
  29. package/dist/.next/server/app/(application)/data/[[...query]]/page.js +2 -2
  30. package/dist/.next/server/app/(application)/data/[[...query]]/page.js.nft.json +1 -1
  31. package/dist/.next/server/app/(application)/data/[[...query]]/page_client-reference-manifest.js +1 -1
  32. package/dist/.next/server/app/(application)/evals/[id]/page.js +1 -1
  33. package/dist/.next/server/app/(application)/evals/[id]/page.js.nft.json +1 -1
  34. package/dist/.next/server/app/(application)/evals/[id]/page_client-reference-manifest.js +1 -1
  35. package/dist/.next/server/app/(application)/evals/[id]/runs/page.js +1 -1
  36. package/dist/.next/server/app/(application)/evals/[id]/runs/page.js.nft.json +1 -1
  37. package/dist/.next/server/app/(application)/evals/[id]/runs/page_client-reference-manifest.js +1 -1
  38. package/dist/.next/server/app/(application)/evals/cases/page.js +1 -1
  39. package/dist/.next/server/app/(application)/evals/cases/page.js.nft.json +1 -1
  40. package/dist/.next/server/app/(application)/evals/cases/page_client-reference-manifest.js +1 -1
  41. package/dist/.next/server/app/(application)/evals/page.js +1 -1
  42. package/dist/.next/server/app/(application)/evals/page.js.nft.json +1 -1
  43. package/dist/.next/server/app/(application)/evals/page_client-reference-manifest.js +1 -1
  44. package/dist/.next/server/app/(application)/explorer/page.js +9 -9
  45. package/dist/.next/server/app/(application)/explorer/page.js.nft.json +1 -1
  46. package/dist/.next/server/app/(application)/explorer/page_client-reference-manifest.js +1 -1
  47. package/dist/.next/server/app/(application)/jobs/page.js +1 -1
  48. package/dist/.next/server/app/(application)/jobs/page.js.nft.json +1 -1
  49. package/dist/.next/server/app/(application)/jobs/page_client-reference-manifest.js +1 -1
  50. package/dist/.next/server/app/(application)/keys/page.js +1 -1
  51. package/dist/.next/server/app/(application)/keys/page.js.nft.json +1 -1
  52. package/dist/.next/server/app/(application)/keys/page_client-reference-manifest.js +1 -1
  53. package/dist/.next/server/app/(application)/page.js +1 -1
  54. package/dist/.next/server/app/(application)/page.js.nft.json +1 -1
  55. package/dist/.next/server/app/(application)/page_client-reference-manifest.js +1 -1
  56. package/dist/.next/server/app/(application)/projects/[project]/page.js +1 -1
  57. package/dist/.next/server/app/(application)/projects/[project]/page.js.nft.json +1 -1
  58. package/dist/.next/server/app/(application)/projects/[project]/page_client-reference-manifest.js +1 -1
  59. package/dist/.next/server/app/(application)/projects/page.js +1 -1
  60. package/dist/.next/server/app/(application)/projects/page.js.nft.json +1 -1
  61. package/dist/.next/server/app/(application)/projects/page_client-reference-manifest.js +1 -1
  62. package/dist/.next/server/app/(application)/roles/page.js +1 -1
  63. package/dist/.next/server/app/(application)/roles/page.js.nft.json +1 -1
  64. package/dist/.next/server/app/(application)/roles/page_client-reference-manifest.js +1 -1
  65. package/dist/.next/server/app/(application)/token/page.js +1 -1
  66. package/dist/.next/server/app/(application)/token/page.js.nft.json +1 -1
  67. package/dist/.next/server/app/(application)/token/page_client-reference-manifest.js +1 -1
  68. package/dist/.next/server/app/(application)/users/page.js +1 -1
  69. package/dist/.next/server/app/(application)/users/page.js.nft.json +1 -1
  70. package/dist/.next/server/app/(application)/users/page_client-reference-manifest.js +1 -1
  71. package/dist/.next/server/app/(application)/variables/create/page.js +1 -1
  72. package/dist/.next/server/app/(application)/variables/create/page.js.nft.json +1 -1
  73. package/dist/.next/server/app/(application)/variables/create/page_client-reference-manifest.js +1 -1
  74. package/dist/.next/server/app/(application)/variables/edit/[variable_id]/page.js +1 -1
  75. package/dist/.next/server/app/(application)/variables/edit/[variable_id]/page.js.nft.json +1 -1
  76. package/dist/.next/server/app/(application)/variables/edit/[variable_id]/page_client-reference-manifest.js +1 -1
  77. package/dist/.next/server/app/(application)/variables/page.js +1 -1
  78. package/dist/.next/server/app/(application)/variables/page.js.nft.json +1 -1
  79. package/dist/.next/server/app/(application)/variables/page_client-reference-manifest.js +1 -1
  80. package/dist/.next/server/app/(application)/variables/usage/[variable_id]/page.js +1 -1
  81. package/dist/.next/server/app/(application)/variables/usage/[variable_id]/page.js.nft.json +1 -1
  82. package/dist/.next/server/app/(application)/variables/usage/[variable_id]/page_client-reference-manifest.js +1 -1
  83. package/dist/.next/server/app/(application)/workflows/page.js +1 -1
  84. package/dist/.next/server/app/(application)/workflows/page.js.nft.json +1 -1
  85. package/dist/.next/server/app/(application)/workflows/page_client-reference-manifest.js +1 -1
  86. package/dist/.next/server/app/(authentication)/login/page.js +3 -3
  87. package/dist/.next/server/app/(authentication)/login/page.js.nft.json +1 -1
  88. package/dist/.next/server/app/(authentication)/login/page_client-reference-manifest.js +1 -1
  89. package/dist/.next/server/app/_not-found/page.js +1 -1
  90. package/dist/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  91. package/dist/.next/server/app/_not-found.html +1 -1
  92. package/dist/.next/server/app/_not-found.rsc +1 -1
  93. package/dist/.next/server/app/api/auth/[...nextauth]/route.js +2 -2
  94. package/dist/.next/server/app/api/config/route.js +2 -2
  95. package/dist/.next/server/app-paths-manifest.json +11 -11
  96. package/dist/.next/server/chunks/{5192.js → 1558.js} +1 -1
  97. package/dist/.next/server/chunks/{3575.js → 2711.js} +1 -1
  98. package/dist/.next/server/chunks/{7944.js → 4470.js} +2 -2
  99. package/dist/.next/server/chunks/9049.js +2 -2
  100. package/dist/.next/server/chunks/{7223.js → 9762.js} +5 -5
  101. package/dist/.next/server/middleware-build-manifest.js +1 -1
  102. package/dist/.next/server/middleware-manifest.json +5 -5
  103. package/dist/.next/server/middleware.js +2 -2
  104. package/dist/.next/server/next-font-manifest.js +1 -1
  105. package/dist/.next/server/next-font-manifest.json +1 -1
  106. package/dist/.next/server/pages/404.html +1 -1
  107. package/dist/.next/server/pages/500.html +1 -1
  108. package/dist/.next/server/pages-manifest.json +1 -1
  109. package/dist/.next/server/server-reference-manifest.json +1 -1
  110. package/dist/.next/static/chunks/2117-7e0e97ffa5867cf9.js.map +1 -1
  111. package/dist/.next/static/chunks/6111-5ab0e72a466543ea.js.map +1 -1
  112. package/dist/.next/static/chunks/7648-be88d7a414ab6394.js.map +1 -1
  113. package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/{page-e622860a59223955.js → page-7737da0d7329baf0.js} +2 -2
  114. package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/page-7737da0d7329baf0.js.map +1 -0
  115. package/dist/.next/static/chunks/app/(application)/agents/{page-fe256553444f6e6f.js → page-58d7ecbf04b75ef3.js} +2 -2
  116. package/dist/.next/static/chunks/app/(application)/agents/page-58d7ecbf04b75ef3.js.map +1 -0
  117. package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-fb7ea4dc4cdb350b.js +2 -0
  118. package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-fb7ea4dc4cdb350b.js.map +1 -0
  119. package/dist/.next/static/chunks/app/(application)/chat/[agent]/{layout-1736d0931ae3f866.js → layout-a701083f64a86849.js} +2 -2
  120. package/dist/.next/static/chunks/app/(application)/chat/[agent]/layout-a701083f64a86849.js.map +1 -0
  121. package/dist/.next/static/chunks/app/(application)/chat/[agent]/{page-1538a952e1e99f94.js → page-2f7e3126e0e76d70.js} +2 -2
  122. package/dist/.next/static/chunks/app/(application)/chat/[agent]/page-2f7e3126e0e76d70.js.map +1 -0
  123. package/dist/.next/static/chunks/app/(application)/chat/{layout-3fbafd811d12ed10.js → layout-b934ba4c0a125683.js} +2 -2
  124. package/dist/.next/static/chunks/app/(application)/chat/layout-b934ba4c0a125683.js.map +1 -0
  125. package/dist/.next/static/chunks/app/(application)/configuration/{page-876d1d43a9cc36e4.js → page-3aa96486933ae5dd.js} +2 -2
  126. package/dist/.next/static/chunks/app/(application)/configuration/page-3aa96486933ae5dd.js.map +1 -0
  127. package/dist/.next/static/chunks/app/(application)/dashboard/{page-ca746e824cb97052.js → page-2436e355871758ba.js} +2 -2
  128. package/dist/.next/static/chunks/app/(application)/dashboard/page-2436e355871758ba.js.map +1 -0
  129. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/{layout-47ad558a66e699c7.js → layout-e073c74bd194e8cc.js} +2 -2
  130. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/layout-e073c74bd194e8cc.js.map +1 -0
  131. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/{page-edcdd8944daaaef8.js → page-375a978d25ee3a65.js} +2 -2
  132. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-375a978d25ee3a65.js.map +1 -0
  133. package/dist/.next/static/chunks/app/(application)/evals/[id]/{page-5d4b8e351ee3265f.js → page-b668fca1ba6993e2.js} +2 -2
  134. package/dist/.next/static/chunks/app/(application)/evals/[id]/page-b668fca1ba6993e2.js.map +1 -0
  135. package/dist/.next/static/chunks/app/(application)/evals/[id]/runs/{page-4f0d1524fc7936d1.js → page-07969d6e5fb01d7b.js} +2 -2
  136. package/dist/.next/static/chunks/app/(application)/evals/[id]/runs/page-07969d6e5fb01d7b.js.map +1 -0
  137. package/dist/.next/static/chunks/app/(application)/evals/cases/{page-47274d92d3daf16b.js → page-0f25ee5d9498cbc5.js} +2 -2
  138. package/dist/.next/static/chunks/app/(application)/evals/cases/page-0f25ee5d9498cbc5.js.map +1 -0
  139. package/dist/.next/static/chunks/app/(application)/evals/page-78bbdcf2c04a4ef9.js +2 -0
  140. package/dist/.next/static/chunks/app/(application)/evals/page-78bbdcf2c04a4ef9.js.map +1 -0
  141. package/dist/.next/static/chunks/app/(application)/explorer/{page-9f8ab38b5cd68c45.js → page-d1580ece2ff5ba64.js} +2 -2
  142. package/dist/.next/static/chunks/app/(application)/explorer/page-d1580ece2ff5ba64.js.map +1 -0
  143. package/dist/.next/static/chunks/app/(application)/jobs/{page-2d9a06a9959e7977.js → page-1f32c5e7202301b2.js} +2 -2
  144. package/dist/.next/static/chunks/app/(application)/jobs/page-1f32c5e7202301b2.js.map +1 -0
  145. package/dist/.next/static/chunks/app/(application)/keys/page-9b13ab99042d606c.js +2 -0
  146. package/dist/.next/static/chunks/app/(application)/keys/page-9b13ab99042d606c.js.map +1 -0
  147. package/dist/.next/static/chunks/app/(application)/layout-cff96ce5805f0772.js +2 -0
  148. package/dist/.next/static/chunks/app/(application)/layout-cff96ce5805f0772.js.map +1 -0
  149. package/dist/.next/static/chunks/app/(application)/{page-16a518c5864e6963.js → page-661f24beb316dabf.js} +2 -2
  150. package/dist/.next/static/chunks/app/(application)/page-661f24beb316dabf.js.map +1 -0
  151. package/dist/.next/static/chunks/app/(application)/projects/[project]/{page-870b48a3e7f64f7d.js → page-cc6f6786682fd877.js} +2 -2
  152. package/dist/.next/static/chunks/app/(application)/projects/[project]/page-cc6f6786682fd877.js.map +1 -0
  153. package/dist/.next/static/chunks/app/(application)/projects/{layout-aa5baaf5cc644e70.js → layout-3ef4b8519966eee7.js} +2 -2
  154. package/dist/.next/static/chunks/app/(application)/projects/layout-3ef4b8519966eee7.js.map +1 -0
  155. package/dist/.next/static/chunks/app/(application)/projects/{page-055a048a107095ed.js → page-6a38fd92beb3b45a.js} +2 -2
  156. package/dist/.next/static/chunks/app/(application)/projects/page-6a38fd92beb3b45a.js.map +1 -0
  157. package/dist/.next/static/chunks/app/(application)/roles/page-d4a925d823a3c66c.js +2 -0
  158. package/dist/.next/static/chunks/app/(application)/roles/page-d4a925d823a3c66c.js.map +1 -0
  159. package/dist/.next/static/chunks/app/(application)/token/{page-f86eaf8c51fdbe52.js → page-19921b235606b9f3.js} +2 -2
  160. package/dist/.next/static/chunks/app/(application)/token/page-19921b235606b9f3.js.map +1 -0
  161. package/dist/.next/static/chunks/app/(application)/users/page-7cddc0528218c5c8.js +2 -0
  162. package/dist/.next/static/chunks/app/(application)/users/page-7cddc0528218c5c8.js.map +1 -0
  163. package/dist/.next/static/chunks/app/(application)/variables/create/{page-16582f525a24dd45.js → page-3d0e1788a92cba52.js} +2 -2
  164. package/dist/.next/static/chunks/app/(application)/variables/create/page-3d0e1788a92cba52.js.map +1 -0
  165. package/dist/.next/static/chunks/app/(application)/variables/edit/[variable_id]/{page-b37d9320812bb8f6.js → page-ad12a1419856c280.js} +2 -2
  166. package/dist/.next/static/chunks/app/(application)/variables/edit/[variable_id]/page-ad12a1419856c280.js.map +1 -0
  167. package/dist/.next/static/chunks/app/(application)/variables/{page-9b438ce239c07987.js → page-530fff39006ba055.js} +2 -2
  168. package/dist/.next/static/chunks/app/(application)/variables/page-530fff39006ba055.js.map +1 -0
  169. package/dist/.next/static/chunks/app/(application)/variables/usage/[variable_id]/{page-b1fe1791701d361e.js → page-11fc31486ee7764e.js} +2 -2
  170. package/dist/.next/static/chunks/app/(application)/variables/usage/[variable_id]/page-11fc31486ee7764e.js.map +1 -0
  171. package/dist/.next/static/chunks/app/(application)/workflows/{page-93969baedc6f38ff.js → page-feb479eaa043e041.js} +2 -2
  172. package/dist/.next/static/chunks/app/(application)/workflows/page-feb479eaa043e041.js.map +1 -0
  173. package/dist/.next/static/chunks/app/(authentication)/{layout-2dfa18ea6e6dc5cd.js → layout-ed3d63f0ade93b47.js} +2 -2
  174. package/dist/.next/static/chunks/app/(authentication)/layout-ed3d63f0ade93b47.js.map +1 -0
  175. package/dist/.next/static/chunks/app/(authentication)/login/{error-c5f516f76e374400.js → error-65d2315c483bed81.js} +2 -2
  176. package/dist/.next/static/chunks/app/(authentication)/login/error-65d2315c483bed81.js.map +1 -0
  177. package/dist/.next/static/chunks/app/(authentication)/login/{page-4de4d6f64507c919.js → page-3233ca86dc3297c3.js} +2 -2
  178. package/dist/.next/static/chunks/app/(authentication)/login/page-3233ca86dc3297c3.js.map +1 -0
  179. package/dist/.next/static/chunks/app/_not-found/page-3832d1eb6511168a.js.map +1 -1
  180. package/dist/.next/static/chunks/main-83299e0cc175f2ed.js.map +1 -1
  181. package/dist/.next/static/chunks/{main-app-da1df2757744a2ea.js → main-app-e4276b9c44f225cb.js} +2 -2
  182. package/dist/.next/static/chunks/main-app-e4276b9c44f225cb.js.map +1 -0
  183. package/dist/.next/static/css/e3f2a16ab7676b05.css.map +1 -1
  184. package/dist/node_modules/sharp/build/Release/sharp-darwin-arm64v8.node +0 -0
  185. package/dist/node_modules/sharp/vendor/8.14.5/darwin-arm64v8/include/harfbuzz/hb-cplusplus.hh +223 -0
  186. package/dist/node_modules/sharp/vendor/8.14.5/darwin-arm64v8/include/vips/vips8 +60 -0
  187. package/dist/node_modules/sharp/vendor/8.14.5/{linux-x64/lib/libvips-cpp.so.42 → darwin-arm64v8/lib/libvips-cpp.42.dylib} +0 -0
  188. package/dist/node_modules/sharp/vendor/8.14.5/darwin-arm64v8/platform.json +1 -0
  189. package/dist/node_modules/sharp/vendor/8.14.5/{linux-x64 → darwin-arm64v8}/versions.json +1 -1
  190. package/dist/package.json +1 -2
  191. package/dist/server.js +1 -1
  192. package/package.json +5 -5
  193. package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/page-e622860a59223955.js.map +0 -1
  194. package/dist/.next/static/chunks/app/(application)/agents/page-fe256553444f6e6f.js.map +0 -1
  195. package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-beaa99a35c9e9bfc.js +0 -2
  196. package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-beaa99a35c9e9bfc.js.map +0 -1
  197. package/dist/.next/static/chunks/app/(application)/chat/[agent]/layout-1736d0931ae3f866.js.map +0 -1
  198. package/dist/.next/static/chunks/app/(application)/chat/[agent]/page-1538a952e1e99f94.js.map +0 -1
  199. package/dist/.next/static/chunks/app/(application)/chat/layout-3fbafd811d12ed10.js.map +0 -1
  200. package/dist/.next/static/chunks/app/(application)/configuration/page-876d1d43a9cc36e4.js.map +0 -1
  201. package/dist/.next/static/chunks/app/(application)/dashboard/page-ca746e824cb97052.js.map +0 -1
  202. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/layout-47ad558a66e699c7.js.map +0 -1
  203. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-edcdd8944daaaef8.js.map +0 -1
  204. package/dist/.next/static/chunks/app/(application)/evals/[id]/page-5d4b8e351ee3265f.js.map +0 -1
  205. package/dist/.next/static/chunks/app/(application)/evals/[id]/runs/page-4f0d1524fc7936d1.js.map +0 -1
  206. package/dist/.next/static/chunks/app/(application)/evals/cases/page-47274d92d3daf16b.js.map +0 -1
  207. package/dist/.next/static/chunks/app/(application)/evals/page-e25d76c28076b126.js +0 -2
  208. package/dist/.next/static/chunks/app/(application)/evals/page-e25d76c28076b126.js.map +0 -1
  209. package/dist/.next/static/chunks/app/(application)/explorer/page-9f8ab38b5cd68c45.js.map +0 -1
  210. package/dist/.next/static/chunks/app/(application)/jobs/page-2d9a06a9959e7977.js.map +0 -1
  211. package/dist/.next/static/chunks/app/(application)/keys/page-6ecb8218f18773b9.js +0 -2
  212. package/dist/.next/static/chunks/app/(application)/keys/page-6ecb8218f18773b9.js.map +0 -1
  213. package/dist/.next/static/chunks/app/(application)/layout-73d93420d0c6661c.js +0 -2
  214. package/dist/.next/static/chunks/app/(application)/layout-73d93420d0c6661c.js.map +0 -1
  215. package/dist/.next/static/chunks/app/(application)/page-16a518c5864e6963.js.map +0 -1
  216. package/dist/.next/static/chunks/app/(application)/projects/[project]/page-870b48a3e7f64f7d.js.map +0 -1
  217. package/dist/.next/static/chunks/app/(application)/projects/layout-aa5baaf5cc644e70.js.map +0 -1
  218. package/dist/.next/static/chunks/app/(application)/projects/page-055a048a107095ed.js.map +0 -1
  219. package/dist/.next/static/chunks/app/(application)/roles/page-b30682514e63b3f8.js +0 -2
  220. package/dist/.next/static/chunks/app/(application)/roles/page-b30682514e63b3f8.js.map +0 -1
  221. package/dist/.next/static/chunks/app/(application)/token/page-f86eaf8c51fdbe52.js.map +0 -1
  222. package/dist/.next/static/chunks/app/(application)/users/page-1a686fd83f765d8e.js +0 -2
  223. package/dist/.next/static/chunks/app/(application)/users/page-1a686fd83f765d8e.js.map +0 -1
  224. package/dist/.next/static/chunks/app/(application)/variables/create/page-16582f525a24dd45.js.map +0 -1
  225. package/dist/.next/static/chunks/app/(application)/variables/edit/[variable_id]/page-b37d9320812bb8f6.js.map +0 -1
  226. package/dist/.next/static/chunks/app/(application)/variables/page-9b438ce239c07987.js.map +0 -1
  227. package/dist/.next/static/chunks/app/(application)/variables/usage/[variable_id]/page-b1fe1791701d361e.js.map +0 -1
  228. package/dist/.next/static/chunks/app/(application)/workflows/page-93969baedc6f38ff.js.map +0 -1
  229. package/dist/.next/static/chunks/app/(authentication)/layout-2dfa18ea6e6dc5cd.js.map +0 -1
  230. package/dist/.next/static/chunks/app/(authentication)/login/error-c5f516f76e374400.js.map +0 -1
  231. package/dist/.next/static/chunks/app/(authentication)/login/page-4de4d6f64507c919.js.map +0 -1
  232. package/dist/.next/static/chunks/main-app-da1df2757744a2ea.js.map +0 -1
  233. package/dist/node_modules/sharp/build/Release/sharp-linux-x64.node +0 -0
  234. package/dist/node_modules/sharp/vendor/8.14.5/linux-x64/platform.json +0 -1
  235. package/release.config.cjs +0 -30
  236. /package/dist/.next/static/{Slpu2oH7SpIV9Idqdqoda → 5Vf-v5wyENpLUvLzma2J6}/_buildManifest.js +0 -0
  237. /package/dist/.next/static/{Slpu2oH7SpIV9Idqdqoda → 5Vf-v5wyENpLUvLzma2J6}/_ssgManifest.js +0 -0
  238. /package/dist/node_modules/sharp/vendor/8.14.5/{linux-x64 → darwin-arm64v8}/THIRD-PARTY-NOTICES.md +0 -0
@@ -1,2 +1,2 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6050],{72252:function(e,t,s){Promise.resolve().then(s.bind(s,6231))},6231:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return eo}});var n=s(57437),a=s(7211),l=s(12199),r=s(13590),i=s(21563),o=s(18930),d=s(9334),c=s(39763);let u=(0,c.Z)("XSquare",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);var m=s(83229),x=s(15868),h=s(45131);let f=(0,c.Z)("Expand",[["path",{d:"m21 21-6-6m6 6v-4.8m0 4.8h-4.8",key:"1c15vz"}],["path",{d:"M3 16.2V21m0 0h4.8M3 21l6-6",key:"1fsnz2"}],["path",{d:"M21 7.8V3m0 0h-4.8M21 3l-6 6",key:"hawz9i"}],["path",{d:"M3 7.8V3m0 0h4.8M3 3l6 6",key:"u9ee12"}]]),p=(0,c.Z)("MessageCirclePlus",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);var v=s(24156),j=s(17684),g=s(99376),y=s(2265),b=s(29501),N=s(67119),w=s(62910),k=s(68656),C=s(35974),E=s(62869),_=s(15681),z=s(95186),T=s(10492),S=s(6512),O=s(1828),R=s(73578),D=s(76818),Z=s(81103),L=s(26110),M=s(84190),F=s(37099),A=s(77992),I=s(94508),P=s(93022),U=s(65613),V=s(20653),$=s(27689),W=s(8014),B=s(74928),G=s(66070),q=s(78361);function J(e){var t,s,c,J,Q,X,K,Y,H,ee,et,es,en;let[ea,el]=(0,y.useState)(),{toast:er}=(0,A.pm)(),ei=(0,g.useRouter)(),[eo,ed]=(0,y.useState)(),ec=e.context,eu=e.context.fields.map(e=>e.name);console.log("fields",eu),console.log("context",ec);let{loading:em,error:ex,refetch:eh}=(0,a.aM)((0,$.A1)(e.context.id,eu,!0),{skip:!e.itemId||!(null===(t=e.context)||void 0===t?void 0:t.id),variables:{context:e.context.id,id:e.itemId},fetchPolicy:"no-cache",nextFetchPolicy:"network-only",onCompleted:t=>{var s,n,a;let l=t[e.context.id+"_itemsById"];el({...l,tags:l.tags?l.tags.split(","):[]}),ed({rights_mode:l.rights_mode,users:null===(s=l.RBAC)||void 0===s?void 0:s.users,roles:null===(n=l.RBAC)||void 0===n?void 0:n.roles,projects:null===(a=l.RBAC)||void 0===a?void 0:a.projects})}});(0,y.useEffect)(()=>{eh()},[e.itemId]);let[ef,ep]=(0,l.D)((0,$.ty)(e.context.id),{onCompleted:()=>{er({title:"Item updated",description:"Item updated successfully."})},onError:e=>{er({title:"Error updating item",description:e.message})}}),[ev,ej]=(0,l.D)((0,$.mN)(e.context.id,[]),{onCompleted:()=>{er({title:"Item deleted",description:"Item deleted successfully."})},onError:e=>{er({title:"Error deleting item",description:e.message})}}),[eg,ey]=(0,l.D)((0,$.Eq)(e.context.id),{onCompleted:t=>{var s;if((null===(s=t[e.context.id+"_itemsGenerateChunks"].jobs)||void 0===s?void 0:s.length)>0){er({title:"Chunks generation started",description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}er({title:"Chunks generated",description:"Chunks generated successfully."})}}),[eb,eN]=(0,l.D)((0,$.ps)(e.context.id),{onCompleted:t=>{var s;if((null===(s=t[e.context.id+"_itemsDeleteChunks"].jobs)||void 0===s?void 0:s.length)>0){er({title:"Chunks deletion started",description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}er({title:"Chunks deleted",description:"Chunks deleted successfully."})}}),[ew,ek]=(0,l.D)((0,$.dc)(e.context.id),{onCompleted:()=>{er({title:"Field processed",description:"Field processed successfully."})},onError:e=>{er({title:"Error processing field",description:e.message})}}),eC=N.Ry({name:N.Z_().nullable().optional(),tags:N.Z_().nullable().optional(),external_id:N.Z_().nullable().optional(),description:N.Z_().min(2,{message:"Text must be at least 2 characters."}).max(1e4,{message:"Text must not be longer than 10.0000 characters."}),...null!==(es=null==ec?void 0:null===(s=ec.fields)||void 0===s?void 0:s.reduce((e,t)=>({...e,[t.name]:N.Z_().nullable()}),{}))&&void 0!==es?es:{}}),eE=(0,b.cI)({resolver:(0,r.F)(eC),defaultValues:{description:null==ea?void 0:ea.description},mode:"onChange"}),e_=e=>{if(e.target.value&&"Enter"===e.key){var t;let s=null!==(t=null==ea?void 0:ea.tags)&&void 0!==t?t:[],n=[...Array.isArray(s)?[...s]:[]];n.push(e.target.value),console.log("tags",n),eE.setValue("tags",n.join(",")),el({...ea,tags:n}),e.target.value=""}},[ez,eT]=(0,y.useState)(!1),[eS,eO]=(0,y.useState)(null),[eR,eD]=(0,y.useState)(null);return((0,y.useEffect)(()=>{(null==ea?void 0:ea.text)==="New item"?eT(!0):eT(!1)},[null==ea?void 0:ea.id]),em)?(0,n.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md"}),(0,n.jsx)(P.O,{className:"w-full h-[50px] rounded-md mt-3"}),(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md mt-3"})]}):ex?(0,n.jsxs)(U.bZ,{variant:"destructive",children:[(0,n.jsx)(V.LPM,{className:"size-4"}),(0,n.jsx)(U.Cd,{children:"Error"}),(0,n.jsx)(U.X,{children:(null==ex?void 0:ex.message)||"Error loading item."})]}):(0,n.jsxs)("div",{className:"flex h-full flex-col",children:[ea?(0,n.jsxs)(n.Fragment,{children:[e.actions?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"flex items-center p-2",children:(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(null==ea?void 0:ea.archived)?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(Z.u,{children:[(0,n.jsx)(Z.aJ,{asChild:!0,children:(0,n.jsxs)(E.z,{onClick:async()=>{ea.id&&(ef({variables:{id:ea.id,input:{archived:!1}}}),el({...ea,archived:!1}),ei.push("./"))},variant:"ghost",size:"icon",disabled:!ea||ep.loading,children:[ep.loading?(0,n.jsx)(T.g,{}):(0,n.jsx)(i.Z,{className:"size-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Unarchive"})]})}),(0,n.jsx)(Z._v,{children:"Unarchive"})]}),(0,n.jsxs)(Z.u,{children:[(0,n.jsx)(Z.aJ,{asChild:!0,children:(0,n.jsxs)(E.z,{onClick:async()=>{ea.id&&(ev({variables:{id:ea.id}}),ei.push("./"))},variant:"ghost",size:"icon",disabled:!ea||ej.loading,children:[ej.loading?(0,n.jsx)(T.g,{}):(0,n.jsx)(o.Z,{className:"size-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Delete"})]})}),(0,n.jsx)(Z._v,{children:"Delete"})]})]}):(0,n.jsxs)(Z.u,{children:[(0,n.jsx)(Z.aJ,{asChild:!0,children:(0,n.jsxs)(E.z,{onClick:async()=>{(null==ea?void 0:ea.id)&&(ef({variables:{id:ea.id,input:{archived:!0}}}),el({...ea,archived:!0}),ei.push("./"))},variant:"ghost",size:"icon",disabled:!ea||ep.loading,children:[ep.loading?(0,n.jsx)(T.g,{}):(0,n.jsx)(d.Z,{className:"size-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Archive"})]})}),(0,n.jsx)(Z._v,{children:"Archive"})]}),ez?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(Z.u,{children:[(0,n.jsx)(Z.aJ,{asChild:!0,children:(0,n.jsxs)(E.z,{onClick:()=>{eT(!1)},variant:"ghost",size:"icon",children:[(0,n.jsx)(u,{className:"size-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Cancel"})]})}),(0,n.jsx)(Z._v,{children:"Cancel"})]}),(0,n.jsxs)(Z.u,{children:[(0,n.jsx)(Z.aJ,{asChild:!0,children:(0,n.jsxs)(E.z,{disabled:ep.loading,onClick:()=>{var e,t,s,n;(null==ea?void 0:ea.id)&&(ef({variables:{id:ea.id,input:{textlength:null==ea?void 0:null===(e=ea.text)||void 0===e?void 0:e.length,description:null==ea?void 0:ea.description,name:null==ea?void 0:ea.name,externalId:null==ea?void 0:ea.externalId,tags:null==ea?void 0:null===(t=ea.tags)||void 0===t?void 0:t.join(","),source:null==ea?void 0:ea.source,archived:null==ea?void 0:ea.archived,rights_mode:null==eo?void 0:eo.rights_mode,RBAC:{users:(null==eo?void 0:eo.users)||[],roles:(null==eo?void 0:eo.roles)||[],projects:(null==eo?void 0:eo.projects)||[]},...null!==(n=null==ec?void 0:null===(s=ec.fields)||void 0===s?void 0:s.reduce((e,t)=>({...e,[t.name]:null==ea?void 0:ea[t.name]}),{}))&&void 0!==n?n:{}}}}),eT(!1))},variant:"ghost",size:"icon",children:[(0,n.jsx)(m.Z,{className:"size-4"}),(0,n.jsxs)("span",{className:"sr-only",children:["Save ",null!==(en=ep.loading)&&void 0!==en?en:(0,n.jsx)(T.g,{})]})]})}),(0,n.jsx)(Z._v,{children:"Save"})]})]}):(0,n.jsxs)(Z.u,{children:[(0,n.jsx)(Z.aJ,{asChild:!0,children:(0,n.jsxs)(E.z,{onClick:()=>{eT(!0)},variant:"ghost",size:"icon",disabled:!ea||ep.loading,children:[(0,n.jsx)(x.Z,{className:"size-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Edit"})]})}),(0,n.jsx)(Z._v,{children:"Edit"})]})]})}),(0,n.jsx)(S.Z,{})]}):null,(0,n.jsx)("div",{className:"flex flex-1 flex-col",children:(0,n.jsxs)("div",{className:(0,I.cn)("space-y-2"),children:[(0,n.jsx)("div",{className:"flex items-center justify-between space-x-4 px-4 bg-muted rounded",children:(0,n.jsx)("h3",{className:"text-lg p-5 font-semibold tracking-tight text-lg",children:"Fields"})}),(0,n.jsxs)("div",{className:"p-5",children:[(0,n.jsx)(_.l0,{...eE,children:(0,n.jsx)("form",{className:"space-y-8",children:(0,n.jsxs)("div",{children:[(0,n.jsxs)(R.iA,{children:[(0,n.jsx)(R.xD,{children:(0,n.jsxs)(R.SC,{children:[(0,n.jsx)(R.ss,{children:"Name"}),(0,n.jsx)(R.ss,{children:"Value"})]})}),(0,n.jsxs)(R.RM,{children:[(0,n.jsxs)(R.SC,{children:[(0,n.jsx)(R.pj,{className:"font-medium capitalize",children:"Name"}),(0,n.jsx)(R.pj,{children:(0,n.jsx)(_.Wi,{control:eE.control,name:"name",render:e=>{var t,s,a;let{field:l}=e;return(0,n.jsx)(_.xJ,{children:ez?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(_.NI,{children:(0,n.jsx)(z.I,{type:"text",disabled:!ez,onChange:e=>{el({...ea,name:e.target.value})},placeholder:"Item name",value:null!==(a=ea.name)&&void 0!==a?a:""})}),(0,n.jsx)(_.zG,{})]}):(0,n.jsx)("div",{onClick:async()=>{var e;await navigator.clipboard.writeText(null!==(e=ea.name)&&void 0!==e?e:""),er({title:"Copied to clipboard"})},className:"flex-1 whitespace-pre-wrap text-sm cursor-copy",children:ea.name&&(null===(t=ea.name)||void 0===t?void 0:t.length)>200?(null===(s=ea.name)||void 0===s?void 0:s.slice(0,200))+"...":ea.name})})}})})]},"name"),(0,n.jsxs)(R.SC,{children:[(0,n.jsx)(R.pj,{className:"font-medium capitalize",children:"Tags"}),(0,n.jsxs)(R.pj,{children:[ez?(0,n.jsx)("div",{className:"grid-row grid grid-flow-col gap-4 pt-2",children:(0,n.jsx)(_.Wi,{control:eE.control,name:"tags",render:e=>{let{field:t}=e;return(0,n.jsxs)(_.xJ,{children:[(0,n.jsx)(_.NI,{children:(0,n.jsx)(z.I,{id:"includes",type:"text",onKeyUp:e=>e_(e),placeholder:"Type and press enter to add"})}),(0,n.jsx)(_.zG,{})]})}})}):null,(null==ea?void 0:null===(c=ea.tags)||void 0===c?void 0:c.length)?(0,n.jsx)("div",{className:"gap-2 pt-2",children:null==ea?void 0:null===(J=ea.tags)||void 0===J?void 0:J.map((e,t)=>(0,n.jsx)(C.C,{variant:"secondary",className:"px-3 py-2 mr-2 mb-2",children:(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("div",{className:"text-muted-foreground truncate max-w-[200px]",children:e}),ez?(0,n.jsx)("span",{className:"size-4 cursor-pointer text-muted-foreground",onClick:()=>{var e;let s=[...null!==(e=ea.tags)&&void 0!==e?e:[]];s.splice(t,1),eE.setValue("tags",s.join(",")),el({...ea,tags:s})},children:(0,n.jsx)(h.Z,{className:"ml-1",size:15})}):null]})},"tag-".concat(t)))}):null]})]},"tags"),(0,n.jsxs)(R.SC,{children:[(0,n.jsx)(R.pj,{className:"font-medium capitalize",children:"Description"}),(0,n.jsx)(R.pj,{children:(0,n.jsx)(_.Wi,{control:eE.control,name:"description",render:e=>{var t,s,a;let{field:l}=e;return(0,n.jsx)(_.xJ,{children:ez?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(_.NI,{children:(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(D.g,{autoFocus:!0,disabled:!ez,onChange:e=>{el({...ea,description:e.target.value})},placeholder:"Item text content",className:"resize-none",value:null!==(s=ea.description)&&void 0!==s?s:""}),(0,n.jsxs)(L.Vq,{children:[(0,n.jsx)(L.hg,{asChild:!0,children:(0,n.jsxs)(E.z,{type:"button",variant:"ghost",size:"sm",className:"absolute top-2 right-2 h-6 w-6 p-0",onClick:()=>{var e;return eO({name:"description",value:null!==(e=ea.description)&&void 0!==e?e:"",disabled:!1})},children:[(0,n.jsx)(f,{className:"h-3 w-3"}),(0,n.jsx)("span",{className:"sr-only",children:"Expand"})]})}),(0,n.jsxs)(L.cZ,{className:"max-w-4xl max-h-[80vh]",children:[(0,n.jsx)(L.fK,{children:(0,n.jsx)(L.$N,{children:"Edit Description"})}),(0,n.jsx)("div",{className:"mt-4",children:(0,n.jsx)(D.g,{rows:20,className:"min-h-[400px] resize-none",value:(null==eS?void 0:eS.name)==="description"?eS.value:null!==(a=ea.description)&&void 0!==a?a:"",onChange:e=>{let t=e.target.value;eO(e=>(null==e?void 0:e.name)==="description"?{...e,value:t}:e),el({...ea,description:t})}})})]})]})]})}),(0,n.jsx)(_.zG,{})]}):(0,n.jsx)("div",{onClick:async()=>{var e;await navigator.clipboard.writeText(null!==(e=ea.description)&&void 0!==e?e:""),er({title:"Copied to clipboard"})},className:"flex-1 whitespace-pre-wrap text-sm cursor-copy",children:(0,n.jsx)(k.J,{text:null!==(t=ea.description)&&void 0!==t?t:""})})})}})})]},19091),(0,n.jsxs)(R.SC,{children:[(0,n.jsx)(R.pj,{className:"font-medium capitalize",children:"External ID"}),(0,n.jsx)(R.pj,{children:(0,n.jsx)(_.Wi,{control:eE.control,name:"external_id",render:e=>{var t,s;let{field:a}=e;return(0,n.jsx)(_.xJ,{children:ez?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(_.NI,{children:(0,n.jsx)(z.I,{type:"text",disabled:!ez,onChange:e=>{console.log("e",e),el({...ea,external_id:e.target.value})},placeholder:"xxxx-xxxx-xxxx-xxxx",value:null!==(s=ea.external_id)&&void 0!==s?s:""})}),(0,n.jsx)(_.zG,{})]}):(0,n.jsx)("div",{onClick:async()=>{var e;await navigator.clipboard.writeText(null!==(e=ea.external_id)&&void 0!==e?e:""),er({title:"Copied to clipboard"})},className:"flex-1 whitespace-pre-wrap text-sm cursor-copy",children:null!==(t=ea.external_id)&&void 0!==t?t:""})})}})})]},"externalId"),(null==ec?void 0:null===(Q=ec.fields)||void 0===Q?void 0:Q.length)&&ec.fields.map((e,t)=>{var s;return(0,n.jsxs)(R.SC,{children:[(0,n.jsxs)(R.pj,{className:"font-medium capitalize flex flex-col",children:[e.label,e.calculated&&(0,n.jsx)("span",{className:"text-sm text-muted-foreground",children:"Calculated"}),e.processor&&(0,n.jsxs)(Z.u,{children:[(0,n.jsx)(Z.aJ,{asChild:!0,children:(0,n.jsxs)(E.z,{variant:"secondary",size:"sm",className:"w-auto mt-2",onClick:()=>{ew({variables:{item:null==ea?void 0:ea.id,field:e.name}})},disabled:ek.loading,children:[ek.loading?(0,n.jsx)(T.g,{}):(0,n.jsx)(p,{className:"size-4"}),(0,n.jsx)("span",{className:"ml-2",children:"Process"})]})}),(0,n.jsx)(Z._v,{className:"max-w-xs",children:e.processor.description})]})]}),ez?(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(R.pj,{children:["code"===e.type||"json"===e.type||"text"===e.type||"longText"===e.type||"markdown"===e.type||"shortText"===e.type?(0,n.jsx)(_.Wi,{control:eE.control,name:e.name,render:t=>{var s,a;let{field:l}=t;return(0,n.jsxs)(_.xJ,{children:[(0,n.jsx)(_.NI,{children:(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(D.g,{id:e.name,rows:"shortText"===e.type?2:7,onChange:t=>{el({...ea,[e.name]:t.target.value})},value:null!==(s=ea[e.name])&&void 0!==s?s:""}),(0,n.jsxs)(L.Vq,{children:[(0,n.jsx)(L.hg,{asChild:!0,children:(0,n.jsxs)(E.z,{type:"button",variant:"ghost",size:"sm",className:"absolute top-2 right-2 h-6 w-6 p-0",onClick:()=>{var t;return eO({name:e.name,disabled:!1,value:null!==(t=ea[e.name])&&void 0!==t?t:""})},children:[(0,n.jsx)(f,{className:"h-3 w-3"}),(0,n.jsx)("span",{className:"sr-only",children:"Expand"})]})}),(0,n.jsxs)(L.cZ,{className:"max-w-4xl max-h-[80vh]",children:[(0,n.jsx)(L.fK,{children:(0,n.jsxs)(L.$N,{children:["Edit ",e.name]})}),(0,n.jsx)("div",{className:"mt-4",children:(0,n.jsx)(D.g,{rows:20,className:"min-h-[400px] resize-none",value:(null==eS?void 0:eS.name)===e.name?eS.value:null!==(a=ea[e.name])&&void 0!==a?a:"",onChange:t=>{let s=t.target.value;eO(t=>(null==t?void 0:t.name)===e.name?{...t,value:s}:t),el({...ea,[e.name]:s})}})})]})]})]})}),(0,n.jsx)(_.zG,{})]})}}):null,"number"===e.type?(0,n.jsx)(_.Wi,{control:eE.control,name:e.name,render:t=>{var s;let{field:a}=t;return(0,n.jsxs)(_.xJ,{children:[(0,n.jsx)(_.NI,{children:(0,n.jsx)(z.I,{id:e.name,type:"number",onChange:t=>{el({...ea,[e.name]:t.target.value})},value:null!==(s=ea[e.name])&&void 0!==s?s:""})}),(0,n.jsx)(_.zG,{})]})}}):null,"boolean"===e.type?(0,n.jsx)(_.Wi,{control:eE.control,name:e.name,render:t=>{let{field:s}=t;return(0,n.jsxs)(_.xJ,{children:[(0,n.jsx)(_.NI,{children:(0,n.jsx)(O.r,{checked:!!s.value,onCheckedChange:t=>{el({...ea,[e.name]:t})}})}),(0,n.jsx)(_.zG,{})]})}}):null,"file"===e.type&&(0,n.jsx)("div",{children:(0,n.jsx)(q.jF,{s3key:ea[e.name],children:(0,n.jsx)(q.ZP,{id:"item-".concat(ea.id),buttonText:"Select File",allowedFileTypes:e.allowedFileTypes,dependencies:[],selectionLimit:1,onConfirm:t=>{console.log("keys",t),el({...ea,[e.name]:t[0]})}})})})]})}):(0,n.jsx)(R.pj,{children:(0,n.jsxs)("span",{children:["code"===e.type&&(0,n.jsx)(w.G,{code:ea[e.name]}),"json"===e.type&&(0,n.jsx)(w.G,{code:ea[e.name]}),"shortText"===e.type&&(0,n.jsx)("p",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(ea[e.name]),er({title:"Copied to clipboard"})},children:ea[e.name]}),"longText"===e.type&&(0,n.jsx)(k.J,{text:ea[e.name]}),"file"===e.type&&(0,n.jsx)(q.jF,{s3key:ea[e.name]}),"markdown"===e.type&&(0,n.jsx)(k.J,{text:ea[e.name]}),!e.type&&(0,n.jsx)(k.J,{text:ea[e.name]}),"text"===e.type&&(0,n.jsx)(k.J,{text:ea[e.name]}),"number"===e.type&&(0,n.jsx)("p",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(ea[e.name]),er({title:"Copied to clipboard"})},children:ea[e.name]}),"boolean"===e.type&&(0,n.jsx)("p",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(ea[e.name]),er({title:"Copied to clipboard"})},children:null!==(s=ea[e.name])&&void 0!==s?s:""})]})})]},t)})]})]}),(0,n.jsx)(S.Z,{className:"my-4"})]})})}),(0,n.jsx)(G.Zb,{className:"bg-transparent",children:(0,n.jsxs)(B.zF,{children:[(0,n.jsx)(G.Ol,{className:"p-4",children:(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex flex-col",children:[(0,n.jsx)("p",{className:"text-base",children:"Access Control"}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground mb-0",children:"Control access to this item."})]}),(0,n.jsx)(B.wy,{asChild:!0,children:(0,n.jsxs)(E.z,{variant:"ghost",size:"icon",className:"size-8",children:[(0,n.jsx)(v.Z,{className:"size-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Toggle"})]})})]})}),(0,n.jsx)(B.Fw,{className:"mt-5",children:(0,n.jsx)(G.aY,{className:"space-y-4",children:(0,n.jsx)(W.P,{initialRightsMode:ea.rights_mode,initialUsers:null===(X=ea.RBAC)||void 0===X?void 0:X.users,initialRoles:null===(K=ea.RBAC)||void 0===K?void 0:K.roles,initialProjects:null===(Y=ea.RBAC)||void 0===Y?void 0:Y.projects,onChange:(e,t,s,n)=>{ed({rights_mode:e,users:t,roles:s,projects:n})}})})})]})}),(0,n.jsxs)("div",{className:"mt-4 border border p-3 pb-5 rounded",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between ml-4 mt-3 mr-4 mb-2",children:[(0,n.jsx)("h1",{className:"text-lg font-medium",children:"Embeddings"}),(0,n.jsxs)(M.h_,{children:[(0,n.jsx)(M.$F,{asChild:!0,children:(0,n.jsxs)(E.z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:[(0,n.jsx)(j.Z,{className:"h-4 w-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Open menu"})]})}),(0,n.jsxs)(M.AW,{align:"end",children:[(0,n.jsx)(M.Xi,{onClick:()=>eD("generate"),children:"Generate embeddings"}),(0,n.jsx)(M.Xi,{onClick:()=>eD("delete"),children:"Delete embeddings"})]})]})]}),(0,n.jsxs)(R.iA,{children:[(0,n.jsx)(R.Rn,{children:(null==ea?void 0:null===(H=ea.chunks)||void 0===H?void 0:H.length)?"A list of all embeddings for this item.":"No embeddings found."}),(0,n.jsx)(R.xD,{children:(0,n.jsxs)(R.SC,{children:[(0,n.jsx)(R.ss,{children:"Index"}),(0,n.jsx)(R.ss,{children:"Content"}),(0,n.jsx)(R.ss,{children:"Dimensions"}),(0,n.jsx)(R.ss,{children:"Created At"}),(0,n.jsx)(R.ss,{children:"Updated At"})]})}),(0,n.jsx)(R.RM,{children:(null==ea?void 0:null===(ee=ea.chunks)||void 0===ee?void 0:ee.length)?(null==ea?void 0:null===(et=ea.chunks)||void 0===et?void 0:et.length)&&ea.chunks.map(e=>(0,n.jsxs)(R.SC,{children:[(0,n.jsx)(R.pj,{className:"font-medium capitalize",children:e.chunk_index+1}),(0,n.jsx)(R.pj,{children:(0,n.jsx)(k.J,{text:e.content})}),(0,n.jsx)(R.pj,{children:e.embedding_size||0}),(0,n.jsx)(R.pj,{children:new Date(e.chunk_created_at).toLocaleString()}),(0,n.jsx)(R.pj,{children:new Date(e.chunk_updated_at).toLocaleString()})]},e.id)):null})]})]})]})]})})]}):(0,n.jsxs)(n.Fragment,{children:[" ",!ea&&e.itemId?(0,n.jsx)("div",{className:"p-8 text-center text-muted-foreground",children:"Item not found."}):(0,n.jsx)("div",{className:"p-8 text-center text-muted-foreground",children:"No item selected."})]}),(0,n.jsx)(F.aR,{open:"generate"===eR,onOpenChange:e=>!e&&eD(null),children:(0,n.jsxs)(F._T,{children:[(0,n.jsxs)(F.fY,{children:[(0,n.jsx)(F.f$,{children:"Generate Embeddings"}),(0,n.jsx)(F.yT,{children:"Are you sure you want to generate embeddings for this item? This will create new embedding vectors for the content."})]}),(0,n.jsxs)(F.xo,{children:[(0,n.jsx)(F.le,{children:"Cancel"}),(0,n.jsx)(F.OL,{disabled:ey.loading,onClick:()=>{(null==ea?void 0:ea.id)&&(console.log("Generate embeddings for item:",null==ea?void 0:ea.id),eD(null),eg({variables:{where:{id:{eq:null==ea?void 0:ea.id}}}}))},children:"Generate"})]})]})}),(0,n.jsx)(F.aR,{open:"delete"===eR,onOpenChange:e=>!e&&eD(null),children:(0,n.jsxs)(F._T,{children:[(0,n.jsxs)(F.fY,{children:[(0,n.jsx)(F.f$,{children:"Delete Embeddings"}),(0,n.jsx)(F.yT,{children:"Are you sure you want to delete all embeddings for this item? This action cannot be undone."})]}),(0,n.jsxs)(F.xo,{children:[(0,n.jsx)(F.le,{children:"Cancel"}),(0,n.jsx)(F.OL,{disabled:eN.loading,onClick:async()=>{(null==ea?void 0:ea.id)&&(console.log("Delete embeddings for item:",null==ea?void 0:ea.id),eD(null),eb({variables:{where:{id:{eq:null==ea?void 0:ea.id}}}}))},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}var Q=s(5341),X=s(91048),K=s(21409),Y=s(52896),H=s(73450);function ee(){let[e,t]=(0,y.useState)("count"),[s,a]=(0,y.useState)({from:(0,Q.k)(new Date,7),to:new Date}),[l,r]=(0,y.useState)("EMBEDDER_GENERATE"),[i,o]=(0,y.useState)("label");return(0,n.jsxs)("div",{className:"flex-1 flex flex-col p-8 pt-6 h-screen",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-8",children:[(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("h2",{className:"text-4xl font-bold tracking-tight bg-clip-text",children:"Contexts Dashboard"}),(0,n.jsx)("p",{className:"text-lg",children:"Monitor your contexts and their usage."})]}),(0,n.jsx)("div",{className:"flex items-center space-x-2",children:(0,n.jsx)(K.z,{dateRange:s,onDateRangeChange:a,maxDays:30})})]}),(0,n.jsxs)("div",{className:"flex-1 grid gap-6 md:grid-cols-3 min-h-0",children:[(0,n.jsx)("div",{className:"rounded-lg border md:col-span-2 p-6 flex flex-col",children:(0,n.jsx)(Y.q,{dateRange:s,selectedType:l,onTypeChange:r,onUnitChange:t,unit:e,dataTypes:[X.h.CONTEXT_RETRIEVE,X.h.EMBEDDER_UPSERT,X.h.EMBEDDER_GENERATE,X.h.EMBEDDER_DELETE,X.h.CONTEXT_UPSERT]})}),(0,n.jsx)("div",{className:"rounded-lg border p-6 flex flex-col",children:(0,n.jsx)(H.Y,{groupByOptions:[],dateRange:s,selectedType:l,groupBy:i,onGroupByChange:o})})]})]})}var et=s(32660),es=s(19378),en=s(7598),ea=s(27648),el=s(37091);function er(e){var t,s;let{contextId:l}=e,r=(0,y.useRef)(new Date(Date.now()-18144e5).toISOString()),{loading:i,data:o,refetch:d,previousData:c,error:u}=(0,a.aM)((0,$.P3)(l,[]),{fetchPolicy:"no-cache",nextFetchPolicy:"network-only",variables:{context:l,page:1,limit:5,filters:[{embeddings_updated_at:{gte:r.current}}],sort:{field:"embeddings_updated_at",direction:"DESC"}}}),m=null==o?void 0:o[l+$.Md];return i?(0,n.jsxs)("div",{className:"flex flex-col gap-2 pt-0",children:[(0,n.jsx)(P.O,{className:"w-full h-[50px] rounded-lg mb-2"}),(0,n.jsx)(P.O,{className:"w-full h-[50px] rounded-lg mb-2"}),(0,n.jsx)(P.O,{className:"w-full h-[50px] rounded-lg"})]}):(0,n.jsx)("div",{className:"space-y-8",children:(null==m?void 0:null===(t=m.items)||void 0===t?void 0:t.length)?null==m?void 0:null===(s=m.items)||void 0===s?void 0:s.map((e,t)=>{var s;return(0,n.jsx)("div",{className:"flex items-center",children:(0,n.jsx)("div",{className:"space-y-1",children:(0,n.jsx)("p",{className:"text-sm font-medium leading-none",children:(0,n.jsxs)(ea.default,{className:"hover:dark:text-blue-500 hover:underline",href:"/data/"+l+"/"+e.id,children:[(0,n.jsx)(el.L,{text:null!==(s=e.name)&&void 0!==s?s:"",length:50}),(0,n.jsxs)("p",{className:"text-sm text-muted-foreground",children:["created at: ",e.embeddings_updated_at?(0,en.Q)(new Date(e.embeddings_updated_at),{addSuffix:!0}):"never","."]})]})})})},t)}):(0,n.jsx)("div",{className:"flex flex-col gap-2 pt-0",children:(0,n.jsx)("p",{className:"text-sm font-medium leading-none",children:"No recent embeddings."})})})}function ei(e){var t;let[s,r]=(0,y.useState)(null),{toast:i}=(0,A.pm)(),{data:o,loading:d,error:c}=(0,a.aM)($.fV,{variables:{id:e.context}}),u=null==o?void 0:o.contextById,m=(0,g.useRouter)(),[x,h]=(0,l.D)((0,$.Eq)(e.context),{onCompleted:t=>{var s;if((null===(s=t[e.context+"_itemsGenerateChunks"].jobs)||void 0===s?void 0:s.length)>0){i({title:"Chunks generation started",description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}i({title:"Chunks generated",description:"Chunks generated successfully."})}}),[f,p]=(0,l.D)((0,$.ps)(e.context),{onCompleted:t=>{var s;if((null===(s=t[e.context+"_itemsDeleteChunks"].jobs)||void 0===s?void 0:s.length)>0){i({title:"Chunks deletion started",description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}i({title:"Chunks deleted",description:"Chunks deleted successfully."})}});return d?(0,n.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md"}),(0,n.jsx)(P.O,{className:"w-full h-[50px] rounded-md mt-3"}),(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md mt-3"})]}):c?(0,n.jsxs)(U.bZ,{variant:"destructive",children:[(0,n.jsx)(V.LPM,{className:"size-4"}),(0,n.jsx)(U.Cd,{children:"Error"}),(0,n.jsx)(U.X,{children:(null==c?void 0:c.message)||"Error loading item."})]}):(0,n.jsxs)("div",{className:"flex h-full flex-col",children:[e.actions?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex p-2 justify-between",children:[(0,n.jsx)("div",{className:"flex items-center gap-2"}),(0,n.jsxs)(E.z,{onClick:()=>{m.push("/context")},variant:"ghost",size:"icon",children:[(0,n.jsx)(et.Z,{className:"size-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Back"})]})]}),(0,n.jsx)(S.Z,{})]}):null,u?(0,n.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,n.jsxs)(G.Zb,{className:"border-0 rounded-none",children:[(0,n.jsx)(G.Ol,{children:(0,n.jsx)(G.ll,{className:"text-lg",children:"Settings"})}),(0,n.jsx)(G.aY,{className:"grid gap-4",children:(0,n.jsx)(es.x,{className:"max-h-[600px]",children:(0,n.jsxs)("div",{className:"space-y-6 pr-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"text-xl font-bold",children:u.name}),(0,n.jsx)("p",{className:"text-muted-foreground mt-1",children:u.description}),(0,n.jsxs)("div",{className:"mt-3 flex items-center",children:[(0,n.jsx)("span",{className:"text-sm font-medium mr-2",children:"Embedder:"}),(0,n.jsx)(C.C,{variant:"outline",children:u.embedder||"None"})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-sm font-medium mr-2",children:"Calculate Vectors:"}),(0,n.jsx)(C.C,{variant:"secondary",children:(null===(t=u.configuration)||void 0===t?void 0:t.calculateVectors)?u.configuration.calculateVectors.charAt(0).toUpperCase()+u.configuration.calculateVectors.slice(1):"Manual"}),(0,n.jsxs)("div",{className:"mt-2 text-xs text-muted-foreground",children:[(0,n.jsxs)("span",{className:"block",children:[(0,n.jsx)("b",{children:"Manual"}),": Vectors are only calculated when triggered manually."]}),(0,n.jsxs)("span",{className:"block",children:[(0,n.jsx)("b",{children:"On Update"}),": Vectors are recalculated whenever an item is updated."]}),(0,n.jsxs)("span",{className:"block",children:[(0,n.jsx)("b",{children:"On Insert"}),": Vectors are calculated when a new item is inserted."]}),(0,n.jsxs)("span",{className:"block",children:[(0,n.jsx)("b",{children:"Always"}),": Vectors are calculated on both insert and update operations."]})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-sm font-medium mr-2",children:"Default rights mode for new items in this context:"}),(0,n.jsxs)("div",{className:"mt-2 text-xs text-muted-foreground",children:[(0,n.jsxs)("span",{className:"block",children:[(0,n.jsx)("b",{children:"Private"}),": Only the user who created the item can view it."]}),(0,n.jsxs)("span",{className:"block",children:[(0,n.jsx)("b",{children:"Users"}),": Any user with access to the context can view the item."]}),(0,n.jsxs)("span",{className:"block",children:[(0,n.jsx)("b",{children:"Roles"}),": Any user with the role assigned to the context can view the item."]}),(0,n.jsxs)("span",{className:"block",children:[(0,n.jsx)("b",{children:"Public"}),": Any user can view the item."]})]})]}),(0,n.jsx)(S.Z,{})]})})})]}),(0,n.jsxs)(G.Zb,{className:"bg-none border-0 rounded-none",children:[(0,n.jsx)(G.Ol,{children:(0,n.jsx)(G.ll,{children:(0,n.jsxs)("div",{className:"flex items-center justify-between ml-4 mt-3 mr-4 mb-2",children:[(0,n.jsx)("h1",{className:"text-lg font-medium",children:"Embeddings"}),(0,n.jsxs)(M.h_,{children:[(0,n.jsx)(M.$F,{asChild:!0,children:(0,n.jsxs)(E.z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:[(0,n.jsx)(j.Z,{className:"h-4 w-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Open menu"})]})}),(0,n.jsxs)(M.AW,{align:"end",children:[(0,n.jsx)(M.Xi,{onClick:()=>r("generate"),children:"Generate all embeddings"}),(0,n.jsx)(M.Xi,{onClick:()=>r("delete"),children:"Delete all embeddings"})]})]})]})})}),(0,n.jsx)(G.aY,{children:(0,n.jsx)(er,{contextId:u.id})})]})]}):(0,n.jsx)("div",{className:"p-8 text-center text-muted-foreground",children:"Context not found."}),(0,n.jsx)(F.aR,{open:"generate"===s,onOpenChange:e=>!e&&r(null),children:(0,n.jsxs)(F._T,{children:[(0,n.jsxs)(F.fY,{children:[(0,n.jsx)(F.f$,{children:"Generate Embeddings"}),(0,n.jsx)(F.yT,{children:"Are you sure you want to generate embeddings for this context? This will create new embedding vectors for every item in the context, this can take a long time, might cost money if you are using a paid service as your embedder, or require a lot of computational resources if your embedder is self hosted."})]}),(0,n.jsxs)(F.xo,{children:[(0,n.jsx)(F.le,{children:"Cancel"}),(0,n.jsx)(F.OL,{disabled:h.loading,onClick:()=>{r(null),x(),i({title:"Generating embeddings...",description:"Embeddings are being generated in the background, depending on the size of the item this may take a while."})},children:"Generate"})]})]})}),(0,n.jsx)(F.aR,{open:"delete"===s,onOpenChange:e=>!e&&r(null),children:(0,n.jsxs)(F._T,{children:[(0,n.jsxs)(F.fY,{children:[(0,n.jsx)(F.f$,{children:"Delete Embeddings"}),(0,n.jsx)(F.yT,{children:"Are you sure you want to delete all embeddings for this context? This action cannot be undone. Embeddings are used to search and filter items, deleting them will remove this functionality from the context, regenerating embeddings might take a long time, might cost money if you are using a paid service as your embedder, or require a lot of computational resources if your embedder is self hosted."})]}),(0,n.jsxs)(F.xo,{children:[(0,n.jsx)(F.le,{children:"Cancel"}),(0,n.jsx)(F.OL,{disabled:p.loading,onClick:async()=>{r(null),f(),i({title:"Embeddings deleted",description:"All embeddings for this item have been deleted."})},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function eo(e){var t,s;let{params:l}=e,{data:r,loading:i,error:o}=(0,a.aM)($.fV,{skip:!(null==l?void 0:null===(t=l.query)||void 0===t?void 0:t[0]),variables:{id:null==l?void 0:null===(s=l.query)||void 0===s?void 0:s[0]}});if(!l.query)return(0,n.jsx)("div",{className:"grow flex flex-col",children:(0,n.jsx)(ee,{})});let d=l.query[0]||null,c="archived"===l.query[1],u="settings"===l.query[1];if(u)return(0,n.jsx)(ei,{expand:!0,actions:!0,context:d});let m=null;return(c?m=l.query[2]||null:u||(m=l.query[1]||null),!i&&(null==r?void 0:r.contextById))?o?(0,n.jsxs)(U.bZ,{variant:"destructive",children:[(0,n.jsx)(V.LPM,{className:"size-4"}),(0,n.jsx)(U.Cd,{children:"Error"}),(0,n.jsx)(U.X,{children:(null==o?void 0:o.message)||"Error loading item."})]}):(0,n.jsx)(J,{actions:!0,context:null==r?void 0:r.contextById,itemId:m}):(0,n.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md"}),(0,n.jsx)(P.O,{className:"w-full h-[50px] rounded-md mt-3"}),(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md mt-3"})]})}},53245:function(e,t,s){"use strict";s.d(t,{d:function(){return x},f:function(){return h}});var n=s(57437),a=s(62869),l=s(94508),r=s(30401),i=s(78867),o=s(2265),d=s(34996),c=s(1479),u=s(9880);let m=(0,o.createContext)({code:""}),x=e=>{let{code:t,language:s,showLineNumbers:a=!1,className:r,children:i,...o}=e;return(0,n.jsx)(m.Provider,{value:{code:t},children:(0,n.jsx)("div",{className:(0,l.cn)("relative w-full overflow-hidden rounded-md border bg-background text-foreground",r),...o,children:(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(d.Z,{className:"overflow-hidden dark:hidden",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:s,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:a,style:c.Z,children:t}),(0,n.jsx)(d.Z,{className:"hidden overflow-hidden dark:block",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:s,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:a,style:u.Z,children:t}),i&&(0,n.jsx)("div",{className:"absolute top-2 right-2 flex items-center gap-2",children:i})]})})})},h=e=>{let{onCopy:t,onError:s,timeout:d=2e3,children:c,className:u,...x}=e,[h,f]=(0,o.useState)(!1),{code:p}=(0,o.useContext)(m),v=async()=>{if(!navigator.clipboard.writeText){null==s||s(Error("Clipboard API not available"));return}try{await navigator.clipboard.writeText(p),f(!0),null==t||t(),setTimeout(()=>f(!1),d)}catch(e){null==s||s(e)}},j=h?r.Z:i.Z;return(0,n.jsx)(a.z,{className:(0,l.cn)("shrink-0",u),onClick:v,size:"icon",variant:"ghost",...x,children:null!=c?c:(0,n.jsx)(j,{size:14})})}},35629:function(e,t,s){"use strict";s.d(t,{H:function(){return x}});var n=s(57437),a=s(94508),l=s(2265),r=s(86816),i=s(67245),o=s(58146),d=s(85020),c=s(53245);s(2446);let u=(0,s(86589).Z)(r.UG),m={ol:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("ol",{className:(0,a.cn)("ml-4 list-outside list-decimal",l),...r,children:s})},li:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("li",{className:(0,a.cn)("py-1",l),...r,children:s})},ul:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("ul",{className:(0,a.cn)("ml-4 list-outside list-disc",l),...r,children:s})},hr:e=>{let{node:t,className:s,...l}=e;return(0,n.jsx)("hr",{className:(0,a.cn)("my-6 border-border",s),...l})},strong:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("span",{className:(0,a.cn)("font-semibold",l),...r,children:s})},a:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("a",{className:(0,a.cn)("font-medium text-primary underline",l),rel:"noreferrer",target:"_blank",...r,children:s})},h1:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("h1",{className:(0,a.cn)("mt-6 mb-2 font-semibold text-3xl",l),...r,children:s})},h2:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("h2",{className:(0,a.cn)("mt-6 mb-2 font-semibold text-2xl",l),...r,children:s})},h3:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("h3",{className:(0,a.cn)("mt-6 mb-2 font-semibold text-xl",l),...r,children:s})},h4:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("h4",{className:(0,a.cn)("mt-6 mb-2 font-semibold text-lg",l),...r,children:s})},h5:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("h5",{className:(0,a.cn)("mt-6 mb-2 font-semibold text-base",l),...r,children:s})},h6:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("h6",{className:(0,a.cn)("mt-6 mb-2 font-semibold text-sm",l),...r,children:s})},table:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("div",{className:"my-4 overflow-x-auto",children:(0,n.jsx)("table",{className:(0,a.cn)("w-full border-collapse border border-border",l),...r,children:s})})},thead:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("thead",{className:(0,a.cn)("bg-muted/50",l),...r,children:s})},tbody:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("tbody",{className:(0,a.cn)("divide-y divide-border",l),...r,children:s})},tr:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("tr",{className:(0,a.cn)("border-border border-b",l),...r,children:s})},th:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("th",{className:(0,a.cn)("px-4 py-2 text-left font-semibold text-sm",l),...r,children:s})},td:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("td",{className:(0,a.cn)("px-4 py-2 text-sm",l),...r,children:s})},blockquote:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("blockquote",{className:(0,a.cn)("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",l),...r,children:s})},code:e=>{var t,s;let{node:l,className:r,...i}=e;return(null==l?void 0:null===(t=l.position)||void 0===t?void 0:t.start.line)!==(null==l?void 0:null===(s=l.position)||void 0===s?void 0:s.end.line)?(0,n.jsx)("code",{className:r,...i}):(0,n.jsx)("code",{className:(0,a.cn)("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",r),...i})},pre:e=>{var t;let{node:s,className:r,children:i}=e,o="javascript";"string"==typeof(null==s?void 0:null===(t=s.properties)||void 0===t?void 0:t.className)&&(o=s.properties.className.replace("language-",""));let d="";return(0,l.isValidElement)(i)&&i.props&&"string"==typeof i.props.children?d=i.props.children:"string"==typeof i&&(d=i),(0,n.jsx)(c.d,{className:(0,a.cn)("my-4 h-auto",r),code:d,language:o,children:(0,n.jsx)(c.f,{onCopy:()=>console.log("Copied code to clipboard"),onError:()=>console.error("Failed to copy code to clipboard")})})}},x=(0,l.memo)(e=>{let{className:t,options:s,children:l,allowedImagePrefixes:r,allowedLinkPrefixes:c,defaultOrigin:x,parseIncompleteMarkdown:h=!0,...f}=e,p="string"==typeof l&&h?function(e){if(!e||"string"!=typeof e)return e;let t=e,s=t.match(/(!?\[)([^\]]*?)$/);if(s){let e=t.lastIndexOf(s[1]);t=t.substring(0,e)}if(t.match(/(\*\*)([^*]*?)$/)&&(t.match(/\*\*/g)||[]).length%2==1&&(t="".concat(t,"**")),t.match(/(__)([^_]*?)$/)&&(t.match(/__/g)||[]).length%2==1&&(t="".concat(t,"__")),t.match(/(\*)([^*]*?)$/)&&t.split("").reduce((e,s,n)=>{if("*"===s){let s=t[n-1],a=t[n+1];if("*"!==s&&"*"!==a)return e+1}return e},0)%2==1&&(t="".concat(t,"*")),t.match(/(_)([^_]*?)$/)&&t.split("").reduce((e,s,n)=>{if("_"===s){let s=t[n-1],a=t[n+1];if("_"!==s&&"_"!==a)return e+1}return e},0)%2==1&&(t="".concat(t,"_")),t.match(/(`)([^`]*?)$/)&&(t.includes("```"),(t.match(/```[\s\S]*?```/g)||[]).length,(t.match(/```/g)||[]).length%2!=1)){let e=0;for(let s=0;s<t.length;s++)if("`"===t[s]){let n="```"===t.substring(s,s+3),a=s>0&&"```"===t.substring(s-1,s+2),l=s>1&&"```"===t.substring(s-2,s+1);!(n||a||l)&&e++}e%2==1&&(t="".concat(t,"`"))}return t.match(/(~~)([^~]*?)$/)&&(t.match(/~~/g)||[]).length%2==1&&(t="".concat(t,"~~")),t}(l):l;return(0,n.jsx)("div",{className:(0,a.cn)("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",t),...f,children:(0,n.jsx)(u,{allowedImagePrefixes:null!=r?r:["*"],allowedLinkPrefixes:null!=c?c:["*"],components:m,defaultOrigin:x,rehypePlugins:[i.Z],remarkPlugins:[o.Z,d.Z],...s,children:p})})},(e,t)=>e.children===t.children);x.displayName="Response"},44045:function(e,t,s){"use strict";s.d(t,{ConfigContextProvider:function(){return l},E:function(){return a}});var n=s(57437);let a=(0,s(2265).createContext)(null);function l(e){let{children:t,config:s}=e;if(console.log("[EXULU] Config: ",s),!s)throw Error("Config not found");return(0,n.jsx)(a.Provider,{value:s,children:t})}},62910:function(e,t,s){"use strict";s.d(t,{G:function(){return f}});var n=s(57437),a=s(29406),l=s(10842),r=s(38436),i=s(2265),o=s(42571),d=s(71558),c=s(69797),u=s(49712),m=s(26110),x=s(77992),h=s(94508);function f(e){let{className:t=null,code:s,language:d,slice:c=200}=e,{toast:f}=(0,x.pm)(),[p,v]=(0,i.useState)(null),j=async(e,t)=>{v(await r.ZP.format(e,{parser:t,plugins:[a.Z,l.ZP]}))};return(0,i.useEffect)(()=>{"json"===d?j(s,"json"):"javascript"===d||"js"===d?j(s,"babel"):v(s)},[s,d]),(0,n.jsxs)(m.Vq,{children:[(0,n.jsx)(m.hg,{asChild:!0,children:(null==p?void 0:p.length)&&(0,n.jsx)(o.Z,{className:(0,h.cn)("cursor-pointer",t),showLineNumbers:!0,wrapLines:!0,lineProps:{style:{wordBreak:"break-all",whiteSpace:"pre-wrap"}},language:d||"plaintext",style:u.Z,children:"".concat(null==p?void 0:p.slice(0,c||200)," ").concat((null==s?void 0:s.length)>(c||200)?"...":"")})}),(0,n.jsx)(m.cZ,{className:"sm:max-w-[800px] overflow-hidden max-h-[500px] overflow-y-scroll",children:(0,n.jsxs)(m.fK,{children:[(0,n.jsx)(m.$N,{children:"Code"}),(0,n.jsx)("div",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(null!=p?p:""),f({title:"Copied to clipboard"})},children:(0,n.jsx)(o.Z,{className:(0,h.cn)(t),showLineNumbers:!0,wrapLines:!0,lineProps:{style:{wordBreak:"break-all",whiteSpace:"pre-wrap"}},language:d||"plaintext",style:u.Z,children:null!=p?p:""})})]})})]})}o.Z.registerLanguage("json",c.Z),o.Z.registerLanguage("javascript",d.Z)},68656:function(e,t,s){"use strict";s.d(t,{J:function(){return p}});var n=s(57437);s(2265);var a=s(26110),l=s(77992),r=s(35629),i=s(62869),o=s(81103),d=s(94508);let c=e=>{let{className:t,...s}=e;return(0,n.jsx)("div",{className:(0,d.cn)("flex flex-col overflow-hidden rounded-lg border bg-background shadow-sm",t),...s})},u=e=>{let{className:t,...s}=e;return(0,n.jsx)("div",{className:(0,d.cn)("flex items-center justify-between border-b bg-muted/50 px-4 py-3",t),...s})},m=e=>{let{className:t,...s}=e;return(0,n.jsx)("div",{className:(0,d.cn)("flex items-center gap-1",t),...s})},x=e=>{let{tooltip:t,label:s,icon:a,children:l,className:r,size:c="sm",variant:u="ghost",...m}=e,x=(0,n.jsxs)(i.z,{className:(0,d.cn)("size-8 p-0 text-muted-foreground hover:text-foreground",r),size:c,type:"button",variant:u,...m,children:[a?(0,n.jsx)(a,{className:"size-4"}):l,(0,n.jsx)("span",{className:"sr-only",children:s||t})]});return t?(0,n.jsx)(o.pn,{children:(0,n.jsxs)(o.u,{children:[(0,n.jsx)(o.aJ,{asChild:!0,children:x}),(0,n.jsx)(o._v,{children:(0,n.jsx)("p",{children:t})})]})}):x},h=e=>{let{className:t,...s}=e;return(0,n.jsx)("div",{className:(0,d.cn)("flex-1 overflow-auto p-4",t),...s})};var f=s(78867);function p(e){let{text:t,sliceLength:s}=e,{toast:i}=(0,l.pm)();return(0,n.jsxs)(a.Vq,{children:[(0,n.jsx)(a.hg,{asChild:!0,children:(0,n.jsxs)("p",{className:"cursor-pointer text-sm text-base",children:[null==t?void 0:t.slice(0,null!=s?s:200),s&&t.length>s?"...":""]})}),(0,n.jsx)(a.cZ,{className:"sm:max-w-[800px] max-h-[500px] overflow-y-scroll",children:(0,n.jsxs)(c,{children:[(0,n.jsx)(u,{children:(0,n.jsx)(m,{children:(0,n.jsx)(x,{icon:f.Z,label:"Copy",tooltip:"Copy to clipboard",onClick:async()=>{await navigator.clipboard.writeText(t),i({title:"Copied to clipboard"})}})})}),(0,n.jsx)(h,{children:(0,n.jsx)(r.H,{children:t})})]})})]})}},21409:function(e,t,s){"use strict";s.d(t,{z:function(){return v}});var n=s(57437),a=s(2265),l=s(20653),r=s(31303),i=s(59121),o=s(27107),d=s(94508),c=s(62869),u=s(92451),m=s(10407),x=s(98235);function h(e){let{className:t,classNames:s,showOutsideDays:a=!0,...l}=e;return(0,n.jsx)(x._W,{showOutsideDays:a,className:(0,d.cn)("p-3",t),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:(0,d.cn)((0,c.d)({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:(0,d.cn)((0,c.d)({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...s},components:{IconLeft:e=>{let{...t}=e;return(0,n.jsx)(u.Z,{className:"size-4"})},IconRight:e=>{let{...t}=e;return(0,n.jsx)(m.Z,{className:"size-4"})}},...l})}h.displayName="Calendar";var f=s(77992),p=s(57054);function v(e){let{dateRange:t,onDateRangeChange:s,className:u,maxDays:m=30}=e,{toast:x}=(0,f.pm)(),v=a.useMemo(()=>{if(!(null==t?void 0:t.from))return[];let e=t.from;return[{before:(0,i.E)(e,-m)},{after:(0,i.E)(e,m)}]},[null==t?void 0:t.from,m]);return(0,n.jsx)("div",{className:(0,d.cn)("grid gap-2",u),children:(0,n.jsxs)(p.J2,{children:[(0,n.jsx)(p.xo,{asChild:!0,children:(0,n.jsxs)(c.z,{id:"date",variant:"outline",className:(0,d.cn)("w-[260px] justify-start text-left font-normal",!t&&"text-muted-foreground"),children:[(0,n.jsx)(l.Que,{className:"mr-2 h-4 w-4"}),(null==t?void 0:t.from)?t.to?(0,n.jsxs)(n.Fragment,{children:[(0,o.WU)(t.from,"LLL dd, y")," -"," ",(0,o.WU)(t.to,"LLL dd, y")]}):(0,o.WU)(t.from,"LLL dd, y"):(0,n.jsx)("span",{children:"Pick a date range"})]})}),(0,n.jsxs)(p.yk,{className:"w-auto p-0",align:"end",children:[(0,n.jsx)(h,{initialFocus:!0,mode:"range",defaultMonth:null==t?void 0:t.from,selected:t,onSelect:e=>{if((null==e?void 0:e.from)&&(null==e?void 0:e.to)&&(0,r.j)(e.to,e.from)>m){x({title:"Date range too large",description:"Please select a date range of ".concat(m," days or less."),variant:"destructive"});return}s(e)},disabled:v,numberOfMonths:2}),(0,n.jsxs)("div",{className:"p-3 pt-0 text-xs text-muted-foreground border-t",children:["Maximum range: ",m," days"]})]})]})})}},73450:function(e,t,s){"use strict";s.d(t,{Y:function(){return h}});var n=s(57437),a=s(2265),l=s(7211),r=s(53647),i=s(93022),o=s(27689),d=s(75169),c=s(3574),u=s(20407),m=s(57969);let x=["hsl(var(--chart-1))","hsl(var(--chart-2))","hsl(var(--chart-3))","hsl(var(--chart-4))","hsl(var(--chart-5))","hsl(var(--chart-6))","hsl(var(--chart-7))","hsl(var(--chart-8))","hsl(var(--chart-9))","hsl(var(--chart-10))"];function h(e){var t,s;let{groupByOptions:h,dateRange:f,selectedType:p,groupBy:v,onGroupByChange:j}=e,{data:g,loading:y,error:b}=(0,l.aM)(o.YH,{variables:{type:p,groupBy:v,from:null==f?void 0:null===(t=f.from)||void 0===t?void 0:t.toISOString(),to:null==f?void 0:null===(s=f.to)||void 0===s?void 0:s.toISOString()},skip:!(null==f?void 0:f.from)||!(null==f?void 0:f.to)}),{chartData:N,chartConfig:w}=a.useMemo(()=>{if(!(null==g?void 0:g.trackingStatistics))return{chartData:[],chartConfig:{}};let e=g.trackingStatistics.map((e,t)=>{var s;return{name:(s=e.group)?s.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "):"Unknown",value:e.count,fill:x[t%x.length]}}).sort((e,t)=>t.value-e.value),t=e.reduce((e,t,s)=>(e[t.name]={label:t.name,color:x[s%x.length]},e),{});return{chartData:e,chartConfig:t}},[g]);return(0,n.jsxs)("div",{className:"flex flex-col h-full",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,n.jsx)("h3",{className:"text-xl font-semibold",children:"Distribution"}),h.length>0&&(0,n.jsx)("div",{className:"w-full max-w-[150px]",children:(0,n.jsxs)(r.Ph,{value:v,onValueChange:j,children:[(0,n.jsx)(r.i4,{children:(0,n.jsx)(r.ki,{placeholder:"Group by"})}),(0,n.jsx)(r.Bw,{children:h.map(e=>(0,n.jsx)(r.Ql,{value:e.value,children:e.label},e.value))})]})})]}),(0,n.jsx)("div",{className:"flex-1 min-h-0",children:y?(0,n.jsx)("div",{className:"space-y-4 h-full",children:(0,n.jsx)(i.O,{className:"h-full w-full"})}):b?(0,n.jsxs)("div",{className:"flex items-center justify-center h-full text-red-500",children:["Error loading distribution data: ",b.message]}):0===N.length?(0,n.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-center",children:"No data available for the selected date range, type, and grouping."}):(0,n.jsx)(m.BO,{config:w,className:"h-full w-full",children:(0,n.jsxs)(d.u,{children:[(0,n.jsx)("defs",{children:N.map((e,t)=>(0,n.jsxs)("radialGradient",{id:"gradient-".concat(e.name.replace(/\s+/g,"-")),cx:"50%",cy:"50%",r:"50%",children:[(0,n.jsx)("stop",{offset:"0%",stopColor:e.fill,stopOpacity:1}),(0,n.jsx)("stop",{offset:"100%",stopColor:e.fill,stopOpacity:.8})]},"gradient-".concat(t)))}),(0,n.jsx)(c.b,{data:N,cx:"50%",cy:"50%",labelLine:!1,label:e=>{let{cx:t,cy:s,midAngle:a,innerRadius:l,outerRadius:r,percent:i,index:o}=e;if(i<.05)return null;let d=Math.PI/180,c=l+(r-l)*.5,u=t+c*Math.cos(-a*d);return(0,n.jsx)("text",{x:u,y:s+c*Math.sin(-a*d),fill:"black",textAnchor:u>t?"start":"end",dominantBaseline:"central",fontSize:"12",fontWeight:"600",paintOrder:"stroke",children:"".concat((100*i).toFixed(0),"%")})},outerRadius:"75%",innerRadius:"45%",dataKey:"value",strokeWidth:3,children:N.map((e,t)=>(0,n.jsx)(u.b,{fill:"url(#gradient-".concat(e.name.replace(/\s+/g,"-"),")")},"cell-".concat(t)))}),(0,n.jsx)(m.h7,{content:(0,n.jsx)(m.dg,{nameKey:"name",hideLabel:!0,formatter:(e,t)=>["number"==typeof e?e.toLocaleString():e," "+String(t)]})})]})})})]})}},52896:function(e,t,s){"use strict";s.d(t,{q:function(){return y}});var n=s(57437),a=s(2265),l=s(7211),r=s(53647),i=s(93022),o=s(27689),d=s(5481),c=s(56940),u=s(97059),m=s(62994),x=s(23263),h=s(57969),f=s(27107),p=s(56942),v=s(54886);function j(e){return e.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}let g={count:{label:"Count",color:"hsl(var(--muted-foreground))"}};function y(e){var t,s;let{dataTypes:y,dateRange:b,selectedType:N,onTypeChange:w,onUnitChange:k,unit:C}=e,{data:E,loading:_,error:z}=(0,l.aM)(o.j9,{variables:{type:N,name:C,from:null==b?void 0:null===(t=b.from)||void 0===t?void 0:t.toISOString(),to:null==b?void 0:null===(s=b.to)||void 0===s?void 0:s.toISOString()},skip:!(null==b?void 0:b.from)||!(null==b?void 0:b.to)}),T=a.useMemo(()=>{if(!(null==E?void 0:E.trackingStatistics)||!(null==b?void 0:b.from)||!(null==b?void 0:b.to))return[];let e=new Map;return E.trackingStatistics.forEach(t=>{let s=new Date("number"==typeof t.group?t.group:Number(t.group)),n=(0,f.WU)((0,p.b)(s),"yyyy-MM-dd");e.set(n,t.count)}),(0,v.D)({start:(0,p.b)(b.from),end:(0,p.b)(b.to)}).map(t=>{let s=(0,f.WU)(t,"yyyy-MM-dd"),n=e.get(s)||0;return{date:t.getTime(),count:n,formattedDate:(0,f.WU)(t,"MMM dd"),dateObj:t}})},[E,b]);return(0,n.jsxs)("div",{className:"flex flex-col h-full",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,n.jsx)("h3",{className:"text-xl font-semibold",children:"Time Series Analytics"}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("div",{className:"w-[150px]",children:(0,n.jsxs)(r.Ph,{value:N,onValueChange:e=>w(e),children:[(0,n.jsx)(r.i4,{children:(0,n.jsx)(r.ki,{placeholder:"Select data type"})}),(0,n.jsx)(r.Bw,{children:null==y?void 0:y.map(e=>(0,n.jsx)(r.Ql,{value:e,children:j(e)+" "},e))})]})}),(0,n.jsx)("div",{className:"w-[150px]",children:(0,n.jsxs)(r.Ph,{value:C,onValueChange:e=>k(e),children:[(0,n.jsx)(r.i4,{children:(0,n.jsx)(r.ki,{placeholder:"Select unit"})}),(0,n.jsxs)(r.Bw,{children:[(0,n.jsx)(r.Ql,{value:"count",children:"Count"}),(0,n.jsx)(r.Ql,{value:"tokens",children:"Tokens"})]})]})})]})]}),(0,n.jsx)("div",{className:"flex-1 min-h-0",children:_?(0,n.jsx)("div",{className:"space-y-4 h-full",children:(0,n.jsx)(i.O,{className:"h-full w-full"})}):z?(0,n.jsxs)("div",{className:"flex items-center justify-center h-full text-red-500",children:["Error loading time series data: ",z.message]}):0===T.length?(0,n.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"No data available for the selected date range and type"}):(0,n.jsx)(h.BO,{config:g,className:"h-full w-full",children:(0,n.jsxs)(d.T,{data:T,children:[(0,n.jsxs)("defs",{children:[(0,n.jsxs)("linearGradient",{id:"fillCount",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,n.jsx)("stop",{offset:"5%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.3}),(0,n.jsx)("stop",{offset:"95%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.05})]}),(0,n.jsxs)("linearGradient",{id:"strokeCount",x1:"0",y1:"0",x2:"1",y2:"0",children:[(0,n.jsx)("stop",{offset:"0%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.8}),(0,n.jsx)("stop",{offset:"100%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.6})]})]}),(0,n.jsx)(c.q,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground))",strokeOpacity:.3,vertical:!1}),(0,n.jsx)(u.K,{dataKey:"formattedDate",tick:{fontSize:12,fill:"hsl(var(--muted-foreground))"},tickLine:{stroke:"hsl(var(--muted-foreground))",strokeOpacity:.5},axisLine:{stroke:"hsl(var(--muted-foreground))",strokeOpacity:.5}}),(0,n.jsx)(m.B,{tick:{fontSize:12,fill:"hsl(var(--muted-foreground))"},tickLine:{stroke:"hsl(var(--muted-foreground))",strokeOpacity:.5},axisLine:{stroke:"hsl(var(--muted-foreground))",strokeOpacity:.5}}),(0,n.jsx)(h.h7,{labelFormatter:(e,t)=>t&&t[0]?(0,f.WU)(t[0].payload.dateObj,"PPP")+" ":e,content:(0,n.jsx)(h.dg,{nameKey:"name",hideLabel:!0,formatter:(e,t)=>["number"==typeof e?e.toLocaleString():e," "+String(t)]})}),(0,n.jsx)(h.Qk,{content:(0,n.jsx)(h.cD,{})}),(0,n.jsx)(x.u,{type:"monotone",dataKey:"count",stroke:"url(#strokeCount)",strokeWidth:3,fill:"url(#fillCount)",fillOpacity:.6,dot:{fill:"hsl(var(--muted-foreground))",strokeWidth:2,r:4,strokeOpacity:.8},activeDot:{r:6,strokeWidth:2,fill:"hsl(var(--background))",stroke:"hsl(var(--muted-foreground))",strokeOpacity:1},name:j(N)})]})})})]})}},37091:function(e,t,s){"use strict";s.d(t,{L:function(){return a}});var n=s(57437);function a(e){let{text:t,length:s}=e;return t.length>s?(0,n.jsxs)(n.Fragment,{children:[t.slice(0,s),"..."]}):(0,n.jsx)(n.Fragment,{children:t})}},37099:function(e,t,s){"use strict";s.d(t,{OL:function(){return p},_T:function(){return u},aR:function(){return o},f$:function(){return h},fY:function(){return m},le:function(){return v},xo:function(){return x},yT:function(){return f}});var n=s(57437),a=s(23619),l=s(2265),r=s(62869),i=s(94508);let o=a.fC;a.xz;let d=a.h_,c=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,n.jsx)(a.aV,{className:(0,i.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...l,ref:t})});c.displayName=a.aV.displayName;let u=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,n.jsxs)(d,{children:[(0,n.jsx)(c,{}),(0,n.jsx)(a.VY,{ref:t,className:(0,i.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",s),...l})]})});u.displayName=a.VY.displayName;let m=e=>{let{className:t,...s}=e;return(0,n.jsx)("div",{className:(0,i.cn)("flex flex-col space-y-2 text-center sm:text-left",t),...s})};m.displayName="AlertDialogHeader";let x=e=>{let{className:t,...s}=e;return(0,n.jsx)("div",{className:(0,i.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s})};x.displayName="AlertDialogFooter";let h=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,n.jsx)(a.Dx,{ref:t,className:(0,i.cn)("text-lg font-semibold",s),...l})});h.displayName=a.Dx.displayName;let f=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,n.jsx)(a.dk,{ref:t,className:(0,i.cn)("text-sm text-muted-foreground",s),...l})});f.displayName=a.dk.displayName;let p=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,n.jsx)(a.aU,{ref:t,className:(0,i.cn)((0,r.d)(),s),...l})});p.displayName=a.aU.displayName;let v=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,n.jsx)(a.$j,{ref:t,className:(0,i.cn)((0,r.d)({variant:"outline"}),"mt-2 sm:mt-0",s),...l})});v.displayName=a.$j.displayName},65613:function(e,t,s){"use strict";s.d(t,{Cd:function(){return d},X:function(){return c},bZ:function(){return o}});var n=s(57437),a=s(90535),l=s(2265),r=s(94508);let i=(0,a.j)("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",info:"border-info/50 text-info dark:border-info [&>svg]:text-info"}},defaultVariants:{variant:"default"}}),o=l.forwardRef((e,t)=>{let{className:s,variant:a,...l}=e;return(0,n.jsx)("div",{ref:t,role:"alert",className:(0,r.cn)(i({variant:a}),s),...l})});o.displayName="Alert";let d=l.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)("h5",{ref:t,className:(0,r.cn)("mb-1 font-medium leading-none tracking-tight",s),...a})});d.displayName="AlertTitle";let c=l.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)("div",{ref:t,className:(0,r.cn)("text-sm [&_p]:leading-relaxed",s),...a})});c.displayName="AlertDescription"},57969:function(e,t,s){"use strict";s.d(t,{BO:function(){return m},Qk:function(){return p},cD:function(){return v},dg:function(){return f},h7:function(){return h}});var n=s(57437),a=s(2265),l=s(47625),r=s(8147),i=s(22190),o=s(94508);let d={light:"",dark:".dark"},c=a.createContext(null);function u(){let e=a.useContext(c);if(!e)throw Error("useChart must be used within a <ChartContainer />");return e}let m=a.forwardRef((e,t)=>{let{id:s,className:r,children:i,config:d,...u}=e,m=a.useId(),h="chart-".concat(s||m.replace(/:/g,""));return(0,n.jsx)(c.Provider,{value:{config:d},children:(0,n.jsxs)("div",{"data-chart":h,ref:t,className:(0,o.cn)("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",r),...u,children:[(0,n.jsx)(x,{id:h,config:d}),(0,n.jsx)(l.h,{children:i})]})})});m.displayName="Chart";let x=e=>{let{id:t,config:s}=e,a=Object.entries(s).filter(e=>{let[,t]=e;return t.theme||t.color});return a.length?(0,n.jsx)("style",{dangerouslySetInnerHTML:{__html:Object.entries(d).map(e=>{let[s,n]=e;return"\n".concat(n," [data-chart=").concat(t,"] {\n").concat(a.map(e=>{var t;let[n,a]=e,l=(null===(t=a.theme)||void 0===t?void 0:t[s])||a.color;return l?" --color-".concat(n,": ").concat(l,";"):null}).join("\n"),"\n}\n")}).join("\n")}}):null},h=r.u,f=a.forwardRef((e,t)=>{let{active:s,payload:l,className:r,indicator:i="dot",hideLabel:d=!1,hideIndicator:c=!1,label:m,labelFormatter:x,labelClassName:h,formatter:f,color:p,nameKey:v,labelKey:g}=e,{config:y}=u(),b=a.useMemo(()=>{var e;if(d||!(null==l?void 0:l.length))return null;let[t]=l,s="".concat(g||(null==t?void 0:t.dataKey)||(null==t?void 0:t.name)||"value"),a=j(y,t,s),r=g||"string"!=typeof m?null==a?void 0:a.label:(null===(e=y[m])||void 0===e?void 0:e.label)||m;return x?(0,n.jsx)("div",{className:(0,o.cn)("font-medium",h),children:x(r,l)}):r?(0,n.jsx)("div",{className:(0,o.cn)("font-medium",h),children:r}):null},[m,x,l,d,h,y,g]);if(!s||!(null==l?void 0:l.length))return null;let N=1===l.length&&"dot"!==i;return(0,n.jsxs)("div",{ref:t,className:(0,o.cn)("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",r),children:[N?null:b,(0,n.jsx)("div",{className:"grid gap-1.5",children:l.map((e,t)=>{let s="".concat(v||e.name||e.dataKey||"value"),a=j(y,e,s),l=p||e.payload.fill||e.color;return(0,n.jsx)("div",{className:(0,o.cn)("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground","dot"===i&&"items-center"),children:f&&(null==e?void 0:e.value)!==void 0&&e.name?f(e.value,e.name,e,t,e.payload):(0,n.jsxs)(n.Fragment,{children:[(null==a?void 0:a.icon)?(0,n.jsx)(a.icon,{}):!c&&(0,n.jsx)("div",{className:(0,o.cn)("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":"dot"===i,"w-1":"line"===i,"w-0 border-[1.5px] border-dashed bg-transparent":"dashed"===i,"my-0.5":N&&"dashed"===i}),style:{"--color-bg":l,"--color-border":l}}),(0,n.jsxs)("div",{className:(0,o.cn)("flex flex-1 justify-between leading-none",N?"items-end":"items-center"),children:[(0,n.jsxs)("div",{className:"grid gap-1.5",children:[N?b:null,(0,n.jsx)("span",{className:"text-muted-foreground",children:(null==a?void 0:a.label)||e.name})]}),e.value&&(0,n.jsx)("span",{className:"font-mono font-medium tabular-nums text-foreground",children:e.value.toLocaleString()})]})]})},e.dataKey)})})]})});f.displayName="ChartTooltip";let p=i.D,v=a.forwardRef((e,t)=>{let{className:s,hideIcon:a=!1,payload:l,verticalAlign:r="bottom",nameKey:i}=e,{config:d}=u();return(null==l?void 0:l.length)?(0,n.jsx)("div",{ref:t,className:(0,o.cn)("flex items-center justify-center gap-4","top"===r?"pb-3":"pt-3",s),children:l.map(e=>{let t="".concat(i||e.dataKey||"value"),s=j(d,e,t);return(0,n.jsxs)("div",{className:(0,o.cn)("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[(null==s?void 0:s.icon)&&!a?(0,n.jsx)(s.icon,{}):(0,n.jsx)("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:e.color}}),null==s?void 0:s.label]},e.value)})}):null});function j(e,t,s){if("object"!=typeof t||null===t)return;let n="payload"in t&&"object"==typeof t.payload&&null!==t.payload?t.payload:void 0,a=s;return s in t&&"string"==typeof t[s]?a=t[s]:n&&s in n&&"string"==typeof n[s]&&(a=n[s]),a in e?e[a]:e[s]}v.displayName="ChartLegend"},74928:function(e,t,s){"use strict";s.d(t,{Fw:function(){return r},wy:function(){return l},zF:function(){return a}});var n=s(88985);let a=n.fC,l=n.wy,r=n.Fw},84190:function(e,t,s){"use strict";s.d(t,{$F:function(){return u},AW:function(){return m},Ju:function(){return f},VD:function(){return p},Xi:function(){return x},bO:function(){return h},h_:function(){return c}});var n=s(57437),a=s(70085),l=s(10407),r=s(30401),i=s(40519),o=s(2265),d=s(94508);let c=a.fC,u=a.xz;a.ZA,a.Uv,a.Tr,a.Ee,o.forwardRef((e,t)=>{let{className:s,inset:r,children:i,...o}=e;return(0,n.jsxs)(a.fF,{ref:t,className:(0,d.cn)("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",r&&"pl-8",s),...o,children:[i,(0,n.jsx)(l.Z,{className:"ml-auto size-4"})]})}).displayName=a.fF.displayName,o.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,n.jsx)(a.tu,{ref:t,className:(0,d.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...l})}).displayName=a.tu.displayName;let m=o.forwardRef((e,t)=>{let{className:s,sideOffset:l=4,...r}=e;return(0,n.jsx)(a.Uv,{children:(0,n.jsx)(a.VY,{ref:t,sideOffset:l,className:(0,d.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...r})})});m.displayName=a.VY.displayName;let x=o.forwardRef((e,t)=>{let{className:s,inset:l,...r}=e;return(0,n.jsx)(a.ck,{ref:t,className:(0,d.cn)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",l&&"pl-8",s),...r})});x.displayName=a.ck.displayName;let h=o.forwardRef((e,t)=>{let{className:s,children:l,checked:i,...o}=e;return(0,n.jsxs)(a.oC,{ref:t,className:(0,d.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),checked:i,...o,children:[(0,n.jsx)("span",{className:"absolute left-2 flex size-3.5 items-center justify-center",children:(0,n.jsx)(a.wU,{children:(0,n.jsx)(r.Z,{className:"size-4"})})}),l]})});h.displayName=a.oC.displayName,o.forwardRef((e,t)=>{let{className:s,children:l,...r}=e;return(0,n.jsxs)(a.Rk,{ref:t,className:(0,d.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...r,children:[(0,n.jsx)("span",{className:"absolute left-2 flex size-3.5 items-center justify-center",children:(0,n.jsx)(a.wU,{children:(0,n.jsx)(i.Z,{className:"size-2 fill-current"})})}),l]})}).displayName=a.Rk.displayName;let f=o.forwardRef((e,t)=>{let{className:s,inset:l,...r}=e;return(0,n.jsx)(a.__,{ref:t,className:(0,d.cn)("px-2 py-1.5 text-sm font-semibold",l&&"pl-8",s),...r})});f.displayName=a.__.displayName;let p=o.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,n.jsx)(a.Z0,{ref:t,className:(0,d.cn)("-mx-1 my-1 h-px bg-muted",s),...l})});p.displayName=a.Z0.displayName},15681:function(e,t,s){"use strict";s.d(t,{NI:function(){return p},Wi:function(){return u},l0:function(){return d},lX:function(){return f},pf:function(){return v},xJ:function(){return h},zG:function(){return j}});var n=s(57437),a=s(37053),l=s(2265),r=s(29501),i=s(26815),o=s(94508);let d=r.RV,c=l.createContext({}),u=e=>{let{...t}=e;return(0,n.jsx)(c.Provider,{value:{name:t.name},children:(0,n.jsx)(r.Qr,{...t})})},m=()=>{let e=l.useContext(c),t=l.useContext(x),{getFieldState:s,formState:n}=(0,r.Gc)(),a=s(e.name,n);if(!e)throw Error("useFormField should be used within <FormField>");let{id:i}=t;return{id:i,name:e.name,formItemId:"".concat(i,"-form-item"),formDescriptionId:"".concat(i,"-form-item-description"),formMessageId:"".concat(i,"-form-item-message"),...a}},x=l.createContext({}),h=l.forwardRef((e,t)=>{let{className:s,...a}=e,r=l.useId();return(0,n.jsx)(x.Provider,{value:{id:r},children:(0,n.jsx)("div",{ref:t,className:(0,o.cn)("space-y-2",s),...a})})});h.displayName="FormItem";let f=l.forwardRef((e,t)=>{let{className:s,...a}=e,{error:l,formItemId:r}=m();return(0,n.jsx)(i._,{ref:t,className:(0,o.cn)(l&&"text-destructive",s),htmlFor:r,...a})});f.displayName="FormLabel";let p=l.forwardRef((e,t)=>{let{...s}=e,{error:l,formItemId:r,formDescriptionId:i,formMessageId:o}=m();return(0,n.jsx)(a.g7,{ref:t,id:r,"aria-describedby":l?"".concat(i," ").concat(o):"".concat(i),"aria-invalid":!!l,...s})});p.displayName="FormControl";let v=l.forwardRef((e,t)=>{let{className:s,...a}=e,{formDescriptionId:l}=m();return(0,n.jsx)("p",{ref:t,id:l,className:(0,o.cn)("text-sm text-muted-foreground",s),...a})});v.displayName="FormDescription";let j=l.forwardRef((e,t)=>{let{className:s,children:a,...l}=e,{error:r,formMessageId:i}=m(),d=r?String(null==r?void 0:r.message):a;return d?(0,n.jsx)("p",{ref:t,id:i,className:(0,o.cn)("text-sm font-medium text-destructive",s),...l,children:d}):null});j.displayName="FormMessage"},95186:function(e,t,s){"use strict";s.d(t,{I:function(){return r}});var n=s(57437),a=s(2265),l=s(94508);let r=a.forwardRef((e,t)=>{let{className:s,type:a,...r}=e;return(0,n.jsx)("input",{type:a,className:(0,l.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",s),ref:t,...r})});r.displayName="Input"},6512:function(e,t,s){"use strict";s.d(t,{Z:function(){return i}});var n=s(57437),a=s(55156),l=s(2265),r=s(94508);let i=l.forwardRef((e,t)=>{let{className:s,orientation:l="horizontal",decorative:i=!0,...o}=e;return(0,n.jsx)(a.f,{ref:t,decorative:i,orientation:l,className:(0,r.cn)("shrink-0 bg-border","horizontal"===l?"h-[1px] w-full":"h-full w-[1px]",s),...o})});i.displayName=a.f.displayName},93022:function(e,t,s){"use strict";s.d(t,{O:function(){return l}});var n=s(57437),a=s(94508);function l(e){let{className:t,...s}=e;return(0,n.jsx)("div",{className:(0,a.cn)("animate-pulse rounded-md bg-muted",t),...s})}},1828:function(e,t,s){"use strict";s.d(t,{r:function(){return i}});var n=s(57437),a=s(50721),l=s(2265),r=s(94508);let i=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,n.jsx)(a.fC,{className:(0,r.cn)("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",s),...l,ref:t,children:(0,n.jsx)(a.bU,{className:(0,r.cn)("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})})});i.displayName=a.fC.displayName},73578:function(e,t,s){"use strict";s.d(t,{RM:function(){return o},Rn:function(){return m},SC:function(){return d},iA:function(){return r},pj:function(){return u},ss:function(){return c},xD:function(){return i}});var n=s(57437),a=s(2265),l=s(94508);let r=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)("div",{className:"relative w-full overflow-auto",children:(0,n.jsx)("table",{ref:t,className:(0,l.cn)("w-full caption-bottom text-sm",s),...a})})});r.displayName="Table";let i=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)("thead",{ref:t,className:(0,l.cn)("[&_tr]:border-b",s),...a})});i.displayName="TableHeader";let o=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)("tbody",{ref:t,className:(0,l.cn)("[&_tr:last-child]:border-0",s),...a})});o.displayName="TableBody",a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)("tfoot",{ref:t,className:(0,l.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...a})}).displayName="TableFooter";let d=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)("tr",{ref:t,className:(0,l.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...a})});d.displayName="TableRow";let c=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)("th",{ref:t,className:(0,l.cn)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&:has([role=checkbox])]:w-[40px]",s),...a})});c.displayName="TableHead";let u=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)("td",{ref:t,className:(0,l.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0 [&:has([role=checkbox])]:w-[40px]",s),...a})});u.displayName="TableCell";let m=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)("caption",{ref:t,className:(0,l.cn)("mt-4 text-sm text-muted-foreground",s),...a})});m.displayName="TableCaption"},81103:function(e,t,s){"use strict";s.d(t,{_v:function(){return c},aJ:function(){return d},pn:function(){return i},u:function(){return o}});var n=s(57437),a=s(4957),l=s(2265),r=s(94508);let i=a.zt,o=a.fC,d=a.xz,c=l.forwardRef((e,t)=>{let{className:s,sideOffset:l=4,...i}=e;return(0,n.jsx)(a.VY,{ref:t,sideOffset:l,className:(0,r.cn)("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...i})});c.displayName=a.VY.displayName},78361:function(e,t,s){"use strict";s.d(t,{jF:function(){return D},jU:function(){return M},ZP:function(){return Z},NF:function(){return A}});var n=s(57437),a=s(2265),l=s(47632),r=s(1109);s(46693),s(51832);var i=s(6374),o=s(44045);let d=async e=>{var t;if(!e.backend)throw Error("No backend set.");let{callbacks:s,maxNumberOfFiles:n,uppyOptions:a}=e||{},{uploadSuccess:o}=s||{},{allowedFileTypes:d,id:c}=a||{},u=await (0,i.LP)(),m=new l.Z({autoProceed:!0,debug:!1,id:c||"uppy",restrictions:{maxNumberOfFiles:n||5,allowedFileTypes:d||[".heic",".jpg",".jpeg",".png",".webp",".svg"]}}).use(r.Z,{id:"Exulu",endpoint:e.backend,headers:{Authorization:"Bearer ".concat(u),Session:null!==(t=localStorage.getItem("session"))&&void 0!==t?t:""}}).on("file-added",async e=>{console.debug("added",e)}).on("upload-error",(e,t)=>{(null==e?void 0:e.id)&&(m.removeFile(null==e?void 0:e.id),console.error("error",t))}).on("upload-success",(e,t)=>{t.uploadURL&&o&&(console.log("response",t),o({file:e,key:t.uploadURL.split("/").pop()||"",url:t.uploadURL}))});return m};var c=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],s=(0,a.useContext)(o.E),[n,l]=(0,a.useState)(void 0);return(0,a.useEffect)(()=>((async()=>{l(await d({...e,backend:(null==s?void 0:s.backend)||""}))})(),()=>{n&&(n.destroy(),l(void 0))}),[...t]),n},u=s(80007),m=s(92735),x=s(88964),h=s(30044),f=s(92451),p=s(10407),v=s(48736),j=s(53113),g=s(69658),y=s(99397),b=s(32489),N=s(15001),w=s(62869),k=s(26110),C=s(19378),E=s(78298),_=s(11713),z=s(21770),T=s(95186),S=s(20653),O=s(66070),R=s(93022);function D(e){let{s3key:t,children:s}=e,{data:l,isLoading:r,error:o,refetch:d}=(0,_.a)({queryKey:["fileObject",t],queryFn:async()=>t?await i.QZ.object(t):null,enabled:null!=t});return((0,a.useEffect)(()=>{t&&d()},[t]),t)?(0,n.jsxs)(O.Zb,{children:[(0,n.jsx)(O.Ol,{className:"pb-3",children:(0,n.jsx)(O.ll,{className:"text-sm truncate",children:t.split("_EXULU_").pop()})}),(0,n.jsxs)(O.aY,{className:"pt-0",children:[r&&(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(R.O,{className:"h-4 w-full"}),(0,n.jsx)(R.O,{className:"h-4 w-2/3"})]}),!r&&l&&(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[(0,n.jsx)("span",{className:"capitalize",children:null==l?void 0:l.ContentType.split("/").pop()}),(0,n.jsxs)("span",{children:[((null==l?void 0:l.ContentLength)/1024/1024).toFixed(2)," MB"]})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[(0,n.jsxs)("span",{children:["Last modified: ",new Date(null==l?void 0:l.LastModified).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"})]}),(0,n.jsxs)(w.z,{variant:"secondary",size:"sm",type:"button",className:"h-7 px-2",onClick:()=>{i.QZ.download(t).then(async e=>{console.log("res",e);let t=await e.json();console.log("res",t);let s=t.url;window.open(s,"_blank")})},children:[(0,n.jsx)("span",{className:"mr-1 text-xs",children:"View"}),(0,n.jsx)(m.Z,{className:"h-3 w-3"})]})]})]}),!r&&o&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:o.message}),s]})]}):(0,n.jsx)(O.Zb,{children:(0,n.jsxs)(O.aY,{className:"p-3 flex",children:[(0,n.jsx)("p",{className:"text-sm text-muted-foreground m-auto",children:"No file selected"}),s]})})}function Z(e){let{id:t,allowedFileTypes:s,dependencies:l,onConfirm:r,selectionLimit:i,buttonText:o}=e,[d,c]=(0,a.useState)(!1);return(0,n.jsxs)(k.Vq,{open:d,onOpenChange:c,children:[(0,n.jsx)(k.hg,{asChild:!0,children:(0,n.jsxs)(w.z,{variant:"outline",children:[o&&(0,n.jsx)("span",{className:"mr-2",children:o}),(0,n.jsx)(x.Z,{className:"h-4 w-4"})]})}),(0,n.jsxs)(k.cZ,{className:"sm:max-w-[900px]",children:[(0,n.jsxs)(k.fK,{children:[(0,n.jsx)(k.$N,{children:"File Gallery"}),(0,n.jsx)(k.Be,{children:"Browse your previously uploaded files or upload new ones."})]}),(0,n.jsx)(L,{id:t,allowedFileTypes:s,dependencies:l,selectionLimit:i,onConfirm:e=>{r(e),c(!1)}})]})]})}let L=e=>{var t,s;let{id:l,allowedFileTypes:r,dependencies:d,onConfirm:m,selectionLimit:x}=e;r||(r=[".png",".jpg",".jpeg",".gif",".webp",".pdf",".docx",".xlsx",".xls",".csv",".pptx",".ppt",".mp3",".wav",".m4a",".mp4",".mpeg",".mp4",".m4a",".mp3",".mpeg",".wav"]);let[v,j]=(0,a.useState)(void 0),[g,y]=(0,a.useState)(void 0),[b,N]=(0,a.useState)(void 0),k=(0,a.useContext)(o.E),[O,D]=(0,a.useState)([]),Z=e=>{if(O.includes(e)){D(O.filter(t=>t!==e));return}if(1===x){D([e]);return}O.length>=x||D([...O,e])},L=(0,z.D)({mutationFn:async e=>{let{key:t}=e;await i.QZ.delete(t),P()}}),{data:F,isLoading:A,error:I,refetch:P}=(0,_.a)({queryKey:["filesQuery",v,b],staleTime:3e4,queryFn:async()=>i.QZ.list({search:v,continuationToken:b})});console.log("!! data !!",F);let{theme:U}=(0,E.F)(),V=c({backend:(null==k?void 0:k.backend)||"",uppyOptions:{id:l,allowedFileTypes:r},callbacks:{uploadSuccess:async e=>{console.log("data",e)}},maxNumberOfFiles:10},d);return((0,a.useEffect)(()=>{P()},[v,b]),V)?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:[(0,n.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,n.jsx)("h3",{className:"text-sm font-medium mb-3",children:"Previously Uploaded Files"}),(0,n.jsx)(T.I,{placeholder:"Search files...",value:v,onChange:e=>j(e.target.value),className:"mb-3"}),(0,n.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground pb-2",children:[(0,n.jsxs)("span",{children:[O.length," / ",x," files selected"]}),(0,n.jsxs)("span",{children:["Allowed file types: ",null==r?void 0:r.map(e=>e).join(", ")]})]}),(0,n.jsxs)(C.x,{children:[A&&(0,n.jsxs)("div",{className:"flex items-center justify-center h-full w-full grid grid-cols-2 sm:grid-cols-3 gap-3",children:[(0,n.jsx)(R.O,{className:"h-[120px] w-full"}),(0,n.jsx)(R.O,{className:"h-[120px] w-full"}),(0,n.jsx)(R.O,{className:"h-[120px] w-full"}),(0,n.jsx)(R.O,{className:"h-[120px] w-full"}),(0,n.jsx)(R.O,{className:"h-[120px] w-full"}),(0,n.jsx)(R.O,{className:"h-[120px] w-full"}),(0,n.jsx)(R.O,{className:"h-[120px] w-full"}),(0,n.jsx)(R.O,{className:"h-[120px] w-full"}),(0,n.jsx)(R.O,{className:"h-[120px] w-full"})]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:[!A&&!(null==F?void 0:null===(t=F.Contents)||void 0===t?void 0:t.length)&&(0,n.jsxs)("div",{className:"col-span-full flex flex-col items-center justify-center py-12 text-center",children:[(0,n.jsx)(h.Z,{className:"h-12 w-12 text-muted-foreground/50 mb-3"}),(0,n.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:"Nothing to see here... yet!"}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground/75 mt-1",children:"Upload some files to get started"})]}),null==F?void 0:null===(s=F.Contents)||void 0===s?void 0:s.map(e=>(0,n.jsx)(M,{s3Key:e.Key,onSelect:Z,active:O.some(t=>t===e.Key),onRemove:()=>{L.mutate({key:e.Key})},disabled:!!r&&!(null==r?void 0:r.some(t=>e.Key.endsWith(t)))}))]}),(0,n.jsx)("div",{className:"flex items-center space-x-6 lg:space-x-8 pt-3",children:(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsxs)(w.z,{variant:"outline",className:"hidden size-8 p-0 lg:flex",onClick:()=>{N(void 0)},disabled:!b||A,children:[(0,n.jsx)("span",{className:"sr-only",children:"Go to first page"}),(0,n.jsx)(S.kRt,{className:"size-4"})]}),(0,n.jsxs)(w.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{N(g)},disabled:!b||A,children:[(0,n.jsx)("span",{className:"sr-only",children:"Go to previous page"}),(0,n.jsx)(f.Z,{className:"size-4"})]}),(0,n.jsxs)(w.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{y(b),N(null==F?void 0:F.NextContinuationToken)},disabled:!(null==F?void 0:F.NextContinuationToken)||A,children:[(0,n.jsx)("span",{className:"sr-only",children:"Go to next page"}),(0,n.jsx)(p.Z,{className:"size-4"})]})]})})]})]}),(0,n.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,n.jsx)("h3",{className:"text-sm font-medium mb-3",children:"Upload New Files"}),(0,n.jsx)(u.A,{uppy:V,theme:"dark"===U?"dark":"light"})]})]}),(0,n.jsx)("div",{className:"flex justify-end",children:(0,n.jsx)(w.z,{variant:"outline",onClick:()=>{m(O),D([])},children:"Confirm"})})]}):null},M=e=>{let{s3Key:t,onSelect:s,onRemove:a,active:l,disabled:r,addToContext:o}=e;return(0,n.jsxs)("div",{className:"".concat(r?"opacity-50":""," group relative rounded-lg p-2 hover:bg-muted transition-colors cursor-pointer ").concat(l?"border border-purple-500":"border"),onClick:()=>{!r&&s&&s(t)},children:[(0,n.jsx)("div",{className:"aspect-square relative mb-2 bg-muted/50 rounded-md overflow-hidden flex items-center justify-center",children:t&&(t.toLowerCase().endsWith("jpg")||t.toLowerCase().endsWith("jpeg")||t.toLowerCase().endsWith("png")||t.toLowerCase().endsWith("svg"))?(0,n.jsx)(I,{fileKey:t}):(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center h-full",children:[t?t.toLowerCase().endsWith("jpg")||t.toLowerCase().endsWith("jpeg")||t.toLowerCase().endsWith("png")||t.toLowerCase().endsWith("svg")?(0,n.jsx)(j.Z,{className:"h-6 w-6 text-blue-500"}):t.endsWith("pdf")?(0,n.jsx)(g.Z,{className:"h-6 w-6 text-red-500"}):t.endsWith("xls")||t.endsWith("xlsx")||t.endsWith("csv")?(0,n.jsx)(v.Z,{className:"h-6 w-6 text-green-500"}):t.endsWith("ppt")||t.endsWith("pptx")?(0,n.jsx)(v.Z,{className:"h-6 w-6 text-orange-500"}):(0,n.jsx)(v.Z,{className:"h-6 w-6 text-gray-500"}):(0,n.jsx)(v.Z,{className:"h-6 w-6 text-gray-500"}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground mt-1 text-center",children:t?t.split("_EXULU_").pop():t})]})}),(0,n.jsx)("p",{className:"text-xs truncate",children:t?t.split("_EXULU_").pop():t}),(0,n.jsxs)("div",{className:"opacity-0 group-hover:opacity-100 flex absolute top-1 right-1",children:[o&&(0,n.jsxs)(w.z,{variant:"ghost",size:"icon",type:"button",className:"h-6 w-6 bg-background/80 hover:bg-background",onClick:()=>{o(t)},children:[(0,n.jsx)(y.Z,{className:"h-3 w-3"}),(0,n.jsx)("span",{className:"sr-only",children:"Add"})]}),(0,n.jsxs)(w.z,{variant:"ghost",size:"icon",type:"button",className:"h-6 w-6 bg-background/80 hover:bg-background",onClick:()=>{i.QZ.download(t).then(async e=>{console.log("res",e);let t=await e.json();console.log("res",t);let s=t.url;window.open(s,"_blank")})},children:[(0,n.jsx)(m.Z,{className:"h-3 w-3"}),(0,n.jsx)("span",{className:"sr-only",children:"View"})]}),a&&(0,n.jsxs)(w.z,{onClick:e=>{e.stopPropagation(),a(t)},variant:"ghost",type:"button",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 bg-background/80 hover:bg-background ml-1",children:[(0,n.jsx)(b.Z,{className:"h-3 w-3"}),(0,n.jsx)("span",{className:"sr-only",children:"Remove"})]})]})]},t)},F={},A=async e=>{if(F[e]){if(!(F[e].expiresAt<Date.now()))return F[e].url;delete F[e]}let t=await i.QZ.download(e),s=await t.json();return console.log("json",s),F[e]={url:s.url,expiresAt:Date.now()+6e4},s.url},I=e=>{let{fileKey:t}=e;console.log("key",t);let s=(0,_.a)({queryKey:["imageQuery",t],staleTime:3e4,queryFn:async()=>A(t)});return s.isLoading?(0,n.jsx)("div",{children:(0,n.jsx)(N.Z,{})}):s.isLoading||s.data?(0,n.jsx)("img",{src:s.data,alt:t,className:"object-cover w-full h-full"}):(0,n.jsx)("div",{children:(0,n.jsx)(h.Z,{})})}},9334:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(39763).Z)("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]])},40519:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(39763).Z)("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])},48736:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(39763).Z)("FileText",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["line",{x1:"16",x2:"8",y1:"13",y2:"13",key:"14keom"}],["line",{x1:"16",x2:"8",y1:"17",y2:"17",key:"17nazh"}],["line",{x1:"10",x2:"8",y1:"9",y2:"9",key:"1a5vjj"}]])},21563:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(39763).Z)("PackageOpen",[["path",{d:"M20.91 8.84 8.56 2.23a1.93 1.93 0 0 0-1.81 0L3.1 4.13a2.12 2.12 0 0 0-.05 3.69l12.22 6.93a2 2 0 0 0 1.94 0L21 12.51a2.12 2.12 0 0 0-.09-3.67Z",key:"1vy178"}],["path",{d:"m3.09 8.84 12.35-6.61a1.93 1.93 0 0 1 1.81 0l3.65 1.9a2.12 2.12 0 0 1 .1 3.69L8.73 14.75a2 2 0 0 1-1.94 0L3 12.51a2.12 2.12 0 0 1 .09-3.67Z",key:"s3bv25"}],["line",{x1:"12",x2:"12",y1:"22",y2:"13",key:"1o4xyi"}],["path",{d:"M20 13.5v3.37a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13.5",key:"1na2nq"}]])},83229:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(39763).Z)("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]])},98728:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(39763).Z)("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},95805:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(39763).Z)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},32489:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(39763).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},78298:function(e,t,s){"use strict";s.d(t,{F:function(){return d},f:function(){return c}});var n=s(2265);let a=["light","dark"],l="(prefers-color-scheme: dark)",r="undefined"==typeof window,i=(0,n.createContext)(void 0),o={setTheme:e=>{},themes:[]},d=()=>{var e;return null!==(e=(0,n.useContext)(i))&&void 0!==e?e:o},c=e=>(0,n.useContext)(i)?n.createElement(n.Fragment,null,e.children):n.createElement(m,e),u=["light","dark"],m=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:s=!0,enableColorScheme:r=!0,storageKey:o="theme",themes:d=u,defaultTheme:c=s?"system":"light",attribute:m="data-theme",value:v,children:j,nonce:g})=>{let[y,b]=(0,n.useState)(()=>h(o,c)),[N,w]=(0,n.useState)(()=>h(o)),k=v?Object.values(v):d,C=(0,n.useCallback)(e=>{let n=e;if(!n)return;"system"===e&&s&&(n=p());let l=v?v[n]:n,i=t?f():null,o=document.documentElement;if("class"===m?(o.classList.remove(...k),l&&o.classList.add(l)):l?o.setAttribute(m,l):o.removeAttribute(m),r){let e=a.includes(c)?c:null,t=a.includes(n)?n:e;o.style.colorScheme=t}null==i||i()},[]),E=(0,n.useCallback)(e=>{b(e);try{localStorage.setItem(o,e)}catch(e){}},[e]),_=(0,n.useCallback)(t=>{w(p(t)),"system"===y&&s&&!e&&C("system")},[y,e]);(0,n.useEffect)(()=>{let e=window.matchMedia(l);return e.addListener(_),_(e),()=>e.removeListener(_)},[_]),(0,n.useEffect)(()=>{let e=e=>{e.key===o&&E(e.newValue||c)};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[E]),(0,n.useEffect)(()=>{C(null!=e?e:y)},[e,y]);let z=(0,n.useMemo)(()=>({theme:y,setTheme:E,forcedTheme:e,resolvedTheme:"system"===y?N:y,themes:s?[...d,"system"]:d,systemTheme:s?N:void 0}),[y,E,e,N,s,d]);return n.createElement(i.Provider,{value:z},n.createElement(x,{forcedTheme:e,disableTransitionOnChange:t,enableSystem:s,enableColorScheme:r,storageKey:o,themes:d,defaultTheme:c,attribute:m,value:v,children:j,attrs:k,nonce:g}),j)},x=(0,n.memo)(({forcedTheme:e,storageKey:t,attribute:s,enableSystem:r,enableColorScheme:i,defaultTheme:o,value:d,attrs:c,nonce:u})=>{let m="system"===o,x="class"===s?`var d=document.documentElement,c=d.classList;c.remove(${c.map(e=>`'${e}'`).join(",")});`:`var d=document.documentElement,n='${s}',s='setAttribute';`,h=i?a.includes(o)&&o?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${o}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",f=(e,t=!1,n=!0)=>{let l=d?d[e]:e,r=t?e+"|| ''":`'${l}'`,o="";return i&&n&&!t&&a.includes(e)&&(o+=`d.style.colorScheme = '${e}';`),"class"===s?o+=t||l?`c.add(${r})`:"null":l&&(o+=`d[s](n,${r})`),o},p=e?`!function(){${x}${f(e)}}()`:r?`!function(){try{${x}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${m})){var t='${l}',m=window.matchMedia(t);if(m.media!==t||m.matches){${f("dark")}}else{${f("light")}}}else if(e){${d?`var x=${JSON.stringify(d)};`:""}${f(d?"x[e]":"e",!0)}}${m?"":"else{"+f(o,!1,!1)+"}"}${h}}catch(e){}}()`:`!function(){try{${x}var e=localStorage.getItem('${t}');if(e){${d?`var x=${JSON.stringify(d)};`:""}${f(d?"x[e]":"e",!0)}}else{${f(o,!1,!1)};}${h}}catch(t){}}();`;return n.createElement("script",{nonce:u,dangerouslySetInnerHTML:{__html:p}})},()=>!0),h=(e,t)=>{let s;if(!r){try{s=localStorage.getItem(e)||void 0}catch(e){}return s||t}},f=()=>{let e=document.createElement("style");return e.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(e),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(e)},1)}},p=e=>(e||(e=window.matchMedia(l)),e.matches?"dark":"light")},99376:function(e,t,s){"use strict";var n=s(35475);s.o(n,"redirect")&&s.d(t,{redirect:function(){return n.redirect}}),s.o(n,"useParams")&&s.d(t,{useParams:function(){return n.useParams}}),s.o(n,"usePathname")&&s.d(t,{usePathname:function(){return n.usePathname}}),s.o(n,"useRouter")&&s.d(t,{useRouter:function(){return n.useRouter}}),s.o(n,"useSearchParams")&&s.d(t,{useSearchParams:function(){return n.useSearchParams}})},24369:function(e,t,s){"use strict";var n=s(2265),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},l=n.useState,r=n.useEffect,i=n.useLayoutEffect,o=n.useDebugValue;function d(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!a(e,s)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var s=t(),n=l({inst:{value:s,getSnapshot:t}}),a=n[0].inst,c=n[1];return i(function(){a.value=s,a.getSnapshot=t,d(a)&&c({inst:a})},[e,s,t]),r(function(){return d(a)&&c({inst:a}),e(function(){d(a)&&c({inst:a})})},[e]),o(s),s};t.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:c},82558:function(e,t,s){"use strict";e.exports=s(24369)},91048:function(e,t,s){"use strict";s.d(t,{h:function(){return n}});let n={CONTEXT_RETRIEVE:"CONTEXT_RETRIEVE",SOURCE_UPDATE:"SOURCE_UPDATE",EMBEDDER_UPSERT:"EMBEDDER_UPSERT",EMBEDDER_GENERATE:"EMBEDDER_GENERATE",EMBEDDER_DELETE:"EMBEDDER_DELETE",WORKFLOW_RUN:"WORKFLOW_RUN",CONTEXT_UPSERT:"CONTEXT_UPSERT",TOOL_CALL:"TOOL_CALL",AGENT_RUN:"AGENT_RUN"}},6374:function(e,t,s){"use strict";s.d(t,{DQ:function(){return r},LP:function(){return l},QZ:function(){return i}});var n=s(80605);let a=async()=>{let e=await fetch("/api/config").then(e=>e.json());if(!e.backend)throw Error("No backend set.");return{files:e.backend,base:e.backend}},l=async()=>{var e;let t=await (0,n.getSession)();return null==t?void 0:null===(e=t.user)||void 0===e?void 0:e.jwt},r={image:{generate:async e=>{let t=await a(),s="".concat(t.base,"/generate/agent/image"),n=await l();if(!n)throw Error("No valid session token available.");return fetch(s,{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(n)}})}}},i={object:async e=>{let t=await a(),s="".concat(t.files,"/s3/object"),n=await l();return(await fetch(s,{method:"POST",body:JSON.stringify({key:e}),headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(n)}})).json()},list:async e=>{let{search:t,continuationToken:s}=e,n=await a(),r="".concat(n.files,"/s3/list"),i=await l();if(!i)throw Error("No valid session token available.");return t&&(r+="?search=".concat(t)),s&&(r+="?continuationToken=".concat(s)),(await fetch(r,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(i)}})).json()},download:async e=>{let t=await a(),s="".concat(t.files,"/s3/download?key=").concat(e),n=await l();if(!n)throw Error("No valid session token available.");return fetch(s,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(n)}})},delete:async e=>{let t=await a(),s="".concat(t.files,"/s3/delete?key=").concat(e),n=await l();if(!n)throw Error("No valid session token available.");return fetch(s,{method:"DELETE",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(n)}})}}},55156:function(e,t,s){"use strict";s.d(t,{f:function(){return d}});var n=s(2265),a=s(66840),l=s(57437),r="horizontal",i=["horizontal","vertical"],o=n.forwardRef((e,t)=>{let{decorative:s,orientation:n=r,...o}=e,d=i.includes(n)?n:r;return(0,l.jsx)(a.WV.div,{"data-orientation":d,...s?{role:"none"}:{"aria-orientation":"vertical"===d?d:void 0,role:"separator"},...o,ref:t})});o.displayName="Separator";var d=o},7598:function(e,t,s){"use strict";s.d(t,{Q:function(){return m}});var n=s(63497),a=s(99649);function l(e,t){let s=(0,a.Q)(e),n=(0,a.Q)(t),l=s.getTime()-n.getTime();return l<0?-1:l>0?1:l}var r=s(78198),i=s(81363),o=s(27742),d=s(5654),c=s(55528),u=s(9340);function m(e,t){return function(e,t,s){var n,m,x,h,f,p;let v,j,g;let y=(0,c.j)(),b=null!==(m=null!==(n=null==s?void 0:s.locale)&&void 0!==n?n:y.locale)&&void 0!==m?m:d._,N=l(e,t);if(isNaN(N))throw RangeError("Invalid time value");let w=Object.assign({},s,{addSuffix:null==s?void 0:s.addSuffix,comparison:N});N>0?(v=(0,a.Q)(t),j=(0,a.Q)(e)):(v=(0,a.Q)(e),j=(0,a.Q)(t));let k=(x=j,h=v,(p=null==void 0?void 0:(void 0).roundingMethod,e=>{let t=(p?Math[p]:Math.trunc)(e);return 0===t?0:t})((+(0,a.Q)(x)-+(0,a.Q)(h))/1e3)),C=Math.round((k-((0,u.D)(j)-(0,u.D)(v))/1e3)/60);if(C<2){if(null==s?void 0:s.includeSeconds){if(k<5)return b.formatDistance("lessThanXSeconds",5,w);if(k<10)return b.formatDistance("lessThanXSeconds",10,w);if(k<20)return b.formatDistance("lessThanXSeconds",20,w);if(k<40)return b.formatDistance("halfAMinute",0,w);else if(k<60)return b.formatDistance("lessThanXMinutes",1,w);else return b.formatDistance("xMinutes",1,w)}return 0===C?b.formatDistance("lessThanXMinutes",1,w):b.formatDistance("xMinutes",C,w)}if(C<45)return b.formatDistance("xMinutes",C,w);if(C<90)return b.formatDistance("aboutXHours",1,w);if(C<r.H_)return b.formatDistance("aboutXHours",Math.round(C/60),w);if(C<2520)return b.formatDistance("xDays",1,w);if(C<r.fH){let e=Math.round(C/r.H_);return b.formatDistance("xDays",e,w)}if(C<2*r.fH)return g=Math.round(C/r.fH),b.formatDistance("aboutXMonths",g,w);if((g=function(e,t){let s;let n=(0,a.Q)(e),r=(0,a.Q)(t),d=l(n,r),c=Math.abs((0,i.T)(n,r));if(c<1)s=0;else{1===n.getMonth()&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-d*c);let t=l(n,r)===-d;(function(e){let t=(0,a.Q)(e);return+function(e){let t=(0,a.Q)(e);return t.setHours(23,59,59,999),t}(t)==+(0,o.V)(t)})((0,a.Q)(e))&&1===c&&1===l(e,r)&&(t=!1),s=d*(c-Number(t))}return 0===s?0:s}(j,v))<12){let e=Math.round(C/r.fH);return b.formatDistance("xMonths",e,w)}{let e=g%12,t=Math.trunc(g/12);return e<3?b.formatDistance("aboutXYears",t,w):e<9?b.formatDistance("overXYears",t,w):b.formatDistance("almostXYears",t+1,w)}}(e,(0,n.L)(e,Date.now()),t)}}},function(e){e.O(0,[329,6840,8310,3954,5874,7690,9851,7629,7093,6148,847,1942,7648,7823,8068,5799,4567,605,85,4957,3825,1785,3702,3397,7107,9141,1713,6152,7119,6242,7564,7963,6373,7907,2971,2117,1744],function(){return e(e.s=72252)}),_N_E=e.O()}]);
2
- //# sourceMappingURL=page-edcdd8944daaaef8.js.map
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6050],{67926:function(e,t,s){Promise.resolve().then(s.bind(s,6231))},6231:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return eo}});var n=s(57437),a=s(7211),l=s(12199),r=s(13590),i=s(21563),o=s(18930),d=s(9334),c=s(39763);let u=(0,c.Z)("XSquare",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);var m=s(83229),x=s(15868),h=s(45131);let f=(0,c.Z)("Expand",[["path",{d:"m21 21-6-6m6 6v-4.8m0 4.8h-4.8",key:"1c15vz"}],["path",{d:"M3 16.2V21m0 0h4.8M3 21l6-6",key:"1fsnz2"}],["path",{d:"M21 7.8V3m0 0h-4.8M21 3l-6 6",key:"hawz9i"}],["path",{d:"M3 7.8V3m0 0h4.8M3 3l6 6",key:"u9ee12"}]]),p=(0,c.Z)("MessageCirclePlus",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);var v=s(24156),j=s(17684),g=s(99376),y=s(2265),b=s(29501),N=s(67119),w=s(62910),k=s(68656),C=s(35974),E=s(62869),_=s(15681),z=s(95186),T=s(10492),S=s(6512),O=s(1828),R=s(73578),D=s(76818),Z=s(81103),L=s(26110),M=s(84190),F=s(37099),A=s(77992),I=s(94508),P=s(93022),U=s(65613),V=s(20653),$=s(27689),W=s(8014),B=s(74928),G=s(66070),q=s(78361);function J(e){var t,s,c,J,Q,X,K,Y,H,ee,et,es,en;let[ea,el]=(0,y.useState)(),{toast:er}=(0,A.pm)(),ei=(0,g.useRouter)(),[eo,ed]=(0,y.useState)(),ec=e.context,eu=e.context.fields.map(e=>e.name);console.log("fields",eu),console.log("context",ec);let{loading:em,error:ex,refetch:eh}=(0,a.aM)((0,$.A1)(e.context.id,eu,!0),{skip:!e.itemId||!(null===(t=e.context)||void 0===t?void 0:t.id),variables:{context:e.context.id,id:e.itemId},fetchPolicy:"no-cache",nextFetchPolicy:"network-only",onCompleted:t=>{var s,n,a;let l=t[e.context.id+"_itemsById"];el({...l,tags:l.tags?l.tags.split(","):[]}),ed({rights_mode:l.rights_mode,users:null===(s=l.RBAC)||void 0===s?void 0:s.users,roles:null===(n=l.RBAC)||void 0===n?void 0:n.roles,projects:null===(a=l.RBAC)||void 0===a?void 0:a.projects})}});(0,y.useEffect)(()=>{eh()},[e.itemId]);let[ef,ep]=(0,l.D)((0,$.ty)(e.context.id),{onCompleted:()=>{er({title:"Item updated",description:"Item updated successfully."})},onError:e=>{er({title:"Error updating item",description:e.message})}}),[ev,ej]=(0,l.D)((0,$.mN)(e.context.id,[]),{onCompleted:()=>{er({title:"Item deleted",description:"Item deleted successfully."})},onError:e=>{er({title:"Error deleting item",description:e.message})}}),[eg,ey]=(0,l.D)((0,$.Eq)(e.context.id),{onCompleted:t=>{var s;if((null===(s=t[e.context.id+"_itemsGenerateChunks"].jobs)||void 0===s?void 0:s.length)>0){er({title:"Chunks generation started",description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}er({title:"Chunks generated",description:"Chunks generated successfully."})}}),[eb,eN]=(0,l.D)((0,$.ps)(e.context.id),{onCompleted:t=>{var s;if((null===(s=t[e.context.id+"_itemsDeleteChunks"].jobs)||void 0===s?void 0:s.length)>0){er({title:"Chunks deletion started",description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}er({title:"Chunks deleted",description:"Chunks deleted successfully."})}}),[ew,ek]=(0,l.D)((0,$.dc)(e.context.id),{onCompleted:()=>{er({title:"Field processed",description:"Field processed successfully."})},onError:e=>{er({title:"Error processing field",description:e.message})}}),eC=N.Ry({name:N.Z_().nullable().optional(),tags:N.Z_().nullable().optional(),external_id:N.Z_().nullable().optional(),description:N.Z_().min(2,{message:"Text must be at least 2 characters."}).max(1e4,{message:"Text must not be longer than 10.0000 characters."}),...null!==(es=null==ec?void 0:null===(s=ec.fields)||void 0===s?void 0:s.reduce((e,t)=>({...e,[t.name]:N.Z_().nullable()}),{}))&&void 0!==es?es:{}}),eE=(0,b.cI)({resolver:(0,r.F)(eC),defaultValues:{description:null==ea?void 0:ea.description},mode:"onChange"}),e_=e=>{if(e.target.value&&"Enter"===e.key){var t;let s=null!==(t=null==ea?void 0:ea.tags)&&void 0!==t?t:[],n=[...Array.isArray(s)?[...s]:[]];n.push(e.target.value),console.log("tags",n),eE.setValue("tags",n.join(",")),el({...ea,tags:n}),e.target.value=""}},[ez,eT]=(0,y.useState)(!1),[eS,eO]=(0,y.useState)(null),[eR,eD]=(0,y.useState)(null);return((0,y.useEffect)(()=>{(null==ea?void 0:ea.text)==="New item"?eT(!0):eT(!1)},[null==ea?void 0:ea.id]),em)?(0,n.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md"}),(0,n.jsx)(P.O,{className:"w-full h-[50px] rounded-md mt-3"}),(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md mt-3"})]}):ex?(0,n.jsxs)(U.bZ,{variant:"destructive",children:[(0,n.jsx)(V.LPM,{className:"size-4"}),(0,n.jsx)(U.Cd,{children:"Error"}),(0,n.jsx)(U.X,{children:(null==ex?void 0:ex.message)||"Error loading item."})]}):(0,n.jsxs)("div",{className:"flex h-full flex-col",children:[ea?(0,n.jsxs)(n.Fragment,{children:[e.actions?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"flex items-center p-2",children:(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(null==ea?void 0:ea.archived)?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(Z.u,{children:[(0,n.jsx)(Z.aJ,{asChild:!0,children:(0,n.jsxs)(E.z,{onClick:async()=>{ea.id&&(ef({variables:{id:ea.id,input:{archived:!1}}}),el({...ea,archived:!1}),ei.push("./"))},variant:"ghost",size:"icon",disabled:!ea||ep.loading,children:[ep.loading?(0,n.jsx)(T.g,{}):(0,n.jsx)(i.Z,{className:"size-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Unarchive"})]})}),(0,n.jsx)(Z._v,{children:"Unarchive"})]}),(0,n.jsxs)(Z.u,{children:[(0,n.jsx)(Z.aJ,{asChild:!0,children:(0,n.jsxs)(E.z,{onClick:async()=>{ea.id&&(ev({variables:{id:ea.id}}),ei.push("./"))},variant:"ghost",size:"icon",disabled:!ea||ej.loading,children:[ej.loading?(0,n.jsx)(T.g,{}):(0,n.jsx)(o.Z,{className:"size-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Delete"})]})}),(0,n.jsx)(Z._v,{children:"Delete"})]})]}):(0,n.jsxs)(Z.u,{children:[(0,n.jsx)(Z.aJ,{asChild:!0,children:(0,n.jsxs)(E.z,{onClick:async()=>{(null==ea?void 0:ea.id)&&(ef({variables:{id:ea.id,input:{archived:!0}}}),el({...ea,archived:!0}),ei.push("./"))},variant:"ghost",size:"icon",disabled:!ea||ep.loading,children:[ep.loading?(0,n.jsx)(T.g,{}):(0,n.jsx)(d.Z,{className:"size-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Archive"})]})}),(0,n.jsx)(Z._v,{children:"Archive"})]}),ez?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(Z.u,{children:[(0,n.jsx)(Z.aJ,{asChild:!0,children:(0,n.jsxs)(E.z,{onClick:()=>{eT(!1)},variant:"ghost",size:"icon",children:[(0,n.jsx)(u,{className:"size-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Cancel"})]})}),(0,n.jsx)(Z._v,{children:"Cancel"})]}),(0,n.jsxs)(Z.u,{children:[(0,n.jsx)(Z.aJ,{asChild:!0,children:(0,n.jsxs)(E.z,{disabled:ep.loading,onClick:()=>{var e,t,s,n;(null==ea?void 0:ea.id)&&(ef({variables:{id:ea.id,input:{textlength:null==ea?void 0:null===(e=ea.text)||void 0===e?void 0:e.length,description:null==ea?void 0:ea.description,name:null==ea?void 0:ea.name,externalId:null==ea?void 0:ea.externalId,tags:null==ea?void 0:null===(t=ea.tags)||void 0===t?void 0:t.join(","),source:null==ea?void 0:ea.source,archived:null==ea?void 0:ea.archived,rights_mode:null==eo?void 0:eo.rights_mode,RBAC:{users:(null==eo?void 0:eo.users)||[],roles:(null==eo?void 0:eo.roles)||[],projects:(null==eo?void 0:eo.projects)||[]},...null!==(n=null==ec?void 0:null===(s=ec.fields)||void 0===s?void 0:s.reduce((e,t)=>({...e,[t.name]:null==ea?void 0:ea[t.name]}),{}))&&void 0!==n?n:{}}}}),eT(!1))},variant:"ghost",size:"icon",children:[(0,n.jsx)(m.Z,{className:"size-4"}),(0,n.jsxs)("span",{className:"sr-only",children:["Save ",null!==(en=ep.loading)&&void 0!==en?en:(0,n.jsx)(T.g,{})]})]})}),(0,n.jsx)(Z._v,{children:"Save"})]})]}):(0,n.jsxs)(Z.u,{children:[(0,n.jsx)(Z.aJ,{asChild:!0,children:(0,n.jsxs)(E.z,{onClick:()=>{eT(!0)},variant:"ghost",size:"icon",disabled:!ea||ep.loading,children:[(0,n.jsx)(x.Z,{className:"size-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Edit"})]})}),(0,n.jsx)(Z._v,{children:"Edit"})]})]})}),(0,n.jsx)(S.Z,{})]}):null,(0,n.jsx)("div",{className:"flex flex-1 flex-col",children:(0,n.jsxs)("div",{className:(0,I.cn)("space-y-2"),children:[(0,n.jsx)("div",{className:"flex items-center justify-between space-x-4 px-4 bg-muted rounded",children:(0,n.jsx)("h3",{className:"text-lg p-5 font-semibold tracking-tight text-lg",children:"Fields"})}),(0,n.jsxs)("div",{className:"p-5",children:[(0,n.jsx)(_.l0,{...eE,children:(0,n.jsx)("form",{className:"space-y-8",children:(0,n.jsxs)("div",{children:[(0,n.jsxs)(R.iA,{children:[(0,n.jsx)(R.xD,{children:(0,n.jsxs)(R.SC,{children:[(0,n.jsx)(R.ss,{children:"Name"}),(0,n.jsx)(R.ss,{children:"Value"})]})}),(0,n.jsxs)(R.RM,{children:[(0,n.jsxs)(R.SC,{children:[(0,n.jsx)(R.pj,{className:"font-medium capitalize",children:"Name"}),(0,n.jsx)(R.pj,{children:(0,n.jsx)(_.Wi,{control:eE.control,name:"name",render:e=>{var t,s,a;let{field:l}=e;return(0,n.jsx)(_.xJ,{children:ez?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(_.NI,{children:(0,n.jsx)(z.I,{type:"text",disabled:!ez,onChange:e=>{el({...ea,name:e.target.value})},placeholder:"Item name",value:null!==(a=ea.name)&&void 0!==a?a:""})}),(0,n.jsx)(_.zG,{})]}):(0,n.jsx)("div",{onClick:async()=>{var e;await navigator.clipboard.writeText(null!==(e=ea.name)&&void 0!==e?e:""),er({title:"Copied to clipboard"})},className:"flex-1 whitespace-pre-wrap text-sm cursor-copy",children:ea.name&&(null===(t=ea.name)||void 0===t?void 0:t.length)>200?(null===(s=ea.name)||void 0===s?void 0:s.slice(0,200))+"...":ea.name})})}})})]},"name"),(0,n.jsxs)(R.SC,{children:[(0,n.jsx)(R.pj,{className:"font-medium capitalize",children:"Tags"}),(0,n.jsxs)(R.pj,{children:[ez?(0,n.jsx)("div",{className:"grid-row grid grid-flow-col gap-4 pt-2",children:(0,n.jsx)(_.Wi,{control:eE.control,name:"tags",render:e=>{let{field:t}=e;return(0,n.jsxs)(_.xJ,{children:[(0,n.jsx)(_.NI,{children:(0,n.jsx)(z.I,{id:"includes",type:"text",onKeyUp:e=>e_(e),placeholder:"Type and press enter to add"})}),(0,n.jsx)(_.zG,{})]})}})}):null,(null==ea?void 0:null===(c=ea.tags)||void 0===c?void 0:c.length)?(0,n.jsx)("div",{className:"gap-2 pt-2",children:null==ea?void 0:null===(J=ea.tags)||void 0===J?void 0:J.map((e,t)=>(0,n.jsx)(C.C,{variant:"secondary",className:"px-3 py-2 mr-2 mb-2",children:(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("div",{className:"text-muted-foreground truncate max-w-[200px]",children:e}),ez?(0,n.jsx)("span",{className:"size-4 cursor-pointer text-muted-foreground",onClick:()=>{var e;let s=[...null!==(e=ea.tags)&&void 0!==e?e:[]];s.splice(t,1),eE.setValue("tags",s.join(",")),el({...ea,tags:s})},children:(0,n.jsx)(h.Z,{className:"ml-1",size:15})}):null]})},"tag-".concat(t)))}):null]})]},"tags"),(0,n.jsxs)(R.SC,{children:[(0,n.jsx)(R.pj,{className:"font-medium capitalize",children:"Description"}),(0,n.jsx)(R.pj,{children:(0,n.jsx)(_.Wi,{control:eE.control,name:"description",render:e=>{var t,s,a;let{field:l}=e;return(0,n.jsx)(_.xJ,{children:ez?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(_.NI,{children:(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(D.g,{autoFocus:!0,disabled:!ez,onChange:e=>{el({...ea,description:e.target.value})},placeholder:"Item text content",className:"resize-none",value:null!==(s=ea.description)&&void 0!==s?s:""}),(0,n.jsxs)(L.Vq,{children:[(0,n.jsx)(L.hg,{asChild:!0,children:(0,n.jsxs)(E.z,{type:"button",variant:"ghost",size:"sm",className:"absolute top-2 right-2 h-6 w-6 p-0",onClick:()=>{var e;return eO({name:"description",value:null!==(e=ea.description)&&void 0!==e?e:"",disabled:!1})},children:[(0,n.jsx)(f,{className:"h-3 w-3"}),(0,n.jsx)("span",{className:"sr-only",children:"Expand"})]})}),(0,n.jsxs)(L.cZ,{className:"max-w-4xl max-h-[80vh]",children:[(0,n.jsx)(L.fK,{children:(0,n.jsx)(L.$N,{children:"Edit Description"})}),(0,n.jsx)("div",{className:"mt-4",children:(0,n.jsx)(D.g,{rows:20,className:"min-h-[400px] resize-none",value:(null==eS?void 0:eS.name)==="description"?eS.value:null!==(a=ea.description)&&void 0!==a?a:"",onChange:e=>{let t=e.target.value;eO(e=>(null==e?void 0:e.name)==="description"?{...e,value:t}:e),el({...ea,description:t})}})})]})]})]})}),(0,n.jsx)(_.zG,{})]}):(0,n.jsx)("div",{onClick:async()=>{var e;await navigator.clipboard.writeText(null!==(e=ea.description)&&void 0!==e?e:""),er({title:"Copied to clipboard"})},className:"flex-1 whitespace-pre-wrap text-sm cursor-copy",children:(0,n.jsx)(k.J,{text:null!==(t=ea.description)&&void 0!==t?t:""})})})}})})]},19091),(0,n.jsxs)(R.SC,{children:[(0,n.jsx)(R.pj,{className:"font-medium capitalize",children:"External ID"}),(0,n.jsx)(R.pj,{children:(0,n.jsx)(_.Wi,{control:eE.control,name:"external_id",render:e=>{var t,s;let{field:a}=e;return(0,n.jsx)(_.xJ,{children:ez?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(_.NI,{children:(0,n.jsx)(z.I,{type:"text",disabled:!ez,onChange:e=>{console.log("e",e),el({...ea,external_id:e.target.value})},placeholder:"xxxx-xxxx-xxxx-xxxx",value:null!==(s=ea.external_id)&&void 0!==s?s:""})}),(0,n.jsx)(_.zG,{})]}):(0,n.jsx)("div",{onClick:async()=>{var e;await navigator.clipboard.writeText(null!==(e=ea.external_id)&&void 0!==e?e:""),er({title:"Copied to clipboard"})},className:"flex-1 whitespace-pre-wrap text-sm cursor-copy",children:null!==(t=ea.external_id)&&void 0!==t?t:""})})}})})]},"externalId"),(null==ec?void 0:null===(Q=ec.fields)||void 0===Q?void 0:Q.length)&&ec.fields.map((e,t)=>{var s;return(0,n.jsxs)(R.SC,{children:[(0,n.jsxs)(R.pj,{className:"font-medium capitalize flex flex-col",children:[e.label,e.calculated&&(0,n.jsx)("span",{className:"text-sm text-muted-foreground",children:"Calculated"}),e.processor&&(0,n.jsxs)(Z.u,{children:[(0,n.jsx)(Z.aJ,{asChild:!0,children:(0,n.jsxs)(E.z,{variant:"secondary",size:"sm",className:"w-auto mt-2",onClick:()=>{ew({variables:{item:null==ea?void 0:ea.id,field:e.name}})},disabled:ek.loading,children:[ek.loading?(0,n.jsx)(T.g,{}):(0,n.jsx)(p,{className:"size-4"}),(0,n.jsx)("span",{className:"ml-2",children:"Process"})]})}),(0,n.jsx)(Z._v,{className:"max-w-xs",children:e.processor.description})]})]}),ez?(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(R.pj,{children:["code"===e.type||"json"===e.type||"text"===e.type||"longText"===e.type||"markdown"===e.type||"shortText"===e.type?(0,n.jsx)(_.Wi,{control:eE.control,name:e.name,render:t=>{var s,a;let{field:l}=t;return(0,n.jsxs)(_.xJ,{children:[(0,n.jsx)(_.NI,{children:(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(D.g,{id:e.name,rows:"shortText"===e.type?2:7,onChange:t=>{el({...ea,[e.name]:t.target.value})},value:null!==(s=ea[e.name])&&void 0!==s?s:""}),(0,n.jsxs)(L.Vq,{children:[(0,n.jsx)(L.hg,{asChild:!0,children:(0,n.jsxs)(E.z,{type:"button",variant:"ghost",size:"sm",className:"absolute top-2 right-2 h-6 w-6 p-0",onClick:()=>{var t;return eO({name:e.name,disabled:!1,value:null!==(t=ea[e.name])&&void 0!==t?t:""})},children:[(0,n.jsx)(f,{className:"h-3 w-3"}),(0,n.jsx)("span",{className:"sr-only",children:"Expand"})]})}),(0,n.jsxs)(L.cZ,{className:"max-w-4xl max-h-[80vh]",children:[(0,n.jsx)(L.fK,{children:(0,n.jsxs)(L.$N,{children:["Edit ",e.name]})}),(0,n.jsx)("div",{className:"mt-4",children:(0,n.jsx)(D.g,{rows:20,className:"min-h-[400px] resize-none",value:(null==eS?void 0:eS.name)===e.name?eS.value:null!==(a=ea[e.name])&&void 0!==a?a:"",onChange:t=>{let s=t.target.value;eO(t=>(null==t?void 0:t.name)===e.name?{...t,value:s}:t),el({...ea,[e.name]:s})}})})]})]})]})}),(0,n.jsx)(_.zG,{})]})}}):null,"number"===e.type?(0,n.jsx)(_.Wi,{control:eE.control,name:e.name,render:t=>{var s;let{field:a}=t;return(0,n.jsxs)(_.xJ,{children:[(0,n.jsx)(_.NI,{children:(0,n.jsx)(z.I,{id:e.name,type:"number",onChange:t=>{el({...ea,[e.name]:t.target.value})},value:null!==(s=ea[e.name])&&void 0!==s?s:""})}),(0,n.jsx)(_.zG,{})]})}}):null,"boolean"===e.type?(0,n.jsx)(_.Wi,{control:eE.control,name:e.name,render:t=>{let{field:s}=t;return(0,n.jsxs)(_.xJ,{children:[(0,n.jsx)(_.NI,{children:(0,n.jsx)(O.r,{checked:!!s.value,onCheckedChange:t=>{el({...ea,[e.name]:t})}})}),(0,n.jsx)(_.zG,{})]})}}):null,"file"===e.type&&(0,n.jsx)("div",{children:(0,n.jsx)(q.jF,{s3key:ea[e.name],children:(0,n.jsx)(q.ZP,{id:"item-".concat(ea.id),buttonText:"Select File",allowedFileTypes:e.allowedFileTypes,dependencies:[],selectionLimit:1,onConfirm:t=>{console.log("keys",t),el({...ea,[e.name]:t[0]})}})})})]})}):(0,n.jsx)(R.pj,{children:(0,n.jsxs)("span",{children:["code"===e.type&&(0,n.jsx)(w.G,{code:ea[e.name]}),"json"===e.type&&(0,n.jsx)(w.G,{code:ea[e.name]}),"shortText"===e.type&&(0,n.jsx)("p",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(ea[e.name]),er({title:"Copied to clipboard"})},children:ea[e.name]}),"longText"===e.type&&(0,n.jsx)(k.J,{text:ea[e.name]}),"file"===e.type&&(0,n.jsx)(q.jF,{s3key:ea[e.name]}),"markdown"===e.type&&(0,n.jsx)(k.J,{text:ea[e.name]}),!e.type&&(0,n.jsx)(k.J,{text:ea[e.name]}),"text"===e.type&&(0,n.jsx)(k.J,{text:ea[e.name]}),"number"===e.type&&(0,n.jsx)("p",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(ea[e.name]),er({title:"Copied to clipboard"})},children:ea[e.name]}),"boolean"===e.type&&(0,n.jsx)("p",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(ea[e.name]),er({title:"Copied to clipboard"})},children:null!==(s=ea[e.name])&&void 0!==s?s:""})]})})]},t)})]})]}),(0,n.jsx)(S.Z,{className:"my-4"})]})})}),(0,n.jsx)(G.Zb,{className:"bg-transparent",children:(0,n.jsxs)(B.zF,{children:[(0,n.jsx)(G.Ol,{className:"p-4",children:(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex flex-col",children:[(0,n.jsx)("p",{className:"text-base",children:"Access Control"}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground mb-0",children:"Control access to this item."})]}),(0,n.jsx)(B.wy,{asChild:!0,children:(0,n.jsxs)(E.z,{variant:"ghost",size:"icon",className:"size-8",children:[(0,n.jsx)(v.Z,{className:"size-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Toggle"})]})})]})}),(0,n.jsx)(B.Fw,{className:"mt-5",children:(0,n.jsx)(G.aY,{className:"space-y-4",children:(0,n.jsx)(W.P,{initialRightsMode:ea.rights_mode,initialUsers:null===(X=ea.RBAC)||void 0===X?void 0:X.users,initialRoles:null===(K=ea.RBAC)||void 0===K?void 0:K.roles,initialProjects:null===(Y=ea.RBAC)||void 0===Y?void 0:Y.projects,onChange:(e,t,s,n)=>{ed({rights_mode:e,users:t,roles:s,projects:n})}})})})]})}),(0,n.jsxs)("div",{className:"mt-4 border border p-3 pb-5 rounded",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between ml-4 mt-3 mr-4 mb-2",children:[(0,n.jsx)("h1",{className:"text-lg font-medium",children:"Embeddings"}),(0,n.jsxs)(M.h_,{children:[(0,n.jsx)(M.$F,{asChild:!0,children:(0,n.jsxs)(E.z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:[(0,n.jsx)(j.Z,{className:"h-4 w-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Open menu"})]})}),(0,n.jsxs)(M.AW,{align:"end",children:[(0,n.jsx)(M.Xi,{onClick:()=>eD("generate"),children:"Generate embeddings"}),(0,n.jsx)(M.Xi,{onClick:()=>eD("delete"),children:"Delete embeddings"})]})]})]}),(0,n.jsxs)(R.iA,{children:[(0,n.jsx)(R.Rn,{children:(null==ea?void 0:null===(H=ea.chunks)||void 0===H?void 0:H.length)?"A list of all embeddings for this item.":"No embeddings found."}),(0,n.jsx)(R.xD,{children:(0,n.jsxs)(R.SC,{children:[(0,n.jsx)(R.ss,{children:"Index"}),(0,n.jsx)(R.ss,{children:"Content"}),(0,n.jsx)(R.ss,{children:"Dimensions"}),(0,n.jsx)(R.ss,{children:"Created At"}),(0,n.jsx)(R.ss,{children:"Updated At"})]})}),(0,n.jsx)(R.RM,{children:(null==ea?void 0:null===(ee=ea.chunks)||void 0===ee?void 0:ee.length)?(null==ea?void 0:null===(et=ea.chunks)||void 0===et?void 0:et.length)&&ea.chunks.map(e=>(0,n.jsxs)(R.SC,{children:[(0,n.jsx)(R.pj,{className:"font-medium capitalize",children:e.chunk_index+1}),(0,n.jsx)(R.pj,{children:(0,n.jsx)(k.J,{text:e.content})}),(0,n.jsx)(R.pj,{children:e.embedding_size||0}),(0,n.jsx)(R.pj,{children:new Date(e.chunk_created_at).toLocaleString()}),(0,n.jsx)(R.pj,{children:new Date(e.chunk_updated_at).toLocaleString()})]},e.id)):null})]})]})]})]})})]}):(0,n.jsxs)(n.Fragment,{children:[" ",!ea&&e.itemId?(0,n.jsx)("div",{className:"p-8 text-center text-muted-foreground",children:"Item not found."}):(0,n.jsx)("div",{className:"p-8 text-center text-muted-foreground",children:"No item selected."})]}),(0,n.jsx)(F.aR,{open:"generate"===eR,onOpenChange:e=>!e&&eD(null),children:(0,n.jsxs)(F._T,{children:[(0,n.jsxs)(F.fY,{children:[(0,n.jsx)(F.f$,{children:"Generate Embeddings"}),(0,n.jsx)(F.yT,{children:"Are you sure you want to generate embeddings for this item? This will create new embedding vectors for the content."})]}),(0,n.jsxs)(F.xo,{children:[(0,n.jsx)(F.le,{children:"Cancel"}),(0,n.jsx)(F.OL,{disabled:ey.loading,onClick:()=>{(null==ea?void 0:ea.id)&&(console.log("Generate embeddings for item:",null==ea?void 0:ea.id),eD(null),eg({variables:{where:{id:{eq:null==ea?void 0:ea.id}}}}))},children:"Generate"})]})]})}),(0,n.jsx)(F.aR,{open:"delete"===eR,onOpenChange:e=>!e&&eD(null),children:(0,n.jsxs)(F._T,{children:[(0,n.jsxs)(F.fY,{children:[(0,n.jsx)(F.f$,{children:"Delete Embeddings"}),(0,n.jsx)(F.yT,{children:"Are you sure you want to delete all embeddings for this item? This action cannot be undone."})]}),(0,n.jsxs)(F.xo,{children:[(0,n.jsx)(F.le,{children:"Cancel"}),(0,n.jsx)(F.OL,{disabled:eN.loading,onClick:async()=>{(null==ea?void 0:ea.id)&&(console.log("Delete embeddings for item:",null==ea?void 0:ea.id),eD(null),eb({variables:{where:{id:{eq:null==ea?void 0:ea.id}}}}))},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}var Q=s(5341),X=s(91048),K=s(21409),Y=s(52896),H=s(73450);function ee(){let[e,t]=(0,y.useState)("count"),[s,a]=(0,y.useState)({from:(0,Q.k)(new Date,7),to:new Date}),[l,r]=(0,y.useState)("EMBEDDER_GENERATE"),[i,o]=(0,y.useState)("label");return(0,n.jsxs)("div",{className:"flex-1 flex flex-col p-8 pt-6 h-screen",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-8",children:[(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("h2",{className:"text-4xl font-bold tracking-tight bg-clip-text",children:"Contexts Dashboard"}),(0,n.jsx)("p",{className:"text-lg",children:"Monitor your contexts and their usage."})]}),(0,n.jsx)("div",{className:"flex items-center space-x-2",children:(0,n.jsx)(K.z,{dateRange:s,onDateRangeChange:a,maxDays:30})})]}),(0,n.jsxs)("div",{className:"flex-1 grid gap-6 md:grid-cols-3 min-h-0",children:[(0,n.jsx)("div",{className:"rounded-lg border md:col-span-2 p-6 flex flex-col",children:(0,n.jsx)(Y.q,{dateRange:s,selectedType:l,onTypeChange:r,onUnitChange:t,unit:e,dataTypes:[X.h.CONTEXT_RETRIEVE,X.h.EMBEDDER_UPSERT,X.h.EMBEDDER_GENERATE,X.h.EMBEDDER_DELETE,X.h.CONTEXT_UPSERT]})}),(0,n.jsx)("div",{className:"rounded-lg border p-6 flex flex-col",children:(0,n.jsx)(H.Y,{groupByOptions:[],dateRange:s,selectedType:l,groupBy:i,onGroupByChange:o})})]})]})}var et=s(32660),es=s(19378),en=s(7598),ea=s(27648),el=s(37091);function er(e){var t,s;let{contextId:l}=e,r=(0,y.useRef)(new Date(Date.now()-18144e5).toISOString()),{loading:i,data:o,refetch:d,previousData:c,error:u}=(0,a.aM)((0,$.P3)(l,[]),{fetchPolicy:"no-cache",nextFetchPolicy:"network-only",variables:{context:l,page:1,limit:5,filters:[{embeddings_updated_at:{gte:r.current}}],sort:{field:"embeddings_updated_at",direction:"DESC"}}}),m=null==o?void 0:o[l+$.Md];return i?(0,n.jsxs)("div",{className:"flex flex-col gap-2 pt-0",children:[(0,n.jsx)(P.O,{className:"w-full h-[50px] rounded-lg mb-2"}),(0,n.jsx)(P.O,{className:"w-full h-[50px] rounded-lg mb-2"}),(0,n.jsx)(P.O,{className:"w-full h-[50px] rounded-lg"})]}):(0,n.jsx)("div",{className:"space-y-8",children:(null==m?void 0:null===(t=m.items)||void 0===t?void 0:t.length)?null==m?void 0:null===(s=m.items)||void 0===s?void 0:s.map((e,t)=>{var s;return(0,n.jsx)("div",{className:"flex items-center",children:(0,n.jsx)("div",{className:"space-y-1",children:(0,n.jsx)("p",{className:"text-sm font-medium leading-none",children:(0,n.jsxs)(ea.default,{className:"hover:dark:text-blue-500 hover:underline",href:"/data/"+l+"/"+e.id,children:[(0,n.jsx)(el.L,{text:null!==(s=e.name)&&void 0!==s?s:"",length:50}),(0,n.jsxs)("p",{className:"text-sm text-muted-foreground",children:["created at: ",e.embeddings_updated_at?(0,en.Q)(new Date(e.embeddings_updated_at),{addSuffix:!0}):"never","."]})]})})})},t)}):(0,n.jsx)("div",{className:"flex flex-col gap-2 pt-0",children:(0,n.jsx)("p",{className:"text-sm font-medium leading-none",children:"No recent embeddings."})})})}function ei(e){var t;let[s,r]=(0,y.useState)(null),{toast:i}=(0,A.pm)(),{data:o,loading:d,error:c}=(0,a.aM)($.fV,{variables:{id:e.context}}),u=null==o?void 0:o.contextById,m=(0,g.useRouter)(),[x,h]=(0,l.D)((0,$.Eq)(e.context),{onCompleted:t=>{var s;if((null===(s=t[e.context+"_itemsGenerateChunks"].jobs)||void 0===s?void 0:s.length)>0){i({title:"Chunks generation started",description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}i({title:"Chunks generated",description:"Chunks generated successfully."})}}),[f,p]=(0,l.D)((0,$.ps)(e.context),{onCompleted:t=>{var s;if((null===(s=t[e.context+"_itemsDeleteChunks"].jobs)||void 0===s?void 0:s.length)>0){i({title:"Chunks deletion started",description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}i({title:"Chunks deleted",description:"Chunks deleted successfully."})}});return d?(0,n.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md"}),(0,n.jsx)(P.O,{className:"w-full h-[50px] rounded-md mt-3"}),(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md mt-3"})]}):c?(0,n.jsxs)(U.bZ,{variant:"destructive",children:[(0,n.jsx)(V.LPM,{className:"size-4"}),(0,n.jsx)(U.Cd,{children:"Error"}),(0,n.jsx)(U.X,{children:(null==c?void 0:c.message)||"Error loading item."})]}):(0,n.jsxs)("div",{className:"flex h-full flex-col",children:[e.actions?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex p-2 justify-between",children:[(0,n.jsx)("div",{className:"flex items-center gap-2"}),(0,n.jsxs)(E.z,{onClick:()=>{m.push("/context")},variant:"ghost",size:"icon",children:[(0,n.jsx)(et.Z,{className:"size-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Back"})]})]}),(0,n.jsx)(S.Z,{})]}):null,u?(0,n.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,n.jsxs)(G.Zb,{className:"border-0 rounded-none",children:[(0,n.jsx)(G.Ol,{children:(0,n.jsx)(G.ll,{className:"text-lg",children:"Settings"})}),(0,n.jsx)(G.aY,{className:"grid gap-4",children:(0,n.jsx)(es.x,{className:"max-h-[600px]",children:(0,n.jsxs)("div",{className:"space-y-6 pr-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"text-xl font-bold",children:u.name}),(0,n.jsx)("p",{className:"text-muted-foreground mt-1",children:u.description}),(0,n.jsxs)("div",{className:"mt-3 flex items-center",children:[(0,n.jsx)("span",{className:"text-sm font-medium mr-2",children:"Embedder:"}),(0,n.jsx)(C.C,{variant:"outline",children:u.embedder||"None"})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-sm font-medium mr-2",children:"Calculate Vectors:"}),(0,n.jsx)(C.C,{variant:"secondary",children:(null===(t=u.configuration)||void 0===t?void 0:t.calculateVectors)?u.configuration.calculateVectors.charAt(0).toUpperCase()+u.configuration.calculateVectors.slice(1):"Manual"}),(0,n.jsxs)("div",{className:"mt-2 text-xs text-muted-foreground",children:[(0,n.jsxs)("span",{className:"block",children:[(0,n.jsx)("b",{children:"Manual"}),": Vectors are only calculated when triggered manually."]}),(0,n.jsxs)("span",{className:"block",children:[(0,n.jsx)("b",{children:"On Update"}),": Vectors are recalculated whenever an item is updated."]}),(0,n.jsxs)("span",{className:"block",children:[(0,n.jsx)("b",{children:"On Insert"}),": Vectors are calculated when a new item is inserted."]}),(0,n.jsxs)("span",{className:"block",children:[(0,n.jsx)("b",{children:"Always"}),": Vectors are calculated on both insert and update operations."]})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-sm font-medium mr-2",children:"Default rights mode for new items in this context:"}),(0,n.jsxs)("div",{className:"mt-2 text-xs text-muted-foreground",children:[(0,n.jsxs)("span",{className:"block",children:[(0,n.jsx)("b",{children:"Private"}),": Only the user who created the item can view it."]}),(0,n.jsxs)("span",{className:"block",children:[(0,n.jsx)("b",{children:"Users"}),": Any user with access to the context can view the item."]}),(0,n.jsxs)("span",{className:"block",children:[(0,n.jsx)("b",{children:"Roles"}),": Any user with the role assigned to the context can view the item."]}),(0,n.jsxs)("span",{className:"block",children:[(0,n.jsx)("b",{children:"Public"}),": Any user can view the item."]})]})]}),(0,n.jsx)(S.Z,{})]})})})]}),(0,n.jsxs)(G.Zb,{className:"bg-none border-0 rounded-none",children:[(0,n.jsx)(G.Ol,{children:(0,n.jsx)(G.ll,{children:(0,n.jsxs)("div",{className:"flex items-center justify-between ml-4 mt-3 mr-4 mb-2",children:[(0,n.jsx)("h1",{className:"text-lg font-medium",children:"Embeddings"}),(0,n.jsxs)(M.h_,{children:[(0,n.jsx)(M.$F,{asChild:!0,children:(0,n.jsxs)(E.z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:[(0,n.jsx)(j.Z,{className:"h-4 w-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Open menu"})]})}),(0,n.jsxs)(M.AW,{align:"end",children:[(0,n.jsx)(M.Xi,{onClick:()=>r("generate"),children:"Generate all embeddings"}),(0,n.jsx)(M.Xi,{onClick:()=>r("delete"),children:"Delete all embeddings"})]})]})]})})}),(0,n.jsx)(G.aY,{children:(0,n.jsx)(er,{contextId:u.id})})]})]}):(0,n.jsx)("div",{className:"p-8 text-center text-muted-foreground",children:"Context not found."}),(0,n.jsx)(F.aR,{open:"generate"===s,onOpenChange:e=>!e&&r(null),children:(0,n.jsxs)(F._T,{children:[(0,n.jsxs)(F.fY,{children:[(0,n.jsx)(F.f$,{children:"Generate Embeddings"}),(0,n.jsx)(F.yT,{children:"Are you sure you want to generate embeddings for this context? This will create new embedding vectors for every item in the context, this can take a long time, might cost money if you are using a paid service as your embedder, or require a lot of computational resources if your embedder is self hosted."})]}),(0,n.jsxs)(F.xo,{children:[(0,n.jsx)(F.le,{children:"Cancel"}),(0,n.jsx)(F.OL,{disabled:h.loading,onClick:()=>{r(null),x(),i({title:"Generating embeddings...",description:"Embeddings are being generated in the background, depending on the size of the item this may take a while."})},children:"Generate"})]})]})}),(0,n.jsx)(F.aR,{open:"delete"===s,onOpenChange:e=>!e&&r(null),children:(0,n.jsxs)(F._T,{children:[(0,n.jsxs)(F.fY,{children:[(0,n.jsx)(F.f$,{children:"Delete Embeddings"}),(0,n.jsx)(F.yT,{children:"Are you sure you want to delete all embeddings for this context? This action cannot be undone. Embeddings are used to search and filter items, deleting them will remove this functionality from the context, regenerating embeddings might take a long time, might cost money if you are using a paid service as your embedder, or require a lot of computational resources if your embedder is self hosted."})]}),(0,n.jsxs)(F.xo,{children:[(0,n.jsx)(F.le,{children:"Cancel"}),(0,n.jsx)(F.OL,{disabled:p.loading,onClick:async()=>{r(null),f(),i({title:"Embeddings deleted",description:"All embeddings for this item have been deleted."})},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function eo(e){var t,s;let{params:l}=e,{data:r,loading:i,error:o}=(0,a.aM)($.fV,{skip:!(null==l?void 0:null===(t=l.query)||void 0===t?void 0:t[0]),variables:{id:null==l?void 0:null===(s=l.query)||void 0===s?void 0:s[0]}});if(!l.query)return(0,n.jsx)("div",{className:"grow flex flex-col",children:(0,n.jsx)(ee,{})});let d=l.query[0]||null,c="archived"===l.query[1],u="settings"===l.query[1];if(u)return(0,n.jsx)(ei,{expand:!0,actions:!0,context:d});let m=null;return(c?m=l.query[2]||null:u||(m=l.query[1]||null),!i&&(null==r?void 0:r.contextById))?o?(0,n.jsxs)(U.bZ,{variant:"destructive",children:[(0,n.jsx)(V.LPM,{className:"size-4"}),(0,n.jsx)(U.Cd,{children:"Error"}),(0,n.jsx)(U.X,{children:(null==o?void 0:o.message)||"Error loading item."})]}):(0,n.jsx)(J,{actions:!0,context:null==r?void 0:r.contextById,itemId:m}):(0,n.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md"}),(0,n.jsx)(P.O,{className:"w-full h-[50px] rounded-md mt-3"}),(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,n.jsx)(P.O,{className:"w-full h-[80px] rounded-md mt-3"})]})}},53245:function(e,t,s){"use strict";s.d(t,{d:function(){return x},f:function(){return h}});var n=s(57437),a=s(62869),l=s(94508),r=s(30401),i=s(78867),o=s(2265),d=s(34996),c=s(1479),u=s(9880);let m=(0,o.createContext)({code:""}),x=e=>{let{code:t,language:s,showLineNumbers:a=!1,className:r,children:i,...o}=e;return(0,n.jsx)(m.Provider,{value:{code:t},children:(0,n.jsx)("div",{className:(0,l.cn)("relative w-full overflow-hidden rounded-md border bg-background text-foreground",r),...o,children:(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(d.Z,{className:"overflow-hidden dark:hidden",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:s,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:a,style:c.Z,children:t}),(0,n.jsx)(d.Z,{className:"hidden overflow-hidden dark:block",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:s,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:a,style:u.Z,children:t}),i&&(0,n.jsx)("div",{className:"absolute top-2 right-2 flex items-center gap-2",children:i})]})})})},h=e=>{let{onCopy:t,onError:s,timeout:d=2e3,children:c,className:u,...x}=e,[h,f]=(0,o.useState)(!1),{code:p}=(0,o.useContext)(m),v=async()=>{if(!navigator.clipboard.writeText){null==s||s(Error("Clipboard API not available"));return}try{await navigator.clipboard.writeText(p),f(!0),null==t||t(),setTimeout(()=>f(!1),d)}catch(e){null==s||s(e)}},j=h?r.Z:i.Z;return(0,n.jsx)(a.z,{className:(0,l.cn)("shrink-0",u),onClick:v,size:"icon",variant:"ghost",...x,children:null!=c?c:(0,n.jsx)(j,{size:14})})}},35629:function(e,t,s){"use strict";s.d(t,{H:function(){return x}});var n=s(57437),a=s(94508),l=s(2265),r=s(86816),i=s(67245),o=s(58146),d=s(85020),c=s(53245);s(2446);let u=(0,s(86589).Z)(r.UG),m={ol:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("ol",{className:(0,a.cn)("ml-4 list-outside list-decimal",l),...r,children:s})},li:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("li",{className:(0,a.cn)("py-1",l),...r,children:s})},ul:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("ul",{className:(0,a.cn)("ml-4 list-outside list-disc",l),...r,children:s})},hr:e=>{let{node:t,className:s,...l}=e;return(0,n.jsx)("hr",{className:(0,a.cn)("my-6 border-border",s),...l})},strong:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("span",{className:(0,a.cn)("font-semibold",l),...r,children:s})},a:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("a",{className:(0,a.cn)("font-medium text-primary underline",l),rel:"noreferrer",target:"_blank",...r,children:s})},h1:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("h1",{className:(0,a.cn)("mt-6 mb-2 font-semibold text-3xl",l),...r,children:s})},h2:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("h2",{className:(0,a.cn)("mt-6 mb-2 font-semibold text-2xl",l),...r,children:s})},h3:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("h3",{className:(0,a.cn)("mt-6 mb-2 font-semibold text-xl",l),...r,children:s})},h4:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("h4",{className:(0,a.cn)("mt-6 mb-2 font-semibold text-lg",l),...r,children:s})},h5:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("h5",{className:(0,a.cn)("mt-6 mb-2 font-semibold text-base",l),...r,children:s})},h6:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("h6",{className:(0,a.cn)("mt-6 mb-2 font-semibold text-sm",l),...r,children:s})},table:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("div",{className:"my-4 overflow-x-auto",children:(0,n.jsx)("table",{className:(0,a.cn)("w-full border-collapse border border-border",l),...r,children:s})})},thead:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("thead",{className:(0,a.cn)("bg-muted/50",l),...r,children:s})},tbody:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("tbody",{className:(0,a.cn)("divide-y divide-border",l),...r,children:s})},tr:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("tr",{className:(0,a.cn)("border-border border-b",l),...r,children:s})},th:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("th",{className:(0,a.cn)("px-4 py-2 text-left font-semibold text-sm",l),...r,children:s})},td:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("td",{className:(0,a.cn)("px-4 py-2 text-sm",l),...r,children:s})},blockquote:e=>{let{node:t,children:s,className:l,...r}=e;return(0,n.jsx)("blockquote",{className:(0,a.cn)("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",l),...r,children:s})},code:e=>{var t,s;let{node:l,className:r,...i}=e;return(null==l?void 0:null===(t=l.position)||void 0===t?void 0:t.start.line)!==(null==l?void 0:null===(s=l.position)||void 0===s?void 0:s.end.line)?(0,n.jsx)("code",{className:r,...i}):(0,n.jsx)("code",{className:(0,a.cn)("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",r),...i})},pre:e=>{var t;let{node:s,className:r,children:i}=e,o="javascript";"string"==typeof(null==s?void 0:null===(t=s.properties)||void 0===t?void 0:t.className)&&(o=s.properties.className.replace("language-",""));let d="";return(0,l.isValidElement)(i)&&i.props&&"string"==typeof i.props.children?d=i.props.children:"string"==typeof i&&(d=i),(0,n.jsx)(c.d,{className:(0,a.cn)("my-4 h-auto",r),code:d,language:o,children:(0,n.jsx)(c.f,{onCopy:()=>console.log("Copied code to clipboard"),onError:()=>console.error("Failed to copy code to clipboard")})})}},x=(0,l.memo)(e=>{let{className:t,options:s,children:l,allowedImagePrefixes:r,allowedLinkPrefixes:c,defaultOrigin:x,parseIncompleteMarkdown:h=!0,...f}=e,p="string"==typeof l&&h?function(e){if(!e||"string"!=typeof e)return e;let t=e,s=t.match(/(!?\[)([^\]]*?)$/);if(s){let e=t.lastIndexOf(s[1]);t=t.substring(0,e)}if(t.match(/(\*\*)([^*]*?)$/)&&(t.match(/\*\*/g)||[]).length%2==1&&(t="".concat(t,"**")),t.match(/(__)([^_]*?)$/)&&(t.match(/__/g)||[]).length%2==1&&(t="".concat(t,"__")),t.match(/(\*)([^*]*?)$/)&&t.split("").reduce((e,s,n)=>{if("*"===s){let s=t[n-1],a=t[n+1];if("*"!==s&&"*"!==a)return e+1}return e},0)%2==1&&(t="".concat(t,"*")),t.match(/(_)([^_]*?)$/)&&t.split("").reduce((e,s,n)=>{if("_"===s){let s=t[n-1],a=t[n+1];if("_"!==s&&"_"!==a)return e+1}return e},0)%2==1&&(t="".concat(t,"_")),t.match(/(`)([^`]*?)$/)&&(t.includes("```"),(t.match(/```[\s\S]*?```/g)||[]).length,(t.match(/```/g)||[]).length%2!=1)){let e=0;for(let s=0;s<t.length;s++)if("`"===t[s]){let n="```"===t.substring(s,s+3),a=s>0&&"```"===t.substring(s-1,s+2),l=s>1&&"```"===t.substring(s-2,s+1);!(n||a||l)&&e++}e%2==1&&(t="".concat(t,"`"))}return t.match(/(~~)([^~]*?)$/)&&(t.match(/~~/g)||[]).length%2==1&&(t="".concat(t,"~~")),t}(l):l;return(0,n.jsx)("div",{className:(0,a.cn)("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",t),...f,children:(0,n.jsx)(u,{allowedImagePrefixes:null!=r?r:["*"],allowedLinkPrefixes:null!=c?c:["*"],components:m,defaultOrigin:x,rehypePlugins:[i.Z],remarkPlugins:[o.Z,d.Z],...s,children:p})})},(e,t)=>e.children===t.children);x.displayName="Response"},44045:function(e,t,s){"use strict";s.d(t,{ConfigContextProvider:function(){return l},E:function(){return a}});var n=s(57437);let a=(0,s(2265).createContext)(null);function l(e){let{children:t,config:s}=e;if(console.log("[EXULU] Config: ",s),!s)throw Error("Config not found");return(0,n.jsx)(a.Provider,{value:s,children:t})}},62910:function(e,t,s){"use strict";s.d(t,{G:function(){return f}});var n=s(57437),a=s(29406),l=s(10842),r=s(38436),i=s(2265),o=s(42571),d=s(71558),c=s(69797),u=s(49712),m=s(26110),x=s(77992),h=s(94508);function f(e){let{className:t=null,code:s,language:d,slice:c=200}=e,{toast:f}=(0,x.pm)(),[p,v]=(0,i.useState)(null),j=async(e,t)=>{v(await r.ZP.format(e,{parser:t,plugins:[a.Z,l.ZP]}))};return(0,i.useEffect)(()=>{"json"===d?j(s,"json"):"javascript"===d||"js"===d?j(s,"babel"):v(s)},[s,d]),(0,n.jsxs)(m.Vq,{children:[(0,n.jsx)(m.hg,{asChild:!0,children:(null==p?void 0:p.length)&&(0,n.jsx)(o.Z,{className:(0,h.cn)("cursor-pointer",t),showLineNumbers:!0,wrapLines:!0,lineProps:{style:{wordBreak:"break-all",whiteSpace:"pre-wrap"}},language:d||"plaintext",style:u.Z,children:"".concat(null==p?void 0:p.slice(0,c||200)," ").concat((null==s?void 0:s.length)>(c||200)?"...":"")})}),(0,n.jsx)(m.cZ,{className:"sm:max-w-[800px] overflow-hidden max-h-[500px] overflow-y-scroll",children:(0,n.jsxs)(m.fK,{children:[(0,n.jsx)(m.$N,{children:"Code"}),(0,n.jsx)("div",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(null!=p?p:""),f({title:"Copied to clipboard"})},children:(0,n.jsx)(o.Z,{className:(0,h.cn)(t),showLineNumbers:!0,wrapLines:!0,lineProps:{style:{wordBreak:"break-all",whiteSpace:"pre-wrap"}},language:d||"plaintext",style:u.Z,children:null!=p?p:""})})]})})]})}o.Z.registerLanguage("json",c.Z),o.Z.registerLanguage("javascript",d.Z)},68656:function(e,t,s){"use strict";s.d(t,{J:function(){return p}});var n=s(57437);s(2265);var a=s(26110),l=s(77992),r=s(35629),i=s(62869),o=s(81103),d=s(94508);let c=e=>{let{className:t,...s}=e;return(0,n.jsx)("div",{className:(0,d.cn)("flex flex-col overflow-hidden rounded-lg border bg-background shadow-sm",t),...s})},u=e=>{let{className:t,...s}=e;return(0,n.jsx)("div",{className:(0,d.cn)("flex items-center justify-between border-b bg-muted/50 px-4 py-3",t),...s})},m=e=>{let{className:t,...s}=e;return(0,n.jsx)("div",{className:(0,d.cn)("flex items-center gap-1",t),...s})},x=e=>{let{tooltip:t,label:s,icon:a,children:l,className:r,size:c="sm",variant:u="ghost",...m}=e,x=(0,n.jsxs)(i.z,{className:(0,d.cn)("size-8 p-0 text-muted-foreground hover:text-foreground",r),size:c,type:"button",variant:u,...m,children:[a?(0,n.jsx)(a,{className:"size-4"}):l,(0,n.jsx)("span",{className:"sr-only",children:s||t})]});return t?(0,n.jsx)(o.pn,{children:(0,n.jsxs)(o.u,{children:[(0,n.jsx)(o.aJ,{asChild:!0,children:x}),(0,n.jsx)(o._v,{children:(0,n.jsx)("p",{children:t})})]})}):x},h=e=>{let{className:t,...s}=e;return(0,n.jsx)("div",{className:(0,d.cn)("flex-1 overflow-auto p-4",t),...s})};var f=s(78867);function p(e){let{text:t,sliceLength:s}=e,{toast:i}=(0,l.pm)();return(0,n.jsxs)(a.Vq,{children:[(0,n.jsx)(a.hg,{asChild:!0,children:(0,n.jsxs)("p",{className:"cursor-pointer text-sm text-base",children:[null==t?void 0:t.slice(0,null!=s?s:200),s&&t.length>s?"...":""]})}),(0,n.jsx)(a.cZ,{className:"sm:max-w-[800px] max-h-[500px] overflow-y-scroll",children:(0,n.jsxs)(c,{children:[(0,n.jsx)(u,{children:(0,n.jsx)(m,{children:(0,n.jsx)(x,{icon:f.Z,label:"Copy",tooltip:"Copy to clipboard",onClick:async()=>{await navigator.clipboard.writeText(t),i({title:"Copied to clipboard"})}})})}),(0,n.jsx)(h,{children:(0,n.jsx)(r.H,{children:t})})]})})]})}},21409:function(e,t,s){"use strict";s.d(t,{z:function(){return v}});var n=s(57437),a=s(2265),l=s(20653),r=s(31303),i=s(59121),o=s(27107),d=s(94508),c=s(62869),u=s(92451),m=s(10407),x=s(98235);function h(e){let{className:t,classNames:s,showOutsideDays:a=!0,...l}=e;return(0,n.jsx)(x._W,{showOutsideDays:a,className:(0,d.cn)("p-3",t),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:(0,d.cn)((0,c.d)({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:(0,d.cn)((0,c.d)({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...s},components:{IconLeft:e=>{let{...t}=e;return(0,n.jsx)(u.Z,{className:"size-4"})},IconRight:e=>{let{...t}=e;return(0,n.jsx)(m.Z,{className:"size-4"})}},...l})}h.displayName="Calendar";var f=s(77992),p=s(57054);function v(e){let{dateRange:t,onDateRangeChange:s,className:u,maxDays:m=30}=e,{toast:x}=(0,f.pm)(),v=a.useMemo(()=>{if(!(null==t?void 0:t.from))return[];let e=t.from;return[{before:(0,i.E)(e,-m)},{after:(0,i.E)(e,m)}]},[null==t?void 0:t.from,m]);return(0,n.jsx)("div",{className:(0,d.cn)("grid gap-2",u),children:(0,n.jsxs)(p.J2,{children:[(0,n.jsx)(p.xo,{asChild:!0,children:(0,n.jsxs)(c.z,{id:"date",variant:"outline",className:(0,d.cn)("w-[260px] justify-start text-left font-normal",!t&&"text-muted-foreground"),children:[(0,n.jsx)(l.Que,{className:"mr-2 h-4 w-4"}),(null==t?void 0:t.from)?t.to?(0,n.jsxs)(n.Fragment,{children:[(0,o.WU)(t.from,"LLL dd, y")," -"," ",(0,o.WU)(t.to,"LLL dd, y")]}):(0,o.WU)(t.from,"LLL dd, y"):(0,n.jsx)("span",{children:"Pick a date range"})]})}),(0,n.jsxs)(p.yk,{className:"w-auto p-0",align:"end",children:[(0,n.jsx)(h,{initialFocus:!0,mode:"range",defaultMonth:null==t?void 0:t.from,selected:t,onSelect:e=>{if((null==e?void 0:e.from)&&(null==e?void 0:e.to)&&(0,r.j)(e.to,e.from)>m){x({title:"Date range too large",description:"Please select a date range of ".concat(m," days or less."),variant:"destructive"});return}s(e)},disabled:v,numberOfMonths:2}),(0,n.jsxs)("div",{className:"p-3 pt-0 text-xs text-muted-foreground border-t",children:["Maximum range: ",m," days"]})]})]})})}},73450:function(e,t,s){"use strict";s.d(t,{Y:function(){return h}});var n=s(57437),a=s(2265),l=s(7211),r=s(53647),i=s(93022),o=s(27689),d=s(75169),c=s(3574),u=s(20407),m=s(57969);let x=["hsl(var(--chart-1))","hsl(var(--chart-2))","hsl(var(--chart-3))","hsl(var(--chart-4))","hsl(var(--chart-5))","hsl(var(--chart-6))","hsl(var(--chart-7))","hsl(var(--chart-8))","hsl(var(--chart-9))","hsl(var(--chart-10))"];function h(e){var t,s;let{groupByOptions:h,dateRange:f,selectedType:p,groupBy:v,onGroupByChange:j}=e,{data:g,loading:y,error:b}=(0,l.aM)(o.YH,{variables:{type:p,groupBy:v,from:null==f?void 0:null===(t=f.from)||void 0===t?void 0:t.toISOString(),to:null==f?void 0:null===(s=f.to)||void 0===s?void 0:s.toISOString()},skip:!(null==f?void 0:f.from)||!(null==f?void 0:f.to)}),{chartData:N,chartConfig:w}=a.useMemo(()=>{if(!(null==g?void 0:g.trackingStatistics))return{chartData:[],chartConfig:{}};let e=g.trackingStatistics.map((e,t)=>{var s;return{name:(s=e.group)?s.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "):"Unknown",value:e.count,fill:x[t%x.length]}}).sort((e,t)=>t.value-e.value),t=e.reduce((e,t,s)=>(e[t.name]={label:t.name,color:x[s%x.length]},e),{});return{chartData:e,chartConfig:t}},[g]);return(0,n.jsxs)("div",{className:"flex flex-col h-full",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,n.jsx)("h3",{className:"text-xl font-semibold",children:"Distribution"}),h.length>0&&(0,n.jsx)("div",{className:"w-full max-w-[150px]",children:(0,n.jsxs)(r.Ph,{value:v,onValueChange:j,children:[(0,n.jsx)(r.i4,{children:(0,n.jsx)(r.ki,{placeholder:"Group by"})}),(0,n.jsx)(r.Bw,{children:h.map(e=>(0,n.jsx)(r.Ql,{value:e.value,children:e.label},e.value))})]})})]}),(0,n.jsx)("div",{className:"flex-1 min-h-0",children:y?(0,n.jsx)("div",{className:"space-y-4 h-full",children:(0,n.jsx)(i.O,{className:"h-full w-full"})}):b?(0,n.jsxs)("div",{className:"flex items-center justify-center h-full text-red-500",children:["Error loading distribution data: ",b.message]}):0===N.length?(0,n.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-center",children:"No data available for the selected date range, type, and grouping."}):(0,n.jsx)(m.BO,{config:w,className:"h-full w-full",children:(0,n.jsxs)(d.u,{children:[(0,n.jsx)("defs",{children:N.map((e,t)=>(0,n.jsxs)("radialGradient",{id:"gradient-".concat(e.name.replace(/\s+/g,"-")),cx:"50%",cy:"50%",r:"50%",children:[(0,n.jsx)("stop",{offset:"0%",stopColor:e.fill,stopOpacity:1}),(0,n.jsx)("stop",{offset:"100%",stopColor:e.fill,stopOpacity:.8})]},"gradient-".concat(t)))}),(0,n.jsx)(c.b,{data:N,cx:"50%",cy:"50%",labelLine:!1,label:e=>{let{cx:t,cy:s,midAngle:a,innerRadius:l,outerRadius:r,percent:i,index:o}=e;if(i<.05)return null;let d=Math.PI/180,c=l+(r-l)*.5,u=t+c*Math.cos(-a*d);return(0,n.jsx)("text",{x:u,y:s+c*Math.sin(-a*d),fill:"black",textAnchor:u>t?"start":"end",dominantBaseline:"central",fontSize:"12",fontWeight:"600",paintOrder:"stroke",children:"".concat((100*i).toFixed(0),"%")})},outerRadius:"75%",innerRadius:"45%",dataKey:"value",strokeWidth:3,children:N.map((e,t)=>(0,n.jsx)(u.b,{fill:"url(#gradient-".concat(e.name.replace(/\s+/g,"-"),")")},"cell-".concat(t)))}),(0,n.jsx)(m.h7,{content:(0,n.jsx)(m.dg,{nameKey:"name",hideLabel:!0,formatter:(e,t)=>["number"==typeof e?e.toLocaleString():e," "+String(t)]})})]})})})]})}},52896:function(e,t,s){"use strict";s.d(t,{q:function(){return y}});var n=s(57437),a=s(2265),l=s(7211),r=s(53647),i=s(93022),o=s(27689),d=s(5481),c=s(56940),u=s(97059),m=s(62994),x=s(23263),h=s(57969),f=s(27107),p=s(56942),v=s(54886);function j(e){return e.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}let g={count:{label:"Count",color:"hsl(var(--muted-foreground))"}};function y(e){var t,s;let{dataTypes:y,dateRange:b,selectedType:N,onTypeChange:w,onUnitChange:k,unit:C}=e,{data:E,loading:_,error:z}=(0,l.aM)(o.j9,{variables:{type:N,name:C,from:null==b?void 0:null===(t=b.from)||void 0===t?void 0:t.toISOString(),to:null==b?void 0:null===(s=b.to)||void 0===s?void 0:s.toISOString()},skip:!(null==b?void 0:b.from)||!(null==b?void 0:b.to)}),T=a.useMemo(()=>{if(!(null==E?void 0:E.trackingStatistics)||!(null==b?void 0:b.from)||!(null==b?void 0:b.to))return[];let e=new Map;return E.trackingStatistics.forEach(t=>{let s=new Date("number"==typeof t.group?t.group:Number(t.group)),n=(0,f.WU)((0,p.b)(s),"yyyy-MM-dd");e.set(n,t.count)}),(0,v.D)({start:(0,p.b)(b.from),end:(0,p.b)(b.to)}).map(t=>{let s=(0,f.WU)(t,"yyyy-MM-dd"),n=e.get(s)||0;return{date:t.getTime(),count:n,formattedDate:(0,f.WU)(t,"MMM dd"),dateObj:t}})},[E,b]);return(0,n.jsxs)("div",{className:"flex flex-col h-full",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,n.jsx)("h3",{className:"text-xl font-semibold",children:"Time Series Analytics"}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("div",{className:"w-[150px]",children:(0,n.jsxs)(r.Ph,{value:N,onValueChange:e=>w(e),children:[(0,n.jsx)(r.i4,{children:(0,n.jsx)(r.ki,{placeholder:"Select data type"})}),(0,n.jsx)(r.Bw,{children:null==y?void 0:y.map(e=>(0,n.jsx)(r.Ql,{value:e,children:j(e)+" "},e))})]})}),(0,n.jsx)("div",{className:"w-[150px]",children:(0,n.jsxs)(r.Ph,{value:C,onValueChange:e=>k(e),children:[(0,n.jsx)(r.i4,{children:(0,n.jsx)(r.ki,{placeholder:"Select unit"})}),(0,n.jsxs)(r.Bw,{children:[(0,n.jsx)(r.Ql,{value:"count",children:"Count"}),(0,n.jsx)(r.Ql,{value:"tokens",children:"Tokens"})]})]})})]})]}),(0,n.jsx)("div",{className:"flex-1 min-h-0",children:_?(0,n.jsx)("div",{className:"space-y-4 h-full",children:(0,n.jsx)(i.O,{className:"h-full w-full"})}):z?(0,n.jsxs)("div",{className:"flex items-center justify-center h-full text-red-500",children:["Error loading time series data: ",z.message]}):0===T.length?(0,n.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"No data available for the selected date range and type"}):(0,n.jsx)(h.BO,{config:g,className:"h-full w-full",children:(0,n.jsxs)(d.T,{data:T,children:[(0,n.jsxs)("defs",{children:[(0,n.jsxs)("linearGradient",{id:"fillCount",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,n.jsx)("stop",{offset:"5%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.3}),(0,n.jsx)("stop",{offset:"95%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.05})]}),(0,n.jsxs)("linearGradient",{id:"strokeCount",x1:"0",y1:"0",x2:"1",y2:"0",children:[(0,n.jsx)("stop",{offset:"0%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.8}),(0,n.jsx)("stop",{offset:"100%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.6})]})]}),(0,n.jsx)(c.q,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground))",strokeOpacity:.3,vertical:!1}),(0,n.jsx)(u.K,{dataKey:"formattedDate",tick:{fontSize:12,fill:"hsl(var(--muted-foreground))"},tickLine:{stroke:"hsl(var(--muted-foreground))",strokeOpacity:.5},axisLine:{stroke:"hsl(var(--muted-foreground))",strokeOpacity:.5}}),(0,n.jsx)(m.B,{tick:{fontSize:12,fill:"hsl(var(--muted-foreground))"},tickLine:{stroke:"hsl(var(--muted-foreground))",strokeOpacity:.5},axisLine:{stroke:"hsl(var(--muted-foreground))",strokeOpacity:.5}}),(0,n.jsx)(h.h7,{labelFormatter:(e,t)=>t&&t[0]?(0,f.WU)(t[0].payload.dateObj,"PPP")+" ":e,content:(0,n.jsx)(h.dg,{nameKey:"name",hideLabel:!0,formatter:(e,t)=>["number"==typeof e?e.toLocaleString():e," "+String(t)]})}),(0,n.jsx)(h.Qk,{content:(0,n.jsx)(h.cD,{})}),(0,n.jsx)(x.u,{type:"monotone",dataKey:"count",stroke:"url(#strokeCount)",strokeWidth:3,fill:"url(#fillCount)",fillOpacity:.6,dot:{fill:"hsl(var(--muted-foreground))",strokeWidth:2,r:4,strokeOpacity:.8},activeDot:{r:6,strokeWidth:2,fill:"hsl(var(--background))",stroke:"hsl(var(--muted-foreground))",strokeOpacity:1},name:j(N)})]})})})]})}},37091:function(e,t,s){"use strict";s.d(t,{L:function(){return a}});var n=s(57437);function a(e){let{text:t,length:s}=e;return t.length>s?(0,n.jsxs)(n.Fragment,{children:[t.slice(0,s),"..."]}):(0,n.jsx)(n.Fragment,{children:t})}},37099:function(e,t,s){"use strict";s.d(t,{OL:function(){return p},_T:function(){return u},aR:function(){return o},f$:function(){return h},fY:function(){return m},le:function(){return v},xo:function(){return x},yT:function(){return f}});var n=s(57437),a=s(23619),l=s(2265),r=s(62869),i=s(94508);let o=a.fC;a.xz;let d=a.h_,c=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,n.jsx)(a.aV,{className:(0,i.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...l,ref:t})});c.displayName=a.aV.displayName;let u=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,n.jsxs)(d,{children:[(0,n.jsx)(c,{}),(0,n.jsx)(a.VY,{ref:t,className:(0,i.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",s),...l})]})});u.displayName=a.VY.displayName;let m=e=>{let{className:t,...s}=e;return(0,n.jsx)("div",{className:(0,i.cn)("flex flex-col space-y-2 text-center sm:text-left",t),...s})};m.displayName="AlertDialogHeader";let x=e=>{let{className:t,...s}=e;return(0,n.jsx)("div",{className:(0,i.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s})};x.displayName="AlertDialogFooter";let h=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,n.jsx)(a.Dx,{ref:t,className:(0,i.cn)("text-lg font-semibold",s),...l})});h.displayName=a.Dx.displayName;let f=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,n.jsx)(a.dk,{ref:t,className:(0,i.cn)("text-sm text-muted-foreground",s),...l})});f.displayName=a.dk.displayName;let p=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,n.jsx)(a.aU,{ref:t,className:(0,i.cn)((0,r.d)(),s),...l})});p.displayName=a.aU.displayName;let v=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,n.jsx)(a.$j,{ref:t,className:(0,i.cn)((0,r.d)({variant:"outline"}),"mt-2 sm:mt-0",s),...l})});v.displayName=a.$j.displayName},65613:function(e,t,s){"use strict";s.d(t,{Cd:function(){return d},X:function(){return c},bZ:function(){return o}});var n=s(57437),a=s(90535),l=s(2265),r=s(94508);let i=(0,a.j)("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",info:"border-info/50 text-info dark:border-info [&>svg]:text-info"}},defaultVariants:{variant:"default"}}),o=l.forwardRef((e,t)=>{let{className:s,variant:a,...l}=e;return(0,n.jsx)("div",{ref:t,role:"alert",className:(0,r.cn)(i({variant:a}),s),...l})});o.displayName="Alert";let d=l.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)("h5",{ref:t,className:(0,r.cn)("mb-1 font-medium leading-none tracking-tight",s),...a})});d.displayName="AlertTitle";let c=l.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)("div",{ref:t,className:(0,r.cn)("text-sm [&_p]:leading-relaxed",s),...a})});c.displayName="AlertDescription"},57969:function(e,t,s){"use strict";s.d(t,{BO:function(){return m},Qk:function(){return p},cD:function(){return v},dg:function(){return f},h7:function(){return h}});var n=s(57437),a=s(2265),l=s(47625),r=s(8147),i=s(22190),o=s(94508);let d={light:"",dark:".dark"},c=a.createContext(null);function u(){let e=a.useContext(c);if(!e)throw Error("useChart must be used within a <ChartContainer />");return e}let m=a.forwardRef((e,t)=>{let{id:s,className:r,children:i,config:d,...u}=e,m=a.useId(),h="chart-".concat(s||m.replace(/:/g,""));return(0,n.jsx)(c.Provider,{value:{config:d},children:(0,n.jsxs)("div",{"data-chart":h,ref:t,className:(0,o.cn)("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",r),...u,children:[(0,n.jsx)(x,{id:h,config:d}),(0,n.jsx)(l.h,{children:i})]})})});m.displayName="Chart";let x=e=>{let{id:t,config:s}=e,a=Object.entries(s).filter(e=>{let[,t]=e;return t.theme||t.color});return a.length?(0,n.jsx)("style",{dangerouslySetInnerHTML:{__html:Object.entries(d).map(e=>{let[s,n]=e;return"\n".concat(n," [data-chart=").concat(t,"] {\n").concat(a.map(e=>{var t;let[n,a]=e,l=(null===(t=a.theme)||void 0===t?void 0:t[s])||a.color;return l?" --color-".concat(n,": ").concat(l,";"):null}).join("\n"),"\n}\n")}).join("\n")}}):null},h=r.u,f=a.forwardRef((e,t)=>{let{active:s,payload:l,className:r,indicator:i="dot",hideLabel:d=!1,hideIndicator:c=!1,label:m,labelFormatter:x,labelClassName:h,formatter:f,color:p,nameKey:v,labelKey:g}=e,{config:y}=u(),b=a.useMemo(()=>{var e;if(d||!(null==l?void 0:l.length))return null;let[t]=l,s="".concat(g||(null==t?void 0:t.dataKey)||(null==t?void 0:t.name)||"value"),a=j(y,t,s),r=g||"string"!=typeof m?null==a?void 0:a.label:(null===(e=y[m])||void 0===e?void 0:e.label)||m;return x?(0,n.jsx)("div",{className:(0,o.cn)("font-medium",h),children:x(r,l)}):r?(0,n.jsx)("div",{className:(0,o.cn)("font-medium",h),children:r}):null},[m,x,l,d,h,y,g]);if(!s||!(null==l?void 0:l.length))return null;let N=1===l.length&&"dot"!==i;return(0,n.jsxs)("div",{ref:t,className:(0,o.cn)("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",r),children:[N?null:b,(0,n.jsx)("div",{className:"grid gap-1.5",children:l.map((e,t)=>{let s="".concat(v||e.name||e.dataKey||"value"),a=j(y,e,s),l=p||e.payload.fill||e.color;return(0,n.jsx)("div",{className:(0,o.cn)("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground","dot"===i&&"items-center"),children:f&&(null==e?void 0:e.value)!==void 0&&e.name?f(e.value,e.name,e,t,e.payload):(0,n.jsxs)(n.Fragment,{children:[(null==a?void 0:a.icon)?(0,n.jsx)(a.icon,{}):!c&&(0,n.jsx)("div",{className:(0,o.cn)("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":"dot"===i,"w-1":"line"===i,"w-0 border-[1.5px] border-dashed bg-transparent":"dashed"===i,"my-0.5":N&&"dashed"===i}),style:{"--color-bg":l,"--color-border":l}}),(0,n.jsxs)("div",{className:(0,o.cn)("flex flex-1 justify-between leading-none",N?"items-end":"items-center"),children:[(0,n.jsxs)("div",{className:"grid gap-1.5",children:[N?b:null,(0,n.jsx)("span",{className:"text-muted-foreground",children:(null==a?void 0:a.label)||e.name})]}),e.value&&(0,n.jsx)("span",{className:"font-mono font-medium tabular-nums text-foreground",children:e.value.toLocaleString()})]})]})},e.dataKey)})})]})});f.displayName="ChartTooltip";let p=i.D,v=a.forwardRef((e,t)=>{let{className:s,hideIcon:a=!1,payload:l,verticalAlign:r="bottom",nameKey:i}=e,{config:d}=u();return(null==l?void 0:l.length)?(0,n.jsx)("div",{ref:t,className:(0,o.cn)("flex items-center justify-center gap-4","top"===r?"pb-3":"pt-3",s),children:l.map(e=>{let t="".concat(i||e.dataKey||"value"),s=j(d,e,t);return(0,n.jsxs)("div",{className:(0,o.cn)("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[(null==s?void 0:s.icon)&&!a?(0,n.jsx)(s.icon,{}):(0,n.jsx)("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:e.color}}),null==s?void 0:s.label]},e.value)})}):null});function j(e,t,s){if("object"!=typeof t||null===t)return;let n="payload"in t&&"object"==typeof t.payload&&null!==t.payload?t.payload:void 0,a=s;return s in t&&"string"==typeof t[s]?a=t[s]:n&&s in n&&"string"==typeof n[s]&&(a=n[s]),a in e?e[a]:e[s]}v.displayName="ChartLegend"},74928:function(e,t,s){"use strict";s.d(t,{Fw:function(){return r},wy:function(){return l},zF:function(){return a}});var n=s(88985);let a=n.fC,l=n.wy,r=n.Fw},84190:function(e,t,s){"use strict";s.d(t,{$F:function(){return u},AW:function(){return m},Ju:function(){return f},VD:function(){return p},Xi:function(){return x},bO:function(){return h},h_:function(){return c}});var n=s(57437),a=s(70085),l=s(10407),r=s(30401),i=s(40519),o=s(2265),d=s(94508);let c=a.fC,u=a.xz;a.ZA,a.Uv,a.Tr,a.Ee,o.forwardRef((e,t)=>{let{className:s,inset:r,children:i,...o}=e;return(0,n.jsxs)(a.fF,{ref:t,className:(0,d.cn)("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",r&&"pl-8",s),...o,children:[i,(0,n.jsx)(l.Z,{className:"ml-auto size-4"})]})}).displayName=a.fF.displayName,o.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,n.jsx)(a.tu,{ref:t,className:(0,d.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...l})}).displayName=a.tu.displayName;let m=o.forwardRef((e,t)=>{let{className:s,sideOffset:l=4,...r}=e;return(0,n.jsx)(a.Uv,{children:(0,n.jsx)(a.VY,{ref:t,sideOffset:l,className:(0,d.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...r})})});m.displayName=a.VY.displayName;let x=o.forwardRef((e,t)=>{let{className:s,inset:l,...r}=e;return(0,n.jsx)(a.ck,{ref:t,className:(0,d.cn)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",l&&"pl-8",s),...r})});x.displayName=a.ck.displayName;let h=o.forwardRef((e,t)=>{let{className:s,children:l,checked:i,...o}=e;return(0,n.jsxs)(a.oC,{ref:t,className:(0,d.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),checked:i,...o,children:[(0,n.jsx)("span",{className:"absolute left-2 flex size-3.5 items-center justify-center",children:(0,n.jsx)(a.wU,{children:(0,n.jsx)(r.Z,{className:"size-4"})})}),l]})});h.displayName=a.oC.displayName,o.forwardRef((e,t)=>{let{className:s,children:l,...r}=e;return(0,n.jsxs)(a.Rk,{ref:t,className:(0,d.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...r,children:[(0,n.jsx)("span",{className:"absolute left-2 flex size-3.5 items-center justify-center",children:(0,n.jsx)(a.wU,{children:(0,n.jsx)(i.Z,{className:"size-2 fill-current"})})}),l]})}).displayName=a.Rk.displayName;let f=o.forwardRef((e,t)=>{let{className:s,inset:l,...r}=e;return(0,n.jsx)(a.__,{ref:t,className:(0,d.cn)("px-2 py-1.5 text-sm font-semibold",l&&"pl-8",s),...r})});f.displayName=a.__.displayName;let p=o.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,n.jsx)(a.Z0,{ref:t,className:(0,d.cn)("-mx-1 my-1 h-px bg-muted",s),...l})});p.displayName=a.Z0.displayName},15681:function(e,t,s){"use strict";s.d(t,{NI:function(){return p},Wi:function(){return u},l0:function(){return d},lX:function(){return f},pf:function(){return v},xJ:function(){return h},zG:function(){return j}});var n=s(57437),a=s(37053),l=s(2265),r=s(29501),i=s(26815),o=s(94508);let d=r.RV,c=l.createContext({}),u=e=>{let{...t}=e;return(0,n.jsx)(c.Provider,{value:{name:t.name},children:(0,n.jsx)(r.Qr,{...t})})},m=()=>{let e=l.useContext(c),t=l.useContext(x),{getFieldState:s,formState:n}=(0,r.Gc)(),a=s(e.name,n);if(!e)throw Error("useFormField should be used within <FormField>");let{id:i}=t;return{id:i,name:e.name,formItemId:"".concat(i,"-form-item"),formDescriptionId:"".concat(i,"-form-item-description"),formMessageId:"".concat(i,"-form-item-message"),...a}},x=l.createContext({}),h=l.forwardRef((e,t)=>{let{className:s,...a}=e,r=l.useId();return(0,n.jsx)(x.Provider,{value:{id:r},children:(0,n.jsx)("div",{ref:t,className:(0,o.cn)("space-y-2",s),...a})})});h.displayName="FormItem";let f=l.forwardRef((e,t)=>{let{className:s,...a}=e,{error:l,formItemId:r}=m();return(0,n.jsx)(i._,{ref:t,className:(0,o.cn)(l&&"text-destructive",s),htmlFor:r,...a})});f.displayName="FormLabel";let p=l.forwardRef((e,t)=>{let{...s}=e,{error:l,formItemId:r,formDescriptionId:i,formMessageId:o}=m();return(0,n.jsx)(a.g7,{ref:t,id:r,"aria-describedby":l?"".concat(i," ").concat(o):"".concat(i),"aria-invalid":!!l,...s})});p.displayName="FormControl";let v=l.forwardRef((e,t)=>{let{className:s,...a}=e,{formDescriptionId:l}=m();return(0,n.jsx)("p",{ref:t,id:l,className:(0,o.cn)("text-sm text-muted-foreground",s),...a})});v.displayName="FormDescription";let j=l.forwardRef((e,t)=>{let{className:s,children:a,...l}=e,{error:r,formMessageId:i}=m(),d=r?String(null==r?void 0:r.message):a;return d?(0,n.jsx)("p",{ref:t,id:i,className:(0,o.cn)("text-sm font-medium text-destructive",s),...l,children:d}):null});j.displayName="FormMessage"},95186:function(e,t,s){"use strict";s.d(t,{I:function(){return r}});var n=s(57437),a=s(2265),l=s(94508);let r=a.forwardRef((e,t)=>{let{className:s,type:a,...r}=e;return(0,n.jsx)("input",{type:a,className:(0,l.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",s),ref:t,...r})});r.displayName="Input"},6512:function(e,t,s){"use strict";s.d(t,{Z:function(){return i}});var n=s(57437),a=s(55156),l=s(2265),r=s(94508);let i=l.forwardRef((e,t)=>{let{className:s,orientation:l="horizontal",decorative:i=!0,...o}=e;return(0,n.jsx)(a.f,{ref:t,decorative:i,orientation:l,className:(0,r.cn)("shrink-0 bg-border","horizontal"===l?"h-[1px] w-full":"h-full w-[1px]",s),...o})});i.displayName=a.f.displayName},93022:function(e,t,s){"use strict";s.d(t,{O:function(){return l}});var n=s(57437),a=s(94508);function l(e){let{className:t,...s}=e;return(0,n.jsx)("div",{className:(0,a.cn)("animate-pulse rounded-md bg-muted",t),...s})}},1828:function(e,t,s){"use strict";s.d(t,{r:function(){return i}});var n=s(57437),a=s(50721),l=s(2265),r=s(94508);let i=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,n.jsx)(a.fC,{className:(0,r.cn)("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",s),...l,ref:t,children:(0,n.jsx)(a.bU,{className:(0,r.cn)("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})})});i.displayName=a.fC.displayName},73578:function(e,t,s){"use strict";s.d(t,{RM:function(){return o},Rn:function(){return m},SC:function(){return d},iA:function(){return r},pj:function(){return u},ss:function(){return c},xD:function(){return i}});var n=s(57437),a=s(2265),l=s(94508);let r=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)("div",{className:"relative w-full overflow-auto",children:(0,n.jsx)("table",{ref:t,className:(0,l.cn)("w-full caption-bottom text-sm",s),...a})})});r.displayName="Table";let i=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)("thead",{ref:t,className:(0,l.cn)("[&_tr]:border-b",s),...a})});i.displayName="TableHeader";let o=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)("tbody",{ref:t,className:(0,l.cn)("[&_tr:last-child]:border-0",s),...a})});o.displayName="TableBody",a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)("tfoot",{ref:t,className:(0,l.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...a})}).displayName="TableFooter";let d=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)("tr",{ref:t,className:(0,l.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...a})});d.displayName="TableRow";let c=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)("th",{ref:t,className:(0,l.cn)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&:has([role=checkbox])]:w-[40px]",s),...a})});c.displayName="TableHead";let u=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)("td",{ref:t,className:(0,l.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0 [&:has([role=checkbox])]:w-[40px]",s),...a})});u.displayName="TableCell";let m=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)("caption",{ref:t,className:(0,l.cn)("mt-4 text-sm text-muted-foreground",s),...a})});m.displayName="TableCaption"},81103:function(e,t,s){"use strict";s.d(t,{_v:function(){return c},aJ:function(){return d},pn:function(){return i},u:function(){return o}});var n=s(57437),a=s(4957),l=s(2265),r=s(94508);let i=a.zt,o=a.fC,d=a.xz,c=l.forwardRef((e,t)=>{let{className:s,sideOffset:l=4,...i}=e;return(0,n.jsx)(a.VY,{ref:t,sideOffset:l,className:(0,r.cn)("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...i})});c.displayName=a.VY.displayName},78361:function(e,t,s){"use strict";s.d(t,{jF:function(){return D},jU:function(){return M},ZP:function(){return Z},NF:function(){return A}});var n=s(57437),a=s(2265),l=s(47632),r=s(1109);s(46693),s(51832);var i=s(6374),o=s(44045);let d=async e=>{var t;if(!e.backend)throw Error("No backend set.");let{callbacks:s,maxNumberOfFiles:n,uppyOptions:a}=e||{},{uploadSuccess:o}=s||{},{allowedFileTypes:d,id:c}=a||{},u=await (0,i.LP)(),m=new l.Z({autoProceed:!0,debug:!1,id:c||"uppy",restrictions:{maxNumberOfFiles:n||5,allowedFileTypes:d||[".heic",".jpg",".jpeg",".png",".webp",".svg"]}}).use(r.Z,{id:"Exulu",endpoint:e.backend,headers:{Authorization:"Bearer ".concat(u),Session:null!==(t=localStorage.getItem("session"))&&void 0!==t?t:""}}).on("file-added",async e=>{console.debug("added",e)}).on("upload-error",(e,t)=>{(null==e?void 0:e.id)&&(m.removeFile(null==e?void 0:e.id),console.error("error",t))}).on("upload-success",(e,t)=>{t.uploadURL&&o&&(console.log("response",t),o({file:e,key:t.uploadURL.split("/").pop()||"",url:t.uploadURL}))});return m};var c=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],s=(0,a.useContext)(o.E),[n,l]=(0,a.useState)(void 0);return(0,a.useEffect)(()=>((async()=>{l(await d({...e,backend:(null==s?void 0:s.backend)||""}))})(),()=>{n&&(n.destroy(),l(void 0))}),[...t]),n},u=s(80007),m=s(92735),x=s(88964),h=s(30044),f=s(92451),p=s(10407),v=s(48736),j=s(53113),g=s(69658),y=s(99397),b=s(32489),N=s(15001),w=s(62869),k=s(26110),C=s(19378),E=s(78298),_=s(11713),z=s(21770),T=s(95186),S=s(20653),O=s(66070),R=s(93022);function D(e){let{s3key:t,children:s}=e,{data:l,isLoading:r,error:o,refetch:d}=(0,_.a)({queryKey:["fileObject",t],queryFn:async()=>t?await i.QZ.object(t):null,enabled:null!=t});return((0,a.useEffect)(()=>{t&&d()},[t]),t)?(0,n.jsxs)(O.Zb,{children:[(0,n.jsx)(O.Ol,{className:"pb-3",children:(0,n.jsx)(O.ll,{className:"text-sm truncate",children:t.split("_EXULU_").pop()})}),(0,n.jsxs)(O.aY,{className:"pt-0",children:[r&&(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(R.O,{className:"h-4 w-full"}),(0,n.jsx)(R.O,{className:"h-4 w-2/3"})]}),!r&&l&&(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[(0,n.jsx)("span",{className:"capitalize",children:null==l?void 0:l.ContentType.split("/").pop()}),(0,n.jsxs)("span",{children:[((null==l?void 0:l.ContentLength)/1024/1024).toFixed(2)," MB"]})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[(0,n.jsxs)("span",{children:["Last modified: ",new Date(null==l?void 0:l.LastModified).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"})]}),(0,n.jsxs)(w.z,{variant:"secondary",size:"sm",type:"button",className:"h-7 px-2",onClick:()=>{i.QZ.download(t).then(async e=>{console.log("res",e);let t=await e.json();console.log("res",t);let s=t.url;window.open(s,"_blank")})},children:[(0,n.jsx)("span",{className:"mr-1 text-xs",children:"View"}),(0,n.jsx)(m.Z,{className:"h-3 w-3"})]})]})]}),!r&&o&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:o.message}),s]})]}):(0,n.jsx)(O.Zb,{children:(0,n.jsxs)(O.aY,{className:"p-3 flex",children:[(0,n.jsx)("p",{className:"text-sm text-muted-foreground m-auto",children:"No file selected"}),s]})})}function Z(e){let{id:t,allowedFileTypes:s,dependencies:l,onConfirm:r,selectionLimit:i,buttonText:o}=e,[d,c]=(0,a.useState)(!1);return(0,n.jsxs)(k.Vq,{open:d,onOpenChange:c,children:[(0,n.jsx)(k.hg,{asChild:!0,children:(0,n.jsxs)(w.z,{variant:"outline",children:[o&&(0,n.jsx)("span",{className:"mr-2",children:o}),(0,n.jsx)(x.Z,{className:"h-4 w-4"})]})}),(0,n.jsxs)(k.cZ,{className:"sm:max-w-[900px]",children:[(0,n.jsxs)(k.fK,{children:[(0,n.jsx)(k.$N,{children:"File Gallery"}),(0,n.jsx)(k.Be,{children:"Browse your previously uploaded files or upload new ones."})]}),(0,n.jsx)(L,{id:t,allowedFileTypes:s,dependencies:l,selectionLimit:i,onConfirm:e=>{r(e),c(!1)}})]})]})}let L=e=>{var t,s;let{id:l,allowedFileTypes:r,dependencies:d,onConfirm:m,selectionLimit:x}=e;r||(r=[".png",".jpg",".jpeg",".gif",".webp",".pdf",".docx",".xlsx",".xls",".csv",".pptx",".ppt",".mp3",".wav",".m4a",".mp4",".mpeg",".mp4",".m4a",".mp3",".mpeg",".wav"]);let[v,j]=(0,a.useState)(void 0),[g,y]=(0,a.useState)(void 0),[b,N]=(0,a.useState)(void 0),k=(0,a.useContext)(o.E),[O,D]=(0,a.useState)([]),Z=e=>{if(O.includes(e)){D(O.filter(t=>t!==e));return}if(1===x){D([e]);return}O.length>=x||D([...O,e])},L=(0,z.D)({mutationFn:async e=>{let{key:t}=e;await i.QZ.delete(t),P()}}),{data:F,isLoading:A,error:I,refetch:P}=(0,_.a)({queryKey:["filesQuery",v,b],staleTime:3e4,queryFn:async()=>i.QZ.list({search:v,continuationToken:b})});console.log("!! data !!",F);let{theme:U}=(0,E.F)(),V=c({backend:(null==k?void 0:k.backend)||"",uppyOptions:{id:l,allowedFileTypes:r},callbacks:{uploadSuccess:async e=>{console.log("data",e)}},maxNumberOfFiles:10},d);return((0,a.useEffect)(()=>{P()},[v,b]),V)?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:[(0,n.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,n.jsx)("h3",{className:"text-sm font-medium mb-3",children:"Previously Uploaded Files"}),(0,n.jsx)(T.I,{placeholder:"Search files...",value:v,onChange:e=>j(e.target.value),className:"mb-3"}),(0,n.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground pb-2",children:[(0,n.jsxs)("span",{children:[O.length," / ",x," files selected"]}),(0,n.jsxs)("span",{children:["Allowed file types: ",null==r?void 0:r.map(e=>e).join(", ")]})]}),(0,n.jsxs)(C.x,{children:[A&&(0,n.jsxs)("div",{className:"flex items-center justify-center h-full w-full grid grid-cols-2 sm:grid-cols-3 gap-3",children:[(0,n.jsx)(R.O,{className:"h-[120px] w-full"}),(0,n.jsx)(R.O,{className:"h-[120px] w-full"}),(0,n.jsx)(R.O,{className:"h-[120px] w-full"}),(0,n.jsx)(R.O,{className:"h-[120px] w-full"}),(0,n.jsx)(R.O,{className:"h-[120px] w-full"}),(0,n.jsx)(R.O,{className:"h-[120px] w-full"}),(0,n.jsx)(R.O,{className:"h-[120px] w-full"}),(0,n.jsx)(R.O,{className:"h-[120px] w-full"}),(0,n.jsx)(R.O,{className:"h-[120px] w-full"})]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:[!A&&!(null==F?void 0:null===(t=F.Contents)||void 0===t?void 0:t.length)&&(0,n.jsxs)("div",{className:"col-span-full flex flex-col items-center justify-center py-12 text-center",children:[(0,n.jsx)(h.Z,{className:"h-12 w-12 text-muted-foreground/50 mb-3"}),(0,n.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:"Nothing to see here... yet!"}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground/75 mt-1",children:"Upload some files to get started"})]}),null==F?void 0:null===(s=F.Contents)||void 0===s?void 0:s.map(e=>(0,n.jsx)(M,{s3Key:e.Key,onSelect:Z,active:O.some(t=>t===e.Key),onRemove:()=>{L.mutate({key:e.Key})},disabled:!!r&&!(null==r?void 0:r.some(t=>e.Key.endsWith(t)))}))]}),(0,n.jsx)("div",{className:"flex items-center space-x-6 lg:space-x-8 pt-3",children:(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsxs)(w.z,{variant:"outline",className:"hidden size-8 p-0 lg:flex",onClick:()=>{N(void 0)},disabled:!b||A,children:[(0,n.jsx)("span",{className:"sr-only",children:"Go to first page"}),(0,n.jsx)(S.kRt,{className:"size-4"})]}),(0,n.jsxs)(w.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{N(g)},disabled:!b||A,children:[(0,n.jsx)("span",{className:"sr-only",children:"Go to previous page"}),(0,n.jsx)(f.Z,{className:"size-4"})]}),(0,n.jsxs)(w.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{y(b),N(null==F?void 0:F.NextContinuationToken)},disabled:!(null==F?void 0:F.NextContinuationToken)||A,children:[(0,n.jsx)("span",{className:"sr-only",children:"Go to next page"}),(0,n.jsx)(p.Z,{className:"size-4"})]})]})})]})]}),(0,n.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,n.jsx)("h3",{className:"text-sm font-medium mb-3",children:"Upload New Files"}),(0,n.jsx)(u.A,{uppy:V,theme:"dark"===U?"dark":"light"})]})]}),(0,n.jsx)("div",{className:"flex justify-end",children:(0,n.jsx)(w.z,{variant:"outline",onClick:()=>{m(O),D([])},children:"Confirm"})})]}):null},M=e=>{let{s3Key:t,onSelect:s,onRemove:a,active:l,disabled:r,addToContext:o}=e;return(0,n.jsxs)("div",{className:"".concat(r?"opacity-50":""," group relative rounded-lg p-2 hover:bg-muted transition-colors cursor-pointer ").concat(l?"border border-purple-500":"border"),onClick:()=>{!r&&s&&s(t)},children:[(0,n.jsx)("div",{className:"aspect-square relative mb-2 bg-muted/50 rounded-md overflow-hidden flex items-center justify-center",children:t&&(t.toLowerCase().endsWith("jpg")||t.toLowerCase().endsWith("jpeg")||t.toLowerCase().endsWith("png")||t.toLowerCase().endsWith("svg"))?(0,n.jsx)(I,{fileKey:t}):(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center h-full",children:[t?t.toLowerCase().endsWith("jpg")||t.toLowerCase().endsWith("jpeg")||t.toLowerCase().endsWith("png")||t.toLowerCase().endsWith("svg")?(0,n.jsx)(j.Z,{className:"h-6 w-6 text-blue-500"}):t.endsWith("pdf")?(0,n.jsx)(g.Z,{className:"h-6 w-6 text-red-500"}):t.endsWith("xls")||t.endsWith("xlsx")||t.endsWith("csv")?(0,n.jsx)(v.Z,{className:"h-6 w-6 text-green-500"}):t.endsWith("ppt")||t.endsWith("pptx")?(0,n.jsx)(v.Z,{className:"h-6 w-6 text-orange-500"}):(0,n.jsx)(v.Z,{className:"h-6 w-6 text-gray-500"}):(0,n.jsx)(v.Z,{className:"h-6 w-6 text-gray-500"}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground mt-1 text-center",children:t?t.split("_EXULU_").pop():t})]})}),(0,n.jsx)("p",{className:"text-xs truncate",children:t?t.split("_EXULU_").pop():t}),(0,n.jsxs)("div",{className:"opacity-0 group-hover:opacity-100 flex absolute top-1 right-1",children:[o&&(0,n.jsxs)(w.z,{variant:"ghost",size:"icon",type:"button",className:"h-6 w-6 bg-background/80 hover:bg-background",onClick:()=>{o(t)},children:[(0,n.jsx)(y.Z,{className:"h-3 w-3"}),(0,n.jsx)("span",{className:"sr-only",children:"Add"})]}),(0,n.jsxs)(w.z,{variant:"ghost",size:"icon",type:"button",className:"h-6 w-6 bg-background/80 hover:bg-background",onClick:()=>{i.QZ.download(t).then(async e=>{console.log("res",e);let t=await e.json();console.log("res",t);let s=t.url;window.open(s,"_blank")})},children:[(0,n.jsx)(m.Z,{className:"h-3 w-3"}),(0,n.jsx)("span",{className:"sr-only",children:"View"})]}),a&&(0,n.jsxs)(w.z,{onClick:e=>{e.stopPropagation(),a(t)},variant:"ghost",type:"button",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 bg-background/80 hover:bg-background ml-1",children:[(0,n.jsx)(b.Z,{className:"h-3 w-3"}),(0,n.jsx)("span",{className:"sr-only",children:"Remove"})]})]})]},t)},F={},A=async e=>{if(F[e]){if(!(F[e].expiresAt<Date.now()))return F[e].url;delete F[e]}let t=await i.QZ.download(e),s=await t.json();return console.log("json",s),F[e]={url:s.url,expiresAt:Date.now()+6e4},s.url},I=e=>{let{fileKey:t}=e;console.log("key",t);let s=(0,_.a)({queryKey:["imageQuery",t],staleTime:3e4,queryFn:async()=>A(t)});return s.isLoading?(0,n.jsx)("div",{children:(0,n.jsx)(N.Z,{})}):s.isLoading||s.data?(0,n.jsx)("img",{src:s.data,alt:t,className:"object-cover w-full h-full"}):(0,n.jsx)("div",{children:(0,n.jsx)(h.Z,{})})}},9334:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(39763).Z)("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]])},40519:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(39763).Z)("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])},48736:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(39763).Z)("FileText",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["line",{x1:"16",x2:"8",y1:"13",y2:"13",key:"14keom"}],["line",{x1:"16",x2:"8",y1:"17",y2:"17",key:"17nazh"}],["line",{x1:"10",x2:"8",y1:"9",y2:"9",key:"1a5vjj"}]])},21563:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(39763).Z)("PackageOpen",[["path",{d:"M20.91 8.84 8.56 2.23a1.93 1.93 0 0 0-1.81 0L3.1 4.13a2.12 2.12 0 0 0-.05 3.69l12.22 6.93a2 2 0 0 0 1.94 0L21 12.51a2.12 2.12 0 0 0-.09-3.67Z",key:"1vy178"}],["path",{d:"m3.09 8.84 12.35-6.61a1.93 1.93 0 0 1 1.81 0l3.65 1.9a2.12 2.12 0 0 1 .1 3.69L8.73 14.75a2 2 0 0 1-1.94 0L3 12.51a2.12 2.12 0 0 1 .09-3.67Z",key:"s3bv25"}],["line",{x1:"12",x2:"12",y1:"22",y2:"13",key:"1o4xyi"}],["path",{d:"M20 13.5v3.37a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13.5",key:"1na2nq"}]])},83229:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(39763).Z)("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]])},98728:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(39763).Z)("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},95805:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(39763).Z)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},32489:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(39763).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},78298:function(e,t,s){"use strict";s.d(t,{F:function(){return d},f:function(){return c}});var n=s(2265);let a=["light","dark"],l="(prefers-color-scheme: dark)",r="undefined"==typeof window,i=(0,n.createContext)(void 0),o={setTheme:e=>{},themes:[]},d=()=>{var e;return null!==(e=(0,n.useContext)(i))&&void 0!==e?e:o},c=e=>(0,n.useContext)(i)?n.createElement(n.Fragment,null,e.children):n.createElement(m,e),u=["light","dark"],m=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:s=!0,enableColorScheme:r=!0,storageKey:o="theme",themes:d=u,defaultTheme:c=s?"system":"light",attribute:m="data-theme",value:v,children:j,nonce:g})=>{let[y,b]=(0,n.useState)(()=>h(o,c)),[N,w]=(0,n.useState)(()=>h(o)),k=v?Object.values(v):d,C=(0,n.useCallback)(e=>{let n=e;if(!n)return;"system"===e&&s&&(n=p());let l=v?v[n]:n,i=t?f():null,o=document.documentElement;if("class"===m?(o.classList.remove(...k),l&&o.classList.add(l)):l?o.setAttribute(m,l):o.removeAttribute(m),r){let e=a.includes(c)?c:null,t=a.includes(n)?n:e;o.style.colorScheme=t}null==i||i()},[]),E=(0,n.useCallback)(e=>{b(e);try{localStorage.setItem(o,e)}catch(e){}},[e]),_=(0,n.useCallback)(t=>{w(p(t)),"system"===y&&s&&!e&&C("system")},[y,e]);(0,n.useEffect)(()=>{let e=window.matchMedia(l);return e.addListener(_),_(e),()=>e.removeListener(_)},[_]),(0,n.useEffect)(()=>{let e=e=>{e.key===o&&E(e.newValue||c)};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[E]),(0,n.useEffect)(()=>{C(null!=e?e:y)},[e,y]);let z=(0,n.useMemo)(()=>({theme:y,setTheme:E,forcedTheme:e,resolvedTheme:"system"===y?N:y,themes:s?[...d,"system"]:d,systemTheme:s?N:void 0}),[y,E,e,N,s,d]);return n.createElement(i.Provider,{value:z},n.createElement(x,{forcedTheme:e,disableTransitionOnChange:t,enableSystem:s,enableColorScheme:r,storageKey:o,themes:d,defaultTheme:c,attribute:m,value:v,children:j,attrs:k,nonce:g}),j)},x=(0,n.memo)(({forcedTheme:e,storageKey:t,attribute:s,enableSystem:r,enableColorScheme:i,defaultTheme:o,value:d,attrs:c,nonce:u})=>{let m="system"===o,x="class"===s?`var d=document.documentElement,c=d.classList;c.remove(${c.map(e=>`'${e}'`).join(",")});`:`var d=document.documentElement,n='${s}',s='setAttribute';`,h=i?a.includes(o)&&o?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${o}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",f=(e,t=!1,n=!0)=>{let l=d?d[e]:e,r=t?e+"|| ''":`'${l}'`,o="";return i&&n&&!t&&a.includes(e)&&(o+=`d.style.colorScheme = '${e}';`),"class"===s?o+=t||l?`c.add(${r})`:"null":l&&(o+=`d[s](n,${r})`),o},p=e?`!function(){${x}${f(e)}}()`:r?`!function(){try{${x}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${m})){var t='${l}',m=window.matchMedia(t);if(m.media!==t||m.matches){${f("dark")}}else{${f("light")}}}else if(e){${d?`var x=${JSON.stringify(d)};`:""}${f(d?"x[e]":"e",!0)}}${m?"":"else{"+f(o,!1,!1)+"}"}${h}}catch(e){}}()`:`!function(){try{${x}var e=localStorage.getItem('${t}');if(e){${d?`var x=${JSON.stringify(d)};`:""}${f(d?"x[e]":"e",!0)}}else{${f(o,!1,!1)};}${h}}catch(t){}}();`;return n.createElement("script",{nonce:u,dangerouslySetInnerHTML:{__html:p}})},()=>!0),h=(e,t)=>{let s;if(!r){try{s=localStorage.getItem(e)||void 0}catch(e){}return s||t}},f=()=>{let e=document.createElement("style");return e.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(e),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(e)},1)}},p=e=>(e||(e=window.matchMedia(l)),e.matches?"dark":"light")},99376:function(e,t,s){"use strict";var n=s(35475);s.o(n,"redirect")&&s.d(t,{redirect:function(){return n.redirect}}),s.o(n,"useParams")&&s.d(t,{useParams:function(){return n.useParams}}),s.o(n,"usePathname")&&s.d(t,{usePathname:function(){return n.usePathname}}),s.o(n,"useRouter")&&s.d(t,{useRouter:function(){return n.useRouter}}),s.o(n,"useSearchParams")&&s.d(t,{useSearchParams:function(){return n.useSearchParams}})},24369:function(e,t,s){"use strict";var n=s(2265),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},l=n.useState,r=n.useEffect,i=n.useLayoutEffect,o=n.useDebugValue;function d(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!a(e,s)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var s=t(),n=l({inst:{value:s,getSnapshot:t}}),a=n[0].inst,c=n[1];return i(function(){a.value=s,a.getSnapshot=t,d(a)&&c({inst:a})},[e,s,t]),r(function(){return d(a)&&c({inst:a}),e(function(){d(a)&&c({inst:a})})},[e]),o(s),s};t.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:c},82558:function(e,t,s){"use strict";e.exports=s(24369)},91048:function(e,t,s){"use strict";s.d(t,{h:function(){return n}});let n={CONTEXT_RETRIEVE:"CONTEXT_RETRIEVE",SOURCE_UPDATE:"SOURCE_UPDATE",EMBEDDER_UPSERT:"EMBEDDER_UPSERT",EMBEDDER_GENERATE:"EMBEDDER_GENERATE",EMBEDDER_DELETE:"EMBEDDER_DELETE",WORKFLOW_RUN:"WORKFLOW_RUN",CONTEXT_UPSERT:"CONTEXT_UPSERT",TOOL_CALL:"TOOL_CALL",AGENT_RUN:"AGENT_RUN"}},6374:function(e,t,s){"use strict";s.d(t,{DQ:function(){return r},LP:function(){return l},QZ:function(){return i}});var n=s(80605);let a=async()=>{let e=await fetch("/api/config").then(e=>e.json());if(!e.backend)throw Error("No backend set.");return{files:e.backend,base:e.backend}},l=async()=>{var e;let t=await (0,n.getSession)();return null==t?void 0:null===(e=t.user)||void 0===e?void 0:e.jwt},r={image:{generate:async e=>{let t=await a(),s="".concat(t.base,"/generate/agent/image"),n=await l();if(!n)throw Error("No valid session token available.");return fetch(s,{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(n)}})}}},i={object:async e=>{let t=await a(),s="".concat(t.files,"/s3/object"),n=await l();return(await fetch(s,{method:"POST",body:JSON.stringify({key:e}),headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(n)}})).json()},list:async e=>{let{search:t,continuationToken:s}=e,n=await a(),r="".concat(n.files,"/s3/list"),i=await l();if(!i)throw Error("No valid session token available.");return t&&(r+="?search=".concat(t)),s&&(r+="?continuationToken=".concat(s)),(await fetch(r,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(i)}})).json()},download:async e=>{let t=await a(),s="".concat(t.files,"/s3/download?key=").concat(e),n=await l();if(!n)throw Error("No valid session token available.");return fetch(s,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(n)}})},delete:async e=>{let t=await a(),s="".concat(t.files,"/s3/delete?key=").concat(e),n=await l();if(!n)throw Error("No valid session token available.");return fetch(s,{method:"DELETE",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(n)}})}}},55156:function(e,t,s){"use strict";s.d(t,{f:function(){return d}});var n=s(2265),a=s(66840),l=s(57437),r="horizontal",i=["horizontal","vertical"],o=n.forwardRef((e,t)=>{let{decorative:s,orientation:n=r,...o}=e,d=i.includes(n)?n:r;return(0,l.jsx)(a.WV.div,{"data-orientation":d,...s?{role:"none"}:{"aria-orientation":"vertical"===d?d:void 0,role:"separator"},...o,ref:t})});o.displayName="Separator";var d=o},7598:function(e,t,s){"use strict";s.d(t,{Q:function(){return m}});var n=s(63497),a=s(99649);function l(e,t){let s=(0,a.Q)(e),n=(0,a.Q)(t),l=s.getTime()-n.getTime();return l<0?-1:l>0?1:l}var r=s(78198),i=s(81363),o=s(27742),d=s(5654),c=s(55528),u=s(9340);function m(e,t){return function(e,t,s){var n,m,x,h,f,p;let v,j,g;let y=(0,c.j)(),b=null!==(m=null!==(n=null==s?void 0:s.locale)&&void 0!==n?n:y.locale)&&void 0!==m?m:d._,N=l(e,t);if(isNaN(N))throw RangeError("Invalid time value");let w=Object.assign({},s,{addSuffix:null==s?void 0:s.addSuffix,comparison:N});N>0?(v=(0,a.Q)(t),j=(0,a.Q)(e)):(v=(0,a.Q)(e),j=(0,a.Q)(t));let k=(x=j,h=v,(p=null==void 0?void 0:(void 0).roundingMethod,e=>{let t=(p?Math[p]:Math.trunc)(e);return 0===t?0:t})((+(0,a.Q)(x)-+(0,a.Q)(h))/1e3)),C=Math.round((k-((0,u.D)(j)-(0,u.D)(v))/1e3)/60);if(C<2){if(null==s?void 0:s.includeSeconds){if(k<5)return b.formatDistance("lessThanXSeconds",5,w);if(k<10)return b.formatDistance("lessThanXSeconds",10,w);if(k<20)return b.formatDistance("lessThanXSeconds",20,w);if(k<40)return b.formatDistance("halfAMinute",0,w);else if(k<60)return b.formatDistance("lessThanXMinutes",1,w);else return b.formatDistance("xMinutes",1,w)}return 0===C?b.formatDistance("lessThanXMinutes",1,w):b.formatDistance("xMinutes",C,w)}if(C<45)return b.formatDistance("xMinutes",C,w);if(C<90)return b.formatDistance("aboutXHours",1,w);if(C<r.H_)return b.formatDistance("aboutXHours",Math.round(C/60),w);if(C<2520)return b.formatDistance("xDays",1,w);if(C<r.fH){let e=Math.round(C/r.H_);return b.formatDistance("xDays",e,w)}if(C<2*r.fH)return g=Math.round(C/r.fH),b.formatDistance("aboutXMonths",g,w);if((g=function(e,t){let s;let n=(0,a.Q)(e),r=(0,a.Q)(t),d=l(n,r),c=Math.abs((0,i.T)(n,r));if(c<1)s=0;else{1===n.getMonth()&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-d*c);let t=l(n,r)===-d;(function(e){let t=(0,a.Q)(e);return+function(e){let t=(0,a.Q)(e);return t.setHours(23,59,59,999),t}(t)==+(0,o.V)(t)})((0,a.Q)(e))&&1===c&&1===l(e,r)&&(t=!1),s=d*(c-Number(t))}return 0===s?0:s}(j,v))<12){let e=Math.round(C/r.fH);return b.formatDistance("xMonths",e,w)}{let e=g%12,t=Math.trunc(g/12);return e<3?b.formatDistance("aboutXYears",t,w):e<9?b.formatDistance("overXYears",t,w):b.formatDistance("almostXYears",t+1,w)}}(e,(0,n.L)(e,Date.now()),t)}}},function(e){e.O(0,[329,6840,8310,3954,5874,7690,9851,7629,7093,6148,847,1942,7648,7823,8068,5799,4567,605,85,4957,3825,1785,3702,3397,7107,9141,1713,6152,7119,6242,7564,7963,6373,7907,2971,2117,1744],function(){return e(e.s=67926)}),_N_E=e.O()}]);
2
+ //# sourceMappingURL=page-375a978d25ee3a65.js.map