reachat 2.1.0-alpha.1 → 2.1.0-alpha.11

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 (53) hide show
  1. package/dist/AppBar/AppBar.d.ts +1 -1
  2. package/dist/{CSVFileRenderer-BAbkFZ2w.js → CSVFileRenderer-Bn37a1kj.js} +15 -14
  3. package/dist/CSVFileRenderer-Bn37a1kj.js.map +1 -0
  4. package/dist/Chat.d.ts +3 -3
  5. package/dist/ChatBubble/ChatBubble.d.ts +1 -1
  6. package/dist/ChatContext.d.ts +2 -2
  7. package/dist/ChatInput/ChatInput.d.ts +24 -0
  8. package/dist/ChatInput/FileInput.d.ts +1 -1
  9. package/dist/{DefaultFileRenderer-Bgc4Jadg.js → DefaultFileRenderer-DW_YJ6ID.js} +2 -2
  10. package/dist/DefaultFileRenderer-DW_YJ6ID.js.map +1 -0
  11. package/dist/ImageFileRenderer-C8tVW3I8.js.map +1 -1
  12. package/dist/Markdown/Markdown.d.ts +5 -0
  13. package/dist/Markdown/Table.d.ts +1 -1
  14. package/dist/Markdown/index.d.ts +2 -2
  15. package/dist/Markdown/plugins/remarkCve.d.ts +1 -1
  16. package/dist/PDFFileRenderer-BBn2EVrV.js +16 -0
  17. package/dist/PDFFileRenderer-BBn2EVrV.js.map +1 -0
  18. package/dist/SessionMessages/SessionEmpty.d.ts +1 -4
  19. package/dist/SessionMessages/SessionMessage/MessageFile/renderers/index.d.ts +1 -1
  20. package/dist/SessionMessages/SessionMessage/MessageFiles.d.ts +1 -1
  21. package/dist/SessionMessages/SessionMessage/MessageSources.d.ts +1 -1
  22. package/dist/SessionMessages/SessionMessage/SessionMessage.d.ts +4 -0
  23. package/dist/SessionMessages/SessionMessage/index.d.ts +2 -2
  24. package/dist/SessionMessages/SessionMessages.d.ts +14 -1
  25. package/dist/SessionMessages/index.d.ts +2 -2
  26. package/dist/SessionsList/index.d.ts +2 -2
  27. package/dist/docs.json +174 -20
  28. package/dist/{index-unCEyRCC.js → index-DqeDjfPI.js} +1339 -1307
  29. package/dist/index-DqeDjfPI.js.map +1 -0
  30. package/dist/index.css +6296 -738
  31. package/dist/index.d.ts +7 -6
  32. package/dist/index.js +32 -31
  33. package/dist/index.umd.cjs +1318 -1278
  34. package/dist/index.umd.cjs.map +1 -1
  35. package/dist/stories/Changelog.mdx +1 -1
  36. package/dist/stories/Chat.stories.tsx +5 -5
  37. package/dist/stories/ChatBubble.stories.tsx +3 -3
  38. package/dist/stories/Companion.stories.tsx +6 -6
  39. package/dist/stories/Console.stories.tsx +23 -23
  40. package/dist/stories/Integration.stories.tsx +2 -2
  41. package/dist/stories/Intro.mdx +1 -1
  42. package/dist/stories/assets/logo.svg +38 -19
  43. package/dist/stories/assets/paperclip.svg +4 -1
  44. package/dist/stories/assets/search.svg +5 -1
  45. package/dist/stories/examples.ts +20 -13
  46. package/dist/theme.d.ts +14 -0
  47. package/dist/utils/index.d.ts +1 -0
  48. package/package.json +63 -47
  49. package/dist/CSVFileRenderer-BAbkFZ2w.js.map +0 -1
  50. package/dist/DefaultFileRenderer-Bgc4Jadg.js.map +0 -1
  51. package/dist/PDFFileRenderer-DQdFS2l6.js +0 -9
  52. package/dist/PDFFileRenderer-DQdFS2l6.js.map +0 -1
  53. package/dist/index-unCEyRCC.js.map +0 -1
@@ -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("@radix-ui/react-slot"), require("react-markdown"), require("react-syntax-highlighter"), require("rehype-katex"), require("mdast-util-find-and-replace"), require("reakeys"), require("remark-gfm"), require("remark-youtube"), require("remark-math"), require("date-fns"), require("@floating-ui/react")) : typeof define === "function" && define.amd ? define(["exports", "react/jsx-runtime", "reablocks", "react", "motion/react", "@radix-ui/react-slot", "react-markdown", "react-syntax-highlighter", "rehype-katex", "mdast-util-find-and-replace", "reakeys", "remark-gfm", "remark-youtube", "remark-math", "date-fns", "@floating-ui/react"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.reachat = {}, global.jsxRuntime, global.reablocks, global.React, global.react, global.reactSlot, global.ReactMarkdown, global.reactSyntaxHighlighter, global.rehypeKatex, global.mdastUtilFindAndReplace, global.reakeys, global.remarkGfm, global.remarkYoutube, global.remarkMath, global.dateFns, global.react$1));
15
- })(this, function(exports2, jsxRuntime, reablocks, React, react, reactSlot, ReactMarkdown, reactSyntaxHighlighter, rehypeKatex, mdastUtilFindAndReplace, reakeys, remarkGfm, remarkYoutube, remarkMath, dateFns, react$1) {
14
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react/jsx-runtime"), require("motion/react"), require("reablocks"), require("react"), require("reakeys"), require("remark-gfm"), require("remark-math"), require("remark-youtube"), require("@floating-ui/react"), require("react-syntax-highlighter"), require("react-markdown"), require("rehype-katex"), require("mdast-util-find-and-replace"), require("@radix-ui/react-slot"), require("date-fns")) : typeof define === "function" && define.amd ? define(["exports", "react/jsx-runtime", "motion/react", "reablocks", "react", "reakeys", "remark-gfm", "remark-math", "remark-youtube", "@floating-ui/react", "react-syntax-highlighter", "react-markdown", "rehype-katex", "mdast-util-find-and-replace", "@radix-ui/react-slot", "date-fns"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.reachat = {}, global.jsxRuntime, global.react, global.reablocks, global.React, global.reakeys, global.remarkGfm, global.remarkMath, global.remarkYoutube, global.react$1, global.reactSyntaxHighlighter, global.ReactMarkdown, global.rehypeKatex, global.mdastUtilFindAndReplace, global.reactSlot, global.dateFns));
15
+ })(this, (function(exports2, jsxRuntime, react, reablocks, React, reakeys, remarkGfm, remarkMath, remarkYoutube, react$1, reactSyntaxHighlighter, ReactMarkdown, rehypeKatex, mdastUtilFindAndReplace, reactSlot, dateFns) {
16
16
  "use strict";
17
17
  function _interopNamespaceDefault(e) {
18
18
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -31,13 +31,277 @@
31
31
  return Object.freeze(n);
32
32
  }
33
33
  const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
34
- const SvgSend = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: 17, height: 17, viewBox: "0 0 17 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("g", { id: "send" }, /* @__PURE__ */ React__namespace.createElement("path", { id: "Vector", d: "M14.6111 2.33327C14.5349 2.3339 14.4598 2.35194 14.3917 2.386L2.39168 8.386C2.31456 8.42456 2.24872 8.4824 2.20055 8.55391C2.15238 8.62543 2.12352 8.70818 2.11677 8.79414C2.11002 8.88009 2.12561 8.96634 2.16203 9.04449C2.19845 9.12264 2.25446 9.19005 2.32462 9.24017L4.52514 10.8124L5.47371 13.6581C5.50257 13.7447 5.55457 13.8217 5.62406 13.8808C5.69355 13.9399 5.7779 13.9789 5.86796 13.9935C5.95802 14.0082 6.05036 13.9979 6.13499 13.9638C6.21962 13.9297 6.2933 13.873 6.34806 13.8001L7.05249 12.8606L10.3207 15.2376C10.3843 15.2839 10.4579 15.3146 10.5355 15.3271C10.6132 15.3396 10.6927 15.3336 10.7676 15.3097C10.8425 15.2857 10.9107 15.2444 10.9667 15.1891C11.0226 15.1338 11.0647 15.0661 11.0896 14.9915L15.0896 2.99147C15.1148 2.91597 15.1216 2.83555 15.1094 2.7569C15.0972 2.67825 15.0665 2.60363 15.0197 2.53926C14.9729 2.47488 14.9114 2.42261 14.8403 2.38678C14.7693 2.35096 14.6907 2.33261 14.6111 2.33327ZM13.2478 5.35345L10.3565 14.0266L7.67293 12.0755L13.2478 5.35345ZM10.684 5.35801L4.934 9.87559L3.58113 8.90879L10.684 5.35801ZM11.2784 6.16205L6.56746 11.843C6.56681 11.8437 6.56616 11.8443 6.56551 11.845L6.56355 11.8476C6.55841 11.8538 6.55342 11.8601 6.54858 11.8665C6.54319 11.8733 6.53798 11.8802 6.53295 11.8873L6.12085 12.4361L5.53426 10.6751L11.2784 6.16205Z", fill: "currentColor" })));
35
- const SvgStop = (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-octagon-x", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "m15 9-6 6" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "m9 9 6 6" }));
34
+ const chatTheme = {
35
+ base: "text-content-text-neutral-base",
36
+ console: "flex w-full gap-4 h-full",
37
+ companion: "w-full h-full overflow-hidden",
38
+ empty: "text-center flex-1",
39
+ appbar: "flex p-5",
40
+ sessions: {
41
+ base: "overflow-auto",
42
+ console: "min-w-[150px] w-[30%] max-w-[300px] bg-gradient-neutral-200 p-5 rounded-3xl",
43
+ companion: "w-full h-full",
44
+ group: "text-xs text-content-text-neutral-3 mt-4 hover:bg-transparent mb-1",
45
+ create: "relative mb-4 rounded-[10px] text-white",
46
+ session: {
47
+ base: "group my-1 rounded-[10px] p-2 text-content-text-neutral-1 border border-transparent",
48
+ active: "border-select-menu-items-color-item-stroke-row-hover [&_button]:opacity-100!",
49
+ delete: "[&>svg]:w-4 [&>svg]:h-4 opacity-0 group-hover:opacity-50!"
50
+ }
51
+ },
52
+ messages: {
53
+ base: "",
54
+ console: "flex flex-col mx-5 flex-1 overflow-hidden",
55
+ companion: "flex w-full h-full",
56
+ back: "self-start pl-0 my-2 ",
57
+ inner: "flex-1 h-full flex flex-col",
58
+ title: "text-base font-bold",
59
+ date: "text-xs whitespace-nowrap text-content-text-neutral-2",
60
+ content: "mt-2 flex-1 overflow-auto",
61
+ header: "flex justify-between items-center gap-2",
62
+ showMore: "mb-4",
63
+ message: {
64
+ base: "mt-4 mb-4 flex flex-col p-0 rounded-sm border-none bg-transparent",
65
+ question: "relative font-semibold mb-4 px-4 py-4 pb-2 rounded-3xl rounded-br-none text-typography border bg-(--background-neutral-raised-5) border-(--stroke-neutral-5)",
66
+ response: "relative data-[compact=false]:px-4 text-content-text-neutral-base",
67
+ overlay: "overflow-y-hidden max-h-[350px] after:content-[''] after:absolute after:inset-x-0 after:bottom-0 after:h-16 after:bg-linear-to-b after:from-transparent after:to-effects-shadows-base-2-xl",
68
+ cursor: "inline-block w-1 h-4 bg-current",
69
+ expand: "absolute bottom-0 right-1 z-10",
70
+ files: {
71
+ base: "mb-2 flex flex-wrap gap-3 ",
72
+ file: {
73
+ base: "flex items-center gap-2 border border-stroke-neutral-4 px-3 py-2 rounded-lg cursor-pointer",
74
+ name: "text-sm text-content-text-neutral-4"
75
+ }
76
+ },
77
+ sources: {
78
+ base: "my-4 flex flex-wrap gap-3",
79
+ source: {
80
+ base: "flex gap-2 border border-stroke-neutral-4 px-4 py-2 rounded-lg cursor-pointer",
81
+ companion: "flex-1 px-3 py-1.5",
82
+ image: "max-w-10 max-h-10 rounded-md w-full h-fit self-center",
83
+ title: "text-md block",
84
+ url: "text-sm text-buttons-colors-link-primary-text-resting underline"
85
+ }
86
+ },
87
+ markdown: {
88
+ hr: "my-4 border-t border-stroke-neutral-4",
89
+ copy: "sticky py-1 [&>svg]:w-4 [&>svg]:h-4 opacity-50",
90
+ p: "mb-2",
91
+ a: "text-buttons-colors-link-primary-text-resting underline",
92
+ table: "table-auto w-full m-2",
93
+ th: "px-4 py-2 text-left font-bold border-b border-stroke-neutral-4",
94
+ td: "px-4 py-2",
95
+ code: "m-2 rounded-b relative",
96
+ 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",
97
+ li: "mb-2 ml-6",
98
+ ul: "mb-4 list-disc",
99
+ ol: "mb-4 list-decimal"
100
+ },
101
+ csvPreview: {
102
+ base: "flex flex-col gap-2",
103
+ header: {
104
+ base: "flex justify-between items-center gap-4",
105
+ icon: "csv-icon flex items-center",
106
+ actions: "csv-actions flex items-center gap-6"
107
+ },
108
+ tableContainer: "flex justify-between",
109
+ dialog: {
110
+ base: "fixed inset-0 bg-background-neutral-canvas-base/70 flex justify-center items-center z-50",
111
+ container: "bg-background-neutral-canvas-base rounded-md w-11/12 h-5/6 overflow-auto"
112
+ }
113
+ },
114
+ footer: {
115
+ base: "mt-3 flex gap-1.5",
116
+ copy: "p-3 rounded-[10px] [&>svg]:size-4 opacity-50 hover:opacity-100!",
117
+ upvote: "p-3 rounded-[10px] [&>svg]:size-4 opacity-50 hover:opacity-100!",
118
+ downvote: "p-3 rounded-[10px] [&>svg]:size-4 opacity-50 hover:opacity-100!",
119
+ refresh: "p-3 rounded-[10px] [&>svg]:size-4 opacity-50 hover:opacity-100!"
120
+ }
121
+ }
122
+ },
123
+ input: {
124
+ base: "flex mt-4 relative",
125
+ upload: "px-5 py-2 size-10 text-content-text-neutral-2 hover:text-content-text-neutral-base",
126
+ input: "w-full border rounded-3xl px-3 py-2 pr-16 after:hidden after:mx-10! [&>textarea]:w-full [&>textarea]:flex-none [&>textarea]:outline-none [&>textarea]:resize-none",
127
+ actions: {
128
+ base: "absolute flex gap-2 items-center right-2 inset-y-1/2 -translate-y-1/2 z-10",
129
+ send: "px-3 py-3 hover:bg-primary-hover rounded-full size-8",
130
+ stop: "px-2 py-2 bg-content-assets-semantic-error-base text-white rounded-full hover:bg-content-assets-semantic-error-1 size-8"
131
+ }
132
+ }
133
+ };
134
+ const AppBar = ({ content, theme = chatTheme }) => {
135
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: reablocks.cn(theme.appbar), children: content });
136
+ };
36
137
  const ChatContext = React.createContext({
37
138
  sessions: [],
38
139
  activeSessionId: null
39
140
  });
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" }));
141
+ const useDimensions = () => {
142
+ const [ref, setRef] = React.useState(null);
143
+ const [width, setWidth] = React.useState(void 0);
144
+ const observe = React.useCallback((element) => {
145
+ if (element) setRef(element);
146
+ }, []);
147
+ React.useEffect(() => {
148
+ if (!ref) return;
149
+ const resizeObserver = new ResizeObserver((entries) => {
150
+ for (const entry of entries) {
151
+ setWidth(entry.contentRect.width);
152
+ }
153
+ });
154
+ resizeObserver.observe(ref);
155
+ return () => {
156
+ resizeObserver.disconnect();
157
+ };
158
+ }, [ref]);
159
+ return { width, observe };
160
+ };
161
+ const Chat = ({
162
+ children,
163
+ viewType = "console",
164
+ sessions,
165
+ onSelectSession,
166
+ onDeleteSession,
167
+ onSendMessage,
168
+ onStopMessage,
169
+ onFileUpload,
170
+ isLoading,
171
+ activeSessionId,
172
+ theme = chatTheme,
173
+ onNewSession,
174
+ remarkPlugins = [remarkGfm, remarkYoutube, remarkMath],
175
+ disabled,
176
+ style,
177
+ className
178
+ }) => {
179
+ const [internalActiveSessionID, setInternalActiveSessionID] = React.useState(activeSessionId);
180
+ const { width, observe } = useDimensions();
181
+ const isCompact = viewType === "companion" || width && width < 767;
182
+ React.useEffect(() => {
183
+ setInternalActiveSessionID(activeSessionId);
184
+ }, [activeSessionId]);
185
+ const handleSelectSession = React.useCallback(
186
+ (sessionId) => {
187
+ setInternalActiveSessionID(sessionId);
188
+ onSelectSession?.(sessionId);
189
+ },
190
+ [onSelectSession]
191
+ );
192
+ const handleDeleteSession = React.useCallback(
193
+ (sessionId) => {
194
+ setInternalActiveSessionID(void 0);
195
+ onDeleteSession?.(sessionId);
196
+ },
197
+ [onDeleteSession]
198
+ );
199
+ const handleCreateNewSession = React.useCallback(() => {
200
+ setInternalActiveSessionID(void 0);
201
+ onNewSession?.();
202
+ }, [onNewSession]);
203
+ reakeys.useHotkeys([
204
+ {
205
+ name: "Create new session",
206
+ category: "Chat",
207
+ keys: "meta+shift+s",
208
+ callback: (event) => {
209
+ event.preventDefault();
210
+ handleCreateNewSession();
211
+ }
212
+ }
213
+ ]);
214
+ const activeSession = React.useMemo(
215
+ () => sessions.find((session) => session.id === internalActiveSessionID),
216
+ [sessions, internalActiveSessionID]
217
+ );
218
+ const contextValue = React.useMemo(
219
+ () => ({
220
+ sessions,
221
+ activeSession,
222
+ remarkPlugins,
223
+ theme,
224
+ disabled,
225
+ isLoading,
226
+ isCompact,
227
+ viewType,
228
+ activeSessionId: internalActiveSessionID,
229
+ selectSession: handleSelectSession,
230
+ deleteSession: handleDeleteSession,
231
+ createSession: handleCreateNewSession,
232
+ sendMessage: onSendMessage,
233
+ stopMessage: onStopMessage,
234
+ fileUpload: onFileUpload
235
+ }),
236
+ [
237
+ isLoading,
238
+ isCompact,
239
+ viewType,
240
+ disabled,
241
+ theme,
242
+ remarkPlugins,
243
+ sessions,
244
+ activeSession,
245
+ internalActiveSessionID,
246
+ handleSelectSession,
247
+ handleDeleteSession,
248
+ handleCreateNewSession,
249
+ onSendMessage,
250
+ onStopMessage,
251
+ onFileUpload
252
+ ]
253
+ );
254
+ return /* @__PURE__ */ jsxRuntime.jsx(ChatContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { initial: false, children: /* @__PURE__ */ jsxRuntime.jsx(
255
+ "div",
256
+ {
257
+ ref: observe,
258
+ className: reablocks.cn(className, theme.base, {
259
+ [theme.companion]: isCompact,
260
+ [theme.console]: !isCompact
261
+ }),
262
+ style,
263
+ children
264
+ }
265
+ ) }) });
266
+ };
267
+ const ChatBubble = React.memo(
268
+ ({
269
+ children,
270
+ bubbleContent,
271
+ position = "right-end",
272
+ modifiers = [react$1.offset({ mainAxis: 0, crossAxis: -40 })],
273
+ className
274
+ }) => {
275
+ const [isOpen, setIsOpen] = React.useState(false);
276
+ const ref = React.useRef(null);
277
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
278
+ /* @__PURE__ */ jsxRuntime.jsx(
279
+ reablocks.ConnectedOverlay,
280
+ {
281
+ placement: position,
282
+ modifiers,
283
+ reference: ref.current,
284
+ open: isOpen,
285
+ onOpen: () => setIsOpen(true),
286
+ onClose: () => setIsOpen(false),
287
+ content: () => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children })
288
+ }
289
+ ),
290
+ /* @__PURE__ */ jsxRuntime.jsx(
291
+ "div",
292
+ {
293
+ ref,
294
+ className,
295
+ onClick: () => setIsOpen((prev) => !prev),
296
+ children: bubbleContent
297
+ }
298
+ )
299
+ ] });
300
+ }
301
+ );
302
+ const SvgSend = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M15.3451 0.654003C15.0011 0.310003 14.5001 0.191003 14.0401 0.339003L1.11712 4.493C0.626116 4.651 0.286116 5.067 0.230116 5.58C0.174116 6.092 0.417116 6.572 0.862116 6.831L5.43812 9.5L9.39112 5.546C9.68412 5.253 10.1591 5.253 10.4521 5.546C10.7451 5.839 10.7451 6.314 10.4521 6.607L6.49812 10.561L9.16712 15.137C9.40211 15.539 9.81712 15.776 10.2741 15.776C10.3221 15.776 10.3711 15.773 10.4201 15.768C10.9321 15.712 11.3491 15.372 11.5061 14.882L15.6611 1.96C15.8091 1.497 15.6881 0.997003 15.3451 0.654003Z", fill: "currentColor" }));
303
+ const SvgStop = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 50 50", width: "24px", height: "24px", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M 25 2 C 12.309534 2 2 12.309534 2 25 C 2 37.690466 12.309534 48 25 48 C 37.690466 48 48 37.690466 48 25 C 48 12.309534 37.690466 2 25 2 z M 25 4 C 36.609534 4 46 13.390466 46 25 C 46 36.609534 36.609534 46 25 46 C 13.390466 46 4 36.609534 4 25 C 4 13.390466 13.390466 4 25 4 z M 32.990234 15.986328 A 1.0001 1.0001 0 0 0 32.292969 16.292969 L 25 23.585938 L 17.707031 16.292969 A 1.0001 1.0001 0 0 0 16.990234 15.990234 A 1.0001 1.0001 0 0 0 16.292969 17.707031 L 23.585938 25 L 16.292969 32.292969 A 1.0001 1.0001 0 1 0 17.707031 33.707031 L 25 26.414062 L 32.292969 33.707031 A 1.0001 1.0001 0 1 0 33.707031 32.292969 L 26.414062 25 L 33.707031 17.707031 A 1.0001 1.0001 0 0 0 32.990234 15.986328 z", fill: "currentColor" }));
304
+ const SvgPaperclip = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 64 64", width: "24px", height: "24px", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M25.3,56.007c-3.409,0-6.818-1.297-9.414-3.893c-2.595-2.596-3.893-6.005-3.893-9.415c0-3.409,1.298-6.819,3.893-9.414 l20.4-20.4c1.847-1.847,4.302-2.864,6.914-2.864c2.611,0,5.067,1.017,6.914,2.864c3.812,3.813,3.812,10.016,0,13.829l-20.4,20.4 c-2.438,2.439-6.385,2.441-8.828,0c-2.434-2.435-2.434-6.395,0-8.829l13.7-13.7c0.781-0.781,2.047-0.781,2.828,0 c0.781,0.781,0.781,2.047,0,2.828l-13.7,13.7c-0.874,0.875-0.874,2.297,0.001,3.172c0.847,0.846,2.324,0.846,3.171,0l20.4-20.4 c2.252-2.253,2.252-5.919,0-8.172c-1.092-1.091-2.543-1.692-4.086-1.692c-1.544,0-2.994,0.601-4.086,1.692l-20.4,20.4 c-1.815,1.816-2.723,4.201-2.723,6.586c0,2.385,0.908,4.77,2.723,6.586c1.816,1.815,4.201,2.723,6.586,2.723 c2.385,0,4.771-0.907,6.586-2.723l12.7-12.7c0.781-0.781,2.047-0.781,2.828,0c0.781,0.781,0.781,2.047,0,2.828l-12.7,12.7 C32.119,54.709,28.71,56.007,25.3,56.007z", fill: "currentColor" }));
41
305
  const FileInput = ({
42
306
  allowedFiles,
43
307
  onFileUpload,
@@ -70,1171 +334,1132 @@
70
334
  variant: "text",
71
335
  disabled: isLoading || disabled,
72
336
  className: reablocks.cn(theme.input.upload),
73
- onClick: () => {
74
- var _a;
75
- return (_a = fileInputRef.current) == null ? void 0 : _a.click();
76
- },
337
+ onClick: () => fileInputRef.current?.click(),
77
338
  children: attachIcon
78
339
  }
79
340
  )
