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