teodor-new-chat-ui 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -0
- package/dist/components/chat/ChatApp.d.ts +8 -0
- package/dist/components/chat/ChatInterface.d.ts +9 -0
- package/dist/components/chat/ChatProvider.d.ts +59 -0
- package/dist/components/chat/MessageComponent.d.ts +9 -0
- package/dist/components/chat/ThreadManager.d.ts +7 -0
- package/dist/components/chat/index.d.ts +6 -0
- package/dist/components/ui/accordion.d.ts +7 -0
- package/dist/components/ui/alert-dialog.d.ts +20 -0
- package/dist/components/ui/alert.d.ts +8 -0
- package/dist/components/ui/aspect-ratio.d.ts +3 -0
- package/dist/components/ui/avatar.d.ts +6 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/breadcrumb.d.ts +19 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/calendar.d.ts +8 -0
- package/dist/components/ui/card.d.ts +8 -0
- package/dist/components/ui/carousel.d.ts +18 -0
- package/dist/components/ui/chart.d.ts +62 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/collapsible.d.ts +5 -0
- package/dist/components/ui/command.d.ts +82 -0
- package/dist/components/ui/context-menu.d.ts +27 -0
- package/dist/components/ui/dialog.d.ts +19 -0
- package/dist/components/ui/drawer.d.ts +22 -0
- package/dist/components/ui/dropdown-menu.d.ts +27 -0
- package/dist/components/ui/form.d.ts +23 -0
- package/dist/components/ui/hover-card.d.ts +6 -0
- package/dist/components/ui/input-otp.d.ts +34 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/label.d.ts +5 -0
- package/dist/components/ui/menubar.d.ts +28 -0
- package/dist/components/ui/navigation-menu.d.ts +12 -0
- package/dist/components/ui/pagination.d.ts +28 -0
- package/dist/components/ui/popover.d.ts +6 -0
- package/dist/components/ui/progress.d.ts +4 -0
- package/dist/components/ui/radio-group.d.ts +5 -0
- package/dist/components/ui/resizable.d.ts +23 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/select.d.ts +13 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/sheet.d.ts +25 -0
- package/dist/components/ui/sidebar.d.ts +66 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/slider.d.ts +4 -0
- package/dist/components/ui/sonner.d.ts +4 -0
- package/dist/components/ui/switch.d.ts +4 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/tabs.d.ts +7 -0
- package/dist/components/ui/textarea.d.ts +5 -0
- package/dist/components/ui/toast.d.ts +15 -0
- package/dist/components/ui/toaster.d.ts +1 -0
- package/dist/components/ui/toggle-group.d.ts +12 -0
- package/dist/components/ui/toggle.d.ts +12 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/use-toast.d.ts +2 -0
- package/dist/favicon.ico +0 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-toast.d.ts +44 -0
- package/dist/index.esm.js +3812 -0
- package/dist/index.umd.js +8 -0
- package/dist/lib/index.d.ts +30 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/placeholder.svg +1 -0
- package/dist/robots.txt +14 -0
- package/package.json +118 -0
|
@@ -0,0 +1,3812 @@
|
|
|
1
|
+
import { jsx as h, jsxs as L, Fragment as Ze } from "react/jsx-runtime";
|
|
2
|
+
import * as u from "react";
|
|
3
|
+
import Qn, { createContext as er, useState as ce, useCallback as z, useEffect as we, useContext as tr, useRef as St, useLayoutEffect as nr } from "react";
|
|
4
|
+
import { Check as rr, X as or, Edit2 as ir, ChevronDown as sr, ChevronRight as ar, RotateCcw as cr, Bot as Tt, Wrench as lr, User as dr, Square as ur, Send as fr, Plus as hr, Edit3 as mr, Trash2 as pr } from "lucide-react";
|
|
5
|
+
import { Slot as gr, createSlot as vr, createSlottable as wr } from "@radix-ui/react-slot";
|
|
6
|
+
import { cva as Ht } from "class-variance-authority";
|
|
7
|
+
import { clsx as br } from "clsx";
|
|
8
|
+
import { twMerge as yr } from "tailwind-merge";
|
|
9
|
+
import * as Wt from "react-dom";
|
|
10
|
+
const Bt = er(null), xr = "http://localhost:8000/api/chat";
|
|
11
|
+
function Vt({
|
|
12
|
+
children: e,
|
|
13
|
+
apiBaseUrl: t = xr,
|
|
14
|
+
enableUrlSync: n = !1
|
|
15
|
+
}) {
|
|
16
|
+
const [r, o] = ce({
|
|
17
|
+
currentThreadId: null,
|
|
18
|
+
messages: [],
|
|
19
|
+
isLoading: !1,
|
|
20
|
+
isLoadingHistory: !1,
|
|
21
|
+
error: null,
|
|
22
|
+
interrupt: null,
|
|
23
|
+
threads: [],
|
|
24
|
+
loadingThreads: !1,
|
|
25
|
+
availableBranches: [],
|
|
26
|
+
currentBranch: null
|
|
27
|
+
}), i = z(() => n ? new URLSearchParams(window.location.search).get("thread") : null, [n]), s = z((b) => {
|
|
28
|
+
if (!n) return;
|
|
29
|
+
const w = new URL(window.location.href);
|
|
30
|
+
b ? w.searchParams.set("thread", b) : w.searchParams.delete("thread"), window.history.pushState({}, "", w.toString());
|
|
31
|
+
}, [n]);
|
|
32
|
+
we(() => {
|
|
33
|
+
if (n) {
|
|
34
|
+
const b = i();
|
|
35
|
+
b && o((w) => ({ ...w, currentThreadId: b }));
|
|
36
|
+
}
|
|
37
|
+
}, [n, i]), we(() => {
|
|
38
|
+
if (!n) return;
|
|
39
|
+
const b = () => {
|
|
40
|
+
const w = i();
|
|
41
|
+
o((g) => ({ ...g, currentThreadId: w }));
|
|
42
|
+
};
|
|
43
|
+
return window.addEventListener("popstate", b), () => window.removeEventListener("popstate", b);
|
|
44
|
+
}, [n, i]);
|
|
45
|
+
const a = z(async () => {
|
|
46
|
+
o((b) => ({ ...b, loadingThreads: !0 }));
|
|
47
|
+
try {
|
|
48
|
+
const b = await fetch(`${t}/threads`);
|
|
49
|
+
if (!b.ok) throw new Error("Failed to load threads");
|
|
50
|
+
const w = await b.json();
|
|
51
|
+
o((g) => ({ ...g, threads: w, loadingThreads: !1 }));
|
|
52
|
+
} catch (b) {
|
|
53
|
+
o((w) => ({
|
|
54
|
+
...w,
|
|
55
|
+
loadingThreads: !1,
|
|
56
|
+
error: b instanceof Error ? b.message : "Failed to load threads"
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
}, [t]), c = (b) => b.map((w) => ({
|
|
60
|
+
id: w.id,
|
|
61
|
+
role: w.role === "human" ? "human" : w.role === "ai" ? "ai" : "tool",
|
|
62
|
+
content: w.content,
|
|
63
|
+
timestamp: w.timestamp,
|
|
64
|
+
name: w.name,
|
|
65
|
+
tool_call_id: w.tool_call_id,
|
|
66
|
+
args: w.args,
|
|
67
|
+
branch_id: w.branch_id,
|
|
68
|
+
sequence_number: w.sequence_number
|
|
69
|
+
})), l = z(async (b) => {
|
|
70
|
+
o((w) => ({ ...w, isLoadingHistory: !0 }));
|
|
71
|
+
try {
|
|
72
|
+
const w = await fetch(`${t}/history/${b}`);
|
|
73
|
+
if (!w.ok) throw new Error("Failed to load history");
|
|
74
|
+
const g = await w.json(), N = c(g);
|
|
75
|
+
o((D) => ({ ...D, messages: N, isLoadingHistory: !1 }));
|
|
76
|
+
} catch (w) {
|
|
77
|
+
o((g) => ({
|
|
78
|
+
...g,
|
|
79
|
+
isLoadingHistory: !1,
|
|
80
|
+
error: w instanceof Error ? w.message : "Failed to load history"
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
}, [t]), d = z(async (b) => {
|
|
84
|
+
try {
|
|
85
|
+
const w = await fetch(`${t}/threads/${b}/branches`);
|
|
86
|
+
if (!w.ok) return;
|
|
87
|
+
const g = await w.json();
|
|
88
|
+
o((N) => ({
|
|
89
|
+
...N,
|
|
90
|
+
availableBranches: g.branches || [],
|
|
91
|
+
currentBranch: g.current_branch
|
|
92
|
+
}));
|
|
93
|
+
} catch (w) {
|
|
94
|
+
console.warn("Failed to load branches:", w);
|
|
95
|
+
}
|
|
96
|
+
}, [t]), f = z((b) => {
|
|
97
|
+
o((w) => ({
|
|
98
|
+
...w,
|
|
99
|
+
currentThreadId: b,
|
|
100
|
+
messages: [],
|
|
101
|
+
availableBranches: [],
|
|
102
|
+
currentBranch: null,
|
|
103
|
+
error: null
|
|
104
|
+
})), s(b), b && Promise.all([
|
|
105
|
+
l(b),
|
|
106
|
+
d(b)
|
|
107
|
+
]).catch((w) => {
|
|
108
|
+
console.error("Failed to load thread data:", w);
|
|
109
|
+
});
|
|
110
|
+
}, [s, l, d]), m = z(async () => {
|
|
111
|
+
try {
|
|
112
|
+
const b = await fetch(`${t}/threads`, {
|
|
113
|
+
method: "POST",
|
|
114
|
+
headers: { "Content-Type": "application/json" }
|
|
115
|
+
});
|
|
116
|
+
if (!b.ok) throw new Error("Failed to create thread");
|
|
117
|
+
const g = (await b.json()).thread_id;
|
|
118
|
+
return await a(), g;
|
|
119
|
+
} catch (b) {
|
|
120
|
+
throw o((w) => ({
|
|
121
|
+
...w,
|
|
122
|
+
error: b instanceof Error ? b.message : "Failed to create thread"
|
|
123
|
+
})), b;
|
|
124
|
+
}
|
|
125
|
+
}, [t]), p = z(async (b) => {
|
|
126
|
+
console.log("deleteThread called with threadId:", b), console.log("apiBaseUrl:", t);
|
|
127
|
+
try {
|
|
128
|
+
const w = `${t}/threads/${b}`;
|
|
129
|
+
console.log("Making DELETE request to:", w);
|
|
130
|
+
const g = await fetch(w, {
|
|
131
|
+
method: "DELETE"
|
|
132
|
+
});
|
|
133
|
+
if (console.log("Delete response status:", g.status), console.log("Delete response ok:", g.ok), !g.ok) {
|
|
134
|
+
const N = await g.text();
|
|
135
|
+
throw console.log("Delete error response:", N), new Error(`Failed to delete thread: ${g.status} ${N}`);
|
|
136
|
+
}
|
|
137
|
+
console.log("Thread deleted successfully"), r.currentThreadId === b && (console.log("Clearing current thread as it was deleted"), f(null)), console.log("Reloading threads list"), await a();
|
|
138
|
+
} catch (w) {
|
|
139
|
+
console.error("Error deleting thread:", w), o((g) => ({
|
|
140
|
+
...g,
|
|
141
|
+
error: w instanceof Error ? w.message : "Failed to delete thread"
|
|
142
|
+
}));
|
|
143
|
+
}
|
|
144
|
+
}, [t, r.currentThreadId, f, a]), v = z(async (b, w) => {
|
|
145
|
+
try {
|
|
146
|
+
if (!(await fetch(`${t}/threads/${b}/title`, {
|
|
147
|
+
method: "PATCH",
|
|
148
|
+
headers: { "Content-Type": "application/json" },
|
|
149
|
+
body: JSON.stringify({ title: w })
|
|
150
|
+
})).ok) throw new Error("Failed to update thread title");
|
|
151
|
+
await a();
|
|
152
|
+
} catch (g) {
|
|
153
|
+
o((N) => ({
|
|
154
|
+
...N,
|
|
155
|
+
error: g instanceof Error ? g.message : "Failed to update thread title"
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
}, [t, a]), y = z(async (b) => {
|
|
159
|
+
if (!r.currentThreadId) return;
|
|
160
|
+
const w = {
|
|
161
|
+
id: `temp-${Date.now()}`,
|
|
162
|
+
role: "human",
|
|
163
|
+
content: b,
|
|
164
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
165
|
+
};
|
|
166
|
+
o((g) => ({
|
|
167
|
+
...g,
|
|
168
|
+
messages: [...g.messages, w],
|
|
169
|
+
isLoading: !0,
|
|
170
|
+
error: null
|
|
171
|
+
}));
|
|
172
|
+
try {
|
|
173
|
+
const g = await fetch(`${t}/stream`, {
|
|
174
|
+
method: "POST",
|
|
175
|
+
headers: { "Content-Type": "application/json" },
|
|
176
|
+
body: JSON.stringify({
|
|
177
|
+
thread_id: r.currentThreadId,
|
|
178
|
+
messages: [...r.messages, { role: "human", content: b }],
|
|
179
|
+
operation: "continue"
|
|
180
|
+
})
|
|
181
|
+
});
|
|
182
|
+
if (!g.ok) {
|
|
183
|
+
const N = await g.text();
|
|
184
|
+
throw new Error(`HTTP ${g.status}: ${N}`);
|
|
185
|
+
}
|
|
186
|
+
await x(g), await l(r.currentThreadId);
|
|
187
|
+
} catch (g) {
|
|
188
|
+
o((N) => ({
|
|
189
|
+
...N,
|
|
190
|
+
messages: N.messages.filter((D) => D.id !== w.id),
|
|
191
|
+
isLoading: !1,
|
|
192
|
+
error: g instanceof Error ? g.message : "Failed to send message"
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
}, [t, r.currentThreadId, r.messages, l]), x = async (b) => {
|
|
196
|
+
var D;
|
|
197
|
+
const w = (D = b.body) == null ? void 0 : D.getReader();
|
|
198
|
+
if (!w) {
|
|
199
|
+
o((k) => ({ ...k, isLoading: !1 }));
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const g = new TextDecoder();
|
|
203
|
+
let N = "";
|
|
204
|
+
try {
|
|
205
|
+
for (; ; ) {
|
|
206
|
+
const { done: k, value: I } = await w.read();
|
|
207
|
+
if (k) break;
|
|
208
|
+
N += g.decode(I, { stream: !0 });
|
|
209
|
+
const F = N.split(`
|
|
210
|
+
`);
|
|
211
|
+
N = F.pop() || "";
|
|
212
|
+
for (const M of F)
|
|
213
|
+
if (M.trim() && M.startsWith("data: "))
|
|
214
|
+
try {
|
|
215
|
+
const _ = JSON.parse(M.slice(6));
|
|
216
|
+
_.type === "text" ? o((O) => {
|
|
217
|
+
const $ = [...O.messages], W = $[$.length - 1];
|
|
218
|
+
return W && W.role === "ai" ? W.content += _.text : $.push({
|
|
219
|
+
id: `ai-${Date.now()}`,
|
|
220
|
+
role: "ai",
|
|
221
|
+
content: _.text,
|
|
222
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
223
|
+
}), { ...O, messages: $ };
|
|
224
|
+
}) : _.type === "tool_call" && o((O) => ({
|
|
225
|
+
...O,
|
|
226
|
+
messages: [...O.messages, {
|
|
227
|
+
id: `tool-${Date.now()}`,
|
|
228
|
+
role: "tool",
|
|
229
|
+
content: _.result || "",
|
|
230
|
+
name: _.name || "unknown_function",
|
|
231
|
+
tool_call_id: _.id,
|
|
232
|
+
args: _.args,
|
|
233
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
234
|
+
}]
|
|
235
|
+
}));
|
|
236
|
+
} catch (_) {
|
|
237
|
+
console.warn("Failed to parse streaming data:", M, _);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
} catch (k) {
|
|
241
|
+
console.error("Streaming error:", k);
|
|
242
|
+
} finally {
|
|
243
|
+
o((k) => ({ ...k, isLoading: !1 }));
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
we(() => {
|
|
247
|
+
a();
|
|
248
|
+
}, [a]);
|
|
249
|
+
const S = z(async (b, w) => {
|
|
250
|
+
if (!(!r.currentThreadId || !b.id)) {
|
|
251
|
+
o((g) => ({ ...g, isLoading: !0, error: null }));
|
|
252
|
+
try {
|
|
253
|
+
const g = w ? "edit_and_regenerate" : "regenerate", N = await fetch(`${t}/stream`, {
|
|
254
|
+
method: "POST",
|
|
255
|
+
headers: { "Content-Type": "application/json" },
|
|
256
|
+
body: JSON.stringify({
|
|
257
|
+
thread_id: r.currentThreadId,
|
|
258
|
+
messages: r.messages,
|
|
259
|
+
operation: g,
|
|
260
|
+
from_message_id: b.id,
|
|
261
|
+
edited_content: w,
|
|
262
|
+
create_branch: !0
|
|
263
|
+
})
|
|
264
|
+
});
|
|
265
|
+
if (!N.ok) {
|
|
266
|
+
const D = await N.text();
|
|
267
|
+
throw new Error(`HTTP ${N.status}: ${D}`);
|
|
268
|
+
}
|
|
269
|
+
await x(N), await Promise.all([
|
|
270
|
+
l(r.currentThreadId),
|
|
271
|
+
d(r.currentThreadId)
|
|
272
|
+
]);
|
|
273
|
+
} catch (g) {
|
|
274
|
+
o((N) => ({
|
|
275
|
+
...N,
|
|
276
|
+
isLoading: !1,
|
|
277
|
+
error: g instanceof Error ? g.message : "Failed to regenerate message"
|
|
278
|
+
}));
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}, [t, r.currentThreadId, r.messages, l, d]), E = z(async (b, w, g = !1) => {
|
|
282
|
+
if (!(!r.currentThreadId || !b.id)) {
|
|
283
|
+
if (g) {
|
|
284
|
+
await S(b, w);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
o((N) => ({
|
|
288
|
+
...N,
|
|
289
|
+
messages: N.messages.map(
|
|
290
|
+
(D) => D.id === b.id ? { ...D, content: w } : D
|
|
291
|
+
)
|
|
292
|
+
}));
|
|
293
|
+
}
|
|
294
|
+
}, [r.currentThreadId, S]), R = z(async (b) => {
|
|
295
|
+
if (r.currentThreadId)
|
|
296
|
+
try {
|
|
297
|
+
if (!(await fetch(`${t}/threads/${r.currentThreadId}/branch`, {
|
|
298
|
+
method: "PATCH",
|
|
299
|
+
headers: { "Content-Type": "application/json" },
|
|
300
|
+
body: JSON.stringify({ branch_id: b })
|
|
301
|
+
})).ok) throw new Error("Failed to switch branch");
|
|
302
|
+
o((g) => ({ ...g, currentBranch: b })), await l(r.currentThreadId);
|
|
303
|
+
} catch (w) {
|
|
304
|
+
o((g) => ({
|
|
305
|
+
...g,
|
|
306
|
+
error: w instanceof Error ? w.message : "Failed to switch branch"
|
|
307
|
+
}));
|
|
308
|
+
}
|
|
309
|
+
}, [t, r.currentThreadId, l]), C = z(() => {
|
|
310
|
+
o((b) => ({ ...b, isLoading: !1 }));
|
|
311
|
+
}, []), T = z(() => {
|
|
312
|
+
o((b) => ({ ...b, error: null }));
|
|
313
|
+
}, []), A = z(async () => {
|
|
314
|
+
await a(), r.currentThreadId && await Promise.all([
|
|
315
|
+
l(r.currentThreadId),
|
|
316
|
+
d(r.currentThreadId)
|
|
317
|
+
]);
|
|
318
|
+
}, [a, l, d, r.currentThreadId]), P = {
|
|
319
|
+
...r,
|
|
320
|
+
selectThread: f,
|
|
321
|
+
createThread: m,
|
|
322
|
+
deleteThread: p,
|
|
323
|
+
updateThreadTitle: v,
|
|
324
|
+
sendMessage: y,
|
|
325
|
+
editMessage: E,
|
|
326
|
+
regenerateFromMessage: S,
|
|
327
|
+
stop: C,
|
|
328
|
+
switchBranch: R,
|
|
329
|
+
clearError: T,
|
|
330
|
+
refresh: A
|
|
331
|
+
};
|
|
332
|
+
return /* @__PURE__ */ h(Bt.Provider, { value: P, children: e });
|
|
333
|
+
}
|
|
334
|
+
function Qe() {
|
|
335
|
+
const e = tr(Bt);
|
|
336
|
+
if (!e)
|
|
337
|
+
throw new Error("useChat must be used within a ChatProvider");
|
|
338
|
+
return e;
|
|
339
|
+
}
|
|
340
|
+
function V(...e) {
|
|
341
|
+
return yr(br(e));
|
|
342
|
+
}
|
|
343
|
+
const Cr = Ht(
|
|
344
|
+
"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",
|
|
345
|
+
{
|
|
346
|
+
variants: {
|
|
347
|
+
variant: {
|
|
348
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
349
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
350
|
+
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
351
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
352
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
353
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
354
|
+
},
|
|
355
|
+
size: {
|
|
356
|
+
default: "h-10 px-4 py-2",
|
|
357
|
+
sm: "h-9 rounded-md px-3",
|
|
358
|
+
lg: "h-11 rounded-md px-8",
|
|
359
|
+
icon: "h-10 w-10"
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
defaultVariants: {
|
|
363
|
+
variant: "default",
|
|
364
|
+
size: "default"
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
), B = u.forwardRef(
|
|
368
|
+
({ className: e, variant: t, size: n, asChild: r = !1, ...o }, i) => /* @__PURE__ */ h(
|
|
369
|
+
r ? gr : "button",
|
|
370
|
+
{
|
|
371
|
+
className: V(Cr({ variant: t, size: n, className: e })),
|
|
372
|
+
ref: i,
|
|
373
|
+
...o
|
|
374
|
+
}
|
|
375
|
+
)
|
|
376
|
+
);
|
|
377
|
+
B.displayName = "Button";
|
|
378
|
+
const et = u.forwardRef(
|
|
379
|
+
({ className: e, ...t }, n) => /* @__PURE__ */ h(
|
|
380
|
+
"textarea",
|
|
381
|
+
{
|
|
382
|
+
className: V(
|
|
383
|
+
"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",
|
|
384
|
+
e
|
|
385
|
+
),
|
|
386
|
+
ref: n,
|
|
387
|
+
...t
|
|
388
|
+
}
|
|
389
|
+
)
|
|
390
|
+
);
|
|
391
|
+
et.displayName = "Textarea";
|
|
392
|
+
function jt({
|
|
393
|
+
message: e,
|
|
394
|
+
onRegenerate: t,
|
|
395
|
+
onEditMessage: n,
|
|
396
|
+
showRegenerate: r = !1
|
|
397
|
+
}) {
|
|
398
|
+
const [o, i] = ce(!1), [s, a] = ce(!1), [c, l] = ce(
|
|
399
|
+
typeof e.content == "string" ? e.content : JSON.stringify(e.content)
|
|
400
|
+
), d = () => {
|
|
401
|
+
t && t(e);
|
|
402
|
+
}, f = () => {
|
|
403
|
+
const x = typeof e.content == "string" ? e.content : JSON.stringify(e.content);
|
|
404
|
+
c.trim() && c !== x && n && n(e, c.trim(), !0), a(!1);
|
|
405
|
+
}, m = () => {
|
|
406
|
+
const x = typeof e.content == "string" ? e.content : JSON.stringify(e.content);
|
|
407
|
+
l(x), a(!1);
|
|
408
|
+
}, p = () => {
|
|
409
|
+
switch (e.role) {
|
|
410
|
+
case "human":
|
|
411
|
+
return /* @__PURE__ */ h(dr, { size: 20, className: "text-blue-600" });
|
|
412
|
+
case "ai":
|
|
413
|
+
return /* @__PURE__ */ h(Tt, { size: 20, className: "text-green-600" });
|
|
414
|
+
case "tool":
|
|
415
|
+
return /* @__PURE__ */ h(lr, { size: 20, className: "text-orange-600" });
|
|
416
|
+
default:
|
|
417
|
+
return /* @__PURE__ */ h(Tt, { size: 20, className: "text-gray-600" });
|
|
418
|
+
}
|
|
419
|
+
}, v = () => {
|
|
420
|
+
switch (e.role) {
|
|
421
|
+
case "human":
|
|
422
|
+
return "You";
|
|
423
|
+
case "ai":
|
|
424
|
+
return "Assistant";
|
|
425
|
+
case "tool":
|
|
426
|
+
return e.name || "Tool";
|
|
427
|
+
default:
|
|
428
|
+
return "Message";
|
|
429
|
+
}
|
|
430
|
+
}, y = () => typeof e.content == "string" ? e.content : e.role === "tool" && e.args ? JSON.stringify(e.args, null, 2) : JSON.stringify(e.content, null, 2);
|
|
431
|
+
return console.log("Rendering message:", e), e.role === "human" ? /* @__PURE__ */ L("div", { className: "flex gap-3 justify-end mb-4", children: [
|
|
432
|
+
/* @__PURE__ */ L(
|
|
433
|
+
"div",
|
|
434
|
+
{
|
|
435
|
+
className: "max-w-[80%] rounded-lg p-4 relative group",
|
|
436
|
+
style: {
|
|
437
|
+
backgroundColor: "#2563eb",
|
|
438
|
+
color: "white",
|
|
439
|
+
border: "2px solid #1d4ed8",
|
|
440
|
+
boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1)"
|
|
441
|
+
},
|
|
442
|
+
children: [
|
|
443
|
+
n && e.id && /* @__PURE__ */ h("div", { className: "absolute -top-1 -right-1 flex space-x-1 opacity-0 group-hover:opacity-100 transition-opacity", children: s ? /* @__PURE__ */ L(Ze, { children: [
|
|
444
|
+
/* @__PURE__ */ h(
|
|
445
|
+
B,
|
|
446
|
+
{
|
|
447
|
+
size: "sm",
|
|
448
|
+
variant: "ghost",
|
|
449
|
+
onClick: f,
|
|
450
|
+
className: "h-6 w-6 p-0 bg-white/10 hover:bg-white/20",
|
|
451
|
+
title: "Save changes and regenerate",
|
|
452
|
+
children: /* @__PURE__ */ h(rr, { className: "h-3 w-3" })
|
|
453
|
+
}
|
|
454
|
+
),
|
|
455
|
+
/* @__PURE__ */ h(
|
|
456
|
+
B,
|
|
457
|
+
{
|
|
458
|
+
size: "sm",
|
|
459
|
+
variant: "ghost",
|
|
460
|
+
onClick: m,
|
|
461
|
+
className: "h-6 w-6 p-0 bg-white/10 hover:bg-white/20",
|
|
462
|
+
title: "Cancel editing",
|
|
463
|
+
children: /* @__PURE__ */ h(or, { className: "h-3 w-3" })
|
|
464
|
+
}
|
|
465
|
+
)
|
|
466
|
+
] }) : /* @__PURE__ */ h(
|
|
467
|
+
B,
|
|
468
|
+
{
|
|
469
|
+
size: "sm",
|
|
470
|
+
variant: "ghost",
|
|
471
|
+
onClick: () => a(!0),
|
|
472
|
+
className: "h-6 w-6 p-0 bg-white/10 hover:bg-white/20",
|
|
473
|
+
title: "Edit message and regenerate AI response",
|
|
474
|
+
children: /* @__PURE__ */ h(ir, { className: "h-3 w-3" })
|
|
475
|
+
}
|
|
476
|
+
) }),
|
|
477
|
+
/* @__PURE__ */ h("div", { className: "whitespace-pre-wrap", style: { color: "white" }, children: s ? /* @__PURE__ */ h(
|
|
478
|
+
et,
|
|
479
|
+
{
|
|
480
|
+
value: c,
|
|
481
|
+
onChange: (x) => l(x.target.value),
|
|
482
|
+
className: "w-full min-h-[60px] bg-white/10 border-white/20 text-white placeholder-white/70",
|
|
483
|
+
placeholder: "Edit your message...",
|
|
484
|
+
autoFocus: !0
|
|
485
|
+
}
|
|
486
|
+
) : /* @__PURE__ */ h("span", { style: { color: "white" }, children: e.content || "[No content]" }) }),
|
|
487
|
+
e.timestamp && !s && /* @__PURE__ */ h("div", { className: "text-xs opacity-70 mt-2", style: { color: "white" }, children: new Date(e.timestamp).toLocaleTimeString() })
|
|
488
|
+
]
|
|
489
|
+
}
|
|
490
|
+
),
|
|
491
|
+
/* @__PURE__ */ h("div", { className: "flex-shrink-0 w-8 h-8 rounded-full bg-blue-600 flex items-center justify-center", children: p() })
|
|
492
|
+
] }) : /* @__PURE__ */ L("div", { className: "flex gap-3 justify-start mb-4", children: [
|
|
493
|
+
/* @__PURE__ */ h("div", { className: "flex-shrink-0 w-8 h-8 rounded-full bg-gray-100 flex items-center justify-center", children: p() }),
|
|
494
|
+
/* @__PURE__ */ L("div", { className: `
|
|
495
|
+
max-w-[80%] rounded-lg p-3 relative group
|
|
496
|
+
${e.role === "tool" ? "bg-orange-50 border border-orange-200" : "bg-gray-100 text-gray-900"}
|
|
497
|
+
`, children: [
|
|
498
|
+
/* @__PURE__ */ L("div", { className: "flex items-center justify-between mb-2", children: [
|
|
499
|
+
/* @__PURE__ */ L("div", { className: "flex items-center gap-2", children: [
|
|
500
|
+
/* @__PURE__ */ h("div", { className: "font-medium text-sm", children: v() }),
|
|
501
|
+
e.role === "tool" && /* @__PURE__ */ L(
|
|
502
|
+
B,
|
|
503
|
+
{
|
|
504
|
+
variant: "ghost",
|
|
505
|
+
size: "sm",
|
|
506
|
+
onClick: () => i(!o),
|
|
507
|
+
className: "h-6 px-2 text-xs",
|
|
508
|
+
children: [
|
|
509
|
+
o ? /* @__PURE__ */ h(sr, { size: 12 }) : /* @__PURE__ */ h(ar, { size: 12 }),
|
|
510
|
+
o ? "Hide" : "Show",
|
|
511
|
+
" Content"
|
|
512
|
+
]
|
|
513
|
+
}
|
|
514
|
+
)
|
|
515
|
+
] }),
|
|
516
|
+
r && t && /* @__PURE__ */ L(
|
|
517
|
+
B,
|
|
518
|
+
{
|
|
519
|
+
variant: "ghost",
|
|
520
|
+
size: "sm",
|
|
521
|
+
onClick: d,
|
|
522
|
+
className: "h-6 px-2 text-xs",
|
|
523
|
+
children: [
|
|
524
|
+
/* @__PURE__ */ h(cr, { size: 12, className: "mr-1" }),
|
|
525
|
+
"Regenerate"
|
|
526
|
+
]
|
|
527
|
+
}
|
|
528
|
+
)
|
|
529
|
+
] }),
|
|
530
|
+
(e.role !== "tool" || o) && /* @__PURE__ */ h("div", { className: `whitespace-pre-wrap ${e.role === "tool" ? "font-mono text-sm" : ""}`, children: y() }),
|
|
531
|
+
e.timestamp && /* @__PURE__ */ h("div", { className: "text-xs opacity-70 mt-2", children: new Date(e.timestamp).toLocaleTimeString() })
|
|
532
|
+
] })
|
|
533
|
+
] });
|
|
534
|
+
}
|
|
535
|
+
function ke({
|
|
536
|
+
className: e = "",
|
|
537
|
+
placeholder: t = "Type your message...",
|
|
538
|
+
autoFocus: n = !0,
|
|
539
|
+
showBranches: r = !0,
|
|
540
|
+
maxHeight: o = "600px"
|
|
541
|
+
}) {
|
|
542
|
+
const {
|
|
543
|
+
currentThreadId: i,
|
|
544
|
+
messages: s,
|
|
545
|
+
isLoading: a,
|
|
546
|
+
isLoadingHistory: c,
|
|
547
|
+
error: l,
|
|
548
|
+
availableBranches: d,
|
|
549
|
+
currentBranch: f,
|
|
550
|
+
sendMessage: m,
|
|
551
|
+
stop: p,
|
|
552
|
+
switchBranch: v,
|
|
553
|
+
regenerateFromMessage: y,
|
|
554
|
+
editMessage: x,
|
|
555
|
+
clearError: S
|
|
556
|
+
} = Qe(), [E, R] = ce(""), C = St(null), T = St(null);
|
|
557
|
+
we(() => {
|
|
558
|
+
var g;
|
|
559
|
+
(g = C.current) == null || g.scrollIntoView({ behavior: "smooth" });
|
|
560
|
+
}, [s]), we(() => {
|
|
561
|
+
n && T.current && T.current.focus();
|
|
562
|
+
}, [n, i]);
|
|
563
|
+
const A = async (g) => {
|
|
564
|
+
if (g.preventDefault(), !E.trim() || a || !i) return;
|
|
565
|
+
const N = E.trim();
|
|
566
|
+
R(""), await m(N);
|
|
567
|
+
}, P = (g) => {
|
|
568
|
+
g.key === "Enter" && !g.shiftKey && (g.preventDefault(), A(g));
|
|
569
|
+
}, b = async (g) => {
|
|
570
|
+
await y(g);
|
|
571
|
+
}, w = async (g, N, D = !1) => {
|
|
572
|
+
await x(g, N, D);
|
|
573
|
+
};
|
|
574
|
+
return i ? /* @__PURE__ */ L("div", { className: `flex flex-col h-full ${e}`, children: [
|
|
575
|
+
l && /* @__PURE__ */ h("div", { className: "bg-red-50 border-l-4 border-red-400 p-4 mb-4", children: /* @__PURE__ */ L("div", { className: "flex justify-between items-center", children: [
|
|
576
|
+
/* @__PURE__ */ h("div", { className: "text-red-700 text-sm", children: l }),
|
|
577
|
+
/* @__PURE__ */ h(
|
|
578
|
+
B,
|
|
579
|
+
{
|
|
580
|
+
variant: "ghost",
|
|
581
|
+
size: "sm",
|
|
582
|
+
onClick: S,
|
|
583
|
+
className: "text-red-600 hover:text-red-700",
|
|
584
|
+
children: "×"
|
|
585
|
+
}
|
|
586
|
+
)
|
|
587
|
+
] }) }),
|
|
588
|
+
r && d.length > 1 && /* @__PURE__ */ L("div", { className: "border-b p-3 bg-gray-50", children: [
|
|
589
|
+
/* @__PURE__ */ h("div", { className: "text-sm font-medium mb-2", children: "Branches:" }),
|
|
590
|
+
/* @__PURE__ */ h("div", { className: "flex gap-2 flex-wrap", children: d.map((g) => /* @__PURE__ */ L(
|
|
591
|
+
B,
|
|
592
|
+
{
|
|
593
|
+
size: "sm",
|
|
594
|
+
variant: f === g.branch_id ? "default" : "outline",
|
|
595
|
+
onClick: () => v(g.branch_id),
|
|
596
|
+
className: "text-xs",
|
|
597
|
+
children: [
|
|
598
|
+
g.preview,
|
|
599
|
+
/* @__PURE__ */ L("span", { className: "ml-1 text-gray-500", children: [
|
|
600
|
+
"(",
|
|
601
|
+
g.message_count,
|
|
602
|
+
")"
|
|
603
|
+
] })
|
|
604
|
+
]
|
|
605
|
+
},
|
|
606
|
+
g.branch_id
|
|
607
|
+
)) })
|
|
608
|
+
] }),
|
|
609
|
+
/* @__PURE__ */ L(
|
|
610
|
+
"div",
|
|
611
|
+
{
|
|
612
|
+
className: "flex-1 overflow-y-auto p-4",
|
|
613
|
+
style: { maxHeight: o },
|
|
614
|
+
children: [
|
|
615
|
+
c ? /* @__PURE__ */ L("div", { className: "flex items-center justify-center py-8", children: [
|
|
616
|
+
/* @__PURE__ */ h("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600" }),
|
|
617
|
+
/* @__PURE__ */ h("span", { className: "ml-2 text-gray-600", children: "Loading conversation..." })
|
|
618
|
+
] }) : s.length === 0 ? /* @__PURE__ */ L("div", { className: "text-center text-gray-500 py-8", children: [
|
|
619
|
+
/* @__PURE__ */ h("div", { className: "text-lg font-medium mb-2", children: "Start a conversation" }),
|
|
620
|
+
/* @__PURE__ */ h("div", { className: "text-sm", children: "Type a message below to begin" })
|
|
621
|
+
] }) : /* @__PURE__ */ h("div", { className: "space-y-4", children: s.map((g, N) => /* @__PURE__ */ L("div", { children: [
|
|
622
|
+
/* @__PURE__ */ h(
|
|
623
|
+
jt,
|
|
624
|
+
{
|
|
625
|
+
message: g,
|
|
626
|
+
onRegenerate: b,
|
|
627
|
+
onEditMessage: w,
|
|
628
|
+
showRegenerate: g.role === "ai" || g.role === "human"
|
|
629
|
+
}
|
|
630
|
+
),
|
|
631
|
+
g.role === "human" && g.branch_id && /* @__PURE__ */ L("div", { className: "text-xs text-gray-500 ml-12 mt-1", children: [
|
|
632
|
+
"Branch: ",
|
|
633
|
+
g.branch_id.slice(0, 8),
|
|
634
|
+
"..."
|
|
635
|
+
] })
|
|
636
|
+
] }, g.id || N)) }),
|
|
637
|
+
/* @__PURE__ */ h("div", { ref: C })
|
|
638
|
+
]
|
|
639
|
+
}
|
|
640
|
+
),
|
|
641
|
+
/* @__PURE__ */ h("div", { className: "border-t p-4 bg-white", children: /* @__PURE__ */ L("form", { onSubmit: A, className: "flex gap-3", children: [
|
|
642
|
+
/* @__PURE__ */ h("div", { className: "flex-1", children: /* @__PURE__ */ h(
|
|
643
|
+
et,
|
|
644
|
+
{
|
|
645
|
+
ref: T,
|
|
646
|
+
value: E,
|
|
647
|
+
onChange: (g) => R(g.target.value),
|
|
648
|
+
onKeyDown: P,
|
|
649
|
+
placeholder: t,
|
|
650
|
+
className: "resize-none min-h-[44px] max-h-32",
|
|
651
|
+
disabled: a
|
|
652
|
+
}
|
|
653
|
+
) }),
|
|
654
|
+
/* @__PURE__ */ h("div", { className: "flex flex-col gap-2", children: a ? /* @__PURE__ */ h(
|
|
655
|
+
B,
|
|
656
|
+
{
|
|
657
|
+
type: "button",
|
|
658
|
+
onClick: p,
|
|
659
|
+
size: "icon",
|
|
660
|
+
variant: "outline",
|
|
661
|
+
className: "shrink-0",
|
|
662
|
+
children: /* @__PURE__ */ h(ur, { size: 16 })
|
|
663
|
+
}
|
|
664
|
+
) : /* @__PURE__ */ h(
|
|
665
|
+
B,
|
|
666
|
+
{
|
|
667
|
+
type: "submit",
|
|
668
|
+
disabled: !E.trim() || !i,
|
|
669
|
+
size: "icon",
|
|
670
|
+
className: "shrink-0",
|
|
671
|
+
children: /* @__PURE__ */ h(fr, { size: 16 })
|
|
672
|
+
}
|
|
673
|
+
) })
|
|
674
|
+
] }) })
|
|
675
|
+
] }) : /* @__PURE__ */ h("div", { className: `flex items-center justify-center h-full ${e}`, children: /* @__PURE__ */ L("div", { className: "text-center text-gray-500", children: [
|
|
676
|
+
/* @__PURE__ */ h("div", { className: "text-lg font-medium mb-2", children: "No thread selected" }),
|
|
677
|
+
/* @__PURE__ */ h("div", { className: "text-sm", children: "Select a thread or create a new one to start chatting" })
|
|
678
|
+
] }) });
|
|
679
|
+
}
|
|
680
|
+
function Me({
|
|
681
|
+
className: e = "",
|
|
682
|
+
showCreateButton: t = !0,
|
|
683
|
+
onThreadSelect: n
|
|
684
|
+
}) {
|
|
685
|
+
const {
|
|
686
|
+
currentThreadId: r,
|
|
687
|
+
threads: o,
|
|
688
|
+
loadingThreads: i,
|
|
689
|
+
selectThread: s,
|
|
690
|
+
createThread: a,
|
|
691
|
+
deleteThread: c,
|
|
692
|
+
updateThreadTitle: l
|
|
693
|
+
} = Qe();
|
|
694
|
+
console.log("ThreadManager rendered, deleteThread available:", typeof c);
|
|
695
|
+
const [d, f] = ce(null), [m, p] = ce(""), v = async (C) => {
|
|
696
|
+
await s(C), n == null || n(C);
|
|
697
|
+
}, y = async () => {
|
|
698
|
+
const C = await a();
|
|
699
|
+
await v(C);
|
|
700
|
+
}, x = async (C, T) => {
|
|
701
|
+
console.log("handleDeleteThread called with threadId:", T), C.stopPropagation();
|
|
702
|
+
const A = confirm("Are you sure you want to delete this thread?");
|
|
703
|
+
if (console.log("User confirmed deletion:", A), A) {
|
|
704
|
+
console.log("Calling deleteThread from ChatProvider...");
|
|
705
|
+
try {
|
|
706
|
+
await c(T), console.log("deleteThread completed successfully");
|
|
707
|
+
} catch (P) {
|
|
708
|
+
console.error("Error in handleDeleteThread:", P);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
}, S = (C, T) => {
|
|
712
|
+
C.stopPropagation(), f(T.id), p(T.title || `Thread ${T.id.slice(0, 8)}`);
|
|
713
|
+
}, E = async (C) => {
|
|
714
|
+
await l(C, m), f(null);
|
|
715
|
+
}, R = () => {
|
|
716
|
+
f(null), p("");
|
|
717
|
+
};
|
|
718
|
+
return i ? /* @__PURE__ */ h("div", { className: `p-4 ${e}`, children: /* @__PURE__ */ h("div", { className: "animate-pulse space-y-2", children: [...Array(3)].map((C, T) => /* @__PURE__ */ h("div", { className: "h-10 bg-gray-200 rounded" }, T)) }) }) : /* @__PURE__ */ L("div", { className: `p-4 ${e}`, children: [
|
|
719
|
+
t && /* @__PURE__ */ L(
|
|
720
|
+
B,
|
|
721
|
+
{
|
|
722
|
+
onClick: y,
|
|
723
|
+
className: "w-full mb-4 flex items-center gap-2",
|
|
724
|
+
variant: "outline",
|
|
725
|
+
children: [
|
|
726
|
+
/* @__PURE__ */ h(hr, { size: 16 }),
|
|
727
|
+
"New Thread"
|
|
728
|
+
]
|
|
729
|
+
}
|
|
730
|
+
),
|
|
731
|
+
/* @__PURE__ */ L("div", { className: "space-y-2", children: [
|
|
732
|
+
o.map((C) => /* @__PURE__ */ h(
|
|
733
|
+
"div",
|
|
734
|
+
{
|
|
735
|
+
className: `
|
|
736
|
+
group p-3 rounded-lg cursor-pointer transition-colors
|
|
737
|
+
${r === C.id ? "bg-blue-100 border-blue-300 border" : "bg-gray-50 hover:bg-gray-100 border border-transparent"}
|
|
738
|
+
`,
|
|
739
|
+
onClick: () => v(C.id),
|
|
740
|
+
children: /* @__PURE__ */ h("div", { className: "flex items-center justify-between", children: d === C.id ? /* @__PURE__ */ L("div", { className: "flex-1 flex gap-2", children: [
|
|
741
|
+
/* @__PURE__ */ h(
|
|
742
|
+
"input",
|
|
743
|
+
{
|
|
744
|
+
value: m,
|
|
745
|
+
onChange: (T) => p(T.target.value),
|
|
746
|
+
onKeyDown: (T) => {
|
|
747
|
+
T.key === "Enter" && E(C.id), T.key === "Escape" && R();
|
|
748
|
+
},
|
|
749
|
+
className: "flex-1 px-2 py-1 text-sm border rounded",
|
|
750
|
+
autoFocus: !0
|
|
751
|
+
}
|
|
752
|
+
),
|
|
753
|
+
/* @__PURE__ */ h(
|
|
754
|
+
B,
|
|
755
|
+
{
|
|
756
|
+
size: "sm",
|
|
757
|
+
onClick: (T) => {
|
|
758
|
+
T.stopPropagation(), E(C.id);
|
|
759
|
+
},
|
|
760
|
+
children: "Save"
|
|
761
|
+
}
|
|
762
|
+
)
|
|
763
|
+
] }) : /* @__PURE__ */ L(Ze, { children: [
|
|
764
|
+
/* @__PURE__ */ L("div", { className: "flex-1 min-w-0", children: [
|
|
765
|
+
/* @__PURE__ */ h("div", { className: "font-medium text-sm truncate", children: C.title || `Thread ${C.id.slice(0, 8)}` }),
|
|
766
|
+
/* @__PURE__ */ h("div", { className: "text-xs text-gray-500", children: new Date(C.updated_at).toLocaleDateString() })
|
|
767
|
+
] }),
|
|
768
|
+
/* @__PURE__ */ L("div", { className: "flex gap-1 opacity-100 transition-opacity", children: [
|
|
769
|
+
/* @__PURE__ */ h(
|
|
770
|
+
B,
|
|
771
|
+
{
|
|
772
|
+
size: "sm",
|
|
773
|
+
variant: "ghost",
|
|
774
|
+
onClick: (T) => S(T, C),
|
|
775
|
+
className: "p-1 h-auto",
|
|
776
|
+
children: /* @__PURE__ */ h(mr, { size: 12 })
|
|
777
|
+
}
|
|
778
|
+
),
|
|
779
|
+
/* @__PURE__ */ h(
|
|
780
|
+
B,
|
|
781
|
+
{
|
|
782
|
+
size: "sm",
|
|
783
|
+
variant: "ghost",
|
|
784
|
+
onClick: (T) => {
|
|
785
|
+
console.log("Delete button clicked!"), x(T, C.id);
|
|
786
|
+
},
|
|
787
|
+
className: "p-1 h-auto text-red-600 hover:text-red-700",
|
|
788
|
+
style: { backgroundColor: "rgba(255, 0, 0, 0.1)" },
|
|
789
|
+
children: /* @__PURE__ */ h(pr, { size: 12 })
|
|
790
|
+
}
|
|
791
|
+
)
|
|
792
|
+
] })
|
|
793
|
+
] }) })
|
|
794
|
+
},
|
|
795
|
+
C.id
|
|
796
|
+
)),
|
|
797
|
+
o.length === 0 && /* @__PURE__ */ h("div", { className: "text-center text-gray-500 py-8", children: "No threads yet. Create your first thread to get started!" })
|
|
798
|
+
] })
|
|
799
|
+
] });
|
|
800
|
+
}
|
|
801
|
+
function Sr({
|
|
802
|
+
apiBaseUrl: e,
|
|
803
|
+
enableUrlSync: t = !0,
|
|
804
|
+
layout: n = "sidebar",
|
|
805
|
+
className: r = ""
|
|
806
|
+
}) {
|
|
807
|
+
return /* @__PURE__ */ h(Vt, { apiBaseUrl: e, enableUrlSync: t, children: /* @__PURE__ */ L("div", { className: `h-full ${r}`, children: [
|
|
808
|
+
n === "sidebar" && /* @__PURE__ */ h(Tr, {}),
|
|
809
|
+
n === "tabs" && /* @__PURE__ */ h(Er, {}),
|
|
810
|
+
n === "split" && /* @__PURE__ */ h(Pr, {})
|
|
811
|
+
] }) });
|
|
812
|
+
}
|
|
813
|
+
function Tr() {
|
|
814
|
+
return /* @__PURE__ */ L("div", { className: "flex h-full", children: [
|
|
815
|
+
/* @__PURE__ */ h("div", { className: "w-80 border-r bg-gray-50", children: /* @__PURE__ */ h(Me, {}) }),
|
|
816
|
+
/* @__PURE__ */ h("div", { className: "flex-1", children: /* @__PURE__ */ h(ke, {}) })
|
|
817
|
+
] });
|
|
818
|
+
}
|
|
819
|
+
function Er() {
|
|
820
|
+
const [e, t] = Qn.useState("chat");
|
|
821
|
+
return /* @__PURE__ */ L("div", { className: "flex flex-col h-full", children: [
|
|
822
|
+
/* @__PURE__ */ h("div", { className: "border-b", children: /* @__PURE__ */ L("div", { className: "flex", children: [
|
|
823
|
+
/* @__PURE__ */ h(
|
|
824
|
+
"button",
|
|
825
|
+
{
|
|
826
|
+
onClick: () => t("chat"),
|
|
827
|
+
className: `px-4 py-2 font-medium ${e === "chat" ? "border-b-2 border-blue-500 text-blue-600" : "text-gray-500 hover:text-gray-700"}`,
|
|
828
|
+
children: "Chat"
|
|
829
|
+
}
|
|
830
|
+
),
|
|
831
|
+
/* @__PURE__ */ h(
|
|
832
|
+
"button",
|
|
833
|
+
{
|
|
834
|
+
onClick: () => t("threads"),
|
|
835
|
+
className: `px-4 py-2 font-medium ${e === "threads" ? "border-b-2 border-blue-500 text-blue-600" : "text-gray-500 hover:text-gray-700"}`,
|
|
836
|
+
children: "Threads"
|
|
837
|
+
}
|
|
838
|
+
)
|
|
839
|
+
] }) }),
|
|
840
|
+
/* @__PURE__ */ L("div", { className: "flex-1", children: [
|
|
841
|
+
e === "chat" && /* @__PURE__ */ h(ke, {}),
|
|
842
|
+
e === "threads" && /* @__PURE__ */ h(Me, { onThreadSelect: () => t("chat") })
|
|
843
|
+
] })
|
|
844
|
+
] });
|
|
845
|
+
}
|
|
846
|
+
function Pr() {
|
|
847
|
+
return /* @__PURE__ */ L("div", { className: "flex flex-col h-full", children: [
|
|
848
|
+
/* @__PURE__ */ h("div", { className: "h-1/3 border-b", children: /* @__PURE__ */ h(Me, {}) }),
|
|
849
|
+
/* @__PURE__ */ h("div", { className: "flex-1", children: /* @__PURE__ */ h(ke, {}) })
|
|
850
|
+
] });
|
|
851
|
+
}
|
|
852
|
+
const Rr = u.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ h(
|
|
853
|
+
"div",
|
|
854
|
+
{
|
|
855
|
+
ref: n,
|
|
856
|
+
className: V(
|
|
857
|
+
"rounded-lg border bg-card text-card-foreground shadow-sm",
|
|
858
|
+
e
|
|
859
|
+
),
|
|
860
|
+
...t
|
|
861
|
+
}
|
|
862
|
+
));
|
|
863
|
+
Rr.displayName = "Card";
|
|
864
|
+
const Nr = u.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ h(
|
|
865
|
+
"div",
|
|
866
|
+
{
|
|
867
|
+
ref: n,
|
|
868
|
+
className: V("flex flex-col space-y-1.5 p-6", e),
|
|
869
|
+
...t
|
|
870
|
+
}
|
|
871
|
+
));
|
|
872
|
+
Nr.displayName = "CardHeader";
|
|
873
|
+
const Ar = u.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ h(
|
|
874
|
+
"h3",
|
|
875
|
+
{
|
|
876
|
+
ref: n,
|
|
877
|
+
className: V(
|
|
878
|
+
"text-2xl font-semibold leading-none tracking-tight",
|
|
879
|
+
e
|
|
880
|
+
),
|
|
881
|
+
...t
|
|
882
|
+
}
|
|
883
|
+
));
|
|
884
|
+
Ar.displayName = "CardTitle";
|
|
885
|
+
const Or = u.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ h(
|
|
886
|
+
"p",
|
|
887
|
+
{
|
|
888
|
+
ref: n,
|
|
889
|
+
className: V("text-sm text-muted-foreground", e),
|
|
890
|
+
...t
|
|
891
|
+
}
|
|
892
|
+
));
|
|
893
|
+
Or.displayName = "CardDescription";
|
|
894
|
+
const Lr = u.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ h("div", { ref: n, className: V("p-6 pt-0", e), ...t }));
|
|
895
|
+
Lr.displayName = "CardContent";
|
|
896
|
+
const Dr = u.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ h(
|
|
897
|
+
"div",
|
|
898
|
+
{
|
|
899
|
+
ref: n,
|
|
900
|
+
className: V("flex items-center p-6 pt-0", e),
|
|
901
|
+
...t
|
|
902
|
+
}
|
|
903
|
+
));
|
|
904
|
+
Dr.displayName = "CardFooter";
|
|
905
|
+
const _r = u.forwardRef(
|
|
906
|
+
({ className: e, type: t, ...n }, r) => /* @__PURE__ */ h(
|
|
907
|
+
"input",
|
|
908
|
+
{
|
|
909
|
+
type: t,
|
|
910
|
+
className: V(
|
|
911
|
+
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground 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 md:text-sm",
|
|
912
|
+
e
|
|
913
|
+
),
|
|
914
|
+
ref: r,
|
|
915
|
+
...n
|
|
916
|
+
}
|
|
917
|
+
)
|
|
918
|
+
);
|
|
919
|
+
_r.displayName = "Input";
|
|
920
|
+
var kr = [
|
|
921
|
+
"a",
|
|
922
|
+
"button",
|
|
923
|
+
"div",
|
|
924
|
+
"form",
|
|
925
|
+
"h2",
|
|
926
|
+
"h3",
|
|
927
|
+
"img",
|
|
928
|
+
"input",
|
|
929
|
+
"label",
|
|
930
|
+
"li",
|
|
931
|
+
"nav",
|
|
932
|
+
"ol",
|
|
933
|
+
"p",
|
|
934
|
+
"select",
|
|
935
|
+
"span",
|
|
936
|
+
"svg",
|
|
937
|
+
"ul"
|
|
938
|
+
], j = kr.reduce((e, t) => {
|
|
939
|
+
const n = vr(`Primitive.${t}`), r = u.forwardRef((o, i) => {
|
|
940
|
+
const { asChild: s, ...a } = o, c = s ? n : t;
|
|
941
|
+
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ h(c, { ...a, ref: i });
|
|
942
|
+
});
|
|
943
|
+
return r.displayName = `Primitive.${t}`, { ...e, [t]: r };
|
|
944
|
+
}, {});
|
|
945
|
+
function Mr(e, t) {
|
|
946
|
+
e && Wt.flushSync(() => e.dispatchEvent(t));
|
|
947
|
+
}
|
|
948
|
+
var Ir = "Label", Yt = u.forwardRef((e, t) => /* @__PURE__ */ h(
|
|
949
|
+
j.label,
|
|
950
|
+
{
|
|
951
|
+
...e,
|
|
952
|
+
ref: t,
|
|
953
|
+
onMouseDown: (n) => {
|
|
954
|
+
var o;
|
|
955
|
+
n.target.closest("button, input, select, textarea") || ((o = e.onMouseDown) == null || o.call(e, n), !n.defaultPrevented && n.detail > 1 && n.preventDefault());
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
));
|
|
959
|
+
Yt.displayName = Ir;
|
|
960
|
+
var Xt = Yt;
|
|
961
|
+
const $r = Ht(
|
|
962
|
+
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
963
|
+
), Fr = u.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ h(
|
|
964
|
+
Xt,
|
|
965
|
+
{
|
|
966
|
+
ref: n,
|
|
967
|
+
className: V($r(), e),
|
|
968
|
+
...t
|
|
969
|
+
}
|
|
970
|
+
));
|
|
971
|
+
Fr.displayName = Xt.displayName;
|
|
972
|
+
var zr = "Separator", Et = "horizontal", Hr = ["horizontal", "vertical"], Ut = u.forwardRef((e, t) => {
|
|
973
|
+
const { decorative: n, orientation: r = Et, ...o } = e, i = Wr(r) ? r : Et, a = n ? { role: "none" } : { "aria-orientation": i === "vertical" ? i : void 0, role: "separator" };
|
|
974
|
+
return /* @__PURE__ */ h(
|
|
975
|
+
j.div,
|
|
976
|
+
{
|
|
977
|
+
"data-orientation": i,
|
|
978
|
+
...a,
|
|
979
|
+
...o,
|
|
980
|
+
ref: t
|
|
981
|
+
}
|
|
982
|
+
);
|
|
983
|
+
});
|
|
984
|
+
Ut.displayName = zr;
|
|
985
|
+
function Wr(e) {
|
|
986
|
+
return Hr.includes(e);
|
|
987
|
+
}
|
|
988
|
+
var qt = Ut;
|
|
989
|
+
const Br = u.forwardRef(
|
|
990
|
+
({ className: e, orientation: t = "horizontal", decorative: n = !0, ...r }, o) => /* @__PURE__ */ h(
|
|
991
|
+
qt,
|
|
992
|
+
{
|
|
993
|
+
ref: o,
|
|
994
|
+
decorative: n,
|
|
995
|
+
orientation: t,
|
|
996
|
+
className: V(
|
|
997
|
+
"shrink-0 bg-border",
|
|
998
|
+
t === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
999
|
+
e
|
|
1000
|
+
),
|
|
1001
|
+
...r
|
|
1002
|
+
}
|
|
1003
|
+
)
|
|
1004
|
+
);
|
|
1005
|
+
Br.displayName = qt.displayName;
|
|
1006
|
+
function Pt(e, t) {
|
|
1007
|
+
if (typeof e == "function")
|
|
1008
|
+
return e(t);
|
|
1009
|
+
e != null && (e.current = t);
|
|
1010
|
+
}
|
|
1011
|
+
function Vr(...e) {
|
|
1012
|
+
return (t) => {
|
|
1013
|
+
let n = !1;
|
|
1014
|
+
const r = e.map((o) => {
|
|
1015
|
+
const i = Pt(o, t);
|
|
1016
|
+
return !n && typeof i == "function" && (n = !0), i;
|
|
1017
|
+
});
|
|
1018
|
+
if (n)
|
|
1019
|
+
return () => {
|
|
1020
|
+
for (let o = 0; o < r.length; o++) {
|
|
1021
|
+
const i = r[o];
|
|
1022
|
+
typeof i == "function" ? i() : Pt(e[o], null);
|
|
1023
|
+
}
|
|
1024
|
+
};
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
1027
|
+
function U(...e) {
|
|
1028
|
+
return u.useCallback(Vr(...e), e);
|
|
1029
|
+
}
|
|
1030
|
+
var ie = globalThis != null && globalThis.document ? u.useLayoutEffect : () => {
|
|
1031
|
+
};
|
|
1032
|
+
function jr(e, t) {
|
|
1033
|
+
return u.useReducer((n, r) => t[n][r] ?? n, e);
|
|
1034
|
+
}
|
|
1035
|
+
var me = (e) => {
|
|
1036
|
+
const { present: t, children: n } = e, r = Yr(t), o = typeof n == "function" ? n({ present: r.isPresent }) : u.Children.only(n), i = U(r.ref, Xr(o));
|
|
1037
|
+
return typeof n == "function" || r.isPresent ? u.cloneElement(o, { ref: i }) : null;
|
|
1038
|
+
};
|
|
1039
|
+
me.displayName = "Presence";
|
|
1040
|
+
function Yr(e) {
|
|
1041
|
+
const [t, n] = u.useState(), r = u.useRef(null), o = u.useRef(e), i = u.useRef("none"), s = e ? "mounted" : "unmounted", [a, c] = jr(s, {
|
|
1042
|
+
mounted: {
|
|
1043
|
+
UNMOUNT: "unmounted",
|
|
1044
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
1045
|
+
},
|
|
1046
|
+
unmountSuspended: {
|
|
1047
|
+
MOUNT: "mounted",
|
|
1048
|
+
ANIMATION_END: "unmounted"
|
|
1049
|
+
},
|
|
1050
|
+
unmounted: {
|
|
1051
|
+
MOUNT: "mounted"
|
|
1052
|
+
}
|
|
1053
|
+
});
|
|
1054
|
+
return u.useEffect(() => {
|
|
1055
|
+
const l = Ee(r.current);
|
|
1056
|
+
i.current = a === "mounted" ? l : "none";
|
|
1057
|
+
}, [a]), ie(() => {
|
|
1058
|
+
const l = r.current, d = o.current;
|
|
1059
|
+
if (d !== e) {
|
|
1060
|
+
const m = i.current, p = Ee(l);
|
|
1061
|
+
e ? c("MOUNT") : p === "none" || (l == null ? void 0 : l.display) === "none" ? c("UNMOUNT") : c(d && m !== p ? "ANIMATION_OUT" : "UNMOUNT"), o.current = e;
|
|
1062
|
+
}
|
|
1063
|
+
}, [e, c]), ie(() => {
|
|
1064
|
+
if (t) {
|
|
1065
|
+
let l;
|
|
1066
|
+
const d = t.ownerDocument.defaultView ?? window, f = (p) => {
|
|
1067
|
+
const y = Ee(r.current).includes(p.animationName);
|
|
1068
|
+
if (p.target === t && y && (c("ANIMATION_END"), !o.current)) {
|
|
1069
|
+
const x = t.style.animationFillMode;
|
|
1070
|
+
t.style.animationFillMode = "forwards", l = d.setTimeout(() => {
|
|
1071
|
+
t.style.animationFillMode === "forwards" && (t.style.animationFillMode = x);
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
}, m = (p) => {
|
|
1075
|
+
p.target === t && (i.current = Ee(r.current));
|
|
1076
|
+
};
|
|
1077
|
+
return t.addEventListener("animationstart", m), t.addEventListener("animationcancel", f), t.addEventListener("animationend", f), () => {
|
|
1078
|
+
d.clearTimeout(l), t.removeEventListener("animationstart", m), t.removeEventListener("animationcancel", f), t.removeEventListener("animationend", f);
|
|
1079
|
+
};
|
|
1080
|
+
} else
|
|
1081
|
+
c("ANIMATION_END");
|
|
1082
|
+
}, [t, c]), {
|
|
1083
|
+
isPresent: ["mounted", "unmountSuspended"].includes(a),
|
|
1084
|
+
ref: u.useCallback((l) => {
|
|
1085
|
+
r.current = l ? getComputedStyle(l) : null, n(l);
|
|
1086
|
+
}, [])
|
|
1087
|
+
};
|
|
1088
|
+
}
|
|
1089
|
+
function Ee(e) {
|
|
1090
|
+
return (e == null ? void 0 : e.animationName) || "none";
|
|
1091
|
+
}
|
|
1092
|
+
function Xr(e) {
|
|
1093
|
+
var r, o;
|
|
1094
|
+
let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning;
|
|
1095
|
+
return n ? e.ref : (t = (o = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
|
|
1096
|
+
}
|
|
1097
|
+
function tt(e, t = []) {
|
|
1098
|
+
let n = [];
|
|
1099
|
+
function r(i, s) {
|
|
1100
|
+
const a = u.createContext(s), c = n.length;
|
|
1101
|
+
n = [...n, s];
|
|
1102
|
+
const l = (f) => {
|
|
1103
|
+
var S;
|
|
1104
|
+
const { scope: m, children: p, ...v } = f, y = ((S = m == null ? void 0 : m[e]) == null ? void 0 : S[c]) || a, x = u.useMemo(() => v, Object.values(v));
|
|
1105
|
+
return /* @__PURE__ */ h(y.Provider, { value: x, children: p });
|
|
1106
|
+
};
|
|
1107
|
+
l.displayName = i + "Provider";
|
|
1108
|
+
function d(f, m) {
|
|
1109
|
+
var y;
|
|
1110
|
+
const p = ((y = m == null ? void 0 : m[e]) == null ? void 0 : y[c]) || a, v = u.useContext(p);
|
|
1111
|
+
if (v) return v;
|
|
1112
|
+
if (s !== void 0) return s;
|
|
1113
|
+
throw new Error(`\`${f}\` must be used within \`${i}\``);
|
|
1114
|
+
}
|
|
1115
|
+
return [l, d];
|
|
1116
|
+
}
|
|
1117
|
+
const o = () => {
|
|
1118
|
+
const i = n.map((s) => u.createContext(s));
|
|
1119
|
+
return function(a) {
|
|
1120
|
+
const c = (a == null ? void 0 : a[e]) || i;
|
|
1121
|
+
return u.useMemo(
|
|
1122
|
+
() => ({ [`__scope${e}`]: { ...a, [e]: c } }),
|
|
1123
|
+
[a, c]
|
|
1124
|
+
);
|
|
1125
|
+
};
|
|
1126
|
+
};
|
|
1127
|
+
return o.scopeName = e, [r, Ur(o, ...t)];
|
|
1128
|
+
}
|
|
1129
|
+
function Ur(...e) {
|
|
1130
|
+
const t = e[0];
|
|
1131
|
+
if (e.length === 1) return t;
|
|
1132
|
+
const n = () => {
|
|
1133
|
+
const r = e.map((o) => ({
|
|
1134
|
+
useScope: o(),
|
|
1135
|
+
scopeName: o.scopeName
|
|
1136
|
+
}));
|
|
1137
|
+
return function(i) {
|
|
1138
|
+
const s = r.reduce((a, { useScope: c, scopeName: l }) => {
|
|
1139
|
+
const f = c(i)[`__scope${l}`];
|
|
1140
|
+
return { ...a, ...f };
|
|
1141
|
+
}, {});
|
|
1142
|
+
return u.useMemo(() => ({ [`__scope${t.scopeName}`]: s }), [s]);
|
|
1143
|
+
};
|
|
1144
|
+
};
|
|
1145
|
+
return n.scopeName = t.scopeName, n;
|
|
1146
|
+
}
|
|
1147
|
+
function J(e) {
|
|
1148
|
+
const t = u.useRef(e);
|
|
1149
|
+
return u.useEffect(() => {
|
|
1150
|
+
t.current = e;
|
|
1151
|
+
}), u.useMemo(() => (...n) => {
|
|
1152
|
+
var r;
|
|
1153
|
+
return (r = t.current) == null ? void 0 : r.call(t, ...n);
|
|
1154
|
+
}, []);
|
|
1155
|
+
}
|
|
1156
|
+
var qr = u.createContext(void 0);
|
|
1157
|
+
function Jr(e) {
|
|
1158
|
+
const t = u.useContext(qr);
|
|
1159
|
+
return e || t || "ltr";
|
|
1160
|
+
}
|
|
1161
|
+
function Gr(e, [t, n]) {
|
|
1162
|
+
return Math.min(n, Math.max(t, e));
|
|
1163
|
+
}
|
|
1164
|
+
function H(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
|
|
1165
|
+
return function(o) {
|
|
1166
|
+
if (e == null || e(o), n === !1 || !o.defaultPrevented)
|
|
1167
|
+
return t == null ? void 0 : t(o);
|
|
1168
|
+
};
|
|
1169
|
+
}
|
|
1170
|
+
function Kr(e, t) {
|
|
1171
|
+
return u.useReducer((n, r) => t[n][r] ?? n, e);
|
|
1172
|
+
}
|
|
1173
|
+
var nt = "ScrollArea", [Jt, Ps] = tt(nt), [Zr, q] = Jt(nt), Gt = u.forwardRef(
|
|
1174
|
+
(e, t) => {
|
|
1175
|
+
const {
|
|
1176
|
+
__scopeScrollArea: n,
|
|
1177
|
+
type: r = "hover",
|
|
1178
|
+
dir: o,
|
|
1179
|
+
scrollHideDelay: i = 600,
|
|
1180
|
+
...s
|
|
1181
|
+
} = e, [a, c] = u.useState(null), [l, d] = u.useState(null), [f, m] = u.useState(null), [p, v] = u.useState(null), [y, x] = u.useState(null), [S, E] = u.useState(0), [R, C] = u.useState(0), [T, A] = u.useState(!1), [P, b] = u.useState(!1), w = U(t, (N) => c(N)), g = Jr(o);
|
|
1182
|
+
return /* @__PURE__ */ h(
|
|
1183
|
+
Zr,
|
|
1184
|
+
{
|
|
1185
|
+
scope: n,
|
|
1186
|
+
type: r,
|
|
1187
|
+
dir: g,
|
|
1188
|
+
scrollHideDelay: i,
|
|
1189
|
+
scrollArea: a,
|
|
1190
|
+
viewport: l,
|
|
1191
|
+
onViewportChange: d,
|
|
1192
|
+
content: f,
|
|
1193
|
+
onContentChange: m,
|
|
1194
|
+
scrollbarX: p,
|
|
1195
|
+
onScrollbarXChange: v,
|
|
1196
|
+
scrollbarXEnabled: T,
|
|
1197
|
+
onScrollbarXEnabledChange: A,
|
|
1198
|
+
scrollbarY: y,
|
|
1199
|
+
onScrollbarYChange: x,
|
|
1200
|
+
scrollbarYEnabled: P,
|
|
1201
|
+
onScrollbarYEnabledChange: b,
|
|
1202
|
+
onCornerWidthChange: E,
|
|
1203
|
+
onCornerHeightChange: C,
|
|
1204
|
+
children: /* @__PURE__ */ h(
|
|
1205
|
+
j.div,
|
|
1206
|
+
{
|
|
1207
|
+
dir: g,
|
|
1208
|
+
...s,
|
|
1209
|
+
ref: w,
|
|
1210
|
+
style: {
|
|
1211
|
+
position: "relative",
|
|
1212
|
+
// Pass corner sizes as CSS vars to reduce re-renders of context consumers
|
|
1213
|
+
"--radix-scroll-area-corner-width": S + "px",
|
|
1214
|
+
"--radix-scroll-area-corner-height": R + "px",
|
|
1215
|
+
...e.style
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
)
|
|
1219
|
+
}
|
|
1220
|
+
);
|
|
1221
|
+
}
|
|
1222
|
+
);
|
|
1223
|
+
Gt.displayName = nt;
|
|
1224
|
+
var Kt = "ScrollAreaViewport", Zt = u.forwardRef(
|
|
1225
|
+
(e, t) => {
|
|
1226
|
+
const { __scopeScrollArea: n, children: r, nonce: o, ...i } = e, s = q(Kt, n), a = u.useRef(null), c = U(t, a, s.onViewportChange);
|
|
1227
|
+
return /* @__PURE__ */ L(Ze, { children: [
|
|
1228
|
+
/* @__PURE__ */ h(
|
|
1229
|
+
"style",
|
|
1230
|
+
{
|
|
1231
|
+
dangerouslySetInnerHTML: {
|
|
1232
|
+
__html: "[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"
|
|
1233
|
+
},
|
|
1234
|
+
nonce: o
|
|
1235
|
+
}
|
|
1236
|
+
),
|
|
1237
|
+
/* @__PURE__ */ h(
|
|
1238
|
+
j.div,
|
|
1239
|
+
{
|
|
1240
|
+
"data-radix-scroll-area-viewport": "",
|
|
1241
|
+
...i,
|
|
1242
|
+
ref: c,
|
|
1243
|
+
style: {
|
|
1244
|
+
/**
|
|
1245
|
+
* We don't support `visible` because the intention is to have at least one scrollbar
|
|
1246
|
+
* if this component is used and `visible` will behave like `auto` in that case
|
|
1247
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/overflow#description
|
|
1248
|
+
*
|
|
1249
|
+
* We don't handle `auto` because the intention is for the native implementation
|
|
1250
|
+
* to be hidden if using this component. We just want to ensure the node is scrollable
|
|
1251
|
+
* so could have used either `scroll` or `auto` here. We picked `scroll` to prevent
|
|
1252
|
+
* the browser from having to work out whether to render native scrollbars or not,
|
|
1253
|
+
* we tell it to with the intention of hiding them in CSS.
|
|
1254
|
+
*/
|
|
1255
|
+
overflowX: s.scrollbarXEnabled ? "scroll" : "hidden",
|
|
1256
|
+
overflowY: s.scrollbarYEnabled ? "scroll" : "hidden",
|
|
1257
|
+
...e.style
|
|
1258
|
+
},
|
|
1259
|
+
children: /* @__PURE__ */ h("div", { ref: s.onContentChange, style: { minWidth: "100%", display: "table" }, children: r })
|
|
1260
|
+
}
|
|
1261
|
+
)
|
|
1262
|
+
] });
|
|
1263
|
+
}
|
|
1264
|
+
);
|
|
1265
|
+
Zt.displayName = Kt;
|
|
1266
|
+
var te = "ScrollAreaScrollbar", rt = u.forwardRef(
|
|
1267
|
+
(e, t) => {
|
|
1268
|
+
const { forceMount: n, ...r } = e, o = q(te, e.__scopeScrollArea), { onScrollbarXEnabledChange: i, onScrollbarYEnabledChange: s } = o, a = e.orientation === "horizontal";
|
|
1269
|
+
return u.useEffect(() => (a ? i(!0) : s(!0), () => {
|
|
1270
|
+
a ? i(!1) : s(!1);
|
|
1271
|
+
}), [a, i, s]), o.type === "hover" ? /* @__PURE__ */ h(Qr, { ...r, ref: t, forceMount: n }) : o.type === "scroll" ? /* @__PURE__ */ h(eo, { ...r, ref: t, forceMount: n }) : o.type === "auto" ? /* @__PURE__ */ h(Qt, { ...r, ref: t, forceMount: n }) : o.type === "always" ? /* @__PURE__ */ h(ot, { ...r, ref: t }) : null;
|
|
1272
|
+
}
|
|
1273
|
+
);
|
|
1274
|
+
rt.displayName = te;
|
|
1275
|
+
var Qr = u.forwardRef((e, t) => {
|
|
1276
|
+
const { forceMount: n, ...r } = e, o = q(te, e.__scopeScrollArea), [i, s] = u.useState(!1);
|
|
1277
|
+
return u.useEffect(() => {
|
|
1278
|
+
const a = o.scrollArea;
|
|
1279
|
+
let c = 0;
|
|
1280
|
+
if (a) {
|
|
1281
|
+
const l = () => {
|
|
1282
|
+
window.clearTimeout(c), s(!0);
|
|
1283
|
+
}, d = () => {
|
|
1284
|
+
c = window.setTimeout(() => s(!1), o.scrollHideDelay);
|
|
1285
|
+
};
|
|
1286
|
+
return a.addEventListener("pointerenter", l), a.addEventListener("pointerleave", d), () => {
|
|
1287
|
+
window.clearTimeout(c), a.removeEventListener("pointerenter", l), a.removeEventListener("pointerleave", d);
|
|
1288
|
+
};
|
|
1289
|
+
}
|
|
1290
|
+
}, [o.scrollArea, o.scrollHideDelay]), /* @__PURE__ */ h(me, { present: n || i, children: /* @__PURE__ */ h(
|
|
1291
|
+
Qt,
|
|
1292
|
+
{
|
|
1293
|
+
"data-state": i ? "visible" : "hidden",
|
|
1294
|
+
...r,
|
|
1295
|
+
ref: t
|
|
1296
|
+
}
|
|
1297
|
+
) });
|
|
1298
|
+
}), eo = u.forwardRef((e, t) => {
|
|
1299
|
+
const { forceMount: n, ...r } = e, o = q(te, e.__scopeScrollArea), i = e.orientation === "horizontal", s = $e(() => c("SCROLL_END"), 100), [a, c] = Kr("hidden", {
|
|
1300
|
+
hidden: {
|
|
1301
|
+
SCROLL: "scrolling"
|
|
1302
|
+
},
|
|
1303
|
+
scrolling: {
|
|
1304
|
+
SCROLL_END: "idle",
|
|
1305
|
+
POINTER_ENTER: "interacting"
|
|
1306
|
+
},
|
|
1307
|
+
interacting: {
|
|
1308
|
+
SCROLL: "interacting",
|
|
1309
|
+
POINTER_LEAVE: "idle"
|
|
1310
|
+
},
|
|
1311
|
+
idle: {
|
|
1312
|
+
HIDE: "hidden",
|
|
1313
|
+
SCROLL: "scrolling",
|
|
1314
|
+
POINTER_ENTER: "interacting"
|
|
1315
|
+
}
|
|
1316
|
+
});
|
|
1317
|
+
return u.useEffect(() => {
|
|
1318
|
+
if (a === "idle") {
|
|
1319
|
+
const l = window.setTimeout(() => c("HIDE"), o.scrollHideDelay);
|
|
1320
|
+
return () => window.clearTimeout(l);
|
|
1321
|
+
}
|
|
1322
|
+
}, [a, o.scrollHideDelay, c]), u.useEffect(() => {
|
|
1323
|
+
const l = o.viewport, d = i ? "scrollLeft" : "scrollTop";
|
|
1324
|
+
if (l) {
|
|
1325
|
+
let f = l[d];
|
|
1326
|
+
const m = () => {
|
|
1327
|
+
const p = l[d];
|
|
1328
|
+
f !== p && (c("SCROLL"), s()), f = p;
|
|
1329
|
+
};
|
|
1330
|
+
return l.addEventListener("scroll", m), () => l.removeEventListener("scroll", m);
|
|
1331
|
+
}
|
|
1332
|
+
}, [o.viewport, i, c, s]), /* @__PURE__ */ h(me, { present: n || a !== "hidden", children: /* @__PURE__ */ h(
|
|
1333
|
+
ot,
|
|
1334
|
+
{
|
|
1335
|
+
"data-state": a === "hidden" ? "hidden" : "visible",
|
|
1336
|
+
...r,
|
|
1337
|
+
ref: t,
|
|
1338
|
+
onPointerEnter: H(e.onPointerEnter, () => c("POINTER_ENTER")),
|
|
1339
|
+
onPointerLeave: H(e.onPointerLeave, () => c("POINTER_LEAVE"))
|
|
1340
|
+
}
|
|
1341
|
+
) });
|
|
1342
|
+
}), Qt = u.forwardRef((e, t) => {
|
|
1343
|
+
const n = q(te, e.__scopeScrollArea), { forceMount: r, ...o } = e, [i, s] = u.useState(!1), a = e.orientation === "horizontal", c = $e(() => {
|
|
1344
|
+
if (n.viewport) {
|
|
1345
|
+
const l = n.viewport.offsetWidth < n.viewport.scrollWidth, d = n.viewport.offsetHeight < n.viewport.scrollHeight;
|
|
1346
|
+
s(a ? l : d);
|
|
1347
|
+
}
|
|
1348
|
+
}, 10);
|
|
1349
|
+
return ue(n.viewport, c), ue(n.content, c), /* @__PURE__ */ h(me, { present: r || i, children: /* @__PURE__ */ h(
|
|
1350
|
+
ot,
|
|
1351
|
+
{
|
|
1352
|
+
"data-state": i ? "visible" : "hidden",
|
|
1353
|
+
...o,
|
|
1354
|
+
ref: t
|
|
1355
|
+
}
|
|
1356
|
+
) });
|
|
1357
|
+
}), ot = u.forwardRef((e, t) => {
|
|
1358
|
+
const { orientation: n = "vertical", ...r } = e, o = q(te, e.__scopeScrollArea), i = u.useRef(null), s = u.useRef(0), [a, c] = u.useState({
|
|
1359
|
+
content: 0,
|
|
1360
|
+
viewport: 0,
|
|
1361
|
+
scrollbar: { size: 0, paddingStart: 0, paddingEnd: 0 }
|
|
1362
|
+
}), l = on(a.viewport, a.content), d = {
|
|
1363
|
+
...r,
|
|
1364
|
+
sizes: a,
|
|
1365
|
+
onSizesChange: c,
|
|
1366
|
+
hasThumb: l > 0 && l < 1,
|
|
1367
|
+
onThumbChange: (m) => i.current = m,
|
|
1368
|
+
onThumbPointerUp: () => s.current = 0,
|
|
1369
|
+
onThumbPointerDown: (m) => s.current = m
|
|
1370
|
+
};
|
|
1371
|
+
function f(m, p) {
|
|
1372
|
+
return so(m, s.current, a, p);
|
|
1373
|
+
}
|
|
1374
|
+
return n === "horizontal" ? /* @__PURE__ */ h(
|
|
1375
|
+
to,
|
|
1376
|
+
{
|
|
1377
|
+
...d,
|
|
1378
|
+
ref: t,
|
|
1379
|
+
onThumbPositionChange: () => {
|
|
1380
|
+
if (o.viewport && i.current) {
|
|
1381
|
+
const m = o.viewport.scrollLeft, p = Rt(m, a, o.dir);
|
|
1382
|
+
i.current.style.transform = `translate3d(${p}px, 0, 0)`;
|
|
1383
|
+
}
|
|
1384
|
+
},
|
|
1385
|
+
onWheelScroll: (m) => {
|
|
1386
|
+
o.viewport && (o.viewport.scrollLeft = m);
|
|
1387
|
+
},
|
|
1388
|
+
onDragScroll: (m) => {
|
|
1389
|
+
o.viewport && (o.viewport.scrollLeft = f(m, o.dir));
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
) : n === "vertical" ? /* @__PURE__ */ h(
|
|
1393
|
+
no,
|
|
1394
|
+
{
|
|
1395
|
+
...d,
|
|
1396
|
+
ref: t,
|
|
1397
|
+
onThumbPositionChange: () => {
|
|
1398
|
+
if (o.viewport && i.current) {
|
|
1399
|
+
const m = o.viewport.scrollTop, p = Rt(m, a);
|
|
1400
|
+
i.current.style.transform = `translate3d(0, ${p}px, 0)`;
|
|
1401
|
+
}
|
|
1402
|
+
},
|
|
1403
|
+
onWheelScroll: (m) => {
|
|
1404
|
+
o.viewport && (o.viewport.scrollTop = m);
|
|
1405
|
+
},
|
|
1406
|
+
onDragScroll: (m) => {
|
|
1407
|
+
o.viewport && (o.viewport.scrollTop = f(m));
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
) : null;
|
|
1411
|
+
}), to = u.forwardRef((e, t) => {
|
|
1412
|
+
const { sizes: n, onSizesChange: r, ...o } = e, i = q(te, e.__scopeScrollArea), [s, a] = u.useState(), c = u.useRef(null), l = U(t, c, i.onScrollbarXChange);
|
|
1413
|
+
return u.useEffect(() => {
|
|
1414
|
+
c.current && a(getComputedStyle(c.current));
|
|
1415
|
+
}, [c]), /* @__PURE__ */ h(
|
|
1416
|
+
tn,
|
|
1417
|
+
{
|
|
1418
|
+
"data-orientation": "horizontal",
|
|
1419
|
+
...o,
|
|
1420
|
+
ref: l,
|
|
1421
|
+
sizes: n,
|
|
1422
|
+
style: {
|
|
1423
|
+
bottom: 0,
|
|
1424
|
+
left: i.dir === "rtl" ? "var(--radix-scroll-area-corner-width)" : 0,
|
|
1425
|
+
right: i.dir === "ltr" ? "var(--radix-scroll-area-corner-width)" : 0,
|
|
1426
|
+
"--radix-scroll-area-thumb-width": Ie(n) + "px",
|
|
1427
|
+
...e.style
|
|
1428
|
+
},
|
|
1429
|
+
onThumbPointerDown: (d) => e.onThumbPointerDown(d.x),
|
|
1430
|
+
onDragScroll: (d) => e.onDragScroll(d.x),
|
|
1431
|
+
onWheelScroll: (d, f) => {
|
|
1432
|
+
if (i.viewport) {
|
|
1433
|
+
const m = i.viewport.scrollLeft + d.deltaX;
|
|
1434
|
+
e.onWheelScroll(m), an(m, f) && d.preventDefault();
|
|
1435
|
+
}
|
|
1436
|
+
},
|
|
1437
|
+
onResize: () => {
|
|
1438
|
+
c.current && i.viewport && s && r({
|
|
1439
|
+
content: i.viewport.scrollWidth,
|
|
1440
|
+
viewport: i.viewport.offsetWidth,
|
|
1441
|
+
scrollbar: {
|
|
1442
|
+
size: c.current.clientWidth,
|
|
1443
|
+
paddingStart: Ae(s.paddingLeft),
|
|
1444
|
+
paddingEnd: Ae(s.paddingRight)
|
|
1445
|
+
}
|
|
1446
|
+
});
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
);
|
|
1450
|
+
}), no = u.forwardRef((e, t) => {
|
|
1451
|
+
const { sizes: n, onSizesChange: r, ...o } = e, i = q(te, e.__scopeScrollArea), [s, a] = u.useState(), c = u.useRef(null), l = U(t, c, i.onScrollbarYChange);
|
|
1452
|
+
return u.useEffect(() => {
|
|
1453
|
+
c.current && a(getComputedStyle(c.current));
|
|
1454
|
+
}, [c]), /* @__PURE__ */ h(
|
|
1455
|
+
tn,
|
|
1456
|
+
{
|
|
1457
|
+
"data-orientation": "vertical",
|
|
1458
|
+
...o,
|
|
1459
|
+
ref: l,
|
|
1460
|
+
sizes: n,
|
|
1461
|
+
style: {
|
|
1462
|
+
top: 0,
|
|
1463
|
+
right: i.dir === "ltr" ? 0 : void 0,
|
|
1464
|
+
left: i.dir === "rtl" ? 0 : void 0,
|
|
1465
|
+
bottom: "var(--radix-scroll-area-corner-height)",
|
|
1466
|
+
"--radix-scroll-area-thumb-height": Ie(n) + "px",
|
|
1467
|
+
...e.style
|
|
1468
|
+
},
|
|
1469
|
+
onThumbPointerDown: (d) => e.onThumbPointerDown(d.y),
|
|
1470
|
+
onDragScroll: (d) => e.onDragScroll(d.y),
|
|
1471
|
+
onWheelScroll: (d, f) => {
|
|
1472
|
+
if (i.viewport) {
|
|
1473
|
+
const m = i.viewport.scrollTop + d.deltaY;
|
|
1474
|
+
e.onWheelScroll(m), an(m, f) && d.preventDefault();
|
|
1475
|
+
}
|
|
1476
|
+
},
|
|
1477
|
+
onResize: () => {
|
|
1478
|
+
c.current && i.viewport && s && r({
|
|
1479
|
+
content: i.viewport.scrollHeight,
|
|
1480
|
+
viewport: i.viewport.offsetHeight,
|
|
1481
|
+
scrollbar: {
|
|
1482
|
+
size: c.current.clientHeight,
|
|
1483
|
+
paddingStart: Ae(s.paddingTop),
|
|
1484
|
+
paddingEnd: Ae(s.paddingBottom)
|
|
1485
|
+
}
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
);
|
|
1490
|
+
}), [ro, en] = Jt(te), tn = u.forwardRef((e, t) => {
|
|
1491
|
+
const {
|
|
1492
|
+
__scopeScrollArea: n,
|
|
1493
|
+
sizes: r,
|
|
1494
|
+
hasThumb: o,
|
|
1495
|
+
onThumbChange: i,
|
|
1496
|
+
onThumbPointerUp: s,
|
|
1497
|
+
onThumbPointerDown: a,
|
|
1498
|
+
onThumbPositionChange: c,
|
|
1499
|
+
onDragScroll: l,
|
|
1500
|
+
onWheelScroll: d,
|
|
1501
|
+
onResize: f,
|
|
1502
|
+
...m
|
|
1503
|
+
} = e, p = q(te, n), [v, y] = u.useState(null), x = U(t, (w) => y(w)), S = u.useRef(null), E = u.useRef(""), R = p.viewport, C = r.content - r.viewport, T = J(d), A = J(c), P = $e(f, 10);
|
|
1504
|
+
function b(w) {
|
|
1505
|
+
if (S.current) {
|
|
1506
|
+
const g = w.clientX - S.current.left, N = w.clientY - S.current.top;
|
|
1507
|
+
l({ x: g, y: N });
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
return u.useEffect(() => {
|
|
1511
|
+
const w = (g) => {
|
|
1512
|
+
const N = g.target;
|
|
1513
|
+
(v == null ? void 0 : v.contains(N)) && T(g, C);
|
|
1514
|
+
};
|
|
1515
|
+
return document.addEventListener("wheel", w, { passive: !1 }), () => document.removeEventListener("wheel", w, { passive: !1 });
|
|
1516
|
+
}, [R, v, C, T]), u.useEffect(A, [r, A]), ue(v, P), ue(p.content, P), /* @__PURE__ */ h(
|
|
1517
|
+
ro,
|
|
1518
|
+
{
|
|
1519
|
+
scope: n,
|
|
1520
|
+
scrollbar: v,
|
|
1521
|
+
hasThumb: o,
|
|
1522
|
+
onThumbChange: J(i),
|
|
1523
|
+
onThumbPointerUp: J(s),
|
|
1524
|
+
onThumbPositionChange: A,
|
|
1525
|
+
onThumbPointerDown: J(a),
|
|
1526
|
+
children: /* @__PURE__ */ h(
|
|
1527
|
+
j.div,
|
|
1528
|
+
{
|
|
1529
|
+
...m,
|
|
1530
|
+
ref: x,
|
|
1531
|
+
style: { position: "absolute", ...m.style },
|
|
1532
|
+
onPointerDown: H(e.onPointerDown, (w) => {
|
|
1533
|
+
w.button === 0 && (w.target.setPointerCapture(w.pointerId), S.current = v.getBoundingClientRect(), E.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", p.viewport && (p.viewport.style.scrollBehavior = "auto"), b(w));
|
|
1534
|
+
}),
|
|
1535
|
+
onPointerMove: H(e.onPointerMove, b),
|
|
1536
|
+
onPointerUp: H(e.onPointerUp, (w) => {
|
|
1537
|
+
const g = w.target;
|
|
1538
|
+
g.hasPointerCapture(w.pointerId) && g.releasePointerCapture(w.pointerId), document.body.style.webkitUserSelect = E.current, p.viewport && (p.viewport.style.scrollBehavior = ""), S.current = null;
|
|
1539
|
+
})
|
|
1540
|
+
}
|
|
1541
|
+
)
|
|
1542
|
+
}
|
|
1543
|
+
);
|
|
1544
|
+
}), Ne = "ScrollAreaThumb", nn = u.forwardRef(
|
|
1545
|
+
(e, t) => {
|
|
1546
|
+
const { forceMount: n, ...r } = e, o = en(Ne, e.__scopeScrollArea);
|
|
1547
|
+
return /* @__PURE__ */ h(me, { present: n || o.hasThumb, children: /* @__PURE__ */ h(oo, { ref: t, ...r }) });
|
|
1548
|
+
}
|
|
1549
|
+
), oo = u.forwardRef(
|
|
1550
|
+
(e, t) => {
|
|
1551
|
+
const { __scopeScrollArea: n, style: r, ...o } = e, i = q(Ne, n), s = en(Ne, n), { onThumbPositionChange: a } = s, c = U(
|
|
1552
|
+
t,
|
|
1553
|
+
(f) => s.onThumbChange(f)
|
|
1554
|
+
), l = u.useRef(void 0), d = $e(() => {
|
|
1555
|
+
l.current && (l.current(), l.current = void 0);
|
|
1556
|
+
}, 100);
|
|
1557
|
+
return u.useEffect(() => {
|
|
1558
|
+
const f = i.viewport;
|
|
1559
|
+
if (f) {
|
|
1560
|
+
const m = () => {
|
|
1561
|
+
if (d(), !l.current) {
|
|
1562
|
+
const p = ao(f, a);
|
|
1563
|
+
l.current = p, a();
|
|
1564
|
+
}
|
|
1565
|
+
};
|
|
1566
|
+
return a(), f.addEventListener("scroll", m), () => f.removeEventListener("scroll", m);
|
|
1567
|
+
}
|
|
1568
|
+
}, [i.viewport, d, a]), /* @__PURE__ */ h(
|
|
1569
|
+
j.div,
|
|
1570
|
+
{
|
|
1571
|
+
"data-state": s.hasThumb ? "visible" : "hidden",
|
|
1572
|
+
...o,
|
|
1573
|
+
ref: c,
|
|
1574
|
+
style: {
|
|
1575
|
+
width: "var(--radix-scroll-area-thumb-width)",
|
|
1576
|
+
height: "var(--radix-scroll-area-thumb-height)",
|
|
1577
|
+
...r
|
|
1578
|
+
},
|
|
1579
|
+
onPointerDownCapture: H(e.onPointerDownCapture, (f) => {
|
|
1580
|
+
const p = f.target.getBoundingClientRect(), v = f.clientX - p.left, y = f.clientY - p.top;
|
|
1581
|
+
s.onThumbPointerDown({ x: v, y });
|
|
1582
|
+
}),
|
|
1583
|
+
onPointerUp: H(e.onPointerUp, s.onThumbPointerUp)
|
|
1584
|
+
}
|
|
1585
|
+
);
|
|
1586
|
+
}
|
|
1587
|
+
);
|
|
1588
|
+
nn.displayName = Ne;
|
|
1589
|
+
var it = "ScrollAreaCorner", rn = u.forwardRef(
|
|
1590
|
+
(e, t) => {
|
|
1591
|
+
const n = q(it, e.__scopeScrollArea), r = !!(n.scrollbarX && n.scrollbarY);
|
|
1592
|
+
return n.type !== "scroll" && r ? /* @__PURE__ */ h(io, { ...e, ref: t }) : null;
|
|
1593
|
+
}
|
|
1594
|
+
);
|
|
1595
|
+
rn.displayName = it;
|
|
1596
|
+
var io = u.forwardRef((e, t) => {
|
|
1597
|
+
const { __scopeScrollArea: n, ...r } = e, o = q(it, n), [i, s] = u.useState(0), [a, c] = u.useState(0), l = !!(i && a);
|
|
1598
|
+
return ue(o.scrollbarX, () => {
|
|
1599
|
+
var f;
|
|
1600
|
+
const d = ((f = o.scrollbarX) == null ? void 0 : f.offsetHeight) || 0;
|
|
1601
|
+
o.onCornerHeightChange(d), c(d);
|
|
1602
|
+
}), ue(o.scrollbarY, () => {
|
|
1603
|
+
var f;
|
|
1604
|
+
const d = ((f = o.scrollbarY) == null ? void 0 : f.offsetWidth) || 0;
|
|
1605
|
+
o.onCornerWidthChange(d), s(d);
|
|
1606
|
+
}), l ? /* @__PURE__ */ h(
|
|
1607
|
+
j.div,
|
|
1608
|
+
{
|
|
1609
|
+
...r,
|
|
1610
|
+
ref: t,
|
|
1611
|
+
style: {
|
|
1612
|
+
width: i,
|
|
1613
|
+
height: a,
|
|
1614
|
+
position: "absolute",
|
|
1615
|
+
right: o.dir === "ltr" ? 0 : void 0,
|
|
1616
|
+
left: o.dir === "rtl" ? 0 : void 0,
|
|
1617
|
+
bottom: 0,
|
|
1618
|
+
...e.style
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
) : null;
|
|
1622
|
+
});
|
|
1623
|
+
function Ae(e) {
|
|
1624
|
+
return e ? parseInt(e, 10) : 0;
|
|
1625
|
+
}
|
|
1626
|
+
function on(e, t) {
|
|
1627
|
+
const n = e / t;
|
|
1628
|
+
return isNaN(n) ? 0 : n;
|
|
1629
|
+
}
|
|
1630
|
+
function Ie(e) {
|
|
1631
|
+
const t = on(e.viewport, e.content), n = e.scrollbar.paddingStart + e.scrollbar.paddingEnd, r = (e.scrollbar.size - n) * t;
|
|
1632
|
+
return Math.max(r, 18);
|
|
1633
|
+
}
|
|
1634
|
+
function so(e, t, n, r = "ltr") {
|
|
1635
|
+
const o = Ie(n), i = o / 2, s = t || i, a = o - s, c = n.scrollbar.paddingStart + s, l = n.scrollbar.size - n.scrollbar.paddingEnd - a, d = n.content - n.viewport, f = r === "ltr" ? [0, d] : [d * -1, 0];
|
|
1636
|
+
return sn([c, l], f)(e);
|
|
1637
|
+
}
|
|
1638
|
+
function Rt(e, t, n = "ltr") {
|
|
1639
|
+
const r = Ie(t), o = t.scrollbar.paddingStart + t.scrollbar.paddingEnd, i = t.scrollbar.size - o, s = t.content - t.viewport, a = i - r, c = n === "ltr" ? [0, s] : [s * -1, 0], l = Gr(e, c);
|
|
1640
|
+
return sn([0, s], [0, a])(l);
|
|
1641
|
+
}
|
|
1642
|
+
function sn(e, t) {
|
|
1643
|
+
return (n) => {
|
|
1644
|
+
if (e[0] === e[1] || t[0] === t[1]) return t[0];
|
|
1645
|
+
const r = (t[1] - t[0]) / (e[1] - e[0]);
|
|
1646
|
+
return t[0] + r * (n - e[0]);
|
|
1647
|
+
};
|
|
1648
|
+
}
|
|
1649
|
+
function an(e, t) {
|
|
1650
|
+
return e > 0 && e < t;
|
|
1651
|
+
}
|
|
1652
|
+
var ao = (e, t = () => {
|
|
1653
|
+
}) => {
|
|
1654
|
+
let n = { left: e.scrollLeft, top: e.scrollTop }, r = 0;
|
|
1655
|
+
return function o() {
|
|
1656
|
+
const i = { left: e.scrollLeft, top: e.scrollTop }, s = n.left !== i.left, a = n.top !== i.top;
|
|
1657
|
+
(s || a) && t(), n = i, r = window.requestAnimationFrame(o);
|
|
1658
|
+
}(), () => window.cancelAnimationFrame(r);
|
|
1659
|
+
};
|
|
1660
|
+
function $e(e, t) {
|
|
1661
|
+
const n = J(e), r = u.useRef(0);
|
|
1662
|
+
return u.useEffect(() => () => window.clearTimeout(r.current), []), u.useCallback(() => {
|
|
1663
|
+
window.clearTimeout(r.current), r.current = window.setTimeout(n, t);
|
|
1664
|
+
}, [n, t]);
|
|
1665
|
+
}
|
|
1666
|
+
function ue(e, t) {
|
|
1667
|
+
const n = J(t);
|
|
1668
|
+
ie(() => {
|
|
1669
|
+
let r = 0;
|
|
1670
|
+
if (e) {
|
|
1671
|
+
const o = new ResizeObserver(() => {
|
|
1672
|
+
cancelAnimationFrame(r), r = window.requestAnimationFrame(n);
|
|
1673
|
+
});
|
|
1674
|
+
return o.observe(e), () => {
|
|
1675
|
+
window.cancelAnimationFrame(r), o.unobserve(e);
|
|
1676
|
+
};
|
|
1677
|
+
}
|
|
1678
|
+
}, [e, n]);
|
|
1679
|
+
}
|
|
1680
|
+
var cn = Gt, co = Zt, lo = rn;
|
|
1681
|
+
const uo = u.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__ */ L(
|
|
1682
|
+
cn,
|
|
1683
|
+
{
|
|
1684
|
+
ref: r,
|
|
1685
|
+
className: V("relative overflow-hidden", e),
|
|
1686
|
+
...n,
|
|
1687
|
+
children: [
|
|
1688
|
+
/* @__PURE__ */ h(co, { className: "h-full w-full rounded-[inherit]", children: t }),
|
|
1689
|
+
/* @__PURE__ */ h(ln, {}),
|
|
1690
|
+
/* @__PURE__ */ h(lo, {})
|
|
1691
|
+
]
|
|
1692
|
+
}
|
|
1693
|
+
));
|
|
1694
|
+
uo.displayName = cn.displayName;
|
|
1695
|
+
const ln = u.forwardRef(({ className: e, orientation: t = "vertical", ...n }, r) => /* @__PURE__ */ h(
|
|
1696
|
+
rt,
|
|
1697
|
+
{
|
|
1698
|
+
ref: r,
|
|
1699
|
+
orientation: t,
|
|
1700
|
+
className: V(
|
|
1701
|
+
"flex touch-none select-none transition-colors",
|
|
1702
|
+
t === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
|
|
1703
|
+
t === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
|
|
1704
|
+
e
|
|
1705
|
+
),
|
|
1706
|
+
...n,
|
|
1707
|
+
children: /* @__PURE__ */ h(nn, { className: "relative flex-1 rounded-full bg-border" })
|
|
1708
|
+
}
|
|
1709
|
+
));
|
|
1710
|
+
ln.displayName = rt.displayName;
|
|
1711
|
+
function fo(e, t = globalThis == null ? void 0 : globalThis.document) {
|
|
1712
|
+
const n = J(e);
|
|
1713
|
+
u.useEffect(() => {
|
|
1714
|
+
const r = (o) => {
|
|
1715
|
+
o.key === "Escape" && n(o);
|
|
1716
|
+
};
|
|
1717
|
+
return t.addEventListener("keydown", r, { capture: !0 }), () => t.removeEventListener("keydown", r, { capture: !0 });
|
|
1718
|
+
}, [n, t]);
|
|
1719
|
+
}
|
|
1720
|
+
var ho = "DismissableLayer", Xe = "dismissableLayer.update", mo = "dismissableLayer.pointerDownOutside", po = "dismissableLayer.focusOutside", Nt, dn = u.createContext({
|
|
1721
|
+
layers: /* @__PURE__ */ new Set(),
|
|
1722
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
1723
|
+
branches: /* @__PURE__ */ new Set()
|
|
1724
|
+
}), un = u.forwardRef(
|
|
1725
|
+
(e, t) => {
|
|
1726
|
+
const {
|
|
1727
|
+
disableOutsidePointerEvents: n = !1,
|
|
1728
|
+
onEscapeKeyDown: r,
|
|
1729
|
+
onPointerDownOutside: o,
|
|
1730
|
+
onFocusOutside: i,
|
|
1731
|
+
onInteractOutside: s,
|
|
1732
|
+
onDismiss: a,
|
|
1733
|
+
...c
|
|
1734
|
+
} = e, l = u.useContext(dn), [d, f] = u.useState(null), m = (d == null ? void 0 : d.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, p] = u.useState({}), v = U(t, (P) => f(P)), y = Array.from(l.layers), [x] = [...l.layersWithOutsidePointerEventsDisabled].slice(-1), S = y.indexOf(x), E = d ? y.indexOf(d) : -1, R = l.layersWithOutsidePointerEventsDisabled.size > 0, C = E >= S, T = wo((P) => {
|
|
1735
|
+
const b = P.target, w = [...l.branches].some((g) => g.contains(b));
|
|
1736
|
+
!C || w || (o == null || o(P), s == null || s(P), P.defaultPrevented || a == null || a());
|
|
1737
|
+
}, m), A = bo((P) => {
|
|
1738
|
+
const b = P.target;
|
|
1739
|
+
[...l.branches].some((g) => g.contains(b)) || (i == null || i(P), s == null || s(P), P.defaultPrevented || a == null || a());
|
|
1740
|
+
}, m);
|
|
1741
|
+
return fo((P) => {
|
|
1742
|
+
E === l.layers.size - 1 && (r == null || r(P), !P.defaultPrevented && a && (P.preventDefault(), a()));
|
|
1743
|
+
}, m), u.useEffect(() => {
|
|
1744
|
+
if (d)
|
|
1745
|
+
return n && (l.layersWithOutsidePointerEventsDisabled.size === 0 && (Nt = m.body.style.pointerEvents, m.body.style.pointerEvents = "none"), l.layersWithOutsidePointerEventsDisabled.add(d)), l.layers.add(d), At(), () => {
|
|
1746
|
+
n && l.layersWithOutsidePointerEventsDisabled.size === 1 && (m.body.style.pointerEvents = Nt);
|
|
1747
|
+
};
|
|
1748
|
+
}, [d, m, n, l]), u.useEffect(() => () => {
|
|
1749
|
+
d && (l.layers.delete(d), l.layersWithOutsidePointerEventsDisabled.delete(d), At());
|
|
1750
|
+
}, [d, l]), u.useEffect(() => {
|
|
1751
|
+
const P = () => p({});
|
|
1752
|
+
return document.addEventListener(Xe, P), () => document.removeEventListener(Xe, P);
|
|
1753
|
+
}, []), /* @__PURE__ */ h(
|
|
1754
|
+
j.div,
|
|
1755
|
+
{
|
|
1756
|
+
...c,
|
|
1757
|
+
ref: v,
|
|
1758
|
+
style: {
|
|
1759
|
+
pointerEvents: R ? C ? "auto" : "none" : void 0,
|
|
1760
|
+
...e.style
|
|
1761
|
+
},
|
|
1762
|
+
onFocusCapture: H(e.onFocusCapture, A.onFocusCapture),
|
|
1763
|
+
onBlurCapture: H(e.onBlurCapture, A.onBlurCapture),
|
|
1764
|
+
onPointerDownCapture: H(
|
|
1765
|
+
e.onPointerDownCapture,
|
|
1766
|
+
T.onPointerDownCapture
|
|
1767
|
+
)
|
|
1768
|
+
}
|
|
1769
|
+
);
|
|
1770
|
+
}
|
|
1771
|
+
);
|
|
1772
|
+
un.displayName = ho;
|
|
1773
|
+
var go = "DismissableLayerBranch", vo = u.forwardRef((e, t) => {
|
|
1774
|
+
const n = u.useContext(dn), r = u.useRef(null), o = U(t, r);
|
|
1775
|
+
return u.useEffect(() => {
|
|
1776
|
+
const i = r.current;
|
|
1777
|
+
if (i)
|
|
1778
|
+
return n.branches.add(i), () => {
|
|
1779
|
+
n.branches.delete(i);
|
|
1780
|
+
};
|
|
1781
|
+
}, [n.branches]), /* @__PURE__ */ h(j.div, { ...e, ref: o });
|
|
1782
|
+
});
|
|
1783
|
+
vo.displayName = go;
|
|
1784
|
+
function wo(e, t = globalThis == null ? void 0 : globalThis.document) {
|
|
1785
|
+
const n = J(e), r = u.useRef(!1), o = u.useRef(() => {
|
|
1786
|
+
});
|
|
1787
|
+
return u.useEffect(() => {
|
|
1788
|
+
const i = (a) => {
|
|
1789
|
+
if (a.target && !r.current) {
|
|
1790
|
+
let c = function() {
|
|
1791
|
+
fn(
|
|
1792
|
+
mo,
|
|
1793
|
+
n,
|
|
1794
|
+
l,
|
|
1795
|
+
{ discrete: !0 }
|
|
1796
|
+
);
|
|
1797
|
+
};
|
|
1798
|
+
const l = { originalEvent: a };
|
|
1799
|
+
a.pointerType === "touch" ? (t.removeEventListener("click", o.current), o.current = c, t.addEventListener("click", o.current, { once: !0 })) : c();
|
|
1800
|
+
} else
|
|
1801
|
+
t.removeEventListener("click", o.current);
|
|
1802
|
+
r.current = !1;
|
|
1803
|
+
}, s = window.setTimeout(() => {
|
|
1804
|
+
t.addEventListener("pointerdown", i);
|
|
1805
|
+
}, 0);
|
|
1806
|
+
return () => {
|
|
1807
|
+
window.clearTimeout(s), t.removeEventListener("pointerdown", i), t.removeEventListener("click", o.current);
|
|
1808
|
+
};
|
|
1809
|
+
}, [t, n]), {
|
|
1810
|
+
// ensures we check React component tree (not just DOM tree)
|
|
1811
|
+
onPointerDownCapture: () => r.current = !0
|
|
1812
|
+
};
|
|
1813
|
+
}
|
|
1814
|
+
function bo(e, t = globalThis == null ? void 0 : globalThis.document) {
|
|
1815
|
+
const n = J(e), r = u.useRef(!1);
|
|
1816
|
+
return u.useEffect(() => {
|
|
1817
|
+
const o = (i) => {
|
|
1818
|
+
i.target && !r.current && fn(po, n, { originalEvent: i }, {
|
|
1819
|
+
discrete: !1
|
|
1820
|
+
});
|
|
1821
|
+
};
|
|
1822
|
+
return t.addEventListener("focusin", o), () => t.removeEventListener("focusin", o);
|
|
1823
|
+
}, [t, n]), {
|
|
1824
|
+
onFocusCapture: () => r.current = !0,
|
|
1825
|
+
onBlurCapture: () => r.current = !1
|
|
1826
|
+
};
|
|
1827
|
+
}
|
|
1828
|
+
function At() {
|
|
1829
|
+
const e = new CustomEvent(Xe);
|
|
1830
|
+
document.dispatchEvent(e);
|
|
1831
|
+
}
|
|
1832
|
+
function fn(e, t, n, { discrete: r }) {
|
|
1833
|
+
const o = n.originalEvent.target, i = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: n });
|
|
1834
|
+
t && o.addEventListener(e, t, { once: !0 }), r ? Mr(o, i) : o.dispatchEvent(i);
|
|
1835
|
+
}
|
|
1836
|
+
var yo = u[" useId ".trim().toString()] || (() => {
|
|
1837
|
+
}), xo = 0;
|
|
1838
|
+
function Co(e) {
|
|
1839
|
+
const [t, n] = u.useState(yo());
|
|
1840
|
+
return ie(() => {
|
|
1841
|
+
n((r) => r ?? String(xo++));
|
|
1842
|
+
}, [e]), t ? `radix-${t}` : "";
|
|
1843
|
+
}
|
|
1844
|
+
const So = ["top", "right", "bottom", "left"], se = Math.min, Y = Math.max, Oe = Math.round, Pe = Math.floor, Q = (e) => ({
|
|
1845
|
+
x: e,
|
|
1846
|
+
y: e
|
|
1847
|
+
}), To = {
|
|
1848
|
+
left: "right",
|
|
1849
|
+
right: "left",
|
|
1850
|
+
bottom: "top",
|
|
1851
|
+
top: "bottom"
|
|
1852
|
+
}, Eo = {
|
|
1853
|
+
start: "end",
|
|
1854
|
+
end: "start"
|
|
1855
|
+
};
|
|
1856
|
+
function Ue(e, t, n) {
|
|
1857
|
+
return Y(e, se(t, n));
|
|
1858
|
+
}
|
|
1859
|
+
function re(e, t) {
|
|
1860
|
+
return typeof e == "function" ? e(t) : e;
|
|
1861
|
+
}
|
|
1862
|
+
function oe(e) {
|
|
1863
|
+
return e.split("-")[0];
|
|
1864
|
+
}
|
|
1865
|
+
function pe(e) {
|
|
1866
|
+
return e.split("-")[1];
|
|
1867
|
+
}
|
|
1868
|
+
function st(e) {
|
|
1869
|
+
return e === "x" ? "y" : "x";
|
|
1870
|
+
}
|
|
1871
|
+
function at(e) {
|
|
1872
|
+
return e === "y" ? "height" : "width";
|
|
1873
|
+
}
|
|
1874
|
+
const Po = /* @__PURE__ */ new Set(["top", "bottom"]);
|
|
1875
|
+
function Z(e) {
|
|
1876
|
+
return Po.has(oe(e)) ? "y" : "x";
|
|
1877
|
+
}
|
|
1878
|
+
function ct(e) {
|
|
1879
|
+
return st(Z(e));
|
|
1880
|
+
}
|
|
1881
|
+
function Ro(e, t, n) {
|
|
1882
|
+
n === void 0 && (n = !1);
|
|
1883
|
+
const r = pe(e), o = ct(e), i = at(o);
|
|
1884
|
+
let s = o === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
|
|
1885
|
+
return t.reference[i] > t.floating[i] && (s = Le(s)), [s, Le(s)];
|
|
1886
|
+
}
|
|
1887
|
+
function No(e) {
|
|
1888
|
+
const t = Le(e);
|
|
1889
|
+
return [qe(e), t, qe(t)];
|
|
1890
|
+
}
|
|
1891
|
+
function qe(e) {
|
|
1892
|
+
return e.replace(/start|end/g, (t) => Eo[t]);
|
|
1893
|
+
}
|
|
1894
|
+
const Ot = ["left", "right"], Lt = ["right", "left"], Ao = ["top", "bottom"], Oo = ["bottom", "top"];
|
|
1895
|
+
function Lo(e, t, n) {
|
|
1896
|
+
switch (e) {
|
|
1897
|
+
case "top":
|
|
1898
|
+
case "bottom":
|
|
1899
|
+
return n ? t ? Lt : Ot : t ? Ot : Lt;
|
|
1900
|
+
case "left":
|
|
1901
|
+
case "right":
|
|
1902
|
+
return t ? Ao : Oo;
|
|
1903
|
+
default:
|
|
1904
|
+
return [];
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
function Do(e, t, n, r) {
|
|
1908
|
+
const o = pe(e);
|
|
1909
|
+
let i = Lo(oe(e), n === "start", r);
|
|
1910
|
+
return o && (i = i.map((s) => s + "-" + o), t && (i = i.concat(i.map(qe)))), i;
|
|
1911
|
+
}
|
|
1912
|
+
function Le(e) {
|
|
1913
|
+
return e.replace(/left|right|bottom|top/g, (t) => To[t]);
|
|
1914
|
+
}
|
|
1915
|
+
function _o(e) {
|
|
1916
|
+
return {
|
|
1917
|
+
top: 0,
|
|
1918
|
+
right: 0,
|
|
1919
|
+
bottom: 0,
|
|
1920
|
+
left: 0,
|
|
1921
|
+
...e
|
|
1922
|
+
};
|
|
1923
|
+
}
|
|
1924
|
+
function hn(e) {
|
|
1925
|
+
return typeof e != "number" ? _o(e) : {
|
|
1926
|
+
top: e,
|
|
1927
|
+
right: e,
|
|
1928
|
+
bottom: e,
|
|
1929
|
+
left: e
|
|
1930
|
+
};
|
|
1931
|
+
}
|
|
1932
|
+
function De(e) {
|
|
1933
|
+
const {
|
|
1934
|
+
x: t,
|
|
1935
|
+
y: n,
|
|
1936
|
+
width: r,
|
|
1937
|
+
height: o
|
|
1938
|
+
} = e;
|
|
1939
|
+
return {
|
|
1940
|
+
width: r,
|
|
1941
|
+
height: o,
|
|
1942
|
+
top: n,
|
|
1943
|
+
left: t,
|
|
1944
|
+
right: t + r,
|
|
1945
|
+
bottom: n + o,
|
|
1946
|
+
x: t,
|
|
1947
|
+
y: n
|
|
1948
|
+
};
|
|
1949
|
+
}
|
|
1950
|
+
function Dt(e, t, n) {
|
|
1951
|
+
let {
|
|
1952
|
+
reference: r,
|
|
1953
|
+
floating: o
|
|
1954
|
+
} = e;
|
|
1955
|
+
const i = Z(t), s = ct(t), a = at(s), c = oe(t), l = i === "y", d = r.x + r.width / 2 - o.width / 2, f = r.y + r.height / 2 - o.height / 2, m = r[a] / 2 - o[a] / 2;
|
|
1956
|
+
let p;
|
|
1957
|
+
switch (c) {
|
|
1958
|
+
case "top":
|
|
1959
|
+
p = {
|
|
1960
|
+
x: d,
|
|
1961
|
+
y: r.y - o.height
|
|
1962
|
+
};
|
|
1963
|
+
break;
|
|
1964
|
+
case "bottom":
|
|
1965
|
+
p = {
|
|
1966
|
+
x: d,
|
|
1967
|
+
y: r.y + r.height
|
|
1968
|
+
};
|
|
1969
|
+
break;
|
|
1970
|
+
case "right":
|
|
1971
|
+
p = {
|
|
1972
|
+
x: r.x + r.width,
|
|
1973
|
+
y: f
|
|
1974
|
+
};
|
|
1975
|
+
break;
|
|
1976
|
+
case "left":
|
|
1977
|
+
p = {
|
|
1978
|
+
x: r.x - o.width,
|
|
1979
|
+
y: f
|
|
1980
|
+
};
|
|
1981
|
+
break;
|
|
1982
|
+
default:
|
|
1983
|
+
p = {
|
|
1984
|
+
x: r.x,
|
|
1985
|
+
y: r.y
|
|
1986
|
+
};
|
|
1987
|
+
}
|
|
1988
|
+
switch (pe(t)) {
|
|
1989
|
+
case "start":
|
|
1990
|
+
p[s] -= m * (n && l ? -1 : 1);
|
|
1991
|
+
break;
|
|
1992
|
+
case "end":
|
|
1993
|
+
p[s] += m * (n && l ? -1 : 1);
|
|
1994
|
+
break;
|
|
1995
|
+
}
|
|
1996
|
+
return p;
|
|
1997
|
+
}
|
|
1998
|
+
const ko = async (e, t, n) => {
|
|
1999
|
+
const {
|
|
2000
|
+
placement: r = "bottom",
|
|
2001
|
+
strategy: o = "absolute",
|
|
2002
|
+
middleware: i = [],
|
|
2003
|
+
platform: s
|
|
2004
|
+
} = n, a = i.filter(Boolean), c = await (s.isRTL == null ? void 0 : s.isRTL(t));
|
|
2005
|
+
let l = await s.getElementRects({
|
|
2006
|
+
reference: e,
|
|
2007
|
+
floating: t,
|
|
2008
|
+
strategy: o
|
|
2009
|
+
}), {
|
|
2010
|
+
x: d,
|
|
2011
|
+
y: f
|
|
2012
|
+
} = Dt(l, r, c), m = r, p = {}, v = 0;
|
|
2013
|
+
for (let y = 0; y < a.length; y++) {
|
|
2014
|
+
const {
|
|
2015
|
+
name: x,
|
|
2016
|
+
fn: S
|
|
2017
|
+
} = a[y], {
|
|
2018
|
+
x: E,
|
|
2019
|
+
y: R,
|
|
2020
|
+
data: C,
|
|
2021
|
+
reset: T
|
|
2022
|
+
} = await S({
|
|
2023
|
+
x: d,
|
|
2024
|
+
y: f,
|
|
2025
|
+
initialPlacement: r,
|
|
2026
|
+
placement: m,
|
|
2027
|
+
strategy: o,
|
|
2028
|
+
middlewareData: p,
|
|
2029
|
+
rects: l,
|
|
2030
|
+
platform: s,
|
|
2031
|
+
elements: {
|
|
2032
|
+
reference: e,
|
|
2033
|
+
floating: t
|
|
2034
|
+
}
|
|
2035
|
+
});
|
|
2036
|
+
d = E ?? d, f = R ?? f, p = {
|
|
2037
|
+
...p,
|
|
2038
|
+
[x]: {
|
|
2039
|
+
...p[x],
|
|
2040
|
+
...C
|
|
2041
|
+
}
|
|
2042
|
+
}, T && v <= 50 && (v++, typeof T == "object" && (T.placement && (m = T.placement), T.rects && (l = T.rects === !0 ? await s.getElementRects({
|
|
2043
|
+
reference: e,
|
|
2044
|
+
floating: t,
|
|
2045
|
+
strategy: o
|
|
2046
|
+
}) : T.rects), {
|
|
2047
|
+
x: d,
|
|
2048
|
+
y: f
|
|
2049
|
+
} = Dt(l, m, c)), y = -1);
|
|
2050
|
+
}
|
|
2051
|
+
return {
|
|
2052
|
+
x: d,
|
|
2053
|
+
y: f,
|
|
2054
|
+
placement: m,
|
|
2055
|
+
strategy: o,
|
|
2056
|
+
middlewareData: p
|
|
2057
|
+
};
|
|
2058
|
+
};
|
|
2059
|
+
async function be(e, t) {
|
|
2060
|
+
var n;
|
|
2061
|
+
t === void 0 && (t = {});
|
|
2062
|
+
const {
|
|
2063
|
+
x: r,
|
|
2064
|
+
y: o,
|
|
2065
|
+
platform: i,
|
|
2066
|
+
rects: s,
|
|
2067
|
+
elements: a,
|
|
2068
|
+
strategy: c
|
|
2069
|
+
} = e, {
|
|
2070
|
+
boundary: l = "clippingAncestors",
|
|
2071
|
+
rootBoundary: d = "viewport",
|
|
2072
|
+
elementContext: f = "floating",
|
|
2073
|
+
altBoundary: m = !1,
|
|
2074
|
+
padding: p = 0
|
|
2075
|
+
} = re(t, e), v = hn(p), x = a[m ? f === "floating" ? "reference" : "floating" : f], S = De(await i.getClippingRect({
|
|
2076
|
+
element: (n = await (i.isElement == null ? void 0 : i.isElement(x))) == null || n ? x : x.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(a.floating)),
|
|
2077
|
+
boundary: l,
|
|
2078
|
+
rootBoundary: d,
|
|
2079
|
+
strategy: c
|
|
2080
|
+
})), E = f === "floating" ? {
|
|
2081
|
+
x: r,
|
|
2082
|
+
y: o,
|
|
2083
|
+
width: s.floating.width,
|
|
2084
|
+
height: s.floating.height
|
|
2085
|
+
} : s.reference, R = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(a.floating)), C = await (i.isElement == null ? void 0 : i.isElement(R)) ? await (i.getScale == null ? void 0 : i.getScale(R)) || {
|
|
2086
|
+
x: 1,
|
|
2087
|
+
y: 1
|
|
2088
|
+
} : {
|
|
2089
|
+
x: 1,
|
|
2090
|
+
y: 1
|
|
2091
|
+
}, T = De(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
2092
|
+
elements: a,
|
|
2093
|
+
rect: E,
|
|
2094
|
+
offsetParent: R,
|
|
2095
|
+
strategy: c
|
|
2096
|
+
}) : E);
|
|
2097
|
+
return {
|
|
2098
|
+
top: (S.top - T.top + v.top) / C.y,
|
|
2099
|
+
bottom: (T.bottom - S.bottom + v.bottom) / C.y,
|
|
2100
|
+
left: (S.left - T.left + v.left) / C.x,
|
|
2101
|
+
right: (T.right - S.right + v.right) / C.x
|
|
2102
|
+
};
|
|
2103
|
+
}
|
|
2104
|
+
const Mo = (e) => ({
|
|
2105
|
+
name: "arrow",
|
|
2106
|
+
options: e,
|
|
2107
|
+
async fn(t) {
|
|
2108
|
+
const {
|
|
2109
|
+
x: n,
|
|
2110
|
+
y: r,
|
|
2111
|
+
placement: o,
|
|
2112
|
+
rects: i,
|
|
2113
|
+
platform: s,
|
|
2114
|
+
elements: a,
|
|
2115
|
+
middlewareData: c
|
|
2116
|
+
} = t, {
|
|
2117
|
+
element: l,
|
|
2118
|
+
padding: d = 0
|
|
2119
|
+
} = re(e, t) || {};
|
|
2120
|
+
if (l == null)
|
|
2121
|
+
return {};
|
|
2122
|
+
const f = hn(d), m = {
|
|
2123
|
+
x: n,
|
|
2124
|
+
y: r
|
|
2125
|
+
}, p = ct(o), v = at(p), y = await s.getDimensions(l), x = p === "y", S = x ? "top" : "left", E = x ? "bottom" : "right", R = x ? "clientHeight" : "clientWidth", C = i.reference[v] + i.reference[p] - m[p] - i.floating[v], T = m[p] - i.reference[p], A = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(l));
|
|
2126
|
+
let P = A ? A[R] : 0;
|
|
2127
|
+
(!P || !await (s.isElement == null ? void 0 : s.isElement(A))) && (P = a.floating[R] || i.floating[v]);
|
|
2128
|
+
const b = C / 2 - T / 2, w = P / 2 - y[v] / 2 - 1, g = se(f[S], w), N = se(f[E], w), D = g, k = P - y[v] - N, I = P / 2 - y[v] / 2 + b, F = Ue(D, I, k), M = !c.arrow && pe(o) != null && I !== F && i.reference[v] / 2 - (I < D ? g : N) - y[v] / 2 < 0, _ = M ? I < D ? I - D : I - k : 0;
|
|
2129
|
+
return {
|
|
2130
|
+
[p]: m[p] + _,
|
|
2131
|
+
data: {
|
|
2132
|
+
[p]: F,
|
|
2133
|
+
centerOffset: I - F - _,
|
|
2134
|
+
...M && {
|
|
2135
|
+
alignmentOffset: _
|
|
2136
|
+
}
|
|
2137
|
+
},
|
|
2138
|
+
reset: M
|
|
2139
|
+
};
|
|
2140
|
+
}
|
|
2141
|
+
}), Io = function(e) {
|
|
2142
|
+
return e === void 0 && (e = {}), {
|
|
2143
|
+
name: "flip",
|
|
2144
|
+
options: e,
|
|
2145
|
+
async fn(t) {
|
|
2146
|
+
var n, r;
|
|
2147
|
+
const {
|
|
2148
|
+
placement: o,
|
|
2149
|
+
middlewareData: i,
|
|
2150
|
+
rects: s,
|
|
2151
|
+
initialPlacement: a,
|
|
2152
|
+
platform: c,
|
|
2153
|
+
elements: l
|
|
2154
|
+
} = t, {
|
|
2155
|
+
mainAxis: d = !0,
|
|
2156
|
+
crossAxis: f = !0,
|
|
2157
|
+
fallbackPlacements: m,
|
|
2158
|
+
fallbackStrategy: p = "bestFit",
|
|
2159
|
+
fallbackAxisSideDirection: v = "none",
|
|
2160
|
+
flipAlignment: y = !0,
|
|
2161
|
+
...x
|
|
2162
|
+
} = re(e, t);
|
|
2163
|
+
if ((n = i.arrow) != null && n.alignmentOffset)
|
|
2164
|
+
return {};
|
|
2165
|
+
const S = oe(o), E = Z(a), R = oe(a) === a, C = await (c.isRTL == null ? void 0 : c.isRTL(l.floating)), T = m || (R || !y ? [Le(a)] : No(a)), A = v !== "none";
|
|
2166
|
+
!m && A && T.push(...Do(a, y, v, C));
|
|
2167
|
+
const P = [a, ...T], b = await be(t, x), w = [];
|
|
2168
|
+
let g = ((r = i.flip) == null ? void 0 : r.overflows) || [];
|
|
2169
|
+
if (d && w.push(b[S]), f) {
|
|
2170
|
+
const I = Ro(o, s, C);
|
|
2171
|
+
w.push(b[I[0]], b[I[1]]);
|
|
2172
|
+
}
|
|
2173
|
+
if (g = [...g, {
|
|
2174
|
+
placement: o,
|
|
2175
|
+
overflows: w
|
|
2176
|
+
}], !w.every((I) => I <= 0)) {
|
|
2177
|
+
var N, D;
|
|
2178
|
+
const I = (((N = i.flip) == null ? void 0 : N.index) || 0) + 1, F = P[I];
|
|
2179
|
+
if (F && (!(f === "alignment" ? E !== Z(F) : !1) || // We leave the current main axis only if every placement on that axis
|
|
2180
|
+
// overflows the main axis.
|
|
2181
|
+
g.every((O) => O.overflows[0] > 0 && Z(O.placement) === E)))
|
|
2182
|
+
return {
|
|
2183
|
+
data: {
|
|
2184
|
+
index: I,
|
|
2185
|
+
overflows: g
|
|
2186
|
+
},
|
|
2187
|
+
reset: {
|
|
2188
|
+
placement: F
|
|
2189
|
+
}
|
|
2190
|
+
};
|
|
2191
|
+
let M = (D = g.filter((_) => _.overflows[0] <= 0).sort((_, O) => _.overflows[1] - O.overflows[1])[0]) == null ? void 0 : D.placement;
|
|
2192
|
+
if (!M)
|
|
2193
|
+
switch (p) {
|
|
2194
|
+
case "bestFit": {
|
|
2195
|
+
var k;
|
|
2196
|
+
const _ = (k = g.filter((O) => {
|
|
2197
|
+
if (A) {
|
|
2198
|
+
const $ = Z(O.placement);
|
|
2199
|
+
return $ === E || // Create a bias to the `y` side axis due to horizontal
|
|
2200
|
+
// reading directions favoring greater width.
|
|
2201
|
+
$ === "y";
|
|
2202
|
+
}
|
|
2203
|
+
return !0;
|
|
2204
|
+
}).map((O) => [O.placement, O.overflows.filter(($) => $ > 0).reduce(($, W) => $ + W, 0)]).sort((O, $) => O[1] - $[1])[0]) == null ? void 0 : k[0];
|
|
2205
|
+
_ && (M = _);
|
|
2206
|
+
break;
|
|
2207
|
+
}
|
|
2208
|
+
case "initialPlacement":
|
|
2209
|
+
M = a;
|
|
2210
|
+
break;
|
|
2211
|
+
}
|
|
2212
|
+
if (o !== M)
|
|
2213
|
+
return {
|
|
2214
|
+
reset: {
|
|
2215
|
+
placement: M
|
|
2216
|
+
}
|
|
2217
|
+
};
|
|
2218
|
+
}
|
|
2219
|
+
return {};
|
|
2220
|
+
}
|
|
2221
|
+
};
|
|
2222
|
+
};
|
|
2223
|
+
function _t(e, t) {
|
|
2224
|
+
return {
|
|
2225
|
+
top: e.top - t.height,
|
|
2226
|
+
right: e.right - t.width,
|
|
2227
|
+
bottom: e.bottom - t.height,
|
|
2228
|
+
left: e.left - t.width
|
|
2229
|
+
};
|
|
2230
|
+
}
|
|
2231
|
+
function kt(e) {
|
|
2232
|
+
return So.some((t) => e[t] >= 0);
|
|
2233
|
+
}
|
|
2234
|
+
const $o = function(e) {
|
|
2235
|
+
return e === void 0 && (e = {}), {
|
|
2236
|
+
name: "hide",
|
|
2237
|
+
options: e,
|
|
2238
|
+
async fn(t) {
|
|
2239
|
+
const {
|
|
2240
|
+
rects: n
|
|
2241
|
+
} = t, {
|
|
2242
|
+
strategy: r = "referenceHidden",
|
|
2243
|
+
...o
|
|
2244
|
+
} = re(e, t);
|
|
2245
|
+
switch (r) {
|
|
2246
|
+
case "referenceHidden": {
|
|
2247
|
+
const i = await be(t, {
|
|
2248
|
+
...o,
|
|
2249
|
+
elementContext: "reference"
|
|
2250
|
+
}), s = _t(i, n.reference);
|
|
2251
|
+
return {
|
|
2252
|
+
data: {
|
|
2253
|
+
referenceHiddenOffsets: s,
|
|
2254
|
+
referenceHidden: kt(s)
|
|
2255
|
+
}
|
|
2256
|
+
};
|
|
2257
|
+
}
|
|
2258
|
+
case "escaped": {
|
|
2259
|
+
const i = await be(t, {
|
|
2260
|
+
...o,
|
|
2261
|
+
altBoundary: !0
|
|
2262
|
+
}), s = _t(i, n.floating);
|
|
2263
|
+
return {
|
|
2264
|
+
data: {
|
|
2265
|
+
escapedOffsets: s,
|
|
2266
|
+
escaped: kt(s)
|
|
2267
|
+
}
|
|
2268
|
+
};
|
|
2269
|
+
}
|
|
2270
|
+
default:
|
|
2271
|
+
return {};
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
};
|
|
2275
|
+
}, mn = /* @__PURE__ */ new Set(["left", "top"]);
|
|
2276
|
+
async function Fo(e, t) {
|
|
2277
|
+
const {
|
|
2278
|
+
placement: n,
|
|
2279
|
+
platform: r,
|
|
2280
|
+
elements: o
|
|
2281
|
+
} = e, i = await (r.isRTL == null ? void 0 : r.isRTL(o.floating)), s = oe(n), a = pe(n), c = Z(n) === "y", l = mn.has(s) ? -1 : 1, d = i && c ? -1 : 1, f = re(t, e);
|
|
2282
|
+
let {
|
|
2283
|
+
mainAxis: m,
|
|
2284
|
+
crossAxis: p,
|
|
2285
|
+
alignmentAxis: v
|
|
2286
|
+
} = typeof f == "number" ? {
|
|
2287
|
+
mainAxis: f,
|
|
2288
|
+
crossAxis: 0,
|
|
2289
|
+
alignmentAxis: null
|
|
2290
|
+
} : {
|
|
2291
|
+
mainAxis: f.mainAxis || 0,
|
|
2292
|
+
crossAxis: f.crossAxis || 0,
|
|
2293
|
+
alignmentAxis: f.alignmentAxis
|
|
2294
|
+
};
|
|
2295
|
+
return a && typeof v == "number" && (p = a === "end" ? v * -1 : v), c ? {
|
|
2296
|
+
x: p * d,
|
|
2297
|
+
y: m * l
|
|
2298
|
+
} : {
|
|
2299
|
+
x: m * l,
|
|
2300
|
+
y: p * d
|
|
2301
|
+
};
|
|
2302
|
+
}
|
|
2303
|
+
const zo = function(e) {
|
|
2304
|
+
return e === void 0 && (e = 0), {
|
|
2305
|
+
name: "offset",
|
|
2306
|
+
options: e,
|
|
2307
|
+
async fn(t) {
|
|
2308
|
+
var n, r;
|
|
2309
|
+
const {
|
|
2310
|
+
x: o,
|
|
2311
|
+
y: i,
|
|
2312
|
+
placement: s,
|
|
2313
|
+
middlewareData: a
|
|
2314
|
+
} = t, c = await Fo(t, e);
|
|
2315
|
+
return s === ((n = a.offset) == null ? void 0 : n.placement) && (r = a.arrow) != null && r.alignmentOffset ? {} : {
|
|
2316
|
+
x: o + c.x,
|
|
2317
|
+
y: i + c.y,
|
|
2318
|
+
data: {
|
|
2319
|
+
...c,
|
|
2320
|
+
placement: s
|
|
2321
|
+
}
|
|
2322
|
+
};
|
|
2323
|
+
}
|
|
2324
|
+
};
|
|
2325
|
+
}, Ho = function(e) {
|
|
2326
|
+
return e === void 0 && (e = {}), {
|
|
2327
|
+
name: "shift",
|
|
2328
|
+
options: e,
|
|
2329
|
+
async fn(t) {
|
|
2330
|
+
const {
|
|
2331
|
+
x: n,
|
|
2332
|
+
y: r,
|
|
2333
|
+
placement: o
|
|
2334
|
+
} = t, {
|
|
2335
|
+
mainAxis: i = !0,
|
|
2336
|
+
crossAxis: s = !1,
|
|
2337
|
+
limiter: a = {
|
|
2338
|
+
fn: (x) => {
|
|
2339
|
+
let {
|
|
2340
|
+
x: S,
|
|
2341
|
+
y: E
|
|
2342
|
+
} = x;
|
|
2343
|
+
return {
|
|
2344
|
+
x: S,
|
|
2345
|
+
y: E
|
|
2346
|
+
};
|
|
2347
|
+
}
|
|
2348
|
+
},
|
|
2349
|
+
...c
|
|
2350
|
+
} = re(e, t), l = {
|
|
2351
|
+
x: n,
|
|
2352
|
+
y: r
|
|
2353
|
+
}, d = await be(t, c), f = Z(oe(o)), m = st(f);
|
|
2354
|
+
let p = l[m], v = l[f];
|
|
2355
|
+
if (i) {
|
|
2356
|
+
const x = m === "y" ? "top" : "left", S = m === "y" ? "bottom" : "right", E = p + d[x], R = p - d[S];
|
|
2357
|
+
p = Ue(E, p, R);
|
|
2358
|
+
}
|
|
2359
|
+
if (s) {
|
|
2360
|
+
const x = f === "y" ? "top" : "left", S = f === "y" ? "bottom" : "right", E = v + d[x], R = v - d[S];
|
|
2361
|
+
v = Ue(E, v, R);
|
|
2362
|
+
}
|
|
2363
|
+
const y = a.fn({
|
|
2364
|
+
...t,
|
|
2365
|
+
[m]: p,
|
|
2366
|
+
[f]: v
|
|
2367
|
+
});
|
|
2368
|
+
return {
|
|
2369
|
+
...y,
|
|
2370
|
+
data: {
|
|
2371
|
+
x: y.x - n,
|
|
2372
|
+
y: y.y - r,
|
|
2373
|
+
enabled: {
|
|
2374
|
+
[m]: i,
|
|
2375
|
+
[f]: s
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
};
|
|
2379
|
+
}
|
|
2380
|
+
};
|
|
2381
|
+
}, Wo = function(e) {
|
|
2382
|
+
return e === void 0 && (e = {}), {
|
|
2383
|
+
options: e,
|
|
2384
|
+
fn(t) {
|
|
2385
|
+
const {
|
|
2386
|
+
x: n,
|
|
2387
|
+
y: r,
|
|
2388
|
+
placement: o,
|
|
2389
|
+
rects: i,
|
|
2390
|
+
middlewareData: s
|
|
2391
|
+
} = t, {
|
|
2392
|
+
offset: a = 0,
|
|
2393
|
+
mainAxis: c = !0,
|
|
2394
|
+
crossAxis: l = !0
|
|
2395
|
+
} = re(e, t), d = {
|
|
2396
|
+
x: n,
|
|
2397
|
+
y: r
|
|
2398
|
+
}, f = Z(o), m = st(f);
|
|
2399
|
+
let p = d[m], v = d[f];
|
|
2400
|
+
const y = re(a, t), x = typeof y == "number" ? {
|
|
2401
|
+
mainAxis: y,
|
|
2402
|
+
crossAxis: 0
|
|
2403
|
+
} : {
|
|
2404
|
+
mainAxis: 0,
|
|
2405
|
+
crossAxis: 0,
|
|
2406
|
+
...y
|
|
2407
|
+
};
|
|
2408
|
+
if (c) {
|
|
2409
|
+
const R = m === "y" ? "height" : "width", C = i.reference[m] - i.floating[R] + x.mainAxis, T = i.reference[m] + i.reference[R] - x.mainAxis;
|
|
2410
|
+
p < C ? p = C : p > T && (p = T);
|
|
2411
|
+
}
|
|
2412
|
+
if (l) {
|
|
2413
|
+
var S, E;
|
|
2414
|
+
const R = m === "y" ? "width" : "height", C = mn.has(oe(o)), T = i.reference[f] - i.floating[R] + (C && ((S = s.offset) == null ? void 0 : S[f]) || 0) + (C ? 0 : x.crossAxis), A = i.reference[f] + i.reference[R] + (C ? 0 : ((E = s.offset) == null ? void 0 : E[f]) || 0) - (C ? x.crossAxis : 0);
|
|
2415
|
+
v < T ? v = T : v > A && (v = A);
|
|
2416
|
+
}
|
|
2417
|
+
return {
|
|
2418
|
+
[m]: p,
|
|
2419
|
+
[f]: v
|
|
2420
|
+
};
|
|
2421
|
+
}
|
|
2422
|
+
};
|
|
2423
|
+
}, Bo = function(e) {
|
|
2424
|
+
return e === void 0 && (e = {}), {
|
|
2425
|
+
name: "size",
|
|
2426
|
+
options: e,
|
|
2427
|
+
async fn(t) {
|
|
2428
|
+
var n, r;
|
|
2429
|
+
const {
|
|
2430
|
+
placement: o,
|
|
2431
|
+
rects: i,
|
|
2432
|
+
platform: s,
|
|
2433
|
+
elements: a
|
|
2434
|
+
} = t, {
|
|
2435
|
+
apply: c = () => {
|
|
2436
|
+
},
|
|
2437
|
+
...l
|
|
2438
|
+
} = re(e, t), d = await be(t, l), f = oe(o), m = pe(o), p = Z(o) === "y", {
|
|
2439
|
+
width: v,
|
|
2440
|
+
height: y
|
|
2441
|
+
} = i.floating;
|
|
2442
|
+
let x, S;
|
|
2443
|
+
f === "top" || f === "bottom" ? (x = f, S = m === (await (s.isRTL == null ? void 0 : s.isRTL(a.floating)) ? "start" : "end") ? "left" : "right") : (S = f, x = m === "end" ? "top" : "bottom");
|
|
2444
|
+
const E = y - d.top - d.bottom, R = v - d.left - d.right, C = se(y - d[x], E), T = se(v - d[S], R), A = !t.middlewareData.shift;
|
|
2445
|
+
let P = C, b = T;
|
|
2446
|
+
if ((n = t.middlewareData.shift) != null && n.enabled.x && (b = R), (r = t.middlewareData.shift) != null && r.enabled.y && (P = E), A && !m) {
|
|
2447
|
+
const g = Y(d.left, 0), N = Y(d.right, 0), D = Y(d.top, 0), k = Y(d.bottom, 0);
|
|
2448
|
+
p ? b = v - 2 * (g !== 0 || N !== 0 ? g + N : Y(d.left, d.right)) : P = y - 2 * (D !== 0 || k !== 0 ? D + k : Y(d.top, d.bottom));
|
|
2449
|
+
}
|
|
2450
|
+
await c({
|
|
2451
|
+
...t,
|
|
2452
|
+
availableWidth: b,
|
|
2453
|
+
availableHeight: P
|
|
2454
|
+
});
|
|
2455
|
+
const w = await s.getDimensions(a.floating);
|
|
2456
|
+
return v !== w.width || y !== w.height ? {
|
|
2457
|
+
reset: {
|
|
2458
|
+
rects: !0
|
|
2459
|
+
}
|
|
2460
|
+
} : {};
|
|
2461
|
+
}
|
|
2462
|
+
};
|
|
2463
|
+
};
|
|
2464
|
+
function Fe() {
|
|
2465
|
+
return typeof window < "u";
|
|
2466
|
+
}
|
|
2467
|
+
function ge(e) {
|
|
2468
|
+
return pn(e) ? (e.nodeName || "").toLowerCase() : "#document";
|
|
2469
|
+
}
|
|
2470
|
+
function X(e) {
|
|
2471
|
+
var t;
|
|
2472
|
+
return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
|
2473
|
+
}
|
|
2474
|
+
function ne(e) {
|
|
2475
|
+
var t;
|
|
2476
|
+
return (t = (pn(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
|
|
2477
|
+
}
|
|
2478
|
+
function pn(e) {
|
|
2479
|
+
return Fe() ? e instanceof Node || e instanceof X(e).Node : !1;
|
|
2480
|
+
}
|
|
2481
|
+
function G(e) {
|
|
2482
|
+
return Fe() ? e instanceof Element || e instanceof X(e).Element : !1;
|
|
2483
|
+
}
|
|
2484
|
+
function ee(e) {
|
|
2485
|
+
return Fe() ? e instanceof HTMLElement || e instanceof X(e).HTMLElement : !1;
|
|
2486
|
+
}
|
|
2487
|
+
function Mt(e) {
|
|
2488
|
+
return !Fe() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof X(e).ShadowRoot;
|
|
2489
|
+
}
|
|
2490
|
+
const Vo = /* @__PURE__ */ new Set(["inline", "contents"]);
|
|
2491
|
+
function Ce(e) {
|
|
2492
|
+
const {
|
|
2493
|
+
overflow: t,
|
|
2494
|
+
overflowX: n,
|
|
2495
|
+
overflowY: r,
|
|
2496
|
+
display: o
|
|
2497
|
+
} = K(e);
|
|
2498
|
+
return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && !Vo.has(o);
|
|
2499
|
+
}
|
|
2500
|
+
const jo = /* @__PURE__ */ new Set(["table", "td", "th"]);
|
|
2501
|
+
function Yo(e) {
|
|
2502
|
+
return jo.has(ge(e));
|
|
2503
|
+
}
|
|
2504
|
+
const Xo = [":popover-open", ":modal"];
|
|
2505
|
+
function ze(e) {
|
|
2506
|
+
return Xo.some((t) => {
|
|
2507
|
+
try {
|
|
2508
|
+
return e.matches(t);
|
|
2509
|
+
} catch {
|
|
2510
|
+
return !1;
|
|
2511
|
+
}
|
|
2512
|
+
});
|
|
2513
|
+
}
|
|
2514
|
+
const Uo = ["transform", "translate", "scale", "rotate", "perspective"], qo = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Jo = ["paint", "layout", "strict", "content"];
|
|
2515
|
+
function lt(e) {
|
|
2516
|
+
const t = dt(), n = G(e) ? K(e) : e;
|
|
2517
|
+
return Uo.some((r) => n[r] ? n[r] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || qo.some((r) => (n.willChange || "").includes(r)) || Jo.some((r) => (n.contain || "").includes(r));
|
|
2518
|
+
}
|
|
2519
|
+
function Go(e) {
|
|
2520
|
+
let t = ae(e);
|
|
2521
|
+
for (; ee(t) && !fe(t); ) {
|
|
2522
|
+
if (lt(t))
|
|
2523
|
+
return t;
|
|
2524
|
+
if (ze(t))
|
|
2525
|
+
return null;
|
|
2526
|
+
t = ae(t);
|
|
2527
|
+
}
|
|
2528
|
+
return null;
|
|
2529
|
+
}
|
|
2530
|
+
function dt() {
|
|
2531
|
+
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
|
|
2532
|
+
}
|
|
2533
|
+
const Ko = /* @__PURE__ */ new Set(["html", "body", "#document"]);
|
|
2534
|
+
function fe(e) {
|
|
2535
|
+
return Ko.has(ge(e));
|
|
2536
|
+
}
|
|
2537
|
+
function K(e) {
|
|
2538
|
+
return X(e).getComputedStyle(e);
|
|
2539
|
+
}
|
|
2540
|
+
function He(e) {
|
|
2541
|
+
return G(e) ? {
|
|
2542
|
+
scrollLeft: e.scrollLeft,
|
|
2543
|
+
scrollTop: e.scrollTop
|
|
2544
|
+
} : {
|
|
2545
|
+
scrollLeft: e.scrollX,
|
|
2546
|
+
scrollTop: e.scrollY
|
|
2547
|
+
};
|
|
2548
|
+
}
|
|
2549
|
+
function ae(e) {
|
|
2550
|
+
if (ge(e) === "html")
|
|
2551
|
+
return e;
|
|
2552
|
+
const t = (
|
|
2553
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
2554
|
+
e.assignedSlot || // DOM Element detected.
|
|
2555
|
+
e.parentNode || // ShadowRoot detected.
|
|
2556
|
+
Mt(e) && e.host || // Fallback.
|
|
2557
|
+
ne(e)
|
|
2558
|
+
);
|
|
2559
|
+
return Mt(t) ? t.host : t;
|
|
2560
|
+
}
|
|
2561
|
+
function gn(e) {
|
|
2562
|
+
const t = ae(e);
|
|
2563
|
+
return fe(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : ee(t) && Ce(t) ? t : gn(t);
|
|
2564
|
+
}
|
|
2565
|
+
function ye(e, t, n) {
|
|
2566
|
+
var r;
|
|
2567
|
+
t === void 0 && (t = []), n === void 0 && (n = !0);
|
|
2568
|
+
const o = gn(e), i = o === ((r = e.ownerDocument) == null ? void 0 : r.body), s = X(o);
|
|
2569
|
+
if (i) {
|
|
2570
|
+
const a = Je(s);
|
|
2571
|
+
return t.concat(s, s.visualViewport || [], Ce(o) ? o : [], a && n ? ye(a) : []);
|
|
2572
|
+
}
|
|
2573
|
+
return t.concat(o, ye(o, [], n));
|
|
2574
|
+
}
|
|
2575
|
+
function Je(e) {
|
|
2576
|
+
return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
|
|
2577
|
+
}
|
|
2578
|
+
function vn(e) {
|
|
2579
|
+
const t = K(e);
|
|
2580
|
+
let n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0;
|
|
2581
|
+
const o = ee(e), i = o ? e.offsetWidth : n, s = o ? e.offsetHeight : r, a = Oe(n) !== i || Oe(r) !== s;
|
|
2582
|
+
return a && (n = i, r = s), {
|
|
2583
|
+
width: n,
|
|
2584
|
+
height: r,
|
|
2585
|
+
$: a
|
|
2586
|
+
};
|
|
2587
|
+
}
|
|
2588
|
+
function ut(e) {
|
|
2589
|
+
return G(e) ? e : e.contextElement;
|
|
2590
|
+
}
|
|
2591
|
+
function de(e) {
|
|
2592
|
+
const t = ut(e);
|
|
2593
|
+
if (!ee(t))
|
|
2594
|
+
return Q(1);
|
|
2595
|
+
const n = t.getBoundingClientRect(), {
|
|
2596
|
+
width: r,
|
|
2597
|
+
height: o,
|
|
2598
|
+
$: i
|
|
2599
|
+
} = vn(t);
|
|
2600
|
+
let s = (i ? Oe(n.width) : n.width) / r, a = (i ? Oe(n.height) : n.height) / o;
|
|
2601
|
+
return (!s || !Number.isFinite(s)) && (s = 1), (!a || !Number.isFinite(a)) && (a = 1), {
|
|
2602
|
+
x: s,
|
|
2603
|
+
y: a
|
|
2604
|
+
};
|
|
2605
|
+
}
|
|
2606
|
+
const Zo = /* @__PURE__ */ Q(0);
|
|
2607
|
+
function wn(e) {
|
|
2608
|
+
const t = X(e);
|
|
2609
|
+
return !dt() || !t.visualViewport ? Zo : {
|
|
2610
|
+
x: t.visualViewport.offsetLeft,
|
|
2611
|
+
y: t.visualViewport.offsetTop
|
|
2612
|
+
};
|
|
2613
|
+
}
|
|
2614
|
+
function Qo(e, t, n) {
|
|
2615
|
+
return t === void 0 && (t = !1), !n || t && n !== X(e) ? !1 : t;
|
|
2616
|
+
}
|
|
2617
|
+
function le(e, t, n, r) {
|
|
2618
|
+
t === void 0 && (t = !1), n === void 0 && (n = !1);
|
|
2619
|
+
const o = e.getBoundingClientRect(), i = ut(e);
|
|
2620
|
+
let s = Q(1);
|
|
2621
|
+
t && (r ? G(r) && (s = de(r)) : s = de(e));
|
|
2622
|
+
const a = Qo(i, n, r) ? wn(i) : Q(0);
|
|
2623
|
+
let c = (o.left + a.x) / s.x, l = (o.top + a.y) / s.y, d = o.width / s.x, f = o.height / s.y;
|
|
2624
|
+
if (i) {
|
|
2625
|
+
const m = X(i), p = r && G(r) ? X(r) : r;
|
|
2626
|
+
let v = m, y = Je(v);
|
|
2627
|
+
for (; y && r && p !== v; ) {
|
|
2628
|
+
const x = de(y), S = y.getBoundingClientRect(), E = K(y), R = S.left + (y.clientLeft + parseFloat(E.paddingLeft)) * x.x, C = S.top + (y.clientTop + parseFloat(E.paddingTop)) * x.y;
|
|
2629
|
+
c *= x.x, l *= x.y, d *= x.x, f *= x.y, c += R, l += C, v = X(y), y = Je(v);
|
|
2630
|
+
}
|
|
2631
|
+
}
|
|
2632
|
+
return De({
|
|
2633
|
+
width: d,
|
|
2634
|
+
height: f,
|
|
2635
|
+
x: c,
|
|
2636
|
+
y: l
|
|
2637
|
+
});
|
|
2638
|
+
}
|
|
2639
|
+
function ft(e, t) {
|
|
2640
|
+
const n = He(e).scrollLeft;
|
|
2641
|
+
return t ? t.left + n : le(ne(e)).left + n;
|
|
2642
|
+
}
|
|
2643
|
+
function bn(e, t, n) {
|
|
2644
|
+
n === void 0 && (n = !1);
|
|
2645
|
+
const r = e.getBoundingClientRect(), o = r.left + t.scrollLeft - (n ? 0 : (
|
|
2646
|
+
// RTL <body> scrollbar.
|
|
2647
|
+
ft(e, r)
|
|
2648
|
+
)), i = r.top + t.scrollTop;
|
|
2649
|
+
return {
|
|
2650
|
+
x: o,
|
|
2651
|
+
y: i
|
|
2652
|
+
};
|
|
2653
|
+
}
|
|
2654
|
+
function ei(e) {
|
|
2655
|
+
let {
|
|
2656
|
+
elements: t,
|
|
2657
|
+
rect: n,
|
|
2658
|
+
offsetParent: r,
|
|
2659
|
+
strategy: o
|
|
2660
|
+
} = e;
|
|
2661
|
+
const i = o === "fixed", s = ne(r), a = t ? ze(t.floating) : !1;
|
|
2662
|
+
if (r === s || a && i)
|
|
2663
|
+
return n;
|
|
2664
|
+
let c = {
|
|
2665
|
+
scrollLeft: 0,
|
|
2666
|
+
scrollTop: 0
|
|
2667
|
+
}, l = Q(1);
|
|
2668
|
+
const d = Q(0), f = ee(r);
|
|
2669
|
+
if ((f || !f && !i) && ((ge(r) !== "body" || Ce(s)) && (c = He(r)), ee(r))) {
|
|
2670
|
+
const p = le(r);
|
|
2671
|
+
l = de(r), d.x = p.x + r.clientLeft, d.y = p.y + r.clientTop;
|
|
2672
|
+
}
|
|
2673
|
+
const m = s && !f && !i ? bn(s, c, !0) : Q(0);
|
|
2674
|
+
return {
|
|
2675
|
+
width: n.width * l.x,
|
|
2676
|
+
height: n.height * l.y,
|
|
2677
|
+
x: n.x * l.x - c.scrollLeft * l.x + d.x + m.x,
|
|
2678
|
+
y: n.y * l.y - c.scrollTop * l.y + d.y + m.y
|
|
2679
|
+
};
|
|
2680
|
+
}
|
|
2681
|
+
function ti(e) {
|
|
2682
|
+
return Array.from(e.getClientRects());
|
|
2683
|
+
}
|
|
2684
|
+
function ni(e) {
|
|
2685
|
+
const t = ne(e), n = He(e), r = e.ownerDocument.body, o = Y(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), i = Y(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight);
|
|
2686
|
+
let s = -n.scrollLeft + ft(e);
|
|
2687
|
+
const a = -n.scrollTop;
|
|
2688
|
+
return K(r).direction === "rtl" && (s += Y(t.clientWidth, r.clientWidth) - o), {
|
|
2689
|
+
width: o,
|
|
2690
|
+
height: i,
|
|
2691
|
+
x: s,
|
|
2692
|
+
y: a
|
|
2693
|
+
};
|
|
2694
|
+
}
|
|
2695
|
+
function ri(e, t) {
|
|
2696
|
+
const n = X(e), r = ne(e), o = n.visualViewport;
|
|
2697
|
+
let i = r.clientWidth, s = r.clientHeight, a = 0, c = 0;
|
|
2698
|
+
if (o) {
|
|
2699
|
+
i = o.width, s = o.height;
|
|
2700
|
+
const l = dt();
|
|
2701
|
+
(!l || l && t === "fixed") && (a = o.offsetLeft, c = o.offsetTop);
|
|
2702
|
+
}
|
|
2703
|
+
return {
|
|
2704
|
+
width: i,
|
|
2705
|
+
height: s,
|
|
2706
|
+
x: a,
|
|
2707
|
+
y: c
|
|
2708
|
+
};
|
|
2709
|
+
}
|
|
2710
|
+
const oi = /* @__PURE__ */ new Set(["absolute", "fixed"]);
|
|
2711
|
+
function ii(e, t) {
|
|
2712
|
+
const n = le(e, !0, t === "fixed"), r = n.top + e.clientTop, o = n.left + e.clientLeft, i = ee(e) ? de(e) : Q(1), s = e.clientWidth * i.x, a = e.clientHeight * i.y, c = o * i.x, l = r * i.y;
|
|
2713
|
+
return {
|
|
2714
|
+
width: s,
|
|
2715
|
+
height: a,
|
|
2716
|
+
x: c,
|
|
2717
|
+
y: l
|
|
2718
|
+
};
|
|
2719
|
+
}
|
|
2720
|
+
function It(e, t, n) {
|
|
2721
|
+
let r;
|
|
2722
|
+
if (t === "viewport")
|
|
2723
|
+
r = ri(e, n);
|
|
2724
|
+
else if (t === "document")
|
|
2725
|
+
r = ni(ne(e));
|
|
2726
|
+
else if (G(t))
|
|
2727
|
+
r = ii(t, n);
|
|
2728
|
+
else {
|
|
2729
|
+
const o = wn(e);
|
|
2730
|
+
r = {
|
|
2731
|
+
x: t.x - o.x,
|
|
2732
|
+
y: t.y - o.y,
|
|
2733
|
+
width: t.width,
|
|
2734
|
+
height: t.height
|
|
2735
|
+
};
|
|
2736
|
+
}
|
|
2737
|
+
return De(r);
|
|
2738
|
+
}
|
|
2739
|
+
function yn(e, t) {
|
|
2740
|
+
const n = ae(e);
|
|
2741
|
+
return n === t || !G(n) || fe(n) ? !1 : K(n).position === "fixed" || yn(n, t);
|
|
2742
|
+
}
|
|
2743
|
+
function si(e, t) {
|
|
2744
|
+
const n = t.get(e);
|
|
2745
|
+
if (n)
|
|
2746
|
+
return n;
|
|
2747
|
+
let r = ye(e, [], !1).filter((a) => G(a) && ge(a) !== "body"), o = null;
|
|
2748
|
+
const i = K(e).position === "fixed";
|
|
2749
|
+
let s = i ? ae(e) : e;
|
|
2750
|
+
for (; G(s) && !fe(s); ) {
|
|
2751
|
+
const a = K(s), c = lt(s);
|
|
2752
|
+
!c && a.position === "fixed" && (o = null), (i ? !c && !o : !c && a.position === "static" && !!o && oi.has(o.position) || Ce(s) && !c && yn(e, s)) ? r = r.filter((d) => d !== s) : o = a, s = ae(s);
|
|
2753
|
+
}
|
|
2754
|
+
return t.set(e, r), r;
|
|
2755
|
+
}
|
|
2756
|
+
function ai(e) {
|
|
2757
|
+
let {
|
|
2758
|
+
element: t,
|
|
2759
|
+
boundary: n,
|
|
2760
|
+
rootBoundary: r,
|
|
2761
|
+
strategy: o
|
|
2762
|
+
} = e;
|
|
2763
|
+
const s = [...n === "clippingAncestors" ? ze(t) ? [] : si(t, this._c) : [].concat(n), r], a = s[0], c = s.reduce((l, d) => {
|
|
2764
|
+
const f = It(t, d, o);
|
|
2765
|
+
return l.top = Y(f.top, l.top), l.right = se(f.right, l.right), l.bottom = se(f.bottom, l.bottom), l.left = Y(f.left, l.left), l;
|
|
2766
|
+
}, It(t, a, o));
|
|
2767
|
+
return {
|
|
2768
|
+
width: c.right - c.left,
|
|
2769
|
+
height: c.bottom - c.top,
|
|
2770
|
+
x: c.left,
|
|
2771
|
+
y: c.top
|
|
2772
|
+
};
|
|
2773
|
+
}
|
|
2774
|
+
function ci(e) {
|
|
2775
|
+
const {
|
|
2776
|
+
width: t,
|
|
2777
|
+
height: n
|
|
2778
|
+
} = vn(e);
|
|
2779
|
+
return {
|
|
2780
|
+
width: t,
|
|
2781
|
+
height: n
|
|
2782
|
+
};
|
|
2783
|
+
}
|
|
2784
|
+
function li(e, t, n) {
|
|
2785
|
+
const r = ee(t), o = ne(t), i = n === "fixed", s = le(e, !0, i, t);
|
|
2786
|
+
let a = {
|
|
2787
|
+
scrollLeft: 0,
|
|
2788
|
+
scrollTop: 0
|
|
2789
|
+
};
|
|
2790
|
+
const c = Q(0);
|
|
2791
|
+
function l() {
|
|
2792
|
+
c.x = ft(o);
|
|
2793
|
+
}
|
|
2794
|
+
if (r || !r && !i)
|
|
2795
|
+
if ((ge(t) !== "body" || Ce(o)) && (a = He(t)), r) {
|
|
2796
|
+
const p = le(t, !0, i, t);
|
|
2797
|
+
c.x = p.x + t.clientLeft, c.y = p.y + t.clientTop;
|
|
2798
|
+
} else o && l();
|
|
2799
|
+
i && !r && o && l();
|
|
2800
|
+
const d = o && !r && !i ? bn(o, a) : Q(0), f = s.left + a.scrollLeft - c.x - d.x, m = s.top + a.scrollTop - c.y - d.y;
|
|
2801
|
+
return {
|
|
2802
|
+
x: f,
|
|
2803
|
+
y: m,
|
|
2804
|
+
width: s.width,
|
|
2805
|
+
height: s.height
|
|
2806
|
+
};
|
|
2807
|
+
}
|
|
2808
|
+
function je(e) {
|
|
2809
|
+
return K(e).position === "static";
|
|
2810
|
+
}
|
|
2811
|
+
function $t(e, t) {
|
|
2812
|
+
if (!ee(e) || K(e).position === "fixed")
|
|
2813
|
+
return null;
|
|
2814
|
+
if (t)
|
|
2815
|
+
return t(e);
|
|
2816
|
+
let n = e.offsetParent;
|
|
2817
|
+
return ne(e) === n && (n = n.ownerDocument.body), n;
|
|
2818
|
+
}
|
|
2819
|
+
function xn(e, t) {
|
|
2820
|
+
const n = X(e);
|
|
2821
|
+
if (ze(e))
|
|
2822
|
+
return n;
|
|
2823
|
+
if (!ee(e)) {
|
|
2824
|
+
let o = ae(e);
|
|
2825
|
+
for (; o && !fe(o); ) {
|
|
2826
|
+
if (G(o) && !je(o))
|
|
2827
|
+
return o;
|
|
2828
|
+
o = ae(o);
|
|
2829
|
+
}
|
|
2830
|
+
return n;
|
|
2831
|
+
}
|
|
2832
|
+
let r = $t(e, t);
|
|
2833
|
+
for (; r && Yo(r) && je(r); )
|
|
2834
|
+
r = $t(r, t);
|
|
2835
|
+
return r && fe(r) && je(r) && !lt(r) ? n : r || Go(e) || n;
|
|
2836
|
+
}
|
|
2837
|
+
const di = async function(e) {
|
|
2838
|
+
const t = this.getOffsetParent || xn, n = this.getDimensions, r = await n(e.floating);
|
|
2839
|
+
return {
|
|
2840
|
+
reference: li(e.reference, await t(e.floating), e.strategy),
|
|
2841
|
+
floating: {
|
|
2842
|
+
x: 0,
|
|
2843
|
+
y: 0,
|
|
2844
|
+
width: r.width,
|
|
2845
|
+
height: r.height
|
|
2846
|
+
}
|
|
2847
|
+
};
|
|
2848
|
+
};
|
|
2849
|
+
function ui(e) {
|
|
2850
|
+
return K(e).direction === "rtl";
|
|
2851
|
+
}
|
|
2852
|
+
const fi = {
|
|
2853
|
+
convertOffsetParentRelativeRectToViewportRelativeRect: ei,
|
|
2854
|
+
getDocumentElement: ne,
|
|
2855
|
+
getClippingRect: ai,
|
|
2856
|
+
getOffsetParent: xn,
|
|
2857
|
+
getElementRects: di,
|
|
2858
|
+
getClientRects: ti,
|
|
2859
|
+
getDimensions: ci,
|
|
2860
|
+
getScale: de,
|
|
2861
|
+
isElement: G,
|
|
2862
|
+
isRTL: ui
|
|
2863
|
+
};
|
|
2864
|
+
function Cn(e, t) {
|
|
2865
|
+
return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
|
|
2866
|
+
}
|
|
2867
|
+
function hi(e, t) {
|
|
2868
|
+
let n = null, r;
|
|
2869
|
+
const o = ne(e);
|
|
2870
|
+
function i() {
|
|
2871
|
+
var a;
|
|
2872
|
+
clearTimeout(r), (a = n) == null || a.disconnect(), n = null;
|
|
2873
|
+
}
|
|
2874
|
+
function s(a, c) {
|
|
2875
|
+
a === void 0 && (a = !1), c === void 0 && (c = 1), i();
|
|
2876
|
+
const l = e.getBoundingClientRect(), {
|
|
2877
|
+
left: d,
|
|
2878
|
+
top: f,
|
|
2879
|
+
width: m,
|
|
2880
|
+
height: p
|
|
2881
|
+
} = l;
|
|
2882
|
+
if (a || t(), !m || !p)
|
|
2883
|
+
return;
|
|
2884
|
+
const v = Pe(f), y = Pe(o.clientWidth - (d + m)), x = Pe(o.clientHeight - (f + p)), S = Pe(d), R = {
|
|
2885
|
+
rootMargin: -v + "px " + -y + "px " + -x + "px " + -S + "px",
|
|
2886
|
+
threshold: Y(0, se(1, c)) || 1
|
|
2887
|
+
};
|
|
2888
|
+
let C = !0;
|
|
2889
|
+
function T(A) {
|
|
2890
|
+
const P = A[0].intersectionRatio;
|
|
2891
|
+
if (P !== c) {
|
|
2892
|
+
if (!C)
|
|
2893
|
+
return s();
|
|
2894
|
+
P ? s(!1, P) : r = setTimeout(() => {
|
|
2895
|
+
s(!1, 1e-7);
|
|
2896
|
+
}, 1e3);
|
|
2897
|
+
}
|
|
2898
|
+
P === 1 && !Cn(l, e.getBoundingClientRect()) && s(), C = !1;
|
|
2899
|
+
}
|
|
2900
|
+
try {
|
|
2901
|
+
n = new IntersectionObserver(T, {
|
|
2902
|
+
...R,
|
|
2903
|
+
// Handle <iframe>s
|
|
2904
|
+
root: o.ownerDocument
|
|
2905
|
+
});
|
|
2906
|
+
} catch {
|
|
2907
|
+
n = new IntersectionObserver(T, R);
|
|
2908
|
+
}
|
|
2909
|
+
n.observe(e);
|
|
2910
|
+
}
|
|
2911
|
+
return s(!0), i;
|
|
2912
|
+
}
|
|
2913
|
+
function mi(e, t, n, r) {
|
|
2914
|
+
r === void 0 && (r = {});
|
|
2915
|
+
const {
|
|
2916
|
+
ancestorScroll: o = !0,
|
|
2917
|
+
ancestorResize: i = !0,
|
|
2918
|
+
elementResize: s = typeof ResizeObserver == "function",
|
|
2919
|
+
layoutShift: a = typeof IntersectionObserver == "function",
|
|
2920
|
+
animationFrame: c = !1
|
|
2921
|
+
} = r, l = ut(e), d = o || i ? [...l ? ye(l) : [], ...ye(t)] : [];
|
|
2922
|
+
d.forEach((S) => {
|
|
2923
|
+
o && S.addEventListener("scroll", n, {
|
|
2924
|
+
passive: !0
|
|
2925
|
+
}), i && S.addEventListener("resize", n);
|
|
2926
|
+
});
|
|
2927
|
+
const f = l && a ? hi(l, n) : null;
|
|
2928
|
+
let m = -1, p = null;
|
|
2929
|
+
s && (p = new ResizeObserver((S) => {
|
|
2930
|
+
let [E] = S;
|
|
2931
|
+
E && E.target === l && p && (p.unobserve(t), cancelAnimationFrame(m), m = requestAnimationFrame(() => {
|
|
2932
|
+
var R;
|
|
2933
|
+
(R = p) == null || R.observe(t);
|
|
2934
|
+
})), n();
|
|
2935
|
+
}), l && !c && p.observe(l), p.observe(t));
|
|
2936
|
+
let v, y = c ? le(e) : null;
|
|
2937
|
+
c && x();
|
|
2938
|
+
function x() {
|
|
2939
|
+
const S = le(e);
|
|
2940
|
+
y && !Cn(y, S) && n(), y = S, v = requestAnimationFrame(x);
|
|
2941
|
+
}
|
|
2942
|
+
return n(), () => {
|
|
2943
|
+
var S;
|
|
2944
|
+
d.forEach((E) => {
|
|
2945
|
+
o && E.removeEventListener("scroll", n), i && E.removeEventListener("resize", n);
|
|
2946
|
+
}), f == null || f(), (S = p) == null || S.disconnect(), p = null, c && cancelAnimationFrame(v);
|
|
2947
|
+
};
|
|
2948
|
+
}
|
|
2949
|
+
const pi = zo, gi = Ho, vi = Io, wi = Bo, bi = $o, Ft = Mo, yi = Wo, xi = (e, t, n) => {
|
|
2950
|
+
const r = /* @__PURE__ */ new Map(), o = {
|
|
2951
|
+
platform: fi,
|
|
2952
|
+
...n
|
|
2953
|
+
}, i = {
|
|
2954
|
+
...o.platform,
|
|
2955
|
+
_c: r
|
|
2956
|
+
};
|
|
2957
|
+
return ko(e, t, {
|
|
2958
|
+
...o,
|
|
2959
|
+
platform: i
|
|
2960
|
+
});
|
|
2961
|
+
};
|
|
2962
|
+
var Ci = typeof document < "u", Si = function() {
|
|
2963
|
+
}, Re = Ci ? nr : Si;
|
|
2964
|
+
function _e(e, t) {
|
|
2965
|
+
if (e === t)
|
|
2966
|
+
return !0;
|
|
2967
|
+
if (typeof e != typeof t)
|
|
2968
|
+
return !1;
|
|
2969
|
+
if (typeof e == "function" && e.toString() === t.toString())
|
|
2970
|
+
return !0;
|
|
2971
|
+
let n, r, o;
|
|
2972
|
+
if (e && t && typeof e == "object") {
|
|
2973
|
+
if (Array.isArray(e)) {
|
|
2974
|
+
if (n = e.length, n !== t.length) return !1;
|
|
2975
|
+
for (r = n; r-- !== 0; )
|
|
2976
|
+
if (!_e(e[r], t[r]))
|
|
2977
|
+
return !1;
|
|
2978
|
+
return !0;
|
|
2979
|
+
}
|
|
2980
|
+
if (o = Object.keys(e), n = o.length, n !== Object.keys(t).length)
|
|
2981
|
+
return !1;
|
|
2982
|
+
for (r = n; r-- !== 0; )
|
|
2983
|
+
if (!{}.hasOwnProperty.call(t, o[r]))
|
|
2984
|
+
return !1;
|
|
2985
|
+
for (r = n; r-- !== 0; ) {
|
|
2986
|
+
const i = o[r];
|
|
2987
|
+
if (!(i === "_owner" && e.$$typeof) && !_e(e[i], t[i]))
|
|
2988
|
+
return !1;
|
|
2989
|
+
}
|
|
2990
|
+
return !0;
|
|
2991
|
+
}
|
|
2992
|
+
return e !== e && t !== t;
|
|
2993
|
+
}
|
|
2994
|
+
function Sn(e) {
|
|
2995
|
+
return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
|
|
2996
|
+
}
|
|
2997
|
+
function zt(e, t) {
|
|
2998
|
+
const n = Sn(e);
|
|
2999
|
+
return Math.round(t * n) / n;
|
|
3000
|
+
}
|
|
3001
|
+
function Ye(e) {
|
|
3002
|
+
const t = u.useRef(e);
|
|
3003
|
+
return Re(() => {
|
|
3004
|
+
t.current = e;
|
|
3005
|
+
}), t;
|
|
3006
|
+
}
|
|
3007
|
+
function Ti(e) {
|
|
3008
|
+
e === void 0 && (e = {});
|
|
3009
|
+
const {
|
|
3010
|
+
placement: t = "bottom",
|
|
3011
|
+
strategy: n = "absolute",
|
|
3012
|
+
middleware: r = [],
|
|
3013
|
+
platform: o,
|
|
3014
|
+
elements: {
|
|
3015
|
+
reference: i,
|
|
3016
|
+
floating: s
|
|
3017
|
+
} = {},
|
|
3018
|
+
transform: a = !0,
|
|
3019
|
+
whileElementsMounted: c,
|
|
3020
|
+
open: l
|
|
3021
|
+
} = e, [d, f] = u.useState({
|
|
3022
|
+
x: 0,
|
|
3023
|
+
y: 0,
|
|
3024
|
+
strategy: n,
|
|
3025
|
+
placement: t,
|
|
3026
|
+
middlewareData: {},
|
|
3027
|
+
isPositioned: !1
|
|
3028
|
+
}), [m, p] = u.useState(r);
|
|
3029
|
+
_e(m, r) || p(r);
|
|
3030
|
+
const [v, y] = u.useState(null), [x, S] = u.useState(null), E = u.useCallback((O) => {
|
|
3031
|
+
O !== A.current && (A.current = O, y(O));
|
|
3032
|
+
}, []), R = u.useCallback((O) => {
|
|
3033
|
+
O !== P.current && (P.current = O, S(O));
|
|
3034
|
+
}, []), C = i || v, T = s || x, A = u.useRef(null), P = u.useRef(null), b = u.useRef(d), w = c != null, g = Ye(c), N = Ye(o), D = Ye(l), k = u.useCallback(() => {
|
|
3035
|
+
if (!A.current || !P.current)
|
|
3036
|
+
return;
|
|
3037
|
+
const O = {
|
|
3038
|
+
placement: t,
|
|
3039
|
+
strategy: n,
|
|
3040
|
+
middleware: m
|
|
3041
|
+
};
|
|
3042
|
+
N.current && (O.platform = N.current), xi(A.current, P.current, O).then(($) => {
|
|
3043
|
+
const W = {
|
|
3044
|
+
...$,
|
|
3045
|
+
// The floating element's position may be recomputed while it's closed
|
|
3046
|
+
// but still mounted (such as when transitioning out). To ensure
|
|
3047
|
+
// `isPositioned` will be `false` initially on the next open, avoid
|
|
3048
|
+
// setting it to `true` when `open === false` (must be specified).
|
|
3049
|
+
isPositioned: D.current !== !1
|
|
3050
|
+
};
|
|
3051
|
+
I.current && !_e(b.current, W) && (b.current = W, Wt.flushSync(() => {
|
|
3052
|
+
f(W);
|
|
3053
|
+
}));
|
|
3054
|
+
});
|
|
3055
|
+
}, [m, t, n, N, D]);
|
|
3056
|
+
Re(() => {
|
|
3057
|
+
l === !1 && b.current.isPositioned && (b.current.isPositioned = !1, f((O) => ({
|
|
3058
|
+
...O,
|
|
3059
|
+
isPositioned: !1
|
|
3060
|
+
})));
|
|
3061
|
+
}, [l]);
|
|
3062
|
+
const I = u.useRef(!1);
|
|
3063
|
+
Re(() => (I.current = !0, () => {
|
|
3064
|
+
I.current = !1;
|
|
3065
|
+
}), []), Re(() => {
|
|
3066
|
+
if (C && (A.current = C), T && (P.current = T), C && T) {
|
|
3067
|
+
if (g.current)
|
|
3068
|
+
return g.current(C, T, k);
|
|
3069
|
+
k();
|
|
3070
|
+
}
|
|
3071
|
+
}, [C, T, k, g, w]);
|
|
3072
|
+
const F = u.useMemo(() => ({
|
|
3073
|
+
reference: A,
|
|
3074
|
+
floating: P,
|
|
3075
|
+
setReference: E,
|
|
3076
|
+
setFloating: R
|
|
3077
|
+
}), [E, R]), M = u.useMemo(() => ({
|
|
3078
|
+
reference: C,
|
|
3079
|
+
floating: T
|
|
3080
|
+
}), [C, T]), _ = u.useMemo(() => {
|
|
3081
|
+
const O = {
|
|
3082
|
+
position: n,
|
|
3083
|
+
left: 0,
|
|
3084
|
+
top: 0
|
|
3085
|
+
};
|
|
3086
|
+
if (!M.floating)
|
|
3087
|
+
return O;
|
|
3088
|
+
const $ = zt(M.floating, d.x), W = zt(M.floating, d.y);
|
|
3089
|
+
return a ? {
|
|
3090
|
+
...O,
|
|
3091
|
+
transform: "translate(" + $ + "px, " + W + "px)",
|
|
3092
|
+
...Sn(M.floating) >= 1.5 && {
|
|
3093
|
+
willChange: "transform"
|
|
3094
|
+
}
|
|
3095
|
+
} : {
|
|
3096
|
+
position: n,
|
|
3097
|
+
left: $,
|
|
3098
|
+
top: W
|
|
3099
|
+
};
|
|
3100
|
+
}, [n, a, M.floating, d.x, d.y]);
|
|
3101
|
+
return u.useMemo(() => ({
|
|
3102
|
+
...d,
|
|
3103
|
+
update: k,
|
|
3104
|
+
refs: F,
|
|
3105
|
+
elements: M,
|
|
3106
|
+
floatingStyles: _
|
|
3107
|
+
}), [d, k, F, M, _]);
|
|
3108
|
+
}
|
|
3109
|
+
const Ei = (e) => {
|
|
3110
|
+
function t(n) {
|
|
3111
|
+
return {}.hasOwnProperty.call(n, "current");
|
|
3112
|
+
}
|
|
3113
|
+
return {
|
|
3114
|
+
name: "arrow",
|
|
3115
|
+
options: e,
|
|
3116
|
+
fn(n) {
|
|
3117
|
+
const {
|
|
3118
|
+
element: r,
|
|
3119
|
+
padding: o
|
|
3120
|
+
} = typeof e == "function" ? e(n) : e;
|
|
3121
|
+
return r && t(r) ? r.current != null ? Ft({
|
|
3122
|
+
element: r.current,
|
|
3123
|
+
padding: o
|
|
3124
|
+
}).fn(n) : {} : r ? Ft({
|
|
3125
|
+
element: r,
|
|
3126
|
+
padding: o
|
|
3127
|
+
}).fn(n) : {};
|
|
3128
|
+
}
|
|
3129
|
+
};
|
|
3130
|
+
}, Pi = (e, t) => ({
|
|
3131
|
+
...pi(e),
|
|
3132
|
+
options: [e, t]
|
|
3133
|
+
}), Ri = (e, t) => ({
|
|
3134
|
+
...gi(e),
|
|
3135
|
+
options: [e, t]
|
|
3136
|
+
}), Ni = (e, t) => ({
|
|
3137
|
+
...yi(e),
|
|
3138
|
+
options: [e, t]
|
|
3139
|
+
}), Ai = (e, t) => ({
|
|
3140
|
+
...vi(e),
|
|
3141
|
+
options: [e, t]
|
|
3142
|
+
}), Oi = (e, t) => ({
|
|
3143
|
+
...wi(e),
|
|
3144
|
+
options: [e, t]
|
|
3145
|
+
}), Li = (e, t) => ({
|
|
3146
|
+
...bi(e),
|
|
3147
|
+
options: [e, t]
|
|
3148
|
+
}), Di = (e, t) => ({
|
|
3149
|
+
...Ei(e),
|
|
3150
|
+
options: [e, t]
|
|
3151
|
+
});
|
|
3152
|
+
var _i = "Arrow", Tn = u.forwardRef((e, t) => {
|
|
3153
|
+
const { children: n, width: r = 10, height: o = 5, ...i } = e;
|
|
3154
|
+
return /* @__PURE__ */ h(
|
|
3155
|
+
j.svg,
|
|
3156
|
+
{
|
|
3157
|
+
...i,
|
|
3158
|
+
ref: t,
|
|
3159
|
+
width: r,
|
|
3160
|
+
height: o,
|
|
3161
|
+
viewBox: "0 0 30 10",
|
|
3162
|
+
preserveAspectRatio: "none",
|
|
3163
|
+
children: e.asChild ? n : /* @__PURE__ */ h("polygon", { points: "0,0 30,0 15,10" })
|
|
3164
|
+
}
|
|
3165
|
+
);
|
|
3166
|
+
});
|
|
3167
|
+
Tn.displayName = _i;
|
|
3168
|
+
var ki = Tn;
|
|
3169
|
+
function Mi(e) {
|
|
3170
|
+
const [t, n] = u.useState(void 0);
|
|
3171
|
+
return ie(() => {
|
|
3172
|
+
if (e) {
|
|
3173
|
+
n({ width: e.offsetWidth, height: e.offsetHeight });
|
|
3174
|
+
const r = new ResizeObserver((o) => {
|
|
3175
|
+
if (!Array.isArray(o) || !o.length)
|
|
3176
|
+
return;
|
|
3177
|
+
const i = o[0];
|
|
3178
|
+
let s, a;
|
|
3179
|
+
if ("borderBoxSize" in i) {
|
|
3180
|
+
const c = i.borderBoxSize, l = Array.isArray(c) ? c[0] : c;
|
|
3181
|
+
s = l.inlineSize, a = l.blockSize;
|
|
3182
|
+
} else
|
|
3183
|
+
s = e.offsetWidth, a = e.offsetHeight;
|
|
3184
|
+
n({ width: s, height: a });
|
|
3185
|
+
});
|
|
3186
|
+
return r.observe(e, { box: "border-box" }), () => r.unobserve(e);
|
|
3187
|
+
} else
|
|
3188
|
+
n(void 0);
|
|
3189
|
+
}, [e]), t;
|
|
3190
|
+
}
|
|
3191
|
+
var ht = "Popper", [En, Pn] = tt(ht), [Ii, Rn] = En(ht), Nn = (e) => {
|
|
3192
|
+
const { __scopePopper: t, children: n } = e, [r, o] = u.useState(null);
|
|
3193
|
+
return /* @__PURE__ */ h(Ii, { scope: t, anchor: r, onAnchorChange: o, children: n });
|
|
3194
|
+
};
|
|
3195
|
+
Nn.displayName = ht;
|
|
3196
|
+
var An = "PopperAnchor", On = u.forwardRef(
|
|
3197
|
+
(e, t) => {
|
|
3198
|
+
const { __scopePopper: n, virtualRef: r, ...o } = e, i = Rn(An, n), s = u.useRef(null), a = U(t, s);
|
|
3199
|
+
return u.useEffect(() => {
|
|
3200
|
+
i.onAnchorChange((r == null ? void 0 : r.current) || s.current);
|
|
3201
|
+
}), r ? null : /* @__PURE__ */ h(j.div, { ...o, ref: a });
|
|
3202
|
+
}
|
|
3203
|
+
);
|
|
3204
|
+
On.displayName = An;
|
|
3205
|
+
var mt = "PopperContent", [$i, Fi] = En(mt), Ln = u.forwardRef(
|
|
3206
|
+
(e, t) => {
|
|
3207
|
+
var gt, vt, wt, bt, yt, xt;
|
|
3208
|
+
const {
|
|
3209
|
+
__scopePopper: n,
|
|
3210
|
+
side: r = "bottom",
|
|
3211
|
+
sideOffset: o = 0,
|
|
3212
|
+
align: i = "center",
|
|
3213
|
+
alignOffset: s = 0,
|
|
3214
|
+
arrowPadding: a = 0,
|
|
3215
|
+
avoidCollisions: c = !0,
|
|
3216
|
+
collisionBoundary: l = [],
|
|
3217
|
+
collisionPadding: d = 0,
|
|
3218
|
+
sticky: f = "partial",
|
|
3219
|
+
hideWhenDetached: m = !1,
|
|
3220
|
+
updatePositionStrategy: p = "optimized",
|
|
3221
|
+
onPlaced: v,
|
|
3222
|
+
...y
|
|
3223
|
+
} = e, x = Rn(mt, n), [S, E] = u.useState(null), R = U(t, (ve) => E(ve)), [C, T] = u.useState(null), A = Mi(C), P = (A == null ? void 0 : A.width) ?? 0, b = (A == null ? void 0 : A.height) ?? 0, w = r + (i !== "center" ? "-" + i : ""), g = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, N = Array.isArray(l) ? l : [l], D = N.length > 0, k = {
|
|
3224
|
+
padding: g,
|
|
3225
|
+
boundary: N.filter(Hi),
|
|
3226
|
+
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
3227
|
+
altBoundary: D
|
|
3228
|
+
}, { refs: I, floatingStyles: F, placement: M, isPositioned: _, middlewareData: O } = Ti({
|
|
3229
|
+
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
3230
|
+
strategy: "fixed",
|
|
3231
|
+
placement: w,
|
|
3232
|
+
whileElementsMounted: (...ve) => mi(...ve, {
|
|
3233
|
+
animationFrame: p === "always"
|
|
3234
|
+
}),
|
|
3235
|
+
elements: {
|
|
3236
|
+
reference: x.anchor
|
|
3237
|
+
},
|
|
3238
|
+
middleware: [
|
|
3239
|
+
Pi({ mainAxis: o + b, alignmentAxis: s }),
|
|
3240
|
+
c && Ri({
|
|
3241
|
+
mainAxis: !0,
|
|
3242
|
+
crossAxis: !1,
|
|
3243
|
+
limiter: f === "partial" ? Ni() : void 0,
|
|
3244
|
+
...k
|
|
3245
|
+
}),
|
|
3246
|
+
c && Ai({ ...k }),
|
|
3247
|
+
Oi({
|
|
3248
|
+
...k,
|
|
3249
|
+
apply: ({ elements: ve, rects: Ct, availableWidth: Jn, availableHeight: Gn }) => {
|
|
3250
|
+
const { width: Kn, height: Zn } = Ct.reference, Te = ve.floating.style;
|
|
3251
|
+
Te.setProperty("--radix-popper-available-width", `${Jn}px`), Te.setProperty("--radix-popper-available-height", `${Gn}px`), Te.setProperty("--radix-popper-anchor-width", `${Kn}px`), Te.setProperty("--radix-popper-anchor-height", `${Zn}px`);
|
|
3252
|
+
}
|
|
3253
|
+
}),
|
|
3254
|
+
C && Di({ element: C, padding: a }),
|
|
3255
|
+
Wi({ arrowWidth: P, arrowHeight: b }),
|
|
3256
|
+
m && Li({ strategy: "referenceHidden", ...k })
|
|
3257
|
+
]
|
|
3258
|
+
}), [$, W] = kn(M), Se = J(v);
|
|
3259
|
+
ie(() => {
|
|
3260
|
+
_ && (Se == null || Se());
|
|
3261
|
+
}, [_, Se]);
|
|
3262
|
+
const jn = (gt = O.arrow) == null ? void 0 : gt.x, Yn = (vt = O.arrow) == null ? void 0 : vt.y, Xn = ((wt = O.arrow) == null ? void 0 : wt.centerOffset) !== 0, [Un, qn] = u.useState();
|
|
3263
|
+
return ie(() => {
|
|
3264
|
+
S && qn(window.getComputedStyle(S).zIndex);
|
|
3265
|
+
}, [S]), /* @__PURE__ */ h(
|
|
3266
|
+
"div",
|
|
3267
|
+
{
|
|
3268
|
+
ref: I.setFloating,
|
|
3269
|
+
"data-radix-popper-content-wrapper": "",
|
|
3270
|
+
style: {
|
|
3271
|
+
...F,
|
|
3272
|
+
transform: _ ? F.transform : "translate(0, -200%)",
|
|
3273
|
+
// keep off the page when measuring
|
|
3274
|
+
minWidth: "max-content",
|
|
3275
|
+
zIndex: Un,
|
|
3276
|
+
"--radix-popper-transform-origin": [
|
|
3277
|
+
(bt = O.transformOrigin) == null ? void 0 : bt.x,
|
|
3278
|
+
(yt = O.transformOrigin) == null ? void 0 : yt.y
|
|
3279
|
+
].join(" "),
|
|
3280
|
+
// hide the content if using the hide middleware and should be hidden
|
|
3281
|
+
// set visibility to hidden and disable pointer events so the UI behaves
|
|
3282
|
+
// as if the PopperContent isn't there at all
|
|
3283
|
+
...((xt = O.hide) == null ? void 0 : xt.referenceHidden) && {
|
|
3284
|
+
visibility: "hidden",
|
|
3285
|
+
pointerEvents: "none"
|
|
3286
|
+
}
|
|
3287
|
+
},
|
|
3288
|
+
dir: e.dir,
|
|
3289
|
+
children: /* @__PURE__ */ h(
|
|
3290
|
+
$i,
|
|
3291
|
+
{
|
|
3292
|
+
scope: n,
|
|
3293
|
+
placedSide: $,
|
|
3294
|
+
onArrowChange: T,
|
|
3295
|
+
arrowX: jn,
|
|
3296
|
+
arrowY: Yn,
|
|
3297
|
+
shouldHideArrow: Xn,
|
|
3298
|
+
children: /* @__PURE__ */ h(
|
|
3299
|
+
j.div,
|
|
3300
|
+
{
|
|
3301
|
+
"data-side": $,
|
|
3302
|
+
"data-align": W,
|
|
3303
|
+
...y,
|
|
3304
|
+
ref: R,
|
|
3305
|
+
style: {
|
|
3306
|
+
...y.style,
|
|
3307
|
+
// if the PopperContent hasn't been placed yet (not all measurements done)
|
|
3308
|
+
// we prevent animations so that users's animation don't kick in too early referring wrong sides
|
|
3309
|
+
animation: _ ? void 0 : "none"
|
|
3310
|
+
}
|
|
3311
|
+
}
|
|
3312
|
+
)
|
|
3313
|
+
}
|
|
3314
|
+
)
|
|
3315
|
+
}
|
|
3316
|
+
);
|
|
3317
|
+
}
|
|
3318
|
+
);
|
|
3319
|
+
Ln.displayName = mt;
|
|
3320
|
+
var Dn = "PopperArrow", zi = {
|
|
3321
|
+
top: "bottom",
|
|
3322
|
+
right: "left",
|
|
3323
|
+
bottom: "top",
|
|
3324
|
+
left: "right"
|
|
3325
|
+
}, _n = u.forwardRef(function(t, n) {
|
|
3326
|
+
const { __scopePopper: r, ...o } = t, i = Fi(Dn, r), s = zi[i.placedSide];
|
|
3327
|
+
return (
|
|
3328
|
+
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
3329
|
+
// doesn't report size as we'd expect on SVG elements.
|
|
3330
|
+
// it reports their bounding box which is effectively the largest path inside the SVG.
|
|
3331
|
+
/* @__PURE__ */ h(
|
|
3332
|
+
"span",
|
|
3333
|
+
{
|
|
3334
|
+
ref: i.onArrowChange,
|
|
3335
|
+
style: {
|
|
3336
|
+
position: "absolute",
|
|
3337
|
+
left: i.arrowX,
|
|
3338
|
+
top: i.arrowY,
|
|
3339
|
+
[s]: 0,
|
|
3340
|
+
transformOrigin: {
|
|
3341
|
+
top: "",
|
|
3342
|
+
right: "0 0",
|
|
3343
|
+
bottom: "center 0",
|
|
3344
|
+
left: "100% 0"
|
|
3345
|
+
}[i.placedSide],
|
|
3346
|
+
transform: {
|
|
3347
|
+
top: "translateY(100%)",
|
|
3348
|
+
right: "translateY(50%) rotate(90deg) translateX(-50%)",
|
|
3349
|
+
bottom: "rotate(180deg)",
|
|
3350
|
+
left: "translateY(50%) rotate(-90deg) translateX(50%)"
|
|
3351
|
+
}[i.placedSide],
|
|
3352
|
+
visibility: i.shouldHideArrow ? "hidden" : void 0
|
|
3353
|
+
},
|
|
3354
|
+
children: /* @__PURE__ */ h(
|
|
3355
|
+
ki,
|
|
3356
|
+
{
|
|
3357
|
+
...o,
|
|
3358
|
+
ref: n,
|
|
3359
|
+
style: {
|
|
3360
|
+
...o.style,
|
|
3361
|
+
// ensures the element can be measured correctly (mostly for if SVG)
|
|
3362
|
+
display: "block"
|
|
3363
|
+
}
|
|
3364
|
+
}
|
|
3365
|
+
)
|
|
3366
|
+
}
|
|
3367
|
+
)
|
|
3368
|
+
);
|
|
3369
|
+
});
|
|
3370
|
+
_n.displayName = Dn;
|
|
3371
|
+
function Hi(e) {
|
|
3372
|
+
return e !== null;
|
|
3373
|
+
}
|
|
3374
|
+
var Wi = (e) => ({
|
|
3375
|
+
name: "transformOrigin",
|
|
3376
|
+
options: e,
|
|
3377
|
+
fn(t) {
|
|
3378
|
+
var x, S, E;
|
|
3379
|
+
const { placement: n, rects: r, middlewareData: o } = t, s = ((x = o.arrow) == null ? void 0 : x.centerOffset) !== 0, a = s ? 0 : e.arrowWidth, c = s ? 0 : e.arrowHeight, [l, d] = kn(n), f = { start: "0%", center: "50%", end: "100%" }[d], m = (((S = o.arrow) == null ? void 0 : S.x) ?? 0) + a / 2, p = (((E = o.arrow) == null ? void 0 : E.y) ?? 0) + c / 2;
|
|
3380
|
+
let v = "", y = "";
|
|
3381
|
+
return l === "bottom" ? (v = s ? f : `${m}px`, y = `${-c}px`) : l === "top" ? (v = s ? f : `${m}px`, y = `${r.floating.height + c}px`) : l === "right" ? (v = `${-c}px`, y = s ? f : `${p}px`) : l === "left" && (v = `${r.floating.width + c}px`, y = s ? f : `${p}px`), { data: { x: v, y } };
|
|
3382
|
+
}
|
|
3383
|
+
});
|
|
3384
|
+
function kn(e) {
|
|
3385
|
+
const [t, n = "center"] = e.split("-");
|
|
3386
|
+
return [t, n];
|
|
3387
|
+
}
|
|
3388
|
+
var Bi = Nn, Vi = On, ji = Ln, Yi = _n, Xi = u[" useInsertionEffect ".trim().toString()] || ie;
|
|
3389
|
+
function Ui({
|
|
3390
|
+
prop: e,
|
|
3391
|
+
defaultProp: t,
|
|
3392
|
+
onChange: n = () => {
|
|
3393
|
+
},
|
|
3394
|
+
caller: r
|
|
3395
|
+
}) {
|
|
3396
|
+
const [o, i, s] = qi({
|
|
3397
|
+
defaultProp: t,
|
|
3398
|
+
onChange: n
|
|
3399
|
+
}), a = e !== void 0, c = a ? e : o;
|
|
3400
|
+
{
|
|
3401
|
+
const d = u.useRef(e !== void 0);
|
|
3402
|
+
u.useEffect(() => {
|
|
3403
|
+
const f = d.current;
|
|
3404
|
+
f !== a && console.warn(
|
|
3405
|
+
`${r} is changing from ${f ? "controlled" : "uncontrolled"} to ${a ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
|
|
3406
|
+
), d.current = a;
|
|
3407
|
+
}, [a, r]);
|
|
3408
|
+
}
|
|
3409
|
+
const l = u.useCallback(
|
|
3410
|
+
(d) => {
|
|
3411
|
+
var f;
|
|
3412
|
+
if (a) {
|
|
3413
|
+
const m = Ji(d) ? d(e) : d;
|
|
3414
|
+
m !== e && ((f = s.current) == null || f.call(s, m));
|
|
3415
|
+
} else
|
|
3416
|
+
i(d);
|
|
3417
|
+
},
|
|
3418
|
+
[a, e, i, s]
|
|
3419
|
+
);
|
|
3420
|
+
return [c, l];
|
|
3421
|
+
}
|
|
3422
|
+
function qi({
|
|
3423
|
+
defaultProp: e,
|
|
3424
|
+
onChange: t
|
|
3425
|
+
}) {
|
|
3426
|
+
const [n, r] = u.useState(e), o = u.useRef(n), i = u.useRef(t);
|
|
3427
|
+
return Xi(() => {
|
|
3428
|
+
i.current = t;
|
|
3429
|
+
}, [t]), u.useEffect(() => {
|
|
3430
|
+
var s;
|
|
3431
|
+
o.current !== n && ((s = i.current) == null || s.call(i, n), o.current = n);
|
|
3432
|
+
}, [n, o]), [n, r, i];
|
|
3433
|
+
}
|
|
3434
|
+
function Ji(e) {
|
|
3435
|
+
return typeof e == "function";
|
|
3436
|
+
}
|
|
3437
|
+
var Gi = Object.freeze({
|
|
3438
|
+
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
3439
|
+
position: "absolute",
|
|
3440
|
+
border: 0,
|
|
3441
|
+
width: 1,
|
|
3442
|
+
height: 1,
|
|
3443
|
+
padding: 0,
|
|
3444
|
+
margin: -1,
|
|
3445
|
+
overflow: "hidden",
|
|
3446
|
+
clip: "rect(0, 0, 0, 0)",
|
|
3447
|
+
whiteSpace: "nowrap",
|
|
3448
|
+
wordWrap: "normal"
|
|
3449
|
+
}), Ki = "VisuallyHidden", Mn = u.forwardRef(
|
|
3450
|
+
(e, t) => /* @__PURE__ */ h(
|
|
3451
|
+
j.span,
|
|
3452
|
+
{
|
|
3453
|
+
...e,
|
|
3454
|
+
ref: t,
|
|
3455
|
+
style: { ...Gi, ...e.style }
|
|
3456
|
+
}
|
|
3457
|
+
)
|
|
3458
|
+
);
|
|
3459
|
+
Mn.displayName = Ki;
|
|
3460
|
+
var Zi = Mn, [We, Rs] = tt("Tooltip", [
|
|
3461
|
+
Pn
|
|
3462
|
+
]), Be = Pn(), In = "TooltipProvider", Qi = 700, Ge = "tooltip.open", [es, pt] = We(In), $n = (e) => {
|
|
3463
|
+
const {
|
|
3464
|
+
__scopeTooltip: t,
|
|
3465
|
+
delayDuration: n = Qi,
|
|
3466
|
+
skipDelayDuration: r = 300,
|
|
3467
|
+
disableHoverableContent: o = !1,
|
|
3468
|
+
children: i
|
|
3469
|
+
} = e, s = u.useRef(!0), a = u.useRef(!1), c = u.useRef(0);
|
|
3470
|
+
return u.useEffect(() => {
|
|
3471
|
+
const l = c.current;
|
|
3472
|
+
return () => window.clearTimeout(l);
|
|
3473
|
+
}, []), /* @__PURE__ */ h(
|
|
3474
|
+
es,
|
|
3475
|
+
{
|
|
3476
|
+
scope: t,
|
|
3477
|
+
isOpenDelayedRef: s,
|
|
3478
|
+
delayDuration: n,
|
|
3479
|
+
onOpen: u.useCallback(() => {
|
|
3480
|
+
window.clearTimeout(c.current), s.current = !1;
|
|
3481
|
+
}, []),
|
|
3482
|
+
onClose: u.useCallback(() => {
|
|
3483
|
+
window.clearTimeout(c.current), c.current = window.setTimeout(
|
|
3484
|
+
() => s.current = !0,
|
|
3485
|
+
r
|
|
3486
|
+
);
|
|
3487
|
+
}, [r]),
|
|
3488
|
+
isPointerInTransitRef: a,
|
|
3489
|
+
onPointerInTransitChange: u.useCallback((l) => {
|
|
3490
|
+
a.current = l;
|
|
3491
|
+
}, []),
|
|
3492
|
+
disableHoverableContent: o,
|
|
3493
|
+
children: i
|
|
3494
|
+
}
|
|
3495
|
+
);
|
|
3496
|
+
};
|
|
3497
|
+
$n.displayName = In;
|
|
3498
|
+
var xe = "Tooltip", [ts, Ve] = We(xe), Fn = (e) => {
|
|
3499
|
+
const {
|
|
3500
|
+
__scopeTooltip: t,
|
|
3501
|
+
children: n,
|
|
3502
|
+
open: r,
|
|
3503
|
+
defaultOpen: o,
|
|
3504
|
+
onOpenChange: i,
|
|
3505
|
+
disableHoverableContent: s,
|
|
3506
|
+
delayDuration: a
|
|
3507
|
+
} = e, c = pt(xe, e.__scopeTooltip), l = Be(t), [d, f] = u.useState(null), m = Co(), p = u.useRef(0), v = s ?? c.disableHoverableContent, y = a ?? c.delayDuration, x = u.useRef(!1), [S, E] = Ui({
|
|
3508
|
+
prop: r,
|
|
3509
|
+
defaultProp: o ?? !1,
|
|
3510
|
+
onChange: (P) => {
|
|
3511
|
+
P ? (c.onOpen(), document.dispatchEvent(new CustomEvent(Ge))) : c.onClose(), i == null || i(P);
|
|
3512
|
+
},
|
|
3513
|
+
caller: xe
|
|
3514
|
+
}), R = u.useMemo(() => S ? x.current ? "delayed-open" : "instant-open" : "closed", [S]), C = u.useCallback(() => {
|
|
3515
|
+
window.clearTimeout(p.current), p.current = 0, x.current = !1, E(!0);
|
|
3516
|
+
}, [E]), T = u.useCallback(() => {
|
|
3517
|
+
window.clearTimeout(p.current), p.current = 0, E(!1);
|
|
3518
|
+
}, [E]), A = u.useCallback(() => {
|
|
3519
|
+
window.clearTimeout(p.current), p.current = window.setTimeout(() => {
|
|
3520
|
+
x.current = !0, E(!0), p.current = 0;
|
|
3521
|
+
}, y);
|
|
3522
|
+
}, [y, E]);
|
|
3523
|
+
return u.useEffect(() => () => {
|
|
3524
|
+
p.current && (window.clearTimeout(p.current), p.current = 0);
|
|
3525
|
+
}, []), /* @__PURE__ */ h(Bi, { ...l, children: /* @__PURE__ */ h(
|
|
3526
|
+
ts,
|
|
3527
|
+
{
|
|
3528
|
+
scope: t,
|
|
3529
|
+
contentId: m,
|
|
3530
|
+
open: S,
|
|
3531
|
+
stateAttribute: R,
|
|
3532
|
+
trigger: d,
|
|
3533
|
+
onTriggerChange: f,
|
|
3534
|
+
onTriggerEnter: u.useCallback(() => {
|
|
3535
|
+
c.isOpenDelayedRef.current ? A() : C();
|
|
3536
|
+
}, [c.isOpenDelayedRef, A, C]),
|
|
3537
|
+
onTriggerLeave: u.useCallback(() => {
|
|
3538
|
+
v ? T() : (window.clearTimeout(p.current), p.current = 0);
|
|
3539
|
+
}, [T, v]),
|
|
3540
|
+
onOpen: C,
|
|
3541
|
+
onClose: T,
|
|
3542
|
+
disableHoverableContent: v,
|
|
3543
|
+
children: n
|
|
3544
|
+
}
|
|
3545
|
+
) });
|
|
3546
|
+
};
|
|
3547
|
+
Fn.displayName = xe;
|
|
3548
|
+
var Ke = "TooltipTrigger", zn = u.forwardRef(
|
|
3549
|
+
(e, t) => {
|
|
3550
|
+
const { __scopeTooltip: n, ...r } = e, o = Ve(Ke, n), i = pt(Ke, n), s = Be(n), a = u.useRef(null), c = U(t, a, o.onTriggerChange), l = u.useRef(!1), d = u.useRef(!1), f = u.useCallback(() => l.current = !1, []);
|
|
3551
|
+
return u.useEffect(() => () => document.removeEventListener("pointerup", f), [f]), /* @__PURE__ */ h(Vi, { asChild: !0, ...s, children: /* @__PURE__ */ h(
|
|
3552
|
+
j.button,
|
|
3553
|
+
{
|
|
3554
|
+
"aria-describedby": o.open ? o.contentId : void 0,
|
|
3555
|
+
"data-state": o.stateAttribute,
|
|
3556
|
+
...r,
|
|
3557
|
+
ref: c,
|
|
3558
|
+
onPointerMove: H(e.onPointerMove, (m) => {
|
|
3559
|
+
m.pointerType !== "touch" && !d.current && !i.isPointerInTransitRef.current && (o.onTriggerEnter(), d.current = !0);
|
|
3560
|
+
}),
|
|
3561
|
+
onPointerLeave: H(e.onPointerLeave, () => {
|
|
3562
|
+
o.onTriggerLeave(), d.current = !1;
|
|
3563
|
+
}),
|
|
3564
|
+
onPointerDown: H(e.onPointerDown, () => {
|
|
3565
|
+
o.open && o.onClose(), l.current = !0, document.addEventListener("pointerup", f, { once: !0 });
|
|
3566
|
+
}),
|
|
3567
|
+
onFocus: H(e.onFocus, () => {
|
|
3568
|
+
l.current || o.onOpen();
|
|
3569
|
+
}),
|
|
3570
|
+
onBlur: H(e.onBlur, o.onClose),
|
|
3571
|
+
onClick: H(e.onClick, o.onClose)
|
|
3572
|
+
}
|
|
3573
|
+
) });
|
|
3574
|
+
}
|
|
3575
|
+
);
|
|
3576
|
+
zn.displayName = Ke;
|
|
3577
|
+
var ns = "TooltipPortal", [Ns, rs] = We(ns, {
|
|
3578
|
+
forceMount: void 0
|
|
3579
|
+
}), he = "TooltipContent", Hn = u.forwardRef(
|
|
3580
|
+
(e, t) => {
|
|
3581
|
+
const n = rs(he, e.__scopeTooltip), { forceMount: r = n.forceMount, side: o = "top", ...i } = e, s = Ve(he, e.__scopeTooltip);
|
|
3582
|
+
return /* @__PURE__ */ h(me, { present: r || s.open, children: s.disableHoverableContent ? /* @__PURE__ */ h(Wn, { side: o, ...i, ref: t }) : /* @__PURE__ */ h(os, { side: o, ...i, ref: t }) });
|
|
3583
|
+
}
|
|
3584
|
+
), os = u.forwardRef((e, t) => {
|
|
3585
|
+
const n = Ve(he, e.__scopeTooltip), r = pt(he, e.__scopeTooltip), o = u.useRef(null), i = U(t, o), [s, a] = u.useState(null), { trigger: c, onClose: l } = n, d = o.current, { onPointerInTransitChange: f } = r, m = u.useCallback(() => {
|
|
3586
|
+
a(null), f(!1);
|
|
3587
|
+
}, [f]), p = u.useCallback(
|
|
3588
|
+
(v, y) => {
|
|
3589
|
+
const x = v.currentTarget, S = { x: v.clientX, y: v.clientY }, E = ls(S, x.getBoundingClientRect()), R = ds(S, E), C = us(y.getBoundingClientRect()), T = hs([...R, ...C]);
|
|
3590
|
+
a(T), f(!0);
|
|
3591
|
+
},
|
|
3592
|
+
[f]
|
|
3593
|
+
);
|
|
3594
|
+
return u.useEffect(() => () => m(), [m]), u.useEffect(() => {
|
|
3595
|
+
if (c && d) {
|
|
3596
|
+
const v = (x) => p(x, d), y = (x) => p(x, c);
|
|
3597
|
+
return c.addEventListener("pointerleave", v), d.addEventListener("pointerleave", y), () => {
|
|
3598
|
+
c.removeEventListener("pointerleave", v), d.removeEventListener("pointerleave", y);
|
|
3599
|
+
};
|
|
3600
|
+
}
|
|
3601
|
+
}, [c, d, p, m]), u.useEffect(() => {
|
|
3602
|
+
if (s) {
|
|
3603
|
+
const v = (y) => {
|
|
3604
|
+
const x = y.target, S = { x: y.clientX, y: y.clientY }, E = (c == null ? void 0 : c.contains(x)) || (d == null ? void 0 : d.contains(x)), R = !fs(S, s);
|
|
3605
|
+
E ? m() : R && (m(), l());
|
|
3606
|
+
};
|
|
3607
|
+
return document.addEventListener("pointermove", v), () => document.removeEventListener("pointermove", v);
|
|
3608
|
+
}
|
|
3609
|
+
}, [c, d, s, l, m]), /* @__PURE__ */ h(Wn, { ...e, ref: i });
|
|
3610
|
+
}), [is, ss] = We(xe, { isInside: !1 }), as = wr("TooltipContent"), Wn = u.forwardRef(
|
|
3611
|
+
(e, t) => {
|
|
3612
|
+
const {
|
|
3613
|
+
__scopeTooltip: n,
|
|
3614
|
+
children: r,
|
|
3615
|
+
"aria-label": o,
|
|
3616
|
+
onEscapeKeyDown: i,
|
|
3617
|
+
onPointerDownOutside: s,
|
|
3618
|
+
...a
|
|
3619
|
+
} = e, c = Ve(he, n), l = Be(n), { onClose: d } = c;
|
|
3620
|
+
return u.useEffect(() => (document.addEventListener(Ge, d), () => document.removeEventListener(Ge, d)), [d]), u.useEffect(() => {
|
|
3621
|
+
if (c.trigger) {
|
|
3622
|
+
const f = (m) => {
|
|
3623
|
+
const p = m.target;
|
|
3624
|
+
p != null && p.contains(c.trigger) && d();
|
|
3625
|
+
};
|
|
3626
|
+
return window.addEventListener("scroll", f, { capture: !0 }), () => window.removeEventListener("scroll", f, { capture: !0 });
|
|
3627
|
+
}
|
|
3628
|
+
}, [c.trigger, d]), /* @__PURE__ */ h(
|
|
3629
|
+
un,
|
|
3630
|
+
{
|
|
3631
|
+
asChild: !0,
|
|
3632
|
+
disableOutsidePointerEvents: !1,
|
|
3633
|
+
onEscapeKeyDown: i,
|
|
3634
|
+
onPointerDownOutside: s,
|
|
3635
|
+
onFocusOutside: (f) => f.preventDefault(),
|
|
3636
|
+
onDismiss: d,
|
|
3637
|
+
children: /* @__PURE__ */ L(
|
|
3638
|
+
ji,
|
|
3639
|
+
{
|
|
3640
|
+
"data-state": c.stateAttribute,
|
|
3641
|
+
...l,
|
|
3642
|
+
...a,
|
|
3643
|
+
ref: t,
|
|
3644
|
+
style: {
|
|
3645
|
+
...a.style,
|
|
3646
|
+
"--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
3647
|
+
"--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
|
|
3648
|
+
"--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
|
|
3649
|
+
"--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
|
|
3650
|
+
"--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
|
|
3651
|
+
},
|
|
3652
|
+
children: [
|
|
3653
|
+
/* @__PURE__ */ h(as, { children: r }),
|
|
3654
|
+
/* @__PURE__ */ h(is, { scope: n, isInside: !0, children: /* @__PURE__ */ h(Zi, { id: c.contentId, role: "tooltip", children: o || r }) })
|
|
3655
|
+
]
|
|
3656
|
+
}
|
|
3657
|
+
)
|
|
3658
|
+
}
|
|
3659
|
+
);
|
|
3660
|
+
}
|
|
3661
|
+
);
|
|
3662
|
+
Hn.displayName = he;
|
|
3663
|
+
var Bn = "TooltipArrow", cs = u.forwardRef(
|
|
3664
|
+
(e, t) => {
|
|
3665
|
+
const { __scopeTooltip: n, ...r } = e, o = Be(n);
|
|
3666
|
+
return ss(
|
|
3667
|
+
Bn,
|
|
3668
|
+
n
|
|
3669
|
+
).isInside ? null : /* @__PURE__ */ h(Yi, { ...o, ...r, ref: t });
|
|
3670
|
+
}
|
|
3671
|
+
);
|
|
3672
|
+
cs.displayName = Bn;
|
|
3673
|
+
function ls(e, t) {
|
|
3674
|
+
const n = Math.abs(t.top - e.y), r = Math.abs(t.bottom - e.y), o = Math.abs(t.right - e.x), i = Math.abs(t.left - e.x);
|
|
3675
|
+
switch (Math.min(n, r, o, i)) {
|
|
3676
|
+
case i:
|
|
3677
|
+
return "left";
|
|
3678
|
+
case o:
|
|
3679
|
+
return "right";
|
|
3680
|
+
case n:
|
|
3681
|
+
return "top";
|
|
3682
|
+
case r:
|
|
3683
|
+
return "bottom";
|
|
3684
|
+
default:
|
|
3685
|
+
throw new Error("unreachable");
|
|
3686
|
+
}
|
|
3687
|
+
}
|
|
3688
|
+
function ds(e, t, n = 5) {
|
|
3689
|
+
const r = [];
|
|
3690
|
+
switch (t) {
|
|
3691
|
+
case "top":
|
|
3692
|
+
r.push(
|
|
3693
|
+
{ x: e.x - n, y: e.y + n },
|
|
3694
|
+
{ x: e.x + n, y: e.y + n }
|
|
3695
|
+
);
|
|
3696
|
+
break;
|
|
3697
|
+
case "bottom":
|
|
3698
|
+
r.push(
|
|
3699
|
+
{ x: e.x - n, y: e.y - n },
|
|
3700
|
+
{ x: e.x + n, y: e.y - n }
|
|
3701
|
+
);
|
|
3702
|
+
break;
|
|
3703
|
+
case "left":
|
|
3704
|
+
r.push(
|
|
3705
|
+
{ x: e.x + n, y: e.y - n },
|
|
3706
|
+
{ x: e.x + n, y: e.y + n }
|
|
3707
|
+
);
|
|
3708
|
+
break;
|
|
3709
|
+
case "right":
|
|
3710
|
+
r.push(
|
|
3711
|
+
{ x: e.x - n, y: e.y - n },
|
|
3712
|
+
{ x: e.x - n, y: e.y + n }
|
|
3713
|
+
);
|
|
3714
|
+
break;
|
|
3715
|
+
}
|
|
3716
|
+
return r;
|
|
3717
|
+
}
|
|
3718
|
+
function us(e) {
|
|
3719
|
+
const { top: t, right: n, bottom: r, left: o } = e;
|
|
3720
|
+
return [
|
|
3721
|
+
{ x: o, y: t },
|
|
3722
|
+
{ x: n, y: t },
|
|
3723
|
+
{ x: n, y: r },
|
|
3724
|
+
{ x: o, y: r }
|
|
3725
|
+
];
|
|
3726
|
+
}
|
|
3727
|
+
function fs(e, t) {
|
|
3728
|
+
const { x: n, y: r } = e;
|
|
3729
|
+
let o = !1;
|
|
3730
|
+
for (let i = 0, s = t.length - 1; i < t.length; s = i++) {
|
|
3731
|
+
const a = t[i], c = t[s], l = a.x, d = a.y, f = c.x, m = c.y;
|
|
3732
|
+
d > r != m > r && n < (f - l) * (r - d) / (m - d) + l && (o = !o);
|
|
3733
|
+
}
|
|
3734
|
+
return o;
|
|
3735
|
+
}
|
|
3736
|
+
function hs(e) {
|
|
3737
|
+
const t = e.slice();
|
|
3738
|
+
return t.sort((n, r) => n.x < r.x ? -1 : n.x > r.x ? 1 : n.y < r.y ? -1 : n.y > r.y ? 1 : 0), ms(t);
|
|
3739
|
+
}
|
|
3740
|
+
function ms(e) {
|
|
3741
|
+
if (e.length <= 1) return e.slice();
|
|
3742
|
+
const t = [];
|
|
3743
|
+
for (let r = 0; r < e.length; r++) {
|
|
3744
|
+
const o = e[r];
|
|
3745
|
+
for (; t.length >= 2; ) {
|
|
3746
|
+
const i = t[t.length - 1], s = t[t.length - 2];
|
|
3747
|
+
if ((i.x - s.x) * (o.y - s.y) >= (i.y - s.y) * (o.x - s.x)) t.pop();
|
|
3748
|
+
else break;
|
|
3749
|
+
}
|
|
3750
|
+
t.push(o);
|
|
3751
|
+
}
|
|
3752
|
+
t.pop();
|
|
3753
|
+
const n = [];
|
|
3754
|
+
for (let r = e.length - 1; r >= 0; r--) {
|
|
3755
|
+
const o = e[r];
|
|
3756
|
+
for (; n.length >= 2; ) {
|
|
3757
|
+
const i = n[n.length - 1], s = n[n.length - 2];
|
|
3758
|
+
if ((i.x - s.x) * (o.y - s.y) >= (i.y - s.y) * (o.x - s.x)) n.pop();
|
|
3759
|
+
else break;
|
|
3760
|
+
}
|
|
3761
|
+
n.push(o);
|
|
3762
|
+
}
|
|
3763
|
+
return n.pop(), t.length === 1 && n.length === 1 && t[0].x === n[0].x && t[0].y === n[0].y ? t : t.concat(n);
|
|
3764
|
+
}
|
|
3765
|
+
var ps = $n, gs = Fn, vs = zn, Vn = Hn;
|
|
3766
|
+
const As = ps, Os = gs, Ls = vs, ws = u.forwardRef(({ className: e, sideOffset: t = 4, ...n }, r) => /* @__PURE__ */ h(
|
|
3767
|
+
Vn,
|
|
3768
|
+
{
|
|
3769
|
+
ref: r,
|
|
3770
|
+
sideOffset: t,
|
|
3771
|
+
className: V(
|
|
3772
|
+
"z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",
|
|
3773
|
+
e
|
|
3774
|
+
),
|
|
3775
|
+
...n
|
|
3776
|
+
}
|
|
3777
|
+
));
|
|
3778
|
+
ws.displayName = Vn.displayName;
|
|
3779
|
+
const Ds = {
|
|
3780
|
+
ChatProvider: Vt,
|
|
3781
|
+
ChatInterface: ke,
|
|
3782
|
+
MessageComponent: jt,
|
|
3783
|
+
ThreadManager: Me,
|
|
3784
|
+
ChatApp: Sr,
|
|
3785
|
+
useChat: Qe
|
|
3786
|
+
};
|
|
3787
|
+
export {
|
|
3788
|
+
B as Button,
|
|
3789
|
+
Rr as Card,
|
|
3790
|
+
Lr as CardContent,
|
|
3791
|
+
Or as CardDescription,
|
|
3792
|
+
Dr as CardFooter,
|
|
3793
|
+
Nr as CardHeader,
|
|
3794
|
+
Ar as CardTitle,
|
|
3795
|
+
Sr as ChatApp,
|
|
3796
|
+
ke as ChatInterface,
|
|
3797
|
+
Vt as ChatProvider,
|
|
3798
|
+
_r as Input,
|
|
3799
|
+
Fr as Label,
|
|
3800
|
+
jt as MessageComponent,
|
|
3801
|
+
uo as ScrollArea,
|
|
3802
|
+
Br as Separator,
|
|
3803
|
+
et as Textarea,
|
|
3804
|
+
Me as ThreadManager,
|
|
3805
|
+
Os as Tooltip,
|
|
3806
|
+
ws as TooltipContent,
|
|
3807
|
+
As as TooltipProvider,
|
|
3808
|
+
Ls as TooltipTrigger,
|
|
3809
|
+
V as cn,
|
|
3810
|
+
Ds as default,
|
|
3811
|
+
Qe as useChat
|
|
3812
|
+
};
|