80
341
  ] });
81
342
  };
82
- const ChatInput = React.forwardRef(({
83
- allowedFiles,
84
- placeholder,
85
- defaultValue,
86
- sendIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgSend, {}),
87
- stopIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgStop, {}),
88
- attachIcon
89
- }, ref) => {
90
- const { theme, isLoading, disabled, sendMessage, stopMessage, fileUpload, activeSessionId } = React.useContext(ChatContext);
91
- const [message, setMessage] = React.useState("");
92
- const inputRef = React.useRef(null);
93
- React.useEffect(() => {
94
- if (inputRef.current) {
95
- inputRef.current.focus();
96
- }
97
- }, [activeSessionId, inputRef]);
98
- React.useImperativeHandle(ref, () => ({
99
- focus: () => {
100
- var _a;
101
- (_a = inputRef.current) == null ? void 0 : _a.focus();
102
- }
103
- }));
104
- const handleSendMessage = () => {
105
- if (message.trim()) {
106
- sendMessage == null ? void 0 : sendMessage(message);
107
- setMessage("");
108
- }
109
- };
110
- const handleKeyPress = (e) => {
111
- if (e.key === "Enter" && !e.shiftKey) {
112
- e.preventDefault();
113
- handleSendMessage();
114
- }
115
- };
116
- const handleFileUpload = (event) => {
117
- var _a;
118
- const file = (_a = event.target.files) == null ? void 0 : _a[0];
119
- if (file && fileUpload) {
120
- fileUpload(file);
121
- }
122
- };
123
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn(theme.input.base), children: [
124
- /* @__PURE__ */ jsxRuntime.jsx(
125
- reablocks.Textarea,
126
- {
127
- ref: inputRef,
128
- containerClassName: reablocks.cn(theme.input.input),
129
- minRows: 1,
130
- autoFocus: true,
131
- value: message,
132
- defaultValue,
133
- onKeyPress: handleKeyPress,
134
- placeholder,
135
- disabled: isLoading || disabled,
136
- onChange: (e) => setMessage(e.target.value)
343
+ const ChatInput = React.forwardRef(
344
+ ({
345
+ allowedFiles,
346
+ placeholder,
347
+ defaultValue,
348
+ className,
349
+ message,
350
+ sendIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgSend, {}),
351
+ stopIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgStop, {}),
352
+ attachIcon,
353
+ onMessageChange
354
+ }, ref) => {
355
+ const {
356
+ theme,
357
+ isLoading,
358
+ disabled,
359
+ sendMessage,
360
+ stopMessage,
361
+ fileUpload,
362
+ activeSessionId
363
+ } = React.useContext(ChatContext);
364
+ const [internalMessage, setInternalMessage] = React.useState("");
365
+ const inputRef = React.useRef(null);
366
+ React.useEffect(() => {
367
+ setInternalMessage(message || "");
368
+ }, [message]);
369
+ React.useEffect(() => {
370
+ if (inputRef.current) {
371
+ inputRef.current.focus();
137
372
  }
138
- ),
139
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn(theme.input.actions.base), children: [
140
- (allowedFiles == null ? void 0 : allowedFiles.length) > 0 && /* @__PURE__ */ jsxRuntime.jsx(
141
- FileInput,
373
+ }, [activeSessionId, inputRef]);
374
+ const handleSendMessage = () => {
375
+ if (internalMessage.trim()) {
376
+ sendMessage?.(internalMessage);
377
+ setInternalMessage("");
378
+ }
379
+ };
380
+ React.useImperativeHandle(ref, () => ({
381
+ focus: () => {
382
+ inputRef.current?.focus();
383
+ },
384
+ send: () => {
385
+ handleSendMessage();
386
+ },
387
+ setValue: (value) => {
388
+ setInternalMessage(value);
389
+ onMessageChange?.(value);
390
+ },
391
+ getValue: () => {
392
+ return internalMessage;
393
+ }
394
+ }));
395
+ const handleKeyPress = (e) => {
396
+ if (e.key === "Enter" && !e.shiftKey) {
397
+ e.preventDefault();
398
+ handleSendMessage();
399
+ }
400
+ };
401
+ const handleFileUpload = (event) => {
402
+ const file = event.target.files?.[0];
403
+ if (file && fileUpload) {
404
+ fileUpload(file);
405
+ }
406
+ };
407
+ const handleMessageChange = React.useCallback(
408
+ (event) => {
409
+ setInternalMessage(event.target.value);
410
+ onMessageChange?.(event.target.value);
411
+ },
412
+ [onMessageChange]
413
+ );
414
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn(theme.input.base, className), children: [
415
+ /* @__PURE__ */ jsxRuntime.jsx(
416
+ reablocks.Textarea,
142
417
  {
143
- allowedFiles,
144
- onFileUpload: handleFileUpload,
145
- isLoading,
146
- disabled,
147
- attachIcon
418
+ ref: inputRef,
419
+ containerClassName: reablocks.cn(theme.input.input),
420
+ minRows: 1,
421
+ autoFocus: true,
422
+ value: internalMessage,
423
+ defaultValue,
424
+ onKeyPress: handleKeyPress,
425
+ placeholder,
426
+ disabled: isLoading || disabled,
427
+ onChange: handleMessageChange
148
428
  }
149
429
  ),
150
- isLoading && /* @__PURE__ */ jsxRuntime.jsx(
151
- reablocks.Button,
152
- {
153
- title: "Stop",
154
- className: reablocks.cn(theme.input.actions.stop),
155
- onClick: stopMessage,
156
- disabled,
157
- children: stopIcon
158
- }
159
- ),
160
- /* @__PURE__ */ jsxRuntime.jsx(
161
- reablocks.Button,
162
- {
163
- title: "Send",
164
- className: reablocks.cn(theme.input.actions.send),
165
- onClick: handleSendMessage,
166
- disabled: isLoading || disabled,
167
- children: sendIcon
168
- }
169
- )
170
- ] })
171
- ] });
172
- });
173
- const SessionEmpty = ({
174
- children
175
- }) => {
176
- const { theme } = React.useContext(ChatContext);
177
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: reablocks.cn(theme.empty), children });
178
- };
179
- const SessionMessagesHeader = ({ children }) => {
180
- const { activeSession, theme } = React.useContext(ChatContext);
181
- const Comp = children ? reactSlot.Slot : "header";
182
- if (!activeSession) {
183
- return null;
184
- }
185
- return /* @__PURE__ */ jsxRuntime.jsx(Comp, { className: reablocks.cn(theme.messages.header), children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
186
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: reablocks.cn(theme.messages.title), children: /* @__PURE__ */ jsxRuntime.jsx(reablocks.Ellipsis, { limit: 125, value: activeSession.title }) }),
187
- /* @__PURE__ */ jsxRuntime.jsx(
188
- reablocks.DateFormat,
189
- {
190
- className: reablocks.cn(theme.messages.date),
191
- date: activeSession.createdAt
192
- }
193
- )
194
- ] }) });
195
- };
196
- const SvgBack = (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-chevron-left", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "m15 18-6-6 6-6" }));
197
- const SessionMessagePanel = ({
198
- children,
199
- allowBack = true
200
- }) => {
201
- const { activeSessionId, theme, isCompact, selectSession, viewType } = React.useContext(ChatContext);
202
- const isVisible = isCompact && activeSessionId || viewType === "chat" || !isCompact;
203
- return isVisible && /* @__PURE__ */ jsxRuntime.jsx(
204
- react.motion.div,
205
- {
206
- initial: { translateX: "200%" },
207
- animate: {
208
- translateX: "0%",
209
- transition: {
210
- type: "tween",
211
- ease: "linear",
212
- duration: 0.2,
213
- when: "beforeChildren"
214
- }
215
- },
216
- exit: { translateX: "200%" },
217
- className: reablocks.cn(theme.messages.base, {
218
- [theme.messages.companion]: isCompact,
219
- [theme.messages.console]: !isCompact
220
- }),
221
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn(theme.messages.inner), children: [
222
- allowBack && isCompact && viewType !== "chat" && /* @__PURE__ */ jsxRuntime.jsxs(
430
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn(theme.input.actions.base), children: [
431
+ allowedFiles?.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
432
+ FileInput,
433
+ {
434
+ allowedFiles,
435
+ onFileUpload: handleFileUpload,
436
+ isLoading,
437
+ disabled,
438
+ attachIcon
439
+ }
440
+ ),
441
+ isLoading && /* @__PURE__ */ jsxRuntime.jsx(
223
442
  reablocks.Button,
224
443
  {
225
- variant: "text",
226
- size: "small",
227
- onClick: () => selectSession(null),
228
- className: reablocks.cn(theme.messages.back),
229
- children: [
230
- /* @__PURE__ */ jsxRuntime.jsx(SvgBack, {}),
231
- "Back"
232
- ]
444
+ title: "Stop",
445
+ className: reablocks.cn(theme.input.actions.stop),
446
+ onClick: stopMessage,
447
+ disabled,
448
+ children: stopIcon
233
449
  }
234
450
  ),
235
- children
451
+ /* @__PURE__ */ jsxRuntime.jsx(
452
+ reablocks.Button,
453
+ {
454
+ title: "Send",
455
+ className: reablocks.cn(theme.input.actions.send),
456
+ onClick: handleSendMessage,
457
+ disabled: isLoading || disabled,
458
+ children: sendIcon
459
+ }
460
+ )
236
461
  ] })
237
- }
238
- );
239
- };
240
- const SvgCopy = (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-copy", ...props }, /* @__PURE__ */ React__namespace.createElement("rect", { width: 14, height: 14, x: 8, y: 8, rx: 2, ry: 2 }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" }));
462
+ ] });
463
+ }
464
+ );
465
+ const SvgCopy = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 18, height: 18, viewBox: "0 0 18 18", fill: "none", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M1.75 6C2.164 6 2.5 6.336 2.5 6.75V13.25C2.5 13.939 3.061 14.5 3.75 14.5H12.25C12.664 14.5 13 14.836 13 15.25C13 15.664 12.664 16 12.25 16H3.75C2.233 16 1 14.767 1 13.25V6.75C1 6.336 1.336 6 1.75 6ZM14.25 2C15.7688 2 17 3.23122 17 4.75V10.25C17 11.7688 15.7688 13 14.25 13H6.75C5.23122 13 4 11.7688 4 10.25V4.75C4 3.23122 5.23122 2 6.75 2H14.25Z", fill: "currentColor" }));
241
466
  const dark = {
242
467
  'code[class*="language-"]': {
243
- "background": "#11111f",
244
- "color": "#e2e8f0",
245
- "textShadow": "0 1px rgba(0, 0, 0, 0.3)",
246
- "fontFamily": '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
247
- "direction": "ltr",
248
- "textAlign": "left",
249
- "whiteSpace": "pre",
250
- "wordSpacing": "normal",
251
- "wordBreak": "normal",
252
- "lineHeight": "1.5",
253
- "MozTabSize": "2",
254
- "OTabSize": "2",
255
- "tabSize": "2",
256
- "WebkitHyphens": "none",
257
- "MozHyphens": "none",
258
- "msHyphens": "none",
259
- "hyphens": "none"
468
+ background: "#11111f",
469
+ color: "#e2e8f0",
470
+ textShadow: "0 1px rgba(0, 0, 0, 0.3)",
471
+ fontFamily: '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
472
+ direction: "ltr",
473
+ textAlign: "left",
474
+ whiteSpace: "pre",
475
+ wordSpacing: "normal",
476
+ wordBreak: "normal",
477
+ lineHeight: "1.5",
478
+ MozTabSize: "2",
479
+ OTabSize: "2",
480
+ tabSize: "2",
481
+ WebkitHyphens: "none",
482
+ MozHyphens: "none",
483
+ msHyphens: "none",
484
+ hyphens: "none"
260
485
  },
261
486
  'pre[class*="language-"]': {
262
- "background": "#11111f",
263
- "color": "#e2e8f0",
264
- "textShadow": "0 1px rgba(0, 0, 0, 0.3)",
265
- "fontFamily": '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
266
- "direction": "ltr",
267
- "textAlign": "left",
268
- "whiteSpace": "pre",
269
- "wordSpacing": "normal",
270
- "wordBreak": "normal",
271
- "lineHeight": "1.5",
272
- "MozTabSize": "2",
273
- "OTabSize": "2",
274
- "tabSize": "2",
275
- "WebkitHyphens": "none",
276
- "MozHyphens": "none",
277
- "msHyphens": "none",
278
- "hyphens": "none",
279
- "padding": "1em",
280
- "margin": "0",
281
- "overflow": "auto"
487
+ background: "#11111f",
488
+ color: "#e2e8f0",
489
+ textShadow: "0 1px rgba(0, 0, 0, 0.3)",
490
+ fontFamily: '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
491
+ direction: "ltr",
492
+ textAlign: "left",
493
+ whiteSpace: "pre",
494
+ wordSpacing: "normal",
495
+ wordBreak: "normal",
496
+ lineHeight: "1.5",
497
+ MozTabSize: "2",
498
+ OTabSize: "2",
499
+ tabSize: "2",
500
+ WebkitHyphens: "none",
501
+ MozHyphens: "none",
502
+ msHyphens: "none",
503
+ hyphens: "none",
504
+ padding: "1em",
505
+ margin: "0",
506
+ overflow: "auto"
282
507
  },
283
508
  'code[class*="language-"]::-moz-selection': {
284
- "background": "#1e293b",
285
- "color": "inherit",
286
- "textShadow": "none"
509
+ background: "#1e293b",
510
+ color: "inherit",
511
+ textShadow: "none"
287
512
  },
288
513
  'code[class*="language-"] *::-moz-selection': {
289
- "background": "#1e293b",
290
- "color": "inherit",
291
- "textShadow": "none"
514
+ background: "#1e293b",
515
+ color: "inherit",
516
+ textShadow: "none"
292
517
  },
293
518
  'pre[class*="language-"] *::-moz-selection': {
294
- "background": "#1e293b",
295
- "color": "inherit",
296
- "textShadow": "none"
519
+ background: "#1e293b",
520
+ color: "inherit",
521
+ textShadow: "none"
297
522
  },
298
523
  'code[class*="language-"]::selection': {
299
- "background": "#1e293b",
300
- "color": "inherit",
301
- "textShadow": "none"
524
+ background: "#1e293b",
525
+ color: "inherit",
526
+ textShadow: "none"
302
527
  },
303
528
  'code[class*="language-"] *::selection': {
304
- "background": "#1e293b",
305
- "color": "inherit",
306
- "textShadow": "none"
529
+ background: "#1e293b",
530
+ color: "inherit",
531
+ textShadow: "none"
307
532
  },
308
533
  'pre[class*="language-"] *::selection': {
309
- "background": "#1e293b",
310
- "color": "inherit",
311
- "textShadow": "none"
534
+ background: "#1e293b",
535
+ color: "inherit",
536
+ textShadow: "none"
312
537
  },
313
538
  ':not(pre) > code[class*="language-"]': {
314
- "padding": "0.2em 0.3em",
315
- "borderRadius": "0.3em",
316
- "whiteSpace": "normal"
539
+ padding: "0.2em 0.3em",
540
+ borderRadius: "0.3em",
541
+ whiteSpace: "normal"
317
542
  },
318
- "comment": {
319
- "color": "#64748b",
320
- "fontStyle": "italic"
543
+ comment: {
544
+ color: "#64748b",
545
+ fontStyle: "italic"
321
546
  },
322
- "prolog": {
323
- "color": "#64748b"
547
+ prolog: {
548
+ color: "#64748b"
324
549
  },
325
- "cdata": {
326
- "color": "#64748b"
550
+ cdata: {
551
+ color: "#64748b"
327
552
  },
328
- "doctype": {
329
- "color": "#e2e8f0"
553
+ doctype: {
554
+ color: "#e2e8f0"
330
555
  },
331
- "punctuation": {
332
- "color": "#e2e8f0"
556
+ punctuation: {
557
+ color: "#e2e8f0"
333
558
  },
334
- "entity": {
335
- "color": "#3b82f6",
336
- "cursor": "help"
559
+ entity: {
560
+ color: "#3b82f6",
561
+ cursor: "help"
337
562
  },
338
563
  "attr-name": {
339
- "color": "#f59e0b"
564
+ color: "#f59e0b"
340
565
  },
341
566
  "class-name": {
342
- "color": "#f59e0b"
567
+ color: "#f59e0b"
343
568
  },
344
- "boolean": {
345
- "color": "#3b82f6"
569
+ boolean: {
570
+ color: "#3b82f6"
346
571
  },
347
- "constant": {
348
- "color": "#3b82f6"
572
+ constant: {
573
+ color: "#3b82f6"
349
574
  },
350
- "number": {
351
- "color": "#3b82f6"
575
+ number: {
576
+ color: "#3b82f6"
352
577
  },
353
- "atrule": {
354
- "color": "#f59e0b"
578
+ atrule: {
579
+ color: "#f59e0b"
355
580
  },
356
- "keyword": {
357
- "color": "#f472b6"
581
+ keyword: {
582
+ color: "#f472b6"
358
583
  },
359
- "property": {
360
- "color": "#3b82f6"
584
+ property: {
585
+ color: "#3b82f6"
361
586
  },
362
- "tag": {
363
- "color": "#3b82f6"
587
+ tag: {
588
+ color: "#3b82f6"
364
589
  },
365
- "symbol": {
366
- "color": "#3b82f6"
590
+ symbol: {
591
+ color: "#3b82f6"
367
592
  },
368
- "deleted": {
369
- "color": "#ef4444"
593
+ deleted: {
594
+ color: "#ef4444"
370
595
  },
371
- "important": {
372
- "color": "#f472b6"
596
+ important: {
597
+ color: "#f472b6"
373
598
  },
374
- "selector": {
375
- "color": "#10b981"
599
+ selector: {
600
+ color: "#10b981"
376
601
  },
377
- "string": {
378
- "color": "#10b981"
602
+ string: {
603
+ color: "#10b981"
379
604
  },
380
- "char": {
381
- "color": "#10b981"
605
+ char: {
606
+ color: "#10b981"
382
607
  },
383
- "builtin": {
384
- "color": "#10b981"
608
+ builtin: {
609
+ color: "#10b981"
385
610
  },
386
- "inserted": {
387
- "color": "#10b981"
611
+ inserted: {
612
+ color: "#10b981"
388
613
  },
389
- "regex": {
390
- "color": "#10b981"
614
+ regex: {
615
+ color: "#10b981"
391
616
  },
392
617
  "attr-value": {
393
- "color": "#10b981"
618
+ color: "#10b981"
394
619
  },
395
620
  "attr-value > .token.punctuation": {
396
- "color": "#10b981"
621
+ color: "#10b981"
397
622
  },
398
- "variable": {
399
- "color": "#60a5fa"
623
+ variable: {
624
+ color: "#60a5fa"
400
625
  },
401
- "operator": {
402
- "color": "#60a5fa"
626
+ operator: {
627
+ color: "#60a5fa"
403
628
  },
404
- "function": {
405
- "color": "#60a5fa"
629
+ function: {
630
+ color: "#60a5fa"
406
631
  },
407
- "url": {
408
- "color": "#60a5fa"
632
+ url: {
633
+ color: "#60a5fa"
409
634
  },
410
635
  "attr-value > .token.punctuation.attr-equals": {
411
- "color": "#e2e8f0"
636
+ color: "#e2e8f0"
412
637
  },
413
638
  "special-attr > .token.attr-value > .token.value.css": {
414
- "color": "#e2e8f0"
639
+ color: "#e2e8f0"
415
640
  },
416
641
  ".language-css .token.selector": {
417
- "color": "#3b82f6"
642
+ color: "#3b82f6"
418
643
  },
419
644
  ".language-css .token.property": {
420
- "color": "#e2e8f0"
645
+ color: "#e2e8f0"
421
646
  },
422
647
  ".language-css .token.function": {
423
- "color": "#60a5fa"
648
+ color: "#60a5fa"
424
649
  },
425
650
  ".language-css .token.url > .token.function": {
426
- "color": "#60a5fa"
651
+ color: "#60a5fa"
427
652
  },
428
653
  ".language-css .token.url > .token.string.url": {
429
- "color": "#10b981"
654
+ color: "#10b981"
430
655
  },
431
656
  ".language-css .token.important": {
432
- "color": "#f472b6"
657
+ color: "#f472b6"
433
658
  },
434
659
  ".language-css .token.atrule .token.rule": {
435
- "color": "#f472b6"
660
+ color: "#f472b6"
436
661
  },
437
662
  ".language-javascript .token.operator": {
438
- "color": "#f472b6"
663
+ color: "#f472b6"
439
664
  },
440
665
  ".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation": {
441
- "color": "#ef4444"
666
+ color: "#ef4444"
442
667
  },
443
668
  ".language-json .token.operator": {
444
- "color": "#e2e8f0"
669
+ color: "#e2e8f0"
445
670
  },
446
671
  ".language-json .token.null.keyword": {
447
- "color": "#3b82f6"
672
+ color: "#3b82f6"
448
673
  },
449
674
  ".language-markdown .token.url": {
450
- "color": "#e2e8f0"
675
+ color: "#e2e8f0"
451
676
  },
452
677
  ".language-markdown .token.url > .token.operator": {
453
- "color": "#e2e8f0"
678
+ color: "#e2e8f0"
454
679
  },
455
680
  ".language-markdown .token.url-reference.url > .token.string": {
456
- "color": "#e2e8f0"
681
+ color: "#e2e8f0"
457
682
  },
458
683
  ".language-markdown .token.url > .token.content": {
459
- "color": "#60a5fa"
684
+ color: "#60a5fa"
460
685
  },
461
686
  ".language-markdown .token.url > .token.url": {
462
- "color": "#60a5fa"
687
+ color: "#60a5fa"
463
688
  },
464
689
  ".language-markdown .token.url-reference.url": {
465
- "color": "#60a5fa"
690
+ color: "#60a5fa"
466
691
  },
467
692
  ".language-markdown .token.blockquote.punctuation": {
468
- "color": "#64748b",
469
- "fontStyle": "italic"
693
+ color: "#64748b",
694
+ fontStyle: "italic"
470
695
  },
471
696
  ".language-markdown .token.hr.punctuation": {
472
- "color": "#64748b",
473
- "fontStyle": "italic"
697
+ color: "#64748b",
698
+ fontStyle: "italic"
474
699
  },
475
700
  ".language-markdown .token.code-snippet": {
476
- "color": "#10b981"
701
+ color: "#10b981"
477
702
  },
478
703
  ".language-markdown .token.bold .token.content": {
479
- "color": "#f59e0b"
704
+ color: "#f59e0b"
480
705
  },
481
706
  ".language-markdown .token.italic .token.content": {
482
- "color": "#f472b6"
707
+ color: "#f472b6"
483
708
  },
484
709
  ".language-markdown .token.strike .token.content": {
485
- "color": "#3b82f6"
710
+ color: "#3b82f6"
486
711
  },
487
712
  ".language-markdown .token.strike .token.punctuation": {
488
- "color": "#3b82f6"
713
+ color: "#3b82f6"
489
714
  },
490
715
  ".language-markdown .token.list.punctuation": {
491
- "color": "#3b82f6"
716
+ color: "#3b82f6"
492
717
  },
493
718
  ".language-markdown .token.title.important > .token.punctuation": {
494
- "color": "#3b82f6"
719
+ color: "#3b82f6"
495
720
  },
496
- "bold": {
497
- "fontWeight": "bold"
721
+ bold: {
722
+ fontWeight: "bold"
498
723
  },
499
- "italic": {
500
- "fontStyle": "italic"
724
+ italic: {
725
+ fontStyle: "italic"
501
726
  },
502
- "namespace": {
503
- "Opacity": "0.8"
727
+ namespace: {
728
+ Opacity: "0.8"
504
729
  },
505
730
  "token.tab:not(:empty):before": {
506
- "color": "#64748b",
507
- "textShadow": "none"
731
+ color: "#64748b",
732
+ textShadow: "none"
508
733
  },
509
734
  "token.cr:before": {
510
- "color": "#64748b",
511
- "textShadow": "none"
735
+ color: "#64748b",
736
+ textShadow: "none"
512
737
  },
513
738
  "token.lf:before": {
514
- "color": "#64748b",
515
- "textShadow": "none"
739
+ color: "#64748b",
740
+ textShadow: "none"
516
741
  },
517
742
  "token.space:before": {
518
- "color": "#64748b",
519
- "textShadow": "none"
743
+ color: "#64748b",
744
+ textShadow: "none"
520
745
  },
521
746
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item": {
522
- "marginRight": "0.4em"
747
+ marginRight: "0.4em"
523
748
  },
524
749
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button": {
525
- "background": "#1e293b",
526
- "color": "#94a3b8",
527
- "padding": "0.1em 0.4em",
528
- "borderRadius": "0.3em"
750
+ background: "#1e293b",
751
+ color: "#94a3b8",
752
+ padding: "0.1em 0.4em",
753
+ borderRadius: "0.3em"
529
754
  },
530
755
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a": {
531
- "background": "#1e293b",
532
- "color": "#94a3b8",
533
- "padding": "0.1em 0.4em",
534
- "borderRadius": "0.3em"
756
+ background: "#1e293b",
757
+ color: "#94a3b8",
758
+ padding: "0.1em 0.4em",
759
+ borderRadius: "0.3em"
535
760
  },
536
761
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span": {
537
- "background": "#1e293b",
538
- "color": "#94a3b8",
539
- "padding": "0.1em 0.4em",
540
- "borderRadius": "0.3em"
762
+ background: "#1e293b",
763
+ color: "#94a3b8",
764
+ padding: "0.1em 0.4em",
765
+ borderRadius: "0.3em"
541
766
  },
542
767
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover": {
543
- "background": "#3b82f6",
544
- "color": "#ffffff"
768
+ background: "#3b82f6",
769
+ color: "#ffffff"
545
770
  },
546
771
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus": {
547
- "background": "#3b82f6",
548
- "color": "#ffffff"
772
+ background: "#3b82f6",
773
+ color: "#ffffff"
549
774
  },
550
775
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover": {
551
- "background": "#3b82f6",
552
- "color": "#ffffff"
776
+ background: "#3b82f6",
777
+ color: "#ffffff"
553
778
  },
554
779
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus": {
555
- "background": "#3b82f6",
556
- "color": "#ffffff"
780
+ background: "#3b82f6",
781
+ color: "#ffffff"
557
782
  },
558
783
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover": {
559
- "background": "#3b82f6",
560
- "color": "#ffffff"
784
+ background: "#3b82f6",
785
+ color: "#ffffff"
561
786
  },
562
787
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus": {
563
- "background": "#3b82f6",
564
- "color": "#ffffff"
788
+ background: "#3b82f6",
789
+ color: "#ffffff"
565
790
  },
566
791
  ".line-highlight.line-highlight": {
567
- "background": "rgba(59, 130, 246, 0.08)"
792
+ background: "rgba(59, 130, 246, 0.08)"
568
793
  },
569
794
  ".line-highlight.line-highlight:before": {
570
- "background": "#1e293b",
571
- "color": "#e2e8f0",
572
- "padding": "0.1em 0.6em",
573
- "borderRadius": "0.3em",
574
- "boxShadow": "0 2px 0 0 rgba(0, 0, 0, 0.2)"
795
+ background: "#1e293b",
796
+ color: "#e2e8f0",
797
+ padding: "0.1em 0.6em",
798
+ borderRadius: "0.3em",
799
+ boxShadow: "0 2px 0 0 rgba(0, 0, 0, 0.2)"
575
800
  },
576
801
  ".line-highlight.line-highlight[data-end]:after": {
577
- "background": "#1e293b",
578
- "color": "#e2e8f0",
579
- "padding": "0.1em 0.6em",
580
- "borderRadius": "0.3em",
581
- "boxShadow": "0 2px 0 0 rgba(0, 0, 0, 0.2)"
802
+ background: "#1e293b",
803
+ color: "#e2e8f0",
804
+ padding: "0.1em 0.6em",
805
+ borderRadius: "0.3em",
806
+ boxShadow: "0 2px 0 0 rgba(0, 0, 0, 0.2)"
582
807
  },
583
808
  "pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before": {
584
- "backgroundColor": "rgba(59, 130, 246, 0.08)"
809
+ backgroundColor: "rgba(59, 130, 246, 0.08)"
585
810
  },
586
811
  ".line-numbers.line-numbers .line-numbers-rows": {
587
- "borderRightColor": "#1e293b"
812
+ borderRightColor: "#1e293b"
588
813
  },
589
814
  ".command-line .command-line-prompt": {
590
- "borderRightColor": "#1e293b"
815
+ borderRightColor: "#1e293b"
591
816
  },
592
817
  ".line-numbers .line-numbers-rows > span:before": {
593
- "color": "#64748b"
818
+ color: "#64748b"
594
819
  },
595
820
  ".command-line .command-line-prompt > span:before": {
596
- "color": "#64748b"
821
+ color: "#64748b"
597
822
  },
598
823
  ".rainbow-braces .token.token.punctuation.brace-level-1": {
599
- "color": "#3b82f6"
824
+ color: "#3b82f6"
600
825
  },
601
826
  ".rainbow-braces .token.token.punctuation.brace-level-5": {
602
- "color": "#3b82f6"
827
+ color: "#3b82f6"
603
828
  },
604
829
  ".rainbow-braces .token.token.punctuation.brace-level-9": {
605
- "color": "#3b82f6"
830
+ color: "#3b82f6"
606
831
  },
607
832
  ".rainbow-braces .token.token.punctuation.brace-level-2": {
608
- "color": "#10b981"
833
+ color: "#10b981"
609
834
  },
610
835
  ".rainbow-braces .token.token.punctuation.brace-level-6": {
611
- "color": "#10b981"
836
+ color: "#10b981"
612
837
  },
613
838
  ".rainbow-braces .token.token.punctuation.brace-level-10": {
614
- "color": "#10b981"
839
+ color: "#10b981"
615
840
  },
616
841
  ".rainbow-braces .token.token.punctuation.brace-level-3": {
617
- "color": "#60a5fa"
842
+ color: "#60a5fa"
618
843
  },
619
844
  ".rainbow-braces .token.token.punctuation.brace-level-7": {
620
- "color": "#60a5fa"
845
+ color: "#60a5fa"
621
846
  },
622
847
  ".rainbow-braces .token.token.punctuation.brace-level-11": {
623
- "color": "#60a5fa"
848
+ color: "#60a5fa"
624
849
  },
625
850
  ".rainbow-braces .token.token.punctuation.brace-level-4": {
626
- "color": "#f472b6"
851
+ color: "#f472b6"
627
852
  },
628
853
  ".rainbow-braces .token.token.punctuation.brace-level-8": {
629
- "color": "#f472b6"
854
+ color: "#f472b6"
630
855
  },
631
856
  ".rainbow-braces .token.token.punctuation.brace-level-12": {
632
- "color": "#f472b6"
857
+ color: "#f472b6"
633
858
  },
634
859
  "pre.diff-highlight > code .token.token.deleted:not(.prefix)": {
635
- "backgroundColor": "rgba(239, 68, 68, 0.15)"
860
+ backgroundColor: "rgba(239, 68, 68, 0.15)"
636
861
  },
637
862
  "pre > code.diff-highlight .token.token.deleted:not(.prefix)": {
638
- "backgroundColor": "rgba(239, 68, 68, 0.15)"
863
+ backgroundColor: "rgba(239, 68, 68, 0.15)"
639
864
  },
640
865
  "pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection": {
641
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
866
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
642
867
  },
643
868
  "pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection": {
644
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
869
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
645
870
  },
646
871
  "pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection": {
647
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
872
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
648
873
  },
649
874
  "pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection": {
650
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
875
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
651
876
  },
652
877
  "pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection": {
653
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
878
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
654
879
  },
655
880
  "pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection": {
656
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
881
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
657
882
  },
658
883
  "pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection": {
659
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
884
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
660
885
  },
661
886
  "pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection": {
662
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
887
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
663
888
  },
664
889
  "pre.diff-highlight > code .token.token.inserted:not(.prefix)": {
665
- "backgroundColor": "rgba(16, 185, 129, 0.15)"
890
+ backgroundColor: "rgba(16, 185, 129, 0.15)"
666
891
  },
667
892
  "pre > code.diff-highlight .token.token.inserted:not(.prefix)": {
668
- "backgroundColor": "rgba(16, 185, 129, 0.15)"
893
+ backgroundColor: "rgba(16, 185, 129, 0.15)"
669
894
  },
670
895
  "pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection": {
671
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
896
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
672
897
  },
673
898
  "pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection": {
674
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
899
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
675
900
  },
676
901
  "pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection": {
677
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
902
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
678
903
  },
679
904
  "pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection": {
680
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
905
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
681
906
  },
682
907
  "pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection": {
683
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
908
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
684
909
  },
685
910
  "pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection": {
686
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
911
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
687
912
  },
688
913
  "pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection": {
689
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
914
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
690
915
  },
691
916
  "pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection": {
692
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
917
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
693
918
  },
694
919
  ".prism-previewer.prism-previewer:before": {
695
- "borderColor": "#11111f"
920
+ borderColor: "#11111f"
696
921
  },
697
922
  ".prism-previewer-gradient.prism-previewer-gradient div": {
698
- "borderColor": "#11111f",
699
- "borderRadius": "0.3em"
923
+ borderColor: "#11111f",
924
+ borderRadius: "0.3em"
700
925
  },
701
926
  ".prism-previewer-color.prism-previewer-color:before": {
702
- "borderRadius": "0.3em"
927
+ borderRadius: "0.3em"
703
928
  },
704
929
  ".prism-previewer-easing.prism-previewer-easing:before": {
705
- "borderRadius": "0.3em"
930
+ borderRadius: "0.3em"
706
931
  },
707
932
  ".prism-previewer.prism-previewer:after": {
708
- "borderTopColor": "#11111f"
933
+ borderTopColor: "#11111f"
709
934
  },
710
935
  ".prism-previewer-flipped.prism-previewer-flipped.after": {
711
- "borderBottomColor": "#11111f"
936
+ borderBottomColor: "#11111f"
712
937
  },
713
938
  ".prism-previewer-angle.prism-previewer-angle:before": {
714
- "background": "#1e293b"
939
+ background: "#1e293b"
715
940
  },
716
941
  ".prism-previewer-time.prism-previewer-time:before": {
717
- "background": "#1e293b"
942
+ background: "#1e293b"
718
943
  },
719
944
  ".prism-previewer-easing.prism-previewer-easing": {
720
- "background": "#1e293b"
945
+ background: "#1e293b"
721
946
  },
722
947
  ".prism-previewer-angle.prism-previewer-angle circle": {
723
- "stroke": "#e2e8f0",
724
- "strokeOpacity": "1"
948
+ stroke: "#e2e8f0",
949
+ strokeOpacity: "1"
725
950
  },
726
951
  ".prism-previewer-time.prism-previewer-time circle": {
727
- "stroke": "#e2e8f0",
728
- "strokeOpacity": "1"
952
+ stroke: "#e2e8f0",
953
+ strokeOpacity: "1"
729
954
  },
730
955
  ".prism-previewer-easing.prism-previewer-easing circle": {
731
- "stroke": "#e2e8f0",
732
- "fill": "transparent"
956
+ stroke: "#e2e8f0",
957
+ fill: "transparent"
733
958
  },
734
959
  ".prism-previewer-easing.prism-previewer-easing path": {
735
- "stroke": "#e2e8f0"
960
+ stroke: "#e2e8f0"
736
961
  },
737
962
  ".prism-previewer-easing.prism-previewer-easing line": {
738
- "stroke": "#e2e8f0"
963
+ stroke: "#e2e8f0"
739
964
  }
740
965
  };
741
966
  const light = {
742
967
  'code[class*="language-"]': {
743
- "background": "#fff",
744
- "color": "#1e293b",
745
- "textShadow": "none",
746
- "fontFamily": '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
747
- "direction": "ltr",
748
- "textAlign": "left",
749
- "whiteSpace": "pre",
750
- "wordSpacing": "normal",
751
- "wordBreak": "normal",
752
- "lineHeight": "1.5",
753
- "MozTabSize": "2",
754
- "OTabSize": "2",
755
- "tabSize": "2",
756
- "WebkitHyphens": "none",
757
- "MozHyphens": "none",
758
- "msHyphens": "none",
759
- "hyphens": "none"
968
+ background: "#fff",
969
+ color: "#1e293b",
970
+ textShadow: "none",
971
+ fontFamily: '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
972
+ direction: "ltr",
973
+ textAlign: "left",
974
+ whiteSpace: "pre",
975
+ wordSpacing: "normal",
976
+ wordBreak: "normal",
977
+ lineHeight: "1.5",
978
+ MozTabSize: "2",
979
+ OTabSize: "2",
980
+ tabSize: "2",
981
+ WebkitHyphens: "none",
982
+ MozHyphens: "none",
983
+ msHyphens: "none",
984
+ hyphens: "none"
760
985
  },
761
986
  'pre[class*="language-"]': {
762
- "background": "#fff",
763
- "color": "#1e293b",
764
- "textShadow": "none",
765
- "fontFamily": '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
766
- "direction": "ltr",
767
- "textAlign": "left",
768
- "whiteSpace": "pre",
769
- "wordSpacing": "normal",
770
- "wordBreak": "normal",
771
- "lineHeight": "1.5",
772
- "MozTabSize": "2",
773
- "OTabSize": "2",
774
- "tabSize": "2",
775
- "WebkitHyphens": "none",
776
- "MozHyphens": "none",
777
- "msHyphens": "none",
778
- "hyphens": "none",
779
- "padding": "1em",
780
- "margin": "0.5em 0",
781
- "overflow": "auto",
782
- "borderRadius": "0.3em",
783
- "border": "1px solid #e2e8f0"
987
+ background: "#fff",
988
+ color: "#1e293b",
989
+ textShadow: "none",
990
+ fontFamily: '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
991
+ direction: "ltr",
992
+ textAlign: "left",
993
+ whiteSpace: "pre",
994
+ wordSpacing: "normal",
995
+ wordBreak: "normal",
996
+ lineHeight: "1.5",
997
+ MozTabSize: "2",
998
+ OTabSize: "2",
999
+ tabSize: "2",
1000
+ WebkitHyphens: "none",
1001
+ MozHyphens: "none",
1002
+ msHyphens: "none",
1003
+ hyphens: "none",
1004
+ padding: "1em",
1005
+ margin: "0.5em 0",
1006
+ overflow: "auto",
1007
+ borderRadius: "0.3em",
1008
+ border: "1px solid #e2e8f0"
784
1009
  },
785
1010
  'code[class*="language-"]::-moz-selection': {
786
- "background": "#e2e8f0",
787
- "color": "inherit",
788
- "textShadow": "none"
1011
+ background: "#e2e8f0",
1012
+ color: "inherit",
1013
+ textShadow: "none"
789
1014
  },
790
1015
  'code[class*="language-"] *::-moz-selection': {
791
- "background": "#e2e8f0",
792
- "color": "inherit",
793
- "textShadow": "none"
1016
+ background: "#e2e8f0",
1017
+ color: "inherit",
1018
+ textShadow: "none"
794
1019
  },
795
1020
  'pre[class*="language-"] *::-moz-selection': {
796
- "background": "#e2e8f0",
797
- "color": "inherit",
798
- "textShadow": "none"
1021
+ background: "#e2e8f0",
1022
+ color: "inherit",
1023
+ textShadow: "none"
799
1024
  },
800
1025
  'code[class*="language-"]::selection': {
801
- "background": "#e2e8f0",
802
- "color": "inherit",
803
- "textShadow": "none"
1026
+ background: "#e2e8f0",
1027
+ color: "inherit",
1028
+ textShadow: "none"
804
1029
  },
805
1030
  'code[class*="language-"] *::selection': {
806
- "background": "#e2e8f0",
807
- "color": "inherit",
808
- "textShadow": "none"
1031
+ background: "#e2e8f0",
1032
+ color: "inherit",
1033
+ textShadow: "none"
809
1034
  },
810
1035
  'pre[class*="language-"] *::selection': {
811
- "background": "#e2e8f0",
812
- "color": "inherit",
813
- "textShadow": "none"
1036
+ background: "#e2e8f0",
1037
+ color: "inherit",
1038
+ textShadow: "none"
814
1039
  },
815
1040
  ':not(pre) > code[class*="language-"]': {
816
- "padding": "0.2em 0.3em",
817
- "borderRadius": "0.3em",
818
- "whiteSpace": "normal",
819
- "background": "#f1f5f9"
1041
+ padding: "0.2em 0.3em",
1042
+ borderRadius: "0.3em",
1043
+ whiteSpace: "normal",
1044
+ background: "#f1f5f9"
820
1045
  },
821
- "comment": {
822
- "color": "#64748b",
823
- "fontStyle": "italic"
1046
+ comment: {
1047
+ color: "#64748b",
1048
+ fontStyle: "italic"
824
1049
  },
825
- "prolog": {
826
- "color": "#64748b"
1050
+ prolog: {
1051
+ color: "#64748b"
827
1052
  },
828
- "cdata": {
829
- "color": "#64748b"
1053
+ cdata: {
1054
+ color: "#64748b"
830
1055
  },
831
- "doctype": {
832
- "color": "#1e293b"
1056
+ doctype: {
1057
+ color: "#1e293b"
833
1058
  },
834
- "punctuation": {
835
- "color": "#64748b"
1059
+ punctuation: {
1060
+ color: "#64748b"
836
1061
  },
837
- "entity": {
838
- "color": "#3b82f6",
839
- "cursor": "help"
1062
+ entity: {
1063
+ color: "#3b82f6",
1064
+ cursor: "help"
840
1065
  },
841
1066
  "attr-name": {
842
- "color": "#ea580c"
1067
+ color: "#ea580c"
843
1068
  },
844
1069
  "class-name": {
845
- "color": "#ea580c"
1070
+ color: "#ea580c"
846
1071
  },
847
- "boolean": {
848
- "color": "#3b82f6"
1072
+ boolean: {
1073
+ color: "#3b82f6"
849
1074
  },
850
- "constant": {
851
- "color": "#3b82f6"
1075
+ constant: {
1076
+ color: "#3b82f6"
852
1077
  },
853
- "number": {
854
- "color": "#3b82f6"
1078
+ number: {
1079
+ color: "#3b82f6"
855
1080
  },
856
- "atrule": {
857
- "color": "#ea580c"
1081
+ atrule: {
1082
+ color: "#ea580c"
858
1083
  },
859
- "keyword": {
860
- "color": "#9333ea"
1084
+ keyword: {
1085
+ color: "#9333ea"
861
1086
  },
862
- "property": {
863
- "color": "#3b82f6"
1087
+ property: {
1088
+ color: "#3b82f6"
864
1089
  },
865
- "tag": {
866
- "color": "#3b82f6"
1090
+ tag: {
1091
+ color: "#3b82f6"
867
1092
  },
868
- "symbol": {
869
- "color": "#3b82f6"
1093
+ symbol: {
1094
+ color: "#3b82f6"
870
1095
  },
871
- "deleted": {
872
- "color": "#dc2626"
1096
+ deleted: {
1097
+ color: "#dc2626"
873
1098
  },
874
- "important": {
875
- "color": "#9333ea"
1099
+ important: {
1100
+ color: "#9333ea"
876
1101
  },
877
- "selector": {
878
- "color": "#16a34a"
1102
+ selector: {
1103
+ color: "#16a34a"
879
1104
  },
880
- "string": {
881
- "color": "#16a34a"
1105
+ string: {
1106
+ color: "#16a34a"
882
1107
  },
883
- "char": {
884
- "color": "#16a34a"
1108
+ char: {
1109
+ color: "#16a34a"
885
1110
  },
886
- "builtin": {
887
- "color": "#16a34a"
1111
+ builtin: {
1112
+ color: "#16a34a"
888
1113
  },
889
- "inserted": {
890
- "color": "#16a34a"
1114
+ inserted: {
1115
+ color: "#16a34a"
891
1116
  },
892
- "regex": {
893
- "color": "#16a34a"
1117
+ regex: {
1118
+ color: "#16a34a"
894
1119
  },
895
1120
  "attr-value": {
896
- "color": "#16a34a"
1121
+ color: "#16a34a"
897
1122
  },
898
1123
  "attr-value > .token.punctuation": {
899
- "color": "#16a34a"
1124
+ color: "#16a34a"
900
1125
  },
901
- "variable": {
902
- "color": "#3b82f6"
1126
+ variable: {
1127
+ color: "#3b82f6"
903
1128
  },
904
- "operator": {
905
- "color": "#3b82f6"
1129
+ operator: {
1130
+ color: "#3b82f6"
906
1131
  },
907
- "function": {
908
- "color": "#3b82f6"
1132
+ function: {
1133
+ color: "#3b82f6"
909
1134
  },
910
- "url": {
911
- "color": "#3b82f6"
1135
+ url: {
1136
+ color: "#3b82f6"
912
1137
  },
913
1138
  "attr-value > .token.punctuation.attr-equals": {
914
- "color": "#64748b"
1139
+ color: "#64748b"
915
1140
  },
916
1141
  "special-attr > .token.attr-value > .token.value.css": {
917
- "color": "#1e293b"
1142
+ color: "#1e293b"
918
1143
  },
919
1144
  ".language-css .token.selector": {
920
- "color": "#3b82f6"
1145
+ color: "#3b82f6"
921
1146
  },
922
1147
  ".language-css .token.property": {
923
- "color": "#1e293b"
1148
+ color: "#1e293b"
924
1149
  },
925
1150
  ".language-css .token.function": {
926
- "color": "#3b82f6"
1151
+ color: "#3b82f6"
927
1152
  },
928
1153
  ".language-css .token.url > .token.function": {
929
- "color": "#3b82f6"
1154
+ color: "#3b82f6"
930
1155
  },
931
1156
  ".language-css .token.url > .token.string.url": {
932
- "color": "#16a34a"
1157
+ color: "#16a34a"
933
1158
  },
934
1159
  ".language-css .token.important": {
935
- "color": "#9333ea"
1160
+ color: "#9333ea"
936
1161
  },
937
1162
  ".language-css .token.atrule .token.rule": {
938
- "color": "#9333ea"
1163
+ color: "#9333ea"
939
1164
  },
940
1165
  ".language-javascript .token.operator": {
941
- "color": "#9333ea"
1166
+ color: "#9333ea"
942
1167
  },
943
1168
  ".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation": {
944
- "color": "#dc2626"
1169
+ color: "#dc2626"
945
1170
  },
946
1171
  ".language-json .token.operator": {
947
- "color": "#1e293b"
1172
+ color: "#1e293b"
948
1173
  },
949
1174
  ".language-json .token.null.keyword": {
950
- "color": "#3b82f6"
1175
+ color: "#3b82f6"
951
1176
  },
952
1177
  ".language-markdown .token.url": {
953
- "color": "#1e293b"
1178
+ color: "#1e293b"
954
1179
  },
955
1180
  ".language-markdown .token.url > .token.operator": {
956
- "color": "#1e293b"
1181
+ color: "#1e293b"
957
1182
  },
958
1183
  ".language-markdown .token.url-reference.url > .token.string": {
959
- "color": "#1e293b"
1184
+ color: "#1e293b"
960
1185
  },
961
1186
  ".language-markdown .token.url > .token.content": {
962
- "color": "#3b82f6"
1187
+ color: "#3b82f6"
963
1188
  },
964
1189
  ".language-markdown .token.url > .token.url": {
965
- "color": "#3b82f6"
1190
+ color: "#3b82f6"
966
1191
  },
967
1192
  ".language-markdown .token.url-reference.url": {
968
- "color": "#3b82f6"
1193
+ color: "#3b82f6"
969
1194
  },
970
1195
  ".language-markdown .token.blockquote.punctuation": {
971
- "color": "#64748b",
972
- "fontStyle": "italic"
1196
+ color: "#64748b",
1197
+ fontStyle: "italic"
973
1198
  },
974
1199
  ".language-markdown .token.hr.punctuation": {
975
- "color": "#64748b",
976
- "fontStyle": "italic"
1200
+ color: "#64748b",
1201
+ fontStyle: "italic"
977
1202
  },
978
1203
  ".language-markdown .token.code-snippet": {
979
- "color": "#16a34a"
1204
+ color: "#16a34a"
980
1205
  },
981
1206
  ".language-markdown .token.bold .token.content": {
982
- "color": "#ea580c"
1207
+ color: "#ea580c"
983
1208
  },
984
1209
  ".language-markdown .token.italic .token.content": {
985
- "color": "#9333ea"
1210
+ color: "#9333ea"
986
1211
  },
987
1212
  ".language-markdown .token.strike .token.content": {
988
- "color": "#3b82f6"
1213
+ color: "#3b82f6"
989
1214
  },
990
1215
  ".language-markdown .token.strike .token.punctuation": {
991
- "color": "#3b82f6"
1216
+ color: "#3b82f6"
992
1217
  },
993
1218
  ".language-markdown .token.list.punctuation": {
994
- "color": "#3b82f6"
1219
+ color: "#3b82f6"
995
1220
  },
996
1221
  ".language-markdown .token.title.important > .token.punctuation": {
997
- "color": "#3b82f6"
1222
+ color: "#3b82f6"
998
1223
  },
999
- "bold": {
1000
- "fontWeight": "bold"
1224
+ bold: {
1225
+ fontWeight: "bold"
1001
1226
  },
1002
- "italic": {
1003
- "fontStyle": "italic"
1227
+ italic: {
1228
+ fontStyle: "italic"
1004
1229
  },
1005
- "namespace": {
1006
- "Opacity": "0.8"
1230
+ namespace: {
1231
+ Opacity: "0.8"
1007
1232
  },
1008
1233
  "token.tab:not(:empty):before": {
1009
- "color": "#94a3b8"
1234
+ color: "#94a3b8"
1010
1235
  },
1011
1236
  "token.cr:before": {
1012
- "color": "#94a3b8"
1237
+ color: "#94a3b8"
1013
1238
  },
1014
1239
  "token.lf:before": {
1015
- "color": "#94a3b8"
1240
+ color: "#94a3b8"
1016
1241
  },
1017
1242
  "token.space:before": {
1018
- "color": "#94a3b8"
1243
+ color: "#94a3b8"
1019
1244
  },
1020
1245
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item": {
1021
- "marginRight": "0.4em"
1246
+ marginRight: "0.4em"
1022
1247
  },
1023
1248
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button": {
1024
- "background": "#f1f5f9",
1025
- "color": "#475569",
1026
- "padding": "0.1em 0.4em",
1027
- "borderRadius": "0.3em"
1249
+ background: "#f1f5f9",
1250
+ color: "#475569",
1251
+ padding: "0.1em 0.4em",
1252
+ borderRadius: "0.3em"
1028
1253
  },
1029
1254
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a": {
1030
- "background": "#f1f5f9",
1031
- "color": "#475569",
1032
- "padding": "0.1em 0.4em",
1033
- "borderRadius": "0.3em"
1255
+ background: "#f1f5f9",
1256
+ color: "#475569",
1257
+ padding: "0.1em 0.4em",
1258
+ borderRadius: "0.3em"
1034
1259
  },
1035
1260
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span": {
1036
- "background": "#f1f5f9",
1037
- "color": "#475569",
1038
- "padding": "0.1em 0.4em",
1039
- "borderRadius": "0.3em"
1261
+ background: "#f1f5f9",
1262
+ color: "#475569",
1263
+ padding: "0.1em 0.4em",
1264
+ borderRadius: "0.3em"
1040
1265
  },
1041
1266
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover": {
1042
- "background": "#3b82f6",
1043
- "color": "#ffffff"
1267
+ background: "#3b82f6",
1268
+ color: "#ffffff"
1044
1269
  },
1045
1270
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus": {
1046
- "background": "#3b82f6",
1047
- "color": "#ffffff"
1271
+ background: "#3b82f6",
1272
+ color: "#ffffff"
1048
1273
  },
1049
1274
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover": {
1050
- "background": "#3b82f6",
1051
- "color": "#ffffff"
1275
+ background: "#3b82f6",
1276
+ color: "#ffffff"
1052
1277
  },
1053
1278
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus": {
1054
- "background": "#3b82f6",
1055
- "color": "#ffffff"
1279
+ background: "#3b82f6",
1280
+ color: "#ffffff"
1056
1281
  },
1057
1282
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover": {
1058
- "background": "#3b82f6",
1059
- "color": "#ffffff"
1283
+ background: "#3b82f6",
1284
+ color: "#ffffff"
1060
1285
  },
1061
1286
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus": {
1062
- "background": "#3b82f6",
1063
- "color": "#ffffff"
1287
+ background: "#3b82f6",
1288
+ color: "#ffffff"
1064
1289
  },
1065
1290
  ".line-highlight.line-highlight": {
1066
- "background": "rgba(59, 130, 246, 0.08)"
1291
+ background: "rgba(59, 130, 246, 0.08)"
1067
1292
  },
1068
1293
  ".line-highlight.line-highlight:before": {
1069
- "background": "#f1f5f9",
1070
- "color": "#1e293b",
1071
- "padding": "0.1em 0.6em",
1072
- "borderRadius": "0.3em",
1073
- "boxShadow": "0 2px 0 0 rgba(0, 0, 0, 0.1)"
1294
+ background: "#f1f5f9",
1295
+ color: "#1e293b",
1296
+ padding: "0.1em 0.6em",
1297
+ borderRadius: "0.3em",
1298
+ boxShadow: "0 2px 0 0 rgba(0, 0, 0, 0.1)"
1074
1299
  },
1075
1300
  ".line-highlight.line-highlight[data-end]:after": {
1076
- "background": "#f1f5f9",
1077
- "color": "#1e293b",
1078
- "padding": "0.1em 0.6em",
1079
- "borderRadius": "0.3em",
1080
- "boxShadow": "0 2px 0 0 rgba(0, 0, 0, 0.1)"
1301
+ background: "#f1f5f9",
1302
+ color: "#1e293b",
1303
+ padding: "0.1em 0.6em",
1304
+ borderRadius: "0.3em",
1305
+ boxShadow: "0 2px 0 0 rgba(0, 0, 0, 0.1)"
1081
1306
  },
1082
1307
  "pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before": {
1083
- "backgroundColor": "rgba(59, 130, 246, 0.08)"
1308
+ backgroundColor: "rgba(59, 130, 246, 0.08)"
1084
1309
  },
1085
1310
  ".line-numbers.line-numbers .line-numbers-rows": {
1086
- "borderRightColor": "#e2e8f0"
1311
+ borderRightColor: "#e2e8f0"
1087
1312
  },
1088
1313
  ".command-line .command-line-prompt": {
1089
- "borderRightColor": "#e2e8f0"
1314
+ borderRightColor: "#e2e8f0"
1090
1315
  },
1091
1316
  ".line-numbers .line-numbers-rows > span:before": {
1092
- "color": "#94a3b8"
1317
+ color: "#94a3b8"
1093
1318
  },
1094
1319
  ".command-line .command-line-prompt > span:before": {
1095
- "color": "#94a3b8"
1320
+ color: "#94a3b8"
1096
1321
  },
1097
1322
  ".rainbow-braces .token.token.punctuation.brace-level-1": {
1098
- "color": "#3b82f6"
1323
+ color: "#3b82f6"
1099
1324
  },
1100
1325
  ".rainbow-braces .token.token.punctuation.brace-level-5": {
1101
- "color": "#3b82f6"
1326
+ color: "#3b82f6"
1102
1327
  },
1103
1328
  ".rainbow-braces .token.token.punctuation.brace-level-9": {
1104
- "color": "#3b82f6"
1329
+ color: "#3b82f6"
1105
1330
  },
1106
1331
  ".rainbow-braces .token.token.punctuation.brace-level-2": {
1107
- "color": "#16a34a"
1332
+ color: "#16a34a"
1108
1333
  },
1109
1334
  ".rainbow-braces .token.token.punctuation.brace-level-6": {
1110
- "color": "#16a34a"
1335
+ color: "#16a34a"
1111
1336
  },
1112
1337
  ".rainbow-braces .token.token.punctuation.brace-level-10": {
1113
- "color": "#16a34a"
1338
+ color: "#16a34a"
1114
1339
  },
1115
1340
  ".rainbow-braces .token.token.punctuation.brace-level-3": {
1116
- "color": "#ea580c"
1341
+ color: "#ea580c"
1117
1342
  },
1118
1343
  ".rainbow-braces .token.token.punctuation.brace-level-7": {
1119
- "color": "#ea580c"
1344
+ color: "#ea580c"
1120
1345
  },
1121
1346
  ".rainbow-braces .token.token.punctuation.brace-level-11": {
1122
- "color": "#ea580c"
1347
+ color: "#ea580c"
1123
1348
  },
1124
1349
  ".rainbow-braces .token.token.punctuation.brace-level-4": {
1125
- "color": "#9333ea"
1350
+ color: "#9333ea"
1126
1351
  },
1127
1352
  ".rainbow-braces .token.token.punctuation.brace-level-8": {
1128
- "color": "#9333ea"
1353
+ color: "#9333ea"
1129
1354
  },
1130
1355
  ".rainbow-braces .token.token.punctuation.brace-level-12": {
1131
- "color": "#9333ea"
1356
+ color: "#9333ea"
1132
1357
  },
1133
1358
  "pre.diff-highlight > code .token.token.deleted:not(.prefix)": {
1134
- "backgroundColor": "rgba(220, 38, 38, 0.15)"
1359
+ backgroundColor: "rgba(220, 38, 38, 0.15)"
1135
1360
  },
1136
1361
  "pre > code.diff-highlight .token.token.deleted:not(.prefix)": {
1137
- "backgroundColor": "rgba(220, 38, 38, 0.15)"
1362
+ backgroundColor: "rgba(220, 38, 38, 0.15)"
1138
1363
  },
1139
1364
  "pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection": {
1140
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1365
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1141
1366
  },
1142
1367
  "pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection": {
1143
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1368
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1144
1369
  },
1145
1370
  "pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection": {
1146
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1371
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1147
1372
  },
1148
1373
  "pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection": {
1149
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1374
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1150
1375
  },
1151
1376
  "pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection": {
1152
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1377
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1153
1378
  },
1154
1379
  "pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection": {
1155
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1380
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1156
1381
  },
1157
1382
  "pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection": {
1158
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1383
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1159
1384
  },
1160
1385
  "pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection": {
1161
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1386
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1162
1387
  },
1163
1388
  "pre.diff-highlight > code .token.token.inserted:not(.prefix)": {
1164
- "backgroundColor": "rgba(22, 163, 74, 0.15)"
1389
+ backgroundColor: "rgba(22, 163, 74, 0.15)"
1165
1390
  },
1166
1391
  "pre > code.diff-highlight .token.token.inserted:not(.prefix)": {
1167
- "backgroundColor": "rgba(22, 163, 74, 0.15)"
1392
+ backgroundColor: "rgba(22, 163, 74, 0.15)"
1168
1393
  },
1169
1394
  "pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection": {
1170
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1395
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1171
1396
  },
1172
1397
  "pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection": {
1173
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1398
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1174
1399
  },
1175
1400
  "pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection": {
1176
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1401
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1177
1402
  },
1178
1403
  "pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection": {
1179
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1404
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1180
1405
  },
1181
1406
  "pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection": {
1182
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1407
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1183
1408
  },
1184
1409
  "pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection": {
1185
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1410
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1186
1411
  },
1187
1412
  "pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection": {
1188
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1413
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1189
1414
  },
1190
1415
  "pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection": {
1191
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1416
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1192
1417
  },
1193
1418
  ".prism-previewer.prism-previewer:before": {
1194
- "borderColor": "#fff"
1419
+ borderColor: "#fff"
1195
1420
  },
1196
1421
  ".prism-previewer-gradient.prism-previewer-gradient div": {
1197
- "borderColor": "#fff",
1198
- "borderRadius": "0.3em"
1422
+ borderColor: "#fff",
1423
+ borderRadius: "0.3em"
1199
1424
  },
1200
1425
  ".prism-previewer-color.prism-previewer-color:before": {
1201
- "borderRadius": "0.3em"
1426
+ borderRadius: "0.3em"
1202
1427
  },
1203
1428
  ".prism-previewer-easing.prism-previewer-easing:before": {
1204
- "borderRadius": "0.3em"
1429
+ borderRadius: "0.3em"
1205
1430
  },
1206
1431
  ".prism-previewer.prism-previewer:after": {
1207
- "borderTopColor": "#fff"
1432
+ borderTopColor: "#fff"
1208
1433
  },
1209
1434
  ".prism-previewer-flipped.prism-previewer-flipped.after": {
1210
- "borderBottomColor": "#fff"
1435
+ borderBottomColor: "#fff"
1211
1436
  },
1212
1437
  ".prism-previewer-angle.prism-previewer-angle:before": {
1213
- "background": "#f1f5f9"
1438
+ background: "#f1f5f9"
1214
1439
  },
1215
1440
  ".prism-previewer-time.prism-previewer-time:before": {
1216
- "background": "#f1f5f9"
1441
+ background: "#f1f5f9"
1217
1442
  },
1218
1443
  ".prism-previewer-easing.prism-previewer-easing": {
1219
- "background": "#f1f5f9"
1444
+ background: "#f1f5f9"
1220
1445
  },
1221
1446
  ".prism-previewer-angle.prism-previewer-angle circle": {
1222
- "stroke": "#1e293b",
1223
- "strokeOpacity": "1"
1447
+ stroke: "#1e293b",
1448
+ strokeOpacity: "1"
1224
1449
  },
1225
1450
  ".prism-previewer-time.prism-previewer-time circle": {
1226
- "stroke": "#1e293b",
1227
- "strokeOpacity": "1"
1451
+ stroke: "#1e293b",
1452
+ strokeOpacity: "1"
1228
1453
  },
1229
1454
  ".prism-previewer-easing.prism-previewer-easing circle": {
1230
- "stroke": "#1e293b",
1231
- "fill": "transparent"
1455
+ stroke: "#1e293b",
1456
+ fill: "transparent"
1232
1457
  },
1233
1458
  ".prism-previewer-easing.prism-previewer-easing path": {
1234
- "stroke": "#1e293b"
1459
+ stroke: "#1e293b"
1235
1460
  },
1236
1461
  ".prism-previewer-easing.prism-previewer-easing line": {
1237
- "stroke": "#1e293b"
1462
+ stroke: "#1e293b"
1238
1463
  }
1239
1464
  };
1240
1465
  const CodeHighlighter = ({
@@ -1246,7 +1471,7 @@
1246
1471
  toolbarClassName,
1247
1472
  theme = dark
1248
1473
  }) => {
1249
- const match = language == null ? void 0 : language.match(/language-(\w+)/);
1474
+ const match = language?.match(/language-(\w+)/);
1250
1475
  const lang = match ? match[1] : "text";
1251
1476
  const handleCopy = (text) => {
1252
1477
  navigator.clipboard.writeText(text).then(() => {
@@ -1263,21 +1488,14 @@
1263
1488
  {
1264
1489
  className: reablocks.cn(copyClassName),
1265
1490
  size: "small",
1266
- variant: "text",
1491
+ variant: "ghost",
1267
1492
  title: "Copy code",
1268
1493
  onClick: () => handleCopy(children),
1269
1494
  children: copyIcon
1270
1495
  }
1271
1496
  )
1272
1497
  ] }),
1273
- /* @__PURE__ */ jsxRuntime.jsx(
1274
- reactSyntaxHighlighter.Prism,
1275
- {
1276
- language: lang,
1277
- style: theme,
1278
- children
1279
- }
1280
- )
1498
+ /* @__PURE__ */ jsxRuntime.jsx(reactSyntaxHighlighter.Prism, { language: lang, style: theme, children })
1281
1499
  ] });
1282
1500
  };
1283
1501
  const TableComponent = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("table", { ...props, children });
@@ -1286,78 +1504,156 @@
1286
1504
  const Markdown = ({
1287
1505
  children,
1288
1506
  remarkPlugins,
1289
- rehypePlugins = [rehypeKatex]
1290
- }) => {
1291
- const { theme } = React.useContext(ChatContext);
1292
- return /* @__PURE__ */ jsxRuntime.jsx(
1293
- ReactMarkdown,
1294
- {
1295
- remarkPlugins,
1296
- rehypePlugins,
1297
- components: {
1298
- code: ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1299
- CodeHighlighter,
1300
- {
1301
- ...props,
1302
- language: className,
1303
- className: reablocks.cn(theme.messages.message.markdown.code, className),
1304
- copyClassName: reablocks.cn(theme.messages.message.markdown.copy),
1305
- toolbarClassName: reablocks.cn(theme.messages.message.markdown.toolbar)
1306
- }
1307
- ),
1308
- table: (props) => /* @__PURE__ */ jsxRuntime.jsx(
1309
- TableComponent,
1310
- {
1311
- ...props,
1312
- className: reablocks.cn(theme.messages.message.markdown.table)
1313
- }
1314
- ),
1315
- th: (props) => /* @__PURE__ */ jsxRuntime.jsx(
1316
- TableHeaderCell,
1317
- {
1318
- ...props,
1319
- className: reablocks.cn(theme.messages.message.markdown.th)
1320
- }
1321
- ),
1322
- td: (props) => /* @__PURE__ */ jsxRuntime.jsx(
1323
- TableDataCell,
1324
- {
1325
- ...props,
1326
- className: reablocks.cn(theme.messages.message.markdown.td)
1327
- }
1328
- ),
1329
- a: (props) => /* @__PURE__ */ jsxRuntime.jsx("a", { ...props, className: reablocks.cn(theme.messages.message.markdown.a) }),
1330
- p: (props) => /* @__PURE__ */ jsxRuntime.jsx("p", { ...props, className: reablocks.cn(theme.messages.message.markdown.p) }),
1331
- li: (props) => /* @__PURE__ */ jsxRuntime.jsx("li", { ...props, className: reablocks.cn(theme.messages.message.markdown.li) }),
1332
- ul: (props) => /* @__PURE__ */ jsxRuntime.jsx("ul", { ...props, className: reablocks.cn(theme.messages.message.markdown.ul) }),
1333
- ol: (props) => /* @__PURE__ */ jsxRuntime.jsx("ol", { ...props, className: reablocks.cn(theme.messages.message.markdown.ol) })
1334
- },
1335
- children
1336
- }
1337
- );
1338
- };
1507
+ rehypePlugins = [rehypeKatex],
1508
+ theme
1509
+ }) => /* @__PURE__ */ jsxRuntime.jsx(
1510
+ ReactMarkdown,
1511
+ {
1512
+ remarkPlugins,
1513
+ rehypePlugins,
1514
+ components: {
1515
+ code: ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1516
+ CodeHighlighter,
1517
+ {
1518
+ ...props,
1519
+ language: className,
1520
+ className: reablocks.cn(theme.messages.message.markdown.code, className),
1521
+ copyClassName: reablocks.cn(theme.messages.message.markdown.copy),
1522
+ toolbarClassName: reablocks.cn(theme.messages.message.markdown.toolbar)
1523
+ }
1524
+ ),
1525
+ table: (props) => /* @__PURE__ */ jsxRuntime.jsx(
1526
+ TableComponent,
1527
+ {
1528
+ ...props,
1529
+ className: reablocks.cn(theme.messages.message.markdown.table)
1530
+ }
1531
+ ),
1532
+ th: (props) => /* @__PURE__ */ jsxRuntime.jsx(
1533
+ TableHeaderCell,
1534
+ {
1535
+ ...props,
1536
+ className: reablocks.cn(theme.messages.message.markdown.th)
1537
+ }
1538
+ ),
1539
+ td: (props) => /* @__PURE__ */ jsxRuntime.jsx(
1540
+ TableDataCell,
1541
+ {
1542
+ ...props,
1543
+ className: reablocks.cn(theme.messages.message.markdown.td)
1544
+ }
1545
+ ),
1546
+ a: (props) => /* @__PURE__ */ jsxRuntime.jsx("a", { ...props, className: reablocks.cn(theme.messages.message.markdown.a) }),
1547
+ hr: (props) => /* @__PURE__ */ jsxRuntime.jsx("hr", { ...props, className: reablocks.cn(theme.messages.message.markdown.hr) }),
1548
+ p: (props) => /* @__PURE__ */ jsxRuntime.jsx("p", { ...props, className: reablocks.cn(theme.messages.message.markdown.p) }),
1549
+ li: (props) => /* @__PURE__ */ jsxRuntime.jsx("li", { ...props, className: reablocks.cn(theme.messages.message.markdown.li) }),
1550
+ ul: (props) => /* @__PURE__ */ jsxRuntime.jsx("ul", { ...props, className: reablocks.cn(theme.messages.message.markdown.ul) }),
1551
+ ol: (props) => /* @__PURE__ */ jsxRuntime.jsx("ol", { ...props, className: reablocks.cn(theme.messages.message.markdown.ol) })
1552
+ },
1553
+ children
1554
+ }
1555
+ );
1339
1556
  const CVE_REGEX = /(CVE-(19|20)\d{2}-\d{4,7})/gi;
1340
1557
  function remarkCve() {
1341
- return (tree, _file) => {
1342
- mdastUtilFindAndReplace.findAndReplace(tree, [[
1343
- CVE_REGEX,
1344
- replaceCve
1345
- ]]);
1558
+ return (tree) => {
1559
+ mdastUtilFindAndReplace.findAndReplace(tree, [[CVE_REGEX, replaceCve]], {
1560
+ ignore: ["link"]
1561
+ });
1346
1562
  };
1347
1563
  function replaceCve(value, id) {
1348
1564
  return [
1349
1565
  {
1350
1566
  type: "link",
1351
1567
  url: `https://cve.mitre.org/cgi-bin/cvename.cgi?name=${id}`,
1352
- children: [
1353
- { children: [{ type: "text", value: value.trim() }] }
1354
- ]
1568
+ children: [{ children: [{ type: "text", value: value.trim() }] }]
1355
1569
  }
1356
1570
  ];
1357
1571
  }
1358
1572
  }
1573
+ const SessionEmpty = ({ children }) => {
1574
+ const { theme } = React.useContext(ChatContext);
1575
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: reablocks.cn(theme.empty), children });
1576
+ };
1577
+ const SvgRefresh = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: 18, height: 18, viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M1.75 8.25098C2.16399 8.25098 2.49998 8.58699 2.5 9.00098C2.5 12.585 5.416 15.501 9 15.501C11.149 15.501 13.1291 14.4262 14.3301 12.6992L12.8701 12.9014C12.4591 12.9484 12.0814 12.6698 12.0244 12.2598C11.9685 11.8498 12.2541 11.4711 12.665 11.4141L15.6094 11.0068L15.6104 11.0078C16.0172 10.951 16.3981 11.2386 16.4551 11.6484L16.8633 14.5928C16.9203 15.0038 16.6327 15.3825 16.2227 15.4395C16.1878 15.4444 16.153 15.4463 16.1191 15.4463C15.7501 15.4463 15.429 15.1738 15.377 14.7988L15.2598 13.9551C13.7628 15.842 11.4739 17.001 9 17.001C4.589 17.001 1 13.412 1 9.00098C1.00002 8.58699 1.33601 8.25098 1.75 8.25098ZM9.00098 1C13.412 1 17.001 4.589 17.001 9C17.001 9.414 16.665 9.75 16.251 9.75C15.837 9.75 15.501 9.414 15.501 9C15.501 5.416 12.585 2.5 9.00098 2.5C6.84502 2.5 4.87188 3.57384 3.67188 5.30078L5.12988 5.09863C5.53788 5.04563 5.91859 5.32923 5.97559 5.74023C6.03148 6.15017 5.7459 6.52895 5.33496 6.58594L2.39062 6.99316C2.35579 6.99812 2.32095 6.99999 2.28711 7C1.91811 7 1.59692 6.72754 1.54492 6.35254L1.13672 3.4082C1.07972 2.9972 1.36734 2.61852 1.77734 2.56152C2.18818 2.50179 2.56607 2.79129 2.62305 3.20215L2.73926 4.04199C4.23526 2.15508 6.52006 1 9 1H9.00098Z", fill: "currentColor" }));
1578
+ const SvgThumbsDown = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 18, height: 18, viewBox: "0 0 18 18", fill: "none", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M11.25 1.25H4.5C3.8775 1.25 3.345 1.625 3.12 2.165L0.855 7.4525C0.7875 7.625 0.75 7.805 0.75 8V9.5C0.75 10.325 1.425 11 2.25 11H6.9825L6.27 14.4275L6.2475 14.6675C6.2475 14.975 6.375 15.26 6.5775 15.4625L7.3725 16.25L12.315 11.3075C12.585 11.0375 12.75 10.6625 12.75 10.25V2.75C12.75 1.925 12.075 1.25 11.25 1.25ZM11.25 10.25L7.995 13.505L9 9.5H2.25V8L4.5 2.75H11.25V10.25ZM14.25 1.25H17.25V10.25H14.25V1.25Z", fill: "currentColor" }));
1579
+ const SvgThumbsUp = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 18, height: 18, viewBox: "0 0 18 18", fill: "none", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M6.75 15.75H13.5C14.1225 15.75 14.655 15.375 14.88 14.835L17.145 9.5475C17.2125 9.375 17.25 9.195 17.25 9V7.5C17.25 6.675 16.575 6 15.75 6H11.0175L11.73 2.5725L11.7525 2.3325C11.7525 2.025 11.625 1.74 11.4225 1.5375L10.6275 0.75L5.685 5.6925C5.415 5.9625 5.25 6.3375 5.25 6.75V14.25C5.25 15.075 5.925 15.75 6.75 15.75ZM6.75 6.75L10.005 3.495L9 7.5H15.75V9L13.5 14.25H6.75V6.75ZM0.75 6.75H3.75V15.75H0.75V6.75Z", fill: "currentColor" }));
1580
+ const MessageActions = ({
1581
+ children,
1582
+ ...props
1583
+ }) => {
1584
+ const { theme } = React.useContext(ChatContext);
1585
+ const {
1586
+ question,
1587
+ response,
1588
+ copyIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgCopy, {}),
1589
+ thumbsUpIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgThumbsUp, {}),
1590
+ thumbsDownIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgThumbsDown, {}),
1591
+ refreshIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgRefresh, {}),
1592
+ onCopy,
1593
+ onUpvote,
1594
+ onDownvote,
1595
+ onRefresh
1596
+ } = props;
1597
+ const Comp = children ? reactSlot.Slot : "div";
1598
+ const handleCopy = (text) => {
1599
+ navigator.clipboard.writeText(text).then(() => {
1600
+ console.log("Text copied to clipboard");
1601
+ }).catch((err) => {
1602
+ console.error("Could not copy text: ", err);
1603
+ });
1604
+ };
1605
+ return (copyIcon || thumbsDownIcon || thumbsUpIcon || refreshIcon) && /* @__PURE__ */ jsxRuntime.jsx(Comp, { className: reablocks.cn(theme.messages.message.footer.base), children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1606
+ copyIcon && /* @__PURE__ */ jsxRuntime.jsx(
1607
+ reablocks.IconButton,
1608
+ {
1609
+ variant: "ghost",
1610
+ disablePadding: true,
1611
+ title: "Copy question and response",
1612
+ className: reablocks.cn(theme.messages.message.footer.copy),
1613
+ onClick: onCopy ? onCopy : () => handleCopy(`${question}
1614
+ ${response}`),
1615
+ children: copyIcon
1616
+ }
1617
+ ),
1618
+ thumbsUpIcon && /* @__PURE__ */ jsxRuntime.jsx(
1619
+ reablocks.IconButton,
1620
+ {
1621
+ variant: "ghost",
1622
+ disablePadding: true,
1623
+ title: "Upvote",
1624
+ className: reablocks.cn(theme.messages.message.footer.upvote),
1625
+ onClick: onUpvote,
1626
+ children: thumbsUpIcon
1627
+ }
1628
+ ),
1629
+ thumbsDownIcon && /* @__PURE__ */ jsxRuntime.jsx(
1630
+ reablocks.IconButton,
1631
+ {
1632
+ variant: "ghost",
1633
+ disablePadding: true,
1634
+ title: "Downvote",
1635
+ className: reablocks.cn(theme.messages.message.footer.downvote),
1636
+ onClick: onDownvote,
1637
+ children: thumbsDownIcon
1638
+ }
1639
+ ),
1640
+ refreshIcon && /* @__PURE__ */ jsxRuntime.jsx(
1641
+ reablocks.IconButton,
1642
+ {
1643
+ variant: "ghost",
1644
+ disablePadding: true,
1645
+ title: "Refresh",
1646
+ className: reablocks.cn(theme.messages.message.footer.refresh),
1647
+ onClick: onRefresh,
1648
+ children: refreshIcon
1649
+ }
1650
+ )
1651
+ ] }) });
1652
+ };
1359
1653
  const SvgFile = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, viewBox: "0 0 16 16", fill: "currentColor", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M2.7036 1.37034C3.04741 1.02653 3.51373 0.833374 3.99996 0.833374H9.33329H9.33331C9.47275 0.833374 9.59885 0.890449 9.68954 0.98251L13.6843 4.97722C13.7763 5.0679 13.8333 5.19398 13.8333 5.33337L13.8333 5.3379V13.3334C13.8333 13.8196 13.6401 14.2859 13.2963 14.6297C12.9525 14.9736 12.4862 15.1667 12 15.1667H3.99996C3.51373 15.1667 3.04741 14.9736 2.7036 14.6297C2.35978 14.2859 2.16663 13.8196 2.16663 13.3334V2.66671C2.16663 2.18048 2.35978 1.71416 2.7036 1.37034ZM3.99996 1.83337H8.83331V5.33337C8.83331 5.60952 9.05717 5.83337 9.33331 5.83337H12.8333V13.3334C12.8333 13.5544 12.7455 13.7663 12.5892 13.9226C12.4329 14.0789 12.221 14.1667 12 14.1667H3.99996C3.77895 14.1667 3.56698 14.0789 3.4107 13.9226C3.25442 13.7663 3.16663 13.5544 3.16663 13.3334V2.66671C3.16663 2.44569 3.25442 2.23373 3.4107 2.07745C3.56698 1.92117 3.77895 1.83337 3.99996 1.83337ZM9.83331 2.5405L12.1262 4.83337H9.83331V2.5405ZM5.33331 8.16663C5.05717 8.16663 4.83331 8.39048 4.83331 8.66663C4.83331 8.94277 5.05717 9.16663 5.33331 9.16663H10.6666C10.9428 9.16663 11.1666 8.94277 11.1666 8.66663C11.1666 8.39048 10.9428 8.16663 10.6666 8.16663H5.33331ZM4.83331 11.3334C4.83331 11.0572 5.05717 10.8334 5.33331 10.8334H10.6666C10.9428 10.8334 11.1666 11.0572 11.1666 11.3334C11.1666 11.6095 10.9428 11.8334 10.6666 11.8334H5.33331C5.05717 11.8334 4.83331 11.6095 4.83331 11.3334ZM5.33331 5.5C5.05717 5.5 4.83331 5.72386 4.83331 6C4.83331 6.27614 5.05717 6.5 5.33331 6.5H6.66665C6.94279 6.5 7.16665 6.27614 7.16665 6C7.16665 5.72386 6.94279 5.5 6.66665 5.5H5.33331Z" }));
1360
- const DefaultFileRenderer$2 = React.lazy(() => Promise.resolve().then(() => DefaultFileRenderer$1));
1654
+ const DefaultFileRenderer$2 = React.lazy(
1655
+ () => Promise.resolve().then(() => DefaultFileRenderer$1)
1656
+ );
1361
1657
  const CSVFileRenderer$2 = React.lazy(() => Promise.resolve().then(() => CSVFileRenderer$1));
1362
1658
  const ImageFileRenderer$2 = React.lazy(() => Promise.resolve().then(() => ImageFileRenderer$1));
1363
1659
  const PDFFileRenderer$2 = React.lazy(() => Promise.resolve().then(() => PDFFileRenderer$1));
@@ -1375,29 +1671,12 @@
1375
1671
  }) => {
1376
1672
  const { theme } = React.useContext(ChatContext);
1377
1673
  const FileRenderer = React.useMemo(() => {
1378
- const Renderer = Object.keys(FILE_TYPE_RENDERER_MAP).find((key) => type == null ? void 0 : type.startsWith(key)) ?? "default";
1674
+ const Renderer = Object.keys(FILE_TYPE_RENDERER_MAP).find((key) => type?.startsWith(key)) ?? "default";
1379
1675
  return FILE_TYPE_RENDERER_MAP[Renderer] || DefaultFileRenderer$2;
1380
1676
  }, [type]);
1381
- return /* @__PURE__ */ jsxRuntime.jsx(
1382
- "div",
1383
- {
1384
- className: reablocks.cn(theme.messages.message.files.file.base),
1385
- children: /* @__PURE__ */ jsxRuntime.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx("div", { children: "Loading..." }), children: /* @__PURE__ */ jsxRuntime.jsx(FileRenderer, { name, url, fileIcon, limit }) })
1386
- }
1387
- );
1677
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: reablocks.cn(theme.messages.message.files.file.base), children: /* @__PURE__ */ jsxRuntime.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx("div", { children: "Loading..." }), children: /* @__PURE__ */ jsxRuntime.jsx(FileRenderer, { name, url, fileIcon, limit }) }) });
1388
1678
  };
1389
- const DefaultFileRenderer = ({
1390
- name,
1391
- limit = 100,
1392
- fileIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgFile, {})
1393
- }) => /* @__PURE__ */ jsxRuntime.jsxs("figure", { className: "flex items-center gap-2", children: [
1394
- fileIcon,
1395
- name && /* @__PURE__ */ jsxRuntime.jsx("figcaption", { className: reablocks.cn("file-name-class"), children: /* @__PURE__ */ jsxRuntime.jsx(reablocks.Ellipsis, { value: name, limit }) })
1396
- ] });
1397
- const DefaultFileRenderer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1398
- __proto__: null,
1399
- default: DefaultFileRenderer
1400
- }, Symbol.toStringTag, { value: "Module" }));
1679
+ const SvgDownload = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "24px", height: "24px", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M 11 2 C 10.448 2 10 2.448 10 3 L 10 11 L 6.5 11 A 0.5 0.5 0 0 0 6 11.5 A 0.5 0.5 0 0 0 6.1464844 11.853516 A 0.5 0.5 0 0 0 6.1777344 11.882812 L 11.283203 16.697266 L 11.316406 16.728516 A 1 1 0 0 0 12 17 A 1 1 0 0 0 12.683594 16.728516 L 12.697266 16.716797 A 1 1 0 0 0 12.707031 16.705078 L 17.810547 11.892578 A 0.5 0.5 0 0 0 17.839844 11.865234 L 17.847656 11.859375 A 0.5 0.5 0 0 0 17.853516 11.853516 A 0.5 0.5 0 0 0 18 11.5 A 0.5 0.5 0 0 0 17.5 11 L 14 11 L 14 3 C 14 2.448 13.552 2 13 2 L 12 2 L 11 2 z M 3 20 A 1.0001 1.0001 0 1 0 3 22 L 21 22 A 1.0001 1.0001 0 1 0 21 20 L 3 20 z", fill: "currentColor" }));
1401
1680
  const sanitizeSVGCell = (cell) => {
1402
1681
  const trimmed = cell.trim();
1403
1682
  const escaped = trimmed.replace(/"/g, '""');
@@ -1414,8 +1693,8 @@
1414
1693
  throw new Error("Failed to parse CSV file.");
1415
1694
  }
1416
1695
  };
1417
- const SvgDownload = (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-cloud-download", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M12 12v9" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "m8 17 4 4 4-4" }));
1418
1696
  const CSVFileRenderer = ({ name, url, fileIcon }) => {
1697
+ const { theme } = React.useContext(ChatContext);
1419
1698
  const [isLoading, setIsLoading] = React.useState(true);
1420
1699
  const [csvData, setCsvData] = React.useState([]);
1421
1700
  const [error, setError] = React.useState(null);
@@ -1491,24 +1770,24 @@
1491
1770
  ]
1492
1771
  }
1493
1772
  );
1494
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
1495
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center gap-4", children: [
1496
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "csv-icon flex items-center", children: [
1773
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: theme.messages.message.csvPreview.base, children: [
1774
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: theme.messages.message.csvPreview.header.base, children: [
1775
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: theme.messages.message.csvPreview.header.icon, children: [
1497
1776
  fileIcon,
1498
1777
  name && /* @__PURE__ */ jsxRuntime.jsx("figcaption", { className: "ml-1", children: name })
1499
1778
  ] }),
1500
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "csv-icon flex items-center gap-6", children: [
1501
- /* @__PURE__ */ jsxRuntime.jsx(reablocks.IconButton, { size: "small", variant: "text", onClick: downloadCSV, children: /* @__PURE__ */ jsxRuntime.jsx(SvgDownload, {}) }),
1502
- /* @__PURE__ */ jsxRuntime.jsx(reablocks.IconButton, { size: "small", variant: "text", onClick: toggleModal, children: /* @__PURE__ */ jsxRuntime.jsx(SvgCopy, {}) })
1779
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: theme.messages.message.csvPreview.header.actions, children: [
1780
+ /* @__PURE__ */ jsxRuntime.jsx(reablocks.IconButton, { size: "medium", variant: "text", onClick: downloadCSV, children: /* @__PURE__ */ jsxRuntime.jsx(SvgDownload, {}) }),
1781
+ /* @__PURE__ */ jsxRuntime.jsx(reablocks.IconButton, { size: "medium", variant: "text", onClick: toggleModal, children: /* @__PURE__ */ jsxRuntime.jsx(SvgCopy, {}) })
1503
1782
  ] })
1504
1783
  ] }),
1505
1784
  error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "error-message", children: error }),
1506
1785
  isLoading && !csvData && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-text-secondary", children: "Loading..." }),
1507
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-between", children: !error && csvData.length > 0 && renderTable(csvData, 6) }),
1786
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: theme.messages.message.csvPreview.tableContainer, children: !error && csvData.length > 0 && renderTable(csvData, 6) }),
1508
1787
  /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: isModalOpen && /* @__PURE__ */ jsxRuntime.jsx(
1509
1788
  react.motion.div,
1510
1789
  {
1511
- className: "fixed inset-0 bg-black/70 flex justify-center items-center z-50",
1790
+ className: theme.messages.message.csvPreview.dialog.base,
1512
1791
  initial: { opacity: 0 },
1513
1792
  animate: { opacity: 1 },
1514
1793
  exit: { opacity: 0 },
@@ -1517,7 +1796,7 @@
1517
1796
  react.motion.div,
1518
1797
  {
1519
1798
  ref: modalRef,
1520
- className: "bg-white dark:bg-gray-900 rounded-md w-11/12 h-5/6 overflow-auto",
1799
+ className: theme.messages.message.csvPreview.dialog.container,
1521
1800
  initial: { scale: 0.8 },
1522
1801
  animate: { scale: 1 },
1523
1802
  exit: { scale: 0.8 },
@@ -1533,15 +1812,34 @@
1533
1812
  __proto__: null,
1534
1813
  default: CSVFileRenderer
1535
1814
  }, Symbol.toStringTag, { value: "Module" }));
