ai-schadcn-chat 0.1.0
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/LICENSE +21 -0
- package/README.md +307 -0
- package/dist/ChatPanel-Cyq7boWQ.js +3468 -0
- package/dist/ChatPanel-Cyq7boWQ.js.map +1 -0
- package/dist/ChatPanel-D3VL5Vdq.cjs +10 -0
- package/dist/ChatPanel-D3VL5Vdq.cjs.map +1 -0
- package/dist/ChatProvider-DcrNbVMh.cjs +2 -0
- package/dist/ChatProvider-DcrNbVMh.cjs.map +1 -0
- package/dist/ChatProvider-DoD4jj4M.js +128 -0
- package/dist/ChatProvider-DoD4jj4M.js.map +1 -0
- package/dist/chat-engine-BaFdimfx.cjs +8 -0
- package/dist/chat-engine-BaFdimfx.cjs.map +1 -0
- package/dist/chat-engine-Cja0KtWE.js +520 -0
- package/dist/chat-engine-Cja0KtWE.js.map +1 -0
- package/dist/components/chat/AgentManager.d.ts +11 -0
- package/dist/components/chat/AgentManager.d.ts.map +1 -0
- package/dist/components/chat/AgentManager.js +110 -0
- package/dist/components/chat/Attachment.d.ts +34 -0
- package/dist/components/chat/Attachment.d.ts.map +1 -0
- package/dist/components/chat/Attachment.js +59 -0
- package/dist/components/chat/AttachmentPreview.d.ts +8 -0
- package/dist/components/chat/AttachmentPreview.d.ts.map +1 -0
- package/dist/components/chat/AttachmentPreview.js +43 -0
- package/dist/components/chat/ChatComposer.d.ts +11 -0
- package/dist/components/chat/ChatComposer.d.ts.map +1 -0
- package/dist/components/chat/ChatComposer.js +10 -0
- package/dist/components/chat/ChatHeader.d.ts +5 -0
- package/dist/components/chat/ChatHeader.d.ts.map +1 -0
- package/dist/components/chat/ChatHeader.js +132 -0
- package/dist/components/chat/ChatPanel.d.ts +36 -0
- package/dist/components/chat/ChatPanel.d.ts.map +1 -0
- package/dist/components/chat/ChatPanel.js +55 -0
- package/dist/components/chat/ChatProvider.d.ts +58 -0
- package/dist/components/chat/ChatProvider.d.ts.map +1 -0
- package/dist/components/chat/ChatProvider.js +145 -0
- package/dist/components/chat/Chatbubble.d.ts +30 -0
- package/dist/components/chat/Chatbubble.d.ts.map +1 -0
- package/dist/components/chat/Chatbubble.js +50 -0
- package/dist/components/chat/Markdown.d.ts +35 -0
- package/dist/components/chat/Markdown.d.ts.map +1 -0
- package/dist/components/chat/Markdown.js +130 -0
- package/dist/components/chat/Message.d.ts +22 -0
- package/dist/components/chat/Message.d.ts.map +1 -0
- package/dist/components/chat/Message.js +21 -0
- package/dist/components/chat/MessageInput.d.ts +24 -0
- package/dist/components/chat/MessageInput.d.ts.map +1 -0
- package/dist/components/chat/MessageInput.js +255 -0
- package/dist/components/chat/MessageList.d.ts +9 -0
- package/dist/components/chat/MessageList.d.ts.map +1 -0
- package/dist/components/chat/MessageList.js +249 -0
- package/dist/components/chat/MessageMarker.d.ts +25 -0
- package/dist/components/chat/MessageMarker.d.ts.map +1 -0
- package/dist/components/chat/MessageMarker.js +31 -0
- package/dist/components/chat/MessageScroller.d.ts +12 -0
- package/dist/components/chat/MessageScroller.d.ts.map +1 -0
- package/dist/components/chat/MessageScroller.js +48 -0
- package/dist/components/chat/MessageScrollerPrimitives.d.ts +76 -0
- package/dist/components/chat/MessageScrollerPrimitives.d.ts.map +1 -0
- package/dist/components/chat/MessageScrollerPrimitives.js +438 -0
- package/dist/components/chat/ProviderManager.d.ts +10 -0
- package/dist/components/chat/ProviderManager.d.ts.map +1 -0
- package/dist/components/chat/ProviderManager.js +110 -0
- package/dist/components/chat/ReasoningPanel.d.ts +15 -0
- package/dist/components/chat/ReasoningPanel.d.ts.map +1 -0
- package/dist/components/chat/ReasoningPanel.js +40 -0
- package/dist/components/chat/ThemeToggle.d.ts +4 -0
- package/dist/components/chat/ThemeToggle.d.ts.map +1 -0
- package/dist/components/chat/ThemeToggle.js +59 -0
- package/dist/components/index.d.ts +44 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +49 -0
- package/dist/components/ui/avatar.d.ts +11 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar.js +33 -0
- package/dist/components/ui/badge.d.ts +10 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +19 -0
- package/dist/components/ui/button.d.ts +12 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +34 -0
- package/dist/components/ui/card.d.ts +8 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.js +15 -0
- package/dist/components/ui/checkbox.d.ts +5 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +8 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +5 -0
- package/dist/components/ui/dialog.d.ts +24 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +30 -0
- package/dist/components/ui/dropdown-menu.d.ts +17 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +20 -0
- package/dist/components/ui/input.d.ts +4 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +7 -0
- package/dist/components/ui/label.d.ts +6 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/label.js +10 -0
- package/dist/components/ui/popover.d.ts +6 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +9 -0
- package/dist/components/ui/scroll-area.d.ts +3 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +8 -0
- package/dist/components/ui/select.d.ts +14 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +26 -0
- package/dist/components/ui/separator.d.ts +3 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +6 -0
- package/dist/components/ui/switch.d.ts +3 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/switch.js +6 -0
- package/dist/components/ui/tabs.d.ts +6 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +11 -0
- package/dist/components/ui/tooltip.d.ts +6 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +9 -0
- package/dist/components.cjs +2 -0
- package/dist/components.cjs.map +1 -0
- package/dist/components.js +129 -0
- package/dist/components.js.map +1 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +3 -0
- package/dist/hooks/useChat.d.ts +6 -0
- package/dist/hooks/useChat.d.ts.map +1 -0
- package/dist/hooks/useChat.js +5 -0
- package/dist/hooks.cjs +2 -0
- package/dist/hooks.cjs.map +1 -0
- package/dist/hooks.js +8 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index-Ci4qkGOp.cjs +20 -0
- package/dist/index-Ci4qkGOp.cjs.map +1 -0
- package/dist/index-NhYr-cEJ.js +567 -0
- package/dist/index-NhYr-cEJ.js.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/agents.d.ts +29 -0
- package/dist/lib/agents.d.ts.map +1 -0
- package/dist/lib/agents.js +145 -0
- package/dist/lib/attachments.d.ts +40 -0
- package/dist/lib/attachments.d.ts.map +1 -0
- package/dist/lib/attachments.js +152 -0
- package/dist/lib/chat-engine.d.ts +109 -0
- package/dist/lib/chat-engine.d.ts.map +1 -0
- package/dist/lib/chat-engine.js +505 -0
- package/dist/lib/index.d.ts +8 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +7 -0
- package/dist/lib/persistence.d.ts +30 -0
- package/dist/lib/persistence.d.ts.map +1 -0
- package/dist/lib/persistence.js +104 -0
- package/dist/lib/providers.d.ts +40 -0
- package/dist/lib/providers.d.ts.map +1 -0
- package/dist/lib/providers.js +0 -0
- package/dist/lib/tw-merge.d.ts +9 -0
- package/dist/lib/tw-merge.d.ts.map +1 -0
- package/dist/lib/tw-merge.js +8 -0
- package/dist/lib/utils.d.ts +69 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +166 -0
- package/dist/lib/voice.d.ts +57 -0
- package/dist/lib/voice.d.ts.map +1 -0
- package/dist/lib/voice.js +103 -0
- package/dist/lib.cjs +2 -0
- package/dist/lib.cjs.map +1 -0
- package/dist/lib.js +59 -0
- package/dist/lib.js.map +1 -0
- package/dist/marker.css +68 -0
- package/dist/package.json +6 -0
- package/dist/presets-BxnbImSM.cjs +2 -0
- package/dist/presets-BxnbImSM.cjs.map +1 -0
- package/dist/presets-D8VQTD8n.js +193 -0
- package/dist/presets-D8VQTD8n.js.map +1 -0
- package/dist/providers/anthropic.d.ts +30 -0
- package/dist/providers/anthropic.d.ts.map +1 -0
- package/dist/providers/anthropic.js +251 -0
- package/dist/providers/base.d.ts +55 -0
- package/dist/providers/base.d.ts.map +1 -0
- package/dist/providers/base.js +272 -0
- package/dist/providers/index.d.ts +15 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +24 -0
- package/dist/providers/openai.d.ts +31 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +192 -0
- package/dist/providers-BuaGy2tX.cjs +4 -0
- package/dist/providers-BuaGy2tX.cjs.map +1 -0
- package/dist/providers-kp-avTNl.js +324 -0
- package/dist/providers-kp-avTNl.js.map +1 -0
- package/dist/providers.cjs +2 -0
- package/dist/providers.cjs.map +1 -0
- package/dist/providers.js +14 -0
- package/dist/providers.js.map +1 -0
- package/dist/scroller.css +278 -0
- package/dist/style.css +1 -0
- package/dist/types/chat.d.ts +342 -0
- package/dist/types/chat.d.ts.map +1 -0
- package/dist/types/chat.js +4 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +14 -0
- package/dist/types/presets.d.ts +25 -0
- package/dist/types/presets.d.ts.map +1 -0
- package/dist/types/presets.js +207 -0
- package/dist/types.cjs +2 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.js +16 -0
- package/dist/types.js.map +1 -0
- package/dist/typeset-presets.css +56 -0
- package/dist/typeset.css +505 -0
- package/package.json +158 -0
|
@@ -0,0 +1,3468 @@
|
|
|
1
|
+
import { jsx as t, jsxs as s, Fragment as L } from "react/jsx-runtime";
|
|
2
|
+
import * as h from "react";
|
|
3
|
+
import { forwardRef as S, useState as z, useEffect as ne, useCallback as Ce, useRef as W, useLayoutEffect as Yt, useMemo as Qt, memo as Xt } from "react";
|
|
4
|
+
import { c as d, f as Jt, e as Zt } from "./index-NhYr-cEJ.js";
|
|
5
|
+
import * as X from "@radix-ui/react-scroll-area";
|
|
6
|
+
import * as Oe from "@radix-ui/react-avatar";
|
|
7
|
+
import * as lt from "@radix-ui/react-switch";
|
|
8
|
+
import * as ea from "@radix-ui/react-separator";
|
|
9
|
+
import * as Te from "@radix-ui/react-tabs";
|
|
10
|
+
import * as je from "@radix-ui/react-checkbox";
|
|
11
|
+
import { X as ft, Check as P, ChevronDown as Ae, ChevronUp as ta, Copy as Me, Pencil as Ue, Trash2 as pe, Plus as Ke, ArrowLeft as gt, Sun as aa, Moon as ra, Sparkles as ze, Settings2 as Fe, FileText as Ge, MessageSquarePlus as na, History as sa, Wrench as qe, MoreHorizontal as oa, RotateCcw as We, FileType as ia, FileJson as la, FileCode as ca, File as da, Loader2 as Le, Paperclip as ua, MicOff as ma, Mic as pa, Square as fa, Send as ga, ArrowDownIcon as ha, Lightbulb as ba, ChevronRight as xa, ArrowDown as va, AlertTriangle as ae, User as ya, Bot as Na, Gauge as ht, Hash as wa, Clock as ka, ServerCrash as Ca, WifiOff as za, KeyRound as Sa } from "lucide-react";
|
|
12
|
+
import * as fe from "@radix-ui/react-tooltip";
|
|
13
|
+
import { d as Ta, c as Aa, l as bt, s as Ma, g as Ra, q as Da, r as Pa, a as Ia, e as Ea, j as xt, m as _a, n as Ha, p as ja, f as Fa, k as La, t as Ba } from "./providers-kp-avTNl.js";
|
|
14
|
+
import { cva as K } from "class-variance-authority";
|
|
15
|
+
import { Slot as Re } from "@radix-ui/react-slot";
|
|
16
|
+
import * as I from "@radix-ui/react-dropdown-menu";
|
|
17
|
+
import * as O from "@radix-ui/react-dialog";
|
|
18
|
+
import * as vt from "@radix-ui/react-label";
|
|
19
|
+
import * as A from "@radix-ui/react-select";
|
|
20
|
+
import { u as se, a as Ye, C as Va } from "./ChatProvider-DoD4jj4M.js";
|
|
21
|
+
import * as Qe from "@radix-ui/react-collapsible";
|
|
22
|
+
import $a from "react-markdown";
|
|
23
|
+
import Oa from "rehype-highlight";
|
|
24
|
+
import ct from "rehype-raw";
|
|
25
|
+
import Ua from "remark-gfm";
|
|
26
|
+
import { f as Ka, e as Ga } from "./chat-engine-Cja0KtWE.js";
|
|
27
|
+
import * as ge from "@radix-ui/react-popover";
|
|
28
|
+
const qa = K(
|
|
29
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
30
|
+
{
|
|
31
|
+
variants: {
|
|
32
|
+
variant: {
|
|
33
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
34
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
35
|
+
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
36
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
37
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
38
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
39
|
+
},
|
|
40
|
+
size: {
|
|
41
|
+
default: "h-10 px-4 py-2",
|
|
42
|
+
sm: "h-9 rounded-md px-3",
|
|
43
|
+
lg: "h-11 rounded-md px-8",
|
|
44
|
+
icon: "h-10 w-10",
|
|
45
|
+
"icon-sm": "h-8 w-8"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
defaultVariants: {
|
|
49
|
+
variant: "default",
|
|
50
|
+
size: "default"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
), N = S(
|
|
54
|
+
({ className: e, variant: a, size: r, asChild: n = !1, ...i }, c) => /* @__PURE__ */ t(
|
|
55
|
+
n ? Re : "button",
|
|
56
|
+
{
|
|
57
|
+
className: d(qa({ variant: a, size: r, className: e })),
|
|
58
|
+
ref: c,
|
|
59
|
+
...i
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
);
|
|
63
|
+
N.displayName = "Button";
|
|
64
|
+
const $ = S(
|
|
65
|
+
({ className: e, type: a, ...r }, n) => /* @__PURE__ */ t(
|
|
66
|
+
"input",
|
|
67
|
+
{
|
|
68
|
+
type: a,
|
|
69
|
+
className: d(
|
|
70
|
+
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
71
|
+
e
|
|
72
|
+
),
|
|
73
|
+
ref: n,
|
|
74
|
+
...r
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
);
|
|
78
|
+
$.displayName = "Input";
|
|
79
|
+
const re = S(
|
|
80
|
+
({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
81
|
+
"textarea",
|
|
82
|
+
{
|
|
83
|
+
className: d(
|
|
84
|
+
"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
85
|
+
e
|
|
86
|
+
),
|
|
87
|
+
ref: r,
|
|
88
|
+
...a
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
);
|
|
92
|
+
re.displayName = "Textarea";
|
|
93
|
+
const Wa = S(
|
|
94
|
+
({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
95
|
+
"div",
|
|
96
|
+
{
|
|
97
|
+
ref: r,
|
|
98
|
+
className: d("rounded-lg border bg-card text-card-foreground shadow-sm", e),
|
|
99
|
+
...a
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
);
|
|
103
|
+
Wa.displayName = "Card";
|
|
104
|
+
const Ya = S(
|
|
105
|
+
({ className: e, ...a }, r) => /* @__PURE__ */ t("div", { ref: r, className: d("flex flex-col space-y-1.5 p-4", e), ...a })
|
|
106
|
+
);
|
|
107
|
+
Ya.displayName = "CardHeader";
|
|
108
|
+
const Qa = S(
|
|
109
|
+
({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
110
|
+
"h3",
|
|
111
|
+
{
|
|
112
|
+
ref: r,
|
|
113
|
+
className: d("text-base font-semibold leading-none tracking-tight", e),
|
|
114
|
+
...a
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
);
|
|
118
|
+
Qa.displayName = "CardTitle";
|
|
119
|
+
const Xa = S(
|
|
120
|
+
({ className: e, ...a }, r) => /* @__PURE__ */ t("p", { ref: r, className: d("text-sm text-muted-foreground", e), ...a })
|
|
121
|
+
);
|
|
122
|
+
Xa.displayName = "CardDescription";
|
|
123
|
+
const Ja = S(
|
|
124
|
+
({ className: e, ...a }, r) => /* @__PURE__ */ t("div", { ref: r, className: d("p-4 pt-0", e), ...a })
|
|
125
|
+
);
|
|
126
|
+
Ja.displayName = "CardContent";
|
|
127
|
+
const Za = S(
|
|
128
|
+
({ className: e, ...a }, r) => /* @__PURE__ */ t("div", { ref: r, className: d("flex items-center p-4 pt-0", e), ...a })
|
|
129
|
+
);
|
|
130
|
+
Za.displayName = "CardFooter";
|
|
131
|
+
const er = S(({ className: e, children: a, ...r }, n) => /* @__PURE__ */ s(
|
|
132
|
+
X.Root,
|
|
133
|
+
{
|
|
134
|
+
ref: n,
|
|
135
|
+
className: d("relative overflow-hidden", e),
|
|
136
|
+
...r,
|
|
137
|
+
children: [
|
|
138
|
+
/* @__PURE__ */ t(X.Viewport, { className: "h-full w-full rounded-[inherit]", children: a }),
|
|
139
|
+
/* @__PURE__ */ t(yt, {}),
|
|
140
|
+
/* @__PURE__ */ t(X.Corner, {})
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
));
|
|
144
|
+
er.displayName = X.Root.displayName;
|
|
145
|
+
const yt = S(({ className: e, orientation: a = "vertical", ...r }, n) => /* @__PURE__ */ t(
|
|
146
|
+
X.ScrollAreaScrollbar,
|
|
147
|
+
{
|
|
148
|
+
ref: n,
|
|
149
|
+
orientation: a,
|
|
150
|
+
className: d(
|
|
151
|
+
"flex touch-none select-none transition-colors",
|
|
152
|
+
a === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
|
|
153
|
+
a === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
|
|
154
|
+
e
|
|
155
|
+
),
|
|
156
|
+
...r,
|
|
157
|
+
children: /* @__PURE__ */ t(X.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
|
|
158
|
+
}
|
|
159
|
+
));
|
|
160
|
+
yt.displayName = X.ScrollAreaScrollbar.displayName;
|
|
161
|
+
const tr = "relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full", ar = "aspect-square h-full w-full", rr = "flex h-full w-full items-center justify-center rounded-full bg-muted text-xs font-medium uppercase", os = (e) => e.trim().split(/\s+/).slice(0, 2).map((a) => a[0]?.toUpperCase() ?? "").join("") || "·", is = (e) => {
|
|
162
|
+
const a = (e ?? "x").trim();
|
|
163
|
+
let r = 0;
|
|
164
|
+
for (let n = 0; n < a.length; n++) r = r * 31 + a.charCodeAt(n) >>> 0;
|
|
165
|
+
return `hsl(${r % 360}deg 70% 88%)`;
|
|
166
|
+
}, ls = (e) => {
|
|
167
|
+
const a = (e ?? "x").trim();
|
|
168
|
+
let r = 0;
|
|
169
|
+
for (let n = 0; n < a.length; n++) r = r * 17 + a.charCodeAt(n) >>> 0;
|
|
170
|
+
return `hsl(${r % 360}deg 40% 25%)`;
|
|
171
|
+
}, nr = S(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
172
|
+
Oe.Root,
|
|
173
|
+
{
|
|
174
|
+
ref: r,
|
|
175
|
+
className: d(tr, e),
|
|
176
|
+
...a
|
|
177
|
+
}
|
|
178
|
+
));
|
|
179
|
+
nr.displayName = "AvatarRoot";
|
|
180
|
+
const sr = S(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
181
|
+
Oe.Image,
|
|
182
|
+
{
|
|
183
|
+
ref: r,
|
|
184
|
+
className: d(ar, e),
|
|
185
|
+
...a
|
|
186
|
+
}
|
|
187
|
+
));
|
|
188
|
+
sr.displayName = "AvatarImage";
|
|
189
|
+
const or = S(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
190
|
+
Oe.Fallback,
|
|
191
|
+
{
|
|
192
|
+
ref: r,
|
|
193
|
+
className: d(rr, e),
|
|
194
|
+
...a
|
|
195
|
+
}
|
|
196
|
+
));
|
|
197
|
+
or.displayName = "AvatarFallback";
|
|
198
|
+
const Ne = I.Root, we = I.Trigger, cs = I.Group, ds = I.Portal, us = I.Sub, ms = I.RadioGroup, ue = S(({ className: e, sideOffset: a = 4, ...r }, n) => /* @__PURE__ */ t(I.Portal, { children: /* @__PURE__ */ t(
|
|
199
|
+
I.Content,
|
|
200
|
+
{
|
|
201
|
+
ref: n,
|
|
202
|
+
sideOffset: a,
|
|
203
|
+
className: d(
|
|
204
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
|
|
205
|
+
e
|
|
206
|
+
),
|
|
207
|
+
...r
|
|
208
|
+
}
|
|
209
|
+
) }));
|
|
210
|
+
ue.displayName = "DropdownMenuContent";
|
|
211
|
+
const q = S(({ className: e, inset: a, ...r }, n) => /* @__PURE__ */ t(
|
|
212
|
+
I.Item,
|
|
213
|
+
{
|
|
214
|
+
ref: n,
|
|
215
|
+
className: d(
|
|
216
|
+
"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:size-4",
|
|
217
|
+
a && "pl-8",
|
|
218
|
+
e
|
|
219
|
+
),
|
|
220
|
+
...r
|
|
221
|
+
}
|
|
222
|
+
));
|
|
223
|
+
q.displayName = "DropdownMenuItem";
|
|
224
|
+
const ke = S(({ className: e, inset: a, ...r }, n) => /* @__PURE__ */ t(
|
|
225
|
+
I.Label,
|
|
226
|
+
{
|
|
227
|
+
ref: n,
|
|
228
|
+
className: d(
|
|
229
|
+
"px-2 py-1.5 text-xs font-semibold uppercase text-muted-foreground",
|
|
230
|
+
a && "pl-8",
|
|
231
|
+
e
|
|
232
|
+
),
|
|
233
|
+
...r
|
|
234
|
+
}
|
|
235
|
+
));
|
|
236
|
+
ke.displayName = "DropdownMenuLabel";
|
|
237
|
+
const me = S(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
238
|
+
I.Separator,
|
|
239
|
+
{
|
|
240
|
+
ref: r,
|
|
241
|
+
className: d("-mx-1 my-1 h-px bg-muted", e),
|
|
242
|
+
...a
|
|
243
|
+
}
|
|
244
|
+
));
|
|
245
|
+
me.displayName = "DropdownMenuSeparator";
|
|
246
|
+
const ir = S(({ className: e, children: a, checked: r, ...n }, i) => /* @__PURE__ */ t(
|
|
247
|
+
I.CheckboxItem,
|
|
248
|
+
{
|
|
249
|
+
ref: i,
|
|
250
|
+
checked: r,
|
|
251
|
+
className: d(
|
|
252
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
253
|
+
e
|
|
254
|
+
),
|
|
255
|
+
...n,
|
|
256
|
+
children: a
|
|
257
|
+
}
|
|
258
|
+
));
|
|
259
|
+
ir.displayName = "DropdownMenuCheckboxItem";
|
|
260
|
+
const lr = ge.Root, cr = ge.Trigger, ps = ge.Anchor, Nt = S(({ className: e, align: a = "center", sideOffset: r = 4, ...n }, i) => /* @__PURE__ */ t(ge.Portal, { children: /* @__PURE__ */ t(
|
|
261
|
+
ge.Content,
|
|
262
|
+
{
|
|
263
|
+
ref: i,
|
|
264
|
+
align: a,
|
|
265
|
+
sideOffset: r,
|
|
266
|
+
className: d(
|
|
267
|
+
"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none",
|
|
268
|
+
e
|
|
269
|
+
),
|
|
270
|
+
...n
|
|
271
|
+
}
|
|
272
|
+
) }));
|
|
273
|
+
Nt.displayName = "PopoverContent";
|
|
274
|
+
const dr = fe.Provider, Y = fe.Root, Q = fe.Trigger, U = S(({ className: e, sideOffset: a = 4, ...r }, n) => /* @__PURE__ */ t(fe.Portal, { children: /* @__PURE__ */ t(
|
|
275
|
+
fe.Content,
|
|
276
|
+
{
|
|
277
|
+
ref: n,
|
|
278
|
+
sideOffset: a,
|
|
279
|
+
className: d(
|
|
280
|
+
"z-50 overflow-hidden rounded-md bg-foreground px-3 py-1.5 text-xs text-background shadow",
|
|
281
|
+
e
|
|
282
|
+
),
|
|
283
|
+
...r
|
|
284
|
+
}
|
|
285
|
+
) }));
|
|
286
|
+
U.displayName = "TooltipContent";
|
|
287
|
+
const ur = S(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
288
|
+
lt.Root,
|
|
289
|
+
{
|
|
290
|
+
ref: r,
|
|
291
|
+
className: d(
|
|
292
|
+
"peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
|
|
293
|
+
e
|
|
294
|
+
),
|
|
295
|
+
...a,
|
|
296
|
+
children: /* @__PURE__ */ t(
|
|
297
|
+
lt.Thumb,
|
|
298
|
+
{
|
|
299
|
+
className: d(
|
|
300
|
+
"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"
|
|
301
|
+
)
|
|
302
|
+
}
|
|
303
|
+
)
|
|
304
|
+
}
|
|
305
|
+
));
|
|
306
|
+
ur.displayName = "Switch";
|
|
307
|
+
const wt = O.Root, fs = O.Trigger, mr = O.Portal, gs = O.Close, kt = S(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
308
|
+
O.Overlay,
|
|
309
|
+
{
|
|
310
|
+
ref: r,
|
|
311
|
+
className: d(
|
|
312
|
+
"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
313
|
+
e
|
|
314
|
+
),
|
|
315
|
+
...a
|
|
316
|
+
}
|
|
317
|
+
));
|
|
318
|
+
kt.displayName = "DialogOverlay";
|
|
319
|
+
const pr = "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg", Xe = S(({ className: e, children: a, ...r }, n) => /* @__PURE__ */ s(mr, { children: [
|
|
320
|
+
/* @__PURE__ */ t(kt, {}),
|
|
321
|
+
/* @__PURE__ */ s(
|
|
322
|
+
O.Content,
|
|
323
|
+
{
|
|
324
|
+
ref: n,
|
|
325
|
+
className: d(pr, e),
|
|
326
|
+
...r,
|
|
327
|
+
children: [
|
|
328
|
+
a,
|
|
329
|
+
/* @__PURE__ */ s(O.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none", children: [
|
|
330
|
+
/* @__PURE__ */ t(ft, { className: "h-4 w-4" }),
|
|
331
|
+
/* @__PURE__ */ t("span", { className: "sr-only", children: "Close" })
|
|
332
|
+
] })
|
|
333
|
+
]
|
|
334
|
+
}
|
|
335
|
+
)
|
|
336
|
+
] }));
|
|
337
|
+
Xe.displayName = "DialogContent";
|
|
338
|
+
const fr = "flex flex-col space-y-1.5 text-center sm:text-left";
|
|
339
|
+
function he({ className: e, ...a }) {
|
|
340
|
+
return /* @__PURE__ */ t("div", { className: d(fr, e), ...a });
|
|
341
|
+
}
|
|
342
|
+
he.displayName = "DialogHeader";
|
|
343
|
+
const gr = "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2";
|
|
344
|
+
function be({ className: e, ...a }) {
|
|
345
|
+
return /* @__PURE__ */ t("div", { className: d(gr, e), ...a });
|
|
346
|
+
}
|
|
347
|
+
be.displayName = "DialogFooter";
|
|
348
|
+
const hr = "text-lg font-semibold leading-none tracking-tight", xe = S(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
349
|
+
O.Title,
|
|
350
|
+
{
|
|
351
|
+
ref: r,
|
|
352
|
+
className: d(hr, e),
|
|
353
|
+
...a
|
|
354
|
+
}
|
|
355
|
+
));
|
|
356
|
+
xe.displayName = "DialogTitle";
|
|
357
|
+
const br = "text-sm text-muted-foreground", Je = S(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
358
|
+
O.Description,
|
|
359
|
+
{
|
|
360
|
+
ref: r,
|
|
361
|
+
className: d(br, e),
|
|
362
|
+
...a
|
|
363
|
+
}
|
|
364
|
+
));
|
|
365
|
+
Je.displayName = "DialogDescription";
|
|
366
|
+
const xr = S(({ className: e, orientation: a = "horizontal", decorative: r = !0, ...n }, i) => /* @__PURE__ */ t(
|
|
367
|
+
ea.Root,
|
|
368
|
+
{
|
|
369
|
+
ref: i,
|
|
370
|
+
decorative: r,
|
|
371
|
+
orientation: a,
|
|
372
|
+
className: d(
|
|
373
|
+
"shrink-0 bg-border",
|
|
374
|
+
a === "horizontal" ? "h-px w-full" : "h-full w-px",
|
|
375
|
+
e
|
|
376
|
+
),
|
|
377
|
+
...n
|
|
378
|
+
}
|
|
379
|
+
));
|
|
380
|
+
xr.displayName = "Separator";
|
|
381
|
+
const vr = K(
|
|
382
|
+
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
383
|
+
{
|
|
384
|
+
variants: {
|
|
385
|
+
variant: {
|
|
386
|
+
default: "border-transparent bg-primary text-primary-foreground",
|
|
387
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground",
|
|
388
|
+
destructive: "border-transparent bg-destructive text-destructive-foreground",
|
|
389
|
+
outline: "text-foreground",
|
|
390
|
+
success: "border-transparent bg-emerald-500/15 text-emerald-700 dark:text-emerald-300",
|
|
391
|
+
warning: "border-transparent bg-amber-500/15 text-amber-700 dark:text-amber-300"
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
defaultVariants: { variant: "default" }
|
|
395
|
+
}
|
|
396
|
+
), Se = S(
|
|
397
|
+
({ className: e, variant: a, ...r }, n) => /* @__PURE__ */ t("div", { ref: n, className: d(vr({ variant: a }), e), ...r })
|
|
398
|
+
);
|
|
399
|
+
Se.displayName = "Badge";
|
|
400
|
+
const hs = Te.Root, yr = S(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
401
|
+
Te.List,
|
|
402
|
+
{
|
|
403
|
+
ref: r,
|
|
404
|
+
className: d(
|
|
405
|
+
"inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
|
|
406
|
+
e
|
|
407
|
+
),
|
|
408
|
+
...a
|
|
409
|
+
}
|
|
410
|
+
));
|
|
411
|
+
yr.displayName = "TabsList";
|
|
412
|
+
const Nr = S(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
413
|
+
Te.Trigger,
|
|
414
|
+
{
|
|
415
|
+
ref: r,
|
|
416
|
+
className: d(
|
|
417
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
|
|
418
|
+
e
|
|
419
|
+
),
|
|
420
|
+
...a
|
|
421
|
+
}
|
|
422
|
+
));
|
|
423
|
+
Nr.displayName = "TabsTrigger";
|
|
424
|
+
const wr = S(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
425
|
+
Te.Content,
|
|
426
|
+
{
|
|
427
|
+
ref: r,
|
|
428
|
+
className: d(
|
|
429
|
+
"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
430
|
+
e
|
|
431
|
+
),
|
|
432
|
+
...a
|
|
433
|
+
}
|
|
434
|
+
));
|
|
435
|
+
wr.displayName = "TabsContent";
|
|
436
|
+
const Ct = A.Root, bs = A.Group, zt = A.Value, Ze = h.forwardRef(({ className: e, children: a, ...r }, n) => /* @__PURE__ */ s(
|
|
437
|
+
A.Trigger,
|
|
438
|
+
{
|
|
439
|
+
ref: n,
|
|
440
|
+
className: d(
|
|
441
|
+
"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
442
|
+
e
|
|
443
|
+
),
|
|
444
|
+
...r,
|
|
445
|
+
children: [
|
|
446
|
+
a,
|
|
447
|
+
/* @__PURE__ */ t(A.Icon, { asChild: !0, children: /* @__PURE__ */ t(Ae, { className: "h-4 w-4 opacity-50" }) })
|
|
448
|
+
]
|
|
449
|
+
}
|
|
450
|
+
));
|
|
451
|
+
Ze.displayName = A.Trigger.displayName;
|
|
452
|
+
const St = h.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
453
|
+
A.ScrollUpButton,
|
|
454
|
+
{
|
|
455
|
+
ref: r,
|
|
456
|
+
className: d(
|
|
457
|
+
"flex cursor-default items-center justify-center py-1",
|
|
458
|
+
e
|
|
459
|
+
),
|
|
460
|
+
...a,
|
|
461
|
+
children: /* @__PURE__ */ t(ta, { className: "h-4 w-4" })
|
|
462
|
+
}
|
|
463
|
+
));
|
|
464
|
+
St.displayName = A.ScrollUpButton.displayName;
|
|
465
|
+
const Tt = h.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
466
|
+
A.ScrollDownButton,
|
|
467
|
+
{
|
|
468
|
+
ref: r,
|
|
469
|
+
className: d(
|
|
470
|
+
"flex cursor-default items-center justify-center py-1",
|
|
471
|
+
e
|
|
472
|
+
),
|
|
473
|
+
...a,
|
|
474
|
+
children: /* @__PURE__ */ t(Ae, { className: "h-4 w-4" })
|
|
475
|
+
}
|
|
476
|
+
));
|
|
477
|
+
Tt.displayName = A.ScrollDownButton.displayName;
|
|
478
|
+
const et = h.forwardRef(({ className: e, children: a, position: r = "popper", ...n }, i) => /* @__PURE__ */ t(A.Portal, { children: /* @__PURE__ */ s(
|
|
479
|
+
A.Content,
|
|
480
|
+
{
|
|
481
|
+
ref: i,
|
|
482
|
+
className: d(
|
|
483
|
+
"relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",
|
|
484
|
+
r === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
485
|
+
e
|
|
486
|
+
),
|
|
487
|
+
position: r,
|
|
488
|
+
...n,
|
|
489
|
+
children: [
|
|
490
|
+
/* @__PURE__ */ t(St, {}),
|
|
491
|
+
/* @__PURE__ */ t(
|
|
492
|
+
A.Viewport,
|
|
493
|
+
{
|
|
494
|
+
className: d(
|
|
495
|
+
"p-1",
|
|
496
|
+
r === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
|
497
|
+
),
|
|
498
|
+
children: a
|
|
499
|
+
}
|
|
500
|
+
),
|
|
501
|
+
/* @__PURE__ */ t(Tt, {})
|
|
502
|
+
]
|
|
503
|
+
}
|
|
504
|
+
) }));
|
|
505
|
+
et.displayName = A.Content.displayName;
|
|
506
|
+
const kr = h.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
507
|
+
A.Label,
|
|
508
|
+
{
|
|
509
|
+
ref: r,
|
|
510
|
+
className: d("px-2 py-1.5 text-sm font-semibold", e),
|
|
511
|
+
...a
|
|
512
|
+
}
|
|
513
|
+
));
|
|
514
|
+
kr.displayName = A.Label.displayName;
|
|
515
|
+
const tt = h.forwardRef(({ className: e, children: a, ...r }, n) => /* @__PURE__ */ s(
|
|
516
|
+
A.Item,
|
|
517
|
+
{
|
|
518
|
+
ref: n,
|
|
519
|
+
className: d(
|
|
520
|
+
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
521
|
+
e
|
|
522
|
+
),
|
|
523
|
+
...r,
|
|
524
|
+
children: [
|
|
525
|
+
/* @__PURE__ */ t("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ t(A.ItemIndicator, { children: /* @__PURE__ */ t(P, { className: "h-4 w-4" }) }) }),
|
|
526
|
+
/* @__PURE__ */ t(A.ItemText, { children: a })
|
|
527
|
+
]
|
|
528
|
+
}
|
|
529
|
+
));
|
|
530
|
+
tt.displayName = A.Item.displayName;
|
|
531
|
+
const Cr = h.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
532
|
+
A.Separator,
|
|
533
|
+
{
|
|
534
|
+
ref: r,
|
|
535
|
+
className: d("-mx-1 my-1 h-px bg-muted", e),
|
|
536
|
+
...a
|
|
537
|
+
}
|
|
538
|
+
));
|
|
539
|
+
Cr.displayName = A.Separator.displayName;
|
|
540
|
+
const zr = K(
|
|
541
|
+
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
542
|
+
), at = h.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
543
|
+
vt.Root,
|
|
544
|
+
{
|
|
545
|
+
ref: r,
|
|
546
|
+
className: d(zr(), e),
|
|
547
|
+
...a
|
|
548
|
+
}
|
|
549
|
+
));
|
|
550
|
+
at.displayName = vt.Root.displayName;
|
|
551
|
+
const Sr = h.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
552
|
+
je.Root,
|
|
553
|
+
{
|
|
554
|
+
ref: r,
|
|
555
|
+
className: d(
|
|
556
|
+
"grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
|
|
557
|
+
e
|
|
558
|
+
),
|
|
559
|
+
...a,
|
|
560
|
+
children: /* @__PURE__ */ t(
|
|
561
|
+
je.Indicator,
|
|
562
|
+
{
|
|
563
|
+
className: d("grid place-content-center text-current"),
|
|
564
|
+
children: /* @__PURE__ */ t(P, { className: "h-4 w-4" })
|
|
565
|
+
}
|
|
566
|
+
)
|
|
567
|
+
}
|
|
568
|
+
));
|
|
569
|
+
Sr.displayName = je.Root.displayName;
|
|
570
|
+
const At = Qe.Root, Mt = Qe.CollapsibleTrigger, Rt = Qe.CollapsibleContent, Tr = [
|
|
571
|
+
"friendly",
|
|
572
|
+
"professional",
|
|
573
|
+
"casual",
|
|
574
|
+
"concise",
|
|
575
|
+
"playful",
|
|
576
|
+
"academic"
|
|
577
|
+
], Ee = {
|
|
578
|
+
name: "",
|
|
579
|
+
description: "",
|
|
580
|
+
icon: "🤖",
|
|
581
|
+
systemPrompt: "",
|
|
582
|
+
tone: "friendly",
|
|
583
|
+
suggestions: ""
|
|
584
|
+
};
|
|
585
|
+
function Ar(e) {
|
|
586
|
+
return {
|
|
587
|
+
id: e.id,
|
|
588
|
+
name: e.name,
|
|
589
|
+
description: e.description ?? "",
|
|
590
|
+
icon: e.icon ?? "🤖",
|
|
591
|
+
systemPrompt: e.systemPrompt,
|
|
592
|
+
tone: e.tone ?? "friendly",
|
|
593
|
+
suggestions: (e.suggestions ?? []).join(`
|
|
594
|
+
`)
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
function Mr({
|
|
598
|
+
open: e,
|
|
599
|
+
onOpenChange: a,
|
|
600
|
+
activeAgentId: r,
|
|
601
|
+
onApply: n,
|
|
602
|
+
startInCreate: i = !1
|
|
603
|
+
}) {
|
|
604
|
+
const [c, l] = z([]), [u, f] = z("list"), [o, m] = z(Ee), p = () => l(bt());
|
|
605
|
+
ne(() => {
|
|
606
|
+
e && (p(), f(i ? "edit" : "list"), m(Ee));
|
|
607
|
+
}, [e, i]);
|
|
608
|
+
const w = () => {
|
|
609
|
+
m(Ee), f("edit");
|
|
610
|
+
}, k = (b) => {
|
|
611
|
+
m(Ar(b)), f("edit");
|
|
612
|
+
}, y = o.name.trim().length > 0 && o.systemPrompt.trim().length > 0;
|
|
613
|
+
return /* @__PURE__ */ t(wt, { open: e, onOpenChange: a, children: /* @__PURE__ */ t(Xe, { className: "max-w-lg gap-0 overflow-hidden p-0", children: u === "list" ? /* @__PURE__ */ t(
|
|
614
|
+
Rr,
|
|
615
|
+
{
|
|
616
|
+
agents: c,
|
|
617
|
+
activeAgentId: r,
|
|
618
|
+
onCreate: w,
|
|
619
|
+
onEdit: k,
|
|
620
|
+
onApply: (b) => {
|
|
621
|
+
n(b), a(!1);
|
|
622
|
+
},
|
|
623
|
+
onDuplicate: (b) => {
|
|
624
|
+
Aa(b), p();
|
|
625
|
+
},
|
|
626
|
+
onDelete: (b) => {
|
|
627
|
+
Ta(b), p();
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
) : /* @__PURE__ */ t(
|
|
631
|
+
Dr,
|
|
632
|
+
{
|
|
633
|
+
draft: o,
|
|
634
|
+
setDraft: m,
|
|
635
|
+
canSave: y,
|
|
636
|
+
onBack: () => f("list"),
|
|
637
|
+
onSave: () => {
|
|
638
|
+
if (!y) return;
|
|
639
|
+
const b = Ma({
|
|
640
|
+
id: o.id,
|
|
641
|
+
name: o.name,
|
|
642
|
+
description: o.description,
|
|
643
|
+
icon: o.icon,
|
|
644
|
+
systemPrompt: o.systemPrompt,
|
|
645
|
+
tone: o.tone,
|
|
646
|
+
suggestions: o.suggestions.split(`
|
|
647
|
+
`)
|
|
648
|
+
});
|
|
649
|
+
p(), n(b), a(!1);
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
) }) });
|
|
653
|
+
}
|
|
654
|
+
function Rr({
|
|
655
|
+
agents: e,
|
|
656
|
+
activeAgentId: a,
|
|
657
|
+
onCreate: r,
|
|
658
|
+
onEdit: n,
|
|
659
|
+
onApply: i,
|
|
660
|
+
onDuplicate: c,
|
|
661
|
+
onDelete: l
|
|
662
|
+
}) {
|
|
663
|
+
return /* @__PURE__ */ s(L, { children: [
|
|
664
|
+
/* @__PURE__ */ s(he, { className: "border-b border-border/60 p-5 pb-4", children: [
|
|
665
|
+
/* @__PURE__ */ t(xe, { children: "Agents" }),
|
|
666
|
+
/* @__PURE__ */ t(Je, { children: "Switch, create, edit, or remove your assistant agents." })
|
|
667
|
+
] }),
|
|
668
|
+
/* @__PURE__ */ t("div", { className: "max-h-[55vh] space-y-1.5 overflow-y-auto p-3 scrollbar-thin", children: e.map((u) => {
|
|
669
|
+
const f = u.id === a;
|
|
670
|
+
return /* @__PURE__ */ s(
|
|
671
|
+
"div",
|
|
672
|
+
{
|
|
673
|
+
className: d(
|
|
674
|
+
"group/agent flex items-center gap-3 rounded-xl border p-2.5 transition-colors",
|
|
675
|
+
f ? "border-primary/40 bg-primary/5" : "border-border/60 hover:bg-accent/50"
|
|
676
|
+
),
|
|
677
|
+
children: [
|
|
678
|
+
/* @__PURE__ */ t("span", { className: "grid size-9 shrink-0 place-items-center rounded-lg bg-muted text-lg", children: u.icon ?? "🤖" }),
|
|
679
|
+
/* @__PURE__ */ s(
|
|
680
|
+
N,
|
|
681
|
+
{
|
|
682
|
+
type: "button",
|
|
683
|
+
variant: "ghost",
|
|
684
|
+
onClick: () => i(u),
|
|
685
|
+
className: "h-auto min-w-0 flex-1 flex-col items-stretch justify-start gap-0 p-0 text-left hover:bg-transparent",
|
|
686
|
+
children: [
|
|
687
|
+
/* @__PURE__ */ s("span", { className: "flex items-center gap-1.5", children: [
|
|
688
|
+
/* @__PURE__ */ t("span", { className: "truncate text-sm font-medium", children: u.name }),
|
|
689
|
+
f && /* @__PURE__ */ t(P, { className: "size-3.5 shrink-0 text-primary" }),
|
|
690
|
+
u.builtIn && /* @__PURE__ */ t(Se, { variant: "secondary", className: "text-[9px]", children: "built-in" })
|
|
691
|
+
] }),
|
|
692
|
+
u.description && /* @__PURE__ */ t("span", { className: "block truncate text-xs font-normal text-muted-foreground", children: u.description })
|
|
693
|
+
]
|
|
694
|
+
}
|
|
695
|
+
),
|
|
696
|
+
/* @__PURE__ */ s("div", { className: "flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover/agent:opacity-100 focus-within:opacity-100", children: [
|
|
697
|
+
/* @__PURE__ */ t(_e, { label: "Duplicate", onClick: () => c(u.id), children: /* @__PURE__ */ t(Me, { className: "size-3.5" }) }),
|
|
698
|
+
!u.builtIn && /* @__PURE__ */ s(L, { children: [
|
|
699
|
+
/* @__PURE__ */ t(_e, { label: "Edit", onClick: () => n(u), children: /* @__PURE__ */ t(Ue, { className: "size-3.5" }) }),
|
|
700
|
+
/* @__PURE__ */ t(
|
|
701
|
+
_e,
|
|
702
|
+
{
|
|
703
|
+
label: "Delete",
|
|
704
|
+
destructive: !0,
|
|
705
|
+
onClick: () => l(u.id),
|
|
706
|
+
children: /* @__PURE__ */ t(pe, { className: "size-3.5" })
|
|
707
|
+
}
|
|
708
|
+
)
|
|
709
|
+
] })
|
|
710
|
+
] })
|
|
711
|
+
]
|
|
712
|
+
},
|
|
713
|
+
u.id
|
|
714
|
+
);
|
|
715
|
+
}) }),
|
|
716
|
+
/* @__PURE__ */ t(be, { className: "border-t border-border/60 p-4", children: /* @__PURE__ */ s(N, { onClick: r, className: "w-full gap-2 sm:w-auto", children: [
|
|
717
|
+
/* @__PURE__ */ t(Ke, { className: "size-4" }),
|
|
718
|
+
"New agent"
|
|
719
|
+
] }) })
|
|
720
|
+
] });
|
|
721
|
+
}
|
|
722
|
+
function Dr({
|
|
723
|
+
draft: e,
|
|
724
|
+
setDraft: a,
|
|
725
|
+
canSave: r,
|
|
726
|
+
onBack: n,
|
|
727
|
+
onSave: i
|
|
728
|
+
}) {
|
|
729
|
+
const c = (l, u) => a({ ...e, [l]: u });
|
|
730
|
+
return /* @__PURE__ */ s(L, { children: [
|
|
731
|
+
/* @__PURE__ */ t(he, { className: "border-b border-border/60 p-5 pb-4", children: /* @__PURE__ */ s(xe, { className: "flex items-center gap-2", children: [
|
|
732
|
+
/* @__PURE__ */ t(
|
|
733
|
+
N,
|
|
734
|
+
{
|
|
735
|
+
type: "button",
|
|
736
|
+
variant: "ghost",
|
|
737
|
+
size: "icon-sm",
|
|
738
|
+
onClick: n,
|
|
739
|
+
"aria-label": "Back to list",
|
|
740
|
+
className: "text-muted-foreground hover:text-foreground",
|
|
741
|
+
children: /* @__PURE__ */ t(gt, { className: "size-4" })
|
|
742
|
+
}
|
|
743
|
+
),
|
|
744
|
+
e.id ? "Edit agent" : "New agent"
|
|
745
|
+
] }) }),
|
|
746
|
+
/* @__PURE__ */ s("div", { className: "max-h-[55vh] space-y-4 overflow-y-auto p-5 scrollbar-thin", children: [
|
|
747
|
+
/* @__PURE__ */ s("div", { className: "flex gap-3", children: [
|
|
748
|
+
/* @__PURE__ */ t(ee, { label: "Icon", className: "w-20", children: /* @__PURE__ */ t(
|
|
749
|
+
$,
|
|
750
|
+
{
|
|
751
|
+
value: e.icon,
|
|
752
|
+
onChange: (l) => c("icon", l.target.value.slice(0, 2)),
|
|
753
|
+
className: "text-center text-lg",
|
|
754
|
+
maxLength: 2
|
|
755
|
+
}
|
|
756
|
+
) }),
|
|
757
|
+
/* @__PURE__ */ t(ee, { label: "Name", className: "flex-1", children: /* @__PURE__ */ t(
|
|
758
|
+
$,
|
|
759
|
+
{
|
|
760
|
+
value: e.name,
|
|
761
|
+
onChange: (l) => c("name", l.target.value),
|
|
762
|
+
placeholder: "e.g. SQL expert"
|
|
763
|
+
}
|
|
764
|
+
) })
|
|
765
|
+
] }),
|
|
766
|
+
/* @__PURE__ */ t(ee, { label: "Description", children: /* @__PURE__ */ t(
|
|
767
|
+
$,
|
|
768
|
+
{
|
|
769
|
+
value: e.description,
|
|
770
|
+
onChange: (l) => c("description", l.target.value),
|
|
771
|
+
placeholder: "One-line summary (optional)"
|
|
772
|
+
}
|
|
773
|
+
) }),
|
|
774
|
+
/* @__PURE__ */ t(ee, { label: "System prompt", children: /* @__PURE__ */ t(
|
|
775
|
+
re,
|
|
776
|
+
{
|
|
777
|
+
value: e.systemPrompt,
|
|
778
|
+
onChange: (l) => c("systemPrompt", l.target.value),
|
|
779
|
+
placeholder: "You are a helpful assistant that…",
|
|
780
|
+
className: "min-h-28 resize-y"
|
|
781
|
+
}
|
|
782
|
+
) }),
|
|
783
|
+
/* @__PURE__ */ t(ee, { label: "Tone", children: /* @__PURE__ */ s(Ct, { value: e.tone, onValueChange: (l) => c("tone", l), children: [
|
|
784
|
+
/* @__PURE__ */ t(Ze, { className: "capitalize", children: /* @__PURE__ */ t(zt, { placeholder: "Select a tone" }) }),
|
|
785
|
+
/* @__PURE__ */ t(et, { children: Tr.map((l) => /* @__PURE__ */ t(tt, { value: l, className: "capitalize", children: l }, l)) })
|
|
786
|
+
] }) }),
|
|
787
|
+
/* @__PURE__ */ t(ee, { label: "Starter suggestions", hint: "one per line", children: /* @__PURE__ */ t(
|
|
788
|
+
re,
|
|
789
|
+
{
|
|
790
|
+
value: e.suggestions,
|
|
791
|
+
onChange: (l) => c("suggestions", l.target.value),
|
|
792
|
+
placeholder: `Explain a concept
|
|
793
|
+
Review my code`,
|
|
794
|
+
className: "min-h-20 resize-y"
|
|
795
|
+
}
|
|
796
|
+
) })
|
|
797
|
+
] }),
|
|
798
|
+
/* @__PURE__ */ s(be, { className: "gap-2 border-t border-border/60 p-4", children: [
|
|
799
|
+
/* @__PURE__ */ t(N, { variant: "ghost", onClick: n, children: "Cancel" }),
|
|
800
|
+
/* @__PURE__ */ s(N, { onClick: i, disabled: !r, className: "gap-2", children: [
|
|
801
|
+
/* @__PURE__ */ t(P, { className: "size-4" }),
|
|
802
|
+
"Save & use"
|
|
803
|
+
] })
|
|
804
|
+
] })
|
|
805
|
+
] });
|
|
806
|
+
}
|
|
807
|
+
function ee({
|
|
808
|
+
label: e,
|
|
809
|
+
hint: a,
|
|
810
|
+
className: r,
|
|
811
|
+
children: n
|
|
812
|
+
}) {
|
|
813
|
+
return /* @__PURE__ */ s("div", { className: d("space-y-1.5", r), children: [
|
|
814
|
+
/* @__PURE__ */ s(at, { className: "flex items-center gap-1.5 text-xs font-medium text-muted-foreground", children: [
|
|
815
|
+
e,
|
|
816
|
+
a && /* @__PURE__ */ s("span", { className: "text-muted-foreground/60", children: [
|
|
817
|
+
"· ",
|
|
818
|
+
a
|
|
819
|
+
] })
|
|
820
|
+
] }),
|
|
821
|
+
n
|
|
822
|
+
] });
|
|
823
|
+
}
|
|
824
|
+
function _e({
|
|
825
|
+
label: e,
|
|
826
|
+
destructive: a,
|
|
827
|
+
onClick: r,
|
|
828
|
+
children: n
|
|
829
|
+
}) {
|
|
830
|
+
return /* @__PURE__ */ t(
|
|
831
|
+
N,
|
|
832
|
+
{
|
|
833
|
+
type: "button",
|
|
834
|
+
variant: "ghost",
|
|
835
|
+
size: "icon-sm",
|
|
836
|
+
"aria-label": e,
|
|
837
|
+
onClick: r,
|
|
838
|
+
className: d(
|
|
839
|
+
"text-muted-foreground hover:bg-foreground/10",
|
|
840
|
+
a ? "hover:text-destructive" : "hover:text-foreground"
|
|
841
|
+
),
|
|
842
|
+
children: n
|
|
843
|
+
}
|
|
844
|
+
);
|
|
845
|
+
}
|
|
846
|
+
const Dt = "ai-schadcn-theme";
|
|
847
|
+
function Pr() {
|
|
848
|
+
if (typeof document > "u") return "light";
|
|
849
|
+
if (document.documentElement.classList.contains("dark")) return "dark";
|
|
850
|
+
try {
|
|
851
|
+
const e = localStorage.getItem(Dt);
|
|
852
|
+
if (e === "light" || e === "dark") return e;
|
|
853
|
+
} catch {
|
|
854
|
+
}
|
|
855
|
+
return window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
856
|
+
}
|
|
857
|
+
function dt(e) {
|
|
858
|
+
const a = document.documentElement;
|
|
859
|
+
a.classList.toggle("dark", e === "dark"), a.style.colorScheme = e;
|
|
860
|
+
}
|
|
861
|
+
function Ir({ className: e }) {
|
|
862
|
+
const [a, r] = z("light");
|
|
863
|
+
ne(() => {
|
|
864
|
+
const c = Pr();
|
|
865
|
+
r(c), dt(c);
|
|
866
|
+
}, []);
|
|
867
|
+
const n = Ce(() => {
|
|
868
|
+
r((c) => {
|
|
869
|
+
const l = c === "dark" ? "light" : "dark";
|
|
870
|
+
dt(l);
|
|
871
|
+
try {
|
|
872
|
+
localStorage.setItem(Dt, l);
|
|
873
|
+
} catch {
|
|
874
|
+
}
|
|
875
|
+
return l;
|
|
876
|
+
});
|
|
877
|
+
}, []), i = a === "dark";
|
|
878
|
+
return /* @__PURE__ */ s(Y, { children: [
|
|
879
|
+
/* @__PURE__ */ t(Q, { asChild: !0, children: /* @__PURE__ */ s(
|
|
880
|
+
N,
|
|
881
|
+
{
|
|
882
|
+
type: "button",
|
|
883
|
+
variant: "ghost",
|
|
884
|
+
size: "icon-sm",
|
|
885
|
+
onClick: n,
|
|
886
|
+
"aria-label": i ? "Switch to light mode" : "Switch to dark mode",
|
|
887
|
+
className: ["relative", e].filter(Boolean).join(" "),
|
|
888
|
+
children: [
|
|
889
|
+
/* @__PURE__ */ t(
|
|
890
|
+
aa,
|
|
891
|
+
{
|
|
892
|
+
className: "size-4 rotate-0 scale-100 transition-all duration-300 dark:-rotate-90 dark:scale-0"
|
|
893
|
+
}
|
|
894
|
+
),
|
|
895
|
+
/* @__PURE__ */ t(
|
|
896
|
+
ra,
|
|
897
|
+
{
|
|
898
|
+
className: "absolute size-4 rotate-90 scale-0 transition-all duration-300 dark:rotate-0 dark:scale-100"
|
|
899
|
+
}
|
|
900
|
+
)
|
|
901
|
+
]
|
|
902
|
+
}
|
|
903
|
+
) }),
|
|
904
|
+
/* @__PURE__ */ t(U, { children: i ? "Light mode" : "Dark mode" })
|
|
905
|
+
] });
|
|
906
|
+
}
|
|
907
|
+
function Er({ className: e }) {
|
|
908
|
+
const a = se(), r = a.config, n = r.ui ?? {}, [i, c] = z(!1), [l, u] = z(!1), [f, o] = z(!1), [m, p] = z(!1), [w, k] = z(
|
|
909
|
+
() => Ra()
|
|
910
|
+
), y = bt(), v = y.find((x) => x.id === w) ?? y.find((x) => x.name === r.personality?.name), b = n.showModelSelector ?? !0, C = n.showDocumentPicker ?? !0, T = n.showToolCalls ?? !0, E = n.enableConversationHistory ?? !0, B = (x) => {
|
|
911
|
+
a.updateConfig({
|
|
912
|
+
systemPrompt: x.systemPrompt,
|
|
913
|
+
personality: {
|
|
914
|
+
...r.personality,
|
|
915
|
+
name: x.name,
|
|
916
|
+
tone: x.tone,
|
|
917
|
+
avatar: x.icon,
|
|
918
|
+
...x.locale ? { locale: x.locale } : {}
|
|
919
|
+
},
|
|
920
|
+
ui: {
|
|
921
|
+
...n,
|
|
922
|
+
title: x.name,
|
|
923
|
+
...x.suggestions && x.suggestions.length > 0 ? { suggestions: x.suggestions } : {}
|
|
924
|
+
}
|
|
925
|
+
}), Da(x.id), k(x.id), c(!1);
|
|
926
|
+
}, j = (x) => {
|
|
927
|
+
p(x), o(!0), c(!1);
|
|
928
|
+
}, _ = (x) => {
|
|
929
|
+
const H = r.documents ?? [], F = H.find((Z) => Z.id === x.id) ? H.filter((Z) => Z.id !== x.id) : [...H, x];
|
|
930
|
+
a.updateConfig({ documents: F });
|
|
931
|
+
}, De = [
|
|
932
|
+
{
|
|
933
|
+
id: "built-in:web",
|
|
934
|
+
name: "Web search guidance",
|
|
935
|
+
description: "Cites sources and flags primary vs. aggregated info.",
|
|
936
|
+
alwaysOn: !1,
|
|
937
|
+
body: "When unsure, prefer citing authoritative web sources and link to them. Distinguish between primary sources and aggregators."
|
|
938
|
+
},
|
|
939
|
+
{
|
|
940
|
+
id: "built-in:code",
|
|
941
|
+
name: "Code reviewer",
|
|
942
|
+
description: "Checks bugs, security, perf, readability & test coverage.",
|
|
943
|
+
alwaysOn: !1,
|
|
944
|
+
body: "When reviewing code, point out: 1) correctness bugs, 2) security implications, 3) performance, 4) readability, 5) test coverage. Suggest minimal patches."
|
|
945
|
+
},
|
|
946
|
+
{
|
|
947
|
+
id: "built-in:sql",
|
|
948
|
+
name: "SQL guardrails",
|
|
949
|
+
description: "Blocks unsafe SQL; requires WHERE clauses & parameters.",
|
|
950
|
+
alwaysOn: !1,
|
|
951
|
+
body: "Never write destructive SQL without a WHERE clause. Prefer parameterized queries. Always state the table schema when joining."
|
|
952
|
+
}
|
|
953
|
+
], ie = r.documents?.length ?? 0, le = a.listConversationsMeta();
|
|
954
|
+
return /* @__PURE__ */ s(
|
|
955
|
+
"header",
|
|
956
|
+
{
|
|
957
|
+
className: d(
|
|
958
|
+
"relative z-20 flex items-center justify-between gap-2 border-b border-border/60 bg-background/70 px-3 py-2.5 backdrop-blur-xl supports-[backdrop-filter]:bg-background/55 sm:px-4",
|
|
959
|
+
e
|
|
960
|
+
),
|
|
961
|
+
children: [
|
|
962
|
+
/* @__PURE__ */ s("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
963
|
+
/* @__PURE__ */ t("span", { className: "relative grid size-9 shrink-0 place-items-center rounded-xl grad-primary text-primary-foreground shadow-sm glow-primary", children: v?.icon ? /* @__PURE__ */ t("span", { className: "text-lg leading-none", children: v.icon }) : /* @__PURE__ */ t(ze, { className: "size-[18px]" }) }),
|
|
964
|
+
/* @__PURE__ */ s("div", { className: "min-w-0", children: [
|
|
965
|
+
/* @__PURE__ */ t("p", { className: "truncate text-sm font-semibold tracking-tight", children: n.title ?? "Assistant" }),
|
|
966
|
+
/* @__PURE__ */ s("p", { className: "flex items-center gap-1.5 truncate text-xs text-muted-foreground", children: [
|
|
967
|
+
/* @__PURE__ */ t("span", { className: "inline-block size-1.5 shrink-0 rounded-full bg-success shadow-[0_0_6px_currentColor]" }),
|
|
968
|
+
/* @__PURE__ */ t("span", { className: "truncate", children: n.subtitle ?? (r.model.label || r.model.id || "Ready") })
|
|
969
|
+
] })
|
|
970
|
+
] })
|
|
971
|
+
] }),
|
|
972
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-0.5", children: [
|
|
973
|
+
b && /* @__PURE__ */ s(Ne, { open: i, onOpenChange: c, children: [
|
|
974
|
+
/* @__PURE__ */ t(we, { asChild: !0, children: /* @__PURE__ */ s(
|
|
975
|
+
N,
|
|
976
|
+
{
|
|
977
|
+
variant: "ghost",
|
|
978
|
+
size: "sm",
|
|
979
|
+
className: "hidden h-8 max-w-[180px] gap-1.5 rounded-lg px-2.5 text-xs font-medium text-muted-foreground hover:text-foreground sm:inline-flex",
|
|
980
|
+
children: [
|
|
981
|
+
/* @__PURE__ */ t("span", { className: "text-sm leading-none", children: v?.icon ?? "✨" }),
|
|
982
|
+
/* @__PURE__ */ t("span", { className: "truncate", children: v?.name ?? r.personality?.name ?? "Agent" }),
|
|
983
|
+
/* @__PURE__ */ t(Ae, { className: "size-3 shrink-0 opacity-50" })
|
|
984
|
+
]
|
|
985
|
+
}
|
|
986
|
+
) }),
|
|
987
|
+
/* @__PURE__ */ s(ue, { align: "end", className: "w-64", children: [
|
|
988
|
+
/* @__PURE__ */ t(ke, { children: "Agents" }),
|
|
989
|
+
/* @__PURE__ */ t("div", { className: "max-h-64 overflow-y-auto", children: y.map((x) => /* @__PURE__ */ s(
|
|
990
|
+
q,
|
|
991
|
+
{
|
|
992
|
+
onClick: () => B(x),
|
|
993
|
+
className: "gap-2",
|
|
994
|
+
children: [
|
|
995
|
+
/* @__PURE__ */ t("span", { className: "text-base leading-none", children: x.icon ?? "🤖" }),
|
|
996
|
+
/* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate", children: x.name }),
|
|
997
|
+
x.id === v?.id && /* @__PURE__ */ t(P, { className: "size-3.5 shrink-0 text-primary" })
|
|
998
|
+
]
|
|
999
|
+
},
|
|
1000
|
+
x.id
|
|
1001
|
+
)) }),
|
|
1002
|
+
/* @__PURE__ */ t(me, {}),
|
|
1003
|
+
/* @__PURE__ */ s(q, { onClick: () => j(!0), children: [
|
|
1004
|
+
/* @__PURE__ */ t(Ke, { className: "size-3.5" }),
|
|
1005
|
+
"New agent"
|
|
1006
|
+
] }),
|
|
1007
|
+
/* @__PURE__ */ s(q, { onClick: () => j(!1), children: [
|
|
1008
|
+
/* @__PURE__ */ t(Fe, { className: "size-3.5" }),
|
|
1009
|
+
"Manage agents…"
|
|
1010
|
+
] })
|
|
1011
|
+
] })
|
|
1012
|
+
] }),
|
|
1013
|
+
C && /* @__PURE__ */ s(Ne, { open: l, onOpenChange: u, children: [
|
|
1014
|
+
/* @__PURE__ */ s(Y, { children: [
|
|
1015
|
+
/* @__PURE__ */ t(Q, { asChild: !0, children: /* @__PURE__ */ t(we, { asChild: !0, children: /* @__PURE__ */ s(
|
|
1016
|
+
N,
|
|
1017
|
+
{
|
|
1018
|
+
variant: "ghost",
|
|
1019
|
+
size: "sm",
|
|
1020
|
+
className: "h-8 gap-1.5 rounded-lg px-2.5 text-xs font-medium text-muted-foreground hover:text-foreground",
|
|
1021
|
+
children: [
|
|
1022
|
+
/* @__PURE__ */ t(Ge, { className: "size-3.5" }),
|
|
1023
|
+
/* @__PURE__ */ t("span", { className: "hidden sm:inline", children: "Docs" }),
|
|
1024
|
+
ie > 0 && /* @__PURE__ */ t(
|
|
1025
|
+
Se,
|
|
1026
|
+
{
|
|
1027
|
+
variant: "secondary",
|
|
1028
|
+
className: "ml-0.5 h-4 min-w-4 justify-center rounded-full px-1 text-[9px] tabular-nums",
|
|
1029
|
+
children: ie
|
|
1030
|
+
}
|
|
1031
|
+
)
|
|
1032
|
+
]
|
|
1033
|
+
}
|
|
1034
|
+
) }) }),
|
|
1035
|
+
/* @__PURE__ */ t(U, { children: "Context documents — extra instructions prepended to the model's system prompt" })
|
|
1036
|
+
] }),
|
|
1037
|
+
/* @__PURE__ */ s(ue, { align: "end", className: "w-72", children: [
|
|
1038
|
+
/* @__PURE__ */ t(ke, { children: "Context documents" }),
|
|
1039
|
+
De.map((x) => {
|
|
1040
|
+
const H = (r.documents ?? []).some(
|
|
1041
|
+
(F) => F.id === x.id
|
|
1042
|
+
);
|
|
1043
|
+
return /* @__PURE__ */ t(
|
|
1044
|
+
q,
|
|
1045
|
+
{
|
|
1046
|
+
onClick: () => _(x),
|
|
1047
|
+
className: "items-start gap-2",
|
|
1048
|
+
children: /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
|
|
1049
|
+
/* @__PURE__ */ s("span", { className: "flex items-center gap-2 truncate", children: [
|
|
1050
|
+
x.name,
|
|
1051
|
+
H && /* @__PURE__ */ t(
|
|
1052
|
+
Se,
|
|
1053
|
+
{
|
|
1054
|
+
variant: "secondary",
|
|
1055
|
+
className: "ml-auto text-[9px]",
|
|
1056
|
+
children: "on"
|
|
1057
|
+
}
|
|
1058
|
+
)
|
|
1059
|
+
] }),
|
|
1060
|
+
x.description && /* @__PURE__ */ t("p", { className: "mt-0.5 truncate text-xs text-muted-foreground", children: x.description })
|
|
1061
|
+
] })
|
|
1062
|
+
},
|
|
1063
|
+
x.id
|
|
1064
|
+
);
|
|
1065
|
+
}),
|
|
1066
|
+
/* @__PURE__ */ t(me, {}),
|
|
1067
|
+
/* @__PURE__ */ t("p", { className: "px-2 py-1.5 text-xs text-muted-foreground", children: "Toggle a doc to prepend it to the model's context." })
|
|
1068
|
+
] })
|
|
1069
|
+
] }),
|
|
1070
|
+
/* @__PURE__ */ t("span", { className: "mx-1 hidden h-5 w-px bg-border/70 sm:block" }),
|
|
1071
|
+
/* @__PURE__ */ s(Y, { children: [
|
|
1072
|
+
/* @__PURE__ */ t(Q, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1073
|
+
N,
|
|
1074
|
+
{
|
|
1075
|
+
variant: "ghost",
|
|
1076
|
+
size: "icon-sm",
|
|
1077
|
+
className: "rounded-lg text-muted-foreground hover:text-foreground",
|
|
1078
|
+
"aria-label": "New chat",
|
|
1079
|
+
onClick: () => a.newConversation(),
|
|
1080
|
+
children: /* @__PURE__ */ t(na, { className: "size-4" })
|
|
1081
|
+
}
|
|
1082
|
+
) }),
|
|
1083
|
+
/* @__PURE__ */ t(U, { children: "New chat" })
|
|
1084
|
+
] }),
|
|
1085
|
+
E && /* @__PURE__ */ s(Ne, { children: [
|
|
1086
|
+
/* @__PURE__ */ s(Y, { children: [
|
|
1087
|
+
/* @__PURE__ */ t(Q, { asChild: !0, children: /* @__PURE__ */ t(we, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1088
|
+
N,
|
|
1089
|
+
{
|
|
1090
|
+
variant: "ghost",
|
|
1091
|
+
size: "icon-sm",
|
|
1092
|
+
className: "rounded-lg text-muted-foreground hover:text-foreground",
|
|
1093
|
+
"aria-label": "Conversation history",
|
|
1094
|
+
children: /* @__PURE__ */ t(sa, { className: "size-4" })
|
|
1095
|
+
}
|
|
1096
|
+
) }) }),
|
|
1097
|
+
/* @__PURE__ */ t(U, { children: "History" })
|
|
1098
|
+
] }),
|
|
1099
|
+
/* @__PURE__ */ s(ue, { align: "end", className: "w-72", children: [
|
|
1100
|
+
/* @__PURE__ */ t(ke, { children: "Conversation history" }),
|
|
1101
|
+
/* @__PURE__ */ t(me, {}),
|
|
1102
|
+
le.length === 0 ? /* @__PURE__ */ s("p", { className: "px-2 py-6 text-center text-xs text-muted-foreground", children: [
|
|
1103
|
+
"No conversations yet.",
|
|
1104
|
+
/* @__PURE__ */ t("br", {}),
|
|
1105
|
+
"Send a message to start one."
|
|
1106
|
+
] }) : /* @__PURE__ */ t("div", { className: "max-h-72 overflow-y-auto", children: le.map((x) => {
|
|
1107
|
+
const H = x.id === a.conversationId;
|
|
1108
|
+
return /* @__PURE__ */ s(
|
|
1109
|
+
"div",
|
|
1110
|
+
{
|
|
1111
|
+
className: d(
|
|
1112
|
+
"group/conv flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors",
|
|
1113
|
+
H ? "bg-accent" : "hover:bg-accent/60"
|
|
1114
|
+
),
|
|
1115
|
+
children: [
|
|
1116
|
+
/* @__PURE__ */ s(
|
|
1117
|
+
N,
|
|
1118
|
+
{
|
|
1119
|
+
type: "button",
|
|
1120
|
+
variant: "ghost",
|
|
1121
|
+
onClick: () => a.setConversationId(x.id),
|
|
1122
|
+
className: "h-auto min-w-0 flex-1 justify-start gap-2 p-0 text-left font-normal hover:bg-transparent",
|
|
1123
|
+
children: [
|
|
1124
|
+
H ? /* @__PURE__ */ t(P, { className: "size-3.5 shrink-0 text-primary" }) : /* @__PURE__ */ t("span", { className: "size-3.5 shrink-0" }),
|
|
1125
|
+
/* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: [
|
|
1126
|
+
/* @__PURE__ */ t("span", { className: "block truncate font-medium", children: x.title }),
|
|
1127
|
+
/* @__PURE__ */ s("span", { className: "block truncate text-[11px] text-muted-foreground", children: [
|
|
1128
|
+
x.messageCount,
|
|
1129
|
+
" msg",
|
|
1130
|
+
x.updatedAt ? ` · ${_r(x.updatedAt)}` : ""
|
|
1131
|
+
] })
|
|
1132
|
+
] })
|
|
1133
|
+
]
|
|
1134
|
+
}
|
|
1135
|
+
),
|
|
1136
|
+
/* @__PURE__ */ t(
|
|
1137
|
+
N,
|
|
1138
|
+
{
|
|
1139
|
+
type: "button",
|
|
1140
|
+
variant: "ghost",
|
|
1141
|
+
size: "icon-sm",
|
|
1142
|
+
"aria-label": "Delete conversation",
|
|
1143
|
+
onClick: (F) => {
|
|
1144
|
+
F.stopPropagation(), a.deleteConversation(x.id);
|
|
1145
|
+
},
|
|
1146
|
+
className: "size-7 shrink-0 text-muted-foreground opacity-0 transition-opacity hover:bg-foreground/10 hover:text-destructive group-hover/conv:opacity-100",
|
|
1147
|
+
children: /* @__PURE__ */ t(pe, { className: "size-3.5" })
|
|
1148
|
+
}
|
|
1149
|
+
)
|
|
1150
|
+
]
|
|
1151
|
+
},
|
|
1152
|
+
x.id
|
|
1153
|
+
);
|
|
1154
|
+
}) })
|
|
1155
|
+
] })
|
|
1156
|
+
] }),
|
|
1157
|
+
/* @__PURE__ */ t(Ir, { className: "rounded-lg text-muted-foreground hover:text-foreground" }),
|
|
1158
|
+
T && a.getActiveToolCallCount() > 0 && /* @__PURE__ */ s(Y, { children: [
|
|
1159
|
+
/* @__PURE__ */ t(Q, { asChild: !0, children: /* @__PURE__ */ s(
|
|
1160
|
+
"div",
|
|
1161
|
+
{
|
|
1162
|
+
className: "inline-flex h-7 items-center gap-1 rounded-lg border border-border/60 bg-card/60 px-2 text-xs font-medium text-muted-foreground",
|
|
1163
|
+
"aria-label": `${a.getActiveToolCallCount()} tool calls in progress`,
|
|
1164
|
+
children: [
|
|
1165
|
+
/* @__PURE__ */ t(qe, { className: "size-3.5 animate-pulse" }),
|
|
1166
|
+
/* @__PURE__ */ t("span", { className: "font-mono", children: a.getActiveToolCallCount() })
|
|
1167
|
+
]
|
|
1168
|
+
}
|
|
1169
|
+
) }),
|
|
1170
|
+
/* @__PURE__ */ s(U, { children: [
|
|
1171
|
+
a.getActiveToolCallCount(),
|
|
1172
|
+
" tool call",
|
|
1173
|
+
a.getActiveToolCallCount() === 1 ? "" : "s",
|
|
1174
|
+
" in progress"
|
|
1175
|
+
] })
|
|
1176
|
+
] }),
|
|
1177
|
+
/* @__PURE__ */ s(Ne, { children: [
|
|
1178
|
+
/* @__PURE__ */ t(we, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1179
|
+
N,
|
|
1180
|
+
{
|
|
1181
|
+
variant: "ghost",
|
|
1182
|
+
size: "icon-sm",
|
|
1183
|
+
className: "rounded-lg text-muted-foreground hover:text-foreground",
|
|
1184
|
+
"aria-label": "More",
|
|
1185
|
+
children: /* @__PURE__ */ t(oa, { className: "size-4" })
|
|
1186
|
+
}
|
|
1187
|
+
) }),
|
|
1188
|
+
/* @__PURE__ */ s(ue, { align: "end", children: [
|
|
1189
|
+
/* @__PURE__ */ s(q, { onClick: () => j(!1), children: [
|
|
1190
|
+
/* @__PURE__ */ t(Fe, { className: "size-3.5" }),
|
|
1191
|
+
"Manage agents…"
|
|
1192
|
+
] }),
|
|
1193
|
+
/* @__PURE__ */ t(me, {}),
|
|
1194
|
+
/* @__PURE__ */ s(
|
|
1195
|
+
q,
|
|
1196
|
+
{
|
|
1197
|
+
onClick: () => a.clear(),
|
|
1198
|
+
className: "text-destructive focus:text-destructive",
|
|
1199
|
+
children: [
|
|
1200
|
+
/* @__PURE__ */ t(pe, { className: "size-3.5" }),
|
|
1201
|
+
"Clear this conversation"
|
|
1202
|
+
]
|
|
1203
|
+
}
|
|
1204
|
+
)
|
|
1205
|
+
] })
|
|
1206
|
+
] })
|
|
1207
|
+
] }),
|
|
1208
|
+
/* @__PURE__ */ t(
|
|
1209
|
+
Mr,
|
|
1210
|
+
{
|
|
1211
|
+
open: f,
|
|
1212
|
+
onOpenChange: o,
|
|
1213
|
+
activeAgentId: v?.id ?? null,
|
|
1214
|
+
onApply: B,
|
|
1215
|
+
startInCreate: m
|
|
1216
|
+
}
|
|
1217
|
+
)
|
|
1218
|
+
]
|
|
1219
|
+
}
|
|
1220
|
+
);
|
|
1221
|
+
}
|
|
1222
|
+
function _r(e) {
|
|
1223
|
+
const a = Date.now() - e, r = Math.round(a / 6e4);
|
|
1224
|
+
if (r < 1) return "just now";
|
|
1225
|
+
if (r < 60) return `${r}m ago`;
|
|
1226
|
+
const n = Math.round(r / 60);
|
|
1227
|
+
if (n < 24) return `${n}h ago`;
|
|
1228
|
+
const i = Math.round(n / 24);
|
|
1229
|
+
if (i < 7) return `${i}d ago`;
|
|
1230
|
+
try {
|
|
1231
|
+
return new Date(e).toLocaleDateString(void 0, {
|
|
1232
|
+
month: "short",
|
|
1233
|
+
day: "numeric"
|
|
1234
|
+
});
|
|
1235
|
+
} catch {
|
|
1236
|
+
return "";
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
function Hr() {
|
|
1240
|
+
return typeof window > "u" ? null : window.SpeechRecognition ?? window.webkitSpeechRecognition ?? null;
|
|
1241
|
+
}
|
|
1242
|
+
function jr(e = {}) {
|
|
1243
|
+
const a = W(null), r = W(null), [n, i] = z(!1), [c, l] = z(!1), [u, f] = z(null), [o, m] = z("");
|
|
1244
|
+
ne(() => {
|
|
1245
|
+
const k = Hr();
|
|
1246
|
+
return a.current = k, i(k !== null), () => {
|
|
1247
|
+
r.current?.abort(), r.current = null;
|
|
1248
|
+
};
|
|
1249
|
+
}, []);
|
|
1250
|
+
const p = Ce(() => {
|
|
1251
|
+
const k = a.current;
|
|
1252
|
+
if (!k) {
|
|
1253
|
+
f("Speech recognition is not supported in this browser.");
|
|
1254
|
+
return;
|
|
1255
|
+
}
|
|
1256
|
+
if (r.current) return;
|
|
1257
|
+
f(null), m("");
|
|
1258
|
+
const y = new k();
|
|
1259
|
+
y.lang = e.lang ?? (typeof navigator < "u" ? navigator.language : "en-US"), y.continuous = e.continuous ?? !1, y.interimResults = !0, y.onresult = (v) => {
|
|
1260
|
+
let b = "";
|
|
1261
|
+
for (let C = v.resultIndex; C < v.results.length; C++) {
|
|
1262
|
+
const T = v.results[C];
|
|
1263
|
+
T && T[0] && (b += T[0].transcript);
|
|
1264
|
+
}
|
|
1265
|
+
if (b) {
|
|
1266
|
+
m(b);
|
|
1267
|
+
const C = v.results[v.results.length - 1]?.isFinal ?? !1;
|
|
1268
|
+
e.onResult?.(b, C);
|
|
1269
|
+
}
|
|
1270
|
+
}, y.onerror = (v) => {
|
|
1271
|
+
const b = v.error ?? v.message ?? "Voice recognition error";
|
|
1272
|
+
f(b), l(!1), r.current = null;
|
|
1273
|
+
}, y.onend = () => {
|
|
1274
|
+
l(!1), r.current = null;
|
|
1275
|
+
};
|
|
1276
|
+
try {
|
|
1277
|
+
y.start(), r.current = y, l(!0);
|
|
1278
|
+
} catch (v) {
|
|
1279
|
+
f(v instanceof Error ? v.message : String(v)), l(!1), r.current = null;
|
|
1280
|
+
}
|
|
1281
|
+
}, [e.lang, e.continuous, e.onResult]), w = Ce(() => {
|
|
1282
|
+
if (r.current)
|
|
1283
|
+
try {
|
|
1284
|
+
r.current.stop();
|
|
1285
|
+
} catch {
|
|
1286
|
+
}
|
|
1287
|
+
}, []);
|
|
1288
|
+
return { supported: n, listening: c, error: u, start: p, stop: w, transcript: o };
|
|
1289
|
+
}
|
|
1290
|
+
const Fr = [
|
|
1291
|
+
{ value: "anthropic", label: "Anthropic (native)" },
|
|
1292
|
+
{ value: "openai", label: "OpenAI (native)" },
|
|
1293
|
+
{ value: "openai-compatible", label: "OpenAI-compatible" }
|
|
1294
|
+
], He = {
|
|
1295
|
+
name: "",
|
|
1296
|
+
icon: "🔌",
|
|
1297
|
+
kind: "openai-compatible",
|
|
1298
|
+
baseUrl: "",
|
|
1299
|
+
apiKey: "",
|
|
1300
|
+
models: ""
|
|
1301
|
+
};
|
|
1302
|
+
function Lr(e) {
|
|
1303
|
+
return {
|
|
1304
|
+
id: e.id,
|
|
1305
|
+
name: e.name,
|
|
1306
|
+
icon: e.icon ?? "🔌",
|
|
1307
|
+
kind: e.kind,
|
|
1308
|
+
baseUrl: e.baseUrl,
|
|
1309
|
+
apiKey: e.apiKey,
|
|
1310
|
+
models: _a(e.models)
|
|
1311
|
+
};
|
|
1312
|
+
}
|
|
1313
|
+
function Br({
|
|
1314
|
+
open: e,
|
|
1315
|
+
onOpenChange: a,
|
|
1316
|
+
activeProviderId: r,
|
|
1317
|
+
onApply: n,
|
|
1318
|
+
startInCreate: i = !1
|
|
1319
|
+
}) {
|
|
1320
|
+
const [c, l] = z([]), [u, f] = z("list"), [o, m] = z(He), p = () => l(xt());
|
|
1321
|
+
ne(() => {
|
|
1322
|
+
e && (p(), f(i ? "edit" : "list"), m(He));
|
|
1323
|
+
}, [e, i]);
|
|
1324
|
+
const w = o.name.trim().length > 0 && o.baseUrl.trim().length > 0;
|
|
1325
|
+
return /* @__PURE__ */ t(wt, { open: e, onOpenChange: a, children: /* @__PURE__ */ t(Xe, { className: "max-w-lg gap-0 overflow-hidden p-0", children: u === "list" ? /* @__PURE__ */ t(
|
|
1326
|
+
Vr,
|
|
1327
|
+
{
|
|
1328
|
+
providers: c,
|
|
1329
|
+
activeProviderId: r,
|
|
1330
|
+
onCreate: () => {
|
|
1331
|
+
m(He), f("edit");
|
|
1332
|
+
},
|
|
1333
|
+
onEdit: (y) => {
|
|
1334
|
+
m(Lr(y)), f("edit");
|
|
1335
|
+
},
|
|
1336
|
+
onApply: (y) => {
|
|
1337
|
+
n(y), a(!1);
|
|
1338
|
+
},
|
|
1339
|
+
onDuplicate: (y) => {
|
|
1340
|
+
Ea(y), p();
|
|
1341
|
+
},
|
|
1342
|
+
onDelete: (y) => {
|
|
1343
|
+
Ia(y), p();
|
|
1344
|
+
},
|
|
1345
|
+
onReset: () => {
|
|
1346
|
+
Pa(), p();
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
) : /* @__PURE__ */ t(
|
|
1350
|
+
$r,
|
|
1351
|
+
{
|
|
1352
|
+
draft: o,
|
|
1353
|
+
setDraft: m,
|
|
1354
|
+
canSave: w,
|
|
1355
|
+
onBack: () => f("list"),
|
|
1356
|
+
onSave: () => {
|
|
1357
|
+
if (!w) return;
|
|
1358
|
+
const y = Ha({
|
|
1359
|
+
id: o.id,
|
|
1360
|
+
name: o.name,
|
|
1361
|
+
icon: o.icon,
|
|
1362
|
+
kind: o.kind,
|
|
1363
|
+
baseUrl: o.baseUrl,
|
|
1364
|
+
apiKey: o.apiKey,
|
|
1365
|
+
models: ja(o.models, o.kind)
|
|
1366
|
+
});
|
|
1367
|
+
p(), n(y), a(!1);
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
) }) });
|
|
1371
|
+
}
|
|
1372
|
+
function Vr({
|
|
1373
|
+
providers: e,
|
|
1374
|
+
activeProviderId: a,
|
|
1375
|
+
onCreate: r,
|
|
1376
|
+
onEdit: n,
|
|
1377
|
+
onApply: i,
|
|
1378
|
+
onDuplicate: c,
|
|
1379
|
+
onDelete: l,
|
|
1380
|
+
onReset: u
|
|
1381
|
+
}) {
|
|
1382
|
+
const f = e.find((m) => m.id === a), o = e.filter((m) => m.id !== f?.id);
|
|
1383
|
+
return /* @__PURE__ */ s(L, { children: [
|
|
1384
|
+
/* @__PURE__ */ s(he, { className: "border-b border-border/60 p-5 pb-3", children: [
|
|
1385
|
+
/* @__PURE__ */ t(xe, { children: "Providers & models" }),
|
|
1386
|
+
/* @__PURE__ */ t(Je, { className: "text-xs", children: "Any OpenAI / Anthropic-compatible API. Keys stay in your browser." })
|
|
1387
|
+
] }),
|
|
1388
|
+
/* @__PURE__ */ s("div", { className: "max-h-[58vh] overflow-y-auto p-2 scrollbar-thin", children: [
|
|
1389
|
+
f && /* @__PURE__ */ s(L, { children: [
|
|
1390
|
+
/* @__PURE__ */ t(ut, { children: "Active" }),
|
|
1391
|
+
/* @__PURE__ */ t(
|
|
1392
|
+
mt,
|
|
1393
|
+
{
|
|
1394
|
+
p: f,
|
|
1395
|
+
active: !0,
|
|
1396
|
+
onApply: i,
|
|
1397
|
+
onEdit: n,
|
|
1398
|
+
onDuplicate: c,
|
|
1399
|
+
onDelete: l
|
|
1400
|
+
}
|
|
1401
|
+
),
|
|
1402
|
+
/* @__PURE__ */ t("div", { className: "h-2" })
|
|
1403
|
+
] }),
|
|
1404
|
+
/* @__PURE__ */ t(ut, { children: f ? "Available" : "Providers" }),
|
|
1405
|
+
o.map((m) => /* @__PURE__ */ t(
|
|
1406
|
+
mt,
|
|
1407
|
+
{
|
|
1408
|
+
p: m,
|
|
1409
|
+
onApply: i,
|
|
1410
|
+
onEdit: n,
|
|
1411
|
+
onDuplicate: c,
|
|
1412
|
+
onDelete: l
|
|
1413
|
+
},
|
|
1414
|
+
m.id
|
|
1415
|
+
))
|
|
1416
|
+
] }),
|
|
1417
|
+
/* @__PURE__ */ s(be, { className: "flex-row items-center justify-between border-t border-border/60 p-4 sm:justify-between", children: [
|
|
1418
|
+
/* @__PURE__ */ s(N, { variant: "ghost", size: "sm", onClick: u, className: "gap-1.5 text-muted-foreground", children: [
|
|
1419
|
+
/* @__PURE__ */ t(We, { className: "size-3.5" }),
|
|
1420
|
+
"Reset defaults"
|
|
1421
|
+
] }),
|
|
1422
|
+
/* @__PURE__ */ s(N, { onClick: r, className: "gap-2", children: [
|
|
1423
|
+
/* @__PURE__ */ t(Ke, { className: "size-4" }),
|
|
1424
|
+
"New provider"
|
|
1425
|
+
] })
|
|
1426
|
+
] })
|
|
1427
|
+
] });
|
|
1428
|
+
}
|
|
1429
|
+
function $r({
|
|
1430
|
+
draft: e,
|
|
1431
|
+
setDraft: a,
|
|
1432
|
+
canSave: r,
|
|
1433
|
+
onBack: n,
|
|
1434
|
+
onSave: i
|
|
1435
|
+
}) {
|
|
1436
|
+
const c = (l, u) => a({ ...e, [l]: u });
|
|
1437
|
+
return /* @__PURE__ */ s(L, { children: [
|
|
1438
|
+
/* @__PURE__ */ t(he, { className: "border-b border-border/60 p-5 pb-4", children: /* @__PURE__ */ s(xe, { className: "flex items-center gap-2", children: [
|
|
1439
|
+
/* @__PURE__ */ t(N, { type: "button", variant: "ghost", size: "icon-sm", onClick: n, "aria-label": "Back to list", className: "text-muted-foreground hover:text-foreground", children: /* @__PURE__ */ t(gt, { className: "size-4" }) }),
|
|
1440
|
+
e.id ? "Edit provider" : "New provider"
|
|
1441
|
+
] }) }),
|
|
1442
|
+
/* @__PURE__ */ s("div", { className: "max-h-[55vh] space-y-4 overflow-y-auto p-5 scrollbar-thin", children: [
|
|
1443
|
+
/* @__PURE__ */ s("div", { className: "flex gap-3", children: [
|
|
1444
|
+
/* @__PURE__ */ t(te, { label: "Icon", className: "w-20", children: /* @__PURE__ */ t($, { value: e.icon, onChange: (l) => c("icon", l.target.value.slice(0, 2)), className: "text-center text-lg", maxLength: 2 }) }),
|
|
1445
|
+
/* @__PURE__ */ t(te, { label: "Name", className: "flex-1", children: /* @__PURE__ */ t($, { value: e.name, onChange: (l) => c("name", l.target.value), placeholder: "e.g. Groq" }) })
|
|
1446
|
+
] }),
|
|
1447
|
+
/* @__PURE__ */ t(te, { label: "Protocol", children: /* @__PURE__ */ s(Ct, { value: e.kind, onValueChange: (l) => c("kind", l), children: [
|
|
1448
|
+
/* @__PURE__ */ t(Ze, { children: /* @__PURE__ */ t(zt, {}) }),
|
|
1449
|
+
/* @__PURE__ */ t(et, { children: Fr.map((l) => /* @__PURE__ */ t(tt, { value: l.value, children: l.label }, l.value)) })
|
|
1450
|
+
] }) }),
|
|
1451
|
+
/* @__PURE__ */ t(te, { label: "Base URL", children: /* @__PURE__ */ t($, { value: e.baseUrl, onChange: (l) => c("baseUrl", l.target.value), placeholder: "https://api.example.com/v1", className: "font-mono text-xs" }) }),
|
|
1452
|
+
/* @__PURE__ */ t(te, { label: "API key", hint: "stored in your browser", children: /* @__PURE__ */ t($, { type: "password", value: e.apiKey, onChange: (l) => c("apiKey", l.target.value), placeholder: "sk-…", className: "font-mono text-xs", autoComplete: "off" }) }),
|
|
1453
|
+
/* @__PURE__ */ t(te, { label: "Models", hint: "one per line · id | Label", children: /* @__PURE__ */ t(
|
|
1454
|
+
re,
|
|
1455
|
+
{
|
|
1456
|
+
value: e.models,
|
|
1457
|
+
onChange: (l) => c("models", l.target.value),
|
|
1458
|
+
placeholder: `gpt-4o | GPT-4o
|
|
1459
|
+
gpt-4o-mini | GPT-4o mini`,
|
|
1460
|
+
className: "min-h-24 resize-y font-mono text-xs"
|
|
1461
|
+
}
|
|
1462
|
+
) })
|
|
1463
|
+
] }),
|
|
1464
|
+
/* @__PURE__ */ s(be, { className: "gap-2 border-t border-border/60 p-4", children: [
|
|
1465
|
+
/* @__PURE__ */ t(N, { variant: "ghost", onClick: n, children: "Cancel" }),
|
|
1466
|
+
/* @__PURE__ */ s(N, { onClick: i, disabled: !r, className: "gap-2", children: [
|
|
1467
|
+
/* @__PURE__ */ t(P, { className: "size-4" }),
|
|
1468
|
+
"Save & use"
|
|
1469
|
+
] })
|
|
1470
|
+
] })
|
|
1471
|
+
] });
|
|
1472
|
+
}
|
|
1473
|
+
function ut({ children: e }) {
|
|
1474
|
+
return /* @__PURE__ */ t("p", { className: "px-2 pb-1 pt-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70", children: e });
|
|
1475
|
+
}
|
|
1476
|
+
function Or(e) {
|
|
1477
|
+
return e.replace(/^https?:\/\//, "");
|
|
1478
|
+
}
|
|
1479
|
+
function mt({
|
|
1480
|
+
p: e,
|
|
1481
|
+
active: a,
|
|
1482
|
+
onApply: r,
|
|
1483
|
+
onEdit: n,
|
|
1484
|
+
onDuplicate: i,
|
|
1485
|
+
onDelete: c
|
|
1486
|
+
}) {
|
|
1487
|
+
return /* @__PURE__ */ s(
|
|
1488
|
+
"div",
|
|
1489
|
+
{
|
|
1490
|
+
className: d(
|
|
1491
|
+
"group/prov flex items-center gap-2.5 rounded-lg px-2 py-1.5 transition-colors",
|
|
1492
|
+
a ? "bg-primary/8 ring-1 ring-primary/20" : "hover:bg-accent/50"
|
|
1493
|
+
),
|
|
1494
|
+
children: [
|
|
1495
|
+
/* @__PURE__ */ t("span", { className: "grid size-8 shrink-0 place-items-center rounded-md bg-muted text-base", children: e.icon ?? "🔌" }),
|
|
1496
|
+
/* @__PURE__ */ s(
|
|
1497
|
+
N,
|
|
1498
|
+
{
|
|
1499
|
+
type: "button",
|
|
1500
|
+
variant: "ghost",
|
|
1501
|
+
onClick: () => r(e),
|
|
1502
|
+
className: "h-auto min-w-0 flex-1 flex-col items-stretch justify-start gap-0.5 p-0 text-left hover:bg-transparent",
|
|
1503
|
+
children: [
|
|
1504
|
+
/* @__PURE__ */ s("span", { className: "flex items-center gap-1.5", children: [
|
|
1505
|
+
/* @__PURE__ */ t("span", { className: "truncate text-sm font-medium", children: e.name }),
|
|
1506
|
+
a && /* @__PURE__ */ t(P, { className: "size-3.5 shrink-0 text-primary" })
|
|
1507
|
+
] }),
|
|
1508
|
+
/* @__PURE__ */ s("span", { className: "flex items-center gap-1.5 truncate text-[11px] font-normal text-muted-foreground", children: [
|
|
1509
|
+
/* @__PURE__ */ t(
|
|
1510
|
+
"span",
|
|
1511
|
+
{
|
|
1512
|
+
className: d(
|
|
1513
|
+
"size-1.5 shrink-0 rounded-full",
|
|
1514
|
+
e.apiKey ? "bg-success" : "bg-muted-foreground/40"
|
|
1515
|
+
),
|
|
1516
|
+
title: e.apiKey ? "API key set" : "No API key"
|
|
1517
|
+
}
|
|
1518
|
+
),
|
|
1519
|
+
/* @__PURE__ */ t("span", { className: "truncate font-mono", children: Or(e.baseUrl) }),
|
|
1520
|
+
/* @__PURE__ */ s("span", { className: "shrink-0 text-muted-foreground/60", children: [
|
|
1521
|
+
"· ",
|
|
1522
|
+
e.models.length,
|
|
1523
|
+
" model",
|
|
1524
|
+
e.models.length === 1 ? "" : "s"
|
|
1525
|
+
] })
|
|
1526
|
+
] })
|
|
1527
|
+
]
|
|
1528
|
+
}
|
|
1529
|
+
),
|
|
1530
|
+
/* @__PURE__ */ s("div", { className: "flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity focus-within:opacity-100 group-hover/prov:opacity-100", children: [
|
|
1531
|
+
/* @__PURE__ */ t(N, { variant: "ghost", size: "icon-sm", "aria-label": "Duplicate", onClick: () => i(e.id), className: "text-muted-foreground hover:text-foreground", children: /* @__PURE__ */ t(Me, { className: "size-3.5" }) }),
|
|
1532
|
+
/* @__PURE__ */ t(N, { variant: "ghost", size: "icon-sm", "aria-label": "Edit", onClick: () => n(e), className: "text-muted-foreground hover:text-foreground", children: /* @__PURE__ */ t(Ue, { className: "size-3.5" }) }),
|
|
1533
|
+
/* @__PURE__ */ t(N, { variant: "ghost", size: "icon-sm", "aria-label": "Delete", onClick: () => c(e.id), className: "text-muted-foreground hover:text-destructive", children: /* @__PURE__ */ t(pe, { className: "size-3.5" }) })
|
|
1534
|
+
] })
|
|
1535
|
+
]
|
|
1536
|
+
}
|
|
1537
|
+
);
|
|
1538
|
+
}
|
|
1539
|
+
function te({
|
|
1540
|
+
label: e,
|
|
1541
|
+
hint: a,
|
|
1542
|
+
className: r,
|
|
1543
|
+
children: n
|
|
1544
|
+
}) {
|
|
1545
|
+
return /* @__PURE__ */ s("div", { className: d("space-y-1.5", r), children: [
|
|
1546
|
+
/* @__PURE__ */ s(at, { className: "flex items-center gap-1.5 text-xs font-medium text-muted-foreground", children: [
|
|
1547
|
+
e,
|
|
1548
|
+
a && /* @__PURE__ */ s("span", { className: "text-muted-foreground/60", children: [
|
|
1549
|
+
"· ",
|
|
1550
|
+
a
|
|
1551
|
+
] })
|
|
1552
|
+
] }),
|
|
1553
|
+
n
|
|
1554
|
+
] });
|
|
1555
|
+
}
|
|
1556
|
+
const Ur = K(
|
|
1557
|
+
"group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-2xl border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/30 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed",
|
|
1558
|
+
{
|
|
1559
|
+
variants: {
|
|
1560
|
+
size: {
|
|
1561
|
+
default: "gap-2 text-sm has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2 has-data-[slot=attachment-media]:p-2",
|
|
1562
|
+
sm: "gap-2.5 text-xs has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5",
|
|
1563
|
+
xs: "gap-1.5 rounded-xl text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1"
|
|
1564
|
+
},
|
|
1565
|
+
orientation: {
|
|
1566
|
+
horizontal: "min-w-40 items-center",
|
|
1567
|
+
vertical: "w-24 flex-col has-data-[slot=attachment-content]:w-30"
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
);
|
|
1572
|
+
function Pt({
|
|
1573
|
+
className: e,
|
|
1574
|
+
state: a = "done",
|
|
1575
|
+
size: r = "default",
|
|
1576
|
+
orientation: n = "horizontal",
|
|
1577
|
+
...i
|
|
1578
|
+
}) {
|
|
1579
|
+
return /* @__PURE__ */ t(
|
|
1580
|
+
"div",
|
|
1581
|
+
{
|
|
1582
|
+
"data-slot": "attachment",
|
|
1583
|
+
"data-state": a,
|
|
1584
|
+
"data-size": r,
|
|
1585
|
+
"data-orientation": n ?? "horizontal",
|
|
1586
|
+
className: d(Ur({ size: r, orientation: n }), e),
|
|
1587
|
+
...i
|
|
1588
|
+
}
|
|
1589
|
+
);
|
|
1590
|
+
}
|
|
1591
|
+
const Kr = K(
|
|
1592
|
+
"relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-foreground group-data-[orientation=vertical]/attachment:w-full group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 group-data-[size=xs]/attachment:rounded-md group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive group-data-[orientation=vertical]/attachment:*:data-[slot=spinner]:size-6! [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5",
|
|
1593
|
+
{
|
|
1594
|
+
variants: {
|
|
1595
|
+
variant: {
|
|
1596
|
+
icon: "",
|
|
1597
|
+
image: "opacity-60 group-data-[state=done]/attachment:opacity-100 group-data-[state=idle]/attachment:opacity-100 *:[img]:aspect-square *:[img]:w-full *:[img]:object-cover"
|
|
1598
|
+
}
|
|
1599
|
+
},
|
|
1600
|
+
defaultVariants: {
|
|
1601
|
+
variant: "icon"
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
);
|
|
1605
|
+
function Be({
|
|
1606
|
+
className: e,
|
|
1607
|
+
variant: a = "icon",
|
|
1608
|
+
...r
|
|
1609
|
+
}) {
|
|
1610
|
+
return /* @__PURE__ */ t(
|
|
1611
|
+
"div",
|
|
1612
|
+
{
|
|
1613
|
+
"data-slot": "attachment-media",
|
|
1614
|
+
"data-variant": a,
|
|
1615
|
+
className: d(Kr({ variant: a }), e),
|
|
1616
|
+
...r
|
|
1617
|
+
}
|
|
1618
|
+
);
|
|
1619
|
+
}
|
|
1620
|
+
function It({
|
|
1621
|
+
className: e,
|
|
1622
|
+
...a
|
|
1623
|
+
}) {
|
|
1624
|
+
return /* @__PURE__ */ t(
|
|
1625
|
+
"div",
|
|
1626
|
+
{
|
|
1627
|
+
"data-slot": "attachment-content",
|
|
1628
|
+
className: d(
|
|
1629
|
+
"max-w-full min-w-0 flex-1 leading-tight group-data-[orientation=vertical]/attachment:px-1",
|
|
1630
|
+
e
|
|
1631
|
+
),
|
|
1632
|
+
...a
|
|
1633
|
+
}
|
|
1634
|
+
);
|
|
1635
|
+
}
|
|
1636
|
+
function Et({
|
|
1637
|
+
className: e,
|
|
1638
|
+
...a
|
|
1639
|
+
}) {
|
|
1640
|
+
return /* @__PURE__ */ t(
|
|
1641
|
+
"span",
|
|
1642
|
+
{
|
|
1643
|
+
"data-slot": "attachment-title",
|
|
1644
|
+
className: d(
|
|
1645
|
+
"block max-w-full min-w-0 truncate font-medium group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer",
|
|
1646
|
+
e
|
|
1647
|
+
),
|
|
1648
|
+
...a
|
|
1649
|
+
}
|
|
1650
|
+
);
|
|
1651
|
+
}
|
|
1652
|
+
function _t({
|
|
1653
|
+
className: e,
|
|
1654
|
+
...a
|
|
1655
|
+
}) {
|
|
1656
|
+
return /* @__PURE__ */ t(
|
|
1657
|
+
"span",
|
|
1658
|
+
{
|
|
1659
|
+
"data-slot": "attachment-description",
|
|
1660
|
+
className: d(
|
|
1661
|
+
"mt-0.5 block min-w-0 truncate text-xs text-muted-foreground group-data-[state=error]/attachment:text-destructive/80",
|
|
1662
|
+
"max-w-full",
|
|
1663
|
+
e
|
|
1664
|
+
),
|
|
1665
|
+
...a
|
|
1666
|
+
}
|
|
1667
|
+
);
|
|
1668
|
+
}
|
|
1669
|
+
function Gr({
|
|
1670
|
+
className: e,
|
|
1671
|
+
...a
|
|
1672
|
+
}) {
|
|
1673
|
+
return /* @__PURE__ */ t(
|
|
1674
|
+
"div",
|
|
1675
|
+
{
|
|
1676
|
+
"data-slot": "attachment-actions",
|
|
1677
|
+
className: d(
|
|
1678
|
+
"relative z-20 flex shrink-0 items-center group-data-[orientation=vertical]/attachment:absolute group-data-[orientation=vertical]/attachment:top-3 group-data-[orientation=vertical]/attachment:right-3 group-data-[orientation=vertical]/attachment:gap-1",
|
|
1679
|
+
e
|
|
1680
|
+
),
|
|
1681
|
+
...a
|
|
1682
|
+
}
|
|
1683
|
+
);
|
|
1684
|
+
}
|
|
1685
|
+
function qr({
|
|
1686
|
+
className: e,
|
|
1687
|
+
variant: a,
|
|
1688
|
+
size: r = "icon-sm",
|
|
1689
|
+
...n
|
|
1690
|
+
}) {
|
|
1691
|
+
return /* @__PURE__ */ t(
|
|
1692
|
+
N,
|
|
1693
|
+
{
|
|
1694
|
+
"data-slot": "attachment-action",
|
|
1695
|
+
variant: a ?? "ghost",
|
|
1696
|
+
size: r,
|
|
1697
|
+
className: d(e),
|
|
1698
|
+
...n
|
|
1699
|
+
}
|
|
1700
|
+
);
|
|
1701
|
+
}
|
|
1702
|
+
function xs({
|
|
1703
|
+
className: e,
|
|
1704
|
+
asChild: a = !1,
|
|
1705
|
+
type: r,
|
|
1706
|
+
...n
|
|
1707
|
+
}) {
|
|
1708
|
+
return /* @__PURE__ */ t(
|
|
1709
|
+
a ? Re : "button",
|
|
1710
|
+
{
|
|
1711
|
+
"data-slot": "attachment-trigger",
|
|
1712
|
+
type: a ? void 0 : r ?? "button",
|
|
1713
|
+
className: d("absolute inset-0 z-10 outline-none", e),
|
|
1714
|
+
...n
|
|
1715
|
+
}
|
|
1716
|
+
);
|
|
1717
|
+
}
|
|
1718
|
+
function vs({ className: e, ...a }) {
|
|
1719
|
+
return /* @__PURE__ */ t(
|
|
1720
|
+
"div",
|
|
1721
|
+
{
|
|
1722
|
+
"data-slot": "attachment-group",
|
|
1723
|
+
className: d(
|
|
1724
|
+
"flex min-w-0 scroll-fade-x snap-x snap-mandatory scroll-px-1 scrollbar-none gap-3 overflow-x-auto overscroll-x-contain py-1 *:data-[slot=attachment]:flex-none *:data-[slot=attachment]:snap-start",
|
|
1725
|
+
e
|
|
1726
|
+
),
|
|
1727
|
+
...a
|
|
1728
|
+
}
|
|
1729
|
+
);
|
|
1730
|
+
}
|
|
1731
|
+
function Wr(e) {
|
|
1732
|
+
return e === "application/pdf" ? ia : e === "application/json" ? la : e.startsWith("text/csv") || e === "text/csv" ? ca : e.startsWith("text/") ? Ge : da;
|
|
1733
|
+
}
|
|
1734
|
+
function Yr(e) {
|
|
1735
|
+
return !e || e === "application/octet-stream" ? "file" : e.startsWith("image/") ? e.slice(6).toUpperCase() : e === "application/pdf" ? "PDF" : e === "application/json" ? "JSON" : e.startsWith("text/") ? e.slice(5).toUpperCase() : e;
|
|
1736
|
+
}
|
|
1737
|
+
function Ht({
|
|
1738
|
+
att: e,
|
|
1739
|
+
state: a = "done",
|
|
1740
|
+
onRemove: r
|
|
1741
|
+
}) {
|
|
1742
|
+
const n = e.mimeType ?? e.mime ?? "", i = n.startsWith("image/") && !!e.dataUrl, c = Wr(n);
|
|
1743
|
+
return /* @__PURE__ */ s(
|
|
1744
|
+
Pt,
|
|
1745
|
+
{
|
|
1746
|
+
size: "default",
|
|
1747
|
+
state: a,
|
|
1748
|
+
className: "w-56 max-w-full bg-background/60",
|
|
1749
|
+
children: [
|
|
1750
|
+
i ? /* @__PURE__ */ t(
|
|
1751
|
+
Be,
|
|
1752
|
+
{
|
|
1753
|
+
variant: "image",
|
|
1754
|
+
className: "size-11 rounded-lg ring-1 ring-border/60",
|
|
1755
|
+
children: /* @__PURE__ */ t("img", { src: e.dataUrl, alt: e.name, loading: "lazy" })
|
|
1756
|
+
}
|
|
1757
|
+
) : /* @__PURE__ */ t(Be, { className: "size-11 rounded-lg text-primary", children: /* @__PURE__ */ t(c, { className: "size-5" }) }),
|
|
1758
|
+
/* @__PURE__ */ s(It, { children: [
|
|
1759
|
+
/* @__PURE__ */ t(Et, { children: e.name }),
|
|
1760
|
+
/* @__PURE__ */ s(_t, { children: [
|
|
1761
|
+
Jt(e.size),
|
|
1762
|
+
" · ",
|
|
1763
|
+
Yr(n)
|
|
1764
|
+
] })
|
|
1765
|
+
] }),
|
|
1766
|
+
r && /* @__PURE__ */ t(Gr, { children: /* @__PURE__ */ t(qr, { "aria-label": "Remove attachment", onClick: r, children: /* @__PURE__ */ t(ft, { className: "size-3.5" }) }) })
|
|
1767
|
+
]
|
|
1768
|
+
}
|
|
1769
|
+
);
|
|
1770
|
+
}
|
|
1771
|
+
function Qr(e) {
|
|
1772
|
+
const { onSend: a, streaming: r, disabled: n, renderSendButton: i, className: c, contentClassName: l } = e, u = se(), f = u.config, o = f.ui ?? {}, [m, p] = z(""), [w, k] = z([]), [y, v] = z(0), [b, C] = z(null), T = W(null), E = (g) => {
|
|
1773
|
+
C(g), T.current !== null && window.clearTimeout(T.current), T.current = window.setTimeout(() => C(null), 4e3);
|
|
1774
|
+
};
|
|
1775
|
+
ne(
|
|
1776
|
+
() => () => {
|
|
1777
|
+
T.current !== null && window.clearTimeout(T.current);
|
|
1778
|
+
},
|
|
1779
|
+
[]
|
|
1780
|
+
);
|
|
1781
|
+
const [B, j] = z(!1), _ = W(null), De = W(null), ie = W(null), le = W(0), x = 200;
|
|
1782
|
+
Yt(() => {
|
|
1783
|
+
const g = ie.current;
|
|
1784
|
+
if (!g) return;
|
|
1785
|
+
const M = le.current;
|
|
1786
|
+
g.style.height = "auto";
|
|
1787
|
+
const D = Math.min(g.scrollHeight, x);
|
|
1788
|
+
M && M !== D && (g.style.height = `${M}px`, g.offsetHeight), g.style.height = `${D}px`, le.current = D;
|
|
1789
|
+
}, [m]);
|
|
1790
|
+
const H = r ?? u.isStreaming, F = !H && !n && (m.trim().length > 0 || w.length > 0), Z = o.enableFileUpload ?? !0, Ft = o.enableVoiceInput ?? !1, V = jr({
|
|
1791
|
+
onResult: (g) => {
|
|
1792
|
+
p((M) => {
|
|
1793
|
+
const D = M.length > 0 && !M.endsWith(" ") ? " " : "";
|
|
1794
|
+
return M + D + g;
|
|
1795
|
+
});
|
|
1796
|
+
}
|
|
1797
|
+
}), [Lt, rt] = z(!1), [Bt, Vt] = z(!1), [nt, $t] = z(
|
|
1798
|
+
() => Fa()
|
|
1799
|
+
), st = (g, M) => {
|
|
1800
|
+
const D = u.config.provider, ce = g.apiKey || (D.baseUrl === g.baseUrl ? D.credentials?.apiKey ?? "" : "");
|
|
1801
|
+
u.updateConfig(
|
|
1802
|
+
La({ ...g, apiKey: ce }, M)
|
|
1803
|
+
), Ba(g.id), $t(g.id);
|
|
1804
|
+
}, Pe = async () => {
|
|
1805
|
+
if (!F) return;
|
|
1806
|
+
const g = m.trim();
|
|
1807
|
+
p("");
|
|
1808
|
+
const M = w;
|
|
1809
|
+
k([]), a ? await a(g, M) : await u.send(g, M);
|
|
1810
|
+
}, Ot = (g) => {
|
|
1811
|
+
g.key === "Enter" && !g.shiftKey && !g.nativeEvent.isComposing && (g.preventDefault(), Pe());
|
|
1812
|
+
}, ot = Ce(
|
|
1813
|
+
async (g) => {
|
|
1814
|
+
const M = Array.from(g), D = o.maxFileSizeMb ?? 10, ce = o.acceptedFileTypes ?? [], ve = M.filter((R) => R.size > D * 1024 * 1024), it = ve.length > 0, Ie = ve.length > 0 ? M.filter((R) => R.size <= D * 1024 * 1024) : M, de = ce.length > 0 ? Ie.filter(
|
|
1815
|
+
(R) => ce.some((G) => R.type === G || R.type.startsWith(`${G}/`))
|
|
1816
|
+
) : Ie, ye = Ie.length - de.length;
|
|
1817
|
+
if (it || ye > 0) {
|
|
1818
|
+
const R = [];
|
|
1819
|
+
it && R.push(
|
|
1820
|
+
`${ve.length} file${ve.length === 1 ? "" : "s"} over ${D} MB`
|
|
1821
|
+
), ye > 0 && R.push(
|
|
1822
|
+
`${ye} file${ye === 1 ? "" : "s"} with unsupported type`
|
|
1823
|
+
);
|
|
1824
|
+
const G = `Rejected ${R.join(" and ")}.`;
|
|
1825
|
+
if (console.warn(`[MessageInput] ${G}`, { maxMb: D, acceptedTypes: ce }), E(G), de.length === 0) return;
|
|
1826
|
+
}
|
|
1827
|
+
v((R) => R + de.length);
|
|
1828
|
+
try {
|
|
1829
|
+
const R = await Ka(de, f);
|
|
1830
|
+
k((G) => [...G, ...R]);
|
|
1831
|
+
} catch (R) {
|
|
1832
|
+
u.config.onError?.(
|
|
1833
|
+
{
|
|
1834
|
+
code: "bad_request",
|
|
1835
|
+
message: (R instanceof Error ? R.message : String(R)) ?? "File upload failed",
|
|
1836
|
+
retryable: !1
|
|
1837
|
+
},
|
|
1838
|
+
{ conversationId: u.conversationId }
|
|
1839
|
+
);
|
|
1840
|
+
} finally {
|
|
1841
|
+
v((R) => Math.max(0, R - de.length));
|
|
1842
|
+
}
|
|
1843
|
+
},
|
|
1844
|
+
[
|
|
1845
|
+
f,
|
|
1846
|
+
u.config,
|
|
1847
|
+
u.conversationId,
|
|
1848
|
+
o.maxFileSizeMb,
|
|
1849
|
+
o.acceptedFileTypes
|
|
1850
|
+
]
|
|
1851
|
+
), Ut = (g) => {
|
|
1852
|
+
g.target.files && ot(g.target.files), g.target.value = "";
|
|
1853
|
+
}, Kt = (g) => {
|
|
1854
|
+
g.preventDefault(), j(!1), g.dataTransfer.files && ot(g.dataTransfer.files);
|
|
1855
|
+
}, Gt = (g) => {
|
|
1856
|
+
Z && (g.preventDefault(), j(!0));
|
|
1857
|
+
}, qt = (g) => {
|
|
1858
|
+
k((M) => M.filter((D) => D.id !== g.id));
|
|
1859
|
+
}, Wt = (g) => {
|
|
1860
|
+
Vt(g), rt(!0);
|
|
1861
|
+
};
|
|
1862
|
+
return /* @__PURE__ */ s(
|
|
1863
|
+
"form",
|
|
1864
|
+
{
|
|
1865
|
+
ref: De,
|
|
1866
|
+
onSubmit: (g) => {
|
|
1867
|
+
g.preventDefault(), Pe();
|
|
1868
|
+
},
|
|
1869
|
+
className: d(
|
|
1870
|
+
"relative z-10 px-3 pb-3 pt-2 sm:px-4 sm:pb-4",
|
|
1871
|
+
c
|
|
1872
|
+
),
|
|
1873
|
+
onDragOver: Gt,
|
|
1874
|
+
onDragLeave: () => j(!1),
|
|
1875
|
+
onDrop: Kt,
|
|
1876
|
+
children: [
|
|
1877
|
+
/* @__PURE__ */ s(
|
|
1878
|
+
"div",
|
|
1879
|
+
{
|
|
1880
|
+
className: d(
|
|
1881
|
+
"mx-auto w-full max-w-3xl rounded-2xl border bg-card/80 p-2 backdrop-blur-xl transition-[box-shadow,border-color] duration-200",
|
|
1882
|
+
"border-border/70 shadow-[0_2px_8px_-4px_oklch(var(--foreground)/0.1)]",
|
|
1883
|
+
"focus-within:border-primary/50 focus-within:shadow-[0_0_0_1px_oklch(var(--primary)/0.35),0_10px_30px_-12px_oklch(var(--glow)/0.5)]",
|
|
1884
|
+
B && "border-primary/60 ring-2 ring-primary/30",
|
|
1885
|
+
l
|
|
1886
|
+
),
|
|
1887
|
+
children: [
|
|
1888
|
+
(w.length > 0 || y > 0) && /* @__PURE__ */ s("div", { className: "flex max-h-44 flex-wrap gap-2 overflow-y-auto px-1 pb-2 pt-1 scrollbar-thin", children: [
|
|
1889
|
+
w.map((g) => /* @__PURE__ */ t(
|
|
1890
|
+
Ht,
|
|
1891
|
+
{
|
|
1892
|
+
att: g,
|
|
1893
|
+
onRemove: () => qt(g)
|
|
1894
|
+
},
|
|
1895
|
+
g.id
|
|
1896
|
+
)),
|
|
1897
|
+
Array.from({ length: y }).map((g, M) => /* @__PURE__ */ s(Pt, { size: "sm", state: "uploading", children: [
|
|
1898
|
+
/* @__PURE__ */ t(Be, { children: /* @__PURE__ */ t(Le, { className: "size-4 animate-spin" }) }),
|
|
1899
|
+
/* @__PURE__ */ s(It, { children: [
|
|
1900
|
+
/* @__PURE__ */ t(Et, { children: "Uploading…" }),
|
|
1901
|
+
/* @__PURE__ */ t(_t, { children: "reading file" })
|
|
1902
|
+
] })
|
|
1903
|
+
] }, `uploading-${M}`))
|
|
1904
|
+
] }),
|
|
1905
|
+
/* @__PURE__ */ s("div", { className: "flex items-end gap-1.5", children: [
|
|
1906
|
+
Z && /* @__PURE__ */ s(L, { children: [
|
|
1907
|
+
/* @__PURE__ */ t(
|
|
1908
|
+
"input",
|
|
1909
|
+
{
|
|
1910
|
+
ref: _,
|
|
1911
|
+
type: "file",
|
|
1912
|
+
hidden: !0,
|
|
1913
|
+
multiple: !0,
|
|
1914
|
+
onChange: Ut,
|
|
1915
|
+
accept: (o.acceptedFileTypes ?? []).join(",")
|
|
1916
|
+
}
|
|
1917
|
+
),
|
|
1918
|
+
/* @__PURE__ */ s(Y, { children: [
|
|
1919
|
+
/* @__PURE__ */ t(Q, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1920
|
+
N,
|
|
1921
|
+
{
|
|
1922
|
+
type: "button",
|
|
1923
|
+
variant: "ghost",
|
|
1924
|
+
size: "icon",
|
|
1925
|
+
className: "size-9 shrink-0 rounded-xl text-muted-foreground hover:text-foreground",
|
|
1926
|
+
onClick: () => _.current?.click(),
|
|
1927
|
+
"aria-label": "Attach files",
|
|
1928
|
+
disabled: n,
|
|
1929
|
+
children: /* @__PURE__ */ t(ua, { className: "size-[18px]" })
|
|
1930
|
+
}
|
|
1931
|
+
) }),
|
|
1932
|
+
/* @__PURE__ */ t(U, { children: "Attach files (images, PDFs, text)" })
|
|
1933
|
+
] })
|
|
1934
|
+
] }),
|
|
1935
|
+
Ft && V.supported && /* @__PURE__ */ s(Y, { children: [
|
|
1936
|
+
/* @__PURE__ */ t(Q, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1937
|
+
N,
|
|
1938
|
+
{
|
|
1939
|
+
type: "button",
|
|
1940
|
+
variant: V.listening ? "destructive" : "ghost",
|
|
1941
|
+
size: "icon",
|
|
1942
|
+
className: d(
|
|
1943
|
+
"size-9 shrink-0 rounded-xl text-muted-foreground hover:text-foreground",
|
|
1944
|
+
V.listening && "ring-2 ring-primary/60 animate-pulse"
|
|
1945
|
+
),
|
|
1946
|
+
onClick: () => {
|
|
1947
|
+
V.listening ? V.stop() : V.start();
|
|
1948
|
+
},
|
|
1949
|
+
"aria-label": V.listening ? "Stop dictation" : "Start dictation",
|
|
1950
|
+
disabled: n,
|
|
1951
|
+
children: V.listening ? /* @__PURE__ */ t(ma, { className: "size-[18px]" }) : /* @__PURE__ */ t(pa, { className: "size-[18px]" })
|
|
1952
|
+
}
|
|
1953
|
+
) }),
|
|
1954
|
+
/* @__PURE__ */ t(U, { children: V.listening ? "Stop dictation" : "Start dictation" })
|
|
1955
|
+
] }),
|
|
1956
|
+
/* @__PURE__ */ t(
|
|
1957
|
+
re,
|
|
1958
|
+
{
|
|
1959
|
+
ref: ie,
|
|
1960
|
+
value: m,
|
|
1961
|
+
onChange: (g) => p(g.target.value),
|
|
1962
|
+
onKeyDown: Ot,
|
|
1963
|
+
placeholder: o.placeholder ?? "Ask anything…",
|
|
1964
|
+
rows: 1,
|
|
1965
|
+
disabled: n,
|
|
1966
|
+
className: "max-h-[200px] min-h-[40px] flex-1 resize-none overflow-y-auto border-0 bg-transparent px-1 py-2 text-[0.9375rem] shadow-none scrollbar-thin transition-[height] duration-150 ease-out focus-visible:ring-0 focus-visible:ring-offset-0 motion-reduce:transition-none"
|
|
1967
|
+
}
|
|
1968
|
+
),
|
|
1969
|
+
/* @__PURE__ */ t(
|
|
1970
|
+
Xr,
|
|
1971
|
+
{
|
|
1972
|
+
currentModelId: f.model.id,
|
|
1973
|
+
activeProviderId: nt,
|
|
1974
|
+
onPick: st,
|
|
1975
|
+
onManage: () => Wt(!1)
|
|
1976
|
+
}
|
|
1977
|
+
),
|
|
1978
|
+
H ? /* @__PURE__ */ t(
|
|
1979
|
+
N,
|
|
1980
|
+
{
|
|
1981
|
+
type: "button",
|
|
1982
|
+
variant: "destructive",
|
|
1983
|
+
size: "icon",
|
|
1984
|
+
className: "size-9 shrink-0 rounded-xl",
|
|
1985
|
+
onClick: () => u.abort(),
|
|
1986
|
+
"aria-label": "Stop generating",
|
|
1987
|
+
children: /* @__PURE__ */ t(fa, { className: "size-3.5 fill-current" })
|
|
1988
|
+
}
|
|
1989
|
+
) : i ? i({
|
|
1990
|
+
disabled: !F,
|
|
1991
|
+
onClick: () => void Pe()
|
|
1992
|
+
}) : /* @__PURE__ */ t(
|
|
1993
|
+
N,
|
|
1994
|
+
{
|
|
1995
|
+
type: "submit",
|
|
1996
|
+
size: "icon",
|
|
1997
|
+
disabled: !F,
|
|
1998
|
+
"aria-label": "Send message",
|
|
1999
|
+
className: d(
|
|
2000
|
+
"size-9 shrink-0 rounded-xl border-0 text-primary-foreground transition-all",
|
|
2001
|
+
F ? "grad-primary glow-primary hover:brightness-110" : "bg-muted text-muted-foreground"
|
|
2002
|
+
),
|
|
2003
|
+
children: /* @__PURE__ */ t(ga, { className: "size-4" })
|
|
2004
|
+
}
|
|
2005
|
+
)
|
|
2006
|
+
] })
|
|
2007
|
+
]
|
|
2008
|
+
}
|
|
2009
|
+
),
|
|
2010
|
+
/* @__PURE__ */ s("p", { className: d("mx-auto mt-2 max-w-3xl px-1 text-center text-[11px] text-muted-foreground/70", l), children: [
|
|
2011
|
+
"Press",
|
|
2012
|
+
" ",
|
|
2013
|
+
/* @__PURE__ */ t("kbd", { className: "rounded border border-border/70 bg-muted/60 px-1 font-sans text-[10px]", children: "Enter" }),
|
|
2014
|
+
" ",
|
|
2015
|
+
"to send ·",
|
|
2016
|
+
" ",
|
|
2017
|
+
/* @__PURE__ */ t("kbd", { className: "rounded border border-border/70 bg-muted/60 px-1 font-sans text-[10px]", children: "Shift+Enter" }),
|
|
2018
|
+
" ",
|
|
2019
|
+
"for a new line"
|
|
2020
|
+
] }),
|
|
2021
|
+
b && /* @__PURE__ */ t(
|
|
2022
|
+
"p",
|
|
2023
|
+
{
|
|
2024
|
+
role: "status",
|
|
2025
|
+
className: "mx-auto mt-1 max-w-3xl px-1 text-center text-[11px] text-destructive",
|
|
2026
|
+
children: b
|
|
2027
|
+
}
|
|
2028
|
+
),
|
|
2029
|
+
B && /* @__PURE__ */ s("div", { className: "pointer-events-none absolute inset-2 flex items-center justify-center gap-2 rounded-2xl border-2 border-dashed border-primary/50 bg-primary/5 text-sm font-medium text-primary backdrop-blur-sm", children: [
|
|
2030
|
+
/* @__PURE__ */ t(Ge, { className: "size-4" }),
|
|
2031
|
+
"Drop files to attach"
|
|
2032
|
+
] }),
|
|
2033
|
+
/* @__PURE__ */ t(
|
|
2034
|
+
Br,
|
|
2035
|
+
{
|
|
2036
|
+
open: Lt,
|
|
2037
|
+
onOpenChange: rt,
|
|
2038
|
+
activeProviderId: nt,
|
|
2039
|
+
onApply: (g) => st(g),
|
|
2040
|
+
startInCreate: Bt
|
|
2041
|
+
}
|
|
2042
|
+
)
|
|
2043
|
+
]
|
|
2044
|
+
}
|
|
2045
|
+
);
|
|
2046
|
+
}
|
|
2047
|
+
function Xr({
|
|
2048
|
+
currentModelId: e,
|
|
2049
|
+
activeProviderId: a,
|
|
2050
|
+
onPick: r,
|
|
2051
|
+
onManage: n
|
|
2052
|
+
}) {
|
|
2053
|
+
const [i, c] = z(!1), [l, u] = z(""), f = Qt(() => i ? xt() : [], [i]), o = l.toLowerCase(), m = f.map((p) => ({
|
|
2054
|
+
provider: p,
|
|
2055
|
+
models: p.models.filter(
|
|
2056
|
+
(w) => !o || w.id.toLowerCase().includes(o) || (w.label ?? "").toLowerCase().includes(o) || p.name.toLowerCase().includes(o)
|
|
2057
|
+
)
|
|
2058
|
+
})).filter((p) => p.models.length > 0);
|
|
2059
|
+
return /* @__PURE__ */ s(lr, { open: i, onOpenChange: c, children: [
|
|
2060
|
+
/* @__PURE__ */ t(cr, { asChild: !0, children: /* @__PURE__ */ s(
|
|
2061
|
+
N,
|
|
2062
|
+
{
|
|
2063
|
+
type: "button",
|
|
2064
|
+
variant: "ghost",
|
|
2065
|
+
size: "sm",
|
|
2066
|
+
className: "hidden h-9 shrink-0 gap-1 rounded-xl border border-border/60 px-2.5 text-xs font-medium text-muted-foreground hover:text-foreground sm:inline-flex",
|
|
2067
|
+
"aria-label": "Select model",
|
|
2068
|
+
children: [
|
|
2069
|
+
/* @__PURE__ */ t("span", { className: "max-w-[120px] truncate font-mono text-[11px]", children: e || "Select model" }),
|
|
2070
|
+
/* @__PURE__ */ t(Ae, { className: "size-3 opacity-60" })
|
|
2071
|
+
]
|
|
2072
|
+
}
|
|
2073
|
+
) }),
|
|
2074
|
+
/* @__PURE__ */ s(Nt, { align: "end", className: "w-80 p-0", children: [
|
|
2075
|
+
/* @__PURE__ */ t("div", { className: "border-b p-2", children: /* @__PURE__ */ t(
|
|
2076
|
+
$,
|
|
2077
|
+
{
|
|
2078
|
+
type: "text",
|
|
2079
|
+
placeholder: "Search providers & models…",
|
|
2080
|
+
value: l,
|
|
2081
|
+
onChange: (p) => u(p.target.value),
|
|
2082
|
+
className: "h-8 text-xs"
|
|
2083
|
+
}
|
|
2084
|
+
) }),
|
|
2085
|
+
/* @__PURE__ */ t("div", { className: "max-h-72 overflow-y-auto p-1", children: m.length === 0 ? /* @__PURE__ */ t("div", { className: "p-4 text-center text-xs text-muted-foreground", children: "No models found" }) : m.map(({ provider: p, models: w }) => /* @__PURE__ */ s("div", { className: "mb-1", children: [
|
|
2086
|
+
/* @__PURE__ */ s("p", { className: "flex items-center gap-1.5 px-2 py-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: [
|
|
2087
|
+
/* @__PURE__ */ t("span", { className: "text-sm leading-none", children: p.icon }),
|
|
2088
|
+
p.name,
|
|
2089
|
+
!p.apiKey && /* @__PURE__ */ t("span", { className: "rounded bg-muted px-1 text-[8px] normal-case text-muted-foreground/70", children: "no key" })
|
|
2090
|
+
] }),
|
|
2091
|
+
w.map((k) => {
|
|
2092
|
+
const y = k.id === e && p.id === a;
|
|
2093
|
+
return /* @__PURE__ */ s(
|
|
2094
|
+
N,
|
|
2095
|
+
{
|
|
2096
|
+
type: "button",
|
|
2097
|
+
variant: "ghost",
|
|
2098
|
+
onClick: () => {
|
|
2099
|
+
r(p, k), c(!1);
|
|
2100
|
+
},
|
|
2101
|
+
className: d(
|
|
2102
|
+
"h-auto w-full justify-between gap-2 rounded-sm px-2 py-1.5 text-left text-xs font-normal",
|
|
2103
|
+
y && "bg-accent/50"
|
|
2104
|
+
),
|
|
2105
|
+
children: [
|
|
2106
|
+
/* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: [
|
|
2107
|
+
/* @__PURE__ */ t("span", { className: "block truncate font-medium", children: k.label ?? k.id }),
|
|
2108
|
+
/* @__PURE__ */ t("span", { className: "block truncate font-mono text-[10px] text-muted-foreground", children: k.id })
|
|
2109
|
+
] }),
|
|
2110
|
+
y && /* @__PURE__ */ t(P, { className: "size-3.5 shrink-0 text-primary" })
|
|
2111
|
+
]
|
|
2112
|
+
},
|
|
2113
|
+
`${p.id}:${k.id}`
|
|
2114
|
+
);
|
|
2115
|
+
})
|
|
2116
|
+
] }, p.id)) }),
|
|
2117
|
+
/* @__PURE__ */ t("div", { className: "border-t p-1", children: /* @__PURE__ */ s(
|
|
2118
|
+
N,
|
|
2119
|
+
{
|
|
2120
|
+
type: "button",
|
|
2121
|
+
variant: "ghost",
|
|
2122
|
+
size: "sm",
|
|
2123
|
+
onClick: () => {
|
|
2124
|
+
c(!1), n();
|
|
2125
|
+
},
|
|
2126
|
+
className: "h-8 w-full justify-start gap-2 rounded-sm px-2 text-xs font-normal text-muted-foreground hover:text-foreground",
|
|
2127
|
+
children: [
|
|
2128
|
+
/* @__PURE__ */ t(Fe, { className: "size-3.5" }),
|
|
2129
|
+
"Manage providers & models…"
|
|
2130
|
+
]
|
|
2131
|
+
}
|
|
2132
|
+
) })
|
|
2133
|
+
] })
|
|
2134
|
+
] });
|
|
2135
|
+
}
|
|
2136
|
+
function ys({ className: e, ...a }) {
|
|
2137
|
+
return /* @__PURE__ */ t(
|
|
2138
|
+
"div",
|
|
2139
|
+
{
|
|
2140
|
+
"data-slot": "bubble-group",
|
|
2141
|
+
className: d("flex min-w-0 flex-col gap-2", e),
|
|
2142
|
+
...a
|
|
2143
|
+
}
|
|
2144
|
+
);
|
|
2145
|
+
}
|
|
2146
|
+
const Jr = K(
|
|
2147
|
+
"group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full",
|
|
2148
|
+
{
|
|
2149
|
+
variants: {
|
|
2150
|
+
variant: {
|
|
2151
|
+
default: "*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80",
|
|
2152
|
+
secondary: "*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",
|
|
2153
|
+
muted: "*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]",
|
|
2154
|
+
tinted: "*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]",
|
|
2155
|
+
outline: "*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30",
|
|
2156
|
+
ghost: "border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50",
|
|
2157
|
+
destructive: "*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30"
|
|
2158
|
+
}
|
|
2159
|
+
},
|
|
2160
|
+
defaultVariants: {
|
|
2161
|
+
variant: "default"
|
|
2162
|
+
}
|
|
2163
|
+
}
|
|
2164
|
+
);
|
|
2165
|
+
function Zr({
|
|
2166
|
+
variant: e = "default",
|
|
2167
|
+
align: a = "start",
|
|
2168
|
+
className: r,
|
|
2169
|
+
...n
|
|
2170
|
+
}) {
|
|
2171
|
+
return /* @__PURE__ */ t(
|
|
2172
|
+
"div",
|
|
2173
|
+
{
|
|
2174
|
+
"data-slot": "bubble",
|
|
2175
|
+
"data-variant": e,
|
|
2176
|
+
"data-align": a,
|
|
2177
|
+
className: d(Jr({ variant: e }), r),
|
|
2178
|
+
...n
|
|
2179
|
+
}
|
|
2180
|
+
);
|
|
2181
|
+
}
|
|
2182
|
+
function en({
|
|
2183
|
+
asChild: e = !1,
|
|
2184
|
+
className: a,
|
|
2185
|
+
...r
|
|
2186
|
+
}) {
|
|
2187
|
+
return /* @__PURE__ */ t(
|
|
2188
|
+
e ? Re : "div",
|
|
2189
|
+
{
|
|
2190
|
+
"data-slot": "bubble-content",
|
|
2191
|
+
className: d(
|
|
2192
|
+
"w-fit max-w-full min-w-0 overflow-hidden rounded-3xl border border-transparent px-3 py-2.5 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/30",
|
|
2193
|
+
a
|
|
2194
|
+
),
|
|
2195
|
+
...r
|
|
2196
|
+
}
|
|
2197
|
+
);
|
|
2198
|
+
}
|
|
2199
|
+
const tn = K(
|
|
2200
|
+
"absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0",
|
|
2201
|
+
{
|
|
2202
|
+
variants: {
|
|
2203
|
+
side: {
|
|
2204
|
+
top: "top-0 -translate-y-3/4",
|
|
2205
|
+
bottom: "bottom-0 translate-y-3/4"
|
|
2206
|
+
},
|
|
2207
|
+
align: {
|
|
2208
|
+
start: "left-3",
|
|
2209
|
+
end: "right-3"
|
|
2210
|
+
}
|
|
2211
|
+
},
|
|
2212
|
+
defaultVariants: {
|
|
2213
|
+
side: "bottom",
|
|
2214
|
+
align: "end"
|
|
2215
|
+
}
|
|
2216
|
+
}
|
|
2217
|
+
);
|
|
2218
|
+
function Ns({
|
|
2219
|
+
side: e = "bottom",
|
|
2220
|
+
align: a = "end",
|
|
2221
|
+
className: r,
|
|
2222
|
+
...n
|
|
2223
|
+
}) {
|
|
2224
|
+
return /* @__PURE__ */ t(
|
|
2225
|
+
"div",
|
|
2226
|
+
{
|
|
2227
|
+
"data-slot": "bubble-reactions",
|
|
2228
|
+
"data-align": a,
|
|
2229
|
+
"data-side": e,
|
|
2230
|
+
className: d(tn({ side: e, align: a }), r),
|
|
2231
|
+
...n
|
|
2232
|
+
}
|
|
2233
|
+
);
|
|
2234
|
+
}
|
|
2235
|
+
function ws({ className: e, ...a }) {
|
|
2236
|
+
return /* @__PURE__ */ t(
|
|
2237
|
+
"div",
|
|
2238
|
+
{
|
|
2239
|
+
"data-slot": "message-group",
|
|
2240
|
+
className: d("flex min-w-0 flex-col gap-2", e),
|
|
2241
|
+
...a
|
|
2242
|
+
}
|
|
2243
|
+
);
|
|
2244
|
+
}
|
|
2245
|
+
function an({
|
|
2246
|
+
className: e,
|
|
2247
|
+
align: a = "start",
|
|
2248
|
+
...r
|
|
2249
|
+
}) {
|
|
2250
|
+
return /* @__PURE__ */ t(
|
|
2251
|
+
"div",
|
|
2252
|
+
{
|
|
2253
|
+
"data-slot": "message",
|
|
2254
|
+
"data-align": a,
|
|
2255
|
+
className: d(
|
|
2256
|
+
"group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse",
|
|
2257
|
+
e
|
|
2258
|
+
),
|
|
2259
|
+
...r
|
|
2260
|
+
}
|
|
2261
|
+
);
|
|
2262
|
+
}
|
|
2263
|
+
function rn({ className: e, ...a }) {
|
|
2264
|
+
return /* @__PURE__ */ t(
|
|
2265
|
+
"div",
|
|
2266
|
+
{
|
|
2267
|
+
"data-slot": "message-avatar",
|
|
2268
|
+
className: d(
|
|
2269
|
+
"flex w-fit min-w-8 shrink-0 items-center justify-center self-end overflow-hidden rounded-full bg-muted group-has-data-[slot=message-footer]/message:-translate-y-8",
|
|
2270
|
+
e
|
|
2271
|
+
),
|
|
2272
|
+
...a
|
|
2273
|
+
}
|
|
2274
|
+
);
|
|
2275
|
+
}
|
|
2276
|
+
function nn({ className: e, ...a }) {
|
|
2277
|
+
return /* @__PURE__ */ t(
|
|
2278
|
+
"div",
|
|
2279
|
+
{
|
|
2280
|
+
"data-slot": "message-content",
|
|
2281
|
+
className: d(
|
|
2282
|
+
"flex w-full min-w-0 flex-col gap-2.5 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end",
|
|
2283
|
+
e
|
|
2284
|
+
),
|
|
2285
|
+
...a
|
|
2286
|
+
}
|
|
2287
|
+
);
|
|
2288
|
+
}
|
|
2289
|
+
function ks({ className: e, ...a }) {
|
|
2290
|
+
return /* @__PURE__ */ t(
|
|
2291
|
+
"div",
|
|
2292
|
+
{
|
|
2293
|
+
"data-slot": "message-header",
|
|
2294
|
+
className: d(
|
|
2295
|
+
"flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0",
|
|
2296
|
+
e
|
|
2297
|
+
),
|
|
2298
|
+
...a
|
|
2299
|
+
}
|
|
2300
|
+
);
|
|
2301
|
+
}
|
|
2302
|
+
function Ve({ className: e, ...a }) {
|
|
2303
|
+
return /* @__PURE__ */ t(
|
|
2304
|
+
"div",
|
|
2305
|
+
{
|
|
2306
|
+
"data-slot": "message-footer",
|
|
2307
|
+
className: d(
|
|
2308
|
+
"flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0 group-data-[align=end]/message:justify-end",
|
|
2309
|
+
e
|
|
2310
|
+
),
|
|
2311
|
+
...a
|
|
2312
|
+
}
|
|
2313
|
+
);
|
|
2314
|
+
}
|
|
2315
|
+
class sn {
|
|
2316
|
+
state = {
|
|
2317
|
+
viewportEl: null,
|
|
2318
|
+
scrollHeight: 0,
|
|
2319
|
+
scrollTop: 0,
|
|
2320
|
+
viewportHeight: 0,
|
|
2321
|
+
autoScroll: !1
|
|
2322
|
+
};
|
|
2323
|
+
listeners = /* @__PURE__ */ new Set();
|
|
2324
|
+
getState = () => this.state;
|
|
2325
|
+
subscribe = (a) => (this.listeners.add(a), () => {
|
|
2326
|
+
this.listeners.delete(a);
|
|
2327
|
+
});
|
|
2328
|
+
setState = (a) => {
|
|
2329
|
+
this.state = { ...this.state, ...a };
|
|
2330
|
+
for (const r of this.listeners) r();
|
|
2331
|
+
};
|
|
2332
|
+
}
|
|
2333
|
+
const jt = h.createContext(null);
|
|
2334
|
+
function J() {
|
|
2335
|
+
const e = h.useContext(jt);
|
|
2336
|
+
if (!e)
|
|
2337
|
+
throw new Error(
|
|
2338
|
+
"MessageScroller primitives must be used within MessageScrollerProvider."
|
|
2339
|
+
);
|
|
2340
|
+
return e;
|
|
2341
|
+
}
|
|
2342
|
+
function on(e) {
|
|
2343
|
+
const {
|
|
2344
|
+
autoScroll: a = !1,
|
|
2345
|
+
defaultScrollPosition: r = "end",
|
|
2346
|
+
scrollEdgeThreshold: n = 4,
|
|
2347
|
+
contentSignal: i = "",
|
|
2348
|
+
children: c
|
|
2349
|
+
} = e, l = h.useRef(null);
|
|
2350
|
+
l.current === null && (l.current = new sn());
|
|
2351
|
+
const u = h.useRef([]), f = h.useRef(!1), o = h.useCallback((b) => (u.current = [...u.current, b], () => {
|
|
2352
|
+
u.current = u.current.filter((C) => C.id !== b.id);
|
|
2353
|
+
}), []), m = h.useCallback(
|
|
2354
|
+
(b, C = {}) => {
|
|
2355
|
+
const T = l.current.getState().viewportEl;
|
|
2356
|
+
if (!T) return;
|
|
2357
|
+
const E = u.current[b];
|
|
2358
|
+
if (!E?.element) return;
|
|
2359
|
+
const B = E.element.offsetTop, j = C.align ?? "start";
|
|
2360
|
+
let _ = B;
|
|
2361
|
+
j === "end" ? _ = B + E.element.offsetHeight - T.clientHeight : j === "center" && (_ = B + E.element.offsetHeight / 2 - T.clientHeight / 2), _ = Math.max(0, _), typeof T.scrollTo == "function" ? T.scrollTo({ top: _, behavior: C.behavior ?? "smooth" }) : T.scrollTop = _;
|
|
2362
|
+
},
|
|
2363
|
+
[]
|
|
2364
|
+
), p = h.useCallback(
|
|
2365
|
+
(b) => m(u.current.length - 1, {
|
|
2366
|
+
align: "end",
|
|
2367
|
+
...b
|
|
2368
|
+
}),
|
|
2369
|
+
[m]
|
|
2370
|
+
), w = h.useCallback(
|
|
2371
|
+
(b) => m(0, { align: "start", ...b }),
|
|
2372
|
+
[m]
|
|
2373
|
+
), k = h.useCallback(
|
|
2374
|
+
(b, C) => {
|
|
2375
|
+
const T = u.current.findIndex((E) => E.id === b);
|
|
2376
|
+
T >= 0 && m(T, C);
|
|
2377
|
+
},
|
|
2378
|
+
[m]
|
|
2379
|
+
);
|
|
2380
|
+
h.useEffect(() => {
|
|
2381
|
+
const b = l.current;
|
|
2382
|
+
return b.subscribe(() => {
|
|
2383
|
+
!b.getState().viewportEl || f.current || requestAnimationFrame(() => {
|
|
2384
|
+
f.current || (r === "end" ? p({ behavior: "auto" }) : w({ behavior: "auto" }), f.current = !0);
|
|
2385
|
+
});
|
|
2386
|
+
});
|
|
2387
|
+
}, [r, p, w]), h.useEffect(() => {
|
|
2388
|
+
l.current.setState({ autoScroll: a });
|
|
2389
|
+
}, [a]);
|
|
2390
|
+
const y = h.useRef(p);
|
|
2391
|
+
h.useEffect(() => {
|
|
2392
|
+
y.current = p;
|
|
2393
|
+
}, [p]), h.useEffect(() => {
|
|
2394
|
+
if (!a) return;
|
|
2395
|
+
const b = l.current, C = requestAnimationFrame(() => {
|
|
2396
|
+
const T = b.getState();
|
|
2397
|
+
!T.viewportEl || T.scrollHeight - T.scrollTop - T.viewportHeight > n || y.current({ behavior: "auto" });
|
|
2398
|
+
});
|
|
2399
|
+
return () => cancelAnimationFrame(C);
|
|
2400
|
+
}, [a, i, n, l]);
|
|
2401
|
+
const v = h.useMemo(
|
|
2402
|
+
() => ({
|
|
2403
|
+
registerMessage: o,
|
|
2404
|
+
stateStore: l.current,
|
|
2405
|
+
scrollToIndex: m,
|
|
2406
|
+
scrollToEnd: p,
|
|
2407
|
+
scrollToStart: w,
|
|
2408
|
+
scrollToMessage: k
|
|
2409
|
+
}),
|
|
2410
|
+
[o, m, p, w, k]
|
|
2411
|
+
);
|
|
2412
|
+
return /* @__PURE__ */ t(jt.Provider, { value: v, children: c });
|
|
2413
|
+
}
|
|
2414
|
+
function Cs() {
|
|
2415
|
+
const { scrollToEnd: e, scrollToStart: a, scrollToMessage: r } = J();
|
|
2416
|
+
return h.useMemo(
|
|
2417
|
+
() => ({
|
|
2418
|
+
scrollToEnd: e,
|
|
2419
|
+
scrollToStart: a,
|
|
2420
|
+
scrollToMessage: r
|
|
2421
|
+
}),
|
|
2422
|
+
[e, a, r]
|
|
2423
|
+
);
|
|
2424
|
+
}
|
|
2425
|
+
function ln() {
|
|
2426
|
+
const { stateStore: e } = J();
|
|
2427
|
+
return h.useSyncExternalStore(
|
|
2428
|
+
e.subscribe,
|
|
2429
|
+
e.getState,
|
|
2430
|
+
e.getState
|
|
2431
|
+
);
|
|
2432
|
+
}
|
|
2433
|
+
function cn() {
|
|
2434
|
+
const { stateStore: e } = J(), a = h.useRef({
|
|
2435
|
+
atEnd: !1,
|
|
2436
|
+
atStart: !0
|
|
2437
|
+
});
|
|
2438
|
+
return h.useSyncExternalStore(
|
|
2439
|
+
e.subscribe,
|
|
2440
|
+
() => {
|
|
2441
|
+
const r = e.getState(), i = r.scrollHeight - r.scrollTop - r.viewportHeight < 32, c = r.scrollTop < 32, l = a.current;
|
|
2442
|
+
if (l.atEnd === i && l.atStart === c) return l;
|
|
2443
|
+
const u = { atEnd: i, atStart: c };
|
|
2444
|
+
return a.current = u, u;
|
|
2445
|
+
},
|
|
2446
|
+
() => ({ atEnd: !1, atStart: !0 })
|
|
2447
|
+
);
|
|
2448
|
+
}
|
|
2449
|
+
const dn = h.forwardRef(function({ children: e, ...a }, r) {
|
|
2450
|
+
return /* @__PURE__ */ t("div", { ref: r, ...a, children: e });
|
|
2451
|
+
}), un = h.forwardRef(
|
|
2452
|
+
function({ children: e, onScroll: a, ...r }, n) {
|
|
2453
|
+
const i = h.useRef(null), c = h.useCallback(
|
|
2454
|
+
(u) => {
|
|
2455
|
+
i.current = u, typeof n == "function" ? n(u) : n && (n.current = u);
|
|
2456
|
+
},
|
|
2457
|
+
[n]
|
|
2458
|
+
), { stateStore: l } = J();
|
|
2459
|
+
return h.useEffect(() => {
|
|
2460
|
+
const u = i.current;
|
|
2461
|
+
if (u)
|
|
2462
|
+
return l.setState({
|
|
2463
|
+
viewportEl: u,
|
|
2464
|
+
scrollHeight: u.scrollHeight,
|
|
2465
|
+
scrollTop: u.scrollTop,
|
|
2466
|
+
viewportHeight: u.clientHeight
|
|
2467
|
+
}), () => l.setState({ viewportEl: null });
|
|
2468
|
+
}, [l]), h.useLayoutEffect(() => {
|
|
2469
|
+
const u = i.current;
|
|
2470
|
+
if (!u) return;
|
|
2471
|
+
const f = () => l.setState({
|
|
2472
|
+
scrollHeight: u.scrollHeight,
|
|
2473
|
+
scrollTop: u.scrollTop,
|
|
2474
|
+
viewportHeight: u.clientHeight
|
|
2475
|
+
});
|
|
2476
|
+
u.addEventListener("scroll", f, { passive: !0 });
|
|
2477
|
+
const o = new ResizeObserver(f);
|
|
2478
|
+
return o.observe(u), f(), () => {
|
|
2479
|
+
u.removeEventListener("scroll", f), o.disconnect();
|
|
2480
|
+
};
|
|
2481
|
+
}, [l]), /* @__PURE__ */ t(
|
|
2482
|
+
"div",
|
|
2483
|
+
{
|
|
2484
|
+
ref: c,
|
|
2485
|
+
onScroll: (u) => {
|
|
2486
|
+
a?.(u);
|
|
2487
|
+
},
|
|
2488
|
+
...r,
|
|
2489
|
+
children: e
|
|
2490
|
+
}
|
|
2491
|
+
);
|
|
2492
|
+
}
|
|
2493
|
+
), mn = h.forwardRef(
|
|
2494
|
+
function({ children: a, ...r }, n) {
|
|
2495
|
+
const i = h.useRef(null), { stateStore: c } = J(), l = h.useRef(
|
|
2496
|
+
null
|
|
2497
|
+
), u = h.useRef(a), f = h.useCallback(
|
|
2498
|
+
(o) => {
|
|
2499
|
+
i.current = o, typeof n == "function" ? n(o) : n && (n.current = o);
|
|
2500
|
+
},
|
|
2501
|
+
[n]
|
|
2502
|
+
);
|
|
2503
|
+
return h.useEffect(() => {
|
|
2504
|
+
const o = i.current;
|
|
2505
|
+
if (!o) return;
|
|
2506
|
+
const m = l.current, p = u.current;
|
|
2507
|
+
if (u.current = a, !m || p === a || o.scrollHeight - m.scrollHeight <= 0 || m.scrollTop > 8) return;
|
|
2508
|
+
const y = requestAnimationFrame(() => {
|
|
2509
|
+
if (!i.current) return;
|
|
2510
|
+
const v = i.current.scrollHeight, b = v - m.scrollHeight;
|
|
2511
|
+
b > 0 && (i.current.scrollTop = m.scrollTop + b, c.setState({
|
|
2512
|
+
scrollTop: m.scrollTop + b,
|
|
2513
|
+
scrollHeight: v
|
|
2514
|
+
}));
|
|
2515
|
+
});
|
|
2516
|
+
return () => cancelAnimationFrame(y);
|
|
2517
|
+
}, [a, c]), h.useLayoutEffect(() => {
|
|
2518
|
+
const o = i.current;
|
|
2519
|
+
if (!o) return;
|
|
2520
|
+
const m = () => {
|
|
2521
|
+
l.current = {
|
|
2522
|
+
scrollTop: o.scrollTop,
|
|
2523
|
+
scrollHeight: o.scrollHeight
|
|
2524
|
+
};
|
|
2525
|
+
}, p = requestAnimationFrame(m);
|
|
2526
|
+
return o.addEventListener("scroll", m, { passive: !0 }), () => {
|
|
2527
|
+
cancelAnimationFrame(p), o.removeEventListener("scroll", m);
|
|
2528
|
+
};
|
|
2529
|
+
}, []), /* @__PURE__ */ t("div", { ref: f, ...r, children: a });
|
|
2530
|
+
}
|
|
2531
|
+
), pn = h.forwardRef(
|
|
2532
|
+
function({ id: e, scrollAnchor: a, children: r, ...n }, i) {
|
|
2533
|
+
const { registerMessage: c } = J(), l = h.useRef(null), u = h.useId(), f = e ?? u, o = h.useCallback(
|
|
2534
|
+
(m) => {
|
|
2535
|
+
l.current = m, typeof i == "function" ? i(m) : i && (i.current = m);
|
|
2536
|
+
},
|
|
2537
|
+
[i]
|
|
2538
|
+
);
|
|
2539
|
+
return h.useEffect(() => c({
|
|
2540
|
+
id: f,
|
|
2541
|
+
element: l.current,
|
|
2542
|
+
scrollAnchor: a
|
|
2543
|
+
}), [f, a, c]), /* @__PURE__ */ t("div", { ref: o, ...n, children: r });
|
|
2544
|
+
}
|
|
2545
|
+
), fn = h.forwardRef(
|
|
2546
|
+
function({ direction: e = "end", render: a, onClick: r, children: n, ...i }, c) {
|
|
2547
|
+
const { stateStore: l, scrollToEnd: u, scrollToStart: f } = J(), o = cn(), m = e === "end", p = m ? !o.atEnd : !o.atStart;
|
|
2548
|
+
ln();
|
|
2549
|
+
const w = (k) => {
|
|
2550
|
+
r?.(k), m ? u() : f();
|
|
2551
|
+
};
|
|
2552
|
+
return a ? h.cloneElement(a, {
|
|
2553
|
+
ref: c,
|
|
2554
|
+
onClick: w,
|
|
2555
|
+
"data-active": p,
|
|
2556
|
+
"data-direction": e,
|
|
2557
|
+
...i,
|
|
2558
|
+
children: n ?? a.props.children
|
|
2559
|
+
}) : /* @__PURE__ */ t(
|
|
2560
|
+
"button",
|
|
2561
|
+
{
|
|
2562
|
+
ref: c,
|
|
2563
|
+
type: "button",
|
|
2564
|
+
"data-active": p,
|
|
2565
|
+
"data-direction": e,
|
|
2566
|
+
onClick: w,
|
|
2567
|
+
...i,
|
|
2568
|
+
children: n
|
|
2569
|
+
}
|
|
2570
|
+
);
|
|
2571
|
+
}
|
|
2572
|
+
), oe = {
|
|
2573
|
+
Provider: on,
|
|
2574
|
+
Root: dn,
|
|
2575
|
+
Viewport: un,
|
|
2576
|
+
Content: mn,
|
|
2577
|
+
Item: pn,
|
|
2578
|
+
Button: fn
|
|
2579
|
+
};
|
|
2580
|
+
function gn(e) {
|
|
2581
|
+
return /* @__PURE__ */ t(oe.Provider, { ...e });
|
|
2582
|
+
}
|
|
2583
|
+
function hn({
|
|
2584
|
+
className: e,
|
|
2585
|
+
...a
|
|
2586
|
+
}) {
|
|
2587
|
+
return /* @__PURE__ */ t(
|
|
2588
|
+
oe.Root,
|
|
2589
|
+
{
|
|
2590
|
+
"data-slot": "message-scroller",
|
|
2591
|
+
className: d(
|
|
2592
|
+
"group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden",
|
|
2593
|
+
e
|
|
2594
|
+
),
|
|
2595
|
+
...a
|
|
2596
|
+
}
|
|
2597
|
+
);
|
|
2598
|
+
}
|
|
2599
|
+
function pt({
|
|
2600
|
+
className: e,
|
|
2601
|
+
...a
|
|
2602
|
+
}) {
|
|
2603
|
+
return /* @__PURE__ */ t(
|
|
2604
|
+
oe.Viewport,
|
|
2605
|
+
{
|
|
2606
|
+
"data-slot": "message-scroller-viewport",
|
|
2607
|
+
className: d(
|
|
2608
|
+
"size-full min-h-0 min-w-0 scroll-fade-b scrollbar-thin scrollbar-gutter-stable overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-none",
|
|
2609
|
+
e
|
|
2610
|
+
),
|
|
2611
|
+
...a
|
|
2612
|
+
}
|
|
2613
|
+
);
|
|
2614
|
+
}
|
|
2615
|
+
function bn({
|
|
2616
|
+
className: e,
|
|
2617
|
+
...a
|
|
2618
|
+
}) {
|
|
2619
|
+
return /* @__PURE__ */ t(
|
|
2620
|
+
oe.Content,
|
|
2621
|
+
{
|
|
2622
|
+
"data-slot": "message-scroller-content",
|
|
2623
|
+
className: d("flex h-max min-h-full flex-col gap-8", e),
|
|
2624
|
+
...a
|
|
2625
|
+
}
|
|
2626
|
+
);
|
|
2627
|
+
}
|
|
2628
|
+
function xn({
|
|
2629
|
+
className: e,
|
|
2630
|
+
scrollAnchor: a = !1,
|
|
2631
|
+
...r
|
|
2632
|
+
}) {
|
|
2633
|
+
return /* @__PURE__ */ t(
|
|
2634
|
+
oe.Item,
|
|
2635
|
+
{
|
|
2636
|
+
"data-slot": "message-scroller-item",
|
|
2637
|
+
scrollAnchor: a,
|
|
2638
|
+
className: d(
|
|
2639
|
+
"min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]",
|
|
2640
|
+
e
|
|
2641
|
+
),
|
|
2642
|
+
...r
|
|
2643
|
+
}
|
|
2644
|
+
);
|
|
2645
|
+
}
|
|
2646
|
+
function vn({
|
|
2647
|
+
direction: e = "end",
|
|
2648
|
+
className: a,
|
|
2649
|
+
children: r,
|
|
2650
|
+
render: n,
|
|
2651
|
+
variant: i = "secondary",
|
|
2652
|
+
size: c = "icon-sm",
|
|
2653
|
+
...l
|
|
2654
|
+
}) {
|
|
2655
|
+
return /* @__PURE__ */ t(
|
|
2656
|
+
oe.Button,
|
|
2657
|
+
{
|
|
2658
|
+
"data-slot": "message-scroller-button",
|
|
2659
|
+
"data-direction": e,
|
|
2660
|
+
"data-variant": i,
|
|
2661
|
+
"data-size": c,
|
|
2662
|
+
direction: e,
|
|
2663
|
+
className: d(
|
|
2664
|
+
"absolute left-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180",
|
|
2665
|
+
a
|
|
2666
|
+
),
|
|
2667
|
+
render: n ?? /* @__PURE__ */ t(N, { variant: i, size: c }),
|
|
2668
|
+
...l,
|
|
2669
|
+
children: r ?? /* @__PURE__ */ s(L, { children: [
|
|
2670
|
+
/* @__PURE__ */ t(ha, {}),
|
|
2671
|
+
/* @__PURE__ */ t("span", { className: "sr-only", children: e === "end" ? "Scroll to end" : "Scroll to start" })
|
|
2672
|
+
] })
|
|
2673
|
+
}
|
|
2674
|
+
);
|
|
2675
|
+
}
|
|
2676
|
+
const yn = K(
|
|
2677
|
+
"group/marker relative flex min-h-4 w-full items-center gap-2 text-left text-sm text-muted-foreground [&_svg:not([class*='size-'])]:size-4 [a]:underline [a]:underline-offset-3 [a]:hover:text-foreground",
|
|
2678
|
+
{
|
|
2679
|
+
variants: {
|
|
2680
|
+
variant: {
|
|
2681
|
+
default: "",
|
|
2682
|
+
separator: "before:mr-1 before:h-px before:min-w-0 before:flex-1 before:bg-border after:ml-1 after:h-px after:min-w-0 after:flex-1 after:bg-border",
|
|
2683
|
+
border: "border-b border-border pb-2"
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
}
|
|
2687
|
+
);
|
|
2688
|
+
function Nn({
|
|
2689
|
+
className: e,
|
|
2690
|
+
variant: a = "default",
|
|
2691
|
+
asChild: r = !1,
|
|
2692
|
+
...n
|
|
2693
|
+
}) {
|
|
2694
|
+
return /* @__PURE__ */ t(
|
|
2695
|
+
r ? Re : "div",
|
|
2696
|
+
{
|
|
2697
|
+
"data-slot": "marker",
|
|
2698
|
+
"data-variant": a,
|
|
2699
|
+
className: d(yn({ variant: a, className: e })),
|
|
2700
|
+
...n
|
|
2701
|
+
}
|
|
2702
|
+
);
|
|
2703
|
+
}
|
|
2704
|
+
function wn({ className: e, ...a }) {
|
|
2705
|
+
return /* @__PURE__ */ t(
|
|
2706
|
+
"span",
|
|
2707
|
+
{
|
|
2708
|
+
"data-slot": "marker-icon",
|
|
2709
|
+
"aria-hidden": "true",
|
|
2710
|
+
className: d(
|
|
2711
|
+
"size-4 shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
2712
|
+
e
|
|
2713
|
+
),
|
|
2714
|
+
...a
|
|
2715
|
+
}
|
|
2716
|
+
);
|
|
2717
|
+
}
|
|
2718
|
+
function kn({ className: e, ...a }) {
|
|
2719
|
+
return /* @__PURE__ */ t(
|
|
2720
|
+
"span",
|
|
2721
|
+
{
|
|
2722
|
+
"data-slot": "marker-content",
|
|
2723
|
+
className: d(
|
|
2724
|
+
"min-w-0 wrap-break-word group-data-[variant=separator]/marker:flex-none group-data-[variant=separator]/marker:text-center *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
|
|
2725
|
+
e
|
|
2726
|
+
),
|
|
2727
|
+
...a
|
|
2728
|
+
}
|
|
2729
|
+
);
|
|
2730
|
+
}
|
|
2731
|
+
function Cn({ getText: e }) {
|
|
2732
|
+
const [a, r] = z(!1);
|
|
2733
|
+
return /* @__PURE__ */ t(
|
|
2734
|
+
N,
|
|
2735
|
+
{
|
|
2736
|
+
type: "button",
|
|
2737
|
+
variant: "ghost",
|
|
2738
|
+
"aria-label": "Copy code",
|
|
2739
|
+
onClick: () => {
|
|
2740
|
+
try {
|
|
2741
|
+
navigator.clipboard?.writeText(e()), r(!0), setTimeout(() => r(!1), 1600);
|
|
2742
|
+
} catch {
|
|
2743
|
+
}
|
|
2744
|
+
},
|
|
2745
|
+
className: "h-7 gap-1.5 px-2 text-[11px] font-medium text-muted-foreground hover:bg-foreground/10 hover:text-foreground",
|
|
2746
|
+
children: a ? /* @__PURE__ */ s(L, { children: [
|
|
2747
|
+
/* @__PURE__ */ t(P, { className: "size-3 text-success" }),
|
|
2748
|
+
" Copied"
|
|
2749
|
+
] }) : /* @__PURE__ */ s(L, { children: [
|
|
2750
|
+
/* @__PURE__ */ t(Me, { className: "size-3" }),
|
|
2751
|
+
" Copy"
|
|
2752
|
+
] })
|
|
2753
|
+
}
|
|
2754
|
+
);
|
|
2755
|
+
}
|
|
2756
|
+
function $e(e) {
|
|
2757
|
+
if (e == null || typeof e == "boolean") return "";
|
|
2758
|
+
if (typeof e == "string" || typeof e == "number") return String(e);
|
|
2759
|
+
if (Array.isArray(e)) return e.map($e).join("");
|
|
2760
|
+
if (typeof e == "object" && "props" in e) {
|
|
2761
|
+
const a = e.props;
|
|
2762
|
+
return $e(a?.children);
|
|
2763
|
+
}
|
|
2764
|
+
return "";
|
|
2765
|
+
}
|
|
2766
|
+
function zn(e) {
|
|
2767
|
+
if (!e || e.enabled === !1)
|
|
2768
|
+
return d("ai-prose", "text-[0.9375rem] leading-relaxed");
|
|
2769
|
+
const a = e.preset && e.preset !== "default" ? `typeset-${e.preset}` : "typeset";
|
|
2770
|
+
return d(a, "text-[var(--typeset-size)]");
|
|
2771
|
+
}
|
|
2772
|
+
function Sn(e) {
|
|
2773
|
+
if (!e || e.enabled === !1) return;
|
|
2774
|
+
const a = {};
|
|
2775
|
+
return e.size && (a["--typeset-size"] = e.size), typeof e.leading == "number" && (a["--typeset-leading"] = e.leading), e.flow && (a["--typeset-flow"] = e.flow), e.fontBody && (a["--typeset-font-body"] = e.fontBody), e.fontHeading && (a["--typeset-font-heading"] = e.fontHeading), e.fontMono && (a["--typeset-font-mono"] = e.fontMono), Object.keys(a).length > 0 ? a : void 0;
|
|
2776
|
+
}
|
|
2777
|
+
const Tn = Xt(function({
|
|
2778
|
+
children: a,
|
|
2779
|
+
className: r,
|
|
2780
|
+
typeset: n,
|
|
2781
|
+
enableCodeHighlight: i = !0,
|
|
2782
|
+
enableCopyButtons: c = !0
|
|
2783
|
+
}) {
|
|
2784
|
+
const l = zn(n), u = Sn(n), f = i ? [ct, [Oa, { detect: !0, ignoreMissing: !0 }]] : [ct];
|
|
2785
|
+
return /* @__PURE__ */ t(
|
|
2786
|
+
"div",
|
|
2787
|
+
{
|
|
2788
|
+
className: d(l, r),
|
|
2789
|
+
style: u,
|
|
2790
|
+
children: /* @__PURE__ */ t(
|
|
2791
|
+
$a,
|
|
2792
|
+
{
|
|
2793
|
+
remarkPlugins: [Ua],
|
|
2794
|
+
rehypePlugins: f,
|
|
2795
|
+
components: {
|
|
2796
|
+
p: ({ children: o }) => /* @__PURE__ */ t("p", { className: "my-2.5", children: o }),
|
|
2797
|
+
a: ({ children: o, href: m }) => /* @__PURE__ */ t(
|
|
2798
|
+
"a",
|
|
2799
|
+
{
|
|
2800
|
+
href: m,
|
|
2801
|
+
target: "_blank",
|
|
2802
|
+
rel: "noreferrer noopener",
|
|
2803
|
+
className: "font-medium text-primary underline decoration-primary/30 underline-offset-2 transition-colors hover:decoration-primary",
|
|
2804
|
+
children: o
|
|
2805
|
+
}
|
|
2806
|
+
),
|
|
2807
|
+
img: ({ src: o, alt: m }) => (
|
|
2808
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
2809
|
+
/* @__PURE__ */ t(
|
|
2810
|
+
"img",
|
|
2811
|
+
{
|
|
2812
|
+
src: typeof o == "string" ? o : void 0,
|
|
2813
|
+
alt: m ?? "",
|
|
2814
|
+
loading: "lazy",
|
|
2815
|
+
className: "my-2 h-auto max-h-80 max-w-full rounded-xl border border-border object-contain"
|
|
2816
|
+
}
|
|
2817
|
+
)
|
|
2818
|
+
),
|
|
2819
|
+
ul: ({ children: o }) => /* @__PURE__ */ t("ul", { className: "my-2.5 list-disc space-y-1 pl-5 marker:text-muted-foreground", children: o }),
|
|
2820
|
+
ol: ({ children: o }) => /* @__PURE__ */ t("ol", { className: "my-2.5 list-decimal space-y-1 pl-5 marker:text-muted-foreground", children: o }),
|
|
2821
|
+
li: ({ children: o }) => /* @__PURE__ */ t("li", { className: "pl-1", children: o }),
|
|
2822
|
+
h1: ({ children: o }) => /* @__PURE__ */ t("h1", { className: "mb-2 mt-4 text-lg font-semibold tracking-tight", children: o }),
|
|
2823
|
+
h2: ({ children: o }) => /* @__PURE__ */ t("h2", { className: "mb-2 mt-4 text-base font-semibold tracking-tight", children: o }),
|
|
2824
|
+
h3: ({ children: o }) => /* @__PURE__ */ t("h3", { className: "mb-1.5 mt-3 text-sm font-semibold tracking-tight", children: o }),
|
|
2825
|
+
blockquote: ({ children: o }) => /* @__PURE__ */ t("blockquote", { className: "my-3 rounded-r-md border-l-2 border-primary/40 bg-primary/5 py-1 pl-3 text-muted-foreground", children: o }),
|
|
2826
|
+
hr: () => /* @__PURE__ */ t("hr", { className: "my-4 border-border" }),
|
|
2827
|
+
table: ({ children: o }) => /* @__PURE__ */ t("div", { className: "my-3 overflow-x-auto rounded-lg border border-border", children: /* @__PURE__ */ t("table", { className: "w-full border-collapse text-sm", children: o }) }),
|
|
2828
|
+
thead: ({ children: o }) => /* @__PURE__ */ t("thead", { className: "bg-muted/60", children: o }),
|
|
2829
|
+
th: ({ children: o }) => /* @__PURE__ */ t("th", { className: "border-b border-border px-3 py-2 text-left font-semibold", children: o }),
|
|
2830
|
+
td: ({ children: o }) => /* @__PURE__ */ t("td", { className: "border-b border-border/60 px-3 py-2 align-top", children: o }),
|
|
2831
|
+
code: ({ className: o, children: m, ...p }) => /language-/.test(o ?? "") ? /* @__PURE__ */ t("code", { className: o, ...p, children: m }) : /* @__PURE__ */ t(
|
|
2832
|
+
"code",
|
|
2833
|
+
{
|
|
2834
|
+
className: "rounded-md border border-border/70 bg-muted/70 px-1.5 py-0.5 font-mono text-[0.85em] text-foreground",
|
|
2835
|
+
...p,
|
|
2836
|
+
children: m
|
|
2837
|
+
}
|
|
2838
|
+
),
|
|
2839
|
+
pre: ({ children: o }) => {
|
|
2840
|
+
const m = An(o);
|
|
2841
|
+
return /* @__PURE__ */ s("div", { className: "group/code my-3 overflow-hidden rounded-xl border border-border bg-[oklch(0.16_0.02_285)] shadow-sm", children: [
|
|
2842
|
+
/* @__PURE__ */ s("div", { className: "flex items-center justify-between border-b border-white/10 bg-white/[0.03] px-3 py-1.5", children: [
|
|
2843
|
+
/* @__PURE__ */ t("span", { className: "font-mono text-[11px] font-medium uppercase tracking-wide text-white/50", children: m || "code" }),
|
|
2844
|
+
c && /* @__PURE__ */ t(Cn, { getText: () => $e(o) })
|
|
2845
|
+
] }),
|
|
2846
|
+
/* @__PURE__ */ t("pre", { className: "overflow-x-auto px-4 py-3 text-[0.8125rem] leading-relaxed text-white/90 [&_code]:bg-transparent [&_code]:p-0", children: o })
|
|
2847
|
+
] });
|
|
2848
|
+
}
|
|
2849
|
+
},
|
|
2850
|
+
children: a
|
|
2851
|
+
}
|
|
2852
|
+
)
|
|
2853
|
+
}
|
|
2854
|
+
);
|
|
2855
|
+
});
|
|
2856
|
+
function An(e) {
|
|
2857
|
+
const a = Array.isArray(e) ? e[0] : e, r = a && typeof a == "object" && "props" in a && a.props?.className || "", n = /language-([\w-]+)/.exec(r);
|
|
2858
|
+
return n ? n[1] : "";
|
|
2859
|
+
}
|
|
2860
|
+
function Mn({ reasoning: e, active: a }) {
|
|
2861
|
+
const [r, n] = z(!!a);
|
|
2862
|
+
return ne(() => {
|
|
2863
|
+
n(!!a);
|
|
2864
|
+
}, [a]), e.trim() ? /* @__PURE__ */ s(At, { open: r, onOpenChange: n, className: "w-fit max-w-full", children: [
|
|
2865
|
+
/* @__PURE__ */ t(Mt, { asChild: !0, children: /* @__PURE__ */ s(
|
|
2866
|
+
N,
|
|
2867
|
+
{
|
|
2868
|
+
type: "button",
|
|
2869
|
+
variant: "ghost",
|
|
2870
|
+
size: "sm",
|
|
2871
|
+
className: "group/think h-7 gap-1.5 rounded-lg px-2 text-xs font-medium text-muted-foreground hover:bg-foreground/5 hover:text-foreground",
|
|
2872
|
+
children: [
|
|
2873
|
+
/* @__PURE__ */ t(ba, { className: d("size-3.5", a && "text-primary") }),
|
|
2874
|
+
a ? /* @__PURE__ */ t("span", { className: "shimmer", children: "Thinking…" }) : "Thought process",
|
|
2875
|
+
/* @__PURE__ */ t(xa, { className: "size-3 opacity-60 transition-transform group-data-[state=open]/think:rotate-90" })
|
|
2876
|
+
]
|
|
2877
|
+
}
|
|
2878
|
+
) }),
|
|
2879
|
+
/* @__PURE__ */ t(Rt, { children: /* @__PURE__ */ t("div", { className: "mt-1 max-h-72 overflow-y-auto whitespace-pre-wrap rounded-xl bg-muted/40 p-3 text-xs leading-relaxed text-muted-foreground scrollbar-thin", children: e.trim() }) })
|
|
2880
|
+
] }) : null;
|
|
2881
|
+
}
|
|
2882
|
+
function Rn(e) {
|
|
2883
|
+
let a = "", r = e.replace(
|
|
2884
|
+
/<think(?:ing)?>([\s\S]*?)<\/think(?:ing)?>/gi,
|
|
2885
|
+
(i, c) => (a += (a ? `
|
|
2886
|
+
` : "") + c, "")
|
|
2887
|
+
);
|
|
2888
|
+
const n = /<think(?:ing)?>/i.exec(r);
|
|
2889
|
+
return n && (a += (a ? `
|
|
2890
|
+
` : "") + r.slice(n.index + n[0].length), r = r.slice(0, n.index)), { think: a.trim(), answer: r.trim() };
|
|
2891
|
+
}
|
|
2892
|
+
const Dn = [
|
|
2893
|
+
"Explain a tricky concept simply",
|
|
2894
|
+
"Write and review a code snippet",
|
|
2895
|
+
"Brainstorm ideas with me",
|
|
2896
|
+
"Summarize a long document"
|
|
2897
|
+
];
|
|
2898
|
+
function Pn({ className: e, contentClassName: a }) {
|
|
2899
|
+
const r = se(), n = r.messages, i = n.at(-1), c = i ? `${i.id}:${i.content?.length ?? 0}` : "";
|
|
2900
|
+
return /* @__PURE__ */ t(
|
|
2901
|
+
gn,
|
|
2902
|
+
{
|
|
2903
|
+
autoScroll: !0,
|
|
2904
|
+
defaultScrollPosition: "end",
|
|
2905
|
+
contentSignal: c,
|
|
2906
|
+
children: /* @__PURE__ */ s(hn, { className: d("relative flex-1", e), children: [
|
|
2907
|
+
n.length === 0 ? /* @__PURE__ */ t(pt, { children: /* @__PURE__ */ t(In, {}) }) : /* @__PURE__ */ t(pt, { children: /* @__PURE__ */ t(bn, { className: d("mx-auto w-full max-w-3xl gap-5 px-3 py-6 sm:px-5", a), children: n.map((l, u) => /* @__PURE__ */ t(
|
|
2908
|
+
xn,
|
|
2909
|
+
{
|
|
2910
|
+
id: l.id,
|
|
2911
|
+
scrollAnchor: u === n.length - 1,
|
|
2912
|
+
children: /* @__PURE__ */ t(
|
|
2913
|
+
En,
|
|
2914
|
+
{
|
|
2915
|
+
message: l,
|
|
2916
|
+
isStreaming: r.isStreaming && u === n.length - 1
|
|
2917
|
+
}
|
|
2918
|
+
)
|
|
2919
|
+
},
|
|
2920
|
+
l.id
|
|
2921
|
+
)) }) }),
|
|
2922
|
+
/* @__PURE__ */ t(
|
|
2923
|
+
vn,
|
|
2924
|
+
{
|
|
2925
|
+
direction: "end",
|
|
2926
|
+
className: "size-9 rounded-full surface-elevated text-foreground/80 backdrop-blur",
|
|
2927
|
+
children: /* @__PURE__ */ t(va, { className: "size-4" })
|
|
2928
|
+
}
|
|
2929
|
+
)
|
|
2930
|
+
] })
|
|
2931
|
+
}
|
|
2932
|
+
);
|
|
2933
|
+
}
|
|
2934
|
+
function In() {
|
|
2935
|
+
const e = se(), a = e.config, r = a.ui ?? {}, n = r.greeting ?? "How can I help you today?", i = r.suggestions ?? Dn;
|
|
2936
|
+
return r.emptyState ? /* @__PURE__ */ t("div", { className: "flex h-full items-center justify-center p-8 text-center", children: r.emptyState }) : /* @__PURE__ */ s("div", { className: "mx-auto flex h-full w-full max-w-2xl flex-col items-center justify-center px-4 py-10 text-center", children: [
|
|
2937
|
+
/* @__PURE__ */ s("div", { className: "animate-message-in relative mb-6 grid size-16 place-items-center rounded-2xl grad-primary text-primary-foreground glow-primary-strong", children: [
|
|
2938
|
+
/* @__PURE__ */ t(ze, { className: "size-7" }),
|
|
2939
|
+
/* @__PURE__ */ t("span", { className: "ring-conic absolute -inset-px -z-10 rounded-2xl opacity-40 blur-md" })
|
|
2940
|
+
] }),
|
|
2941
|
+
/* @__PURE__ */ t("h2", { className: "text-balance text-2xl font-semibold tracking-tight sm:text-3xl", children: n }),
|
|
2942
|
+
/* @__PURE__ */ s("p", { className: "mt-2 max-w-md text-pretty text-sm text-muted-foreground", children: [
|
|
2943
|
+
"Ask anything, or start with one of these. Powered by",
|
|
2944
|
+
" ",
|
|
2945
|
+
/* @__PURE__ */ t("span", { className: "font-medium text-foreground", children: a.model.label ?? a.model.id }),
|
|
2946
|
+
"."
|
|
2947
|
+
] }),
|
|
2948
|
+
/* @__PURE__ */ t("div", { className: "mt-8 grid w-full grid-cols-1 gap-2.5 sm:grid-cols-2", children: i.map((c, l) => /* @__PURE__ */ s(
|
|
2949
|
+
N,
|
|
2950
|
+
{
|
|
2951
|
+
type: "button",
|
|
2952
|
+
variant: "outline",
|
|
2953
|
+
onClick: () => void e.send(c),
|
|
2954
|
+
style: { animationDelay: `${l * 60}ms` },
|
|
2955
|
+
className: "animate-message-in group h-auto justify-start gap-3 whitespace-normal rounded-xl border-border/70 bg-card/60 px-4 py-3 text-left text-sm font-normal transition-all hover:-translate-y-0.5 hover:border-primary/40 hover:bg-card hover:shadow-[0_8px_24px_-12px_oklch(var(--glow)/0.4)]",
|
|
2956
|
+
children: [
|
|
2957
|
+
/* @__PURE__ */ t("span", { className: "grid size-7 shrink-0 place-items-center rounded-lg bg-primary/10 text-primary transition-colors group-hover:bg-primary/15", children: /* @__PURE__ */ t(ze, { className: "size-3.5" }) }),
|
|
2958
|
+
/* @__PURE__ */ t("span", { className: "text-pretty text-foreground/90", children: c })
|
|
2959
|
+
]
|
|
2960
|
+
},
|
|
2961
|
+
c
|
|
2962
|
+
)) })
|
|
2963
|
+
] });
|
|
2964
|
+
}
|
|
2965
|
+
function En({ message: e, isStreaming: a }) {
|
|
2966
|
+
const r = se(), i = r.config.ui ?? {}, [c, l] = z(!1), u = e.status === "error", f = !u && e.role === "user" ? "end" : "start", o = !u && e.role === "user", m = $n(e.role, e.status), p = o ? Ga(e.content) : e.content, { think: w, answer: k } = o ? { think: "", answer: p } : Rn(p), y = o ? "" : [e.reasoning, w].filter(Boolean).join(`
|
|
2967
|
+
`).trim(), v = o ? p : k, b = e.status === "streaming" && v.trim().length === 0 && y.length === 0;
|
|
2968
|
+
return /* @__PURE__ */ s(an, { align: f, className: "animate-message-in", children: [
|
|
2969
|
+
!o && /* @__PURE__ */ t(rn, { className: "bg-transparent", children: /* @__PURE__ */ t(On, { role: u ? "assistant" : e.role }) }),
|
|
2970
|
+
/* @__PURE__ */ s(nn, { children: [
|
|
2971
|
+
e.attachments && e.attachments.length > 0 && /* @__PURE__ */ t(
|
|
2972
|
+
"div",
|
|
2973
|
+
{
|
|
2974
|
+
className: d(
|
|
2975
|
+
"flex flex-wrap gap-2",
|
|
2976
|
+
f === "end" && "justify-end"
|
|
2977
|
+
),
|
|
2978
|
+
children: e.attachments.map((C) => /* @__PURE__ */ t(Ht, { att: C }, C.id))
|
|
2979
|
+
}
|
|
2980
|
+
),
|
|
2981
|
+
y.length > 0 && /* @__PURE__ */ t(
|
|
2982
|
+
Mn,
|
|
2983
|
+
{
|
|
2984
|
+
reasoning: y,
|
|
2985
|
+
active: e.status === "streaming"
|
|
2986
|
+
}
|
|
2987
|
+
),
|
|
2988
|
+
c ? /* @__PURE__ */ t(
|
|
2989
|
+
jn,
|
|
2990
|
+
{
|
|
2991
|
+
initial: v,
|
|
2992
|
+
onCancel: () => l(!1),
|
|
2993
|
+
onSave: (C) => {
|
|
2994
|
+
l(!1), C.trim() && C.trim() !== v.trim() && r.editAndResend(e.id, C.trim());
|
|
2995
|
+
}
|
|
2996
|
+
}
|
|
2997
|
+
) : (v.trim().length > 0 || b) && /* @__PURE__ */ t(Zr, { variant: m, align: f, children: /* @__PURE__ */ s(
|
|
2998
|
+
en,
|
|
2999
|
+
{
|
|
3000
|
+
className: d(o ? "surface-tinted text-foreground" : "surface-elevated"),
|
|
3001
|
+
children: [
|
|
3002
|
+
b ? /* @__PURE__ */ t(Fn, {}) : /* @__PURE__ */ t(Ln, { message: e, isUser: o, text: v }),
|
|
3003
|
+
e.status === "streaming" && !b && /* @__PURE__ */ t("span", { className: "ml-0.5 inline-block h-4 w-[3px] translate-y-0.5 animate-pulse rounded-full bg-current align-text-bottom" })
|
|
3004
|
+
]
|
|
3005
|
+
}
|
|
3006
|
+
) }),
|
|
3007
|
+
e.toolCalls && e.toolCalls.length > 0 && /* @__PURE__ */ t("div", { className: "flex flex-col gap-1", children: e.toolCalls.map((C) => /* @__PURE__ */ s(Nn, { variant: "default", children: [
|
|
3008
|
+
/* @__PURE__ */ t(wn, { children: C.status === "error" ? /* @__PURE__ */ t(ae, {}) : C.status === "complete" ? /* @__PURE__ */ t(P, {}) : /* @__PURE__ */ t(Le, { className: "animate-spin" }) }),
|
|
3009
|
+
/* @__PURE__ */ s(kn, { children: [
|
|
3010
|
+
/* @__PURE__ */ t("span", { className: "font-mono", children: C.name }),
|
|
3011
|
+
C.status === "error" ? " failed" : C.status === "complete" ? "" : " …"
|
|
3012
|
+
] })
|
|
3013
|
+
] }, C.id)) }),
|
|
3014
|
+
u && /* @__PURE__ */ t("div", { className: "self-start", children: /* @__PURE__ */ t(Vn, { error: e.error, onRetry: () => void r.regenerate() }) }),
|
|
3015
|
+
!o && e.status === "complete" && /* @__PURE__ */ t(Hn, { message: e, answer: v }),
|
|
3016
|
+
!c && !b && v.trim().length > 0 && /* @__PURE__ */ t(
|
|
3017
|
+
_n,
|
|
3018
|
+
{
|
|
3019
|
+
message: e,
|
|
3020
|
+
copyText: v,
|
|
3021
|
+
align: f,
|
|
3022
|
+
isUser: o,
|
|
3023
|
+
showTimestamp: i.showTimestamps ?? !0,
|
|
3024
|
+
onEdit: o ? () => l(!0) : void 0,
|
|
3025
|
+
onDelete: () => r.deleteMessage(e.id),
|
|
3026
|
+
showActions: i.enableMessageActions ?? !0,
|
|
3027
|
+
showRegenerate: i.enableRegenerate ?? !0,
|
|
3028
|
+
showEdit: o && (i.enableEditAndResend ?? !0)
|
|
3029
|
+
}
|
|
3030
|
+
),
|
|
3031
|
+
a && !b && /* @__PURE__ */ t(Ve, { children: /* @__PURE__ */ s("span", { className: "inline-flex items-center gap-1.5 text-primary", children: [
|
|
3032
|
+
/* @__PURE__ */ t(Le, { className: "size-3 animate-spin" }),
|
|
3033
|
+
"Generating…"
|
|
3034
|
+
] }) }),
|
|
3035
|
+
e.role === "tool" && e.name && /* @__PURE__ */ t(Ve, { children: /* @__PURE__ */ s("span", { className: "inline-flex items-center gap-1", children: [
|
|
3036
|
+
/* @__PURE__ */ t(qe, { className: "size-3" }),
|
|
3037
|
+
"tool · ",
|
|
3038
|
+
/* @__PURE__ */ t("span", { className: "font-mono", children: e.name })
|
|
3039
|
+
] }) })
|
|
3040
|
+
] })
|
|
3041
|
+
] });
|
|
3042
|
+
}
|
|
3043
|
+
function _n({
|
|
3044
|
+
message: e,
|
|
3045
|
+
copyText: a,
|
|
3046
|
+
align: r,
|
|
3047
|
+
isUser: n,
|
|
3048
|
+
showTimestamp: i,
|
|
3049
|
+
onEdit: c,
|
|
3050
|
+
onDelete: l,
|
|
3051
|
+
showActions: u = !0,
|
|
3052
|
+
showRegenerate: f = !0,
|
|
3053
|
+
showEdit: o = !0
|
|
3054
|
+
}) {
|
|
3055
|
+
const m = se(), [p, w] = z(!1), k = e.role === "assistant", y = () => {
|
|
3056
|
+
try {
|
|
3057
|
+
navigator.clipboard?.writeText(a), w(!0), setTimeout(() => w(!1), 1600);
|
|
3058
|
+
} catch {
|
|
3059
|
+
}
|
|
3060
|
+
}, v = "size-7 text-muted-foreground hover:bg-foreground/10 hover:text-foreground";
|
|
3061
|
+
return u ? /* @__PURE__ */ s(
|
|
3062
|
+
Ve,
|
|
3063
|
+
{
|
|
3064
|
+
className: d(
|
|
3065
|
+
"w-fit gap-0.5 opacity-0 transition-opacity duration-150 focus-within:opacity-100 group-hover/message:opacity-100",
|
|
3066
|
+
r === "end" && "flex-row-reverse self-end"
|
|
3067
|
+
),
|
|
3068
|
+
children: [
|
|
3069
|
+
/* @__PURE__ */ t(N, { type: "button", variant: "ghost", size: "icon-sm", onClick: y, "aria-label": "Copy message", className: v, children: p ? /* @__PURE__ */ t(P, { className: "size-3.5 text-success" }) : /* @__PURE__ */ t(Me, { className: "size-3.5" }) }),
|
|
3070
|
+
k && f && /* @__PURE__ */ t(N, { type: "button", variant: "ghost", size: "icon-sm", onClick: () => void m.regenerate(), "aria-label": "Regenerate response", className: v, children: /* @__PURE__ */ t(We, { className: "size-3.5" }) }),
|
|
3071
|
+
n && c && o && /* @__PURE__ */ t(N, { type: "button", variant: "ghost", size: "icon-sm", onClick: c, "aria-label": "Edit message", className: v, children: /* @__PURE__ */ t(Ue, { className: "size-3.5" }) }),
|
|
3072
|
+
l && /* @__PURE__ */ t(N, { type: "button", variant: "ghost", size: "icon-sm", onClick: l, "aria-label": "Delete message", className: "size-7 text-muted-foreground hover:bg-foreground/10 hover:text-destructive", children: /* @__PURE__ */ t(pe, { className: "size-3.5" }) }),
|
|
3073
|
+
i && /* @__PURE__ */ t("span", { className: "px-1.5 text-[11px] tabular-nums text-muted-foreground/70", children: Un(e.createdAt) })
|
|
3074
|
+
]
|
|
3075
|
+
}
|
|
3076
|
+
) : null;
|
|
3077
|
+
}
|
|
3078
|
+
function Hn({
|
|
3079
|
+
message: e,
|
|
3080
|
+
answer: a
|
|
3081
|
+
}) {
|
|
3082
|
+
const r = e.usage?.completionTokens ?? Zt(a), n = e.startedAt && e.completedAt ? e.completedAt - e.startedAt : void 0, i = n ? n / 1e3 : void 0, c = r && i && i > 0 ? r / i : void 0;
|
|
3083
|
+
return !r && !i && !e.model ? null : /* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-3 px-3 text-[11px] text-muted-foreground/70", children: [
|
|
3084
|
+
e.model && /* @__PURE__ */ s(
|
|
3085
|
+
"span",
|
|
3086
|
+
{
|
|
3087
|
+
className: "inline-flex items-center gap-1",
|
|
3088
|
+
title: `Generated by ${e.model}`,
|
|
3089
|
+
children: [
|
|
3090
|
+
/* @__PURE__ */ t(Na, { className: "size-3" }),
|
|
3091
|
+
e.model
|
|
3092
|
+
]
|
|
3093
|
+
}
|
|
3094
|
+
),
|
|
3095
|
+
c !== void 0 && /* @__PURE__ */ s("span", { className: "inline-flex items-center gap-1", children: [
|
|
3096
|
+
/* @__PURE__ */ t(ht, { className: "size-3" }),
|
|
3097
|
+
c.toFixed(1),
|
|
3098
|
+
" tok/s"
|
|
3099
|
+
] }),
|
|
3100
|
+
r > 0 && /* @__PURE__ */ s("span", { className: "inline-flex items-center gap-1 tabular-nums", children: [
|
|
3101
|
+
/* @__PURE__ */ t(wa, { className: "size-3" }),
|
|
3102
|
+
r,
|
|
3103
|
+
" tokens"
|
|
3104
|
+
] }),
|
|
3105
|
+
i !== void 0 && /* @__PURE__ */ s("span", { className: "inline-flex items-center gap-1 tabular-nums", children: [
|
|
3106
|
+
/* @__PURE__ */ t(ka, { className: "size-3" }),
|
|
3107
|
+
i.toFixed(2),
|
|
3108
|
+
"s"
|
|
3109
|
+
] })
|
|
3110
|
+
] });
|
|
3111
|
+
}
|
|
3112
|
+
function jn({
|
|
3113
|
+
initial: e,
|
|
3114
|
+
onSave: a,
|
|
3115
|
+
onCancel: r
|
|
3116
|
+
}) {
|
|
3117
|
+
const [n, i] = z(e);
|
|
3118
|
+
return /* @__PURE__ */ s("div", { className: "w-full max-w-[80%] self-end", children: [
|
|
3119
|
+
/* @__PURE__ */ t(
|
|
3120
|
+
re,
|
|
3121
|
+
{
|
|
3122
|
+
autoFocus: !0,
|
|
3123
|
+
value: n,
|
|
3124
|
+
onChange: (c) => i(c.target.value),
|
|
3125
|
+
onKeyDown: (c) => {
|
|
3126
|
+
c.key === "Enter" && !c.shiftKey && (c.preventDefault(), a(n)), c.key === "Escape" && r();
|
|
3127
|
+
},
|
|
3128
|
+
className: "min-h-16 w-full resize-y rounded-2xl surface-tinted text-sm text-foreground"
|
|
3129
|
+
}
|
|
3130
|
+
),
|
|
3131
|
+
/* @__PURE__ */ s("div", { className: "mt-1.5 flex justify-end gap-2", children: [
|
|
3132
|
+
/* @__PURE__ */ t(N, { type: "button", variant: "ghost", size: "sm", onClick: r, children: "Cancel" }),
|
|
3133
|
+
/* @__PURE__ */ s(N, { type: "button", size: "sm", onClick: () => a(n), className: "gap-1.5", children: [
|
|
3134
|
+
/* @__PURE__ */ t(P, { className: "size-3.5" }),
|
|
3135
|
+
"Save & resend"
|
|
3136
|
+
] })
|
|
3137
|
+
] })
|
|
3138
|
+
] });
|
|
3139
|
+
}
|
|
3140
|
+
function Fn() {
|
|
3141
|
+
return /* @__PURE__ */ t(
|
|
3142
|
+
"span",
|
|
3143
|
+
{
|
|
3144
|
+
className: "flex items-center gap-1 py-1",
|
|
3145
|
+
"aria-label": "Assistant is typing",
|
|
3146
|
+
children: [0, 1, 2].map((e) => /* @__PURE__ */ t(
|
|
3147
|
+
"span",
|
|
3148
|
+
{
|
|
3149
|
+
className: "size-2 rounded-full bg-primary",
|
|
3150
|
+
style: {
|
|
3151
|
+
animation: "typing-bounce 1.2s ease-in-out infinite",
|
|
3152
|
+
animationDelay: `${e * 0.18}s`
|
|
3153
|
+
}
|
|
3154
|
+
},
|
|
3155
|
+
e
|
|
3156
|
+
))
|
|
3157
|
+
}
|
|
3158
|
+
);
|
|
3159
|
+
}
|
|
3160
|
+
function Ln({
|
|
3161
|
+
message: e,
|
|
3162
|
+
isUser: a,
|
|
3163
|
+
text: r
|
|
3164
|
+
}) {
|
|
3165
|
+
const n = Ye(), i = n?.config.ui?.typeset, c = n?.config.ui ?? {}, l = c.enableCodeHighlight ?? !0, u = c.enableCopyButtons ?? !0;
|
|
3166
|
+
return e.role === "tool" ? /* @__PURE__ */ t("pre", { className: "max-w-full overflow-x-auto whitespace-pre-wrap break-words font-mono text-xs", children: Kn(r, 1200) }) : a ? /* @__PURE__ */ t("span", { className: "whitespace-pre-wrap break-words", children: r }) : /* @__PURE__ */ t(
|
|
3167
|
+
Tn,
|
|
3168
|
+
{
|
|
3169
|
+
typeset: i,
|
|
3170
|
+
enableCodeHighlight: l,
|
|
3171
|
+
enableCopyButtons: u,
|
|
3172
|
+
children: r
|
|
3173
|
+
}
|
|
3174
|
+
);
|
|
3175
|
+
}
|
|
3176
|
+
function Bn(e) {
|
|
3177
|
+
switch (e?.code) {
|
|
3178
|
+
case "rate_limit":
|
|
3179
|
+
return {
|
|
3180
|
+
title: "You've hit the rate limit",
|
|
3181
|
+
body: "This model's plan is out of quota right now. Wait a moment and try again, or upgrade your plan for more usage.",
|
|
3182
|
+
Icon: ht
|
|
3183
|
+
};
|
|
3184
|
+
case "auth":
|
|
3185
|
+
return {
|
|
3186
|
+
title: "Couldn't authenticate",
|
|
3187
|
+
body: "The API key was rejected. Double-check that it's correct and has access to this model.",
|
|
3188
|
+
Icon: Sa
|
|
3189
|
+
};
|
|
3190
|
+
case "network":
|
|
3191
|
+
return {
|
|
3192
|
+
title: "Connection problem",
|
|
3193
|
+
body: "I couldn't reach the model. Check your internet connection and try again.",
|
|
3194
|
+
Icon: za
|
|
3195
|
+
};
|
|
3196
|
+
case "server":
|
|
3197
|
+
return {
|
|
3198
|
+
title: "The model service had a problem",
|
|
3199
|
+
body: "The provider returned an error. This is usually temporary — try again in a moment.",
|
|
3200
|
+
Icon: Ca
|
|
3201
|
+
};
|
|
3202
|
+
case "context_overflow":
|
|
3203
|
+
return {
|
|
3204
|
+
title: "This conversation got too long",
|
|
3205
|
+
body: "It exceeded the model's context window. Start a new chat or remove some earlier messages.",
|
|
3206
|
+
Icon: ae
|
|
3207
|
+
};
|
|
3208
|
+
case "aborted":
|
|
3209
|
+
return {
|
|
3210
|
+
title: "Generation stopped",
|
|
3211
|
+
body: "You stopped this response. Send again to retry.",
|
|
3212
|
+
Icon: ae
|
|
3213
|
+
};
|
|
3214
|
+
case "parse":
|
|
3215
|
+
return {
|
|
3216
|
+
title: "I couldn't read the reply",
|
|
3217
|
+
body: "The model's response came back malformed. Trying again usually fixes it.",
|
|
3218
|
+
Icon: ae
|
|
3219
|
+
};
|
|
3220
|
+
default:
|
|
3221
|
+
return {
|
|
3222
|
+
title: "Something went wrong",
|
|
3223
|
+
body: "An unexpected error stopped this response. Let's try again.",
|
|
3224
|
+
Icon: ae
|
|
3225
|
+
};
|
|
3226
|
+
}
|
|
3227
|
+
}
|
|
3228
|
+
function Vn({
|
|
3229
|
+
error: e,
|
|
3230
|
+
onRetry: a
|
|
3231
|
+
}) {
|
|
3232
|
+
const { title: r, body: n, Icon: i } = Bn(e), c = e?.message?.trim();
|
|
3233
|
+
return /* @__PURE__ */ t("div", { className: "w-fit max-w-[85%] rounded-3xl surface-elevated p-3 text-sm", children: /* @__PURE__ */ s("div", { className: "flex gap-2.5", children: [
|
|
3234
|
+
/* @__PURE__ */ t("span", { className: "grid size-8 shrink-0 place-items-center rounded-lg bg-destructive/10 text-destructive", children: /* @__PURE__ */ t(i, { className: "size-4" }) }),
|
|
3235
|
+
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
|
|
3236
|
+
/* @__PURE__ */ t("p", { className: "font-medium text-destructive", children: r }),
|
|
3237
|
+
/* @__PURE__ */ t("p", { className: "mt-0.5 text-pretty text-muted-foreground", children: n }),
|
|
3238
|
+
/* @__PURE__ */ s("div", { className: "mt-2.5 flex flex-wrap items-center gap-2", children: [
|
|
3239
|
+
/* @__PURE__ */ s(
|
|
3240
|
+
N,
|
|
3241
|
+
{
|
|
3242
|
+
type: "button",
|
|
3243
|
+
size: "sm",
|
|
3244
|
+
onClick: a,
|
|
3245
|
+
className: "h-8 gap-1.5 rounded-lg text-xs",
|
|
3246
|
+
children: [
|
|
3247
|
+
/* @__PURE__ */ t(We, { className: "size-3.5" }),
|
|
3248
|
+
"Try again"
|
|
3249
|
+
]
|
|
3250
|
+
}
|
|
3251
|
+
),
|
|
3252
|
+
c && /* @__PURE__ */ s(At, { className: "min-w-0", children: [
|
|
3253
|
+
/* @__PURE__ */ t(Mt, { asChild: !0, children: /* @__PURE__ */ s(
|
|
3254
|
+
N,
|
|
3255
|
+
{
|
|
3256
|
+
type: "button",
|
|
3257
|
+
variant: "ghost",
|
|
3258
|
+
size: "sm",
|
|
3259
|
+
className: "h-8 gap-1 rounded-lg px-2 text-xs font-normal text-muted-foreground hover:bg-foreground/5 hover:text-foreground",
|
|
3260
|
+
children: [
|
|
3261
|
+
/* @__PURE__ */ t(ae, { className: "size-3" }),
|
|
3262
|
+
"Technical details"
|
|
3263
|
+
]
|
|
3264
|
+
}
|
|
3265
|
+
) }),
|
|
3266
|
+
/* @__PURE__ */ t(Rt, { children: /* @__PURE__ */ s("pre", { className: "mt-2 max-h-40 max-w-full overflow-auto whitespace-pre-wrap break-all rounded-lg bg-muted/60 p-2.5 font-mono text-[11px] leading-relaxed text-muted-foreground", children: [
|
|
3267
|
+
e?.code ? `${e.code}${e.status ? ` · ${e.status}` : ""}
|
|
3268
|
+
` : "",
|
|
3269
|
+
c
|
|
3270
|
+
] }) })
|
|
3271
|
+
] })
|
|
3272
|
+
] })
|
|
3273
|
+
] })
|
|
3274
|
+
] }) });
|
|
3275
|
+
}
|
|
3276
|
+
function $n(e, a) {
|
|
3277
|
+
return a === "error" ? "destructive" : e === "user" ? "default" : e === "assistant" ? "secondary" : "muted";
|
|
3278
|
+
}
|
|
3279
|
+
function On({ role: e }) {
|
|
3280
|
+
return e === "user" ? /* @__PURE__ */ t("div", { className: "flex size-8 items-center justify-center rounded-full bg-muted text-muted-foreground ring-1 ring-border/70", children: /* @__PURE__ */ t(ya, { className: "size-4" }) }) : e === "assistant" ? /* @__PURE__ */ t("div", { className: "flex size-8 items-center justify-center rounded-full grad-primary text-primary-foreground shadow-sm glow-primary", children: /* @__PURE__ */ t(ze, { className: "size-4" }) }) : /* @__PURE__ */ t("div", { className: "flex size-8 items-center justify-center rounded-full bg-muted text-muted-foreground", children: /* @__PURE__ */ t(qe, { className: "size-4" }) });
|
|
3281
|
+
}
|
|
3282
|
+
function Un(e) {
|
|
3283
|
+
try {
|
|
3284
|
+
return new Date(e).toLocaleTimeString(void 0, {
|
|
3285
|
+
hour: "2-digit",
|
|
3286
|
+
minute: "2-digit"
|
|
3287
|
+
});
|
|
3288
|
+
} catch {
|
|
3289
|
+
return "";
|
|
3290
|
+
}
|
|
3291
|
+
}
|
|
3292
|
+
function Kn(e, a) {
|
|
3293
|
+
return e.length > a ? `${e.slice(0, a)}…` : e;
|
|
3294
|
+
}
|
|
3295
|
+
function zs(e) {
|
|
3296
|
+
const {
|
|
3297
|
+
config: a,
|
|
3298
|
+
layout: r = "panel",
|
|
3299
|
+
renderHeader: n,
|
|
3300
|
+
renderFooter: i,
|
|
3301
|
+
className: c,
|
|
3302
|
+
contentClassName: l,
|
|
3303
|
+
style: u,
|
|
3304
|
+
hideHeader: f = !1,
|
|
3305
|
+
hideComposer: o = !1
|
|
3306
|
+
} = e, m = Ye(), p = /* @__PURE__ */ t(dr, { delayDuration: 200, children: /* @__PURE__ */ t(
|
|
3307
|
+
Gn,
|
|
3308
|
+
{
|
|
3309
|
+
layout: r,
|
|
3310
|
+
className: c,
|
|
3311
|
+
style: u,
|
|
3312
|
+
renderHeader: n,
|
|
3313
|
+
renderFooter: i,
|
|
3314
|
+
contentClassName: l,
|
|
3315
|
+
hideHeader: f,
|
|
3316
|
+
hideComposer: o
|
|
3317
|
+
}
|
|
3318
|
+
) });
|
|
3319
|
+
return m ? p : /* @__PURE__ */ t(Va, { config: a, children: p });
|
|
3320
|
+
}
|
|
3321
|
+
function Gn({
|
|
3322
|
+
layout: e,
|
|
3323
|
+
className: a,
|
|
3324
|
+
style: r,
|
|
3325
|
+
renderHeader: n,
|
|
3326
|
+
renderFooter: i,
|
|
3327
|
+
contentClassName: c,
|
|
3328
|
+
hideHeader: l,
|
|
3329
|
+
hideComposer: u
|
|
3330
|
+
}) {
|
|
3331
|
+
const o = Ye()?.config.ui ?? {}, m = o.density ?? "comfortable", p = o.theme ?? "system", w = o.accentColor ?? "", k = o.fontFamily ?? "", y = e === "floating" ? "fixed bottom-5 right-5 z-40 flex w-[min(420px,calc(100vw-2.5rem))] h-[min(660px,calc(100vh-2.5rem))] flex-col overflow-hidden rounded-2xl surface-elevated app-mesh" : e === "fullpage" ? "flex h-full w-full flex-col app-mesh" : "flex h-full w-full flex-col overflow-hidden rounded-2xl surface-elevated app-mesh", v = {};
|
|
3332
|
+
return w && (v["--chat-accent"] = w), k && (v["--chat-font-family"] = k), /* @__PURE__ */ s(
|
|
3333
|
+
"div",
|
|
3334
|
+
{
|
|
3335
|
+
className: d(y, a),
|
|
3336
|
+
style: { ...r, ...v },
|
|
3337
|
+
"data-density": m,
|
|
3338
|
+
"data-theme": p,
|
|
3339
|
+
children: [
|
|
3340
|
+
n ? n() : l ? null : /* @__PURE__ */ t(Er, {}),
|
|
3341
|
+
/* @__PURE__ */ t(Pn, { contentClassName: c }),
|
|
3342
|
+
i ? i() : null,
|
|
3343
|
+
u ? null : /* @__PURE__ */ t(Qr, { contentClassName: c })
|
|
3344
|
+
]
|
|
3345
|
+
}
|
|
3346
|
+
);
|
|
3347
|
+
}
|
|
3348
|
+
export {
|
|
3349
|
+
we as $,
|
|
3350
|
+
Mr as A,
|
|
3351
|
+
Se as B,
|
|
3352
|
+
Wa as C,
|
|
3353
|
+
At as D,
|
|
3354
|
+
Rt as E,
|
|
3355
|
+
Mt as F,
|
|
3356
|
+
wt as G,
|
|
3357
|
+
gs as H,
|
|
3358
|
+
Xe as I,
|
|
3359
|
+
Je as J,
|
|
3360
|
+
be as K,
|
|
3361
|
+
he as L,
|
|
3362
|
+
Qr as M,
|
|
3363
|
+
kt as N,
|
|
3364
|
+
mr as O,
|
|
3365
|
+
xe as P,
|
|
3366
|
+
fs as Q,
|
|
3367
|
+
Ne as R,
|
|
3368
|
+
ir as S,
|
|
3369
|
+
ue as T,
|
|
3370
|
+
cs as U,
|
|
3371
|
+
q as V,
|
|
3372
|
+
ke as W,
|
|
3373
|
+
ds as X,
|
|
3374
|
+
ms as Y,
|
|
3375
|
+
me as Z,
|
|
3376
|
+
us as _,
|
|
3377
|
+
Pt as a,
|
|
3378
|
+
cn as a$,
|
|
3379
|
+
$ as a0,
|
|
3380
|
+
at as a1,
|
|
3381
|
+
Tn as a2,
|
|
3382
|
+
Nn as a3,
|
|
3383
|
+
kn as a4,
|
|
3384
|
+
wn as a5,
|
|
3385
|
+
an as a6,
|
|
3386
|
+
rn as a7,
|
|
3387
|
+
nn as a8,
|
|
3388
|
+
Ve as a9,
|
|
3389
|
+
xr as aA,
|
|
3390
|
+
ur as aB,
|
|
3391
|
+
hs as aC,
|
|
3392
|
+
wr as aD,
|
|
3393
|
+
yr as aE,
|
|
3394
|
+
Nr as aF,
|
|
3395
|
+
re as aG,
|
|
3396
|
+
Ir as aH,
|
|
3397
|
+
Y as aI,
|
|
3398
|
+
U as aJ,
|
|
3399
|
+
dr as aK,
|
|
3400
|
+
Q as aL,
|
|
3401
|
+
tr as aM,
|
|
3402
|
+
rr as aN,
|
|
3403
|
+
ls as aO,
|
|
3404
|
+
is as aP,
|
|
3405
|
+
ar as aQ,
|
|
3406
|
+
os as aR,
|
|
3407
|
+
qa as aS,
|
|
3408
|
+
pr as aT,
|
|
3409
|
+
br as aU,
|
|
3410
|
+
gr as aV,
|
|
3411
|
+
fr as aW,
|
|
3412
|
+
hr as aX,
|
|
3413
|
+
yn as aY,
|
|
3414
|
+
Cs as aZ,
|
|
3415
|
+
ln as a_,
|
|
3416
|
+
ws as aa,
|
|
3417
|
+
ks as ab,
|
|
3418
|
+
Pn as ac,
|
|
3419
|
+
hn as ad,
|
|
3420
|
+
vn as ae,
|
|
3421
|
+
bn as af,
|
|
3422
|
+
xn as ag,
|
|
3423
|
+
gn as ah,
|
|
3424
|
+
pt as ai,
|
|
3425
|
+
lr as aj,
|
|
3426
|
+
ps as ak,
|
|
3427
|
+
Nt as al,
|
|
3428
|
+
cr as am,
|
|
3429
|
+
Br as an,
|
|
3430
|
+
Mn as ao,
|
|
3431
|
+
er as ap,
|
|
3432
|
+
Ct as aq,
|
|
3433
|
+
et as ar,
|
|
3434
|
+
bs as as,
|
|
3435
|
+
tt as at,
|
|
3436
|
+
kr as au,
|
|
3437
|
+
Tt as av,
|
|
3438
|
+
St as aw,
|
|
3439
|
+
Cr as ax,
|
|
3440
|
+
Ze as ay,
|
|
3441
|
+
zt as az,
|
|
3442
|
+
qr as b,
|
|
3443
|
+
Gr as c,
|
|
3444
|
+
It as d,
|
|
3445
|
+
_t as e,
|
|
3446
|
+
vs as f,
|
|
3447
|
+
Be as g,
|
|
3448
|
+
Ht as h,
|
|
3449
|
+
Et as i,
|
|
3450
|
+
xs as j,
|
|
3451
|
+
or as k,
|
|
3452
|
+
sr as l,
|
|
3453
|
+
nr as m,
|
|
3454
|
+
Zr as n,
|
|
3455
|
+
en as o,
|
|
3456
|
+
ys as p,
|
|
3457
|
+
Ns as q,
|
|
3458
|
+
N as r,
|
|
3459
|
+
Ja as s,
|
|
3460
|
+
Xa as t,
|
|
3461
|
+
Za as u,
|
|
3462
|
+
Ya as v,
|
|
3463
|
+
Qa as w,
|
|
3464
|
+
Er as x,
|
|
3465
|
+
zs as y,
|
|
3466
|
+
Sr as z
|
|
3467
|
+
};
|
|
3468
|
+
//# sourceMappingURL=ChatPanel-Cyq7boWQ.js.map
|