reflex-agent 0.13.4 → 0.14.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 (182) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +102 -95
  3. package/.next/app-path-routes-manifest.json +8 -7
  4. package/.next/build-manifest.json +5 -5
  5. package/.next/prerender-manifest.json +3 -3
  6. package/.next/react-loadable-manifest.json +1 -1
  7. package/.next/server/app/_not-found/page.js +1 -1
  8. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  9. package/.next/server/app/agents/[agentId]/page.js +1 -1
  10. package/.next/server/app/agents/[agentId]/page_client-reference-manifest.js +1 -1
  11. package/.next/server/app/api/agents/[agentId]/respond/route.js +1 -1
  12. package/.next/server/app/api/agents/[agentId]/respond/route_client-reference-manifest.js +1 -1
  13. package/.next/server/app/api/images/[rootId]/[file]/route_client-reference-manifest.js +1 -1
  14. package/.next/server/app/api/oauth/callback/route_client-reference-manifest.js +1 -1
  15. package/.next/server/app/api/oauth/start/route_client-reference-manifest.js +1 -1
  16. package/.next/server/app/api/roots/[id]/attachments/route_client-reference-manifest.js +1 -1
  17. package/.next/server/app/api/roots/[id]/chat/[topicId]/send/route.js +1 -1
  18. package/.next/server/app/api/roots/[id]/chat/[topicId]/send/route_client-reference-manifest.js +1 -1
  19. package/.next/server/app/api/roots/[id]/chat/[topicId]/stop/route.js +1 -1
  20. package/.next/server/app/api/roots/[id]/chat/[topicId]/stop/route_client-reference-manifest.js +1 -1
  21. package/.next/server/app/api/roots/[id]/chat/[topicId]/stream/route.js +1 -1
  22. package/.next/server/app/api/roots/[id]/chat/[topicId]/stream/route_client-reference-manifest.js +1 -1
  23. package/.next/server/app/api/roots/[id]/dashboard/route.js +1 -1
  24. package/.next/server/app/api/roots/[id]/dashboard/route_client-reference-manifest.js +1 -1
  25. package/.next/server/app/api/roots/[id]/suggestions/route.js +1 -1
  26. package/.next/server/app/api/roots/[id]/suggestions/route_client-reference-manifest.js +1 -1
  27. package/.next/server/app/api/utilities/[scope]/[id]/bundle.js/route_client-reference-manifest.js +1 -1
  28. package/.next/server/app/api/utilities/[scope]/[id]/host/route.js +1 -1
  29. package/.next/server/app/api/utilities/[scope]/[id]/host/route_client-reference-manifest.js +1 -1
  30. package/.next/server/app/api/utilities/[scope]/[id]/host-api.mjs/route_client-reference-manifest.js +1 -1
  31. package/.next/server/app/api/utilities/[scope]/[id]/host-ui.mjs/route.js +53 -1
  32. package/.next/server/app/api/utilities/[scope]/[id]/host-ui.mjs/route_client-reference-manifest.js +1 -1
  33. package/.next/server/app/api/utilities/[scope]/[id]/iframe/route_client-reference-manifest.js +1 -1
  34. package/.next/server/app/api/utilities/[scope]/[id]/style.css/route_client-reference-manifest.js +1 -1
  35. package/.next/server/app/api/utilities/install-archive/route.js +1 -0
  36. package/.next/server/app/api/utilities/install-archive/route.js.nft.json +1 -0
  37. package/.next/server/app/api/utilities/install-archive/route_client-reference-manifest.js +1 -0
  38. package/.next/server/app/audit/page.js +2 -2
  39. package/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  40. package/.next/server/app/onboarding/page.js +2 -2
  41. package/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  42. package/.next/server/app/page.js +2 -2
  43. package/.next/server/app/page.js.nft.json +1 -1
  44. package/.next/server/app/page_client-reference-manifest.js +1 -1
  45. package/.next/server/app/roots/[id]/chat/[topicId]/page.js +2 -2
  46. package/.next/server/app/roots/[id]/chat/[topicId]/page.js.nft.json +1 -1
  47. package/.next/server/app/roots/[id]/chat/[topicId]/page_client-reference-manifest.js +1 -1
  48. package/.next/server/app/roots/[id]/kb/[...slug]/page.js +2 -2
  49. package/.next/server/app/roots/[id]/kb/[...slug]/page.js.nft.json +1 -1
  50. package/.next/server/app/roots/[id]/kb/[...slug]/page_client-reference-manifest.js +1 -1
  51. package/.next/server/app/roots/[id]/memory/page.js +1 -1
  52. package/.next/server/app/roots/[id]/memory/page_client-reference-manifest.js +1 -1
  53. package/.next/server/app/roots/[id]/page.js +6 -6
  54. package/.next/server/app/roots/[id]/page.js.nft.json +1 -1
  55. package/.next/server/app/roots/[id]/page_client-reference-manifest.js +1 -1
  56. package/.next/server/app/roots/[id]/workflows/[wfId]/page.js +2 -2
  57. package/.next/server/app/roots/[id]/workflows/[wfId]/page.js.nft.json +1 -1
  58. package/.next/server/app/roots/[id]/workflows/[wfId]/page_client-reference-manifest.js +1 -1
  59. package/.next/server/app/roots/[id]/workflows/page.js +2 -2
  60. package/.next/server/app/roots/[id]/workflows/page.js.nft.json +1 -1
  61. package/.next/server/app/roots/[id]/workflows/page_client-reference-manifest.js +1 -1
  62. package/.next/server/app/roots/new/page.js +4 -4
  63. package/.next/server/app/roots/new/page_client-reference-manifest.js +1 -1
  64. package/.next/server/app/settings/page.js +5 -5
  65. package/.next/server/app/settings/page.js.nft.json +1 -1
  66. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  67. package/.next/server/app/share/[id]/file/page.js +2 -2
  68. package/.next/server/app/share/[id]/file/page_client-reference-manifest.js +1 -1
  69. package/.next/server/app/share/[id]/page.js +2 -2
  70. package/.next/server/app/share/[id]/page_client-reference-manifest.js +1 -1
  71. package/.next/server/app/utilities/[scope]/[id]/page.js +2 -2
  72. package/.next/server/app/utilities/[scope]/[id]/page.js.nft.json +1 -1
  73. package/.next/server/app/utilities/[scope]/[id]/page_client-reference-manifest.js +1 -1
  74. package/.next/server/app/utilities/page.js +2 -2
  75. package/.next/server/app/utilities/page_client-reference-manifest.js +1 -1
  76. package/.next/server/app-paths-manifest.json +8 -7
  77. package/.next/server/chunks/1105.js +1 -1
  78. package/.next/server/chunks/1358.js +1 -1
  79. package/.next/server/chunks/285.js +9 -6
  80. package/.next/server/chunks/3091.js +1 -0
  81. package/.next/server/chunks/3332.js +1 -1
  82. package/.next/server/chunks/3795.js +3 -0
  83. package/.next/server/chunks/{2688.js → 4299.js} +2 -2
  84. package/.next/server/chunks/4812.js +1 -1
  85. package/.next/server/chunks/4925.js +1 -1
  86. package/.next/server/chunks/{8425.js → 6648.js} +1 -1
  87. package/.next/server/chunks/7300.js +56 -4
  88. package/.next/server/chunks/7358.js +3 -0
  89. package/.next/server/chunks/9098.js +1 -1
  90. package/.next/server/chunks/969.js +1 -0
  91. package/.next/server/chunks/9809.js +1 -1
  92. package/.next/server/chunks/9861.js +57 -5
  93. package/.next/server/functions-config-manifest.json +1 -0
  94. package/.next/server/middleware-build-manifest.js +1 -1
  95. package/.next/server/middleware-manifest.json +5 -5
  96. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  97. package/.next/server/pages/500.html +1 -1
  98. package/.next/server/server-reference-manifest.js +1 -1
  99. package/.next/server/server-reference-manifest.json +1 -1
  100. package/.next/static/1y4wPze4yO8DprxGKwSXQ/_buildManifest.js +1 -0
  101. package/.next/static/chunks/{5596-93b53c14a2d5c59a.js → 2608-755e5d9ca79c19dc.js} +1 -1
  102. package/.next/static/chunks/4108.17cd7704e88bcb32.js +1 -0
  103. package/.next/static/chunks/{9001-6f38a673a3868871.js → 4442-79daa48fe7845771.js} +1 -1
  104. package/.next/static/chunks/6226-819ec17660994a7d.js +1 -0
  105. package/.next/static/chunks/7922-9a16eb68adcc7498.js +1 -0
  106. package/.next/static/chunks/9624-7dc547ab202a1d82.js +1 -0
  107. package/.next/static/chunks/app/api/agents/[agentId]/respond/route-5d0cd3b754198853.js +1 -0
  108. package/.next/static/chunks/app/api/images/[rootId]/[file]/route-5d0cd3b754198853.js +1 -0
  109. package/.next/static/chunks/app/api/oauth/callback/route-5d0cd3b754198853.js +1 -0
  110. package/.next/static/chunks/app/api/oauth/start/route-5d0cd3b754198853.js +1 -0
  111. package/.next/static/chunks/app/api/roots/[id]/attachments/route-5d0cd3b754198853.js +1 -0
  112. package/.next/static/chunks/app/api/roots/[id]/chat/[topicId]/send/route-5d0cd3b754198853.js +1 -0
  113. package/.next/static/chunks/app/api/roots/[id]/chat/[topicId]/stop/route-5d0cd3b754198853.js +1 -0
  114. package/.next/static/chunks/app/api/roots/[id]/chat/[topicId]/stream/route-5d0cd3b754198853.js +1 -0
  115. package/.next/static/chunks/app/api/roots/[id]/dashboard/route-5d0cd3b754198853.js +1 -0
  116. package/.next/static/chunks/app/api/roots/[id]/suggestions/route-5d0cd3b754198853.js +1 -0
  117. package/.next/static/chunks/app/api/utilities/[scope]/[id]/bundle.js/route-5d0cd3b754198853.js +1 -0
  118. package/.next/static/chunks/app/api/utilities/[scope]/[id]/host/route-5d0cd3b754198853.js +1 -0
  119. package/.next/static/chunks/app/api/utilities/[scope]/[id]/host-api.mjs/route-5d0cd3b754198853.js +1 -0
  120. package/.next/static/chunks/app/api/utilities/[scope]/[id]/host-ui.mjs/route-5d0cd3b754198853.js +1 -0
  121. package/.next/static/chunks/app/api/utilities/[scope]/[id]/iframe/route-5d0cd3b754198853.js +1 -0
  122. package/.next/static/chunks/app/api/utilities/[scope]/[id]/style.css/route-5d0cd3b754198853.js +1 -0
  123. package/.next/static/chunks/app/api/utilities/install-archive/route-5d0cd3b754198853.js +1 -0
  124. package/.next/static/chunks/app/layout-5caae9e60f5d6d42.js +1 -0
  125. package/.next/static/chunks/app/onboarding/page-3bb8ad02f9c88fdf.js +1 -0
  126. package/.next/static/chunks/app/{page-0c090eba51732036.js → page-6e32890e646e50aa.js} +1 -1
  127. package/.next/static/chunks/app/roots/[id]/chat/[topicId]/{page-292bc4cdceb6ea1d.js → page-ac00a7a8d6a16da8.js} +1 -1
  128. package/.next/static/chunks/app/roots/[id]/kb/[...slug]/{page-5e4f7b893c02c2bd.js → page-14cb4b8a24e40dc7.js} +1 -1
  129. package/.next/static/chunks/app/roots/[id]/layout-5d0cd3b754198853.js +1 -0
  130. package/.next/static/chunks/app/roots/[id]/memory/page-7bbe675652b7f9e8.js +1 -0
  131. package/.next/static/chunks/app/roots/[id]/page-2080ede443a668d2.js +1 -0
  132. package/.next/static/chunks/app/roots/[id]/workflows/[wfId]/page-c744450355558209.js +1 -0
  133. package/.next/static/chunks/app/roots/[id]/workflows/page-8175a0fbbc465472.js +1 -0
  134. package/.next/static/chunks/app/roots/new/page-3d83b5dfb0a8f869.js +1 -0
  135. package/.next/static/chunks/app/settings/page-550fab06213d866c.js +1 -0
  136. package/.next/static/chunks/app/share/[id]/page-c290e46d1beba1ff.js +1 -0
  137. package/.next/static/chunks/app/utilities/[scope]/[id]/{page-ea8352712b521f75.js → page-5aaa4731a5ab783d.js} +1 -1
  138. package/.next/static/chunks/app/utilities/page-0e362fd622574297.js +1 -0
  139. package/.next/static/chunks/{webpack-a4eadc02863be5eb.js → webpack-e60c7ddfa84db519.js} +1 -1
  140. package/.next/trace +90 -90
  141. package/.next/types/app/api/utilities/install-archive/route.ts +347 -0
  142. package/.next/types/routes.d.ts +2 -1
  143. package/.next/types/validator.ts +9 -0
  144. package/dist/lib/reflex/prompts/defaults.js +3 -0
  145. package/dist/lib/reflex/prompts/defaults.js.map +1 -1
  146. package/package.json +2 -1
  147. package/.next/server/chunks/2678.js +0 -3
  148. package/.next/server/chunks/491.js +0 -1
  149. package/.next/server/chunks/6238.js +0 -1
  150. package/.next/static/chunks/3717-339a6fc5e3b929f9.js +0 -1
  151. package/.next/static/chunks/4108.58294dcccaecb2f1.js +0 -1
  152. package/.next/static/chunks/4179-847dcd61bef8c59f.js +0 -1
  153. package/.next/static/chunks/4273-0b053f2035ad088d.js +0 -1
  154. package/.next/static/chunks/app/api/agents/[agentId]/respond/route-7e2f82a91b10b7e2.js +0 -1
  155. package/.next/static/chunks/app/api/images/[rootId]/[file]/route-7e2f82a91b10b7e2.js +0 -1
  156. package/.next/static/chunks/app/api/oauth/callback/route-7e2f82a91b10b7e2.js +0 -1
  157. package/.next/static/chunks/app/api/oauth/start/route-7e2f82a91b10b7e2.js +0 -1
  158. package/.next/static/chunks/app/api/roots/[id]/attachments/route-7e2f82a91b10b7e2.js +0 -1
  159. package/.next/static/chunks/app/api/roots/[id]/chat/[topicId]/send/route-7e2f82a91b10b7e2.js +0 -1
  160. package/.next/static/chunks/app/api/roots/[id]/chat/[topicId]/stop/route-7e2f82a91b10b7e2.js +0 -1
  161. package/.next/static/chunks/app/api/roots/[id]/chat/[topicId]/stream/route-7e2f82a91b10b7e2.js +0 -1
  162. package/.next/static/chunks/app/api/roots/[id]/dashboard/route-7e2f82a91b10b7e2.js +0 -1
  163. package/.next/static/chunks/app/api/roots/[id]/suggestions/route-7e2f82a91b10b7e2.js +0 -1
  164. package/.next/static/chunks/app/api/utilities/[scope]/[id]/bundle.js/route-7e2f82a91b10b7e2.js +0 -1
  165. package/.next/static/chunks/app/api/utilities/[scope]/[id]/host/route-7e2f82a91b10b7e2.js +0 -1
  166. package/.next/static/chunks/app/api/utilities/[scope]/[id]/host-api.mjs/route-7e2f82a91b10b7e2.js +0 -1
  167. package/.next/static/chunks/app/api/utilities/[scope]/[id]/host-ui.mjs/route-7e2f82a91b10b7e2.js +0 -1
  168. package/.next/static/chunks/app/api/utilities/[scope]/[id]/iframe/route-7e2f82a91b10b7e2.js +0 -1
  169. package/.next/static/chunks/app/api/utilities/[scope]/[id]/style.css/route-7e2f82a91b10b7e2.js +0 -1
  170. package/.next/static/chunks/app/layout-5e042e4e97dcea31.js +0 -1
  171. package/.next/static/chunks/app/onboarding/page-97aa4ad99276380f.js +0 -1
  172. package/.next/static/chunks/app/roots/[id]/layout-7e2f82a91b10b7e2.js +0 -1
  173. package/.next/static/chunks/app/roots/[id]/memory/page-b1fd919707f00c99.js +0 -1
  174. package/.next/static/chunks/app/roots/[id]/page-da97fb20eef9677c.js +0 -1
  175. package/.next/static/chunks/app/roots/[id]/workflows/[wfId]/page-932edf8ce73b23bc.js +0 -1
  176. package/.next/static/chunks/app/roots/[id]/workflows/page-7339062dee577728.js +0 -1
  177. package/.next/static/chunks/app/roots/new/page-c96a333c1ef53fba.js +0 -1
  178. package/.next/static/chunks/app/settings/page-75c61dd145bed57e.js +0 -1
  179. package/.next/static/chunks/app/share/[id]/page-e4b74cf795d4e211.js +0 -1
  180. package/.next/static/chunks/app/utilities/page-b5514f6c3291e23f.js +0 -1
  181. package/.next/static/my3C6nd2vY80TaiBNwet5/_buildManifest.js +0 -1
  182. /package/.next/static/{my3C6nd2vY80TaiBNwet5 → 1y4wPze4yO8DprxGKwSXQ}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{13506:(e,t,s)=>{"use strict";s.d(t,{cn:()=>n});var a=s(47989),r=s(55701);function n(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return(0,r.QP)((0,a.$)(t))}},17848:(e,t,s)=>{Promise.resolve().then(s.bind(s,70521)),Promise.resolve().then(s.t.bind(s,60290,23)),Promise.resolve().then(s.bind(s,43450)),Promise.resolve().then(s.bind(s,52713))},37829:(e,t,s)=>{"use strict";s.d(t,{L:()=>r});var a=s(7911);let r=(0,a.createServerReference)("60aca7b73665ef85604f648bbe1616034cd83463a3",a.callServer,void 0,a.findSourceMapURL,"deleteTopicAction")},43450:(e,t,s)=>{"use strict";s.d(t,{Toaster:()=>u});var a=s(4624),r=s(58726),n=s(42795),l=s(85924),i=s(69259),c=s(3239),o=s(41085),d=s(56221);let u=e=>{let{...t}=e,{theme:s="system"}=(0,o.D)();return(0,a.jsx)(d.l$,{theme:s,className:"toaster group",icons:{success:(0,a.jsx)(r.A,{className:"size-4"}),info:(0,a.jsx)(n.A,{className:"size-4"}),warning:(0,a.jsx)(l.A,{className:"size-4"}),error:(0,a.jsx)(i.A,{className:"size-4"}),loading:(0,a.jsx)(c.A,{className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},...t})}},60290:()=>{},63514:(e,t,s)=>{"use strict";s.d(t,{$d:()=>n,S9:()=>l,Zi:()=>r});var a=s(99356);let r={rootsChanged:"reflex:roots-changed",topicsChanged:e=>"reflex:topics-changed:".concat(e),kbChanged:e=>"reflex:kb-changed:".concat(e)};function n(e,t){window.dispatchEvent(new CustomEvent(e,{detail:t}))}function l(e,t){(0,a.useEffect)(()=>{let s=e=>t(e.detail);return window.addEventListener(e,s),()=>window.removeEventListener(e,s)},[e,t])}},70521:(e,t,s)=>{"use strict";s.d(t,{AppSidebar:()=>Z});var a=s(4624),r=s(99356),n=s(54400),l=s.n(n),i=s(69285),c=s(56221),o=s(49411),d=s(8096),u=s(72754),x=s(70762),h=s(69709),m=s(69205),p=s(9923),f=s(49623),g=s(3239),j=s(79182),b=s(42146),v=s(46972),N=s(37829),w=s(63514),y=s(80192),k=s(91074),A=s(85253),S=s(7911);let C=(0,S.createServerReference)("405eec77015823504c4d87c03db040d53fa326e6e4",S.callServer,void 0,S.findSourceMapURL,"loadKbSectionsAction"),z=(0,S.createServerReference)("404d285de9f75afe539d9c23e180e4b21e3e7f6d72",S.callServer,void 0,S.findSourceMapURL,"loadTopicsAction"),R=(0,S.createServerReference)("40063ad620375e57329871a0f9124a04c117ad5cc3",S.callServer,void 0,S.findSourceMapURL,"loadSidebarMemoryAction"),I=(0,S.createServerReference)("4015f6e0e4760a82616dc12e15576087d7b6702fe1",S.callServer,void 0,S.findSourceMapURL,"loadSidebarUtilitiesAction"),E=(0,S.createServerReference)("00845f96527f3684e6def80bdc0f333ecb2b61ef09",S.callServer,void 0,S.findSourceMapURL,"listRootsAction"),L=(0,S.createServerReference)("40e724d0266b2a3a906045e1cd0703077a4ac6ecbc",S.callServer,void 0,S.findSourceMapURL,"listAgentsAction");var U=s(39624),_=s(53296),P=s(50469),M=s(50988),T=s(63622),$=s(40805);function Z(e){let{initialRoots:t}=e,s=(0,i.usePathname)(),n=(0,o.c)("app"),[c,h]=(0,r.useState)(t),m=(0,r.useCallback)(async()=>{let e=await E();e.ok&&h(e.entries)},[]);return((0,w.S9)(w.Zi.rootsChanged,m),(null==s?void 0:s.startsWith("/share/"))||"/share"===s)?null:(0,a.jsxs)("aside",{className:"w-72 shrink-0 border-r bg-muted/30 flex flex-col",children:[(0,a.jsxs)("div",{className:"px-4 py-4 flex items-center gap-2 border-b",children:[(0,a.jsx)("span",{className:"reflex-gradient inline-flex h-7 w-7 items-center justify-center rounded-lg text-white shadow-sm",children:(0,a.jsx)(d.A,{className:"h-4 w-4"})}),(0,a.jsxs)("div",{className:"leading-tight",children:[(0,a.jsx)(l(),{href:"/",className:"text-sm font-semibold tracking-tight hover:underline",children:"Reflex"}),(0,a.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:"knowledge base"})]})]}),(0,a.jsx)(y.F,{className:"flex-1",children:(0,a.jsxs)("nav",{className:"px-2 pt-3 pb-6",children:[(0,a.jsx)("div",{className:"px-2 mb-1 text-[10px] uppercase tracking-wider text-muted-foreground",children:n("sidebar.spaces")}),0===c.length?(0,a.jsx)("div",{className:"px-2 py-3 text-xs text-muted-foreground",children:n("sidebar.empty")}):(0,a.jsx)("ul",{className:"space-y-0.5",children:c.map(e=>{var t;return(0,a.jsx)(D,{root:e,active:null!=(t=null==s?void 0:s.startsWith("/roots/".concat(e.id)))&&t},e.id)})}),(0,a.jsx)("div",{className:"mt-2 px-2",children:(0,a.jsx)(A.$,{asChild:!0,variant:"ghost",size:"sm",className:"h-7 w-full justify-start text-xs",children:(0,a.jsxs)(l(),{href:"/roots/new",children:[(0,a.jsx)(u.A,{className:"mr-1 h-3.5 w-3.5"})," ",n("sidebar.addSpace")]})})})]})}),(0,a.jsx)(k.Separator,{}),(0,a.jsxs)("div",{className:"px-2 py-2 space-y-0.5",children:[(0,a.jsx)(A.$,{asChild:!0,variant:"/utilities"===s||(null==s?void 0:s.startsWith("/utilities/"))?"secondary":"ghost",size:"sm",className:"w-full justify-start",children:(0,a.jsxs)(l(),{href:"/utilities",children:[(0,a.jsx)(U.A,{className:"mr-2 h-4 w-4"})," ",n("sidebar.utilities")]})}),(0,a.jsx)(A.$,{asChild:!0,variant:"/audit"===s?"secondary":"ghost",size:"sm",className:"w-full justify-start",children:(0,a.jsxs)(l(),{href:"/audit",children:[(0,a.jsx)(_.A,{className:"mr-2 h-4 w-4"})," ",n("sidebar.audit")]})}),(0,a.jsx)(A.$,{asChild:!0,variant:"/settings"===s?"secondary":"ghost",size:"sm",className:"w-full justify-start",children:(0,a.jsxs)(l(),{href:"/settings",children:[(0,a.jsx)(x.A,{className:"mr-2 h-4 w-4"})," Settings"]})})]})]})}function D(e){let{root:t,active:s}=e,n=(0,o.c)("app"),[c,d]=(0,r.useState)(s),[u,x]=(0,r.useState)(!1),[b,v]=(0,r.useState)(!1),[N,y]=(0,r.useState)(!1),[k,A]=(0,r.useState)(!1),[S,E]=(0,r.useState)(!1),[_,T]=(0,r.useState)(null),[$,Z]=(0,r.useState)(null),[D,W]=(0,r.useState)(null),[O,K]=(0,r.useState)(null),[Q,q]=(0,r.useState)(null),[H,J]=(0,r.useState)(!1),[ee,et]=(0,r.useState)(!1),[es,ea]=(0,r.useState)(!1),[er,en]=(0,r.useState)(!1),[el,ei]=(0,r.useState)(!1),ec=(0,i.usePathname)();(0,r.useEffect)(()=>{s&&d(!0)},[s]);let eo=(0,r.useCallback)(async()=>{J(!0);let e=await C(t.id);J(!1),e.ok?T(e.sections):T([])},[t.id]),ed=(0,r.useCallback)(async()=>{ea(!0);let e=await z(t.id);ea(!1),e.ok?W(e.topics):W([])},[t.id]),eu=(0,r.useCallback)(async()=>{ei(!0);let e=await L({rootId:t.id});ei(!1),e.ok?q(e.agents):q([])},[t.id]),ex=(0,r.useCallback)(async()=>{et(!0);let e=await R(t.id);et(!1),e.ok?Z(e.files):Z([])},[t.id]),eh=(0,r.useCallback)(async()=>{en(!0);let e=await I(t.id);en(!1),e.ok?K(e.utilities):K([])},[t.id]);(0,w.S9)(w.Zi.kbChanged(t.id),()=>{u?eo():T(null)}),(0,w.S9)(w.Zi.topicsChanged(t.id),()=>{N?ed():W(null),S?eu():q(null),k?eh():K(null)}),(0,r.useEffect)(()=>{if(!S)return;let e=setInterval(()=>{eu()},3e3);return()=>clearInterval(e)},[S,eu]);let em=async()=>{let e=!u;x(e),e&&null===_&&!H&&await eo()},ep=async()=>{let e=!b;v(e),e&&null===$&&!ee&&await ex()},ef=async()=>{let e=!N;y(e),e&&null===D&&!es&&await ed()},eg=async()=>{let e=!k;A(e),e&&null===O&&!er&&await eh()},ej=async()=>{let e=!S;E(e),e&&null===Q&&!el&&await eu()},eb=function(e){var t;let s=e.split("/").filter(Boolean);return null!=(t=s[s.length-1])?t:e}(t.path);return(0,a.jsxs)("li",{children:[(0,a.jsxs)("div",{className:"flex items-center group",children:[(0,a.jsx)("button",{type:"button",onClick:()=>d(e=>!e),className:"h-6 w-6 flex items-center justify-center text-muted-foreground hover:text-foreground shrink-0","aria-label":n(c?"sidebar.collapse":"sidebar.expand"),children:c?(0,a.jsx)(h.A,{className:"h-3.5 w-3.5"}):(0,a.jsx)(m.A,{className:"h-3.5 w-3.5"})}),(0,a.jsxs)(l(),{href:"/roots/".concat(t.id),className:"flex-1 min-w-0 flex items-center gap-2 px-2 py-1 rounded-md text-sm hover:bg-accent ".concat(s?"bg-accent":""),children:[(0,a.jsx)(p.A,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:eb})]})]}),c&&(0,a.jsxs)("ul",{className:"ml-5 mt-0.5 space-y-0.5 border-l pl-1",children:[(0,a.jsxs)("li",{children:[(0,a.jsxs)("button",{type:"button",onClick:em,className:"w-full flex items-center gap-1 px-2 py-1 rounded-md text-xs text-muted-foreground hover:bg-accent hover:text-foreground",children:[u?(0,a.jsx)(h.A,{className:"h-3 w-3 shrink-0"}):(0,a.jsx)(m.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsx)(f.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:n("sidebar.kb")}),H&&(0,a.jsx)(g.A,{className:"ml-auto h-3 w-3 animate-spin shrink-0"})]}),u&&null!==_&&(0,a.jsx)(B,{rootId:t.id,sections:_,pathname:ec})]}),(0,a.jsxs)("li",{children:[(0,a.jsxs)("button",{type:"button",onClick:ep,className:"w-full flex items-center gap-1 px-2 py-1 rounded-md text-xs text-muted-foreground hover:bg-accent hover:text-foreground",children:[b?(0,a.jsx)(h.A,{className:"h-3 w-3 shrink-0"}):(0,a.jsx)(m.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsx)(P.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:n("sidebar.memory")}),ee&&(0,a.jsx)(g.A,{className:"ml-auto h-3 w-3 animate-spin shrink-0"})]}),b&&null!==$&&(0,a.jsx)(X,{rootId:t.id,memory:$,pathname:ec})]}),(0,a.jsxs)("li",{children:[(0,a.jsxs)("button",{type:"button",onClick:ef,className:"w-full flex items-center gap-1 px-2 py-1 rounded-md text-xs text-muted-foreground hover:bg-accent hover:text-foreground",children:[N?(0,a.jsx)(h.A,{className:"h-3 w-3 shrink-0"}):(0,a.jsx)(m.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsx)(j.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:n("sidebar.topics")}),es&&(0,a.jsx)(g.A,{className:"ml-auto h-3 w-3 animate-spin shrink-0"}),null!==D&&(0,a.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground",children:D.length})]}),N&&null!==D&&(0,a.jsx)(G,{rootId:t.id,topics:D,pathname:ec})]}),(0,a.jsxs)("li",{children:[(0,a.jsxs)("button",{type:"button",onClick:eg,className:"w-full flex items-center gap-1 px-2 py-1 rounded-md text-xs text-muted-foreground hover:bg-accent hover:text-foreground",children:[k?(0,a.jsx)(h.A,{className:"h-3 w-3 shrink-0"}):(0,a.jsx)(m.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsx)(U.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:n("sidebar.utilities")}),er&&(0,a.jsx)(g.A,{className:"ml-auto h-3 w-3 animate-spin shrink-0"}),null!==O&&!er&&(0,a.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground",children:O.length})]}),k&&null!==O&&(0,a.jsx)(Y,{rootId:t.id,utilities:O,pathname:ec})]}),(0,a.jsxs)("li",{children:[(0,a.jsxs)("button",{type:"button",onClick:ej,className:"w-full flex items-center gap-1 px-2 py-1 rounded-md text-xs text-muted-foreground hover:bg-accent hover:text-foreground",children:[S?(0,a.jsx)(h.A,{className:"h-3 w-3 shrink-0"}):(0,a.jsx)(m.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsx)(M.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:n("sidebar.agents")}),el&&(0,a.jsx)(g.A,{className:"ml-auto h-3 w-3 animate-spin shrink-0"}),null!==Q&&!el&&(0,a.jsxs)("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[Q.filter(e=>V(e.status)).length,"/",Q.length]})]}),S&&null!==Q&&(0,a.jsx)(F,{agents:Q,pathname:ec})]})]})]})}function F(e){var t,s;let{agents:r,pathname:n}=e;if(0===r.length)return(0,a.jsx)(W,{});let l=new Map;for(let e of r){let s=e.parentId,a=null!=(t=l.get(s))?t:[];a.push(e),l.set(s,a)}let i=null!=(s=l.get(void 0))?s:[];return(0,a.jsx)("ul",{className:"ml-4 mt-0.5 space-y-0.5 border-l pl-1",children:i.map(e=>(0,a.jsx)(O,{agent:e,byParent:l,pathname:n,depth:0},e.id))})}function W(){let e=(0,o.c)("app");return(0,a.jsx)("div",{className:"ml-4 px-3 py-1 text-[11px] italic text-muted-foreground",children:e("sidebar.noAgents")})}function O(e){var t;let{agent:s,byParent:r,pathname:n,depth:i}=e,c=null!=(t=r.get(s.id))?t:[],o="/agents/".concat(s.id),d=n===o;return(0,a.jsxs)("li",{children:[(0,a.jsxs)(l(),{href:o,className:"flex items-center gap-1 px-2 py-1 text-[12px] rounded hover:bg-accent ".concat(d?"bg-accent":""),style:{paddingLeft:8*i+4},children:[V(s.status)?(0,a.jsx)(T.A,{className:"h-3 w-3 text-emerald-600 shrink-0 animate-pulse"}):(0,a.jsx)(M.A,{className:"h-3 w-3 text-muted-foreground shrink-0"}),(0,a.jsx)("span",{className:"truncate flex-1",children:s.label}),(0,a.jsx)("span",{className:"font-mono text-[10px] text-muted-foreground shrink-0",title:"".concat(s.harness," \xb7 ").concat(s.model),children:"claude-code"===s.harness?"claude":"ollama"===s.harness?"ollama":"codex"})]}),c.length>0&&(0,a.jsx)("ul",{className:"space-y-0.5",children:c.map(e=>(0,a.jsx)(O,{agent:e,byParent:r,pathname:n,depth:i+1},e.id))})]})}function V(e){return"starting"===e||"running"===e}function B(e){let{rootId:t,sections:s,pathname:r}=e;return 0===s.length?(0,a.jsx)(K,{}):(0,a.jsx)("ul",{className:"ml-4 mt-0.5 space-y-0.5 border-l pl-1",children:s.map(e=>e.isDir?(0,a.jsx)(Q,{rootId:t,section:e,pathname:r},e.rel):(0,a.jsx)("li",{children:(0,a.jsx)(q,{rootId:t,section:e,pathname:r})},e.rel))})}function K(){let e=(0,o.c)("app");return(0,a.jsx)("div",{className:"px-3 py-1 text-[11px] italic text-muted-foreground",children:e("sidebar.kbEmpty")})}function Q(e){let{rootId:t,section:s,pathname:n}=e,[l,i]=(0,r.useState)(!1);return(0,a.jsxs)("li",{children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("button",{type:"button",onClick:()=>i(e=>!e),className:"h-5 w-5 flex items-center justify-center text-muted-foreground hover:text-foreground shrink-0",children:l?(0,a.jsx)(h.A,{className:"h-3 w-3"}):(0,a.jsx)(m.A,{className:"h-3 w-3"})}),(0,a.jsx)(b.A,{className:"h-3 w-3 text-muted-foreground shrink-0 mr-1"}),(0,a.jsx)("span",{className:"text-[12px] flex-1 truncate",children:s.label})]}),l&&s.children&&(0,a.jsx)("ul",{className:"ml-4 space-y-0.5 border-l pl-1",children:s.children.map(e=>(0,a.jsx)("li",{children:(0,a.jsx)(q,{rootId:t,section:e,pathname:n})},e.rel))})]})}function q(e){let{rootId:t,section:s,pathname:r}=e;if(!s.fileRel)return null;let n=s.fileRel.split("/").map(encodeURIComponent).join("/"),i="/roots/".concat(t,"/kb/").concat(n),c=r===i;return(0,a.jsxs)(l(),{href:i,className:"flex items-center gap-1 px-2 py-1 text-[12px] rounded hover:bg-accent ".concat(c?"bg-accent":""),children:[(0,a.jsx)(f.A,{className:"h-3 w-3 text-muted-foreground shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:s.label})]})}function G(e){let{rootId:t,topics:s,pathname:r}=e;return 0===s.length?(0,a.jsx)(H,{}):(0,a.jsx)("ul",{className:"ml-4 mt-0.5 space-y-0.5 border-l pl-1",children:s.map(e=>(0,a.jsx)(J,{rootId:t,topic:e,pathname:r},e.id))})}function H(){let e=(0,o.c)("app");return(0,a.jsx)("div",{className:"ml-4 px-3 py-1 text-[11px] italic text-muted-foreground",children:e("sidebar.noTopics")})}function J(e){let{rootId:t,topic:s,pathname:n}=e,d=(0,o.c)("app"),u="/roots/".concat(t,"/chat/").concat(s.id),x=n===u,[h,m]=(0,r.useTransition)(),p=(0,i.useRouter)();return(0,a.jsx)("li",{className:"group/topic",children:(0,a.jsxs)(l(),{href:u,className:"flex items-center gap-1 px-2 py-1 text-[12px] rounded hover:bg-accent ".concat(x?"bg-accent":""),children:[(0,a.jsx)(j.A,{className:"h-3 w-3 text-muted-foreground shrink-0"}),(0,a.jsx)("span",{className:"truncate flex-1 min-w-0",children:s.title}),(0,a.jsx)("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),confirm(d("sidebar.deleteTopicConfirm",{title:s.title}))&&m(async()=>{let e=await (0,N.L)(t,s.id);if(!e.ok){var a;c.oR.error(null!=(a=e.error)?a:d("sidebar.deleteFailed"));return}c.oR.success(d("sidebar.topicDeleted")),(0,w.$d)(w.Zi.topicsChanged(t)),x&&p.push("/roots/".concat(t))})},disabled:h,"aria-label":d("sidebar.deleteTopic"),title:d("sidebar.deleteTopic"),className:"opacity-0 group-hover/topic:opacity-100 transition-opacity p-0.5 rounded hover:bg-destructive/15 text-muted-foreground hover:text-destructive shrink-0",children:h?(0,a.jsx)(g.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(v.A,{className:"h-3 w-3"})})]})})}function X(e){let{rootId:t,memory:s,pathname:r}=e,n=(0,o.c)("app"),i=s.filter(e=>!e.empty),c="/roots/".concat(t,"/memory"),d=r===c;return 0===i.length?(0,a.jsx)("div",{className:"ml-4 px-3 py-1 text-[11px] italic text-muted-foreground",children:n("sidebar.memoryEmpty")}):(0,a.jsx)("ul",{className:"ml-4 mt-0.5 space-y-0.5 border-l pl-1",children:i.map(e=>(0,a.jsx)("li",{children:(0,a.jsxs)(l(),{href:c,title:e.description,className:"flex items-center gap-1 px-2 py-1 text-[12px] rounded hover:bg-accent ".concat(d?"bg-accent":""),children:[(0,a.jsx)(P.A,{className:"h-3 w-3 text-muted-foreground shrink-0"}),(0,a.jsx)("span",{className:"truncate flex-1 min-w-0",children:e.file}),(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground shrink-0",children:e.lines})]})},e.file))})}function Y(e){let{rootId:t,utilities:s,pathname:r}=e,n=(0,o.c)("app");return 0===s.length?(0,a.jsx)("div",{className:"ml-4 px-3 py-1 text-[11px] italic text-muted-foreground",children:n("sidebar.utilitiesEmpty")}):(0,a.jsx)("ul",{className:"ml-4 mt-0.5 space-y-0.5 border-l pl-1",children:s.map(e=>(0,a.jsx)(ee,{rootId:t,utility:e,pathname:r},"".concat(e.scope,":").concat(e.id)))})}function ee(e){let{rootId:t,utility:s,pathname:n}=e,[i,c]=(0,r.useState)(!1),o="/utilities/".concat(s.scope,"/").concat(encodeURIComponent(s.id)).concat(s.rootId?"?rootId=".concat(encodeURIComponent(s.rootId)):""),d=s.threads.length>0;return(0,a.jsxs)("li",{children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("button",{type:"button",onClick:()=>c(e=>!e),disabled:!d,className:"h-5 w-5 flex items-center justify-center text-muted-foreground hover:text-foreground shrink-0 disabled:opacity-30",children:d?i?(0,a.jsx)(h.A,{className:"h-3 w-3"}):(0,a.jsx)(m.A,{className:"h-3 w-3"}):(0,a.jsx)("span",{className:"inline-block h-3 w-3"})}),(0,a.jsxs)(l(),{href:o,className:"flex-1 min-w-0 flex items-center gap-1 px-1 py-1 text-[12px] rounded hover:bg-accent",children:[(0,a.jsx)($.A,{className:"h-3 w-3 text-muted-foreground shrink-0"}),(0,a.jsx)("span",{className:"truncate flex-1",children:s.name}),d&&(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground shrink-0",children:s.threads.length})]})]}),i&&d&&(0,a.jsx)("ul",{className:"ml-4 space-y-0.5 border-l pl-1",children:s.threads.map(e=>{let s="/roots/".concat(t,"/chat/").concat(e.id),r=n===s;return(0,a.jsx)("li",{children:(0,a.jsxs)(l(),{href:s,className:"flex items-center gap-1 px-2 py-1 text-[12px] rounded hover:bg-accent ".concat(r?"bg-accent":""),children:[(0,a.jsx)(j.A,{className:"h-3 w-3 text-muted-foreground shrink-0"}),(0,a.jsx)("span",{className:"truncate flex-1 min-w-0",children:e.title})]})},e.id)})})]})}},80192:(e,t,s)=>{"use strict";s.d(t,{F:()=>l});var a=s(4624);s(99356);var r=s(14884),n=s(13506);function l(e){let{className:t,children:s,...l}=e;return(0,a.jsxs)(r.Root,{"data-slot":"scroll-area",className:(0,n.cn)("relative",t),...l,children:[(0,a.jsx)(r.Viewport,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",children:s}),(0,a.jsx)(i,{}),(0,a.jsx)(r.Corner,{})]})}function i(e){let{className:t,orientation:s="vertical",...l}=e;return(0,a.jsx)(r.ScrollAreaScrollbar,{"data-slot":"scroll-area-scrollbar",orientation:s,className:(0,n.cn)("flex touch-none p-px transition-colors select-none","vertical"===s&&"h-full w-2.5 border-l border-l-transparent","horizontal"===s&&"h-2.5 flex-col border-t border-t-transparent",t),...l,children:(0,a.jsx)(r.ScrollAreaThumb,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}},85253:(e,t,s)=>{"use strict";s.d(t,{$:()=>c});var a=s(4624);s(99356);var r=s(60621),n=s(50362),l=s(13506);let i=(0,r.F)("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function c(e){let{className:t,variant:s="default",size:r="default",asChild:c=!1,...o}=e,d=c?n.bL:"button";return(0,a.jsx)(d,{"data-slot":"button","data-variant":s,"data-size":r,className:(0,l.cn)(i({variant:s,size:r,className:t})),...o})}},91074:(e,t,s)=>{"use strict";s.d(t,{Separator:()=>l});var a=s(4624);s(99356);var r=s(44188),n=s(13506);function l(e){let{className:t,orientation:s="horizontal",decorative:l=!0,...i}=e;return(0,a.jsx)(r.b,{"data-slot":"separator",decorative:l,orientation:s,className:(0,n.cn)("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...i})}}},e=>{e.O(0,[497,4400,4678,9776,6785,9411,951,4933,146,7358],()=>e(e.s=17848)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9566],{3239:(e,t,s)=>{"use strict";s.d(t,{A:()=>l});let l=(0,s(45804).A)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},8096:(e,t,s)=>{"use strict";s.d(t,{A:()=>l});let l=(0,s(45804).A)("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]])},41240:(e,t,s)=>{"use strict";s.d(t,{OnboardingWizard:()=>N});var l=s(4624),a=s(99356),i=s(69285),n=s(49411),c=s(8096),d=s(3239),r=s(45804);let o=(0,r.A)("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);var m=s(86790);let x=(0,r.A)("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);var u=s(58726);let p=(0,r.A)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);var h=s(54207),g=s(85924),v=s(56221),j=s(7911);let b=(0,j.createServerReference)("00a7c53923c09337601eded6c1b6e5fdce9be8e452",j.callServer,void 0,j.findSourceMapURL,"detectEnginesAction"),f=(0,j.createServerReference)("408ad35f26876f74199ee8239fc0669a62a7253c27",j.callServer,void 0,j.findSourceMapURL,"runOnboardingAction");function N(e){var t,s,r;let{templates:g,initialLanguage:j,initialName:N}=e,w=(0,n.c)("onboarding"),C=(0,i.useRouter)(),[M,L]=(0,a.useState)(0),[S,R]=(0,a.useState)(N),[z,T]=(0,a.useState)(j||"russian"),[D,E]=(0,a.useState)(""),[_,H]=(0,a.useState)("claude"),[O,P]=(0,a.useState)({loading:!0,claudeAvailable:!1,codexAvailable:!1,ollamaAvailable:!1}),[F,q]=(0,a.useState)(new Set),[V,Z]=(0,a.useTransition)();(0,a.useEffect)(()=>{try{E(Intl.DateTimeFormat().resolvedOptions().timeZone||"")}catch(e){}(async()=>{let e=await b();P({loading:!1,claudeAvailable:e.claudeCli.available,...e.claudeCli.version?{claudeVersion:e.claudeCli.version}:{},codexAvailable:e.codexCli.available,...e.codexCli.version?{codexVersion:e.codexCli.version}:{},ollamaAvailable:e.ollama.available,...void 0!==e.ollama.modelsCount?{ollamaModels:e.ollama.modelsCount}:{}}),!e.claudeCli.available&&(e.codexCli.available?H("codex"):e.ollama.available&&H("ollama"))})()},[]);let U=(0,a.useMemo)(()=>0===M?S.trim().length>0&&z.trim().length>0:1===M?"claude"===_?O.claudeAvailable:"codex"===_?O.codexAvailable:O.ollamaAvailable:2!==M||F.size>0,[M,S,z,_,O,F]),B=[w("stepTitles.0"),w("stepTitles.1"),w("stepTitles.2"),w("stepTitles.3")];return(0,l.jsx)("div",{className:"min-h-screen flex flex-col items-center px-4 py-8",children:(0,l.jsxs)("div",{className:"w-full max-w-2xl space-y-4",children:[(0,l.jsxs)("header",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,l.jsx)(c.A,{className:"h-4 w-4 text-violet-600"}),(0,l.jsx)("span",{className:"font-medium",children:w("header.welcome")}),(0,l.jsx)("span",{className:"ml-auto text-xs",children:w("header.stepCounter",{current:M+1,total:4,title:B[M]})})]}),(0,l.jsx)(y,{current:M}),0===M&&(0,l.jsxs)(k,{children:[(0,l.jsx)("h1",{className:"text-2xl font-semibold",children:w("step0.title")}),(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:w("step0.description")}),(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)("label",{className:"text-xs font-medium",htmlFor:"name",children:w("step0.nameLabel")}),(0,l.jsx)("input",{id:"name",value:S,onChange:e=>R(e.target.value),autoFocus:!0,placeholder:w("step0.namePlaceholder"),className:"w-full rounded border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-violet-400"})]}),(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)("label",{className:"text-xs font-medium",htmlFor:"lang",children:w("step0.languageLabel")}),(0,l.jsxs)("select",{id:"lang",value:z,onChange:e=>T(e.target.value),className:"w-full rounded border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-violet-400",children:[(0,l.jsx)("option",{value:"russian",children:w("step0.languageRu")}),(0,l.jsx)("option",{value:"english",children:w("step0.languageEn")}),(0,l.jsx)("option",{value:"espa\xf1ol",children:w("step0.languageEs")}),(0,l.jsx)("option",{value:"deutsch",children:w("step0.languageDe")}),(0,l.jsx)("option",{value:"fran\xe7ais",children:w("step0.languageFr")})]})]}),D&&(0,l.jsxs)("p",{className:"text-[11px] text-muted-foreground",children:[w("step0.timezoneDetected")," ",(0,l.jsx)("code",{className:"font-mono",children:D})]})]}),1===M&&(0,l.jsxs)(k,{children:[(0,l.jsx)("h1",{className:"text-2xl font-semibold",children:w("step1.title")}),(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:w("step1.description")}),O.loading?(0,l.jsxs)("p",{className:"text-sm text-muted-foreground flex items-center gap-2",children:[(0,l.jsx)(d.A,{className:"h-4 w-4 animate-spin"}),w("step1.checking")]}):(0,l.jsxs)("div",{className:"grid gap-2",children:[(0,l.jsx)(A,{selected:"claude"===_,onSelect:()=>H("claude"),icon:(0,l.jsx)(o,{className:"h-5 w-5"}),title:w("step1.claudeTitle"),description:w("step1.claudeDescription"),installLinkLabel:w("step1.installLink"),status:O.claudeAvailable?{ok:!0,hint:null!=(t=O.claudeVersion)?t:w("step1.claudeReady")}:{ok:!1,hint:w("step1.claudeMissing"),link:"https://docs.anthropic.com/claude/docs/claude-code"}}),(0,l.jsx)(A,{selected:"codex"===_,onSelect:()=>H("codex"),icon:(0,l.jsx)(m.A,{className:"h-5 w-5"}),title:w("step1.codexTitle"),description:w("step1.codexDescription"),installLinkLabel:w("step1.installLink"),status:O.codexAvailable?{ok:!0,hint:null!=(s=O.codexVersion)?s:w("step1.codexReady")}:{ok:!1,hint:w("step1.codexMissing"),link:"https://github.com/openai/codex"}}),(0,l.jsx)(A,{selected:"ollama"===_,onSelect:()=>H("ollama"),icon:(0,l.jsx)(x,{className:"h-5 w-5"}),title:w("step1.ollamaTitle"),description:w("step1.ollamaDescription"),installLinkLabel:w("step1.installLink"),status:O.ollamaAvailable?{ok:!0,hint:w("step1.ollamaModels",{count:null!=(r=O.ollamaModels)?r:"?"})}:{ok:!1,hint:w("step1.ollamaMissing"),link:"https://ollama.com/download"}})]})]}),2===M&&(0,l.jsxs)(k,{children:[(0,l.jsx)("h1",{className:"text-2xl font-semibold",children:w("step2.title")}),(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:w("step2.description")}),(0,l.jsx)("ul",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:g.map(e=>{let t=F.has(e.id);return(0,l.jsx)("li",{children:(0,l.jsx)("button",{type:"button",onClick:()=>{let t=new Set(F);t.has(e.id)?t.delete(e.id):t.add(e.id),q(t)},className:"w-full text-left rounded-lg border p-3 transition "+(t?"border-violet-500 bg-violet-50 dark:bg-violet-950/40":"hover:bg-accent"),children:(0,l.jsxs)("div",{className:"flex items-start gap-2",children:[(0,l.jsx)("span",{className:"text-2xl leading-none",children:e.emoji}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsxs)("div",{className:"font-medium flex items-center gap-1",children:[e.label,t&&(0,l.jsx)(u.A,{className:"h-3.5 w-3.5 text-violet-600"})]}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground leading-snug mt-0.5",children:e.description})]})]})})},e.id)})}),(0,l.jsx)("p",{className:"text-[11px] text-muted-foreground",children:w("step2.folderHint")})]}),3===M&&(0,l.jsxs)(k,{children:[(0,l.jsx)("h1",{className:"text-2xl font-semibold",children:w("step3.title")}),(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:w("step3.description")}),(0,l.jsxs)("ul",{className:"text-sm space-y-1",children:[(0,l.jsxs)("li",{className:"flex items-center gap-2",children:[(0,l.jsx)(u.A,{className:"h-4 w-4 text-emerald-600"}),w("step3.profileLabel")," ",(0,l.jsx)("strong",{children:S})," \xb7 ",z," \xb7 ",D||w("step3.empty")]}),(0,l.jsxs)("li",{className:"flex items-center gap-2",children:[(0,l.jsx)(u.A,{className:"h-4 w-4 text-emerald-600"}),w("step3.engineLabel")," ",(0,l.jsx)("strong",{children:"claude"===_?w("step3.engineClaude"):"codex"===_?w("step3.engineCodex"):w("step3.engineOllama")})]}),(0,l.jsxs)("li",{className:"flex items-center gap-2",children:[(0,l.jsx)(u.A,{className:"h-4 w-4 text-emerald-600"}),w("step3.spacesLabel")," ",[...F].map(e=>{var t;return null==(t=g.find(t=>t.id===e))?void 0:t.label}).filter(Boolean).join(" \xb7 ")||w("step3.empty")]})]}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:w("step3.footer")})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[M>0&&(0,l.jsxs)("button",{type:"button",onClick:()=>L(e=>e-1),className:"inline-flex items-center gap-1 rounded border px-3 py-2 text-sm hover:bg-accent",children:[(0,l.jsx)(p,{className:"h-4 w-4"}),w("nav.back")]}),(0,l.jsx)("div",{className:"ml-auto"}),M<3?(0,l.jsxs)("button",{type:"button",onClick:()=>L(e=>e+1),disabled:!U,className:"inline-flex items-center gap-1 rounded bg-violet-600 px-4 py-2 text-sm font-medium text-white hover:bg-violet-700 disabled:opacity-50",children:[w("nav.next"),(0,l.jsx)(h.A,{className:"h-4 w-4"})]}):(0,l.jsxs)("button",{type:"button",onClick:()=>{Z(async()=>{let e=await f({userName:S.trim(),language:z.trim(),timezone:D.trim(),engine:_,templates:[...F]});if(!e.ok){var t;v.oR.error(null!=(t=e.error)?t:w("errors.generic"));return}v.oR.success(w("success.created",{spaces:e.spacesCreated,widgets:e.widgetsCreated})),C.push("/")})},disabled:V,className:"inline-flex items-center gap-1 rounded bg-emerald-600 px-4 py-2 text-sm font-medium text-white hover:bg-emerald-700 disabled:opacity-50",children:[V?(0,l.jsx)(d.A,{className:"h-4 w-4 animate-spin"}):(0,l.jsx)(c.A,{className:"h-4 w-4"}),w("nav.start")]})]})]})})}function k(e){let{children:t}=e;return(0,l.jsx)("section",{className:"rounded-xl border bg-card p-6 shadow-sm space-y-4",children:t})}function y(e){let{current:t}=e;return(0,l.jsx)("div",{className:"flex items-center gap-1",children:[0,1,2,3].map(e=>(0,l.jsx)("div",{className:"h-1 flex-1 rounded-full "+(e<=t?"bg-violet-600":"bg-muted")},e))})}function A(e){let{selected:t,onSelect:s,icon:a,title:i,description:n,status:c,installLinkLabel:d}=e;return(0,l.jsxs)("button",{type:"button",onClick:s,className:"w-full text-left rounded-lg border p-3 transition flex items-start gap-3 "+(t?"border-violet-500 bg-violet-50 dark:bg-violet-950/40":"hover:bg-accent"),children:[(0,l.jsx)("div",{className:"mt-0.5 text-violet-600",children:a}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsxs)("div",{className:"font-medium flex items-center gap-2",children:[i,t&&(0,l.jsx)(u.A,{className:"h-3.5 w-3.5 text-violet-600"})]}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground leading-snug mt-0.5",children:n}),(0,l.jsxs)("div",{className:"mt-1.5 inline-flex items-center gap-1 text-[11px] "+(c.ok?"text-emerald-700":"text-amber-700"),children:[c.ok?(0,l.jsx)(u.A,{className:"h-3 w-3"}):(0,l.jsx)(g.A,{className:"h-3 w-3"}),(0,l.jsx)("span",{children:c.hint}),c.link&&(0,l.jsx)("a",{href:c.link,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"underline ml-1",children:d})]})]})]})}},54207:(e,t,s)=>{"use strict";s.d(t,{A:()=>l});let l=(0,s(45804).A)("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])},58726:(e,t,s)=>{"use strict";s.d(t,{A:()=>l});let l=(0,s(45804).A)("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},69285:(e,t,s)=>{"use strict";var l=s(48849);s.o(l,"usePathname")&&s.d(t,{usePathname:function(){return l.usePathname}}),s.o(l,"useRouter")&&s.d(t,{useRouter:function(){return l.useRouter}})},81641:(e,t,s)=>{Promise.resolve().then(s.bind(s,41240))},85924:(e,t,s)=>{"use strict";s.d(t,{A:()=>l});let l=(0,s(45804).A)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},86790:(e,t,s)=>{"use strict";s.d(t,{A:()=>l});let l=(0,s(45804).A)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])}},e=>{e.O(0,[9776,9411,4933,146,7358],()=>e(e.s=81641)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8974],{31246:(e,r,n)=>{"use strict";n.d(r,{h:()=>s});var i=n(7911);let s=(0,i.createServerReference)("70551ae830c556dc328e99be141f12aef0d9777e54",i.callServer,void 0,i.findSourceMapURL,"generateTopicTitleAction")},63392:(e,r,n)=>{Promise.resolve().then(n.bind(n,89061)),Promise.resolve().then(n.bind(n,96253)),Promise.resolve().then(n.bind(n,28050)),Promise.resolve().then(n.bind(n,94904)),Promise.resolve().then(n.bind(n,13270)),Promise.resolve().then(n.bind(n,99730)),Promise.resolve().then(n.bind(n,89146)),Promise.resolve().then(n.bind(n,19078)),Promise.resolve().then(n.bind(n,67854)),Promise.resolve().then(n.bind(n,69050)),Promise.resolve().then(n.bind(n,63739)),Promise.resolve().then(n.bind(n,33976)),Promise.resolve().then(n.bind(n,12537)),Promise.resolve().then(n.bind(n,97485)),Promise.resolve().then(n.bind(n,41923)),Promise.resolve().then(n.bind(n,73868)),Promise.resolve().then(n.bind(n,53511)),Promise.resolve().then(n.bind(n,2018)),Promise.resolve().then(n.bind(n,18487)),Promise.resolve().then(n.bind(n,98346)),Promise.resolve().then(n.bind(n,14884)),Promise.resolve().then(n.bind(n,85314)),Promise.resolve().then(n.bind(n,17280)),Promise.resolve().then(n.bind(n,8855)),Promise.resolve().then(n.bind(n,86631)),Promise.resolve().then(n.bind(n,2604)),Promise.resolve().then(n.bind(n,27237)),Promise.resolve().then(n.bind(n,49455)),Promise.resolve().then(n.bind(n,39211)),Promise.resolve().then(n.bind(n,56360)),Promise.resolve().then(n.t.bind(n,54400,23))},88181:(e,r,n)=>{"use strict";n.d(r,{g:()=>s});var i=n(7911);let s=(0,i.createServerReference)("78fea7d2a69cb84ab9cee2bc2cddf3bff9ee7d020f",i.callServer,void 0,i.findSourceMapURL,"startTopicAction")},89061:(e,r,n)=>{"use strict";n.d(r,{UniversalChatBar:()=>v});var i=n(4624),s=n(99356),t=n(69285),o=n(69709),l=n(95265),d=n(56221),a=n(49411),c=n(88181),m=n(31246),u=n(25235),b=n(63602),h=n(63514);function v(e){var r,n,v;let{spaces:p}=e,f=(0,t.useRouter)(),x=(0,a.c)("app"),[P,g]=(0,s.useState)(null!=(n=null==(r=p[0])?void 0:r.id)?n:""),[w,j]=(0,s.useState)(!1),[,k]=(0,s.useTransition)(),N=(0,s.useRef)(null),S=null!=(v=p.find(e=>e.id===P))?v:p[0];if((0,s.useEffect)(()=>{if(!w)return;let e=e=>{var r;(null==(r=N.current)?void 0:r.contains(e.target))||j(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[w]),!S)return(0,i.jsx)("div",{className:"border-t bg-background",children:(0,i.jsxs)("div",{className:"mx-auto max-w-3xl px-6 py-5 text-center text-xs text-muted-foreground",children:[x("universal.createFirstSpace1")," ",(0,i.jsx)("a",{href:"/onboarding?force=1",className:"underline",children:x("universal.wizardLink")})," ",x("universal.or")," ",(0,i.jsx)("a",{href:"/roots/new",className:"underline",children:x("universal.manualLink")}),"."]})});let L=p.length>1?(0,i.jsxs)("div",{className:"relative",ref:N,children:[(0,i.jsxs)("button",{type:"button",onClick:()=>j(e=>!e),className:"inline-flex items-center gap-1 rounded-full border bg-card/80 px-2 py-0.5 text-[10px] font-medium hover:bg-accent normal-case tracking-normal",title:x("universal.pickSpace"),children:[(0,i.jsx)("span",{className:"text-muted-foreground",children:x("universal.in")}),(0,i.jsx)("span",{children:S.label}),(0,i.jsx)(o.A,{className:"h-3 w-3 text-muted-foreground"})]}),w&&(0,i.jsx)("ul",{className:"absolute bottom-full right-0 mb-1 min-w-[200px] max-h-60 overflow-y-auto rounded-md border bg-popover shadow-lg z-40 py-1",children:p.map(e=>(0,i.jsx)("li",{children:(0,i.jsx)("button",{type:"button",onClick:()=>{g(e.id),j(!1)},className:"block w-full text-left px-3 py-1.5 text-sm hover:bg-accent "+(e.id===S.id?"font-semibold":""),children:e.label})},e.id))})]}):null,y=async e=>await new Promise(r=>{k(async()=>{let n=await (0,c.g)(S.id,e.message,e.attachments);if(!n.ok){d.oR.error(n.error),r(!1);return}(0,h.$d)(h.Zi.topicsChanged(S.id)),e.message.trim()&&(0,m.h)(S.id,n.topicId,e.message).then(e=>{e.ok&&(0,h.$d)(h.Zi.topicsChanged(S.id))}),f.push("/roots/".concat(S.id,"/chat/").concat(n.topicId)),r(!0)})});return(0,i.jsx)(b.E,{label:x("universal.label"),...L?{headerRight:L}:{},children:(0,i.jsx)(u.L,{rootId:S.id,placeholder:x("universal.placeholder"),submitLabel:x("universal.submitLabel"),pendingLabel:x("universal.pendingLabel"),SubmitIcon:l.A,onSubmit:y},S.id)})}}},e=>{e.O(0,[4400,4678,9776,6785,3335,9411,2038,5596,4933,146,7358],()=>e(e.s=63392)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8974],{18909:(e,r,n)=>{"use strict";n.d(r,{g:()=>s});var i=n(7911);let s=(0,i.createServerReference)("78c3f2500c42332a8c114501958483c62375d5516b",i.callServer,void 0,i.findSourceMapURL,"startTopicAction")},63392:(e,r,n)=>{Promise.resolve().then(n.bind(n,89061)),Promise.resolve().then(n.bind(n,96253)),Promise.resolve().then(n.bind(n,28050)),Promise.resolve().then(n.bind(n,94904)),Promise.resolve().then(n.bind(n,13270)),Promise.resolve().then(n.bind(n,99730)),Promise.resolve().then(n.bind(n,89146)),Promise.resolve().then(n.bind(n,19078)),Promise.resolve().then(n.bind(n,67854)),Promise.resolve().then(n.bind(n,69050)),Promise.resolve().then(n.bind(n,63739)),Promise.resolve().then(n.bind(n,33976)),Promise.resolve().then(n.bind(n,12537)),Promise.resolve().then(n.bind(n,97485)),Promise.resolve().then(n.bind(n,41923)),Promise.resolve().then(n.bind(n,73868)),Promise.resolve().then(n.bind(n,53511)),Promise.resolve().then(n.bind(n,2018)),Promise.resolve().then(n.bind(n,18487)),Promise.resolve().then(n.bind(n,98346)),Promise.resolve().then(n.bind(n,14884)),Promise.resolve().then(n.bind(n,85314)),Promise.resolve().then(n.bind(n,17280)),Promise.resolve().then(n.bind(n,8855)),Promise.resolve().then(n.bind(n,86631)),Promise.resolve().then(n.bind(n,2604)),Promise.resolve().then(n.bind(n,27237)),Promise.resolve().then(n.bind(n,49455)),Promise.resolve().then(n.bind(n,39211)),Promise.resolve().then(n.bind(n,56360)),Promise.resolve().then(n.t.bind(n,54400,23))},65127:(e,r,n)=>{"use strict";n.d(r,{h:()=>s});var i=n(7911);let s=(0,i.createServerReference)("7044d226c44bc09b7f8a89033c20eab29f5d5002f9",i.callServer,void 0,i.findSourceMapURL,"generateTopicTitleAction")},89061:(e,r,n)=>{"use strict";n.d(r,{UniversalChatBar:()=>v});var i=n(4624),s=n(99356),t=n(69285),o=n(69709),l=n(95265),a=n(56221),d=n(49411),c=n(18909),m=n(65127),u=n(18471),b=n(63602),h=n(63514);function v(e){var r,n,v;let{spaces:p}=e,f=(0,t.useRouter)(),x=(0,d.c)("app"),[P,g]=(0,s.useState)(null!=(n=null==(r=p[0])?void 0:r.id)?n:""),[w,j]=(0,s.useState)(!1),[,k]=(0,s.useTransition)(),N=(0,s.useRef)(null),S=null!=(v=p.find(e=>e.id===P))?v:p[0];if((0,s.useEffect)(()=>{if(!w)return;let e=e=>{var r;(null==(r=N.current)?void 0:r.contains(e.target))||j(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[w]),!S)return(0,i.jsx)("div",{className:"border-t bg-background",children:(0,i.jsxs)("div",{className:"mx-auto max-w-3xl px-6 py-5 text-center text-xs text-muted-foreground",children:[x("universal.createFirstSpace1")," ",(0,i.jsx)("a",{href:"/onboarding?force=1",className:"underline",children:x("universal.wizardLink")})," ",x("universal.or")," ",(0,i.jsx)("a",{href:"/roots/new",className:"underline",children:x("universal.manualLink")}),"."]})});let L=p.length>1?(0,i.jsxs)("div",{className:"relative",ref:N,children:[(0,i.jsxs)("button",{type:"button",onClick:()=>j(e=>!e),className:"inline-flex items-center gap-1 rounded-full border bg-card/80 px-2 py-0.5 text-[10px] font-medium hover:bg-accent normal-case tracking-normal",title:x("universal.pickSpace"),children:[(0,i.jsx)("span",{className:"text-muted-foreground",children:x("universal.in")}),(0,i.jsx)("span",{children:S.label}),(0,i.jsx)(o.A,{className:"h-3 w-3 text-muted-foreground"})]}),w&&(0,i.jsx)("ul",{className:"absolute bottom-full right-0 mb-1 min-w-[200px] max-h-60 overflow-y-auto rounded-md border bg-popover shadow-lg z-40 py-1",children:p.map(e=>(0,i.jsx)("li",{children:(0,i.jsx)("button",{type:"button",onClick:()=>{g(e.id),j(!1)},className:"block w-full text-left px-3 py-1.5 text-sm hover:bg-accent "+(e.id===S.id?"font-semibold":""),children:e.label})},e.id))})]}):null,y=async e=>await new Promise(r=>{k(async()=>{let n=await (0,c.g)(S.id,e.message,e.attachments);if(!n.ok){a.oR.error(n.error),r(!1);return}(0,h.$d)(h.Zi.topicsChanged(S.id)),e.message.trim()&&(0,m.h)(S.id,n.topicId,e.message).then(e=>{e.ok&&(0,h.$d)(h.Zi.topicsChanged(S.id))}),f.push("/roots/".concat(S.id,"/chat/").concat(n.topicId)),r(!0)})});return(0,i.jsx)(b.E,{label:x("universal.label"),...L?{headerRight:L}:{},children:(0,i.jsx)(u.L,{rootId:S.id,placeholder:x("universal.placeholder"),submitLabel:x("universal.submitLabel"),pendingLabel:x("universal.pendingLabel"),SubmitIcon:l.A,onSubmit:y},S.id)})}}},e=>{e.O(0,[4400,4678,9776,6785,3335,9411,2038,2608,4933,146,7358],()=>e(e.s=63392)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[310],{3989:(e,t,s)=>{"use strict";s.d(t,{ChatView:()=>eu});var r=s(4624),n=s(99356),a=s(69285),i=s(49411),o=s(23506),l=s(1646),d=s(3239),c=s(95265),m=s(8096),u=s(56221),p=s(28310),x=s(85253),h=s(96325),g=s(63602),f=s(25235),v=s(63514),b=s(69709),j=s(69205),w=s(49623),N=s(51587),y=s(76479),k=s(53296),C=s(43863),A=s(9923),S=s(94494),I=s(13506);function P(e){let{name:t,input:s,result:a,pending:o}=e,l=(0,i.c)("roots"),[c,m]=(0,n.useState)(!1),u=function(e){let t=e.toLowerCase();return"read"===t?w.A:"write"===t||"edit"===t?N.A:"bash"===t||"shell"===t?y.A:"glob"===t?k.A:"grep"===t||"search"===t?C.A:"ls"===t?A.A:S.A}(t),p=function(e,t){if(!t||"object"!=typeof t)return"";let s=e.toLowerCase();if(("read"===s||"write"===s||"edit"===s)&&"string"==typeof t.file_path)return t.file_path;if("bash"===s&&"string"==typeof t.command)return t.command.length>80?t.command.slice(0,77)+"…":t.command;if("glob"===s&&"string"==typeof t.pattern)return t.pattern;if("grep"===s){let e=[];return"string"==typeof t.pattern&&e.push(t.pattern),"string"==typeof t.path&&e.push("in ".concat(t.path)),e.join(" ")}return"ls"===s&&"string"==typeof t.path?t.path:""}(t,s);return(0,r.jsxs)("div",{className:(0,I.cn)("rounded-lg border my-2 text-sm overflow-hidden",(null==a?void 0:a.isError)?"border-destructive/40 bg-destructive/5":"bg-muted/30"),children:[(0,r.jsxs)("button",{type:"button",onClick:()=>m(e=>!e),className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-accent/40 transition-colors",children:[c?(0,r.jsx)(b.A,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}):(0,r.jsx)(j.A,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,r.jsx)(u,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,r.jsx)("span",{className:"font-mono text-xs font-medium",children:t}),p&&(0,r.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:p}),(0,r.jsx)("span",{className:"ml-auto text-[10px] uppercase tracking-wider text-muted-foreground shrink-0",children:o?(0,r.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,r.jsx)(d.A,{className:"h-3 w-3 animate-spin"})," ",l("toolCall.working")]}):(null==a?void 0:a.isError)?(0,r.jsx)("span",{className:"text-destructive",children:l("toolCall.error")}):a?(0,r.jsx)("span",{children:l("toolCall.done")}):(0,r.jsx)("span",{children:"—"})})]}),c&&(0,r.jsxs)("div",{className:"px-3 pb-3 space-y-2",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"input"}),(0,r.jsx)("pre",{className:"text-[11px] font-mono bg-background/60 rounded p-2 overflow-x-auto whitespace-pre-wrap break-all",children:function(e){try{return JSON.stringify(e,null,2)}catch(t){return String(e)}}(s)})]}),a&&(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"output"}),(0,r.jsx)("pre",{className:(0,I.cn)("text-[11px] font-mono rounded p-2 overflow-x-auto whitespace-pre-wrap max-h-64 overflow-y-auto",a.isError?"bg-destructive/10 text-destructive-foreground":"bg-background/60"),children:a.content||"(empty)"})]})]})]})}var T=s(3024),q=s(86295),R=s(13561),z=s(43153),B=s(59145),E=s(35687),O=s(39783),$=s(65714),L=s(15523),D=s(78825),U=s(66459);function H(e){let{perm:t}=e,s=(0,i.c)("roots"),[a,o]=(0,n.useTransition)(),l=t.resolved,c=(e,s)=>{o(async()=>{let r=await fetch("/api/agents/".concat(t.agentId,"/respond"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:"permission",requestId:t.requestId,decision:e,...s?{scope:s}:{},...t.tool?{tool:t.tool}:{}})});if(!r.ok){var n;let e=await r.json().catch(()=>({}));u.oR.error(null!=(n=e.error)?n:"HTTP ".concat(r.status))}})};return(0,r.jsx)("div",{className:(0,I.cn)("rounded-lg border-2 my-2 p-4 reflex-gradient",l&&"opacity-60"),children:(0,r.jsxs)("div",{className:"rounded-md bg-background/95 backdrop-blur p-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-2 text-[11px] uppercase tracking-wider text-muted-foreground",children:[(0,r.jsx)(T.A,{className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{children:s("permissionCard.title")}),t.tool&&(0,r.jsx)("span",{className:"font-mono normal-case tracking-normal",children:t.tool}),(0,r.jsx)("span",{className:"ml-auto font-mono normal-case tracking-normal",children:t.requestId})]}),t.description&&(0,r.jsx)("p",{className:"text-sm mb-2",children:t.description}),void 0!==t.input&&(0,r.jsx)("pre",{className:"text-[11px] font-mono bg-muted/40 rounded p-2 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto mb-3",children:M(t.input)}),l?(0,r.jsx)("div",{className:"flex items-center gap-2 text-sm",children:"allow"===l.decision?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(q.A,{className:"h-4 w-4 text-emerald-600"}),(0,r.jsx)("span",{children:s("permissionCard.allowed",{scope:l.scope?" (".concat(l.scope,")"):""})})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(R.A,{className:"h-4 w-4 text-destructive"}),(0,r.jsx)("span",{children:s("permissionCard.denied")})]})}):(0,r.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,r.jsxs)(x.$,{size:"sm",onClick:()=>c("allow","once"),disabled:a,children:[a?(0,r.jsx)(d.A,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(z.A,{className:"mr-2 h-3.5 w-3.5"}),s("permissionCard.allow")]}),(0,r.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:()=>c("allow","always"),disabled:a,children:[(0,r.jsx)(q.A,{className:"mr-2 h-3.5 w-3.5"}),s("permissionCard.allowAlways")]}),(0,r.jsxs)(x.$,{size:"sm",variant:"destructive",onClick:()=>c("deny"),disabled:a,children:[(0,r.jsx)(R.A,{className:"mr-2 h-3.5 w-3.5"}),s("permissionCard.deny")]})]})]})})}function F(e){var t;let{question:s}=e,a=(0,i.c)("roots"),[o,l]=(0,n.useState)(""),[c,m]=(0,n.useState)(new Set),[p,h]=(0,n.useTransition)(),g=s.resolved,f=s.options&&s.options.length>0?s.options:(null!=(t=s.choices)?t:[]).map(e=>({label:e})),v=e=>{e.trim()&&h(async()=>{let t=await fetch("/api/agents/".concat(s.agentId,"/respond"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:"answer",questionId:s.questionId,answer:e.trim()})});if(t.ok)l(""),m(new Set);else{var r;let e=await t.json().catch(()=>({}));u.oR.error(null!=(r=e.error)?r:"HTTP ".concat(t.status))}})};return(0,r.jsx)("div",{className:(0,I.cn)("rounded-lg border-2 my-2 p-4 reflex-gradient",g&&"opacity-60"),children:(0,r.jsxs)("div",{className:"rounded-md bg-background/95 backdrop-blur p-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-2 text-[11px] uppercase tracking-wider text-muted-foreground flex-wrap",children:[(0,r.jsx)(B.A,{className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{children:a("questionCard.title")}),s.header&&(0,r.jsx)("span",{className:"rounded bg-violet-100 dark:bg-violet-950/60 text-violet-900 dark:text-violet-200 px-1.5 py-0.5 text-[10px] uppercase font-mono",children:s.header}),s.multiSelect&&(0,r.jsx)("span",{className:"text-[10px] normal-case tracking-normal italic",children:a("questionCard.multiSelect")}),(0,r.jsx)("span",{className:"ml-auto font-mono normal-case tracking-normal",children:s.questionId})]}),(0,r.jsx)("p",{className:"text-sm font-medium mb-3",children:s.prompt}),g?(0,r.jsxs)("p",{className:"text-sm text-muted-foreground",children:[a("questionCard.answerLabel")," ",(0,r.jsx)("span",{className:"text-foreground",children:function(e){if(!e.startsWith("["))return e;try{let t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e))return t.join(", ")}catch(e){}return e}(g.answer)})]}):(0,r.jsxs)("div",{className:"space-y-2",children:[f.length>0&&(0,r.jsx)("div",{className:"flex flex-col gap-1.5",children:f.map(e=>{let t=c.has(e.label);return s.multiSelect?(0,r.jsxs)("button",{type:"button",onClick:()=>{var t;return t=e.label,void m(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},disabled:p,className:(0,I.cn)("flex items-start gap-2 text-left rounded-md border p-2.5 transition",t?"border-violet-500 bg-violet-50 dark:bg-violet-950/30":"border-input hover:bg-accent/40",p&&"opacity-50"),children:[(0,r.jsx)("span",{className:(0,I.cn)("mt-0.5 h-3.5 w-3.5 shrink-0 rounded border flex items-center justify-center",t?"bg-violet-600 border-violet-600 text-white":"border-muted-foreground/40"),children:t&&(0,r.jsx)(z.A,{className:"h-2.5 w-2.5"})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("div",{className:"text-sm font-medium",children:e.label}),e.description&&(0,r.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5 leading-snug",children:e.description})]})]},e.label):(0,r.jsx)("button",{type:"button",onClick:()=>v(e.label),disabled:p,className:(0,I.cn)("flex items-start gap-2 text-left rounded-md border p-2.5 transition","border-input hover:bg-accent/60 hover:border-violet-400",p&&"opacity-50"),children:(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("div",{className:"text-sm font-medium",children:e.label}),e.description&&(0,r.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5 leading-snug",children:e.description})]})},e.label)})}),s.multiSelect&&f.length>0&&(0,r.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-1",children:[(0,r.jsx)("span",{className:"text-[11px] text-muted-foreground",children:a("questionCard.selected",{count:c.size})}),(0,r.jsxs)(x.$,{type:"button",size:"sm",onClick:()=>{0!==c.size&&v(JSON.stringify([...c]))},disabled:p||0===c.size,children:[p?(0,r.jsx)(d.A,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(z.A,{className:"mr-2 h-3.5 w-3.5"}),a("questionCard.submit")]})]}),(0,r.jsxs)("form",{className:"flex gap-2",onSubmit:e=>{e.preventDefault(),v(o)},children:[(0,r.jsx)(L.p,{value:o,onChange:e=>l(e.target.value),placeholder:a("questionCard.ownAnswerPlaceholder"),disabled:p,className:"h-9 text-sm"}),(0,r.jsxs)(x.$,{type:"submit",size:"sm",disabled:p||!o.trim(),children:[p?(0,r.jsx)(d.A,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(z.A,{className:"mr-2 h-3.5 w-3.5"}),a("questionCard.submit")]})]})]})]})})}function J(e){let{entry:t}=e,s=(0,i.c)("roots"),[a,o]=(0,n.useTransition)(),[l,c]=(0,n.useState)({}),m=t.resolved,p=e=>{if("approve"===e){var r,n;for(let e of null!=(r=t.secrets)?r:[])if(!e.oauth&&e.required&&!(null==(n=l[e.envKey])?void 0:n.trim()))return void u.oR.error(s("mcpAddCard.secretRequired",{label:e.label||e.envKey}))}o(async()=>{let s=await fetch("/api/agents/".concat(t.agentId,"/respond"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:"mcp-add",requestId:t.requestId,decision:e,..."approve"===e?{secretValues:l}:{}})});if(!s.ok){var r;let e=await s.json().catch(()=>({}));u.oR.error(null!=(r=e.error)?r:"HTTP ".concat(s.status))}})};return(0,r.jsx)("div",{className:(0,I.cn)("rounded-lg border-2 my-2 p-4 reflex-gradient",m&&"opacity-60"),children:(0,r.jsxs)("div",{className:"rounded-md bg-background/95 backdrop-blur p-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-2 text-[11px] uppercase tracking-wider text-muted-foreground",children:[(0,r.jsx)(E.A,{className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{children:s("mcpAddCard.title")}),(0,r.jsx)("span",{className:"font-mono normal-case tracking-normal",children:t.server}),(0,r.jsx)("span",{className:"ml-auto font-mono normal-case tracking-normal",children:t.requestId})]}),(0,r.jsx)("div",{className:"text-sm font-medium",children:t.label}),t.description&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:t.description}),(0,r.jsx)("pre",{className:"text-[11px] font-mono bg-muted/40 rounded p-2 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto my-3",children:M(t.config)}),t.secrets&&t.secrets.length>0&&!m&&(0,r.jsxs)("div",{className:"space-y-2 mb-3",children:[(0,r.jsx)("div",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:s("mcpAddCard.fillSecrets")}),t.secrets.map(e=>{var t;return e.oauth?(0,r.jsx)(K,{slot:e},e.envKey):(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsxs)("label",{className:"text-xs flex items-center gap-2",children:[(0,r.jsx)("span",{className:"font-mono",children:e.envKey}),(0,r.jsx)("span",{className:"text-muted-foreground",children:e.label}),e.required&&(0,r.jsx)("span",{className:"text-destructive text-[10px]",children:"*"})]}),e.description&&(0,r.jsx)("p",{className:"text-[11px] text-muted-foreground",children:e.description}),(0,r.jsx)(L.p,{type:"password",value:null!=(t=l[e.envKey])?t:"",onChange:t=>c(s=>({...s,[e.envKey]:t.target.value})),placeholder:e.required?s("mcpAddCard.required"):s("mcpAddCard.optional"),className:"font-mono text-xs h-8"})]},e.envKey)})]}),m?(0,r.jsx)("div",{className:"flex items-center gap-2 text-sm",children:"approve"===m.decision?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(z.A,{className:"h-4 w-4 text-emerald-600"}),(0,r.jsx)("span",{children:s("mcpAddCard.registered")})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(R.A,{className:"h-4 w-4 text-destructive"}),(0,r.jsx)("span",{children:s("mcpAddCard.rejected")})]})}):(0,r.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,r.jsxs)(x.$,{type:"button",variant:"default",size:"sm",onClick:()=>p("approve"),disabled:a,children:[a&&(0,r.jsx)(d.A,{className:"mr-1 h-3.5 w-3.5 animate-spin"}),(0,r.jsx)(z.A,{className:"h-3.5 w-3.5 mr-1"})," ",s("mcpAddCard.register")]}),(0,r.jsxs)(x.$,{type:"button",variant:"outline",size:"sm",onClick:()=>p("reject"),disabled:a,children:[(0,r.jsx)(R.A,{className:"h-3.5 w-3.5 mr-1"})," ",s("mcpAddCard.reject")]})]})]})})}function K(e){var t,a;let{slot:o}=e,l=(0,i.c)("roots"),[c,m]=(0,n.useState)(null),[p,h]=(0,n.useState)(null),[g,f]=(0,n.useState)(""),[v,j]=(0,n.useState)(""),[w,N]=(0,n.useState)(!1),[y,k]=(0,n.useState)(!1),[C,A]=(0,n.useTransition)(),[S,I]=(0,n.useTransition)(),P=async()=>{if(!o.oauth)return;let{listOAuthStatusesAction:e,getOAuthClientAction:t}=await s.e(4108).then(s.bind(s,94108)),[r,n]=await Promise.all([e(),t(o.oauth)]);if(r.ok){let e=r.statuses.find(e=>e.id===o.oauth);e&&m({hasClient:e.hasClient,hasTokens:e.hasTokens})}if(n.ok){var a;h({setupHint:n.setupHint,consoleUrl:n.consoleUrl,needsClientSecret:n.needsClientSecret,setupSteps:null!=(a=n.setupSteps)?a:[]}),n.client?(f(n.client.clientId),N(n.client.hasSecret)):(f(""),N(!1))}};(0,n.useEffect)(()=>{P()},[o.oauth]);let T=!(null==c?void 0:c.hasClient);return(0,r.jsxs)("div",{className:"space-y-2 rounded border border-violet-200 bg-violet-50/30 p-2",children:[(0,r.jsxs)("label",{className:"text-xs flex items-center gap-2",children:[(0,r.jsx)("span",{className:"font-mono",children:o.envKey}),(0,r.jsx)("span",{className:"text-muted-foreground",children:o.label}),(0,r.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-violet-700 ml-auto",children:l("mcpAddCard.oauthLabel",{provider:null!=(t=o.oauth)?t:""})})]}),o.description&&(0,r.jsx)("p",{className:"text-[11px] text-muted-foreground",children:o.description}),(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(null==c?void 0:c.hasTokens)?(0,r.jsxs)("span",{className:"text-xs text-emerald-700 flex items-center gap-1",children:[(0,r.jsx)(z.A,{className:"h-3 w-3"})," ",l("mcpAddCard.authorized")]}):(null==c?void 0:c.hasClient)?(0,r.jsxs)(x.$,{type:"button",size:"sm",variant:"outline",onClick:()=>{o.oauth&&A(async()=>{let{beginOAuthAction:e,listOAuthStatusesAction:t}=await s.e(4108).then(s.bind(s,94108)),r=await e(o.oauth);if(!r.ok)return void u.oR.error(r.error);window.open(r.authorizeUrl,"reflex-oauth","width=600,height=720,noopener=no");let n=Date.now(),a=async()=>{if(Date.now()-n>3e5)return void u.oR.error(l("mcpAddCard.authorizationTimedOut"));let e=await t();if(e.ok){let t=e.statuses.find(e=>e.id===o.oauth);if(null==t?void 0:t.hasTokens){u.oR.success(l("mcpAddCard.providerAuthorized",{provider:o.oauth})),m({hasClient:t.hasClient,hasTokens:t.hasTokens});return}}setTimeout(()=>void a(),1500)};a()})},disabled:C,className:"h-7 text-xs",children:[C&&(0,r.jsx)(d.A,{className:"mr-1 h-3 w-3 animate-spin"}),l("mcpAddCard.authorizeVia",{provider:null!=(a=o.oauth)?a:""})]}):(0,r.jsx)("span",{className:"text-xs text-amber-700",children:l("mcpAddCard.clientIdNotConfigured")}),!T&&(0,r.jsxs)(x.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>k(e=>!e),className:"h-7 text-xs text-muted-foreground gap-1",children:[(0,r.jsx)(b.A,{className:"h-3 w-3 transition-transform ".concat(y?"rotate-180":"")}),y?l("mcpAddCard.hideClient"):l("mcpAddCard.editClient")]}),(0,r.jsx)(x.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>void P(),className:"h-7 text-xs text-muted-foreground ml-auto",children:l("mcpAddCard.refresh")})]}),(y||T)&&p&&(0,r.jsxs)("div",{className:"space-y-2 border-t border-violet-200 pt-2 mt-2",children:[p.setupHint&&(0,r.jsx)("div",{className:"rounded border border-amber-200 bg-amber-50 px-2 py-1.5 text-[10px] text-amber-900 leading-snug",children:p.setupHint}),(0,r.jsxs)("a",{href:p.consoleUrl,target:"_blank",rel:"noopener noreferrer",className:"text-[11px] text-violet-700 hover:underline inline-flex items-center gap-1",children:[(0,r.jsx)(O.A,{className:"h-3 w-3"}),l("mcpAddCard.openProviderConsole")]}),p.setupSteps.length>0&&(0,r.jsxs)("div",{className:"rounded border border-violet-200 bg-white/60 p-2",children:[(0,r.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1.5",children:l("mcpAddCard.stepByStep")}),(0,r.jsx)(U.O,{steps:p.setupSteps})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(D.J,{className:"text-[10px]",children:l("mcpAddCard.clientIdLabel")}),(0,r.jsx)(L.p,{value:g,onChange:e=>f(e.target.value),placeholder:"123…apps.googleusercontent.com",className:"font-mono text-xs h-7"})]}),p.needsClientSecret&&(0,r.jsxs)("div",{children:[(0,r.jsxs)(D.J,{className:"text-[10px]",children:[l("mcpAddCard.clientSecretLabel")," ",w&&(0,r.jsx)("span",{className:"text-muted-foreground",children:l("mcpAddCard.clientSecretSavedHint")})]}),(0,r.jsx)(L.p,{type:"password",value:v,onChange:e=>j(e.target.value),placeholder:w?"••••":"GOCSPX-…",className:"font-mono text-xs h-7"})]}),(0,r.jsx)("div",{className:"flex justify-end",children:(0,r.jsxs)(x.$,{type:"button",size:"sm",onClick:()=>{if(o.oauth){if(!g.trim())return void u.oR.error(l("mcpAddCard.clientIdRequired"));I(async()=>{let{saveOAuthClientAction:e}=await s.e(4108).then(s.bind(s,94108)),t=await e({provider:o.oauth,clientId:g.trim(),...v?{clientSecret:v}:{}});if(!t.ok)return void u.oR.error(t.error);u.oR.success(l("mcpAddCard.clientSaved")),j(""),await P()})}},disabled:S||!g.trim(),className:"h-7 text-xs",children:[S?(0,r.jsx)(d.A,{className:"mr-1 h-3 w-3 animate-spin"}):(0,r.jsx)($.A,{className:"mr-1 h-3 w-3"}),l("mcpAddCard.saveClient")]})})]})]})}function M(e){try{return JSON.stringify(e,null,2)}catch(t){return String(e)}}var _=s(54400),W=s.n(_),V=s(7293),G=s(86515),Z=s(16329),X=s(40805),Q=s(8583),Y=s(35994);function ee(e){let{rootId:t,entry:s}=e,n=(0,i.c)("roots"),a=function(e){let t=e.toLowerCase();return"task"===t||"tasks"===t?G.A:"meeting"===t||"meetings"===t?Z.A:"product"===t||"products"===t?X.A:"fact"===t||"facts"===t?Q.A:Y.A}(s.kind),o="/roots/".concat(t,"?file=").concat(encodeURIComponent(s.relPath));return(0,r.jsx)(W(),{href:o,className:"my-2 block rounded-lg border-2 p-[2px] reflex-gradient hover:shadow-md transition-shadow",children:(0,r.jsxs)("div",{className:"rounded-md bg-background/95 backdrop-blur p-3 flex items-center gap-3",children:[(0,r.jsx)("div",{className:"reflex-gradient h-9 w-9 rounded-md flex items-center justify-center text-white shrink-0",children:(0,r.jsx)(a,{className:"h-4 w-4"})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground flex items-center gap-1",children:[(0,r.jsx)(m.A,{className:"h-3 w-3"}),(0,r.jsx)("span",{children:n("kbWriteCard.writtenToKb")}),(0,r.jsx)("span",{className:"font-mono normal-case tracking-normal",children:s.kind})]}),(0,r.jsx)("div",{className:"text-sm font-medium truncate",children:s.title}),(0,r.jsx)("div",{className:"text-[11px] font-mono text-muted-foreground truncate",children:s.relPath})]}),(0,r.jsx)(V.A,{className:"h-4 w-4 text-muted-foreground shrink-0"})]})})}var et=s(39624);function es(e){let{utility:t,rootId:s}=e,n=(0,i.c)("roots"),a="project"===t.scope&&s?"?rootId=".concat(encodeURIComponent(s)):"",o="/utilities/".concat(t.scope,"/").concat(t.id).concat(a);return(0,r.jsx)(W(),{href:o,className:"my-2 block rounded-lg border-2 p-[2px] reflex-gradient hover:shadow-md transition-shadow",children:(0,r.jsxs)("div",{className:"rounded-md bg-background/95 backdrop-blur p-3 flex items-center gap-3",children:[(0,r.jsx)("div",{className:"reflex-gradient h-9 w-9 rounded-md flex items-center justify-center text-white shrink-0",children:(0,r.jsx)(et.A,{className:"h-4 w-4"})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground flex items-center gap-1",children:[(0,r.jsx)(m.A,{className:"h-3 w-3"}),(0,r.jsx)("span",{children:n("utilityCard.installed")}),(0,r.jsx)("span",{className:"font-mono normal-case tracking-normal",children:t.scope})]}),(0,r.jsx)("div",{className:"text-sm font-medium truncate",children:t.name}),(0,r.jsxs)("div",{className:"text-[11px] font-mono text-muted-foreground truncate",children:[t.id," \xb7 v",t.version]})]})]})})}var er=s(94870),en=s(56380),ea=s(76974),ei=s(91940),eo=s(51376);function el(e){let{rootId:t,widget:s}=e,a=(0,i.c)("roots"),[o,l]=(0,n.useState)(!1),[d,c]=(0,n.useTransition)();return(0,r.jsxs)("div",{className:"my-3 rounded-lg border border-violet-200 bg-violet-50/40 dark:border-violet-900/40 dark:bg-violet-950/20 overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-violet-200 dark:border-violet-900/40 bg-violet-100/40 dark:bg-violet-900/20 text-xs",children:[(0,r.jsx)(m.A,{className:"h-3 w-3 text-violet-600"}),(0,r.jsx)("span",{className:"font-medium text-violet-900 dark:text-violet-200",children:"create"===s.op?a("widgetPreview.created"):a("widgetPreview.updated")}),(0,r.jsx)(p.E,{variant:"outline",className:"text-[10px] font-mono",children:s.widgetKind}),(0,r.jsx)("span",{className:"text-[10px] text-muted-foreground font-mono ml-1",children:s.widgetId}),o?(0,r.jsxs)("span",{className:"ml-auto inline-flex items-center gap-1 text-[10px] text-emerald-700",children:[(0,r.jsx)(z.A,{className:"h-3 w-3"}),a("widgetPreview.onDashboard")]}):(0,r.jsxs)("button",{type:"button",onClick:()=>{c(async()=>{let e=await (0,eo.t)(t,s.widgetId);e.ok?(l(!0),u.oR.success(a("widgetPreview.pinned"))):u.oR.error(e.error)})},disabled:d,className:"ml-auto inline-flex items-center gap-1 text-[10px] text-violet-700 hover:underline disabled:opacity-50",title:a("widgetPreview.pinToDashboardTitle"),children:[(0,r.jsx)(er.A,{className:"h-3 w-3"}),d?a("widgetPreview.pinning"):a("widgetPreview.pinToDashboard")]}),(0,r.jsx)(W(),{href:"/roots/".concat(t),className:"inline-flex items-center gap-1 text-[10px] text-muted-foreground hover:text-violet-700",title:a("widgetPreview.openDashboard"),children:(0,r.jsx)(en.A,{className:"h-3 w-3"})})]}),(0,r.jsxs)("div",{className:"p-3 space-y-2 bg-card",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("h4",{className:"text-sm font-medium",children:s.title}),s.description&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:s.description})]}),(0,r.jsxs)("span",{className:"text-[10px] text-muted-foreground inline-flex items-center gap-0.5",title:a("widgetPreview.editViaChatTitle"),children:[(0,r.jsx)(ea.A,{className:"h-2.5 w-2.5"}),a("widgetPreview.editViaChat")]})]}),(0,r.jsx)("div",{className:"pt-1",children:(0,ei.v)(t,s.widgetKind,s.data,{readonly:!0})})]})]})}var ed=s(27474),ec=s(54207);function em(e){let{rootId:t,workflow:s}=e,n=(0,i.c)("roots");return(0,r.jsxs)("div",{className:"my-3 rounded-lg border border-violet-200 bg-violet-50/40 dark:border-violet-900/40 dark:bg-violet-950/20 overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-violet-200 dark:border-violet-900/40 bg-violet-100/40 dark:bg-violet-900/20 text-xs",children:[(0,r.jsx)(m.A,{className:"h-3 w-3 text-violet-600"}),(0,r.jsx)("span",{className:"font-medium text-violet-900 dark:text-violet-200",children:n("workflowPreview.created")}),(0,r.jsx)(p.E,{variant:"outline",className:"text-[10px] font-mono",children:s.trigger}),(0,r.jsx)("span",{className:"text-[10px] text-muted-foreground font-mono ml-1",children:s.workflowId})]}),(0,r.jsxs)("div",{className:"p-3 space-y-2 bg-card",children:[(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[(0,r.jsx)(ed.A,{className:"h-4 w-4 text-violet-600 mt-0.5 shrink-0"}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("h4",{className:"text-sm font-medium",children:s.label}),s.description&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:s.description}),(0,r.jsx)("p",{className:"text-[10px] text-muted-foreground mt-1",children:n.rich("workflowPreview.stepsCount",{count:s.stepCount,trigger:s.trigger,code:e=>(0,r.jsx)("code",{className:"font-mono",children:e})})})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 pt-1 text-xs",children:[(0,r.jsxs)(W(),{href:"/roots/".concat(t,"/workflows/").concat(s.workflowId),className:"inline-flex items-center gap-1 rounded px-2 py-1 bg-violet-600 text-white hover:bg-violet-700",children:[(0,r.jsx)(ec.A,{className:"h-3 w-3"}),n("workflowPreview.openInEditor")]}),(0,r.jsxs)("span",{className:"text-[10px] text-muted-foreground inline-flex items-center gap-1",children:[(0,r.jsx)(ea.A,{className:"h-2.5 w-2.5"}),n("workflowPreview.editHereViaChat")]})]})]})]})}function eu(e){let{rootId:t,topicId:s,initialEvents:a,initialActive:m}=e,x=(0,i.c)("roots"),[h,b]=(0,n.useState)(a),[j,w]=(0,n.useState)(m),[N,y]=(0,n.useState)(!1),k=(0,n.useRef)(a.length>0?a[a.length-1].seq:-1),C=(0,n.useRef)(null),A=(0,n.useMemo)(()=>(function(e){let t=[],s=new Map,r=null,n=null,a=e=>{var a;let i=s.get(e),o={kind:"assistant",agentId:e,agentLabel:null!=(a=null==i?void 0:i.label)?a:"assistant",...(null==i?void 0:i.model)?{agentModel:i.model}:{},...(null==i?void 0:i.role)?{agentRole:i.role}:{},segments:[],pending:!0};return t.push(o),r=o,n=null,o},i=(e,t)=>{let s=r;s&&(s.pending=!1,"failed"===e&&t&&(s.error=t),r=null,n=null)};for(let l of e){if("agent-start"===l.type){s.set(l.agentId,l.meta);continue}if("turn-start"===l.type){a(l.agentId);continue}if("turn-end"===l.type||"agent-end"===l.type){i(l.status,l.error);continue}if("user-message"===l.type){let e=s.get(l.agentId),r=null==e?void 0:e.role;t.push({kind:"user",body:l.text,agentId:l.agentId,...r?{agentRole:r}:{},...(null==e?void 0:e.label)?{agentLabel:e.label}:{}});continue}if("system"===l.type){l.subtype&&l.subtype.startsWith("reflex.")&&t.push({kind:"system",body:l.text,systemSubtype:l.subtype});continue}if("assistant-delta"===l.type){let e=r;if(e||(e=a(l.agentId)),!e)continue;let t=e.segments;if(n&&"text"===n.kind)n.text+=l.text;else{let e={kind:"text",text:l.text};t.push(e),n=e}continue}if("tool-use"===l.type){let e=r;if(e||(e=a(l.agentId)),!e)continue;let t=e.segments,s={kind:"tool",tool:{toolUseId:l.toolUseId,name:l.name,input:l.input}};t.push(s),n=s;continue}if("tool-result"===l.type){var o;let e=r;if(!e)continue;let t=null!=(o=e.segments)?o:[];for(let e=t.length-1;e>=0;e--){let s=t[e];if("tool"===s.kind&&s.tool.toolUseId===l.toolUseId){s.tool.result={content:l.content,...l.isError?{isError:!0}:{}};break}}continue}if("error"===l.type){let e=r;e&&(e.error=l.message);continue}if("permission-request"===l.type){let e=null!=r?r:a(l.agentId);if(!e)continue;e.segments.push({kind:"permission",perm:{requestId:l.requestId,agentId:l.agentId,...l.tool?{tool:l.tool}:{},...l.action?{action:l.action}:{},...void 0!==l.input?{input:l.input}:{},...l.description?{description:l.description}:{}}}),n=e.segments[e.segments.length-1];continue}if("permission-response"===l.type){for(let e of t)if("assistant"===e.kind&&e.segments)for(let t of e.segments)"permission"===t.kind&&t.perm.requestId===l.requestId&&(t.perm.resolved={decision:l.decision,...l.scope?{scope:l.scope}:{}});continue}if("question"===l.type){let e=null!=r?r:a(l.agentId);if(!e)continue;e.segments.push({kind:"question",question:{questionId:l.questionId,agentId:l.agentId,prompt:l.prompt,...l.header?{header:l.header}:{},...l.multiSelect?{multiSelect:!0}:{},...l.choices?{choices:l.choices}:{},...l.options?{options:l.options}:{}}}),n=e.segments[e.segments.length-1];continue}if("answer"===l.type){for(let e of t)if("assistant"===e.kind&&e.segments)for(let t of e.segments)"question"===t.kind&&t.question.questionId===l.questionId&&(t.question.resolved={answer:l.answer});continue}if("mcp-add-request"===l.type){let e=null!=r?r:a(l.agentId);if(!e)continue;e.segments.push({kind:"mcp-add",entry:{requestId:l.requestId,agentId:l.agentId,server:l.server,label:l.label,...l.description?{description:l.description}:{},config:l.config,...l.secrets?{secrets:l.secrets}:{}}}),n=e.segments[e.segments.length-1];continue}if("mcp-add-response"===l.type){for(let e of t)if("assistant"===e.kind&&e.segments)for(let t of e.segments)"mcp-add"===t.kind&&t.entry.requestId===l.requestId&&(t.entry.resolved={decision:l.decision});continue}if("onboarding-done"===l.type){t.push({kind:"onboarding-done"});continue}if("kb-write"===l.type){let e=null!=r?r:a(l.agentId);if(!e)continue;e.segments.push({kind:"kb",kb:{kind:l.kind,title:l.title,relPath:l.relPath}}),n=e.segments[e.segments.length-1];continue}if("utility-installed"===l.type){let e=null!=r?r:a(l.agentId);if(!e)continue;e.segments.push({kind:"utility",utility:{id:l.utilityId,name:l.name,scope:l.scope,version:l.version}}),n=e.segments[e.segments.length-1];continue}if("utility-error"===l.type){let e=null!=r?r:a(l.agentId);e&&(e.error=l.message);continue}if("widget-event"===l.type){let e=null!=r?r:a(l.agentId);if(!e)continue;e.segments.push({kind:"widget",widget:{op:l.op,widgetId:l.widgetId,title:l.title,...l.description?{description:l.description}:{},widgetKind:l.kind,data:l.data,...l.sourceTopicId?{sourceTopicId:l.sourceTopicId}:{}}}),n=e.segments[e.segments.length-1];continue}if("widget-error"===l.type){let e=null!=r?r:a(l.agentId);e&&(e.error=l.message);continue}if("workflow-event"===l.type){let e=null!=r?r:a(l.agentId);if(!e)continue;e.segments.push({kind:"workflow",workflow:{workflowId:l.workflowId,label:l.label,...l.description?{description:l.description}:{},trigger:l.trigger,stepCount:l.stepCount}}),n=e.segments[e.segments.length-1];continue}if("workflow-error"===l.type){let e=null!=r?r:a(l.agentId);e&&(e.error=l.message);continue}}return t})(h),[h]),S=(0,n.useCallback)(()=>{let e=C.current;e&&(e.scrollTop=e.scrollHeight)},[]);(0,n.useEffect)(()=>{S()},[A,S]),(0,n.useEffect)(()=>{let e=new AbortController,r="/api/roots/".concat(t,"/chat/").concat(s,"/stream?since=").concat(k.current),n=!1;return(async()=>{try{let a=await fetch(r,{signal:e.signal});if(!a.ok||!a.body)return void y(!1);y(!0);let i=a.body.getReader(),o=new TextDecoder,l="";for(;!n;){let{done:e,value:r}=await i.read();if(e)break;for(let e of(l+=o.decode(r,{stream:!0}),function(e){let t=[];for(;;){let s=e.indexOf("\n\n");if(s<0)break;let r=e.slice(0,s);e=e.slice(s+2);let n="message",a="";for(let e of r.split(/\r?\n/))!e.startsWith(":")&&(e.startsWith("event:")?n=e.slice(6).trim():e.startsWith("data:")&&(a+=e.slice(5).trimStart()));let i=null;try{i=a?JSON.parse(a):null}catch(e){i=null}t.push({event:n,data:i,rest:e})}return t}(l)))if(l=e.rest,"event"===e.event&&e.data){let t=e.data;I(t)}else if("error"===e.event){var t,s;u.oR.error(String(null!=(s=null==(t=e.data)?void 0:t.message)?s:"stream"))}}}catch(e){n||y(!1)}finally{y(!1)}})(),()=>{n=!0,e.abort()}},[s,t]);let I=(0,n.useCallback)(e=>{e.seq<=k.current||(k.current=e.seq,b(t=>[...t,e]),"turn-start"===e.type?w(!0):"agent-start"===e.type&&"orchestrator"===e.meta.role&&w(!0),("turn-end"===e.type||"agent-end"===e.type)&&(w(!1),(0,v.$d)(v.Zi.topicsChanged(t))),"kb-write"===e.type&&(0,v.$d)(v.Zi.kbChanged(t)))},[t]),P=(0,n.useCallback)(async()=>{try{let r=await fetch("/api/roots/".concat(t,"/chat/").concat(s,"/stop"),{method:"POST"});if(!r.ok){var e;let t=await r.json().catch(()=>({}));u.oR.error(null!=(e=t.error)?e:"HTTP ".concat(r.status));return}w(!1)}catch(e){u.oR.error(e instanceof Error?e.message:String(e))}},[t,s]),T=(0,n.useCallback)(async(e,r)=>{let n=e.trim();if(!n&&0===r.length)return!1;try{let e=await fetch("/api/roots/".concat(t,"/chat/").concat(s,"/send"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:n,attachments:r})});if(409===e.status)return u.oR.error(x("chat.waitForCurrentAnswer")),!1;if(!e.ok){var a;let t=await e.json().catch(()=>({}));return u.oR.error(null!=(a=t.error)?a:"HTTP ".concat(e.status)),!1}return!0}catch(e){return u.oR.error(e instanceof Error?e.message:String(e)),!1}},[t,s]);return(0,r.jsxs)("div",{className:"flex-1 flex flex-col min-h-0",children:[(0,r.jsxs)("div",{className:"border-b px-6 py-2 flex items-center gap-3 text-xs",children:[(0,r.jsx)("span",{className:"text-muted-foreground inline-flex items-center gap-1",children:N?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.A,{className:"h-3 w-3 text-emerald-600"})," ",x("chat.connectedToStream")]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.A,{className:"h-3 w-3 text-muted-foreground"})," ",x("chat.offline")]})}),j&&(0,r.jsxs)(p.E,{variant:"default",className:"gap-1 bg-emerald-600",children:[(0,r.jsx)(d.A,{className:"h-3 w-3 animate-spin"})," ",x("chat.agentWorking")]}),(0,r.jsxs)("span",{className:"ml-auto text-[10px] text-muted-foreground font-mono",children:["seq: ",k.current]})]}),(0,r.jsx)("div",{ref:C,className:"flex-1 overflow-y-auto",children:(0,r.jsx)("div",{className:"mx-auto max-w-3xl px-6 py-6 space-y-4",children:0===A.length?(0,r.jsx)("p",{className:"text-sm text-muted-foreground italic",children:x("chat.topicEmpty")}):A.map((e,n)=>(0,r.jsx)(ep,{turn:e,rootId:t,topicId:s},n))})}),(0,r.jsx)(g.E,{label:x("chat.replyInTopicLabel"),children:(0,r.jsx)(f.L,{rootId:t,topicId:s,placeholder:x("chat.topicPlaceholder"),submitLabel:x("chat.send"),pendingLabel:x("chat.sendPending"),SubmitIcon:c.A,active:j,onStop:P,onSubmit:e=>{let{message:t,attachments:s}=e;return T(t,s)}})})]})}function ep(e){var t,s,n,a;let{turn:o,rootId:l,topicId:c}=e,p=(0,i.c)("roots"),x=(e,t)=>{let s=p("kb.summaryContextChat",{url:t,text:e});fetch("/api/roots/".concat(l,"/chat/").concat(c,"/send"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:s,attachments:[]})}).then(async e=>{if(!e.ok){var t;let s=await e.json().catch(()=>({}));u.oR.error(null!=(t=s.error)?t:"HTTP ".concat(e.status));return}u.oR.success(p("kb.summarySentToChat"))}).catch(e=>{u.oR.error(e instanceof Error?e.message:String(e))})};if("system"===o.kind)return(0,r.jsx)(eg,{body:null!=(s=o.body)?s:"",subtype:o.systemSubtype});if("onboarding-done"===o.kind)return(0,r.jsx)(eh,{rootId:l});if("user"===o.kind){if("subagent"===o.agentRole)return null;let e=null!=(n=o.body)?n:"";if(/^\/skill\s+space-onboarding\s*$/.test(e.trim()))return null;let t=function(e,t){let s=e.trimStart(),r=/^\[MCP setup wizard\]\s*([^\n]*)/.exec(s);if(r)return{badge:t.mcpSetupBadge,summary:r[1].trim()||t.mcpSetupDefault,details:e};let n=/^\[Reflex\]\s+Answer for question\s+\S+:\s+([\s\S]*?)(?:\s*\.?\s*Continue\.\s*)?$/.exec(s);if(n)return{badge:t.answerBadge,summary:n[1].trim(),details:e};let a=/^\[Reflex\]\s+(Allowed|Denied|User (allowed|denied))[\s\S]*?:\s*([\s\S]*?)(?:\s*\.?\s*Continue\.\s*)?$/.exec(s);if(a){var i,o;return{badge:t.permissionBadge,summary:(null!=(o=null!=(i=a[3])?i:a[1])?o:"").trim()||t.permissionUserDecision,details:e}}if(/^\[Reflex\]\s+(MCP server|User rejected|Failed to register)[\s\S]*?$/.exec(s)){let r=s.split("\n",1)[0];return{badge:t.mcpBadge,summary:r.replace(/^\[Reflex\]\s+/,"").slice(0,200),details:e}}if(/^\[Reflex \/goal\]\s+([\s\S]*)/.exec(s))return{badge:t.goalBadge,summary:t.goalAutoContinue,details:e};let l=/^\[Reflex[^\]]*\]\s*([\s\S]*)/.exec(s);if(l){let s=l[1].split("\n",1)[0].trim();return{badge:t.systemBadge,summary:s.slice(0,200)||t.systemMessage,details:e}}return null}(e,{mcpSetupDefault:p("chat.mcpSetupDefault"),mcpSetupBadge:p("chat.mcpSetupBadge"),answerBadge:p("chat.answerBadge"),permissionBadge:p("chat.permissionBadge"),permissionUserDecision:p("chat.permissionUserDecision"),mcpBadge:p("chat.mcpBadge"),goalBadge:p("chat.goalBadge"),goalAutoContinue:p("chat.goalAutoContinue"),systemBadge:p("chat.systemBadge"),systemMessage:p("chat.systemMessage")});return t?(0,r.jsx)(ef,{system:t}):(0,r.jsxs)("div",{className:"rounded-lg border bg-muted/40 p-4",children:[(0,r.jsx)("div",{className:"text-[11px] uppercase tracking-wide text-muted-foreground mb-2",children:"user"}),(0,r.jsx)(h.p,{source:e,onSendToChat:x})]})}let g="subagent"===o.agentRole;return(0,r.jsx)(ex,{isSubAgent:g,turn:o,children:(0,r.jsxs)("div",{className:g?"rounded-md border border-dashed bg-muted/30 px-3 py-2":"rounded-lg border bg-background p-4",children:[(0,r.jsxs)("div",{className:"text-[11px] uppercase tracking-wide text-muted-foreground mb-2 flex items-center gap-2",children:[(0,r.jsx)(m.A,{className:"h-3 w-3"}),(0,r.jsx)("span",{children:null!=(a=o.agentLabel)?a:"assistant"}),g&&(0,r.jsx)("span",{className:"text-[10px] normal-case px-1.5 py-0.5 rounded bg-violet-100 text-violet-800 tracking-normal",children:"sub-agent"}),o.agentModel&&(0,r.jsx)("span",{className:"font-mono text-[10px] normal-case tracking-normal",children:o.agentModel}),o.pending&&(0,r.jsx)(d.A,{className:"h-3 w-3 animate-spin"}),o.error&&(0,r.jsx)("span",{className:"text-destructive text-xs normal-case",children:p("chat.errorPrefix",{message:o.error})})]}),null==(t=o.segments)?void 0:t.map((e,t)=>{if("text"===e.kind){let s=function(e){let t=e;for(let e of["permission","question","kb","utility","dispatch","mcp-add","youtube-summary","widget-create","widget-update","workflow-create","image-gen","memory","suggestion","onboarding-done","skill-create","task-create","task-update"]){let s=RegExp("<{1,2}reflex:".concat(e,">{1,2}[\\s\\S]*?<{1,2}\\/reflex:").concat(e,">{1,2}"),"g");t=t.replace(s,"")}return t}(e.text);return s.trim()?(0,r.jsx)(h.p,{source:s,onSendToChat:x},t):null}return"tool"===e.kind?(0,r.jsx)(P,{name:e.tool.name,input:e.tool.input,...e.tool.result?{result:e.tool.result}:{},pending:!e.tool.result},t):"permission"===e.kind?(0,r.jsx)(H,{perm:e.perm},t):"question"===e.kind?(0,r.jsx)(F,{question:e.question},t):"kb"===e.kind?(0,r.jsx)(ee,{rootId:l,entry:e.kb},t):"mcp-add"===e.kind?(0,r.jsx)(J,{entry:e.entry},t):"utility"===e.kind?(0,r.jsx)(es,{utility:e.utility,rootId:l},t):"widget"===e.kind?(0,r.jsx)(el,{rootId:l,widget:e.widget},t):"workflow"===e.kind?(0,r.jsx)(em,{rootId:l,workflow:e.workflow},t):null}),o.pending&&(!o.segments||0===o.segments.length)&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:p("chat.thinking")})]})})}function ex(e){var t;let{isSubAgent:s,turn:n,children:a}=e,o=(0,i.c)("roots");if(!s)return(0,r.jsx)(r.Fragment,{children:a});let l=[null!=(t=n.agentLabel)?t:"sub-agent",o(n.pending?"chat.subAgentWorking":n.error?"chat.subAgentError":"chat.subAgentDone")].join(" \xb7 ");return(0,r.jsxs)("details",{className:"group",open:n.pending,children:[(0,r.jsxs)("summary",{className:"cursor-pointer list-none flex items-center gap-2 text-xs text-muted-foreground border-l-2 border-violet-300 pl-2 py-1 hover:text-foreground select-none",children:[(0,r.jsx)("span",{className:"inline-block h-3 w-3 text-center transition-transform group-open:rotate-90",children:"▸"}),(0,r.jsx)(m.A,{className:"h-3 w-3 text-violet-500"}),(0,r.jsx)("span",{children:l}),n.pending&&(0,r.jsx)(d.A,{className:"h-3 w-3 animate-spin"})]}),(0,r.jsx)("div",{className:"mt-1 pl-4",children:a})]})}function eh(e){let{rootId:t}=e,s=(0,a.useRouter)();return(0,r.jsx)("div",{className:"rounded-lg border border-emerald-300 bg-emerald-50/70 dark:bg-emerald-950/30 p-4",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("div",{className:"rounded-full bg-emerald-500/10 p-2 mt-0.5",children:(0,r.jsx)(m.A,{className:"h-4 w-4 text-emerald-600"})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("div",{className:"font-medium text-sm",children:"Dashboard is ready"}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Suggestions are waiting on the dashboard. Approve the ones that feel right; dismiss the rest. Come back here anytime to add context."})]}),(0,r.jsx)(x.$,{type:"button",size:"sm",onClick:()=>s.push("/roots/".concat(t)),children:"Go to dashboard"})]})})}function eg(e){let{body:t,subtype:s}=e;return(0,r.jsxs)("div",{className:["rounded-md border px-3 py-2 text-xs flex items-start gap-2","reflex.preflight"===s?"border-violet-200 bg-violet-50/60 text-violet-900":"border-dashed bg-muted/30 text-muted-foreground"].join(" "),children:[(0,r.jsx)(m.A,{className:"h-3.5 w-3.5 mt-0.5 shrink-0 text-violet-600"}),(0,r.jsx)("div",{className:"whitespace-pre-wrap leading-relaxed flex-1 min-w-0",children:t})]})}function ef(e){let{system:t}=e;return(0,r.jsxs)("details",{className:"group rounded-md border border-dashed bg-muted/20 px-3 py-1.5 text-xs",children:[(0,r.jsxs)("summary",{className:"cursor-pointer list-none flex items-center gap-2 select-none",children:[(0,r.jsx)("span",{className:"inline-block h-3 w-3 text-center text-muted-foreground transition-transform group-open:rotate-90",children:"▸"}),(0,r.jsx)("span",{className:"rounded bg-muted-foreground/10 text-[10px] uppercase tracking-wider text-muted-foreground px-1.5 py-0.5 font-mono",children:t.badge}),(0,r.jsx)("span",{className:"truncate text-foreground/80",children:t.summary})]}),(0,r.jsx)("pre",{className:"mt-2 pl-5 text-[11px] whitespace-pre-wrap font-mono text-muted-foreground/90",children:t.details})]})}},16225:(e,t,s)=>{"use strict";s.d(t,{DeleteTopicButton:()=>p});var r=s(4624),n=s(99356),a=s(69285),i=s(49411),o=s(3239),l=s(46972),d=s(56221),c=s(85253),m=s(40920),u=s(63514);function p(e){let{rootId:t,topicId:s,topicTitle:p}=e,x=(0,i.c)("roots"),[h,g]=(0,n.useTransition)(),f=(0,a.useRouter)();return(0,r.jsxs)(c.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>{confirm(x("deleteTopic.confirm",{title:p}))&&g(async()=>{let e=await (0,m.L)(t,s);if(!e.ok){var r;d.oR.error(null!=(r=e.error)?r:x("deleteTopic.deleteFailed"));return}d.oR.success(x("deleteTopic.deleted")),(0,u.$d)(u.Zi.topicsChanged(t)),f.push("/roots/".concat(t))})},disabled:h,className:"gap-1 h-8 text-muted-foreground hover:text-destructive",title:x("deleteTopic.title"),children:[h?(0,r.jsx)(o.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(l.A,{className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{className:"text-xs",children:x("deleteTopic.label")})]})}},25342:(e,t,s)=>{Promise.resolve().then(s.bind(s,3989)),Promise.resolve().then(s.bind(s,16225)),Promise.resolve().then(s.bind(s,28260)),Promise.resolve().then(s.bind(s,91074)),Promise.resolve().then(s.bind(s,96253)),Promise.resolve().then(s.bind(s,28050)),Promise.resolve().then(s.bind(s,94904)),Promise.resolve().then(s.bind(s,13270)),Promise.resolve().then(s.bind(s,99730)),Promise.resolve().then(s.bind(s,89146)),Promise.resolve().then(s.bind(s,19078)),Promise.resolve().then(s.bind(s,67854)),Promise.resolve().then(s.bind(s,69050)),Promise.resolve().then(s.bind(s,63739)),Promise.resolve().then(s.bind(s,33976)),Promise.resolve().then(s.bind(s,12537)),Promise.resolve().then(s.bind(s,97485)),Promise.resolve().then(s.bind(s,41923)),Promise.resolve().then(s.bind(s,73868)),Promise.resolve().then(s.bind(s,53511)),Promise.resolve().then(s.bind(s,2018)),Promise.resolve().then(s.bind(s,18487)),Promise.resolve().then(s.bind(s,98346)),Promise.resolve().then(s.bind(s,14884)),Promise.resolve().then(s.bind(s,85314)),Promise.resolve().then(s.bind(s,17280)),Promise.resolve().then(s.bind(s,8855)),Promise.resolve().then(s.bind(s,86631)),Promise.resolve().then(s.bind(s,2604)),Promise.resolve().then(s.bind(s,27237)),Promise.resolve().then(s.bind(s,49455)),Promise.resolve().then(s.bind(s,39211)),Promise.resolve().then(s.bind(s,56360)),Promise.resolve().then(s.t.bind(s,54400,23))},28260:(e,t,s)=>{"use strict";s.d(t,{GoalBadge:()=>g});var r=s(4624),n=s(99356),a=s(49411),i=s(13561),o=s(58726),l=s(5270),d=s(41234),c=s(56221),m=s(85253),u=s(28310),p=s(13506),x=s(7911);let h=(0,x.createServerReference)("609d4ced8e13cb529b51ab1cbdcc944883ef6f328f",x.callServer,void 0,x.findSourceMapURL,"clearTopicGoalAction");function g(e){var t;let{rootId:s,topicId:x,goal:g,status:f,iterations:v}=e,b=(0,a.c)("roots"),[j,w]=(0,n.useTransition)(),N="completed"===(t=f)?o.A:"abandoned"===t?l.A:d.A;return(0,r.jsxs)("div",{className:(0,p.cn)("flex items-center gap-2 rounded-md border px-3 py-1.5 text-xs","active"===f&&"reflex-gradient text-foreground border-transparent","completed"===f&&"border-emerald-500/40 bg-emerald-50","abandoned"===f&&"border-destructive/40 bg-destructive/5"),children:[(0,r.jsx)(N,{className:"h-3.5 w-3.5 shrink-0"}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("div",{className:"text-[10px] uppercase tracking-wider opacity-80",children:["/goal \xb7 ",f," ","active"===f&&v>0&&(0,r.jsxs)("span",{className:"font-mono",children:["(",v,")"]})]}),(0,r.jsx)("div",{className:"truncate font-medium",title:g,children:g})]}),"active"===f&&(0,r.jsxs)(m.$,{type:"button",size:"sm",variant:"ghost",className:"h-7 shrink-0",disabled:j,onClick:()=>{confirm(b("goalBadge.stopConfirm"))&&w(async()=>{var e;let t=await h(s,x);t.ok?c.oR.success(b("goalBadge.stopSuccess")):c.oR.error(null!=(e=t.error)?e:b("goalBadge.stopFailed"))})},children:[(0,r.jsx)(i.A,{className:"mr-1 h-3 w-3"})," ",b("goalBadge.stop")]}),("completed"===f||"abandoned"===f)&&(0,r.jsx)(u.E,{variant:"outline",className:"shrink-0 capitalize",children:f})]})}},40920:(e,t,s)=>{"use strict";s.d(t,{L:()=>n});var r=s(7911);let n=(0,r.createServerReference)("60f16adfda42bc1297a7276d1dc3c3708f7f5bc4d6",r.callServer,void 0,r.findSourceMapURL,"deleteTopicAction")},66459:(e,t,s)=>{"use strict";s.d(t,{O:()=>c});var r=s(4624),n=s(99356),a=s(43153),i=s(9598),o=s(56221),l=s(49411),d=s(85253);function c(e){let{steps:t}=e,s=(0,l.c)("app");return t&&0!==t.length?(0,r.jsx)("ol",{className:"space-y-2 text-xs",children:t.map((e,t)=>(0,r.jsxs)("li",{className:"flex gap-2",children:[(0,r.jsxs)("span",{className:"font-mono text-muted-foreground shrink-0 w-5 text-right",children:[t+1,"."]}),(0,r.jsxs)("div",{className:"space-y-1 flex-1 min-w-0",children:[(0,r.jsx)("div",{children:e.title}),e.choice&&(0,r.jsxs)("div",{className:"text-[11px]",children:[(0,r.jsx)("span",{className:"text-muted-foreground",children:s("oauth.copyHint")}),(0,r.jsx)("span",{className:"font-medium bg-muted/60 rounded px-1.5 py-0.5",children:e.choice})]}),e.body&&(0,r.jsx)("p",{className:"text-[11px] text-muted-foreground",children:e.body}),e.copy&&(0,r.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[e.field&&(0,r.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[e.field,":"]}),(0,r.jsx)("code",{className:"font-mono text-[11px] bg-muted/60 rounded px-1.5 py-0.5 break-all flex-1 min-w-0",children:e.copy}),(0,r.jsx)(m,{value:e.copy})]})]})]},t))}):null}function m(e){let{value:t}=e,s=(0,l.c)("app"),[c,m]=(0,n.useState)(!1);return(0,r.jsx)(d.$,{type:"button",size:"icon",variant:"ghost",className:"h-6 w-6 shrink-0",onClick:async()=>{try{await navigator.clipboard.writeText(t),m(!0),o.oR.success(s("oauth.copied")),setTimeout(()=>m(!1),1200)}catch(e){o.oR.error(s("oauth.copyFailed"))}},title:s("oauth.copy"),children:c?(0,r.jsx)(a.A,{className:"h-3 w-3 text-emerald-600"}):(0,r.jsx)(i.A,{className:"h-3 w-3"})})}}},e=>{e.O(0,[4400,4678,9776,6785,3335,9411,2038,8775,6568,5596,3717,9001,4933,146,7358],()=>e(e.s=25342)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[310],{3989:(e,t,s)=>{"use strict";s.d(t,{ChatView:()=>eu});var r=s(4624),n=s(99356),a=s(69285),i=s(49411),o=s(23506),l=s(1646),d=s(3239),c=s(95265),m=s(8096),u=s(56221),p=s(28310),x=s(85253),h=s(26288),g=s(63602),f=s(18471),v=s(63514),b=s(69709),j=s(69205),w=s(49623),N=s(51587),y=s(76479),k=s(53296),C=s(43863),A=s(9923),S=s(94494),I=s(13506);function P(e){let{name:t,input:s,result:a,pending:o}=e,l=(0,i.c)("roots"),[c,m]=(0,n.useState)(!1),u=function(e){let t=e.toLowerCase();return"read"===t?w.A:"write"===t||"edit"===t?N.A:"bash"===t||"shell"===t?y.A:"glob"===t?k.A:"grep"===t||"search"===t?C.A:"ls"===t?A.A:S.A}(t),p=function(e,t){if(!t||"object"!=typeof t)return"";let s=e.toLowerCase();if(("read"===s||"write"===s||"edit"===s)&&"string"==typeof t.file_path)return t.file_path;if("bash"===s&&"string"==typeof t.command)return t.command.length>80?t.command.slice(0,77)+"…":t.command;if("glob"===s&&"string"==typeof t.pattern)return t.pattern;if("grep"===s){let e=[];return"string"==typeof t.pattern&&e.push(t.pattern),"string"==typeof t.path&&e.push("in ".concat(t.path)),e.join(" ")}return"ls"===s&&"string"==typeof t.path?t.path:""}(t,s);return(0,r.jsxs)("div",{className:(0,I.cn)("rounded-lg border my-2 text-sm overflow-hidden",(null==a?void 0:a.isError)?"border-destructive/40 bg-destructive/5":"bg-muted/30"),children:[(0,r.jsxs)("button",{type:"button",onClick:()=>m(e=>!e),className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-accent/40 transition-colors",children:[c?(0,r.jsx)(b.A,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}):(0,r.jsx)(j.A,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,r.jsx)(u,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,r.jsx)("span",{className:"font-mono text-xs font-medium",children:t}),p&&(0,r.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:p}),(0,r.jsx)("span",{className:"ml-auto text-[10px] uppercase tracking-wider text-muted-foreground shrink-0",children:o?(0,r.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,r.jsx)(d.A,{className:"h-3 w-3 animate-spin"})," ",l("toolCall.working")]}):(null==a?void 0:a.isError)?(0,r.jsx)("span",{className:"text-destructive",children:l("toolCall.error")}):a?(0,r.jsx)("span",{children:l("toolCall.done")}):(0,r.jsx)("span",{children:"—"})})]}),c&&(0,r.jsxs)("div",{className:"px-3 pb-3 space-y-2",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"input"}),(0,r.jsx)("pre",{className:"text-[11px] font-mono bg-background/60 rounded p-2 overflow-x-auto whitespace-pre-wrap break-all",children:function(e){try{return JSON.stringify(e,null,2)}catch(t){return String(e)}}(s)})]}),a&&(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"output"}),(0,r.jsx)("pre",{className:(0,I.cn)("text-[11px] font-mono rounded p-2 overflow-x-auto whitespace-pre-wrap max-h-64 overflow-y-auto",a.isError?"bg-destructive/10 text-destructive-foreground":"bg-background/60"),children:a.content||"(empty)"})]})]})]})}var T=s(3024),q=s(86295),R=s(13561),z=s(43153),B=s(59145),E=s(35687),O=s(39783),$=s(65714),L=s(15523),D=s(78825),U=s(66459);function H(e){let{perm:t}=e,s=(0,i.c)("roots"),[a,o]=(0,n.useTransition)(),l=t.resolved,c=(e,s)=>{o(async()=>{let r=await fetch("/api/agents/".concat(t.agentId,"/respond"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:"permission",requestId:t.requestId,decision:e,...s?{scope:s}:{},...t.tool?{tool:t.tool}:{}})});if(!r.ok){var n;let e=await r.json().catch(()=>({}));u.oR.error(null!=(n=e.error)?n:"HTTP ".concat(r.status))}})};return(0,r.jsx)("div",{className:(0,I.cn)("rounded-lg border-2 my-2 p-4 reflex-gradient",l&&"opacity-60"),children:(0,r.jsxs)("div",{className:"rounded-md bg-background/95 backdrop-blur p-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-2 text-[11px] uppercase tracking-wider text-muted-foreground",children:[(0,r.jsx)(T.A,{className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{children:s("permissionCard.title")}),t.tool&&(0,r.jsx)("span",{className:"font-mono normal-case tracking-normal",children:t.tool}),(0,r.jsx)("span",{className:"ml-auto font-mono normal-case tracking-normal",children:t.requestId})]}),t.description&&(0,r.jsx)("p",{className:"text-sm mb-2",children:t.description}),void 0!==t.input&&(0,r.jsx)("pre",{className:"text-[11px] font-mono bg-muted/40 rounded p-2 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto mb-3",children:M(t.input)}),l?(0,r.jsx)("div",{className:"flex items-center gap-2 text-sm",children:"allow"===l.decision?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(q.A,{className:"h-4 w-4 text-emerald-600"}),(0,r.jsx)("span",{children:s("permissionCard.allowed",{scope:l.scope?" (".concat(l.scope,")"):""})})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(R.A,{className:"h-4 w-4 text-destructive"}),(0,r.jsx)("span",{children:s("permissionCard.denied")})]})}):(0,r.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,r.jsxs)(x.$,{size:"sm",onClick:()=>c("allow","once"),disabled:a,children:[a?(0,r.jsx)(d.A,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(z.A,{className:"mr-2 h-3.5 w-3.5"}),s("permissionCard.allow")]}),(0,r.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:()=>c("allow","always"),disabled:a,children:[(0,r.jsx)(q.A,{className:"mr-2 h-3.5 w-3.5"}),s("permissionCard.allowAlways")]}),(0,r.jsxs)(x.$,{size:"sm",variant:"destructive",onClick:()=>c("deny"),disabled:a,children:[(0,r.jsx)(R.A,{className:"mr-2 h-3.5 w-3.5"}),s("permissionCard.deny")]})]})]})})}function F(e){var t;let{question:s}=e,a=(0,i.c)("roots"),[o,l]=(0,n.useState)(""),[c,m]=(0,n.useState)(new Set),[p,h]=(0,n.useTransition)(),g=s.resolved,f=s.options&&s.options.length>0?s.options:(null!=(t=s.choices)?t:[]).map(e=>({label:e})),v=e=>{e.trim()&&h(async()=>{let t=await fetch("/api/agents/".concat(s.agentId,"/respond"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:"answer",questionId:s.questionId,answer:e.trim()})});if(t.ok)l(""),m(new Set);else{var r;let e=await t.json().catch(()=>({}));u.oR.error(null!=(r=e.error)?r:"HTTP ".concat(t.status))}})};return(0,r.jsx)("div",{className:(0,I.cn)("rounded-lg border-2 my-2 p-4 reflex-gradient",g&&"opacity-60"),children:(0,r.jsxs)("div",{className:"rounded-md bg-background/95 backdrop-blur p-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-2 text-[11px] uppercase tracking-wider text-muted-foreground flex-wrap",children:[(0,r.jsx)(B.A,{className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{children:a("questionCard.title")}),s.header&&(0,r.jsx)("span",{className:"rounded bg-violet-100 dark:bg-violet-950/60 text-violet-900 dark:text-violet-200 px-1.5 py-0.5 text-[10px] uppercase font-mono",children:s.header}),s.multiSelect&&(0,r.jsx)("span",{className:"text-[10px] normal-case tracking-normal italic",children:a("questionCard.multiSelect")}),(0,r.jsx)("span",{className:"ml-auto font-mono normal-case tracking-normal",children:s.questionId})]}),(0,r.jsx)("p",{className:"text-sm font-medium mb-3",children:s.prompt}),g?(0,r.jsxs)("p",{className:"text-sm text-muted-foreground",children:[a("questionCard.answerLabel")," ",(0,r.jsx)("span",{className:"text-foreground",children:function(e){if(!e.startsWith("["))return e;try{let t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e))return t.join(", ")}catch(e){}return e}(g.answer)})]}):(0,r.jsxs)("div",{className:"space-y-2",children:[f.length>0&&(0,r.jsx)("div",{className:"flex flex-col gap-1.5",children:f.map(e=>{let t=c.has(e.label);return s.multiSelect?(0,r.jsxs)("button",{type:"button",onClick:()=>{var t;return t=e.label,void m(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},disabled:p,className:(0,I.cn)("flex items-start gap-2 text-left rounded-md border p-2.5 transition",t?"border-violet-500 bg-violet-50 dark:bg-violet-950/30":"border-input hover:bg-accent/40",p&&"opacity-50"),children:[(0,r.jsx)("span",{className:(0,I.cn)("mt-0.5 h-3.5 w-3.5 shrink-0 rounded border flex items-center justify-center",t?"bg-violet-600 border-violet-600 text-white":"border-muted-foreground/40"),children:t&&(0,r.jsx)(z.A,{className:"h-2.5 w-2.5"})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("div",{className:"text-sm font-medium",children:e.label}),e.description&&(0,r.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5 leading-snug",children:e.description})]})]},e.label):(0,r.jsx)("button",{type:"button",onClick:()=>v(e.label),disabled:p,className:(0,I.cn)("flex items-start gap-2 text-left rounded-md border p-2.5 transition","border-input hover:bg-accent/60 hover:border-violet-400",p&&"opacity-50"),children:(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("div",{className:"text-sm font-medium",children:e.label}),e.description&&(0,r.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5 leading-snug",children:e.description})]})},e.label)})}),s.multiSelect&&f.length>0&&(0,r.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-1",children:[(0,r.jsx)("span",{className:"text-[11px] text-muted-foreground",children:a("questionCard.selected",{count:c.size})}),(0,r.jsxs)(x.$,{type:"button",size:"sm",onClick:()=>{0!==c.size&&v(JSON.stringify([...c]))},disabled:p||0===c.size,children:[p?(0,r.jsx)(d.A,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(z.A,{className:"mr-2 h-3.5 w-3.5"}),a("questionCard.submit")]})]}),(0,r.jsxs)("form",{className:"flex gap-2",onSubmit:e=>{e.preventDefault(),v(o)},children:[(0,r.jsx)(L.p,{value:o,onChange:e=>l(e.target.value),placeholder:a("questionCard.ownAnswerPlaceholder"),disabled:p,className:"h-9 text-sm"}),(0,r.jsxs)(x.$,{type:"submit",size:"sm",disabled:p||!o.trim(),children:[p?(0,r.jsx)(d.A,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(z.A,{className:"mr-2 h-3.5 w-3.5"}),a("questionCard.submit")]})]})]})]})})}function J(e){let{entry:t}=e,s=(0,i.c)("roots"),[a,o]=(0,n.useTransition)(),[l,c]=(0,n.useState)({}),m=t.resolved,p=e=>{if("approve"===e){var r,n;for(let e of null!=(r=t.secrets)?r:[])if(!e.oauth&&e.required&&!(null==(n=l[e.envKey])?void 0:n.trim()))return void u.oR.error(s("mcpAddCard.secretRequired",{label:e.label||e.envKey}))}o(async()=>{let s=await fetch("/api/agents/".concat(t.agentId,"/respond"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:"mcp-add",requestId:t.requestId,decision:e,..."approve"===e?{secretValues:l}:{}})});if(!s.ok){var r;let e=await s.json().catch(()=>({}));u.oR.error(null!=(r=e.error)?r:"HTTP ".concat(s.status))}})};return(0,r.jsx)("div",{className:(0,I.cn)("rounded-lg border-2 my-2 p-4 reflex-gradient",m&&"opacity-60"),children:(0,r.jsxs)("div",{className:"rounded-md bg-background/95 backdrop-blur p-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-2 text-[11px] uppercase tracking-wider text-muted-foreground",children:[(0,r.jsx)(E.A,{className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{children:s("mcpAddCard.title")}),(0,r.jsx)("span",{className:"font-mono normal-case tracking-normal",children:t.server}),(0,r.jsx)("span",{className:"ml-auto font-mono normal-case tracking-normal",children:t.requestId})]}),(0,r.jsx)("div",{className:"text-sm font-medium",children:t.label}),t.description&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:t.description}),(0,r.jsx)("pre",{className:"text-[11px] font-mono bg-muted/40 rounded p-2 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto my-3",children:M(t.config)}),t.secrets&&t.secrets.length>0&&!m&&(0,r.jsxs)("div",{className:"space-y-2 mb-3",children:[(0,r.jsx)("div",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:s("mcpAddCard.fillSecrets")}),t.secrets.map(e=>{var t;return e.oauth?(0,r.jsx)(K,{slot:e},e.envKey):(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsxs)("label",{className:"text-xs flex items-center gap-2",children:[(0,r.jsx)("span",{className:"font-mono",children:e.envKey}),(0,r.jsx)("span",{className:"text-muted-foreground",children:e.label}),e.required&&(0,r.jsx)("span",{className:"text-destructive text-[10px]",children:"*"})]}),e.description&&(0,r.jsx)("p",{className:"text-[11px] text-muted-foreground",children:e.description}),(0,r.jsx)(L.p,{type:"password",value:null!=(t=l[e.envKey])?t:"",onChange:t=>c(s=>({...s,[e.envKey]:t.target.value})),placeholder:e.required?s("mcpAddCard.required"):s("mcpAddCard.optional"),className:"font-mono text-xs h-8"})]},e.envKey)})]}),m?(0,r.jsx)("div",{className:"flex items-center gap-2 text-sm",children:"approve"===m.decision?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(z.A,{className:"h-4 w-4 text-emerald-600"}),(0,r.jsx)("span",{children:s("mcpAddCard.registered")})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(R.A,{className:"h-4 w-4 text-destructive"}),(0,r.jsx)("span",{children:s("mcpAddCard.rejected")})]})}):(0,r.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,r.jsxs)(x.$,{type:"button",variant:"default",size:"sm",onClick:()=>p("approve"),disabled:a,children:[a&&(0,r.jsx)(d.A,{className:"mr-1 h-3.5 w-3.5 animate-spin"}),(0,r.jsx)(z.A,{className:"h-3.5 w-3.5 mr-1"})," ",s("mcpAddCard.register")]}),(0,r.jsxs)(x.$,{type:"button",variant:"outline",size:"sm",onClick:()=>p("reject"),disabled:a,children:[(0,r.jsx)(R.A,{className:"h-3.5 w-3.5 mr-1"})," ",s("mcpAddCard.reject")]})]})]})})}function K(e){var t,a;let{slot:o}=e,l=(0,i.c)("roots"),[c,m]=(0,n.useState)(null),[p,h]=(0,n.useState)(null),[g,f]=(0,n.useState)(""),[v,j]=(0,n.useState)(""),[w,N]=(0,n.useState)(!1),[y,k]=(0,n.useState)(!1),[C,A]=(0,n.useTransition)(),[S,I]=(0,n.useTransition)(),P=async()=>{if(!o.oauth)return;let{listOAuthStatusesAction:e,getOAuthClientAction:t}=await s.e(4108).then(s.bind(s,94108)),[r,n]=await Promise.all([e(),t(o.oauth)]);if(r.ok){let e=r.statuses.find(e=>e.id===o.oauth);e&&m({hasClient:e.hasClient,hasTokens:e.hasTokens})}if(n.ok){var a;h({setupHint:n.setupHint,consoleUrl:n.consoleUrl,needsClientSecret:n.needsClientSecret,setupSteps:null!=(a=n.setupSteps)?a:[]}),n.client?(f(n.client.clientId),N(n.client.hasSecret)):(f(""),N(!1))}};(0,n.useEffect)(()=>{P()},[o.oauth]);let T=!(null==c?void 0:c.hasClient);return(0,r.jsxs)("div",{className:"space-y-2 rounded border border-violet-200 bg-violet-50/30 p-2",children:[(0,r.jsxs)("label",{className:"text-xs flex items-center gap-2",children:[(0,r.jsx)("span",{className:"font-mono",children:o.envKey}),(0,r.jsx)("span",{className:"text-muted-foreground",children:o.label}),(0,r.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-violet-700 ml-auto",children:l("mcpAddCard.oauthLabel",{provider:null!=(t=o.oauth)?t:""})})]}),o.description&&(0,r.jsx)("p",{className:"text-[11px] text-muted-foreground",children:o.description}),(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(null==c?void 0:c.hasTokens)?(0,r.jsxs)("span",{className:"text-xs text-emerald-700 flex items-center gap-1",children:[(0,r.jsx)(z.A,{className:"h-3 w-3"})," ",l("mcpAddCard.authorized")]}):(null==c?void 0:c.hasClient)?(0,r.jsxs)(x.$,{type:"button",size:"sm",variant:"outline",onClick:()=>{o.oauth&&A(async()=>{let{beginOAuthAction:e,listOAuthStatusesAction:t}=await s.e(4108).then(s.bind(s,94108)),r=await e(o.oauth);if(!r.ok)return void u.oR.error(r.error);window.open(r.authorizeUrl,"reflex-oauth","width=600,height=720,noopener=no");let n=Date.now(),a=async()=>{if(Date.now()-n>3e5)return void u.oR.error(l("mcpAddCard.authorizationTimedOut"));let e=await t();if(e.ok){let t=e.statuses.find(e=>e.id===o.oauth);if(null==t?void 0:t.hasTokens){u.oR.success(l("mcpAddCard.providerAuthorized",{provider:o.oauth})),m({hasClient:t.hasClient,hasTokens:t.hasTokens});return}}setTimeout(()=>void a(),1500)};a()})},disabled:C,className:"h-7 text-xs",children:[C&&(0,r.jsx)(d.A,{className:"mr-1 h-3 w-3 animate-spin"}),l("mcpAddCard.authorizeVia",{provider:null!=(a=o.oauth)?a:""})]}):(0,r.jsx)("span",{className:"text-xs text-amber-700",children:l("mcpAddCard.clientIdNotConfigured")}),!T&&(0,r.jsxs)(x.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>k(e=>!e),className:"h-7 text-xs text-muted-foreground gap-1",children:[(0,r.jsx)(b.A,{className:"h-3 w-3 transition-transform ".concat(y?"rotate-180":"")}),y?l("mcpAddCard.hideClient"):l("mcpAddCard.editClient")]}),(0,r.jsx)(x.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>void P(),className:"h-7 text-xs text-muted-foreground ml-auto",children:l("mcpAddCard.refresh")})]}),(y||T)&&p&&(0,r.jsxs)("div",{className:"space-y-2 border-t border-violet-200 pt-2 mt-2",children:[p.setupHint&&(0,r.jsx)("div",{className:"rounded border border-amber-200 bg-amber-50 px-2 py-1.5 text-[10px] text-amber-900 leading-snug",children:p.setupHint}),(0,r.jsxs)("a",{href:p.consoleUrl,target:"_blank",rel:"noopener noreferrer",className:"text-[11px] text-violet-700 hover:underline inline-flex items-center gap-1",children:[(0,r.jsx)(O.A,{className:"h-3 w-3"}),l("mcpAddCard.openProviderConsole")]}),p.setupSteps.length>0&&(0,r.jsxs)("div",{className:"rounded border border-violet-200 bg-white/60 p-2",children:[(0,r.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1.5",children:l("mcpAddCard.stepByStep")}),(0,r.jsx)(U.O,{steps:p.setupSteps})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(D.J,{className:"text-[10px]",children:l("mcpAddCard.clientIdLabel")}),(0,r.jsx)(L.p,{value:g,onChange:e=>f(e.target.value),placeholder:"123…apps.googleusercontent.com",className:"font-mono text-xs h-7"})]}),p.needsClientSecret&&(0,r.jsxs)("div",{children:[(0,r.jsxs)(D.J,{className:"text-[10px]",children:[l("mcpAddCard.clientSecretLabel")," ",w&&(0,r.jsx)("span",{className:"text-muted-foreground",children:l("mcpAddCard.clientSecretSavedHint")})]}),(0,r.jsx)(L.p,{type:"password",value:v,onChange:e=>j(e.target.value),placeholder:w?"••••":"GOCSPX-…",className:"font-mono text-xs h-7"})]}),(0,r.jsx)("div",{className:"flex justify-end",children:(0,r.jsxs)(x.$,{type:"button",size:"sm",onClick:()=>{if(o.oauth){if(!g.trim())return void u.oR.error(l("mcpAddCard.clientIdRequired"));I(async()=>{let{saveOAuthClientAction:e}=await s.e(4108).then(s.bind(s,94108)),t=await e({provider:o.oauth,clientId:g.trim(),...v?{clientSecret:v}:{}});if(!t.ok)return void u.oR.error(t.error);u.oR.success(l("mcpAddCard.clientSaved")),j(""),await P()})}},disabled:S||!g.trim(),className:"h-7 text-xs",children:[S?(0,r.jsx)(d.A,{className:"mr-1 h-3 w-3 animate-spin"}):(0,r.jsx)($.A,{className:"mr-1 h-3 w-3"}),l("mcpAddCard.saveClient")]})})]})]})}function M(e){try{return JSON.stringify(e,null,2)}catch(t){return String(e)}}var _=s(54400),W=s.n(_),V=s(7293),G=s(86515),Z=s(16329),X=s(40805),Q=s(8583),Y=s(35994);function ee(e){let{rootId:t,entry:s}=e,n=(0,i.c)("roots"),a=function(e){let t=e.toLowerCase();return"task"===t||"tasks"===t?G.A:"meeting"===t||"meetings"===t?Z.A:"product"===t||"products"===t?X.A:"fact"===t||"facts"===t?Q.A:Y.A}(s.kind),o="/roots/".concat(t,"?file=").concat(encodeURIComponent(s.relPath));return(0,r.jsx)(W(),{href:o,className:"my-2 block rounded-lg border-2 p-[2px] reflex-gradient hover:shadow-md transition-shadow",children:(0,r.jsxs)("div",{className:"rounded-md bg-background/95 backdrop-blur p-3 flex items-center gap-3",children:[(0,r.jsx)("div",{className:"reflex-gradient h-9 w-9 rounded-md flex items-center justify-center text-white shrink-0",children:(0,r.jsx)(a,{className:"h-4 w-4"})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground flex items-center gap-1",children:[(0,r.jsx)(m.A,{className:"h-3 w-3"}),(0,r.jsx)("span",{children:n("kbWriteCard.writtenToKb")}),(0,r.jsx)("span",{className:"font-mono normal-case tracking-normal",children:s.kind})]}),(0,r.jsx)("div",{className:"text-sm font-medium truncate",children:s.title}),(0,r.jsx)("div",{className:"text-[11px] font-mono text-muted-foreground truncate",children:s.relPath})]}),(0,r.jsx)(V.A,{className:"h-4 w-4 text-muted-foreground shrink-0"})]})})}var et=s(39624);function es(e){let{utility:t,rootId:s}=e,n=(0,i.c)("roots"),a="project"===t.scope&&s?"?rootId=".concat(encodeURIComponent(s)):"",o="/utilities/".concat(t.scope,"/").concat(t.id).concat(a);return(0,r.jsx)(W(),{href:o,className:"my-2 block rounded-lg border-2 p-[2px] reflex-gradient hover:shadow-md transition-shadow",children:(0,r.jsxs)("div",{className:"rounded-md bg-background/95 backdrop-blur p-3 flex items-center gap-3",children:[(0,r.jsx)("div",{className:"reflex-gradient h-9 w-9 rounded-md flex items-center justify-center text-white shrink-0",children:(0,r.jsx)(et.A,{className:"h-4 w-4"})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground flex items-center gap-1",children:[(0,r.jsx)(m.A,{className:"h-3 w-3"}),(0,r.jsx)("span",{children:n("utilityCard.installed")}),(0,r.jsx)("span",{className:"font-mono normal-case tracking-normal",children:t.scope})]}),(0,r.jsx)("div",{className:"text-sm font-medium truncate",children:t.name}),(0,r.jsxs)("div",{className:"text-[11px] font-mono text-muted-foreground truncate",children:[t.id," \xb7 v",t.version]})]})]})})}var er=s(94870),en=s(56380),ea=s(76974),ei=s(97997),eo=s(62350);function el(e){let{rootId:t,widget:s}=e,a=(0,i.c)("roots"),[o,l]=(0,n.useState)(!1),[d,c]=(0,n.useTransition)();return(0,r.jsxs)("div",{className:"my-3 rounded-lg border border-violet-200 bg-violet-50/40 dark:border-violet-900/40 dark:bg-violet-950/20 overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-violet-200 dark:border-violet-900/40 bg-violet-100/40 dark:bg-violet-900/20 text-xs",children:[(0,r.jsx)(m.A,{className:"h-3 w-3 text-violet-600"}),(0,r.jsx)("span",{className:"font-medium text-violet-900 dark:text-violet-200",children:"create"===s.op?a("widgetPreview.created"):a("widgetPreview.updated")}),(0,r.jsx)(p.E,{variant:"outline",className:"text-[10px] font-mono",children:s.widgetKind}),(0,r.jsx)("span",{className:"text-[10px] text-muted-foreground font-mono ml-1",children:s.widgetId}),o?(0,r.jsxs)("span",{className:"ml-auto inline-flex items-center gap-1 text-[10px] text-emerald-700",children:[(0,r.jsx)(z.A,{className:"h-3 w-3"}),a("widgetPreview.onDashboard")]}):(0,r.jsxs)("button",{type:"button",onClick:()=>{c(async()=>{let e=await (0,eo.t)(t,s.widgetId);e.ok?(l(!0),u.oR.success(a("widgetPreview.pinned"))):u.oR.error(e.error)})},disabled:d,className:"ml-auto inline-flex items-center gap-1 text-[10px] text-violet-700 hover:underline disabled:opacity-50",title:a("widgetPreview.pinToDashboardTitle"),children:[(0,r.jsx)(er.A,{className:"h-3 w-3"}),d?a("widgetPreview.pinning"):a("widgetPreview.pinToDashboard")]}),(0,r.jsx)(W(),{href:"/roots/".concat(t),className:"inline-flex items-center gap-1 text-[10px] text-muted-foreground hover:text-violet-700",title:a("widgetPreview.openDashboard"),children:(0,r.jsx)(en.A,{className:"h-3 w-3"})})]}),(0,r.jsxs)("div",{className:"p-3 space-y-2 bg-card",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("h4",{className:"text-sm font-medium",children:s.title}),s.description&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:s.description})]}),(0,r.jsxs)("span",{className:"text-[10px] text-muted-foreground inline-flex items-center gap-0.5",title:a("widgetPreview.editViaChatTitle"),children:[(0,r.jsx)(ea.A,{className:"h-2.5 w-2.5"}),a("widgetPreview.editViaChat")]})]}),(0,r.jsx)("div",{className:"pt-1",children:(0,ei.v)(t,s.widgetKind,s.data,{readonly:!0})})]})]})}var ed=s(27474),ec=s(54207);function em(e){let{rootId:t,workflow:s}=e,n=(0,i.c)("roots");return(0,r.jsxs)("div",{className:"my-3 rounded-lg border border-violet-200 bg-violet-50/40 dark:border-violet-900/40 dark:bg-violet-950/20 overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-violet-200 dark:border-violet-900/40 bg-violet-100/40 dark:bg-violet-900/20 text-xs",children:[(0,r.jsx)(m.A,{className:"h-3 w-3 text-violet-600"}),(0,r.jsx)("span",{className:"font-medium text-violet-900 dark:text-violet-200",children:n("workflowPreview.created")}),(0,r.jsx)(p.E,{variant:"outline",className:"text-[10px] font-mono",children:s.trigger}),(0,r.jsx)("span",{className:"text-[10px] text-muted-foreground font-mono ml-1",children:s.workflowId})]}),(0,r.jsxs)("div",{className:"p-3 space-y-2 bg-card",children:[(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[(0,r.jsx)(ed.A,{className:"h-4 w-4 text-violet-600 mt-0.5 shrink-0"}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("h4",{className:"text-sm font-medium",children:s.label}),s.description&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:s.description}),(0,r.jsx)("p",{className:"text-[10px] text-muted-foreground mt-1",children:n.rich("workflowPreview.stepsCount",{count:s.stepCount,trigger:s.trigger,code:e=>(0,r.jsx)("code",{className:"font-mono",children:e})})})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 pt-1 text-xs",children:[(0,r.jsxs)(W(),{href:"/roots/".concat(t,"/workflows/").concat(s.workflowId),className:"inline-flex items-center gap-1 rounded px-2 py-1 bg-violet-600 text-white hover:bg-violet-700",children:[(0,r.jsx)(ec.A,{className:"h-3 w-3"}),n("workflowPreview.openInEditor")]}),(0,r.jsxs)("span",{className:"text-[10px] text-muted-foreground inline-flex items-center gap-1",children:[(0,r.jsx)(ea.A,{className:"h-2.5 w-2.5"}),n("workflowPreview.editHereViaChat")]})]})]})]})}function eu(e){let{rootId:t,topicId:s,initialEvents:a,initialActive:m}=e,x=(0,i.c)("roots"),[h,b]=(0,n.useState)(a),[j,w]=(0,n.useState)(m),[N,y]=(0,n.useState)(!1),k=(0,n.useRef)(a.length>0?a[a.length-1].seq:-1),C=(0,n.useRef)(null),A=(0,n.useMemo)(()=>(function(e){let t=[],s=new Map,r=null,n=null,a=e=>{var a;let i=s.get(e),o={kind:"assistant",agentId:e,agentLabel:null!=(a=null==i?void 0:i.label)?a:"assistant",...(null==i?void 0:i.model)?{agentModel:i.model}:{},...(null==i?void 0:i.role)?{agentRole:i.role}:{},segments:[],pending:!0};return t.push(o),r=o,n=null,o},i=(e,t)=>{let s=r;s&&(s.pending=!1,"failed"===e&&t&&(s.error=t),r=null,n=null)};for(let l of e){if("agent-start"===l.type){s.set(l.agentId,l.meta);continue}if("turn-start"===l.type){a(l.agentId);continue}if("turn-end"===l.type||"agent-end"===l.type){i(l.status,l.error);continue}if("user-message"===l.type){let e=s.get(l.agentId),r=null==e?void 0:e.role;t.push({kind:"user",body:l.text,agentId:l.agentId,...r?{agentRole:r}:{},...(null==e?void 0:e.label)?{agentLabel:e.label}:{}});continue}if("system"===l.type){l.subtype&&l.subtype.startsWith("reflex.")&&t.push({kind:"system",body:l.text,systemSubtype:l.subtype});continue}if("assistant-delta"===l.type){let e=r;if(e||(e=a(l.agentId)),!e)continue;let t=e.segments;if(n&&"text"===n.kind)n.text+=l.text;else{let e={kind:"text",text:l.text};t.push(e),n=e}continue}if("tool-use"===l.type){let e=r;if(e||(e=a(l.agentId)),!e)continue;let t=e.segments,s={kind:"tool",tool:{toolUseId:l.toolUseId,name:l.name,input:l.input}};t.push(s),n=s;continue}if("tool-result"===l.type){var o;let e=r;if(!e)continue;let t=null!=(o=e.segments)?o:[];for(let e=t.length-1;e>=0;e--){let s=t[e];if("tool"===s.kind&&s.tool.toolUseId===l.toolUseId){s.tool.result={content:l.content,...l.isError?{isError:!0}:{}};break}}continue}if("error"===l.type){let e=r;e&&(e.error=l.message);continue}if("permission-request"===l.type){let e=null!=r?r:a(l.agentId);if(!e)continue;e.segments.push({kind:"permission",perm:{requestId:l.requestId,agentId:l.agentId,...l.tool?{tool:l.tool}:{},...l.action?{action:l.action}:{},...void 0!==l.input?{input:l.input}:{},...l.description?{description:l.description}:{}}}),n=e.segments[e.segments.length-1];continue}if("permission-response"===l.type){for(let e of t)if("assistant"===e.kind&&e.segments)for(let t of e.segments)"permission"===t.kind&&t.perm.requestId===l.requestId&&(t.perm.resolved={decision:l.decision,...l.scope?{scope:l.scope}:{}});continue}if("question"===l.type){let e=null!=r?r:a(l.agentId);if(!e)continue;e.segments.push({kind:"question",question:{questionId:l.questionId,agentId:l.agentId,prompt:l.prompt,...l.header?{header:l.header}:{},...l.multiSelect?{multiSelect:!0}:{},...l.choices?{choices:l.choices}:{},...l.options?{options:l.options}:{}}}),n=e.segments[e.segments.length-1];continue}if("answer"===l.type){for(let e of t)if("assistant"===e.kind&&e.segments)for(let t of e.segments)"question"===t.kind&&t.question.questionId===l.questionId&&(t.question.resolved={answer:l.answer});continue}if("mcp-add-request"===l.type){let e=null!=r?r:a(l.agentId);if(!e)continue;e.segments.push({kind:"mcp-add",entry:{requestId:l.requestId,agentId:l.agentId,server:l.server,label:l.label,...l.description?{description:l.description}:{},config:l.config,...l.secrets?{secrets:l.secrets}:{}}}),n=e.segments[e.segments.length-1];continue}if("mcp-add-response"===l.type){for(let e of t)if("assistant"===e.kind&&e.segments)for(let t of e.segments)"mcp-add"===t.kind&&t.entry.requestId===l.requestId&&(t.entry.resolved={decision:l.decision});continue}if("onboarding-done"===l.type){t.push({kind:"onboarding-done"});continue}if("kb-write"===l.type){let e=null!=r?r:a(l.agentId);if(!e)continue;e.segments.push({kind:"kb",kb:{kind:l.kind,title:l.title,relPath:l.relPath}}),n=e.segments[e.segments.length-1];continue}if("utility-installed"===l.type){let e=null!=r?r:a(l.agentId);if(!e)continue;e.segments.push({kind:"utility",utility:{id:l.utilityId,name:l.name,scope:l.scope,version:l.version}}),n=e.segments[e.segments.length-1];continue}if("utility-error"===l.type){let e=null!=r?r:a(l.agentId);e&&(e.error=l.message);continue}if("widget-event"===l.type){let e=null!=r?r:a(l.agentId);if(!e)continue;e.segments.push({kind:"widget",widget:{op:l.op,widgetId:l.widgetId,title:l.title,...l.description?{description:l.description}:{},widgetKind:l.kind,data:l.data,...l.sourceTopicId?{sourceTopicId:l.sourceTopicId}:{}}}),n=e.segments[e.segments.length-1];continue}if("widget-error"===l.type){let e=null!=r?r:a(l.agentId);e&&(e.error=l.message);continue}if("workflow-event"===l.type){let e=null!=r?r:a(l.agentId);if(!e)continue;e.segments.push({kind:"workflow",workflow:{workflowId:l.workflowId,label:l.label,...l.description?{description:l.description}:{},trigger:l.trigger,stepCount:l.stepCount}}),n=e.segments[e.segments.length-1];continue}if("workflow-error"===l.type){let e=null!=r?r:a(l.agentId);e&&(e.error=l.message);continue}}return t})(h),[h]),S=(0,n.useCallback)(()=>{let e=C.current;e&&(e.scrollTop=e.scrollHeight)},[]);(0,n.useEffect)(()=>{S()},[A,S]),(0,n.useEffect)(()=>{let e=new AbortController,r="/api/roots/".concat(t,"/chat/").concat(s,"/stream?since=").concat(k.current),n=!1;return(async()=>{try{let a=await fetch(r,{signal:e.signal});if(!a.ok||!a.body)return void y(!1);y(!0);let i=a.body.getReader(),o=new TextDecoder,l="";for(;!n;){let{done:e,value:r}=await i.read();if(e)break;for(let e of(l+=o.decode(r,{stream:!0}),function(e){let t=[];for(;;){let s=e.indexOf("\n\n");if(s<0)break;let r=e.slice(0,s);e=e.slice(s+2);let n="message",a="";for(let e of r.split(/\r?\n/))!e.startsWith(":")&&(e.startsWith("event:")?n=e.slice(6).trim():e.startsWith("data:")&&(a+=e.slice(5).trimStart()));let i=null;try{i=a?JSON.parse(a):null}catch(e){i=null}t.push({event:n,data:i,rest:e})}return t}(l)))if(l=e.rest,"event"===e.event&&e.data){let t=e.data;I(t)}else if("error"===e.event){var t,s;u.oR.error(String(null!=(s=null==(t=e.data)?void 0:t.message)?s:"stream"))}}}catch(e){n||y(!1)}finally{y(!1)}})(),()=>{n=!0,e.abort()}},[s,t]);let I=(0,n.useCallback)(e=>{e.seq<=k.current||(k.current=e.seq,b(t=>[...t,e]),"turn-start"===e.type?w(!0):"agent-start"===e.type&&"orchestrator"===e.meta.role&&w(!0),("turn-end"===e.type||"agent-end"===e.type)&&(w(!1),(0,v.$d)(v.Zi.topicsChanged(t))),"kb-write"===e.type&&(0,v.$d)(v.Zi.kbChanged(t)))},[t]),P=(0,n.useCallback)(async()=>{try{let r=await fetch("/api/roots/".concat(t,"/chat/").concat(s,"/stop"),{method:"POST"});if(!r.ok){var e;let t=await r.json().catch(()=>({}));u.oR.error(null!=(e=t.error)?e:"HTTP ".concat(r.status));return}w(!1)}catch(e){u.oR.error(e instanceof Error?e.message:String(e))}},[t,s]),T=(0,n.useCallback)(async(e,r)=>{let n=e.trim();if(!n&&0===r.length)return!1;try{let e=await fetch("/api/roots/".concat(t,"/chat/").concat(s,"/send"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:n,attachments:r})});if(409===e.status)return u.oR.error(x("chat.waitForCurrentAnswer")),!1;if(!e.ok){var a;let t=await e.json().catch(()=>({}));return u.oR.error(null!=(a=t.error)?a:"HTTP ".concat(e.status)),!1}return!0}catch(e){return u.oR.error(e instanceof Error?e.message:String(e)),!1}},[t,s]);return(0,r.jsxs)("div",{className:"flex-1 flex flex-col min-h-0",children:[(0,r.jsxs)("div",{className:"border-b px-6 py-2 flex items-center gap-3 text-xs",children:[(0,r.jsx)("span",{className:"text-muted-foreground inline-flex items-center gap-1",children:N?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.A,{className:"h-3 w-3 text-emerald-600"})," ",x("chat.connectedToStream")]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.A,{className:"h-3 w-3 text-muted-foreground"})," ",x("chat.offline")]})}),j&&(0,r.jsxs)(p.E,{variant:"default",className:"gap-1 bg-emerald-600",children:[(0,r.jsx)(d.A,{className:"h-3 w-3 animate-spin"})," ",x("chat.agentWorking")]}),(0,r.jsxs)("span",{className:"ml-auto text-[10px] text-muted-foreground font-mono",children:["seq: ",k.current]})]}),(0,r.jsx)("div",{ref:C,className:"flex-1 overflow-y-auto",children:(0,r.jsx)("div",{className:"mx-auto max-w-3xl px-6 py-6 space-y-4",children:0===A.length?(0,r.jsx)("p",{className:"text-sm text-muted-foreground italic",children:x("chat.topicEmpty")}):A.map((e,n)=>(0,r.jsx)(ep,{turn:e,rootId:t,topicId:s},n))})}),(0,r.jsx)(g.E,{label:x("chat.replyInTopicLabel"),children:(0,r.jsx)(f.L,{rootId:t,topicId:s,placeholder:x("chat.topicPlaceholder"),submitLabel:x("chat.send"),pendingLabel:x("chat.sendPending"),SubmitIcon:c.A,active:j,onStop:P,onSubmit:e=>{let{message:t,attachments:s}=e;return T(t,s)}})})]})}function ep(e){var t,s,n,a;let{turn:o,rootId:l,topicId:c}=e,p=(0,i.c)("roots"),x=(e,t)=>{let s=p("kb.summaryContextChat",{url:t,text:e});fetch("/api/roots/".concat(l,"/chat/").concat(c,"/send"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:s,attachments:[]})}).then(async e=>{if(!e.ok){var t;let s=await e.json().catch(()=>({}));u.oR.error(null!=(t=s.error)?t:"HTTP ".concat(e.status));return}u.oR.success(p("kb.summarySentToChat"))}).catch(e=>{u.oR.error(e instanceof Error?e.message:String(e))})};if("system"===o.kind)return(0,r.jsx)(eg,{body:null!=(s=o.body)?s:"",subtype:o.systemSubtype});if("onboarding-done"===o.kind)return(0,r.jsx)(eh,{rootId:l});if("user"===o.kind){if("subagent"===o.agentRole)return null;let e=null!=(n=o.body)?n:"";if(/^\/skill\s+space-onboarding\s*$/.test(e.trim()))return null;let t=function(e,t){let s=e.trimStart(),r=/^\[MCP setup wizard\]\s*([^\n]*)/.exec(s);if(r)return{badge:t.mcpSetupBadge,summary:r[1].trim()||t.mcpSetupDefault,details:e};let n=/^\[Reflex\]\s+Answer for question\s+\S+:\s+([\s\S]*?)(?:\s*\.?\s*Continue\.\s*)?$/.exec(s);if(n)return{badge:t.answerBadge,summary:n[1].trim(),details:e};let a=/^\[Reflex\]\s+(Allowed|Denied|User (allowed|denied))[\s\S]*?:\s*([\s\S]*?)(?:\s*\.?\s*Continue\.\s*)?$/.exec(s);if(a){var i,o;return{badge:t.permissionBadge,summary:(null!=(o=null!=(i=a[3])?i:a[1])?o:"").trim()||t.permissionUserDecision,details:e}}if(/^\[Reflex\]\s+(MCP server|User rejected|Failed to register)[\s\S]*?$/.exec(s)){let r=s.split("\n",1)[0];return{badge:t.mcpBadge,summary:r.replace(/^\[Reflex\]\s+/,"").slice(0,200),details:e}}if(/^\[Reflex \/goal\]\s+([\s\S]*)/.exec(s))return{badge:t.goalBadge,summary:t.goalAutoContinue,details:e};let l=/^\[Reflex[^\]]*\]\s*([\s\S]*)/.exec(s);if(l){let s=l[1].split("\n",1)[0].trim();return{badge:t.systemBadge,summary:s.slice(0,200)||t.systemMessage,details:e}}return null}(e,{mcpSetupDefault:p("chat.mcpSetupDefault"),mcpSetupBadge:p("chat.mcpSetupBadge"),answerBadge:p("chat.answerBadge"),permissionBadge:p("chat.permissionBadge"),permissionUserDecision:p("chat.permissionUserDecision"),mcpBadge:p("chat.mcpBadge"),goalBadge:p("chat.goalBadge"),goalAutoContinue:p("chat.goalAutoContinue"),systemBadge:p("chat.systemBadge"),systemMessage:p("chat.systemMessage")});return t?(0,r.jsx)(ef,{system:t}):(0,r.jsxs)("div",{className:"rounded-lg border bg-muted/40 p-4",children:[(0,r.jsx)("div",{className:"text-[11px] uppercase tracking-wide text-muted-foreground mb-2",children:"user"}),(0,r.jsx)(h.p,{source:e,onSendToChat:x})]})}let g="subagent"===o.agentRole;return(0,r.jsx)(ex,{isSubAgent:g,turn:o,children:(0,r.jsxs)("div",{className:g?"rounded-md border border-dashed bg-muted/30 px-3 py-2":"rounded-lg border bg-background p-4",children:[(0,r.jsxs)("div",{className:"text-[11px] uppercase tracking-wide text-muted-foreground mb-2 flex items-center gap-2",children:[(0,r.jsx)(m.A,{className:"h-3 w-3"}),(0,r.jsx)("span",{children:null!=(a=o.agentLabel)?a:"assistant"}),g&&(0,r.jsx)("span",{className:"text-[10px] normal-case px-1.5 py-0.5 rounded bg-violet-100 text-violet-800 tracking-normal",children:"sub-agent"}),o.agentModel&&(0,r.jsx)("span",{className:"font-mono text-[10px] normal-case tracking-normal",children:o.agentModel}),o.pending&&(0,r.jsx)(d.A,{className:"h-3 w-3 animate-spin"}),o.error&&(0,r.jsx)("span",{className:"text-destructive text-xs normal-case",children:p("chat.errorPrefix",{message:o.error})})]}),null==(t=o.segments)?void 0:t.map((e,t)=>{if("text"===e.kind){let s=function(e){let t=e;for(let e of["permission","question","kb","utility","dispatch","mcp-add","youtube-summary","widget-create","widget-update","workflow-create","image-gen","memory","suggestion","onboarding-done","skill-create","task-create","task-update"]){let s=RegExp("<{1,2}reflex:".concat(e,">{1,2}[\\s\\S]*?<{1,2}\\/reflex:").concat(e,">{1,2}"),"g");t=t.replace(s,"")}return t}(e.text);return s.trim()?(0,r.jsx)(h.p,{source:s,onSendToChat:x},t):null}return"tool"===e.kind?(0,r.jsx)(P,{name:e.tool.name,input:e.tool.input,...e.tool.result?{result:e.tool.result}:{},pending:!e.tool.result},t):"permission"===e.kind?(0,r.jsx)(H,{perm:e.perm},t):"question"===e.kind?(0,r.jsx)(F,{question:e.question},t):"kb"===e.kind?(0,r.jsx)(ee,{rootId:l,entry:e.kb},t):"mcp-add"===e.kind?(0,r.jsx)(J,{entry:e.entry},t):"utility"===e.kind?(0,r.jsx)(es,{utility:e.utility,rootId:l},t):"widget"===e.kind?(0,r.jsx)(el,{rootId:l,widget:e.widget},t):"workflow"===e.kind?(0,r.jsx)(em,{rootId:l,workflow:e.workflow},t):null}),o.pending&&(!o.segments||0===o.segments.length)&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:p("chat.thinking")})]})})}function ex(e){var t;let{isSubAgent:s,turn:n,children:a}=e,o=(0,i.c)("roots");if(!s)return(0,r.jsx)(r.Fragment,{children:a});let l=[null!=(t=n.agentLabel)?t:"sub-agent",o(n.pending?"chat.subAgentWorking":n.error?"chat.subAgentError":"chat.subAgentDone")].join(" \xb7 ");return(0,r.jsxs)("details",{className:"group",open:n.pending,children:[(0,r.jsxs)("summary",{className:"cursor-pointer list-none flex items-center gap-2 text-xs text-muted-foreground border-l-2 border-violet-300 pl-2 py-1 hover:text-foreground select-none",children:[(0,r.jsx)("span",{className:"inline-block h-3 w-3 text-center transition-transform group-open:rotate-90",children:"▸"}),(0,r.jsx)(m.A,{className:"h-3 w-3 text-violet-500"}),(0,r.jsx)("span",{children:l}),n.pending&&(0,r.jsx)(d.A,{className:"h-3 w-3 animate-spin"})]}),(0,r.jsx)("div",{className:"mt-1 pl-4",children:a})]})}function eh(e){let{rootId:t}=e,s=(0,a.useRouter)();return(0,r.jsx)("div",{className:"rounded-lg border border-emerald-300 bg-emerald-50/70 dark:bg-emerald-950/30 p-4",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("div",{className:"rounded-full bg-emerald-500/10 p-2 mt-0.5",children:(0,r.jsx)(m.A,{className:"h-4 w-4 text-emerald-600"})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("div",{className:"font-medium text-sm",children:"Dashboard is ready"}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Suggestions are waiting on the dashboard. Approve the ones that feel right; dismiss the rest. Come back here anytime to add context."})]}),(0,r.jsx)(x.$,{type:"button",size:"sm",onClick:()=>s.push("/roots/".concat(t)),children:"Go to dashboard"})]})})}function eg(e){let{body:t,subtype:s}=e;return(0,r.jsxs)("div",{className:["rounded-md border px-3 py-2 text-xs flex items-start gap-2","reflex.preflight"===s?"border-violet-200 bg-violet-50/60 text-violet-900":"border-dashed bg-muted/30 text-muted-foreground"].join(" "),children:[(0,r.jsx)(m.A,{className:"h-3.5 w-3.5 mt-0.5 shrink-0 text-violet-600"}),(0,r.jsx)("div",{className:"whitespace-pre-wrap leading-relaxed flex-1 min-w-0",children:t})]})}function ef(e){let{system:t}=e;return(0,r.jsxs)("details",{className:"group rounded-md border border-dashed bg-muted/20 px-3 py-1.5 text-xs",children:[(0,r.jsxs)("summary",{className:"cursor-pointer list-none flex items-center gap-2 select-none",children:[(0,r.jsx)("span",{className:"inline-block h-3 w-3 text-center text-muted-foreground transition-transform group-open:rotate-90",children:"▸"}),(0,r.jsx)("span",{className:"rounded bg-muted-foreground/10 text-[10px] uppercase tracking-wider text-muted-foreground px-1.5 py-0.5 font-mono",children:t.badge}),(0,r.jsx)("span",{className:"truncate text-foreground/80",children:t.summary})]}),(0,r.jsx)("pre",{className:"mt-2 pl-5 text-[11px] whitespace-pre-wrap font-mono text-muted-foreground/90",children:t.details})]})}},4390:(e,t,s)=>{"use strict";s.d(t,{GoalBadge:()=>g});var r=s(4624),n=s(99356),a=s(49411),i=s(13561),o=s(58726),l=s(5270),d=s(41234),c=s(56221),m=s(85253),u=s(28310),p=s(13506),x=s(7911);let h=(0,x.createServerReference)("60fecb3b35cfccc39f4a7fc774f2e9dacb58ff6e92",x.callServer,void 0,x.findSourceMapURL,"clearTopicGoalAction");function g(e){var t;let{rootId:s,topicId:x,goal:g,status:f,iterations:v}=e,b=(0,a.c)("roots"),[j,w]=(0,n.useTransition)(),N="completed"===(t=f)?o.A:"abandoned"===t?l.A:d.A;return(0,r.jsxs)("div",{className:(0,p.cn)("flex items-center gap-2 rounded-md border px-3 py-1.5 text-xs","active"===f&&"reflex-gradient text-foreground border-transparent","completed"===f&&"border-emerald-500/40 bg-emerald-50","abandoned"===f&&"border-destructive/40 bg-destructive/5"),children:[(0,r.jsx)(N,{className:"h-3.5 w-3.5 shrink-0"}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("div",{className:"text-[10px] uppercase tracking-wider opacity-80",children:["/goal \xb7 ",f," ","active"===f&&v>0&&(0,r.jsxs)("span",{className:"font-mono",children:["(",v,")"]})]}),(0,r.jsx)("div",{className:"truncate font-medium",title:g,children:g})]}),"active"===f&&(0,r.jsxs)(m.$,{type:"button",size:"sm",variant:"ghost",className:"h-7 shrink-0",disabled:j,onClick:()=>{confirm(b("goalBadge.stopConfirm"))&&w(async()=>{var e;let t=await h(s,x);t.ok?c.oR.success(b("goalBadge.stopSuccess")):c.oR.error(null!=(e=t.error)?e:b("goalBadge.stopFailed"))})},children:[(0,r.jsx)(i.A,{className:"mr-1 h-3 w-3"})," ",b("goalBadge.stop")]}),("completed"===f||"abandoned"===f)&&(0,r.jsx)(u.E,{variant:"outline",className:"shrink-0 capitalize",children:f})]})}},16225:(e,t,s)=>{"use strict";s.d(t,{DeleteTopicButton:()=>p});var r=s(4624),n=s(99356),a=s(69285),i=s(49411),o=s(3239),l=s(46972),d=s(56221),c=s(85253),m=s(37829),u=s(63514);function p(e){let{rootId:t,topicId:s,topicTitle:p}=e,x=(0,i.c)("roots"),[h,g]=(0,n.useTransition)(),f=(0,a.useRouter)();return(0,r.jsxs)(c.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>{confirm(x("deleteTopic.confirm",{title:p}))&&g(async()=>{let e=await (0,m.L)(t,s);if(!e.ok){var r;d.oR.error(null!=(r=e.error)?r:x("deleteTopic.deleteFailed"));return}d.oR.success(x("deleteTopic.deleted")),(0,u.$d)(u.Zi.topicsChanged(t)),f.push("/roots/".concat(t))})},disabled:h,className:"gap-1 h-8 text-muted-foreground hover:text-destructive",title:x("deleteTopic.title"),children:[h?(0,r.jsx)(o.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(l.A,{className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{className:"text-xs",children:x("deleteTopic.label")})]})}},25342:(e,t,s)=>{Promise.resolve().then(s.bind(s,3989)),Promise.resolve().then(s.bind(s,16225)),Promise.resolve().then(s.bind(s,4390)),Promise.resolve().then(s.bind(s,91074)),Promise.resolve().then(s.bind(s,96253)),Promise.resolve().then(s.bind(s,28050)),Promise.resolve().then(s.bind(s,94904)),Promise.resolve().then(s.bind(s,13270)),Promise.resolve().then(s.bind(s,99730)),Promise.resolve().then(s.bind(s,89146)),Promise.resolve().then(s.bind(s,19078)),Promise.resolve().then(s.bind(s,67854)),Promise.resolve().then(s.bind(s,69050)),Promise.resolve().then(s.bind(s,63739)),Promise.resolve().then(s.bind(s,33976)),Promise.resolve().then(s.bind(s,12537)),Promise.resolve().then(s.bind(s,97485)),Promise.resolve().then(s.bind(s,41923)),Promise.resolve().then(s.bind(s,73868)),Promise.resolve().then(s.bind(s,53511)),Promise.resolve().then(s.bind(s,2018)),Promise.resolve().then(s.bind(s,18487)),Promise.resolve().then(s.bind(s,98346)),Promise.resolve().then(s.bind(s,14884)),Promise.resolve().then(s.bind(s,85314)),Promise.resolve().then(s.bind(s,17280)),Promise.resolve().then(s.bind(s,8855)),Promise.resolve().then(s.bind(s,86631)),Promise.resolve().then(s.bind(s,2604)),Promise.resolve().then(s.bind(s,27237)),Promise.resolve().then(s.bind(s,49455)),Promise.resolve().then(s.bind(s,39211)),Promise.resolve().then(s.bind(s,56360)),Promise.resolve().then(s.t.bind(s,54400,23))},37829:(e,t,s)=>{"use strict";s.d(t,{L:()=>n});var r=s(7911);let n=(0,r.createServerReference)("60aca7b73665ef85604f648bbe1616034cd83463a3",r.callServer,void 0,r.findSourceMapURL,"deleteTopicAction")},66459:(e,t,s)=>{"use strict";s.d(t,{O:()=>c});var r=s(4624),n=s(99356),a=s(43153),i=s(9598),o=s(56221),l=s(49411),d=s(85253);function c(e){let{steps:t}=e,s=(0,l.c)("app");return t&&0!==t.length?(0,r.jsx)("ol",{className:"space-y-2 text-xs",children:t.map((e,t)=>(0,r.jsxs)("li",{className:"flex gap-2",children:[(0,r.jsxs)("span",{className:"font-mono text-muted-foreground shrink-0 w-5 text-right",children:[t+1,"."]}),(0,r.jsxs)("div",{className:"space-y-1 flex-1 min-w-0",children:[(0,r.jsx)("div",{children:e.title}),e.choice&&(0,r.jsxs)("div",{className:"text-[11px]",children:[(0,r.jsx)("span",{className:"text-muted-foreground",children:s("oauth.copyHint")}),(0,r.jsx)("span",{className:"font-medium bg-muted/60 rounded px-1.5 py-0.5",children:e.choice})]}),e.body&&(0,r.jsx)("p",{className:"text-[11px] text-muted-foreground",children:e.body}),e.copy&&(0,r.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[e.field&&(0,r.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[e.field,":"]}),(0,r.jsx)("code",{className:"font-mono text-[11px] bg-muted/60 rounded px-1.5 py-0.5 break-all flex-1 min-w-0",children:e.copy}),(0,r.jsx)(m,{value:e.copy})]})]})]},t))}):null}function m(e){let{value:t}=e,s=(0,l.c)("app"),[c,m]=(0,n.useState)(!1);return(0,r.jsx)(d.$,{type:"button",size:"icon",variant:"ghost",className:"h-6 w-6 shrink-0",onClick:async()=>{try{await navigator.clipboard.writeText(t),m(!0),o.oR.success(s("oauth.copied")),setTimeout(()=>m(!1),1200)}catch(e){o.oR.error(s("oauth.copyFailed"))}},title:s("oauth.copy"),children:c?(0,r.jsx)(a.A,{className:"h-3 w-3 text-emerald-600"}):(0,r.jsx)(i.A,{className:"h-3 w-3"})})}}},e=>{e.O(0,[4400,4678,9776,6785,3335,9411,2038,8775,6568,2608,6226,4442,4933,146,7358],()=>e(e.s=25342)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[532],{2046:(e,t,s)=>{Promise.resolve().then(s.bind(s,20045)),Promise.resolve().then(s.bind(s,62084)),Promise.resolve().then(s.bind(s,24005)),Promise.resolve().then(s.bind(s,91074)),Promise.resolve().then(s.bind(s,96253)),Promise.resolve().then(s.bind(s,28050)),Promise.resolve().then(s.bind(s,94904)),Promise.resolve().then(s.bind(s,13270)),Promise.resolve().then(s.bind(s,99730)),Promise.resolve().then(s.bind(s,89146)),Promise.resolve().then(s.bind(s,19078)),Promise.resolve().then(s.bind(s,67854)),Promise.resolve().then(s.bind(s,69050)),Promise.resolve().then(s.bind(s,63739)),Promise.resolve().then(s.bind(s,33976)),Promise.resolve().then(s.bind(s,12537)),Promise.resolve().then(s.bind(s,97485)),Promise.resolve().then(s.bind(s,41923)),Promise.resolve().then(s.bind(s,73868)),Promise.resolve().then(s.bind(s,53511)),Promise.resolve().then(s.bind(s,2018)),Promise.resolve().then(s.bind(s,18487)),Promise.resolve().then(s.bind(s,98346)),Promise.resolve().then(s.bind(s,14884)),Promise.resolve().then(s.bind(s,85314)),Promise.resolve().then(s.bind(s,17280)),Promise.resolve().then(s.bind(s,8855)),Promise.resolve().then(s.bind(s,86631)),Promise.resolve().then(s.bind(s,2604)),Promise.resolve().then(s.bind(s,27237)),Promise.resolve().then(s.bind(s,49455)),Promise.resolve().then(s.bind(s,39211)),Promise.resolve().then(s.bind(s,56360)),Promise.resolve().then(s.t.bind(s,54400,23))},5270:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},16329:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]])},23262:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]])},24005:(e,t,s)=>{"use strict";s.d(t,{RootViewer:()=>F});var r=s(4624),n=s(99356),a=s(69285),i=s(49411),l=s(56221),c=s(80192),o=s(43504),d=s(28310),m=s(96325),x=s(7911);let u=(0,x.createServerReference)("607db27c200fb010f5772cb5cece93513c908995c2",x.callServer,void 0,x.findSourceMapURL,"readKbFileAction");var h=s(8190),p=s(45804);let y=(0,p.A)("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);var v=s(16329);let f=(0,p.A)("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),g=(0,p.A)("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]),b=(0,p.A)("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"}]]),j=(0,p.A)("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);var k=s(39783),N=s(58726),w=s(72691),A=s(5270);let P=(0,p.A)("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);var E=s(13506);function C(e){let{kind:t,data:s}=e,n=(null!=t?t:"").toLowerCase();return"task"===n?(0,r.jsx)(L,{data:s}):"meeting"===n?(0,r.jsx)(_,{data:s}):"product"===n?(0,r.jsx)(z,{data:s}):"fact"===n?(0,r.jsx)(B,{data:s}):(0,r.jsx)(M,{data:s})}let S=new Set(["title","version","date","kind"]);function M(e){let{data:t}=e,s=Object.entries(t).filter(e=>{let[t]=e;return!S.has(t)});return 0===s.length?null:(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-1.5",children:s.map(e=>{let[t,s]=e;return(0,r.jsxs)(d.E,{variant:"outline",className:"font-mono text-[10px]",children:[(0,r.jsxs)("span",{className:"text-muted-foreground mr-1",children:[t,":"]}),(0,r.jsx)("span",{className:"truncate max-w-[16rem]",children:function e(t){if(null==t)return"";if("string"==typeof t)return t;if("number"==typeof t||"boolean"==typeof t)return String(t);if(Array.isArray(t))return t.map(t=>e(t)).join(", ");try{return JSON.stringify(t)}catch(e){return String(t)}}(s)})]},t)})})}function L(e){var t;let{data:s}=e,n=(0,i.c)("roots"),a=R(s.status),l=R(s.priority),c=null!=(t=R(s.due))?t:R(s.due_date),o=R(s.assignee),m=U(s.tags);return(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[a&&(0,r.jsxs)(d.E,{className:(0,E.cn)("gap-1 capitalize",function(e){let t=e.toLowerCase();return"done"===t?"bg-emerald-600 text-white":"doing"===t||"in_progress"===t?"bg-blue-600 text-white":"blocked"===t||"cancelled"===t?"bg-destructive text-destructive-foreground":"paused"===t?"bg-amber-600 text-white":"bg-secondary text-secondary-foreground"}(a)),children:[(0,r.jsx)(H,{status:a}),a]}),l&&(0,r.jsxs)(d.E,{variant:"outline",className:(0,E.cn)("gap-1 capitalize",function(e){let t=e.toLowerCase();return"high"===t||"p0"===t||"urgent"===t?"border-destructive text-destructive":"med"===t||"medium"===t||"p1"===t?"border-amber-600 text-amber-700":"border-muted-foreground text-muted-foreground"}(l)),children:[(0,r.jsx)(y,{className:"h-3 w-3"}),l]}),c&&(0,r.jsxs)(d.E,{variant:"secondary",className:"gap-1",children:[(0,r.jsx)(v.A,{className:"h-3 w-3"}),n("entityBadges.dueLabel",{date:c})]}),o&&(0,r.jsxs)(d.E,{variant:"outline",className:"gap-1",children:[(0,r.jsx)(f,{className:"h-3 w-3"}),o]}),null==m?void 0:m.map(e=>(0,r.jsxs)(d.E,{variant:"secondary",className:"gap-1",children:[(0,r.jsx)(g,{className:"h-3 w-3"}),e]},e))]})}function _(e){var t;let{data:s}=e,n=(0,i.c)("roots"),a=U(s.attendees),l=U(s.decisions),c=null!=(t=U(s.action_items))?t:U(s.actionItems);return(0,r.jsxs)("div",{className:"space-y-2",children:[a&&a.length>0&&(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,r.jsx)(b,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.map(e=>(0,r.jsxs)(d.E,{variant:"outline",className:"gap-1",children:[(0,r.jsx)(f,{className:"h-3 w-3"})," ",e]},e))]}),l&&l.length>0&&(0,r.jsx)(I,{title:n("entityBadges.decisionsTitle"),items:l}),c&&c.length>0&&(0,r.jsx)(I,{title:"Action items",items:c})]})}function z(e){var t;let{data:s}=e,n=(0,i.c)("roots"),a=R(s.sku),l=s.price,c=R(s.currency),o=R(s.vendor),m=R(s.url),x=U(s.tags);return(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[null!=l&&""!==l&&(0,r.jsxs)(d.E,{className:"bg-emerald-600 text-white",children:["number"==typeof(t=l)?t.toLocaleString():"string"==typeof t?t:String(t),c?" ".concat(c):""]}),a&&(0,r.jsxs)(d.E,{variant:"outline",className:"gap-1 font-mono",children:[(0,r.jsx)(j,{className:"h-3 w-3"})," ",a]}),o&&(0,r.jsx)(d.E,{variant:"secondary",className:"gap-1",children:o}),m&&(0,r.jsxs)("a",{href:m,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-primary underline-offset-2 hover:underline",children:[(0,r.jsx)(k.A,{className:"h-3 w-3"}),n("entityBadges.openLink")]}),null==x?void 0:x.map(e=>(0,r.jsxs)(d.E,{variant:"outline",className:"gap-1",children:[(0,r.jsx)(g,{className:"h-3 w-3"})," ",e]},e))]})}function B(e){let{data:t}=e,s=(0,i.c)("roots"),n=U(t.tags),a=R(t.source);return(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[null==n?void 0:n.map(e=>(0,r.jsxs)(d.E,{variant:"secondary",className:"gap-1",children:[(0,r.jsx)(g,{className:"h-3 w-3"})," ",e]},e)),a&&(0,r.jsxs)(d.E,{variant:"outline",className:"gap-1 max-w-[24rem]",children:[(0,r.jsx)("span",{className:"text-muted-foreground",children:s("entityBadges.sourceLabel")}),(0,r.jsx)("span",{className:"truncate",children:a})]})]})}function I(e){let{title:t,items:s}=e;return(0,r.jsxs)("div",{className:"rounded-md border bg-muted/30 p-2",children:[(0,r.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:t}),(0,r.jsx)("ul",{className:"space-y-0.5 text-sm",children:s.map((e,t)=>(0,r.jsxs)("li",{className:"leading-snug",children:["• ",e]},t))})]})}function H(e){let{status:t}=e,s=t.toLowerCase();return"done"===s?(0,r.jsx)(N.A,{className:"h-3 w-3"}):"doing"===s||"in_progress"===s?(0,r.jsx)(w.A,{className:"h-3 w-3"}):"blocked"===s||"cancelled"===s?(0,r.jsx)(A.A,{className:"h-3 w-3"}):"paused"===s?(0,r.jsx)(P,{className:"h-3 w-3"}):(0,r.jsx)(y,{className:"h-3 w-3"})}function R(e){return"string"==typeof e&&e.trim()?e:"number"==typeof e?String(e):void 0}function U(e){if(!Array.isArray(e))return;let t=e.map(e=>"string"==typeof e?e:null==e?"":String(e)).filter(e=>e.trim());return t.length>0?t:void 0}var q=s(88181);function F(e){var t,s;let{files:d,rootId:x,rootPath:p,initialFile:y}=e,v=(0,i.c)("roots"),f=(()=>{let e=new Map;for(let t of d)e.set(t.rel,t);return e})(),g=null!=(s=y&&f.has(y)?y:f.has("INDEX.md")?"INDEX.md":null==(t=d[0])?void 0:t.rel)?s:null,[b,j]=(0,n.useState)(g),[k,N]=(0,n.useState)(""),[w,A]=(0,n.useState)(null),[P,E]=(0,n.useTransition)(),C=(0,a.useRouter)();return(0,n.useEffect)(()=>{y&&f.has(y)&&j(y)},[y]),(0,n.useEffect)(()=>{b&&E(async()=>{let e=await u(x,b);if(e.ok)N(e.content),A(e.meta);else{var t;N("# Error\n\n".concat(null!=(t=e.error)?t:"")),A(null)}})},[b,x]),(0,r.jsxs)("div",{className:"flex-1 flex flex-col min-h-0",children:[(0,r.jsx)(c.F,{className:"flex-1 min-h-0",children:(0,r.jsxs)("article",{className:"mx-auto max-w-3xl px-8 py-10",children:[b?P?(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)(o.E,{className:"h-8 w-3/5"}),(0,r.jsx)(o.E,{className:"h-4 w-full"}),(0,r.jsx)(o.E,{className:"h-4 w-11/12"}),(0,r.jsx)(o.E,{className:"h-4 w-4/5"})]}):(0,r.jsxs)(r.Fragment,{children:[w&&(0,r.jsx)(O,{meta:w,filename:b}),(0,r.jsx)(m.p,{source:function(e){if(!e.startsWith("---"))return e;let t=e.indexOf("\n---",3);return t<0?e:e.slice(t+4).replace(/^\r?\n/,"")}(k),onSendToChat:(e,t)=>{(async()=>{let s=v("kb.summaryContext",{url:t,text:e}),r=await (0,q.g)(x,s);if(!r.ok)return l.oR.error(r.error);C.push("/roots/".concat(x,"/chat/").concat(r.topicId))})()}})]}):(0,r.jsx)("p",{className:"text-muted-foreground",children:v("kb.selectFileHint")}),(0,r.jsxs)("div",{className:"mt-10 text-[11px] text-muted-foreground font-mono truncate",children:[p,"/.reflex/"]})]})}),(0,r.jsx)(h.CommandBar,{rootId:x,focusFile:null!=b?b:void 0})]})}function O(e){var t;let{meta:s,filename:n}=e;return s.title||void 0!==s.version||s.date||s.kind?(0,r.jsxs)("header",{className:"mb-6 pb-4 border-b space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-baseline gap-3 flex-wrap",children:[(0,r.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:null!=(t=s.title)?t:n}),(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[s.kind&&(0,r.jsx)(d.E,{variant:"default",className:"capitalize",children:s.kind}),void 0!==s.version&&(0,r.jsxs)(d.E,{variant:"outline",children:["v",s.version]}),s.date&&(0,r.jsx)("span",{className:"font-mono",children:s.date})]})]}),(0,r.jsx)(T,{createdBy:s.data.createdBy}),(0,r.jsx)(C,{kind:s.kind,data:s.data}),(0,r.jsx)("div",{className:"text-[11px] text-muted-foreground font-mono",children:n})]}):null}function T(e){let{createdBy:t}=e,s=(0,i.c)("roots");if("string"!=typeof t||!t)return null;let[n,a]=t.split(":",2);if(!n||!a)return null;let[l,c]=a.split("@",2),o="utility"===n?s("kb.createdMiniApp"):"workflow"===n?s("kb.createdWorkflow"):"agent"===n?s("kb.createdAgent"):n,d=(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full border bg-violet-50 dark:bg-violet-950/30 px-2 py-0.5 text-[10px] text-violet-700 dark:text-violet-300",children:[(0,r.jsx)("span",{className:"text-[9px] uppercase tracking-wider text-muted-foreground",children:s("kb.createdLabel")}),(0,r.jsx)("span",{children:o}),(0,r.jsx)("code",{className:"font-mono",children:l}),c&&(0,r.jsxs)("span",{className:"font-mono text-muted-foreground",children:["v",c]})]});return"utility"===n&&l?(0,r.jsx)("a",{href:"/utilities/project/".concat(encodeURIComponent(l)),className:"inline-block hover:opacity-80",title:s("kb.openMiniApp"),children:d}):d}},30441:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]])},39160:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]])},58726:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},59728:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},72691:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])}},e=>{e.O(0,[4400,4678,9776,6785,3335,9411,2038,8775,5596,3717,4179,4933,146,7358],()=>e(e.s=2046)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[532],{2046:(e,t,s)=>{Promise.resolve().then(s.bind(s,32669)),Promise.resolve().then(s.bind(s,86049)),Promise.resolve().then(s.bind(s,24863)),Promise.resolve().then(s.bind(s,91074)),Promise.resolve().then(s.bind(s,96253)),Promise.resolve().then(s.bind(s,28050)),Promise.resolve().then(s.bind(s,94904)),Promise.resolve().then(s.bind(s,13270)),Promise.resolve().then(s.bind(s,99730)),Promise.resolve().then(s.bind(s,89146)),Promise.resolve().then(s.bind(s,19078)),Promise.resolve().then(s.bind(s,67854)),Promise.resolve().then(s.bind(s,69050)),Promise.resolve().then(s.bind(s,63739)),Promise.resolve().then(s.bind(s,33976)),Promise.resolve().then(s.bind(s,12537)),Promise.resolve().then(s.bind(s,97485)),Promise.resolve().then(s.bind(s,41923)),Promise.resolve().then(s.bind(s,73868)),Promise.resolve().then(s.bind(s,53511)),Promise.resolve().then(s.bind(s,2018)),Promise.resolve().then(s.bind(s,18487)),Promise.resolve().then(s.bind(s,98346)),Promise.resolve().then(s.bind(s,14884)),Promise.resolve().then(s.bind(s,85314)),Promise.resolve().then(s.bind(s,17280)),Promise.resolve().then(s.bind(s,8855)),Promise.resolve().then(s.bind(s,86631)),Promise.resolve().then(s.bind(s,2604)),Promise.resolve().then(s.bind(s,27237)),Promise.resolve().then(s.bind(s,49455)),Promise.resolve().then(s.bind(s,39211)),Promise.resolve().then(s.bind(s,56360)),Promise.resolve().then(s.t.bind(s,54400,23))},5270:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},16329:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]])},23262:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]])},24863:(e,t,s)=>{"use strict";s.d(t,{RootViewer:()=>F});var r=s(4624),n=s(99356),a=s(69285),i=s(49411),l=s(56221),c=s(80192),o=s(43504),d=s(28310),m=s(26288),x=s(7911);let u=(0,x.createServerReference)("60b50f77b4f6a5159f93af176b0319a2462f2060f0",x.callServer,void 0,x.findSourceMapURL,"readKbFileAction");var h=s(8190),p=s(45804);let y=(0,p.A)("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);var v=s(16329);let f=(0,p.A)("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),g=(0,p.A)("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]),b=(0,p.A)("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"}]]),j=(0,p.A)("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);var k=s(39783),N=s(58726),w=s(72691),A=s(5270);let P=(0,p.A)("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);var E=s(13506);function C(e){let{kind:t,data:s}=e,n=(null!=t?t:"").toLowerCase();return"task"===n?(0,r.jsx)(L,{data:s}):"meeting"===n?(0,r.jsx)(_,{data:s}):"product"===n?(0,r.jsx)(z,{data:s}):"fact"===n?(0,r.jsx)(B,{data:s}):(0,r.jsx)(M,{data:s})}let S=new Set(["title","version","date","kind"]);function M(e){let{data:t}=e,s=Object.entries(t).filter(e=>{let[t]=e;return!S.has(t)});return 0===s.length?null:(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-1.5",children:s.map(e=>{let[t,s]=e;return(0,r.jsxs)(d.E,{variant:"outline",className:"font-mono text-[10px]",children:[(0,r.jsxs)("span",{className:"text-muted-foreground mr-1",children:[t,":"]}),(0,r.jsx)("span",{className:"truncate max-w-[16rem]",children:function e(t){if(null==t)return"";if("string"==typeof t)return t;if("number"==typeof t||"boolean"==typeof t)return String(t);if(Array.isArray(t))return t.map(t=>e(t)).join(", ");try{return JSON.stringify(t)}catch(e){return String(t)}}(s)})]},t)})})}function L(e){var t;let{data:s}=e,n=(0,i.c)("roots"),a=R(s.status),l=R(s.priority),c=null!=(t=R(s.due))?t:R(s.due_date),o=R(s.assignee),m=U(s.tags);return(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[a&&(0,r.jsxs)(d.E,{className:(0,E.cn)("gap-1 capitalize",function(e){let t=e.toLowerCase();return"done"===t?"bg-emerald-600 text-white":"doing"===t||"in_progress"===t?"bg-blue-600 text-white":"blocked"===t||"cancelled"===t?"bg-destructive text-destructive-foreground":"paused"===t?"bg-amber-600 text-white":"bg-secondary text-secondary-foreground"}(a)),children:[(0,r.jsx)(H,{status:a}),a]}),l&&(0,r.jsxs)(d.E,{variant:"outline",className:(0,E.cn)("gap-1 capitalize",function(e){let t=e.toLowerCase();return"high"===t||"p0"===t||"urgent"===t?"border-destructive text-destructive":"med"===t||"medium"===t||"p1"===t?"border-amber-600 text-amber-700":"border-muted-foreground text-muted-foreground"}(l)),children:[(0,r.jsx)(y,{className:"h-3 w-3"}),l]}),c&&(0,r.jsxs)(d.E,{variant:"secondary",className:"gap-1",children:[(0,r.jsx)(v.A,{className:"h-3 w-3"}),n("entityBadges.dueLabel",{date:c})]}),o&&(0,r.jsxs)(d.E,{variant:"outline",className:"gap-1",children:[(0,r.jsx)(f,{className:"h-3 w-3"}),o]}),null==m?void 0:m.map(e=>(0,r.jsxs)(d.E,{variant:"secondary",className:"gap-1",children:[(0,r.jsx)(g,{className:"h-3 w-3"}),e]},e))]})}function _(e){var t;let{data:s}=e,n=(0,i.c)("roots"),a=U(s.attendees),l=U(s.decisions),c=null!=(t=U(s.action_items))?t:U(s.actionItems);return(0,r.jsxs)("div",{className:"space-y-2",children:[a&&a.length>0&&(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,r.jsx)(b,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.map(e=>(0,r.jsxs)(d.E,{variant:"outline",className:"gap-1",children:[(0,r.jsx)(f,{className:"h-3 w-3"})," ",e]},e))]}),l&&l.length>0&&(0,r.jsx)(I,{title:n("entityBadges.decisionsTitle"),items:l}),c&&c.length>0&&(0,r.jsx)(I,{title:"Action items",items:c})]})}function z(e){var t;let{data:s}=e,n=(0,i.c)("roots"),a=R(s.sku),l=s.price,c=R(s.currency),o=R(s.vendor),m=R(s.url),x=U(s.tags);return(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[null!=l&&""!==l&&(0,r.jsxs)(d.E,{className:"bg-emerald-600 text-white",children:["number"==typeof(t=l)?t.toLocaleString():"string"==typeof t?t:String(t),c?" ".concat(c):""]}),a&&(0,r.jsxs)(d.E,{variant:"outline",className:"gap-1 font-mono",children:[(0,r.jsx)(j,{className:"h-3 w-3"})," ",a]}),o&&(0,r.jsx)(d.E,{variant:"secondary",className:"gap-1",children:o}),m&&(0,r.jsxs)("a",{href:m,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-primary underline-offset-2 hover:underline",children:[(0,r.jsx)(k.A,{className:"h-3 w-3"}),n("entityBadges.openLink")]}),null==x?void 0:x.map(e=>(0,r.jsxs)(d.E,{variant:"outline",className:"gap-1",children:[(0,r.jsx)(g,{className:"h-3 w-3"})," ",e]},e))]})}function B(e){let{data:t}=e,s=(0,i.c)("roots"),n=U(t.tags),a=R(t.source);return(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[null==n?void 0:n.map(e=>(0,r.jsxs)(d.E,{variant:"secondary",className:"gap-1",children:[(0,r.jsx)(g,{className:"h-3 w-3"})," ",e]},e)),a&&(0,r.jsxs)(d.E,{variant:"outline",className:"gap-1 max-w-[24rem]",children:[(0,r.jsx)("span",{className:"text-muted-foreground",children:s("entityBadges.sourceLabel")}),(0,r.jsx)("span",{className:"truncate",children:a})]})]})}function I(e){let{title:t,items:s}=e;return(0,r.jsxs)("div",{className:"rounded-md border bg-muted/30 p-2",children:[(0,r.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:t}),(0,r.jsx)("ul",{className:"space-y-0.5 text-sm",children:s.map((e,t)=>(0,r.jsxs)("li",{className:"leading-snug",children:["• ",e]},t))})]})}function H(e){let{status:t}=e,s=t.toLowerCase();return"done"===s?(0,r.jsx)(N.A,{className:"h-3 w-3"}):"doing"===s||"in_progress"===s?(0,r.jsx)(w.A,{className:"h-3 w-3"}):"blocked"===s||"cancelled"===s?(0,r.jsx)(A.A,{className:"h-3 w-3"}):"paused"===s?(0,r.jsx)(P,{className:"h-3 w-3"}):(0,r.jsx)(y,{className:"h-3 w-3"})}function R(e){return"string"==typeof e&&e.trim()?e:"number"==typeof e?String(e):void 0}function U(e){if(!Array.isArray(e))return;let t=e.map(e=>"string"==typeof e?e:null==e?"":String(e)).filter(e=>e.trim());return t.length>0?t:void 0}var q=s(18909);function F(e){var t,s;let{files:d,rootId:x,rootPath:p,initialFile:y}=e,v=(0,i.c)("roots"),f=(()=>{let e=new Map;for(let t of d)e.set(t.rel,t);return e})(),g=null!=(s=y&&f.has(y)?y:f.has("INDEX.md")?"INDEX.md":null==(t=d[0])?void 0:t.rel)?s:null,[b,j]=(0,n.useState)(g),[k,N]=(0,n.useState)(""),[w,A]=(0,n.useState)(null),[P,E]=(0,n.useTransition)(),C=(0,a.useRouter)();return(0,n.useEffect)(()=>{y&&f.has(y)&&j(y)},[y]),(0,n.useEffect)(()=>{b&&E(async()=>{let e=await u(x,b);if(e.ok)N(e.content),A(e.meta);else{var t;N("# Error\n\n".concat(null!=(t=e.error)?t:"")),A(null)}})},[b,x]),(0,r.jsxs)("div",{className:"flex-1 flex flex-col min-h-0",children:[(0,r.jsx)(c.F,{className:"flex-1 min-h-0",children:(0,r.jsxs)("article",{className:"mx-auto max-w-3xl px-8 py-10",children:[b?P?(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)(o.E,{className:"h-8 w-3/5"}),(0,r.jsx)(o.E,{className:"h-4 w-full"}),(0,r.jsx)(o.E,{className:"h-4 w-11/12"}),(0,r.jsx)(o.E,{className:"h-4 w-4/5"})]}):(0,r.jsxs)(r.Fragment,{children:[w&&(0,r.jsx)(O,{meta:w,filename:b}),(0,r.jsx)(m.p,{source:function(e){if(!e.startsWith("---"))return e;let t=e.indexOf("\n---",3);return t<0?e:e.slice(t+4).replace(/^\r?\n/,"")}(k),onSendToChat:(e,t)=>{(async()=>{let s=v("kb.summaryContext",{url:t,text:e}),r=await (0,q.g)(x,s);if(!r.ok)return l.oR.error(r.error);C.push("/roots/".concat(x,"/chat/").concat(r.topicId))})()}})]}):(0,r.jsx)("p",{className:"text-muted-foreground",children:v("kb.selectFileHint")}),(0,r.jsxs)("div",{className:"mt-10 text-[11px] text-muted-foreground font-mono truncate",children:[p,"/.reflex/"]})]})}),(0,r.jsx)(h.CommandBar,{rootId:x,focusFile:null!=b?b:void 0})]})}function O(e){var t;let{meta:s,filename:n}=e;return s.title||void 0!==s.version||s.date||s.kind?(0,r.jsxs)("header",{className:"mb-6 pb-4 border-b space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-baseline gap-3 flex-wrap",children:[(0,r.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:null!=(t=s.title)?t:n}),(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[s.kind&&(0,r.jsx)(d.E,{variant:"default",className:"capitalize",children:s.kind}),void 0!==s.version&&(0,r.jsxs)(d.E,{variant:"outline",children:["v",s.version]}),s.date&&(0,r.jsx)("span",{className:"font-mono",children:s.date})]})]}),(0,r.jsx)(T,{createdBy:s.data.createdBy}),(0,r.jsx)(C,{kind:s.kind,data:s.data}),(0,r.jsx)("div",{className:"text-[11px] text-muted-foreground font-mono",children:n})]}):null}function T(e){let{createdBy:t}=e,s=(0,i.c)("roots");if("string"!=typeof t||!t)return null;let[n,a]=t.split(":",2);if(!n||!a)return null;let[l,c]=a.split("@",2),o="utility"===n?s("kb.createdMiniApp"):"workflow"===n?s("kb.createdWorkflow"):"agent"===n?s("kb.createdAgent"):n,d=(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full border bg-violet-50 dark:bg-violet-950/30 px-2 py-0.5 text-[10px] text-violet-700 dark:text-violet-300",children:[(0,r.jsx)("span",{className:"text-[9px] uppercase tracking-wider text-muted-foreground",children:s("kb.createdLabel")}),(0,r.jsx)("span",{children:o}),(0,r.jsx)("code",{className:"font-mono",children:l}),c&&(0,r.jsxs)("span",{className:"font-mono text-muted-foreground",children:["v",c]})]});return"utility"===n&&l?(0,r.jsx)("a",{href:"/utilities/project/".concat(encodeURIComponent(l)),className:"inline-block hover:opacity-80",title:s("kb.openMiniApp"),children:d}):d}},30441:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]])},39160:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]])},58726:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},59728:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},72691:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])}},e=>{e.O(0,[4400,4678,9776,6785,3335,9411,2038,8775,2608,6226,7922,4933,146,7358],()=>e(e.s=2046)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8,803,1064,1119,2047,2295,3373,4751,5618,5650,5867,6058,6062,6475,7200,7812,8818,9749],{93480:()=>{}},_=>{_.O(0,[4933,146,7358],()=>_(_.s=93480)),_N_E=_.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9872],{3239:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(45804).A)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},4959:(e,t,r)=>{"use strict";r.d(t,{BT:()=>d,Wu:()=>l,ZB:()=>o,Zp:()=>a,aR:()=>i,wL:()=>c});var s=r(4624);r(99356);var n=r(13506);function a(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"card",className:(0,n.cn)("flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",t),...r})}function i(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"card-header",className:(0,n.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...r})}function o(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"card-title",className:(0,n.cn)("leading-none font-semibold",t),...r})}function d(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"card-description",className:(0,n.cn)("text-sm text-muted-foreground",t),...r})}function l(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"card-content",className:(0,n.cn)("px-6",t),...r})}function c(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"card-footer",className:(0,n.cn)("flex items-center px-6 [.border-t]:pt-6",t),...r})}},7951:(e,t,r)=>{Promise.resolve().then(r.bind(r,77364)),Promise.resolve().then(r.bind(r,91074)),Promise.resolve().then(r.bind(r,96253)),Promise.resolve().then(r.bind(r,28050)),Promise.resolve().then(r.bind(r,94904)),Promise.resolve().then(r.bind(r,13270)),Promise.resolve().then(r.bind(r,99730)),Promise.resolve().then(r.bind(r,89146)),Promise.resolve().then(r.bind(r,19078)),Promise.resolve().then(r.bind(r,67854)),Promise.resolve().then(r.bind(r,69050)),Promise.resolve().then(r.bind(r,63739)),Promise.resolve().then(r.bind(r,33976)),Promise.resolve().then(r.bind(r,12537)),Promise.resolve().then(r.bind(r,97485)),Promise.resolve().then(r.bind(r,41923)),Promise.resolve().then(r.bind(r,73868)),Promise.resolve().then(r.bind(r,53511)),Promise.resolve().then(r.bind(r,2018)),Promise.resolve().then(r.bind(r,18487)),Promise.resolve().then(r.bind(r,98346)),Promise.resolve().then(r.bind(r,14884)),Promise.resolve().then(r.bind(r,85314)),Promise.resolve().then(r.bind(r,17280)),Promise.resolve().then(r.bind(r,8855)),Promise.resolve().then(r.bind(r,86631)),Promise.resolve().then(r.bind(r,2604)),Promise.resolve().then(r.bind(r,27237)),Promise.resolve().then(r.bind(r,49455)),Promise.resolve().then(r.bind(r,39211)),Promise.resolve().then(r.bind(r,56360)),Promise.resolve().then(r.t.bind(r,54400,23))},13506:(e,t,r)=>{"use strict";r.d(t,{cn:()=>a});var s=r(47989),n=r(55701);function a(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,n.QP)((0,s.$)(t))}},46972:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(45804).A)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},60621:(e,t,r)=>{"use strict";r.d(t,{F:()=>i});var s=r(47989);let n=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,a=s.$,i=(e,t)=>r=>{var s;if((null==t?void 0:t.variants)==null)return a(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:i,defaultVariants:o}=t,d=Object.keys(i).map(e=>{let t=null==r?void 0:r[e],s=null==o?void 0:o[e];if(null===t)return null;let a=n(t)||n(s);return i[e][a]}),l=r&&Object.entries(r).reduce((e,t)=>{let[r,s]=t;return void 0===s||(e[r]=s),e},{});return a(e,d,null==t||null==(s=t.compoundVariants)?void 0:s.reduce((e,t)=>{let{class:r,className:s,...n}=t;return Object.entries(n).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...o,...l}[t]):({...o,...l})[t]===r})?[...e,r,s]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}},65714:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(45804).A)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},71651:(e,t,r)=>{"use strict";r.d(t,{T:()=>a});var s=r(4624);r(99356);var n=r(13506);function a(e){let{className:t,...r}=e;return(0,s.jsx)("textarea",{"data-slot":"textarea",className:(0,n.cn)("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40",t),...r})}},77364:(e,t,r)=>{"use strict";r.d(t,{MemoryEditor:()=>p});var s=r(4624),n=r(99356),a=r(56221),i=r(3239),o=r(85924),d=r(65714),l=r(46972),c=r(85253),u=r(4959),v=r(71651),m=r(13506),h=r(7911);let x=(0,h.createServerReference)("402c20ee9ffc2a44da3e1d2b4bb50488fab4d28c95",h.callServer,void 0,h.findSourceMapURL,"loadMemoryAction"),f=(0,h.createServerReference)("405553b2057ee0ed28180499aef130476e3c48afd4",h.callServer,void 0,h.findSourceMapURL,"saveMemoryFileAction"),b=(0,h.createServerReference)("40d5508d880eadcd5dc5088ed2f32c9fff17b4621c",h.callServer,void 0,h.findSourceMapURL,"wipeMemoryAction");function p(e){let{scope:t,rootId:r,title:a,description:d,allowWipe:l}=e,[c,v]=(0,n.useState)([]),[m,h]=(0,n.useState)(!0),[f,b]=(0,n.useState)(null),p=(0,n.useCallback)(async()=>{h(!0);let e=await x(r?{scope:t,rootId:r}:{scope:t});if(h(!1),!e.ok)return void b(e.error);b(null),v(e.files)},[t,r]);return(0,n.useEffect)(()=>{p()},[p]),(0,s.jsxs)(u.Zp,{children:[(0,s.jsx)(u.aR,{children:(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(u.ZB,{className:"text-lg",children:a}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:d})]}),l&&c.length>0&&(0,s.jsx)(y,{scope:t,rootId:r,onWiped:p})]})}),(0,s.jsx)(u.Wu,{children:m?(0,s.jsxs)("div",{className:"text-sm text-muted-foreground flex items-center gap-2",children:[(0,s.jsx)(i.A,{className:"h-3 w-3 animate-spin"})," Loading…"]}):f?(0,s.jsxs)("p",{className:"text-sm text-destructive flex items-center gap-2",children:[(0,s.jsx)(o.A,{className:"h-3.5 w-3.5"}),f]}):(0,s.jsx)("div",{className:"space-y-4",children:c.map(e=>(0,s.jsx)(g,{snapshot:e,scope:t,rootId:r,onSaved:e=>v(t=>t.map(t=>t.file===e.file?e:t))},e.file))})})]})}function g(e){let{snapshot:t,scope:r,rootId:o,onSaved:l}=e,[u,h]=(0,n.useState)(t.content),[x,b]=(0,n.useTransition)();(0,n.useEffect)(()=>{h(t.content)},[t.content]);let p=u.trim(),g=p?p.split("\n").length:0,y=g>t.cap,j=g>.9*t.cap,k=u!==t.content;return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,s.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,s.jsx)("span",{className:"font-mono text-sm font-semibold",children:t.file}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:t.description})]}),(0,s.jsxs)("span",{className:(0,m.cn)("text-xs tabular-nums",y?"text-destructive font-medium":j?"text-amber-600":"text-muted-foreground"),children:[g,"/",t.cap]})]}),(0,s.jsx)(v.T,{value:u,onChange:e=>h(e.target.value),rows:Math.min(t.cap+2,Math.max(3,g+1)),placeholder:"Empty",className:"font-mono text-xs"}),(0,s.jsx)("div",{className:"flex items-center justify-end gap-2",children:(0,s.jsxs)(c.$,{type:"button",size:"sm",variant:k?"default":"ghost",disabled:!k||x||y,onClick:()=>{if(y)return void a.oR.error("".concat(t.file," exceeds ").concat(t.cap,"-line cap (").concat(g,"). Trim before saving."));b(async()=>{let e=await f({scope:r,...o?{rootId:o}:{},file:t.file,content:p});if(!e.ok){var s;a.oR.error(null!=(s=e.error)?s:"Save failed");return}a.oR.success("Saved ".concat(t.file)),l({...t,content:p,lines:e.lines})})},children:[x?(0,s.jsx)(i.A,{className:"mr-1 h-3 w-3 animate-spin"}):(0,s.jsx)(d.A,{className:"mr-1 h-3 w-3"}),"Save"]})})]})}function y(e){let{scope:t,rootId:r,onWiped:i}=e,[o,d]=(0,n.useTransition)();return(0,s.jsxs)(c.$,{type:"button",size:"sm",variant:"ghost",disabled:o,onClick:()=>{confirm("Erase ALL memory at this scope? Cannot be undone.")&&d(async()=>{let e=await b(r?{scope:t,rootId:r}:{scope:t});if(!e.ok){var s;a.oR.error(null!=(s=e.error)?s:"Wipe failed");return}a.oR.success("Memory wiped"),await i()})},className:"text-destructive hover:text-destructive",children:[(0,s.jsx)(l.A,{className:"mr-1 h-3 w-3"}),"Wipe all"]})}},85253:(e,t,r)=>{"use strict";r.d(t,{$:()=>d});var s=r(4624);r(99356);var n=r(60621),a=r(50362),i=r(13506);let o=(0,n.F)("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function d(e){let{className:t,variant:r="default",size:n="default",asChild:d=!1,...l}=e,c=d?a.bL:"button";return(0,s.jsx)(c,{"data-slot":"button","data-variant":r,"data-size":n,className:(0,i.cn)(o({variant:r,size:n,className:t})),...l})}},85924:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(45804).A)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},91074:(e,t,r)=>{"use strict";r.d(t,{Separator:()=>i});var s=r(4624);r(99356);var n=r(44188),a=r(13506);function i(e){let{className:t,orientation:r="horizontal",decorative:i=!0,...o}=e;return(0,s.jsx)(n.b,{"data-slot":"separator",decorative:i,orientation:r,className:(0,a.cn)("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...o})}}},e=>{e.O(0,[4400,4678,9776,6785,3335,4933,146,7358],()=>e(e.s=7951)),_N_E=e.O()}]);