@copilotkit/react-ui 0.0.0-0.0.0-max-changeset-10101010101010-20260109191632

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 (395) hide show
  1. package/CHANGELOG.md +17415 -0
  2. package/LICENSE +21 -0
  3. package/README.md +141 -0
  4. package/dist/chunk-3W6J75HS.mjs +126 -0
  5. package/dist/chunk-3W6J75HS.mjs.map +1 -0
  6. package/dist/chunk-54JAUBUJ.mjs +26 -0
  7. package/dist/chunk-54JAUBUJ.mjs.map +1 -0
  8. package/dist/chunk-7OURDQZJ.mjs +133 -0
  9. package/dist/chunk-7OURDQZJ.mjs.map +1 -0
  10. package/dist/chunk-7PR2KJDO.mjs +222 -0
  11. package/dist/chunk-7PR2KJDO.mjs.map +1 -0
  12. package/dist/chunk-BH6PCAAL.mjs +81 -0
  13. package/dist/chunk-BH6PCAAL.mjs.map +1 -0
  14. package/dist/chunk-C3GSYRC3.mjs +118 -0
  15. package/dist/chunk-C3GSYRC3.mjs.map +1 -0
  16. package/dist/chunk-DBKRAOH7.mjs +34 -0
  17. package/dist/chunk-DBKRAOH7.mjs.map +1 -0
  18. package/dist/chunk-EFZPSZWO.mjs +1 -0
  19. package/dist/chunk-EFZPSZWO.mjs.map +1 -0
  20. package/dist/chunk-ELGRNEAO.mjs +32 -0
  21. package/dist/chunk-ELGRNEAO.mjs.map +1 -0
  22. package/dist/chunk-ELUJRANC.mjs +21 -0
  23. package/dist/chunk-ELUJRANC.mjs.map +1 -0
  24. package/dist/chunk-FFJHOZX6.mjs +202 -0
  25. package/dist/chunk-FFJHOZX6.mjs.map +1 -0
  26. package/dist/chunk-GDSZGYCE.mjs +32 -0
  27. package/dist/chunk-GDSZGYCE.mjs.map +1 -0
  28. package/dist/chunk-HIW7RXCD.mjs +184 -0
  29. package/dist/chunk-HIW7RXCD.mjs.map +1 -0
  30. package/dist/chunk-IEMQ2SQW.mjs +93 -0
  31. package/dist/chunk-IEMQ2SQW.mjs.map +1 -0
  32. package/dist/chunk-IHFR6PYG.mjs +116 -0
  33. package/dist/chunk-IHFR6PYG.mjs.map +1 -0
  34. package/dist/chunk-IK2BPURM.mjs +400 -0
  35. package/dist/chunk-IK2BPURM.mjs.map +1 -0
  36. package/dist/chunk-IU3WTXLQ.mjs +1 -0
  37. package/dist/chunk-IU3WTXLQ.mjs.map +1 -0
  38. package/dist/chunk-JGMFJZMG.mjs +11 -0
  39. package/dist/chunk-JGMFJZMG.mjs.map +1 -0
  40. package/dist/chunk-JY2CSDKN.mjs +135 -0
  41. package/dist/chunk-JY2CSDKN.mjs.map +1 -0
  42. package/dist/chunk-JZ3RFQQ6.mjs +128 -0
  43. package/dist/chunk-JZ3RFQQ6.mjs.map +1 -0
  44. package/dist/chunk-KXE2JCUH.mjs +1 -0
  45. package/dist/chunk-KXE2JCUH.mjs.map +1 -0
  46. package/dist/chunk-LQEFRHRT.mjs +30 -0
  47. package/dist/chunk-LQEFRHRT.mjs.map +1 -0
  48. package/dist/chunk-MMVDU6DF.mjs +1 -0
  49. package/dist/chunk-MMVDU6DF.mjs.map +1 -0
  50. package/dist/chunk-MRXNTQOX.mjs +59 -0
  51. package/dist/chunk-MRXNTQOX.mjs.map +1 -0
  52. package/dist/chunk-NCIAFFQ2.mjs +82 -0
  53. package/dist/chunk-NCIAFFQ2.mjs.map +1 -0
  54. package/dist/chunk-NGJ32FAP.mjs +30 -0
  55. package/dist/chunk-NGJ32FAP.mjs.map +1 -0
  56. package/dist/chunk-NRA3CFEE.mjs +97 -0
  57. package/dist/chunk-NRA3CFEE.mjs.map +1 -0
  58. package/dist/chunk-O72ZB5V3.mjs +140 -0
  59. package/dist/chunk-O72ZB5V3.mjs.map +1 -0
  60. package/dist/chunk-PLHTVHUW.mjs +82 -0
  61. package/dist/chunk-PLHTVHUW.mjs.map +1 -0
  62. package/dist/chunk-Q5V6S67N.mjs +103 -0
  63. package/dist/chunk-Q5V6S67N.mjs.map +1 -0
  64. package/dist/chunk-QB3GUN2N.mjs +31 -0
  65. package/dist/chunk-QB3GUN2N.mjs.map +1 -0
  66. package/dist/chunk-QIOJXTIQ.mjs +64 -0
  67. package/dist/chunk-QIOJXTIQ.mjs.map +1 -0
  68. package/dist/chunk-QPQRLXN3.mjs +435 -0
  69. package/dist/chunk-QPQRLXN3.mjs.map +1 -0
  70. package/dist/chunk-RYUCX3ZK.mjs +32 -0
  71. package/dist/chunk-RYUCX3ZK.mjs.map +1 -0
  72. package/dist/chunk-SC6JRFAJ.mjs +1 -0
  73. package/dist/chunk-SC6JRFAJ.mjs.map +1 -0
  74. package/dist/chunk-T26KLXLH.mjs +1 -0
  75. package/dist/chunk-T26KLXLH.mjs.map +1 -0
  76. package/dist/chunk-UFN2VWSR.mjs +25 -0
  77. package/dist/chunk-UFN2VWSR.mjs.map +1 -0
  78. package/dist/chunk-V7W6IM2V.mjs +1 -0
  79. package/dist/chunk-V7W6IM2V.mjs.map +1 -0
  80. package/dist/chunk-WB3YULQ4.mjs +1 -0
  81. package/dist/chunk-WB3YULQ4.mjs.map +1 -0
  82. package/dist/chunk-XWG3L6QC.mjs +258 -0
  83. package/dist/chunk-XWG3L6QC.mjs.map +1 -0
  84. package/dist/chunk-Y4FKRAKJ.mjs +12 -0
  85. package/dist/chunk-Y4FKRAKJ.mjs.map +1 -0
  86. package/dist/components/chat/Button.d.ts +9 -0
  87. package/dist/components/chat/Button.js +71 -0
  88. package/dist/components/chat/Button.js.map +1 -0
  89. package/dist/components/chat/Button.mjs +10 -0
  90. package/dist/components/chat/Button.mjs.map +1 -0
  91. package/dist/components/chat/Chat.d.ts +204 -0
  92. package/dist/components/chat/Chat.js +2270 -0
  93. package/dist/components/chat/Chat.js.map +1 -0
  94. package/dist/components/chat/Chat.mjs +29 -0
  95. package/dist/components/chat/Chat.mjs.map +1 -0
  96. package/dist/components/chat/ChatContext.d.ts +145 -0
  97. package/dist/components/chat/ChatContext.js +329 -0
  98. package/dist/components/chat/ChatContext.js.map +1 -0
  99. package/dist/components/chat/ChatContext.mjs +13 -0
  100. package/dist/components/chat/ChatContext.mjs.map +1 -0
  101. package/dist/components/chat/CodeBlock.d.ts +14 -0
  102. package/dist/components/chat/CodeBlock.js +510 -0
  103. package/dist/components/chat/CodeBlock.js.map +1 -0
  104. package/dist/components/chat/CodeBlock.mjs +14 -0
  105. package/dist/components/chat/CodeBlock.mjs.map +1 -0
  106. package/dist/components/chat/Header.d.ts +9 -0
  107. package/dist/components/chat/Header.js +582 -0
  108. package/dist/components/chat/Header.js.map +1 -0
  109. package/dist/components/chat/Header.mjs +17 -0
  110. package/dist/components/chat/Header.mjs.map +1 -0
  111. package/dist/components/chat/Icons.d.ts +20 -0
  112. package/dist/components/chat/Icons.js +297 -0
  113. package/dist/components/chat/Icons.js.map +1 -0
  114. package/dist/components/chat/Icons.mjs +38 -0
  115. package/dist/components/chat/Icons.mjs.map +1 -0
  116. package/dist/components/chat/ImageUploadQueue.d.ts +13 -0
  117. package/dist/components/chat/ImageUploadQueue.js +106 -0
  118. package/dist/components/chat/ImageUploadQueue.js.map +1 -0
  119. package/dist/components/chat/ImageUploadQueue.mjs +8 -0
  120. package/dist/components/chat/ImageUploadQueue.mjs.map +1 -0
  121. package/dist/components/chat/Input.d.ts +9 -0
  122. package/dist/components/chat/Input.js +396 -0
  123. package/dist/components/chat/Input.js.map +1 -0
  124. package/dist/components/chat/Input.mjs +14 -0
  125. package/dist/components/chat/Input.mjs.map +1 -0
  126. package/dist/components/chat/Markdown.d.ts +10 -0
  127. package/dist/components/chat/Markdown.js +652 -0
  128. package/dist/components/chat/Markdown.js.map +1 -0
  129. package/dist/components/chat/Markdown.mjs +11 -0
  130. package/dist/components/chat/Markdown.mjs.map +1 -0
  131. package/dist/components/chat/Messages.d.ts +13 -0
  132. package/dist/components/chat/Messages.js +1195 -0
  133. package/dist/components/chat/Messages.js.map +1 -0
  134. package/dist/components/chat/Messages.mjs +20 -0
  135. package/dist/components/chat/Messages.mjs.map +1 -0
  136. package/dist/components/chat/Modal.d.ts +51 -0
  137. package/dist/components/chat/Modal.js +3075 -0
  138. package/dist/components/chat/Modal.js.map +1 -0
  139. package/dist/components/chat/Modal.mjs +38 -0
  140. package/dist/components/chat/Modal.mjs.map +1 -0
  141. package/dist/components/chat/Popup.d.ts +13 -0
  142. package/dist/components/chat/Popup.js +3086 -0
  143. package/dist/components/chat/Popup.js.map +1 -0
  144. package/dist/components/chat/Popup.mjs +39 -0
  145. package/dist/components/chat/Popup.mjs.map +1 -0
  146. package/dist/components/chat/PoweredByTag.d.ts +7 -0
  147. package/dist/components/chat/PoweredByTag.js +61 -0
  148. package/dist/components/chat/PoweredByTag.js.map +1 -0
  149. package/dist/components/chat/PoweredByTag.mjs +9 -0
  150. package/dist/components/chat/PoweredByTag.mjs.map +1 -0
  151. package/dist/components/chat/Sidebar.d.ts +13 -0
  152. package/dist/components/chat/Sidebar.js +3095 -0
  153. package/dist/components/chat/Sidebar.js.map +1 -0
  154. package/dist/components/chat/Sidebar.mjs +39 -0
  155. package/dist/components/chat/Sidebar.mjs.map +1 -0
  156. package/dist/components/chat/Suggestion.d.ts +12 -0
  157. package/dist/components/chat/Suggestion.js +56 -0
  158. package/dist/components/chat/Suggestion.js.map +1 -0
  159. package/dist/components/chat/Suggestion.mjs +9 -0
  160. package/dist/components/chat/Suggestion.mjs.map +1 -0
  161. package/dist/components/chat/Suggestions.d.ts +9 -0
  162. package/dist/components/chat/Suggestions.js +81 -0
  163. package/dist/components/chat/Suggestions.js.map +1 -0
  164. package/dist/components/chat/Suggestions.mjs +10 -0
  165. package/dist/components/chat/Suggestions.mjs.map +1 -0
  166. package/dist/components/chat/Textarea.d.ts +15 -0
  167. package/dist/components/chat/Textarea.js +84 -0
  168. package/dist/components/chat/Textarea.js.map +1 -0
  169. package/dist/components/chat/Textarea.mjs +8 -0
  170. package/dist/components/chat/Textarea.mjs.map +1 -0
  171. package/dist/components/chat/Window.d.ts +9 -0
  172. package/dist/components/chat/Window.js +164 -0
  173. package/dist/components/chat/Window.js.map +1 -0
  174. package/dist/components/chat/Window.mjs +10 -0
  175. package/dist/components/chat/Window.mjs.map +1 -0
  176. package/dist/components/chat/index.d.ts +18 -0
  177. package/dist/components/chat/index.js +3122 -0
  178. package/dist/components/chat/index.js.map +1 -0
  179. package/dist/components/chat/index.mjs +69 -0
  180. package/dist/components/chat/index.mjs.map +1 -0
  181. package/dist/components/chat/messages/AssistantMessage.d.ts +9 -0
  182. package/dist/components/chat/messages/AssistantMessage.js +775 -0
  183. package/dist/components/chat/messages/AssistantMessage.js.map +1 -0
  184. package/dist/components/chat/messages/AssistantMessage.mjs +13 -0
  185. package/dist/components/chat/messages/AssistantMessage.mjs.map +1 -0
  186. package/dist/components/chat/messages/ErrorMessage.d.ts +9 -0
  187. package/dist/components/chat/messages/ErrorMessage.js +722 -0
  188. package/dist/components/chat/messages/ErrorMessage.js.map +1 -0
  189. package/dist/components/chat/messages/ErrorMessage.mjs +66 -0
  190. package/dist/components/chat/messages/ErrorMessage.mjs.map +1 -0
  191. package/dist/components/chat/messages/ImageRenderer.d.ts +12 -0
  192. package/dist/components/chat/messages/ImageRenderer.js +58 -0
  193. package/dist/components/chat/messages/ImageRenderer.js.map +1 -0
  194. package/dist/components/chat/messages/ImageRenderer.mjs +8 -0
  195. package/dist/components/chat/messages/ImageRenderer.mjs.map +1 -0
  196. package/dist/components/chat/messages/LegacyRenderMessage.d.ts +28 -0
  197. package/dist/components/chat/messages/LegacyRenderMessage.js +1023 -0
  198. package/dist/components/chat/messages/LegacyRenderMessage.js.map +1 -0
  199. package/dist/components/chat/messages/LegacyRenderMessage.mjs +17 -0
  200. package/dist/components/chat/messages/LegacyRenderMessage.mjs.map +1 -0
  201. package/dist/components/chat/messages/RenderMessage.d.ts +9 -0
  202. package/dist/components/chat/messages/RenderMessage.js +898 -0
  203. package/dist/components/chat/messages/RenderMessage.js.map +1 -0
  204. package/dist/components/chat/messages/RenderMessage.mjs +16 -0
  205. package/dist/components/chat/messages/RenderMessage.mjs.map +1 -0
  206. package/dist/components/chat/messages/UserMessage.d.ts +9 -0
  207. package/dist/components/chat/messages/UserMessage.js +56 -0
  208. package/dist/components/chat/messages/UserMessage.js.map +1 -0
  209. package/dist/components/chat/messages/UserMessage.mjs +8 -0
  210. package/dist/components/chat/messages/UserMessage.mjs.map +1 -0
  211. package/dist/components/chat/props.d.ts +298 -0
  212. package/dist/components/chat/props.js +19 -0
  213. package/dist/components/chat/props.js.map +1 -0
  214. package/dist/components/chat/props.mjs +2 -0
  215. package/dist/components/chat/props.mjs.map +1 -0
  216. package/dist/components/dev-console/console.d.ts +11 -0
  217. package/dist/components/dev-console/console.js +537 -0
  218. package/dist/components/dev-console/console.js.map +1 -0
  219. package/dist/components/dev-console/console.mjs +17 -0
  220. package/dist/components/dev-console/console.mjs.map +1 -0
  221. package/dist/components/dev-console/icons.d.ts +9 -0
  222. package/dist/components/dev-console/icons.js +131 -0
  223. package/dist/components/dev-console/icons.js.map +1 -0
  224. package/dist/components/dev-console/icons.mjs +16 -0
  225. package/dist/components/dev-console/icons.mjs.map +1 -0
  226. package/dist/components/dev-console/index.d.ts +3 -0
  227. package/dist/components/dev-console/index.js +537 -0
  228. package/dist/components/dev-console/index.js.map +1 -0
  229. package/dist/components/dev-console/index.mjs +18 -0
  230. package/dist/components/dev-console/index.mjs.map +1 -0
  231. package/dist/components/dev-console/types.d.ts +9 -0
  232. package/dist/components/dev-console/types.js +19 -0
  233. package/dist/components/dev-console/types.js.map +1 -0
  234. package/dist/components/dev-console/types.mjs +1 -0
  235. package/dist/components/dev-console/types.mjs.map +1 -0
  236. package/dist/components/dev-console/utils.d.ts +10 -0
  237. package/dist/components/dev-console/utils.js +177 -0
  238. package/dist/components/dev-console/utils.js.map +1 -0
  239. package/dist/components/dev-console/utils.mjs +16 -0
  240. package/dist/components/dev-console/utils.mjs.map +1 -0
  241. package/dist/components/help-modal/icons.d.ts +9 -0
  242. package/dist/components/help-modal/icons.js +107 -0
  243. package/dist/components/help-modal/icons.js.map +1 -0
  244. package/dist/components/help-modal/icons.mjs +12 -0
  245. package/dist/components/help-modal/icons.mjs.map +1 -0
  246. package/dist/components/help-modal/index.d.ts +2 -0
  247. package/dist/components/help-modal/index.js +137 -0
  248. package/dist/components/help-modal/index.js.map +1 -0
  249. package/dist/components/help-modal/index.mjs +10 -0
  250. package/dist/components/help-modal/index.mjs.map +1 -0
  251. package/dist/components/help-modal/modal.d.ts +5 -0
  252. package/dist/components/help-modal/modal.js +135 -0
  253. package/dist/components/help-modal/modal.js.map +1 -0
  254. package/dist/components/help-modal/modal.mjs +9 -0
  255. package/dist/components/help-modal/modal.mjs.map +1 -0
  256. package/dist/components/index.d.ts +19 -0
  257. package/dist/components/index.js +3126 -0
  258. package/dist/components/index.js.map +1 -0
  259. package/dist/components/index.mjs +76 -0
  260. package/dist/components/index.mjs.map +1 -0
  261. package/dist/context/index.d.ts +2 -0
  262. package/dist/context/index.js +19 -0
  263. package/dist/context/index.js.map +1 -0
  264. package/dist/context/index.mjs +2 -0
  265. package/dist/context/index.mjs.map +1 -0
  266. package/dist/hooks/index.d.ts +2 -0
  267. package/dist/hooks/index.js +36 -0
  268. package/dist/hooks/index.js.map +1 -0
  269. package/dist/hooks/index.mjs +9 -0
  270. package/dist/hooks/index.mjs.map +1 -0
  271. package/dist/hooks/use-copilot-chat-suggestions.d.ts +66 -0
  272. package/dist/hooks/use-copilot-chat-suggestions.js +34 -0
  273. package/dist/hooks/use-copilot-chat-suggestions.js.map +1 -0
  274. package/dist/hooks/use-copilot-chat-suggestions.mjs +8 -0
  275. package/dist/hooks/use-copilot-chat-suggestions.mjs.map +1 -0
  276. package/dist/hooks/use-copy-to-clipboard.d.ts +9 -0
  277. package/dist/hooks/use-copy-to-clipboard.js +60 -0
  278. package/dist/hooks/use-copy-to-clipboard.js.map +1 -0
  279. package/dist/hooks/use-copy-to-clipboard.mjs +8 -0
  280. package/dist/hooks/use-copy-to-clipboard.mjs.map +1 -0
  281. package/dist/hooks/use-dark-mode.d.ts +3 -0
  282. package/dist/hooks/use-dark-mode.js +35 -0
  283. package/dist/hooks/use-dark-mode.js.map +1 -0
  284. package/dist/hooks/use-dark-mode.mjs +8 -0
  285. package/dist/hooks/use-dark-mode.mjs.map +1 -0
  286. package/dist/hooks/use-push-to-talk.d.ts +19 -0
  287. package/dist/hooks/use-push-to-talk.js +195 -0
  288. package/dist/hooks/use-push-to-talk.js.map +1 -0
  289. package/dist/hooks/use-push-to-talk.mjs +12 -0
  290. package/dist/hooks/use-push-to-talk.mjs.map +1 -0
  291. package/dist/index.css +1258 -0
  292. package/dist/index.css.map +1 -0
  293. package/dist/index.d.ts +21 -0
  294. package/dist/index.js +3135 -0
  295. package/dist/index.js.map +1 -0
  296. package/dist/index.mjs +84 -0
  297. package/dist/index.mjs.map +1 -0
  298. package/dist/lib/utils.d.ts +4 -0
  299. package/dist/lib/utils.js +76 -0
  300. package/dist/lib/utils.js.map +1 -0
  301. package/dist/lib/utils.mjs +34 -0
  302. package/dist/lib/utils.mjs.map +1 -0
  303. package/dist/types/css.d.ts +22 -0
  304. package/dist/types/css.js +19 -0
  305. package/dist/types/css.js.map +1 -0
  306. package/dist/types/css.mjs +1 -0
  307. package/dist/types/css.mjs.map +1 -0
  308. package/dist/types/index.d.ts +3 -0
  309. package/dist/types/index.js +19 -0
  310. package/dist/types/index.js.map +1 -0
  311. package/dist/types/index.mjs +2 -0
  312. package/dist/types/index.mjs.map +1 -0
  313. package/dist/types/suggestions.d.ts +9 -0
  314. package/dist/types/suggestions.js +19 -0
  315. package/dist/types/suggestions.js.map +1 -0
  316. package/dist/types/suggestions.mjs +1 -0
  317. package/dist/types/suggestions.mjs.map +1 -0
  318. package/dist/v2/index.css +4 -0
  319. package/dist/v2/index.css.map +1 -0
  320. package/dist/v2/index.d.ts +2 -0
  321. package/dist/v2/index.js +2 -0
  322. package/dist/v2/index.js.map +1 -0
  323. package/dist/v2/index.mjs +2 -0
  324. package/dist/v2/index.mjs.map +1 -0
  325. package/jest.config.js +5 -0
  326. package/package.json +83 -0
  327. package/postcss.config.js +60 -0
  328. package/src/components/chat/Button.tsx +18 -0
  329. package/src/components/chat/Chat.tsx +795 -0
  330. package/src/components/chat/ChatContext.tsx +248 -0
  331. package/src/components/chat/CodeBlock.tsx +418 -0
  332. package/src/components/chat/Header.tsx +24 -0
  333. package/src/components/chat/Icons.tsx +237 -0
  334. package/src/components/chat/ImageUploadQueue.tsx +77 -0
  335. package/src/components/chat/Input.tsx +156 -0
  336. package/src/components/chat/Markdown.tsx +144 -0
  337. package/src/components/chat/Messages.tsx +206 -0
  338. package/src/components/chat/Modal.tsx +220 -0
  339. package/src/components/chat/Popup.tsx +77 -0
  340. package/src/components/chat/PoweredByTag.tsx +42 -0
  341. package/src/components/chat/Sidebar.tsx +96 -0
  342. package/src/components/chat/Suggestion.tsx +29 -0
  343. package/src/components/chat/Suggestions.tsx +23 -0
  344. package/src/components/chat/Textarea.tsx +77 -0
  345. package/src/components/chat/Window.tsx +152 -0
  346. package/src/components/chat/index.tsx +11 -0
  347. package/src/components/chat/messages/AssistantMessage.tsx +118 -0
  348. package/src/components/chat/messages/ErrorMessage.tsx +59 -0
  349. package/src/components/chat/messages/ImageRenderer.tsx +37 -0
  350. package/src/components/chat/messages/LegacyRenderMessage.tsx +150 -0
  351. package/src/components/chat/messages/RenderMessage.tsx +61 -0
  352. package/src/components/chat/messages/UserMessage.tsx +46 -0
  353. package/src/components/chat/props.ts +353 -0
  354. package/src/components/dev-console/console.tsx +242 -0
  355. package/src/components/dev-console/icons.tsx +99 -0
  356. package/src/components/dev-console/index.tsx +2 -0
  357. package/src/components/dev-console/types.ts +7 -0
  358. package/src/components/dev-console/utils.ts +142 -0
  359. package/src/components/help-modal/icons.tsx +68 -0
  360. package/src/components/help-modal/index.tsx +1 -0
  361. package/src/components/help-modal/modal.tsx +101 -0
  362. package/src/components/index.ts +2 -0
  363. package/src/context/index.ts +1 -0
  364. package/src/css/animations.css +35 -0
  365. package/src/css/button.css +67 -0
  366. package/src/css/colors.css +78 -0
  367. package/src/css/console.css +166 -0
  368. package/src/css/crew.css +277 -0
  369. package/src/css/header.css +65 -0
  370. package/src/css/input.css +152 -0
  371. package/src/css/markdown.css +150 -0
  372. package/src/css/messages.css +244 -0
  373. package/src/css/panel.css +39 -0
  374. package/src/css/popup.css +22 -0
  375. package/src/css/sidebar.css +34 -0
  376. package/src/css/suggestions.css +43 -0
  377. package/src/css/window.css +60 -0
  378. package/src/hooks/index.ts +1 -0
  379. package/src/hooks/use-copilot-chat-suggestions.tsx +71 -0
  380. package/src/hooks/use-copy-to-clipboard.tsx +29 -0
  381. package/src/hooks/use-dark-mode.ts +10 -0
  382. package/src/hooks/use-push-to-talk.tsx +167 -0
  383. package/src/index.tsx +7 -0
  384. package/src/lib/utils.test.ts +7 -0
  385. package/src/lib/utils.ts +27 -0
  386. package/src/styles.css +14 -0
  387. package/src/types/css.ts +21 -0
  388. package/src/types/index.ts +2 -0
  389. package/src/types/suggestions.ts +7 -0
  390. package/src/v2/index.ts +1 -0
  391. package/src/v2/styles.css +1 -0
  392. package/tailwind.config.js +7 -0
  393. package/tsconfig.json +12 -0
  394. package/tsup.config.ts +11 -0
  395. package/typedoc.json +4 -0
