ai-schadcn-chat 0.1.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 (221) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +307 -0
  3. package/dist/ChatPanel-Cyq7boWQ.js +3468 -0
  4. package/dist/ChatPanel-Cyq7boWQ.js.map +1 -0
  5. package/dist/ChatPanel-D3VL5Vdq.cjs +10 -0
  6. package/dist/ChatPanel-D3VL5Vdq.cjs.map +1 -0
  7. package/dist/ChatProvider-DcrNbVMh.cjs +2 -0
  8. package/dist/ChatProvider-DcrNbVMh.cjs.map +1 -0
  9. package/dist/ChatProvider-DoD4jj4M.js +128 -0
  10. package/dist/ChatProvider-DoD4jj4M.js.map +1 -0
  11. package/dist/chat-engine-BaFdimfx.cjs +8 -0
  12. package/dist/chat-engine-BaFdimfx.cjs.map +1 -0
  13. package/dist/chat-engine-Cja0KtWE.js +520 -0
  14. package/dist/chat-engine-Cja0KtWE.js.map +1 -0
  15. package/dist/components/chat/AgentManager.d.ts +11 -0
  16. package/dist/components/chat/AgentManager.d.ts.map +1 -0
  17. package/dist/components/chat/AgentManager.js +110 -0
  18. package/dist/components/chat/Attachment.d.ts +34 -0
  19. package/dist/components/chat/Attachment.d.ts.map +1 -0
  20. package/dist/components/chat/Attachment.js +59 -0
  21. package/dist/components/chat/AttachmentPreview.d.ts +8 -0
  22. package/dist/components/chat/AttachmentPreview.d.ts.map +1 -0
  23. package/dist/components/chat/AttachmentPreview.js +43 -0
  24. package/dist/components/chat/ChatComposer.d.ts +11 -0
  25. package/dist/components/chat/ChatComposer.d.ts.map +1 -0
  26. package/dist/components/chat/ChatComposer.js +10 -0
  27. package/dist/components/chat/ChatHeader.d.ts +5 -0
  28. package/dist/components/chat/ChatHeader.d.ts.map +1 -0
  29. package/dist/components/chat/ChatHeader.js +132 -0
  30. package/dist/components/chat/ChatPanel.d.ts +36 -0
  31. package/dist/components/chat/ChatPanel.d.ts.map +1 -0
  32. package/dist/components/chat/ChatPanel.js +55 -0
  33. package/dist/components/chat/ChatProvider.d.ts +58 -0
  34. package/dist/components/chat/ChatProvider.d.ts.map +1 -0
  35. package/dist/components/chat/ChatProvider.js +145 -0
  36. package/dist/components/chat/Chatbubble.d.ts +30 -0
  37. package/dist/components/chat/Chatbubble.d.ts.map +1 -0
  38. package/dist/components/chat/Chatbubble.js +50 -0
  39. package/dist/components/chat/Markdown.d.ts +35 -0
  40. package/dist/components/chat/Markdown.d.ts.map +1 -0
  41. package/dist/components/chat/Markdown.js +130 -0
  42. package/dist/components/chat/Message.d.ts +22 -0
  43. package/dist/components/chat/Message.d.ts.map +1 -0
  44. package/dist/components/chat/Message.js +21 -0
  45. package/dist/components/chat/MessageInput.d.ts +24 -0
  46. package/dist/components/chat/MessageInput.d.ts.map +1 -0
  47. package/dist/components/chat/MessageInput.js +255 -0
  48. package/dist/components/chat/MessageList.d.ts +9 -0
  49. package/dist/components/chat/MessageList.d.ts.map +1 -0
  50. package/dist/components/chat/MessageList.js +249 -0
  51. package/dist/components/chat/MessageMarker.d.ts +25 -0
  52. package/dist/components/chat/MessageMarker.d.ts.map +1 -0
  53. package/dist/components/chat/MessageMarker.js +31 -0
  54. package/dist/components/chat/MessageScroller.d.ts +12 -0
  55. package/dist/components/chat/MessageScroller.d.ts.map +1 -0
  56. package/dist/components/chat/MessageScroller.js +48 -0
  57. package/dist/components/chat/MessageScrollerPrimitives.d.ts +76 -0
  58. package/dist/components/chat/MessageScrollerPrimitives.d.ts.map +1 -0
  59. package/dist/components/chat/MessageScrollerPrimitives.js +438 -0
  60. package/dist/components/chat/ProviderManager.d.ts +10 -0
  61. package/dist/components/chat/ProviderManager.d.ts.map +1 -0
  62. package/dist/components/chat/ProviderManager.js +110 -0
  63. package/dist/components/chat/ReasoningPanel.d.ts +15 -0
  64. package/dist/components/chat/ReasoningPanel.d.ts.map +1 -0
  65. package/dist/components/chat/ReasoningPanel.js +40 -0
  66. package/dist/components/chat/ThemeToggle.d.ts +4 -0
  67. package/dist/components/chat/ThemeToggle.d.ts.map +1 -0
  68. package/dist/components/chat/ThemeToggle.js +59 -0
  69. package/dist/components/index.d.ts +44 -0
  70. package/dist/components/index.d.ts.map +1 -0
  71. package/dist/components/index.js +49 -0
  72. package/dist/components/ui/avatar.d.ts +11 -0
  73. package/dist/components/ui/avatar.d.ts.map +1 -0
  74. package/dist/components/ui/avatar.js +33 -0
  75. package/dist/components/ui/badge.d.ts +10 -0
  76. package/dist/components/ui/badge.d.ts.map +1 -0
  77. package/dist/components/ui/badge.js +19 -0
  78. package/dist/components/ui/button.d.ts +12 -0
  79. package/dist/components/ui/button.d.ts.map +1 -0
  80. package/dist/components/ui/button.js +34 -0
  81. package/dist/components/ui/card.d.ts +8 -0
  82. package/dist/components/ui/card.d.ts.map +1 -0
  83. package/dist/components/ui/card.js +15 -0
  84. package/dist/components/ui/checkbox.d.ts +5 -0
  85. package/dist/components/ui/checkbox.d.ts.map +1 -0
  86. package/dist/components/ui/checkbox.js +8 -0
  87. package/dist/components/ui/collapsible.d.ts +6 -0
  88. package/dist/components/ui/collapsible.d.ts.map +1 -0
  89. package/dist/components/ui/collapsible.js +5 -0
  90. package/dist/components/ui/dialog.d.ts +24 -0
  91. package/dist/components/ui/dialog.d.ts.map +1 -0
  92. package/dist/components/ui/dialog.js +30 -0
  93. package/dist/components/ui/dropdown-menu.d.ts +17 -0
  94. package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
  95. package/dist/components/ui/dropdown-menu.js +20 -0
  96. package/dist/components/ui/input.d.ts +4 -0
  97. package/dist/components/ui/input.d.ts.map +1 -0
  98. package/dist/components/ui/input.js +7 -0
  99. package/dist/components/ui/label.d.ts +6 -0
  100. package/dist/components/ui/label.d.ts.map +1 -0
  101. package/dist/components/ui/label.js +10 -0
  102. package/dist/components/ui/popover.d.ts +6 -0
  103. package/dist/components/ui/popover.d.ts.map +1 -0
  104. package/dist/components/ui/popover.js +9 -0
  105. package/dist/components/ui/scroll-area.d.ts +3 -0
  106. package/dist/components/ui/scroll-area.d.ts.map +1 -0
  107. package/dist/components/ui/scroll-area.js +8 -0
  108. package/dist/components/ui/select.d.ts +14 -0
  109. package/dist/components/ui/select.d.ts.map +1 -0
  110. package/dist/components/ui/select.js +26 -0
  111. package/dist/components/ui/separator.d.ts +3 -0
  112. package/dist/components/ui/separator.d.ts.map +1 -0
  113. package/dist/components/ui/separator.js +6 -0
  114. package/dist/components/ui/switch.d.ts +3 -0
  115. package/dist/components/ui/switch.d.ts.map +1 -0
  116. package/dist/components/ui/switch.js +6 -0
  117. package/dist/components/ui/tabs.d.ts +6 -0
  118. package/dist/components/ui/tabs.d.ts.map +1 -0
  119. package/dist/components/ui/tabs.js +11 -0
  120. package/dist/components/ui/tooltip.d.ts +6 -0
  121. package/dist/components/ui/tooltip.d.ts.map +1 -0
  122. package/dist/components/ui/tooltip.js +9 -0
  123. package/dist/components.cjs +2 -0
  124. package/dist/components.cjs.map +1 -0
  125. package/dist/components.js +129 -0
  126. package/dist/components.js.map +1 -0
  127. package/dist/hooks/index.d.ts +2 -0
  128. package/dist/hooks/index.d.ts.map +1 -0
  129. package/dist/hooks/index.js +3 -0
  130. package/dist/hooks/useChat.d.ts +6 -0
  131. package/dist/hooks/useChat.d.ts.map +1 -0
  132. package/dist/hooks/useChat.js +5 -0
  133. package/dist/hooks.cjs +2 -0
  134. package/dist/hooks.cjs.map +1 -0
  135. package/dist/hooks.js +8 -0
  136. package/dist/hooks.js.map +1 -0
  137. package/dist/index-Ci4qkGOp.cjs +20 -0
  138. package/dist/index-Ci4qkGOp.cjs.map +1 -0
  139. package/dist/index-NhYr-cEJ.js +567 -0
  140. package/dist/index-NhYr-cEJ.js.map +1 -0
  141. package/dist/index.cjs +2 -0
  142. package/dist/index.cjs.map +1 -0
  143. package/dist/index.d.ts +33 -0
  144. package/dist/index.d.ts.map +1 -0
  145. package/dist/index.js +32 -0
  146. package/dist/index.js.map +1 -0
  147. package/dist/lib/agents.d.ts +29 -0
  148. package/dist/lib/agents.d.ts.map +1 -0
  149. package/dist/lib/agents.js +145 -0
  150. package/dist/lib/attachments.d.ts +40 -0
  151. package/dist/lib/attachments.d.ts.map +1 -0
  152. package/dist/lib/attachments.js +152 -0
  153. package/dist/lib/chat-engine.d.ts +109 -0
  154. package/dist/lib/chat-engine.d.ts.map +1 -0
  155. package/dist/lib/chat-engine.js +505 -0
  156. package/dist/lib/index.d.ts +8 -0
  157. package/dist/lib/index.d.ts.map +1 -0
  158. package/dist/lib/index.js +7 -0
  159. package/dist/lib/persistence.d.ts +30 -0
  160. package/dist/lib/persistence.d.ts.map +1 -0
  161. package/dist/lib/persistence.js +104 -0
  162. package/dist/lib/providers.d.ts +40 -0
  163. package/dist/lib/providers.d.ts.map +1 -0
  164. package/dist/lib/providers.js +0 -0
  165. package/dist/lib/tw-merge.d.ts +9 -0
  166. package/dist/lib/tw-merge.d.ts.map +1 -0
  167. package/dist/lib/tw-merge.js +8 -0
  168. package/dist/lib/utils.d.ts +69 -0
  169. package/dist/lib/utils.d.ts.map +1 -0
  170. package/dist/lib/utils.js +166 -0
  171. package/dist/lib/voice.d.ts +57 -0
  172. package/dist/lib/voice.d.ts.map +1 -0
  173. package/dist/lib/voice.js +103 -0
  174. package/dist/lib.cjs +2 -0
  175. package/dist/lib.cjs.map +1 -0
  176. package/dist/lib.js +59 -0
  177. package/dist/lib.js.map +1 -0
  178. package/dist/marker.css +68 -0
  179. package/dist/package.json +6 -0
  180. package/dist/presets-BxnbImSM.cjs +2 -0
  181. package/dist/presets-BxnbImSM.cjs.map +1 -0
  182. package/dist/presets-D8VQTD8n.js +193 -0
  183. package/dist/presets-D8VQTD8n.js.map +1 -0
  184. package/dist/providers/anthropic.d.ts +30 -0
  185. package/dist/providers/anthropic.d.ts.map +1 -0
  186. package/dist/providers/anthropic.js +251 -0
  187. package/dist/providers/base.d.ts +55 -0
  188. package/dist/providers/base.d.ts.map +1 -0
  189. package/dist/providers/base.js +272 -0
  190. package/dist/providers/index.d.ts +15 -0
  191. package/dist/providers/index.d.ts.map +1 -0
  192. package/dist/providers/index.js +24 -0
  193. package/dist/providers/openai.d.ts +31 -0
  194. package/dist/providers/openai.d.ts.map +1 -0
  195. package/dist/providers/openai.js +192 -0
  196. package/dist/providers-BuaGy2tX.cjs +4 -0
  197. package/dist/providers-BuaGy2tX.cjs.map +1 -0
  198. package/dist/providers-kp-avTNl.js +324 -0
  199. package/dist/providers-kp-avTNl.js.map +1 -0
  200. package/dist/providers.cjs +2 -0
  201. package/dist/providers.cjs.map +1 -0
  202. package/dist/providers.js +14 -0
  203. package/dist/providers.js.map +1 -0
  204. package/dist/scroller.css +278 -0
  205. package/dist/style.css +1 -0
  206. package/dist/types/chat.d.ts +342 -0
  207. package/dist/types/chat.d.ts.map +1 -0
  208. package/dist/types/chat.js +4 -0
  209. package/dist/types/index.d.ts +9 -0
  210. package/dist/types/index.d.ts.map +1 -0
  211. package/dist/types/index.js +14 -0
  212. package/dist/types/presets.d.ts +25 -0
  213. package/dist/types/presets.d.ts.map +1 -0
  214. package/dist/types/presets.js +207 -0
  215. package/dist/types.cjs +2 -0
  216. package/dist/types.cjs.map +1 -0
  217. package/dist/types.js +16 -0
  218. package/dist/types.js.map +1 -0
  219. package/dist/typeset-presets.css +56 -0
  220. package/dist/typeset.css +505 -0
  221. package/package.json +158 -0
