@versini/sassysaint 6.0.3 → 6.2.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,1751 @@
1
+ import { jsxs as i, jsx as e, Fragment as z } from "react/jsx-runtime";
2
+ import { g as V, un as F, 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 oe, 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 O, 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.CUiqvVTR.js";
3
+ import { i as me, useServerCapabilities as ft, Ie as ce, HistoryContext as Me, E as Ce, ConfirmationPanel as Pe, ge as pt, he as gt, ue as ge, le as P, ye as yt, me as bt, p as xt, z as kt, be as Ct, serviceCall as se, SERVICE_TYPES as le, f as te, AppContext as Oe, useChatsHistory as Et, useUserChatStats as Tt, useUserPreferences as ze, m as Nt, _e as wt, me$1 as St, R as re, P as vt } from "./App.D4e44Rzs.js";
4
+ import At, { useRef as S, useState as C, useContext as he, useCallback as Be, useEffect as H, 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
+ V,
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
+ V,
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
+ ), Pt = ({
59
+ className: t,
60
+ viewBox: a,
61
+ title: o,
62
+ monotone: n,
63
+ ...r
64
+ }) => /* @__PURE__ */ i(
65
+ V,
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
+ ), Ot = ({
85
+ className: t,
86
+ viewBox: a,
87
+ title: o,
88
+ monotone: n,
89
+ ...r
90
+ }) => /* @__PURE__ */ i(
91
+ V,
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
+ V,
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
+ V,
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
+ V,
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
+ V,
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 } = F(), a = me(), o = me(), {
207
+ data: n,
208
+ error: r,
209
+ isLoading: c
210
+ } = ft({
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.2.0",
221
+ [N.ABOUT.BUILD_TIMESTAMP]: "01/23/2025 12:23 PM EST"
222
+ })
223
+ }
224
+ ) }),
225
+ r || c ? 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((f) => /* @__PURE__ */ e("div", { className: "text-right", children: f }, f)) }),
233
+ [ue(N.ABOUT.PLUGIN, s.length)]: /* @__PURE__ */ e(z, { children: s.map((f) => /* @__PURE__ */ e("div", { className: "text-right", children: f }, f)) })
234
+ })
235
+ }
236
+ )
237
+ ] });
238
+ }, Vt = ({
239
+ open: t,
240
+ onOpenChange: a
241
+ }) => /* @__PURE__ */ e(ce, { open: t, onOpenChange: a, title: Qe, children: /* @__PURE__ */ e($t, {}) }), Ft = async (t, a, o, n) => {
242
+ try {
243
+ const r = await se({
244
+ accessToken: n,
245
+ type: le.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: c } = F(), s = S(null), d = S({
271
+ id: 0,
272
+ timestamp: "",
273
+ message: ""
274
+ }), [u, f] = C(!1), [p, b] = C(
275
+ Se + ve
276
+ ), { state: x, dispatch: l } = he(Me), [, h] = Ce({
277
+ key: ke + Je,
278
+ initialValue: x.sortDirection
279
+ }), T = (m) => {
280
+ switch (x.sortDirection) {
281
+ case te.ASC:
282
+ h(te.DESC), l({
283
+ type: Ae,
284
+ payload: {
285
+ sortedCell: m,
286
+ sortDirection: te.DESC
287
+ }
288
+ });
289
+ break;
290
+ default:
291
+ h(te.ASC), l({
292
+ type: Ae,
293
+ payload: {
294
+ sortedCell: m,
295
+ sortDirection: te.ASC
296
+ }
297
+ });
298
+ break;
299
+ }
300
+ }, E = async () => {
301
+ const m = d.current;
302
+ try {
303
+ await se({
304
+ accessToken: await c(),
305
+ type: le.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((I) => I + Se);
315
+ }, []);
316
+ return H(() => {
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
+ Pe,
325
+ {
326
+ showConfirmation: u,
327
+ setShowConfirmation: f,
328
+ action: E,
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(pt, { stickyHeader: !0, stickyFooter: !0, compact: !0, children: [
352
+ /* @__PURE__ */ e(gt, { children: /* @__PURE__ */ i(ge, { children: [
353
+ /* @__PURE__ */ e(P, { 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(P, { className: "text-xs sm:text-sm", children: "First message" }),
369
+ /* @__PURE__ */ e(P, { className: "text-xs sm:text-sm", children: "Model" }),
370
+ /* @__PURE__ */ e(P, { className: "text-xs sm:text-sm text-right", children: "Actions" })
371
+ ] }) }),
372
+ /* @__PURE__ */ e(bt, { children: t.slice(0, p).map((m, w) => {
373
+ var I, D;
374
+ return ((I = m == null ? void 0 : m.messages) == null ? void 0 : I.length) > 0 ? /* @__PURE__ */ i(It, { children: [
375
+ w === p - ve && /* @__PURE__ */ e("tr", { ref: s }),
376
+ /* @__PURE__ */ i(ge, { children: [
377
+ /* @__PURE__ */ e(P, { children: w + 1 }),
378
+ /* @__PURE__ */ e(
379
+ P,
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
+ P,
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 ? (D = m.messages[0]) == null ? void 0 : D.content : ""
395
+ }
396
+ ),
397
+ /* @__PURE__ */ i(
398
+ P,
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(P, { align: "right", children: [
411
+ /* @__PURE__ */ e(
412
+ oe,
413
+ {
414
+ className: "mr-2",
415
+ focusMode: "alt-system",
416
+ noBorder: !0,
417
+ label: "Restore chat",
418
+ onClick: async () => {
419
+ const L = await c();
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
+ oe,
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
+ }, f(!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(Ct, { children: /* @__PURE__ */ e(ge, { children: /* @__PURE__ */ e(P, { 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 } = F(), { state: r, dispatch: c } = he(Oe), { state: s, dispatch: d } = he(Me), { data: u, mutate: f } = Et({
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
+ }), p = S(null), [, b] = Ce({
470
+ key: ke + tt,
471
+ initialValue: s.searchString
472
+ }), [x, l] = C([]);
473
+ H(() => {
474
+ u && l(u);
475
+ }, [u]);
476
+ const h = async (g) => {
477
+ b(g), d({
478
+ type: nt,
479
+ payload: { searchString: g }
480
+ });
481
+ }, T = at((g) => {
482
+ h(g.target.value.trim());
483
+ }, 500);
484
+ return /* @__PURE__ */ e(ce, { 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: p,
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
+ h(""), (g = p.current) != null && g.value && (p.current.value = "", p.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: f,
525
+ filteredHistory: x,
526
+ dispatch: c,
527
+ onOpenChange: a
528
+ }
529
+ ) })
530
+ ] }) });
531
+ }, Yt = ({ stats: t }) => {
532
+ const { isAuthenticated: a, user: o, registeringForPasskey: n, authenticationType: r } = F(), c = 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(c, {
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(O, { children: /* @__PURE__ */ e(Ie, { size: "size-8" }) }),
551
+ /* @__PURE__ */ e(O, { 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
+ oe,
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 } = F(), {
587
+ data: r,
588
+ error: c,
589
+ isLoading: s
590
+ } = Tt({
591
+ keys: [n == null ? void 0 : n.username],
592
+ getAccessToken: o
593
+ });
594
+ return c || s ? null : /* @__PURE__ */ e(ce, { 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 H(() => (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, c] = C(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() && c(u.contentRect);
639
+ }));
640
+ }), [a]);
641
+ return H(() => (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 [c, s] = C(!1), [d, u] = C(
654
+ a !== void 0 ? a : o
655
+ ), f = (p) => {
656
+ u(p), n == null || n(p);
657
+ };
658
+ return H(() => {
659
+ (async () => t !== void 0 && !c && r > 0 && (await new Promise(
660
+ (p) => setTimeout(p, r)
661
+ ), s(!0)))();
662
+ }, [t, r, c]), t !== void 0 ? !c && r > 0 ? ["", n, !0] : [t, n, !0] : [d, f, !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: c,
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: c,
736
+ dispatch: s
737
+ }) : Le({
738
+ children: t,
739
+ clearAnnouncementDelay: n,
740
+ clearAnnouncementTimeoutRef: r,
741
+ onAnnouncementClear: c,
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: c,
752
+ onAnnouncementClear: s,
753
+ visible: d,
754
+ ...u
755
+ }) {
756
+ const f = S(null), p = S(null), [b, x] = Rt(rr, {
757
+ announcement: null
758
+ });
759
+ let l = o;
760
+ typeof l > "u" && (l = n ? tr[n] : "assertive"), H(() => {
761
+ ar({
762
+ announcementTimeoutRef: f,
763
+ announcementDelay: r,
764
+ children: t,
765
+ clearAnnouncementDelay: c,
766
+ clearAnnouncementTimeoutRef: p,
767
+ onAnnouncementClear: s,
768
+ dispatch: x
769
+ });
770
+ }, [
771
+ t,
772
+ r,
773
+ c,
774
+ s
775
+ ]);
776
+ const h = y(a, {
777
+ "sr-only": !d
778
+ });
779
+ return /* @__PURE__ */ e(
780
+ "div",
781
+ {
782
+ "aria-live": l,
783
+ ...n && { role: n },
784
+ className: h,
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: c
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]": c === !0 && !r || !c && !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]": c === !0 && !r || !c && !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]": c === !0 && !r || !c && !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: c,
896
+ error: s,
897
+ mode: d,
898
+ leftElement: u,
899
+ rightElement: f
900
+ }) => {
901
+ const p = 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: c,
913
+ error: s
914
+ }),
915
+ {
916
+ "disabled:cursor-not-allowed disabled:opacity-50": r
917
+ }
918
+ ), x = o ? void 0 : "sr-only", l = dr({
919
+ disabled: r,
920
+ raw: o,
921
+ error: s,
922
+ mode: d,
923
+ rightElement: f,
924
+ leftElement: u
925
+ }), h = ur({
926
+ error: s,
927
+ raw: o,
928
+ mode: d,
929
+ disabled: r
930
+ }), T = o ? void 0 : y(Wt, "absolute"), E = o ? void 0 : y(Xt, "absolute");
931
+ return {
932
+ wrapper: p,
933
+ textArea: b,
934
+ accessibleLabel: x,
935
+ visibleLabel: l,
936
+ helperText: h,
937
+ rightElement: T,
938
+ leftElement: E
939
+ };
940
+ }, hr = ({
941
+ scrollHeight: t,
942
+ currentHeight: a,
943
+ currentLabelOffset: o = 0,
944
+ currentHelperTextOffset: n = 0
945
+ }) => {
946
+ let r, c;
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), c = n + Math.sign(s) * (12 * d);
950
+ }
951
+ return {
952
+ labelOffset: r,
953
+ helperTextOffset: c,
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: c,
964
+ textAreaClassName: s,
965
+ mode: d = "system",
966
+ focusMode: u = "system",
967
+ value: f,
968
+ defaultValue: p,
969
+ disabled: b = !1,
970
+ noBorder: x = !1,
971
+ labelId: l,
972
+ helperText: h = "",
973
+ helperTextOnFocus: T = !1,
974
+ rightElement: E,
975
+ leftElement: g,
976
+ onChange: A,
977
+ onFocus: m,
978
+ onBlur: w,
979
+ ...I
980
+ }, D) => {
981
+ var L;
982
+ const _ = S(null), ie = Qt([D, _]), [k, R] = Re(), [Q, G] = Re(), K = S(80), U = S(-25), M = S(null), J = S(30), Z = S(null), Y = er({ id: t, prefix: `${De}-` }), [Ee, Fe] = C(0), [Te, Ge] = C(0), [Ue, Ne] = C(
983
+ !!(!T && h)
984
+ ), Ye = `${a} error, ${h}`, j = mr({
985
+ className: c,
986
+ textAreaClassName: s,
987
+ error: n,
988
+ raw: r,
989
+ focusMode: u,
990
+ disabled: b,
991
+ noBorder: x,
992
+ mode: d,
993
+ rightElement: !!E,
994
+ leftElement: !!g
995
+ }), [$, je] = Zt({
996
+ value: f,
997
+ initialControlledDelay: 20,
998
+ defaultValue: p,
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 && h && Ne(!0), m && m(v);
1010
+ }, Xe = (v) => {
1011
+ T && h && !$ && Ne(!1), w && w(v);
1012
+ };
1013
+ return ne(() => {
1014
+ R && R.width && Fe(R.width + 18 + 10);
1015
+ }, [R]), ne(() => {
1016
+ G && G.width && Ge(G.width + 18 + 10);
1017
+ }, [G]), ne(() => {
1018
+ r || _ && _.current && $ !== void 0 && (_.current.style.height = "inherit", _.current.style.height = _.current.scrollHeight + "px");
1019
+ }, [$, 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
+ $ ? "none" : "all 0.2s ease-out"
1025
+ );
1026
+ }, 0);
1027
+ }, [$, r]), ne(() => {
1028
+ var v, we;
1029
+ if (!r && _ && _.current && $ !== void 0) {
1030
+ const { labelOffset: fe, helperTextOffset: pe, scrollHeight: qe } = hr({
1031
+ scrollHeight: _.current.scrollHeight,
1032
+ currentHeight: K.current,
1033
+ currentLabelOffset: U.current,
1034
+ currentHelperTextOffset: J.current
1035
+ });
1036
+ fe && (U.current = fe, (v = M == null ? void 0 : M.current) == null || v.style.setProperty(
1037
+ "--av-text-area-label",
1038
+ `${fe}px`
1039
+ )), pe && (J.current = pe, (we = Z == null ? void 0 : Z.current) == null || we.style.setProperty(
1040
+ "--av-text-area-helper-text",
1041
+ `${pe}px`
1042
+ )), K.current = qe || K.current;
1043
+ }
1044
+ }, [$, r]), G.width > 0 && ((L = M == null ? void 0 : M.current) == null || L.style.setProperty(
1045
+ "--tw-translate-x",
1046
+ `${12 + G.width + 5}px`
1047
+ )), /* @__PURE__ */ i("div", { className: j.wrapper, children: [
1048
+ /* @__PURE__ */ e(
1049
+ "label",
1050
+ {
1051
+ htmlFor: Y,
1052
+ id: l,
1053
+ className: j.accessibleLabel,
1054
+ children: o
1055
+ }
1056
+ ),
1057
+ g && /* @__PURE__ */ e(
1058
+ "div",
1059
+ {
1060
+ ref: Q,
1061
+ className: j.leftElement,
1062
+ children: g
1063
+ }
1064
+ ),
1065
+ /* @__PURE__ */ e(
1066
+ "textarea",
1067
+ {
1068
+ ref: ie,
1069
+ id: Y,
1070
+ name: a,
1071
+ disabled: b,
1072
+ placeholder: r ? void 0 : " ",
1073
+ className: j.textArea,
1074
+ rows: 1,
1075
+ ...h && { "aria-describedby": `${Y}-helper` },
1076
+ ...n && { "aria-invalid": "true" },
1077
+ ...E && !g && !r && { style: { paddingRight: Ee } },
1078
+ ...g && !E && !r && { style: { paddingLeft: Te } },
1079
+ ...E && g && !r && {
1080
+ style: {
1081
+ paddingRight: Ee,
1082
+ paddingLeft: Te
1083
+ }
1084
+ },
1085
+ value: $,
1086
+ onChange: Ke,
1087
+ onFocus: We,
1088
+ onBlur: Xe,
1089
+ ...I
1090
+ }
1091
+ ),
1092
+ !r && /* @__PURE__ */ e(
1093
+ "label",
1094
+ {
1095
+ ref: M,
1096
+ "aria-hidden": !0,
1097
+ htmlFor: Y,
1098
+ className: `${j.visibleLabel}`,
1099
+ children: o
1100
+ }
1101
+ ),
1102
+ Ue && /* @__PURE__ */ e(
1103
+ "div",
1104
+ {
1105
+ ref: Z,
1106
+ id: `${Y}-helper`,
1107
+ className: j.helperText,
1108
+ children: h
1109
+ }
1110
+ ),
1111
+ E && /* @__PURE__ */ e(
1112
+ "div",
1113
+ {
1114
+ ref: k,
1115
+ className: j.rightElement,
1116
+ children: E
1117
+ }
1118
+ ),
1119
+ n && h && /* @__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 fr = "av-toggle", pr = () => 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
+ }), Cr = ({ className: t }) => y(
1186
+ fr,
1187
+ "relative flex cursor-pointer items-center",
1188
+ t
1189
+ ), Er = ({
1190
+ mode: t,
1191
+ focusMode: a,
1192
+ labelHidden: o,
1193
+ className: n,
1194
+ noBorder: r
1195
+ }) => ({
1196
+ toggle: y(
1197
+ pr(),
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: Cr({ className: n })
1206
+ }), ae = ({
1207
+ checked: t = !1,
1208
+ onChange: a,
1209
+ label: o,
1210
+ labelHidden: n = !1,
1211
+ name: r,
1212
+ mode: c = "system",
1213
+ focusMode: s = "system",
1214
+ className: d,
1215
+ noBorder: u = !1
1216
+ }) => {
1217
+ const f = Er({
1218
+ mode: c,
1219
+ focusMode: s,
1220
+ labelHidden: n,
1221
+ className: d,
1222
+ noBorder: u
1223
+ }), p = (b) => {
1224
+ a == null || a(b.target.checked);
1225
+ };
1226
+ return /* @__PURE__ */ i("label", { className: f.wrapper, children: [
1227
+ /* @__PURE__ */ e(
1228
+ "input",
1229
+ {
1230
+ name: r,
1231
+ checked: t,
1232
+ type: "checkbox",
1233
+ className: f.input,
1234
+ onChange: p
1235
+ }
1236
+ ),
1237
+ /* @__PURE__ */ e("div", { className: f.toggle }),
1238
+ /* @__PURE__ */ e("span", { className: f.label, children: o })
1239
+ ] });
1240
+ }, Tr = ({
1241
+ open: t,
1242
+ onOpenChange: a
1243
+ }) => {
1244
+ const { getAccessToken: o, user: n } = F(), {
1245
+ data: r,
1246
+ error: c,
1247
+ isLoading: s,
1248
+ mutate: d
1249
+ } = ze({
1250
+ keys: [n == null ? void 0 : n.username],
1251
+ getAccessToken: o,
1252
+ isPaused: !0
1253
+ }), [u, f] = C({
1254
+ prompts: []
1255
+ }), p = ({
1256
+ slot: l,
1257
+ checked: h,
1258
+ label: T,
1259
+ content: E,
1260
+ privateChat: g = !1
1261
+ }) => {
1262
+ f((A) => {
1263
+ const m = A.prompts, w = {
1264
+ slot: l,
1265
+ label: T,
1266
+ content: E,
1267
+ enabled: h,
1268
+ privateChat: g
1269
+ };
1270
+ console.info(`==> [${Date.now()}] : `, w);
1271
+ const I = m.findIndex((D) => D.slot === l);
1272
+ return I === -1 ? {
1273
+ ...A,
1274
+ prompts: [...m, { ...w, slot: l }]
1275
+ } : (m[I] = w, {
1276
+ ...A,
1277
+ prompts: [...m]
1278
+ });
1279
+ });
1280
+ }, b = async (l) => {
1281
+ l.preventDefault();
1282
+ try {
1283
+ await se({
1284
+ accessToken: await o(),
1285
+ type: le.SET_USER_PREFERENCES,
1286
+ params: {
1287
+ user: n == null ? void 0 : n.username,
1288
+ tags: u.prompts
1289
+ }
1290
+ });
1291
+ } catch {
1292
+ }
1293
+ }, x = () => {
1294
+ d({ ...r }), a(!1);
1295
+ };
1296
+ return H(() => {
1297
+ r != null && r.tags && f({ prompts: r.tags });
1298
+ }, [r]), H(() => {
1299
+ console.info(`==> [${Date.now()}] localPrompts: `, u);
1300
+ }, [u]), c || s ? null : /* @__PURE__ */ i(
1301
+ ce,
1302
+ {
1303
+ open: t,
1304
+ onOpenChange: x,
1305
+ title: "Prompts",
1306
+ footer: /* @__PURE__ */ i(
1307
+ q,
1308
+ {
1309
+ columnGap: 2,
1310
+ alignHorizontal: "flex-end",
1311
+ className: "pb-8 sm:pb-0",
1312
+ children: [
1313
+ /* @__PURE__ */ e(O, { children: /* @__PURE__ */ e(
1314
+ X,
1315
+ {
1316
+ mode: "dark",
1317
+ variant: "secondary",
1318
+ focusMode: "light",
1319
+ onClick: x,
1320
+ children: "Cancel"
1321
+ }
1322
+ ) }),
1323
+ /* @__PURE__ */ e(O, { children: /* @__PURE__ */ e(
1324
+ X,
1325
+ {
1326
+ mode: "dark",
1327
+ variant: "danger",
1328
+ focusMode: "light",
1329
+ onClick: async (l) => {
1330
+ a(!1), await b(l);
1331
+ },
1332
+ children: "Save"
1333
+ }
1334
+ ) })
1335
+ ]
1336
+ }
1337
+ ),
1338
+ children: [
1339
+ /* @__PURE__ */ e("p", { children: ct }),
1340
+ u.prompts && u.prompts.map((l) => /* @__PURE__ */ i(
1341
+ B,
1342
+ {
1343
+ header: `Prompt ${l.slot + 1}`,
1344
+ className: "prose-dark dark:prose-lighter mb-2",
1345
+ children: [
1346
+ /* @__PURE__ */ i(q, { className: "mt-8 mb-6", columnGap: 2, rowGap: 6, children: [
1347
+ /* @__PURE__ */ e(O, { span: 12, children: /* @__PURE__ */ e(
1348
+ be,
1349
+ {
1350
+ label: "Label",
1351
+ name: `prompt${l.slot}-label`,
1352
+ value: l.label,
1353
+ onChange: (h) => {
1354
+ p({
1355
+ slot: l.slot,
1356
+ checked: l.enabled,
1357
+ label: h.target.value,
1358
+ content: l.content
1359
+ });
1360
+ }
1361
+ }
1362
+ ) }),
1363
+ /* @__PURE__ */ e(O, { span: 12, children: /* @__PURE__ */ e(
1364
+ be,
1365
+ {
1366
+ label: "Content",
1367
+ name: `prompt${l.slot}-content`,
1368
+ value: l.content,
1369
+ onChange: (h) => {
1370
+ p({
1371
+ slot: l.slot,
1372
+ checked: l.enabled,
1373
+ label: l.label,
1374
+ content: h.target.value
1375
+ });
1376
+ }
1377
+ }
1378
+ ) })
1379
+ ] }),
1380
+ /* @__PURE__ */ e(
1381
+ ae,
1382
+ {
1383
+ className: "mt-2",
1384
+ noBorder: !0,
1385
+ label: "Enabled",
1386
+ name: l.slot.toString(),
1387
+ onChange: (h) => {
1388
+ p({
1389
+ slot: l.slot,
1390
+ checked: h,
1391
+ label: l.label,
1392
+ content: l.content
1393
+ });
1394
+ },
1395
+ checked: l.enabled
1396
+ }
1397
+ ),
1398
+ /* @__PURE__ */ e(
1399
+ ae,
1400
+ {
1401
+ className: "mt-2",
1402
+ noBorder: !0,
1403
+ label: "Temporary Chat",
1404
+ name: `private-${l.slot.toString()}`,
1405
+ onChange: (h) => {
1406
+ p({
1407
+ slot: l.slot,
1408
+ checked: l.enabled,
1409
+ label: l.label,
1410
+ content: l.content,
1411
+ privateChat: h
1412
+ });
1413
+ },
1414
+ checked: l.privateChat
1415
+ }
1416
+ )
1417
+ ]
1418
+ },
1419
+ `prompt-slot-${l.slot}`
1420
+ ))
1421
+ ]
1422
+ }
1423
+ );
1424
+ }, Nr = ({
1425
+ open: t,
1426
+ onOpenChange: a
1427
+ }) => {
1428
+ const { getAccessToken: o, user: n } = F(), {
1429
+ data: r,
1430
+ error: c,
1431
+ isLoading: s,
1432
+ mutate: d
1433
+ } = ze({
1434
+ keys: [n == null ? void 0 : n.username],
1435
+ getAccessToken: o
1436
+ }), [u, f] = C(!1), [p, b] = C({
1437
+ loadingLocation: !1
1438
+ }), [x, l] = C(""), [h, T] = C(""), [E, g] = C(it), [A, m] = Ce({
1439
+ key: ke + dt,
1440
+ initialValue: !1
1441
+ }), w = (k) => {
1442
+ m(k);
1443
+ }, I = async (k) => {
1444
+ k.preventDefault();
1445
+ try {
1446
+ await se({
1447
+ accessToken: await o(),
1448
+ type: le.SET_USER_PREFERENCES,
1449
+ params: {
1450
+ user: n == null ? void 0 : n.username,
1451
+ instructions: x,
1452
+ location: h,
1453
+ engine: E
1454
+ }
1455
+ }), d(), b({
1456
+ loadingLocation: !1
1457
+ });
1458
+ } catch {
1459
+ }
1460
+ }, D = async () => {
1461
+ b({
1462
+ loadingLocation: !0
1463
+ }), T("...");
1464
+ try {
1465
+ const k = Date.now(), R = await ht(), Q = await se({
1466
+ accessToken: await o(),
1467
+ type: le.GET_LOCATION,
1468
+ params: {
1469
+ latitude: R.latitude,
1470
+ longitude: R.longitude
1471
+ }
1472
+ }), K = Date.now() - k;
1473
+ if (K < 2e3 && await new Promise((U) => setTimeout(U, 2e3 - K)), Q.status === 200) {
1474
+ const { city: U, state: M, country: J, displayName: Z } = Q.data, Y = U && M && J ? `${U}, ${M}, ${J}` : Z;
1475
+ b({
1476
+ loadingLocation: !1
1477
+ }), T(Y);
1478
+ } else
1479
+ b({
1480
+ loadingLocation: !1
1481
+ });
1482
+ } catch {
1483
+ }
1484
+ }, L = (k, R) => {
1485
+ g(k ? R : R === W ? ee : W);
1486
+ }, _ = () => {
1487
+ f(!u);
1488
+ }, ie = () => {
1489
+ d({ ...r }), a(!1);
1490
+ };
1491
+ return H(() => {
1492
+ r != null && r.instructions && l(r.instructions), r != null && r.location && T(r.location), r != null && r.engine && g(r.engine);
1493
+ }, [r]), c || s ? null : /* @__PURE__ */ e(
1494
+ ce,
1495
+ {
1496
+ open: t,
1497
+ onOpenChange: ie,
1498
+ title: ut,
1499
+ footer: /* @__PURE__ */ i(
1500
+ q,
1501
+ {
1502
+ columnGap: 2,
1503
+ alignHorizontal: "flex-end",
1504
+ className: "pb-8 sm:pb-0",
1505
+ children: [
1506
+ /* @__PURE__ */ e(O, { children: /* @__PURE__ */ e(
1507
+ X,
1508
+ {
1509
+ mode: "dark",
1510
+ variant: "secondary",
1511
+ focusMode: "light",
1512
+ onClick: ie,
1513
+ children: "Cancel"
1514
+ }
1515
+ ) }),
1516
+ /* @__PURE__ */ e(O, { children: /* @__PURE__ */ e(
1517
+ X,
1518
+ {
1519
+ mode: "dark",
1520
+ variant: "danger",
1521
+ focusMode: "light",
1522
+ onClick: async (k) => {
1523
+ a(!1), await I(k);
1524
+ },
1525
+ children: "Save"
1526
+ }
1527
+ ) })
1528
+ ]
1529
+ }
1530
+ ),
1531
+ children: /* @__PURE__ */ i(z, { children: [
1532
+ u && /* @__PURE__ */ e(Tr, { open: u, onOpenChange: f }),
1533
+ /* @__PURE__ */ i(
1534
+ B,
1535
+ {
1536
+ header: N.SETTINGS_ENGINE.TITLE,
1537
+ className: "prose-dark dark:prose-lighter",
1538
+ children: [
1539
+ /* @__PURE__ */ e("p", { className: "text-sm", children: "Select the AI engine that will be used to generate responses." }),
1540
+ /* @__PURE__ */ e(
1541
+ ae,
1542
+ {
1543
+ noBorder: !0,
1544
+ label: W,
1545
+ name: W,
1546
+ onChange: (k) => L(k, W),
1547
+ checked: E === W
1548
+ }
1549
+ ),
1550
+ /* @__PURE__ */ e(
1551
+ ae,
1552
+ {
1553
+ className: "mt-2",
1554
+ noBorder: !0,
1555
+ label: ee,
1556
+ name: ee,
1557
+ onChange: (k) => L(k, ee),
1558
+ checked: E === ee
1559
+ }
1560
+ ),
1561
+ /* @__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.' }),
1562
+ /* @__PURE__ */ e(
1563
+ ae,
1564
+ {
1565
+ className: "mt-2",
1566
+ noBorder: !0,
1567
+ label: "Show Message Statistics",
1568
+ name: "show-message-statistics",
1569
+ onChange: w,
1570
+ checked: A
1571
+ }
1572
+ ),
1573
+ /* @__PURE__ */ e("h3", { className: "border-b-2 border-slate-400", children: "Prompts" }),
1574
+ /* @__PURE__ */ e(
1575
+ oe,
1576
+ {
1577
+ className: "mt-2",
1578
+ size: "small",
1579
+ onClick: _,
1580
+ labelLeft: "Edit Custom Prompts",
1581
+ children: /* @__PURE__ */ e(Nt, { size: "size-3", monotone: !0 })
1582
+ }
1583
+ )
1584
+ ]
1585
+ }
1586
+ ),
1587
+ /* @__PURE__ */ i(
1588
+ B,
1589
+ {
1590
+ header: "Custom Instructions",
1591
+ className: "prose-dark dark:prose-lighter mt-4",
1592
+ children: [
1593
+ /* @__PURE__ */ i("p", { className: "text-sm", children: [
1594
+ "What would you like ",
1595
+ /* @__PURE__ */ e("em", { children: mt }),
1596
+ " to know about you to provide better responses?"
1597
+ ] }),
1598
+ /* @__PURE__ */ e(
1599
+ xe,
1600
+ {
1601
+ mode: "alt-system",
1602
+ autoCapitalize: "off",
1603
+ autoComplete: "off",
1604
+ autoCorrect: "off",
1605
+ name: "customInstructions",
1606
+ label: "Custom Instructions",
1607
+ value: x,
1608
+ onChange: (k) => {
1609
+ l(k.target.value);
1610
+ },
1611
+ helperText: "Press ENTER to add a new line."
1612
+ }
1613
+ )
1614
+ ]
1615
+ }
1616
+ ),
1617
+ /* @__PURE__ */ i(
1618
+ B,
1619
+ {
1620
+ header: "Location",
1621
+ className: "prose-dark dark:prose-lighter mt-4",
1622
+ children: [
1623
+ /* @__PURE__ */ e("p", { className: "text-sm", children: "You can share your location to receive customized responses based on your area." }),
1624
+ /* @__PURE__ */ e(
1625
+ xe,
1626
+ {
1627
+ mode: "alt-system",
1628
+ name: "location",
1629
+ label: "Location",
1630
+ value: h,
1631
+ onChange: (k) => {
1632
+ T(k.target.value);
1633
+ },
1634
+ helperText: "Enter your location or press auto-detect."
1635
+ }
1636
+ ),
1637
+ /* @__PURE__ */ e(
1638
+ X,
1639
+ {
1640
+ className: "mt-2",
1641
+ size: "small",
1642
+ noBorder: !0,
1643
+ disabled: p.loadingLocation,
1644
+ onClick: D,
1645
+ children: p.loadingLocation ? "Detecting..." : "Auto-detect"
1646
+ }
1647
+ )
1648
+ ]
1649
+ }
1650
+ )
1651
+ ] })
1652
+ }
1653
+ );
1654
+ }, _r = () => {
1655
+ const { logout: t } = F(), { state: a } = he(Oe), [o, n] = C(!1), [r, c] = C(!1), [s, d] = C(!1), [u, f] = C(!1), [p, b] = C(!1), x = () => {
1656
+ n(!o);
1657
+ }, l = () => {
1658
+ c(!r);
1659
+ }, h = () => {
1660
+ d(!s);
1661
+ }, T = () => {
1662
+ f(!u);
1663
+ }, E = () => {
1664
+ b(!p);
1665
+ };
1666
+ return /* @__PURE__ */ i(z, { children: [
1667
+ /* @__PURE__ */ e(
1668
+ Pe,
1669
+ {
1670
+ showConfirmation: p,
1671
+ setShowConfirmation: b,
1672
+ action: t,
1673
+ customStrings: {
1674
+ confirmAction: _e,
1675
+ cancelAction: "Cancel",
1676
+ title: _e
1677
+ },
1678
+ children: /* @__PURE__ */ e("p", { children: "Are you sure you want to log out?" })
1679
+ }
1680
+ ),
1681
+ /* @__PURE__ */ e(jt, { open: o, onOpenChange: n }),
1682
+ /* @__PURE__ */ e(Nr, { open: r, onOpenChange: c }),
1683
+ s && /* @__PURE__ */ e(Ut, { open: s, onOpenChange: d }),
1684
+ /* @__PURE__ */ e(Vt, { open: u, onOpenChange: f }),
1685
+ /* @__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(O, { children: /* @__PURE__ */ e(q, { children: /* @__PURE__ */ e(O, { children: /* @__PURE__ */ e(
1686
+ wt,
1687
+ {
1688
+ label: "Profile, Settings, etc.",
1689
+ mode: "light",
1690
+ placement: "left",
1691
+ trigger: /* @__PURE__ */ i(
1692
+ St,
1693
+ {
1694
+ mode: "dark",
1695
+ focusMode: "light",
1696
+ trigger: /* @__PURE__ */ e(oe, { label: "Settings", children: /* @__PURE__ */ e(Ht, {}) }),
1697
+ defaultPlacement: "bottom-end",
1698
+ children: [
1699
+ /* @__PURE__ */ e(
1700
+ re,
1701
+ {
1702
+ label: "Profile",
1703
+ onClick: x,
1704
+ icon: /* @__PURE__ */ e(zt, {})
1705
+ }
1706
+ ),
1707
+ /* @__PURE__ */ e(
1708
+ re,
1709
+ {
1710
+ label: "Settings",
1711
+ onClick: l,
1712
+ icon: /* @__PURE__ */ e(Dt, {})
1713
+ }
1714
+ ),
1715
+ /* @__PURE__ */ e(
1716
+ re,
1717
+ {
1718
+ label: "History",
1719
+ onClick: h,
1720
+ icon: /* @__PURE__ */ e(Pt, {})
1721
+ }
1722
+ ),
1723
+ /* @__PURE__ */ e(
1724
+ re,
1725
+ {
1726
+ label: "About",
1727
+ onClick: T,
1728
+ icon: /* @__PURE__ */ e(Ot, {})
1729
+ }
1730
+ ),
1731
+ a && a.id && !a.isComponent && /* @__PURE__ */ i(z, { children: [
1732
+ /* @__PURE__ */ e(vt, {}),
1733
+ /* @__PURE__ */ e(
1734
+ re,
1735
+ {
1736
+ label: "Log out",
1737
+ onClick: E,
1738
+ icon: /* @__PURE__ */ e("div", { className: "text-red-700", children: /* @__PURE__ */ e(Lt, { monotone: !0 }) })
1739
+ }
1740
+ )
1741
+ ] })
1742
+ ]
1743
+ }
1744
+ )
1745
+ }
1746
+ ) }) }) }) }) })
1747
+ ] });
1748
+ };
1749
+ export {
1750
+ _r as default
1751
+ };