@@ -0,0 +1,1023 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __getProtoOf = Object.getPrototypeOf;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {}))
15
+ if (__hasOwnProp.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(b)) {
19
+ if (__propIsEnum.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
24
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
+ var __objRest = (source, exclude) => {
26
+ var target = {};
27
+ for (var prop in source)
28
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
+ target[prop] = source[prop];
30
+ if (source != null && __getOwnPropSymbols)
31
+ for (var prop of __getOwnPropSymbols(source)) {
32
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
+ target[prop] = source[prop];
34
+ }
35
+ return target;
36
+ };
37
+ var __export = (target, all) => {
38
+ for (var name in all)
39
+ __defProp(target, name, { get: all[name], enumerable: true });
40
+ };
41
+ var __copyProps = (to, from, except, desc) => {
42
+ if (from && typeof from === "object" || typeof from === "function") {
43
+ for (let key of __getOwnPropNames(from))
44
+ if (!__hasOwnProp.call(to, key) && key !== except)
45
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
46
+ }
47
+ return to;
48
+ };
49
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
50
+ // If the importer is in node compatibility mode or this is not an ESM
51
+ // file that has been converted to a CommonJS file using a Babel-
52
+ // compatible transform (i.e. "__esModule" has not been set), then set
53
+ // "default" to the CommonJS "module.exports" for node compatibility.
54
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
55
+ mod
56
+ ));
57
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
58
+
59
+ // src/components/chat/messages/LegacyRenderMessage.tsx
60
+ var LegacyRenderMessage_exports = {};
61
+ __export(LegacyRenderMessage_exports, {
62
+ LegacyRenderMessage: () => LegacyRenderMessage
63
+ });
64
+ module.exports = __toCommonJS(LegacyRenderMessage_exports);
65
+
66
+ // src/components/chat/messages/UserMessage.tsx
67
+ var import_jsx_runtime = require("react/jsx-runtime");
68
+ var getTextContent = (content) => {
69
+ if (typeof content === "undefined") {
70
+ return void 0;
71
+ }
72
+ if (typeof content === "string") {
73
+ return content;
74
+ }
75
+ return content.map((part) => {
76
+ if (part.type === "text") {
77
+ return part.text;
78
+ }
79
+ return void 0;
80
+ }).filter((value) => typeof value === "string" && value.length > 0).join(" ").trim() || void 0;
81
+ };
82
+ var UserMessage = (props) => {
83
+ const { message, ImageRenderer: ImageRenderer2 } = props;
84
+ const isImageMessage = message && "image" in message && Boolean(message.image);
85
+ if (isImageMessage) {
86
+ const imageMessage = message;
87
+ const content2 = getTextContent(imageMessage == null ? void 0 : imageMessage.content);
88
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "copilotKitMessage copilotKitUserMessage", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ImageRenderer2, { image: imageMessage.image, content: content2 }) });
89
+ }
90
+ const content = getTextContent(message == null ? void 0 : message.content);
91
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "copilotKitMessage copilotKitUserMessage", children: content });
92
+ };
93
+
94
+ // src/components/chat/ChatContext.tsx
95
+ var import_react = __toESM(require("react"));
96
+
97
+ // src/components/chat/Icons.tsx
98
+ var import_jsx_runtime2 = require("react/jsx-runtime");
99
+ var CopyIcon = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
100
+ "svg",
101
+ {
102
+ xmlns: "http://www.w3.org/2000/svg",
103
+ fill: "none",
104
+ viewBox: "0 0 24 24",
105
+ strokeWidth: "2",
106
+ stroke: "currentColor",
107
+ width: "16",
108
+ height: "16",
109
+ style: { minWidth: "16px", minHeight: "16px" },
110
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
111
+ "path",
112
+ {
113
+ strokeLinecap: "round",
114
+ strokeLinejoin: "round",
115
+ d: "M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 01-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 011.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 00-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 01-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 00-3.375-3.375h-1.5a1.125 1.125 0 01-1.125-1.125v-1.5a3.375 3.375 0 00-3.375-3.375H9.75"
116
+ }
117
+ )
118
+ }
119
+ );
120
+ var DownloadIcon = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
121
+ "svg",
122
+ {
123
+ xmlns: "http://www.w3.org/2000/svg",
124
+ fill: "none",
125
+ viewBox: "0 0 24 24",
126
+ strokeWidth: "2",
127
+ stroke: "currentColor",
128
+ width: "16",
129
+ height: "16",
130
+ style: { minWidth: "16px", minHeight: "16px" },
131
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
132
+ "path",
133
+ {
134
+ strokeLinecap: "round",
135
+ strokeLinejoin: "round",
136
+ d: "M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"
137
+ }
138
+ )
139
+ }
140
+ );
141
+ var CheckIcon = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
142
+ "svg",
143
+ {
144
+ xmlns: "http://www.w3.org/2000/svg",
145
+ fill: "none",
146
+ viewBox: "0 0 24 24",
147
+ strokeWidth: "2",
148
+ stroke: "currentColor",
149
+ width: "16",
150
+ height: "16",
151
+ style: { minWidth: "16px", minHeight: "16px" },
152
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 12.75l6 6 9-13.5" })
153
+ }
154
+ );
155
+
156
+ // src/components/chat/ChatContext.tsx
157
+ var import_jsx_runtime3 = require("react/jsx-runtime");
158
+ var ChatContext = import_react.default.createContext(void 0);
159
+ function useChatContext() {
160
+ const context = import_react.default.useContext(ChatContext);
161
+ if (context === void 0) {
162
+ throw new Error(
163
+ "Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?"
164
+ );
165
+ }
166
+ return context;
167
+ }
168
+
169
+ // src/components/chat/Markdown.tsx
170
+ var import_react3 = require("react");
171
+ var import_react_markdown = __toESM(require("react-markdown"));
172
+
173
+ // src/components/chat/CodeBlock.tsx
174
+ var import_react2 = require("react");
175
+ var import_react_syntax_highlighter = require("react-syntax-highlighter");
176
+
177
+ // src/hooks/use-copy-to-clipboard.tsx
178
+ var React2 = __toESM(require("react"));
179
+ function useCopyToClipboard({ timeout = 2e3 }) {
180
+ const [isCopied, setIsCopied] = React2.useState(false);
181
+ const copyToClipboard = (value) => {
182
+ var _a;
183
+ if (typeof window === "undefined" || !((_a = navigator.clipboard) == null ? void 0 : _a.writeText)) {
184
+ return;
185
+ }
186
+ if (!value) {
187
+ return;
188
+ }
189
+ navigator.clipboard.writeText(value).then(() => {
190
+ setIsCopied(true);
191
+ setTimeout(() => {
192
+ setIsCopied(false);
193
+ }, timeout);
194
+ });
195
+ };
196
+ return { isCopied, copyToClipboard };
197
+ }
198
+
199
+ // src/components/chat/CodeBlock.tsx
200
+ var import_jsx_runtime4 = require("react/jsx-runtime");
201
+ var programmingLanguages = {
202
+ javascript: ".js",
203
+ python: ".py",
204
+ java: ".java",
205
+ c: ".c",
206
+ cpp: ".cpp",
207
+ "c++": ".cpp",
208
+ "c#": ".cs",
209
+ ruby: ".rb",
210
+ php: ".php",
211
+ swift: ".swift",
212
+ "objective-c": ".m",
213
+ kotlin: ".kt",
214
+ typescript: ".ts",
215
+ go: ".go",
216
+ perl: ".pl",
217
+ rust: ".rs",
218
+ scala: ".scala",
219
+ haskell: ".hs",
220
+ lua: ".lua",
221
+ shell: ".sh",
222
+ sql: ".sql",
223
+ html: ".html",
224
+ css: ".css"
225
+ // add more file extensions here, make sure the key is same as language prop in CodeBlock.tsx component
226
+ };
227
+ var generateRandomString = (length, lowercase = false) => {
228
+ const chars = "ABCDEFGHJKLMNPQRSTUVWXY3456789";
229
+ let result = "";
230
+ for (let i = 0; i < length; i++) {
231
+ result += chars.charAt(Math.floor(Math.random() * chars.length));
232
+ }
233
+ return lowercase ? result.toLowerCase() : result;
234
+ };
235
+ var CodeBlock = (0, import_react2.memo)(({ language, value }) => {
236
+ const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2e3 });
237
+ const [SyntaxHighlighter, setSyntaxHighlighter] = (0, import_react2.useState)(
238
+ () => import_react_syntax_highlighter.Light
239
+ );
240
+ (0, import_react2.useEffect)(() => {
241
+ try {
242
+ new RegExp("(?<=#)\\w+");
243
+ setSyntaxHighlighter(() => import_react_syntax_highlighter.Prism);
244
+ } catch (e) {
245
+ setSyntaxHighlighter(() => import_react_syntax_highlighter.Light);
246
+ }
247
+ }, []);
248
+ const downloadAsFile = () => {
249
+ if (typeof window === "undefined") {
250
+ return;
251
+ }
252
+ const fileExtension = programmingLanguages[language] || ".file";
253
+ const suggestedFileName = `file-${generateRandomString(3, true)}${fileExtension}`;
254
+ const fileName = window.prompt("Enter file name", suggestedFileName);
255
+ if (!fileName) {
256
+ return;
257
+ }
258
+ const blob = new Blob([value], { type: "text/plain" });
259
+ const url = URL.createObjectURL(blob);
260
+ const link = document.createElement("a");
261
+ link.download = fileName;
262
+ link.href = url;
263
+ link.style.display = "none";
264
+ document.body.appendChild(link);
265
+ link.click();
266
+ document.body.removeChild(link);
267
+ URL.revokeObjectURL(url);
268
+ };
269
+ const onCopy = () => {
270
+ if (isCopied)
271
+ return;
272
+ copyToClipboard(value);
273
+ };
274
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "copilotKitCodeBlock", children: [
275
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "copilotKitCodeBlockToolbar", children: [
276
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "copilotKitCodeBlockToolbarLanguage", children: language }),
277
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "copilotKitCodeBlockToolbarButtons", children: [
278
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: downloadAsFile, children: DownloadIcon }),
279
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: onCopy, children: isCopied ? CheckIcon : CopyIcon })
280
+ ] })
281
+ ] }),
282
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
283
+ SyntaxHighlighter,
284
+ {
285
+ language,
286
+ style: highlightStyle,
287
+ PreTag: "div",
288
+ customStyle: {
289
+ margin: 0,
290
+ borderBottomLeftRadius: "0.375rem",
291
+ borderBottomRightRadius: "0.375rem"
292
+ },
293
+ children: value
294
+ }
295
+ )
296
+ ] });
297
+ });
298
+ CodeBlock.displayName = "CodeBlock";
299
+ var highlightStyle = {
300
+ 'pre[class*="language-"]': {
301
+ color: "#d4d4d4",
302
+ fontSize: "13px",
303
+ textShadow: "none",
304
+ fontFamily: 'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',
305
+ direction: "ltr",
306
+ textAlign: "left",
307
+ whiteSpace: "pre",
308
+ wordSpacing: "normal",
309
+ wordBreak: "normal",
310
+ lineHeight: "1.5",
311
+ MozTabSize: "4",
312
+ OTabSize: "4",
313
+ tabSize: "4",
314
+ WebkitHyphens: "none",
315
+ MozHyphens: "none",
316
+ msHyphens: "none",
317
+ hyphens: "none",
318
+ padding: "1em",
319
+ margin: ".5em 0",
320
+ overflow: "auto",
321
+ background: "#1e1e1e"
322
+ },
323
+ 'code[class*="language-"]': {
324
+ color: "#d4d4d4",
325
+ fontSize: "13px",
326
+ textShadow: "none",
327
+ fontFamily: 'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',
328
+ direction: "ltr",
329
+ textAlign: "left",
330
+ whiteSpace: "pre",
331
+ wordSpacing: "normal",
332
+ wordBreak: "normal",
333
+ lineHeight: "1.5",
334
+ MozTabSize: "4",
335
+ OTabSize: "4",
336
+ tabSize: "4",
337
+ WebkitHyphens: "none",
338
+ MozHyphens: "none",
339
+ msHyphens: "none",
340
+ hyphens: "none"
341
+ },
342
+ 'pre[class*="language-"]::selection': {
343
+ textShadow: "none",
344
+ background: "#264F78"
345
+ },
346
+ 'code[class*="language-"]::selection': {
347
+ textShadow: "none",
348
+ background: "#264F78"
349
+ },
350
+ 'pre[class*="language-"] *::selection': {
351
+ textShadow: "none",
352
+ background: "#264F78"
353
+ },
354
+ 'code[class*="language-"] *::selection': {
355
+ textShadow: "none",
356
+ background: "#264F78"
357
+ },
358
+ ':not(pre) > code[class*="language-"]': {
359
+ padding: ".1em .3em",
360
+ borderRadius: ".3em",
361
+ color: "#db4c69",
362
+ background: "#1e1e1e"
363
+ },
364
+ ".namespace": {
365
+ Opacity: ".7"
366
+ },
367
+ "doctype.doctype-tag": {
368
+ color: "#569CD6"
369
+ },
370
+ "doctype.name": {
371
+ color: "#9cdcfe"
372
+ },
373
+ comment: {
374
+ color: "#6a9955"
375
+ },
376
+ prolog: {
377
+ color: "#6a9955"
378
+ },
379
+ punctuation: {
380
+ color: "#d4d4d4"
381
+ },
382
+ ".language-html .language-css .token.punctuation": {
383
+ color: "#d4d4d4"
384
+ },
385
+ ".language-html .language-javascript .token.punctuation": {
386
+ color: "#d4d4d4"
387
+ },
388
+ property: {
389
+ color: "#9cdcfe"
390
+ },
391
+ tag: {
392
+ color: "#569cd6"
393
+ },
394
+ boolean: {
395
+ color: "#569cd6"
396
+ },
397
+ number: {
398
+ color: "#b5cea8"
399
+ },
400
+ constant: {
401
+ color: "#9cdcfe"
402
+ },
403
+ symbol: {
404
+ color: "#b5cea8"
405
+ },
406
+ inserted: {
407
+ color: "#b5cea8"
408
+ },
409
+ unit: {
410
+ color: "#b5cea8"
411
+ },
412
+ selector: {
413
+ color: "#d7ba7d"
414
+ },
415
+ "attr-name": {
416
+ color: "#9cdcfe"
417
+ },
418
+ string: {
419
+ color: "#ce9178"
420
+ },
421
+ char: {
422
+ color: "#ce9178"
423
+ },
424
+ builtin: {
425
+ color: "#ce9178"
426
+ },
427
+ deleted: {
428
+ color: "#ce9178"
429
+ },
430
+ ".language-css .token.string.url": {
431
+ textDecoration: "underline"
432
+ },
433
+ operator: {
434
+ color: "#d4d4d4"
435
+ },
436
+ entity: {
437
+ color: "#569cd6"
438
+ },
439
+ "operator.arrow": {
440
+ color: "#569CD6"
441
+ },
442
+ atrule: {
443
+ color: "#ce9178"
444
+ },
445
+ "atrule.rule": {
446
+ color: "#c586c0"
447
+ },
448
+ "atrule.url": {
449
+ color: "#9cdcfe"
450
+ },
451
+ "atrule.url.function": {
452
+ color: "#dcdcaa"
453
+ },
454
+ "atrule.url.punctuation": {
455
+ color: "#d4d4d4"
456
+ },
457
+ keyword: {
458
+ color: "#569CD6"
459
+ },
460
+ "keyword.module": {
461
+ color: "#c586c0"
462
+ },
463
+ "keyword.control-flow": {
464
+ color: "#c586c0"
465
+ },
466
+ function: {
467
+ color: "#dcdcaa"
468
+ },
469
+ "function.maybe-class-name": {
470
+ color: "#dcdcaa"
471
+ },
472
+ regex: {
473
+ color: "#d16969"
474
+ },
475
+ important: {
476
+ color: "#569cd6"
477
+ },
478
+ italic: {
479
+ fontStyle: "italic"
480
+ },
481
+ "class-name": {
482
+ color: "#4ec9b0"
483
+ },
484
+ "maybe-class-name": {
485
+ color: "#4ec9b0"
486
+ },
487
+ console: {
488
+ color: "#9cdcfe"
489
+ },
490
+ parameter: {
491
+ color: "#9cdcfe"
492
+ },
493
+ interpolation: {
494
+ color: "#9cdcfe"
495
+ },
496
+ "punctuation.interpolation-punctuation": {
497
+ color: "#569cd6"
498
+ },
499
+ variable: {
500
+ color: "#9cdcfe"
501
+ },
502
+ "imports.maybe-class-name": {
503
+ color: "#9cdcfe"
504
+ },
505
+ "exports.maybe-class-name": {
506
+ color: "#9cdcfe"
507
+ },
508
+ escape: {
509
+ color: "#d7ba7d"
510
+ },
511
+ "tag.punctuation": {
512
+ color: "#808080"
513
+ },
514
+ cdata: {
515
+ color: "#808080"
516
+ },
517
+ "attr-value": {
518
+ color: "#ce9178"
519
+ },
520
+ "attr-value.punctuation": {
521
+ color: "#ce9178"
522
+ },
523
+ "attr-value.punctuation.attr-equals": {
524
+ color: "#d4d4d4"
525
+ },
526
+ namespace: {
527
+ color: "#4ec9b0"
528
+ },
529
+ 'pre[class*="language-javascript"]': {
530
+ color: "#9cdcfe"
531
+ },
532
+ 'code[class*="language-javascript"]': {
533
+ color: "#9cdcfe"
534
+ },
535
+ 'pre[class*="language-jsx"]': {
536
+ color: "#9cdcfe"
537
+ },
538
+ 'code[class*="language-jsx"]': {
539
+ color: "#9cdcfe"
540
+ },
541
+ 'pre[class*="language-typescript"]': {
542
+ color: "#9cdcfe"
543
+ },
544
+ 'code[class*="language-typescript"]': {
545
+ color: "#9cdcfe"
546
+ },
547
+ 'pre[class*="language-tsx"]': {
548
+ color: "#9cdcfe"
549
+ },
550
+ 'code[class*="language-tsx"]': {
551
+ color: "#9cdcfe"
552
+ },
553
+ 'pre[class*="language-css"]': {
554
+ color: "#ce9178"
555
+ },
556
+ 'code[class*="language-css"]': {
557
+ color: "#ce9178"
558
+ },
559
+ 'pre[class*="language-html"]': {
560
+ color: "#d4d4d4"
561
+ },
562
+ 'code[class*="language-html"]': {
563
+ color: "#d4d4d4"
564
+ },
565
+ ".language-regex .token.anchor": {
566
+ color: "#dcdcaa"
567
+ },
568
+ ".language-html .token.punctuation": {
569
+ color: "#808080"
570
+ },
571
+ 'pre[class*="language-"] > code[class*="language-"]': {
572
+ position: "relative",
573
+ zIndex: "1"
574
+ },
575
+ ".line-highlight.line-highlight": {
576
+ background: "#f7ebc6",
577
+ boxShadow: "inset 5px 0 0 #f7d87c",
578
+ zIndex: "0"
579
+ }
580
+ };
581
+
582
+ // src/components/chat/Markdown.tsx
583
+ var import_remark_gfm = __toESM(require("remark-gfm"));
584
+ var import_remark_math = __toESM(require("remark-math"));
585
+ var import_rehype_raw = __toESM(require("rehype-raw"));
586
+ var import_jsx_runtime5 = require("react/jsx-runtime");
587
+ var defaultComponents = {
588
+ a(_a) {
589
+ var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
590
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { target: "_blank", rel: "noopener noreferrer", children }));
591
+ },
592
+ // @ts-expect-error -- inline
593
+ code(_c) {
594
+ var _d = _c, { children, className, inline } = _d, props = __objRest(_d, ["children", "className", "inline"]);
595
+ if (Array.isArray(children) && children.length) {
596
+ if (children[0] == "\u258D") {
597
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
598
+ "span",
599
+ {
600
+ style: {
601
+ animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
602
+ marginTop: "0.25rem"
603
+ },
604
+ children: "\u258D"
605
+ }
606
+ );
607
+ }
608
+ children[0] = (children == null ? void 0 : children[0]).replace("`\u258D`", "\u258D");
609
+ }
610
+ const match = /language-(\w+)/.exec(className || "");
611
+ const hasLanguage = match && match[1];
612
+ const content = String(children);
613
+ const hasNewlines = content.includes("\n");
614
+ const isInline = !hasLanguage && !hasNewlines;
615
+ if (isInline) {
616
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
617
+ "code",
618
+ __spreadProps(__spreadValues({
619
+ className: `copilotKitMarkdownElement copilotKitInlineCode ${className || ""}`
620
+ }, props), {
621
+ children
622
+ })
623
+ );
624
+ }
625
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
626
+ CodeBlock,
627
+ __spreadValues({
628
+ language: match && match[1] || "",
629
+ value: String(children).replace(/\n$/, "")
630
+ }, props),
631
+ Math.random()
632
+ );
633
+ },
634
+ h1: (_e) => {
635
+ var _f = _e, { children } = _f, props = __objRest(_f, ["children"]);
636
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h1", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
637
+ },
638
+ h2: (_g) => {
639
+ var _h = _g, { children } = _h, props = __objRest(_h, ["children"]);
640
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
641
+ },
642
+ h3: (_i) => {
643
+ var _j = _i, { children } = _j, props = __objRest(_j, ["children"]);
644
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
645
+ },
646
+ h4: (_k) => {
647
+ var _l = _k, { children } = _l, props = __objRest(_l, ["children"]);
648
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h4", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
649
+ },
650
+ h5: (_m) => {
651
+ var _n = _m, { children } = _n, props = __objRest(_n, ["children"]);
652
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h5", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
653
+ },
654
+ h6: (_o) => {
655
+ var _p = _o, { children } = _p, props = __objRest(_p, ["children"]);
656
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h6", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
657
+ },
658
+ p: (_q) => {
659
+ var _r = _q, { children } = _r, props = __objRest(_r, ["children"]);
660
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
661
+ },
662
+ pre: (_s) => {
663
+ var _t = _s, { children } = _t, props = __objRest(_t, ["children"]);
664
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("pre", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
665
+ },
666
+ blockquote: (_u) => {
667
+ var _v = _u, { children } = _v, props = __objRest(_v, ["children"]);
668
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("blockquote", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
669
+ },
670
+ ul: (_w) => {
671
+ var _x = _w, { children } = _x, props = __objRest(_x, ["children"]);
672
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
673
+ },
674
+ li: (_y) => {
675
+ var _z = _y, { children } = _z, props = __objRest(_z, ["children"]);
676
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
677
+ }
678
+ };
679
+ var MemoizedReactMarkdown = (0, import_react3.memo)(
680
+ import_react_markdown.default,
681
+ (prevProps, nextProps) => prevProps.children === nextProps.children && prevProps.components === nextProps.components
682
+ );
683
+ var Markdown = ({ content, components }) => {
684
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "copilotKitMarkdown", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
685
+ MemoizedReactMarkdown,
686
+ {
687
+ components: __spreadValues(__spreadValues({}, defaultComponents), components),
688
+ remarkPlugins: [import_remark_gfm.default, [import_remark_math.default, { singleDollarTextMath: false }]],
689
+ rehypePlugins: [import_rehype_raw.default],
690
+ children: content
691
+ }
692
+ ) });
693
+ };
694
+
695
+ // src/components/chat/messages/AssistantMessage.tsx
696
+ var import_react4 = require("react");
697
+ var import_jsx_runtime6 = require("react/jsx-runtime");
698
+ var AssistantMessage = (props) => {
699
+ var _a;
700
+ const { icons, labels } = useChatContext();
701
+ const {
702
+ message,
703
+ isLoading,
704
+ onRegenerate,
705
+ onCopy,
706
+ onThumbsUp,
707
+ onThumbsDown,
708
+ isCurrentMessage,
709
+ feedback,
710
+ markdownTagRenderers
711
+ } = props;
712
+ const [copied, setCopied] = (0, import_react4.useState)(false);
713
+ const handleCopy = () => {
714
+ const content2 = (message == null ? void 0 : message.content) || "";
715
+ if (content2 && onCopy) {
716
+ navigator.clipboard.writeText(content2);
717
+ setCopied(true);
718
+ onCopy(content2);
719
+ setTimeout(() => setCopied(false), 2e3);
720
+ } else if (content2) {
721
+ navigator.clipboard.writeText(content2);
722
+ setCopied(true);
723
+ setTimeout(() => setCopied(false), 2e3);
724
+ }
725
+ };
726
+ const handleRegenerate = () => {
727
+ if (onRegenerate)
728
+ onRegenerate();
729
+ };
730
+ const handleThumbsUp = () => {
731
+ if (onThumbsUp && message) {
732
+ onThumbsUp(message);
733
+ }
734
+ };
735
+ const handleThumbsDown = () => {
736
+ if (onThumbsDown && message) {
737
+ onThumbsDown(message);
738
+ }
739
+ };
740
+ const LoadingIcon = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: icons.activityIcon });
741
+ const content = (message == null ? void 0 : message.content) || "";
742
+ const subComponent = (_a = message == null ? void 0 : message.generativeUI) == null ? void 0 : _a.call(message);
743
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
744
+ content && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
745
+ content && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Markdown, { content, components: markdownTagRenderers }),
746
+ content && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
747
+ "div",
748
+ {
749
+ className: `copilotKitMessageControls ${isCurrentMessage ? "currentMessage" : ""}`,
750
+ children: [
751
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
752
+ "button",
753
+ {
754
+ className: "copilotKitMessageControlButton",
755
+ onClick: handleRegenerate,
756
+ "aria-label": labels.regenerateResponse,
757
+ title: labels.regenerateResponse,
758
+ children: icons.regenerateIcon
759
+ }
760
+ ),
761
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
762
+ "button",
763
+ {
764
+ className: "copilotKitMessageControlButton",
765
+ onClick: handleCopy,
766
+ "aria-label": labels.copyToClipboard,
767
+ title: labels.copyToClipboard,
768
+ children: copied ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { fontSize: "10px", fontWeight: "bold" }, children: "\u2713" }) : icons.copyIcon
769
+ }
770
+ ),
771
+ onThumbsUp && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
772
+ "button",
773
+ {
774
+ className: `copilotKitMessageControlButton ${feedback === "thumbsUp" ? "active" : ""}`,
775
+ onClick: handleThumbsUp,
776
+ "aria-label": labels.thumbsUp,
777
+ title: labels.thumbsUp,
778
+ children: icons.thumbsUpIcon
779
+ }
780
+ ),
781
+ onThumbsDown && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
782
+ "button",
783
+ {
784
+ className: `copilotKitMessageControlButton ${feedback === "thumbsDown" ? "active" : ""}`,
785
+ onClick: handleThumbsDown,
786
+ "aria-label": labels.thumbsDown,
787
+ title: labels.thumbsDown,
788
+ children: icons.thumbsDownIcon
789
+ }
790
+ )
791
+ ]
792
+ }
793
+ )
794
+ ] }),
795
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { marginBottom: "0.5rem" }, children: subComponent }),
796
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(LoadingIcon, {})
797
+ ] });
798
+ };
799
+
800
+ // src/components/chat/messages/ImageRenderer.tsx
801
+ var import_react5 = require("react");
802
+ var import_jsx_runtime7 = require("react/jsx-runtime");
803
+ var ImageRenderer = ({ image, content, className = "" }) => {
804
+ const [imageError, setImageError] = (0, import_react5.useState)(false);
805
+ const imageSrc = `data:image/${image.format};base64,${image.bytes}`;
806
+ const altText = content || "User uploaded image";
807
+ const handleImageError = () => {
808
+ setImageError(true);
809
+ };
810
+ if (imageError) {
811
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `copilotKitImageRendering copilotKitImageRenderingError ${className}`, children: [
812
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "copilotKitImageRenderingErrorMessage", children: "Failed to load image" }),
813
+ content && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "copilotKitImageRenderingContent", children: content })
814
+ ] });
815
+ }
816
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `copilotKitImageRendering ${className}`, children: [
817
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
818
+ "img",
819
+ {
820
+ src: imageSrc,
821
+ alt: altText,
822
+ className: "copilotKitImageRenderingImage",
823
+ onError: handleImageError
824
+ }
825
+ ),
826
+ content && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "copilotKitImageRenderingContent", children: content })
827
+ ] });
828
+ };
829
+
830
+ // src/components/chat/messages/RenderMessage.tsx
831
+ var import_jsx_runtime8 = require("react/jsx-runtime");
832
+ function RenderMessage(_a) {
833
+ var _b = _a, {
834
+ UserMessage: UserMessage2 = UserMessage,
835
+ AssistantMessage: AssistantMessage2 = AssistantMessage,
836
+ ImageRenderer: ImageRenderer2 = ImageRenderer
837
+ } = _b, props = __objRest(_b, [
838
+ "UserMessage",
839
+ "AssistantMessage",
840
+ "ImageRenderer"
841
+ ]);
842
+ var _a2;
843
+ const {
844
+ message,
845
+ messages,
846
+ inProgress,
847
+ index,
848
+ isCurrentMessage,
849
+ onRegenerate,
850
+ onCopy,
851
+ onThumbsUp,
852
+ onThumbsDown,
853
+ messageFeedback,
854
+ markdownTagRenderers
855
+ } = props;
856
+ switch (message.role) {
857
+ case "user":
858
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
859
+ UserMessage2,
860
+ {
861
+ rawData: message,
862
+ "data-message-role": "user",
863
+ message,
864
+ ImageRenderer: ImageRenderer2
865
+ },
866
+ index
867
+ );
868
+ case "assistant":
869
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
870
+ AssistantMessage2,
871
+ {
872
+ "data-message-role": "assistant",
873
+ subComponent: (_a2 = message.generativeUI) == null ? void 0 : _a2.call(message),
874
+ rawData: message,
875
+ message,
876
+ messages,
877
+ isLoading: inProgress && isCurrentMessage && !message.content,
878
+ isGenerating: inProgress && isCurrentMessage && !!message.content,
879
+ isCurrentMessage,
880
+ onRegenerate: () => onRegenerate == null ? void 0 : onRegenerate(message.id),
881
+ onCopy,
882
+ onThumbsUp,
883
+ onThumbsDown,
884
+ feedback: (messageFeedback == null ? void 0 : messageFeedback[message.id]) || null,
885
+ markdownTagRenderers,
886
+ ImageRenderer: ImageRenderer2
887
+ },
888
+ index
889
+ );
890
+ default:
891
+ return null;
892
+ }
893
+ }
894
+
895
+ // src/components/chat/messages/LegacyRenderMessage.tsx
896
+ var import_runtime_client_gql = require("@copilotkit/runtime-client-gql");
897
+ var import_jsx_runtime9 = require("react/jsx-runtime");
898
+ var LegacyRenderMessage = ({
899
+ message,
900
+ messages,
901
+ inProgress,
902
+ index,
903
+ isCurrentMessage,
904
+ actionResult,
905
+ AssistantMessage: AssistantMessage2,
906
+ UserMessage: UserMessage2,
907
+ ImageRenderer: ImageRenderer2,
908
+ onRegenerate,
909
+ onCopy,
910
+ onThumbsUp,
911
+ onThumbsDown,
912
+ markdownTagRenderers,
913
+ legacyProps
914
+ }) => {
915
+ var _a;
916
+ const {
917
+ RenderTextMessage,
918
+ RenderActionExecutionMessage,
919
+ RenderAgentStateMessage,
920
+ RenderResultMessage,
921
+ RenderImageMessage
922
+ } = legacyProps;
923
+ const deprecatedMessage = (_a = (0, import_runtime_client_gql.aguiToGQL)(message)[0]) != null ? _a : void 0;
924
+ if (deprecatedMessage.isTextMessage() && RenderTextMessage) {
925
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
926
+ RenderTextMessage,
927
+ {
928
+ message,
929
+ messages,
930
+ inProgress,
931
+ index,
932
+ isCurrentMessage,
933
+ AssistantMessage: AssistantMessage2,
934
+ UserMessage: UserMessage2,
935
+ onRegenerate,
936
+ onCopy,
937
+ onThumbsUp,
938
+ onThumbsDown,
939
+ markdownTagRenderers
940
+ }
941
+ );
942
+ }
943
+ if (deprecatedMessage.isActionExecutionMessage() && RenderActionExecutionMessage) {
944
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
945
+ RenderActionExecutionMessage,
946
+ {
947
+ messages,
948
+ message,
949
+ inProgress,
950
+ index,
951
+ isCurrentMessage,
952
+ actionResult,
953
+ AssistantMessage: AssistantMessage2,
954
+ UserMessage: UserMessage2
955
+ }
956
+ );
957
+ }
958
+ if (deprecatedMessage.isAgentStateMessage() && RenderAgentStateMessage) {
959
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
960
+ RenderAgentStateMessage,
961
+ {
962
+ messages,
963
+ message,
964
+ inProgress,
965
+ index,
966
+ isCurrentMessage,
967
+ AssistantMessage: AssistantMessage2,
968
+ UserMessage: UserMessage2
969
+ }
970
+ );
971
+ }
972
+ if (deprecatedMessage.isResultMessage() && RenderResultMessage) {
973
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
974
+ RenderResultMessage,
975
+ {
976
+ messages,
977
+ message,
978
+ inProgress,
979
+ index,
980
+ isCurrentMessage,
981
+ AssistantMessage: AssistantMessage2,
982
+ UserMessage: UserMessage2
983
+ }
984
+ );
985
+ }
986
+ if (deprecatedMessage.isImageMessage() && RenderImageMessage) {
987
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
988
+ RenderImageMessage,
989
+ {
990
+ messages,
991
+ message,
992
+ inProgress,
993
+ index,
994
+ isCurrentMessage,
995
+ AssistantMessage: AssistantMessage2,
996
+ UserMessage: UserMessage2
997
+ }
998
+ );
999
+ }
1000
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1001
+ RenderMessage,
1002
+ {
1003
+ messages,
1004
+ message,
1005
+ inProgress,
1006
+ index,
1007
+ isCurrentMessage,
1008
+ AssistantMessage: AssistantMessage2,
1009
+ UserMessage: UserMessage2,
1010
+ ImageRenderer: ImageRenderer2,
1011
+ onRegenerate,
1012
+ onCopy,
1013
+ onThumbsUp,
1014
+ onThumbsDown,
1015
+ markdownTagRenderers
1016
+ }
1017
+ );
1018
+ };
1019
+ // Annotate the CommonJS export names for ESM import in node:
1020
+ 0 && (module.exports = {
1021
+ LegacyRenderMessage
1022
+ });
1023
+ //# sourceMappingURL=LegacyRenderMessage.js.map