@exulu/frontend 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/.next/BUILD_ID +1 -1
  2. package/dist/.next/app-build-manifest.json +129 -131
  3. package/dist/.next/app-path-routes-manifest.json +1 -1
  4. package/dist/.next/build-manifest.json +2 -2
  5. package/dist/.next/prerender-manifest.json +1 -1
  6. package/dist/.next/server/app/(application)/agents/edit/[id]/page.js +1 -1
  7. package/dist/.next/server/app/(application)/agents/edit/[id]/page.js.nft.json +1 -1
  8. package/dist/.next/server/app/(application)/agents/edit/[id]/page_client-reference-manifest.js +1 -1
  9. package/dist/.next/server/app/(application)/agents/page_client-reference-manifest.js +1 -1
  10. package/dist/.next/server/app/(application)/chat/[agent]/[session]/page.js +7 -7
  11. package/dist/.next/server/app/(application)/chat/[agent]/[session]/page.js.nft.json +1 -1
  12. package/dist/.next/server/app/(application)/chat/[agent]/[session]/page_client-reference-manifest.js +1 -1
  13. package/dist/.next/server/app/(application)/chat/[agent]/page_client-reference-manifest.js +1 -1
  14. package/dist/.next/server/app/(application)/chat/page_client-reference-manifest.js +1 -1
  15. package/dist/.next/server/app/(application)/configuration/page_client-reference-manifest.js +1 -1
  16. package/dist/.next/server/app/(application)/dashboard/page_client-reference-manifest.js +1 -1
  17. package/dist/.next/server/app/(application)/data/[[...query]]/page.js +4 -4
  18. package/dist/.next/server/app/(application)/data/[[...query]]/page.js.nft.json +1 -1
  19. package/dist/.next/server/app/(application)/data/[[...query]]/page_client-reference-manifest.js +1 -1
  20. package/dist/.next/server/app/(application)/evals/[id]/page.js +1 -1
  21. package/dist/.next/server/app/(application)/evals/[id]/page.js.nft.json +1 -1
  22. package/dist/.next/server/app/(application)/evals/[id]/page_client-reference-manifest.js +1 -1
  23. package/dist/.next/server/app/(application)/evals/cases/page.js +1 -1
  24. package/dist/.next/server/app/(application)/evals/cases/page.js.nft.json +1 -1
  25. package/dist/.next/server/app/(application)/evals/cases/page_client-reference-manifest.js +1 -1
  26. package/dist/.next/server/app/(application)/evals/page_client-reference-manifest.js +1 -1
  27. package/dist/.next/server/app/(application)/explorer/page_client-reference-manifest.js +1 -1
  28. package/dist/.next/server/app/(application)/keys/page_client-reference-manifest.js +1 -1
  29. package/dist/.next/server/app/(application)/page_client-reference-manifest.js +1 -1
  30. package/dist/.next/server/app/(application)/projects/[project]/page.js +1 -1
  31. package/dist/.next/server/app/(application)/projects/[project]/page.js.nft.json +1 -1
  32. package/dist/.next/server/app/(application)/projects/[project]/page_client-reference-manifest.js +1 -1
  33. package/dist/.next/server/app/(application)/projects/page.js +1 -1
  34. package/dist/.next/server/app/(application)/projects/page_client-reference-manifest.js +1 -1
  35. package/dist/.next/server/app/(application)/prompts/page.js +1 -1
  36. package/dist/.next/server/app/(application)/prompts/page_client-reference-manifest.js +1 -1
  37. package/dist/.next/server/app/(application)/roles/page_client-reference-manifest.js +1 -1
  38. package/dist/.next/server/app/(application)/token/page_client-reference-manifest.js +1 -1
  39. package/dist/.next/server/app/(application)/users/page_client-reference-manifest.js +1 -1
  40. package/dist/.next/server/app/(application)/variables/create/page_client-reference-manifest.js +1 -1
  41. package/dist/.next/server/app/(application)/variables/edit/[variable_id]/page_client-reference-manifest.js +1 -1
  42. package/dist/.next/server/app/(application)/variables/page_client-reference-manifest.js +1 -1
  43. package/dist/.next/server/app/(application)/variables/usage/[variable_id]/page_client-reference-manifest.js +1 -1
  44. package/dist/.next/server/app/(application)/workflows/page.js +1 -1
  45. package/dist/.next/server/app/(application)/workflows/page_client-reference-manifest.js +1 -1
  46. package/dist/.next/server/app/(authentication)/login/page_client-reference-manifest.js +1 -1
  47. package/dist/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  48. package/dist/.next/server/app/_not-found.html +1 -1
  49. package/dist/.next/server/app/_not-found.rsc +1 -1
  50. package/dist/.next/server/app-paths-manifest.json +6 -6
  51. package/dist/.next/server/chunks/1025.js +1 -0
  52. package/dist/.next/server/chunks/2270.js +11 -48
  53. package/dist/.next/server/chunks/3434.js +1 -1
  54. package/dist/.next/server/chunks/3503.js +1 -0
  55. package/dist/.next/server/chunks/5084.js +1 -0
  56. package/dist/.next/server/chunks/5192.js +1 -1
  57. package/dist/.next/server/chunks/5485.js +1 -1
  58. package/dist/.next/server/chunks/5600.js +1 -1
  59. package/dist/.next/server/chunks/5974.js +1 -0
  60. package/dist/.next/server/chunks/6590.js +1 -1
  61. package/dist/.next/server/chunks/7471.js +1 -1
  62. package/dist/.next/server/chunks/8286.js +1 -1
  63. package/dist/.next/server/chunks/{3679.js → 9874.js} +5 -5
  64. package/dist/.next/server/middleware-manifest.json +5 -5
  65. package/dist/.next/server/pages/404.html +1 -1
  66. package/dist/.next/server/pages/500.html +1 -1
  67. package/dist/.next/server/server-reference-manifest.json +1 -1
  68. package/dist/.next/static/chunks/1685-939396dad2f8f1e0.js +2 -0
  69. package/dist/.next/static/chunks/1685-939396dad2f8f1e0.js.map +1 -0
  70. package/dist/.next/static/chunks/{4811-316807e25b634f9f.js → 192-72d6868cd891ccc6.js} +8 -8
  71. package/dist/.next/static/chunks/192-72d6868cd891ccc6.js.map +1 -0
  72. package/dist/.next/static/chunks/1957-cf44b1d31a9c7d5c.js +2 -0
  73. package/dist/.next/static/chunks/1957-cf44b1d31a9c7d5c.js.map +1 -0
  74. package/dist/.next/static/chunks/342-d9c2d6ae9f9435cb.js +2 -0
  75. package/dist/.next/static/chunks/342-d9c2d6ae9f9435cb.js.map +1 -0
  76. package/dist/.next/static/chunks/552-39155a93c527ec6d.js +2 -0
  77. package/dist/.next/static/chunks/552-39155a93c527ec6d.js.map +1 -0
  78. package/dist/.next/static/chunks/6367-59655a85d75e19be.js +2 -0
  79. package/dist/.next/static/chunks/6367-59655a85d75e19be.js.map +1 -0
  80. package/dist/.next/static/chunks/6373-601400fab8a3bb55.js +2 -0
  81. package/dist/.next/static/chunks/6373-601400fab8a3bb55.js.map +1 -0
  82. package/dist/.next/static/chunks/8030-9c926ea4dfd3a54e.js +2 -0
  83. package/dist/.next/static/chunks/8030-9c926ea4dfd3a54e.js.map +1 -0
  84. package/dist/.next/static/chunks/{6805-792cc8008b165c07.js → 8293-0e69d89d2dac7111.js} +10 -10
  85. package/dist/.next/static/chunks/8293-0e69d89d2dac7111.js.map +1 -0
  86. package/dist/.next/static/chunks/9953-95900a236271a222.js +2 -0
  87. package/dist/.next/static/chunks/9953-95900a236271a222.js.map +1 -0
  88. package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/page-e4a4693953329671.js +2 -0
  89. package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/page-e4a4693953329671.js.map +1 -0
  90. package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-7edb1c7c850f982c.js +2 -0
  91. package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-7edb1c7c850f982c.js.map +1 -0
  92. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-8d2b3995cacfd832.js +2 -0
  93. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-8d2b3995cacfd832.js.map +1 -0
  94. package/dist/.next/static/chunks/app/(application)/evals/[id]/page-a7728cf9b0524489.js +2 -0
  95. package/dist/.next/static/chunks/app/(application)/evals/[id]/page-a7728cf9b0524489.js.map +1 -0
  96. package/dist/.next/static/chunks/app/(application)/evals/cases/{page-a39fef7444581565.js → page-827f50c6d1f150d0.js} +2 -2
  97. package/dist/.next/static/chunks/app/(application)/evals/cases/{page-a39fef7444581565.js.map → page-827f50c6d1f150d0.js.map} +1 -1
  98. package/dist/.next/static/chunks/app/(application)/projects/[project]/page-f04fd5291a1ef7b1.js +2 -0
  99. package/dist/.next/static/chunks/app/(application)/projects/[project]/page-f04fd5291a1ef7b1.js.map +1 -0
  100. package/dist/.next/static/chunks/app/(application)/prompts/page-2c500e9898447506.js +2 -0
  101. package/dist/.next/static/chunks/app/(application)/prompts/page-2c500e9898447506.js.map +1 -0
  102. package/dist/.next/static/chunks/app/(application)/workflows/{page-47dedb88cec600d5.js → page-e38f9456120dab69.js} +2 -2
  103. package/dist/.next/static/chunks/app/(application)/workflows/page-e38f9456120dab69.js.map +1 -0
  104. package/dist/.next/static/css/6f8c5212af8ef284.css +4 -0
  105. package/dist/.next/static/css/6f8c5212af8ef284.css.map +1 -0
  106. package/dist/.next/static/css/e3f2a16ab7676b05.css.map +1 -1
  107. package/package.json +1 -1
  108. package/dist/.next/server/chunks/2948.js +0 -1
  109. package/dist/.next/server/chunks/38.js +0 -1
  110. package/dist/.next/server/chunks/7958.js +0 -1
  111. package/dist/.next/server/chunks/8050.js +0 -1
  112. package/dist/.next/static/chunks/1685-9cacdee7e3f0942f.js +0 -2
  113. package/dist/.next/static/chunks/1685-9cacdee7e3f0942f.js.map +0 -1
  114. package/dist/.next/static/chunks/1957-39a01a3915f246ab.js +0 -2
  115. package/dist/.next/static/chunks/1957-39a01a3915f246ab.js.map +0 -1
  116. package/dist/.next/static/chunks/4811-316807e25b634f9f.js.map +0 -1
  117. package/dist/.next/static/chunks/5282-68f9880f1f951f44.js +0 -2
  118. package/dist/.next/static/chunks/5282-68f9880f1f951f44.js.map +0 -1
  119. package/dist/.next/static/chunks/6367-59cef3c74213925b.js +0 -2
  120. package/dist/.next/static/chunks/6367-59cef3c74213925b.js.map +0 -1
  121. package/dist/.next/static/chunks/6373-4c5dffaf4193621c.js +0 -2
  122. package/dist/.next/static/chunks/6373-4c5dffaf4193621c.js.map +0 -1
  123. package/dist/.next/static/chunks/6805-792cc8008b165c07.js.map +0 -1
  124. package/dist/.next/static/chunks/8030-c1b6be46253076cb.js +0 -2
  125. package/dist/.next/static/chunks/8030-c1b6be46253076cb.js.map +0 -1
  126. package/dist/.next/static/chunks/9621-f81c4d7c0ecf5a67.js +0 -2
  127. package/dist/.next/static/chunks/9621-f81c4d7c0ecf5a67.js.map +0 -1
  128. package/dist/.next/static/chunks/9953-dfb5fc0e5b74ec09.js +0 -2
  129. package/dist/.next/static/chunks/9953-dfb5fc0e5b74ec09.js.map +0 -1
  130. package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/page-4e7e02768ed1a72a.js +0 -2
  131. package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/page-4e7e02768ed1a72a.js.map +0 -1
  132. package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-38f845d5ccdad76b.js +0 -2
  133. package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-38f845d5ccdad76b.js.map +0 -1
  134. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-a391b8407f74e9b4.js +0 -2
  135. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-a391b8407f74e9b4.js.map +0 -1
  136. package/dist/.next/static/chunks/app/(application)/evals/[id]/page-cf6f8d2bd4e9c819.js +0 -2
  137. package/dist/.next/static/chunks/app/(application)/evals/[id]/page-cf6f8d2bd4e9c819.js.map +0 -1
  138. package/dist/.next/static/chunks/app/(application)/projects/[project]/page-bc859da58d8505f7.js +0 -2
  139. package/dist/.next/static/chunks/app/(application)/projects/[project]/page-bc859da58d8505f7.js.map +0 -1
  140. package/dist/.next/static/chunks/app/(application)/prompts/page-d2f36ff149385efd.js +0 -2
  141. package/dist/.next/static/chunks/app/(application)/prompts/page-d2f36ff149385efd.js.map +0 -1
  142. package/dist/.next/static/chunks/app/(application)/workflows/page-47dedb88cec600d5.js.map +0 -1
  143. package/dist/.next/static/css/c8c015815c72d053.css +0 -4
  144. package/dist/.next/static/css/c8c015815c72d053.css.map +0 -1
  145. /package/dist/.next/static/{GOwerAkBncYx0J8q1TqQb → ls-syPkq9-MWp-VWWDEZJ}/_buildManifest.js +0 -0
  146. /package/dist/.next/static/{GOwerAkBncYx0J8q1TqQb → ls-syPkq9-MWp-VWWDEZJ}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"static/chunks/app/(application)/agents/edit/[id]/page-e4a4693953329671.js","mappings":"sFAAAA,QAAAC,OAAA,GAAAC,IAAA,CAAAC,EAAAC,IAAA,CAAAD,EAAA,kNCUO,IAAME,EAAU,gBAER,SAASC,EAAKC,CAAsC,KAAtC,CAAEC,OAAAA,CAAM,CAA8B,CAAtCD,EAErB,CAAEE,KAAAA,CAAI,CAAEC,QAAAA,CAAO,CAAEC,MAAAA,CAAK,CAAEC,QAAAA,CAAO,CAAE,CAAGC,CAAAA,EAAAA,EAAAA,EAAAA,EAEvCC,EAAAA,EAAeA,CAAE,CAClBC,UAAW,CACTC,GAAIR,EAAOQ,EAAE,CAEjB,UAEA,EACS,GAAAC,EAAAC,GAAA,EAACC,MAAAA,UACN,GAAAF,EAAAC,GAAA,EAACE,EAAAA,CAAQA,CAAAA,CAACC,UAAU,oBAIpBV,EACK,GAAAM,EAAAK,IAAA,EAACC,EAAAA,EAAKA,CAAAA,CAACC,QAAQ,wBACpB,GAAAP,EAAAC,GAAA,EAACO,EAAAA,GAAuBA,CAAAA,CAACJ,UAAU,WACnC,GAAAJ,EAAAC,GAAA,EAACQ,EAAAA,EAAUA,CAAAA,UAAC,UACZ,GAAAT,EAAAC,GAAA,EAACS,EAAAA,CAAgBA,CAAAA,UAAC,4BAMjBlB,CAAAA,MAAAA,EAAAA,KAAAA,EAAAA,EAAMmB,SAAS,EAWlB,GAAAX,EAAAC,GAAA,EAACW,EAAAA,CAASA,CAAAA,CACRC,MAAOrB,EAAKmB,SAAS,CACrBhB,QAASA,IAZJ,GAAAK,EAAAK,IAAA,EAACC,EAAAA,EAAKA,CAAAA,CAACC,QAAQ,wBACpB,GAAAP,EAAAC,GAAA,EAACO,EAAAA,GAAuBA,CAAAA,CAACJ,UAAU,WACnC,GAAAJ,EAAAC,GAAA,EAACQ,EAAAA,EAAUA,CAAAA,UAAC,UACZ,GAAAT,EAAAC,GAAA,EAACS,EAAAA,CAAgBA,CAAAA,UAAC,uBAYxB,sECzCM,IAAAI,EAAcC,CAAAA,EAAAA,SAAAA,CAAAA,EAAiB,cAAe,CAClD,CAAC,SAAU,CAAEC,GAAI,KAAMC,GAAI,KAAMC,EAAG,KAAMC,IAAK,UAAU,CACzD,CAAC,OAAQ,CAAEC,GAAI,KAAMC,GAAI,KAAMC,GAAI,IAAKC,GAAI,KAAMJ,IAAK,UAAU,CACjE,CAAC,OAAQ,CAAEC,GAAI,KAAMC,GAAI,QAASC,GAAI,KAAMC,GAAI,KAAMJ,IAAK,UAAU,CACtE,sECJK,IAAAK,EAAOT,CAAAA,EAAAA,SAAAA,CAAAA,EAAiB,OAAQ,CACpC,CAAC,SAAU,CAAEC,GAAI,KAAMC,GAAI,KAAMC,EAAG,KAAMC,IAAK,UAAU,CACzD,CAAC,OAAQ,CAAEM,EAAG,YAAaN,IAAK,UAAU,CAC1C,CAAC,OAAQ,CAAEM,EAAG,YAAaN,IAAK,UAAU,CAC3C,qFCQM,SAASO,EAA2BC,CAAQ,CAAEC,CAAS,EAC5D,IAAMC,EAAYC,CAAAA,EAAAA,EAAAA,CAAAA,EAAOH,GACnBI,EAAaD,CAAAA,EAAAA,EAAAA,CAAAA,EAAOF,GAK1B,OAAOI,GAHUH,CAAAA,EAAUI,WAAW,GAAKF,EAAWE,WAAW,IAC/CJ,CAAAA,EAAUK,QAAQ,GAAKH,EAAWG,QAAQ,GAG9D,qFCXO,SAASC,EAAWC,CAAI,EAC7B,IAAMC,EAAQP,CAAAA,EAAAA,EAAAA,CAAAA,EAAOM,GACfE,EAAQD,EAAMH,QAAQ,GAG5B,OAFAG,EAAME,WAAW,CAACF,EAAMJ,WAAW,GAAIK,EAAQ,EAAG,GAClDD,EAAMG,QAAQ,CAAC,GAAI,GAAI,GAAI,KACpBH,CACT","sources":["webpack://_N_E/?f6bf","webpack://_N_E/./app/(application)/agents/edit/[id]/page.tsx","webpack://_N_E/../../../src/icons/alert-circle.ts","webpack://_N_E/../../../src/icons/info.ts","webpack://_N_E/./node_modules/date-fns/differenceInCalendarMonths.mjs","webpack://_N_E/./node_modules/date-fns/endOfMonth.mjs"],"sourcesContent":["import(/* webpackMode: \"eager\" */ \"/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/agents/edit/[id]/page.tsx\");\n","\"use client\";\n\nimport * as React from \"react\";\nimport AgentForm from \"@/app/(application)/agents/edit/[id]/form\";\nimport { useQuery } from \"@apollo/client\";\nimport { Skeleton } from \"@/components/ui/skeleton\";\nimport { Alert, AlertDescription, AlertTitle } from \"@/components/ui/alert\";\nimport { ExclamationTriangleIcon } from \"@radix-ui/react-icons\";\nimport { GET_AGENT_BY_ID } from \"@/queries/queries\";\nimport { Agent } from \"@/types/models/agent\";\nexport const dynamic = \"force-dynamic\";\n\nexport default function Page({ params }: { params: { id: string } }) {\n\n const { data, loading, error, refetch } = useQuery<{\n agentById: Agent\n }>(GET_AGENT_BY_ID, {\n variables: {\n id: params.id,\n },\n });\n\n if (loading) {\n return <div>\n <Skeleton className=\"w-full h-full\" />\n </div>\n }\n\n if (error) {\n return <Alert variant=\"destructive\">\n <ExclamationTriangleIcon className=\"size-4\" />\n <AlertTitle>Error</AlertTitle>\n <AlertDescription>\n Error loading agent.\n </AlertDescription>\n </Alert>\n }\n\n if (!data?.agentById) {\n return <Alert variant=\"destructive\">\n <ExclamationTriangleIcon className=\"size-4\" />\n <AlertTitle>Error</AlertTitle>\n <AlertDescription>\n Agent not found.\n </AlertDescription>\n </Alert>\n }\n\n return (\n <AgentForm\n agent={data.agentById}\n refetch={refetch}\n />\n );\n}\n","import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name AlertCircle\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxMCIgLz4KICA8bGluZSB4MT0iMTIiIHgyPSIxMiIgeTE9IjgiIHkyPSIxMiIgLz4KICA8bGluZSB4MT0iMTIiIHgyPSIxMi4wMSIgeTE9IjE2IiB5Mj0iMTYiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/alert-circle\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst AlertCircle = createLucideIcon('AlertCircle', [\n ['circle', { cx: '12', cy: '12', r: '10', key: '1mglay' }],\n ['line', { x1: '12', x2: '12', y1: '8', y2: '12', key: '1pkeuh' }],\n ['line', { x1: '12', x2: '12.01', y1: '16', y2: '16', key: '4dfq90' }],\n]);\n\nexport default AlertCircle;\n","import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Info\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxMCIgLz4KICA8cGF0aCBkPSJNMTIgMTZ2LTQiIC8+CiAgPHBhdGggZD0iTTEyIDhoLjAxIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/info\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst Info = createLucideIcon('Info', [\n ['circle', { cx: '12', cy: '12', r: '10', key: '1mglay' }],\n ['path', { d: 'M12 16v-4', key: '1dtifu' }],\n ['path', { d: 'M12 8h.01', key: 'e9boi3' }],\n]);\n\nexport default Info;\n","import { toDate } from \"./toDate.mjs\";\n\n/**\n * @name differenceInCalendarMonths\n * @category Month Helpers\n * @summary Get the number of calendar months between the given dates.\n *\n * @description\n * Get the number of calendar months between the given dates.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param dateLeft - The later date\n * @param dateRight - The earlier date\n *\n * @returns The number of calendar months\n *\n * @example\n * // How many calendar months are between 31 January 2014 and 1 September 2014?\n * const result = differenceInCalendarMonths(\n * new Date(2014, 8, 1),\n * new Date(2014, 0, 31)\n * )\n * //=> 8\n */\nexport function differenceInCalendarMonths(dateLeft, dateRight) {\n const _dateLeft = toDate(dateLeft);\n const _dateRight = toDate(dateRight);\n\n const yearDiff = _dateLeft.getFullYear() - _dateRight.getFullYear();\n const monthDiff = _dateLeft.getMonth() - _dateRight.getMonth();\n\n return yearDiff * 12 + monthDiff;\n}\n\n// Fallback for modularized imports:\nexport default differenceInCalendarMonths;\n","import { toDate } from \"./toDate.mjs\";\n\n/**\n * @name endOfMonth\n * @category Month Helpers\n * @summary Return the end of a month for the given date.\n *\n * @description\n * Return the end of a month for the given date.\n * The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param date - The original date\n *\n * @returns The end of a month\n *\n * @example\n * // The end of a month for 2 September 2014 11:55:00:\n * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 30 2014 23:59:59.999\n */\nexport function endOfMonth(date) {\n const _date = toDate(date);\n const month = _date.getMonth();\n _date.setFullYear(_date.getFullYear(), month + 1, 0);\n _date.setHours(23, 59, 59, 999);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default endOfMonth;\n"],"names":["Promise","resolve","then","__webpack_require__","bind","dynamic","Page","param","params","data","loading","error","refetch","useQuery","GET_AGENT_BY_ID","variables","id","react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__","jsx","div","Skeleton","className","jsxs","Alert","variant","ExclamationTriangleIcon","AlertTitle","AlertDescription","agentById","AgentForm","agent","AlertCircle","createLucideIcon","cx","cy","r","key","x1","x2","y1","y2","Info","d","differenceInCalendarMonths","dateLeft","dateRight","_dateLeft","toDate","_dateRight","yearDiff","getFullYear","getMonth","endOfMonth","date","_date","month","setFullYear","setHours"],"sourceRoot":""}
