reachat 2.1.0-alpha.3 → 2.1.0-alpha.5

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 (50) hide show
  1. package/dist/AppBar/AppBar.d.ts +1 -1
  2. package/dist/{CSVFileRenderer-CpB8ngRc.js → CSVFileRenderer-Bh5dmsTS.js} +15 -14
  3. package/dist/CSVFileRenderer-Bh5dmsTS.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 +4 -0
  8. package/dist/ChatInput/FileInput.d.ts +1 -1
  9. package/dist/{DefaultFileRenderer-DEgyNAd4.js → DefaultFileRenderer-CeV73ofi.js} +2 -2
  10. package/dist/DefaultFileRenderer-CeV73ofi.js.map +1 -0
  11. package/dist/ImageFileRenderer-C8tVW3I8.js.map +1 -1
  12. package/dist/Markdown/Table.d.ts +1 -1
  13. package/dist/Markdown/index.d.ts +2 -2
  14. package/dist/Markdown/plugins/remarkCve.d.ts +1 -1
  15. package/dist/PDFFileRenderer-BBn2EVrV.js +16 -0
  16. package/dist/PDFFileRenderer-BBn2EVrV.js.map +1 -0
  17. package/dist/SessionMessages/SessionEmpty.d.ts +1 -4
  18. package/dist/SessionMessages/SessionMessage/MessageFile/renderers/index.d.ts +1 -1
  19. package/dist/SessionMessages/SessionMessage/MessageFiles.d.ts +1 -1
  20. package/dist/SessionMessages/SessionMessage/MessageSources.d.ts +1 -1
  21. package/dist/SessionMessages/SessionMessage/index.d.ts +2 -2
  22. package/dist/SessionMessages/SessionMessages.d.ts +5 -1
  23. package/dist/SessionMessages/index.d.ts +2 -2
  24. package/dist/SessionsList/index.d.ts +2 -2
  25. package/dist/docs.json +41 -20
  26. package/dist/{index-DVFyp_Cz.js → index-nY4fLD9h.js} +1121 -1135
  27. package/dist/index-nY4fLD9h.js.map +1 -0
  28. package/dist/index.css +6296 -738
  29. package/dist/index.d.ts +6 -6
  30. package/dist/index.js +31 -31
  31. package/dist/index.umd.cjs +1101 -1107
  32. package/dist/index.umd.cjs.map +1 -1
  33. package/dist/stories/Changelog.mdx +1 -1
  34. package/dist/stories/Chat.stories.tsx +5 -5
  35. package/dist/stories/ChatBubble.stories.tsx +3 -3
  36. package/dist/stories/Companion.stories.tsx +6 -6
  37. package/dist/stories/Console.stories.tsx +22 -22
  38. package/dist/stories/Integration.stories.tsx +2 -2
  39. package/dist/stories/Intro.mdx +1 -1
  40. package/dist/stories/assets/logo.svg +38 -19
  41. package/dist/stories/assets/paperclip.svg +4 -1
  42. package/dist/stories/assets/search.svg +5 -1
  43. package/dist/stories/examples.ts +20 -13
  44. package/dist/theme.d.ts +13 -0
  45. package/package.json +62 -46
  46. package/dist/CSVFileRenderer-CpB8ngRc.js.map +0 -1
  47. package/dist/DefaultFileRenderer-DEgyNAd4.js.map +0 -1
  48. package/dist/PDFFileRenderer-DQdFS2l6.js +0 -9
  49. package/dist/PDFFileRenderer-DQdFS2l6.js.map +0 -1
  50. package/dist/index-DVFyp_Cz.js.map +0 -1
@@ -1,26 +1,289 @@
1
- import { jsxs, Fragment, jsx } from "react/jsx-runtime";
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { cn, ConnectedOverlay, Button, Textarea, IconButton, Ellipsis, Card, Divider, useInfinityList, DateFormat, ListItem, List } from "reablocks";
3
+ import { AnimatePresence, motion } from "motion/react";
2
4
  import * as React from "react";
3
- import { createContext, useContext, useRef, forwardRef, useState, useEffect, useImperativeHandle, useCallback, lazy, useMemo, Suspense, memo } from "react";
4
- import { Button, cn, Textarea, Ellipsis, DateFormat, IconButton, Card, Divider, useInfinityList, ListItem, List, ConnectedOverlay } from "reablocks";
5
- import { Slot } from "@radix-ui/react-slot";
6
- import { motion, AnimatePresence } from "motion/react";
7
- import ReactMarkdown from "react-markdown";
8
- import { Prism } from "react-syntax-highlighter";
9
- import rehypeKatex from "rehype-katex";
10
- import { findAndReplace } from "mdast-util-find-and-replace";
5
+ import { createContext, useState, useCallback, useEffect, useMemo, memo, useRef, useContext, forwardRef, useImperativeHandle, lazy, Suspense } from "react";
11
6
  import { useHotkeys } from "reakeys";
12
7
  import remarkGfm from "remark-gfm";
13
- import remarkYoutube from "remark-youtube";
14
8
  import remarkMath from "remark-math";
15
- import { isToday, isYesterday, isThisWeek, differenceInYears, format } from "date-fns";
9
+ import remarkYoutube from "remark-youtube";
16
10
  import { offset } from "@floating-ui/react";
17
- const SvgSend = (props) => /* @__PURE__ */ React.createElement("svg", { width: 17, height: 17, viewBox: "0 0 17 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React.createElement("g", { id: "send" }, /* @__PURE__ */ React.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" })));
18
- const SvgStop = (props) => /* @__PURE__ */ React.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.createElement("path", { d: "m15 9-6 6" }), /* @__PURE__ */ React.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.createElement("path", { d: "m9 9 6 6" }));
11
+ import { Prism } from "react-syntax-highlighter";
12
+ import ReactMarkdown from "react-markdown";
13
+ import rehypeKatex from "rehype-katex";
14
+ import { findAndReplace } from "mdast-util-find-and-replace";
15
+ import { Slot } from "@radix-ui/react-slot";
16
+ import { isToday, isYesterday, isThisWeek, differenceInYears, format } from "date-fns";
17
+ const chatTheme = {
18
+ base: "text-content-text-neutral-base",
19
+ console: "flex w-full gap-4 h-full",
20
+ companion: "w-full h-full overflow-hidden",
21
+ empty: "text-center flex-1",
22
+ appbar: "flex p-5",
23
+ sessions: {
24
+ base: "overflow-auto",
25
+ console: "min-w-[150px] w-[30%] max-w-[300px] bg-gradient-neutral-200 p-5 rounded-3xl",
26
+ companion: "w-full h-full",
27
+ group: "text-xs text-content-text-neutral-3 mt-4 hover:bg-transparent mb-1",
28
+ create: "relative mb-4 rounded-[10px] text-white",
29
+ session: {
30
+ base: "group my-1 rounded-[10px] p-2 text-content-text-neutral-1 border border-transparent",
31
+ active: "border-select-menu-items-color-item-stroke-row-hover [&_button]:opacity-100!",
32
+ delete: "[&>svg]:w-4 [&>svg]:h-4 opacity-0 group-hover:opacity-50!"
33
+ }
34
+ },
35
+ messages: {
36
+ base: "",
37
+ console: "flex flex-col mx-5 flex-1 overflow-hidden",
38
+ companion: "flex w-full h-full",
39
+ back: "self-start pl-0 my-2 ",
40
+ inner: "flex-1 h-full flex flex-col",
41
+ title: "text-base font-bold",
42
+ date: "text-xs whitespace-nowrap text-content-text-neutral-2",
43
+ content: "mt-2 flex-1 overflow-auto",
44
+ header: "flex justify-between items-center gap-2",
45
+ showMore: "mb-4",
46
+ message: {
47
+ base: "mt-4 mb-4 flex flex-col p-0 rounded-sm border-none bg-transparent",
48
+ 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)",
49
+ response: "relative data-[compact=false]:px-4 text-content-text-neutral-base",
50
+ 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",
51
+ cursor: "inline-block w-1 h-4 bg-current",
52
+ expand: "absolute bottom-0 right-1 z-10",
53
+ files: {
54
+ base: "mb-2 flex flex-wrap gap-3 ",
55
+ file: {
56
+ base: "flex items-center gap-2 border border-stroke-neutral-4 px-3 py-2 rounded-lg cursor-pointer",
57
+ name: "text-sm text-content-text-neutral-4"
58
+ }
59
+ },
60
+ sources: {
61
+ base: "my-4 flex flex-wrap gap-3",
62
+ source: {
63
+ base: "flex gap-2 border border-stroke-neutral-4 px-4 py-2 rounded-lg cursor-pointer",
64
+ companion: "flex-1 px-3 py-1.5",
65
+ image: "max-w-10 max-h-10 rounded-md w-full h-fit self-center",
66
+ title: "text-md block",
67
+ url: "text-sm text-buttons-colors-link-primary-text-resting underline"
68
+ }
69
+ },
70
+ markdown: {
71
+ copy: "sticky py-1 [&>svg]:w-4 [&>svg]:h-4 opacity-50",
72
+ p: "mb-2",
73
+ a: "text-buttons-colors-link-primary-text-resting underline",
74
+ table: "table-auto w-full m-2",
75
+ th: "px-4 py-2 text-left font-bold border-b border-stroke-neutral-4",
76
+ td: "px-4 py-2",
77
+ code: "m-2 rounded-b relative",
78
+ 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",
79
+ li: "mb-2 ml-6",
80
+ ul: "mb-4 list-disc",
81
+ ol: "mb-4 list-decimal"
82
+ },
83
+ csvPreview: {
84
+ base: "flex flex-col gap-2",
85
+ header: {
86
+ base: "flex justify-between items-center gap-4",
87
+ icon: "csv-icon flex items-center",
88
+ actions: "csv-actions flex items-center gap-6"
89
+ },
90
+ tableContainer: "flex justify-between",
91
+ dialog: {
92
+ base: "fixed inset-0 bg-background-neutral-canvas-base/70 flex justify-center items-center z-50",
93
+ container: "bg-background-neutral-canvas-base rounded-md w-11/12 h-5/6 overflow-auto"
94
+ }
95
+ },
96
+ footer: {
97
+ base: "mt-3 flex gap-1.5",
98
+ copy: "p-3 rounded-[10px] [&>svg]:size-4 opacity-50 hover:opacity-100!",
99
+ upvote: "p-3 rounded-[10px] [&>svg]:size-4 opacity-50 hover:opacity-100!",
100
+ downvote: "p-3 rounded-[10px] [&>svg]:size-4 opacity-50 hover:opacity-100!",
101
+ refresh: "p-3 rounded-[10px] [&>svg]:size-4 opacity-50 hover:opacity-100!"
102
+ }
103
+ }
104
+ },
105
+ input: {
106
+ base: "flex mt-4 relative",
107
+ upload: "px-5 py-2 size-10 text-content-text-neutral-2 hover:text-content-text-neutral-base",
108
+ 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",
109
+ actions: {
110
+ base: "absolute flex gap-2 items-center right-2 inset-y-1/2 -translate-y-1/2 z-10",
111
+ send: "px-3 py-3 hover:bg-primary-hover rounded-full size-8",
112
+ stop: "px-2 py-2 bg-content-assets-semantic-error-base text-white rounded-full hover:bg-content-assets-semantic-error-1 size-8"
113
+ }
114
+ }
115
+ };
116
+ const AppBar = ({ content, theme = chatTheme }) => {
117
+ return /* @__PURE__ */ jsx("div", { className: cn(theme.appbar), children: content });
118
+ };
19
119
  const ChatContext = createContext({
20
120
  sessions: [],
21
121
  activeSessionId: null
22
122
  });
23
- const SvgPaperclip = (props) => /* @__PURE__ */ React.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.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" }));
123
+ const useDimensions = () => {
124
+ const [ref, setRef] = useState(null);
125
+ const [width, setWidth] = useState(void 0);
126
+ const observe = useCallback((element) => {
127
+ if (element) setRef(element);
128
+ }, []);
129
+ useEffect(() => {
130
+ if (!ref) return;
131
+ const resizeObserver = new ResizeObserver((entries) => {
132
+ for (const entry of entries) {
133
+ setWidth(entry.contentRect.width);
134
+ }
135
+ });
136
+ resizeObserver.observe(ref);
137
+ return () => {
138
+ resizeObserver.disconnect();
139
+ };
140
+ }, [ref]);
141
+ return { width, observe };
142
+ };
143
+ const Chat = ({
144
+ children,
145
+ viewType = "console",
146
+ sessions,
147
+ onSelectSession,
148
+ onDeleteSession,
149
+ onSendMessage,
150
+ onStopMessage,
151
+ onFileUpload,
152
+ isLoading,
153
+ activeSessionId,
154
+ theme = chatTheme,
155
+ onNewSession,
156
+ remarkPlugins = [remarkGfm, remarkYoutube, remarkMath],
157
+ disabled,
158
+ style,
159
+ className
160
+ }) => {
161
+ const [internalActiveSessionID, setInternalActiveSessionID] = useState(activeSessionId);
162
+ const { width, observe } = useDimensions();
163
+ const isCompact = viewType === "companion" || width && width < 767;
164
+ useEffect(() => {
165
+ setInternalActiveSessionID(activeSessionId);
166
+ }, [activeSessionId]);
167
+ const handleSelectSession = useCallback(
168
+ (sessionId) => {
169
+ setInternalActiveSessionID(sessionId);
170
+ onSelectSession?.(sessionId);
171
+ },
172
+ [onSelectSession]
173
+ );
174
+ const handleDeleteSession = useCallback(
175
+ (sessionId) => {
176
+ setInternalActiveSessionID(void 0);
177
+ onDeleteSession?.(sessionId);
178
+ },
179
+ [onDeleteSession]
180
+ );
181
+ const handleCreateNewSession = useCallback(() => {
182
+ setInternalActiveSessionID(void 0);
183
+ onNewSession?.();
184
+ }, [onNewSession]);
185
+ useHotkeys([
186
+ {
187
+ name: "Create new session",
188
+ category: "Chat",
189
+ keys: "meta+shift+s",
190
+ callback: (event) => {
191
+ event.preventDefault();
192
+ handleCreateNewSession();
193
+ }
194
+ }
195
+ ]);
196
+ const activeSession = useMemo(
197
+ () => sessions.find((session) => session.id === internalActiveSessionID),
198
+ [sessions, internalActiveSessionID]
199
+ );
200
+ const contextValue = useMemo(
201
+ () => ({
202
+ sessions,
203
+ activeSession,
204
+ remarkPlugins,
205
+ theme,
206
+ disabled,
207
+ isLoading,
208
+ isCompact,
209
+ viewType,
210
+ activeSessionId: internalActiveSessionID,
211
+ selectSession: handleSelectSession,
212
+ deleteSession: handleDeleteSession,
213
+ createSession: handleCreateNewSession,
214
+ sendMessage: onSendMessage,
215
+ stopMessage: onStopMessage,
216
+ fileUpload: onFileUpload
217
+ }),
218
+ [
219
+ isLoading,
220
+ isCompact,
221
+ viewType,
222
+ disabled,
223
+ theme,
224
+ remarkPlugins,
225
+ sessions,
226
+ activeSession,
227
+ internalActiveSessionID,
228
+ handleSelectSession,
229
+ handleDeleteSession,
230
+ handleCreateNewSession,
231
+ onSendMessage,
232
+ onStopMessage,
233
+ onFileUpload
234
+ ]
235
+ );
236
+ return /* @__PURE__ */ jsx(ChatContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: /* @__PURE__ */ jsx(
237
+ "div",
238
+ {
239
+ ref: observe,
240
+ className: cn(className, theme.base, {
241
+ [theme.companion]: isCompact,
242
+ [theme.console]: !isCompact
243
+ }),
244
+ style,
245
+ children
246
+ }
247
+ ) }) });
248
+ };
249
+ const ChatBubble = memo(
250
+ ({
251
+ children,
252
+ bubbleContent,
253
+ position = "right-end",
254
+ modifiers = [offset({ mainAxis: 0, crossAxis: -40 })],
255
+ className
256
+ }) => {
257
+ const [isOpen, setIsOpen] = useState(false);
258
+ const ref = useRef(null);
259
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
260
+ /* @__PURE__ */ jsx(
261
+ ConnectedOverlay,
262
+ {
263
+ placement: position,
264
+ modifiers,
265
+ reference: ref.current,
266
+ open: isOpen,
267
+ onOpen: () => setIsOpen(true),
268
+ onClose: () => setIsOpen(false),
269
+ content: () => /* @__PURE__ */ jsx(Fragment, { children })
270
+ }
271
+ ),
272
+ /* @__PURE__ */ jsx(
273
+ "div",
274
+ {
275
+ ref,
276
+ className,
277
+ onClick: () => setIsOpen((prev) => !prev),
278
+ children: bubbleContent
279
+ }
280
+ )
281
+ ] });
282
+ }
283
+ );
284
+ const SvgSend = (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", ...props }, /* @__PURE__ */ React.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" }));
285
+ const SvgStop = (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 50 50", width: "24px", height: "24px", ...props }, /* @__PURE__ */ React.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" }));
286
+ const SvgPaperclip = (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 64 64", width: "24px", height: "24px", ...props }, /* @__PURE__ */ React.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" }));
24
287
  const FileInput = ({
25
288
  allowedFiles,
26
289
  onFileUpload,
@@ -53,10 +316,7 @@ const FileInput = ({
53
316
  variant: "text",
54
317
  disabled: isLoading || disabled,
55
318
  className: cn(theme.input.upload),
56
- onClick: () => {
57
- var _a;
58
- return (_a = fileInputRef.current) == null ? void 0 : _a.click();
59
- },
319
+ onClick: () => fileInputRef.current?.click(),
60
320
  children: attachIcon
61
321
  }
62
322
  )
@@ -92,24 +352,24 @@ const ChatInput = forwardRef(
92
352
  inputRef.current.focus();
93
353
  }
94
354
  }, [activeSessionId, inputRef]);
