@versini/sassysaint 6.0.2 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1725 @@
1
+ import { jsxs as i, jsx as e, Fragment as z } from "react/jsx-runtime";
2
+ import { g as D, un as $, R as B, CARDS as N, renderDataAsList as de, pluralize as ue, ABOUT_TITLE as Qe, INFINITE_SCROLL_LIMIT as Se, INFINITE_SCROLL_THRESHOLD as ve, LOCAL_STORAGE_PREFIX as ke, LOCAL_STORAGE_SORT as Je, Y as ae, ACTION_RESET as Ze, ACTION_RESTORE as et, ACTION_SORT as Ae, LOCAL_STORAGE_SEARCH as tt, HISTORY_TITLE as rt, ye as be, C as X, ACTION_SEARCH as nt, debounce as at, M as ot, L as q, j as P, l as Ie, durationFormatter as st, PROFILE_TITLE as lt, PROMPTS_DESCRIPTION as ct, DEFAULT_AI_ENGINE as it, LOCAL_STORAGE_CHAT_DETAILS as dt, SETTINGS_TITLE as ut, ENGINE_OPENAI as W, ENGINE_ANTHROPIC as ee, APP_NAME as mt, getCurrentGeoLocation as ht, LOG_OUT as _e } from "./index.DUNIGQ5_.js";
3
+ import { i as me, useServerCapabilities as pt, Ie as le, HistoryContext as Me, E as Ee, ConfirmationPanel as Oe, ge as ft, he as gt, ue as ge, le as O, ye as yt, me as bt, p as xt, z as kt, be as Et, serviceCall as oe, SERVICE_TYPES as se, f as te, AppContext as Pe, useChatsHistory as Ct, useUserChatStats as Tt, useUserPreferences as ze, m as Nt, _e as wt, me$1 as St, R as re, P as vt } from "./App.CVKf39VG.js";
4
+ import At, { useRef as S, useState as E, useContext as he, useCallback as Be, useEffect as V, Fragment as It, useLayoutEffect as ne, useMemo as He, useId as _t, useReducer as Rt } from "react";
5
+ import y from "clsx";
6
+ const Lt = ({
7
+ className: t,
8
+ viewBox: a,
9
+ title: o,
10
+ monotone: n,
11
+ ...r
12
+ }) => /* @__PURE__ */ i(
13
+ D,
14
+ {
15
+ defaultViewBox: "0 0 512 512",
16
+ size: "size-5",
17
+ viewBox: a,
18
+ className: t,
19
+ title: o || "Back",
20
+ ...r,
21
+ children: [
22
+ /* @__PURE__ */ e(
23
+ "path",
24
+ {
25
+ 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-224 0-111-80.7-203.1-186.7-220.9-1.8-.3-3.6-.4-5.3-.4-15.3 0-28.9 11.1-31.5 26.7-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 160-79.2 0-145.1-57.6-157.8-133.3-2.9-17.4-19.4-29.2-36.9-26.3-15.6 2.6-26.7 16.2-26.7 31.5z",
26
+ opacity: n ? "1" : "0.4"
27
+ }
28
+ ),
29
+ /* @__PURE__ */ e("path", { d: "M32 0h160c17.7 0 32 14.3 32 32s-14.3 32-32 32h-82.7l233.3 233.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L64 109.3V192c0 17.7-14.3 32-32 32S0 209.7 0 192V32C0 14.3 14.3 0 32 0" })
30
+ ]
31
+ }
32
+ ), Mt = ({
33
+ className: t,
34
+ viewBox: a,
35
+ title: o,
36
+ monotone: n,
37
+ ...r
38
+ }) => /* @__PURE__ */ i(
39
+ D,
40
+ {
41
+ defaultViewBox: "0 0 448 512",
42
+ size: "size-5",
43
+ viewBox: a,
44
+ className: t,
45
+ title: o || "Delete",
46
+ ...r,
47
+ children: [
48
+ /* @__PURE__ */ e(
49
+ "path",
50
+ {
51
+ d: "M32 96v352c0 35.3 28.7 64 64 64h256c35.3 0 64-28.7 64-64V96zm80 80c0-8.8 7.2-16 16-16s16 7.2 16 16v224c0 8.8-7.2 16-16 16s-16-7.2-16-16zm96 0c0-8.8 7.2-16 16-16s16 7.2 16 16v224c0 8.8-7.2 16-16 16s-16-7.2-16-16zm96 0c0-8.8 7.2-16 16-16s16 7.2 16 16v224c0 8.8-7.2 16-16 16s-16-7.2-16-16z",
52
+ opacity: n ? "1" : "0.4"
53
+ }
54
+ ),
55
+ /* @__PURE__ */ e("path", { d: "M163.8 0c-12.1 0-23.2 6.8-28.6 17.7L128 32H32C14.3 32 0 46.3 0 64s14.3 32 32 32h384c17.7 0 32-14.3 32-32s-14.3-32-32-32h-96l-7.2-14.3C307.4 6.8 296.3 0 284.2 0z" })
56
+ ]
57
+ }
58
+ ), Ot = ({
59
+ className: t,
60
+ viewBox: a,
61
+ title: o,
62
+ monotone: n,
63
+ ...r
64
+ }) => /* @__PURE__ */ i(
65
+ D,
66
+ {
67
+ defaultViewBox: "0 0 512 512",
68
+ size: "size-5",
69
+ viewBox: a,
70
+ className: t,
71
+ title: o || "History",
72
+ ...r,
73
+ children: [
74
+ /* @__PURE__ */ e(
75
+ "path",
76
+ {
77
+ d: "M0 57.9V168c0 13.3 10.7 24 24 24h110.1c21.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.4-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.9",
78
+ opacity: n ? "1" : "0.4"
79
+ }
80
+ ),
81
+ /* @__PURE__ */ e("path", { d: "M256 128c13.3 0 24 10.7 24 24v94.1l65 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-17V152c0-13.3 10.7-24 24-24z" })
82
+ ]
83
+ }
84
+ ), Pt = ({
85
+ className: t,
86
+ viewBox: a,
87
+ title: o,
88
+ monotone: n,
89
+ ...r
90
+ }) => /* @__PURE__ */ i(
91
+ D,
92
+ {
93
+ defaultViewBox: "0 0 512 512",
94
+ size: "size-5",
95
+ viewBox: a,
96
+ className: t,
97
+ title: o || "Info",
98
+ ...r,
99
+ children: [
100
+ /* @__PURE__ */ e(
101
+ "path",
102
+ {
103
+ d: "M0 256a256 256 0 1 0 512 0 256 256 0 1 0-512 0m192-8c0-13.3 10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24h-80c-13.3 0-24-10.7-24-24s10.7-24 24-24h24v-64h-24c-13.3 0-24-10.7-24-24m96-88a32 32 0 1 1-64 0 32 32 0 1 1 64 0",
104
+ opacity: ".4"
105
+ }
106
+ ),
107
+ /* @__PURE__ */ e("path", { d: "M256 128a32 32 0 1 1 0 64 32 32 0 1 1 0-64m-64 120c0-13.3 10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24h-80c-13.3 0-24-10.7-24-24s10.7-24 24-24h24v-64h-24c-13.3 0-24-10.7-24-24" })
108
+ ]
109
+ }
110
+ ), zt = ({
111
+ className: t,
112
+ viewBox: a,
113
+ title: o,
114
+ monotone: n,
115
+ ...r
116
+ }) => /* @__PURE__ */ i(
117
+ D,
118
+ {
119
+ defaultViewBox: "0 0 576 512",
120
+ size: "size-5",
121
+ viewBox: a,
122
+ className: t,
123
+ title: o || "Profile",
124
+ ...r,
125
+ children: [
126
+ /* @__PURE__ */ e(
127
+ "path",
128
+ {
129
+ d: "M0 96v320c0 35.3 28.7 64 64 64h448c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64C28.7 32 0 60.7 0 96m64 272c0-44.2 35.8-80 80-80h64c44.2 0 80 35.8 80 80 0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16m176-176a64 64 0 1 1-128 0 64 64 0 1 1 128 0m112-16c0-8.8 7.2-16 16-16h128c8.8 0 16 7.2 16 16s-7.2 16-16 16H368c-8.8 0-16-7.2-16-16m0 64c0-8.8 7.2-16 16-16h128c8.8 0 16 7.2 16 16s-7.2 16-16 16H368c-8.8 0-16-7.2-16-16m0 64c0-8.8 7.2-16 16-16h128c8.8 0 16 7.2 16 16s-7.2 16-16 16H368c-8.8 0-16-7.2-16-16",
130
+ opacity: ".4"
131
+ }
132
+ ),
133
+ /* @__PURE__ */ e("path", { d: "M176 256a64 64 0 1 0 0-128 64 64 0 1 0 0 128m-32 32c-44.2 0-80 35.8-80 80 0 8.8 7.2 16 16 16h192c8.8 0 16-7.2 16-16 0-44.2-35.8-80-80-80z" })
134
+ ]
135
+ }
136
+ ), Bt = ({
137
+ className: t,
138
+ viewBox: a,
139
+ title: o,
140
+ monotone: n,
141
+ ...r
142
+ }) => /* @__PURE__ */ i(
143
+ D,
144
+ {
145
+ defaultViewBox: "0 0 512 512",
146
+ size: "size-5",
147
+ viewBox: a,
148
+ className: t,
149
+ title: o || "Restore",
150
+ ...r,
151
+ children: [
152
+ /* @__PURE__ */ e(
153
+ "path",
154
+ {
155
+ d: "M128 80v16h64V80c0-8.8 7.2-16 16-16h224c8.8 0 16 7.2 16 16v224c0 8.8-7.2 16-16 16h-16v64h16c44.2 0 80-35.8 80-80V80c0-44.2-35.8-80-80-80H208c-44.2 0-80 35.8-80 80",
156
+ opacity: n ? "1" : "0.4"
157
+ }
158
+ ),
159
+ /* @__PURE__ */ e("path", { d: "M64 128c-35.3 0-64 28.7-64 64v256c0 35.3 28.7 64 64 64h256c35.3 0 64-28.7 64-64V192c0-35.3-28.7-64-64-64zm32 64h192c17.7 0 32 14.3 32 32s-14.3 32-32 32H96c-17.7 0-32-14.3-32-32s14.3-32 32-32" })
160
+ ]
161
+ }
162
+ ), Ht = ({
163
+ className: t,
164
+ viewBox: a,
165
+ title: o,
166
+ monotone: n,
167
+ ...r
168
+ }) => /* @__PURE__ */ e(
169
+ D,
170
+ {
171
+ defaultViewBox: "0 0 448 512",
172
+ size: "size-5",
173
+ viewBox: a,
174
+ className: t,
175
+ title: o || "Settings",
176
+ ...r,
177
+ children: /* @__PURE__ */ e("path", { d: "M432 256a48 48 0 1 1-96 0 48 48 0 1 1 96 0m-160 0a48 48 0 1 1-96 0 48 48 0 1 1 96 0M64 304a48 48 0 1 1 0-96 48 48 0 1 1 0 96" })
178
+ }
179
+ ), Dt = ({
180
+ className: t,
181
+ viewBox: a,
182
+ title: o,
183
+ monotone: n,
184
+ ...r
185
+ }) => /* @__PURE__ */ i(
186
+ D,
187
+ {
188
+ defaultViewBox: "0 0 512 512",
189
+ size: "size-5",
190
+ viewBox: a,
191
+ className: t,
192
+ title: o || "Sliders",
193
+ ...r,
194
+ children: [
195
+ /* @__PURE__ */ e(
196
+ "path",
197
+ {
198
+ d: "M0 96c0-17.7 14.3-32 32-32h86.7c-2.1 4.9-3.8 10.1-4.9 15.4-.6 2.7-1 5.4-1.3 8.2-.1 1.4-.3 2.8-.3 4.2s-.1 2.8-.1 4.2c0 11.4 2.4 22.2 6.7 32H32c-17.7 0-32-14.3-32-32m0 160c0-17.7 14.3-32 32-32h246.7c-2.1 4.9-3.8 10.1-4.9 15.4-.6 2.7-1 5.4-1.3 8.2-.1 1.4-.3 2.8-.3 4.2s-.1 2.8-.1 4.2c0 11.4 2.4 22.2 6.7 32H32c-17.7 0-32-14.3-32-32m0 160c0-17.7 14.3-32 32-32h54.7c-2.1 4.9-3.8 10.1-4.9 15.4-.6 2.7-1 5.4-1.3 8.2-.1 1.4-.3 2.8-.3 4.2s-.1 2.8-.1 4.2c0 11.4 2.4 22.2 6.7 32H32c-17.7 0-32-14.3-32-32m233.3-32H480c17.7 0 32 14.3 32 32s-14.3 32-32 32H233.3c2.1-4.9 3.8-10.1 4.9-15.4.6-2.7 1-5.4 1.3-8.2.1-1.4.3-2.8.3-4.2s.1-2.8.1-4.2c0-11.4-2.4-22.2-6.7-32zm32-320H480c17.7 0 32 14.3 32 32s-14.3 32-32 32H265.3c2.1-4.9 3.8-10.1 4.9-15.4.6-2.7 1-5.4 1.3-8.2.1-1.4.3-2.8.3-4.2s.1-2.8.1-4.2c0-11.4-2.4-22.2-6.7-32zm160 160H480c17.7 0 32 14.3 32 32s-14.3 32-32 32h-54.7c2.1-4.9 3.8-10.1 4.9-15.4.6-2.7 1-5.4 1.3-8.2.1-1.4.3-2.8.3-4.2s.1-2.8.1-4.2c0-11.4-2.4-22.2-6.7-32z",
199
+ opacity: n ? "1" : "0.4"
200
+ }
201
+ ),
202
+ /* @__PURE__ */ e("path", { d: "M128 416a32 32 0 1 1 64 0 32 32 0 1 1-64 0m112 0a80 80 0 1 0-160 0 80 80 0 1 0 160 0m80-160a32 32 0 1 1 64 0 32 32 0 1 1-64 0m112 0a80 80 0 1 0-160 0 80 80 0 1 0 160 0M192 128a32 32 0 1 1 0-64 32 32 0 1 1 0 64m0-112a80 80 0 1 0 0 160 80 80 0 1 0 0-160" })
203
+ ]
204
+ }
205
+ ), $t = () => {
206
+ const { getAccessToken: t } = $(), a = me(), o = me(), {
207
+ data: n,
208
+ error: r,
209
+ isLoading: l
210
+ } = pt({
211
+ getAccessToken: t
212
+ }), s = (n == null ? void 0 : n.plugins) || [], d = (n == null ? void 0 : n.version) || "", u = (n == null ? void 0 : n.models) || [];
213
+ return /* @__PURE__ */ i(z, { children: [
214
+ /* @__PURE__ */ e("div", { className: "mb-4", children: /* @__PURE__ */ e(
215
+ B,
216
+ {
217
+ header: N.ABOUT.TITLE_CLIENT,
218
+ className: "prose-dark dark:prose-lighter",
219
+ children: de(a, {
220
+ [N.ABOUT.VERSION]: "6.1.0",
221
+ [N.ABOUT.BUILD_TIMESTAMP]: "01/23/2025 11:39 AM EST"
222
+ })
223
+ }
224
+ ) }),
225
+ r || l ? null : /* @__PURE__ */ e(
226
+ B,
227
+ {
228
+ header: N.ABOUT.TITLE_SERVER,
229
+ className: "prose-dark dark:prose-lighter",
230
+ children: de(o, {
231
+ [N.ABOUT.VERSION]: d,
232
+ [ue(N.ABOUT.ENGINE, u.length)]: /* @__PURE__ */ e(z, { children: u.map((h) => /* @__PURE__ */ e("div", { className: "text-right", children: h }, h)) }),
233
+ [ue(N.ABOUT.PLUGIN, s.length)]: /* @__PURE__ */ e(z, { children: s.map((h) => /* @__PURE__ */ e("div", { className: "text-right", children: h }, h)) })
234
+ })
235
+ }
236
+ )
237
+ ] });
238
+ }, Vt = ({
239
+ open: t,
240
+ onOpenChange: a
241
+ }) => /* @__PURE__ */ e(le, { open: t, onOpenChange: a, title: Qe, children: /* @__PURE__ */ e($t, {}) }), Ft = async (t, a, o, n) => {
242
+ try {
243
+ const r = await oe({
244
+ accessToken: n,
245
+ type: se.GET_CHAT,
246
+ params: {
247
+ id: t.id
248
+ }
249
+ });
250
+ r.status === 200 && (a({
251
+ type: Ze
252
+ }), a({
253
+ type: et,
254
+ payload: {
255
+ id: t.id,
256
+ model: r.data.model,
257
+ usage: r.data.usage,
258
+ messages: r.data.messages
259
+ }
260
+ }), o(!1));
261
+ } catch {
262
+ }
263
+ }, Gt = ({
264
+ filteredHistory: t,
265
+ dispatch: a,
266
+ onOpenChange: o,
267
+ mutate: n
268
+ }) => {
269
+ var A;
270
+ const { user: r, getAccessToken: l } = $(), s = S(null), d = S({
271
+ id: 0,
272
+ timestamp: "",
273
+ message: ""
274
+ }), [u, h] = E(!1), [f, b] = E(
275
+ Se + ve
276
+ ), { state: x, dispatch: c } = he(Me), [, p] = Ee({
277
+ key: ke + Je,
278
+ initialValue: x.sortDirection
279
+ }), T = (m) => {
280
+ switch (x.sortDirection) {
281
+ case te.ASC:
282
+ p(te.DESC), c({
283
+ type: Ae,
284
+ payload: {
285
+ sortedCell: m,
286
+ sortDirection: te.DESC
287
+ }
288
+ });
289
+ break;
290
+ default:
291
+ p(te.ASC), c({
292
+ type: Ae,
293
+ payload: {
294
+ sortedCell: m,
295
+ sortDirection: te.ASC
296
+ }
297
+ });
298
+ break;
299
+ }
300
+ }, C = async () => {
301
+ const m = d.current;
302
+ try {
303
+ await oe({
304
+ accessToken: await l(),
305
+ type: se.DELETE_CHAT,
306
+ params: {
307
+ userId: (r == null ? void 0 : r.username) || "",
308
+ id: m.id
309
+ }
310
+ }), n();
311
+ } catch {
312
+ }
313
+ }, g = Be((m) => {
314
+ m[0].isIntersecting && b((R) => R + Se);
315
+ }, []);
316
+ return V(() => {
317
+ const m = {
318
+ // root: null,
319
+ rootMargin: "20px"
320
+ }, w = new IntersectionObserver(g, m);
321
+ s.current && w.observe(s.current);
322
+ }), /* @__PURE__ */ i(z, { children: [
323
+ /* @__PURE__ */ i(
324
+ Oe,
325
+ {
326
+ showConfirmation: u,
327
+ setShowConfirmation: h,
328
+ action: C,
329
+ customStrings: {
330
+ confirmAction: "Delete",
331
+ cancelAction: "Cancel",
332
+ title: "Delete chat"
333
+ },
334
+ children: [
335
+ /* @__PURE__ */ e("p", { className: "m-0", children: "Are you sure you want to delete the following chat:" }),
336
+ /* @__PURE__ */ i("ul", { className: "m-0", children: [
337
+ /* @__PURE__ */ i("li", { children: [
338
+ "Timestamp:",
339
+ " ",
340
+ /* @__PURE__ */ e("span", { className: "text-lg", children: d.current && d.current.timestamp })
341
+ ] }),
342
+ /* @__PURE__ */ i("li", { children: [
343
+ "First message:",
344
+ " ",
345
+ /* @__PURE__ */ e("span", { className: "text-lg", children: (A = d.current) == null ? void 0 : A.message })
346
+ ] })
347
+ ] })
348
+ ]
349
+ }
350
+ ),
351
+ /* @__PURE__ */ i(ft, { stickyHeader: !0, stickyFooter: !0, compact: !0, children: [
352
+ /* @__PURE__ */ e(gt, { children: /* @__PURE__ */ i(ge, { children: [
353
+ /* @__PURE__ */ e(O, { className: "sr-only", children: "Row" }),
354
+ /* @__PURE__ */ e(
355
+ yt,
356
+ {
357
+ buttonClassName: "text-xs sm:text-sm",
358
+ cellId: "timestamp",
359
+ align: "left",
360
+ sortDirection: x.sortDirection,
361
+ sortedCell: x.sortedCell,
362
+ onClick: () => {
363
+ T("timestamp");
364
+ },
365
+ children: "Date"
366
+ }
367
+ ),
368
+ /* @__PURE__ */ e(O, { className: "text-xs sm:text-sm", children: "First message" }),
369
+ /* @__PURE__ */ e(O, { className: "text-xs sm:text-sm", children: "Model" }),
370
+ /* @__PURE__ */ e(O, { className: "text-xs sm:text-sm text-right", children: "Actions" })
371
+ ] }) }),
372
+ /* @__PURE__ */ e(bt, { children: t.slice(0, f).map((m, w) => {
373
+ var R, j;
374
+ return ((R = m == null ? void 0 : m.messages) == null ? void 0 : R.length) > 0 ? /* @__PURE__ */ i(It, { children: [
375
+ w === f - ve && /* @__PURE__ */ e("tr", { ref: s }),
376
+ /* @__PURE__ */ i(ge, { children: [
377
+ /* @__PURE__ */ e(O, { children: w + 1 }),
378
+ /* @__PURE__ */ e(
379
+ O,
380
+ {
381
+ component: "th",
382
+ scope: "row",
383
+ className: "text-gray-400 sm:whitespace-nowrap text-xs sm:text-sm max-w-20 sm:max-w-none",
384
+ children: m.timestamp.split(",")[0]
385
+ }
386
+ ),
387
+ /* @__PURE__ */ e(
388
+ O,
389
+ {
390
+ className: "max-w-[100px] text-white sm:max-w-full text-xs sm:text-sm",
391
+ style: {
392
+ wordBreak: "break-word"
393
+ },
394
+ children: m.messages.length > 0 ? (j = m.messages[0]) == null ? void 0 : j.content : ""
395
+ }
396
+ ),
397
+ /* @__PURE__ */ i(
398
+ O,
399
+ {
400
+ component: "th",
401
+ scope: "row",
402
+ className: "text-gray-400",
403
+ align: "center",
404
+ children: [
405
+ m.model && m.model.startsWith("claude") && /* @__PURE__ */ e(xt, { size: "size-4 sm:size-5" }),
406
+ m.model && m.model.startsWith("gpt") && /* @__PURE__ */ e(kt, { size: "size-4 sm:size-5" })
407
+ ]
408
+ }
409
+ ),
410
+ /* @__PURE__ */ i(O, { align: "right", children: [
411
+ /* @__PURE__ */ e(
412
+ ae,
413
+ {
414
+ className: "mr-2",
415
+ focusMode: "alt-system",
416
+ noBorder: !0,
417
+ label: "Restore chat",
418
+ onClick: async () => {
419
+ const L = await l();
420
+ Ft(
421
+ m,
422
+ a,
423
+ o,
424
+ L
425
+ );
426
+ },
427
+ children: /* @__PURE__ */ e(Bt, { size: "size-3", monotone: !0 })
428
+ }
429
+ ),
430
+ /* @__PURE__ */ e(
431
+ ae,
432
+ {
433
+ focusMode: "alt-system",
434
+ noBorder: !0,
435
+ label: "Delete chat",
436
+ onClick: () => {
437
+ var L;
438
+ d.current = {
439
+ id: m.id,
440
+ timestamp: m.timestamp,
441
+ message: m.messages.length > 0 ? (L = m.messages[0]) == null ? void 0 : L.content : ""
442
+ }, h(!u);
443
+ },
444
+ children: /* @__PURE__ */ e("div", { className: "text-red-400", children: /* @__PURE__ */ e(Mt, { size: "size-3", monotone: !0 }) })
445
+ }
446
+ )
447
+ ] })
448
+ ] })
449
+ ] }, `${N.HISTORY.TITLE}-${m.id}-${w}`) : null;
450
+ }) }),
451
+ /* @__PURE__ */ e(Et, { children: /* @__PURE__ */ e(ge, { children: /* @__PURE__ */ e(O, { colSpan: 1e3, children: /* @__PURE__ */ e("div", { children: ue(
452
+ `${t.length} chat`,
453
+ t.length
454
+ ) }) }) }) })
455
+ ] })
456
+ ] });
457
+ }, Ut = ({
458
+ open: t,
459
+ onOpenChange: a
460
+ }) => {
461
+ const { getAccessToken: o, user: n } = $(), { state: r, dispatch: l } = he(Pe), { state: s, dispatch: d } = he(Me), { data: u, mutate: h } = Ct({
462
+ keys: [
463
+ n == null ? void 0 : n.username,
464
+ s.searchString,
465
+ s.sortDirection,
466
+ (r == null ? void 0 : r.lastTriggeredTimestamp) || 0
467
+ ],
468
+ getAccessToken: o
469
+ }), f = S(null), [, b] = Ee({
470
+ key: ke + tt,
471
+ initialValue: s.searchString
472
+ }), [x, c] = E([]);
473
+ V(() => {
474
+ u && c(u);
475
+ }, [u]);
476
+ const p = async (g) => {
477
+ b(g), d({
478
+ type: nt,
479
+ payload: { searchString: g }
480
+ });
481
+ }, T = at((g) => {
482
+ p(g.target.value.trim());
483
+ }, 500);
484
+ return /* @__PURE__ */ e(le, { open: t, onOpenChange: a, title: rt, children: /* @__PURE__ */ i(z, { children: [
485
+ /* @__PURE__ */ e("form", { autoComplete: "off", onSubmit: async (g) => {
486
+ g.preventDefault();
487
+ }, children: /* @__PURE__ */ e(
488
+ be,
489
+ {
490
+ autoCapitalize: "off",
491
+ autoComplete: "off",
492
+ autoCorrect: "off",
493
+ ref: f,
494
+ defaultValue: s.searchString,
495
+ focusMode: "light",
496
+ mode: "dark",
497
+ name: "Search",
498
+ label: "Search",
499
+ onChange: T,
500
+ className: "mt-2 mb-2",
501
+ ...s.searchString && {
502
+ rightElement: /* @__PURE__ */ e(
503
+ X,
504
+ {
505
+ type: "button",
506
+ disabled: !s.searchString,
507
+ mode: "light",
508
+ focusMode: "light",
509
+ noBorder: !0,
510
+ size: "small",
511
+ onClick: () => {
512
+ var g;
513
+ p(""), (g = f.current) != null && g.value && (f.current.value = "", f.current.focus());
514
+ },
515
+ children: "Reset"
516
+ }
517
+ )
518
+ }
519
+ }
520
+ ) }),
521
+ /* @__PURE__ */ e("div", { className: "flex flex-col gap-2 sm:flex-row max-h-[60vh] min-h-[60vh]", children: /* @__PURE__ */ e(
522
+ Gt,
523
+ {
524
+ mutate: h,
525
+ filteredHistory: x,
526
+ dispatch: l,
527
+ onOpenChange: a
528
+ }
529
+ ) })
530
+ ] }) });
531
+ }, Yt = ({ stats: t }) => {
532
+ const { isAuthenticated: a, user: o, registeringForPasskey: n, authenticationType: r } = $(), l = me(), s = me(), d = (o == null ? void 0 : o.username) || "";
533
+ return a && d ? /* @__PURE__ */ i(z, { children: [
534
+ /* @__PURE__ */ e(
535
+ B,
536
+ {
537
+ header: N.PREFERENCES.TITLE,
538
+ className: "prose-dark dark:prose-lighter",
539
+ children: de(l, {
540
+ [N.PREFERENCES.NAME]: d,
541
+ [N.PREFERENCES.EMAIL]: (o == null ? void 0 : o.email) || ""
542
+ })
543
+ }
544
+ ),
545
+ r !== ot.PASSKEY && /* @__PURE__ */ i(
546
+ B,
547
+ {
548
+ className: "prose-dark dark:prose-lighter mt-4",
549
+ header: /* @__PURE__ */ e("h2", { className: "m-0", children: /* @__PURE__ */ i(q, { columnGap: 3, alignVertical: "center", children: [
550
+ /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(Ie, { size: "size-8" }) }),
551
+ /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e("div", { children: N.PREFERENCES.PASSKEY_TITLE }) })
552
+ ] }) }),
553
+ children: [
554
+ /* @__PURE__ */ e("p", { children: N.PREFERENCES.PASSKEY_INSTRUCTIONS }),
555
+ /* @__PURE__ */ e(
556
+ ae,
557
+ {
558
+ size: "small",
559
+ className: "mt-2",
560
+ onClick: n,
561
+ labelLeft: N.PREFERENCES.PASSKEY_BUTTON,
562
+ children: /* @__PURE__ */ e(Ie, { size: "size-5", monotone: !0 })
563
+ }
564
+ )
565
+ ]
566
+ }
567
+ ),
568
+ /* @__PURE__ */ e(
569
+ B,
570
+ {
571
+ header: N.MAIN_STATISTICS.TITLE,
572
+ className: "prose-dark dark:prose-lighter mt-4",
573
+ children: de(s, {
574
+ [ue(N.MAIN_STATISTICS.TOTAL, t.totalChats)]: t.totalChats,
575
+ [N.MAIN_STATISTICS.PROCESSING_TIME]: st(
576
+ t.averageProcessingTimes
577
+ )
578
+ })
579
+ }
580
+ )
581
+ ] }) : null;
582
+ }, jt = ({
583
+ open: t,
584
+ onOpenChange: a
585
+ }) => {
586
+ const { getAccessToken: o, user: n } = $(), {
587
+ data: r,
588
+ error: l,
589
+ isLoading: s
590
+ } = Tt({
591
+ keys: [n == null ? void 0 : n.username],
592
+ getAccessToken: o
593
+ });
594
+ return l || s ? null : /* @__PURE__ */ e(le, { open: t, onOpenChange: a, title: lt, children: /* @__PURE__ */ e(Yt, { stats: r }) });
595
+ };
596
+ /*!
597
+ @versini/ui-textarea v3.0.10
598
+ © 2025 gizmette.com
599
+ */
600
+ try {
601
+ window.__VERSINI_UI_TEXTAREA__ || (window.__VERSINI_UI_TEXTAREA__ = {
602
+ version: "3.0.10",
603
+ buildTime: "01/20/2025 10:07 PM EST",
604
+ homepage: "https://github.com/aversini/ui-components",
605
+ license: "MIT"
606
+ });
607
+ } catch {
608
+ }
609
+ const De = "av-text-area", Kt = "av-text-area-wrapper", ye = "av-text-area-helper-text", Wt = "av-text-area__control--right", Xt = "av-text-area__control--left";
610
+ function qt() {
611
+ const t = S(!1);
612
+ return V(() => (t.current = !0, () => {
613
+ t.current = !1;
614
+ }), []), Be(() => t.current, []);
615
+ }
616
+ function Qt(t) {
617
+ return He(() => t.every((a) => a == null) ? () => {
618
+ } : (a) => {
619
+ t.forEach((o) => {
620
+ typeof o == "function" ? o(a) : o != null && (o.current = a);
621
+ });
622
+ }, t);
623
+ }
624
+ const Jt = {
625
+ x: 0,
626
+ y: 0,
627
+ width: 0,
628
+ height: 0,
629
+ top: 0,
630
+ left: 0,
631
+ bottom: 0,
632
+ right: 0
633
+ };
634
+ function Re(t) {
635
+ const a = qt(), o = S(0), n = S(null), [r, l] = E(Jt), s = He(() => typeof ResizeObserver > "u" ? null : new ResizeObserver((d) => {
636
+ const u = d[0];
637
+ u && (cancelAnimationFrame(o.current), o.current = requestAnimationFrame(() => {
638
+ n.current && a() && l(u.contentRect);
639
+ }));
640
+ }), [a]);
641
+ return V(() => (n.current && (s == null || s.observe(n.current, t)), () => {
642
+ s == null || s.disconnect(), o.current && cancelAnimationFrame(o.current);
643
+ }), [s, t]), [n, r];
644
+ }
645
+ function Zt({
646
+ value: t,
647
+ defaultValue: a,
648
+ finalValue: o,
649
+ onChange: n = () => {
650
+ },
651
+ initialControlledDelay: r = 0
652
+ }) {
653
+ const [l, s] = E(!1), [d, u] = E(
654
+ a !== void 0 ? a : o
655
+ ), h = (f) => {
656
+ u(f), n == null || n(f);
657
+ };
658
+ return V(() => {
659
+ (async () => t !== void 0 && !l && r > 0 && (await new Promise(
660
+ (f) => setTimeout(f, r)
661
+ ), s(!0)))();
662
+ }, [t, r, l]), t !== void 0 ? !l && r > 0 ? ["", n, !0] : [t, n, !0] : [d, h, !1];
663
+ }
664
+ function er(t) {
665
+ const a = _t();
666
+ if (!t)
667
+ return a;
668
+ if (typeof t == "number" || typeof t == "string")
669
+ return `${t}${a}`;
670
+ if (typeof t == "object") {
671
+ const { id: o, prefix: n = "" } = t;
672
+ return typeof o == "number" || typeof o == "string" ? `${n}${o}` : `${n}${a}`;
673
+ }
674
+ }
675
+ const $e = "SET_ANNOUNCEMENT", Ve = "CLEAR_ANNOUNCEMENT", tr = {
676
+ alert: null,
677
+ alertdialog: null,
678
+ log: "polite",
679
+ marquee: null,
680
+ progressbar: null,
681
+ status: "polite",
682
+ timer: "assertive"
683
+ }, rr = (t, a) => {
684
+ switch (a == null ? void 0 : a.type) {
685
+ case $e:
686
+ return {
687
+ ...t,
688
+ announcement: a.payload
689
+ };
690
+ case Ve:
691
+ return {
692
+ ...t,
693
+ announcement: null
694
+ };
695
+ default:
696
+ return t;
697
+ }
698
+ }, nr = ({
699
+ onAnnouncementClear: t,
700
+ dispatch: a
701
+ }) => {
702
+ a({
703
+ type: Ve
704
+ }), typeof t == "function" && t();
705
+ }, Le = ({
706
+ children: t,
707
+ clearAnnouncementDelay: a,
708
+ clearAnnouncementTimeoutRef: o,
709
+ onAnnouncementClear: n,
710
+ dispatch: r
711
+ }) => {
712
+ clearTimeout(o.current), t !== null && r({
713
+ type: $e,
714
+ payload: t
715
+ }), a && (o.current = setTimeout(
716
+ () => nr({
717
+ onAnnouncementClear: n,
718
+ dispatch: r
719
+ }),
720
+ a
721
+ ));
722
+ }, ar = ({
723
+ children: t,
724
+ announcementTimeoutRef: a,
725
+ announcementDelay: o,
726
+ clearAnnouncementDelay: n,
727
+ clearAnnouncementTimeoutRef: r,
728
+ onAnnouncementClear: l,
729
+ dispatch: s
730
+ }) => {
731
+ clearTimeout(a.current), o ? a.current = setTimeout(Le, o, {
732
+ children: t,
733
+ clearAnnouncementDelay: n,
734
+ clearAnnouncementTimeoutRef: r,
735
+ onAnnouncementClear: l,
736
+ dispatch: s
737
+ }) : Le({
738
+ children: t,
739
+ clearAnnouncementDelay: n,
740
+ clearAnnouncementTimeoutRef: r,
741
+ onAnnouncementClear: l,
742
+ dispatch: s
743
+ });
744
+ };
745
+ function or({
746
+ children: t,
747
+ className: a,
748
+ politeness: o,
749
+ role: n = null,
750
+ announcementDelay: r,
751
+ clearAnnouncementDelay: l,
752
+ onAnnouncementClear: s,
753
+ visible: d,
754
+ ...u
755
+ }) {
756
+ const h = S(null), f = S(null), [b, x] = Rt(rr, {
757
+ announcement: null
758
+ });
759
+ let c = o;
760
+ typeof c > "u" && (c = n ? tr[n] : "assertive"), V(() => {
761
+ ar({
762
+ announcementTimeoutRef: h,
763
+ announcementDelay: r,
764
+ children: t,
765
+ clearAnnouncementDelay: l,
766
+ clearAnnouncementTimeoutRef: f,
767
+ onAnnouncementClear: s,
768
+ dispatch: x
769
+ });
770
+ }, [
771
+ t,
772
+ r,
773
+ l,
774
+ s
775
+ ]);
776
+ const p = y(a, {
777
+ "sr-only": !d
778
+ });
779
+ return /* @__PURE__ */ e(
780
+ "div",
781
+ {
782
+ "aria-live": c,
783
+ ...n && { role: n },
784
+ className: p,
785
+ ...u,
786
+ children: b.announcement
787
+ }
788
+ );
789
+ }
790
+ /*!
791
+ @versini/ui-liveregion v1.3.7
792
+ © 2025 gizmette.com
793
+ */
794
+ try {
795
+ window.__VERSINI_UI_LIVEREGION__ || (window.__VERSINI_UI_LIVEREGION__ = {
796
+ version: "1.3.7",
797
+ buildTime: "01/20/2025 10:07 PM EST",
798
+ homepage: "https://github.com/aversini/ui-components",
799
+ license: "MIT"
800
+ });
801
+ } catch {
802
+ }
803
+ const sr = () => "rounded-md text-base h-20 min-h-[80px] resize-none overflow-hidden px-4 py-7", lr = ({ mode: t }) => y({
804
+ "bg-surface-darker text-copy-lighter caret-copy-light": t === "dark",
805
+ "bg-surface-lighter text-copy-dark caret-copy-dark": t === "light",
806
+ "bg-surface-lighter text-copy-dark caret-copy-dark dark:bg-surface-darker dark:text-copy-lighter dark:caret-copy-light": t === "system",
807
+ "bg-surface-darker text-copy-lighter caret-copy-light dark:bg-surface-lighter dark:text-copy-dark dark:caret-copy-dark": t === "alt-system"
808
+ }), cr = ({
809
+ focusMode: t
810
+ }) => y("focus:outline focus:outline-2 focus:outline-offset-2", {
811
+ "focus:outline-focus-dark": t === "dark",
812
+ "focus:outline-focus-light": t === "light",
813
+ "focus:outline-focus-light dark:focus:outline-focus-dark": t === "alt-system",
814
+ "focus:outline-focus-dark dark:focus:outline-focus-light": t === "system"
815
+ }), ir = ({
816
+ noBorder: t,
817
+ error: a
818
+ }) => y("border-2", {
819
+ "border-border-dark": !t && !a,
820
+ "focus:border-border-dark": !t && a,
821
+ "border-border-error-dark": !t && a,
822
+ "border-transparent": t
823
+ }), dr = ({
824
+ disabled: t,
825
+ raw: a,
826
+ error: o,
827
+ mode: n,
828
+ leftElement: r,
829
+ rightElement: l
830
+ }) => {
831
+ if (a)
832
+ return "";
833
+ if (t)
834
+ return y(
835
+ "transform translate-y-0 scale-100 absolute px-2 cursor-not-allowed opacity-50 font-medium",
836
+ {
837
+ "translate-x-[12px]": l === !0 && !r || !l && !r
838
+ }
839
+ );
840
+ if (!o)
841
+ return y(
842
+ "absolute px-2 cursor-text font-medium transform translate-y-0 scale-100",
843
+ {
844
+ "translate-x-[12px]": l === !0 && !r || !l && !r,
845
+ "text-copy-medium": n === "dark",
846
+ "text-copy-dark": n === "light",
847
+ "text-copy-dark dark:text-copy-medium": n === "system",
848
+ "text-copy-medium dark:text-copy-dark": n === "alt-system"
849
+ }
850
+ );
851
+ if (o)
852
+ return y(
853
+ "absolute px-2 cursor-text font-medium transform translate-y-0 scale-100",
854
+ {
855
+ "translate-x-[12px]": l === !0 && !r || !l && !r,
856
+ "text-copy-medium": n === "dark",
857
+ "text-copy-error-dark": n === "light",
858
+ "text-copy-error-dark dark:text-copy-error-light": n === "system",
859
+ "text-copy-medium dark:text-copy-error-dark": n === "alt-system"
860
+ }
861
+ );
862
+ }, ur = ({
863
+ error: t,
864
+ raw: a,
865
+ mode: o,
866
+ disabled: n
867
+ }) => {
868
+ if (a)
869
+ return "";
870
+ if (n)
871
+ return y(
872
+ ye,
873
+ "absolute px-2 cursor-not-allowed opacity-50 font-medium"
874
+ );
875
+ if (!t)
876
+ return y(ye, "absolute px-2 font-medium", {
877
+ "text-copy-medium": o === "dark",
878
+ "text-copy-dark": o === "light",
879
+ "text-copy-dark dark:text-copy-medium": o === "system",
880
+ "text-copy-medium dark:text-copy-dark": o === "alt-system"
881
+ });
882
+ if (t)
883
+ return y(ye, "absolute px-2 font-medium", {
884
+ "text-copy-error-light": o === "dark",
885
+ "text-copy-error-dark": o === "light",
886
+ "text-copy-error-dark dark:text-copy-error-light": o === "system",
887
+ "dark:text-copy-error-dark text-copy-error-light": o === "alt-system"
888
+ });
889
+ }, mr = ({
890
+ className: t,
891
+ textAreaClassName: a,
892
+ raw: o,
893
+ focusMode: n,
894
+ disabled: r,
895
+ noBorder: l,
896
+ error: s,
897
+ mode: d,
898
+ leftElement: u,
899
+ rightElement: h
900
+ }) => {
901
+ const f = o ? t : y(
902
+ "relative flex w-full flex-col justify-center",
903
+ Kt,
904
+ t
905
+ ), b = o ? y(a) : y(
906
+ De,
907
+ a,
908
+ sr(),
909
+ lr({ mode: d }),
910
+ cr({ focusMode: n }),
911
+ ir({
912
+ noBorder: l,
913
+ error: s
914
+ }),
915
+ {
916
+ "disabled:cursor-not-allowed disabled:opacity-50": r
917
+ }
918
+ ), x = o ? void 0 : "sr-only", c = dr({
919
+ disabled: r,
920
+ raw: o,
921
+ error: s,
922
+ mode: d,
923
+ rightElement: h,
924
+ leftElement: u
925
+ }), p = ur({
926
+ error: s,
927
+ raw: o,
928
+ mode: d,
929
+ disabled: r
930
+ }), T = o ? void 0 : y(Wt, "absolute"), C = o ? void 0 : y(Xt, "absolute");
931
+ return {
932
+ wrapper: f,
933
+ textArea: b,
934
+ accessibleLabel: x,
935
+ visibleLabel: c,
936
+ helperText: p,
937
+ rightElement: T,
938
+ leftElement: C
939
+ };
940
+ }, hr = ({
941
+ scrollHeight: t,
942
+ currentHeight: a,
943
+ currentLabelOffset: o = 0,
944
+ currentHelperTextOffset: n = 0
945
+ }) => {
946
+ let r, l;
947
+ if (t > 0 && t !== a) {
948
+ const s = t - a, d = Math.abs(s / 24);
949
+ r = o + -1 * Math.sign(s) * (12 * d), l = n + Math.sign(s) * (12 * d);
950
+ }
951
+ return {
952
+ labelOffset: r,
953
+ helperTextOffset: l,
954
+ scrollHeight: t
955
+ };
956
+ }, xe = At.forwardRef(
957
+ ({
958
+ id: t,
959
+ name: a,
960
+ label: o,
961
+ error: n = !1,
962
+ raw: r = !1,
963
+ className: l,
964
+ textAreaClassName: s,
965
+ mode: d = "system",
966
+ focusMode: u = "system",
967
+ value: h,
968
+ defaultValue: f,
969
+ disabled: b = !1,
970
+ noBorder: x = !1,
971
+ labelId: c,
972
+ helperText: p = "",
973
+ helperTextOnFocus: T = !1,
974
+ rightElement: C,
975
+ leftElement: g,
976
+ onChange: A,
977
+ onFocus: m,
978
+ onBlur: w,
979
+ ...R
980
+ }, j) => {
981
+ var L;
982
+ const I = S(null), ce = Qt([j, I]), [k, _] = Re(), [Q, F] = Re(), K = S(80), G = S(-25), M = S(null), J = S(30), Z = S(null), U = er({ id: t, prefix: `${De}-` }), [Ce, Fe] = E(0), [Te, Ge] = E(0), [Ue, Ne] = E(
983
+ !!(!T && p)
984
+ ), Ye = `${a} error, ${p}`, Y = mr({
985
+ className: l,
986
+ textAreaClassName: s,
987
+ error: n,
988
+ raw: r,
989
+ focusMode: u,
990
+ disabled: b,
991
+ noBorder: x,
992
+ mode: d,
993
+ rightElement: !!C,
994
+ leftElement: !!g
995
+ }), [H, je] = Zt({
996
+ value: h,
997
+ initialControlledDelay: 20,
998
+ defaultValue: f,
999
+ onChange: (v) => {
1000
+ A && A({
1001
+ target: {
1002
+ value: v
1003
+ }
1004
+ });
1005
+ }
1006
+ }), Ke = (v) => {
1007
+ je(v.target.value);
1008
+ }, We = (v) => {
1009
+ T && p && Ne(!0), m && m(v);
1010
+ }, Xe = (v) => {
1011
+ T && p && !H && Ne(!1), w && w(v);
1012
+ };
1013
+ return ne(() => {
1014
+ _ && _.width && Fe(_.width + 18 + 10);
1015
+ }, [_]), ne(() => {
1016
+ F && F.width && Ge(F.width + 18 + 10);
1017
+ }, [F]), ne(() => {
1018
+ r || I && I.current && H !== void 0 && (I.current.style.height = "inherit", I.current.style.height = I.current.scrollHeight + "px");
1019
+ }, [H, r]), ne(() => {
1020
+ r || setTimeout(() => {
1021
+ var v;
1022
+ (v = M == null ? void 0 : M.current) == null || v.style.setProperty(
1023
+ "--av-text-area-wrapper-transition",
1024
+ H ? "none" : "all 0.2s ease-out"
1025
+ );
1026
+ }, 0);
1027
+ }, [H, r]), ne(() => {
1028
+ var v, we;
1029
+ if (!r && I && I.current && H !== void 0) {
1030
+ const { labelOffset: pe, helperTextOffset: fe, scrollHeight: qe } = hr({
1031
+ scrollHeight: I.current.scrollHeight,
1032
+ currentHeight: K.current,
1033
+ currentLabelOffset: G.current,
1034
+ currentHelperTextOffset: J.current
1035
+ });
1036
+ pe && (G.current = pe, (v = M == null ? void 0 : M.current) == null || v.style.setProperty(
1037
+ "--av-text-area-label",
1038
+ `${pe}px`
1039
+ )), fe && (J.current = fe, (we = Z == null ? void 0 : Z.current) == null || we.style.setProperty(
1040
+ "--av-text-area-helper-text",
1041
+ `${fe}px`
1042
+ )), K.current = qe || K.current;
1043
+ }
1044
+ }, [H, r]), F.width > 0 && ((L = M == null ? void 0 : M.current) == null || L.style.setProperty(
1045
+ "--tw-translate-x",
1046
+ `${12 + F.width + 5}px`
1047
+ )), /* @__PURE__ */ i("div", { className: Y.wrapper, children: [
1048
+ /* @__PURE__ */ e(
1049
+ "label",
1050
+ {
1051
+ htmlFor: U,
1052
+ id: c,
1053
+ className: Y.accessibleLabel,
1054
+ children: o
1055
+ }
1056
+ ),
1057
+ g && /* @__PURE__ */ e(
1058
+ "div",
1059
+ {
1060
+ ref: Q,
1061
+ className: Y.leftElement,
1062
+ children: g
1063
+ }
1064
+ ),
1065
+ /* @__PURE__ */ e(
1066
+ "textarea",
1067
+ {
1068
+ ref: ce,
1069
+ id: U,
1070
+ name: a,
1071
+ disabled: b,
1072
+ placeholder: r ? void 0 : " ",
1073
+ className: Y.textArea,
1074
+ rows: 1,
1075
+ ...p && { "aria-describedby": `${U}-helper` },
1076
+ ...n && { "aria-invalid": "true" },
1077
+ ...C && !g && !r && { style: { paddingRight: Ce } },
1078
+ ...g && !C && !r && { style: { paddingLeft: Te } },
1079
+ ...C && g && !r && {
1080
+ style: {
1081
+ paddingRight: Ce,
1082
+ paddingLeft: Te
1083
+ }
1084
+ },
1085
+ value: H,
1086
+ onChange: Ke,
1087
+ onFocus: We,
1088
+ onBlur: Xe,
1089
+ ...R
1090
+ }
1091
+ ),
1092
+ !r && /* @__PURE__ */ e(
1093
+ "label",
1094
+ {
1095
+ ref: M,
1096
+ "aria-hidden": !0,
1097
+ htmlFor: U,
1098
+ className: `${Y.visibleLabel}`,
1099
+ children: o
1100
+ }
1101
+ ),
1102
+ Ue && /* @__PURE__ */ e(
1103
+ "div",
1104
+ {
1105
+ ref: Z,
1106
+ id: `${U}-helper`,
1107
+ className: Y.helperText,
1108
+ children: p
1109
+ }
1110
+ ),
1111
+ C && /* @__PURE__ */ e(
1112
+ "div",
1113
+ {
1114
+ ref: k,
1115
+ className: Y.rightElement,
1116
+ children: C
1117
+ }
1118
+ ),
1119
+ n && p && /* @__PURE__ */ e(or, { politeness: "polite", clearAnnouncementDelay: 500, children: Ye })
1120
+ ] });
1121
+ }
1122
+ );
1123
+ xe.displayName = "TextArea";
1124
+ /*!
1125
+ @versini/ui-toggle v3.0.8
1126
+ © 2025 gizmette.com
1127
+ */
1128
+ try {
1129
+ window.__VERSINI_UI_TOGGLE__ || (window.__VERSINI_UI_TOGGLE__ = {
1130
+ version: "3.0.8",
1131
+ buildTime: "01/20/2025 01:49 PM EST",
1132
+ homepage: "https://github.com/aversini/ui-components",
1133
+ license: "MIT"
1134
+ });
1135
+ } catch {
1136
+ }
1137
+ const pr = "av-toggle", fr = () => y("peer", "h-6", "w-11", "rounded-full"), gr = ({
1138
+ focusMode: t
1139
+ }) => y(
1140
+ "peer-focus:outline",
1141
+ "peer-focus:outline-2",
1142
+ "peer-focus:outline-offset-2",
1143
+ {
1144
+ "peer-focus:outline-focus-dark": t === "dark",
1145
+ "peer-focus:outline-focus-light": t === "light",
1146
+ "peer-focus:outline-focus-light dark:peer-focus:outline-focus-dark": t === "alt-system",
1147
+ "peer-focus:outline-focus-dark dark:peer-focus:outline-focus-light": t === "system"
1148
+ }
1149
+ ), yr = () => y(
1150
+ "peer-checked:after:translate-x-full",
1151
+ // background color when checked
1152
+ "peer-checked:bg-violet-500",
1153
+ // knob circle and border color when checked
1154
+ "peer-checked:after:bg-white",
1155
+ "peer-checked:after:border-white"
1156
+ ), br = () => y(
1157
+ "after:left-[2px]",
1158
+ "after:top-[2px]",
1159
+ "after:border",
1160
+ "after:border-surface-light dark:after:border-surface-medium",
1161
+ "after:bg-surface-light dark:after:bg-surface-medium",
1162
+ "after:absolute",
1163
+ "after:h-5",
1164
+ "after:w-5",
1165
+ "after:rounded-full",
1166
+ "after:transition-all",
1167
+ "after:content-['']"
1168
+ ), xr = ({
1169
+ mode: t,
1170
+ noBorder: a
1171
+ }) => y({
1172
+ border: !a,
1173
+ "border-border-dark bg-surface-medium": t === "light",
1174
+ "border-border-light bg-surface-darker": t === "dark",
1175
+ "border-border-light bg-surface-darker dark:border-border-dark dark:bg-surface-medium": t === "alt-system",
1176
+ "border-border-dark bg-surface-medium dark:border-border-light dark:bg-surface-darker": t === "system"
1177
+ }), kr = ({
1178
+ mode: t,
1179
+ labelHidden: a
1180
+ }) => a ? "sr-only" : y("ml-2 text-sm", {
1181
+ "text-copy-dark": t === "light",
1182
+ "text-copy-lighter": t === "dark",
1183
+ "text-copy-lighter dark:text-copy-dark": t === "alt-system",
1184
+ "text-copy-dark dark:text-copy-lighter": t === "system"
1185
+ }), Er = ({ className: t }) => y(
1186
+ pr,
1187
+ "relative flex cursor-pointer items-center",
1188
+ t
1189
+ ), Cr = ({
1190
+ mode: t,
1191
+ focusMode: a,
1192
+ labelHidden: o,
1193
+ className: n,
1194
+ noBorder: r
1195
+ }) => ({
1196
+ toggle: y(
1197
+ fr(),
1198
+ xr({ mode: t, noBorder: r }),
1199
+ gr({ focusMode: a }),
1200
+ br(),
1201
+ yr()
1202
+ ),
1203
+ label: kr({ mode: t, labelHidden: o }),
1204
+ input: "peer sr-only",
1205
+ wrapper: Er({ className: n })
1206
+ }), ie = ({
1207
+ checked: t = !1,
1208
+ onChange: a,
1209
+ label: o,
1210
+ labelHidden: n = !1,
1211
+ name: r,
1212
+ mode: l = "system",
1213
+ focusMode: s = "system",
1214
+ className: d,
1215
+ noBorder: u = !1
1216
+ }) => {
1217
+ const h = Cr({
1218
+ mode: l,
1219
+ focusMode: s,
1220
+ labelHidden: n,
1221
+ className: d,
1222
+ noBorder: u
1223
+ }), f = (b) => {
1224
+ a == null || a(b.target.checked);
1225
+ };
1226
+ return /* @__PURE__ */ i("label", { className: h.wrapper, children: [
1227
+ /* @__PURE__ */ e(
1228
+ "input",
1229
+ {
1230
+ name: r,
1231
+ checked: t,
1232
+ type: "checkbox",
1233
+ className: h.input,
1234
+ onChange: f
1235
+ }
1236
+ ),
1237
+ /* @__PURE__ */ e("div", { className: h.toggle }),
1238
+ /* @__PURE__ */ e("span", { className: h.label, children: o })
1239
+ ] });
1240
+ }, Tr = ({
1241
+ open: t,
1242
+ onOpenChange: a
1243
+ }) => {
1244
+ const { getAccessToken: o, user: n } = $(), {
1245
+ data: r,
1246
+ error: l,
1247
+ isLoading: s,
1248
+ mutate: d
1249
+ } = ze({
1250
+ keys: [n == null ? void 0 : n.username],
1251
+ getAccessToken: o
1252
+ }), [u, h] = E({
1253
+ prompts: []
1254
+ }), f = ({
1255
+ slot: c,
1256
+ checked: p,
1257
+ label: T,
1258
+ content: C
1259
+ }) => {
1260
+ h((g) => {
1261
+ const A = g.prompts, m = {
1262
+ slot: c,
1263
+ label: T,
1264
+ content: C,
1265
+ enabled: p
1266
+ }, w = A.findIndex((R) => R.slot === c);
1267
+ return w === -1 ? {
1268
+ ...g,
1269
+ prompts: [...A, { ...m, slot: c }]
1270
+ } : (A[w] = m, {
1271
+ ...g,
1272
+ prompts: [...A]
1273
+ });
1274
+ });
1275
+ }, b = async (c) => {
1276
+ c.preventDefault();
1277
+ try {
1278
+ await oe({
1279
+ accessToken: await o(),
1280
+ type: se.SET_USER_PREFERENCES,
1281
+ params: {
1282
+ user: n == null ? void 0 : n.username,
1283
+ tags: u.prompts
1284
+ }
1285
+ });
1286
+ } catch {
1287
+ }
1288
+ }, x = () => {
1289
+ d({ ...r }), a(!1);
1290
+ };
1291
+ return V(() => {
1292
+ r != null && r.tags && h({ prompts: r.tags });
1293
+ }, [r]), l || s ? null : /* @__PURE__ */ i(
1294
+ le,
1295
+ {
1296
+ open: t,
1297
+ onOpenChange: x,
1298
+ title: "Prompts",
1299
+ footer: /* @__PURE__ */ i(
1300
+ q,
1301
+ {
1302
+ columnGap: 2,
1303
+ alignHorizontal: "flex-end",
1304
+ className: "pb-8 sm:pb-0",
1305
+ children: [
1306
+ /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
1307
+ X,
1308
+ {
1309
+ mode: "dark",
1310
+ variant: "secondary",
1311
+ focusMode: "light",
1312
+ onClick: x,
1313
+ children: "Cancel"
1314
+ }
1315
+ ) }),
1316
+ /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
1317
+ X,
1318
+ {
1319
+ mode: "dark",
1320
+ variant: "danger",
1321
+ focusMode: "light",
1322
+ onClick: async (c) => {
1323
+ a(!1), await b(c);
1324
+ },
1325
+ children: "Save"
1326
+ }
1327
+ ) })
1328
+ ]
1329
+ }
1330
+ ),
1331
+ children: [
1332
+ /* @__PURE__ */ e("p", { children: ct }),
1333
+ u.prompts && u.prompts.map((c) => /* @__PURE__ */ i(
1334
+ B,
1335
+ {
1336
+ header: `Prompt ${c.slot + 1}`,
1337
+ className: "prose-dark dark:prose-lighter mb-2",
1338
+ children: [
1339
+ /* @__PURE__ */ i(q, { className: "mt-8 mb-6", columnGap: 2, rowGap: 6, children: [
1340
+ /* @__PURE__ */ e(P, { span: 12, children: /* @__PURE__ */ e(
1341
+ be,
1342
+ {
1343
+ label: "Label",
1344
+ name: `prompt${c.slot}-label`,
1345
+ value: c.label,
1346
+ onChange: (p) => {
1347
+ f({
1348
+ slot: c.slot,
1349
+ checked: c.enabled,
1350
+ label: p.target.value,
1351
+ content: c.content
1352
+ });
1353
+ }
1354
+ }
1355
+ ) }),
1356
+ /* @__PURE__ */ e(P, { span: 12, children: /* @__PURE__ */ e(
1357
+ be,
1358
+ {
1359
+ label: "Content",
1360
+ name: `prompt${c.slot}-content`,
1361
+ value: c.content,
1362
+ onChange: (p) => {
1363
+ f({
1364
+ slot: c.slot,
1365
+ checked: c.enabled,
1366
+ label: c.label,
1367
+ content: p.target.value
1368
+ });
1369
+ }
1370
+ }
1371
+ ) })
1372
+ ] }),
1373
+ /* @__PURE__ */ e(
1374
+ ie,
1375
+ {
1376
+ className: "mt-2",
1377
+ noBorder: !0,
1378
+ label: "Enabled",
1379
+ name: c.slot.toString(),
1380
+ onChange: (p) => {
1381
+ f({
1382
+ slot: c.slot,
1383
+ checked: p,
1384
+ label: c.label,
1385
+ content: c.content
1386
+ });
1387
+ },
1388
+ checked: c.enabled
1389
+ }
1390
+ )
1391
+ ]
1392
+ },
1393
+ `prompt-slot-${c.slot}`
1394
+ ))
1395
+ ]
1396
+ }
1397
+ );
1398
+ }, Nr = ({
1399
+ open: t,
1400
+ onOpenChange: a
1401
+ }) => {
1402
+ const { getAccessToken: o, user: n } = $(), {
1403
+ data: r,
1404
+ error: l,
1405
+ isLoading: s,
1406
+ mutate: d
1407
+ } = ze({
1408
+ keys: [n == null ? void 0 : n.username],
1409
+ getAccessToken: o
1410
+ }), [u, h] = E(!1), [f, b] = E({
1411
+ loadingLocation: !1
1412
+ }), [x, c] = E(""), [p, T] = E(""), [C, g] = E(it), [A, m] = Ee({
1413
+ key: ke + dt,
1414
+ initialValue: !1
1415
+ }), w = (k) => {
1416
+ m(k);
1417
+ }, R = async (k) => {
1418
+ k.preventDefault();
1419
+ try {
1420
+ await oe({
1421
+ accessToken: await o(),
1422
+ type: se.SET_USER_PREFERENCES,
1423
+ params: {
1424
+ user: n == null ? void 0 : n.username,
1425
+ instructions: x,
1426
+ location: p,
1427
+ engine: C
1428
+ }
1429
+ }), d(), b({
1430
+ loadingLocation: !1
1431
+ });
1432
+ } catch {
1433
+ }
1434
+ }, j = async () => {
1435
+ b({
1436
+ loadingLocation: !0
1437
+ }), T("...");
1438
+ try {
1439
+ const k = Date.now(), _ = await ht(), Q = await oe({
1440
+ accessToken: await o(),
1441
+ type: se.GET_LOCATION,
1442
+ params: {
1443
+ latitude: _.latitude,
1444
+ longitude: _.longitude
1445
+ }
1446
+ }), K = Date.now() - k;
1447
+ if (K < 2e3 && await new Promise((G) => setTimeout(G, 2e3 - K)), Q.status === 200) {
1448
+ const { city: G, state: M, country: J, displayName: Z } = Q.data, U = G && M && J ? `${G}, ${M}, ${J}` : Z;
1449
+ b({
1450
+ loadingLocation: !1
1451
+ }), T(U);
1452
+ } else
1453
+ b({
1454
+ loadingLocation: !1
1455
+ });
1456
+ } catch {
1457
+ }
1458
+ }, L = (k, _) => {
1459
+ g(k ? _ : _ === W ? ee : W);
1460
+ }, I = () => {
1461
+ h(!u);
1462
+ }, ce = () => {
1463
+ d({ ...r }), a(!1);
1464
+ };
1465
+ return V(() => {
1466
+ r != null && r.instructions && c(r.instructions), r != null && r.location && T(r.location), r != null && r.engine && g(r.engine);
1467
+ }, [r]), l || s ? null : /* @__PURE__ */ e(
1468
+ le,
1469
+ {
1470
+ open: t,
1471
+ onOpenChange: ce,
1472
+ title: ut,
1473
+ footer: /* @__PURE__ */ i(
1474
+ q,
1475
+ {
1476
+ columnGap: 2,
1477
+ alignHorizontal: "flex-end",
1478
+ className: "pb-8 sm:pb-0",
1479
+ children: [
1480
+ /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
1481
+ X,
1482
+ {
1483
+ mode: "dark",
1484
+ variant: "secondary",
1485
+ focusMode: "light",
1486
+ onClick: ce,
1487
+ children: "Cancel"
1488
+ }
1489
+ ) }),
1490
+ /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
1491
+ X,
1492
+ {
1493
+ mode: "dark",
1494
+ variant: "danger",
1495
+ focusMode: "light",
1496
+ onClick: async (k) => {
1497
+ a(!1), await R(k);
1498
+ },
1499
+ children: "Save"
1500
+ }
1501
+ ) })
1502
+ ]
1503
+ }
1504
+ ),
1505
+ children: /* @__PURE__ */ i(z, { children: [
1506
+ u && /* @__PURE__ */ e(Tr, { open: u, onOpenChange: h }),
1507
+ /* @__PURE__ */ i(
1508
+ B,
1509
+ {
1510
+ header: N.SETTINGS_ENGINE.TITLE,
1511
+ className: "prose-dark dark:prose-lighter",
1512
+ children: [
1513
+ /* @__PURE__ */ e("p", { className: "text-sm", children: "Select the AI engine that will be used to generate responses." }),
1514
+ /* @__PURE__ */ e(
1515
+ ie,
1516
+ {
1517
+ noBorder: !0,
1518
+ label: W,
1519
+ name: W,
1520
+ onChange: (k) => L(k, W),
1521
+ checked: C === W
1522
+ }
1523
+ ),
1524
+ /* @__PURE__ */ e(
1525
+ ie,
1526
+ {
1527
+ className: "mt-2",
1528
+ noBorder: !0,
1529
+ label: ee,
1530
+ name: ee,
1531
+ onChange: (k) => L(k, ee),
1532
+ checked: C === ee
1533
+ }
1534
+ ),
1535
+ /* @__PURE__ */ e("p", { className: "text-sm", children: 'This "Show Message Statistics" option adds individual statistics for each messages under their respective bubbles, such as processing time, model name, and more.' }),
1536
+ /* @__PURE__ */ e(
1537
+ ie,
1538
+ {
1539
+ className: "mt-2",
1540
+ noBorder: !0,
1541
+ label: "Show Message Statistics",
1542
+ name: "show-message-statistics",
1543
+ onChange: w,
1544
+ checked: A
1545
+ }
1546
+ ),
1547
+ /* @__PURE__ */ e("h3", { className: "border-b-2 border-slate-400", children: "Prompts" }),
1548
+ /* @__PURE__ */ e(
1549
+ ae,
1550
+ {
1551
+ className: "mt-2",
1552
+ size: "small",
1553
+ onClick: I,
1554
+ labelLeft: "Edit Custom Prompts",
1555
+ children: /* @__PURE__ */ e(Nt, { size: "size-3", monotone: !0 })
1556
+ }
1557
+ )
1558
+ ]
1559
+ }
1560
+ ),
1561
+ /* @__PURE__ */ i(
1562
+ B,
1563
+ {
1564
+ header: "Custom Instructions",
1565
+ className: "prose-dark dark:prose-lighter mt-4",
1566
+ children: [
1567
+ /* @__PURE__ */ i("p", { className: "text-sm", children: [
1568
+ "What would you like ",
1569
+ /* @__PURE__ */ e("em", { children: mt }),
1570
+ " to know about you to provide better responses?"
1571
+ ] }),
1572
+ /* @__PURE__ */ e(
1573
+ xe,
1574
+ {
1575
+ mode: "alt-system",
1576
+ autoCapitalize: "off",
1577
+ autoComplete: "off",
1578
+ autoCorrect: "off",
1579
+ name: "customInstructions",
1580
+ label: "Custom Instructions",
1581
+ value: x,
1582
+ onChange: (k) => {
1583
+ c(k.target.value);
1584
+ },
1585
+ helperText: "Press ENTER to add a new line."
1586
+ }
1587
+ )
1588
+ ]
1589
+ }
1590
+ ),
1591
+ /* @__PURE__ */ i(
1592
+ B,
1593
+ {
1594
+ header: "Location",
1595
+ className: "prose-dark dark:prose-lighter mt-4",
1596
+ children: [
1597
+ /* @__PURE__ */ e("p", { className: "text-sm", children: "You can share your location to receive customized responses based on your area." }),
1598
+ /* @__PURE__ */ e(
1599
+ xe,
1600
+ {
1601
+ mode: "alt-system",
1602
+ name: "location",
1603
+ label: "Location",
1604
+ value: p,
1605
+ onChange: (k) => {
1606
+ T(k.target.value);
1607
+ },
1608
+ helperText: "Enter your location or press auto-detect."
1609
+ }
1610
+ ),
1611
+ /* @__PURE__ */ e(
1612
+ X,
1613
+ {
1614
+ className: "mt-2",
1615
+ size: "small",
1616
+ noBorder: !0,
1617
+ disabled: f.loadingLocation,
1618
+ onClick: j,
1619
+ children: f.loadingLocation ? "Detecting..." : "Auto-detect"
1620
+ }
1621
+ )
1622
+ ]
1623
+ }
1624
+ )
1625
+ ] })
1626
+ }
1627
+ );
1628
+ }, _r = () => {
1629
+ const { logout: t } = $(), { state: a } = he(Pe), [o, n] = E(!1), [r, l] = E(!1), [s, d] = E(!1), [u, h] = E(!1), [f, b] = E(!1), x = () => {
1630
+ n(!o);
1631
+ }, c = () => {
1632
+ l(!r);
1633
+ }, p = () => {
1634
+ d(!s);
1635
+ }, T = () => {
1636
+ h(!u);
1637
+ }, C = () => {
1638
+ b(!f);
1639
+ };
1640
+ return /* @__PURE__ */ i(z, { children: [
1641
+ /* @__PURE__ */ e(
1642
+ Oe,
1643
+ {
1644
+ showConfirmation: f,
1645
+ setShowConfirmation: b,
1646
+ action: t,
1647
+ customStrings: {
1648
+ confirmAction: _e,
1649
+ cancelAction: "Cancel",
1650
+ title: _e
1651
+ },
1652
+ children: /* @__PURE__ */ e("p", { children: "Are you sure you want to log out?" })
1653
+ }
1654
+ ),
1655
+ /* @__PURE__ */ e(jt, { open: o, onOpenChange: n }),
1656
+ /* @__PURE__ */ e(Nr, { open: r, onOpenChange: l }),
1657
+ s && /* @__PURE__ */ e(Ut, { open: s, onOpenChange: d }),
1658
+ /* @__PURE__ */ e(Vt, { open: u, onOpenChange: h }),
1659
+ /* @__PURE__ */ e("div", { className: "bg-slate-900 py-4 px-4 rounded-t-md", children: /* @__PURE__ */ e(q, { alignHorizontal: "flex-end", alignVertical: "center", children: /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(q, { children: /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
1660
+ wt,
1661
+ {
1662
+ label: "Profile, Settings, etc.",
1663
+ mode: "light",
1664
+ placement: "left",
1665
+ trigger: /* @__PURE__ */ i(
1666
+ St,
1667
+ {
1668
+ mode: "dark",
1669
+ focusMode: "light",
1670
+ trigger: /* @__PURE__ */ e(ae, { label: "Settings", children: /* @__PURE__ */ e(Ht, {}) }),
1671
+ defaultPlacement: "bottom-end",
1672
+ children: [
1673
+ /* @__PURE__ */ e(
1674
+ re,
1675
+ {
1676
+ label: "Profile",
1677
+ onClick: x,
1678
+ icon: /* @__PURE__ */ e(zt, {})
1679
+ }
1680
+ ),
1681
+ /* @__PURE__ */ e(
1682
+ re,
1683
+ {
1684
+ label: "Settings",
1685
+ onClick: c,
1686
+ icon: /* @__PURE__ */ e(Dt, {})
1687
+ }
1688
+ ),
1689
+ /* @__PURE__ */ e(
1690
+ re,
1691
+ {
1692
+ label: "History",
1693
+ onClick: p,
1694
+ icon: /* @__PURE__ */ e(Ot, {})
1695
+ }
1696
+ ),
1697
+ /* @__PURE__ */ e(
1698
+ re,
1699
+ {
1700
+ label: "About",
1701
+ onClick: T,
1702
+ icon: /* @__PURE__ */ e(Pt, {})
1703
+ }
1704
+ ),
1705
+ a && a.id && !a.isComponent && /* @__PURE__ */ i(z, { children: [
1706
+ /* @__PURE__ */ e(vt, {}),
1707
+ /* @__PURE__ */ e(
1708
+ re,
1709
+ {
1710
+ label: "Log out",
1711
+ onClick: C,
1712
+ icon: /* @__PURE__ */ e("div", { className: "text-red-700", children: /* @__PURE__ */ e(Lt, { monotone: !0 }) })
1713
+ }
1714
+ )
1715
+ ] })
1716
+ ]
1717
+ }
1718
+ )
1719
+ }
1720
+ ) }) }) }) }) })
1721
+ ] });
1722
+ };
1723
+ export {
1724
+ _r as default
1725
+ };