@@ -0,0 +1,10 @@
1
+ "use strict";const e=require("react/jsx-runtime"),m=require("react"),c=require("./index-Ci4qkGOp.cjs"),Ds=require("@radix-ui/react-scroll-area"),Ps=require("@radix-ui/react-avatar"),Is=require("@radix-ui/react-switch"),_s=require("@radix-ui/react-separator"),Es=require("@radix-ui/react-tabs"),Fs=require("@radix-ui/react-checkbox"),u=require("lucide-react"),Hs=require("@radix-ui/react-tooltip"),A=require("./providers-BuaGy2tX.cjs"),W=require("class-variance-authority"),we=require("@radix-ui/react-slot"),Ls=require("@radix-ui/react-dropdown-menu"),Bs=require("@radix-ui/react-dialog"),Vs=require("@radix-ui/react-label"),qs=require("@radix-ui/react-select"),B=require("./ChatProvider-DcrNbVMh.cjs"),Os=require("@radix-ui/react-collapsible"),$s=require("react-markdown"),Us=require("rehype-highlight"),it=require("rehype-raw"),Gs=require("remark-gfm"),mt=require("./chat-engine-BaFdimfx.cjs"),Ks=require("@radix-ui/react-popover");function D(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(s,a,n.get?n:{enumerable:!0,get:()=>t[a]})}}return s.default=t,Object.freeze(s)}const h=D(m),Q=D(Ds),Le=D(Ps),lt=D(Is),Ws=D(_s),Ne=D(Es),Ee=D(Fs),fe=D(Hs),P=D(Ls),$=D(Bs),pt=D(Vs),z=D(qs),Be=D(Os),ge=D(Ks),xt=W.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10","icon-sm":"h-8 w-8"}},defaultVariants:{variant:"default",size:"default"}}),y=m.forwardRef(({className:t,variant:s,size:a,asChild:n=!1,...o},l)=>{const i=n?we.Slot:"button";return e.jsx(i,{className:c.cn(xt({variant:s,size:a,className:t})),ref:l,...o})});y.displayName="Button";const L=m.forwardRef(({className:t,type:s,...a},n)=>e.jsx("input",{type:s,className:c.cn("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...a}));L.displayName="Input";const X=m.forwardRef(({className:t,...s},a)=>e.jsx("textarea",{className:c.cn("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:a,...s}));X.displayName="Textarea";const ft=m.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:c.cn("rounded-lg border bg-card text-card-foreground shadow-sm",t),...s}));ft.displayName="Card";const gt=m.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:c.cn("flex flex-col space-y-1.5 p-4",t),...s}));gt.displayName="CardHeader";const ht=m.forwardRef(({className:t,...s},a)=>e.jsx("h3",{ref:a,className:c.cn("text-base font-semibold leading-none tracking-tight",t),...s}));ht.displayName="CardTitle";const bt=m.forwardRef(({className:t,...s},a)=>e.jsx("p",{ref:a,className:c.cn("text-sm text-muted-foreground",t),...s}));bt.displayName="CardDescription";const vt=m.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:c.cn("p-4 pt-0",t),...s}));vt.displayName="CardContent";const jt=m.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:c.cn("flex items-center p-4 pt-0",t),...s}));jt.displayName="CardFooter";const yt=m.forwardRef(({className:t,children:s,...a},n)=>e.jsxs(Q.Root,{ref:n,className:c.cn("relative overflow-hidden",t),...a,children:[e.jsx(Q.Viewport,{className:"h-full w-full rounded-[inherit]",children:s}),e.jsx(wt,{}),e.jsx(Q.Corner,{})]}));yt.displayName=Q.Root.displayName;const wt=m.forwardRef(({className:t,orientation:s="vertical",...a},n)=>e.jsx(Q.ScrollAreaScrollbar,{ref:n,orientation:s,className:c.cn("flex touch-none select-none transition-colors",s==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",s==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...a,children:e.jsx(Q.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));wt.displayName=Q.ScrollAreaScrollbar.displayName;const Nt="relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",Ct="aspect-square h-full w-full",kt="flex h-full w-full items-center justify-center rounded-full bg-muted text-xs font-medium uppercase",Ys=t=>t.trim().split(/\s+/).slice(0,2).map(s=>s[0]?.toUpperCase()??"").join("")||"·",Qs=t=>{const s=(t??"x").trim();let a=0;for(let n=0;n<s.length;n++)a=a*31+s.charCodeAt(n)>>>0;return`hsl(${a%360}deg 70% 88%)`},Xs=t=>{const s=(t??"x").trim();let a=0;for(let n=0;n<s.length;n++)a=a*17+s.charCodeAt(n)>>>0;return`hsl(${a%360}deg 40% 25%)`},St=m.forwardRef(({className:t,...s},a)=>e.jsx(Le.Root,{ref:a,className:c.cn(Nt,t),...s}));St.displayName="AvatarRoot";const zt=m.forwardRef(({className:t,...s},a)=>e.jsx(Le.Image,{ref:a,className:c.cn(Ct,t),...s}));zt.displayName="AvatarImage";const Tt=m.forwardRef(({className:t,...s},a)=>e.jsx(Le.Fallback,{ref:a,className:c.cn(kt,t),...s}));Tt.displayName="AvatarFallback";const me=P.Root,pe=P.Trigger,Js=P.Group,Zs=P.Portal,ea=P.Sub,ta=P.RadioGroup,se=m.forwardRef(({className:t,sideOffset:s=4,...a},n)=>e.jsx(P.Portal,{children:e.jsx(P.Content,{ref:n,sideOffset:s,className:c.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",t),...a})}));se.displayName="DropdownMenuContent";const U=m.forwardRef(({className:t,inset:s,...a},n)=>e.jsx(P.Item,{ref:n,className:c.cn("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:size-4",s&&"pl-8",t),...a}));U.displayName="DropdownMenuItem";const xe=m.forwardRef(({className:t,inset:s,...a},n)=>e.jsx(P.Label,{ref:n,className:c.cn("px-2 py-1.5 text-xs font-semibold uppercase text-muted-foreground",s&&"pl-8",t),...a}));xe.displayName="DropdownMenuLabel";const ae=m.forwardRef(({className:t,...s},a)=>e.jsx(P.Separator,{ref:a,className:c.cn("-mx-1 my-1 h-px bg-muted",t),...s}));ae.displayName="DropdownMenuSeparator";const Rt=m.forwardRef(({className:t,children:s,checked:a,...n},o)=>e.jsx(P.CheckboxItem,{ref:o,checked:a,className:c.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:s}));Rt.displayName="DropdownMenuCheckboxItem";const At=ge.Root,Mt=ge.Trigger,sa=ge.Anchor,Ve=m.forwardRef(({className:t,align:s="center",sideOffset:a=4,...n},o)=>e.jsx(ge.Portal,{children:e.jsx(ge.Content,{ref:o,align:s,sideOffset:a,className:c.cn("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none",t),...n})}));Ve.displayName="PopoverContent";const Dt=fe.Provider,G=fe.Root,K=fe.Trigger,O=m.forwardRef(({className:t,sideOffset:s=4,...a},n)=>e.jsx(fe.Portal,{children:e.jsx(fe.Content,{ref:n,sideOffset:s,className:c.cn("z-50 overflow-hidden rounded-md bg-foreground px-3 py-1.5 text-xs text-background shadow",t),...a})}));O.displayName="TooltipContent";const Pt=m.forwardRef(({className:t,...s},a)=>e.jsx(lt.Root,{ref:a,className:c.cn("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...s,children:e.jsx(lt.Thumb,{className:c.cn("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Pt.displayName="Switch";const qe=$.Root,aa=$.Trigger,It=$.Portal,na=$.Close,Oe=m.forwardRef(({className:t,...s},a)=>e.jsx($.Overlay,{ref:a,className:c.cn("fixed inset-0 z-50 bg-black/60 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s}));Oe.displayName="DialogOverlay";const _t="fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",Ce=m.forwardRef(({className:t,children:s,...a},n)=>e.jsxs(It,{children:[e.jsx(Oe,{}),e.jsxs($.Content,{ref:n,className:c.cn(_t,t),...a,children:[s,e.jsxs($.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[e.jsx(u.X,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ce.displayName="DialogContent";const Et="flex flex-col space-y-1.5 text-center sm:text-left";function ne({className:t,...s}){return e.jsx("div",{className:c.cn(Et,t),...s})}ne.displayName="DialogHeader";const Ft="flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2";function re({className:t,...s}){return e.jsx("div",{className:c.cn(Ft,t),...s})}re.displayName="DialogFooter";const Ht="text-lg font-semibold leading-none tracking-tight",oe=m.forwardRef(({className:t,...s},a)=>e.jsx($.Title,{ref:a,className:c.cn(Ht,t),...s}));oe.displayName="DialogTitle";const Lt="text-sm text-muted-foreground",ke=m.forwardRef(({className:t,...s},a)=>e.jsx($.Description,{ref:a,className:c.cn(Lt,t),...s}));ke.displayName="DialogDescription";const Bt=m.forwardRef(({className:t,orientation:s="horizontal",decorative:a=!0,...n},o)=>e.jsx(Ws.Root,{ref:o,decorative:a,orientation:s,className:c.cn("shrink-0 bg-border",s==="horizontal"?"h-px w-full":"h-full w-px",t),...n}));Bt.displayName="Separator";const ra=W.cva("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground",outline:"text-foreground",success:"border-transparent bg-emerald-500/15 text-emerald-700 dark:text-emerald-300",warning:"border-transparent bg-amber-500/15 text-amber-700 dark:text-amber-300"}},defaultVariants:{variant:"default"}}),he=m.forwardRef(({className:t,variant:s,...a},n)=>e.jsx("div",{ref:n,className:c.cn(ra({variant:s}),t),...a}));he.displayName="Badge";const oa=Ne.Root,Vt=m.forwardRef(({className:t,...s},a)=>e.jsx(Ne.List,{ref:a,className:c.cn("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...s}));Vt.displayName="TabsList";const qt=m.forwardRef(({className:t,...s},a)=>e.jsx(Ne.Trigger,{ref:a,className:c.cn("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...s}));qt.displayName="TabsTrigger";const Ot=m.forwardRef(({className:t,...s},a)=>e.jsx(Ne.Content,{ref:a,className:c.cn("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...s}));Ot.displayName="TabsContent";const $e=z.Root,ia=z.Group,Ue=z.Value,Se=h.forwardRef(({className:t,children:s,...a},n)=>e.jsxs(z.Trigger,{ref:n,className:c.cn("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...a,children:[s,e.jsx(z.Icon,{asChild:!0,children:e.jsx(u.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));Se.displayName=z.Trigger.displayName;const Ge=h.forwardRef(({className:t,...s},a)=>e.jsx(z.ScrollUpButton,{ref:a,className:c.cn("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(u.ChevronUp,{className:"h-4 w-4"})}));Ge.displayName=z.ScrollUpButton.displayName;const Ke=h.forwardRef(({className:t,...s},a)=>e.jsx(z.ScrollDownButton,{ref:a,className:c.cn("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(u.ChevronDown,{className:"h-4 w-4"})}));Ke.displayName=z.ScrollDownButton.displayName;const ze=h.forwardRef(({className:t,children:s,position:a="popper",...n},o)=>e.jsx(z.Portal,{children:e.jsxs(z.Content,{ref:o,className:c.cn("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:a,...n,children:[e.jsx(Ge,{}),e.jsx(z.Viewport,{className:c.cn("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),e.jsx(Ke,{})]})}));ze.displayName=z.Content.displayName;const $t=h.forwardRef(({className:t,...s},a)=>e.jsx(z.Label,{ref:a,className:c.cn("px-2 py-1.5 text-sm font-semibold",t),...s}));$t.displayName=z.Label.displayName;const Te=h.forwardRef(({className:t,children:s,...a},n)=>e.jsxs(z.Item,{ref:n,className:c.cn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(z.ItemIndicator,{children:e.jsx(u.Check,{className:"h-4 w-4"})})}),e.jsx(z.ItemText,{children:s})]}));Te.displayName=z.Item.displayName;const Ut=h.forwardRef(({className:t,...s},a)=>e.jsx(z.Separator,{ref:a,className:c.cn("-mx-1 my-1 h-px bg-muted",t),...s}));Ut.displayName=z.Separator.displayName;const la=W.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Re=h.forwardRef(({className:t,...s},a)=>e.jsx(pt.Root,{ref:a,className:c.cn(la(),t),...s}));Re.displayName=pt.Root.displayName;const Gt=h.forwardRef(({className:t,...s},a)=>e.jsx(Ee.Root,{ref:a,className:c.cn("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...s,children:e.jsx(Ee.Indicator,{className:c.cn("grid place-content-center text-current"),children:e.jsx(u.Check,{className:"h-4 w-4"})})}));Gt.displayName=Ee.Root.displayName;const We=Be.Root,Ye=Be.CollapsibleTrigger,Qe=Be.CollapsibleContent,ca=["friendly","professional","casual","concise","playful","academic"],Pe={name:"",description:"",icon:"🤖",systemPrompt:"",tone:"friendly",suggestions:""};function da(t){return{id:t.id,name:t.name,description:t.description??"",icon:t.icon??"🤖",systemPrompt:t.systemPrompt,tone:t.tone??"friendly",suggestions:(t.suggestions??[]).join(`
2
+ `)}}function Kt({open:t,onOpenChange:s,activeAgentId:a,onApply:n,startInCreate:o=!1}){const[l,i]=m.useState([]),[d,f]=m.useState("list"),[r,p]=m.useState(Pe),x=()=>i(A.listAgents());m.useEffect(()=>{t&&(x(),f(o?"edit":"list"),p(Pe))},[t,o]);const N=()=>{p(Pe),f("edit")},C=b=>{p(da(b)),f("edit")},w=r.name.trim().length>0&&r.systemPrompt.trim().length>0,v=()=>{if(!w)return;const b=A.saveAgent({id:r.id,name:r.name,description:r.description,icon:r.icon,systemPrompt:r.systemPrompt,tone:r.tone,suggestions:r.suggestions.split(`
3
+ `)});x(),n(b),s(!1)};return e.jsx(qe,{open:t,onOpenChange:s,children:e.jsx(Ce,{className:"max-w-lg gap-0 overflow-hidden p-0",children:d==="list"?e.jsx(ua,{agents:l,activeAgentId:a,onCreate:N,onEdit:C,onApply:b=>{n(b),s(!1)},onDuplicate:b=>{A.duplicateAgent(b),x()},onDelete:b=>{A.deleteAgent(b),x()}}):e.jsx(ma,{draft:r,setDraft:p,canSave:w,onBack:()=>f("list"),onSave:v})})})}function ua({agents:t,activeAgentId:s,onCreate:a,onEdit:n,onApply:o,onDuplicate:l,onDelete:i}){return e.jsxs(e.Fragment,{children:[e.jsxs(ne,{className:"border-b border-border/60 p-5 pb-4",children:[e.jsx(oe,{children:"Agents"}),e.jsx(ke,{children:"Switch, create, edit, or remove your assistant agents."})]}),e.jsx("div",{className:"max-h-[55vh] space-y-1.5 overflow-y-auto p-3 scrollbar-thin",children:t.map(d=>{const f=d.id===s;return e.jsxs("div",{className:c.cn("group/agent flex items-center gap-3 rounded-xl border p-2.5 transition-colors",f?"border-primary/40 bg-primary/5":"border-border/60 hover:bg-accent/50"),children:[e.jsx("span",{className:"grid size-9 shrink-0 place-items-center rounded-lg bg-muted text-lg",children:d.icon??"🤖"}),e.jsxs(y,{type:"button",variant:"ghost",onClick:()=>o(d),className:"h-auto min-w-0 flex-1 flex-col items-stretch justify-start gap-0 p-0 text-left hover:bg-transparent",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:d.name}),f&&e.jsx(u.Check,{className:"size-3.5 shrink-0 text-primary"}),d.builtIn&&e.jsx(he,{variant:"secondary",className:"text-[9px]",children:"built-in"})]}),d.description&&e.jsx("span",{className:"block truncate text-xs font-normal text-muted-foreground",children:d.description})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover/agent:opacity-100 focus-within:opacity-100",children:[e.jsx(Ie,{label:"Duplicate",onClick:()=>l(d.id),children:e.jsx(u.Copy,{className:"size-3.5"})}),!d.builtIn&&e.jsxs(e.Fragment,{children:[e.jsx(Ie,{label:"Edit",onClick:()=>n(d),children:e.jsx(u.Pencil,{className:"size-3.5"})}),e.jsx(Ie,{label:"Delete",destructive:!0,onClick:()=>i(d.id),children:e.jsx(u.Trash2,{className:"size-3.5"})})]})]})]},d.id)})}),e.jsx(re,{className:"border-t border-border/60 p-4",children:e.jsxs(y,{onClick:a,className:"w-full gap-2 sm:w-auto",children:[e.jsx(u.Plus,{className:"size-4"}),"New agent"]})})]})}function ma({draft:t,setDraft:s,canSave:a,onBack:n,onSave:o}){const l=(i,d)=>s({...t,[i]:d});return e.jsxs(e.Fragment,{children:[e.jsx(ne,{className:"border-b border-border/60 p-5 pb-4",children:e.jsxs(oe,{className:"flex items-center gap-2",children:[e.jsx(y,{type:"button",variant:"ghost",size:"icon-sm",onClick:n,"aria-label":"Back to list",className:"text-muted-foreground hover:text-foreground",children:e.jsx(u.ArrowLeft,{className:"size-4"})}),t.id?"Edit agent":"New agent"]})}),e.jsxs("div",{className:"max-h-[55vh] space-y-4 overflow-y-auto p-5 scrollbar-thin",children:[e.jsxs("div",{className:"flex gap-3",children:[e.jsx(ee,{label:"Icon",className:"w-20",children:e.jsx(L,{value:t.icon,onChange:i=>l("icon",i.target.value.slice(0,2)),className:"text-center text-lg",maxLength:2})}),e.jsx(ee,{label:"Name",className:"flex-1",children:e.jsx(L,{value:t.name,onChange:i=>l("name",i.target.value),placeholder:"e.g. SQL expert"})})]}),e.jsx(ee,{label:"Description",children:e.jsx(L,{value:t.description,onChange:i=>l("description",i.target.value),placeholder:"One-line summary (optional)"})}),e.jsx(ee,{label:"System prompt",children:e.jsx(X,{value:t.systemPrompt,onChange:i=>l("systemPrompt",i.target.value),placeholder:"You are a helpful assistant that…",className:"min-h-28 resize-y"})}),e.jsx(ee,{label:"Tone",children:e.jsxs($e,{value:t.tone,onValueChange:i=>l("tone",i),children:[e.jsx(Se,{className:"capitalize",children:e.jsx(Ue,{placeholder:"Select a tone"})}),e.jsx(ze,{children:ca.map(i=>e.jsx(Te,{value:i,className:"capitalize",children:i},i))})]})}),e.jsx(ee,{label:"Starter suggestions",hint:"one per line",children:e.jsx(X,{value:t.suggestions,onChange:i=>l("suggestions",i.target.value),placeholder:`Explain a concept
4
+ Review my code`,className:"min-h-20 resize-y"})})]}),e.jsxs(re,{className:"gap-2 border-t border-border/60 p-4",children:[e.jsx(y,{variant:"ghost",onClick:n,children:"Cancel"}),e.jsxs(y,{onClick:o,disabled:!a,className:"gap-2",children:[e.jsx(u.Check,{className:"size-4"}),"Save & use"]})]})]})}function ee({label:t,hint:s,className:a,children:n}){return e.jsxs("div",{className:c.cn("space-y-1.5",a),children:[e.jsxs(Re,{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[t,s&&e.jsxs("span",{className:"text-muted-foreground/60",children:["· ",s]})]}),n]})}function Ie({label:t,destructive:s,onClick:a,children:n}){return e.jsx(y,{type:"button",variant:"ghost",size:"icon-sm","aria-label":t,onClick:a,className:c.cn("text-muted-foreground hover:bg-foreground/10",s?"hover:text-destructive":"hover:text-foreground"),children:n})}const Wt="ai-schadcn-theme";function pa(){if(typeof document>"u")return"light";if(document.documentElement.classList.contains("dark"))return"dark";try{const t=localStorage.getItem(Wt);if(t==="light"||t==="dark")return t}catch{}return window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}function ct(t){const s=document.documentElement;s.classList.toggle("dark",t==="dark"),s.style.colorScheme=t}function Yt({className:t}){const[s,a]=m.useState("light");m.useEffect(()=>{const l=pa();a(l),ct(l)},[]);const n=m.useCallback(()=>{a(l=>{const i=l==="dark"?"light":"dark";ct(i);try{localStorage.setItem(Wt,i)}catch{}return i})},[]),o=s==="dark";return e.jsxs(G,{children:[e.jsx(K,{asChild:!0,children:e.jsxs(y,{type:"button",variant:"ghost",size:"icon-sm",onClick:n,"aria-label":o?"Switch to light mode":"Switch to dark mode",className:["relative",t].filter(Boolean).join(" "),children:[e.jsx(u.Sun,{className:"size-4 rotate-0 scale-100 transition-all duration-300 dark:-rotate-90 dark:scale-0"}),e.jsx(u.Moon,{className:"absolute size-4 rotate-90 scale-0 transition-all duration-300 dark:rotate-0 dark:scale-100"})]})}),e.jsx(O,{children:o?"Light mode":"Dark mode"})]})}function Qt({className:t}){const s=B.useChat(),a=s.config,n=a.ui??{},[o,l]=m.useState(!1),[i,d]=m.useState(!1),[f,r]=m.useState(!1),[p,x]=m.useState(!1),[N,C]=m.useState(()=>A.getActiveAgentId()),w=A.listAgents(),v=w.find(j=>j.id===N)??w.find(j=>j.name===a.personality?.name),b=n.showModelSelector??!0,k=n.showDocumentPicker??!0,S=n.showToolCalls??!0,I=n.enableConversationHistory??!0,V=j=>{s.updateConfig({systemPrompt:j.systemPrompt,personality:{...a.personality,name:j.name,tone:j.tone,avatar:j.icon,...j.locale?{locale:j.locale}:{}},ui:{...n,title:j.name,...j.suggestions&&j.suggestions.length>0?{suggestions:j.suggestions}:{}}}),A.setActiveAgentId(j.id),C(j.id),l(!1)},F=j=>{x(j),r(!0),l(!1)},_=j=>{const E=a.documents??[],H=E.find(Z=>Z.id===j.id)?E.filter(Z=>Z.id!==j.id):[...E,j];s.updateConfig({documents:H})},Ae=[{id:"built-in:web",name:"Web search guidance",description:"Cites sources and flags primary vs. aggregated info.",alwaysOn:!1,body:"When unsure, prefer citing authoritative web sources and link to them. Distinguish between primary sources and aggregators."},{id:"built-in:code",name:"Code reviewer",description:"Checks bugs, security, perf, readability & test coverage.",alwaysOn:!1,body:"When reviewing code, point out: 1) correctness bugs, 2) security implications, 3) performance, 4) readability, 5) test coverage. Suggest minimal patches."},{id:"built-in:sql",name:"SQL guardrails",description:"Blocks unsafe SQL; requires WHERE clauses & parameters.",alwaysOn:!1,body:"Never write destructive SQL without a WHERE clause. Prefer parameterized queries. Always state the table schema when joining."}],le=a.documents?.length??0,ce=s.listConversationsMeta();return e.jsxs("header",{className:c.cn("relative z-20 flex items-center justify-between gap-2 border-b border-border/60 bg-background/70 px-3 py-2.5 backdrop-blur-xl supports-[backdrop-filter]:bg-background/55 sm:px-4",t),children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{className:"relative grid size-9 shrink-0 place-items-center rounded-xl grad-primary text-primary-foreground shadow-sm glow-primary",children:v?.icon?e.jsx("span",{className:"text-lg leading-none",children:v.icon}):e.jsx(u.Sparkles,{className:"size-[18px]"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-semibold tracking-tight",children:n.title??"Assistant"}),e.jsxs("p",{className:"flex items-center gap-1.5 truncate text-xs text-muted-foreground",children:[e.jsx("span",{className:"inline-block size-1.5 shrink-0 rounded-full bg-success shadow-[0_0_6px_currentColor]"}),e.jsx("span",{className:"truncate",children:n.subtitle??(a.model.label||a.model.id||"Ready")})]})]})]}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[b&&e.jsxs(me,{open:o,onOpenChange:l,children:[e.jsx(pe,{asChild:!0,children:e.jsxs(y,{variant:"ghost",size:"sm",className:"hidden h-8 max-w-[180px] gap-1.5 rounded-lg px-2.5 text-xs font-medium text-muted-foreground hover:text-foreground sm:inline-flex",children:[e.jsx("span",{className:"text-sm leading-none",children:v?.icon??"✨"}),e.jsx("span",{className:"truncate",children:v?.name??a.personality?.name??"Agent"}),e.jsx(u.ChevronDown,{className:"size-3 shrink-0 opacity-50"})]})}),e.jsxs(se,{align:"end",className:"w-64",children:[e.jsx(xe,{children:"Agents"}),e.jsx("div",{className:"max-h-64 overflow-y-auto",children:w.map(j=>e.jsxs(U,{onClick:()=>V(j),className:"gap-2",children:[e.jsx("span",{className:"text-base leading-none",children:j.icon??"🤖"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:j.name}),j.id===v?.id&&e.jsx(u.Check,{className:"size-3.5 shrink-0 text-primary"})]},j.id))}),e.jsx(ae,{}),e.jsxs(U,{onClick:()=>F(!0),children:[e.jsx(u.Plus,{className:"size-3.5"}),"New agent"]}),e.jsxs(U,{onClick:()=>F(!1),children:[e.jsx(u.Settings2,{className:"size-3.5"}),"Manage agents…"]})]})]}),k&&e.jsxs(me,{open:i,onOpenChange:d,children:[e.jsxs(G,{children:[e.jsx(K,{asChild:!0,children:e.jsx(pe,{asChild:!0,children:e.jsxs(y,{variant:"ghost",size:"sm",className:"h-8 gap-1.5 rounded-lg px-2.5 text-xs font-medium text-muted-foreground hover:text-foreground",children:[e.jsx(u.FileText,{className:"size-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Docs"}),le>0&&e.jsx(he,{variant:"secondary",className:"ml-0.5 h-4 min-w-4 justify-center rounded-full px-1 text-[9px] tabular-nums",children:le})]})})}),e.jsx(O,{children:"Context documents — extra instructions prepended to the model's system prompt"})]}),e.jsxs(se,{align:"end",className:"w-72",children:[e.jsx(xe,{children:"Context documents"}),Ae.map(j=>{const E=(a.documents??[]).some(H=>H.id===j.id);return e.jsx(U,{onClick:()=>_(j),className:"items-start gap-2",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("span",{className:"flex items-center gap-2 truncate",children:[j.name,E&&e.jsx(he,{variant:"secondary",className:"ml-auto text-[9px]",children:"on"})]}),j.description&&e.jsx("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:j.description})]})},j.id)}),e.jsx(ae,{}),e.jsx("p",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"Toggle a doc to prepend it to the model's context."})]})]}),e.jsx("span",{className:"mx-1 hidden h-5 w-px bg-border/70 sm:block"}),e.jsxs(G,{children:[e.jsx(K,{asChild:!0,children:e.jsx(y,{variant:"ghost",size:"icon-sm",className:"rounded-lg text-muted-foreground hover:text-foreground","aria-label":"New chat",onClick:()=>s.newConversation(),children:e.jsx(u.MessageSquarePlus,{className:"size-4"})})}),e.jsx(O,{children:"New chat"})]}),I&&e.jsxs(me,{children:[e.jsxs(G,{children:[e.jsx(K,{asChild:!0,children:e.jsx(pe,{asChild:!0,children:e.jsx(y,{variant:"ghost",size:"icon-sm",className:"rounded-lg text-muted-foreground hover:text-foreground","aria-label":"Conversation history",children:e.jsx(u.History,{className:"size-4"})})})}),e.jsx(O,{children:"History"})]}),e.jsxs(se,{align:"end",className:"w-72",children:[e.jsx(xe,{children:"Conversation history"}),e.jsx(ae,{}),ce.length===0?e.jsxs("p",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:["No conversations yet.",e.jsx("br",{}),"Send a message to start one."]}):e.jsx("div",{className:"max-h-72 overflow-y-auto",children:ce.map(j=>{const E=j.id===s.conversationId;return e.jsxs("div",{className:c.cn("group/conv flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors",E?"bg-accent":"hover:bg-accent/60"),children:[e.jsxs(y,{type:"button",variant:"ghost",onClick:()=>s.setConversationId(j.id),className:"h-auto min-w-0 flex-1 justify-start gap-2 p-0 text-left font-normal hover:bg-transparent",children:[E?e.jsx(u.Check,{className:"size-3.5 shrink-0 text-primary"}):e.jsx("span",{className:"size-3.5 shrink-0"}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block truncate font-medium",children:j.title}),e.jsxs("span",{className:"block truncate text-[11px] text-muted-foreground",children:[j.messageCount," msg",j.updatedAt?` · ${xa(j.updatedAt)}`:""]})]})]}),e.jsx(y,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Delete conversation",onClick:H=>{H.stopPropagation(),s.deleteConversation(j.id)},className:"size-7 shrink-0 text-muted-foreground opacity-0 transition-opacity hover:bg-foreground/10 hover:text-destructive group-hover/conv:opacity-100",children:e.jsx(u.Trash2,{className:"size-3.5"})})]},j.id)})})]})]}),e.jsx(Yt,{className:"rounded-lg text-muted-foreground hover:text-foreground"}),S&&s.getActiveToolCallCount()>0&&e.jsxs(G,{children:[e.jsx(K,{asChild:!0,children:e.jsxs("div",{className:"inline-flex h-7 items-center gap-1 rounded-lg border border-border/60 bg-card/60 px-2 text-xs font-medium text-muted-foreground","aria-label":`${s.getActiveToolCallCount()} tool calls in progress`,children:[e.jsx(u.Wrench,{className:"size-3.5 animate-pulse"}),e.jsx("span",{className:"font-mono",children:s.getActiveToolCallCount()})]})}),e.jsxs(O,{children:[s.getActiveToolCallCount()," tool call",s.getActiveToolCallCount()===1?"":"s"," in progress"]})]}),e.jsxs(me,{children:[e.jsx(pe,{asChild:!0,children:e.jsx(y,{variant:"ghost",size:"icon-sm",className:"rounded-lg text-muted-foreground hover:text-foreground","aria-label":"More",children:e.jsx(u.MoreHorizontal,{className:"size-4"})})}),e.jsxs(se,{align:"end",children:[e.jsxs(U,{onClick:()=>F(!1),children:[e.jsx(u.Settings2,{className:"size-3.5"}),"Manage agents…"]}),e.jsx(ae,{}),e.jsxs(U,{onClick:()=>s.clear(),className:"text-destructive focus:text-destructive",children:[e.jsx(u.Trash2,{className:"size-3.5"}),"Clear this conversation"]})]})]})]}),e.jsx(Kt,{open:f,onOpenChange:r,activeAgentId:v?.id??null,onApply:V,startInCreate:p})]})}function xa(t){const s=Date.now()-t,a=Math.round(s/6e4);if(a<1)return"just now";if(a<60)return`${a}m ago`;const n=Math.round(a/60);if(n<24)return`${n}h ago`;const o=Math.round(n/24);if(o<7)return`${o}d ago`;try{return new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric"})}catch{return""}}function fa(){return typeof window>"u"?null:window.SpeechRecognition??window.webkitSpeechRecognition??null}function ga(t={}){const s=m.useRef(null),a=m.useRef(null),[n,o]=m.useState(!1),[l,i]=m.useState(!1),[d,f]=m.useState(null),[r,p]=m.useState("");m.useEffect(()=>{const C=fa();return s.current=C,o(C!==null),()=>{a.current?.abort(),a.current=null}},[]);const x=m.useCallback(()=>{const C=s.current;if(!C){f("Speech recognition is not supported in this browser.");return}if(a.current)return;f(null),p("");const w=new C;w.lang=t.lang??(typeof navigator<"u"?navigator.language:"en-US"),w.continuous=t.continuous??!1,w.interimResults=!0,w.onresult=v=>{let b="";for(let k=v.resultIndex;k<v.results.length;k++){const S=v.results[k];S&&S[0]&&(b+=S[0].transcript)}if(b){p(b);const k=v.results[v.results.length-1]?.isFinal??!1;t.onResult?.(b,k)}},w.onerror=v=>{const b=v.error??v.message??"Voice recognition error";f(b),i(!1),a.current=null},w.onend=()=>{i(!1),a.current=null};try{w.start(),a.current=w,i(!0)}catch(v){f(v instanceof Error?v.message:String(v)),i(!1),a.current=null}},[t.lang,t.continuous,t.onResult]),N=m.useCallback(()=>{if(a.current)try{a.current.stop()}catch{}},[]);return{supported:n,listening:l,error:d,start:x,stop:N,transcript:r}}const ha=[{value:"anthropic",label:"Anthropic (native)"},{value:"openai",label:"OpenAI (native)"},{value:"openai-compatible",label:"OpenAI-compatible"}],_e={name:"",icon:"🔌",kind:"openai-compatible",baseUrl:"",apiKey:"",models:""};function ba(t){return{id:t.id,name:t.name,icon:t.icon??"🔌",kind:t.kind,baseUrl:t.baseUrl,apiKey:t.apiKey,models:A.modelsToText(t.models)}}function Xt({open:t,onOpenChange:s,activeProviderId:a,onApply:n,startInCreate:o=!1}){const[l,i]=m.useState([]),[d,f]=m.useState("list"),[r,p]=m.useState(_e),x=()=>i(A.listProviders());m.useEffect(()=>{t&&(x(),f(o?"edit":"list"),p(_e))},[t,o]);const N=r.name.trim().length>0&&r.baseUrl.trim().length>0,C=()=>{if(!N)return;const w=A.saveProvider({id:r.id,name:r.name,icon:r.icon,kind:r.kind,baseUrl:r.baseUrl,apiKey:r.apiKey,models:A.parseModelsText(r.models,r.kind)});x(),n(w),s(!1)};return e.jsx(qe,{open:t,onOpenChange:s,children:e.jsx(Ce,{className:"max-w-lg gap-0 overflow-hidden p-0",children:d==="list"?e.jsx(va,{providers:l,activeProviderId:a,onCreate:()=>{p(_e),f("edit")},onEdit:w=>{p(ba(w)),f("edit")},onApply:w=>{n(w),s(!1)},onDuplicate:w=>{A.duplicateProvider(w),x()},onDelete:w=>{A.deleteProvider(w),x()},onReset:()=>{A.resetProviders(),x()}}):e.jsx(ja,{draft:r,setDraft:p,canSave:N,onBack:()=>f("list"),onSave:C})})})}function va({providers:t,activeProviderId:s,onCreate:a,onEdit:n,onApply:o,onDuplicate:l,onDelete:i,onReset:d}){const f=t.find(p=>p.id===s),r=t.filter(p=>p.id!==f?.id);return e.jsxs(e.Fragment,{children:[e.jsxs(ne,{className:"border-b border-border/60 p-5 pb-3",children:[e.jsx(oe,{children:"Providers & models"}),e.jsx(ke,{className:"text-xs",children:"Any OpenAI / Anthropic-compatible API. Keys stay in your browser."})]}),e.jsxs("div",{className:"max-h-[58vh] overflow-y-auto p-2 scrollbar-thin",children:[f&&e.jsxs(e.Fragment,{children:[e.jsx(dt,{children:"Active"}),e.jsx(ut,{p:f,active:!0,onApply:o,onEdit:n,onDuplicate:l,onDelete:i}),e.jsx("div",{className:"h-2"})]}),e.jsx(dt,{children:f?"Available":"Providers"}),r.map(p=>e.jsx(ut,{p,onApply:o,onEdit:n,onDuplicate:l,onDelete:i},p.id))]}),e.jsxs(re,{className:"flex-row items-center justify-between border-t border-border/60 p-4 sm:justify-between",children:[e.jsxs(y,{variant:"ghost",size:"sm",onClick:d,className:"gap-1.5 text-muted-foreground",children:[e.jsx(u.RotateCcw,{className:"size-3.5"}),"Reset defaults"]}),e.jsxs(y,{onClick:a,className:"gap-2",children:[e.jsx(u.Plus,{className:"size-4"}),"New provider"]})]})]})}function ja({draft:t,setDraft:s,canSave:a,onBack:n,onSave:o}){const l=(i,d)=>s({...t,[i]:d});return e.jsxs(e.Fragment,{children:[e.jsx(ne,{className:"border-b border-border/60 p-5 pb-4",children:e.jsxs(oe,{className:"flex items-center gap-2",children:[e.jsx(y,{type:"button",variant:"ghost",size:"icon-sm",onClick:n,"aria-label":"Back to list",className:"text-muted-foreground hover:text-foreground",children:e.jsx(u.ArrowLeft,{className:"size-4"})}),t.id?"Edit provider":"New provider"]})}),e.jsxs("div",{className:"max-h-[55vh] space-y-4 overflow-y-auto p-5 scrollbar-thin",children:[e.jsxs("div",{className:"flex gap-3",children:[e.jsx(te,{label:"Icon",className:"w-20",children:e.jsx(L,{value:t.icon,onChange:i=>l("icon",i.target.value.slice(0,2)),className:"text-center text-lg",maxLength:2})}),e.jsx(te,{label:"Name",className:"flex-1",children:e.jsx(L,{value:t.name,onChange:i=>l("name",i.target.value),placeholder:"e.g. Groq"})})]}),e.jsx(te,{label:"Protocol",children:e.jsxs($e,{value:t.kind,onValueChange:i=>l("kind",i),children:[e.jsx(Se,{children:e.jsx(Ue,{})}),e.jsx(ze,{children:ha.map(i=>e.jsx(Te,{value:i.value,children:i.label},i.value))})]})}),e.jsx(te,{label:"Base URL",children:e.jsx(L,{value:t.baseUrl,onChange:i=>l("baseUrl",i.target.value),placeholder:"https://api.example.com/v1",className:"font-mono text-xs"})}),e.jsx(te,{label:"API key",hint:"stored in your browser",children:e.jsx(L,{type:"password",value:t.apiKey,onChange:i=>l("apiKey",i.target.value),placeholder:"sk-…",className:"font-mono text-xs",autoComplete:"off"})}),e.jsx(te,{label:"Models",hint:"one per line · id | Label",children:e.jsx(X,{value:t.models,onChange:i=>l("models",i.target.value),placeholder:`gpt-4o | GPT-4o
5
+ gpt-4o-mini | GPT-4o mini`,className:"min-h-24 resize-y font-mono text-xs"})})]}),e.jsxs(re,{className:"gap-2 border-t border-border/60 p-4",children:[e.jsx(y,{variant:"ghost",onClick:n,children:"Cancel"}),e.jsxs(y,{onClick:o,disabled:!a,className:"gap-2",children:[e.jsx(u.Check,{className:"size-4"}),"Save & use"]})]})]})}function dt({children:t}){return e.jsx("p",{className:"px-2 pb-1 pt-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:t})}function ya(t){return t.replace(/^https?:\/\//,"")}function ut({p:t,active:s,onApply:a,onEdit:n,onDuplicate:o,onDelete:l}){return e.jsxs("div",{className:c.cn("group/prov flex items-center gap-2.5 rounded-lg px-2 py-1.5 transition-colors",s?"bg-primary/8 ring-1 ring-primary/20":"hover:bg-accent/50"),children:[e.jsx("span",{className:"grid size-8 shrink-0 place-items-center rounded-md bg-muted text-base",children:t.icon??"🔌"}),e.jsxs(y,{type:"button",variant:"ghost",onClick:()=>a(t),className:"h-auto min-w-0 flex-1 flex-col items-stretch justify-start gap-0.5 p-0 text-left hover:bg-transparent",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:t.name}),s&&e.jsx(u.Check,{className:"size-3.5 shrink-0 text-primary"})]}),e.jsxs("span",{className:"flex items-center gap-1.5 truncate text-[11px] font-normal text-muted-foreground",children:[e.jsx("span",{className:c.cn("size-1.5 shrink-0 rounded-full",t.apiKey?"bg-success":"bg-muted-foreground/40"),title:t.apiKey?"API key set":"No API key"}),e.jsx("span",{className:"truncate font-mono",children:ya(t.baseUrl)}),e.jsxs("span",{className:"shrink-0 text-muted-foreground/60",children:["· ",t.models.length," model",t.models.length===1?"":"s"]})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity focus-within:opacity-100 group-hover/prov:opacity-100",children:[e.jsx(y,{variant:"ghost",size:"icon-sm","aria-label":"Duplicate",onClick:()=>o(t.id),className:"text-muted-foreground hover:text-foreground",children:e.jsx(u.Copy,{className:"size-3.5"})}),e.jsx(y,{variant:"ghost",size:"icon-sm","aria-label":"Edit",onClick:()=>n(t),className:"text-muted-foreground hover:text-foreground",children:e.jsx(u.Pencil,{className:"size-3.5"})}),e.jsx(y,{variant:"ghost",size:"icon-sm","aria-label":"Delete",onClick:()=>l(t.id),className:"text-muted-foreground hover:text-destructive",children:e.jsx(u.Trash2,{className:"size-3.5"})})]})]})}function te({label:t,hint:s,className:a,children:n}){return e.jsxs("div",{className:c.cn("space-y-1.5",a),children:[e.jsxs(Re,{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[t,s&&e.jsxs("span",{className:"text-muted-foreground/60",children:["· ",s]})]}),n]})}const wa=W.cva("group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-2xl border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/30 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed",{variants:{size:{default:"gap-2 text-sm has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2 has-data-[slot=attachment-media]:p-2",sm:"gap-2.5 text-xs has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5",xs:"gap-1.5 rounded-xl text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1"},orientation:{horizontal:"min-w-40 items-center",vertical:"w-24 flex-col has-data-[slot=attachment-content]:w-30"}}});function Xe({className:t,state:s="done",size:a="default",orientation:n="horizontal",...o}){const l=n??"horizontal";return e.jsx("div",{"data-slot":"attachment","data-state":s,"data-size":a,"data-orientation":l,className:c.cn(wa({size:a,orientation:n}),t),...o})}const Na=W.cva("relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-foreground group-data-[orientation=vertical]/attachment:w-full group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 group-data-[size=xs]/attachment:rounded-md group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive group-data-[orientation=vertical]/attachment:*:data-[slot=spinner]:size-6! [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5",{variants:{variant:{icon:"",image:"opacity-60 group-data-[state=done]/attachment:opacity-100 group-data-[state=idle]/attachment:opacity-100 *:[img]:aspect-square *:[img]:w-full *:[img]:object-cover"}},defaultVariants:{variant:"icon"}});function je({className:t,variant:s="icon",...a}){return e.jsx("div",{"data-slot":"attachment-media","data-variant":s,className:c.cn(Na({variant:s}),t),...a})}function Je({className:t,...s}){return e.jsx("div",{"data-slot":"attachment-content",className:c.cn("max-w-full min-w-0 flex-1 leading-tight group-data-[orientation=vertical]/attachment:px-1",t),...s})}function Ze({className:t,...s}){return e.jsx("span",{"data-slot":"attachment-title",className:c.cn("block max-w-full min-w-0 truncate font-medium group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer",t),...s})}function et({className:t,...s}){return e.jsx("span",{"data-slot":"attachment-description",className:c.cn("mt-0.5 block min-w-0 truncate text-xs text-muted-foreground group-data-[state=error]/attachment:text-destructive/80","max-w-full",t),...s})}function Jt({className:t,...s}){return e.jsx("div",{"data-slot":"attachment-actions",className:c.cn("relative z-20 flex shrink-0 items-center group-data-[orientation=vertical]/attachment:absolute group-data-[orientation=vertical]/attachment:top-3 group-data-[orientation=vertical]/attachment:right-3 group-data-[orientation=vertical]/attachment:gap-1",t),...s})}function Zt({className:t,variant:s,size:a="icon-sm",...n}){return e.jsx(y,{"data-slot":"attachment-action",variant:s??"ghost",size:a,className:c.cn(t),...n})}function Ca({className:t,asChild:s=!1,type:a,...n}){const o=s?we.Slot:"button";return e.jsx(o,{"data-slot":"attachment-trigger",type:s?void 0:a??"button",className:c.cn("absolute inset-0 z-10 outline-none",t),...n})}function ka({className:t,...s}){return e.jsx("div",{"data-slot":"attachment-group",className:c.cn("flex min-w-0 scroll-fade-x snap-x snap-mandatory scroll-px-1 scrollbar-none gap-3 overflow-x-auto overscroll-x-contain py-1 *:data-[slot=attachment]:flex-none *:data-[slot=attachment]:snap-start",t),...s})}function Sa(t){return t==="application/pdf"?u.FileType:t==="application/json"?u.FileJson:t.startsWith("text/csv")||t==="text/csv"?u.FileCode:t.startsWith("text/")?u.FileText:u.File}function za(t){return!t||t==="application/octet-stream"?"file":t.startsWith("image/")?t.slice(6).toUpperCase():t==="application/pdf"?"PDF":t==="application/json"?"JSON":t.startsWith("text/")?t.slice(5).toUpperCase():t}function tt({att:t,state:s="done",onRemove:a}){const n=t.mimeType??t.mime??"",o=n.startsWith("image/")&&!!t.dataUrl,l=Sa(n);return e.jsxs(Xe,{size:"default",state:s,className:"w-56 max-w-full bg-background/60",children:[o?e.jsx(je,{variant:"image",className:"size-11 rounded-lg ring-1 ring-border/60",children:e.jsx("img",{src:t.dataUrl,alt:t.name,loading:"lazy"})}):e.jsx(je,{className:"size-11 rounded-lg text-primary",children:e.jsx(l,{className:"size-5"})}),e.jsxs(Je,{children:[e.jsx(Ze,{children:t.name}),e.jsxs(et,{children:[c.formatBytes(t.size)," · ",za(n)]})]}),a&&e.jsx(Jt,{children:e.jsx(Zt,{"aria-label":"Remove attachment",onClick:a,children:e.jsx(u.X,{className:"size-3.5"})})})]})}function es(t){const{onSend:s,streaming:a,disabled:n,renderSendButton:o,className:l,contentClassName:i}=t,d=B.useChat(),f=d.config,r=f.ui??{},[p,x]=m.useState(""),[N,C]=m.useState([]),[w,v]=m.useState(0),[b,k]=m.useState(null),S=m.useRef(null),I=g=>{k(g),S.current!==null&&window.clearTimeout(S.current),S.current=window.setTimeout(()=>k(null),4e3)};m.useEffect(()=>()=>{S.current!==null&&window.clearTimeout(S.current)},[]);const[V,F]=m.useState(!1),_=m.useRef(null),Ae=m.useRef(null),le=m.useRef(null),ce=m.useRef(0),j=200;m.useLayoutEffect(()=>{const g=le.current;if(!g)return;const T=ce.current;g.style.height="auto";const M=Math.min(g.scrollHeight,j);T&&T!==M&&(g.style.height=`${T}px`,g.offsetHeight),g.style.height=`${M}px`,ce.current=M},[p]);const E=a??d.isStreaming,H=!E&&!n&&(p.trim().length>0||N.length>0),Z=r.enableFileUpload??!0,ys=r.enableVoiceInput??!1,q=ga({onResult:g=>{x(T=>{const M=T.length>0&&!T.endsWith(" ")?" ":"";return T+M+g})}}),[ws,st]=m.useState(!1),[Ns,Cs]=m.useState(!1),[at,ks]=m.useState(()=>A.getActiveProviderId()),nt=(g,T)=>{const M=d.config.provider,de=g.apiKey||(M.baseUrl===g.baseUrl?M.credentials?.apiKey??"":"");d.updateConfig(A.profileToConfig({...g,apiKey:de},T)),A.setActiveProviderId(g.id),ks(g.id)},Me=async()=>{if(!H)return;const g=p.trim();x("");const T=N;C([]),s?await s(g,T):await d.send(g,T)},Ss=g=>{g.key==="Enter"&&!g.shiftKey&&!g.nativeEvent.isComposing&&(g.preventDefault(),Me())},rt=m.useCallback(async g=>{const T=Array.from(g),M=r.maxFileSizeMb??10,de=r.acceptedFileTypes??[],be=T.filter(R=>R.size>M*1024*1024),ot=be.length>0,De=be.length>0?T.filter(R=>R.size<=M*1024*1024):T,ue=de.length>0?De.filter(R=>de.some(Y=>R.type===Y||R.type.startsWith(`${Y}/`))):De,ve=De.length-ue.length;if(ot||ve>0){const R=[];ot&&R.push(`${be.length} file${be.length===1?"":"s"} over ${M} MB`),ve>0&&R.push(`${ve} file${ve===1?"":"s"} with unsupported type`);const Y=`Rejected ${R.join(" and ")}.`;if(console.warn(`[MessageInput] ${Y}`,{maxMb:M,acceptedTypes:de}),I(Y),ue.length===0)return}v(R=>R+ue.length);try{const R=await mt.filesToAttachments(ue,f);C(Y=>[...Y,...R])}catch(R){d.config.onError?.({code:"bad_request",message:(R instanceof Error?R.message:String(R))??"File upload failed",retryable:!1},{conversationId:d.conversationId})}finally{v(R=>Math.max(0,R-ue.length))}},[f,d.config,d.conversationId,r.maxFileSizeMb,r.acceptedFileTypes]),zs=g=>{g.target.files&&rt(g.target.files),g.target.value=""},Ts=g=>{g.preventDefault(),F(!1),g.dataTransfer.files&&rt(g.dataTransfer.files)},Rs=g=>{Z&&(g.preventDefault(),F(!0))},As=g=>{C(T=>T.filter(M=>M.id!==g.id))},Ms=g=>{Cs(g),st(!0)};return e.jsxs("form",{ref:Ae,onSubmit:g=>{g.preventDefault(),Me()},className:c.cn("relative z-10 px-3 pb-3 pt-2 sm:px-4 sm:pb-4",l),onDragOver:Rs,onDragLeave:()=>F(!1),onDrop:Ts,children:[e.jsxs("div",{className:c.cn("mx-auto w-full max-w-3xl rounded-2xl border bg-card/80 p-2 backdrop-blur-xl transition-[box-shadow,border-color] duration-200","border-border/70 shadow-[0_2px_8px_-4px_oklch(var(--foreground)/0.1)]","focus-within:border-primary/50 focus-within:shadow-[0_0_0_1px_oklch(var(--primary)/0.35),0_10px_30px_-12px_oklch(var(--glow)/0.5)]",V&&"border-primary/60 ring-2 ring-primary/30",i),children:[(N.length>0||w>0)&&e.jsxs("div",{className:"flex max-h-44 flex-wrap gap-2 overflow-y-auto px-1 pb-2 pt-1 scrollbar-thin",children:[N.map(g=>e.jsx(tt,{att:g,onRemove:()=>As(g)},g.id)),Array.from({length:w}).map((g,T)=>e.jsxs(Xe,{size:"sm",state:"uploading",children:[e.jsx(je,{children:e.jsx(u.Loader2,{className:"size-4 animate-spin"})}),e.jsxs(Je,{children:[e.jsx(Ze,{children:"Uploading…"}),e.jsx(et,{children:"reading file"})]})]},`uploading-${T}`))]}),e.jsxs("div",{className:"flex items-end gap-1.5",children:[Z&&e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:_,type:"file",hidden:!0,multiple:!0,onChange:zs,accept:(r.acceptedFileTypes??[]).join(",")}),e.jsxs(G,{children:[e.jsx(K,{asChild:!0,children:e.jsx(y,{type:"button",variant:"ghost",size:"icon",className:"size-9 shrink-0 rounded-xl text-muted-foreground hover:text-foreground",onClick:()=>_.current?.click(),"aria-label":"Attach files",disabled:n,children:e.jsx(u.Paperclip,{className:"size-[18px]"})})}),e.jsx(O,{children:"Attach files (images, PDFs, text)"})]})]}),ys&&q.supported&&e.jsxs(G,{children:[e.jsx(K,{asChild:!0,children:e.jsx(y,{type:"button",variant:q.listening?"destructive":"ghost",size:"icon",className:c.cn("size-9 shrink-0 rounded-xl text-muted-foreground hover:text-foreground",q.listening&&"ring-2 ring-primary/60 animate-pulse"),onClick:()=>{q.listening?q.stop():q.start()},"aria-label":q.listening?"Stop dictation":"Start dictation",disabled:n,children:q.listening?e.jsx(u.MicOff,{className:"size-[18px]"}):e.jsx(u.Mic,{className:"size-[18px]"})})}),e.jsx(O,{children:q.listening?"Stop dictation":"Start dictation"})]}),e.jsx(X,{ref:le,value:p,onChange:g=>x(g.target.value),onKeyDown:Ss,placeholder:r.placeholder??"Ask anything…",rows:1,disabled:n,className:"max-h-[200px] min-h-[40px] flex-1 resize-none overflow-y-auto border-0 bg-transparent px-1 py-2 text-[0.9375rem] shadow-none scrollbar-thin transition-[height] duration-150 ease-out focus-visible:ring-0 focus-visible:ring-offset-0 motion-reduce:transition-none"}),e.jsx(Ta,{currentModelId:f.model.id,activeProviderId:at,onPick:nt,onManage:()=>Ms(!1)}),E?e.jsx(y,{type:"button",variant:"destructive",size:"icon",className:"size-9 shrink-0 rounded-xl",onClick:()=>d.abort(),"aria-label":"Stop generating",children:e.jsx(u.Square,{className:"size-3.5 fill-current"})}):o?o({disabled:!H,onClick:()=>void Me()}):e.jsx(y,{type:"submit",size:"icon",disabled:!H,"aria-label":"Send message",className:c.cn("size-9 shrink-0 rounded-xl border-0 text-primary-foreground transition-all",H?"grad-primary glow-primary hover:brightness-110":"bg-muted text-muted-foreground"),children:e.jsx(u.Send,{className:"size-4"})})]})]}),e.jsxs("p",{className:c.cn("mx-auto mt-2 max-w-3xl px-1 text-center text-[11px] text-muted-foreground/70",i),children:["Press"," ",e.jsx("kbd",{className:"rounded border border-border/70 bg-muted/60 px-1 font-sans text-[10px]",children:"Enter"})," ","to send ·"," ",e.jsx("kbd",{className:"rounded border border-border/70 bg-muted/60 px-1 font-sans text-[10px]",children:"Shift+Enter"})," ","for a new line"]}),b&&e.jsx("p",{role:"status",className:"mx-auto mt-1 max-w-3xl px-1 text-center text-[11px] text-destructive",children:b}),V&&e.jsxs("div",{className:"pointer-events-none absolute inset-2 flex items-center justify-center gap-2 rounded-2xl border-2 border-dashed border-primary/50 bg-primary/5 text-sm font-medium text-primary backdrop-blur-sm",children:[e.jsx(u.FileText,{className:"size-4"}),"Drop files to attach"]}),e.jsx(Xt,{open:ws,onOpenChange:st,activeProviderId:at,onApply:g=>nt(g),startInCreate:Ns})]})}function Ta({currentModelId:t,activeProviderId:s,onPick:a,onManage:n}){const[o,l]=m.useState(!1),[i,d]=m.useState(""),f=m.useMemo(()=>o?A.listProviders():[],[o]),r=i.toLowerCase(),p=f.map(x=>({provider:x,models:x.models.filter(N=>!r||N.id.toLowerCase().includes(r)||(N.label??"").toLowerCase().includes(r)||x.name.toLowerCase().includes(r))})).filter(x=>x.models.length>0);return e.jsxs(At,{open:o,onOpenChange:l,children:[e.jsx(Mt,{asChild:!0,children:e.jsxs(y,{type:"button",variant:"ghost",size:"sm",className:"hidden h-9 shrink-0 gap-1 rounded-xl border border-border/60 px-2.5 text-xs font-medium text-muted-foreground hover:text-foreground sm:inline-flex","aria-label":"Select model",children:[e.jsx("span",{className:"max-w-[120px] truncate font-mono text-[11px]",children:t||"Select model"}),e.jsx(u.ChevronDown,{className:"size-3 opacity-60"})]})}),e.jsxs(Ve,{align:"end",className:"w-80 p-0",children:[e.jsx("div",{className:"border-b p-2",children:e.jsx(L,{type:"text",placeholder:"Search providers & models…",value:i,onChange:x=>d(x.target.value),className:"h-8 text-xs"})}),e.jsx("div",{className:"max-h-72 overflow-y-auto p-1",children:p.length===0?e.jsx("div",{className:"p-4 text-center text-xs text-muted-foreground",children:"No models found"}):p.map(({provider:x,models:N})=>e.jsxs("div",{className:"mb-1",children:[e.jsxs("p",{className:"flex items-center gap-1.5 px-2 py-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:[e.jsx("span",{className:"text-sm leading-none",children:x.icon}),x.name,!x.apiKey&&e.jsx("span",{className:"rounded bg-muted px-1 text-[8px] normal-case text-muted-foreground/70",children:"no key"})]}),N.map(C=>{const w=C.id===t&&x.id===s;return e.jsxs(y,{type:"button",variant:"ghost",onClick:()=>{a(x,C),l(!1)},className:c.cn("h-auto w-full justify-between gap-2 rounded-sm px-2 py-1.5 text-left text-xs font-normal",w&&"bg-accent/50"),children:[e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block truncate font-medium",children:C.label??C.id}),e.jsx("span",{className:"block truncate font-mono text-[10px] text-muted-foreground",children:C.id})]}),w&&e.jsx(u.Check,{className:"size-3.5 shrink-0 text-primary"})]},`${x.id}:${C.id}`)})]},x.id))}),e.jsx("div",{className:"border-t p-1",children:e.jsxs(y,{type:"button",variant:"ghost",size:"sm",onClick:()=>{l(!1),n()},className:"h-8 w-full justify-start gap-2 rounded-sm px-2 text-xs font-normal text-muted-foreground hover:text-foreground",children:[e.jsx(u.Settings2,{className:"size-3.5"}),"Manage providers & models…"]})})]})]})}function Ra({className:t,...s}){return e.jsx("div",{"data-slot":"bubble-group",className:c.cn("flex min-w-0 flex-col gap-2",t),...s})}const Aa=W.cva("group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full",{variants:{variant:{default:"*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80",secondary:"*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",muted:"*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]",tinted:"*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]",outline:"*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30",ghost:"border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50",destructive:"*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30"}},defaultVariants:{variant:"default"}});function ts({variant:t="default",align:s="start",className:a,...n}){return e.jsx("div",{"data-slot":"bubble","data-variant":t,"data-align":s,className:c.cn(Aa({variant:t}),a),...n})}function ss({asChild:t=!1,className:s,...a}){const n=t?we.Slot:"div";return e.jsx(n,{"data-slot":"bubble-content",className:c.cn("w-fit max-w-full min-w-0 overflow-hidden rounded-3xl border border-transparent px-3 py-2.5 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/30",s),...a})}const Ma=W.cva("absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0",{variants:{side:{top:"top-0 -translate-y-3/4",bottom:"bottom-0 translate-y-3/4"},align:{start:"left-3",end:"right-3"}},defaultVariants:{side:"bottom",align:"end"}});function Da({side:t="bottom",align:s="end",className:a,...n}){return e.jsx("div",{"data-slot":"bubble-reactions","data-align":s,"data-side":t,className:c.cn(Ma({side:t,align:s}),a),...n})}function Pa({className:t,...s}){return e.jsx("div",{"data-slot":"message-group",className:c.cn("flex min-w-0 flex-col gap-2",t),...s})}function as({className:t,align:s="start",...a}){return e.jsx("div",{"data-slot":"message","data-align":s,className:c.cn("group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse",t),...a})}function ns({className:t,...s}){return e.jsx("div",{"data-slot":"message-avatar",className:c.cn("flex w-fit min-w-8 shrink-0 items-center justify-center self-end overflow-hidden rounded-full bg-muted group-has-data-[slot=message-footer]/message:-translate-y-8",t),...s})}function rs({className:t,...s}){return e.jsx("div",{"data-slot":"message-content",className:c.cn("flex w-full min-w-0 flex-col gap-2.5 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end",t),...s})}function Ia({className:t,...s}){return e.jsx("div",{"data-slot":"message-header",className:c.cn("flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0",t),...s})}function ye({className:t,...s}){return e.jsx("div",{"data-slot":"message-footer",className:c.cn("flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0 group-data-[align=end]/message:justify-end",t),...s})}class _a{state={viewportEl:null,scrollHeight:0,scrollTop:0,viewportHeight:0,autoScroll:!1};listeners=new Set;getState=()=>this.state;subscribe=s=>(this.listeners.add(s),()=>{this.listeners.delete(s)});setState=s=>{this.state={...this.state,...s};for(const a of this.listeners)a()}}const os=h.createContext(null);function J(){const t=h.useContext(os);if(!t)throw new Error("MessageScroller primitives must be used within MessageScrollerProvider.");return t}function Ea(t){const{autoScroll:s=!1,defaultScrollPosition:a="end",scrollEdgeThreshold:n=4,contentSignal:o="",children:l}=t,i=h.useRef(null);i.current===null&&(i.current=new _a);const d=h.useRef([]),f=h.useRef(!1),r=h.useCallback(b=>(d.current=[...d.current,b],()=>{d.current=d.current.filter(k=>k.id!==b.id)}),[]),p=h.useCallback((b,k={})=>{const S=i.current.getState().viewportEl;if(!S)return;const I=d.current[b];if(!I?.element)return;const V=I.element.offsetTop,F=k.align??"start";let _=V;F==="end"?_=V+I.element.offsetHeight-S.clientHeight:F==="center"&&(_=V+I.element.offsetHeight/2-S.clientHeight/2),_=Math.max(0,_),typeof S.scrollTo=="function"?S.scrollTo({top:_,behavior:k.behavior??"smooth"}):S.scrollTop=_},[]),x=h.useCallback(b=>p(d.current.length-1,{align:"end",...b}),[p]),N=h.useCallback(b=>p(0,{align:"start",...b}),[p]),C=h.useCallback((b,k)=>{const S=d.current.findIndex(I=>I.id===b);S>=0&&p(S,k)},[p]);h.useEffect(()=>{const b=i.current;return b.subscribe(()=>{!b.getState().viewportEl||f.current||requestAnimationFrame(()=>{f.current||(a==="end"?x({behavior:"auto"}):N({behavior:"auto"}),f.current=!0)})})},[a,x,N]),h.useEffect(()=>{i.current.setState({autoScroll:s})},[s]);const w=h.useRef(x);h.useEffect(()=>{w.current=x},[x]),h.useEffect(()=>{if(!s)return;const b=i.current,k=requestAnimationFrame(()=>{const S=b.getState();!S.viewportEl||S.scrollHeight-S.scrollTop-S.viewportHeight>n||w.current({behavior:"auto"})});return()=>cancelAnimationFrame(k)},[s,o,n,i]);const v=h.useMemo(()=>({registerMessage:r,stateStore:i.current,scrollToIndex:p,scrollToEnd:x,scrollToStart:N,scrollToMessage:C}),[r,p,x,N,C]);return e.jsx(os.Provider,{value:v,children:l})}function Fa(){const{scrollToEnd:t,scrollToStart:s,scrollToMessage:a}=J();return h.useMemo(()=>({scrollToEnd:t,scrollToStart:s,scrollToMessage:a}),[t,s,a])}function is(){const{stateStore:t}=J();return h.useSyncExternalStore(t.subscribe,t.getState,t.getState)}function ls(){const{stateStore:t}=J(),s=h.useRef({atEnd:!1,atStart:!0});return h.useSyncExternalStore(t.subscribe,()=>{const a=t.getState(),o=a.scrollHeight-a.scrollTop-a.viewportHeight<32,l=a.scrollTop<32,i=s.current;if(i.atEnd===o&&i.atStart===l)return i;const d={atEnd:o,atStart:l};return s.current=d,d},()=>({atEnd:!1,atStart:!0}))}const Ha=h.forwardRef(function({children:t,...s},a){return e.jsx("div",{ref:a,...s,children:t})}),La=h.forwardRef(function({children:t,onScroll:s,...a},n){const o=h.useRef(null),l=h.useCallback(d=>{o.current=d,typeof n=="function"?n(d):n&&(n.current=d)},[n]),{stateStore:i}=J();return h.useEffect(()=>{const d=o.current;if(d)return i.setState({viewportEl:d,scrollHeight:d.scrollHeight,scrollTop:d.scrollTop,viewportHeight:d.clientHeight}),()=>i.setState({viewportEl:null})},[i]),h.useLayoutEffect(()=>{const d=o.current;if(!d)return;const f=()=>i.setState({scrollHeight:d.scrollHeight,scrollTop:d.scrollTop,viewportHeight:d.clientHeight});d.addEventListener("scroll",f,{passive:!0});const r=new ResizeObserver(f);return r.observe(d),f(),()=>{d.removeEventListener("scroll",f),r.disconnect()}},[i]),e.jsx("div",{ref:l,onScroll:d=>{s?.(d)},...a,children:t})}),Ba=h.forwardRef(function({children:s,...a},n){const o=h.useRef(null),{stateStore:l}=J(),i=h.useRef(null),d=h.useRef(s),f=h.useCallback(r=>{o.current=r,typeof n=="function"?n(r):n&&(n.current=r)},[n]);return h.useEffect(()=>{const r=o.current;if(!r)return;const p=i.current,x=d.current;if(d.current=s,!p||x===s||r.scrollHeight-p.scrollHeight<=0||p.scrollTop>8)return;const w=requestAnimationFrame(()=>{if(!o.current)return;const v=o.current.scrollHeight,b=v-p.scrollHeight;b>0&&(o.current.scrollTop=p.scrollTop+b,l.setState({scrollTop:p.scrollTop+b,scrollHeight:v}))});return()=>cancelAnimationFrame(w)},[s,l]),h.useLayoutEffect(()=>{const r=o.current;if(!r)return;const p=()=>{i.current={scrollTop:r.scrollTop,scrollHeight:r.scrollHeight}},x=requestAnimationFrame(p);return r.addEventListener("scroll",p,{passive:!0}),()=>{cancelAnimationFrame(x),r.removeEventListener("scroll",p)}},[]),e.jsx("div",{ref:f,...a,children:s})}),Va=h.forwardRef(function({id:t,scrollAnchor:s,children:a,...n},o){const{registerMessage:l}=J(),i=h.useRef(null),d=h.useId(),f=t??d,r=h.useCallback(p=>{i.current=p,typeof o=="function"?o(p):o&&(o.current=p)},[o]);return h.useEffect(()=>l({id:f,element:i.current,scrollAnchor:s}),[f,s,l]),e.jsx("div",{ref:r,...n,children:a})}),qa=h.forwardRef(function({direction:t="end",render:s,onClick:a,children:n,...o},l){const{stateStore:i,scrollToEnd:d,scrollToStart:f}=J(),r=ls(),p=t==="end",x=p?!r.atEnd:!r.atStart;is();const N=C=>{a?.(C),p?d():f()};return s?h.cloneElement(s,{ref:l,onClick:N,"data-active":x,"data-direction":t,...o,children:n??s.props.children}):e.jsx("button",{ref:l,type:"button","data-active":x,"data-direction":t,onClick:N,...o,children:n})}),ie={Provider:Ea,Root:Ha,Viewport:La,Content:Ba,Item:Va,Button:qa};function cs(t){return e.jsx(ie.Provider,{...t})}function ds({className:t,...s}){return e.jsx(ie.Root,{"data-slot":"message-scroller",className:c.cn("group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden",t),...s})}function Fe({className:t,...s}){return e.jsx(ie.Viewport,{"data-slot":"message-scroller-viewport",className:c.cn("size-full min-h-0 min-w-0 scroll-fade-b scrollbar-thin scrollbar-gutter-stable overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-none",t),...s})}function us({className:t,...s}){return e.jsx(ie.Content,{"data-slot":"message-scroller-content",className:c.cn("flex h-max min-h-full flex-col gap-8",t),...s})}function ms({className:t,scrollAnchor:s=!1,...a}){return e.jsx(ie.Item,{"data-slot":"message-scroller-item",scrollAnchor:s,className:c.cn("min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]",t),...a})}function ps({direction:t="end",className:s,children:a,render:n,variant:o="secondary",size:l="icon-sm",...i}){return e.jsx(ie.Button,{"data-slot":"message-scroller-button","data-direction":t,"data-variant":o,"data-size":l,direction:t,className:c.cn("absolute left-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180",s),render:n??e.jsx(y,{variant:o,size:l}),...i,children:a??e.jsxs(e.Fragment,{children:[e.jsx(u.ArrowDownIcon,{}),e.jsx("span",{className:"sr-only",children:t==="end"?"Scroll to end":"Scroll to start"})]})})}const xs=W.cva("group/marker relative flex min-h-4 w-full items-center gap-2 text-left text-sm text-muted-foreground [&_svg:not([class*='size-'])]:size-4 [a]:underline [a]:underline-offset-3 [a]:hover:text-foreground",{variants:{variant:{default:"",separator:"before:mr-1 before:h-px before:min-w-0 before:flex-1 before:bg-border after:ml-1 after:h-px after:min-w-0 after:flex-1 after:bg-border",border:"border-b border-border pb-2"}}});function fs({className:t,variant:s="default",asChild:a=!1,...n}){const o=a?we.Slot:"div";return e.jsx(o,{"data-slot":"marker","data-variant":s,className:c.cn(xs({variant:s,className:t})),...n})}function gs({className:t,...s}){return e.jsx("span",{"data-slot":"marker-icon","aria-hidden":"true",className:c.cn("size-4 shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...s})}function hs({className:t,...s}){return e.jsx("span",{"data-slot":"marker-content",className:c.cn("min-w-0 wrap-break-word group-data-[variant=separator]/marker:flex-none group-data-[variant=separator]/marker:text-center *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",t),...s})}function Oa({getText:t}){const[s,a]=m.useState(!1);return e.jsx(y,{type:"button",variant:"ghost","aria-label":"Copy code",onClick:()=>{try{navigator.clipboard?.writeText(t()),a(!0),setTimeout(()=>a(!1),1600)}catch{}},className:"h-7 gap-1.5 px-2 text-[11px] font-medium text-muted-foreground hover:bg-foreground/10 hover:text-foreground",children:s?e.jsxs(e.Fragment,{children:[e.jsx(u.Check,{className:"size-3 text-success"})," Copied"]}):e.jsxs(e.Fragment,{children:[e.jsx(u.Copy,{className:"size-3"})," Copy"]})})}function He(t){if(t==null||typeof t=="boolean")return"";if(typeof t=="string"||typeof t=="number")return String(t);if(Array.isArray(t))return t.map(He).join("");if(typeof t=="object"&&"props"in t){const s=t.props;return He(s?.children)}return""}function $a(t){if(!t||t.enabled===!1)return c.cn("ai-prose","text-[0.9375rem] leading-relaxed");const s=t.preset&&t.preset!=="default"?`typeset-${t.preset}`:"typeset";return c.cn(s,"text-[var(--typeset-size)]")}function Ua(t){if(!t||t.enabled===!1)return;const s={};return t.size&&(s["--typeset-size"]=t.size),typeof t.leading=="number"&&(s["--typeset-leading"]=t.leading),t.flow&&(s["--typeset-flow"]=t.flow),t.fontBody&&(s["--typeset-font-body"]=t.fontBody),t.fontHeading&&(s["--typeset-font-heading"]=t.fontHeading),t.fontMono&&(s["--typeset-font-mono"]=t.fontMono),Object.keys(s).length>0?s:void 0}const bs=m.memo(function({children:s,className:a,typeset:n,enableCodeHighlight:o=!0,enableCopyButtons:l=!0}){const i=$a(n),d=Ua(n),f=o?[it,[Us,{detect:!0,ignoreMissing:!0}]]:[it];return e.jsx("div",{className:c.cn(i,a),style:d,children:e.jsx($s,{remarkPlugins:[Gs],rehypePlugins:f,components:{p:({children:r})=>e.jsx("p",{className:"my-2.5",children:r}),a:({children:r,href:p})=>e.jsx("a",{href:p,target:"_blank",rel:"noreferrer noopener",className:"font-medium text-primary underline decoration-primary/30 underline-offset-2 transition-colors hover:decoration-primary",children:r}),img:({src:r,alt:p})=>e.jsx("img",{src:typeof r=="string"?r:void 0,alt:p??"",loading:"lazy",className:"my-2 h-auto max-h-80 max-w-full rounded-xl border border-border object-contain"}),ul:({children:r})=>e.jsx("ul",{className:"my-2.5 list-disc space-y-1 pl-5 marker:text-muted-foreground",children:r}),ol:({children:r})=>e.jsx("ol",{className:"my-2.5 list-decimal space-y-1 pl-5 marker:text-muted-foreground",children:r}),li:({children:r})=>e.jsx("li",{className:"pl-1",children:r}),h1:({children:r})=>e.jsx("h1",{className:"mb-2 mt-4 text-lg font-semibold tracking-tight",children:r}),h2:({children:r})=>e.jsx("h2",{className:"mb-2 mt-4 text-base font-semibold tracking-tight",children:r}),h3:({children:r})=>e.jsx("h3",{className:"mb-1.5 mt-3 text-sm font-semibold tracking-tight",children:r}),blockquote:({children:r})=>e.jsx("blockquote",{className:"my-3 rounded-r-md border-l-2 border-primary/40 bg-primary/5 py-1 pl-3 text-muted-foreground",children:r}),hr:()=>e.jsx("hr",{className:"my-4 border-border"}),table:({children:r})=>e.jsx("div",{className:"my-3 overflow-x-auto rounded-lg border border-border",children:e.jsx("table",{className:"w-full border-collapse text-sm",children:r})}),thead:({children:r})=>e.jsx("thead",{className:"bg-muted/60",children:r}),th:({children:r})=>e.jsx("th",{className:"border-b border-border px-3 py-2 text-left font-semibold",children:r}),td:({children:r})=>e.jsx("td",{className:"border-b border-border/60 px-3 py-2 align-top",children:r}),code:({className:r,children:p,...x})=>/language-/.test(r??"")?e.jsx("code",{className:r,...x,children:p}):e.jsx("code",{className:"rounded-md border border-border/70 bg-muted/70 px-1.5 py-0.5 font-mono text-[0.85em] text-foreground",...x,children:p}),pre:({children:r})=>{const p=Ga(r);return e.jsxs("div",{className:"group/code my-3 overflow-hidden rounded-xl border border-border bg-[oklch(0.16_0.02_285)] shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-white/10 bg-white/[0.03] px-3 py-1.5",children:[e.jsx("span",{className:"font-mono text-[11px] font-medium uppercase tracking-wide text-white/50",children:p||"code"}),l&&e.jsx(Oa,{getText:()=>He(r)})]}),e.jsx("pre",{className:"overflow-x-auto px-4 py-3 text-[0.8125rem] leading-relaxed text-white/90 [&_code]:bg-transparent [&_code]:p-0",children:r})]})}},children:s})})});function Ga(t){const s=Array.isArray(t)?t[0]:t,a=s&&typeof s=="object"&&"props"in s&&s.props?.className||"",n=/language-([\w-]+)/.exec(a);return n?n[1]:""}function vs({reasoning:t,active:s}){const[a,n]=m.useState(!!s);return m.useEffect(()=>{n(!!s)},[s]),t.trim()?e.jsxs(We,{open:a,onOpenChange:n,className:"w-fit max-w-full",children:[e.jsx(Ye,{asChild:!0,children:e.jsxs(y,{type:"button",variant:"ghost",size:"sm",className:"group/think h-7 gap-1.5 rounded-lg px-2 text-xs font-medium text-muted-foreground hover:bg-foreground/5 hover:text-foreground",children:[e.jsx(u.Lightbulb,{className:c.cn("size-3.5",s&&"text-primary")}),s?e.jsx("span",{className:"shimmer",children:"Thinking…"}):"Thought process",e.jsx(u.ChevronRight,{className:"size-3 opacity-60 transition-transform group-data-[state=open]/think:rotate-90"})]})}),e.jsx(Qe,{children:e.jsx("div",{className:"mt-1 max-h-72 overflow-y-auto whitespace-pre-wrap rounded-xl bg-muted/40 p-3 text-xs leading-relaxed text-muted-foreground scrollbar-thin",children:t.trim()})})]}):null}function Ka(t){let s="",a=t.replace(/<think(?:ing)?>([\s\S]*?)<\/think(?:ing)?>/gi,(o,l)=>(s+=(s?`
6
+ `:"")+l,""));const n=/<think(?:ing)?>/i.exec(a);return n&&(s+=(s?`
7
+ `:"")+a.slice(n.index+n[0].length),a=a.slice(0,n.index)),{think:s.trim(),answer:a.trim()}}const Wa=["Explain a tricky concept simply","Write and review a code snippet","Brainstorm ideas with me","Summarize a long document"];function js({className:t,contentClassName:s}){const a=B.useChat(),n=a.messages,o=n.at(-1),l=o?`${o.id}:${o.content?.length??0}`:"";return e.jsx(cs,{autoScroll:!0,defaultScrollPosition:"end",contentSignal:l,children:e.jsxs(ds,{className:c.cn("relative flex-1",t),children:[n.length===0?e.jsx(Fe,{children:e.jsx(Ya,{})}):e.jsx(Fe,{children:e.jsx(us,{className:c.cn("mx-auto w-full max-w-3xl gap-5 px-3 py-6 sm:px-5",s),children:n.map((i,d)=>e.jsx(ms,{id:i.id,scrollAnchor:d===n.length-1,children:e.jsx(Qa,{message:i,isStreaming:a.isStreaming&&d===n.length-1})},i.id))})}),e.jsx(ps,{direction:"end",className:"size-9 rounded-full surface-elevated text-foreground/80 backdrop-blur",children:e.jsx(u.ArrowDown,{className:"size-4"})})]})})}function Ya(){const t=B.useChat(),s=t.config,a=s.ui??{},n=a.greeting??"How can I help you today?",o=a.suggestions??Wa;return a.emptyState?e.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center",children:a.emptyState}):e.jsxs("div",{className:"mx-auto flex h-full w-full max-w-2xl flex-col items-center justify-center px-4 py-10 text-center",children:[e.jsxs("div",{className:"animate-message-in relative mb-6 grid size-16 place-items-center rounded-2xl grad-primary text-primary-foreground glow-primary-strong",children:[e.jsx(u.Sparkles,{className:"size-7"}),e.jsx("span",{className:"ring-conic absolute -inset-px -z-10 rounded-2xl opacity-40 blur-md"})]}),e.jsx("h2",{className:"text-balance text-2xl font-semibold tracking-tight sm:text-3xl",children:n}),e.jsxs("p",{className:"mt-2 max-w-md text-pretty text-sm text-muted-foreground",children:["Ask anything, or start with one of these. Powered by"," ",e.jsx("span",{className:"font-medium text-foreground",children:s.model.label??s.model.id}),"."]}),e.jsx("div",{className:"mt-8 grid w-full grid-cols-1 gap-2.5 sm:grid-cols-2",children:o.map((l,i)=>e.jsxs(y,{type:"button",variant:"outline",onClick:()=>void t.send(l),style:{animationDelay:`${i*60}ms`},className:"animate-message-in group h-auto justify-start gap-3 whitespace-normal rounded-xl border-border/70 bg-card/60 px-4 py-3 text-left text-sm font-normal transition-all hover:-translate-y-0.5 hover:border-primary/40 hover:bg-card hover:shadow-[0_8px_24px_-12px_oklch(var(--glow)/0.4)]",children:[e.jsx("span",{className:"grid size-7 shrink-0 place-items-center rounded-lg bg-primary/10 text-primary transition-colors group-hover:bg-primary/15",children:e.jsx(u.Sparkles,{className:"size-3.5"})}),e.jsx("span",{className:"text-pretty text-foreground/90",children:l})]},l))})]})}function Qa({message:t,isStreaming:s}){const a=B.useChat(),o=a.config.ui??{},[l,i]=m.useState(!1),d=t.status==="error",f=!d&&t.role==="user"?"end":"start",r=!d&&t.role==="user",p=nn(t.role,t.status),x=r?mt.extractMessageText(t.content):t.content,{think:N,answer:C}=r?{think:"",answer:x}:Ka(x),w=r?"":[t.reasoning,N].filter(Boolean).join(`
8
+ `).trim(),v=r?x:C,b=t.status==="streaming"&&v.trim().length===0&&w.length===0;return e.jsxs(as,{align:f,className:"animate-message-in",children:[!r&&e.jsx(ns,{className:"bg-transparent",children:e.jsx(rn,{role:d?"assistant":t.role})}),e.jsxs(rs,{children:[t.attachments&&t.attachments.length>0&&e.jsx("div",{className:c.cn("flex flex-wrap gap-2",f==="end"&&"justify-end"),children:t.attachments.map(k=>e.jsx(tt,{att:k},k.id))}),w.length>0&&e.jsx(vs,{reasoning:w,active:t.status==="streaming"}),l?e.jsx(Za,{initial:v,onCancel:()=>i(!1),onSave:k=>{i(!1),k.trim()&&k.trim()!==v.trim()&&a.editAndResend(t.id,k.trim())}}):(v.trim().length>0||b)&&e.jsx(ts,{variant:p,align:f,children:e.jsxs(ss,{className:c.cn(r?"surface-tinted text-foreground":"surface-elevated"),children:[b?e.jsx(en,{}):e.jsx(tn,{message:t,isUser:r,text:v}),t.status==="streaming"&&!b&&e.jsx("span",{className:"ml-0.5 inline-block h-4 w-[3px] translate-y-0.5 animate-pulse rounded-full bg-current align-text-bottom"})]})}),t.toolCalls&&t.toolCalls.length>0&&e.jsx("div",{className:"flex flex-col gap-1",children:t.toolCalls.map(k=>e.jsxs(fs,{variant:"default",children:[e.jsx(gs,{children:k.status==="error"?e.jsx(u.AlertTriangle,{}):k.status==="complete"?e.jsx(u.Check,{}):e.jsx(u.Loader2,{className:"animate-spin"})}),e.jsxs(hs,{children:[e.jsx("span",{className:"font-mono",children:k.name}),k.status==="error"?" failed":k.status==="complete"?"":" …"]})]},k.id))}),d&&e.jsx("div",{className:"self-start",children:e.jsx(an,{error:t.error,onRetry:()=>void a.regenerate()})}),!r&&t.status==="complete"&&e.jsx(Ja,{message:t,answer:v}),!l&&!b&&v.trim().length>0&&e.jsx(Xa,{message:t,copyText:v,align:f,isUser:r,showTimestamp:o.showTimestamps??!0,onEdit:r?()=>i(!0):void 0,onDelete:()=>a.deleteMessage(t.id),showActions:o.enableMessageActions??!0,showRegenerate:o.enableRegenerate??!0,showEdit:r&&(o.enableEditAndResend??!0)}),s&&!b&&e.jsx(ye,{children:e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-primary",children:[e.jsx(u.Loader2,{className:"size-3 animate-spin"}),"Generating…"]})}),t.role==="tool"&&t.name&&e.jsx(ye,{children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(u.Wrench,{className:"size-3"}),"tool · ",e.jsx("span",{className:"font-mono",children:t.name})]})})]})]})}function Xa({message:t,copyText:s,align:a,isUser:n,showTimestamp:o,onEdit:l,onDelete:i,showActions:d=!0,showRegenerate:f=!0,showEdit:r=!0}){const p=B.useChat(),[x,N]=m.useState(!1),C=t.role==="assistant",w=()=>{try{navigator.clipboard?.writeText(s),N(!0),setTimeout(()=>N(!1),1600)}catch{}},v="size-7 text-muted-foreground hover:bg-foreground/10 hover:text-foreground";return d?e.jsxs(ye,{className:c.cn("w-fit gap-0.5 opacity-0 transition-opacity duration-150 focus-within:opacity-100 group-hover/message:opacity-100",a==="end"&&"flex-row-reverse self-end"),children:[e.jsx(y,{type:"button",variant:"ghost",size:"icon-sm",onClick:w,"aria-label":"Copy message",className:v,children:x?e.jsx(u.Check,{className:"size-3.5 text-success"}):e.jsx(u.Copy,{className:"size-3.5"})}),C&&f&&e.jsx(y,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>void p.regenerate(),"aria-label":"Regenerate response",className:v,children:e.jsx(u.RotateCcw,{className:"size-3.5"})}),n&&l&&r&&e.jsx(y,{type:"button",variant:"ghost",size:"icon-sm",onClick:l,"aria-label":"Edit message",className:v,children:e.jsx(u.Pencil,{className:"size-3.5"})}),i&&e.jsx(y,{type:"button",variant:"ghost",size:"icon-sm",onClick:i,"aria-label":"Delete message",className:"size-7 text-muted-foreground hover:bg-foreground/10 hover:text-destructive",children:e.jsx(u.Trash2,{className:"size-3.5"})}),o&&e.jsx("span",{className:"px-1.5 text-[11px] tabular-nums text-muted-foreground/70",children:on(t.createdAt)})]}):null}function Ja({message:t,answer:s}){const a=t.usage?.completionTokens??c.estimateTokens(s),n=t.startedAt&&t.completedAt?t.completedAt-t.startedAt:void 0,o=n?n/1e3:void 0,l=a&&o&&o>0?a/o:void 0;return!a&&!o&&!t.model?null:e.jsxs("div",{className:"flex flex-wrap items-center gap-3 px-3 text-[11px] text-muted-foreground/70",children:[t.model&&e.jsxs("span",{className:"inline-flex items-center gap-1",title:`Generated by ${t.model}`,children:[e.jsx(u.Bot,{className:"size-3"}),t.model]}),l!==void 0&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(u.Gauge,{className:"size-3"}),l.toFixed(1)," tok/s"]}),a>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 tabular-nums",children:[e.jsx(u.Hash,{className:"size-3"}),a," tokens"]}),o!==void 0&&e.jsxs("span",{className:"inline-flex items-center gap-1 tabular-nums",children:[e.jsx(u.Clock,{className:"size-3"}),o.toFixed(2),"s"]})]})}function Za({initial:t,onSave:s,onCancel:a}){const[n,o]=m.useState(t);return e.jsxs("div",{className:"w-full max-w-[80%] self-end",children:[e.jsx(X,{autoFocus:!0,value:n,onChange:l=>o(l.target.value),onKeyDown:l=>{l.key==="Enter"&&!l.shiftKey&&(l.preventDefault(),s(n)),l.key==="Escape"&&a()},className:"min-h-16 w-full resize-y rounded-2xl surface-tinted text-sm text-foreground"}),e.jsxs("div",{className:"mt-1.5 flex justify-end gap-2",children:[e.jsx(y,{type:"button",variant:"ghost",size:"sm",onClick:a,children:"Cancel"}),e.jsxs(y,{type:"button",size:"sm",onClick:()=>s(n),className:"gap-1.5",children:[e.jsx(u.Check,{className:"size-3.5"}),"Save & resend"]})]})]})}function en(){return e.jsx("span",{className:"flex items-center gap-1 py-1","aria-label":"Assistant is typing",children:[0,1,2].map(t=>e.jsx("span",{className:"size-2 rounded-full bg-primary",style:{animation:"typing-bounce 1.2s ease-in-out infinite",animationDelay:`${t*.18}s`}},t))})}function tn({message:t,isUser:s,text:a}){const n=B.useOptionalChat(),o=n?.config.ui?.typeset,l=n?.config.ui??{},i=l.enableCodeHighlight??!0,d=l.enableCopyButtons??!0;return t.role==="tool"?e.jsx("pre",{className:"max-w-full overflow-x-auto whitespace-pre-wrap break-words font-mono text-xs",children:ln(a,1200)}):s?e.jsx("span",{className:"whitespace-pre-wrap break-words",children:a}):e.jsx(bs,{typeset:o,enableCodeHighlight:i,enableCopyButtons:d,children:a})}function sn(t){switch(t?.code){case"rate_limit":return{title:"You've hit the rate limit",body:"This model's plan is out of quota right now. Wait a moment and try again, or upgrade your plan for more usage.",Icon:u.Gauge};case"auth":return{title:"Couldn't authenticate",body:"The API key was rejected. Double-check that it's correct and has access to this model.",Icon:u.KeyRound};case"network":return{title:"Connection problem",body:"I couldn't reach the model. Check your internet connection and try again.",Icon:u.WifiOff};case"server":return{title:"The model service had a problem",body:"The provider returned an error. This is usually temporary — try again in a moment.",Icon:u.ServerCrash};case"context_overflow":return{title:"This conversation got too long",body:"It exceeded the model's context window. Start a new chat or remove some earlier messages.",Icon:u.AlertTriangle};case"aborted":return{title:"Generation stopped",body:"You stopped this response. Send again to retry.",Icon:u.AlertTriangle};case"parse":return{title:"I couldn't read the reply",body:"The model's response came back malformed. Trying again usually fixes it.",Icon:u.AlertTriangle};default:return{title:"Something went wrong",body:"An unexpected error stopped this response. Let's try again.",Icon:u.AlertTriangle}}}function an({error:t,onRetry:s}){const{title:a,body:n,Icon:o}=sn(t),l=t?.message?.trim();return e.jsx("div",{className:"w-fit max-w-[85%] rounded-3xl surface-elevated p-3 text-sm",children:e.jsxs("div",{className:"flex gap-2.5",children:[e.jsx("span",{className:"grid size-8 shrink-0 place-items-center rounded-lg bg-destructive/10 text-destructive",children:e.jsx(o,{className:"size-4"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-medium text-destructive",children:a}),e.jsx("p",{className:"mt-0.5 text-pretty text-muted-foreground",children:n}),e.jsxs("div",{className:"mt-2.5 flex flex-wrap items-center gap-2",children:[e.jsxs(y,{type:"button",size:"sm",onClick:s,className:"h-8 gap-1.5 rounded-lg text-xs",children:[e.jsx(u.RotateCcw,{className:"size-3.5"}),"Try again"]}),l&&e.jsxs(We,{className:"min-w-0",children:[e.jsx(Ye,{asChild:!0,children:e.jsxs(y,{type:"button",variant:"ghost",size:"sm",className:"h-8 gap-1 rounded-lg px-2 text-xs font-normal text-muted-foreground hover:bg-foreground/5 hover:text-foreground",children:[e.jsx(u.AlertTriangle,{className:"size-3"}),"Technical details"]})}),e.jsx(Qe,{children:e.jsxs("pre",{className:"mt-2 max-h-40 max-w-full overflow-auto whitespace-pre-wrap break-all rounded-lg bg-muted/60 p-2.5 font-mono text-[11px] leading-relaxed text-muted-foreground",children:[t?.code?`${t.code}${t.status?` · ${t.status}`:""}
9
+ `:"",l]})})]})]})]})]})})}function nn(t,s){return s==="error"?"destructive":t==="user"?"default":t==="assistant"?"secondary":"muted"}function rn({role:t}){return t==="user"?e.jsx("div",{className:"flex size-8 items-center justify-center rounded-full bg-muted text-muted-foreground ring-1 ring-border/70",children:e.jsx(u.User,{className:"size-4"})}):t==="assistant"?e.jsx("div",{className:"flex size-8 items-center justify-center rounded-full grad-primary text-primary-foreground shadow-sm glow-primary",children:e.jsx(u.Sparkles,{className:"size-4"})}):e.jsx("div",{className:"flex size-8 items-center justify-center rounded-full bg-muted text-muted-foreground",children:e.jsx(u.Wrench,{className:"size-4"})})}function on(t){try{return new Date(t).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}catch{return""}}function ln(t,s){return t.length>s?`${t.slice(0,s)}…`:t}function cn(t){const{config:s,layout:a="panel",renderHeader:n,renderFooter:o,className:l,contentClassName:i,style:d,hideHeader:f=!1,hideComposer:r=!1}=t,p=B.useOptionalChat(),x=e.jsx(Dt,{delayDuration:200,children:e.jsx(dn,{layout:a,className:l,style:d,renderHeader:n,renderFooter:o,contentClassName:i,hideHeader:f,hideComposer:r})});return p?x:e.jsx(B.ChatProvider,{config:s,children:x})}function dn({layout:t,className:s,style:a,renderHeader:n,renderFooter:o,contentClassName:l,hideHeader:i,hideComposer:d}){const r=B.useOptionalChat()?.config.ui??{},p=r.density??"comfortable",x=r.theme??"system",N=r.accentColor??"",C=r.fontFamily??"",w=t==="floating"?"fixed bottom-5 right-5 z-40 flex w-[min(420px,calc(100vw-2.5rem))] h-[min(660px,calc(100vh-2.5rem))] flex-col overflow-hidden rounded-2xl surface-elevated app-mesh":t==="fullpage"?"flex h-full w-full flex-col app-mesh":"flex h-full w-full flex-col overflow-hidden rounded-2xl surface-elevated app-mesh",v={};return N&&(v["--chat-accent"]=N),C&&(v["--chat-font-family"]=C),e.jsxs("div",{className:c.cn(w,s),style:{...a,...v},"data-density":p,"data-theme":x,children:[n?n():i?null:e.jsx(Qt,{}),e.jsx(js,{contentClassName:l}),o?o():null,d?null:e.jsx(es,{contentClassName:l})]})}exports.AgentManager=Kt;exports.Attachment=Xe;exports.AttachmentAction=Zt;exports.AttachmentActions=Jt;exports.AttachmentContent=Je;exports.AttachmentDescription=et;exports.AttachmentGroup=ka;exports.AttachmentMedia=je;exports.AttachmentPreview=tt;exports.AttachmentTitle=Ze;exports.AttachmentTrigger=Ca;exports.AvatarFallback=Tt;exports.AvatarImage=zt;exports.AvatarRoot=St;exports.Badge=he;exports.Bubble=ts;exports.BubbleContent=ss;exports.BubbleGroup=Ra;exports.BubbleReactions=Da;exports.Button=y;exports.Card=ft;exports.CardContent=vt;exports.CardDescription=bt;exports.CardFooter=jt;exports.CardHeader=gt;exports.CardTitle=ht;exports.ChatHeader=Qt;exports.ChatPanel=cn;exports.Checkbox=Gt;exports.Collapsible=We;exports.CollapsibleContent=Qe;exports.CollapsibleTrigger=Ye;exports.Dialog=qe;exports.DialogClose=na;exports.DialogContent=Ce;exports.DialogDescription=ke;exports.DialogFooter=re;exports.DialogHeader=ne;exports.DialogOverlay=Oe;exports.DialogPortal=It;exports.DialogTitle=oe;exports.DialogTrigger=aa;exports.DropdownMenu=me;exports.DropdownMenuCheckboxItem=Rt;exports.DropdownMenuContent=se;exports.DropdownMenuGroup=Js;exports.DropdownMenuItem=U;exports.DropdownMenuLabel=xe;exports.DropdownMenuPortal=Zs;exports.DropdownMenuRadioGroup=ta;exports.DropdownMenuSeparator=ae;exports.DropdownMenuSub=ea;exports.DropdownMenuTrigger=pe;exports.Input=L;exports.Label=Re;exports.Markdown=bs;exports.Marker=fs;exports.MarkerContent=hs;exports.MarkerIcon=gs;exports.Message=as;exports.MessageAvatar=ns;exports.MessageContent=rs;exports.MessageFooter=ye;exports.MessageGroup=Pa;exports.MessageHeader=Ia;exports.MessageInput=es;exports.MessageList=js;exports.MessageScroller=ds;exports.MessageScrollerButton=ps;exports.MessageScrollerContent=us;exports.MessageScrollerItem=ms;exports.MessageScrollerProvider=cs;exports.MessageScrollerViewport=Fe;exports.Popover=At;exports.PopoverAnchor=sa;exports.PopoverContent=Ve;exports.PopoverTrigger=Mt;exports.ProviderManager=Xt;exports.ReasoningPanel=vs;exports.ScrollArea=yt;exports.Select=$e;exports.SelectContent=ze;exports.SelectGroup=ia;exports.SelectItem=Te;exports.SelectLabel=$t;exports.SelectScrollDownButton=Ke;exports.SelectScrollUpButton=Ge;exports.SelectSeparator=Ut;exports.SelectTrigger=Se;exports.SelectValue=Ue;exports.Separator=Bt;exports.Switch=Pt;exports.Tabs=oa;exports.TabsContent=Ot;exports.TabsList=Vt;exports.TabsTrigger=qt;exports.Textarea=X;exports.ThemeToggle=Yt;exports.Tooltip=G;exports.TooltipContent=O;exports.TooltipProvider=Dt;exports.TooltipTrigger=K;exports.avatarClasses=Nt;exports.avatarFallbackClasses=kt;exports.avatarForeground=Xs;exports.avatarHue=Qs;exports.avatarImageClasses=Ct;exports.avatarLetter=Ys;exports.buttonVariants=xt;exports.dialogContentClasses=_t;exports.dialogDescriptionClasses=Lt;exports.dialogFooterClasses=Ft;exports.dialogHeaderClasses=Et;exports.dialogTitleClasses=Ht;exports.markerVariants=xs;exports.useMessageScroller=Fa;exports.useMessageScrollerScrollable=is;exports.useMessageScrollerVisibility=ls;
10
+ //# sourceMappingURL=ChatPanel-D3VL5Vdq.cjs.map