@@ -0,0 +1,2 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4709],{395:function(e,t,s){Promise.resolve().then(s.bind(s,18528))},18528:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return eE},dynamic:function(){return eU}});var n=s(57437),l=s(2265),a=s(99376),r=s(65613),i=s(7211),o=s(12199),d=s(41658),c=s(80834),u=s(13832),m=s(20653),x=s(94508);let p=e=>{let{size:t=16}=e;return(0,n.jsxs)("svg",{height:t,strokeLinejoin:"round",style:{color:"currentcolor"},viewBox:"0 0 16 16",width:t,children:[(0,n.jsx)("title",{children:"Loader"}),(0,n.jsxs)("g",{clipPath:"url(#clip0_2393_1490)",children:[(0,n.jsx)("path",{d:"M8 0V4",stroke:"currentColor",strokeWidth:"1.5"}),(0,n.jsx)("path",{d:"M8 16V12",opacity:"0.5",stroke:"currentColor",strokeWidth:"1.5"}),(0,n.jsx)("path",{d:"M3.29773 1.52783L5.64887 4.7639",opacity:"0.9",stroke:"currentColor",strokeWidth:"1.5"}),(0,n.jsx)("path",{d:"M12.7023 1.52783L10.3511 4.7639",opacity:"0.1",stroke:"currentColor",strokeWidth:"1.5"}),(0,n.jsx)("path",{d:"M12.7023 14.472L10.3511 11.236",opacity:"0.4",stroke:"currentColor",strokeWidth:"1.5"}),(0,n.jsx)("path",{d:"M3.29773 14.472L5.64887 11.236",opacity:"0.6",stroke:"currentColor",strokeWidth:"1.5"}),(0,n.jsx)("path",{d:"M15.6085 5.52783L11.8043 6.7639",opacity:"0.2",stroke:"currentColor",strokeWidth:"1.5"}),(0,n.jsx)("path",{d:"M0.391602 10.472L4.19583 9.23598",opacity:"0.7",stroke:"currentColor",strokeWidth:"1.5"}),(0,n.jsx)("path",{d:"M15.6085 10.4722L11.8043 9.2361",opacity:"0.3",stroke:"currentColor",strokeWidth:"1.5"}),(0,n.jsx)("path",{d:"M0.391602 5.52783L4.19583 6.7639",opacity:"0.8",stroke:"currentColor",strokeWidth:"1.5"})]}),(0,n.jsx)("defs",{children:(0,n.jsx)("clipPath",{id:"clip0_2393_1490",children:(0,n.jsx)("rect",{fill:"white",height:"16",width:"16"})})})]})},h=e=>{let{className:t,size:s=16,...l}=e;return(0,n.jsx)("div",{className:(0,x.cn)("inline-flex animate-spin items-center justify-center",t),...l,children:(0,n.jsx)(p,{size:s})})};var f=s(27315),v=s(81103),g=s(27689),j=s(6374),N=s(44045),y=s(48736),b=s(20265),w=s(24156),k=s(77992),C=s(27699),_=s(62869),T=s(1828),S=s(66070),z=s(27182),I=s(866),F=s(8014),P=s(74928),L=s(10492),R=s(35974),D=s(87393),Z=s(78361),M=s(23462);let U=M.fC,E=M.xz,A=l.forwardRef((e,t)=>{let{className:s,align:l="center",sideOffset:a=4,...r}=e;return(0,n.jsx)(M.VY,{ref:t,align:l,sideOffset:a,className:(0,x.cn)("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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})});A.displayName=M.VY.displayName;var B=s(60610);let O=l.forwardRef((e,t)=>{let{className:s,value:l,...a}=e;return(0,n.jsx)(B.fC,{ref:t,className:(0,x.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",s),...a,children:(0,n.jsx)(B.z$,{className:"size-full flex-1 bg-primary transition-all",style:{transform:"translateX(-".concat(100-(l||0),"%)")}})})});O.displayName=B.fC.displayName;var W=s(72543);let q=(0,l.createContext)(null),K=()=>{let e=(0,l.useContext)(q);if(!e)throw Error("Context components must be used within Context");return e},J=e=>{let{usedTokens:t,maxTokens:s,usage:l,modelId:a,...r}=e;return(0,n.jsx)(q.Provider,{value:{usedTokens:t,maxTokens:s,usage:l,modelId:a},children:(0,n.jsx)(U,{closeDelay:0,openDelay:0,...r})})},H=()=>{let{usedTokens:e,maxTokens:t}=K(),s=2*Math.PI*10;return(0,n.jsxs)("svg",{"aria-label":"Model context usage",height:"20",role:"img",style:{color:"currentcolor"},viewBox:"0 0 ".concat(24," ").concat(24),width:"20",children:[(0,n.jsx)("circle",{cx:12,cy:12,fill:"none",opacity:"0.25",r:10,stroke:"currentColor",strokeWidth:2}),(0,n.jsx)("circle",{cx:12,cy:12,fill:"none",opacity:"0.7",r:10,stroke:"currentColor",strokeDasharray:"".concat(s," ").concat(s),strokeDashoffset:s*(1-e/t),strokeLinecap:"round",strokeWidth:2,style:{transformOrigin:"center",transform:"rotate(-90deg)"}})]})},V=e=>{let{children:t,...s}=e,{usedTokens:l,maxTokens:a}=K(),r=new Intl.NumberFormat("en-US",{style:"percent",maximumFractionDigits:1}).format(l/a);return(0,n.jsx)(E,{asChild:!0,children:null!=t?t:(0,n.jsxs)(_.z,{type:"button",variant:"ghost",...s,children:[(0,n.jsx)("span",{className:"font-medium text-muted-foreground",children:r}),(0,n.jsx)(H,{})]})})},Y=e=>{let{className:t,...s}=e;return(0,n.jsx)(A,{className:(0,x.cn)("min-w-[240px] divide-y overflow-hidden p-0",t),...s})},X=e=>{let{children:t,className:s,...l}=e,{usedTokens:a,maxTokens:r}=K(),i=a/r,o=new Intl.NumberFormat("en-US",{style:"percent",maximumFractionDigits:1}).format(i),d=new Intl.NumberFormat("en-US",{notation:"compact"}).format(a),c=new Intl.NumberFormat("en-US",{notation:"compact"}).format(r);return(0,n.jsx)("div",{className:(0,x.cn)("w-full space-y-2 p-3",s),...l,children:null!=t?t:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3 text-xs",children:[(0,n.jsx)("p",{children:o}),(0,n.jsxs)("p",{className:"font-mono text-muted-foreground",children:[d," / ",c]})]}),(0,n.jsx)("div",{className:"space-y-2",children:(0,n.jsx)(O,{className:"bg-muted",value:100*i})})]})})},$=e=>{let{children:t,className:s,...l}=e;return(0,n.jsx)("div",{className:(0,x.cn)("w-full p-3",s),...l,children:t})},G=e=>{var t;let{className:s,children:l,...a}=e,{usage:r,modelId:i}=K(),o=null!==(t=null==r?void 0:r.inputTokens)&&void 0!==t?t:0;if(l)return l;if(!o)return null;let d=i?(0,W.Wn)({modelId:i,usage:{input:o,output:0}}).totalUSD:void 0,c=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(null!=d?d:0);return(0,n.jsxs)("div",{className:(0,x.cn)("flex items-center justify-between text-xs",s),...a,children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Input"}),(0,n.jsx)(es,{costText:c,tokens:o})]})},Q=e=>{var t;let{className:s,children:l,...a}=e,{usage:r,modelId:i}=K(),o=null!==(t=null==r?void 0:r.outputTokens)&&void 0!==t?t:0;if(l)return l;if(!o)return null;let d=i?(0,W.Wn)({modelId:i,usage:{input:0,output:o}}).totalUSD:void 0,c=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(null!=d?d:0);return(0,n.jsxs)("div",{className:(0,x.cn)("flex items-center justify-between text-xs",s),...a,children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Output"}),(0,n.jsx)(es,{costText:c,tokens:o})]})},ee=e=>{var t;let{className:s,children:l,...a}=e,{usage:r,modelId:i}=K(),o=null!==(t=null==r?void 0:r.reasoningTokens)&&void 0!==t?t:0;if(l)return l;if(!o)return null;let d=i?(0,W.Wn)({modelId:i,usage:{reasoningTokens:o}}).totalUSD:void 0,c=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(null!=d?d:0);return(0,n.jsxs)("div",{className:(0,x.cn)("flex items-center justify-between text-xs",s),...a,children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Reasoning"}),(0,n.jsx)(es,{costText:c,tokens:o})]})},et=e=>{var t;let{className:s,children:l,...a}=e,{usage:r,modelId:i}=K(),o=null!==(t=null==r?void 0:r.cachedInputTokens)&&void 0!==t?t:0;if(l)return l;if(!o)return null;let d=i?(0,W.Wn)({modelId:i,usage:{cacheReads:o,input:0,output:0}}).totalUSD:void 0,c=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(null!=d?d:0);return(0,n.jsxs)("div",{className:(0,x.cn)("flex items-center justify-between text-xs",s),...a,children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Cache"}),(0,n.jsx)(es,{costText:c,tokens:o})]})},es=e=>{let{tokens:t,costText:s}=e;return(0,n.jsxs)("span",{children:[void 0===t?"—":new Intl.NumberFormat("en-US",{notation:"compact"}).format(t),s?(0,n.jsxs)("span",{className:"ml-2 text-muted-foreground",children:["• ",s]}):null]})};var en=s(40519),el=s(91723),ea=s(65302),er=s(45131),ei=s(29525),eo=s(40875),ed=s(53245);let ec=e=>{let{className:t,...s}=e;return(0,n.jsx)(P.zF,{className:(0,x.cn)("not-prose mb-4 w-full rounded-md border",t),...s})},eu=e=>{let t={"input-streaming":(0,n.jsx)(en.Z,{className:"size-4 mr-2"}),"input-available":(0,n.jsx)(el.Z,{className:"size-4 animate-pulse mr-2"}),"output-available":(0,n.jsx)(ea.Z,{className:"size-4 text-green-600 mr-2"}),"output-error":(0,n.jsx)(er.Z,{className:"size-4 text-red-600 mr-2"})};return(0,n.jsxs)(R.C,{className:"rounded-full text-xs",variant:"secondary",children:[t[e],{"input-streaming":"Pending","input-available":"Running","output-available":"Completed","output-error":"Error"}[e]]})},em=e=>{let{className:t,type:s,state:l,...a}=e;return(0,n.jsxs)(P.wy,{className:(0,x.cn)("flex w-full items-center justify-between gap-4 p-3",t),...a,children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(ei.Z,{className:"size-4 text-muted-foreground"}),(0,n.jsx)("span",{className:"font-medium text-sm",children:s}),eu(l)]}),(0,n.jsx)(eo.Z,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})},ex=e=>{let{className:t,...s}=e;return(0,n.jsx)(P.Fw,{className:(0,x.cn)("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",t),...s})},ep=e=>{let{className:t,input:s,...l}=e;return(0,n.jsxs)("div",{className:(0,x.cn)("space-y-2 overflow-hidden p-4",t),...l,children:[(0,n.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:"Parameters"}),(0,n.jsx)("div",{className:"rounded-md bg-muted/50",children:(0,n.jsx)(ed.d,{code:JSON.stringify(s,null,2),language:"json"})})]})},eh=e=>{let{className:t,output:s,errorText:l,...a}=e;return s||l?(0,n.jsxs)("div",{className:(0,x.cn)("space-y-2 p-4",t),...a,children:[(0,n.jsx)("h4",{className:"font-medium text-muted-foreground text-xs tracking-wide",children:l?"Error":"Result"}),(0,n.jsxs)("div",{className:(0,x.cn)("overflow-x-auto rounded-md text-xs [&_table]:w-full p-5",l?"bg-destructive/10 text-destructive":"bg-muted/50 text-foreground"),children:[l&&(0,n.jsx)("div",{children:l}),s&&(0,n.jsx)("div",{children:s})]})]}):(0,n.jsx)(n.Fragment,{})};var ef=s(93022),ev=s(77256),eg=s(35629),ej=s(92279),eN=s(78298),ey=s(21391),eb=s(26110),ew=s(95186),ek=s(73247),eC=s(31810),e_=s(42208),eT=s(12194),eS=s(84544),ez=s(19378);function eI(e){var t;let{open:s,onOpenChange:a,onSelectPrompt:r,agentId:i}=e,[o,d]=(0,l.useState)(""),c=[];o&&c.push({or:[{name:{contains:o}},{description:{contains:o}},{content:{contains:o}}]});let{data:u,loading:m}=(0,eT.Sh)({page:1,limit:50,filters:c,sort:{field:"favorite_count",direction:"DESC"}}),x=(null==u?void 0:null===(t=u.prompt_libraryPagination)||void 0===t?void 0:t.items)||[],p=i?x.filter(e=>e.assigned_agents&&e.assigned_agents.includes(i)):[],h=i?x.filter(e=>!e.assigned_agents||!e.assigned_agents.includes(i)):x,f=e=>{r(e),a(!1),d("")};return(0,n.jsx)(eb.Vq,{open:s,onOpenChange:a,children:(0,n.jsxs)(eb.cZ,{className:"max-w-2xl max-h-[80vh]",children:[(0,n.jsxs)(eb.fK,{children:[(0,n.jsx)(eb.$N,{children:"Select a Prompt"}),(0,n.jsx)(eb.Be,{children:"Choose a prompt template to insert into your message"})]}),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(ek.Z,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),(0,n.jsx)(ew.I,{placeholder:"Search prompts...",value:o,onChange:e=>d(e.target.value),className:"pl-10"})]}),(0,n.jsx)(ez.x,{className:"h-[400px] pr-4",children:m?(0,n.jsx)("div",{className:"space-y-3",children:[1,2,3].map(e=>(0,n.jsx)(ef.O,{className:"h-24 w-full"},e))}):(0,n.jsxs)("div",{className:"space-y-4",children:[p.length>0&&(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,n.jsx)(eC.Z,{className:"h-4 w-4 text-yellow-500"}),(0,n.jsx)("h3",{className:"text-sm font-medium",children:"Recommended for this agent"})]}),(0,n.jsx)("div",{className:"space-y-2",children:p.map(e=>(0,n.jsx)(eF,{prompt:e,onSelect:f},e.id))})]}),h.length>0&&(0,n.jsxs)("div",{children:[p.length>0&&(0,n.jsx)("h3",{className:"text-sm font-medium mb-2",children:"All Prompts"}),(0,n.jsx)("div",{className:"space-y-2",children:h.map(e=>(0,n.jsx)(eF,{prompt:e,onSelect:f},e.id))})]}),0===x.length&&!m&&(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(0,n.jsx)(y.Z,{className:"h-12 w-12 text-muted-foreground mb-3"}),(0,n.jsx)("h3",{className:"text-lg font-medium",children:"No prompts found"}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:o?"Try a different search term":"Create your first prompt in the Prompt Library"})]})]})})]})})}function eF(e){var t;let{prompt:s,onSelect:l}=e,a=(0,eS.H)(s.content);return(0,n.jsxs)("button",{onClick:()=>l(s),className:"w-full text-left p-3 rounded-lg border hover:bg-accent transition-colors",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-2 mb-1",children:[(0,n.jsx)("h4",{className:"font-medium text-sm",children:s.name}),(0,n.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground flex-shrink-0",children:[(0,n.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,n.jsx)(eC.Z,{className:"h-3 w-3"}),(0,n.jsx)("span",{children:s.favorite_count||0})]}),(0,n.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,n.jsx)(e_.Z,{className:"h-3 w-3"}),(0,n.jsx)("span",{children:s.usage_count||0})]})]})]}),s.description&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 mb-2",children:s.description}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-1",children:[a.length>0&&(0,n.jsxs)(R.C,{variant:"outline",className:"text-xs",children:[a.length," variable",1!==a.length?"s":""]}),null===(t=s.tags)||void 0===t?void 0:t.slice(0,2).map(e=>(0,n.jsx)(R.C,{variant:"secondary",className:"text-xs",children:e},e)),s.tags&&s.tags.length>2&&(0,n.jsxs)(R.C,{variant:"secondary",className:"text-xs",children:["+",s.tags.length-2]})]})]})}var eP=s(26815);function eL(e){return e?e.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}function eR(e){let{open:t,onOpenChange:s,variables:a,promptName:r,onSubmit:i}=e,[o,d]=(0,l.useState)({});(0,l.useEffect)(()=>{let e={};a.forEach(t=>{e[t]=""}),d(e)},[a]);let c=(e,t)=>{d(s=>({...s,[e]:t}))},u=a.every(e=>{var t;return null===(t=o[e])||void 0===t?void 0:t.trim()});return(0,n.jsx)(eb.Vq,{open:t,onOpenChange:s,children:(0,n.jsxs)(eb.cZ,{className:"max-w-md",children:[(0,n.jsxs)(eb.fK,{children:[(0,n.jsx)(eb.$N,{children:"Fill in Variables"}),(0,n.jsxs)(eb.Be,{children:['Complete the following fields for "',r,'"']})]}),(0,n.jsx)("div",{className:"space-y-4 py-4",children:a.map(e=>(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(eP._,{htmlFor:e,children:eL(e)}),(0,n.jsx)(ew.I,{id:e,placeholder:"Enter ".concat(eL(e).toLowerCase(),"..."),value:o[e]||"",onChange:t=>c(e,t.target.value)})]},e))}),(0,n.jsxs)(eb.cN,{children:[(0,n.jsx)(_.z,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),(0,n.jsx)(_.z,{onClick:()=>{i(o),d({})},disabled:!u,children:"Insert Prompt"})]})]})})}var eD=s(27648);function eZ(e){var t,s,a,x,p,M,U,E,A,B,W;let{session:q,agent:K,initialPromptId:H}=e,[es,en]=(0,l.useState)(null),el=l.useContext(N.E);(0,I.d)();let{theme:ea}=(0,eN.F)(),[er,ei]=(0,l.useState)(null),[eo,ed]=(0,l.useState)(null),{user:ec}=(0,l.useContext)(u.S),[eu,em]=(0,l.useState)(null),[ex,ep]=(0,l.useState)(!1),[eh,ef]=(0,l.useState)(""),[eg,eb]=(0,l.useState)([]),ew=l.useRef(null),{toast:ek}=(0,k.pm)(),[eC,e_]=(0,l.useState)(!1),[ez,eF]=(0,l.useState)(!1),[eP,eL]=(0,l.useState)(null),[eZ]=(0,eT.VR)(),[eU,eE]=(0,l.useState)({rights_mode:(null==q?void 0:q.rights_mode)||"private",users:(null==q?void 0:null===(t=q.RBAC)||void 0===t?void 0:t.users)||[],roles:(null==q?void 0:null===(s=q.RBAC)||void 0===s?void 0:s.roles)||[]}),eA=(0,i.aM)(g.L5,{variables:{id:q.created_by},skip:!q.created_by}),eB=(0,i.aM)(g.jL,{variables:{id:q.project},skip:!q.project}),{data:eO}=(0,i.aM)(g.X0,{variables:{id:H},skip:!H}),[eW,eq]=(0,l.useState)(!1),[eK,eJ]=(0,o.D)(g.r1),[eH,eV]=(0,l.useState)({totalTokens:0,reasoningTokens:0,inputTokens:0,outputTokens:0,cachedInputTokens:0});(0,i.aM)(g.N,{returnPartialData:!0,fetchPolicy:"network-only",nextFetchPolicy:"network-only",variables:{page:1,limit:50,filters:{session:{eq:q.id}}},onCompleted:e=>{(null==e?void 0:e.agent_messagesPagination)&&e0(null==e?void 0:e.agent_messagesPagination.items.map(e=>JSON.parse(e.content)))}});let{messages:eY,sendMessage:eX,status:e$,stop:eG,regenerate:eQ,setMessages:e0,addToolResult:e1}=(0,c.RJ)({sendAutomaticallyWhen:d.l0,experimental_throttle:50,async onToolCall(e){let{toolCall:t}=e;if(!t.dynamic&&"getLocation"===t.toolName){let e=["New York","Los Angeles","Chicago","San Francisco"];e1({tool:"confirm-tool-call",toolCallId:t.toolCallId,output:e[Math.floor(Math.random()*e.length)]})}},onError:e=>{console.log("error!!",null==e?void 0:e.message);try{let{message:t}=JSON.parse(null==e?void 0:e.message);en(t)}catch(t){en(e.message)}},transport:new d.PD({api:"".concat(null==el?void 0:el.backend).concat(K.slug,"/").concat(K.id),prepareSendMessagesRequest:async e=>{let{messages:t,id:s,body:n}=e,l=await (0,j.LP)();if(!l)throw Error("No valid session token available.");return{body:{...n,message:t[t.length-1],id:s,session:q.id},headers:{User:ec.id,Session:q.id,Authorization:"Bearer ".concat(l),Stream:"true"}}}})});(0,l.useEffect)(()=>{let e=null==eY?void 0:eY.reduce((e,t)=>{let s=t.metadata;return e+((null==s?void 0:s.totalTokens)||0)},0),t=null==eY?void 0:eY.reduce((e,t)=>{let s=t.metadata;return e+((null==s?void 0:s.reasoningTokens)||0)},0);eV({totalTokens:e,reasoningTokens:t,inputTokens:null==eY?void 0:eY.reduce((e,t)=>{let s=t.metadata;return e+((null==s?void 0:s.inputTokens)||0)},0),outputTokens:null==eY?void 0:eY.reduce((e,t)=>{let s=t.metadata;return e+((null==s?void 0:s.outputTokens)||0)},0),cachedInputTokens:null==eY?void 0:eY.reduce((e,t)=>{let s=t.metadata;return e+((null==s?void 0:s.cachedInputTokens)||0)},0)})},[eY]),(0,l.useMemo)(()=>{let e=(null==eY?void 0:eY.filter(e=>"user"===e.role))||[],t=(null==eY?void 0:eY.filter(e=>"assistant"===e.role))||[];return e.length>=1&&t.length>=1},[eY]);let e2=e=>{(0,eS.H)(e.content).length>0?(eL(e),eF(!0)):(e3(e.content),eZ({variables:{id:e.id,usage_count:(e.usage_count||0)+1}}))},e3=e=>{var t;ef(t=>t?"".concat(t,"\n\n").concat(e):e),null===(t=ew.current)||void 0===t||t.focus()};(0,l.useEffect)(()=>{if((null==eO?void 0:eO.prompt_library_itemById)&&!eW){let e=eO.prompt_library_itemById;eq(!0),e2(e)}},[eO,eW]);let e5=async(e,t)=>{e.preventDefault(),eX({text:eh,files:er||[]},{body:{disabledTools:eg}}),ef(""),ei(null),ed(null)},e4=e=>{eb(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},e8=(0,D.I)(q,ec),e6=async e=>{ei(await Promise.all(e.map(async e=>{if(!e.s3key){let t="";return Object.entries(e).forEach(e=>{let[s,n]=e;t+="".concat(s,": ").concat(n,"\n")}),{type:"file",mediaType:e.type,filename:e.name,url:"data:text/plain;base64,".concat(btoa(t))}}return{type:"file",mediaType:e.type,filename:e.name,url:await (0,Z.NF)(e.s3key)}})))};return(0,l.useEffect)(()=>{if(!eo){ei(null);return}e6(eo.map(e=>({s3key:e,name:e,type:"file"})))},[eo]),(0,n.jsx)("div",{className:"flex flex-col w-full mx-auto relative size-full",children:(0,n.jsx)("div",{className:"mx-auto relative size-full",children:(0,n.jsxs)("div",{className:"flex h-full w-full max-h-[calc(100vh)] overflow-y-auto overflow-x-hidden",children:[(0,n.jsxs)("div",{className:"flex flex-col flex-1 pb-6",children:[(0,n.jsxs)(z.ri,{className:"overflow-y-hidden",children:[K.maxContextLength?(0,n.jsx)(v.pn,{children:(0,n.jsxs)(v.u,{children:[(0,n.jsx)(v.aJ,{asChild:!0,children:(0,n.jsxs)("div",{className:"absolute w-full ".concat("top-0"),children:[(0,n.jsx)(O,{className:"w-full rounded-none",value:eH.totalTokens/K.maxContextLength*100}),(0,n.jsxs)("div",{className:"justify-between flex felx-row",children:[(0,n.jsx)("div",{}),(0,n.jsxs)(J,{maxTokens:K.maxContextLength||0,usedTokens:eH.totalTokens,usage:{inputTokens:eH.inputTokens,outputTokens:eH.outputTokens,totalTokens:eH.totalTokens,cachedInputTokens:eH.cachedInputTokens,reasoningTokens:eH.reasoningTokens},children:[(0,n.jsx)(V,{}),(0,n.jsxs)(Y,{children:[(0,n.jsx)(X,{}),(0,n.jsxs)($,{children:[(0,n.jsx)(G,{}),(0,n.jsx)(Q,{}),(0,n.jsx)(ee,{}),(0,n.jsx)(et,{})]})]})]})]})]})}),(0,n.jsx)(v._v,{children:(0,n.jsxs)("p",{children:[Intl.NumberFormat("en-US").format(eH.totalTokens)," / ",Intl.NumberFormat("en-US").format(K.maxContextLength)," tokens in the context window used."]})})]})}):null,(null==eY?void 0:eY.length)===0?(0,n.jsx)("div",{className:"size-full flex justify-center items-center",children:(0,n.jsxs)("div",{className:"flex flex-col gap-4 items-center max-w-2xl w-full px-4 my-auto",children:[(0,n.jsx)(ey.default,{alt:"Logo",width:120,height:120,className:"h-30 w-40 object-contain"}),(0,n.jsx)("p",{className:"text-center text-lg text-muted-foreground",children:"How can I help you today?"}),(0,n.jsx)(ej.Z,{agent:K,status:e$,className:"w-80"})]})}):null,(0,n.jsxs)(z.iG,{className:"px-6",children:[(null==eY?void 0:eY.length)>0&&(0,n.jsx)(ev.K,{messages:eY,config:{marginTopFirstMessage:"mt-12"},status:e$,onRegenerate:eQ,onAddToolResult:e1,UntypedToolPartComponent:eM,addToContext:e=>{ed([...eo||[],e])},writeAccess:e8}),"streaming"===e$?(0,n.jsx)(h,{}):null]})]}),!e8&&(0,n.jsx)("div",{className:"px-6 mx-auto mt-3",children:(0,n.jsx)(R.C,{variant:"outline",children:"Read access only"})}),es&&(0,n.jsx)("div",{className:"mx-5",children:(0,n.jsxs)(r.bZ,{className:"mb-3",variant:"destructive",children:[(0,n.jsx)(m.LPM,{className:"size-4"}),(0,n.jsx)(r.Cd,{children:"Error"}),(0,n.jsx)(r.X,{children:es})]})}),e8&&(0,n.jsxs)("form",{onSubmit:e5,className:"px-6 border-input border rounded flex mx-5 p-5 flex-col gap-2",children:[(0,n.jsxs)("div",{className:"items-center flex relative gap-2 w-full",children:[(null==el?void 0:null===(a=el.fileUploads)||void 0===a?void 0:a.s3endpoint)&&(0,n.jsx)(Z.ZP,{id:"chat-".concat(q.id),selectionLimit:10,allowedFileTypes:[...(null===(x=K.capabilities)||void 0===x?void 0:x.audio)||[],...(null===(p=K.capabilities)||void 0===p?void 0:p.video)||[],...(null===(M=K.capabilities)||void 0===M?void 0:M.files)||[],...(null===(U=K.capabilities)||void 0===U?void 0:U.images)||[]],dependencies:[],onConfirm:e=>{ed(e)}}),(0,n.jsx)(v.pn,{children:(0,n.jsxs)(v.u,{children:[(0,n.jsx)(v.aJ,{asChild:!0,children:(0,n.jsx)(_.z,{type:"button",variant:"outline",size:"icon",className:"shrink-0",onClick:()=>e_(!0),children:(0,n.jsx)(y.Z,{className:"h-5 w-5 text-muted-foreground"})})}),(0,n.jsx)(v._v,{children:(0,n.jsx)("p",{children:"Insert prompt from library"})})]})}),(0,n.jsx)(f.Z,{autoComplete:"off",autoFocus:!0,minRows:1,value:eh,ref:ew,onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),e5(e))},onChange:e=>ef(e.target.value),name:"message",placeholder:"Ask me anything...",className:"max-h-40 px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 w-full items-center h-28 resize-none overflow-hidden dark:bg-card/35"}),"streaming"!==e$?(0,n.jsx)(_.z,{className:"shrink-0",variant:"secondary",size:"icon",disabled:"submitted"===e$||!(null==eh?void 0:eh.trim()),children:(0,n.jsx)(b.Z,{className:" size-6 text-muted-foreground"})}):(0,n.jsx)(_.z,{className:"shrink-0",variant:"secondary",size:"icon",onClick:eG,children:(0,n.jsx)(m.wNq,{className:"size-6 text-muted-foreground"})})]}),(0,n.jsx)("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-3",children:null==eo?void 0:eo.map(e=>(0,n.jsx)(Z.jU,{s3Key:e,disabled:!0,active:!1,onRemove:()=>{ed(null==eo?void 0:eo.filter(t=>t!==e))}}))})]}),(0,n.jsx)(C.x,{isOpen:ex,onClose:()=>ep(!1),messages:eY||[],sessionTitle:q.title}),(0,n.jsx)(eI,{open:eC,onOpenChange:e_,onSelectPrompt:e2,agentId:K.id}),eP&&(0,n.jsx)(eR,{open:ez,onOpenChange:eF,variables:(0,eS.H)(eP.content),promptName:eP.name,onSubmit:e=>{eP&&(e3(function(e,t){if(!e)return"";if(!t||0===Object.keys(t).length)return e;let s=e;for(let[e,n]of Object.entries(t)){let t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l=RegExp("\\{\\{".concat(t,"\\}\\}"),"g");s=s.replace(l,n||"")}return s}(eP.content,e)),eZ({variables:{id:eP.id,usage_count:(eP.usage_count||0)+1}}),eF(!1),eL(null))}})]}),e8&&(0,n.jsxs)("div",{className:"w-80 border-l bg-muted/20 p-4 space-y-4",children:[(null==eY?void 0:eY.length)>0&&(0,n.jsx)("div",{children:(0,n.jsx)(ej.Z,{agent:K,status:e$,className:"w-80"})}),(0,n.jsx)("div",{children:(0,n.jsx)("p",{className:"text-sm font-medium text-center",children:K.name})}),K.description&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:K.description}),(0,n.jsx)("hr",{className:"my-2"}),(0,n.jsx)("div",{className:"mt-1",children:(0,n.jsxs)("div",{className:"border rounded",children:[eA.loading&&(0,n.jsxs)("div",{className:"flex flex-row justify-between p-3",children:[(0,n.jsx)("p",{className:"text-sm font-medium",children:"Session created by"}),(0,n.jsx)(L.g,{className:"ml-2"})]}),(null===(E=eA.data)||void 0===E?void 0:E.userById)&&!eA.loading&&(0,n.jsxs)("div",{className:"flex flex-row justify-between p-3",children:[(0,n.jsx)("p",{className:"text-sm font-medium",children:"Session created by"}),(0,n.jsx)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:(0,n.jsx)("p",{className:"text-sm font-medium capitalize",children:eA.data.userById.name})})]})]})}),q.project&&(0,n.jsx)("div",{className:"mt-1",children:(0,n.jsxs)("div",{className:"border rounded",children:[eB.loading&&(0,n.jsxs)("div",{className:"flex flex-row justify-between p-3",children:[(0,n.jsx)("p",{className:"text-sm font-medium",children:"This chat is part of a project:"}),(0,n.jsx)(L.g,{className:"ml-2"})]}),(null===(A=eB.data)||void 0===A?void 0:A.projectById)&&!eB.loading&&(0,n.jsxs)("div",{className:"flex flex-col p-3 gap-2",children:[(0,n.jsx)("p",{className:"text-sm font-medium",children:"Project"}),(0,n.jsx)(eD.default,{href:"/projects/".concat(q.project),className:"text-sm text-primary hover:underline",children:eB.data.projectById.name}),eB.data.projectById.description&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:eB.data.projectById.description})]})]})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-xs font-medium text-muted-foreground pt-2",children:"You can disable tools for individual messages in this session by clicking the switch:"}),(0,n.jsx)(v.pn,{children:(0,n.jsx)("div",{className:"space-y-1 pt-2",children:K.tools&&K.tools.length>0?K.tools.map(e=>{let t=!eg.includes(e.id);return(0,n.jsxs)(v.u,{children:[(0,n.jsx)(v.aJ,{asChild:!0,children:(0,n.jsxs)("div",{className:"p-2 rounded-md border text-xs bg-background flex items-center justify-between",children:[(0,n.jsx)("p",{className:"font-medium flex items-center gap-2",children:e.name}),(0,n.jsx)(T.r,{checked:t,onCheckedChange:()=>e4(e.id)})]})}),(0,n.jsx)(v._v,{children:(0,n.jsx)("p",{className:"max-w-[200px] text-wrap",children:e.description})})]},e.name)}):(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:"No tools enabled."})})})]}),(0,n.jsx)("div",{className:"mt-1",children:(0,n.jsxs)(P.zF,{className:"border rounded",children:[(0,n.jsx)(S.Ol,{className:"px-3 py-1",children:(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("div",{className:"flex flex-col",children:(0,n.jsxs)("p",{className:"text-sm font-medium",children:["Access control (",q.rights_mode,")"]})}),(0,n.jsx)(P.wy,{asChild:!0,children:(0,n.jsxs)(_.z,{variant:"ghost",size:"icon",className:"size-8",children:[(0,n.jsx)(w.Z,{className:"size-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Toggle"})]})})]})}),(0,n.jsx)(P.Fw,{children:(0,n.jsxs)(S.aY,{className:"space-y-4 p-3",children:[(0,n.jsx)(F.P,{allowedModes:["private","users","roles"],initialRightsMode:q.rights_mode,initialUsers:null===(B=q.RBAC)||void 0===B?void 0:B.users,initialRoles:null===(W=q.RBAC)||void 0===W?void 0:W.roles,onChange:(e,t,s)=>{eE({rights_mode:e,users:t,roles:s})}}),(0,n.jsxs)(_.z,{disabled:eJ.loading,onClick:()=>{eK({variables:{id:q.id,rights_mode:eU.rights_mode,RBAC:{users:eU.users,roles:eU.roles}}})},children:["Save access rights ",eJ.loading&&(0,n.jsx)(L.g,{className:"ml-2"})," "]})]})})]})})]})]})})})}let eM=e=>{var t;let{untypedToolPart:s,callId:l,addToContext:a}=e,r=s.output;console.log("output",r);let i=null===(t=s.type)||void 0===t?void 0:t.replace(/ /g,"-");return i=(null==(i=null==(i=null==i?void 0:i.replace(/tool-/g,""))?void 0:i.replace(/_/g," "))?void 0:i.charAt(0).toUpperCase())+(null==i?void 0:i.slice(1)),(0,n.jsxs)(ec,{className:"mt-3",defaultOpen:!1,children:[(0,n.jsx)(em,{className:"capitalize",type:i,state:s.state}),(0,n.jsxs)(ex,{children:[(0,n.jsx)(ep,{input:s.input}),(0,n.jsx)(eh,{output:r?(0,n.jsx)(eg.H,{children:"string"==typeof r?r:JSON.stringify(r,null,2)}):!s.errorText&&(0,n.jsx)(ef.O,{className:"h-4 w-full"}),errorText:s.errorText})]})]},l)},eU="force-dynamic";function eE(e){var t;let{params:s}=e,l=(0,a.useSearchParams)().get("promptId"),{data:o,loading:d,error:c}=(0,i.aM)(g.lk,{returnPartialData:!0,fetchPolicy:"network-only",nextFetchPolicy:"network-only",variables:{id:s.session}}),{data:u,loading:x,error:p}=(0,i.aM)(g.as,{skip:!(null==o?void 0:o.agent_sessionById),variables:{id:s.agent,project:(null==o?void 0:null===(t=o.agent_sessionById)||void 0===t?void 0:t.project)||void 0}});return d||x?(0,n.jsx)("div",{children:(0,n.jsx)(ef.O,{className:"w-full h-full"})}):c||p?(0,n.jsxs)(r.bZ,{variant:"destructive",children:[(0,n.jsx)(m.LPM,{className:"size-4"}),(0,n.jsx)(r.Cd,{children:"Error"}),(0,n.jsxs)(r.X,{children:["Error loading agent ",(null==p?void 0:p.message)||(null==c?void 0:c.message),"."]})]}):(null==u?void 0:u.agentById)&&(null==o?void 0:o.agent_sessionById)?(0,n.jsx)(eZ,{session:null==o?void 0:o.agent_sessionById,agent:u.agentById,initialPromptId:l||void 0}):(0,n.jsxs)(r.bZ,{variant:"destructive",children:[(0,n.jsx)(m.LPM,{className:"size-4"}),(0,n.jsx)(r.Cd,{children:"Error"}),(0,n.jsx)(r.X,{children:"Agent or session not found."})]})}},27182:function(e,t,s){"use strict";s.d(t,{iG:function(){return i},ri:function(){return r}});var n=s(57437);s(62869);var l=s(94508);s(2265);var a=s(20460);let r=e=>{let{className:t,...s}=e;return(0,n.jsx)(a.h,{className:(0,l.cn)("relative flex-1 overflow-y-auto",t),initial:"smooth",resize:"smooth",role:"log",...s})},i=e=>{let{className:t,...s}=e;return(0,n.jsx)(a.h.Content,{className:(0,l.cn)("p-4",t),...s})}},92279:function(e,t,s){"use strict";var n=s(57437),l=s(7882),a=s(11713),r=s(78361);let i=e=>{let{agent:t,status:s,className:i}=e,{data:o}=(0,a.a)({queryKey:["defaultAnimation","idle"],queryFn:async()=>(await fetch("/agent-idle.json")).json(),staleTime:36e5,enabled:!t.animation_idle}),{data:d}=(0,a.a)({queryKey:["defaultAnimation","responding"],queryFn:async()=>(await fetch("/agent-responding.json")).json(),staleTime:36e5,enabled:!t.animation_responding}),{data:c}=(0,a.a)({queryKey:["customAnimation",t.animation_idle],queryFn:async()=>{if(!t.animation_idle)return null;let e=await (0,r.NF)(t.animation_idle);return(await fetch(e)).json()},enabled:!!t.animation_idle,staleTime:3e5}),{data:u}=(0,a.a)({queryKey:["customAnimation",t.animation_responding],queryFn:async()=>{if(!t.animation_responding)return null;let e=await (0,r.NF)(t.animation_responding);return(await fetch(e)).json()},enabled:!!t.animation_responding,staleTime:3e5}),{View:m}=(0,l.useLottie)((()=>{switch(s){case"submitted":case"ready":case"error":default:return{animationData:c||o,loop:!0,autoplay:!0};case"streaming":return{animationData:u||d,loop:!0,autoplay:!0}}})());return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)("div",{className:"",children:(0,n.jsx)("div",{className:i,children:m})})})};t.Z=e=>{let{agent:t,status:s,className:l}=e;return(0,n.jsx)(i,{className:l,agent:t,status:s})}},77256:function(e,t,s){"use strict";s.d(t,{K:function(){return E}});var n=s(57437);s(16831);var l=s(94508);let a=e=>{let{className:t,from:s,...a}=e;return(0,n.jsx)("div",{className:(0,l.cn)("group flex w-full items-end justify-end gap-2 py-4","user"===s?"is-user flex-row-reverse justify-end":"is-assistant flex-row-reverse justify-end","[&>div]:max-w-[80%]",t),...a})},r=e=>{let{children:t,className:s,...a}=e;return(0,n.jsx)("div",{className:(0,l.cn)("flex flex-col gap-2 overflow-hidden rounded-lg py-3 text-foreground text-sm","group-[.is-user]:bg-secondary group-[.is-user]:text-primary-foreground group-[.is-user]:px-4","group-[.is-assistant]:bg-transparent group-[.is-assistant]:text-foreground",s),...a,children:(0,n.jsx)("div",{className:"is-user:dark",children:t})})};var i=s(62869),o=s(81103);let d=e=>{let{className:t,children:s,...a}=e;return(0,n.jsx)("div",{className:(0,l.cn)("flex items-center gap-1",t),...a,children:s})},c=e=>{let{tooltip:t,children:s,label:a,className:r,variant:d="ghost",size:c="sm",...u}=e,m=(0,n.jsxs)(i.z,{className:(0,l.cn)("size-9 p-1.5 text-muted-foreground hover:text-foreground",r),size:c,type:"button",variant:d,...u,children:[s,(0,n.jsx)("span",{className:"sr-only",children:a||t})]});return t?(0,n.jsx)(o.pn,{children:(0,n.jsxs)(o.u,{children:[(0,n.jsx)(o.aJ,{asChild:!0,children:m}),(0,n.jsx)(o._v,{children:(0,n.jsx)("p",{children:t})})]})}):m};var u=s(35629),m=s(80886),x=s(74928),p=s(64972),h=s(40875),f=s(2265);let v=(0,f.createContext)(null),g=()=>{let e=(0,f.useContext)(v);if(!e)throw Error("Reasoning components must be used within Reasoning");return e},j=(0,f.memo)(e=>{let{className:t,isStreaming:s=!1,open:a,defaultOpen:r=!1,onOpenChange:i,duration:o,children:d,...c}=e,[u,p]=(0,m.T)({prop:a,defaultProp:r,onChange:i}),[h,g]=(0,m.T)({prop:o,defaultProp:0}),[j,N]=(0,f.useState)(!1),[y,b]=(0,f.useState)(null);return(0,f.useEffect)(()=>{s?null===y&&b(Date.now()):null!==y&&(g(Math.round((Date.now()-y)/1e3)),b(null))},[s,y,g]),(0,f.useEffect)(()=>{if(s&&!u)p(!0);else if(!s&&u&&!r&&!j){let e=setTimeout(()=>{p(!1),N(!0)},1e3);return()=>clearTimeout(e)}},[s,u,r,p,j]),(0,n.jsx)(v.Provider,{value:{isStreaming:s,isOpen:u,setIsOpen:p,duration:h},children:(0,n.jsx)(x.zF,{className:(0,l.cn)("not-prose mb-4",t),onOpenChange:e=>{p(e)},open:u,...c,children:d})})}),N=(0,f.memo)(e=>{let{className:t,title:s="Reasoning",children:a,...r}=e,{isStreaming:i,isOpen:o,duration:d}=g();return(0,n.jsx)(x.wy,{className:(0,l.cn)("flex items-center gap-2 text-muted-foreground text-sm",t),...r,children:null!=a?a:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(p.Z,{className:"size-4"}),i||0===d?(0,n.jsx)("p",{children:"Thinking..."}):(0,n.jsxs)("p",{children:["Thought for ",d," seconds"]}),(0,n.jsx)(h.Z,{className:(0,l.cn)("size-4 text-muted-foreground transition-transform",o?"rotate-180":"rotate-0")})]})})}),y=(0,f.memo)(e=>{let{className:t,children:s,...a}=e;return(0,n.jsx)(x.Fw,{className:(0,l.cn)("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",t),...a,children:(0,n.jsx)(u.H,{className:"grid gap-2",children:s})})});j.displayName="Reasoning",N.displayName="ReasoningTrigger",y.displayName="ReasoningContent";var b=s(55455);let w=e=>{let{className:t,...s}=e;return(0,n.jsx)(x.zF,{className:(0,l.cn)("not-prose mb-4 text-primary text-xs",t),...s})},k=e=>{let{className:t,count:s,children:l,...a}=e;return(0,n.jsx)(x.wy,{className:"flex items-center gap-2",...a,children:null!=l?l:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("p",{className:"font-medium",children:["Used ",s," sources"]}),(0,n.jsx)(h.Z,{className:"h-4 w-4"})]})})},C=e=>{let{className:t,...s}=e;return(0,n.jsx)(x.Fw,{className:(0,l.cn)("mt-3 flex w-fit flex-col gap-2","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",t),...s})},_=e=>{let{href:t,title:s,children:l,...a}=e;return(0,n.jsx)("a",{className:"flex items-center gap-2",href:t,rel:"noreferrer",target:"_blank",...a,children:null!=l?l:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(b.Z,{className:"h-4 w-4"}),(0,n.jsx)("span",{className:"block font-medium",children:s})]})})};var T=s(52636),S=s(78867),z=s(33145),I=s(77992),F=s(40519),P=s(15863),L=s(66901),R=s(45131);let D={pending:{icon:F.Z,label:"Pending",className:"text-muted-foreground"},in_progress:{icon:P.Z,label:"In Progress",className:"text-blue-500 animate-spin"},completed:{icon:L.Z,label:"Completed",className:"text-green-500"},cancelled:{icon:R.Z,label:"Cancelled",className:"text-red-500"}},Z={high:{label:"High",className:"bg-red-500/10 text-red-500 border-red-500/20"},medium:{label:"Medium",className:"bg-yellow-500/10 text-yellow-500 border-yellow-500/20"},low:{label:"Low",className:"bg-blue-500/10 text-blue-500 border-blue-500/20"}},M=e=>{let{todos:t,showPriority:s=!1,state:a,className:r,...i}=e;if("string"==typeof t&&(t=JSON.parse(t)),!t||0===t.length)return null;let o=t.filter(e=>"completed"===e.status).length,d=t.length;return(0,n.jsxs)("div",{className:(0,l.cn)("my-2 space-y-1","input-streaming"===a&&"opacity-70",r),...i,children:[t.map((e,a)=>{let r=D[e.status]?D[e.status].icon:D.pending.icon,i=D[e.status]?D[e.status].className:D.pending.className;Z[e.priority]?Z[e.priority].className:Z.medium.className;let o="in_progress"===e.status&&a===t.findIndex(e=>"in_progress"===e.status);return(0,n.jsxs)("div",{className:(0,l.cn)("flex items-start gap-2 py-0.5","cancelled"===e.status&&"opacity-50"),children:[(0,n.jsx)("div",{className:"flex-shrink-0 pt-0.5",children:(0,n.jsx)(r,{className:(0,l.cn)("size-3.5",i)})}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("span",{className:(0,l.cn)("text-sm","completed"===e.status&&"text-muted-foreground line-through","cancelled"===e.status&&"text-muted-foreground line-through","in_progress"===e.status&&o&&"font-medium"),children:e.content}),s&&"high"===e.priority&&(0,n.jsx)("span",{className:"ml-2 text-red-500 text-xs",children:"(!)"})]})]},e.id)}),d>1&&(0,n.jsxs)("div",{className:"flex items-center gap-2 pt-1 text-muted-foreground text-xs",children:[(0,n.jsx)("div",{className:"h-1 flex-1 overflow-hidden rounded-full bg-secondary",children:(0,n.jsx)("div",{className:"h-full bg-primary transition-all duration-300",style:{width:"".concat(o/d*100,"%")}})}),(0,n.jsxs)("span",{className:"whitespace-nowrap",children:[o,"/",d]})]}),"output-error"===a&&(0,n.jsxs)("div",{className:"flex items-center gap-1 pt-1 text-red-500 text-xs",children:[(0,n.jsx)(R.Z,{className:"size-3"}),(0,n.jsx)("span",{children:"Error updating tasks"})]})]})};var U=s(78361);function E(e){let{messages:t,status:s="idle",className:i,showActions:o=!0,onRegenerate:m,onAddToolResult:x,UntypedToolPartComponent:p,addToContext:h,writeAccess:f=!0,config:v}=e,{toast:g}=(0,I.pm)();return(0,n.jsx)(n.Fragment,{children:null==t?void 0:t.map((e,t)=>{var b,I;let F=e.metadata,P=null!==(I=null===(b=e.parts.filter(e=>{var t;return"text"===e.type&&(null===(t=e.text)||void 0===t?void 0:t.includes('<file name="'))}))||void 0===b?void 0:b.flatMap(e=>{var t;let s=e.text.match(/<file name="([^"]+)">([^<]+)<\/file>/g);return null!==(t=null==s?void 0:s.map(e=>{var t,s,n,l;console.log("filePart",e);let a=null!==(n=null===(t=e.match(/<file name="([^"]+)">/))||void 0===t?void 0:t[1])&&void 0!==n?n:"";return console.log("s3Key",a),{s3Key:a,content:null!==(l=null===(s=e.match(/<file name="([^"]+)">([^<]+)<\/file>/))||void 0===s?void 0:s[2])&&void 0!==l?l:""}}))&&void 0!==t?t:[]}))&&void 0!==I?I:[];return console.log("files",P),(0,n.jsx)(a,{className:(0,l.cn)("assistant"===e.role&&((null==v?void 0:v.customAssistantClassnames)?null==v?void 0:v.customAssistantClassnames:""),0===t&&((null==v?void 0:v.marginTopFirstMessage)?null==v?void 0:v.marginTopFirstMessage:"mt-12"),i),from:e.role,children:(0,n.jsxs)(r,{children:[e.parts.map((t,l)=>{var a,r,i,o,d,c,m,f;if("step-start"===t.type)return null;if("text"===t.type){let s=t.text.replace(/<file name="([^"]+)">([^<]+)<\/file>/g,"");return(0,n.jsx)(u.H,{className:"chat-response-container",children:s},"".concat(e.id,"-").concat(l)+"_response")}if("tool-askForConfirmation"===t.type&&x){let e=t.toolCallId;switch(t.state){case"input-streaming":return(0,n.jsx)("div",{children:"Loading confirmation request..."},e);case"input-available":return(0,n.jsxs)("div",{children:[t.input.message,(0,n.jsxs)("div",{children:[(0,n.jsx)("button",{onClick:()=>x({tool:"askForConfirmation",toolCallId:e,output:"Yes, confirmed"}),children:"Yes"}),(0,n.jsx)("button",{onClick:()=>x({tool:"askForConfirmation",toolCallId:e,output:"No, denied"}),children:"No"})]})]},e);case"output-available":return(0,n.jsxs)("div",{children:["Tool call allowed: ",t.output]},e);case"output-error":return(0,n.jsxs)("div",{children:["Error: ",t.errorText]},e)}}if((null===(a=t.type)||void 0===a?void 0:a.toLowerCase().includes("preview_pdf"))||(null===(r=t.type)||void 0===r?void 0:r.toLowerCase().includes("pdf_file_in_a_web_view"))){let e=JSON.parse(null!==(c=null===(d=t.output)||void 0===d?void 0:d.result)&&void 0!==c?c:"{}");if(!(null==e?void 0:e.url))return(0,n.jsxs)("div",{children:["No URL provided for PDF preview ",JSON.stringify(e)]});let s="".concat(e.url,"#page=").concat(null!==(m=e.page)&&void 0!==m?m:1);return(0,n.jsx)("iframe",{src:s,style:{width:"100%",height:"100vh"},title:"PDF viewer"})}if((null===(i=t.type)||void 0===i?void 0:i.toLowerCase())==="tool-todo_write"||(null===(o=t.type)||void 0===o?void 0:o.toLowerCase())==="tool-todo_read"){let e=t.output;if(!(null==e?void 0:e.result))return null;let s=t.state;return(0,n.jsx)(M,{todos:e.result,showPriority:!0,state:s})}if((t.type.startsWith("tool-")||"dynamic-tool"===t.type)&&p&&h){let e=t.toolCallId;return(0,n.jsx)(p,{untypedToolPart:t,callId:e,addToContext:h},e)}return"file"===t.type&&(null===(f=t.mediaType)||void 0===f?void 0:f.startsWith("image/"))?(0,n.jsx)(z.default,{src:t.url,width:300,height:300,alt:"Generated image"},"".concat(e.id,"-").concat(l)):"source-url"===t.type?(0,n.jsxs)(w,{children:[(0,n.jsx)(k,{count:e.parts.filter(e=>"source-url"===e.type).length}),(0,n.jsx)(C,{children:e.parts.map((t,s)=>{if("source-url"===t.type)return(0,n.jsx)(_,{href:t.url,title:t.title},"".concat(e.id,"-").concat(s))})},"".concat(e.id))]},"".concat(e.id,"-").concat(l)):"reasoning"===t.type?(0,n.jsxs)(j,{className:"w-full",isStreaming:"streaming"===s,children:[(0,n.jsx)(N,{}),(0,n.jsx)(y,{children:t.text})]},"".concat(e.id,"-").concat(l)):null}),P.length>0&&(0,n.jsx)("div",{className:"grid grid-cols-6 min-w-[500px] gap-2 mt-3 mb-3",children:P.map(t=>(0,n.jsx)(U.jU,{s3Key:t.s3Key,onRemove:()=>{},active:!1,disabled:!1},t.s3Key+"_file_item_"+e.id))}),o&&"assistant"===e.role&&(0,n.jsxs)(d,{className:"mt-2",children:[m&&(0,n.jsx)(c,{onClick:()=>m(),label:"Retry",disabled:!f,children:(0,n.jsx)(T.Z,{className:"size-3"})}),(0,n.jsx)(c,{onClick:()=>{navigator.clipboard.writeText(e.parts.map(e=>(null==e?void 0:e.text)||"").join("\n")),g({title:"Copied message",description:"The message was copied to your clipboard."})},label:"Copy",children:(0,n.jsx)(S.Z,{className:"size-3"})}),(null==F?void 0:F.totalTokens)&&(0,n.jsxs)("small",{className:"text-muted-foreground",children:[Intl.NumberFormat("en-US").format(null==F?void 0:F.totalTokens)," tokens"]})]})]})},e.id)})})}},1828:function(e,t,s){"use strict";s.d(t,{r:function(){return i}});var n=s(57437),l=s(50721),a=s(2265),r=s(94508);let i=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)(l.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),...a,ref:t,children:(0,n.jsx)(l.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=l.fC.displayName},12194:function(e,t,s){"use strict";s.d(t,{EE:function(){return i},Lq:function(){return x},Sh:function(){return r},VR:function(){return c},er:function(){return o},iJ:function(){return d}});var n=s(7211),l=s(12199),a=s(27689);let r=e=>{var t,s,l,r;return(0,n.aM)(a.xx,{variables:{page:null!==(t=null==e?void 0:e.page)&&void 0!==t?t:1,limit:null!==(s=null==e?void 0:e.limit)&&void 0!==s?s:20,filters:null!==(l=null==e?void 0:e.filters)&&void 0!==l?l:[],sort:null!==(r=null==e?void 0:e.sort)&&void 0!==r?r:{field:"updatedAt",direction:"DESC"}}})},i=()=>(0,l.D)(a.Iv,{refetchQueries:[{query:a.xx,variables:{page:1,limit:20}}]}),o=()=>(0,l.D)(a.jA),d=()=>(0,l.D)(a.Ll,{refetchQueries:[{query:a.xx,variables:{page:1,limit:20}}]}),c=()=>(0,l.D)(a.re),u=()=>(0,l.D)(a.Nl),m=()=>(0,l.D)(a.m8),x=()=>{let[e]=u(),[t]=m(),[s]=(0,l.D)(a.UK);return{toggleFavorite:async(n,l,a,r,i)=>{a&&i?(await t({variables:{id:i}}),await s({variables:{id:n,favorite_count:Math.max(0,r-1)}})):(await e({variables:{user_id:l,prompt_id:n}}),await s({variables:{id:n,favorite_count:r+1}}))}}}},87393:function(e,t,s){"use strict";s.d(t,{I:function(){return n}});let n=(e,t)=>{var s,n,l,a,r,i;let o="private"===e.rights_mode,d="public"===e.rights_mode,c="users"===e.rights_mode,u="roles"===e.rights_mode,m=t.super_admin,x=e.created_by===t.id.toString(),p=!1;return o&&x&&(p=!0),d&&(p=!0),c&&(p=(null===(l=e.RBAC)||void 0===l?void 0:null===(n=l.users)||void 0===n?void 0:null===(s=n.find(e=>e.id===t.id))||void 0===s?void 0:s.rights)==="write"),u&&(p=(null===(i=e.RBAC)||void 0===i?void 0:null===(r=i.roles)||void 0===r?void 0:null===(a=r.find(e=>{var s;return e.id===(null===(s=t.role)||void 0===s?void 0:s.id)}))||void 0===a?void 0:a.rights)==="write"),m&&(p=!0),p}},84544:function(e,t,s){"use strict";function n(e){if(!e)return[];let t=e.matchAll(/\{\{([a-zA-Z0-9_]+)\}\}/g),s=new Set;for(let e of Array.from(t))s.add(e[1]);return Array.from(s).sort()}s.d(t,{H:function(){return n}})}},function(e){e.O(0,[329,6840,8310,3954,4705,3611,6989,5987,9851,7629,7093,6148,847,1942,7648,7823,8068,5799,605,4567,1206,5338,1785,5110,3171,1425,1713,192,7086,3145,8293,6373,3832,8030,3750,1957,2971,2117,1744],function(){return e(e.s=395)}),_N_E=e.O()}]);
2
+ //# sourceMappingURL=page-7edb1c7c850f982c.js.map