1815
+ const DefaultFileRenderer = ({
1816
+ name,
1817
+ limit = 100,
1818
+ fileIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgFile, {})
1819
+ }) => /* @__PURE__ */ jsxRuntime.jsxs("figure", { className: "flex items-center gap-2", children: [
1820
+ fileIcon,
1821
+ name && /* @__PURE__ */ jsxRuntime.jsx("figcaption", { className: reablocks.cn("file-name-class"), children: /* @__PURE__ */ jsxRuntime.jsx(reablocks.Ellipsis, { value: name, limit }) })
1822
+ ] });
1823
+ const DefaultFileRenderer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1824
+ __proto__: null,
1825
+ default: DefaultFileRenderer
1826
+ }, Symbol.toStringTag, { value: "Module" }));
1536
1827
  const ImageFileRenderer = ({ url }) => /* @__PURE__ */ jsxRuntime.jsx("img", { src: url, alt: "Image", className: "size-10" });
1537
1828
  const ImageFileRenderer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1538
1829
  __proto__: null,
1539
1830
  default: ImageFileRenderer
1540
1831
  }, Symbol.toStringTag, { value: "Module" }));
1541
- const PDFFileRenderer = ({ name, url, fileIcon }) => /* @__PURE__ */ jsxRuntime.jsxs("figure", { className: "csv-icon flex items-center gap-2", onClick: () => window.open(url, "_blank"), children: [
1542
- fileIcon,
1543
- name && /* @__PURE__ */ jsxRuntime.jsx("figcaption", { className: "file-name", children: name })
1544
- ] });
1832
+ const PDFFileRenderer = ({ name, url, fileIcon }) => /* @__PURE__ */ jsxRuntime.jsxs(
1833
+ "figure",
1834
+ {
1835
+ className: "csv-icon flex items-center gap-2",
1836
+ onClick: () => window.open(url, "_blank"),
1837
+ children: [
1838
+ fileIcon,
1839
+ name && /* @__PURE__ */ jsxRuntime.jsx("figcaption", { className: "file-name", children: name })
1840
+ ]
1841
+ }
1842
+ );
1545
1843
  const PDFFileRenderer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1546
