reachat 3.1.0 → 3.2.1

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.
package/dist/index.css CHANGED
@@ -106,6 +106,7 @@
106
106
  --radius-xl: 0.75rem;
107
107
  --radius-2xl: 1rem;
108
108
  --radius-3xl: 1.5rem;
109
+ --ease-out: cubic-bezier(0, 0, 0.2, 1);
109
110
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
110
111
  --blur-md: 12px;
111
112
  --default-transition-duration: 150ms;
@@ -981,6 +982,9 @@
981
982
  .w-\[500px\] {
982
983
  width: 500px;
983
984
  }
985
+ .w-\[800px\] {
986
+ width: 800px;
987
+ }
984
988
  .w-auto {
985
989
  width: auto;
986
990
  }
@@ -1142,6 +1146,9 @@
1142
1146
  .-rotate-90 {
1143
1147
  rotate: calc(90deg * -1);
1144
1148
  }
1149
+ .rotate-45 {
1150
+ rotate: 45deg;
1151
+ }
1145
1152
  .rotate-90 {
1146
1153
  rotate: 90deg;
1147
1154
  }
@@ -1486,6 +1493,10 @@
1486
1493
  border-top-style: var(--tw-border-style);
1487
1494
  border-top-width: 1px;
1488
1495
  }
1496
+ .border-r {
1497
+ border-right-style: var(--tw-border-style);
1498
+ border-right-width: 1px;
1499
+ }
1489
1500
  .border-b {
1490
1501
  border-bottom-style: var(--tw-border-style);
1491
1502
  border-bottom-width: 1px;
@@ -1640,6 +1651,9 @@
1640
1651
  .bg-green-800 {
1641
1652
  background-color: var(--color-green-800);
1642
1653
  }
1654
+ .bg-inherit {
1655
+ background-color: inherit;
1656
+ }
1643
1657
  .bg-lime-600 {
1644
1658
  background-color: var(--color-lime-600);
1645
1659
  }
@@ -1993,6 +2007,9 @@
1993
2007
  .pt-2\.5 {
1994
2008
  padding-top: calc(var(--spacing) * 2.5);
1995
2009
  }
2010
+ .pt-4 {
2011
+ padding-top: calc(var(--spacing) * 4);
2012
+ }
1996
2013
  .pt-7 {
1997
2014
  padding-top: calc(var(--spacing) * 7);
1998
2015
  }
@@ -2044,6 +2061,9 @@
2044
2061
  .pb-6 {
2045
2062
  padding-bottom: calc(var(--spacing) * 6);
2046
2063
  }
2064
+ .pb-8 {
2065
+ padding-bottom: calc(var(--spacing) * 8);
2066
+ }
2047
2067
  .pb-\[10px\] {
2048
2068
  padding-bottom: 10px;
2049
2069
  }
@@ -2369,6 +2389,10 @@
2369
2389
  --tw-shadow: 0 25px 50px -12px var(--tw-shadow-color, rgb(0 0 0 / 0.25));
2370
2390
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
2371
2391
  }
2392
+ .shadow-\[0_4px_20px_0_\#e1e2e333_inset\] {
2393
+ --tw-shadow: 0 4px 20px 0 var(--tw-shadow-color, #e1e2e333) inset;
2394
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
2395
+ }
2372
2396
  .shadow-\[0px_4px_4px_0px_rgba\(0\,0\,0\,0\.20\)\] {
2373
2397
  --tw-shadow: 0px 4px 4px 0px var(--tw-shadow-color, rgba(0,0,0,0.20));
2374
2398
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
@@ -2471,6 +2495,10 @@
2471
2495
  --tw-ease: linear;
2472
2496
  transition-timing-function: linear;
2473
2497
  }
2498
+ .ease-out {
2499
+ --tw-ease: var(--ease-out);
2500
+ transition-timing-function: var(--ease-out);
2501
+ }
2474
2502
  .will-change-\[border-color\] {
2475
2503
  will-change: border-color;
2476
2504
  }
@@ -2805,6 +2833,13 @@
2805
2833
  }
