@versini/sassysaint 5.5.25 → 5.5.27

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.
@@ -1,2940 +0,0 @@
1
- import { jsx as o, jsxs as v, Fragment as z } from "react/jsx-runtime";
2
- import { g as P, un as D, R as F, CARDS as _, renderDataAsList as pe, pluralize as be, ABOUT_TITLE as Dt, L as K, j as M, C as U, INFINITE_SCROLL_LIMIT as Ge, INFINITE_SCROLL_THRESHOLD as Ue, LOCAL_STORAGE_PREFIX as ue, LOCAL_STORAGE_SORT as Vt, P as te, ACTION_RESET as et, ACTION_RESTORE as Gt, ACTION_SORT as He, LOCAL_STORAGE_SEARCH as Ut, HISTORY_TITLE as Ht, ye as Te, ACTION_SEARCH as jt, debounce as Wt, M as Kt, z as je, durationFormatter as Yt, PROFILE_TITLE as Zt, PROMPTS_DESCRIPTION as qt, DEFAULT_AI_ENGINE as Qt, LOCAL_STORAGE_ENGINE_TOGGLE as tt, LOCAL_STORAGE_CHAT_DETAILS as Xt, SETTINGS_TITLE as Jt, ENGINE_OPENAI as J, ENGINE_ANTHROPIC as ee, APP_NAME as er, getCurrentGeoLocation as tr, LOG_OUT as We } from "./index.DBAc9xii.js";
3
- import * as h from "react";
4
- import E, { useId as ze, forwardRef as rt, useState as R, useRef as re, useContext as Y, useEffect as Z, useCallback as rr, Fragment as or } from "react";
5
- import w from "clsx";
6
- import { useFloatingTree as ot, useFloatingNodeId as ar, useListItem as at, useFloating as nt, offset as nr, flip as sr, shift as lr, autoUpdate as cr, useClick as st, useRole as lt, useDismiss as ct, useListNavigation as ir, useTypeahead as dr, useInteractions as it, useMergeRefs as Ae, FloatingNode as ur, FloatingList as mr, FloatingPortal as dt, FloatingFocusManager as ut, FloatingTree as hr, FloatingOverlay as gr } from "@floating-ui/react";
7
- import { useServerCapabilities as mt, HistoryContext as ht, E as me, ge as fr, he as pr, ue as Ie, ie as $, ye as br, me as vr, be as yr, serviceCall as oe, SERVICE_TYPES as ae, f as ce, AppContext as Pe, useChatsHistory as kr, useUserChatStats as wr, useUserPreferences as Be, Fe as Ke, NewChatButton as Nr } from "./App.BX41JKCq.js";
8
- const gt = ({
9
- className: e,
10
- viewBox: t,
11
- title: r,
12
- monotone: a,
13
- ...n
14
- }) => /* @__PURE__ */ o(
15
- P,
16
- {
17
- defaultViewBox: "0 0 24 24",
18
- size: "size-5",
19
- viewBox: t,
20
- className: e,
21
- title: r || "Anthropic",
22
- ...n,
23
- children: /* @__PURE__ */ o("path", { d: "M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z" })
24
- }
25
- ), xr = ({
26
- className: e,
27
- viewBox: t,
28
- title: r,
29
- monotone: a,
30
- ...n
31
- }) => /* @__PURE__ */ v(
32
- P,
33
- {
34
- defaultViewBox: "0 0 512 512",
35
- size: "size-5",
36
- viewBox: t,
37
- className: e,
38
- title: r || "Back",
39
- ...n,
40
- children: [
41
- /* @__PURE__ */ o(
42
- "path",
43
- {
44
- className: "fa-secondary",
45
- opacity: a ? "1" : "0.4",
46
- d: "M66.6 320c0 1.8 .1 3.5 .4 5.3C84.9 431.3 177 512 288 512c123.7 0 224-100.3 224-224c0-111-80.7-203.1-186.7-220.9c-1.8-.3-3.6-.4-5.3-.4c-15.3 0-28.9 11.1-31.5 26.7c-2.9 17.4 8.8 33.9 26.3 36.9C390.4 142.9 448 208.8 448 288c0 88.4-71.6 160-160 160c-79.2 0-145.1-57.6-157.8-133.3c-2.9-17.4-19.4-29.2-36.9-26.3c-15.6 2.6-26.7 16.2-26.7 31.5z"
47
- }
48
- ),
49
- /* @__PURE__ */ o(
50
- "path",
51
- {
52
- className: "fa-primary",
53
- d: "M32 0L192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-82.7 0L342.6 297.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L64 109.3 64 192c0 17.7-14.3 32-32 32s-32-14.3-32-32L0 32C0 14.3 14.3 0 32 0z"
54
- }
55
- )
56
- ]
57
- }
58
- ), Cr = ({
59
- className: e,
60
- viewBox: t,
61
- title: r,
62
- monotone: a,
63
- ...n
64
- }) => /* @__PURE__ */ v(
65
- P,
66
- {
67
- defaultViewBox: "0 0 448 512",
68
- size: "size-5",
69
- viewBox: t,
70
- className: e,
71
- title: r || "Delete",
72
- ...n,
73
- children: [
74
- /* @__PURE__ */ o(
75
- "path",
76
- {
77
- className: "fa-secondary",
78
- opacity: a ? "1" : "0.4",
79
- d: "M32 96l0 352c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-352L32 96zm80 80c0-8.8 7.2-16 16-16s16 7.2 16 16l0 224c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-224zm96 0c0-8.8 7.2-16 16-16s16 7.2 16 16l0 224c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-224zm96 0c0-8.8 7.2-16 16-16s16 7.2 16 16l0 224c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-224z"
80
- }
81
- ),
82
- /* @__PURE__ */ o(
83
- "path",
84
- {
85
- className: "fa-primary",
86
- d: "M163.8 0c-12.1 0-23.2 6.8-28.6 17.7L128 32 32 32C14.3 32 0 46.3 0 64S14.3 96 32 96l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-96 0-7.2-14.3C307.4 6.8 296.3 0 284.2 0L163.8 0z"
87
- }
88
- )
89
- ]
90
- }
91
- ), Ir = ({
92
- className: e,
93
- viewBox: t,
94
- title: r,
95
- monotone: a,
96
- ...n
97
- }) => /* @__PURE__ */ v(
98
- P,
99
- {
100
- defaultViewBox: "0 0 512 512",
101
- size: "size-5",
102
- viewBox: t,
103
- className: e,
104
- title: r || "Edit",
105
- ...n,
106
- children: [
107
- /* @__PURE__ */ o(
108
- "path",
109
- {
110
- className: "fa-secondary",
111
- opacity: a ? "1" : "0.4",
112
- d: "M0 160c0-53 43-96 96-96l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-96 0c-17.7 0-32 14.3-32 32l0 256c0 17.7 14.3 32 32 32l256 0c17.7 0 32-14.3 32-32l0-96c0-17.7 14.3-32 32-32s32 14.3 32 32l0 96c0 53-43 96-96 96L96 512c-53 0-96-43-96-96L0 160z"
113
- }
114
- ),
115
- /* @__PURE__ */ o(
116
- "path",
117
- {
118
- className: "fa-primary",
119
- d: "M392.4 21.7L362.3 51.7l97.9 97.9 30.1-30.1c21.9-21.9 21.9-57.3 0-79.2L471.6 21.7c-21.9-21.9-57.3-21.9-79.2 0zM339.7 74.3L172.4 241.7c-6.1 6.1-10.8 13.6-13.5 21.9l-29.6 88.8c-2.9 8.6-.6 18.1 5.8 24.6s15.9 8.7 24.6 5.8l88.8-29.6c8.2-2.7 15.7-7.4 21.9-13.5L437.7 172.3 339.7 74.3z"
120
- }
121
- )
122
- ]
123
- }
124
- ), Er = ({
125
- className: e,
126
- viewBox: t,
127
- title: r,
128
- monotone: a,
129
- ...n
130
- }) => /* @__PURE__ */ v(
131
- P,
132
- {
133
- defaultViewBox: "0 0 512 512",
134
- size: "size-5",
135
- viewBox: t,
136
- className: e,
137
- title: r || "History",
138
- ...n,
139
- children: [
140
- /* @__PURE__ */ o(
141
- "path",
142
- {
143
- className: "fa-secondary",
144
- opacity: a ? "1" : "0.4",
145
- d: "M0 57.9L0 168c0 13.3 10.7 24 24 24l110.1 0c21.4 0 32.1-25.9 17-41l-30.8-30.8C155 85.5 203 64 256 64c106 0 192 86 192 192s-86 192-192 192c-40.8 0-78.6-12.7-109.7-34.4c-14.5-10.1-34.4-6.6-44.6 7.9s-6.6 34.4 7.9 44.6C151.2 495 201.7 512 256 512c141.4 0 256-114.6 256-256S397.4 0 256 0C185.3 0 121.3 28.7 75 75L41 41C25.9 25.9 0 36.6 0 57.9z"
146
- }
147
- ),
148
- /* @__PURE__ */ o(
149
- "path",
150
- {
151
- className: "fa-primary",
152
- d: "M256 128c13.3 0 24 10.7 24 24l0 94.1 65 65c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-72-72c-4.5-4.5-7-10.6-7-17l0-104c0-13.3 10.7-24 24-24z"
153
- }
154
- )
155
- ]
156
- }
157
- ), Tr = ({
158
- className: e,
159
- viewBox: t,
160
- title: r,
161
- monotone: a,
162
- ...n
163
- }) => /* @__PURE__ */ v(
164
- P,
165
- {
166
- defaultViewBox: "0 0 512 512",
167
- size: "size-5",
168
- viewBox: t,
169
- className: e,
170
- title: r || "Info",
171
- ...n,
172
- children: [
173
- /* @__PURE__ */ o(
174
- "path",
175
- {
176
- className: "fa-secondary",
177
- opacity: "0.4",
178
- d: "M0 256a256 256 0 1 0 512 0A256 256 0 1 0 0 256zm192-8c0-13.3 10.7-24 24-24l48 0c13.3 0 24 10.7 24 24l0 88 8 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l24 0 0-64-24 0c-13.3 0-24-10.7-24-24zm96-88a32 32 0 1 1 -64 0 32 32 0 1 1 64 0z"
179
- }
180
- ),
181
- /* @__PURE__ */ o(
182
- "path",
183
- {
184
- className: "fa-primary",
185
- d: "M256 128a32 32 0 1 1 0 64 32 32 0 1 1 0-64zM192 248c0-13.3 10.7-24 24-24l48 0c13.3 0 24 10.7 24 24l0 88 8 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l24 0 0-64-24 0c-13.3 0-24-10.7-24-24z"
186
- }
187
- )
188
- ]
189
- }
190
- ), ft = ({
191
- className: e,
192
- viewBox: t,
193
- title: r,
194
- monotone: a,
195
- ...n
196
- }) => /* @__PURE__ */ o(
197
- P,
198
- {
199
- defaultViewBox: "0 0 24 24",
200
- size: "size-5",
201
- viewBox: t,
202
- className: e,
203
- title: r || "OpenAI",
204
- ...n,
205
- children: /* @__PURE__ */ o("path", { d: "M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z" })
206
- }
207
- ), _r = ({
208
- className: e,
209
- viewBox: t,
210
- title: r,
211
- monotone: a,
212
- ...n
213
- }) => /* @__PURE__ */ v(
214
- P,
215
- {
216
- defaultViewBox: "0 0 576 512",
217
- size: "size-5",
218
- viewBox: t,
219
- className: e,
220
- title: r || "Profile",
221
- ...n,
222
- children: [
223
- /* @__PURE__ */ o(
224
- "path",
225
- {
226
- className: "fa-secondary",
227
- opacity: "0.4",
228
- d: "M0 96L0 416c0 35.3 28.7 64 64 64l448 0c35.3 0 64-28.7 64-64l0-320c0-35.3-28.7-64-64-64L64 32C28.7 32 0 60.7 0 96zM64 368c0-44.2 35.8-80 80-80l64 0c44.2 0 80 35.8 80 80c0 8.8-7.2 16-16 16L80 384c-8.8 0-16-7.2-16-16zM240 192a64 64 0 1 1 -128 0 64 64 0 1 1 128 0zm112-16c0-8.8 7.2-16 16-16l128 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-128 0c-8.8 0-16-7.2-16-16zm0 64c0-8.8 7.2-16 16-16l128 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-128 0c-8.8 0-16-7.2-16-16zm0 64c0-8.8 7.2-16 16-16l128 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-128 0c-8.8 0-16-7.2-16-16z"
229
- }
230
- ),
231
- /* @__PURE__ */ o(
232
- "path",
233
- {
234
- className: "fa-primary",
235
- d: "M176 256a64 64 0 1 0 0-128 64 64 0 1 0 0 128zm-32 32c-44.2 0-80 35.8-80 80c0 8.8 7.2 16 16 16l192 0c8.8 0 16-7.2 16-16c0-44.2-35.8-80-80-80l-64 0z"
236
- }
237
- )
238
- ]
239
- }
240
- ), Sr = ({
241
- className: e,
242
- viewBox: t,
243
- title: r,
244
- monotone: a,
245
- ...n
246
- }) => /* @__PURE__ */ v(
247
- P,
248
- {
249
- defaultViewBox: "0 0 512 512",
250
- size: "size-5",
251
- viewBox: t,
252
- className: e,
253
- title: r || "Restore",
254
- ...n,
255
- children: [
256
- /* @__PURE__ */ o(
257
- "path",
258
- {
259
- className: "fa-secondary",
260
- opacity: a ? "1" : "0.4",
261
- d: "M128 80l0 16 64 0 0-16c0-8.8 7.2-16 16-16l224 0c8.8 0 16 7.2 16 16l0 224c0 8.8-7.2 16-16 16l-16 0 0 64 16 0c44.2 0 80-35.8 80-80l0-224c0-44.2-35.8-80-80-80L208 0c-44.2 0-80 35.8-80 80z"
262
- }
263
- ),
264
- /* @__PURE__ */ o(
265
- "path",
266
- {
267
- className: "fa-primary",
268
- d: "M64 128c-35.3 0-64 28.7-64 64L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-256c0-35.3-28.7-64-64-64L64 128zm32 64l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L96 256c-17.7 0-32-14.3-32-32s14.3-32 32-32z"
269
- }
270
- )
271
- ]
272
- }
273
- ), Rr = ({
274
- className: e,
275
- viewBox: t,
276
- title: r,
277
- monotone: a,
278
- ...n
279
- }) => /* @__PURE__ */ o(
280
- P,
281
- {
282
- defaultViewBox: "0 0 448 512",
283
- size: "size-5",
284
- viewBox: t,
285
- className: e,
286
- title: r || "Settings",
287
- ...n,
288
- children: /* @__PURE__ */ o("path", { d: "M8 256a56 56 0 1 1 112 0A56 56 0 1 1 8 256zm160 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm216-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z" })
289
- }
290
- ), Lr = ({
291
- className: e,
292
- viewBox: t,
293
- title: r,
294
- monotone: a,
295
- ...n
296
- }) => /* @__PURE__ */ v(
297
- P,
298
- {
299
- defaultViewBox: "0 0 512 512",
300
- size: "size-5",
301
- viewBox: t,
302
- className: e,
303
- title: r || "Sliders",
304
- ...n,
305
- children: [
306
- /* @__PURE__ */ o(
307
- "path",
308
- {
309
- className: "fa-secondary",
310
- opacity: a ? "1" : "0.4",
311
- d: "M0 96C0 78.3 14.3 64 32 64l86.7 0c-2.1 4.9-3.8 10.1-4.9 15.4c-.6 2.7-1 5.4-1.3 8.2c-.1 1.4-.3 2.8-.3 4.2s-.1 2.8-.1 4.2c0 11.4 2.4 22.2 6.7 32L32 128C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32l246.7 0c-2.1 4.9-3.8 10.1-4.9 15.4c-.6 2.7-1 5.4-1.3 8.2c-.1 1.4-.3 2.8-.3 4.2s-.1 2.8-.1 4.2c0 11.4 2.4 22.2 6.7 32L32 288c-17.7 0-32-14.3-32-32zM0 416c0-17.7 14.3-32 32-32l54.7 0c-2.1 4.9-3.8 10.1-4.9 15.4c-.6 2.7-1 5.4-1.3 8.2c-.1 1.4-.3 2.8-.3 4.2s-.1 2.8-.1 4.2c0 11.4 2.4 22.2 6.7 32L32 448c-17.7 0-32-14.3-32-32zm233.3-32L480 384c17.7 0 32 14.3 32 32s-14.3 32-32 32l-246.7 0c2.1-4.9 3.8-10.1 4.9-15.4c.6-2.7 1-5.4 1.3-8.2c.1-1.4 .3-2.8 .3-4.2s.1-2.8 .1-4.2c0-11.4-2.4-22.2-6.7-32zm32-320L480 64c17.7 0 32 14.3 32 32s-14.3 32-32 32l-214.7 0c2.1-4.9 3.8-10.1 4.9-15.4c.6-2.7 1-5.4 1.3-8.2c.1-1.4 .3-2.8 .3-4.2s.1-2.8 .1-4.2c0-11.4-2.4-22.2-6.7-32zm160 160l54.7 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-54.7 0c2.1-4.9 3.8-10.1 4.9-15.4c.6-2.7 1-5.4 1.3-8.2c.1-1.4 .3-2.8 .3-4.2s.1-2.8 .1-4.2c0-11.4-2.4-22.2-6.7-32z"
312
- }
313
- ),
314
- /* @__PURE__ */ o(
315
- "path",
316
- {
317
- className: "fa-primary",
318
- d: "M128 416a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zm112 0A80 80 0 1 0 80 416a80 80 0 1 0 160 0zm80-160a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zm112 0a80 80 0 1 0 -160 0 80 80 0 1 0 160 0zM192 128a32 32 0 1 1 0-64 32 32 0 1 1 0 64zm0-112a80 80 0 1 0 0 160 80 80 0 1 0 0-160z"
319
- }
320
- )
321
- ]
322
- }
323
- );
324
- function ve(e) {
325
- return ze();
326
- }
327
- const _e = h.createContext({
328
- getItemProps: () => ({}),
329
- activeIndex: null,
330
- /* v8 ignore next 2 */
331
- setActiveIndex: () => {
332
- },
333
- setHasFocusInside: () => {
334
- },
335
- isOpen: !1
336
- }), Ye = (e) => {
337
- if (typeof e == "string")
338
- return e;
339
- if (typeof e == "function")
340
- return e.displayName || e.name || "Component";
341
- if (typeof e == "object" && e !== null && "type" in e) {
342
- const t = e.type;
343
- if (typeof t == "function" || typeof t == "object")
344
- return t.displayName || t.name || "Component";
345
- }
346
- return "Element";
347
- }, pt = rt(
348
- ({
349
- trigger: e,
350
- children: t,
351
- label: r = "Open menu",
352
- defaultPlacement: a = "bottom-start",
353
- onOpenChange: n,
354
- mode: s = "system",
355
- focusMode: l = "system",
356
- ...c
357
- }, u) => {
358
- const [i, f] = R(!1), [p, g] = R(!1), [d, m] = R(null), y = re([]), b = re([]), N = Y(_e), x = ot(), k = ar(), C = at(), { floatingStyles: T, refs: A, context: L } = nt({
359
- nodeId: k,
360
- open: i,
361
- onOpenChange: (G) => {
362
- f(G), n == null || n(G);
363
- },
364
- placement: a,
365
- strategy: "fixed",
366
- middleware: [nr({ mainAxis: 10 }), sr(), lr()],
367
- whileElementsMounted: cr
368
- }), S = st(L, {
369
- event: "mousedown",
370
- toggle: !0,
371
- ignoreMouse: !1
372
- }), q = lt(L, { role: "menu" }), Q = ct(L, { bubbles: !0 }), V = ir(L, {
373
- listRef: y,
374
- activeIndex: d,
375
- nested: !1,
376
- onNavigate: m,
377
- loop: !0
378
- }), I = dr(L, {
379
- listRef: b,
380
- onMatch: i ? m : void 0,
381
- activeIndex: d
382
- }), { getReferenceProps: B, getFloatingProps: H, getItemProps: O } = it([S, q, Q, V, I]), le = Ye(e) === "Button" || Ye(e) === "ButtonIcon", X = le ? {
383
- noInternalClick: le,
384
- focusMode: l,
385
- mode: s
386
- } : {}, ge = E.cloneElement(
387
- e,
388
- {
389
- ...X,
390
- "aria-label": r,
391
- "data-open": i ? "" : void 0,
392
- "data-focus-inside": p ? "" : void 0,
393
- ref: Ae([A.setReference, C.ref, u]),
394
- ...B(
395
- N.getItemProps({
396
- ...c
397
- })
398
- )
399
- }
400
- );
401
- return Z(() => {
402
- if (!x)
403
- return;
404
- function G() {
405
- f(!1), n == null || n(!1);
406
- }
407
- return x.events.on("click", G), () => {
408
- x.events.off("click", G);
409
- };
410
- }, [x, n]), Z(() => {
411
- i && x && x.events.emit("menuopen", { nodeId: k });
412
- }, [x, i, k]), /* @__PURE__ */ v(ur, { id: k, children: [
413
- ge,
414
- /* @__PURE__ */ o(
415
- _e.Provider,
416
- {
417
- value: {
418
- activeIndex: d,
419
- setActiveIndex: m,
420
- getItemProps: O,
421
- setHasFocusInside: g,
422
- isOpen: i
423
- },
424
- children: /* @__PURE__ */ o(mr, { elementsRef: y, labelsRef: b, children: i && /* @__PURE__ */ o(dt, { children: /* @__PURE__ */ o(
425
- ut,
426
- {
427
- context: L,
428
- modal: !1,
429
- initialFocus: 0,
430
- returnFocus: !0,
431
- children: /* @__PURE__ */ o(
432
- "div",
433
- {
434
- ref: A.setFloating,
435
- className: "rounded-md bg-surface-light p-4 shadow-sm shadow-border-dark outline-none sm:p-2",
436
- style: T,
437
- ...H(),
438
- children: t
439
- }
440
- )
441
- }
442
- ) }) })
443
- }
444
- )
445
- ] });
446
- }
447
- ), Oe = rt((e, t) => /* @__PURE__ */ o(hr, { children: /* @__PURE__ */ o(pt, { ...e, ref: t }) }));
448
- Oe.displayName = "Menu";
449
- pt.displayName = "MenuComponent";
450
- const j = h.forwardRef(
451
- ({
452
- label: e,
453
- disabled: t,
454
- icon: r,
455
- raw: a = !1,
456
- children: n,
457
- ignoreClick: s = !1,
458
- ...l
459
- }, c) => {
460
- let u = "";
461
- const i = h.useContext(_e), f = at({ label: t ? null : e }), p = ot(), g = Ae([f.ref, c]);
462
- return a && n ? /* @__PURE__ */ o(
463
- "div",
464
- {
465
- role: "menuitem",
466
- ...i.getItemProps({
467
- onClick(d) {
468
- var m;
469
- s || ((m = l.onClick) == null || m.call(l, d), p == null || p.events.emit("click"));
470
- }
471
- }),
472
- children: n
473
- }
474
- ) : (r && (u = "pl-2"), /* @__PURE__ */ v(
475
- "button",
476
- {
477
- ...l,
478
- ref: g,
479
- role: "menuitem",
480
- className: "m-0 flex w-full rounded-md border border-transparent bg-none px-2 py-2 text-left text-base outline-none focus:border focus:border-border-medium focus:bg-surface-lighter focus:underline disabled:cursor-not-allowed disabled:text-copy-medium sm:py-1",
481
- tabIndex: 0,
482
- disabled: t,
483
- ...i.getItemProps({
484
- onClick(d) {
485
- var m;
486
- s || ((m = l.onClick) == null || m.call(l, d), p == null || p.events.emit("click"));
487
- },
488
- onFocus(d) {
489
- var m;
490
- (m = l.onFocus) == null || m.call(l, d), i.setHasFocusInside(!0);
491
- }
492
- }),
493
- children: [
494
- r,
495
- e && /* @__PURE__ */ o("span", { className: u, children: e })
496
- ]
497
- }
498
- ));
499
- }
500
- );
501
- j.displayName = "MenuItem";
502
- const Mr = ({ className: e, ...t }) => {
503
- const r = w(e, "my-1 border-t border-border-medium");
504
- return /* @__PURE__ */ o("div", { className: r, ...t });
505
- };
506
- /*!
507
- @versini/ui-menu v3.0.3
508
- © 2025 gizmette.com
509
- */
510
- try {
511
- window.__VERSINI_UI_MENU__ || (window.__VERSINI_UI_MENU__ = {
512
- version: "3.0.3",
513
- buildTime: "01/06/2025 08:01 PM EST",
514
- homepage: "https://github.com/aversini/ui-components",
515
- license: "MIT"
516
- });
517
- } catch {
518
- }
519
- /*!
520
- @versini/ui-panel v1.3.4
521
- © 2025 gizmette.com
522
- */
523
- try {
524
- window.__VERSINI_UI_PANEL__ || (window.__VERSINI_UI_PANEL__ = {
525
- version: "1.3.4",
526
- buildTime: "01/06/2025 08:01 PM EST",
527
- homepage: "https://github.com/aversini/ui-components",
528
- license: "MIT"
529
- });
530
- } catch {
531
- }
532
- const Ze = "av-messagebox", qe = "av-panel", Qe = "av-button", we = "icon", bt = "button", Se = "link", zr = ({
533
- type: e,
534
- size: t,
535
- labelRight: r,
536
- labelLeft: a,
537
- align: n
538
- }) => {
539
- const s = "max-h-8 py-0 px-2", l = "max-h-9 py-1 px-3", c = "max-h-12 py-2 px-4";
540
- switch (e) {
541
- case bt:
542
- case Se:
543
- return w({
544
- [s]: t === "small",
545
- [l]: t === "medium",
546
- [c]: t === "large"
547
- });
548
- case we:
549
- return w("inline-flex items-center", {
550
- "justify-center": n === "center",
551
- "justify-start": n === "left",
552
- "justify-end": n === "right",
553
- "h-6 w-6 p-0": t === "small" && !(r || a),
554
- "h-6 px-2": t === "small" && (r || a),
555
- "h-8 w-8 p-1": t === "medium" && !(r || a),
556
- "h-8 px-3": t === "medium" && (r || a),
557
- "h-12 w-12 p-2": t === "large" && !(r || a),
558
- "h-12 px-4": t === "large" && (r || a)
559
- });
560
- }
561
- }, Ar = ({
562
- type: e,
563
- size: t,
564
- labelRight: r,
565
- labelLeft: a
566
- }) => {
567
- const n = "text-sm font-medium", s = "text-base font-medium", l = "text-lg font-medium";
568
- switch (e) {
569
- case bt:
570
- case Se:
571
- return w({
572
- "text-center": e === Se,
573
- [n]: t === "small",
574
- [s]: t === "medium",
575
- [l]: t === "large"
576
- });
577
- case we:
578
- return w({
579
- [n]: t === "small" && (r || a),
580
- [s]: t === "medium" && (r || a),
581
- [l]: t === "large" && (r || a)
582
- });
583
- }
584
- }, Pr = ({
585
- mode: e,
586
- noBackground: t,
587
- noTruncate: r,
588
- variant: a
589
- }) => {
590
- if (t)
591
- return "not-prose";
592
- if (a === "primary")
593
- return w("not-prose", {
594
- truncate: !r,
595
- "text-copy-light": e === "dark" || e === "system",
596
- "text-copy-lighter": e === "light" || e === "alt-system",
597
- "dark:text-copy-lighter": e === "system",
598
- "dark:text-copy-light": e === "alt-system"
599
- });
600
- if (a === "secondary")
601
- return w("not-prose", {
602
- truncate: !r,
603
- "text-copy-light": e === "light" || e === "system",
604
- "text-copy-lighter": e === "dark" || e === "alt-system",
605
- "dark:text-copy-lighter": e === "alt-system",
606
- "dark:text-copy-light": e === "system"
607
- });
608
- if (a === "danger")
609
- return w("not-prose", {
610
- truncate: !r,
611
- "text-copy-light": e === "dark" || e === "system",
612
- "text-copy-lighter": e === "light" || e === "alt-system",
613
- "dark:text-copy-lighter": e === "system",
614
- "dark:text-copy-light": e === "alt-system"
615
- });
616
- if (a === "selected")
617
- return w("not-prose text-copy-lighter", {
618
- truncate: !r
619
- });
620
- }, Br = ({
621
- mode: e,
622
- noBackground: t,
623
- variant: r
624
- }) => {
625
- if (!t) {
626
- if (r === "primary")
627
- return w({
628
- "bg-action-dark": e === "dark",
629
- "bg-action-light": e === "light",
630
- "bg-action-dark dark:bg-action-light": e === "system",
631
- "bg-action-light dark:bg-action-dark": e === "alt-system"
632
- });
633
- if (r === "secondary")
634
- return w({
635
- "bg-action-dark": e === "light",
636
- "bg-action-light": e === "dark",
637
- "bg-action-dark dark:bg-action-light": e === "alt-system",
638
- "bg-action-light dark:bg-action-dark": e === "system"
639
- });
640
- if (r === "danger")
641
- return w({
642
- "bg-action-danger-dark": e === "dark",
643
- "bg-action-danger-light": e === "light",
644
- "bg-action-danger-dark dark:bg-action-danger-light": e === "system",
645
- "bg-action-danger-light dark:bg-action-danger-dark": e === "alt-system"
646
- });
647
- if (r === "selected")
648
- return "bg-action-selected-dark";
649
- }
650
- }, Or = ({
651
- radius: e
652
- }) => w({
653
- "rounded-full": e === "large",
654
- "rounded-md": e === "medium",
655
- "rounded-sm": e === "small"
656
- }), $r = ({
657
- mode: e,
658
- disabled: t,
659
- variant: r
660
- }) => {
661
- if (t)
662
- return "";
663
- if (r === "primary")
664
- return w("hover:text-copy-light-hover", {
665
- "hover:bg-action-dark-hover": e === "dark",
666
- "hover:bg-action-light-hover": e === "light",
667
- "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "system",
668
- "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "alt-system"
669
- });
670
- if (r === "secondary")
671
- return w("hover:text-copy-light-hover", {
672
- "hover:bg-action-dark-hover": e === "light",
673
- "hover:bg-action-light-hover": e === "dark",
674
- "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "alt-system",
675
- "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "system"
676
- });
677
- if (r === "danger")
678
- return w("hover:text-copy-light-hover", {
679
- "hover:bg-action-danger-dark-hover": e === "dark",
680
- "hover:bg-action-danger-light-hover": e === "light",
681
- "hover:bg-action-danger-dark-hover dark:hover:bg-action-danger-light-hover": e === "system",
682
- "hover:bg-action-danger-light-hover dark:hover:bg-action-danger-dark-hover": e === "alt-system"
683
- });
684
- if (r === "selected")
685
- return "hover:text-copy-light-hover hover:bg-action-selected-dark-hover";
686
- }, Fr = ({
687
- mode: e,
688
- disabled: t,
689
- variant: r
690
- }) => {
691
- if (t)
692
- return "";
693
- if (r === "primary")
694
- return w("active:text-copy-light-active", {
695
- "active:bg-action-dark-active": e === "dark",
696
- "active:bg-action-light-active": e === "light",
697
- "active:bg-action-dark-active dark:active:bg-action-light-active": e === "system",
698
- "active:bg-action-light-active dark:active:bg-action-dark-active": e === "alt-system"
699
- });
700
- if (r === "secondary")
701
- return w("active:text-copy-light-active", {
702
- "active:bg-action-dark-active": e === "light",
703
- "active:bg-action-light-active": e === "dark",
704
- "active:bg-action-dark-active dark:active:bg-action-light-active": e === "alt-system",
705
- "active:bg-action-light-active dark:active:bg-action-dark-active": e === "system"
706
- });
707
- if (r === "danger")
708
- return w("active:text-copy-lighter-active", {
709
- "active:bg-action-danger-dark-active": e === "dark",
710
- "active:bg-action-danger-light-active": e === "light",
711
- "active:bg-action-danger-dark-active dark:active:bg-action-danger-light-active": e === "system",
712
- "active:bg-action-danger-light-active dark:active:bg-action-danger-dark-active": e === "alt-system"
713
- });
714
- if (r === "selected")
715
- return "active:text-copy-lighter-active active:bg-action-selected-dark-active";
716
- }, Dr = ({
717
- mode: e,
718
- noBorder: t,
719
- variant: r
720
- }) => {
721
- if (t)
722
- return "border border-transparent";
723
- if (r === "primary")
724
- return w("border", {
725
- "border-border-dark": e === "dark",
726
- "border-border-accent": e === "light",
727
- "border-border-dark dark:border-border-accent": e === "system",
728
- "border-border-accent dark:border-border-dark": e === "alt-system"
729
- });
730
- if (r === "secondary")
731
- return w("border", {
732
- "border-border-dark": e === "light",
733
- "border-border-accent": e === "dark",
734
- "border-border-dark dark:border-border-accent": e === "alt-system",
735
- "border-border-accent dark:border-border-dark": e === "system"
736
- });
737
- if (r === "danger")
738
- return w("border", {
739
- "border-border-danger-dark": e === "dark",
740
- "border-border-danger-medium": e === "light",
741
- "border-border-danger-dark dark:border-border-danger-medium": e === "system",
742
- "border-border-danger-medium dark:border-border-danger-dark": e === "alt-system"
743
- });
744
- if (r === "selected")
745
- return "border border-border-selected-dark";
746
- }, Vr = ({
747
- focusMode: e
748
- }) => w("focus:outline", "focus:outline-2", "focus:outline-offset-2", {
749
- "focus:outline-focus-dark": e === "dark",
750
- "focus:outline-focus-light": e === "light",
751
- "focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
752
- "focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
753
- }), vt = ({
754
- type: e,
755
- className: t,
756
- raw: r,
757
- mode: a,
758
- focusMode: n,
759
- disabled: s,
760
- fullWidth: l,
761
- size: c,
762
- noBorder: u,
763
- labelRight: i,
764
- labelLeft: f,
765
- noBackground: p,
766
- variant: g,
767
- noTruncate: d,
768
- align: m,
769
- radius: y
770
- }) => (g || (g = "primary"), r ? w(Qe, t) : w(
771
- Qe,
772
- Pr({
773
- mode: a,
774
- variant: g,
775
- noBackground: p,
776
- noTruncate: d
777
- }),
778
- Br({ mode: a, noBackground: p, variant: g }),
779
- Or({ radius: y }),
780
- zr({
781
- type: e,
782
- size: c,
783
- labelRight: i,
784
- labelLeft: f,
785
- align: m
786
- }),
787
- Ar({ type: e, size: c, labelRight: i, labelLeft: f }),
788
- Dr({ mode: a, variant: g, noBorder: u }),
789
- Vr({ focusMode: n }),
790
- $r({ mode: a, variant: g, disabled: s }),
791
- Fr({ mode: a, variant: g, disabled: s }),
792
- {
793
- "w-full": l,
794
- "disabled:cursor-not-allowed disabled:opacity-50": s
795
- },
796
- t
797
- )), Gr = (e, t, r) => {
798
- var a;
799
- !t && (!document.activeElement || document.activeElement !== e.currentTarget) && typeof ((a = e == null ? void 0 : e.currentTarget) == null ? void 0 : a.focus) == "function" && e.currentTarget.focus(), typeof r == "function" && r(e);
800
- }, $e = E.forwardRef((e, t) => {
801
- const { onClick: r, noInternalClick: a = !1, ...n } = e;
802
- return /* @__PURE__ */ o(
803
- "button",
804
- {
805
- ref: t,
806
- onClick: (s) => {
807
- Gr(s, a, r);
808
- },
809
- ...n
810
- }
811
- );
812
- });
813
- $e.displayName = "BaseButton";
814
- const yt = E.forwardRef(
815
- ({
816
- children: e,
817
- disabled: t = !1,
818
- mode: r = "system",
819
- focusMode: a = "system",
820
- fullWidth: n = !1,
821
- className: s,
822
- type: l = "button",
823
- raw: c = !1,
824
- noBorder: u = !1,
825
- "aria-label": i,
826
- label: f,
827
- size: p = "medium",
828
- labelRight: g,
829
- labelLeft: d,
830
- noBackground: m = !1,
831
- align: y = "center",
832
- radius: b = "large",
833
- variant: N = "primary",
834
- ...x
835
- }, k) => {
836
- const C = vt({
837
- type: we,
838
- mode: r,
839
- focusMode: a,
840
- fullWidth: n,
841
- disabled: t,
842
- raw: c,
843
- className: s,
844
- noBorder: u,
845
- size: p,
846
- labelRight: g,
847
- labelLeft: d,
848
- noBackground: m,
849
- align: y,
850
- radius: b,
851
- variant: N
852
- }), T = w({
853
- "text-copy-accent-dark": r === "light" && !c,
854
- "text-copy-light": r === "dark" && !c,
855
- "text-copy-accent-dark dark:text-copy-light": r === "alt-system" && !c,
856
- "text-copy-light dark:text-copy-accent-dark": r === "system" && !c
857
- });
858
- return /* @__PURE__ */ v(
859
- $e,
860
- {
861
- ref: k,
862
- className: C,
863
- disabled: t,
864
- type: l,
865
- "aria-label": i || f,
866
- ...x,
867
- children: [
868
- d && /* @__PURE__ */ o("span", { className: "pr-2", children: d }),
869
- /* @__PURE__ */ o("div", { className: T, children: e }),
870
- g && /* @__PURE__ */ o("span", { className: "pl-2", children: g })
871
- ]
872
- }
873
- );
874
- }
875
- );
876
- yt.displayName = "ButtonIcon";
877
- /*!
878
- @versini/ui-button v4.0.4
879
- © 2025 gizmette.com
880
- */
881
- try {
882
- window.__VERSINI_UI_BUTTON__ || (window.__VERSINI_UI_BUTTON__ = {
883
- version: "4.0.4",
884
- buildTime: "01/06/2025 08:01 PM EST",
885
- homepage: "https://github.com/aversini/ui-components",
886
- license: "MIT"
887
- });
888
- } catch {
889
- }
890
- const Ur = E.forwardRef(
891
- ({
892
- children: e,
893
- disabled: t = !1,
894
- mode: r = "system",
895
- focusMode: a = "system",
896
- fullWidth: n = !1,
897
- className: s,
898
- type: l = "button",
899
- raw: c = !1,
900
- noBorder: u = !1,
901
- "aria-label": i,
902
- label: f,
903
- size: p = "medium",
904
- labelRight: g,
905
- labelLeft: d,
906
- noBackground: m = !1,
907
- align: y = "center",
908
- active: b = !1,
909
- radius: N = "large",
910
- ...x
911
- }, k) => {
912
- const C = vt({
913
- type: we,
914
- mode: r,
915
- focusMode: a,
916
- fullWidth: n,
917
- disabled: t,
918
- raw: c,
919
- className: s,
920
- noBorder: u,
921
- size: p,
922
- labelRight: g,
923
- labelLeft: d,
924
- noBackground: m,
925
- align: y,
926
- radius: N
927
- }), T = w({
928
- "text-copy-accent-dark": r === "light" && !c,
929
- "text-copy-light": r === "dark" && !c,
930
- "text-copy-accent-dark dark:text-copy-light": r === "alt-system" && !c,
931
- "text-copy-light dark:text-copy-accent-dark": r === "system" && !c
932
- }), A = b ? w(
933
- "relative",
934
- "focus-within:static",
935
- "focus-within:after:border-transparent",
936
- "after:absolute",
937
- "after:content-['']",
938
- "after:border-b-2",
939
- "after:bottom-[-4px]",
940
- "after:left-0",
941
- "after:right-0",
942
- {
943
- "after:border-table-dark": r === "dark",
944
- "after:border-table-light": r === "light",
945
- "after:border-table-dark dark:after:border-table-light": r === "system",
946
- "after:border-table-light dark:after:border-table-dark": r === "alt-system"
947
- }
948
- ) : "";
949
- return /* @__PURE__ */ o("div", { className: A, children: /* @__PURE__ */ v(
950
- $e,
951
- {
952
- ref: k,
953
- className: C,
954
- disabled: t,
955
- type: l,
956
- "aria-label": i || f,
957
- ...x,
958
- children: [
959
- d && /* @__PURE__ */ o("span", { className: "pr-2", children: d }),
960
- /* @__PURE__ */ o("div", { className: T, children: e }),
961
- g && /* @__PURE__ */ o("span", { className: "pl-2", children: g })
962
- ]
963
- }
964
- ) });
965
- }
966
- );
967
- Ur.displayName = "ButtonSort";
968
- const Hr = ({
969
- children: e,
970
- fill: t,
971
- viewBox: r,
972
- className: a,
973
- defaultViewBox: n,
974
- size: s,
975
- title: l,
976
- semantic: c = !1,
977
- ...u
978
- }) => {
979
- const i = w(s, a);
980
- return /* @__PURE__ */ v(z, { children: [
981
- /* @__PURE__ */ o(
982
- "svg",
983
- {
984
- xmlns: "http://www.w3.org/2000/svg",
985
- className: i,
986
- viewBox: r || n,
987
- fill: t || "currentColor",
988
- role: "img",
989
- "aria-hidden": !c,
990
- focusable: !1,
991
- ...u,
992
- children: e
993
- }
994
- ),
995
- l && c && /* @__PURE__ */ o("span", { className: "sr-only", children: l })
996
- ] });
997
- };
998
- /*!
999
- @versini/ui-svgicon v4.0.1
1000
- © 2025 gizmette.com
1001
- */
1002
- try {
1003
- window.__VERSINI_UI_SVGICON__ || (window.__VERSINI_UI_SVGICON__ = {
1004
- version: "4.0.1",
1005
- buildTime: "01/06/2025 08:00 PM EST",
1006
- homepage: "https://github.com/aversini/ui-components",
1007
- license: "MIT"
1008
- });
1009
- } catch {
1010
- }
1011
- const jr = ({
1012
- className: e,
1013
- viewBox: t,
1014
- title: r,
1015
- monotone: a,
1016
- ...n
1017
- }) => /* @__PURE__ */ o(
1018
- Hr,
1019
- {
1020
- defaultViewBox: "0 0 384 512",
1021
- size: "size-5",
1022
- viewBox: t,
1023
- className: e,
1024
- title: r || "Close",
1025
- ...n,
1026
- children: /* @__PURE__ */ o("path", { d: "M345 137c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-119 119L73 103c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l119 119L39 375c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l119-119L311 409c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-119-119L345 137z" })
1027
- }
1028
- );
1029
- /*!
1030
- @versini/ui-icons v4.2.1
1031
- © 2025 gizmette.com
1032
- */
1033
- try {
1034
- window.__VERSINI_UI_ICONS__ || (window.__VERSINI_UI_ICONS__ = {
1035
- version: "4.2.1",
1036
- buildTime: "01/06/2025 08:00 PM EST",
1037
- homepage: "https://github.com/aversini/ui-components",
1038
- license: "MIT"
1039
- });
1040
- } catch {
1041
- }
1042
- const kt = h.createContext(null);
1043
- function Wr({
1044
- initialOpen: e = !1,
1045
- open: t,
1046
- onOpenChange: r
1047
- } = {}) {
1048
- const [a, n] = h.useState(e), [s, l] = h.useState(), [c, u] = h.useState(), i = t ?? a, f = r ?? n, p = nt({
1049
- open: i,
1050
- onOpenChange: f
1051
- }), g = p.context, d = st(g, {
1052
- enabled: t == null
1053
- }), m = ct(g, {
1054
- outsidePress: !1,
1055
- outsidePressEvent: "mousedown"
1056
- }), y = lt(g), b = it([d, m, y]);
1057
- return h.useMemo(
1058
- () => ({
1059
- open: i,
1060
- setOpen: f,
1061
- ...b,
1062
- ...p,
1063
- labelId: s,
1064
- descriptionId: c,
1065
- setLabelId: l,
1066
- setDescriptionId: u
1067
- }),
1068
- [i, f, b, p, s, c]
1069
- );
1070
- }
1071
- const Ne = () => {
1072
- const e = h.useContext(kt);
1073
- if (e == null)
1074
- throw new Error("Modal components must be wrapped in <Modal />");
1075
- return e;
1076
- };
1077
- function Kr({
1078
- children: e,
1079
- ...t
1080
- }) {
1081
- const r = Wr(t);
1082
- return /* @__PURE__ */ o(kt.Provider, { value: r, children: e });
1083
- }
1084
- const Yr = h.forwardRef(function(e, t) {
1085
- const { context: r, ...a } = Ne(), n = Ae([a.refs.setFloating, t]);
1086
- if (!r.open)
1087
- return null;
1088
- const { overlayBackground: s, ...l } = e, c = w("grid place-items-center", {
1089
- [`${s}`]: s,
1090
- "bg-black sm:bg-black/[.8]": !s
1091
- });
1092
- return /* @__PURE__ */ o(dt, { children: /* @__PURE__ */ o(gr, { className: c, lockScroll: !0, children: /* @__PURE__ */ o(ut, { context: r, children: /* @__PURE__ */ o(
1093
- "div",
1094
- {
1095
- ref: n,
1096
- "aria-labelledby": a.labelId,
1097
- "aria-describedby": a.descriptionId,
1098
- ...a.getFloatingProps(l),
1099
- children: l.children
1100
- }
1101
- ) }) }) });
1102
- }), Zr = h.forwardRef(function({ children: e, ...t }, r) {
1103
- const { setLabelId: a } = Ne(), n = ze();
1104
- return h.useLayoutEffect(() => (a(n), () => a(void 0)), [n, a]), /* @__PURE__ */ o("h1", { ...t, ref: r, id: n, children: e });
1105
- }), qr = h.forwardRef(function({ children: e, ...t }, r) {
1106
- const { setDescriptionId: a } = Ne(), n = ze();
1107
- return h.useLayoutEffect(() => (a(n), () => a(void 0)), [n, a]), /* @__PURE__ */ o("div", { ...t, ref: r, id: n, children: e });
1108
- }), Qr = h.forwardRef(function(e, t) {
1109
- const { setOpen: r } = Ne(), { trigger: a, className: n, ...s } = e, l = h.useCallback(() => r(!1), [r]);
1110
- return /* @__PURE__ */ o("div", { className: n, children: h.cloneElement(a, {
1111
- ref: t,
1112
- onClick: l,
1113
- ...s
1114
- }) });
1115
- });
1116
- /*!
1117
- @versini/ui-modal v1.2.1
1118
- © 2025 gizmette.com
1119
- */
1120
- try {
1121
- window.__VERSINI_UI_MODAL__ || (window.__VERSINI_UI_MODAL__ = {
1122
- version: "1.2.1",
1123
- buildTime: "01/06/2025 08:00 PM EST",
1124
- homepage: "https://github.com/aversini/ui-components",
1125
- license: "MIT"
1126
- });
1127
- } catch {
1128
- }
1129
- const ie = "panel", fe = "messagebox", Xr = ({
1130
- className: e,
1131
- kind: t,
1132
- borderMode: r
1133
- }) => ({
1134
- main: w("prose prose-lighter flex flex-col bg-surface-medium", {
1135
- [`${qe} max-h-full sm:max-h-[95%] min-h-full sm:min-h-[10rem] sm:rounded-lg sm:border-2`]: t === ie,
1136
- [`${qe} w-full sm:w-[95%] md:max-w-2xl`]: t === ie && !e,
1137
- [`${Ze} rounded-lg border-2`]: t === fe,
1138
- [`${Ze} w-[95%] sm:w-[50%] md:max-w-2xl`]: t === fe && !e,
1139
- [`${e}`]: !!e,
1140
- "sm:border-border-dark": r === "dark" && t === ie,
1141
- "sm:border-border-accent": r === "light" && t === ie,
1142
- "border-border-dark": r === "dark" && t === fe,
1143
- "border-border-accent": r === "light" && t === fe
1144
- }),
1145
- content: "flex flex-col py-2 sm:py-4 sm:px-4 px-2 overflow-y-auto",
1146
- footer: "flex flex-grow flex-col sm:p-4 p-2",
1147
- header: "sm:p-4 mb-0 p-2",
1148
- close: "sm:p-4 p-2"
1149
- }), ne = ({
1150
- open: e,
1151
- onOpenChange: t,
1152
- title: r,
1153
- children: a,
1154
- footer: n,
1155
- borderMode: s = "light",
1156
- kind: l = ie,
1157
- className: c
1158
- }) => {
1159
- const u = re(""), i = Xr({ className: c, kind: l, borderMode: s });
1160
- return Z(() => (e && (u.current = document.title, document.title = `${r} | ${u.current}`), () => {
1161
- e && (document.title = u.current);
1162
- }), [r, e]), /* @__PURE__ */ o(z, { children: e && /* @__PURE__ */ o(Kr, { open: e, onOpenChange: t, children: /* @__PURE__ */ v(Yr, { className: i.main, children: [
1163
- /* @__PURE__ */ v("div", { className: "flex flex-row-reverse items-center justify-between", children: [
1164
- /* @__PURE__ */ o(
1165
- Qr,
1166
- {
1167
- className: i.close,
1168
- trigger: /* @__PURE__ */ o(
1169
- yt,
1170
- {
1171
- mode: "dark",
1172
- focusMode: "light",
1173
- noBorder: !0,
1174
- label: "Close",
1175
- children: /* @__PURE__ */ o(jr, {})
1176
- }
1177
- )
1178
- }
1179
- ),
1180
- /* @__PURE__ */ o(Zr, { className: i.header, children: r })
1181
- ] }),
1182
- /* @__PURE__ */ o(qr, { className: i.content, children: a }),
1183
- n && /* @__PURE__ */ o("div", { className: i.footer, children: n })
1184
- ] }) }) });
1185
- }, Jr = () => {
1186
- const { getAccessToken: e } = D(), t = ve(), r = ve(), {
1187
- data: a,
1188
- error: n,
1189
- isLoading: s
1190
- } = mt({
1191
- getAccessToken: e
1192
- }), l = (a == null ? void 0 : a.plugins) || [], c = (a == null ? void 0 : a.version) || "", u = (a == null ? void 0 : a.models) || [];
1193
- return /* @__PURE__ */ v(z, { children: [
1194
- /* @__PURE__ */ o("div", { className: "mb-4", children: /* @__PURE__ */ o(
1195
- F,
1196
- {
1197
- header: _.ABOUT.TITLE_CLIENT,
1198
- className: "prose-dark dark:prose-lighter",
1199
- children: pe(t, {
1200
- [_.ABOUT.VERSION]: "5.19.11",
1201
- [_.ABOUT.BUILD_TIMESTAMP]: "01/07/2025 09:42 AM EST"
1202
- })
1203
- }
1204
- ) }),
1205
- n || s ? null : /* @__PURE__ */ o(
1206
- F,
1207
- {
1208
- header: _.ABOUT.TITLE_SERVER,
1209
- className: "prose-dark dark:prose-lighter",
1210
- children: pe(r, {
1211
- [_.ABOUT.VERSION]: c,
1212
- [be(_.ABOUT.ENGINE, u.length)]: /* @__PURE__ */ o(z, { children: u.map((i) => /* @__PURE__ */ o("div", { className: "text-right", children: i }, i)) }),
1213
- [be(_.ABOUT.PLUGIN, l.length)]: /* @__PURE__ */ o(z, { children: l.map((i) => /* @__PURE__ */ o("div", { className: "text-right", children: i }, i)) })
1214
- })
1215
- }
1216
- )
1217
- ] });
1218
- }, eo = ({
1219
- open: e,
1220
- onOpenChange: t
1221
- }) => /* @__PURE__ */ o(ne, { open: e, onOpenChange: t, title: Dt, children: /* @__PURE__ */ o(Jr, {}) }), wt = ({
1222
- showConfirmation: e,
1223
- setShowConfirmation: t,
1224
- action: r,
1225
- children: a,
1226
- customStrings: n
1227
- }) => /* @__PURE__ */ o(
1228
- ne,
1229
- {
1230
- kind: "messagebox",
1231
- open: e,
1232
- onOpenChange: t,
1233
- title: n.title,
1234
- footer: /* @__PURE__ */ v(K, { columnGap: 2, alignHorizontal: "flex-end", children: [
1235
- /* @__PURE__ */ o(M, { children: /* @__PURE__ */ o(
1236
- U,
1237
- {
1238
- mode: "dark",
1239
- variant: "secondary",
1240
- focusMode: "light",
1241
- onClick: () => {
1242
- t(!1);
1243
- },
1244
- children: n.cancelAction
1245
- }
1246
- ) }),
1247
- /* @__PURE__ */ o(M, { children: /* @__PURE__ */ o(
1248
- U,
1249
- {
1250
- mode: "dark",
1251
- variant: "danger",
1252
- focusMode: "light",
1253
- onClick: () => {
1254
- t(!1), r();
1255
- },
1256
- children: n.confirmAction
1257
- }
1258
- ) })
1259
- ] }),
1260
- children: a
1261
- }
1262
- ), to = async (e, t, r, a) => {
1263
- try {
1264
- const n = await oe({
1265
- accessToken: a,
1266
- type: ae.GET_CHAT,
1267
- params: {
1268
- id: e.id
1269
- }
1270
- });
1271
- n.status === 200 && (t({
1272
- type: et
1273
- }), t({
1274
- type: Gt,
1275
- payload: {
1276
- id: e.id,
1277
- model: n.data.model,
1278
- usage: n.data.usage,
1279
- messages: n.data.messages
1280
- }
1281
- }), r(!1));
1282
- } catch {
1283
- }
1284
- }, ro = ({
1285
- filteredHistory: e,
1286
- dispatch: t,
1287
- onOpenChange: r,
1288
- mutate: a
1289
- }) => {
1290
- var x;
1291
- const { user: n, getAccessToken: s } = D(), l = re(null), c = re({
1292
- id: 0,
1293
- timestamp: "",
1294
- message: ""
1295
- }), [u, i] = R(!1), [f, p] = R(
1296
- Ge + Ue
1297
- ), { state: g, dispatch: d } = Y(ht), [, m] = me({
1298
- key: ue + Vt,
1299
- initialValue: g.sortDirection
1300
- }), y = (k) => {
1301
- switch (g.sortDirection) {
1302
- case ce.ASC:
1303
- m(ce.DESC), d({
1304
- type: He,
1305
- payload: {
1306
- sortedCell: k,
1307
- sortDirection: ce.DESC
1308
- }
1309
- });
1310
- break;
1311
- default:
1312
- m(ce.ASC), d({
1313
- type: He,
1314
- payload: {
1315
- sortedCell: k,
1316
- sortDirection: ce.ASC
1317
- }
1318
- });
1319
- break;
1320
- }
1321
- }, b = async () => {
1322
- const k = c.current;
1323
- try {
1324
- await oe({
1325
- accessToken: await s(),
1326
- type: ae.DELETE_CHAT,
1327
- params: {
1328
- userId: (n == null ? void 0 : n.username) || "",
1329
- id: k.id
1330
- }
1331
- }), a();
1332
- } catch {
1333
- }
1334
- }, N = rr((k) => {
1335
- k[0].isIntersecting && p((T) => T + Ge);
1336
- }, []);
1337
- return Z(() => {
1338
- const k = {
1339
- // root: null,
1340
- rootMargin: "20px"
1341
- }, C = new IntersectionObserver(N, k);
1342
- l.current && C.observe(l.current);
1343
- }), /* @__PURE__ */ v(z, { children: [
1344
- /* @__PURE__ */ v(
1345
- wt,
1346
- {
1347
- showConfirmation: u,
1348
- setShowConfirmation: i,
1349
- action: b,
1350
- customStrings: {
1351
- confirmAction: "Delete",
1352
- cancelAction: "Cancel",
1353
- title: "Delete chat"
1354
- },
1355
- children: [
1356
- /* @__PURE__ */ o("p", { className: "m-0", children: "Are you sure you want to delete the following chat:" }),
1357
- /* @__PURE__ */ v("ul", { className: "m-0", children: [
1358
- /* @__PURE__ */ v("li", { children: [
1359
- "Timestamp:",
1360
- " ",
1361
- /* @__PURE__ */ o("span", { className: "text-lg", children: c.current && c.current.timestamp })
1362
- ] }),
1363
- /* @__PURE__ */ v("li", { children: [
1364
- "First message:",
1365
- " ",
1366
- /* @__PURE__ */ o("span", { className: "text-lg", children: (x = c.current) == null ? void 0 : x.message })
1367
- ] })
1368
- ] })
1369
- ]
1370
- }
1371
- ),
1372
- /* @__PURE__ */ v(fr, { stickyHeader: !0, stickyFooter: !0, compact: !0, children: [
1373
- /* @__PURE__ */ o(pr, { children: /* @__PURE__ */ v(Ie, { children: [
1374
- /* @__PURE__ */ o($, { className: "sr-only", children: "Row" }),
1375
- /* @__PURE__ */ o(
1376
- br,
1377
- {
1378
- buttonClassName: "text-xs sm:text-sm",
1379
- cellId: "timestamp",
1380
- align: "left",
1381
- sortDirection: g.sortDirection,
1382
- sortedCell: g.sortedCell,
1383
- onClick: () => {
1384
- y("timestamp");
1385
- },
1386
- children: "Date"
1387
- }
1388
- ),
1389
- /* @__PURE__ */ o($, { className: "text-xs sm:text-sm", children: "First message" }),
1390
- /* @__PURE__ */ o($, { className: "text-xs sm:text-sm", children: "Model" }),
1391
- /* @__PURE__ */ o($, { className: "text-xs sm:text-sm text-right", children: "Actions" })
1392
- ] }) }),
1393
- /* @__PURE__ */ o(vr, { children: e.slice(0, f).map((k, C) => {
1394
- var T, A;
1395
- return ((T = k == null ? void 0 : k.messages) == null ? void 0 : T.length) > 0 ? /* @__PURE__ */ v(or, { children: [
1396
- C === f - Ue && /* @__PURE__ */ o("tr", { ref: l }),
1397
- /* @__PURE__ */ v(Ie, { children: [
1398
- /* @__PURE__ */ o($, { children: C + 1 }),
1399
- /* @__PURE__ */ o(
1400
- $,
1401
- {
1402
- component: "th",
1403
- scope: "row",
1404
- className: "text-gray-400 sm:whitespace-nowrap text-xs sm:text-sm max-w-20 sm:max-w-none",
1405
- children: k.timestamp.split(",")[0]
1406
- }
1407
- ),
1408
- /* @__PURE__ */ o(
1409
- $,
1410
- {
1411
- className: "max-w-[100px] text-white sm:max-w-full text-xs sm:text-sm",
1412
- style: {
1413
- wordBreak: "break-word"
1414
- },
1415
- children: k.messages.length > 0 ? (A = k.messages[0]) == null ? void 0 : A.content : ""
1416
- }
1417
- ),
1418
- /* @__PURE__ */ v(
1419
- $,
1420
- {
1421
- component: "th",
1422
- scope: "row",
1423
- className: "text-gray-400",
1424
- align: "center",
1425
- children: [
1426
- k.model && k.model.startsWith("claude") && /* @__PURE__ */ o(gt, { size: "size-4 sm:size-5" }),
1427
- k.model && k.model.startsWith("gpt") && /* @__PURE__ */ o(ft, { size: "size-4 sm:size-5" })
1428
- ]
1429
- }
1430
- ),
1431
- /* @__PURE__ */ v($, { align: "right", children: [
1432
- /* @__PURE__ */ o(
1433
- te,
1434
- {
1435
- className: "mr-2",
1436
- focusMode: "alt-system",
1437
- noBorder: !0,
1438
- label: "Restore chat",
1439
- onClick: async () => {
1440
- const L = await s();
1441
- to(
1442
- k,
1443
- t,
1444
- r,
1445
- L
1446
- );
1447
- },
1448
- children: /* @__PURE__ */ o(Sr, { size: "size-3", monotone: !0 })
1449
- }
1450
- ),
1451
- /* @__PURE__ */ o(
1452
- te,
1453
- {
1454
- focusMode: "alt-system",
1455
- noBorder: !0,
1456
- label: "Delete chat",
1457
- onClick: () => {
1458
- var L;
1459
- c.current = {
1460
- id: k.id,
1461
- timestamp: k.timestamp,
1462
- message: k.messages.length > 0 ? (L = k.messages[0]) == null ? void 0 : L.content : ""
1463
- }, i(!u);
1464
- },
1465
- children: /* @__PURE__ */ o("div", { className: "text-red-400", children: /* @__PURE__ */ o(Cr, { size: "size-3", monotone: !0 }) })
1466
- }
1467
- )
1468
- ] })
1469
- ] })
1470
- ] }, `${_.HISTORY.TITLE}-${k.id}-${C}`) : null;
1471
- }) }),
1472
- /* @__PURE__ */ o(yr, { children: /* @__PURE__ */ o(Ie, { children: /* @__PURE__ */ o($, { colSpan: 1e3, children: /* @__PURE__ */ o("div", { children: be(
1473
- `${e.length} chat`,
1474
- e.length
1475
- ) }) }) }) })
1476
- ] })
1477
- ] });
1478
- }, oo = ({
1479
- open: e,
1480
- onOpenChange: t
1481
- }) => {
1482
- const { getAccessToken: r, user: a } = D(), { dispatch: n } = Y(Pe), { state: s, dispatch: l } = Y(ht), { data: c, mutate: u } = kr({
1483
- keys: [
1484
- a == null ? void 0 : a.username,
1485
- s.searchString,
1486
- s.sortDirection
1487
- ],
1488
- getAccessToken: r
1489
- }), i = re(null), [, f] = me({
1490
- key: ue + Ut,
1491
- initialValue: s.searchString
1492
- }), [p, g] = R([]);
1493
- Z(() => {
1494
- c && g(c);
1495
- }, [c]);
1496
- const d = async (b) => {
1497
- f(b), l({
1498
- type: jt,
1499
- payload: { searchString: b }
1500
- });
1501
- }, m = Wt((b) => {
1502
- d(b.target.value.trim());
1503
- }, 500);
1504
- return /* @__PURE__ */ o(ne, { open: e, onOpenChange: t, title: Ht, children: /* @__PURE__ */ v(z, { children: [
1505
- /* @__PURE__ */ o("form", { autoComplete: "off", onSubmit: async (b) => {
1506
- b.preventDefault();
1507
- }, children: /* @__PURE__ */ o(
1508
- Te,
1509
- {
1510
- autoCapitalize: "off",
1511
- autoComplete: "off",
1512
- autoCorrect: "off",
1513
- ref: i,
1514
- defaultValue: s.searchString,
1515
- focusMode: "light",
1516
- mode: "dark",
1517
- name: "Search",
1518
- label: "Search",
1519
- onChange: m,
1520
- className: "mt-2 mb-2",
1521
- ...s.searchString && {
1522
- rightElement: /* @__PURE__ */ o(
1523
- U,
1524
- {
1525
- type: "button",
1526
- disabled: !s.searchString,
1527
- mode: "light",
1528
- focusMode: "light",
1529
- noBorder: !0,
1530
- size: "small",
1531
- onClick: () => {
1532
- var b;
1533
- d(""), (b = i.current) != null && b.value && (i.current.value = "", i.current.focus());
1534
- },
1535
- children: "Reset"
1536
- }
1537
- )
1538
- }
1539
- }
1540
- ) }),
1541
- /* @__PURE__ */ o("div", { className: "flex flex-col gap-2 sm:flex-row max-h-[60vh] min-h-[60vh]", children: /* @__PURE__ */ o(
1542
- ro,
1543
- {
1544
- mutate: u,
1545
- filteredHistory: p,
1546
- dispatch: n,
1547
- onOpenChange: t
1548
- }
1549
- ) })
1550
- ] }) });
1551
- }, ao = ({ stats: e }) => {
1552
- const { isAuthenticated: t, user: r, registeringForPasskey: a, authenticationType: n } = D(), s = ve(), l = ve(), c = (r == null ? void 0 : r.username) || "";
1553
- return t && c ? /* @__PURE__ */ v(z, { children: [
1554
- /* @__PURE__ */ o(
1555
- F,
1556
- {
1557
- header: _.PREFERENCES.TITLE,
1558
- className: "prose-dark dark:prose-lighter",
1559
- children: pe(s, {
1560
- [_.PREFERENCES.NAME]: c,
1561
- [_.PREFERENCES.EMAIL]: (r == null ? void 0 : r.email) || ""
1562
- })
1563
- }
1564
- ),
1565
- n !== Kt.PASSKEY && /* @__PURE__ */ v(
1566
- F,
1567
- {
1568
- className: "prose-dark dark:prose-lighter mt-4",
1569
- header: /* @__PURE__ */ o("h2", { className: "m-0", children: /* @__PURE__ */ v(K, { columnGap: 3, alignVertical: "center", children: [
1570
- /* @__PURE__ */ o(M, { children: /* @__PURE__ */ o(je, { size: "size-8" }) }),
1571
- /* @__PURE__ */ o(M, { children: /* @__PURE__ */ o("div", { children: _.PREFERENCES.PASSKEY_TITLE }) })
1572
- ] }) }),
1573
- children: [
1574
- /* @__PURE__ */ o("p", { children: _.PREFERENCES.PASSKEY_INSTRUCTIONS }),
1575
- /* @__PURE__ */ o(
1576
- te,
1577
- {
1578
- size: "small",
1579
- className: "mt-2",
1580
- onClick: a,
1581
- labelLeft: _.PREFERENCES.PASSKEY_BUTTON,
1582
- children: /* @__PURE__ */ o(je, { size: "size-5", monotone: !0 })
1583
- }
1584
- )
1585
- ]
1586
- }
1587
- ),
1588
- /* @__PURE__ */ o(
1589
- F,
1590
- {
1591
- header: _.MAIN_STATISTICS.TITLE,
1592
- className: "prose-dark dark:prose-lighter mt-4",
1593
- children: pe(l, {
1594
- [be(_.MAIN_STATISTICS.TOTAL, e.totalChats)]: e.totalChats,
1595
- [_.MAIN_STATISTICS.PROCESSING_TIME]: Yt(
1596
- e.averageProcessingTimes
1597
- )
1598
- })
1599
- }
1600
- )
1601
- ] }) : null;
1602
- }, no = ({
1603
- open: e,
1604
- onOpenChange: t
1605
- }) => {
1606
- const { getAccessToken: r, user: a } = D(), {
1607
- data: n,
1608
- error: s,
1609
- isLoading: l
1610
- } = wr({
1611
- keys: [a == null ? void 0 : a.username],
1612
- getAccessToken: r
1613
- });
1614
- return s || l ? null : /* @__PURE__ */ o(ne, { open: e, onOpenChange: t, title: Zt, children: /* @__PURE__ */ o(ao, { stats: n }) });
1615
- };
1616
- /*!
1617
- @versini/ui-toggle v3.0.1
1618
- © 2025 gizmette.com
1619
- */
1620
- try {
1621
- window.__VERSINI_UI_TOGGLE__ || (window.__VERSINI_UI_TOGGLE__ = {
1622
- version: "3.0.1",
1623
- buildTime: "01/06/2025 08:00 PM EST",
1624
- homepage: "https://github.com/aversini/ui-components",
1625
- license: "MIT"
1626
- });
1627
- } catch {
1628
- }
1629
- const so = "av-toggle", lo = () => w("peer", "h-6", "w-11", "rounded-full"), co = ({
1630
- focusMode: e
1631
- }) => w(
1632
- "peer-focus:outline",
1633
- "peer-focus:outline-2",
1634
- "peer-focus:outline-offset-2",
1635
- {
1636
- "peer-focus:outline-focus-dark": e === "dark",
1637
- "peer-focus:outline-focus-light": e === "light",
1638
- "peer-focus:outline-focus-light dark:peer-focus:outline-focus-dark": e === "alt-system",
1639
- "peer-focus:outline-focus-dark dark:peer-focus:outline-focus-light": e === "system"
1640
- }
1641
- ), io = () => w(
1642
- "peer-checked:after:translate-x-full",
1643
- // background color when checked
1644
- "peer-checked:bg-violet-500",
1645
- // knob circle and border color when checked
1646
- "peer-checked:after:bg-white",
1647
- "peer-checked:after:border-white"
1648
- ), uo = () => w(
1649
- "after:left-[2px]",
1650
- "after:top-[2px]",
1651
- "after:border",
1652
- "after:border-surface-light dark:after:border-surface-medium",
1653
- "after:bg-surface-light dark:after:bg-surface-medium",
1654
- "after:absolute",
1655
- "after:h-5",
1656
- "after:w-5",
1657
- "after:rounded-full",
1658
- "after:transition-all",
1659
- "after:content-['']"
1660
- ), mo = ({
1661
- mode: e,
1662
- noBorder: t
1663
- }) => w({
1664
- border: !t,
1665
- "border-border-dark bg-surface-medium": e === "light",
1666
- "border-border-light bg-surface-darker": e === "dark",
1667
- "border-border-light bg-surface-darker dark:border-border-dark dark:bg-surface-medium": e === "alt-system",
1668
- "border-border-dark bg-surface-medium dark:border-border-light dark:bg-surface-darker": e === "system"
1669
- }), ho = ({
1670
- mode: e,
1671
- labelHidden: t
1672
- }) => t ? "sr-only" : w("ml-2 text-sm", {
1673
- "text-copy-dark": e === "light",
1674
- "text-copy-lighter": e === "dark",
1675
- "text-copy-lighter dark:text-copy-dark": e === "alt-system",
1676
- "text-copy-dark dark:text-copy-lighter": e === "system"
1677
- }), go = ({ className: e }) => w(
1678
- so,
1679
- "relative flex cursor-pointer items-center",
1680
- e
1681
- ), fo = ({
1682
- mode: e,
1683
- focusMode: t,
1684
- labelHidden: r,
1685
- className: a,
1686
- noBorder: n
1687
- }) => ({
1688
- toggle: w(
1689
- lo(),
1690
- mo({ mode: e, noBorder: n }),
1691
- co({ focusMode: t }),
1692
- uo(),
1693
- io()
1694
- ),
1695
- label: ho({ mode: e, labelHidden: r }),
1696
- input: "peer sr-only",
1697
- wrapper: go({ className: a })
1698
- }), de = ({
1699
- checked: e = !1,
1700
- onChange: t,
1701
- label: r,
1702
- labelHidden: a = !1,
1703
- name: n,
1704
- mode: s = "system",
1705
- focusMode: l = "system",
1706
- className: c,
1707
- noBorder: u = !1
1708
- }) => {
1709
- const i = fo({
1710
- mode: s,
1711
- focusMode: l,
1712
- labelHidden: a,
1713
- className: c,
1714
- noBorder: u
1715
- }), f = (p) => {
1716
- t == null || t(p.target.checked);
1717
- };
1718
- return /* @__PURE__ */ v("label", { className: i.wrapper, children: [
1719
- /* @__PURE__ */ o(
1720
- "input",
1721
- {
1722
- name: n,
1723
- checked: e,
1724
- type: "checkbox",
1725
- className: i.input,
1726
- onChange: f
1727
- }
1728
- ),
1729
- /* @__PURE__ */ o("div", { className: i.toggle }),
1730
- /* @__PURE__ */ o("span", { className: i.label, children: r })
1731
- ] });
1732
- }, po = ({
1733
- open: e,
1734
- onOpenChange: t
1735
- }) => {
1736
- const { getAccessToken: r, user: a } = D(), {
1737
- data: n,
1738
- error: s,
1739
- isLoading: l,
1740
- mutate: c
1741
- } = Be({
1742
- keys: [a == null ? void 0 : a.username],
1743
- getAccessToken: r
1744
- }), [u, i] = R({
1745
- prompts: []
1746
- }), f = ({
1747
- slot: d,
1748
- checked: m,
1749
- label: y,
1750
- content: b
1751
- }) => {
1752
- i((N) => {
1753
- const x = N.prompts, k = {
1754
- slot: d,
1755
- label: y,
1756
- content: b,
1757
- enabled: m
1758
- }, C = x.findIndex((T) => T.slot === d);
1759
- return C === -1 ? {
1760
- ...N,
1761
- prompts: [...x, { ...k, slot: d }]
1762
- } : (x[C] = k, {
1763
- ...N,
1764
- prompts: [...x]
1765
- });
1766
- });
1767
- }, p = async (d) => {
1768
- d.preventDefault();
1769
- try {
1770
- await oe({
1771
- accessToken: await r(),
1772
- type: ae.SET_USER_PREFERENCES,
1773
- params: {
1774
- user: a == null ? void 0 : a.username,
1775
- tags: u.prompts
1776
- }
1777
- });
1778
- } catch {
1779
- }
1780
- }, g = () => {
1781
- c({ ...n }), t(!1);
1782
- };
1783
- return Z(() => {
1784
- n != null && n.tags && i({ prompts: n.tags });
1785
- }, [n]), s || l ? null : /* @__PURE__ */ v(
1786
- ne,
1787
- {
1788
- open: e,
1789
- onOpenChange: g,
1790
- title: "Prompts",
1791
- footer: /* @__PURE__ */ v(
1792
- K,
1793
- {
1794
- columnGap: 2,
1795
- alignHorizontal: "flex-end",
1796
- className: "pb-8 sm:pb-0",
1797
- children: [
1798
- /* @__PURE__ */ o(M, { children: /* @__PURE__ */ o(
1799
- U,
1800
- {
1801
- mode: "dark",
1802
- variant: "secondary",
1803
- focusMode: "light",
1804
- onClick: g,
1805
- children: "Cancel"
1806
- }
1807
- ) }),
1808
- /* @__PURE__ */ o(M, { children: /* @__PURE__ */ o(
1809
- U,
1810
- {
1811
- mode: "dark",
1812
- variant: "danger",
1813
- focusMode: "light",
1814
- onClick: async (d) => {
1815
- t(!1), await p(d);
1816
- },
1817
- children: "Save"
1818
- }
1819
- ) })
1820
- ]
1821
- }
1822
- ),
1823
- children: [
1824
- /* @__PURE__ */ o("p", { children: qt }),
1825
- u.prompts && u.prompts.map((d) => /* @__PURE__ */ v(
1826
- F,
1827
- {
1828
- header: `Prompt ${d.slot + 1}`,
1829
- className: "prose-dark dark:prose-lighter mb-2",
1830
- children: [
1831
- /* @__PURE__ */ v(K, { className: "mt-8 mb-6", columnGap: 2, rowGap: 6, children: [
1832
- /* @__PURE__ */ o(M, { span: 12, children: /* @__PURE__ */ o(
1833
- Te,
1834
- {
1835
- label: "Label",
1836
- name: `prompt${d.slot}-label`,
1837
- value: d.label,
1838
- onChange: (m) => {
1839
- f({
1840
- slot: d.slot,
1841
- checked: d.enabled,
1842
- label: m.target.value,
1843
- content: d.content
1844
- });
1845
- }
1846
- }
1847
- ) }),
1848
- /* @__PURE__ */ o(M, { span: 12, children: /* @__PURE__ */ o(
1849
- Te,
1850
- {
1851
- label: "Content",
1852
- name: `prompt${d.slot}-content`,
1853
- value: d.content,
1854
- onChange: (m) => {
1855
- f({
1856
- slot: d.slot,
1857
- checked: d.enabled,
1858
- label: d.label,
1859
- content: m.target.value
1860
- });
1861
- }
1862
- }
1863
- ) })
1864
- ] }),
1865
- /* @__PURE__ */ o(
1866
- de,
1867
- {
1868
- className: "mt-2",
1869
- noBorder: !0,
1870
- label: "Enabled",
1871
- name: d.slot.toString(),
1872
- onChange: (m) => {
1873
- f({
1874
- slot: d.slot,
1875
- checked: m,
1876
- label: d.label,
1877
- content: d.content
1878
- });
1879
- },
1880
- checked: d.enabled
1881
- }
1882
- )
1883
- ]
1884
- },
1885
- `prompt-slot-${d.slot}`
1886
- ))
1887
- ]
1888
- }
1889
- );
1890
- }, bo = ({
1891
- open: e,
1892
- onOpenChange: t
1893
- }) => {
1894
- const { getAccessToken: r, user: a } = D(), {
1895
- data: n,
1896
- error: s,
1897
- isLoading: l,
1898
- mutate: c
1899
- } = Be({
1900
- keys: [a == null ? void 0 : a.username],
1901
- getAccessToken: r
1902
- }), [u, i] = R(!1), [f, p] = R({
1903
- loadingLocation: !1
1904
- }), [g, d] = R(""), [m, y] = R(""), [b, N] = R(Qt), [x, k] = me({
1905
- key: ue + tt,
1906
- initialValue: !1
1907
- }), [C, T] = me({
1908
- key: ue + Xt,
1909
- initialValue: !1
1910
- }), A = (I) => {
1911
- T(I);
1912
- }, L = async (I) => {
1913
- I.preventDefault();
1914
- try {
1915
- await oe({
1916
- accessToken: await r(),
1917
- type: ae.SET_USER_PREFERENCES,
1918
- params: {
1919
- user: a == null ? void 0 : a.username,
1920
- instructions: g,
1921
- location: m,
1922
- engine: b
1923
- }
1924
- }), c(), p({
1925
- loadingLocation: !1
1926
- });
1927
- } catch {
1928
- }
1929
- }, S = async () => {
1930
- p({
1931
- loadingLocation: !0
1932
- }), y("...");
1933
- try {
1934
- const I = Date.now(), B = await tr(), H = await oe({
1935
- accessToken: await r(),
1936
- type: ae.GET_LOCATION,
1937
- params: {
1938
- latitude: B.latitude,
1939
- longitude: B.longitude
1940
- }
1941
- }), le = Date.now() - I;
1942
- if (le < 2e3 && await new Promise((X) => setTimeout(X, 2e3 - le)), H.status === 200) {
1943
- const { city: X, state: ge, country: G, displayName: $t } = H.data, Ft = X && ge && G ? `${X}, ${ge}, ${G}` : $t;
1944
- p({
1945
- loadingLocation: !1
1946
- }), y(Ft);
1947
- } else
1948
- p({
1949
- loadingLocation: !1
1950
- });
1951
- } catch {
1952
- }
1953
- }, q = (I, B) => {
1954
- N(I ? B : B === J ? ee : J);
1955
- }, Q = () => {
1956
- i(!u);
1957
- }, V = () => {
1958
- c({ ...n }), t(!1);
1959
- };
1960
- return Z(() => {
1961
- n != null && n.instructions && d(n.instructions), n != null && n.location && y(n.location), n != null && n.engine && N(n.engine);
1962
- }, [n]), s || l ? null : /* @__PURE__ */ o(
1963
- ne,
1964
- {
1965
- open: e,
1966
- onOpenChange: V,
1967
- title: Jt,
1968
- footer: /* @__PURE__ */ v(
1969
- K,
1970
- {
1971
- columnGap: 2,
1972
- alignHorizontal: "flex-end",
1973
- className: "pb-8 sm:pb-0",
1974
- children: [
1975
- /* @__PURE__ */ o(M, { children: /* @__PURE__ */ o(
1976
- U,
1977
- {
1978
- mode: "dark",
1979
- variant: "secondary",
1980
- focusMode: "light",
1981
- onClick: V,
1982
- children: "Cancel"
1983
- }
1984
- ) }),
1985
- /* @__PURE__ */ o(M, { children: /* @__PURE__ */ o(
1986
- U,
1987
- {
1988
- mode: "dark",
1989
- variant: "danger",
1990
- focusMode: "light",
1991
- onClick: async (I) => {
1992
- t(!1), await L(I);
1993
- },
1994
- children: "Save"
1995
- }
1996
- ) })
1997
- ]
1998
- }
1999
- ),
2000
- children: /* @__PURE__ */ v(z, { children: [
2001
- u && /* @__PURE__ */ o(po, { open: u, onOpenChange: i }),
2002
- /* @__PURE__ */ v(
2003
- F,
2004
- {
2005
- header: _.SETTINGS_ENGINE.TITLE,
2006
- className: "prose-dark dark:prose-lighter",
2007
- children: [
2008
- /* @__PURE__ */ o("p", { className: "text-sm", children: "Select the AI engine that will be used to generate responses." }),
2009
- /* @__PURE__ */ o(
2010
- de,
2011
- {
2012
- noBorder: !0,
2013
- label: J,
2014
- name: J,
2015
- onChange: (I) => q(I, J),
2016
- checked: b === J
2017
- }
2018
- ),
2019
- /* @__PURE__ */ o(
2020
- de,
2021
- {
2022
- className: "mt-2",
2023
- noBorder: !0,
2024
- label: ee,
2025
- name: ee,
2026
- onChange: (I) => q(I, ee),
2027
- checked: b === ee
2028
- }
2029
- ),
2030
- /* @__PURE__ */ o("p", { className: "text-sm", children: "This option introduces a new menu at the top of the screen, enabling you to quickly switch between engines." }),
2031
- /* @__PURE__ */ o(
2032
- de,
2033
- {
2034
- className: "mt-2",
2035
- noBorder: !0,
2036
- label: "Show Quick Engine Toggle Menu",
2037
- name: "show-toggle-engine-menu",
2038
- onChange: k,
2039
- checked: x
2040
- }
2041
- ),
2042
- /* @__PURE__ */ o("p", { className: "text-sm", children: "This option adds individual statistics for each messages under their respective bubbles, such as processing time, model name, and more." }),
2043
- /* @__PURE__ */ o(
2044
- de,
2045
- {
2046
- className: "mt-2",
2047
- noBorder: !0,
2048
- label: "Show Message Statistics",
2049
- name: "show-message-statistics",
2050
- onChange: A,
2051
- checked: C
2052
- }
2053
- ),
2054
- /* @__PURE__ */ o("h3", { className: "border-b-2 border-slate-400", children: "Prompts" }),
2055
- /* @__PURE__ */ o(
2056
- te,
2057
- {
2058
- className: "mt-2",
2059
- size: "small",
2060
- onClick: Q,
2061
- labelLeft: "Edit Custom Prompts",
2062
- children: /* @__PURE__ */ o(Ir, { size: "size-3", monotone: !0 })
2063
- }
2064
- )
2065
- ]
2066
- }
2067
- ),
2068
- /* @__PURE__ */ v(
2069
- F,
2070
- {
2071
- header: "Custom Instructions",
2072
- className: "prose-dark dark:prose-lighter mt-4",
2073
- children: [
2074
- /* @__PURE__ */ v("p", { className: "text-sm", children: [
2075
- "What would you like ",
2076
- /* @__PURE__ */ o("em", { children: er }),
2077
- " to know about you to provide better responses?"
2078
- ] }),
2079
- /* @__PURE__ */ o(
2080
- Ke,
2081
- {
2082
- mode: "alt-system",
2083
- autoCapitalize: "off",
2084
- autoComplete: "off",
2085
- autoCorrect: "off",
2086
- name: "customInstructions",
2087
- label: "Custom Instructions",
2088
- value: g,
2089
- onChange: (I) => {
2090
- d(I.target.value);
2091
- },
2092
- helperText: "Press ENTER to add a new line."
2093
- }
2094
- )
2095
- ]
2096
- }
2097
- ),
2098
- /* @__PURE__ */ v(
2099
- F,
2100
- {
2101
- header: "Location",
2102
- className: "prose-dark dark:prose-lighter mt-4",
2103
- children: [
2104
- /* @__PURE__ */ o("p", { className: "text-sm", children: "You can share your location to receive customized responses based on your area." }),
2105
- /* @__PURE__ */ o(
2106
- Ke,
2107
- {
2108
- mode: "alt-system",
2109
- name: "location",
2110
- label: "Location",
2111
- value: m,
2112
- onChange: (I) => {
2113
- y(I.target.value);
2114
- },
2115
- helperText: "Enter your location or press auto-detect."
2116
- }
2117
- ),
2118
- /* @__PURE__ */ o(
2119
- U,
2120
- {
2121
- className: "mt-2",
2122
- size: "small",
2123
- noBorder: !0,
2124
- disabled: f.loadingLocation,
2125
- onClick: S,
2126
- children: f.loadingLocation ? "Detecting..." : "Auto-detect"
2127
- }
2128
- )
2129
- ]
2130
- }
2131
- )
2132
- ] })
2133
- }
2134
- );
2135
- };
2136
- /*!
2137
- @versini/ui-togglegroup v3.0.1
2138
- © 2025 gizmette.com
2139
- */
2140
- try {
2141
- window.__VERSINI_UI_TOGGLEGROUP__ || (window.__VERSINI_UI_TOGGLEGROUP__ = {
2142
- version: "3.0.1",
2143
- buildTime: "01/06/2025 08:00 PM EST",
2144
- homepage: "https://github.com/aversini/ui-components",
2145
- license: "MIT"
2146
- });
2147
- } catch {
2148
- }
2149
- const vo = "av-togglegroup", yo = "av-togglegroup-item-wrapper", ko = "av-togglegroup-item";
2150
- function Fe(e, t = []) {
2151
- let r = [];
2152
- function a(s, l) {
2153
- const c = h.createContext(l), u = r.length;
2154
- r = [...r, l];
2155
- const i = (p) => {
2156
- var g;
2157
- const { scope: d, children: m, ...y } = p, b = ((g = d == null ? void 0 : d[e]) == null ? void 0 : g[u]) || c, N = h.useMemo(() => y, Object.values(y));
2158
- return /* @__PURE__ */ o(b.Provider, { value: N, children: m });
2159
- };
2160
- i.displayName = s + "Provider";
2161
- function f(p, g) {
2162
- var d;
2163
- const m = ((d = g == null ? void 0 : g[e]) == null ? void 0 : d[u]) || c, y = h.useContext(m);
2164
- if (y) return y;
2165
- if (l !== void 0) return l;
2166
- throw new Error(`\`${p}\` must be used within \`${s}\``);
2167
- }
2168
- return [i, f];
2169
- }
2170
- const n = () => {
2171
- const s = r.map((l) => h.createContext(l));
2172
- return function(l) {
2173
- const c = (l == null ? void 0 : l[e]) || s;
2174
- return h.useMemo(
2175
- () => ({ [`__scope${e}`]: { ...l, [e]: c } }),
2176
- [l, c]
2177
- );
2178
- };
2179
- };
2180
- return n.scopeName = e, [a, wo(n, ...t)];
2181
- }
2182
- function wo(...e) {
2183
- const t = e[0];
2184
- if (e.length === 1) return t;
2185
- const r = () => {
2186
- const a = e.map((n) => ({
2187
- useScope: n(),
2188
- scopeName: n.scopeName
2189
- }));
2190
- return function(n) {
2191
- const s = a.reduce((l, { useScope: c, scopeName: u }) => {
2192
- const i = c(n)[`__scope${u}`];
2193
- return { ...l, ...i };
2194
- }, {});
2195
- return h.useMemo(() => ({ [`__scope${t.scopeName}`]: s }), [s]);
2196
- };
2197
- };
2198
- return r.scopeName = t.scopeName, r;
2199
- }
2200
- function Xe(e, t) {
2201
- if (typeof e == "function")
2202
- return e(t);
2203
- e != null && (e.current = t);
2204
- }
2205
- function Nt(...e) {
2206
- return (t) => {
2207
- let r = !1;
2208
- const a = e.map((n) => {
2209
- const s = Xe(n, t);
2210
- return !r && typeof s == "function" && (r = !0), s;
2211
- });
2212
- if (r)
2213
- return () => {
2214
- for (let n = 0; n < a.length; n++) {
2215
- const s = a[n];
2216
- typeof s == "function" ? s() : Xe(e[n], null);
2217
- }
2218
- };
2219
- };
2220
- }
2221
- function Re(...e) {
2222
- return h.useCallback(Nt(...e), e);
2223
- }
2224
- var ye = h.forwardRef((e, t) => {
2225
- const { children: r, ...a } = e, n = h.Children.toArray(r), s = n.find(xo);
2226
- if (s) {
2227
- const l = s.props.children, c = n.map((u) => u === s ? h.Children.count(l) > 1 ? h.Children.only(null) : h.isValidElement(l) ? l.props.children : null : u);
2228
- return /* @__PURE__ */ o(Le, { ...a, ref: t, children: h.isValidElement(l) ? h.cloneElement(l, void 0, c) : null });
2229
- }
2230
- return /* @__PURE__ */ o(Le, { ...a, ref: t, children: r });
2231
- });
2232
- ye.displayName = "Slot";
2233
- var Le = h.forwardRef((e, t) => {
2234
- const { children: r, ...a } = e;
2235
- if (h.isValidElement(r)) {
2236
- const n = Io(r);
2237
- return h.cloneElement(r, {
2238
- ...Co(a, r.props),
2239
- // @ts-ignore
2240
- ref: t ? Nt(t, n) : n
2241
- });
2242
- }
2243
- return h.Children.count(r) > 1 ? h.Children.only(null) : null;
2244
- });
2245
- Le.displayName = "SlotClone";
2246
- var No = ({ children: e }) => /* @__PURE__ */ o(z, { children: e });
2247
- function xo(e) {
2248
- return h.isValidElement(e) && e.type === No;
2249
- }
2250
- function Co(e, t) {
2251
- const r = { ...t };
2252
- for (const a in t) {
2253
- const n = e[a], s = t[a];
2254
- /^on[A-Z]/.test(a) ? n && s ? r[a] = (...l) => {
2255
- s(...l), n(...l);
2256
- } : n && (r[a] = n) : a === "style" ? r[a] = { ...n, ...s } : a === "className" && (r[a] = [n, s].filter(Boolean).join(" "));
2257
- }
2258
- return { ...e, ...r };
2259
- }
2260
- function Io(e) {
2261
- var t, r;
2262
- let a = (t = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : t.get, n = a && "isReactWarning" in a && a.isReactWarning;
2263
- return n ? e.ref : (a = (r = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : r.get, n = a && "isReactWarning" in a && a.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
2264
- }
2265
- var Eo = [
2266
- "a",
2267
- "button",
2268
- "div",
2269
- "form",
2270
- "h2",
2271
- "h3",
2272
- "img",
2273
- "input",
2274
- "label",
2275
- "li",
2276
- "nav",
2277
- "ol",
2278
- "p",
2279
- "span",
2280
- "svg",
2281
- "ul"
2282
- ], he = Eo.reduce((e, t) => {
2283
- const r = h.forwardRef((a, n) => {
2284
- const { asChild: s, ...l } = a, c = s ? ye : t;
2285
- return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ o(c, { ...l, ref: n });
2286
- });
2287
- return r.displayName = `Primitive.${t}`, { ...e, [t]: r };
2288
- }, {});
2289
- function W(e, t, { checkForDefaultPrevented: r = !0 } = {}) {
2290
- return function(a) {
2291
- if (e == null || e(a), r === !1 || !a.defaultPrevented)
2292
- return t == null ? void 0 : t(a);
2293
- };
2294
- }
2295
- function To(e) {
2296
- const t = e + "CollectionProvider", [r, a] = Fe(t), [n, s] = r(
2297
- t,
2298
- { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
2299
- ), l = (d) => {
2300
- const { scope: m, children: y } = d, b = E.useRef(null), N = E.useRef(/* @__PURE__ */ new Map()).current;
2301
- return /* @__PURE__ */ o(n, { scope: m, itemMap: N, collectionRef: b, children: y });
2302
- };
2303
- l.displayName = t;
2304
- const c = e + "CollectionSlot", u = E.forwardRef(
2305
- (d, m) => {
2306
- const { scope: y, children: b } = d, N = s(c, y), x = Re(m, N.collectionRef);
2307
- return /* @__PURE__ */ o(ye, { ref: x, children: b });
2308
- }
2309
- );
2310
- u.displayName = c;
2311
- const i = e + "CollectionItemSlot", f = "data-radix-collection-item", p = E.forwardRef(
2312
- (d, m) => {
2313
- const { scope: y, children: b, ...N } = d, x = E.useRef(null), k = Re(m, x), C = s(i, y);
2314
- return E.useEffect(() => (C.itemMap.set(x, { ref: x, ...N }), () => void C.itemMap.delete(x))), /* @__PURE__ */ o(ye, { [f]: "", ref: k, children: b });
2315
- }
2316
- );
2317
- p.displayName = i;
2318
- function g(d) {
2319
- const m = s(e + "CollectionConsumer", d);
2320
- return E.useCallback(() => {
2321
- const y = m.collectionRef.current;
2322
- if (!y) return [];
2323
- const b = Array.from(y.querySelectorAll(`[${f}]`));
2324
- return Array.from(m.itemMap.values()).sort(
2325
- (N, x) => b.indexOf(N.ref.current) - b.indexOf(x.ref.current)
2326
- );
2327
- }, [m.collectionRef, m.itemMap]);
2328
- }
2329
- return [
2330
- { Provider: l, Slot: u, ItemSlot: p },
2331
- g,
2332
- a
2333
- ];
2334
- }
2335
- var _o = globalThis != null && globalThis.document ? h.useLayoutEffect : () => {
2336
- }, So = h.useId || (() => {
2337
- }), Ro = 0;
2338
- function Lo(e) {
2339
- const [t, r] = h.useState(So());
2340
- return _o(() => {
2341
- r((a) => a ?? String(Ro++));
2342
- }, [e]), t ? `radix-${t}` : "";
2343
- }
2344
- function De(e) {
2345
- const t = h.useRef(e);
2346
- return h.useEffect(() => {
2347
- t.current = e;
2348
- }), h.useMemo(() => (...r) => {
2349
- var a;
2350
- return (a = t.current) == null ? void 0 : a.call(t, ...r);
2351
- }, []);
2352
- }
2353
- function xe({
2354
- prop: e,
2355
- defaultProp: t,
2356
- onChange: r = () => {
2357
- }
2358
- }) {
2359
- const [a, n] = Mo({ defaultProp: t, onChange: r }), s = e !== void 0, l = s ? e : a, c = De(r), u = h.useCallback(
2360
- (i) => {
2361
- if (s) {
2362
- const f = typeof i == "function" ? i(e) : i;
2363
- f !== e && c(f);
2364
- } else
2365
- n(i);
2366
- },
2367
- [s, e, n, c]
2368
- );
2369
- return [l, u];
2370
- }
2371
- function Mo({
2372
- defaultProp: e,
2373
- onChange: t
2374
- }) {
2375
- const r = h.useState(e), [a] = r, n = h.useRef(a), s = De(t);
2376
- return h.useEffect(() => {
2377
- n.current !== a && (s(a), n.current = a);
2378
- }, [a, n, s]), r;
2379
- }
2380
- var zo = h.createContext(void 0);
2381
- function xt(e) {
2382
- const t = h.useContext(zo);
2383
- return e || t || "ltr";
2384
- }
2385
- var Ee = "rovingFocusGroup.onEntryFocus", Ao = { bubbles: !1, cancelable: !0 }, Ce = "RovingFocusGroup", [Me, Ct, Po] = To(Ce), [Bo, It] = Fe(
2386
- Ce,
2387
- [Po]
2388
- ), [Oo, $o] = Bo(Ce), Et = h.forwardRef(
2389
- (e, t) => /* @__PURE__ */ o(Me.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ o(Me.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ o(Fo, { ...e, ref: t }) }) })
2390
- );
2391
- Et.displayName = Ce;
2392
- var Fo = h.forwardRef((e, t) => {
2393
- const {
2394
- __scopeRovingFocusGroup: r,
2395
- orientation: a,
2396
- loop: n = !1,
2397
- dir: s,
2398
- currentTabStopId: l,
2399
- defaultCurrentTabStopId: c,
2400
- onCurrentTabStopIdChange: u,
2401
- onEntryFocus: i,
2402
- preventScrollOnEntryFocus: f = !1,
2403
- ...p
2404
- } = e, g = h.useRef(null), d = Re(t, g), m = xt(s), [y = null, b] = xe({
2405
- prop: l,
2406
- defaultProp: c,
2407
- onChange: u
2408
- }), [N, x] = h.useState(!1), k = De(i), C = Ct(r), T = h.useRef(!1), [A, L] = h.useState(0);
2409
- return h.useEffect(() => {
2410
- const S = g.current;
2411
- if (S)
2412
- return S.addEventListener(Ee, k), () => S.removeEventListener(Ee, k);
2413
- }, [k]), /* @__PURE__ */ o(
2414
- Oo,
2415
- {
2416
- scope: r,
2417
- orientation: a,
2418
- dir: m,
2419
- loop: n,
2420
- currentTabStopId: y,
2421
- onItemFocus: h.useCallback(
2422
- (S) => b(S),
2423
- [b]
2424
- ),
2425
- onItemShiftTab: h.useCallback(() => x(!0), []),
2426
- onFocusableItemAdd: h.useCallback(
2427
- () => L((S) => S + 1),
2428
- []
2429
- ),
2430
- onFocusableItemRemove: h.useCallback(
2431
- () => L((S) => S - 1),
2432
- []
2433
- ),
2434
- children: /* @__PURE__ */ o(
2435
- he.div,
2436
- {
2437
- tabIndex: N || A === 0 ? -1 : 0,
2438
- "data-orientation": a,
2439
- ...p,
2440
- ref: d,
2441
- style: { outline: "none", ...e.style },
2442
- onMouseDown: W(e.onMouseDown, () => {
2443
- T.current = !0;
2444
- }),
2445
- onFocus: W(e.onFocus, (S) => {
2446
- const q = !T.current;
2447
- if (S.target === S.currentTarget && q && !N) {
2448
- const Q = new CustomEvent(Ee, Ao);
2449
- if (S.currentTarget.dispatchEvent(Q), !Q.defaultPrevented) {
2450
- const V = C().filter((O) => O.focusable), I = V.find((O) => O.active), B = V.find((O) => O.id === y), H = [I, B, ...V].filter(
2451
- Boolean
2452
- ).map((O) => O.ref.current);
2453
- St(H, f);
2454
- }
2455
- }
2456
- T.current = !1;
2457
- }),
2458
- onBlur: W(e.onBlur, () => x(!1))
2459
- }
2460
- )
2461
- }
2462
- );
2463
- }), Tt = "RovingFocusGroupItem", _t = h.forwardRef(
2464
- (e, t) => {
2465
- const {
2466
- __scopeRovingFocusGroup: r,
2467
- focusable: a = !0,
2468
- active: n = !1,
2469
- tabStopId: s,
2470
- ...l
2471
- } = e, c = Lo(), u = s || c, i = $o(Tt, r), f = i.currentTabStopId === u, p = Ct(r), { onFocusableItemAdd: g, onFocusableItemRemove: d } = i;
2472
- return h.useEffect(() => {
2473
- if (a)
2474
- return g(), () => d();
2475
- }, [a, g, d]), /* @__PURE__ */ o(
2476
- Me.ItemSlot,
2477
- {
2478
- scope: r,
2479
- id: u,
2480
- focusable: a,
2481
- active: n,
2482
- children: /* @__PURE__ */ o(
2483
- he.span,
2484
- {
2485
- tabIndex: f ? 0 : -1,
2486
- "data-orientation": i.orientation,
2487
- ...l,
2488
- ref: t,
2489
- onMouseDown: W(e.onMouseDown, (m) => {
2490
- a ? i.onItemFocus(u) : m.preventDefault();
2491
- }),
2492
- onFocus: W(e.onFocus, () => i.onItemFocus(u)),
2493
- onKeyDown: W(e.onKeyDown, (m) => {
2494
- if (m.key === "Tab" && m.shiftKey) {
2495
- i.onItemShiftTab();
2496
- return;
2497
- }
2498
- if (m.target !== m.currentTarget) return;
2499
- const y = Go(m, i.orientation, i.dir);
2500
- if (y !== void 0) {
2501
- if (m.metaKey || m.ctrlKey || m.altKey || m.shiftKey) return;
2502
- m.preventDefault();
2503
- let b = p().filter((N) => N.focusable).map((N) => N.ref.current);
2504
- if (y === "last") b.reverse();
2505
- else if (y === "prev" || y === "next") {
2506
- y === "prev" && b.reverse();
2507
- const N = b.indexOf(m.currentTarget);
2508
- b = i.loop ? Uo(b, N + 1) : b.slice(N + 1);
2509
- }
2510
- setTimeout(() => St(b));
2511
- }
2512
- })
2513
- }
2514
- )
2515
- }
2516
- );
2517
- }
2518
- );
2519
- _t.displayName = Tt;
2520
- var Do = {
2521
- ArrowLeft: "prev",
2522
- ArrowUp: "prev",
2523
- ArrowRight: "next",
2524
- ArrowDown: "next",
2525
- PageUp: "first",
2526
- Home: "first",
2527
- PageDown: "last",
2528
- End: "last"
2529
- };
2530
- function Vo(e, t) {
2531
- return t !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
2532
- }
2533
- function Go(e, t, r) {
2534
- const a = Vo(e.key, r);
2535
- if (!(t === "vertical" && ["ArrowLeft", "ArrowRight"].includes(a)) && !(t === "horizontal" && ["ArrowUp", "ArrowDown"].includes(a)))
2536
- return Do[a];
2537
- }
2538
- function St(e, t = !1) {
2539
- const r = document.activeElement;
2540
- for (const a of e)
2541
- if (a === r || (a.focus({ preventScroll: t }), document.activeElement !== r)) return;
2542
- }
2543
- function Uo(e, t) {
2544
- return e.map((r, a) => e[(t + a) % e.length]);
2545
- }
2546
- var Ho = Et, jo = _t, Wo = "Toggle", Rt = h.forwardRef((e, t) => {
2547
- const { pressed: r, defaultPressed: a = !1, onPressedChange: n, ...s } = e, [l = !1, c] = xe({
2548
- prop: r,
2549
- onChange: n,
2550
- defaultProp: a
2551
- });
2552
- return /* @__PURE__ */ o(
2553
- he.button,
2554
- {
2555
- type: "button",
2556
- "aria-pressed": l,
2557
- "data-state": l ? "on" : "off",
2558
- "data-disabled": e.disabled ? "" : void 0,
2559
- ...s,
2560
- ref: t,
2561
- onClick: W(e.onClick, () => {
2562
- e.disabled || c(!l);
2563
- })
2564
- }
2565
- );
2566
- });
2567
- Rt.displayName = Wo;
2568
- var se = "ToggleGroup", [Lt, ga] = Fe(se, [
2569
- It
2570
- ]), Mt = It(), Ve = E.forwardRef((e, t) => {
2571
- const { type: r, ...a } = e;
2572
- if (r === "single")
2573
- return /* @__PURE__ */ o(Ko, { ...a, ref: t });
2574
- if (r === "multiple")
2575
- return /* @__PURE__ */ o(Yo, { ...a, ref: t });
2576
- throw new Error(`Missing prop \`type\` expected on \`${se}\``);
2577
- });
2578
- Ve.displayName = se;
2579
- var [zt, At] = Lt(se), Ko = E.forwardRef((e, t) => {
2580
- const {
2581
- value: r,
2582
- defaultValue: a,
2583
- onValueChange: n = () => {
2584
- },
2585
- ...s
2586
- } = e, [l, c] = xe({
2587
- prop: r,
2588
- defaultProp: a,
2589
- onChange: n
2590
- });
2591
- return /* @__PURE__ */ o(
2592
- zt,
2593
- {
2594
- scope: e.__scopeToggleGroup,
2595
- type: "single",
2596
- value: l ? [l] : [],
2597
- onItemActivate: c,
2598
- onItemDeactivate: E.useCallback(() => c(""), [c]),
2599
- children: /* @__PURE__ */ o(Pt, { ...s, ref: t })
2600
- }
2601
- );
2602
- }), Yo = E.forwardRef((e, t) => {
2603
- const {
2604
- value: r,
2605
- defaultValue: a,
2606
- onValueChange: n = () => {
2607
- },
2608
- ...s
2609
- } = e, [l = [], c] = xe({
2610
- prop: r,
2611
- defaultProp: a,
2612
- onChange: n
2613
- }), u = E.useCallback(
2614
- (f) => c((p = []) => [...p, f]),
2615
- [c]
2616
- ), i = E.useCallback(
2617
- (f) => c((p = []) => p.filter((g) => g !== f)),
2618
- [c]
2619
- );
2620
- return /* @__PURE__ */ o(
2621
- zt,
2622
- {
2623
- scope: e.__scopeToggleGroup,
2624
- type: "multiple",
2625
- value: l,
2626
- onItemActivate: u,
2627
- onItemDeactivate: i,
2628
- children: /* @__PURE__ */ o(Pt, { ...s, ref: t })
2629
- }
2630
- );
2631
- });
2632
- Ve.displayName = se;
2633
- var [Zo, qo] = Lt(se), Pt = E.forwardRef(
2634
- (e, t) => {
2635
- const {
2636
- __scopeToggleGroup: r,
2637
- disabled: a = !1,
2638
- rovingFocus: n = !0,
2639
- orientation: s,
2640
- dir: l,
2641
- loop: c = !0,
2642
- ...u
2643
- } = e, i = Mt(r), f = xt(l), p = { role: "group", dir: f, ...u };
2644
- return /* @__PURE__ */ o(Zo, { scope: r, rovingFocus: n, disabled: a, children: n ? /* @__PURE__ */ o(
2645
- Ho,
2646
- {
2647
- asChild: !0,
2648
- ...i,
2649
- orientation: s,
2650
- dir: f,
2651
- loop: c,
2652
- children: /* @__PURE__ */ o(he.div, { ...p, ref: t })
2653
- }
2654
- ) : /* @__PURE__ */ o(he.div, { ...p, ref: t }) });
2655
- }
2656
- ), ke = "ToggleGroupItem", Bt = E.forwardRef(
2657
- (e, t) => {
2658
- const r = At(ke, e.__scopeToggleGroup), a = qo(ke, e.__scopeToggleGroup), n = Mt(e.__scopeToggleGroup), s = r.value.includes(e.value), l = a.disabled || e.disabled, c = { ...e, pressed: s, disabled: l }, u = E.useRef(null);
2659
- return a.rovingFocus ? /* @__PURE__ */ o(
2660
- jo,
2661
- {
2662
- asChild: !0,
2663
- ...n,
2664
- focusable: !l,
2665
- active: s,
2666
- ref: u,
2667
- children: /* @__PURE__ */ o(Je, { ...c, ref: t })
2668
- }
2669
- ) : /* @__PURE__ */ o(Je, { ...c, ref: t });
2670
- }
2671
- );
2672
- Bt.displayName = ke;
2673
- var Je = E.forwardRef(
2674
- (e, t) => {
2675
- const { __scopeToggleGroup: r, value: a, ...n } = e, s = At(ke, r), l = { role: "radio", "aria-checked": e.pressed, "aria-pressed": void 0 }, c = s.type === "single" ? l : void 0;
2676
- return /* @__PURE__ */ o(
2677
- Rt,
2678
- {
2679
- ...c,
2680
- ...n,
2681
- ref: t,
2682
- onPressedChange: (u) => {
2683
- u ? s.onItemActivate(a) : s.onItemDeactivate(a);
2684
- }
2685
- }
2686
- );
2687
- }
2688
- ), Qo = Ve, Xo = Bt;
2689
- const Ot = E.createContext({
2690
- size: "medium",
2691
- focusMode: "system",
2692
- mode: "system"
2693
- }), Jo = ({ focusMode: e }) => w("focus:outline", "focus:outline-2", "focus:outline-offset", {
2694
- "focus:outline-focus-light": e === "light",
2695
- "focus:outline-focus-dark": e === "dark",
2696
- "focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
2697
- "focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
2698
- }), ea = ({ mode: e }) => w({
2699
- "data-[state=on]:bg-surface-medium": e === "dark",
2700
- "data-[state=on]:bg-surface-lightest": e === "light",
2701
- "data-[state=on]:bg-surface-lightest dark:data-[state=on]:bg-surface-medium": e === "system",
2702
- "data-[state=on]:bg-surface-medium dark:data-[state=on]:bg-surface-lightest": e === "alt-system"
2703
- }), ta = ({ size: e }) => w({
2704
- "h-5 px-2": e === "small",
2705
- "h-6 px-3": e === "medium",
2706
- "h-7 px-4": e === "large"
2707
- }), ra = ({ mode: e }) => w(
2708
- yo,
2709
- "px-1",
2710
- "relative",
2711
- "border-r",
2712
- "last:border-transparent",
2713
- "has-[button[aria-checked='true']]:border-transparent",
2714
- "has-[+_*_button[aria-checked='false']]:border-border-medium",
2715
- {
2716
- "border-surface-light": e === "light",
2717
- "border-surface-darker": e === "dark",
2718
- "border-surface-light dark:border-surface-darker": e === "system",
2719
- "border-surface-darker dark:border-surface-light": e === "alt-system"
2720
- }
2721
- ), oa = ({
2722
- focusMode: e,
2723
- mode: t,
2724
- size: r
2725
- }) => ({
2726
- wrapperClass: ra({ mode: t }),
2727
- itemClass: w(
2728
- ko,
2729
- "flex items-center justify-center bg-transparent",
2730
- "rounded-sm",
2731
- "transition duration-200 ease",
2732
- ta({ size: r }),
2733
- Jo({ focusMode: e }),
2734
- ea({ mode: t })
2735
- )
2736
- }), aa = ({
2737
- mode: e,
2738
- className: t
2739
- }) => w(
2740
- vo,
2741
- "inline-flex p-1",
2742
- "rounded-sm",
2743
- {
2744
- "bg-surface-light text-copy-dark": e === "light",
2745
- "bg-surface-darker text-copy-lighter": e === "dark",
2746
- "bg-surface-light text-copy-dark dark:bg-surface-darker dark:text-copy-lighter": e === "system",
2747
- "bg-surface-darker text-copy-lighter dark:bg-surface-light dark:text-copy-dark": e === "alt-system"
2748
- },
2749
- t
2750
- ), na = ({
2751
- children: e,
2752
- value: t,
2753
- onValueChange: r,
2754
- disabled: a,
2755
- mode: n = "system",
2756
- focusMode: s = "system",
2757
- size: l = "medium",
2758
- defaultValue: c,
2759
- className: u,
2760
- ...i
2761
- }) => {
2762
- const f = aa({ mode: n, className: u }), p = { size: l, focusMode: s, mode: n };
2763
- return /* @__PURE__ */ o(Ot.Provider, { value: p, children: /* @__PURE__ */ o(
2764
- Qo,
2765
- {
2766
- disabled: a,
2767
- className: f,
2768
- value: t,
2769
- defaultValue: c,
2770
- onValueChange: r,
2771
- ...i,
2772
- type: "single",
2773
- children: e
2774
- }
2775
- ) });
2776
- }, sa = ({ value: e, disabled: t }) => {
2777
- const { size: r, focusMode: a, mode: n } = Y(Ot), { itemClass: s, wrapperClass: l } = oa({
2778
- focusMode: a,
2779
- mode: n,
2780
- size: r
2781
- });
2782
- return /* @__PURE__ */ o("div", { className: l, children: /* @__PURE__ */ o(
2783
- Xo,
2784
- {
2785
- disabled: t,
2786
- className: s,
2787
- value: e,
2788
- children: e
2789
- }
2790
- ) });
2791
- }, la = () => {
2792
- const { state: e, dispatch: t } = Y(Pe), { getAccessToken: r, user: a } = D(), [n] = me({
2793
- key: ue + tt,
2794
- initialValue: !1
2795
- }), {
2796
- data: s,
2797
- error: l,
2798
- isLoading: c
2799
- } = mt({
2800
- getAccessToken: r
2801
- }), {
2802
- data: u,
2803
- error: i,
2804
- isLoading: f,
2805
- mutate: p
2806
- } = Be({
2807
- keys: [a == null ? void 0 : a.username],
2808
- getAccessToken: r
2809
- });
2810
- return l || c || i || f ? null : n && u && /* @__PURE__ */ o(M, { children: /* @__PURE__ */ o(
2811
- Oe,
2812
- {
2813
- mode: "dark",
2814
- focusMode: "light",
2815
- trigger: /* @__PURE__ */ o(te, { className: "mr-2", children: u && u.engine === ee ? /* @__PURE__ */ o(gt, {}) : /* @__PURE__ */ o(ft, {}) }),
2816
- defaultPlacement: "bottom-start",
2817
- children: /* @__PURE__ */ o(j, { raw: !0, children: /* @__PURE__ */ o(
2818
- na,
2819
- {
2820
- size: "small",
2821
- mode: "dark",
2822
- focusMode: "light",
2823
- value: u.engine,
2824
- onValueChange: async (g) => {
2825
- if (g)
2826
- try {
2827
- await oe({
2828
- accessToken: await r(),
2829
- type: ae.SET_USER_PREFERENCES,
2830
- params: {
2831
- user: a == null ? void 0 : a.username,
2832
- engine: g
2833
- }
2834
- }), p({ ...u }), e && (e == null ? void 0 : e.messages.length) > 0 && t({
2835
- type: et
2836
- });
2837
- } catch {
2838
- }
2839
- },
2840
- children: s && s.engines && s.engines.map((g) => /* @__PURE__ */ o(sa, { value: g }, g))
2841
- }
2842
- ) })
2843
- }
2844
- ) });
2845
- }, fa = () => {
2846
- const { logout: e } = D(), { state: t } = Y(Pe), [r, a] = R(!1), [n, s] = R(!1), [l, c] = R(!1), [u, i] = R(!1), [f, p] = R(!1), g = () => {
2847
- a(!r);
2848
- }, d = () => {
2849
- s(!n);
2850
- }, m = () => {
2851
- c(!l);
2852
- }, y = () => {
2853
- i(!u);
2854
- }, b = () => {
2855
- p(!f);
2856
- };
2857
- return /* @__PURE__ */ v(z, { children: [
2858
- /* @__PURE__ */ o(
2859
- wt,
2860
- {
2861
- showConfirmation: f,
2862
- setShowConfirmation: p,
2863
- action: e,
2864
- customStrings: {
2865
- confirmAction: We,
2866
- cancelAction: "Cancel",
2867
- title: We
2868
- },
2869
- children: /* @__PURE__ */ o("p", { children: "Are you sure you want to log out?" })
2870
- }
2871
- ),
2872
- /* @__PURE__ */ o(no, { open: r, onOpenChange: a }),
2873
- /* @__PURE__ */ o(bo, { open: n, onOpenChange: s }),
2874
- l && /* @__PURE__ */ o(oo, { open: l, onOpenChange: c }),
2875
- /* @__PURE__ */ o(eo, { open: u, onOpenChange: i }),
2876
- /* @__PURE__ */ o("div", { className: "bg-slate-900 py-4 px-4 rounded-t-md", children: /* @__PURE__ */ v(K, { alignHorizontal: "space-between", alignVertical: "center", children: [
2877
- /* @__PURE__ */ o(M, { children: /* @__PURE__ */ o(Nr, { mode: "dark", radius: "large" }) }),
2878
- /* @__PURE__ */ o(M, { children: /* @__PURE__ */ v(K, { children: [
2879
- /* @__PURE__ */ o(la, {}),
2880
- /* @__PURE__ */ o(M, { children: /* @__PURE__ */ v(
2881
- Oe,
2882
- {
2883
- mode: "dark",
2884
- focusMode: "light",
2885
- trigger: /* @__PURE__ */ o(te, { children: /* @__PURE__ */ o(Rr, {}) }),
2886
- defaultPlacement: "bottom-end",
2887
- children: [
2888
- /* @__PURE__ */ o(
2889
- j,
2890
- {
2891
- label: "Profile",
2892
- onClick: g,
2893
- icon: /* @__PURE__ */ o(_r, {})
2894
- }
2895
- ),
2896
- /* @__PURE__ */ o(
2897
- j,
2898
- {
2899
- label: "Settings",
2900
- onClick: d,
2901
- icon: /* @__PURE__ */ o(Lr, {})
2902
- }
2903
- ),
2904
- /* @__PURE__ */ o(
2905
- j,
2906
- {
2907
- label: "History",
2908
- onClick: m,
2909
- icon: /* @__PURE__ */ o(Er, {})
2910
- }
2911
- ),
2912
- /* @__PURE__ */ o(
2913
- j,
2914
- {
2915
- label: "About",
2916
- onClick: y,
2917
- icon: /* @__PURE__ */ o(Tr, {})
2918
- }
2919
- ),
2920
- t && t.id && !t.isComponent && /* @__PURE__ */ v(z, { children: [
2921
- /* @__PURE__ */ o(Mr, {}),
2922
- /* @__PURE__ */ o(
2923
- j,
2924
- {
2925
- label: "Log out",
2926
- onClick: b,
2927
- icon: /* @__PURE__ */ o("div", { className: "text-red-700", children: /* @__PURE__ */ o(xr, { monotone: !0 }) })
2928
- }
2929
- )
2930
- ] })
2931
- ]
2932
- }
2933
- ) })
2934
- ] }) })
2935
- ] }) })
2936
- ] });
2937
- };
2938
- export {
2939
- fa as default
2940
- };