1844
  __proto__: null,
1547
1845
  default: PDFFileRenderer
@@ -1631,7 +1929,7 @@
1631
1929
  ...props,
1632
1930
  children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1633
1931
  /* @__PURE__ */ jsxRuntime.jsx(MessageFiles, { files }),
1634
- /* @__PURE__ */ jsxRuntime.jsx(Markdown, { remarkPlugins, children: question }),
1932
+ /* @__PURE__ */ jsxRuntime.jsx(Markdown, { remarkPlugins, theme, children: question }),
1635
1933
  isLong && !expanded && /* @__PURE__ */ jsxRuntime.jsx(
1636
1934
  reablocks.Button,
1637
1935
  {
@@ -1659,7 +1957,7 @@
1659
1957
  "data-compact": isCompact,
1660
1958
  className: reablocks.cn(theme.messages.message.response),
1661
1959
  children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1662
- /* @__PURE__ */ jsxRuntime.jsx(Markdown, { remarkPlugins, children: response }),
1960
+ /* @__PURE__ */ jsxRuntime.jsx(Markdown, { remarkPlugins, theme, children: response }),
1663
1961
  isLoading && /* @__PURE__ */ jsxRuntime.jsx(
1664
1962
  react.motion.div,
1665
1963
  {
@@ -1676,7 +1974,12 @@
1676
1974
  }
1677
1975
  );
1678
1976
  };
1679
- const MessageSource = ({ title, url, image, limit = 50 }) => {
1977
+ const MessageSource = ({
1978
+ title,
1979
+ url,
1980
+ image,
1981
+ limit = 50
1982
+ }) => {
1680
1983
  const { theme, isCompact } = React.useContext(ChatContext);
1681
1984
  return /* @__PURE__ */ jsxRuntime.jsxs(
1682
1985
  "figure",
@@ -1690,10 +1993,26 @@
1690
1993
  }
1691
1994
  },
1692
1995
  children: [
1693
- image && /* @__PURE__ */ jsxRuntime.jsx("img", { src: image, alt: title, className: reablocks.cn(theme.messages.message.sources.source.image) }),
1996
+ image && /* @__PURE__ */ jsxRuntime.jsx(
1997
+ "img",
1998
+ {
1999
+ src: image,
2000
+ alt: title,
2001
+ className: reablocks.cn(theme.messages.message.sources.source.image)
2002
+ }
2003
+ ),
1694
2004
  (title || url) && /* @__PURE__ */ jsxRuntime.jsxs("figcaption", { children: [
1695
2005
  title && /* @__PURE__ */ jsxRuntime.jsx("span", { className: reablocks.cn(theme.messages.message.sources.source.title), children: /* @__PURE__ */ jsxRuntime.jsx(reablocks.Ellipsis, { value: title, limit }) }),
1696
- url && /* @__PURE__ */ jsxRuntime.jsx("a", { href: url, target: "_blank", rel: "noopener noreferrer", className: reablocks.cn(theme.messages.message.sources.source.url), children: url })
2006
+ url && /* @__PURE__ */ jsxRuntime.jsx(
2007
+ "a",
2008
+ {
2009
+ href: url,
2010
+ target: "_blank",
2011
+ rel: "noopener noreferrer",
2012
+ className: reablocks.cn(theme.messages.message.sources.source.url),
2013
+ children: url
2014
+ }
2015
+ )
1697
2016
  ] })
1698
2017
  ]
1699
2018
  }
@@ -1710,82 +2029,6 @@
1710
2029
  }