2806
2834
  }
2807
2835
  }
2836
+ .hover\:border-transparent {
2837
+ &:hover {
2838
+ @media (hover: hover) {
2839
+ border-color: transparent;
2840
+ }
2841
+ }
2842
+ }
2808
2843
  .hover\:bg-blue-100 {
2809
2844
  &:hover {
2810
2845
  @media (hover: hover) {
@@ -3368,14 +3403,6 @@
3368
3403
  background-color: var(--color-gray-700);
3369
3404
  }
3370
3405
  }
3371
- .dark\:bg-gray-700\/50 {
3372
- &:where(.theme-dark, .theme-dark *, [data-theme=dark], [data-theme=dark] *) {
3373
- background-color: color-mix(in srgb, oklch(37.3% 0.034 259.733) 50%, transparent);
3374
- @supports (color: color-mix(in lab, red, red)) {
3375
- background-color: color-mix(in oklab, var(--color-gray-700) 50%, transparent);
3376
- }
3377
- }
3378
- }
3379
3406
  .dark\:bg-gray-800 {
3380
3407
  &:where(.theme-dark, .theme-dark *, [data-theme=dark], [data-theme=dark] *) {
3381
3408
  background-color: var(--color-gray-800);
package/dist/index.d.ts CHANGED
@@ -12,3 +12,5 @@ export * from './ChatSuggestions';
12
12
  export * from './MessageStatus';
13
13
  export * from './useAgUi';
14
14
  export * from './ComponentCatalog';
15
+ export * from './types';
16
+ export * from './utils';
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@
10
10
  console.error("vite-plugin-css-injected-by-js", e);
11
11
  }
12
12
  })();
13
- import { A, b, C, c, d, e, f, g, h, i, j, k, F, M, l, m, n, o, p, q, r, s, t, u, N, R, v, w, x, y, z, B, D, E, G, H, T, I, J, K, L, O, P, Q, U, V, W, X, Y, Z, _, $, a0, a1, a2 } from "./index-CZSBRZbI.js";
13
+ import { A, b, C, c, d, e, f, g, h, i, j, k, F, M, l, m, n, o, p, q, r, s, t, u, N, R, v, w, x, y, z, B, D, E, G, H, T, I, J, K, L, O, P, Q, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3 } from "./index-BiStNXJ4.js";
14
14
  import "react/jsx-runtime";
15
15
  import "react";
16
16
  import "reablocks";
@@ -64,12 +64,13 @@ export {
64
64
  V as creditCardMatcher,
65
65
  W as dark,
66
66
  X as generatePrompt,
67
- Y as light,
68
- Z as remarkComponent,
69
- _ as remarkCve,
70
- $ as remarkRedact,
71
- a0 as ssnMatcher,
72
- a1 as useAgUi,
73
- a2 as validateSpec
67
+ Y as groupSessionsByDate,
68
+ Z as light,
69
+ _ as remarkComponent,
70
+ $ as remarkCve,
71
+ a0 as remarkRedact,
72
+ a1 as ssnMatcher,
73
+ a2 as useAgUi,
74
+ a3 as validateSpec
74
75
  };
75
76
  //# sourceMappingURL=index.js.map
@@ -11,8 +11,8 @@
11
11
  }
12
12
  })();
