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