1711
2030
  return sources && sources.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: reablocks.cn(theme.messages.message.sources.base), children: sources.map((source, index) => /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...source, children }, index)) });
1712
2031
  };
1713
- const SvgThumbsDown = (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-thumbs-down", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M17 14V2" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z" }));
1714
- const SvgThumbsUp = (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-thumbs-up", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M7 10v12" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z" }));
1715
- const SvgRefresh = (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-refresh-ccw", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M3 3v5h5" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M16 16h5v5" }));
1716
- const MessageActions = ({
1717
- children,
1718
- ...props
1719
- }) => {
1720
- const { theme } = React.useContext(ChatContext);
1721
- const {
1722
- question,
1723
- response,
1724
- copyIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgCopy, {}),
1725
- thumbsUpIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgThumbsUp, {}),
1726
- thumbsDownIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgThumbsDown, {}),
1727
- refreshIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgRefresh, {}),
1728
- onCopy,
1729
- onUpvote,
1730
- onDownvote,
1731
- onRefresh
1732
- } = props;
1733
- const Comp = children ? reactSlot.Slot : "div";
1734
- const handleCopy = (text) => {
1735
- navigator.clipboard.writeText(text).then(() => {
1736
- console.log("Text copied to clipboard");
1737
- }).catch((err) => {
1738
- console.error("Could not copy text: ", err);
1739
- });
1740
- };
1741
- return (copyIcon || thumbsDownIcon || thumbsUpIcon || refreshIcon) && /* @__PURE__ */ jsxRuntime.jsx(Comp, { className: reablocks.cn(theme.messages.message.footer.base), children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1742
- copyIcon && /* @__PURE__ */ jsxRuntime.jsx(
1743
- reablocks.IconButton,
1744
- {
1745
- variant: "text",
1746
- disablePadding: true,
1747
- title: "Copy question and response",
1748
- className: reablocks.cn(theme.messages.message.footer.copy),
1749
- onClick: onCopy ? onCopy : () => handleCopy(`${question}
1750
- ${response}`),
1751
- children: copyIcon
1752
- }
1753
- ),
1754
- thumbsUpIcon && /* @__PURE__ */ jsxRuntime.jsx(
1755
- reablocks.IconButton,
1756
- {
1757
- variant: "text",
1758
- disablePadding: true,
1759
- title: "Upvote",
1760
- className: reablocks.cn(theme.messages.message.footer.upvote),
1761
- onClick: onUpvote,
1762
- children: thumbsUpIcon
1763
- }
1764
- ),
1765
- thumbsDownIcon && /* @__PURE__ */ jsxRuntime.jsx(
1766
- reablocks.IconButton,
1767
- {
1768
- variant: "text",
1769
- disablePadding: true,
1770
- title: "Downvote",
1771
- className: reablocks.cn(theme.messages.message.footer.downvote),
1772
- onClick: onDownvote,
1773
- children: thumbsDownIcon
1774
- }
1775
- ),
1776
- refreshIcon && /* @__PURE__ */ jsxRuntime.jsx(
1777
- reablocks.IconButton,
1778
- {
1779
- variant: "text",
1780
- disablePadding: true,
1781
- title: "Refresh",
1782
- className: reablocks.cn(theme.messages.message.footer.refresh),
1783
- onClick: onRefresh,
1784
- children: refreshIcon
1785
- }
1786
- )
1787
- ] }) });
1788
- };
1789
2032
  const messageVariants = {
1790
2033
  hidden: {
1791
2034
  opacity: 0,
@@ -1800,403 +2043,51 @@ ${response}`),
1800
2043
  }
1801
2044
  };
1802
2045
  const SessionMessage = ({
2046
+ className,
1803
2047
  conversation,
1804
2048
  isLast,
1805
2049
  children
1806
2050
  }) => {
1807
2051
  const { theme, isLoading } = React.useContext(ChatContext);
1808
2052
  return /* @__PURE__ */ jsxRuntime.jsxs(react.motion.div, { variants: messageVariants, children: [
1809
- /* @__PURE__ */ jsxRuntime.jsx(reablocks.Card, { className: reablocks.cn(theme.messages.message.base), children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1810
- /* @__PURE__ */ jsxRuntime.jsx(MessageQuestion, { question: conversation.question, files: conversation.files }),
2053
+ /* @__PURE__ */ jsxRuntime.jsx(reablocks.Card, { className: reablocks.cn(theme.messages.message.base, className), children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1811
2054
  /* @__PURE__ */ jsxRuntime.jsx(
1812
- MessageResponse,
1813
- {
1814
- response: conversation.response,
1815
- isLoading: isLast && isLoading
1816
- }
1817
- ),
1818
- /* @__PURE__ */ jsxRuntime.jsx(MessageSources, { sources: conversation.sources }),
1819
- /* @__PURE__ */ jsxRuntime.jsx(
1820
- MessageActions,
2055
+ MessageQuestion,
1821
2056
  {
1822
2057
  question: conversation.question,
1823
- response: conversation.response
2058
+ files: conversation.files
1824
2059
  }
1825
- )
1826
- ] }) }),
1827
- !isLast && /* @__PURE__ */ jsxRuntime.jsx(reablocks.Divider, {})
1828
- ] }, conversation.id);
1829
- };
1830
- const containerVariants = {
1831
- hidden: {},
1832
- visible: {
1833
- transition: {
1834
- staggerChildren: 0.07,
1835
- when: "beforeChildren"
1836
- }
1837
- }
1838
- };
1839
- const SessionMessages = ({
1840
- children,
1841
- newSessionContent,
1842
- limit = 10,
1843
- showMoreText = "Show more"
1844
- }) => {
1845
- const { activeSession, theme } = React.useContext(ChatContext);
1846
- const contentRef = React.useRef(null);
1847
- const [isAnimating, setIsAnimating] = React.useState(true);
1848
- React.useEffect(() => {
1849
- if (contentRef.current) {
1850
- requestAnimationFrame(
1851
- () => contentRef.current.scrollTop = contentRef.current.scrollHeight
1852
- );
1853
- }
1854
- }, [activeSession, isAnimating]);
1855
- function handleShowMore() {
1856
- showNext(limit);
1857
- requestAnimationFrame(() => contentRef.current.scrollTop = 0);
1858
- }
1859
- const reversedConvos = React.useMemo(
1860
- () => [...(activeSession == null ? void 0 : activeSession.conversations) ?? []].reverse(),
1861
- [activeSession]
1862
- );
1863
- const { data, hasMore, showNext } = reablocks.useInfinityList({
1864
- items: reversedConvos,
1865
- size: limit
1866
- });
1867
- const reReversedConvo = React.useMemo(() => [...data].reverse(), [data]);
1868
- const convosToRender = limit ? reReversedConvo : activeSession == null ? void 0 : activeSession.conversations;
1869
- if (!activeSession) {
1870
- return /* @__PURE__ */ jsxRuntime.jsx(SessionEmpty, { children: newSessionContent });
1871
- }
1872
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn(theme.messages.content), ref: contentRef, children: [
1873
- hasMore && /* @__PURE__ */ jsxRuntime.jsx(
1874
- reablocks.Button,
1875
- {
1876
- variant: "outline",
1877
- className: reablocks.cn(theme.messages.showMore),
1878
- fullWidth: true,
1879
- onClick: handleShowMore,
1880
- children: showMoreText
1881
- }
1882
- ),
1883
- /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: /* @__PURE__ */ jsxRuntime.jsx(
1884
- react.motion.div,
1885
- {
1886
- variants: containerVariants,
1887
- initial: "hidden",
1888
- animate: "visible",
1889
- onAnimationComplete: () => {
1890
- requestAnimationFrame(() => setIsAnimating(false));
1891
- },
1892
- children: children ? children(convosToRender) : convosToRender.map((conversation, index) => /* @__PURE__ */ jsxRuntime.jsx(
1893
- SessionMessage,
1894
- {
1895
- conversation,
1896
- isLast: index === conversation.length - 1
1897
- },
1898
- conversation.id
1899
- ))
1900
- },
1901
- activeSession == null ? void 0 : activeSession.id
1902
- ) })
1903
- ] });
1904
- };
1905
- const chatTheme = {
1906
- base: "dark:text-white text-gray-500",
1907
- console: "flex w-full gap-4 h-full",
1908
- companion: "w-full h-full overflow-hidden",
1909
- empty: "text-center flex-1",
1910
- appbar: "flex p-5",
1911
- sessions: {
1912
- base: "overflow-auto",
1913
- console: "min-w-[150px] w-[30%] max-w-[300px] dark:bg-[#11111F] bg-[#F2F3F7] p-5 rounded-3xl",
1914
- companion: "w-full h-full",
1915
- group: "text-xs dart:text-gray-400 text-gray-700 mt-4 hover:bg-transparent mb-1",
1916
- create: "relative mb-4 rounded-[10px] text-white",
1917
- session: {
1918
- base: [
1919
- "group my-1 rounded-[10px] p-2 text-gray-500 border border-transparent hover:bg-gray-300 hover:border-gray-400 [&_svg]:text-gray-500",
1920
- "dark:text-typography dark:text-gray-400 dark:hover:bg-gray-800/50 dark:hover:border-gray-700/50 dark:[&_svg]:text-gray-200"
1921
- ].join(" "),
1922
- active: [
1923
- "border border-gray-300 hover:border-gray-400 text-gray-700 bg-gray-200 hover:bg-gray-300 ",
1924
- "dark:text-gray-500 dark:bg-gray-800/70 dark:border-gray-700/50 dark:text-white dark:border-gray-700/70 dark:hover:bg-gray-800/50",
1925
- "[&_button]:opacity-100!"
1926
- ].join(" "),
1927
- delete: "[&>svg]:w-4 [&>svg]:h-4 opacity-0 group-hover:opacity-50!"
1928
- }
1929
- },
1930
- messages: {
1931
- base: "",
1932
- console: "flex flex-col mx-5 flex-1 overflow-hidden",
1933
- companion: "flex w-full h-full",
1934
- back: "self-start p-0 my-2",
1935
- inner: "flex-1 h-full flex flex-col",
1936
- title: ["text-base font-bold text-gray-500", "dark:text-gray-200"].join(
1937
- " "
1938
- ),
1939
- date: "text-xs whitespace-nowrap text-gray-400",
1940
- content: [
1941
- "mt-2 flex-1 overflow-auto [&_hr]:bg-gray-200",
1942
- "dark:[&_hr]:bg-gray-800/60"
1943
- ].join(" "),
1944
- header: "flex justify-between items-center gap-2",
1945
- showMore: "mb-4",
1946
- message: {
1947
- base: "mt-4 mb-4 flex flex-col p-0 rounded-sm border-none bg-transparent",
1948
- question: [
1949
- "relative font-semibold mb-4 px-4 py-4 pb-2 rounded-3xl rounded-br-none text-typography border bg-gray-200 border-gray-300 text-gray-900",
1950
- "dark:bg-gray-900/60 dark:border-gray-700/50 dark:text-gray-100"
1951
- ].join(" "),
1952
- response: [
1953
- "relative data-[compact=false]:px-4 text-gray-900",
1954
- "dark:text-gray-100"
1955
- ].join(" "),
1956
- overlay: "overflow-y-hidden max-h-[350px] after:content-[''] after:absolute after:inset-x-0 after:bottom-0 after:h-16 after:bg-linear-to-b after:from-transparent dark:after:to-gray-900 after:to-gray-200",
1957
- cursor: "inline-block w-1 h-4 bg-current",
1958
- expand: "absolute bottom-1 right-1 z-10",
1959
- files: {
1960
- base: "mb-2 flex flex-wrap gap-3 ",
1961
- file: {
1962
- base: [
1963
- "flex items-center gap-2 border border-gray-300 px-3 py-2 rounded-lg cursor-pointer",
1964
- "dark:border-gray-700"
1965
- ].join(" "),
1966
- name: ["text-sm text-gray-500", "dark:text-gray-200"].join(" ")
1967
- }
1968
- },
1969
- sources: {
1970
- base: "my-4 flex flex-wrap gap-3",
1971
- source: {
1972
- base: [
1973
- "flex gap-2 border border-gray-200 px-4 py-2 rounded-lg cursor-pointer",
1974
- "dark:border-gray-700"
1975
- ].join(" "),
1976
- companion: "flex-1 px-3 py-1.5",
1977
- image: "max-w-10 max-h-10 rounded-md w-full h-fit self-center",
1978
- title: "text-md block",
1979
- url: "text-sm text-blue-400 underline"
1980
- }
1981
- },
1982
- markdown: {
1983
- copy: "sticky py-1 [&>svg]:w-4 [&>svg]:h-4 opacity-50",
1984
- p: "mb-2",
1985
- a: "text-blue-400 underline",
1986
- table: "table-auto w-full m-2",
1987
- th: "px-4 py-2 text-left font-bold border-b border-gray-500",
1988
- td: "px-4 py-2",
1989
- code: "m-2 rounded-b relative",
1990
- 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 ",
1991
- li: "mb-2 ml-6",
1992
- ul: "mb-4 list-disc",
1993
- ol: "mb-4 list-decimal"
1994
- },
1995
- footer: {
1996
- base: "mt-3 flex gap-1.5",
1997
- copy: [
1998
- "p-3 rounded-[10px] [&>svg]:w-4 [&>svg]:h-4 opacity-50 hover:opacity-100! hover:bg-gray-200 hover:text-gray-500",
1999
- "dark:hover:bg-gray-800 dark:hover:text-white text-gray-400"
2000
- ].join(" "),
2001
- upvote: "p-3 rounded-[10px] [&>svg]:w-4 [&>svg]:h-4 opacity-50 hover:opacity-100! hover:bg-gray-700/40 hover:text-white text-gray-400",
2002
- downvote: "p-3 rounded-[10px] [&>svg]:w-4 [&>svg]:h-4 opacity-50 hover:opacity-100! hover:bg-gray-700/40 hover:text-white text-gray-400",
2003
- refresh: "p-3 rounded-[10px] [&>svg]:w-4 [&>svg]:h-4 opacity-50 hover:opacity-100! hover:bg-gray-700/40 hover:text-white text-gray-400"
2004
- }
2005
- }
2006
- },
2007
- input: {
2008
- base: "flex mt-4 relative",
2009
- upload: ["px-5 py-2 text-gray-400 size-10", "dark:gray-500"].join(" "),
2010
- input: [
2011
- "w-full border rounded-3xl px-3 py-2 pr-16 text-gray-500 border-gray-200 hover:bg-blue-100 hover:border-blue-500 after:hidden after:mx-10! bg-white [&>textarea]:w-full [&>textarea]:flex-none",
2012
- "dark:border-gray-700/50 dark:text-gray-200 dark:bg-gray-950 dark:hover:bg-blue-950/40"
2013
- ].join(" "),
2014
- actions: {
2015
- base: "absolute flex gap-2 items-center right-5 inset-y-1/2 -translate-y-1/2 z-10",
2016
- send: [
2017
- "px-3 py-3 hover:bg-primary-hover rounded-full bg-gray-200 hover:bg-gray-300 text-gray-500",
2018
- "dark:text-white light:text-gray-500 dark:bg-gray-800 dark:hover:bg-gray-700"
2019
- ].join(" "),
2020
- stop: "px-2 py-2 bg-red-500 text-white rounded-full hover:bg-red-700 "
2021
- }
2022
- }
2023
- };
2024
- const useDimensions = () => {
2025
- const [ref, setRef] = React.useState(null);
2026
- const [width, setWidth] = React.useState(void 0);
2027
- const observe = React.useCallback((element) => {
2028
- if (element) setRef(element);
2029
- }, []);
2030
- React.useEffect(() => {
2031
- if (!ref) return;
2032
- const resizeObserver = new ResizeObserver((entries) => {
2033
- for (let entry of entries) {
2034
- setWidth(entry.contentRect.width);
2035
- }
2036
- });
2037
- resizeObserver.observe(ref);
2038
- return () => {
2039
- resizeObserver.disconnect();
2040
- };
2041
- }, [ref]);
2042
- return { width, observe };
2043
- };
2044
- const Chat = ({
2045
- children,
2046
- viewType = "console",
2047
- sessions,
2048
- onSelectSession,
2049
- onDeleteSession,
2050
- onSendMessage,
2051
- onStopMessage,
2052
- onFileUpload,
2053
- isLoading,
2054
- activeSessionId,
2055
- theme = chatTheme,
2056
- onNewSession,
2057
- remarkPlugins = [remarkGfm, remarkYoutube, remarkMath],
2058
- disabled,
2059
- style,
2060
- className
2061
- }) => {
2062
- const [internalActiveSessionID, setInternalActiveSessionID] = React.useState(activeSessionId);
2063
- const { width, observe } = useDimensions();
2064
- const isCompact = viewType === "companion" || width && width < 767;
2065
- React.useEffect(() => {
2066
- setInternalActiveSessionID(activeSessionId);
2067
- }, [activeSessionId]);
2068
- const handleSelectSession = React.useCallback(
2069
- (sessionId) => {
2070
- setInternalActiveSessionID(sessionId);
2071
- onSelectSession == null ? void 0 : onSelectSession(sessionId);
2072
- },
2073
- [onSelectSession]
2074
- );
2075
- const handleDeleteSession = React.useCallback(
2076
- (sessionId) => {
2077
- setInternalActiveSessionID(void 0);
2078
- onDeleteSession == null ? void 0 : onDeleteSession(sessionId);
2079
- },
2080
- [onDeleteSession]
2081
- );
2082
- const handleCreateNewSession = React.useCallback(() => {
2083
- setInternalActiveSessionID(void 0);
2084
- onNewSession == null ? void 0 : onNewSession();
2085
- }, [onNewSession]);
2086
- reakeys.useHotkeys([
2087
- {
2088
- name: "Create new session",
2089
- category: "Chat",
2090
- keys: "meta+shift+s",
2091
- callback: (event) => {
2092
- event.preventDefault();
2093
- handleCreateNewSession();
2094
- }
2095
- }
2096
- ]);
2097
- const activeSession = React.useMemo(
2098
- () => sessions.find((session) => session.id === internalActiveSessionID),
2099
- [sessions, internalActiveSessionID]
2100
- );
2101
- const contextValue = React.useMemo(
2102
- () => ({
2103
- sessions,
2104
- activeSession,
2105
- remarkPlugins,
2106
- theme,
2107
- disabled,
2108
- isLoading,
2109
- isCompact,
2110
- viewType,
2111
- activeSessionId: internalActiveSessionID,
2112
- selectSession: handleSelectSession,
2113
- deleteSession: handleDeleteSession,
2114
- createSession: handleCreateNewSession,
2115
- sendMessage: onSendMessage,
2116
- stopMessage: onStopMessage,
2117
- fileUpload: onFileUpload
2118
- }),
2119
- [
2120
- isLoading,
2121
- isCompact,
2122
- viewType,
2123
- disabled,
2124
- theme,
2125
- remarkPlugins,
2126
- sessions,
2127
- activeSession,
2128
- internalActiveSessionID,
2129
- handleSelectSession,
2130
- handleDeleteSession,
2131
- handleCreateNewSession,
2132
- onSendMessage,
2133
- onStopMessage,
2134
- onFileUpload
2135
- ]
2136
- );
2137
- return /* @__PURE__ */ jsxRuntime.jsx(ChatContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { initial: false, children: /* @__PURE__ */ jsxRuntime.jsx(
2138
- "div",
2139
- {
2140
- ref: observe,
2141
- className: reablocks.cn(className, theme.base, {
2142
- [theme.companion]: isCompact,
2143
- [theme.console]: !isCompact
2144
- }),
2145
- style,
2146
- children
2147
- }
2148
- ) }) });
2149
- };
2150
- const SvgTrash = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: 14, height: 14, viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("g", { id: "Delete" }, /* @__PURE__ */ React__namespace.createElement("path", { id: "Vector", d: "M5.97905 1.16666C5.90859 1.16576 5.83895 1.18189 5.77605 1.21368C5.71316 1.24547 5.65888 1.29199 5.61783 1.34926C5.57677 1.40654 5.55016 1.47288 5.54025 1.54265C5.53034 1.61242 5.53743 1.68355 5.56092 1.75H4.27007C3.7342 1.75 3.2324 2.01817 2.93535 2.46435L2.24492 3.5H2.18738C2.12941 3.49918 2.07185 3.50989 2.01805 3.5315C1.96425 3.55312 1.91529 3.58522 1.874 3.62593C1.83271 3.66663 1.79993 3.71514 1.77755 3.76863C1.75518 3.82211 1.74365 3.87952 1.74365 3.9375C1.74365 3.99548 1.75518 4.05288 1.77755 4.10636C1.79993 4.15985 1.83271 4.20836 1.874 4.24907C1.91529 4.28977 1.96425 4.32187 2.01805 4.34349C2.07185 4.3651 2.12941 4.37582 2.18738 4.375H2.41012C2.44765 4.38067 2.48576 4.38143 2.52348 4.37727L3.24468 11.1084C3.33169 11.9199 4.02367 12.5417 4.83973 12.5417H9.15947C9.97553 12.5417 10.6675 11.9199 10.7545 11.1084L11.4763 4.37727C11.5133 4.38124 11.5506 4.38047 11.5874 4.375H11.8124C11.8704 4.37582 11.9279 4.3651 11.9817 4.34349C12.0355 4.32187 12.0845 4.28977 12.1258 4.24907C12.1671 4.20836 12.1998 4.15985 12.2222 4.10636C12.2446 4.05288 12.2561 3.99548 12.2561 3.9375C12.2561 3.87952 12.2446 3.82211 12.2222 3.76863C12.1998 3.71514 12.1671 3.66663 12.1258 3.62593C12.0845 3.58522 12.0355 3.55312 11.9817 3.5315C11.9279 3.50989 11.8704 3.49918 11.8124 3.5H11.7548L11.0644 2.46435C10.7671 2.01841 10.2654 1.75 9.7297 1.75H8.43885C8.46234 1.68355 8.46943 1.61242 8.45952 1.54265C8.44961 1.47288 8.423 1.40654 8.38194 1.34926C8.34089 1.29199 8.2866 1.24547 8.22371 1.21368C8.16082 1.18189 8.09118 1.16576 8.02072 1.16666H5.97905ZM4.27007 2.625H9.7297C9.97394 2.625 10.2009 2.74639 10.3364 2.9497L10.7033 3.5H3.29651L3.66338 2.9497L3.66395 2.94913C3.79913 2.74608 4.02543 2.625 4.27007 2.625ZM3.40361 4.375H10.5962L9.88465 11.015C9.8445 11.3894 9.53575 11.6667 9.15947 11.6667H4.83973C4.46345 11.6667 4.15527 11.3894 4.11512 11.015L3.40361 4.375Z", fill: "currentColor" })));
2151
- const SvgChat = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: 16, height: 17, viewBox: "0 0 16 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M8 3C4.55375 3 1.75 5.23753 1.75 7.98828C1.75 9.70653 2.83659 11.2762 4.62109 12.188C4.11184 13.0465 3.62587 13.7378 3.62012 13.7461C3.50687 13.9071 3.49862 14.1196 3.59912 14.2891C3.69012 14.4418 3.8543 14.5342 4.0293 14.5342C4.0483 14.5342 4.06743 14.533 4.08643 14.5308C4.15168 14.5233 5.66214 14.3364 7.50439 12.9604C7.67239 12.9712 7.8385 12.9766 8 12.9766C11.4462 12.9766 14.25 10.739 14.25 7.98828C14.25 5.23753 11.4462 3 8 3ZM8 4C10.8948 4 13.25 5.78903 13.25 7.98828C13.25 10.1875 10.8948 11.9766 8 11.9766C7.8055 11.9766 7.60225 11.968 7.396 11.9497C7.271 11.9382 7.1454 11.9752 7.0459 12.0527C6.3589 12.5855 5.72033 12.9308 5.20508 13.1528C5.38383 12.8648 5.57691 12.5418 5.76416 12.2061C5.83416 12.0813 5.84705 11.9324 5.7998 11.7974C5.75255 11.6624 5.64983 11.5542 5.51758 11.5C3.81033 10.7993 2.75 9.45328 2.75 7.98828C2.75 5.78903 5.10525 4 8 4ZM5.5 7.25C5.08575 7.25 4.75 7.58575 4.75 8C4.75 8.41425 5.08575 8.75 5.5 8.75C5.91425 8.75 6.25 8.41425 6.25 8C6.25 7.58575 5.91425 7.25 5.5 7.25ZM8 7.25C7.58575 7.25 7.25 7.58575 7.25 8C7.25 8.41425 7.58575 8.75 8 8.75C8.41425 8.75 8.75 8.41425 8.75 8C8.75 7.58575 8.41425 7.25 8 7.25ZM10.5 7.25C10.0857 7.25 9.75 7.58575 9.75 8C9.75 8.41425 10.0857 8.75 10.5 8.75C10.9143 8.75 11.25 8.41425 11.25 8C11.25 7.58575 10.9143 7.25 10.5 7.25Z", fill: "currentColor" }));
2152
- const SessionListItem = ({
2153
- children,
2154
- session,
2155
- deletable = true,
2156
- limit = 100,
2157
- deleteIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgTrash, {}),
2158
- chatIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgChat, { className: "mr-2" })
2159
- }) => {
2160
- const { activeSessionId, selectSession, deleteSession, theme } = React.useContext(ChatContext);
2161
- const Comp = children ? reactSlot.Slot : reablocks.ListItem;
2162
- return /* @__PURE__ */ jsxRuntime.jsx(
2163
- Comp,
2164
- {
2165
- dense: true,
2166
- disableGutters: true,
2167
- active: session.id === activeSessionId,
2168
- className: reablocks.cn(theme.sessions.session.base, {
2169
- [theme.sessions.session.active]: session.id === activeSessionId
2170
- }),
2171
- onClick: () => selectSession == null ? void 0 : selectSession(session.id),
2172
- start: chatIcon,
2173
- end: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: deletable && /* @__PURE__ */ jsxRuntime.jsx(
2174
- reablocks.IconButton,
2060
+ ),
2061
+ /* @__PURE__ */ jsxRuntime.jsx(
2062
+ MessageResponse,
2175
2063
  {
2176
- size: "small",
2177
- variant: "text",
2178
- onClick: (e) => {
2179
- e.stopPropagation();
2180
- deleteSession(session.id);
2181
- },
2182
- className: reablocks.cn(theme.sessions.session.delete),
2183
- children: deleteIcon
2064
+ response: conversation.response,
2065
+ isLoading: isLast && isLoading
2184
2066
  }
2185
- ) }),
2186
- children: children || /* @__PURE__ */ jsxRuntime.jsx(reablocks.Ellipsis, { value: session.title, limit })
2187
- }
2188
- );
2067
+ ),
2068
+ /* @__PURE__ */ jsxRuntime.jsx(MessageSources, { sources: conversation.sources }),
2069
+ /* @__PURE__ */ jsxRuntime.jsx(
2070
+ MessageActions,
2071
+ {
2072
+ question: conversation.question,
2073
+ response: conversation.response
2074
+ }
2075
+ )
2076
+ ] }) }),
2077
+ !isLast && /* @__PURE__ */ jsxRuntime.jsx(reablocks.Divider, {})
2078
+ ] }, conversation.id);
2189
2079
  };
2190
- const SessionsList = ({
2080
+ const SvgBack = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 50 50", width: "24px", height: "24px", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M 34.980469 3.992188 C 34.71875 3.996094 34.472656 4.105469 34.292969 4.292969 L 14.292969 24.292969 C 13.902344 24.683594 13.902344 25.316406 14.292969 25.707031 L 34.292969 45.707031 C 34.542969 45.96875 34.917969 46.074219 35.265625 45.980469 C 35.617188 45.890625 35.890625 45.617188 35.980469 45.265625 C 36.074219 44.917969 35.96875 44.542969 35.707031 44.292969 L 16.414063 25 L 35.707031 5.707031 C 36.003906 5.417969 36.089844 4.980469 35.929688 4.601563 C 35.769531 4.21875 35.394531 3.976563 34.980469 3.992188 Z", fill: "currentColor" }));
2081
+ const SessionMessagePanel = ({
2191
2082
  children,
2192
- templates
2083
+ allowBack = true
2193
2084
  }) => {
2194
- const { theme, isCompact, activeSessionId, createSession } = React.useContext(ChatContext);
2195
- const isVisible = isCompact && !activeSessionId;
2196
- return (!isCompact || isVisible) && /* @__PURE__ */ jsxRuntime.jsxs(
2085
+ const { activeSessionId, theme, isCompact, selectSession, viewType } = React.useContext(ChatContext);
2086
+ const isVisible = isCompact && activeSessionId || viewType === "chat" || !isCompact;
2087
+ return isVisible && /* @__PURE__ */ jsxRuntime.jsx(
2197
2088
  react.motion.div,
2198
2089
  {
2199
- initial: { translateX: "-100%" },
2090
+ initial: { translateX: "200%" },
2200
2091
  animate: {
2201
2092
  translateX: "0%",
2202
2093
  transition: {
@@ -2206,29 +2097,133 @@ ${response}`),
2206
2097
  when: "beforeChildren"
2207
2098
  }