355
+ const handleSendMessage = () => {
356
+ if (internalMessage.trim()) {
357
+ sendMessage?.(internalMessage);
358
+ setInternalMessage("");
359
+ }
360
+ };
95
361
  useImperativeHandle(ref, () => ({
96
362
  focus: () => {
97
- var _a;
98
- (_a = inputRef.current) == null ? void 0 : _a.focus();
363
+ inputRef.current?.focus();
99
364
  },
100
365
  send: () => {
101
- if (internalMessage.trim()) {
102
- sendMessage == null ? void 0 : sendMessage(internalMessage);
103
- setInternalMessage("");
104
- }
366
+ handleSendMessage();
367
+ },
368
+ setValue: (value) => {
369
+ setInternalMessage(value);
370
+ onMessageChange?.(value);
105
371
  }
106
372
  }));
107
- const handleSendMessage = () => {
108
- if (internalMessage.trim()) {
109
- sendMessage == null ? void 0 : sendMessage(internalMessage);
110
- setInternalMessage("");
111
- }
112
- };
113
373
  const handleKeyPress = (e) => {
114
374
  if (e.key === "Enter" && !e.shiftKey) {
115
375
  e.preventDefault();
@@ -117,8 +377,7 @@ const ChatInput = forwardRef(
117
377
  }
118
378
  };
119
379
  const handleFileUpload = (event) => {
120
- var _a;
121
- const file = (_a = event.target.files) == null ? void 0 : _a[0];
380
+ const file = event.target.files?.[0];
122
381
  if (file && fileUpload) {
123
382
  fileUpload(file);
124
383
  }
@@ -126,7 +385,7 @@ const ChatInput = forwardRef(
126
385
  const handleMessageChange = useCallback(
127
386
  (event) => {
128
387
  setInternalMessage(event.target.value);
129
- onMessageChange == null ? void 0 : onMessageChange(event.target.value);
388
+ onMessageChange?.(event.target.value);
130
389
  },
131
390
  [onMessageChange]
132
391
  );
@@ -147,7 +406,7 @@ const ChatInput = forwardRef(
147
406
  }
148
407
  ),
149
408
  /* @__PURE__ */ jsxs("div", { className: cn(theme.input.actions.base), children: [
150
- (allowedFiles == null ? void 0 : allowedFiles.length) > 0 && /* @__PURE__ */ jsx(
409
+ allowedFiles?.length > 0 && /* @__PURE__ */ jsx(
151
410
  FileInput,
152
411
  {
153
412
  allowedFiles,
@@ -181,1071 +440,1004 @@ const ChatInput = forwardRef(
181
440
  ] });
182
441
  }
183
442
  );
184
- const SessionEmpty = ({
185
- children
186
- }) => {
187
- const { theme } = useContext(ChatContext);
188
- return /* @__PURE__ */ jsx("div", { className: cn(theme.empty), children });
189
- };
190
- const SessionMessagesHeader = ({ children }) => {
191
- const { activeSession, theme } = useContext(ChatContext);
192
- const Comp = children ? Slot : "header";
193
- if (!activeSession) {
194
- return null;
195
- }
196
- return /* @__PURE__ */ jsx(Comp, { className: cn(theme.messages.header), children: children || /* @__PURE__ */ jsxs(Fragment, { children: [
197
- /* @__PURE__ */ jsx("h2", { className: cn(theme.messages.title), children: /* @__PURE__ */ jsx(Ellipsis, { limit: 125, value: activeSession.title }) }),
198
- /* @__PURE__ */ jsx(
199
- DateFormat,
200
- {
201
- className: cn(theme.messages.date),
202
- date: activeSession.createdAt
203
- }
204
- )
205
- ] }) });
206
- };
207
- const SvgBack = (props) => /* @__PURE__ */ React.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.createElement("path", { d: "m15 18-6-6 6-6" }));
208
- const SessionMessagePanel = ({
209
- children,
210
- allowBack = true
211
- }) => {
212
- const { activeSessionId, theme, isCompact, selectSession, viewType } = useContext(ChatContext);
213
- const isVisible = isCompact && activeSessionId || viewType === "chat" || !isCompact;
214
- return isVisible && /* @__PURE__ */ jsx(
215
- motion.div,
216
- {
217
- initial: { translateX: "200%" },
218
- animate: {
219
- translateX: "0%",
220
- transition: {
221
- type: "tween",
222
- ease: "linear",
223
- duration: 0.2,
224
- when: "beforeChildren"
225
- }
226
- },
227
- exit: { translateX: "200%" },
228
- className: cn(theme.messages.base, {
229
- [theme.messages.companion]: isCompact,
230
- [theme.messages.console]: !isCompact
231
- }),
232
- children: /* @__PURE__ */ jsxs("div", { className: cn(theme.messages.inner), children: [
233
- allowBack && isCompact && viewType !== "chat" && /* @__PURE__ */ jsxs(
234
- Button,
235
- {
236
- variant: "text",
237
- size: "small",
238
- onClick: () => selectSession(null),
239
- className: cn(theme.messages.back),
240
- children: [
241
- /* @__PURE__ */ jsx(SvgBack, {}),
242
- "Back"
243
- ]
244
- }
245
- ),
246
- children
247
- ] })
248
- }
249
- );
250
- };
251
- const SvgCopy = (props) => /* @__PURE__ */ React.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.createElement("rect", { width: 14, height: 14, x: 8, y: 8, rx: 2, ry: 2 }), /* @__PURE__ */ React.createElement("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" }));
443
+ const SvgCopy = (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 18, height: 18, viewBox: "0 0 18 18", fill: "none", ...props }, /* @__PURE__ */ React.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" }));
252
444
  const dark = {
253
445
  'code[class*="language-"]': {
254
- "background": "#11111f",
255
- "color": "#e2e8f0",
256
- "textShadow": "0 1px rgba(0, 0, 0, 0.3)",
257
- "fontFamily": '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
258
- "direction": "ltr",
259
- "textAlign": "left",
260
- "whiteSpace": "pre",
261
- "wordSpacing": "normal",
262
- "wordBreak": "normal",
263
- "lineHeight": "1.5",
264
- "MozTabSize": "2",
265
- "OTabSize": "2",
266
- "tabSize": "2",
267
- "WebkitHyphens": "none",
268
- "MozHyphens": "none",
269
- "msHyphens": "none",
270
- "hyphens": "none"
446
+ background: "#11111f",
447
+ color: "#e2e8f0",
448
+ textShadow: "0 1px rgba(0, 0, 0, 0.3)",
449
+ fontFamily: '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
450
+ direction: "ltr",
451
+ textAlign: "left",
452
+ whiteSpace: "pre",
453
+ wordSpacing: "normal",
454
+ wordBreak: "normal",
455
+ lineHeight: "1.5",
456
+ MozTabSize: "2",
457
+ OTabSize: "2",
458
+ tabSize: "2",
459
+ WebkitHyphens: "none",
460
+ MozHyphens: "none",
461
+ msHyphens: "none",
462
+ hyphens: "none"
271
463
  },
272
464
  'pre[class*="language-"]': {
273
- "background": "#11111f",
274
- "color": "#e2e8f0",
275
- "textShadow": "0 1px rgba(0, 0, 0, 0.3)",
276
- "fontFamily": '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
277
- "direction": "ltr",
278
- "textAlign": "left",
279
- "whiteSpace": "pre",
280
- "wordSpacing": "normal",
281
- "wordBreak": "normal",
282
- "lineHeight": "1.5",
283
- "MozTabSize": "2",
284
- "OTabSize": "2",
285
- "tabSize": "2",
286
- "WebkitHyphens": "none",
287
- "MozHyphens": "none",
288
- "msHyphens": "none",
289
- "hyphens": "none",
290
- "padding": "1em",
291
- "margin": "0",
292
- "overflow": "auto"
465
+ background: "#11111f",
466
+ color: "#e2e8f0",
467
+ textShadow: "0 1px rgba(0, 0, 0, 0.3)",
468
+ fontFamily: '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
469
+ direction: "ltr",
470
+ textAlign: "left",
471
+ whiteSpace: "pre",
472
+ wordSpacing: "normal",
473
+ wordBreak: "normal",
474
+ lineHeight: "1.5",
475
+ MozTabSize: "2",
476
+ OTabSize: "2",
477
+ tabSize: "2",
478
+ WebkitHyphens: "none",
479
+ MozHyphens: "none",
480
+ msHyphens: "none",
481
+ hyphens: "none",
482
+ padding: "1em",
483
+ margin: "0",
484
+ overflow: "auto"
293
485
  },
294
486
  'code[class*="language-"]::-moz-selection': {
295
- "background": "#1e293b",
296
- "color": "inherit",
297
- "textShadow": "none"
487
+ background: "#1e293b",
488
+ color: "inherit",
489
+ textShadow: "none"
298
490
  },
299
491
  'code[class*="language-"] *::-moz-selection': {
300
- "background": "#1e293b",
301
- "color": "inherit",
302
- "textShadow": "none"
492
+ background: "#1e293b",
493
+ color: "inherit",
494
+ textShadow: "none"
303
495
  },
304
496
  'pre[class*="language-"] *::-moz-selection': {
305
- "background": "#1e293b",
306
- "color": "inherit",
307
- "textShadow": "none"
497
+ background: "#1e293b",
498
+ color: "inherit",
499
+ textShadow: "none"
308
500
  },
309
501
  'code[class*="language-"]::selection': {
310
- "background": "#1e293b",
311
- "color": "inherit",
312
- "textShadow": "none"
502
+ background: "#1e293b",
503
+ color: "inherit",
504
+ textShadow: "none"
313
505
  },
314
506
  'code[class*="language-"] *::selection': {
315
- "background": "#1e293b",
316
- "color": "inherit",
317
- "textShadow": "none"
507
+ background: "#1e293b",
508
+ color: "inherit",
509
+ textShadow: "none"
318
510
  },
319
511
  'pre[class*="language-"] *::selection': {
320
- "background": "#1e293b",
321
- "color": "inherit",
322
- "textShadow": "none"
512
+ background: "#1e293b",
513
+ color: "inherit",
514
+ textShadow: "none"
323
515
  },
324
516
  ':not(pre) > code[class*="language-"]': {
325
- "padding": "0.2em 0.3em",
326
- "borderRadius": "0.3em",
327
- "whiteSpace": "normal"
517
+ padding: "0.2em 0.3em",
518
+ borderRadius: "0.3em",
519
+ whiteSpace: "normal"
328
520
  },
329
- "comment": {
330
- "color": "#64748b",
331
- "fontStyle": "italic"
521
+ comment: {
522
+ color: "#64748b",
523
+ fontStyle: "italic"
332
524
  },
333
- "prolog": {
334
- "color": "#64748b"
525
+ prolog: {
526
+ color: "#64748b"
335
527
  },
336
- "cdata": {
337
- "color": "#64748b"
528
+ cdata: {
529
+ color: "#64748b"
338
530
  },
339
- "doctype": {
340
- "color": "#e2e8f0"
531
+ doctype: {
532
+ color: "#e2e8f0"
341
533
  },
342
- "punctuation": {
343
- "color": "#e2e8f0"
534
+ punctuation: {
535
+ color: "#e2e8f0"
344
536
  },
345
- "entity": {
346
- "color": "#3b82f6",
347
- "cursor": "help"
537
+ entity: {
538
+ color: "#3b82f6",
539
+ cursor: "help"
348
540
  },
349
541
  "attr-name": {
350
- "color": "#f59e0b"
542
+ color: "#f59e0b"
351
543
  },
352
544
  "class-name": {
353
- "color": "#f59e0b"
545
+ color: "#f59e0b"
354
546
  },
355
- "boolean": {
356
- "color": "#3b82f6"
547
+ boolean: {
548
+ color: "#3b82f6"
357
549
  },
358
- "constant": {
359
- "color": "#3b82f6"
550
+ constant: {
551
+ color: "#3b82f6"
360
552
  },
361
- "number": {
362
- "color": "#3b82f6"
553
+ number: {
554
+ color: "#3b82f6"
363
555
  },
364
- "atrule": {
365
- "color": "#f59e0b"
556
+ atrule: {
557
+ color: "#f59e0b"
366
558
  },
367
- "keyword": {
368
- "color": "#f472b6"
559
+ keyword: {
560
+ color: "#f472b6"
369
561
  },
370
- "property": {
371
- "color": "#3b82f6"
562
+ property: {
563
+ color: "#3b82f6"
372
564
  },
373
- "tag": {
374
- "color": "#3b82f6"
565
+ tag: {
566
+ color: "#3b82f6"
375
567
  },
376
- "symbol": {
377
- "color": "#3b82f6"
568
+ symbol: {
569
+ color: "#3b82f6"
378
570
  },
379
- "deleted": {
380
- "color": "#ef4444"
571
+ deleted: {
572
+ color: "#ef4444"
381
573
  },
382
- "important": {
383
- "color": "#f472b6"
574
+ important: {
575
+ color: "#f472b6"
384
576
  },
385
- "selector": {
386
- "color": "#10b981"
577
+ selector: {
578
+ color: "#10b981"
387
579
  },
388
- "string": {
389
- "color": "#10b981"
580
+ string: {
581
+ color: "#10b981"
390
582
  },
391
- "char": {
392
- "color": "#10b981"
583
+ char: {
584
+ color: "#10b981"
393
585
  },
394
- "builtin": {
395
- "color": "#10b981"
586
+ builtin: {
587
+ color: "#10b981"
396
588
  },
397
- "inserted": {
398
- "color": "#10b981"
589
+ inserted: {
590
+ color: "#10b981"
399
591
  },
400
- "regex": {
401
- "color": "#10b981"
592
+ regex: {
593
+ color: "#10b981"
402
594
  },
403
595
  "attr-value": {
404
- "color": "#10b981"
596
+ color: "#10b981"
405
597
  },
406
598
  "attr-value > .token.punctuation": {
407
- "color": "#10b981"
599
+ color: "#10b981"
408
600
  },
409
- "variable": {
410
- "color": "#60a5fa"
601
+ variable: {
602
+ color: "#60a5fa"
411
603
  },
412
- "operator": {
413
- "color": "#60a5fa"
604
+ operator: {
605
+ color: "#60a5fa"
414
606
  },
415
- "function": {
416
- "color": "#60a5fa"
607
+ function: {
608
+ color: "#60a5fa"
417
609
  },
418
- "url": {
419
- "color": "#60a5fa"
610
+ url: {
611
+ color: "#60a5fa"
420
612
  },
421
613
  "attr-value > .token.punctuation.attr-equals": {
422
- "color": "#e2e8f0"
614
+ color: "#e2e8f0"
423
615
  },
424
616
  "special-attr > .token.attr-value > .token.value.css": {
425
- "color": "#e2e8f0"
617
+ color: "#e2e8f0"
426
618
  },
427
619
  ".language-css .token.selector": {
428
- "color": "#3b82f6"
620
+ color: "#3b82f6"
429
621
  },
430
622
  ".language-css .token.property": {
431
- "color": "#e2e8f0"
623
+ color: "#e2e8f0"
432
624
  },
433
625
  ".language-css .token.function": {
434
- "color": "#60a5fa"
626
+ color: "#60a5fa"
435
627
  },
436
628
  ".language-css .token.url > .token.function": {
437
- "color": "#60a5fa"
629
+ color: "#60a5fa"
438
630
  },
439
631
  ".language-css .token.url > .token.string.url": {
440
- "color": "#10b981"
632
+ color: "#10b981"
441
633
  },
442
634
  ".language-css .token.important": {
443
- "color": "#f472b6"
635
+ color: "#f472b6"
444
636
  },
445
637
  ".language-css .token.atrule .token.rule": {
446
- "color": "#f472b6"
638
+ color: "#f472b6"
447
639
  },
448
640
  ".language-javascript .token.operator": {
449
- "color": "#f472b6"
641
+ color: "#f472b6"
450
642
  },
451
643
  ".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation": {
452
- "color": "#ef4444"
644
+ color: "#ef4444"
453
645
  },
454
646
  ".language-json .token.operator": {
455
- "color": "#e2e8f0"
647
+ color: "#e2e8f0"
456
648
  },
457
649
  ".language-json .token.null.keyword": {
458
- "color": "#3b82f6"
650
+ color: "#3b82f6"
459
651
  },
460
652
  ".language-markdown .token.url": {
461
- "color": "#e2e8f0"
653
+ color: "#e2e8f0"
462
654
  },
463
655
  ".language-markdown .token.url > .token.operator": {
464
- "color": "#e2e8f0"
656
+ color: "#e2e8f0"
465
657
  },
466
658
  ".language-markdown .token.url-reference.url > .token.string": {
467
- "color": "#e2e8f0"
659
+ color: "#e2e8f0"
468
660
  },
469
661
  ".language-markdown .token.url > .token.content": {
470
- "color": "#60a5fa"
662
+ color: "#60a5fa"
471
663
  },
472
664
  ".language-markdown .token.url > .token.url": {
473
- "color": "#60a5fa"
665
+ color: "#60a5fa"
474
666
  },
475
667
  ".language-markdown .token.url-reference.url": {
476
- "color": "#60a5fa"
668
+ color: "#60a5fa"
477
669
  },
478
670
  ".language-markdown .token.blockquote.punctuation": {
479
- "color": "#64748b",
480
- "fontStyle": "italic"
671
+ color: "#64748b",
672
+ fontStyle: "italic"
481
673
  },
482
674
  ".language-markdown .token.hr.punctuation": {
483
- "color": "#64748b",
484
- "fontStyle": "italic"
675
+ color: "#64748b",
676
+ fontStyle: "italic"
485
677
  },
486
678
  ".language-markdown .token.code-snippet": {
487
- "color": "#10b981"
679
+ color: "#10b981"
488
680
  },
489
681
  ".language-markdown .token.bold .token.content": {
490
- "color": "#f59e0b"
682
+ color: "#f59e0b"
491
683
  },
492
684
  ".language-markdown .token.italic .token.content": {
493
- "color": "#f472b6"
685
+ color: "#f472b6"
494
686
  },
495
687
  ".language-markdown .token.strike .token.content": {
496
- "color": "#3b82f6"
688
+ color: "#3b82f6"
497
689
  },
498
690
  ".language-markdown .token.strike .token.punctuation": {
499
- "color": "#3b82f6"
691
+ color: "#3b82f6"
500
692
  },
501
693
  ".language-markdown .token.list.punctuation": {
502
- "color": "#3b82f6"
694
+ color: "#3b82f6"
503
695
  },
504
696
  ".language-markdown .token.title.important > .token.punctuation": {
505
- "color": "#3b82f6"
697
+ color: "#3b82f6"
506
698
  },
507
- "bold": {
508
- "fontWeight": "bold"
699
+ bold: {
700
+ fontWeight: "bold"
509
701
  },
510
- "italic": {
511
- "fontStyle": "italic"
702
+ italic: {
703
+ fontStyle: "italic"
512
704
  },
513
- "namespace": {
514
- "Opacity": "0.8"
705
+ namespace: {
706
+ Opacity: "0.8"
515
707
  },
516
708
  "token.tab:not(:empty):before": {
517
- "color": "#64748b",
518
- "textShadow": "none"
709
+ color: "#64748b",
710
+ textShadow: "none"
519
711
  },
520
712
  "token.cr:before": {
521
- "color": "#64748b",
522
- "textShadow": "none"
713
+ color: "#64748b",
714
+ textShadow: "none"
523
715
  },
524
716
  "token.lf:before": {
525
- "color": "#64748b",
526
- "textShadow": "none"
717
+ color: "#64748b",
718
+ textShadow: "none"
527
719
  },
528
720
  "token.space:before": {
529
- "color": "#64748b",
530
- "textShadow": "none"
721
+ color: "#64748b",
722
+ textShadow: "none"
531
723
  },
532
724
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item": {
533
- "marginRight": "0.4em"
725
+ marginRight: "0.4em"
534
726
  },
535
727
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button": {
536
- "background": "#1e293b",
537
- "color": "#94a3b8",
538
- "padding": "0.1em 0.4em",
539
- "borderRadius": "0.3em"
728
+ background: "#1e293b",
729
+ color: "#94a3b8",
730
+ padding: "0.1em 0.4em",
731
+ borderRadius: "0.3em"
540
732
  },
541
733
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a": {
542
- "background": "#1e293b",
543
- "color": "#94a3b8",
544
- "padding": "0.1em 0.4em",
545
- "borderRadius": "0.3em"
734
+ background: "#1e293b",
735
+ color: "#94a3b8",
736
+ padding: "0.1em 0.4em",
737
+ borderRadius: "0.3em"
546
738
  },
547
739
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span": {
548
- "background": "#1e293b",
549
- "color": "#94a3b8",
550
- "padding": "0.1em 0.4em",
551
- "borderRadius": "0.3em"
740
+ background: "#1e293b",
741
+ color: "#94a3b8",
742
+ padding: "0.1em 0.4em",
743
+ borderRadius: "0.3em"
552
744
  },
553
745
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover": {
554
- "background": "#3b82f6",
555
- "color": "#ffffff"
746
+ background: "#3b82f6",
747
+ color: "#ffffff"
556
748
  },
557
749
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus": {
558
- "background": "#3b82f6",
559
- "color": "#ffffff"
750
+ background: "#3b82f6",
751
+ color: "#ffffff"
560
752
  },
561
753
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover": {
562
- "background": "#3b82f6",
563
- "color": "#ffffff"
754
+ background: "#3b82f6",
755
+ color: "#ffffff"
564
756
  },
565
757
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus": {
566
- "background": "#3b82f6",
567
- "color": "#ffffff"
758
+ background: "#3b82f6",
759
+ color: "#ffffff"
568
760
  },
569
761
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover": {
570
- "background": "#3b82f6",
571
- "color": "#ffffff"
762
+ background: "#3b82f6",
763
+ color: "#ffffff"
572
764
  },
573
765
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus": {
574
- "background": "#3b82f6",
575
- "color": "#ffffff"
766
+ background: "#3b82f6",
767
+ color: "#ffffff"
576
768
  },
577
769
  ".line-highlight.line-highlight": {
578
- "background": "rgba(59, 130, 246, 0.08)"
770
+ background: "rgba(59, 130, 246, 0.08)"
579
771
  },
580
772
  ".line-highlight.line-highlight:before": {
581
- "background": "#1e293b",
582
- "color": "#e2e8f0",
583
- "padding": "0.1em 0.6em",
584
- "borderRadius": "0.3em",
585
- "boxShadow": "0 2px 0 0 rgba(0, 0, 0, 0.2)"
773
+ background: "#1e293b",
774
+ color: "#e2e8f0",
775
+ padding: "0.1em 0.6em",
776
+ borderRadius: "0.3em",
777
+ boxShadow: "0 2px 0 0 rgba(0, 0, 0, 0.2)"
586
778
  },
587
779
  ".line-highlight.line-highlight[data-end]:after": {
588
- "background": "#1e293b",
589
- "color": "#e2e8f0",
590
- "padding": "0.1em 0.6em",
591
- "borderRadius": "0.3em",
592
- "boxShadow": "0 2px 0 0 rgba(0, 0, 0, 0.2)"
780
+ background: "#1e293b",
781
+ color: "#e2e8f0",
782
+ padding: "0.1em 0.6em",
783
+ borderRadius: "0.3em",
784
+ boxShadow: "0 2px 0 0 rgba(0, 0, 0, 0.2)"
593
785
  },
594
786
  "pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before": {
595
- "backgroundColor": "rgba(59, 130, 246, 0.08)"
787
+ backgroundColor: "rgba(59, 130, 246, 0.08)"
596
788
  },
597
789
  ".line-numbers.line-numbers .line-numbers-rows": {
598
- "borderRightColor": "#1e293b"
790
+ borderRightColor: "#1e293b"
599
791
  },
600
792
  ".command-line .command-line-prompt": {
601
- "borderRightColor": "#1e293b"
793
+ borderRightColor: "#1e293b"
602
794
  },
603
795
  ".line-numbers .line-numbers-rows > span:before": {
604
- "color": "#64748b"
796
+ color: "#64748b"
605
797
  },
606
798
  ".command-line .command-line-prompt > span:before": {
607
- "color": "#64748b"
799
+ color: "#64748b"
608
800
  },
609
801
  ".rainbow-braces .token.token.punctuation.brace-level-1": {
610
- "color": "#3b82f6"
802
+ color: "#3b82f6"
611
803
  },
612
804
  ".rainbow-braces .token.token.punctuation.brace-level-5": {
613
- "color": "#3b82f6"
805
+ color: "#3b82f6"
614
806
  },
615
807
  ".rainbow-braces .token.token.punctuation.brace-level-9": {
616
- "color": "#3b82f6"
808
+ color: "#3b82f6"
617
809
  },
618
810
  ".rainbow-braces .token.token.punctuation.brace-level-2": {
619
- "color": "#10b981"
811
+ color: "#10b981"
620
812
  },
621
813
  ".rainbow-braces .token.token.punctuation.brace-level-6": {
622
- "color": "#10b981"
814
+ color: "#10b981"
623
815
  },
624
816
  ".rainbow-braces .token.token.punctuation.brace-level-10": {
625
- "color": "#10b981"
817
+ color: "#10b981"
626
818
  },
627
819
  ".rainbow-braces .token.token.punctuation.brace-level-3": {
628
- "color": "#60a5fa"
820
+ color: "#60a5fa"
629
821
  },
630
822
  ".rainbow-braces .token.token.punctuation.brace-level-7": {
631
- "color": "#60a5fa"
823
+ color: "#60a5fa"
632
824
  },
633
825
  ".rainbow-braces .token.token.punctuation.brace-level-11": {
634
- "color": "#60a5fa"
826
+ color: "#60a5fa"
635
827
  },
636
828
  ".rainbow-braces .token.token.punctuation.brace-level-4": {
637
- "color": "#f472b6"
829
+ color: "#f472b6"
638
830
  },
639
831
  ".rainbow-braces .token.token.punctuation.brace-level-8": {
640
- "color": "#f472b6"
832
+ color: "#f472b6"
641
833
  },
642
834
  ".rainbow-braces .token.token.punctuation.brace-level-12": {
643
- "color": "#f472b6"
835
+ color: "#f472b6"
644
836
  },
645
837
  "pre.diff-highlight > code .token.token.deleted:not(.prefix)": {
646
- "backgroundColor": "rgba(239, 68, 68, 0.15)"
838
+ backgroundColor: "rgba(239, 68, 68, 0.15)"
647
839
  },
648
840
  "pre > code.diff-highlight .token.token.deleted:not(.prefix)": {
649
- "backgroundColor": "rgba(239, 68, 68, 0.15)"
841
+ backgroundColor: "rgba(239, 68, 68, 0.15)"
650
842
  },
651
843
  "pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection": {
652
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
844
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
653
845
  },
654
846
  "pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection": {
655
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
847
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
656
848
  },
657
849
  "pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection": {
658
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
850
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
659
851
  },
660
852
  "pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection": {
661
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
853
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
662
854
  },
663
855
  "pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection": {
664
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
856
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
665
857
  },
666
858
  "pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection": {
667
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
859
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
668
860
  },
669
861
  "pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection": {
670
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
862
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
671
863
  },
672
864
  "pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection": {
673
- "backgroundColor": "rgba(239, 68, 68, 0.25)"
865
+ backgroundColor: "rgba(239, 68, 68, 0.25)"
674
866
  },
675
867
  "pre.diff-highlight > code .token.token.inserted:not(.prefix)": {
676
- "backgroundColor": "rgba(16, 185, 129, 0.15)"
868
+ backgroundColor: "rgba(16, 185, 129, 0.15)"
677
869
  },
678
870
  "pre > code.diff-highlight .token.token.inserted:not(.prefix)": {
679
- "backgroundColor": "rgba(16, 185, 129, 0.15)"
871
+ backgroundColor: "rgba(16, 185, 129, 0.15)"
680
872
  },
681
873
  "pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection": {
682
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
874
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
683
875
  },
684
876
  "pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection": {
685
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
877
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
686
878
  },
687
879
  "pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection": {
688
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
880
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
689
881
  },
690
882
  "pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection": {
691
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
883
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
692
884
  },
693
885
  "pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection": {
694
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
886
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
695
887
  },
696
888
  "pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection": {
697
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
889
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
698
890
  },
699
891
  "pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection": {
700
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
892
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
701
893
  },
702
894
  "pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection": {
703
- "backgroundColor": "rgba(16, 185, 129, 0.25)"
895
+ backgroundColor: "rgba(16, 185, 129, 0.25)"
704
896
  },
705
897
  ".prism-previewer.prism-previewer:before": {
706
- "borderColor": "#11111f"
898
+ borderColor: "#11111f"
707
899
  },
708
900
  ".prism-previewer-gradient.prism-previewer-gradient div": {
709
- "borderColor": "#11111f",
710
- "borderRadius": "0.3em"
901
+ borderColor: "#11111f",
902
+ borderRadius: "0.3em"
711
903
  },
712
904
  ".prism-previewer-color.prism-previewer-color:before": {
713
- "borderRadius": "0.3em"
905
+ borderRadius: "0.3em"
714
906
  },
715
907
  ".prism-previewer-easing.prism-previewer-easing:before": {
716
- "borderRadius": "0.3em"
908
+ borderRadius: "0.3em"
717
909
  },
718
910
  ".prism-previewer.prism-previewer:after": {
719
- "borderTopColor": "#11111f"
911
+ borderTopColor: "#11111f"
720
912
  },
721
913
  ".prism-previewer-flipped.prism-previewer-flipped.after": {
722
- "borderBottomColor": "#11111f"
914
+ borderBottomColor: "#11111f"
723
915
  },
724
916
  ".prism-previewer-angle.prism-previewer-angle:before": {
725
- "background": "#1e293b"
917
+ background: "#1e293b"
726
918
  },
727
919
  ".prism-previewer-time.prism-previewer-time:before": {
728
- "background": "#1e293b"
920
+ background: "#1e293b"
729
921
  },
730
922
  ".prism-previewer-easing.prism-previewer-easing": {
731
- "background": "#1e293b"
923
+ background: "#1e293b"
732
924
  },
733
925
  ".prism-previewer-angle.prism-previewer-angle circle": {
734
- "stroke": "#e2e8f0",
735
- "strokeOpacity": "1"
926
+ stroke: "#e2e8f0",
927
+ strokeOpacity: "1"
736
928
  },
737
929
  ".prism-previewer-time.prism-previewer-time circle": {
738
- "stroke": "#e2e8f0",
739
- "strokeOpacity": "1"
930
+ stroke: "#e2e8f0",
931
+ strokeOpacity: "1"
740
932
  },
741
933
  ".prism-previewer-easing.prism-previewer-easing circle": {
742
- "stroke": "#e2e8f0",
743
- "fill": "transparent"
934
+ stroke: "#e2e8f0",
935
+ fill: "transparent"
744
936
  },
745
937
  ".prism-previewer-easing.prism-previewer-easing path": {
746
- "stroke": "#e2e8f0"
938
+ stroke: "#e2e8f0"
747
939
  },
748
940
  ".prism-previewer-easing.prism-previewer-easing line": {
749
- "stroke": "#e2e8f0"
941
+ stroke: "#e2e8f0"
750
942
  }
751
943
  };
752
944
  const light = {
753
945
  'code[class*="language-"]': {
754
- "background": "#fff",
755
- "color": "#1e293b",
756
- "textShadow": "none",
757
- "fontFamily": '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
758
- "direction": "ltr",
759
- "textAlign": "left",
760
- "whiteSpace": "pre",
761
- "wordSpacing": "normal",
762
- "wordBreak": "normal",
763
- "lineHeight": "1.5",
764
- "MozTabSize": "2",
765
- "OTabSize": "2",
766
- "tabSize": "2",
767
- "WebkitHyphens": "none",
768
- "MozHyphens": "none",
769
- "msHyphens": "none",
770
- "hyphens": "none"
946
+ background: "#fff",
947
+ color: "#1e293b",
948
+ textShadow: "none",
949
+ fontFamily: '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
950
+ direction: "ltr",
951
+ textAlign: "left",
952
+ whiteSpace: "pre",
953
+ wordSpacing: "normal",
954
+ wordBreak: "normal",
955
+ lineHeight: "1.5",
956
+ MozTabSize: "2",
957
+ OTabSize: "2",
958
+ tabSize: "2",
959
+ WebkitHyphens: "none",
960
+ MozHyphens: "none",
961
+ msHyphens: "none",
962
+ hyphens: "none"
771
963
  },
772
964
  'pre[class*="language-"]': {
773
- "background": "#fff",
774
- "color": "#1e293b",
775
- "textShadow": "none",
776
- "fontFamily": '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
777
- "direction": "ltr",
778
- "textAlign": "left",
779
- "whiteSpace": "pre",
780
- "wordSpacing": "normal",
781
- "wordBreak": "normal",
782
- "lineHeight": "1.5",
783
- "MozTabSize": "2",
784
- "OTabSize": "2",
785
- "tabSize": "2",
786
- "WebkitHyphens": "none",
787
- "MozHyphens": "none",
788
- "msHyphens": "none",
789
- "hyphens": "none",
790
- "padding": "1em",
791
- "margin": "0.5em 0",
792
- "overflow": "auto",
793
- "borderRadius": "0.3em",
794
- "border": "1px solid #e2e8f0"
965
+ background: "#fff",
966
+ color: "#1e293b",
967
+ textShadow: "none",
968
+ fontFamily: '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',
969
+ direction: "ltr",
970
+ textAlign: "left",
971
+ whiteSpace: "pre",
972
+ wordSpacing: "normal",
973
+ wordBreak: "normal",
974
+ lineHeight: "1.5",
975
+ MozTabSize: "2",
976
+ OTabSize: "2",
977
+ tabSize: "2",
978
+ WebkitHyphens: "none",
979
+ MozHyphens: "none",
980
+ msHyphens: "none",
981
+ hyphens: "none",
982
+ padding: "1em",
983
+ margin: "0.5em 0",
984
+ overflow: "auto",
985
+ borderRadius: "0.3em",
986
+ border: "1px solid #e2e8f0"
795
987
  },
796
988
  'code[class*="language-"]::-moz-selection': {
797
- "background": "#e2e8f0",
798
- "color": "inherit",
799
- "textShadow": "none"
989
+ background: "#e2e8f0",
990
+ color: "inherit",
991
+ textShadow: "none"
800
992
  },
801
993
  'code[class*="language-"] *::-moz-selection': {
802
- "background": "#e2e8f0",
803
- "color": "inherit",
804
- "textShadow": "none"
994
+ background: "#e2e8f0",
995
+ color: "inherit",
996
+ textShadow: "none"
805
997
  },
806
998
  'pre[class*="language-"] *::-moz-selection': {
807
- "background": "#e2e8f0",
808
- "color": "inherit",
809
- "textShadow": "none"
999
+ background: "#e2e8f0",
1000
+ color: "inherit",
1001
+ textShadow: "none"
810
1002
  },
811
1003
  'code[class*="language-"]::selection': {
812
- "background": "#e2e8f0",
813
- "color": "inherit",
814
- "textShadow": "none"
1004
+ background: "#e2e8f0",
1005
+ color: "inherit",
1006
+ textShadow: "none"
815
1007
  },
816
1008
  'code[class*="language-"] *::selection': {
817
- "background": "#e2e8f0",
818
- "color": "inherit",
819
- "textShadow": "none"
1009
+ background: "#e2e8f0",
1010
+ color: "inherit",
1011
+ textShadow: "none"
820
1012
  },
821
1013
  'pre[class*="language-"] *::selection': {
822
- "background": "#e2e8f0",
823
- "color": "inherit",
824
- "textShadow": "none"
1014
+ background: "#e2e8f0",
1015
+ color: "inherit",
1016
+ textShadow: "none"
825
1017
  },
826
1018
  ':not(pre) > code[class*="language-"]': {
827
- "padding": "0.2em 0.3em",
828
- "borderRadius": "0.3em",
829
- "whiteSpace": "normal",
830
- "background": "#f1f5f9"
1019
+ padding: "0.2em 0.3em",
1020
+ borderRadius: "0.3em",
1021
+ whiteSpace: "normal",
1022
+ background: "#f1f5f9"
831
1023
  },
832
- "comment": {
833
- "color": "#64748b",
834
- "fontStyle": "italic"
1024
+ comment: {
1025
+ color: "#64748b",
1026
+ fontStyle: "italic"
835
1027
  },
836
- "prolog": {
837
- "color": "#64748b"
1028
+ prolog: {
1029
+ color: "#64748b"
838
1030
  },
839
- "cdata": {
840
- "color": "#64748b"
1031
+ cdata: {
1032
+ color: "#64748b"
841
1033
  },
842
- "doctype": {
843
- "color": "#1e293b"
1034
+ doctype: {
1035
+ color: "#1e293b"
844
1036
  },
845
- "punctuation": {
846
- "color": "#64748b"
1037
+ punctuation: {
1038
+ color: "#64748b"
847
1039
  },
848
- "entity": {
849
- "color": "#3b82f6",
850
- "cursor": "help"
1040
+ entity: {
1041
+ color: "#3b82f6",
1042
+ cursor: "help"
851
1043
  },
852
1044
  "attr-name": {
853
- "color": "#ea580c"
1045
+ color: "#ea580c"
854
1046
  },
855
1047
  "class-name": {
856
- "color": "#ea580c"
1048
+ color: "#ea580c"
857
1049
  },
858
- "boolean": {
859
- "color": "#3b82f6"
1050
+ boolean: {
1051
+ color: "#3b82f6"
860
1052
  },
861
- "constant": {
862
- "color": "#3b82f6"
1053
+ constant: {
1054
+ color: "#3b82f6"
863
1055
  },
864
- "number": {
865
- "color": "#3b82f6"
1056
+ number: {
1057
+ color: "#3b82f6"
866
1058
  },
867
- "atrule": {
868
- "color": "#ea580c"
1059
+ atrule: {
1060
+ color: "#ea580c"
869
1061
  },
870
- "keyword": {
871
- "color": "#9333ea"
1062
+ keyword: {
1063
+ color: "#9333ea"
872
1064
  },
873
- "property": {
874
- "color": "#3b82f6"
1065
+ property: {
1066
+ color: "#3b82f6"
875
1067
  },
876
- "tag": {
877
- "color": "#3b82f6"
1068
+ tag: {
1069
+ color: "#3b82f6"
878
1070
  },
879
- "symbol": {
880
- "color": "#3b82f6"
1071
+ symbol: {
1072
+ color: "#3b82f6"
881
1073
  },
882
- "deleted": {
883
- "color": "#dc2626"
1074
+ deleted: {
1075
+ color: "#dc2626"
884
1076
  },
885
- "important": {
886
- "color": "#9333ea"
1077
+ important: {
1078
+ color: "#9333ea"
887
1079
  },
888
- "selector": {
889
- "color": "#16a34a"
1080
+ selector: {
1081
+ color: "#16a34a"
890
1082
  },
891
- "string": {
892
- "color": "#16a34a"
1083
+ string: {
1084
+ color: "#16a34a"
893
1085
  },
894
- "char": {
895
- "color": "#16a34a"
1086
+ char: {
1087
+ color: "#16a34a"
896
1088
  },
897
- "builtin": {
898
- "color": "#16a34a"
1089
+ builtin: {
1090
+ color: "#16a34a"
899
1091
  },
900
- "inserted": {
901
- "color": "#16a34a"
1092
+ inserted: {
1093
+ color: "#16a34a"
902
1094
  },
903
- "regex": {
904
- "color": "#16a34a"
1095
+ regex: {
1096
+ color: "#16a34a"
905
1097
  },
906
1098
  "attr-value": {
907
- "color": "#16a34a"
1099
+ color: "#16a34a"
908
1100
  },
909
1101
  "attr-value > .token.punctuation": {
910
- "color": "#16a34a"
1102
+ color: "#16a34a"
911
1103
  },
912
- "variable": {
913
- "color": "#3b82f6"
1104
+ variable: {
1105
+ color: "#3b82f6"
914
1106
  },
915
- "operator": {
916
- "color": "#3b82f6"
1107
+ operator: {
1108
+ color: "#3b82f6"
917
1109
  },
918
- "function": {
919
- "color": "#3b82f6"
1110
+ function: {
1111
+ color: "#3b82f6"
920
1112
  },
921
- "url": {
922
- "color": "#3b82f6"
1113
+ url: {
1114
+ color: "#3b82f6"
923
1115
  },
924
1116
  "attr-value > .token.punctuation.attr-equals": {
925
- "color": "#64748b"
1117
+ color: "#64748b"
926
1118
  },
927
1119
  "special-attr > .token.attr-value > .token.value.css": {
928
- "color": "#1e293b"
1120
+ color: "#1e293b"
929
1121
  },
930
1122
  ".language-css .token.selector": {
931
- "color": "#3b82f6"
1123
+ color: "#3b82f6"
932
1124
  },
933
1125
  ".language-css .token.property": {
934
- "color": "#1e293b"
1126
+ color: "#1e293b"
935
1127
  },
936
1128
  ".language-css .token.function": {
937
- "color": "#3b82f6"
1129
+ color: "#3b82f6"
938
1130
  },
939
1131
  ".language-css .token.url > .token.function": {
940
- "color": "#3b82f6"
1132
+ color: "#3b82f6"
941
1133
  },
942
1134
  ".language-css .token.url > .token.string.url": {
943
- "color": "#16a34a"
1135
+ color: "#16a34a"
944
1136
  },
945
1137
  ".language-css .token.important": {
946
- "color": "#9333ea"
1138
+ color: "#9333ea"
947
1139
  },
948
1140
  ".language-css .token.atrule .token.rule": {
949
- "color": "#9333ea"
1141
+ color: "#9333ea"
950
1142
  },
951
1143
  ".language-javascript .token.operator": {
952
- "color": "#9333ea"
1144
+ color: "#9333ea"
953
1145
  },
954
1146
  ".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation": {
955
- "color": "#dc2626"
1147
+ color: "#dc2626"
956
1148
  },
957
1149
  ".language-json .token.operator": {
958
- "color": "#1e293b"
1150
+ color: "#1e293b"
959
1151
  },
960
1152
  ".language-json .token.null.keyword": {
961
- "color": "#3b82f6"
1153
+ color: "#3b82f6"
962
1154
  },
963
1155
  ".language-markdown .token.url": {
964
- "color": "#1e293b"
1156
+ color: "#1e293b"
965
1157
  },
966
1158
  ".language-markdown .token.url > .token.operator": {
967
- "color": "#1e293b"
1159
+ color: "#1e293b"
968
1160
  },
969
1161
  ".language-markdown .token.url-reference.url > .token.string": {
970
- "color": "#1e293b"
1162
+ color: "#1e293b"
971
1163
  },
972
1164
  ".language-markdown .token.url > .token.content": {
973
- "color": "#3b82f6"
1165
+ color: "#3b82f6"
974
1166
  },
975
1167
  ".language-markdown .token.url > .token.url": {
976
- "color": "#3b82f6"
1168
+ color: "#3b82f6"
977
1169
  },
978
1170
  ".language-markdown .token.url-reference.url": {
979
- "color": "#3b82f6"
1171
+ color: "#3b82f6"
980
1172
  },
981
1173
  ".language-markdown .token.blockquote.punctuation": {
982
- "color": "#64748b",
983
- "fontStyle": "italic"
1174
+ color: "#64748b",
1175
+ fontStyle: "italic"
984
1176
  },
985
1177
  ".language-markdown .token.hr.punctuation": {
986
- "color": "#64748b",
987
- "fontStyle": "italic"
1178
+ color: "#64748b",
1179
+ fontStyle: "italic"
988
1180
  },
989
1181
  ".language-markdown .token.code-snippet": {
990
- "color": "#16a34a"
1182
+ color: "#16a34a"
991
1183
  },
992
1184
  ".language-markdown .token.bold .token.content": {
993
- "color": "#ea580c"
1185
+ color: "#ea580c"
994
1186
  },
995
1187
  ".language-markdown .token.italic .token.content": {
996
- "color": "#9333ea"
1188
+ color: "#9333ea"
997
1189
  },
998
1190
  ".language-markdown .token.strike .token.content": {
999
- "color": "#3b82f6"
1191
+ color: "#3b82f6"
1000
1192
  },
1001
1193
  ".language-markdown .token.strike .token.punctuation": {
1002
- "color": "#3b82f6"
1194
+ color: "#3b82f6"
1003
1195
  },
1004
1196
  ".language-markdown .token.list.punctuation": {
1005
- "color": "#3b82f6"
1197
+ color: "#3b82f6"
1006
1198
  },
1007
1199
  ".language-markdown .token.title.important > .token.punctuation": {
1008
- "color": "#3b82f6"
1200
+ color: "#3b82f6"
1009
1201
  },
1010
- "bold": {
1011
- "fontWeight": "bold"
1202
+ bold: {
1203
+ fontWeight: "bold"
1012
1204
  },
1013
- "italic": {
1014
- "fontStyle": "italic"
1205
+ italic: {
1206
+ fontStyle: "italic"
1015
1207
  },
1016
- "namespace": {
1017
- "Opacity": "0.8"
1208
+ namespace: {
1209
+ Opacity: "0.8"
1018
1210
  },
1019
1211
  "token.tab:not(:empty):before": {
1020
- "color": "#94a3b8"
1212
+ color: "#94a3b8"
1021
1213
  },
1022
1214
  "token.cr:before": {
1023
- "color": "#94a3b8"
1215
+ color: "#94a3b8"
1024
1216
  },
1025
1217
  "token.lf:before": {
1026
- "color": "#94a3b8"
1218
+ color: "#94a3b8"
1027
1219
  },
1028
1220
  "token.space:before": {
1029
- "color": "#94a3b8"
1221
+ color: "#94a3b8"
1030
1222
  },
1031
1223
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item": {
1032
- "marginRight": "0.4em"
1224
+ marginRight: "0.4em"
1033
1225
  },
1034
1226
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button": {
1035
- "background": "#f1f5f9",
1036
- "color": "#475569",
1037
- "padding": "0.1em 0.4em",
1038
- "borderRadius": "0.3em"
1227
+ background: "#f1f5f9",
1228
+ color: "#475569",
1229
+ padding: "0.1em 0.4em",
1230
+ borderRadius: "0.3em"
1039
1231
  },
1040
1232
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a": {
1041
- "background": "#f1f5f9",
1042
- "color": "#475569",
1043
- "padding": "0.1em 0.4em",
1044
- "borderRadius": "0.3em"
1233
+ background: "#f1f5f9",
1234
+ color: "#475569",
1235
+ padding: "0.1em 0.4em",
1236
+ borderRadius: "0.3em"
1045
1237
  },
1046
1238
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span": {
1047
- "background": "#f1f5f9",
1048
- "color": "#475569",
1049
- "padding": "0.1em 0.4em",
1050
- "borderRadius": "0.3em"
1239
+ background: "#f1f5f9",
1240
+ color: "#475569",
1241
+ padding: "0.1em 0.4em",
1242
+ borderRadius: "0.3em"
1051
1243
  },
1052
1244
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover": {
1053
- "background": "#3b82f6",
1054
- "color": "#ffffff"
1245
+ background: "#3b82f6",
1246
+ color: "#ffffff"
1055
1247
  },
1056
1248
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus": {
1057
- "background": "#3b82f6",
1058
- "color": "#ffffff"
1249
+ background: "#3b82f6",
1250
+ color: "#ffffff"
1059
1251
  },
1060
1252
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover": {
1061
- "background": "#3b82f6",
1062
- "color": "#ffffff"
1253
+ background: "#3b82f6",
1254
+ color: "#ffffff"
1063
1255
  },
1064
1256
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus": {
1065
- "background": "#3b82f6",
1066
- "color": "#ffffff"
1257
+ background: "#3b82f6",
1258
+ color: "#ffffff"
1067
1259
  },
1068
1260
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover": {
1069
- "background": "#3b82f6",
1070
- "color": "#ffffff"
1261
+ background: "#3b82f6",
1262
+ color: "#ffffff"
1071
1263
  },
1072
1264
  "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus": {
1073
- "background": "#3b82f6",
1074
- "color": "#ffffff"
1265
+ background: "#3b82f6",
1266
+ color: "#ffffff"
1075
1267
  },
1076
1268
  ".line-highlight.line-highlight": {
1077
- "background": "rgba(59, 130, 246, 0.08)"
1269
+ background: "rgba(59, 130, 246, 0.08)"
1078
1270
  },
1079
1271
  ".line-highlight.line-highlight:before": {
1080
- "background": "#f1f5f9",
1081
- "color": "#1e293b",
1082
- "padding": "0.1em 0.6em",
1083
- "borderRadius": "0.3em",
1084
- "boxShadow": "0 2px 0 0 rgba(0, 0, 0, 0.1)"
1272
+ background: "#f1f5f9",
1273
+ color: "#1e293b",
1274
+ padding: "0.1em 0.6em",
1275
+ borderRadius: "0.3em",
1276
+ boxShadow: "0 2px 0 0 rgba(0, 0, 0, 0.1)"
1085
1277
  },
1086
1278
  ".line-highlight.line-highlight[data-end]:after": {
1087
- "background": "#f1f5f9",
1088
- "color": "#1e293b",
1089
- "padding": "0.1em 0.6em",
1090
- "borderRadius": "0.3em",
1091
- "boxShadow": "0 2px 0 0 rgba(0, 0, 0, 0.1)"
1279
+ background: "#f1f5f9",
1280
+ color: "#1e293b",
1281
+ padding: "0.1em 0.6em",
1282
+ borderRadius: "0.3em",
1283
+ boxShadow: "0 2px 0 0 rgba(0, 0, 0, 0.1)"
1092
1284
  },
1093
1285
  "pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before": {
1094
- "backgroundColor": "rgba(59, 130, 246, 0.08)"
1286
+ backgroundColor: "rgba(59, 130, 246, 0.08)"
1095
1287
  },
1096
1288
  ".line-numbers.line-numbers .line-numbers-rows": {
1097
- "borderRightColor": "#e2e8f0"
1289
+ borderRightColor: "#e2e8f0"
1098
1290
  },
1099
1291
  ".command-line .command-line-prompt": {
1100
- "borderRightColor": "#e2e8f0"
1292
+ borderRightColor: "#e2e8f0"
1101
1293
  },
1102
1294
  ".line-numbers .line-numbers-rows > span:before": {
1103
- "color": "#94a3b8"
1295
+ color: "#94a3b8"
1104
1296
  },
1105
1297
  ".command-line .command-line-prompt > span:before": {
1106
- "color": "#94a3b8"
1298
+ color: "#94a3b8"
1107
1299
  },
1108
1300
  ".rainbow-braces .token.token.punctuation.brace-level-1": {
1109
- "color": "#3b82f6"
1301
+ color: "#3b82f6"
1110
1302
  },
1111
1303
  ".rainbow-braces .token.token.punctuation.brace-level-5": {
1112
- "color": "#3b82f6"
1304
+ color: "#3b82f6"
1113
1305
  },
1114
1306
  ".rainbow-braces .token.token.punctuation.brace-level-9": {
1115
- "color": "#3b82f6"
1307
+ color: "#3b82f6"
1116
1308
  },
1117
1309
  ".rainbow-braces .token.token.punctuation.brace-level-2": {
1118
- "color": "#16a34a"
1310
+ color: "#16a34a"
1119
1311
  },
1120
1312
  ".rainbow-braces .token.token.punctuation.brace-level-6": {
1121
- "color": "#16a34a"
1313
+ color: "#16a34a"
1122
1314
  },
1123
1315
  ".rainbow-braces .token.token.punctuation.brace-level-10": {
1124
- "color": "#16a34a"
1316
+ color: "#16a34a"
1125
1317
  },
1126
1318
  ".rainbow-braces .token.token.punctuation.brace-level-3": {
1127
- "color": "#ea580c"
1319
+ color: "#ea580c"
1128
1320
  },
1129
1321
  ".rainbow-braces .token.token.punctuation.brace-level-7": {
1130
- "color": "#ea580c"
1322
+ color: "#ea580c"
1131
1323
  },
1132
1324
  ".rainbow-braces .token.token.punctuation.brace-level-11": {
1133
- "color": "#ea580c"
1325
+ color: "#ea580c"
1134
1326
  },
1135
1327
  ".rainbow-braces .token.token.punctuation.brace-level-4": {
1136
- "color": "#9333ea"
1328
+ color: "#9333ea"
1137
1329
  },
1138
1330
  ".rainbow-braces .token.token.punctuation.brace-level-8": {
1139
- "color": "#9333ea"
1331
+ color: "#9333ea"
1140
1332
  },
1141
1333
  ".rainbow-braces .token.token.punctuation.brace-level-12": {
1142
- "color": "#9333ea"
1334
+ color: "#9333ea"
1143
1335
  },
1144
1336
  "pre.diff-highlight > code .token.token.deleted:not(.prefix)": {
1145
- "backgroundColor": "rgba(220, 38, 38, 0.15)"
1337
+ backgroundColor: "rgba(220, 38, 38, 0.15)"
1146
1338
  },
1147
1339
  "pre > code.diff-highlight .token.token.deleted:not(.prefix)": {
1148
- "backgroundColor": "rgba(220, 38, 38, 0.15)"
1340
+ backgroundColor: "rgba(220, 38, 38, 0.15)"
1149
1341
  },
1150
1342
  "pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection": {
1151
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1343
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1152
1344
  },
1153
1345
  "pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection": {
1154
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1346
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1155
1347
  },
1156
1348
  "pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection": {
1157
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1349
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1158
1350
  },
1159
1351
  "pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection": {
1160
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1352
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1161
1353
  },
1162
1354
  "pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection": {
1163
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1355
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1164
1356
  },
1165
1357
  "pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection": {
1166
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1358
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1167
1359
  },
1168
1360
  "pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection": {
1169
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1361
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1170
1362
  },
1171
1363
  "pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection": {
1172
- "backgroundColor": "rgba(220, 38, 38, 0.25)"
1364
+ backgroundColor: "rgba(220, 38, 38, 0.25)"
1173
1365
  },
1174
1366
  "pre.diff-highlight > code .token.token.inserted:not(.prefix)": {
1175
- "backgroundColor": "rgba(22, 163, 74, 0.15)"
1367
+ backgroundColor: "rgba(22, 163, 74, 0.15)"
1176
1368
  },
1177
1369
  "pre > code.diff-highlight .token.token.inserted:not(.prefix)": {
1178
- "backgroundColor": "rgba(22, 163, 74, 0.15)"
1370
+ backgroundColor: "rgba(22, 163, 74, 0.15)"
1179
1371
  },
1180
1372
  "pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection": {
1181
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1373
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1182
1374
  },
1183
1375
  "pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection": {
1184
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1376
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1185
1377
  },
1186
1378
  "pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection": {
1187
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1379
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1188
1380
  },
1189
1381
  "pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection": {
1190
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1382
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1191
1383
  },
1192
1384
  "pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection": {
1193
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1385
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1194
1386
  },
1195
1387
  "pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection": {
1196
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1388
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1197
1389
  },
1198
1390
  "pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection": {
1199
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1391
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1200
1392
  },
1201
1393
  "pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection": {
1202
- "backgroundColor": "rgba(22, 163, 74, 0.25)"
1394
+ backgroundColor: "rgba(22, 163, 74, 0.25)"
1203
1395
  },
1204
1396
  ".prism-previewer.prism-previewer:before": {
1205
- "borderColor": "#fff"
1397
+ borderColor: "#fff"
1206
1398
  },
1207
1399
  ".prism-previewer-gradient.prism-previewer-gradient div": {
1208
- "borderColor": "#fff",
1209
- "borderRadius": "0.3em"
1400
+ borderColor: "#fff",
1401
+ borderRadius: "0.3em"
1210
1402
  },
1211
1403
  ".prism-previewer-color.prism-previewer-color:before": {
1212
- "borderRadius": "0.3em"
1404
+ borderRadius: "0.3em"
1213
1405
  },
1214
1406
  ".prism-previewer-easing.prism-previewer-easing:before": {
1215
- "borderRadius": "0.3em"
1407
+ borderRadius: "0.3em"
1216
1408
  },
1217
1409
  ".prism-previewer.prism-previewer:after": {
1218
- "borderTopColor": "#fff"
1410
+ borderTopColor: "#fff"
1219
1411
  },
1220
1412
  ".prism-previewer-flipped.prism-previewer-flipped.after": {
1221
- "borderBottomColor": "#fff"
1413
+ borderBottomColor: "#fff"
1222
1414
  },
1223
1415
  ".prism-previewer-angle.prism-previewer-angle:before": {
1224
- "background": "#f1f5f9"
1416
+ background: "#f1f5f9"
1225
1417
  },
1226
1418
  ".prism-previewer-time.prism-previewer-time:before": {
1227
- "background": "#f1f5f9"
1419
+ background: "#f1f5f9"
1228
1420
  },
1229
1421
  ".prism-previewer-easing.prism-previewer-easing": {
1230
- "background": "#f1f5f9"
1422
+ background: "#f1f5f9"
1231
1423
  },
1232
1424
  ".prism-previewer-angle.prism-previewer-angle circle": {
1233
- "stroke": "#1e293b",
1234
- "strokeOpacity": "1"
1425
+ stroke: "#1e293b",
1426
+ strokeOpacity: "1"
1235
1427
  },
1236
1428
  ".prism-previewer-time.prism-previewer-time circle": {
1237
- "stroke": "#1e293b",
1238
- "strokeOpacity": "1"
1429
+ stroke: "#1e293b",
1430
+ strokeOpacity: "1"
1239
1431
  },
1240
1432
  ".prism-previewer-easing.prism-previewer-easing circle": {
1241
- "stroke": "#1e293b",
1242
- "fill": "transparent"
1433
+ stroke: "#1e293b",
1434
+ fill: "transparent"
1243
1435
  },
1244
1436
  ".prism-previewer-easing.prism-previewer-easing path": {
1245
- "stroke": "#1e293b"
1437
+ stroke: "#1e293b"
1246
1438
  },
1247
1439
  ".prism-previewer-easing.prism-previewer-easing line": {
1248
- "stroke": "#1e293b"
1440
+ stroke: "#1e293b"
1249
1441
  }
1250
1442
  };
1251
1443
  const CodeHighlighter = ({
@@ -1257,7 +1449,7 @@ const CodeHighlighter = ({
1257
1449
  toolbarClassName,
1258
1450
  theme = dark
1259
1451
  }) => {
1260
- const match = language == null ? void 0 : language.match(/language-(\w+)/);
1452
+ const match = language?.match(/language-(\w+)/);
1261
1453
  const lang = match ? match[1] : "text";
1262
1454
  const handleCopy = (text) => {
1263
1455
  navigator.clipboard.writeText(text).then(() => {
@@ -1274,21 +1466,14 @@ const CodeHighlighter = ({
1274
1466
  {
1275
1467
  className: cn(copyClassName),
1276
1468
  size: "small",
1277
- variant: "text",
1469
+ variant: "ghost",
1278
1470
  title: "Copy code",
1279
1471
  onClick: () => handleCopy(children),
1280
1472
  children: copyIcon
1281
1473
  }
1282
1474
  )
1283
1475
  ] }),
1284
- /* @__PURE__ */ jsx(
1285
- Prism,
1286
- {
1287
- language: lang,
1288
- style: theme,
1289
- children
1290
- }
1291
- )
1476
+ /* @__PURE__ */ jsx(Prism, { language: lang, style: theme, children })
1292
1477
  ] });
1293
1478
  };
1294
1479
  const TableComponent = ({ children, ...props }) => /* @__PURE__ */ jsx("table", { ...props, children });
@@ -1349,29 +1534,106 @@ const Markdown = ({
1349
1534
  };
1350
1535
  const CVE_REGEX = /(CVE-(19|20)\d{2}-\d{4,7})/gi;
1351
1536
  function remarkCve() {
1352
- return (tree, _file) => {
1353
- findAndReplace(tree, [[
1354
- CVE_REGEX,
1355
- replaceCve
1356
- ]]);
1537
+ return (tree) => {
1538
+ findAndReplace(tree, [[CVE_REGEX, replaceCve]]);
1357
1539
  };
1358
1540
  function replaceCve(value, id) {
1359
1541
  return [
1360
1542
  {
1361
1543
  type: "link",
1362
1544
  url: `https://cve.mitre.org/cgi-bin/cvename.cgi?name=${id}`,
1363
- children: [
1364
- { children: [{ type: "text", value: value.trim() }] }
1365
- ]
1545
+ children: [{ children: [{ type: "text", value: value.trim() }] }]
1366
1546
  }
1367
1547
  ];
1368
1548
  }
1369
1549
  }
1550
+ const SessionEmpty = ({ children }) => {
1551
+ const { theme } = useContext(ChatContext);
1552
+ return /* @__PURE__ */ jsx("div", { className: cn(theme.empty), children });
1553
+ };
1554
+ const SvgRefresh = (props) => /* @__PURE__ */ React.createElement("svg", { width: 18, height: 18, viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React.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" }));
1555
+ const SvgThumbsDown = (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 18, height: 18, viewBox: "0 0 18 18", fill: "none", ...props }, /* @__PURE__ */ React.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" }));
1556
+ const SvgThumbsUp = (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 18, height: 18, viewBox: "0 0 18 18", fill: "none", ...props }, /* @__PURE__ */ React.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" }));
1557
+ const MessageActions = ({
1558
+ children,
1559
+ ...props
1560
+ }) => {
1561
+ const { theme } = useContext(ChatContext);
1562
+ const {
1563
+ question,
1564
+ response,
1565
+ copyIcon = /* @__PURE__ */ jsx(SvgCopy, {}),
1566
+ thumbsUpIcon = /* @__PURE__ */ jsx(SvgThumbsUp, {}),
1567
+ thumbsDownIcon = /* @__PURE__ */ jsx(SvgThumbsDown, {}),
1568
+ refreshIcon = /* @__PURE__ */ jsx(SvgRefresh, {}),
1569
+ onCopy,
1570
+ onUpvote,
1571
+ onDownvote,
1572
+ onRefresh
1573
+ } = props;
1574
+ const Comp = children ? Slot : "div";
1575
+ const handleCopy = (text) => {
1576
+ navigator.clipboard.writeText(text).then(() => {
1577
+ console.log("Text copied to clipboard");
1578
+ }).catch((err) => {
1579
+ console.error("Could not copy text: ", err);
1580
+ });
1581
+ };
1582
+ return (copyIcon || thumbsDownIcon || thumbsUpIcon || refreshIcon) && /* @__PURE__ */ jsx(Comp, { className: cn(theme.messages.message.footer.base), children: children || /* @__PURE__ */ jsxs(Fragment, { children: [
1583
+ copyIcon && /* @__PURE__ */ jsx(
1584
+ IconButton,
1585
+ {
1586
+ variant: "ghost",
1587
+ disablePadding: true,
1588
+ title: "Copy question and response",
1589
+ className: cn(theme.messages.message.footer.copy),
1590
+ onClick: onCopy ? onCopy : () => handleCopy(`${question}
1591
+ ${response}`),
1592
+ children: copyIcon
1593
+ }
1594
+ ),
1595
+ thumbsUpIcon && /* @__PURE__ */ jsx(
1596
+ IconButton,
1597
+ {
1598
+ variant: "ghost",
1599
+ disablePadding: true,
1600
+ title: "Upvote",
1601
+ className: cn(theme.messages.message.footer.upvote),
1602
+ onClick: onUpvote,
1603
+ children: thumbsUpIcon
1604
+ }
1605
+ ),
1606
+ thumbsDownIcon && /* @__PURE__ */ jsx(
1607
+ IconButton,
1608
+ {
1609
+ variant: "ghost",
1610
+ disablePadding: true,
1611
+ title: "Downvote",
1612
+ className: cn(theme.messages.message.footer.downvote),
1613
+ onClick: onDownvote,
1614
+ children: thumbsDownIcon
1615
+ }
1616
+ ),
1617
+ refreshIcon && /* @__PURE__ */ jsx(
1618
+ IconButton,
1619
+ {
1620
+ variant: "ghost",
1621
+ disablePadding: true,
1622
+ title: "Refresh",
1623
+ className: cn(theme.messages.message.footer.refresh),
1624
+ onClick: onRefresh,
1625
+ children: refreshIcon
1626
+ }
1627
+ )
1628
+ ] }) });
1629
+ };
1370
1630
  const SvgFile = (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, viewBox: "0 0 16 16", fill: "currentColor", ...props }, /* @__PURE__ */ React.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" }));
1371
- const DefaultFileRenderer = lazy(() => import("./DefaultFileRenderer-DEgyNAd4.js"));
1372
- const CSVFileRenderer = lazy(() => import("./CSVFileRenderer-CpB8ngRc.js"));
1631
+ const DefaultFileRenderer = lazy(
1632
+ () => import("./DefaultFileRenderer-CeV73ofi.js")
1633
+ );
1634
+ const CSVFileRenderer = lazy(() => import("./CSVFileRenderer-Bh5dmsTS.js"));
1373
1635
  const ImageFileRenderer = lazy(() => import("./ImageFileRenderer-C8tVW3I8.js"));
1374
- const PDFFileRenderer = lazy(() => import("./PDFFileRenderer-DQdFS2l6.js"));
1636
+ const PDFFileRenderer = lazy(() => import("./PDFFileRenderer-BBn2EVrV.js"));
1375
1637
  const FILE_TYPE_RENDERER_MAP = {
1376
1638
  "image/": ImageFileRenderer,
1377
1639
  "text/csv": CSVFileRenderer,
@@ -1386,16 +1648,10 @@ const MessageFile = ({
1386
1648
  }) => {
1387
1649
  const { theme } = useContext(ChatContext);
1388
1650
  const FileRenderer = useMemo(() => {
1389
- const Renderer = Object.keys(FILE_TYPE_RENDERER_MAP).find((key) => type == null ? void 0 : type.startsWith(key)) ?? "default";
1651
+ const Renderer = Object.keys(FILE_TYPE_RENDERER_MAP).find((key) => type?.startsWith(key)) ?? "default";
1390
1652
  return FILE_TYPE_RENDERER_MAP[Renderer] || DefaultFileRenderer;
1391
1653
  }, [type]);
1392
- return /* @__PURE__ */ jsx(
1393
- "div",
1394
- {
1395
- className: cn(theme.messages.message.files.file.base),
1396
- children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: /* @__PURE__ */ jsx(FileRenderer, { name, url, fileIcon, limit }) })
1397
- }
1398
- );
1654
+ return /* @__PURE__ */ jsx("div", { className: cn(theme.messages.message.files.file.base), children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: /* @__PURE__ */ jsx(FileRenderer, { name, url, fileIcon, limit }) }) });
1399
1655
  };
1400
1656
  const MessageFiles = ({ files, children }) => {
1401
1657
  const { theme } = useContext(ChatContext);
@@ -1527,7 +1783,12 @@ const MessageResponse = ({
1527
1783
  }
1528
1784
  );
1529
1785
  };
1530
- const MessageSource = ({ title, url, image, limit = 50 }) => {
1786
+ const MessageSource = ({
1787
+ title,
1788
+ url,
1789
+ image,
1790
+ limit = 50
1791
+ }) => {
1531
1792
  const { theme, isCompact } = useContext(ChatContext);
1532
1793
  return /* @__PURE__ */ jsxs(
1533
1794
  "figure",
@@ -1541,10 +1802,26 @@ const MessageSource = ({ title, url, image, limit = 50 }) => {
1541
1802
  }
1542
1803
  },
1543
1804
  children: [
1544
- image && /* @__PURE__ */ jsx("img", { src: image, alt: title, className: cn(theme.messages.message.sources.source.image) }),
1805
+ image && /* @__PURE__ */ jsx(
1806
+ "img",
1807
+ {
1808
+ src: image,
1809
+ alt: title,
1810
+ className: cn(theme.messages.message.sources.source.image)
1811
+ }
1812
+ ),
1545
1813
  (title || url) && /* @__PURE__ */ jsxs("figcaption", { children: [
1546
1814
  title && /* @__PURE__ */ jsx("span", { className: cn(theme.messages.message.sources.source.title), children: /* @__PURE__ */ jsx(Ellipsis, { value: title, limit }) }),
1547
- url && /* @__PURE__ */ jsx("a", { href: url, target: "_blank", rel: "noopener noreferrer", className: cn(theme.messages.message.sources.source.url), children: url })
1815
+ url && /* @__PURE__ */ jsx(
1816
+ "a",
1817
+ {
1818
+ href: url,
1819
+ target: "_blank",
1820
+ rel: "noopener noreferrer",
1821
+ className: cn(theme.messages.message.sources.source.url),
1822
+ children: url
1823
+ }
1824
+ )
1548
1825
  ] })
1549
1826
  ]
1550
1827
  }
@@ -1561,82 +1838,6 @@ const MessageSources = ({
1561
1838
  }
1562
1839
  return sources && sources.length > 0 && /* @__PURE__ */ jsx("div", { className: cn(theme.messages.message.sources.base), children: sources.map((source, index) => /* @__PURE__ */ jsx(Comp, { ...source, children }, index)) });
1563
1840
  };
1564
- const SvgThumbsDown = (props) => /* @__PURE__ */ React.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.createElement("path", { d: "M17 14V2" }), /* @__PURE__ */ React.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" }));
1565
- const SvgThumbsUp = (props) => /* @__PURE__ */ React.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.createElement("path", { d: "M7 10v12" }), /* @__PURE__ */ React.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" }));
1566
- const SvgRefresh = (props) => /* @__PURE__ */ React.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.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.createElement("path", { d: "M3 3v5h5" }), /* @__PURE__ */ React.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.createElement("path", { d: "M16 16h5v5" }));
1567
- const MessageActions = ({
1568
- children,
1569
- ...props
1570
- }) => {
1571
- const { theme } = useContext(ChatContext);
1572
- const {
1573
- question,
1574
- response,
1575
- copyIcon = /* @__PURE__ */ jsx(SvgCopy, {}),
1576
- thumbsUpIcon = /* @__PURE__ */ jsx(SvgThumbsUp, {}),
1577
- thumbsDownIcon = /* @__PURE__ */ jsx(SvgThumbsDown, {}),
1578
- refreshIcon = /* @__PURE__ */ jsx(SvgRefresh, {}),
1579
- onCopy,
1580
- onUpvote,
1581
- onDownvote,
1582
- onRefresh
1583
- } = props;
1584
- const Comp = children ? Slot : "div";
1585
- const handleCopy = (text) => {
1586
- navigator.clipboard.writeText(text).then(() => {
1587
- console.log("Text copied to clipboard");
1588
- }).catch((err) => {
1589
- console.error("Could not copy text: ", err);
1590
- });
1591
- };
1592
- return (copyIcon || thumbsDownIcon || thumbsUpIcon || refreshIcon) && /* @__PURE__ */ jsx(Comp, { className: cn(theme.messages.message.footer.base), children: children || /* @__PURE__ */ jsxs(Fragment, { children: [
1593
- copyIcon && /* @__PURE__ */ jsx(
1594
- IconButton,
1595
- {
1596
- variant: "text",
1597
- disablePadding: true,
1598
- title: "Copy question and response",
1599
- className: cn(theme.messages.message.footer.copy),
1600
- onClick: onCopy ? onCopy : () => handleCopy(`${question}
1601
- ${response}`),
1602
- children: copyIcon
1603
- }
1604
- ),
1605
- thumbsUpIcon && /* @__PURE__ */ jsx(
1606
- IconButton,
1607
- {
1608
- variant: "text",
1609
- disablePadding: true,
1610
- title: "Upvote",
1611
- className: cn(theme.messages.message.footer.upvote),
1612
- onClick: onUpvote,
1613
- children: thumbsUpIcon
1614
- }
1615
- ),
1616
- thumbsDownIcon && /* @__PURE__ */ jsx(
1617
- IconButton,
1618
- {
1619
- variant: "text",
1620
- disablePadding: true,
1621
- title: "Downvote",
1622
- className: cn(theme.messages.message.footer.downvote),
1623
- onClick: onDownvote,
1624
- children: thumbsDownIcon
1625
- }
1626
- ),
1627
- refreshIcon && /* @__PURE__ */ jsx(
1628
- IconButton,
1629
- {
1630
- variant: "text",
1631
- disablePadding: true,
1632
- title: "Refresh",
1633
- className: cn(theme.messages.message.footer.refresh),
1634
- onClick: onRefresh,
1635
- children: refreshIcon
1636
- }
1637
- )
1638
- ] }) });
1639
- };
1640
1841
  const messageVariants = {
1641
1842
  hidden: {
1642
1843
  opacity: 0,
@@ -1658,7 +1859,13 @@ const SessionMessage = ({
1658
1859
  const { theme, isLoading } = useContext(ChatContext);
1659
1860
  return /* @__PURE__ */ jsxs(motion.div, { variants: messageVariants, children: [
1660
1861
  /* @__PURE__ */ jsx(Card, { className: cn(theme.messages.message.base), children: children || /* @__PURE__ */ jsxs(Fragment, { children: [
1661
- /* @__PURE__ */ jsx(MessageQuestion, { question: conversation.question, files: conversation.files }),
1862
+ /* @__PURE__ */ jsx(
1863
+ MessageQuestion,
1864
+ {
1865
+ question: conversation.question,
1866
+ files: conversation.files
1867
+ }
1868
+ ),
1662
1869
  /* @__PURE__ */ jsx(
1663
1870
  MessageResponse,
1664
1871
  {
@@ -1678,45 +1885,90 @@ const SessionMessage = ({
1678
1885
  !isLast && /* @__PURE__ */ jsx(Divider, {})
1679
1886
  ] }, conversation.id);
1680
1887
  };
1681
- const containerVariants = {
1682
- hidden: {},
1683
- visible: {
1684
- transition: {
1685
- staggerChildren: 0.07,
1686
- when: "beforeChildren"
1687
- }
1688
- }
1689
- };
1690
- const SessionMessages = ({
1888
+ const SvgBack = (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 50 50", width: "24px", height: "24px", ...props }, /* @__PURE__ */ React.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" }));
1889
+ const SessionMessagePanel = ({
1691
1890
  children,
1692
- newSessionContent,
1693
- limit = 10,
1694
- showMoreText = "Show more"
1891
+ allowBack = true
1695
1892
  }) => {
1696
- const { activeSession, theme } = useContext(ChatContext);
1697
- const contentRef = useRef(null);
1698
- const [isAnimating, setIsAnimating] = useState(true);
1699
- useEffect(() => {
1700
- if (contentRef.current) {
1701
- requestAnimationFrame(
1702
- () => contentRef.current.scrollTop = contentRef.current.scrollHeight
1703
- );
1704
- }
1705
- }, [activeSession, isAnimating]);
1706
- function handleShowMore() {
1707
- showNext(limit);
1708
- requestAnimationFrame(() => contentRef.current.scrollTop = 0);
1709
- }
1710
- const reversedConvos = useMemo(
1711
- () => [...(activeSession == null ? void 0 : activeSession.conversations) ?? []].reverse(),
1712
- [activeSession]
1893
+ const { activeSessionId, theme, isCompact, selectSession, viewType } = useContext(ChatContext);
1894
+ const isVisible = isCompact && activeSessionId || viewType === "chat" || !isCompact;
1895
+ return isVisible && /* @__PURE__ */ jsx(
1896
+ motion.div,
1897
+ {
1898
+ initial: { translateX: "200%" },
1899
+ animate: {
1900
+ translateX: "0%",
1901
+ transition: {
1902
+ type: "tween",
1903
+ ease: "linear",
1904
+ duration: 0.2,
1905
+ when: "beforeChildren"
1906
+ }
1907
+ },
1908
+ exit: { translateX: "200%" },
1909
+ className: cn(theme.messages.base, {
1910
+ [theme.messages.companion]: isCompact,
1911
+ [theme.messages.console]: !isCompact
1912
+ }),
1913
+ children: /* @__PURE__ */ jsxs("div", { className: cn(theme.messages.inner), children: [
1914
+ allowBack && isCompact && viewType !== "chat" && /* @__PURE__ */ jsxs(
1915
+ Button,
1916
+ {
1917
+ variant: "text",
1918
+ size: "small",
1919
+ onClick: () => selectSession(null),
1920
+ className: cn(theme.messages.back),
1921
+ children: [
1922
+ /* @__PURE__ */ jsx(SvgBack, {}),
1923
+ "Back"
1924
+ ]
1925
+ }
1926
+ ),
1927
+ children
1928
+ ] })
1929
+ }
1930
+ );
1931
+ };
1932
+ const containerVariants = {
1933
+ hidden: {},
1934
+ visible: {
1935
+ transition: {
1936
+ staggerChildren: 0.07,
1937
+ when: "beforeChildren"
1938
+ }
1939
+ }
1940
+ };
1941
+ const SessionMessages = ({
1942
+ children,
1943
+ newSessionContent,
1944
+ limit = 10,
1945
+ showMoreText = "Show more",
1946
+ autoScroll = true
1947
+ }) => {
1948
+ const { activeSession, theme } = useContext(ChatContext);
1949
+ const contentRef = useRef(null);
1950
+ const [isAnimating, setIsAnimating] = useState(true);
1951
+ useEffect(() => {
1952
+ if (contentRef.current && autoScroll) {
1953
+ requestAnimationFrame(
1954
+ () => contentRef.current.scrollTop = contentRef.current.scrollHeight
1955
+ );
1956
+ }
1957
+ }, [activeSession, autoScroll, isAnimating]);
1958
+ function handleShowMore() {
1959
+ showNext(limit);
1960
+ requestAnimationFrame(() => contentRef.current.scrollTop = 0);
1961
+ }
1962
+ const reversedConvos = useMemo(
1963
+ () => [...activeSession?.conversations ?? []].reverse(),
1964
+ [activeSession]
1713
1965
  );
1714
1966
  const { data, hasMore, showNext } = useInfinityList({
1715
1967
  items: reversedConvos,
1716
1968
  size: limit
1717
1969
  });
1718
1970
  const reReversedConvo = useMemo(() => [...data].reverse(), [data]);
1719
- const convosToRender = limit ? reReversedConvo : activeSession == null ? void 0 : activeSession.conversations;
1971
+ const convosToRender = limit ? reReversedConvo : activeSession?.conversations;
1720
1972
  if (!activeSession) {
1721
1973
  return /* @__PURE__ */ jsx(SessionEmpty, { children: newSessionContent });
1722
1974
  }
@@ -1749,336 +2001,26 @@ const SessionMessages = ({
1749
2001
  conversation.id
1750
2002
  ))
1751
2003
  },
1752
- activeSession == null ? void 0 : activeSession.id
2004
+ activeSession?.id
1753
2005
  ) })
1754
2006
  ] });
1755
2007
  };
1756
- const chatTheme = {
1757
- base: "dark:text-white text-gray-500",
1758
- console: "flex w-full gap-4 h-full",
1759
- companion: "w-full h-full overflow-hidden",
1760
- empty: "text-center flex-1",
1761
- appbar: "flex p-5",
1762
- sessions: {
1763
- base: "overflow-auto",
1764
- console: "min-w-[150px] w-[30%] max-w-[300px] dark:bg-[#11111F] bg-[#F2F3F7] p-5 rounded-3xl",
1765
- companion: "w-full h-full",
1766
- group: "text-xs dart:text-gray-400 text-gray-700 mt-4 hover:bg-transparent mb-1",
1767
- create: "relative mb-4 rounded-[10px] text-white",
1768
- session: {
1769
- base: [
1770
- "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",
1771
- "dark:text-typography dark:text-gray-400 dark:hover:bg-gray-800/50 dark:hover:border-gray-700/50 dark:[&_svg]:text-gray-200"
1772
- ].join(" "),
1773
- active: [
1774
- "border border-gray-300 hover:border-gray-400 text-gray-700 bg-gray-200 hover:bg-gray-300 ",
1775
- "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",
1776
- "[&_button]:opacity-100!"
1777
- ].join(" "),
1778
- delete: "[&>svg]:w-4 [&>svg]:h-4 opacity-0 group-hover:opacity-50!"
1779
- }
1780
- },
1781
- messages: {
1782
- base: "",
1783
- console: "flex flex-col mx-5 flex-1 overflow-hidden",
1784
- companion: "flex w-full h-full",
1785
- back: "self-start p-0 my-2",
1786
- inner: "flex-1 h-full flex flex-col",
1787
- title: ["text-base font-bold text-gray-500", "dark:text-gray-200"].join(
1788
- " "
1789
- ),
1790
- date: "text-xs whitespace-nowrap text-gray-400",
1791
- content: [
1792
- "mt-2 flex-1 overflow-auto [&_hr]:bg-gray-200",
1793
- "dark:[&_hr]:bg-gray-800/60"
1794
- ].join(" "),
1795
- header: "flex justify-between items-center gap-2",
1796
- showMore: "mb-4",
1797
- message: {
1798
- base: "mt-4 mb-4 flex flex-col p-0 rounded-sm border-none bg-transparent",
1799
- question: [
1800
- "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",
1801
- "dark:bg-gray-900/60 dark:border-gray-700/50 dark:text-gray-100"
1802
- ].join(" "),
1803
- response: [
1804
- "relative data-[compact=false]:px-4 text-gray-900",
1805
- "dark:text-gray-100"
1806
- ].join(" "),
1807
- 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",
1808
- cursor: "inline-block w-1 h-4 bg-current",
1809
- expand: "absolute bottom-1 right-1 z-10",
1810
- files: {
1811
- base: "mb-2 flex flex-wrap gap-3 ",
1812
- file: {
1813
- base: [
1814
- "flex items-center gap-2 border border-gray-300 px-3 py-2 rounded-lg cursor-pointer",
1815
- "dark:border-gray-700"
1816
- ].join(" "),
1817
- name: ["text-sm text-gray-500", "dark:text-gray-200"].join(" ")
1818
- }
1819
- },
1820
- sources: {
1821
- base: "my-4 flex flex-wrap gap-3",
1822
- source: {
1823
- base: [
1824
- "flex gap-2 border border-gray-200 px-4 py-2 rounded-lg cursor-pointer",
1825
- "dark:border-gray-700"
1826
- ].join(" "),
1827
- companion: "flex-1 px-3 py-1.5",
1828
- image: "max-w-10 max-h-10 rounded-md w-full h-fit self-center",
1829
- title: "text-md block",
1830
- url: "text-sm text-blue-400 underline"
1831
- }
1832
- },
1833
- markdown: {
1834
- copy: "sticky py-1 [&>svg]:w-4 [&>svg]:h-4 opacity-50",
1835
- p: "mb-2",
1836
- a: "text-blue-400 underline",
1837
- table: "table-auto w-full m-2",
1838
- th: "px-4 py-2 text-left font-bold border-b border-gray-500",
1839
- td: "px-4 py-2",
1840
- code: "m-2 rounded-b relative",
1841
- 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 ",
1842
- li: "mb-2 ml-6",
1843
- ul: "mb-4 list-disc",
1844
- ol: "mb-4 list-decimal"
1845
- },
1846
- footer: {
1847
- base: "mt-3 flex gap-1.5",
1848
- copy: [
1849
- "p-3 rounded-[10px] [&>svg]:w-4 [&>svg]:h-4 opacity-50 hover:opacity-100! hover:bg-gray-200 hover:text-gray-500",
1850
- "dark:hover:bg-gray-800 dark:hover:text-white text-gray-400"
1851
- ].join(" "),
1852
- 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",
1853
- 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",
1854
- 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"
1855
- }
1856
- }
1857
- },
1858
- input: {
1859
- base: "flex mt-4 relative",
1860
- upload: ["px-5 py-2 text-gray-400 size-10", "dark:gray-500"].join(" "),
1861
- input: [
1862
- "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",
1863
- "dark:border-gray-700/50 dark:text-gray-200 dark:bg-gray-950 dark:hover:bg-blue-950/40"
1864
- ].join(" "),
1865
- actions: {
1866
- base: "absolute flex gap-2 items-center right-5 inset-y-1/2 -translate-y-1/2 z-10",
1867
- send: [
1868
- "px-3 py-3 hover:bg-primary-hover rounded-full bg-gray-200 hover:bg-gray-300 text-gray-500",
1869
- "dark:text-white light:text-gray-500 dark:bg-gray-800 dark:hover:bg-gray-700"
1870
- ].join(" "),
1871
- stop: "px-2 py-2 bg-red-500 text-white rounded-full hover:bg-red-700 "
1872
- }
2008
+ const SessionMessagesHeader = ({ children }) => {
2009
+ const { activeSession, theme } = useContext(ChatContext);
2010
+ const Comp = children ? Slot : "header";
2011
+ if (!activeSession) {
2012
+ return null;
1873
2013
  }
1874
- };
1875
- const useDimensions = () => {
1876
- const [ref, setRef] = useState(null);
1877
- const [width, setWidth] = useState(void 0);
1878
- const observe = useCallback((element) => {
1879
- if (element) setRef(element);
1880
- }, []);
1881
- useEffect(() => {
1882
- if (!ref) return;
1883
- const resizeObserver = new ResizeObserver((entries) => {
1884
- for (let entry of entries) {
1885
- setWidth(entry.contentRect.width);
1886
- }
1887
- });
1888
- resizeObserver.observe(ref);
1889
- return () => {
1890
- resizeObserver.disconnect();
1891
- };
1892
- }, [ref]);
1893
- return { width, observe };
1894
- };
1895
- const Chat = ({
1896
- children,
1897
- viewType = "console",
1898
- sessions,
1899
- onSelectSession,
1900
- onDeleteSession,
1901
- onSendMessage,
1902
- onStopMessage,
1903
- onFileUpload,
1904
- isLoading,
1905
- activeSessionId,
1906
- theme = chatTheme,
1907
- onNewSession,
1908
- remarkPlugins = [remarkGfm, remarkYoutube, remarkMath],
1909
- disabled,
1910
- style,
1911
- className
1912
- }) => {
1913
- const [internalActiveSessionID, setInternalActiveSessionID] = useState(activeSessionId);
1914
- const { width, observe } = useDimensions();
1915
- const isCompact = viewType === "companion" || width && width < 767;
1916
- useEffect(() => {
1917
- setInternalActiveSessionID(activeSessionId);
1918
- }, [activeSessionId]);
1919
- const handleSelectSession = useCallback(
1920
- (sessionId) => {
1921
- setInternalActiveSessionID(sessionId);
1922
- onSelectSession == null ? void 0 : onSelectSession(sessionId);
1923
- },
1924
- [onSelectSession]
1925
- );
1926
- const handleDeleteSession = useCallback(
1927
- (sessionId) => {
1928
- setInternalActiveSessionID(void 0);
1929
- onDeleteSession == null ? void 0 : onDeleteSession(sessionId);
1930
- },
1931
- [onDeleteSession]
1932
- );
1933
- const handleCreateNewSession = useCallback(() => {
1934
- setInternalActiveSessionID(void 0);
1935
- onNewSession == null ? void 0 : onNewSession();
1936
- }, [onNewSession]);
1937
- useHotkeys([
1938
- {
1939
- name: "Create new session",
1940
- category: "Chat",
1941
- keys: "meta+shift+s",
1942
- callback: (event) => {
1943
- event.preventDefault();
1944
- handleCreateNewSession();
2014
+ return /* @__PURE__ */ jsx(Comp, { className: cn(theme.messages.header), children: children || /* @__PURE__ */ jsxs(Fragment, { children: [
2015
+ /* @__PURE__ */ jsx("h2", { className: cn(theme.messages.title), children: /* @__PURE__ */ jsx(Ellipsis, { limit: 125, value: activeSession.title }) }),
2016
+ /* @__PURE__ */ jsx(
2017
+ DateFormat,
2018
+ {
2019
+ className: cn(theme.messages.date),
2020
+ date: activeSession.createdAt
1945
2021
  }
1946
- }
1947
- ]);
1948
- const activeSession = useMemo(
1949
- () => sessions.find((session) => session.id === internalActiveSessionID),
1950
- [sessions, internalActiveSessionID]
1951
- );
1952
- const contextValue = useMemo(
1953
- () => ({
1954
- sessions,
1955
- activeSession,
1956
- remarkPlugins,
1957
- theme,
1958
- disabled,
1959
- isLoading,
1960
- isCompact,
1961
- viewType,
1962
- activeSessionId: internalActiveSessionID,
1963
- selectSession: handleSelectSession,
1964
- deleteSession: handleDeleteSession,
1965
- createSession: handleCreateNewSession,
1966
- sendMessage: onSendMessage,
1967
- stopMessage: onStopMessage,
1968
- fileUpload: onFileUpload
1969
- }),
1970
- [
1971
- isLoading,
1972
- isCompact,
1973
- viewType,
1974
- disabled,
1975
- theme,
1976
- remarkPlugins,
1977
- sessions,
1978
- activeSession,
1979
- internalActiveSessionID,
1980
- handleSelectSession,
1981
- handleDeleteSession,
1982
- handleCreateNewSession,
1983
- onSendMessage,
1984
- onStopMessage,
1985
- onFileUpload
1986
- ]
1987
- );
1988
- return /* @__PURE__ */ jsx(ChatContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: /* @__PURE__ */ jsx(
1989
- "div",
1990
- {
1991
- ref: observe,
1992
- className: cn(className, theme.base, {
1993
- [theme.companion]: isCompact,
1994
- [theme.console]: !isCompact
1995
- }),
1996
- style,
1997
- children
1998
- }
1999
- ) }) });
2000
- };
2001
- const SvgTrash = (props) => /* @__PURE__ */ React.createElement("svg", { width: 14, height: 14, viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React.createElement("g", { id: "Delete" }, /* @__PURE__ */ React.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" })));
2002
- const SvgChat = (props) => /* @__PURE__ */ React.createElement("svg", { width: 16, height: 17, viewBox: "0 0 16 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React.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" }));
2003
- const SessionListItem = ({
2004
- children,
2005
- session,
2006
- deletable = true,
2007
- limit = 100,
2008
- deleteIcon = /* @__PURE__ */ jsx(SvgTrash, {}),
2009
- chatIcon = /* @__PURE__ */ jsx(SvgChat, { className: "mr-2" })
2010
- }) => {
2011
- const { activeSessionId, selectSession, deleteSession, theme } = useContext(ChatContext);
2012
- const Comp = children ? Slot : ListItem;
2013
- return /* @__PURE__ */ jsx(
2014
- Comp,
2015
- {
2016
- dense: true,
2017
- disableGutters: true,
2018
- active: session.id === activeSessionId,
2019
- className: cn(theme.sessions.session.base, {
2020
- [theme.sessions.session.active]: session.id === activeSessionId
2021
- }),
2022
- onClick: () => selectSession == null ? void 0 : selectSession(session.id),
2023
- start: chatIcon,
2024
- end: /* @__PURE__ */ jsx(Fragment, { children: deletable && /* @__PURE__ */ jsx(
2025
- IconButton,
2026
- {
2027
- size: "small",
2028
- variant: "text",
2029
- onClick: (e) => {
2030
- e.stopPropagation();
2031
- deleteSession(session.id);
2032
- },
2033
- className: cn(theme.sessions.session.delete),
2034
- children: deleteIcon
2035
- }
2036
- ) }),
2037
- children: children || /* @__PURE__ */ jsx(Ellipsis, { value: session.title, limit })
2038
- }
2039
- );
2040
- };
2041
- const SessionsList = ({
2042
- children,
2043
- templates
2044
- }) => {
2045
- const { theme, isCompact, activeSessionId, createSession } = useContext(ChatContext);
2046
- const isVisible = isCompact && !activeSessionId;
2047
- return (!isCompact || isVisible) && /* @__PURE__ */ jsxs(
2048
- motion.div,
2049
- {
2050
- initial: { translateX: "-100%" },
2051
- animate: {
2052
- translateX: "0%",
2053
- transition: {
2054
- type: "tween",
2055
- ease: "linear",
2056
- duration: 0.2,
2057
- when: "beforeChildren"
2058
- }
2059
- },
2060
- exit: { translateX: "-100%" },
2061
- className: cn(theme.sessions.base, {
2062
- [theme.sessions.companion]: isCompact,
2063
- [theme.sessions.console]: !isCompact
2064
- }),
2065
- children: [
2066
- /* @__PURE__ */ jsx(List, { children }),
2067
- templates && !activeSessionId && /* @__PURE__ */ jsx("div", { className: "mt-4", children: templates.map((template) => /* @__PURE__ */ jsx("div", { onClick: () => createSession == null ? void 0 : createSession(), children: /* @__PURE__ */ jsx(
2068
- SessionListItem,
2069
- {
2070
- session: {
2071
- id: template.id,
2072
- title: template.title,
2073
- conversations: []
2074
- },
2075
- chatIcon: template.icon,
2076
- deletable: false
2077
- }
2078
- ) }, template.id)) })
2079
- ]
2080
- }
2081
- );
2022
+ )
2023
+ ] }) });
2082
2024
  };
2083
2025
  const SvgPlus = (props) => /* @__PURE__ */ React.createElement("svg", { width: 17, height: 17, viewBox: "0 0 17 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React.createElement("g", { id: "add" }, /* @__PURE__ */ React.createElement("path", { id: "Vector", d: "M13.1667 9.16658H9.16671V13.1666H7.83337V9.16658H3.83337V7.83325H7.83337V3.83325H9.16671V7.83325H13.1667V9.16658Z", fill: "currentColor" })));
2084
2026
  const NewSessionButton = ({
@@ -2164,6 +2106,46 @@ function groupSessionsByDate(sessions) {
2164
2106
  )
2165
2107
  }));
2166
2108
  }
2109
+ const SvgChat = (props) => /* @__PURE__ */ React.createElement("svg", { width: 16, height: 17, viewBox: "0 0 16 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React.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" }));
2110
+ const SvgTrash = (props) => /* @__PURE__ */ React.createElement("svg", { width: 14, height: 14, viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React.createElement("g", { id: "Delete" }, /* @__PURE__ */ React.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" })));
2111
+ const SessionListItem = ({
2112
+ children,
2113
+ session,
2114
+ deletable = true,
2115
+ limit = 100,
2116
+ deleteIcon = /* @__PURE__ */ jsx(SvgTrash, {}),
2117
+ chatIcon = /* @__PURE__ */ jsx(SvgChat, { className: "mr-2" })
2118
+ }) => {
2119
+ const { activeSessionId, selectSession, deleteSession, theme } = useContext(ChatContext);
2120
+ const Comp = children ? Slot : ListItem;
2121
+ return /* @__PURE__ */ jsx(
2122
+ Comp,
2123
+ {
2124
+ dense: true,
2125
+ disableGutters: true,
2126
+ active: session.id === activeSessionId,
2127
+ className: cn(theme.sessions.session.base, {
2128
+ [theme.sessions.session.active]: session.id === activeSessionId
2129
+ }),
2130
+ onClick: () => selectSession?.(session.id),
2131
+ start: chatIcon,
2132
+ end: /* @__PURE__ */ jsx(Fragment, { children: deletable && /* @__PURE__ */ jsx(
2133
+ IconButton,
2134
+ {
2135
+ size: "small",
2136
+ variant: "ghost",
2137
+ onClick: (e) => {
2138
+ e.stopPropagation();
2139
+ deleteSession(session.id);
2140
+ },
2141
+ className: cn(theme.sessions.session.delete),
2142
+ children: deleteIcon
2143
+ }
2144
+ ) }),
2145
+ children: children || /* @__PURE__ */ jsx(Ellipsis, { value: session.title, limit })
2146
+ }
2147
+ );
2148
+ };
2167
2149
  const SessionsGroup = ({
2168
2150
  heading,
2169
2151
  children
@@ -2185,80 +2167,84 @@ const SessionsGroup = ({
2185
2167
  const SessionGroups = ({ children }) => {
2186
2168
  const { sessions } = useContext(ChatContext);
2187
2169
  const groups = useMemo(() => groupSessionsByDate(sessions), [sessions]);
2188
- return /* @__PURE__ */ jsx(Fragment, { children: children ? children(groups) : groups.map(({ heading, sessions: sessions2 }) => /* @__PURE__ */ jsx(SessionsGroup, { heading, children: sessions2.map((session) => /* @__PURE__ */ jsx(SessionListItem, { session }, session.id)) })) });
2170
+ return /* @__PURE__ */ jsx(Fragment, { children: children ? children(groups) : groups.map(({ heading, sessions: sessions2 }) => /* @__PURE__ */ jsx(SessionsGroup, { heading, children: sessions2.map((session) => /* @__PURE__ */ jsx(SessionListItem, { session }, session.id)) }, heading)) });
2189
2171
  };
2190
- const AppBar = ({ content, theme = chatTheme }) => {
2191
- return /* @__PURE__ */ jsx("div", { className: cn(theme.appbar), children: content });
2192
- };
2193
- const ChatBubble = memo(
2194
- ({
2195
- children,
2196
- bubbleContent,
2197
- position = "right-end",
2198
- modifiers = [offset({ mainAxis: 0, crossAxis: -40 })],
2199
- className
2200
- }) => {
2201
- const [isOpen, setIsOpen] = useState(false);
2202
- const ref = useRef(null);
2203
- return /* @__PURE__ */ jsxs(Fragment, { children: [
2204
- /* @__PURE__ */ jsx(
2205
- ConnectedOverlay,
2206
- {
2207
- placement: position,
2208
- modifiers,
2209
- reference: ref.current,
2210
- open: isOpen,
2211
- onOpen: () => setIsOpen(true),
2212
- onClose: () => setIsOpen(false),
2213
- content: () => /* @__PURE__ */ jsx(Fragment, { children })
2214
- }
2215
- ),
2216
- /* @__PURE__ */ jsx(
2217
- "div",
2218
- {
2219
- ref,
2220
- className,
2221
- onClick: () => setIsOpen((prev) => !prev),
2222
- children: bubbleContent
2172
+ const SessionsList = ({
2173
+ children,
2174
+ templates
2175
+ }) => {
2176
+ const { theme, isCompact, activeSessionId, createSession } = useContext(ChatContext);
2177
+ const isVisible = isCompact && !activeSessionId;
2178
+ return (!isCompact || isVisible) && /* @__PURE__ */ jsxs(
2179
+ motion.div,
2180
+ {
2181
+ initial: { translateX: "-100%" },
2182
+ animate: {
2183
+ translateX: "0%",
2184
+ transition: {
2185
+ type: "tween",
2186
+ ease: "linear",
2187
+ duration: 0.2,
2188
+ when: "beforeChildren"
2223
2189
  }
2224
- )
2225
- ] });
2226
- }
2227
- );
2190
+ },
2191
+ exit: { translateX: "-100%" },
2192
+ className: cn(theme.sessions.base, {
2193
+ [theme.sessions.companion]: isCompact,
2194
+ [theme.sessions.console]: !isCompact
2195
+ }),
2196
+ children: [
2197
+ /* @__PURE__ */ jsx(List, { children }),
2198
+ templates && !activeSessionId && /* @__PURE__ */ jsx("div", { className: "mt-4", children: templates.map((template) => /* @__PURE__ */ jsx("div", { onClick: () => createSession?.(), children: /* @__PURE__ */ jsx(
2199
+ SessionListItem,
2200
+ {
2201
+ session: {
2202
+ id: template.id,
2203
+ title: template.title,
2204
+ conversations: []
2205
+ },
2206
+ chatIcon: template.icon,
2207
+ deletable: false
2208
+ }
2209
+ ) }, template.id)) })
2210
+ ]
2211
+ }
2212
+ );
2213
+ };
2228
2214
  export {
2229
2215
  AppBar as A,
2230
- ChatBubble as B,
2231
- ChatInput as C,
2216
+ chatTheme as B,
2217
+ ChatContext as C,
2232
2218
  FileInput as F,
2233
- MessageSource as M,
2219
+ Markdown as M,
2234
2220
  NewSessionButton as N,
2235
2221
  SvgFile as S,
2236
2222
  TableComponent as T,
2237
2223
  SvgCopy as a,
2238
- SessionEmpty as b,
2239
- SessionMessagesHeader as c,
2240
- SessionMessagePanel as d,
2241
- SessionMessage as e,
2242
- MessageActions as f,
2243
- MessageFile as g,
2244
- MessageFiles as h,
2245
- MessageQuestion as i,
2246
- MessageResponse as j,
2247
- MessageSources as k,
2248
- SessionMessages as l,
2249
- Chat as m,
2250
- SessionsList as n,
2251
- SessionListItem as o,
2252
- SessionGroups as p,
2253
- SessionsGroup as q,
2254
- chatTheme as r,
2255
- Markdown as s,
2256
- TableHeaderCell as t,
2257
- TableDataCell as u,
2258
- CodeHighlighter as v,
2259
- remarkCve as w,
2260
- dark as x,
2261
- light as y,
2262
- ChatContext as z
2224
+ Chat as b,
2225
+ ChatBubble as c,
2226
+ ChatInput as d,
2227
+ CodeHighlighter as e,
2228
+ TableHeaderCell as f,
2229
+ TableDataCell as g,
2230
+ dark as h,
2231
+ SessionEmpty as i,
2232
+ MessageActions as j,
2233
+ MessageFile as k,
2234
+ light as l,
2235
+ MessageFiles as m,
2236
+ MessageQuestion as n,
2237
+ MessageResponse as o,
2238
+ MessageSource as p,
2239
+ MessageSources as q,
2240
+ remarkCve as r,
2241
+ SessionMessage as s,
2242
+ SessionMessagePanel as t,
2243
+ SessionMessages as u,
2244
+ SessionMessagesHeader as v,
2245
+ SessionGroups as w,
2246
+ SessionListItem as x,
2247
+ SessionsGroup as y,
2248
+ SessionsList as z
2263
2249
  };
2264
- //# sourceMappingURL=index-DVFyp_Cz.js.map
2250
+ //# sourceMappingURL=index-nY4fLD9h.js.map