13
13
  (function(global, factory) {
14
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react/jsx-runtime"), require("reablocks"), require("react"), require("motion/react"), require("@tiptap/react"), require("@floating-ui/dom"), require("@tiptap/extension-document"), require("@tiptap/extension-paragraph"), require("@tiptap/extension-text"), require("@tiptap/extension-hard-break"), require("@tiptap/extension-placeholder"), require("@tiptap/extension-mention"), require("@radix-ui/react-slot"), require("react-markdown"), require("react-syntax-highlighter"), require("rehype-katex"), require("rehype-raw"), require("reaviz"), require("mdast-util-find-and-replace"), require("lodash/debounce.js"), require("reakeys"), require("remark-gfm"), require("remark-youtube"), require("remark-math"), require("date-fns"), require("@floating-ui/react"), require("zod")) : typeof define === "function" && define.amd ? define(["exports", "react/jsx-runtime", "reablocks", "react", "motion/react", "@tiptap/react", "@floating-ui/dom", "@tiptap/extension-document", "@tiptap/extension-paragraph", "@tiptap/extension-text", "@tiptap/extension-hard-break", "@tiptap/extension-placeholder", "@tiptap/extension-mention", "@radix-ui/react-slot", "react-markdown", "react-syntax-highlighter", "rehype-katex", "rehype-raw", "reaviz", "mdast-util-find-and-replace", "lodash/debounce.js", "reakeys", "remark-gfm", "remark-youtube", "remark-math", "date-fns", "@floating-ui/react", "zod"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.reachat = {}, global.jsxRuntime, global.reablocks, global.React, global.react$1, global.react, global.dom, global.Document, global.Paragraph, global.Text, global.HardBreak, global.Placeholder, global.Mention, global.reactSlot, global.ReactMarkdown, global.reactSyntaxHighlighter, global.rehypeKatex, global.rehypeRaw, global.reaviz, global.mdastUtilFindAndReplace, global.debounce, global.reakeys, global.remarkGfm, global.remarkYoutube, global.remarkMath, global.dateFns, global.react$2, global.zod));
15
- })(this, (function(exports2, jsxRuntime, reablocks, React, react$1, react, dom, Document, Paragraph, Text, HardBreak, Placeholder, Mention, reactSlot, ReactMarkdown, reactSyntaxHighlighter, rehypeKatex, rehypeRaw, reaviz, mdastUtilFindAndReplace, debounce, reakeys, remarkGfm, remarkYoutube, remarkMath, dateFns, react$2, zod) {
14
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react/jsx-runtime"), require("reablocks"), require("react"), require("motion/react"), require("@tiptap/react"), require("@floating-ui/dom"), require("@tiptap/extension-document"), require("@tiptap/extension-paragraph"), require("@tiptap/extension-text"), require("@tiptap/extension-hard-break"), require("@tiptap/extension-placeholder"), require("@tiptap/extension-mention"), require("@radix-ui/react-slot"), require("react-markdown"), require("rehype-katex"), require("rehype-raw"), require("react-syntax-highlighter"), require("reaviz"), require("mdast-util-find-and-replace"), require("lodash/debounce.js"), require("reakeys"), require("remark-gfm"), require("remark-youtube"), require("remark-math"), require("date-fns"), require("@floating-ui/react"), require("zod")) : typeof define === "function" && define.amd ? define(["exports", "react/jsx-runtime", "reablocks", "react", "motion/react", "@tiptap/react", "@floating-ui/dom", "@tiptap/extension-document", "@tiptap/extension-paragraph", "@tiptap/extension-text", "@tiptap/extension-hard-break", "@tiptap/extension-placeholder", "@tiptap/extension-mention", "@radix-ui/react-slot", "react-markdown", "rehype-katex", "rehype-raw", "react-syntax-highlighter", "reaviz", "mdast-util-find-and-replace", "lodash/debounce.js", "reakeys", "remark-gfm", "remark-youtube", "remark-math", "date-fns", "@floating-ui/react", "zod"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.reachat = {}, global.jsxRuntime, global.reablocks, global.React, global.react$1, global.react, global.dom, global.Document, global.Paragraph, global.Text, global.HardBreak, global.Placeholder, global.Mention, global.reactSlot, global.ReactMarkdown, global.rehypeKatex, global.rehypeRaw, global.reactSyntaxHighlighter, global.reaviz, global.mdastUtilFindAndReplace, global.debounce, global.reakeys, global.remarkGfm, global.remarkYoutube, global.remarkMath, global.dateFns, global.react$2, global.zod));
15
+ })(this, (function(exports2, jsxRuntime, reablocks, React, react$1, react, dom, Document, Paragraph, Text, HardBreak, Placeholder, Mention, reactSlot, ReactMarkdown, rehypeKatex, rehypeRaw, reactSyntaxHighlighter, reaviz, mdastUtilFindAndReplace, debounce, reakeys, remarkGfm, remarkYoutube, remarkMath, dateFns, react$2, zod) {
16
16
  "use strict";
17
17
  function _interopNamespaceDefault(e) {
18
18
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -40,6 +40,7 @@
40
40
  const SvgPaperclip = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1, strokeLinecap: "round", strokeLinejoin: "round", className: "lucide lucide-paperclip", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48" }));
41
41
  const FileInput = ({
42
42
  allowedFiles,
43
+ multiple,
43
44
  onFileUpload,
44
45
  isLoading,
45
46
  disabled,
@@ -55,6 +56,7 @@
55
56
  ref: fileInputRef,
56
57
  className: "hidden",
57
58
  accept: allowedFiles.join(","),
59
+ multiple,
58
60
  onChange: (e) => {
59
61
  onFileUpload(e);
60
62
  if (fileInputRef.current) {
@@ -185,17 +187,25 @@
185
187
  }
186
188
  },
187
189
  markdown: {
190
+ hr: "my-4 border-t border-stroke-neutral-4",
188
191
  copy: "sticky py-1 [&>svg]:w-4 [&>svg]:h-4 opacity-50",
189
192
  p: "mb-2",
190
- a: "text-blue-400 underline",
193
+ a: "text-buttons-colors-link-primary-text-resting underline",
191
194
  table: "table-auto w-full m-2",
192
- th: "px-4 py-2 text-left font-bold border-b border-gray-500",
195
+ th: "px-4 py-2 text-left font-bold border-b border-stroke-neutral-4",
193
196
  td: "px-4 py-2",
194
197
  code: "m-2 rounded-b relative",
195
- toolbar: "text-xs dark:bg-gray-700/50 flex items-center justify-between px-2 py-1 rounded-t sticky top-0 backdrop-blur-md bg-gray-200 ",
198
+ inlineCode: "bg-gradient-neutral-200 p-1 rounded",
199
+ toolbar: "text-xs flex items-center justify-between px-2 py-1 rounded-t sticky top-0 backdrop-blur-md bg-gradient-neutral-500/50",
196
200
  li: "mb-2 ml-6",
197
201
  ul: "mb-4 list-disc",
198
- ol: "mb-4 list-decimal"
202
+ ol: "mb-4 list-decimal",
203
+ h1: "text-4xl font-bold mb-4 mt-6",
204
+ h2: "text-3xl font-bold mb-3 mt-5",
205
+ h3: "text-2xl font-bold mb-3 mt-4",
206
+ h4: "text-xl font-bold mb-2 mt-3",
207
+ h5: "text-lg font-bold mb-2 mt-2",
208
+ h6: "text-base font-bold mb-2 mt-2"
199
209
  },
200
210
  footer: {
201
211
  base: "mt-3 flex gap-1.5",
@@ -656,7 +666,9 @@
656
666
  ({
657
667
  allowedFiles,
658
668
  placeholder = "Type a message...",
669
+ allowMultipleFiles = false,
659
670
  defaultValue,
671
+ className,
660
672
  sendIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgSend, {}),
661
673
  stopIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgStop, {}),
662
674
  attachIcon,
@@ -664,7 +676,8 @@
664
676
  commands,
665
677
  minHeight = 24,
666
678
  maxHeight = 200,
667
- autoFocus = true
679
+ autoFocus = true,
680
+ onMessageChange
668
681
  }, ref) => {
669
682
  const {
670
683
  theme,
@@ -693,6 +706,7 @@
693
706
  setValue: (value) => {
694
707
  setMessage(value);
695
708
  inputRef.current?.setValue(value);
709
+ onMessageChange?.(value);
696
710
  },
697
711
  insertText: (text) => {
698
712
  inputRef.current?.insertText(text);
@@ -715,18 +729,19 @@
715
729
  },
716
730
  [sendMessage]
717
731
  );
718
- const handleChange = React.useCallback((value) => {
719
- setMessage(value);
720
- }, []);
721
- const handleFileUpload = React.useCallback(
722
- (event) => {
723
- const file = event.target.files?.[0];
724
- if (file && fileUpload) {
725
- fileUpload(file);
726
- }
732
+ const handleChange = React.useCallback(
733
+ (value) => {
734
+ setMessage(value);
735
+ onMessageChange?.(value);
727
736
  },
728
- [fileUpload]
737
+ [onMessageChange]
729
738
  );
739
+ const handleFileUpload = (event) => {
740
+ const files = event.target.files;
741
+ if (files?.length && fileUpload) {
742
+ fileUpload(allowMultipleFiles ? Array.from(files) : files[0]);
743
+ }
744
+ };
730
745
  const mentionsConfig = React.useMemo(
731
746
  () => mentions ? { ...mentions, trigger: mentions.trigger || "@" } : void 0,
732
747
  [mentions]
@@ -735,7 +750,7 @@
735
750
  () => commands ? { ...commands, trigger: commands.trigger || "/" } : void 0,
736
751
  [commands]
737
752
  );
738
- return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: containerRef, className: reablocks.cn(theme.input.base), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn("relative flex-1", theme.input.input), children: [
753
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: containerRef, className: reablocks.cn(theme.input.base, className), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn("relative flex-1", theme.input.input), children: [
739
754
  /* @__PURE__ */ jsxRuntime.jsx(
740
755
  RichTextInput,
741
756
  {
@@ -758,6 +773,7 @@
758
773
  FileInput,
759
774
  {
760
775
  allowedFiles,
776
+ multiple: allowMultipleFiles,
761
777
  onFileUpload: handleFileUpload,
762
778
  isLoading,
763
779
  disabled,
@@ -1858,14 +1874,17 @@
1858
1874
  const CodeHighlighter = ({
1859
1875
  className,
1860
1876
  children,
1877
+ inlineClassName,
1861
1878
  copyClassName,
1862
1879
  copyIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgCopy, {}),
1863
1880
  language,
1864
1881
  toolbarClassName,
1865
- theme = dark
1882
+ theme = dark,
1883
+ ...props
1866
1884
  }) => {
1867
1885
  const match = language?.match(/language-(\w+)/);
1868
1886
  const lang = match ? match[1] : "text";
1887
+ const isInline = !match;
1869
1888
  const handleCopy = (text) => {
1870
1889
  navigator.clipboard.writeText(text).then(() => {
1871
1890
  console.log("Text copied to clipboard");
@@ -1873,6 +1892,9 @@
1873
1892
  console.error("Could not copy text: ", err);
1874
1893
  });
1875
1894
  };
1895
+ if (isInline) {
1896
+ return /* @__PURE__ */ jsxRuntime.jsx("code", { className: reablocks.cn(inlineClassName), ...props, children });
1897
+ }
1876
1898
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn("relative", className), children: [
1877
1899
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn(toolbarClassName), children: [
1878
1900
  /* @__PURE__ */ jsxRuntime.jsx("div", { children: lang }),
@@ -1888,14 +1910,7 @@
1888
1910
  }
1889
1911
  )
1890
1912
  ] }),
1891
- /* @__PURE__ */ jsxRuntime.jsx(
1892
- reactSyntaxHighlighter.Prism,
1893
- {
1894
- language: lang,
1895
- style: theme,
1896
- children
1897
- }
1898
- )
1913
+ /* @__PURE__ */ jsxRuntime.jsx(reactSyntaxHighlighter.Prism, { language: lang, style: theme, children })
1899
1914
  ] });
1900
1915
  };
1901
1916
  const TableComponent = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("table", { ...props, children });
@@ -1905,16 +1920,19 @@
1905
1920
  children,
1906
1921
  remarkPlugins,
1907
1922
  rehypePlugins = [rehypeRaw, rehypeKatex],
1923
+ theme: themeProp,
1908
1924
  customComponents
1909
1925
  }) => {
1910
- const { theme, markdownComponents } = React.useContext(ChatContext);
1926
+ const { theme: contextTheme, markdownComponents } = React.useContext(ChatContext);
1927
+ const theme = themeProp || contextTheme;
1911
1928
  const components = React.useMemo(() => {
1912
1929
  const defaultComponents = {
1913
1930
  code: ({ className, children: children2, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1914
1931
  CodeHighlighter,
1915
1932
  {
1916
1933
  ...props,
1917
- language: className,
1934
+ language: reablocks.cn(className),
1935
+ inlineClassName: reablocks.cn(theme.messages.message.markdown.inlineCode),
1918
1936
  className: reablocks.cn(theme.messages.message.markdown.code, className),
1919
1937
  copyClassName: reablocks.cn(theme.messages.message.markdown.copy),
1920
1938
  toolbarClassName: reablocks.cn(theme.messages.message.markdown.toolbar),
@@ -1943,10 +1961,17 @@
1943
1961
  }
1944
1962
  ),
1945
1963
  a: (props) => /* @__PURE__ */ jsxRuntime.jsx("a", { ...props, className: reablocks.cn(theme.messages.message.markdown.a) }),
1964
+ hr: (props) => /* @__PURE__ */ jsxRuntime.jsx("hr", { ...props, className: reablocks.cn(theme.messages.message.markdown.hr) }),
1946
1965
  p: (props) => /* @__PURE__ */ jsxRuntime.jsx("p", { ...props, className: reablocks.cn(theme.messages.message.markdown.p) }),
1947
1966
  li: (props) => /* @__PURE__ */ jsxRuntime.jsx("li", { ...props, className: reablocks.cn(theme.messages.message.markdown.li) }),
1948
1967
  ul: (props) => /* @__PURE__ */ jsxRuntime.jsx("ul", { ...props, className: reablocks.cn(theme.messages.message.markdown.ul) }),
1949
1968
  ol: (props) => /* @__PURE__ */ jsxRuntime.jsx("ol", { ...props, className: reablocks.cn(theme.messages.message.markdown.ol) }),
1969
+ h1: (props) => /* @__PURE__ */ jsxRuntime.jsx("h1", { ...props, className: reablocks.cn(theme.messages.message.markdown.h1) }),
1970
+ h2: (props) => /* @__PURE__ */ jsxRuntime.jsx("h2", { ...props, className: reablocks.cn(theme.messages.message.markdown.h2) }),
1971
+ h3: (props) => /* @__PURE__ */ jsxRuntime.jsx("h3", { ...props, className: reablocks.cn(theme.messages.message.markdown.h3) }),
1972
+ h4: (props) => /* @__PURE__ */ jsxRuntime.jsx("h4", { ...props, className: reablocks.cn(theme.messages.message.markdown.h4) }),
1973
+ h5: (props) => /* @__PURE__ */ jsxRuntime.jsx("h5", { ...props, className: reablocks.cn(theme.messages.message.markdown.h5) }),
1974
+ h6: (props) => /* @__PURE__ */ jsxRuntime.jsx("h6", { ...props, className: reablocks.cn(theme.messages.message.markdown.h6) }),
1950
1975
  // 'redact' is a custom element created by remarkRedact, not a standard
1951
1976
  // HTML tag, so it falls outside react-markdown's Components type.
1952
1977
  redact: ((props) => /* @__PURE__ */ jsxRuntime.jsx(
@@ -2088,25 +2113,18 @@
2088
2113
  ] });
2089
2114
  };
2090
2115
  const CVE_REGEX = /(CVE-(19|20)\d{2}-\d{4,7})/gi;
2091
- function remarkCve() {
2092
- return (tree, _file) => {
2093
- mdastUtilFindAndReplace.findAndReplace(tree, [[
2116
+ const remarkCve = () => (tree) => {
2117
+ mdastUtilFindAndReplace.findAndReplace(tree, [
2118
+ [
2094
2119
  CVE_REGEX,
2095
- replaceCve
2096
- ]]);
2097
- };
2098
- function replaceCve(value, id) {
2099
- return [
2100
- {
2120
+ (value) => ({
2101
2121
  type: "link",
2102
- url: `https://cve.mitre.org/cgi-bin/cvename.cgi?name=${id}`,
2103
- children: [
2104
- { children: [{ type: "text", value: value.trim() }] }
2105
- ]
2106
- }
2107
- ];
2108
- }
2109
- }
2122
+ url: `https://cve.mitre.org/cgi-bin/cvename.cgi?name=${value.trim()}`,
2123
+ children: [{ type: "text", value: value.trim() }]
2124
+ })
2125
+ ]
2126
+ ]);
2127
+ };
2110
2128
  const remarkComponent = (_options = {}) => {
2111
2129
  return () => {
2112
2130
  };
@@ -2446,7 +2464,7 @@
2446
2464
  ...props,
2447
2465
  children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2448
2466
  /* @__PURE__ */ jsxRuntime.jsx(MessageFiles, { files }),
2449
- /* @__PURE__ */ jsxRuntime.jsx(Markdown, { remarkPlugins, children: question }),
2467
+ /* @__PURE__ */ jsxRuntime.jsx(Markdown, { remarkPlugins, theme, children: question }),
2450
2468
  isLong && !expanded && /* @__PURE__ */ jsxRuntime.jsx(
2451
2469
  reablocks.Button,
2452
2470
  {
@@ -2473,7 +2491,7 @@
2473
2491
  "data-compact": isCompact,
2474
2492
  className: reablocks.cn(theme.messages.message.response),
2475
2493
  children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2476
- /* @__PURE__ */ jsxRuntime.jsx(Markdown, { remarkPlugins, children: response }),
2494
+ /* @__PURE__ */ jsxRuntime.jsx(Markdown, { remarkPlugins, theme, children: response }),
2477
2495
  isLoading && /* @__PURE__ */ jsxRuntime.jsx(
2478
2496
  react$1.motion.div,
2479
2497
  {
@@ -2491,7 +2509,6 @@
2491
2509
  );
2492
2510
  }
2493
2511
  );
2494
- MessageResponse.displayName = "MessageResponse";
2495
2512
  const MessageSource = ({ title, url, image, limit = 50 }) => {
2496
2513
  const { theme, isCompact } = React.useContext(ChatContext);
2497
2514
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2623,9 +2640,9 @@ ${response}` : ""}`);
2623
2640
  }
2624
2641
  };
2625
2642
  const SessionMessage = React.memo(
2626
- ({ conversation, isLast, children }) => {
2643
+ ({ conversation, isLast, children, className }) => {
2627
2644
  const { theme, isLoading } = React.useContext(ChatContext);
2628
- return /* @__PURE__ */ jsxRuntime.jsx(react$1.motion.div, { variants: messageVariants, children: /* @__PURE__ */ jsxRuntime.jsx(reablocks.Card, { className: reablocks.cn(theme.messages.message.base), children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2645
+ return /* @__PURE__ */ jsxRuntime.jsx(react$1.motion.div, { variants: messageVariants, children: /* @__PURE__ */ jsxRuntime.jsx(reablocks.Card, { className: reablocks.cn(theme.messages.message.base, className), children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2629
2646
  /* @__PURE__ */ jsxRuntime.jsx(
2630
2647
  MessageQuestion,
2631
2648
  {
@@ -2666,8 +2683,14 @@ ${response}` : ""}`);
2666
2683
  children,
2667
2684
  newSessionContent,
2668
2685
  limit = 10,
2686
+ className,
2669
2687
  showMoreText = "Show more",
2670
- showScrollBottomButton = false
2688
+ autoScroll = true,
2689
+ showLoadMoreButton = false,
2690
+ showScrollBottomButton,
2691
+ loadMoreButtonDisabled,
2692
+ onScroll,
2693
+ onLoadMore
2671
2694
  }) => {
2672
2695
  const { activeSession, theme } = React.useContext(ChatContext);
2673
2696
  const contentRef = React.useRef(null);
@@ -2690,12 +2713,12 @@ ${response}` : ""}`);
2690
2713
  return () => currentRef.removeEventListener("scroll", handleScroll);
2691
2714
  }, [showScrollBottomButton]);
2692
2715
  React.useEffect(() => {
2693
- if (contentRef.current) {
2716
+ if (contentRef.current && autoScroll) {
2694
2717
  requestAnimationFrame(
2695
2718
  () => contentRef.current.scrollTop = contentRef.current.scrollHeight
2696
2719
  );
2697
2720
  }
2698
- }, [activeSession, isAnimating]);
2721
+ }, [activeSession, autoScroll, isAnimating]);
2699
2722
  const handleShowMore = () => {
2700
2723
  showNext(limit);
2701
2724
  requestAnimationFrame(() => contentRef.current.scrollTop = 0);
@@ -2721,21 +2744,23 @@ ${response}` : ""}`);
2721
2744
  if (!activeSession) {
2722
2745
  return /* @__PURE__ */ jsxRuntime.jsx(SessionEmpty, { children: newSessionContent });
2723
2746
  }
2724
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex-1 overflow-y-hidden", children: [
2747
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn("relative flex-1 overflow-y-hidden", className), children: [
2725
2748
  /* @__PURE__ */ jsxRuntime.jsxs(
2726
2749
  "div",
2727
2750
  {
2728
- className: reablocks.cn(theme.messages.content, "h-full"),
2751
+ className: reablocks.cn(theme.messages.content, className, "h-full"),
2729
2752
  ref: contentRef,
2730
2753
  id: activeSession?.id,
2754
+ onScrollCapture: onScroll,
2731
2755
  children: [
2732
- hasMore && /* @__PURE__ */ jsxRuntime.jsx(
2756
+ (showLoadMoreButton || hasMore) && /* @__PURE__ */ jsxRuntime.jsx(
2733
2757
  reablocks.Button,
2734
2758
  {
2759
+ disabled: loadMoreButtonDisabled,
2735
2760
  variant: "outline",
2736
2761
  className: reablocks.cn(theme.messages.showMore),
2737
2762
  fullWidth: true,
2738
- onClick: handleShowMore,
2763
+ onClick: onLoadMore ?? handleShowMore,
2739
2764
  children: showMoreText
2740
2765
  }
2741
2766
  ),
@@ -2748,7 +2773,7 @@ ${response}` : ""}`);
2748
2773
  animate: "visible",
2749
2774
  onAnimationComplete: () => requestAnimationFrame(() => {
2750
2775
  setIsAnimating(false);
2751
- if (contentRef.current) {
2776
+ if (contentRef.current && autoScroll) {
2752
2777
  contentRef.current.scrollTop = contentRef.current.scrollHeight;
2753
2778
  }
2754
2779
  }),
@@ -2779,7 +2804,7 @@ ${response}` : ""}`);
2779
2804
  {
2780
2805
  onClick: handleScrollToBottom,
2781
2806
  className: theme.messages?.message?.scrollToBottom?.button,
2782
- size: "sm",
2807
+ size: "small",
2783
2808
  children: /* @__PURE__ */ jsxRuntime.jsx(SvgArrowDown, {})
2784
2809
  }
2785
2810
  )
@@ -4139,6 +4164,7 @@ ${componentDocs}`;
4139
4164
  exports2.creditCardMatcher = creditCardMatcher;
4140
4165
  exports2.dark = dark;
4141
4166
  exports2.generatePrompt = generatePrompt;
4167
+ exports2.groupSessionsByDate = groupSessionsByDate;
4142
4168
  exports2.light = light;
4143
4169
  exports2.remarkComponent = remarkComponent;
4144
4170
  exports2.remarkCve = remarkCve;