2208
2099
  },
2209
- exit: { translateX: "-100%" },
2210
- className: reablocks.cn(theme.sessions.base, {
2211
- [theme.sessions.companion]: isCompact,
2212
- [theme.sessions.console]: !isCompact
2100
+ exit: { translateX: "200%" },
2101
+ className: reablocks.cn(theme.messages.base, {
2102
+ [theme.messages.companion]: isCompact,
2103
+ [theme.messages.console]: !isCompact
2213
2104
  }),
2105
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn(theme.messages.inner), children: [
2106
+ allowBack && isCompact && viewType !== "chat" && /* @__PURE__ */ jsxRuntime.jsxs(
2107
+ reablocks.Button,
2108
+ {
2109
+ variant: "text",
2110
+ size: "small",
2111
+ onClick: () => selectSession(null),
2112
+ className: reablocks.cn(theme.messages.back),
2113
+ children: [
2114
+ /* @__PURE__ */ jsxRuntime.jsx(SvgBack, {}),
2115
+ "Back"
2116
+ ]
2117
+ }
2118
+ ),
2119
+ children
2120
+ ] })
2121
+ }
2122
+ );
2123
+ };
2124
+ const containerVariants = {
2125
+ hidden: {},
2126
+ visible: {
2127
+ transition: {
2128
+ staggerChildren: 0.07,
2129
+ when: "beforeChildren"
2130
+ }
2131
+ }
2132
+ };
2133
+ const SessionMessages = ({
2134
+ children,
2135
+ newSessionContent,
2136
+ limit = 10,
2137
+ className,
2138
+ showMoreText = "Show more",
2139
+ autoScroll = true,
2140
+ onScroll
2141
+ }) => {
2142
+ const { activeSession, theme } = React.useContext(ChatContext);
2143
+ const contentRef = React.useRef(null);
2144
+ const [isAnimating, setIsAnimating] = React.useState(true);
2145
+ React.useEffect(() => {
2146
+ if (contentRef.current && autoScroll) {
2147
+ requestAnimationFrame(
2148
+ () => contentRef.current.scrollTop = contentRef.current.scrollHeight
2149
+ );
2150
+ }
2151
+ }, [activeSession, autoScroll, isAnimating]);
2152
+ function handleShowMore() {
2153
+ showNext(limit);
2154
+ requestAnimationFrame(() => contentRef.current.scrollTop = 0);
2155
+ }
2156
+ const reversedConvos = React.useMemo(
2157
+ () => [...activeSession?.conversations ?? []].reverse(),
2158
+ [activeSession]
2159
+ );
2160
+ const { data, hasMore, showNext } = reablocks.useInfinityList({
2161
+ items: reversedConvos,
2162
+ size: limit
2163
+ });
2164
+ const reReversedConvo = React.useMemo(() => [...data].reverse(), [data]);
2165
+ const convosToRender = limit ? reReversedConvo : activeSession?.conversations;
2166
+ if (!activeSession) {
2167
+ return /* @__PURE__ */ jsxRuntime.jsx(SessionEmpty, { children: newSessionContent });
2168
+ }
2169
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2170
+ "div",
2171
+ {
2172
+ className: reablocks.cn(theme.messages.content, className),
2173
+ ref: contentRef,
2174
+ onScroll,
2214
2175
  children: [
2215
- /* @__PURE__ */ jsxRuntime.jsx(reablocks.List, { children }),
2216
- templates && !activeSessionId && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4", children: templates.map((template) => /* @__PURE__ */ jsxRuntime.jsx("div", { onClick: () => createSession == null ? void 0 : createSession(), children: /* @__PURE__ */ jsxRuntime.jsx(
2217
- SessionListItem,
2176
+ hasMore && /* @__PURE__ */ jsxRuntime.jsx(
2177
+ reablocks.Button,
2218
2178
  {
2219
- session: {
2220
- id: template.id,
2221
- title: template.title,
2222
- conversations: []
2223
- },
2224
- chatIcon: template.icon,
2225
- deletable: false
2179
+ variant: "outline",
2180
+ className: reablocks.cn(theme.messages.showMore),
2181
+ fullWidth: true,
2182
+ onClick: handleShowMore,
2183
+ children: showMoreText
2226
2184
  }
2227
- ) }, template.id)) })
2185
+ ),
2186
+ /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: /* @__PURE__ */ jsxRuntime.jsx(
2187
+ react.motion.div,
2188
+ {
2189
+ variants: containerVariants,
2190
+ initial: "hidden",
2191
+ animate: "visible",
2192
+ onAnimationComplete: () => {
2193
+ requestAnimationFrame(() => setIsAnimating(false));
2194
+ },
2195
+ children: children ? children(convosToRender) : convosToRender.map((conversation, index) => /* @__PURE__ */ jsxRuntime.jsx(
2196
+ SessionMessage,
2197
+ {
2198
+ conversation,
2199
+ isLast: index === conversation.length - 1
2200
+ },
2201
+ conversation.id
2202
+ ))
2203
+ },
2204
+ activeSession?.id
2205
+ ) })
2228
2206
  ]
