@arbidocs/react 0.4.2 → 0.4.4
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/README.md +24 -0
- package/dist/{chunk-3CLGHHME.js → chunk-MIJRORQL.js} +395 -313
- package/dist/chunk-MIJRORQL.js.map +1 -0
- package/dist/{chunk-OU2QLIKS.cjs → chunk-ORKGCXG3.cjs} +444 -361
- package/dist/chunk-ORKGCXG3.cjs.map +1 -0
- package/dist/index.cjs +990 -1337
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1820 -291
- package/dist/index.d.ts +1820 -291
- package/dist/index.js +743 -1123
- package/dist/index.js.map +1 -1
- package/dist/ui/index.cjs +126 -126
- package/dist/ui/index.d.cts +12 -12
- package/dist/ui/index.d.ts +12 -12
- package/dist/ui/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-3CLGHHME.js.map +0 -1
- package/dist/chunk-OU2QLIKS.cjs.map +0 -1
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { cn, getCollisionPadding, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuLabel, DropdownMenuItem, DropdownMenuSeparator } from './chunk-6ALMBER7.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import React__default, { createContext, forwardRef, memo, useContext, useState, useRef, useEffect, useMemo, useCallback, useId, Fragment as Fragment$1 } from 'react';
|
|
4
|
+
import { createPortal } from 'react-dom';
|
|
2
5
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import * as React2 from 'react';
|
|
4
|
-
import React2__default, { createContext, forwardRef, memo, useMemo, useContext, useState, useRef, useEffect, useCallback, useId, Fragment as Fragment$1 } from 'react';
|
|
5
|
-
import Markdown from 'react-markdown';
|
|
6
|
-
import remarkGfm from 'remark-gfm';
|
|
7
|
-
import rehypeRaw from 'rehype-raw';
|
|
8
6
|
import { Circle, Check, X, ChevronDown, ChevronUp, Search, MessageCircleMore, Loader2, Square, Mic, MoreVertical, Copy, MessageSquareLock, Info, FileQuestion, BookOpen, Upload, LogOut, LayoutGrid, Bell, MessageSquare, CircleUserRound, Wrench, CreditCard, ClipboardList, UserPlus, UserStar, Settings2, Users, User, NotebookPen, NotebookText, StickyNote, FolderPlus, Hash, EyeOff, Eye, CaptionsOff, FolderOpen, MessageSquareMore, MessageSquarePlus, MessageSquareText, MessageSquareOff, MessagesSquare, Columns3Cog, SquarePlus, SquareM, ChevronsDown, Bot, Calendar, Folder, List, SquareCheckBig, ChevronsUpDown, Minus, Plus, AlertTriangle, FileX, SkipForward, XCircle, CheckCircle } from 'lucide-react';
|
|
9
|
-
import { createPortal } from 'react-dom';
|
|
10
7
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
11
8
|
import { cva } from 'class-variance-authority';
|
|
12
9
|
import { Slot } from '@radix-ui/react-slot';
|
|
@@ -25,263 +22,55 @@ import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
|
25
22
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
26
23
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
27
24
|
import { Command as Command$1 } from 'cmdk';
|
|
25
|
+
import Markdown from 'react-markdown';
|
|
26
|
+
import remarkGfm from 'remark-gfm';
|
|
27
|
+
import rehypeRaw from 'rehype-raw';
|
|
28
28
|
|
|
29
|
-
var
|
|
30
|
-
h1: ({ children, ...props }) => /* @__PURE__ */ jsx("h1", { className: "text-lg font-semibold", "data-testid": "markdown-heading-1", ...props, children }),
|
|
31
|
-
h2: ({ children, ...props }) => /* @__PURE__ */ jsx("h2", { className: "font-semibold text-base", "data-testid": "markdown-heading-2", ...props, children }),
|
|
32
|
-
h3: ({ children, ...props }) => /* @__PURE__ */ jsx("h3", { className: "font-semibold text-base", "data-testid": "markdown-heading-3", ...props, children }),
|
|
33
|
-
h4: ({ children, ...props }) => /* @__PURE__ */ jsx("h4", { className: "font-semibold text-base", ...props, children }),
|
|
34
|
-
h5: ({ children, ...props }) => /* @__PURE__ */ jsx("h5", { className: "font-medium", ...props, children }),
|
|
35
|
-
strong: ({ children, ...props }) => /* @__PURE__ */ jsx("strong", { className: "font-semibold", ...props, children }),
|
|
36
|
-
blockquote: ({ children, ...props }) => /* @__PURE__ */ jsx("blockquote", { className: "border-l-2 border-primary pl-4", ...props, children }),
|
|
37
|
-
ol: ({ children, ...props }) => /* @__PURE__ */ jsx("ol", { className: "list-decimal space-y-2 pl-6", "data-testid": "markdown-ordered-list", ...props, children }),
|
|
38
|
-
ul: ({ children, ...props }) => /* @__PURE__ */ jsx("ul", { className: "list-none space-y-2 pl-6", "data-testid": "markdown-unordered-list", ...props, children }),
|
|
39
|
-
li: ({ children, ...props }) => /* @__PURE__ */ jsx("li", { className: "my-1.5", ...props, children }),
|
|
40
|
-
table: ({ children, ...props }) => /* @__PURE__ */ jsx("table", { "data-testid": "markdown-table", ...props, children }),
|
|
41
|
-
th: ({ children, ...props }) => /* @__PURE__ */ jsx("th", { ...props, children }),
|
|
42
|
-
td: ({ children, ...props }) => /* @__PURE__ */ jsx("td", { ...props, children }),
|
|
43
|
-
tr: ({ children, ...props }) => /* @__PURE__ */ jsx("tr", { ...props, children }),
|
|
44
|
-
p: ({ children, ...props }) => /* @__PURE__ */ jsx("p", { className: "whitespace-pre-wrap", ...props, children }),
|
|
45
|
-
hr: (props) => /* @__PURE__ */ jsx("hr", { className: "border-foreground/20", ...props }),
|
|
46
|
-
sup: ({ children, ...props }) => /* @__PURE__ */ jsx("sup", { className: "text-xs", ...props, children }),
|
|
47
|
-
sub: ({ children, ...props }) => /* @__PURE__ */ jsx("sub", { className: "text-xs", ...props, children }),
|
|
48
|
-
div: ({ children, className, ...props }) => /* @__PURE__ */ jsx("div", { className, ...props, children }),
|
|
49
|
-
br: (props) => /* @__PURE__ */ jsx("br", { ...props }),
|
|
50
|
-
kbd: ({ children, ...props }) => /* @__PURE__ */ jsx(
|
|
51
|
-
"kbd",
|
|
52
|
-
{
|
|
53
|
-
className: "px-1.5 py-0.5 text-xs font-mono bg-muted border border-border rounded",
|
|
54
|
-
...props,
|
|
55
|
-
children
|
|
56
|
-
}
|
|
57
|
-
),
|
|
58
|
-
abbr: ({ children, title, ...props }) => /* @__PURE__ */ jsx("abbr", { title, className: "underline decoration-dotted cursor-help", ...props, children }),
|
|
59
|
-
cite: ({ children, ...props }) => /* @__PURE__ */ jsx("cite", { className: "italic", ...props, children })
|
|
60
|
-
};
|
|
61
|
-
var MarkdownStreamingContext = createContext(false);
|
|
62
|
-
|
|
63
|
-
// src/ai/split-markdown-blocks.ts
|
|
64
|
-
var LIST_ITEM_RE = /^\s*([-*+]|\d+[.)])\s/;
|
|
65
|
-
var BLOCKQUOTE_RE = /^\s*>/;
|
|
66
|
-
function splitMarkdownBlocks(content) {
|
|
67
|
-
if (!content) return [];
|
|
68
|
-
const blocks = [];
|
|
69
|
-
let start = 0;
|
|
70
|
-
let inFence = false;
|
|
71
|
-
let i = 0;
|
|
72
|
-
while (i < content.length) {
|
|
73
|
-
if (content.startsWith("```", i)) {
|
|
74
|
-
inFence = !inFence;
|
|
75
|
-
i += 3;
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
if (!inFence && content[i] === "\n" && content[i + 1] === "\n") {
|
|
79
|
-
const before = content.slice(start, i);
|
|
80
|
-
const lastLine = before.slice(before.lastIndexOf("\n") + 1);
|
|
81
|
-
const afterStart = i + 2;
|
|
82
|
-
const nextNewline = content.indexOf("\n", afterStart);
|
|
83
|
-
const nextLine = content.slice(afterStart, nextNewline === -1 ? void 0 : nextNewline);
|
|
84
|
-
const bothListItems = LIST_ITEM_RE.test(lastLine) && LIST_ITEM_RE.test(nextLine);
|
|
85
|
-
const bothBlockquotes = BLOCKQUOTE_RE.test(lastLine) && BLOCKQUOTE_RE.test(nextLine);
|
|
86
|
-
if (bothListItems || bothBlockquotes) {
|
|
87
|
-
i += 2;
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
blocks.push(content.slice(start, afterStart));
|
|
91
|
-
start = afterStart;
|
|
92
|
-
i = afterStart;
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
i++;
|
|
96
|
-
}
|
|
97
|
-
if (start < content.length) blocks.push(content.slice(start));
|
|
98
|
-
return blocks;
|
|
99
|
-
}
|
|
100
|
-
function CodeBlock({ language, code }) {
|
|
101
|
-
const [copied, setCopied] = useState(false);
|
|
102
|
-
const handleCopy = async () => {
|
|
103
|
-
try {
|
|
104
|
-
await navigator.clipboard.writeText(code);
|
|
105
|
-
setCopied(true);
|
|
106
|
-
setTimeout(() => setCopied(false), 2e3);
|
|
107
|
-
} catch {
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
return /* @__PURE__ */ jsxs(
|
|
111
|
-
"div",
|
|
112
|
-
{
|
|
113
|
-
className: "code-block relative my-3 overflow-hidden rounded-md border border-border bg-muted",
|
|
114
|
-
"data-testid": "markdown-code-block",
|
|
115
|
-
children: [
|
|
116
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b border-border px-3 py-1.5", children: [
|
|
117
|
-
/* @__PURE__ */ jsx("span", { className: "font-mono text-xs text-muted-foreground", children: language || "code" }),
|
|
118
|
-
/* @__PURE__ */ jsxs(
|
|
119
|
-
"button",
|
|
120
|
-
{
|
|
121
|
-
type: "button",
|
|
122
|
-
onClick: handleCopy,
|
|
123
|
-
className: "flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground",
|
|
124
|
-
title: copied ? "Copied!" : "Copy code",
|
|
125
|
-
children: [
|
|
126
|
-
copied ? /* @__PURE__ */ jsx(Check, { size: 12 }) : /* @__PURE__ */ jsx(Copy, { size: 12 }),
|
|
127
|
-
/* @__PURE__ */ jsx("span", { children: copied ? "Copied" : "Copy" })
|
|
128
|
-
]
|
|
129
|
-
}
|
|
130
|
-
)
|
|
131
|
-
] }),
|
|
132
|
-
/* @__PURE__ */ jsx("pre", { className: "overflow-x-auto p-3 text-sm leading-relaxed", children: /* @__PURE__ */ jsx("code", { className: cn("font-mono text-foreground", language && `language-${language}`), children: code }) })
|
|
133
|
-
]
|
|
134
|
-
}
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
var defaultComponents = {
|
|
138
|
-
...markdownBaseComponents,
|
|
139
|
-
a: ({ href, children, ...props }) => {
|
|
140
|
-
const isInternal = !href || href.startsWith("#") || href.startsWith("cite:");
|
|
141
|
-
return /* @__PURE__ */ jsx(
|
|
142
|
-
"a",
|
|
143
|
-
{
|
|
144
|
-
className: "text-primary underline underline-offset-2",
|
|
145
|
-
href,
|
|
146
|
-
...isInternal ? {} : { target: "_blank", rel: "noopener noreferrer" },
|
|
147
|
-
...props,
|
|
148
|
-
children
|
|
149
|
-
}
|
|
150
|
-
);
|
|
151
|
-
},
|
|
152
|
-
em: ({ children, ...props }) => /* @__PURE__ */ jsx("em", { className: "italic", ...props, children }),
|
|
153
|
-
code: function MarkdownCode({
|
|
154
|
-
className,
|
|
155
|
-
children,
|
|
156
|
-
...props
|
|
157
|
-
}) {
|
|
158
|
-
const match = /language-(\w+)/.exec(className || "");
|
|
159
|
-
if (!match) {
|
|
160
|
-
return /* @__PURE__ */ jsx(
|
|
161
|
-
"code",
|
|
162
|
-
{
|
|
163
|
-
className: "rounded bg-muted px-1 py-0.5 font-mono text-[0.9em]",
|
|
164
|
-
"data-testid": "markdown-inline-code",
|
|
165
|
-
...props,
|
|
166
|
-
children
|
|
167
|
-
}
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
return /* @__PURE__ */ jsx(CodeBlock, { language: match[1], code: String(children).replace(/\n$/, "") });
|
|
171
|
-
},
|
|
172
|
-
// The CodeBlock renders its own <pre>; unwrap react-markdown's wrapper so we
|
|
173
|
-
// don't nest <pre><pre>.
|
|
174
|
-
pre: ({ children }) => /* @__PURE__ */ jsx(Fragment, { children }),
|
|
175
|
-
blockquote: ({ children, ...props }) => /* @__PURE__ */ jsx("blockquote", { className: "border-l-2 border-border pl-4 italic text-muted-foreground", ...props, children }),
|
|
176
|
-
table: ({ children, ...props }) => /* @__PURE__ */ jsx("div", { className: "my-3 overflow-x-auto rounded-lg border border-border", children: /* @__PURE__ */ jsx("table", { "data-testid": "markdown-table", className: "w-full border-collapse text-sm", ...props, children }) }),
|
|
177
|
-
thead: ({ children, ...props }) => /* @__PURE__ */ jsx("thead", { className: "bg-muted", ...props, children }),
|
|
178
|
-
th: ({ children, ...props }) => /* @__PURE__ */ jsx(
|
|
179
|
-
"th",
|
|
180
|
-
{
|
|
181
|
-
className: "border-b border-border px-3 py-2 text-left font-semibold text-foreground",
|
|
182
|
-
...props,
|
|
183
|
-
children
|
|
184
|
-
}
|
|
185
|
-
),
|
|
186
|
-
td: ({ children, ...props }) => /* @__PURE__ */ jsx("td", { className: "border-b border-border px-3 py-2 align-top", ...props, children }),
|
|
187
|
-
// General emphasis marks (GFM `~~strikethrough~~` → <del>, raw <ins>/<mark>).
|
|
188
|
-
del: ({ children, ...props }) => /* @__PURE__ */ jsx("del", { className: "text-muted-foreground line-through", ...props, children }),
|
|
189
|
-
ins: ({ children, ...props }) => /* @__PURE__ */ jsx("ins", { className: "underline decoration-primary/60", ...props, children }),
|
|
190
|
-
mark: ({ children, ...props }) => /* @__PURE__ */ jsx("mark", { className: "rounded bg-primary/15 px-0.5 text-foreground", ...props, children })
|
|
191
|
-
};
|
|
192
|
-
var remarkPlugins = [remarkGfm];
|
|
193
|
-
var rehypePlugins = [rehypeRaw];
|
|
194
|
-
var MemoizedBlock = React2__default.memo(function MarkdownBlock({
|
|
195
|
-
content,
|
|
196
|
-
components
|
|
197
|
-
}) {
|
|
198
|
-
return /* @__PURE__ */ jsx(Markdown, { remarkPlugins, rehypePlugins, components, children: content });
|
|
199
|
-
});
|
|
200
|
-
var MarkdownErrorBoundary = class extends React2__default.Component {
|
|
201
|
-
state = { hasError: false };
|
|
202
|
-
static getDerivedStateFromError() {
|
|
203
|
-
return { hasError: true };
|
|
204
|
-
}
|
|
205
|
-
render() {
|
|
206
|
-
return this.state.hasError ? this.props.fallback : this.props.children;
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
function MarkdownRendererComponent({
|
|
210
|
-
children,
|
|
211
|
-
components: customComponents,
|
|
212
|
-
isStreaming = false,
|
|
213
|
-
className,
|
|
214
|
-
testId = "markdown-renderer"
|
|
215
|
-
}) {
|
|
216
|
-
const components = useMemo(
|
|
217
|
-
() => customComponents ? { ...defaultComponents, ...customComponents } : defaultComponents,
|
|
218
|
-
[customComponents]
|
|
219
|
-
);
|
|
220
|
-
const blocks = useMemo(() => splitMarkdownBlocks(children), [children]);
|
|
221
|
-
return /* @__PURE__ */ jsx(
|
|
222
|
-
MarkdownErrorBoundary,
|
|
223
|
-
{
|
|
224
|
-
fallback: /* @__PURE__ */ jsx("div", { className: cn("whitespace-pre-wrap break-words text-foreground", className), children }),
|
|
225
|
-
children: /* @__PURE__ */ jsx(MarkdownStreamingContext.Provider, { value: isStreaming, children: /* @__PURE__ */ jsx(
|
|
226
|
-
"div",
|
|
227
|
-
{
|
|
228
|
-
className: cn(
|
|
229
|
-
"markdown-content space-y-3 break-words leading-relaxed text-foreground",
|
|
230
|
-
className
|
|
231
|
-
),
|
|
232
|
-
"data-testid": testId,
|
|
233
|
-
children: blocks.map((block, index) => /* @__PURE__ */ jsx(MemoizedBlock, { content: block, components }, index))
|
|
234
|
-
}
|
|
235
|
-
) })
|
|
236
|
-
}
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
var MarkdownRenderer = React2__default.memo(MarkdownRendererComponent);
|
|
240
|
-
var TooltipContext = React2.createContext(null);
|
|
29
|
+
var TooltipContext = React.createContext(null);
|
|
241
30
|
var DEFAULT_DELAY = 300;
|
|
242
|
-
var TooltipConfigContext =
|
|
31
|
+
var TooltipConfigContext = React.createContext({
|
|
243
32
|
delayDuration: DEFAULT_DELAY
|
|
244
33
|
});
|
|
245
34
|
var TooltipProvider = ({ children, delayDuration = DEFAULT_DELAY }) => {
|
|
246
|
-
const value =
|
|
35
|
+
const value = React.useMemo(() => ({ delayDuration }), [delayDuration]);
|
|
247
36
|
return /* @__PURE__ */ jsx(TooltipConfigContext.Provider, { value, children });
|
|
248
37
|
};
|
|
249
38
|
function Tooltip({ children, delayDuration }) {
|
|
250
|
-
const config =
|
|
39
|
+
const config = React.useContext(TooltipConfigContext);
|
|
251
40
|
const delay = delayDuration ?? config.delayDuration;
|
|
252
|
-
const [open, setOpen] =
|
|
253
|
-
const triggerRef =
|
|
254
|
-
const timer =
|
|
255
|
-
const contentId =
|
|
41
|
+
const [open, setOpen] = React.useState(false);
|
|
42
|
+
const triggerRef = React.useRef(null);
|
|
43
|
+
const timer = React.useRef(null);
|
|
44
|
+
const contentId = React.useId();
|
|
256
45
|
const clearTimer = () => {
|
|
257
46
|
if (timer.current) {
|
|
258
47
|
clearTimeout(timer.current);
|
|
259
48
|
timer.current = null;
|
|
260
49
|
}
|
|
261
50
|
};
|
|
262
|
-
const suppressed =
|
|
263
|
-
const show =
|
|
51
|
+
const suppressed = React.useRef(false);
|
|
52
|
+
const show = React.useCallback(() => {
|
|
264
53
|
clearTimer();
|
|
265
54
|
if (suppressed.current) return;
|
|
266
55
|
timer.current = setTimeout(() => setOpen(true), delay);
|
|
267
56
|
}, [delay]);
|
|
268
|
-
const hide =
|
|
57
|
+
const hide = React.useCallback(() => {
|
|
269
58
|
clearTimer();
|
|
270
59
|
setOpen(false);
|
|
271
60
|
}, []);
|
|
272
|
-
const suppress =
|
|
61
|
+
const suppress = React.useCallback(() => {
|
|
273
62
|
suppressed.current = true;
|
|
274
63
|
clearTimer();
|
|
275
64
|
setOpen(false);
|
|
276
65
|
}, []);
|
|
277
|
-
const release =
|
|
66
|
+
const release = React.useCallback(() => {
|
|
278
67
|
suppressed.current = false;
|
|
279
68
|
}, []);
|
|
280
|
-
const setTrigger =
|
|
69
|
+
const setTrigger = React.useCallback((el) => {
|
|
281
70
|
triggerRef.current = el;
|
|
282
71
|
}, []);
|
|
283
|
-
|
|
284
|
-
const value =
|
|
72
|
+
React.useEffect(() => () => clearTimer(), []);
|
|
73
|
+
const value = React.useMemo(
|
|
285
74
|
() => ({ open, show, hide, suppress, release, setTrigger, triggerRef, contentId }),
|
|
286
75
|
[open, show, hide, suppress, release, setTrigger, contentId]
|
|
287
76
|
);
|
|
@@ -305,7 +94,7 @@ function showsOwnText(el) {
|
|
|
305
94
|
return /\p{L}{2,}/u.test(visible);
|
|
306
95
|
}
|
|
307
96
|
function TooltipTrigger({ asChild, children, ...props }) {
|
|
308
|
-
const ctx =
|
|
97
|
+
const ctx = React.useContext(TooltipContext);
|
|
309
98
|
if (!ctx) return /* @__PURE__ */ jsx(Fragment, { children });
|
|
310
99
|
const triggerHandlers = {
|
|
311
100
|
onPointerEnter: (e) => {
|
|
@@ -321,7 +110,7 @@ function TooltipTrigger({ asChild, children, ...props }) {
|
|
|
321
110
|
},
|
|
322
111
|
onPointerDown: (e) => {
|
|
323
112
|
props.onPointerDown?.(e);
|
|
324
|
-
(asChild &&
|
|
113
|
+
(asChild && React.isValidElement(children) ? children.props.onPointerDown : void 0)?.(e);
|
|
325
114
|
ctx.suppress();
|
|
326
115
|
},
|
|
327
116
|
onFocus: (e) => {
|
|
@@ -335,9 +124,9 @@ function TooltipTrigger({ asChild, children, ...props }) {
|
|
|
335
124
|
"aria-describedby": ctx.open ? ctx.contentId : void 0,
|
|
336
125
|
"data-state": ctx.open ? "open" : "closed"
|
|
337
126
|
};
|
|
338
|
-
if (asChild &&
|
|
127
|
+
if (asChild && React.isValidElement(children)) {
|
|
339
128
|
const child = children;
|
|
340
|
-
return
|
|
129
|
+
return React.cloneElement(child, {
|
|
341
130
|
...props,
|
|
342
131
|
...triggerHandlers,
|
|
343
132
|
ref: ctx.setTrigger
|
|
@@ -360,12 +149,12 @@ var TRANSFORM_BY_SIDE = {
|
|
|
360
149
|
left: "translate(-100%, -50%)",
|
|
361
150
|
right: "translate(0, -50%)"
|
|
362
151
|
};
|
|
363
|
-
var TooltipContent =
|
|
152
|
+
var TooltipContent = React.forwardRef(
|
|
364
153
|
({ className, side = "top", sideOffset = 4, collisionPadding = 8, style, ...props }, ref) => {
|
|
365
|
-
const ctx =
|
|
366
|
-
const innerRef =
|
|
367
|
-
const [coords, setCoords] =
|
|
368
|
-
|
|
154
|
+
const ctx = React.useContext(TooltipContext);
|
|
155
|
+
const innerRef = React.useRef(null);
|
|
156
|
+
const [coords, setCoords] = React.useState(null);
|
|
157
|
+
React.useLayoutEffect(() => {
|
|
369
158
|
if (!ctx?.open || !ctx.triggerRef.current) {
|
|
370
159
|
setCoords(null);
|
|
371
160
|
return;
|
|
@@ -512,7 +301,7 @@ function DictateProvider({
|
|
|
512
301
|
function useDictateContext() {
|
|
513
302
|
return useContext(DictateContext);
|
|
514
303
|
}
|
|
515
|
-
var Avatar =
|
|
304
|
+
var Avatar = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
516
305
|
AvatarPrimitive.Root,
|
|
517
306
|
{
|
|
518
307
|
ref,
|
|
@@ -521,7 +310,7 @@ var Avatar = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
521
310
|
}
|
|
522
311
|
));
|
|
523
312
|
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
524
|
-
var AvatarImage =
|
|
313
|
+
var AvatarImage = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
525
314
|
AvatarPrimitive.Image,
|
|
526
315
|
{
|
|
527
316
|
ref,
|
|
@@ -530,7 +319,7 @@ var AvatarImage = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
530
319
|
}
|
|
531
320
|
));
|
|
532
321
|
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
533
|
-
var AvatarFallback =
|
|
322
|
+
var AvatarFallback = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
534
323
|
AvatarPrimitive.Fallback,
|
|
535
324
|
{
|
|
536
325
|
ref,
|
|
@@ -593,7 +382,7 @@ var buttonVariants = cva(
|
|
|
593
382
|
}
|
|
594
383
|
}
|
|
595
384
|
);
|
|
596
|
-
var Button =
|
|
385
|
+
var Button = React.forwardRef(
|
|
597
386
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
598
387
|
const Comp = asChild ? Slot : "button";
|
|
599
388
|
return /* @__PURE__ */ jsx(Comp, { className: cn(buttonVariants({ variant, size, className })), ref, ...props });
|
|
@@ -602,7 +391,7 @@ var Button = React2.forwardRef(
|
|
|
602
391
|
Button.displayName = "Button";
|
|
603
392
|
var HoverCard = HoverCardPrimitive.Root;
|
|
604
393
|
var HoverCardTrigger = HoverCardPrimitive.Trigger;
|
|
605
|
-
var HoverCardContent =
|
|
394
|
+
var HoverCardContent = React.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(HoverCardPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
606
395
|
HoverCardPrimitive.Content,
|
|
607
396
|
{
|
|
608
397
|
ref,
|
|
@@ -629,7 +418,7 @@ var cardVariants = cva("rounded-lg bg-card text-card-foreground", {
|
|
|
629
418
|
variant: "flat"
|
|
630
419
|
}
|
|
631
420
|
});
|
|
632
|
-
var Card =
|
|
421
|
+
var Card = React.forwardRef(
|
|
633
422
|
({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
634
423
|
"div",
|
|
635
424
|
{
|
|
@@ -641,7 +430,7 @@ var Card = React2.forwardRef(
|
|
|
641
430
|
)
|
|
642
431
|
);
|
|
643
432
|
Card.displayName = "Card";
|
|
644
|
-
var CardHeader =
|
|
433
|
+
var CardHeader = React.forwardRef(
|
|
645
434
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
646
435
|
"div",
|
|
647
436
|
{
|
|
@@ -653,7 +442,7 @@ var CardHeader = React2.forwardRef(
|
|
|
653
442
|
)
|
|
654
443
|
);
|
|
655
444
|
CardHeader.displayName = "CardHeader";
|
|
656
|
-
var CardTitle =
|
|
445
|
+
var CardTitle = React.forwardRef(
|
|
657
446
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
658
447
|
"div",
|
|
659
448
|
{
|
|
@@ -665,7 +454,7 @@ var CardTitle = React2.forwardRef(
|
|
|
665
454
|
)
|
|
666
455
|
);
|
|
667
456
|
CardTitle.displayName = "CardTitle";
|
|
668
|
-
var CardDescription =
|
|
457
|
+
var CardDescription = React.forwardRef(
|
|
669
458
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
670
459
|
"div",
|
|
671
460
|
{
|
|
@@ -677,11 +466,11 @@ var CardDescription = React2.forwardRef(
|
|
|
677
466
|
)
|
|
678
467
|
);
|
|
679
468
|
CardDescription.displayName = "CardDescription";
|
|
680
|
-
var CardContent =
|
|
469
|
+
var CardContent = React.forwardRef(
|
|
681
470
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, "data-slot": "card-content", className: cn("p-6 pt-0", className), ...props })
|
|
682
471
|
);
|
|
683
472
|
CardContent.displayName = "CardContent";
|
|
684
|
-
var CardFooter =
|
|
473
|
+
var CardFooter = React.forwardRef(
|
|
685
474
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
686
475
|
"div",
|
|
687
476
|
{
|
|
@@ -1018,12 +807,12 @@ function InlineMicButton({
|
|
|
1018
807
|
)
|
|
1019
808
|
] });
|
|
1020
809
|
}
|
|
1021
|
-
var Input =
|
|
810
|
+
var Input = React.forwardRef(
|
|
1022
811
|
({ className, type, dictate, onFocus, onBlur, ...props }, forwardedRef) => {
|
|
1023
812
|
const dictateCtx = useDictateContext();
|
|
1024
|
-
const [focused, setFocused] =
|
|
1025
|
-
const innerRef =
|
|
1026
|
-
|
|
813
|
+
const [focused, setFocused] = React.useState(false);
|
|
814
|
+
const innerRef = React.useRef(null);
|
|
815
|
+
React.useImperativeHandle(forwardedRef, () => innerRef.current);
|
|
1027
816
|
const showDictate = dictate && !!dictateCtx && !props.disabled && !props.readOnly;
|
|
1028
817
|
const input = /* @__PURE__ */ jsx(
|
|
1029
818
|
"input",
|
|
@@ -1074,7 +863,7 @@ var Input = React2.forwardRef(
|
|
|
1074
863
|
}
|
|
1075
864
|
);
|
|
1076
865
|
Input.displayName = "Input";
|
|
1077
|
-
var Label =
|
|
866
|
+
var Label = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1078
867
|
"label",
|
|
1079
868
|
{
|
|
1080
869
|
ref,
|
|
@@ -1083,7 +872,7 @@ var Label = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
1083
872
|
}
|
|
1084
873
|
));
|
|
1085
874
|
Label.displayName = "Label";
|
|
1086
|
-
var Separator =
|
|
875
|
+
var Separator = React.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1087
876
|
SeparatorPrimitive.Root,
|
|
1088
877
|
{
|
|
1089
878
|
ref,
|
|
@@ -1098,12 +887,12 @@ var Separator = React2.forwardRef(({ className, orientation = "horizontal", deco
|
|
|
1098
887
|
}
|
|
1099
888
|
));
|
|
1100
889
|
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
1101
|
-
var Textarea =
|
|
890
|
+
var Textarea = React.forwardRef(
|
|
1102
891
|
({ className, dictate, onFocus, onBlur, ...props }, forwardedRef) => {
|
|
1103
892
|
const dictateCtx = useDictateContext();
|
|
1104
|
-
const [focused, setFocused] =
|
|
1105
|
-
const innerRef =
|
|
1106
|
-
|
|
893
|
+
const [focused, setFocused] = React.useState(false);
|
|
894
|
+
const innerRef = React.useRef(null);
|
|
895
|
+
React.useImperativeHandle(forwardedRef, () => innerRef.current);
|
|
1107
896
|
const showDictate = dictate && !!dictateCtx && !props.disabled && !props.readOnly;
|
|
1108
897
|
const textarea = /* @__PURE__ */ jsx(
|
|
1109
898
|
"textarea",
|
|
@@ -1155,7 +944,7 @@ Textarea.displayName = "Textarea";
|
|
|
1155
944
|
var Collapsible = CollapsiblePrimitive.Root;
|
|
1156
945
|
var CollapsibleTrigger2 = CollapsiblePrimitive.CollapsibleTrigger;
|
|
1157
946
|
var CollapsibleContent2 = CollapsiblePrimitive.CollapsibleContent;
|
|
1158
|
-
var Progress =
|
|
947
|
+
var Progress = React.forwardRef(({ className, value, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1159
948
|
ProgressPrimitive.Root,
|
|
1160
949
|
{
|
|
1161
950
|
ref,
|
|
@@ -1171,11 +960,11 @@ var Progress = React2.forwardRef(({ className, value, ...props }, ref) => /* @__
|
|
|
1171
960
|
}
|
|
1172
961
|
));
|
|
1173
962
|
Progress.displayName = ProgressPrimitive.Root.displayName;
|
|
1174
|
-
var RadioGroup =
|
|
963
|
+
var RadioGroup = React.forwardRef(({ className, ...props }, ref) => {
|
|
1175
964
|
return /* @__PURE__ */ jsx(RadioGroupPrimitive.Root, { className: cn("grid gap-2", className), ...props, ref });
|
|
1176
965
|
});
|
|
1177
966
|
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
1178
|
-
var RadioGroupItem =
|
|
967
|
+
var RadioGroupItem = React.forwardRef(({ className, ...props }, ref) => {
|
|
1179
968
|
return /* @__PURE__ */ jsx(
|
|
1180
969
|
RadioGroupPrimitive.Item,
|
|
1181
970
|
{
|
|
@@ -1190,7 +979,7 @@ var RadioGroupItem = React2.forwardRef(({ className, ...props }, ref) => {
|
|
|
1190
979
|
);
|
|
1191
980
|
});
|
|
1192
981
|
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
1193
|
-
var Checkbox =
|
|
982
|
+
var Checkbox = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1194
983
|
CheckboxPrimitive.Root,
|
|
1195
984
|
{
|
|
1196
985
|
ref,
|
|
@@ -1203,7 +992,7 @@ var Checkbox = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
1203
992
|
}
|
|
1204
993
|
));
|
|
1205
994
|
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
1206
|
-
var Switch =
|
|
995
|
+
var Switch = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1207
996
|
SwitchPrimitives.Root,
|
|
1208
997
|
{
|
|
1209
998
|
className: cn(
|
|
@@ -1224,7 +1013,7 @@ var Switch = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
1224
1013
|
));
|
|
1225
1014
|
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
1226
1015
|
var Tabs = TabsPrimitive.Root;
|
|
1227
|
-
var TabsList =
|
|
1016
|
+
var TabsList = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1228
1017
|
TabsPrimitive.List,
|
|
1229
1018
|
{
|
|
1230
1019
|
ref,
|
|
@@ -1236,7 +1025,7 @@ var TabsList = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
1236
1025
|
}
|
|
1237
1026
|
));
|
|
1238
1027
|
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
1239
|
-
var TabsTrigger =
|
|
1028
|
+
var TabsTrigger = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1240
1029
|
TabsPrimitive.Trigger,
|
|
1241
1030
|
{
|
|
1242
1031
|
ref,
|
|
@@ -1248,7 +1037,7 @@ var TabsTrigger = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
1248
1037
|
}
|
|
1249
1038
|
));
|
|
1250
1039
|
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
1251
|
-
var TabsContent =
|
|
1040
|
+
var TabsContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1252
1041
|
TabsPrimitive.Content,
|
|
1253
1042
|
{
|
|
1254
1043
|
ref,
|
|
@@ -1260,15 +1049,15 @@ var TabsContent = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
1260
1049
|
}
|
|
1261
1050
|
));
|
|
1262
1051
|
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
1263
|
-
var Table =
|
|
1052
|
+
var Table = React.forwardRef(
|
|
1264
1053
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx("table", { ref, className: cn("w-full caption-bottom text-sm", className), ...props }) })
|
|
1265
1054
|
);
|
|
1266
1055
|
Table.displayName = "Table";
|
|
1267
|
-
var TableHeader =
|
|
1056
|
+
var TableHeader = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
|
|
1268
1057
|
TableHeader.displayName = "TableHeader";
|
|
1269
|
-
var TableBody =
|
|
1058
|
+
var TableBody = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("tbody", { ref, className: cn("[&_tr:last-child]:border-0", className), ...props }));
|
|
1270
1059
|
TableBody.displayName = "TableBody";
|
|
1271
|
-
var TableFooter =
|
|
1060
|
+
var TableFooter = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1272
1061
|
"tfoot",
|
|
1273
1062
|
{
|
|
1274
1063
|
ref,
|
|
@@ -1277,7 +1066,7 @@ var TableFooter = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
1277
1066
|
}
|
|
1278
1067
|
));
|
|
1279
1068
|
TableFooter.displayName = "TableFooter";
|
|
1280
|
-
var TableRow =
|
|
1069
|
+
var TableRow = React.forwardRef(
|
|
1281
1070
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1282
1071
|
"tr",
|
|
1283
1072
|
{
|
|
@@ -1291,7 +1080,7 @@ var TableRow = React2.forwardRef(
|
|
|
1291
1080
|
)
|
|
1292
1081
|
);
|
|
1293
1082
|
TableRow.displayName = "TableRow";
|
|
1294
|
-
var TableHead =
|
|
1083
|
+
var TableHead = React.forwardRef(
|
|
1295
1084
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1296
1085
|
"th",
|
|
1297
1086
|
{
|
|
@@ -1305,7 +1094,7 @@ var TableHead = React2.forwardRef(
|
|
|
1305
1094
|
)
|
|
1306
1095
|
);
|
|
1307
1096
|
TableHead.displayName = "TableHead";
|
|
1308
|
-
var TableCell =
|
|
1097
|
+
var TableCell = React.forwardRef(
|
|
1309
1098
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1310
1099
|
"td",
|
|
1311
1100
|
{
|
|
@@ -1319,9 +1108,9 @@ var TableCell = React2.forwardRef(
|
|
|
1319
1108
|
)
|
|
1320
1109
|
);
|
|
1321
1110
|
TableCell.displayName = "TableCell";
|
|
1322
|
-
var TableCaption =
|
|
1111
|
+
var TableCaption = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("caption", { ref, className: cn("mt-4 text-sm text-muted-foreground", className), ...props }));
|
|
1323
1112
|
TableCaption.displayName = "TableCaption";
|
|
1324
|
-
var Slider =
|
|
1113
|
+
var Slider = React.forwardRef(
|
|
1325
1114
|
({ className, rangeClassName, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
1326
1115
|
SliderPrimitive.Root,
|
|
1327
1116
|
{
|
|
@@ -1356,7 +1145,7 @@ var toggleVariants = cva(
|
|
|
1356
1145
|
}
|
|
1357
1146
|
}
|
|
1358
1147
|
);
|
|
1359
|
-
var Toggle =
|
|
1148
|
+
var Toggle = React.forwardRef(({ className, variant, size, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1360
1149
|
TogglePrimitive.Root,
|
|
1361
1150
|
{
|
|
1362
1151
|
ref,
|
|
@@ -1365,11 +1154,11 @@ var Toggle = React2.forwardRef(({ className, variant, size, ...props }, ref) =>
|
|
|
1365
1154
|
}
|
|
1366
1155
|
));
|
|
1367
1156
|
Toggle.displayName = TogglePrimitive.Root.displayName;
|
|
1368
|
-
var ToggleGroupContext =
|
|
1157
|
+
var ToggleGroupContext = React.createContext({
|
|
1369
1158
|
size: "default",
|
|
1370
1159
|
variant: "default"
|
|
1371
1160
|
});
|
|
1372
|
-
var ToggleGroup =
|
|
1161
|
+
var ToggleGroup = React.forwardRef(({ className, variant, size, children, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1373
1162
|
ToggleGroupPrimitive.Root,
|
|
1374
1163
|
{
|
|
1375
1164
|
ref,
|
|
@@ -1379,8 +1168,8 @@ var ToggleGroup = React2.forwardRef(({ className, variant, size, children, ...pr
|
|
|
1379
1168
|
}
|
|
1380
1169
|
));
|
|
1381
1170
|
ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;
|
|
1382
|
-
var ToggleGroupItem =
|
|
1383
|
-
const context =
|
|
1171
|
+
var ToggleGroupItem = React.forwardRef(({ className, children, variant, size, ...props }, ref) => {
|
|
1172
|
+
const context = React.useContext(ToggleGroupContext);
|
|
1384
1173
|
return /* @__PURE__ */ jsx(
|
|
1385
1174
|
ToggleGroupPrimitive.Item,
|
|
1386
1175
|
{
|
|
@@ -1409,7 +1198,7 @@ var Dialog = DialogPrimitive.Root;
|
|
|
1409
1198
|
var DialogTrigger = DialogPrimitive.Trigger;
|
|
1410
1199
|
var DialogPortal = DialogPrimitive.Portal;
|
|
1411
1200
|
var DialogClose = DialogPrimitive.Close;
|
|
1412
|
-
var DialogOverlay =
|
|
1201
|
+
var DialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1413
1202
|
DialogPrimitive.Overlay,
|
|
1414
1203
|
{
|
|
1415
1204
|
ref,
|
|
@@ -1426,7 +1215,7 @@ var PHONE_PRESENTATION = {
|
|
|
1426
1215
|
sheet: "max-sm:top-auto max-sm:bottom-0 max-sm:left-0 max-sm:w-full max-sm:max-w-full max-sm:border-x-0 max-sm:border-b-0 max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none max-sm:rounded-t-xl max-sm:pb-[max(1.5rem,env(safe-area-inset-bottom))] max-sm:max-h-[calc(100dvh-env(safe-area-inset-top,0px)-2.5rem)] max-sm:data-[state=open]:slide-in-from-bottom-10 max-sm:data-[state=open]:zoom-in-100 max-sm:data-[state=closed]:zoom-out-100",
|
|
1427
1216
|
full: "max-sm:top-auto max-sm:bottom-0 max-sm:left-0 max-sm:border-x-0 max-sm:border-b-0 max-sm:h-[calc(100dvh-env(safe-area-inset-top,0px)-1rem)] max-sm:w-full max-sm:max-w-full max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none max-sm:rounded-t-xl max-sm:pb-[max(1.5rem,env(safe-area-inset-bottom))] max-sm:max-h-none max-sm:data-[state=open]:slide-in-from-bottom-10 max-sm:data-[state=open]:zoom-in-100 max-sm:data-[state=closed]:zoom-out-100"
|
|
1428
1217
|
};
|
|
1429
|
-
var DialogContent =
|
|
1218
|
+
var DialogContent = React.forwardRef(
|
|
1430
1219
|
({ className, children, hideCloseButton, presentation = "center", onInteractOutside, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
1431
1220
|
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
1432
1221
|
/* @__PURE__ */ jsxs(
|
|
@@ -1480,7 +1269,7 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
|
1480
1269
|
}
|
|
1481
1270
|
);
|
|
1482
1271
|
DialogFooter.displayName = "DialogFooter";
|
|
1483
|
-
var DialogTitle =
|
|
1272
|
+
var DialogTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1484
1273
|
DialogPrimitive.Title,
|
|
1485
1274
|
{
|
|
1486
1275
|
ref,
|
|
@@ -1489,7 +1278,7 @@ var DialogTitle = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
1489
1278
|
}
|
|
1490
1279
|
));
|
|
1491
1280
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
1492
|
-
var DialogDescription =
|
|
1281
|
+
var DialogDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1493
1282
|
DialogPrimitive.Description,
|
|
1494
1283
|
{
|
|
1495
1284
|
ref,
|
|
@@ -1501,7 +1290,7 @@ DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
|
1501
1290
|
var Popover = PopoverPrimitive.Root;
|
|
1502
1291
|
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
1503
1292
|
var PopoverAnchor = PopoverPrimitive.Anchor;
|
|
1504
|
-
var PopoverContent =
|
|
1293
|
+
var PopoverContent = React.forwardRef(({ className, align = "center", sideOffset = 4, container, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { container: container ?? void 0, children: /* @__PURE__ */ jsx(
|
|
1505
1294
|
PopoverPrimitive.Content,
|
|
1506
1295
|
{
|
|
1507
1296
|
ref,
|
|
@@ -1777,7 +1566,7 @@ function MarkMenu({
|
|
|
1777
1566
|
var Select = SelectPrimitive.Root;
|
|
1778
1567
|
var SelectGroup = SelectPrimitive.Group;
|
|
1779
1568
|
var SelectValue = SelectPrimitive.Value;
|
|
1780
|
-
var SelectTrigger =
|
|
1569
|
+
var SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
1781
1570
|
SelectPrimitive.Trigger,
|
|
1782
1571
|
{
|
|
1783
1572
|
ref,
|
|
@@ -1793,7 +1582,7 @@ var SelectTrigger = React2.forwardRef(({ className, children, ...props }, ref) =
|
|
|
1793
1582
|
}
|
|
1794
1583
|
));
|
|
1795
1584
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
1796
|
-
var SelectScrollUpButton =
|
|
1585
|
+
var SelectScrollUpButton = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1797
1586
|
SelectPrimitive.ScrollUpButton,
|
|
1798
1587
|
{
|
|
1799
1588
|
ref,
|
|
@@ -1803,7 +1592,7 @@ var SelectScrollUpButton = React2.forwardRef(({ className, ...props }, ref) => /
|
|
|
1803
1592
|
}
|
|
1804
1593
|
));
|
|
1805
1594
|
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
1806
|
-
var SelectScrollDownButton =
|
|
1595
|
+
var SelectScrollDownButton = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1807
1596
|
SelectPrimitive.ScrollDownButton,
|
|
1808
1597
|
{
|
|
1809
1598
|
ref,
|
|
@@ -1813,7 +1602,7 @@ var SelectScrollDownButton = React2.forwardRef(({ className, ...props }, ref) =>
|
|
|
1813
1602
|
}
|
|
1814
1603
|
));
|
|
1815
1604
|
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
1816
|
-
var SelectContent =
|
|
1605
|
+
var SelectContent = React.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
1817
1606
|
SelectPrimitive.Content,
|
|
1818
1607
|
{
|
|
1819
1608
|
ref,
|
|
@@ -1842,7 +1631,7 @@ var SelectContent = React2.forwardRef(({ className, children, position = "popper
|
|
|
1842
1631
|
}
|
|
1843
1632
|
) }));
|
|
1844
1633
|
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
1845
|
-
var SelectLabel =
|
|
1634
|
+
var SelectLabel = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1846
1635
|
SelectPrimitive.Label,
|
|
1847
1636
|
{
|
|
1848
1637
|
ref,
|
|
@@ -1851,7 +1640,7 @@ var SelectLabel = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
1851
1640
|
}
|
|
1852
1641
|
));
|
|
1853
1642
|
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
1854
|
-
var SelectItem =
|
|
1643
|
+
var SelectItem = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
1855
1644
|
SelectPrimitive.Item,
|
|
1856
1645
|
{
|
|
1857
1646
|
ref,
|
|
@@ -1867,7 +1656,7 @@ var SelectItem = React2.forwardRef(({ className, children, ...props }, ref) => /
|
|
|
1867
1656
|
}
|
|
1868
1657
|
));
|
|
1869
1658
|
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
1870
|
-
var SelectSeparator =
|
|
1659
|
+
var SelectSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1871
1660
|
SelectPrimitive.Separator,
|
|
1872
1661
|
{
|
|
1873
1662
|
ref,
|
|
@@ -1876,7 +1665,7 @@ var SelectSeparator = React2.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
1876
1665
|
}
|
|
1877
1666
|
));
|
|
1878
1667
|
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
1879
|
-
var Command =
|
|
1668
|
+
var Command = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1880
1669
|
Command$1,
|
|
1881
1670
|
{
|
|
1882
1671
|
ref,
|
|
@@ -1891,7 +1680,7 @@ Command.displayName = Command$1.displayName;
|
|
|
1891
1680
|
var CommandDialog = ({ children, ...props }) => {
|
|
1892
1681
|
return /* @__PURE__ */ jsx(Dialog, { ...props, children: /* @__PURE__ */ jsx(DialogContent, { className: "overflow-hidden p-0", children: /* @__PURE__ */ jsx(Command, { className: "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children }) }) });
|
|
1893
1682
|
};
|
|
1894
|
-
var CommandInput =
|
|
1683
|
+
var CommandInput = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs("div", { className: "flex items-center border-b px-3", "data-cmdk-input-wrapper": "", children: [
|
|
1895
1684
|
/* @__PURE__ */ jsx(Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
1896
1685
|
/* @__PURE__ */ jsx(
|
|
1897
1686
|
Command$1.Input,
|
|
@@ -1906,7 +1695,7 @@ var CommandInput = React2.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
1906
1695
|
)
|
|
1907
1696
|
] }));
|
|
1908
1697
|
CommandInput.displayName = Command$1.Input.displayName;
|
|
1909
|
-
var CommandList =
|
|
1698
|
+
var CommandList = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1910
1699
|
Command$1.List,
|
|
1911
1700
|
{
|
|
1912
1701
|
ref,
|
|
@@ -1915,9 +1704,9 @@ var CommandList = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
1915
1704
|
}
|
|
1916
1705
|
));
|
|
1917
1706
|
CommandList.displayName = Command$1.List.displayName;
|
|
1918
|
-
var CommandEmpty =
|
|
1707
|
+
var CommandEmpty = React.forwardRef((props, ref) => /* @__PURE__ */ jsx(Command$1.Empty, { ref, className: "py-6 text-center text-sm", ...props }));
|
|
1919
1708
|
CommandEmpty.displayName = Command$1.Empty.displayName;
|
|
1920
|
-
var CommandGroup =
|
|
1709
|
+
var CommandGroup = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1921
1710
|
Command$1.Group,
|
|
1922
1711
|
{
|
|
1923
1712
|
ref,
|
|
@@ -1929,7 +1718,7 @@ var CommandGroup = React2.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
1929
1718
|
}
|
|
1930
1719
|
));
|
|
1931
1720
|
CommandGroup.displayName = Command$1.Group.displayName;
|
|
1932
|
-
var CommandSeparator =
|
|
1721
|
+
var CommandSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1933
1722
|
Command$1.Separator,
|
|
1934
1723
|
{
|
|
1935
1724
|
ref,
|
|
@@ -1938,7 +1727,7 @@ var CommandSeparator = React2.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
1938
1727
|
}
|
|
1939
1728
|
));
|
|
1940
1729
|
CommandSeparator.displayName = Command$1.Separator.displayName;
|
|
1941
|
-
var CommandItem =
|
|
1730
|
+
var CommandItem = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1942
1731
|
Command$1.Item,
|
|
1943
1732
|
{
|
|
1944
1733
|
ref,
|
|
@@ -1960,6 +1749,299 @@ var CommandShortcut = ({ className, ...props }) => {
|
|
|
1960
1749
|
);
|
|
1961
1750
|
};
|
|
1962
1751
|
CommandShortcut.displayName = "CommandShortcut";
|
|
1752
|
+
var markdownBaseComponents = {
|
|
1753
|
+
h1: ({ children, ...props }) => /* @__PURE__ */ jsx("h1", { className: "text-lg font-semibold", "data-testid": "markdown-heading-1", ...props, children }),
|
|
1754
|
+
h2: ({ children, ...props }) => /* @__PURE__ */ jsx("h2", { className: "font-semibold text-base", "data-testid": "markdown-heading-2", ...props, children }),
|
|
1755
|
+
h3: ({ children, ...props }) => /* @__PURE__ */ jsx("h3", { className: "font-semibold text-base", "data-testid": "markdown-heading-3", ...props, children }),
|
|
1756
|
+
h4: ({ children, ...props }) => /* @__PURE__ */ jsx("h4", { className: "font-semibold text-base", ...props, children }),
|
|
1757
|
+
h5: ({ children, ...props }) => /* @__PURE__ */ jsx("h5", { className: "font-medium", ...props, children }),
|
|
1758
|
+
strong: ({ children, ...props }) => /* @__PURE__ */ jsx("strong", { className: "font-semibold", ...props, children }),
|
|
1759
|
+
blockquote: ({ children, ...props }) => /* @__PURE__ */ jsx("blockquote", { className: "border-l-2 border-primary pl-4", ...props, children }),
|
|
1760
|
+
ol: ({ children, ...props }) => /* @__PURE__ */ jsx("ol", { className: "list-decimal space-y-2 pl-6", "data-testid": "markdown-ordered-list", ...props, children }),
|
|
1761
|
+
ul: ({ children, ...props }) => /* @__PURE__ */ jsx("ul", { className: "list-none space-y-2 pl-6", "data-testid": "markdown-unordered-list", ...props, children }),
|
|
1762
|
+
li: ({ children, ...props }) => /* @__PURE__ */ jsx("li", { className: "my-1.5", ...props, children }),
|
|
1763
|
+
table: ({ children, ...props }) => /* @__PURE__ */ jsx("table", { "data-testid": "markdown-table", ...props, children }),
|
|
1764
|
+
th: ({ children, ...props }) => /* @__PURE__ */ jsx("th", { ...props, children }),
|
|
1765
|
+
td: ({ children, ...props }) => /* @__PURE__ */ jsx("td", { ...props, children }),
|
|
1766
|
+
tr: ({ children, ...props }) => /* @__PURE__ */ jsx("tr", { ...props, children }),
|
|
1767
|
+
p: ({ children, ...props }) => /* @__PURE__ */ jsx("p", { className: "whitespace-pre-wrap", ...props, children }),
|
|
1768
|
+
hr: (props) => /* @__PURE__ */ jsx("hr", { className: "border-foreground/20", ...props }),
|
|
1769
|
+
sup: ({ children, ...props }) => /* @__PURE__ */ jsx("sup", { className: "text-xs", ...props, children }),
|
|
1770
|
+
sub: ({ children, ...props }) => /* @__PURE__ */ jsx("sub", { className: "text-xs", ...props, children }),
|
|
1771
|
+
div: ({ children, className, ...props }) => /* @__PURE__ */ jsx("div", { className, ...props, children }),
|
|
1772
|
+
br: (props) => /* @__PURE__ */ jsx("br", { ...props }),
|
|
1773
|
+
kbd: ({ children, ...props }) => /* @__PURE__ */ jsx(
|
|
1774
|
+
"kbd",
|
|
1775
|
+
{
|
|
1776
|
+
className: "px-1.5 py-0.5 text-xs font-mono bg-muted border border-border rounded",
|
|
1777
|
+
...props,
|
|
1778
|
+
children
|
|
1779
|
+
}
|
|
1780
|
+
),
|
|
1781
|
+
abbr: ({ children, title, ...props }) => /* @__PURE__ */ jsx("abbr", { title, className: "underline decoration-dotted cursor-help", ...props, children }),
|
|
1782
|
+
cite: ({ children, ...props }) => /* @__PURE__ */ jsx("cite", { className: "italic", ...props, children })
|
|
1783
|
+
};
|
|
1784
|
+
var MarkdownStreamingContext = createContext(false);
|
|
1785
|
+
|
|
1786
|
+
// src/ai/split-markdown-blocks.ts
|
|
1787
|
+
var LIST_ITEM_RE = /^\s*([-*+]|\d+[.)])\s/;
|
|
1788
|
+
var BLOCKQUOTE_RE = /^\s*>/;
|
|
1789
|
+
function splitMarkdownBlocks(content) {
|
|
1790
|
+
if (!content) return [];
|
|
1791
|
+
const blocks = [];
|
|
1792
|
+
let start = 0;
|
|
1793
|
+
let inFence = false;
|
|
1794
|
+
let i = 0;
|
|
1795
|
+
while (i < content.length) {
|
|
1796
|
+
if (content.startsWith("```", i)) {
|
|
1797
|
+
inFence = !inFence;
|
|
1798
|
+
i += 3;
|
|
1799
|
+
continue;
|
|
1800
|
+
}
|
|
1801
|
+
if (!inFence && content[i] === "\n" && content[i + 1] === "\n") {
|
|
1802
|
+
const before = content.slice(start, i);
|
|
1803
|
+
const lastLine = before.slice(before.lastIndexOf("\n") + 1);
|
|
1804
|
+
const afterStart = i + 2;
|
|
1805
|
+
const nextNewline = content.indexOf("\n", afterStart);
|
|
1806
|
+
const nextLine = content.slice(afterStart, nextNewline === -1 ? void 0 : nextNewline);
|
|
1807
|
+
const bothListItems = LIST_ITEM_RE.test(lastLine) && LIST_ITEM_RE.test(nextLine);
|
|
1808
|
+
const bothBlockquotes = BLOCKQUOTE_RE.test(lastLine) && BLOCKQUOTE_RE.test(nextLine);
|
|
1809
|
+
if (bothListItems || bothBlockquotes) {
|
|
1810
|
+
i += 2;
|
|
1811
|
+
continue;
|
|
1812
|
+
}
|
|
1813
|
+
blocks.push(content.slice(start, afterStart));
|
|
1814
|
+
start = afterStart;
|
|
1815
|
+
i = afterStart;
|
|
1816
|
+
continue;
|
|
1817
|
+
}
|
|
1818
|
+
i++;
|
|
1819
|
+
}
|
|
1820
|
+
if (start < content.length) blocks.push(content.slice(start));
|
|
1821
|
+
return blocks;
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
// src/ai/normalize-citations.ts
|
|
1825
|
+
var CITE_LINK = /\[([^\]\n]+)\]\((#cite-[\w-]+)\)/g;
|
|
1826
|
+
var BLOCK_MARKER = /^(?:[-*+]|\d{1,9}[.)]|#{1,6})[ \t]+/;
|
|
1827
|
+
var LEADING_EMPHASIS = /^(?:\*\*|__|\*|_)+/;
|
|
1828
|
+
var TRAILING_EMPHASIS = /(\*\*|__|\*|_)(:?)$/;
|
|
1829
|
+
function countToken(text, token) {
|
|
1830
|
+
const double = token + token;
|
|
1831
|
+
if (token.length === 2) return text.split(token).length - 1;
|
|
1832
|
+
const withoutDouble = text.split(double).join("");
|
|
1833
|
+
return withoutDouble.split(token).length - 1;
|
|
1834
|
+
}
|
|
1835
|
+
function emphasisTokens(run) {
|
|
1836
|
+
const char = run[0];
|
|
1837
|
+
const tokens = [];
|
|
1838
|
+
let rest = run;
|
|
1839
|
+
while (rest.length > 0) {
|
|
1840
|
+
const size = rest.length >= 2 ? 2 : 1;
|
|
1841
|
+
tokens.push(char.repeat(size));
|
|
1842
|
+
rest = rest.slice(size);
|
|
1843
|
+
}
|
|
1844
|
+
return tokens;
|
|
1845
|
+
}
|
|
1846
|
+
function hoistFromLink(text, before, after) {
|
|
1847
|
+
let body = text;
|
|
1848
|
+
let prefix = "";
|
|
1849
|
+
let suffix = "";
|
|
1850
|
+
if (before.trim() === "") {
|
|
1851
|
+
const marker = BLOCK_MARKER.exec(body);
|
|
1852
|
+
if (marker) {
|
|
1853
|
+
prefix += marker[0];
|
|
1854
|
+
body = body.slice(marker[0].length);
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
const leading = LEADING_EMPHASIS.exec(body);
|
|
1858
|
+
if (leading) {
|
|
1859
|
+
let kept = "";
|
|
1860
|
+
let rest = body.slice(leading[0].length);
|
|
1861
|
+
for (const token of emphasisTokens(leading[0]).reverse()) {
|
|
1862
|
+
if (countToken(rest, token) % 2 === 1) {
|
|
1863
|
+
kept = token + kept;
|
|
1864
|
+
continue;
|
|
1865
|
+
}
|
|
1866
|
+
if (countToken(after, token) % 2 === 1) prefix += token;
|
|
1867
|
+
else kept = token + kept;
|
|
1868
|
+
}
|
|
1869
|
+
body = kept + rest;
|
|
1870
|
+
rest = "";
|
|
1871
|
+
}
|
|
1872
|
+
const trailing = TRAILING_EMPHASIS.exec(body);
|
|
1873
|
+
if (trailing) {
|
|
1874
|
+
const token = trailing[1];
|
|
1875
|
+
const inner = body.slice(0, body.length - trailing[0].length);
|
|
1876
|
+
const openedBefore = countToken(before + prefix, token) % 2 === 1;
|
|
1877
|
+
if (countToken(inner, token) % 2 === 0 && openedBefore) {
|
|
1878
|
+
body = inner;
|
|
1879
|
+
suffix = trailing[0];
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
return [prefix, body, suffix];
|
|
1883
|
+
}
|
|
1884
|
+
function normalizeLine(line) {
|
|
1885
|
+
if (!line.includes("](#cite-")) return line;
|
|
1886
|
+
return line.replace(CITE_LINK, (match, text, href, offset) => {
|
|
1887
|
+
const before = line.slice(0, offset);
|
|
1888
|
+
const after = line.slice(offset + match.length);
|
|
1889
|
+
const [prefix, body, suffix] = hoistFromLink(text, before, after);
|
|
1890
|
+
if (!prefix && !suffix && body === text) return match;
|
|
1891
|
+
return `${prefix}[${body}](${href})${suffix}`;
|
|
1892
|
+
});
|
|
1893
|
+
}
|
|
1894
|
+
function normalizeCitationMarkup(markdown) {
|
|
1895
|
+
if (!markdown.includes("](#cite-")) return markdown;
|
|
1896
|
+
let inFence = false;
|
|
1897
|
+
return markdown.split("\n").map((line) => {
|
|
1898
|
+
if (/^\s*(```|~~~)/.test(line)) {
|
|
1899
|
+
inFence = !inFence;
|
|
1900
|
+
return line;
|
|
1901
|
+
}
|
|
1902
|
+
return inFence ? line : normalizeLine(line);
|
|
1903
|
+
}).join("\n");
|
|
1904
|
+
}
|
|
1905
|
+
function CodeBlock({ language, code }) {
|
|
1906
|
+
const [copied, setCopied] = useState(false);
|
|
1907
|
+
const handleCopy = async () => {
|
|
1908
|
+
try {
|
|
1909
|
+
await navigator.clipboard.writeText(code);
|
|
1910
|
+
setCopied(true);
|
|
1911
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
1912
|
+
} catch {
|
|
1913
|
+
}
|
|
1914
|
+
};
|
|
1915
|
+
return /* @__PURE__ */ jsxs(
|
|
1916
|
+
"div",
|
|
1917
|
+
{
|
|
1918
|
+
className: "code-block relative my-3 overflow-hidden rounded-md border border-current/20 bg-current/5",
|
|
1919
|
+
"data-testid": "markdown-code-block",
|
|
1920
|
+
children: [
|
|
1921
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b border-current/20 px-3 py-1.5", children: [
|
|
1922
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-xs text-muted-foreground", children: language || "code" }),
|
|
1923
|
+
/* @__PURE__ */ jsxs(
|
|
1924
|
+
"button",
|
|
1925
|
+
{
|
|
1926
|
+
type: "button",
|
|
1927
|
+
onClick: handleCopy,
|
|
1928
|
+
className: "flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground",
|
|
1929
|
+
title: copied ? "Copied!" : "Copy code",
|
|
1930
|
+
children: [
|
|
1931
|
+
copied ? /* @__PURE__ */ jsx(Check, { size: 12 }) : /* @__PURE__ */ jsx(Copy, { size: 12 }),
|
|
1932
|
+
/* @__PURE__ */ jsx("span", { children: copied ? "Copied" : "Copy" })
|
|
1933
|
+
]
|
|
1934
|
+
}
|
|
1935
|
+
)
|
|
1936
|
+
] }),
|
|
1937
|
+
/* @__PURE__ */ jsx("pre", { className: "overflow-x-auto p-3 text-sm leading-relaxed", children: /* @__PURE__ */ jsx("code", { className: cn("font-mono", language && `language-${language}`), children: code }) })
|
|
1938
|
+
]
|
|
1939
|
+
}
|
|
1940
|
+
);
|
|
1941
|
+
}
|
|
1942
|
+
var defaultComponents = {
|
|
1943
|
+
...markdownBaseComponents,
|
|
1944
|
+
a: ({ href, children, ...props }) => {
|
|
1945
|
+
if (href?.startsWith("#cite-")) {
|
|
1946
|
+
return /* @__PURE__ */ jsx(
|
|
1947
|
+
"span",
|
|
1948
|
+
{
|
|
1949
|
+
className: "cited-text underline decoration-dotted underline-offset-4",
|
|
1950
|
+
"data-cite": href.slice(6),
|
|
1951
|
+
children
|
|
1952
|
+
}
|
|
1953
|
+
);
|
|
1954
|
+
}
|
|
1955
|
+
const isInternal = !href || href.startsWith("#") || href.startsWith("cite:");
|
|
1956
|
+
return /* @__PURE__ */ jsx(
|
|
1957
|
+
"a",
|
|
1958
|
+
{
|
|
1959
|
+
className: "text-primary underline underline-offset-2",
|
|
1960
|
+
href,
|
|
1961
|
+
...isInternal ? {} : { target: "_blank", rel: "noopener noreferrer" },
|
|
1962
|
+
...props,
|
|
1963
|
+
children
|
|
1964
|
+
}
|
|
1965
|
+
);
|
|
1966
|
+
},
|
|
1967
|
+
em: ({ children, ...props }) => /* @__PURE__ */ jsx("em", { className: "italic", ...props, children }),
|
|
1968
|
+
code: function MarkdownCode({
|
|
1969
|
+
className,
|
|
1970
|
+
children,
|
|
1971
|
+
...props
|
|
1972
|
+
}) {
|
|
1973
|
+
const match = /language-(\w+)/.exec(className || "");
|
|
1974
|
+
if (!match) {
|
|
1975
|
+
return /* @__PURE__ */ jsx(
|
|
1976
|
+
"code",
|
|
1977
|
+
{
|
|
1978
|
+
className: "rounded bg-current/10 px-1 py-0.5 font-mono text-[0.9em]",
|
|
1979
|
+
"data-testid": "markdown-inline-code",
|
|
1980
|
+
...props,
|
|
1981
|
+
children
|
|
1982
|
+
}
|
|
1983
|
+
);
|
|
1984
|
+
}
|
|
1985
|
+
return /* @__PURE__ */ jsx(CodeBlock, { language: match[1], code: String(children).replace(/\n$/, "") });
|
|
1986
|
+
},
|
|
1987
|
+
// The CodeBlock renders its own <pre>; unwrap react-markdown's wrapper so we
|
|
1988
|
+
// don't nest <pre><pre>.
|
|
1989
|
+
pre: ({ children }) => /* @__PURE__ */ jsx(Fragment, { children }),
|
|
1990
|
+
blockquote: ({ children, ...props }) => /* @__PURE__ */ jsx("blockquote", { className: "border-l-2 border-border pl-4 italic text-muted-foreground", ...props, children }),
|
|
1991
|
+
table: ({ children, ...props }) => /* @__PURE__ */ jsx("div", { className: "my-3 overflow-x-auto rounded-lg border border-border", children: /* @__PURE__ */ jsx("table", { "data-testid": "markdown-table", className: "w-full border-collapse text-sm", ...props, children }) }),
|
|
1992
|
+
thead: ({ children, ...props }) => /* @__PURE__ */ jsx("thead", { className: "bg-current/10", ...props, children }),
|
|
1993
|
+
th: ({ children, ...props }) => /* @__PURE__ */ jsx("th", { className: "border-b border-border px-3 py-2 text-left font-semibold", ...props, children }),
|
|
1994
|
+
td: ({ children, ...props }) => /* @__PURE__ */ jsx("td", { className: "border-b border-border px-3 py-2 align-top", ...props, children }),
|
|
1995
|
+
// General emphasis marks (GFM `~~strikethrough~~` → <del>, raw <ins>/<mark>).
|
|
1996
|
+
del: ({ children, ...props }) => /* @__PURE__ */ jsx("del", { className: "text-muted-foreground line-through", ...props, children }),
|
|
1997
|
+
ins: ({ children, ...props }) => /* @__PURE__ */ jsx("ins", { className: "underline decoration-primary/60", ...props, children }),
|
|
1998
|
+
mark: ({ children, ...props }) => /* @__PURE__ */ jsx("mark", { className: "rounded bg-primary/15 px-0.5 text-inherit", ...props, children })
|
|
1999
|
+
};
|
|
2000
|
+
var remarkPlugins = [remarkGfm];
|
|
2001
|
+
var rehypePlugins = [rehypeRaw];
|
|
2002
|
+
var MemoizedBlock = React__default.memo(function MarkdownBlock({
|
|
2003
|
+
content,
|
|
2004
|
+
components
|
|
2005
|
+
}) {
|
|
2006
|
+
return /* @__PURE__ */ jsx(Markdown, { remarkPlugins, rehypePlugins, components, children: content });
|
|
2007
|
+
});
|
|
2008
|
+
var MarkdownErrorBoundary = class extends React__default.Component {
|
|
2009
|
+
state = { hasError: false };
|
|
2010
|
+
static getDerivedStateFromError() {
|
|
2011
|
+
return { hasError: true };
|
|
2012
|
+
}
|
|
2013
|
+
render() {
|
|
2014
|
+
return this.state.hasError ? this.props.fallback : this.props.children;
|
|
2015
|
+
}
|
|
2016
|
+
};
|
|
2017
|
+
function MarkdownRendererComponent({
|
|
2018
|
+
children,
|
|
2019
|
+
components: customComponents,
|
|
2020
|
+
isStreaming = false,
|
|
2021
|
+
className,
|
|
2022
|
+
testId = "markdown-renderer"
|
|
2023
|
+
}) {
|
|
2024
|
+
const components = useMemo(
|
|
2025
|
+
() => customComponents ? { ...defaultComponents, ...customComponents } : defaultComponents,
|
|
2026
|
+
[customComponents]
|
|
2027
|
+
);
|
|
2028
|
+
const blocks = useMemo(() => splitMarkdownBlocks(normalizeCitationMarkup(children)), [children]);
|
|
2029
|
+
return /* @__PURE__ */ jsx(
|
|
2030
|
+
MarkdownErrorBoundary,
|
|
2031
|
+
{
|
|
2032
|
+
fallback: /* @__PURE__ */ jsx("div", { className: cn("whitespace-pre-wrap break-words", className), children }),
|
|
2033
|
+
children: /* @__PURE__ */ jsx(MarkdownStreamingContext.Provider, { value: isStreaming, children: /* @__PURE__ */ jsx(
|
|
2034
|
+
"div",
|
|
2035
|
+
{
|
|
2036
|
+
className: cn("markdown-content space-y-3 break-words leading-relaxed", className),
|
|
2037
|
+
"data-testid": testId,
|
|
2038
|
+
children: blocks.map((block, index) => /* @__PURE__ */ jsx(MemoizedBlock, { content: block, components }, index))
|
|
2039
|
+
}
|
|
2040
|
+
) })
|
|
2041
|
+
}
|
|
2042
|
+
);
|
|
2043
|
+
}
|
|
2044
|
+
var MarkdownRenderer = React__default.memo(MarkdownRendererComponent);
|
|
1963
2045
|
var AI_COMPONENTS = {
|
|
1964
2046
|
a: (p) => /* @__PURE__ */ jsx(
|
|
1965
2047
|
"a",
|
|
@@ -1984,7 +2066,7 @@ function AiMarkdown({
|
|
|
1984
2066
|
return /* @__PURE__ */ jsx(
|
|
1985
2067
|
MarkdownRenderer,
|
|
1986
2068
|
{
|
|
1987
|
-
className: className ?? "text-sm
|
|
2069
|
+
className: className ?? "text-sm",
|
|
1988
2070
|
components: AI_COMPONENTS,
|
|
1989
2071
|
isStreaming,
|
|
1990
2072
|
testId: "ai-markdown",
|
|
@@ -3423,7 +3505,7 @@ var getEntityLabel = (entityType, form = "SINGULAR") => {
|
|
|
3423
3505
|
};
|
|
3424
3506
|
var EntityIcon = ({ entityType, variant = "DEFAULT", ...props }) => {
|
|
3425
3507
|
const IconComponent = getEntityIcon(entityType, variant);
|
|
3426
|
-
return IconComponent ?
|
|
3508
|
+
return IconComponent ? React__default.createElement(IconComponent, props) : null;
|
|
3427
3509
|
};
|
|
3428
3510
|
var VISIBILITY_ICONS = {
|
|
3429
3511
|
PRIVATE: MessageSquareLock,
|
|
@@ -3434,7 +3516,7 @@ var VisibilityIcon = ({
|
|
|
3434
3516
|
...props
|
|
3435
3517
|
}) => {
|
|
3436
3518
|
const IconComponent = isShared ? VISIBILITY_ICONS.SHARED : VISIBILITY_ICONS.PRIVATE;
|
|
3437
|
-
return
|
|
3519
|
+
return React__default.createElement(IconComponent, props);
|
|
3438
3520
|
};
|
|
3439
3521
|
|
|
3440
3522
|
// src/entities/colors.ts
|
|
@@ -3699,7 +3781,7 @@ function RenameField({
|
|
|
3699
3781
|
onCancel,
|
|
3700
3782
|
testId
|
|
3701
3783
|
}) {
|
|
3702
|
-
const done =
|
|
3784
|
+
const done = React__default.useRef(false);
|
|
3703
3785
|
const commit = (value) => {
|
|
3704
3786
|
if (done.current) return;
|
|
3705
3787
|
done.current = true;
|
|
@@ -3787,8 +3869,8 @@ function DocumentCard({
|
|
|
3787
3869
|
const normalised = (status ?? "").toLowerCase();
|
|
3788
3870
|
const isProcessing = ACTIVE_STATUSES.has(normalised);
|
|
3789
3871
|
const showStatusMarker = !isProcessing && TERMINAL_STATUSES.has(normalised);
|
|
3790
|
-
const [thumbFailed, setThumbFailed] =
|
|
3791
|
-
const [thumbLandscape, setThumbLandscape] =
|
|
3872
|
+
const [thumbFailed, setThumbFailed] = React__default.useState(false);
|
|
3873
|
+
const [thumbLandscape, setThumbLandscape] = React__default.useState(false);
|
|
3792
3874
|
const showThumbnail = !!thumbnailUrl && !thumbFailed && !isProcessing;
|
|
3793
3875
|
return /* @__PURE__ */ jsxs(
|
|
3794
3876
|
"div",
|
|
@@ -3877,6 +3959,6 @@ function DocumentCard({
|
|
|
3877
3959
|
);
|
|
3878
3960
|
}
|
|
3879
3961
|
|
|
3880
|
-
export { AgentBadge, AiMarkdown, ArbiBotHeadIcon, AudIcon, Avatar, AvatarFallback, AvatarImage, BASE_COLORS2 as BASE_COLORS, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DictateProvider, DocumentCard, DocumentEntity, ENTITY_MAPPINGS, EmlIcon, EntityIcon, EntityPill, FILE_TYPE_COLORS, HoverCard, HoverCardContent, HoverCardTrigger, IconToggle, ImgIcon, InlineMicButton, Input, Label, MarkMenu, MarkdownRenderer, MarkdownStreamingContext, MicRecordingOverlay, MicWaveformIndicator, NEUTRAL_GRAY2 as NEUTRAL_GRAY, PLACEHOLDER_COLOR, PassageCard, PdfIcon, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PresenceLabel, Progress, ProjectEntity, RadioGroup, RadioGroupItem, RagDot, RelevanceDot, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Slider, StatusPill, Switch, TAG_TYPE_ICONS, TAG_TYPE_LABELS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TagEntity, Textarea, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UserEntity, UserMenu, VISIBILITY_ICONS, VidIcon, VisibilityIcon, badgeVariants, buttonVariants, cardVariants, classifyMediaError, configureEntityRegistry, configureRagLabels, configureStatusRegistry, formatElapsed, getDocIcon, getEntityColor2 as getEntityColor, getEntityColorStyles, getEntityIcon, getEntityLabel, getStatusVariant, getTagTypeIcon, getTagTypeLabel, getWorkspaceColor, markdownBaseComponents, splitMarkdownBlocks, toggleVariants, useAudioRecorder };
|
|
3881
|
-
//# sourceMappingURL=chunk-
|
|
3882
|
-
//# sourceMappingURL=chunk-
|
|
3962
|
+
export { AgentBadge, AiMarkdown, ArbiBotHeadIcon, AudIcon, Avatar, AvatarFallback, AvatarImage, BASE_COLORS2 as BASE_COLORS, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DictateProvider, DocumentCard, DocumentEntity, ENTITY_MAPPINGS, EmlIcon, EntityIcon, EntityPill, FILE_TYPE_COLORS, HoverCard, HoverCardContent, HoverCardTrigger, IconToggle, ImgIcon, InlineMicButton, Input, Label, MarkMenu, MarkdownRenderer, MarkdownStreamingContext, MicRecordingOverlay, MicWaveformIndicator, NEUTRAL_GRAY2 as NEUTRAL_GRAY, PLACEHOLDER_COLOR, PassageCard, PdfIcon, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PresenceLabel, Progress, ProjectEntity, RadioGroup, RadioGroupItem, RagDot, RelevanceDot, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Slider, StatusPill, Switch, TAG_TYPE_ICONS, TAG_TYPE_LABELS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TagEntity, Textarea, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UserEntity, UserMenu, VISIBILITY_ICONS, VidIcon, VisibilityIcon, badgeVariants, buttonVariants, cardVariants, classifyMediaError, configureEntityRegistry, configureRagLabels, configureStatusRegistry, formatElapsed, getDocIcon, getEntityColor2 as getEntityColor, getEntityColorStyles, getEntityIcon, getEntityLabel, getStatusVariant, getTagTypeIcon, getTagTypeLabel, getWorkspaceColor, markdownBaseComponents, normalizeCitationMarkup, splitMarkdownBlocks, toggleVariants, useAudioRecorder };
|
|
3963
|
+
//# sourceMappingURL=chunk-MIJRORQL.js.map
|
|
3964
|
+
//# sourceMappingURL=chunk-MIJRORQL.js.map
|