2229
2207
  }
2230
2208
  );
2231
2209
  };
2210
+ const SessionMessagesHeader = ({ children }) => {
2211
+ const { activeSession, theme } = React.useContext(ChatContext);
2212
+ const Comp = children ? reactSlot.Slot : "header";
2213
+ if (!activeSession) {
2214
+ return null;
2215
+ }
2216
+ return /* @__PURE__ */ jsxRuntime.jsx(Comp, { className: reablocks.cn(theme.messages.header), children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2217
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: reablocks.cn(theme.messages.title), children: /* @__PURE__ */ jsxRuntime.jsx(reablocks.Ellipsis, { limit: 125, value: activeSession.title }) }),
2218
+ /* @__PURE__ */ jsxRuntime.jsx(
2219
+ reablocks.DateFormat,
2220
+ {
2221
+ className: reablocks.cn(theme.messages.date),
2222
+ date: activeSession.createdAt
2223
+ }
2224
+ )
2225
+ ] }) });
2226
+ };
2232
2227
  const SvgPlus = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: 17, height: 17, viewBox: "0 0 17 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("g", { id: "add" }, /* @__PURE__ */ React__namespace.createElement("path", { id: "Vector", d: "M13.1667 9.16658H9.16671V13.1666H7.83337V9.16658H3.83337V7.83325H7.83337V3.83325H9.16671V7.83325H13.1667V9.16658Z", fill: "currentColor" })));
2233
2228
  const NewSessionButton = ({
2234
2229
  children,
@@ -2313,6 +2308,46 @@ ${response}`),
2313
2308
  )
2314
2309
  }));
2315
2310
  }
2311
+ const SvgChat = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: 16, height: 17, viewBox: "0 0 16 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M8 3C4.55375 3 1.75 5.23753 1.75 7.98828C1.75 9.70653 2.83659 11.2762 4.62109 12.188C4.11184 13.0465 3.62587 13.7378 3.62012 13.7461C3.50687 13.9071 3.49862 14.1196 3.59912 14.2891C3.69012 14.4418 3.8543 14.5342 4.0293 14.5342C4.0483 14.5342 4.06743 14.533 4.08643 14.5308C4.15168 14.5233 5.66214 14.3364 7.50439 12.9604C7.67239 12.9712 7.8385 12.9766 8 12.9766C11.4462 12.9766 14.25 10.739 14.25 7.98828C14.25 5.23753 11.4462 3 8 3ZM8 4C10.8948 4 13.25 5.78903 13.25 7.98828C13.25 10.1875 10.8948 11.9766 8 11.9766C7.8055 11.9766 7.60225 11.968 7.396 11.9497C7.271 11.9382 7.1454 11.9752 7.0459 12.0527C6.3589 12.5855 5.72033 12.9308 5.20508 13.1528C5.38383 12.8648 5.57691 12.5418 5.76416 12.2061C5.83416 12.0813 5.84705 11.9324 5.7998 11.7974C5.75255 11.6624 5.64983 11.5542 5.51758 11.5C3.81033 10.7993 2.75 9.45328 2.75 7.98828C2.75 5.78903 5.10525 4 8 4ZM5.5 7.25C5.08575 7.25 4.75 7.58575 4.75 8C4.75 8.41425 5.08575 8.75 5.5 8.75C5.91425 8.75 6.25 8.41425 6.25 8C6.25 7.58575 5.91425 7.25 5.5 7.25ZM8 7.25C7.58575 7.25 7.25 7.58575 7.25 8C7.25 8.41425 7.58575 8.75 8 8.75C8.41425 8.75 8.75 8.41425 8.75 8C8.75 7.58575 8.41425 7.25 8 7.25ZM10.5 7.25C10.0857 7.25 9.75 7.58575 9.75 8C9.75 8.41425 10.0857 8.75 10.5 8.75C10.9143 8.75 11.25 8.41425 11.25 8C11.25 7.58575 10.9143 7.25 10.5 7.25Z", fill: "currentColor" }));
2312
+ const SvgTrash = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: 14, height: 14, viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("g", { id: "Delete" }, /* @__PURE__ */ React__namespace.createElement("path", { id: "Vector", d: "M5.97905 1.16666C5.90859 1.16576 5.83895 1.18189 5.77605 1.21368C5.71316 1.24547 5.65888 1.29199 5.61783 1.34926C5.57677 1.40654 5.55016 1.47288 5.54025 1.54265C5.53034 1.61242 5.53743 1.68355 5.56092 1.75H4.27007C3.7342 1.75 3.2324 2.01817 2.93535 2.46435L2.24492 3.5H2.18738C2.12941 3.49918 2.07185 3.50989 2.01805 3.5315C1.96425 3.55312 1.91529 3.58522 1.874 3.62593C1.83271 3.66663 1.79993 3.71514 1.77755 3.76863C1.75518 3.82211 1.74365 3.87952 1.74365 3.9375C1.74365 3.99548 1.75518 4.05288 1.77755 4.10636C1.79993 4.15985 1.83271 4.20836 1.874 4.24907C1.91529 4.28977 1.96425 4.32187 2.01805 4.34349C2.07185 4.3651 2.12941 4.37582 2.18738 4.375H2.41012C2.44765 4.38067 2.48576 4.38143 2.52348 4.37727L3.24468 11.1084C3.33169 11.9199 4.02367 12.5417 4.83973 12.5417H9.15947C9.97553 12.5417 10.6675 11.9199 10.7545 11.1084L11.4763 4.37727C11.5133 4.38124 11.5506 4.38047 11.5874 4.375H11.8124C11.8704 4.37582 11.9279 4.3651 11.9817 4.34349C12.0355 4.32187 12.0845 4.28977 12.1258 4.24907C12.1671 4.20836 12.1998 4.15985 12.2222 4.10636C12.2446 4.05288 12.2561 3.99548 12.2561 3.9375C12.2561 3.87952 12.2446 3.82211 12.2222 3.76863C12.1998 3.71514 12.1671 3.66663 12.1258 3.62593C12.0845 3.58522 12.0355 3.55312 11.9817 3.5315C11.9279 3.50989 11.8704 3.49918 11.8124 3.5H11.7548L11.0644 2.46435C10.7671 2.01841 10.2654 1.75 9.7297 1.75H8.43885C8.46234 1.68355 8.46943 1.61242 8.45952 1.54265C8.44961 1.47288 8.423 1.40654 8.38194 1.34926C8.34089 1.29199 8.2866 1.24547 8.22371 1.21368C8.16082 1.18189 8.09118 1.16576 8.02072 1.16666H5.97905ZM4.27007 2.625H9.7297C9.97394 2.625 10.2009 2.74639 10.3364 2.9497L10.7033 3.5H3.29651L3.66338 2.9497L3.66395 2.94913C3.79913 2.74608 4.02543 2.625 4.27007 2.625ZM3.40361 4.375H10.5962L9.88465 11.015C9.8445 11.3894 9.53575 11.6667 9.15947 11.6667H4.83973C4.46345 11.6667 4.15527 11.3894 4.11512 11.015L3.40361 4.375Z", fill: "currentColor" })));
2313
+ const SessionListItem = ({
2314
+ children,
2315
+ session,
2316
+ deletable = true,
2317
+ limit = 100,
2318
+ deleteIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgTrash, {}),
2319
+ chatIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgChat, { className: "mr-2" })
2320
+ }) => {
2321
+ const { activeSessionId, selectSession, deleteSession, theme } = React.useContext(ChatContext);
2322
+ const Comp = children ? reactSlot.Slot : reablocks.ListItem;
2323
+ return /* @__PURE__ */ jsxRuntime.jsx(
2324
+ Comp,
2325
+ {
2326
+ dense: true,
2327
+ disableGutters: true,
2328
+ active: session.id === activeSessionId,
2329
+ className: reablocks.cn(theme.sessions.session.base, {
2330
+ [theme.sessions.session.active]: session.id === activeSessionId
2331
+ }),
2332
+ onClick: () => selectSession?.(session.id),
2333
+ start: chatIcon,
2334
+ end: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: deletable && /* @__PURE__ */ jsxRuntime.jsx(
2335
+ reablocks.IconButton,
2336
+ {
2337
+ size: "small",
2338
+ variant: "ghost",
2339
+ onClick: (e) => {
2340
+ e.stopPropagation();
2341
+ deleteSession(session.id);
2342
+ },
2343
+ className: reablocks.cn(theme.sessions.session.delete),
2344
+ children: deleteIcon
2345
+ }
2346
+ ) }),
2347
+ children: children || /* @__PURE__ */ jsxRuntime.jsx(reablocks.Ellipsis, { value: session.title, limit })
2348
+ }
2349
+ );
2350
+ };
2316
2351
  const SessionsGroup = ({
2317
2352
  heading,
2318
2353
  children
@@ -2334,46 +2369,50 @@ ${response}`),
2334
2369
  const SessionGroups = ({ children }) => {
2335
2370
  const { sessions } = React.useContext(ChatContext);
2336
2371
  const groups = React.useMemo(() => groupSessionsByDate(sessions), [sessions]);
2337
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: children ? children(groups) : groups.map(({ heading, sessions: sessions2 }) => /* @__PURE__ */ jsxRuntime.jsx(SessionsGroup, { heading, children: sessions2.map((session) => /* @__PURE__ */ jsxRuntime.jsx(SessionListItem, { session }, session.id)) })) });
2338
- };
2339
- const AppBar = ({ content, theme = chatTheme }) => {
2340
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: reablocks.cn(theme.appbar), children: content });
2372
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: children ? children(groups) : groups.map(({ heading, sessions: sessions2 }) => /* @__PURE__ */ jsxRuntime.jsx(SessionsGroup, { heading, children: sessions2.map((session) => /* @__PURE__ */ jsxRuntime.jsx(SessionListItem, { session }, session.id)) }, heading)) });
2341
2373
  };
2342
- const ChatBubble = React.memo(
2343
- ({
2344
- children,
2345
- bubbleContent,
2346
- position = "right-end",
2347
- modifiers = [react$1.offset({ mainAxis: 0, crossAxis: -40 })],
2348
- className
2349
- }) => {
2350
- const [isOpen, setIsOpen] = React.useState(false);
2351
- const ref = React.useRef(null);
2352
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2353
- /* @__PURE__ */ jsxRuntime.jsx(
2354
- reablocks.ConnectedOverlay,
2355
- {
2356
- placement: position,
2357
- modifiers,
2358
- reference: ref.current,
2359
- open: isOpen,
2360
- onOpen: () => setIsOpen(true),
2361
- onClose: () => setIsOpen(false),
2362
- content: () => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children })
2363
- }
2364
- ),
2365
- /* @__PURE__ */ jsxRuntime.jsx(
2366
- "div",
2367
- {
2368
- ref,
2369
- className,
2370
- onClick: () => setIsOpen((prev) => !prev),
2371
- children: bubbleContent
2374
+ const SessionsList = ({
2375
+ children,
2376
+ templates
2377
+ }) => {
2378
+ const { theme, isCompact, activeSessionId, createSession } = React.useContext(ChatContext);
2379
+ const isVisible = isCompact && !activeSessionId;
2380
+ return (!isCompact || isVisible) && /* @__PURE__ */ jsxRuntime.jsxs(
2381
+ react.motion.div,
2382
+ {
2383
+ initial: { translateX: "-100%" },
2384
+ animate: {
2385
+ translateX: "0%",
2386
+ transition: {
2387
+ type: "tween",
2388
+ ease: "linear",
2389
+ duration: 0.2,
2390
+ when: "beforeChildren"
2372
2391
  }
2373
- )
2374
- ] });
2375
- }
2376
- );
2392
+ },
2393
+ exit: { translateX: "-100%" },
2394
+ className: reablocks.cn(theme.sessions.base, {
2395
+ [theme.sessions.companion]: isCompact,
2396
+ [theme.sessions.console]: !isCompact
2397
+ }),
2398
+ children: [
2399
+ /* @__PURE__ */ jsxRuntime.jsx(reablocks.List, { children }),
2400
+ templates && !activeSessionId && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4", children: templates.map((template) => /* @__PURE__ */ jsxRuntime.jsx("div", { onClick: () => createSession?.(), children: /* @__PURE__ */ jsxRuntime.jsx(
2401
+ SessionListItem,
2402
+ {
2403
+ session: {
2404
+ id: template.id,
2405
+ title: template.title,
2406
+ conversations: []
2407
+ },
2408
+ chatIcon: template.icon,
2409
+ deletable: false
2410
+ }
2411
+ ) }, template.id)) })
2412
+ ]
2413
+ }
2414
+ );
2415
+ };
2377
2416
  exports2.AppBar = AppBar;
2378
2417
  exports2.Chat = Chat;
2379
2418
  exports2.ChatBubble = ChatBubble;
@@ -2404,8 +2443,9 @@ ${response}`),
2404
2443
  exports2.TableHeaderCell = TableHeaderCell;
2405
2444
  exports2.chatTheme = chatTheme;
2406
2445
  exports2.dark = dark;
2446
+ exports2.groupSessionsByDate = groupSessionsByDate;
2407
2447
  exports2.light = light;
2408
2448
  exports2.remarkCve = remarkCve;
2409
2449
  Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
2410
- });
2450
+ }));
2411
2451
  //# sourceMappingURL=index.umd.cjs.map