@versini/sassysaint 5.0.1 → 5.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1983 @@
1
+ import { jsxs as m, jsx as o, Fragment as S } from "react/jsx-runtime";
2
+ import { g as _, D as I, CARDS as v, renderDataAsList as X, pluralize as oe, ABOUT_TITLE as Xe, MODEL_GPT4 as Ze, numberFormatter as Je, durationFormatter as _e, NA as qe, ROLE_ASSISTANT as Qe, extractAverage as et, GPT4_MAX_TOKENS as tt, rn as $, STATS as Ae, b as me, j as U, R as z, LOCAL_STORAGE_PREFIX as P, LOCAL_STORAGE_SORT as at, O as V, ACTION_RESET as ot, ACTION_RESTORE as rt, truncate as nt, ACTION_SORT as ie, LOCAL_STORAGE_SEARCH as it, ye as st, ACTION_SEARCH as ct, HISTORY_TITLE as lt, getCurrentGeoLocation as dt, LOCAL_STORAGE_TAG_SUMMARIZE as fe, LOCAL_STORAGE_TAG_PROOFREAD as be, LOCAL_STORAGE_TAG_REPHRASE as ve, TAG_CONTENT as se, TAGS as ce, LOCAL_STORAGE_CHAT_DETAILS as ut, G as mt, v as ye, PROFILE_TITLE as ht, LOG_OUT as ke } from "./index.BuZgDoDD.js";
3
+ import * as de from "react";
4
+ import re, { forwardRef as Re, useState as C, useRef as Z, useContext as B, useEffect as O, Suspense as gt, lazy as pt, useId as ft, useMemo as bt } from "react";
5
+ import { AppContext as ne, serviceCall as M, SERVICE_TYPES as L, HistoryContext as Me, E as F, f as x, ce as vt, ge as yt, me as le, ie as R, ue as kt, be as Tt, he as Ct, we as Te } from "./index.lZ9DXn26.js";
6
+ import f from "clsx";
7
+ import { useFloatingTree as Le, useFloatingNodeId as Nt, useListItem as Be, useFloating as wt, offset as Et, flip as St, shift as xt, autoUpdate as It, useClick as _t, useRole as At, useDismiss as Rt, useListNavigation as Mt, useTypeahead as Lt, useInteractions as Bt, useMergeRefs as Oe, FloatingNode as Ot, FloatingList as Ht, FloatingPortal as Dt, FloatingFocusManager as zt, FloatingTree as Pt } from "@floating-ui/react";
8
+ const Vt = ({
9
+ className: e,
10
+ viewBox: t,
11
+ spacing: a,
12
+ title: r,
13
+ monotone: n,
14
+ ...i
15
+ }) => /* @__PURE__ */ m(
16
+ _,
17
+ {
18
+ defaultViewBox: "0 0 512 512",
19
+ defaultClassName: "size-5",
20
+ viewBox: t,
21
+ className: e,
22
+ spacing: a,
23
+ title: r || "Back",
24
+ ...i,
25
+ children: [
26
+ /* @__PURE__ */ o(
27
+ "path",
28
+ {
29
+ opacity: n ? "1" : "0.4",
30
+ d: "M288.4 93.4c2.9-17.4 19.4-29.2 36.9-26.3C431.3 84.9 512 177 512 288c0 123.7-100.3 224-224 224C177 512 84.9 431.3 67.1 325.3c-2.9-17.4 8.8-33.9 26.3-36.9s33.9 8.8 36.9 26.3C142.9 390.4 208.8 448 288 448c88.4 0 160-71.6 160-160c0-79.2-57.6-145.1-133.3-157.8c-17.4-2.9-29.2-19.4-26.3-36.9z"
31
+ }
32
+ ),
33
+ /* @__PURE__ */ o("path", { d: "M32 0H192c17.7 0 32 14.3 32 32s-14.3 32-32 32H109.3L342.6 297.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 32s-32-14.3-32-32V32C0 14.3 14.3 0 32 0z" })
34
+ ]
35
+ }
36
+ ), Ft = ({
37
+ className: e,
38
+ viewBox: t,
39
+ spacing: a,
40
+ title: r,
41
+ monotone: n,
42
+ ...i
43
+ }) => /* @__PURE__ */ m(
44
+ _,
45
+ {
46
+ defaultViewBox: "0 0 448 512",
47
+ defaultClassName: "size-5",
48
+ viewBox: t,
49
+ className: e,
50
+ spacing: a,
51
+ title: r || "Chart",
52
+ ...i,
53
+ children: [
54
+ /* @__PURE__ */ o(
55
+ "path",
56
+ {
57
+ opacity: n ? "1" : "0.4",
58
+ d: "M160 80c0-26.5 21.5-48 48-48h32c26.5 0 48 21.5 48 48V432c0 26.5-21.5 48-48 48H208c-26.5 0-48-21.5-48-48V80z"
59
+ }
60
+ ),
61
+ /* @__PURE__ */ o("path", { d: "M368 96c-26.5 0-48 21.5-48 48V432c0 26.5 21.5 48 48 48h32c26.5 0 48-21.5 48-48V144c0-26.5-21.5-48-48-48H368zM48 224c-26.5 0-48 21.5-48 48V432c0 26.5 21.5 48 48 48H80c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48H48z" })
62
+ ]
63
+ }
64
+ ), Ut = ({
65
+ className: e,
66
+ viewBox: t,
67
+ spacing: a,
68
+ title: r,
69
+ monotone: n,
70
+ ...i
71
+ }) => /* @__PURE__ */ m(
72
+ _,
73
+ {
74
+ defaultViewBox: "0 0 448 512",
75
+ defaultClassName: "size-5",
76
+ viewBox: t,
77
+ className: e,
78
+ spacing: a,
79
+ title: r || "Delete",
80
+ ...i,
81
+ children: [
82
+ /* @__PURE__ */ o(
83
+ "path",
84
+ {
85
+ opacity: n ? "1" : "0.4",
86
+ d: "M416 96H32V448c0 35.3 28.7 64 64 64H352c35.3 0 64-28.7 64-64V96zM144 176V400c0 8.8-7.2 16-16 16s-16-7.2-16-16V176c0-8.8 7.2-16 16-16s16 7.2 16 16zm96 0V400c0 8.8-7.2 16-16 16s-16-7.2-16-16V176c0-8.8 7.2-16 16-16s16 7.2 16 16zm96 0V400c0 8.8-7.2 16-16 16s-16-7.2-16-16V176c0-8.8 7.2-16 16-16s16 7.2 16 16z"
87
+ }
88
+ ),
89
+ /* @__PURE__ */ o("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 96 32 96H416c17.7 0 32-14.3 32-32s-14.3-32-32-32H320l-7.2-14.3C307.4 6.8 296.3 0 284.2 0H163.8z" })
90
+ ]
91
+ }
92
+ ), Ce = ({
93
+ className: e,
94
+ viewBox: t,
95
+ spacing: a,
96
+ title: r,
97
+ monotone: n,
98
+ ...i
99
+ }) => /* @__PURE__ */ m(
100
+ _,
101
+ {
102
+ defaultViewBox: "0 0 512 512",
103
+ defaultClassName: "size-5",
104
+ viewBox: t,
105
+ className: e,
106
+ spacing: a,
107
+ title: r || "Edit",
108
+ ...i,
109
+ children: [
110
+ /* @__PURE__ */ o(
111
+ "path",
112
+ {
113
+ opacity: n ? "1" : "0.4",
114
+ d: "M0 160c0-53 43-96 96-96h96c17.7 0 32 14.3 32 32s-14.3 32-32 32H96c-17.7 0-32 14.3-32 32V416c0 17.7 14.3 32 32 32H352c17.7 0 32-14.3 32-32V320c0-17.7 14.3-32 32-32s32 14.3 32 32v96c0 53-43 96-96 96H96c-53 0-96-43-96-96V160z"
115
+ }
116
+ ),
117
+ /* @__PURE__ */ o("path", { d: "M392.4 21.7L362.3 51.7l97.9 97.9 30.1-30.1c21.9-21.9 21.9-57.3 0-79.2L471.6 21.7c-21.9-21.9-57.3-21.9-79.2 0zM339.7 74.3L172.4 241.7c-6.1 6.1-10.8 13.6-13.5 21.9l-29.6 88.8c-2.9 8.6-.6 18.1 5.8 24.6s15.9 8.7 24.6 5.8l88.8-29.6c8.2-2.7 15.7-7.4 21.9-13.5L437.7 172.3 339.7 74.3z" })
118
+ ]
119
+ }
120
+ ), $t = ({
121
+ className: e,
122
+ viewBox: t,
123
+ spacing: a,
124
+ title: r,
125
+ monotone: n,
126
+ ...i
127
+ }) => /* @__PURE__ */ m(
128
+ _,
129
+ {
130
+ defaultViewBox: "0 0 512 512",
131
+ defaultClassName: "size-5",
132
+ viewBox: t,
133
+ className: e,
134
+ spacing: a,
135
+ title: r || "History",
136
+ ...i,
137
+ children: [
138
+ /* @__PURE__ */ o(
139
+ "path",
140
+ {
141
+ opacity: n ? "1" : "0.4",
142
+ d: "M120.2 120.2C155 85.5 203 64 256 64c106 0 192 86 192 192s-86 192-192 192c-40.8 0-78.6-12.7-109.7-34.4c-14.5-10.1-34.4-6.6-44.6 7.9s-6.6 34.4 7.9 44.6C151.2 495 201.7 512 256 512c141.4 0 256-114.6 256-256S397.4 0 256 0C185.3 0 121.3 28.7 75 75L41 41C25.9 25.9 0 36.6 0 57.9V168c0 13.3 10.7 24 24 24H134.1c21.4 0 32.1-25.9 17-41l-30.8-30.8z"
143
+ }
144
+ ),
145
+ /* @__PURE__ */ o("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" })
146
+ ]
147
+ }
148
+ ), Gt = ({
149
+ className: e,
150
+ viewBox: t,
151
+ spacing: a,
152
+ title: r,
153
+ monotone: n,
154
+ ...i
155
+ }) => /* @__PURE__ */ m(
156
+ _,
157
+ {
158
+ defaultViewBox: "0 0 512 512",
159
+ defaultClassName: "size-5",
160
+ viewBox: t,
161
+ className: e,
162
+ spacing: a,
163
+ title: r || "Info",
164
+ ...i,
165
+ children: [
166
+ /* @__PURE__ */ o(
167
+ "path",
168
+ {
169
+ opacity: "0.4",
170
+ d: "M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"
171
+ }
172
+ ),
173
+ /* @__PURE__ */ o("path", { d: "M256 128a32 32 0 1 1 0 64 32 32 0 1 1 0-64zM192 248c0-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 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h24V272H216c-13.3 0-24-10.7-24-24z" })
174
+ ]
175
+ }
176
+ ), jt = ({
177
+ className: e,
178
+ viewBox: t,
179
+ spacing: a,
180
+ title: r,
181
+ monotone: n,
182
+ ...i
183
+ }) => /* @__PURE__ */ m(
184
+ _,
185
+ {
186
+ defaultViewBox: "0 0 576 512",
187
+ defaultClassName: "size-5",
188
+ viewBox: t,
189
+ className: e,
190
+ spacing: a,
191
+ title: r || "Profile",
192
+ ...i,
193
+ children: [
194
+ /* @__PURE__ */ o(
195
+ "path",
196
+ {
197
+ opacity: "0.4",
198
+ d: "M64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H512c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zm80 256h64c44.2 0 80 35.8 80 80c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16c0-44.2 35.8-80 80-80zm-32-96a64 64 0 1 1 128 0 64 64 0 1 1 -128 0zm256-32H496c8.8 0 16 7.2 16 16s-7.2 16-16 16H368c-8.8 0-16-7.2-16-16s7.2-16 16-16zm0 64H496c8.8 0 16 7.2 16 16s-7.2 16-16 16H368c-8.8 0-16-7.2-16-16s7.2-16 16-16zm0 64H496c8.8 0 16 7.2 16 16s-7.2 16-16 16H368c-8.8 0-16-7.2-16-16s7.2-16 16-16z"
199
+ }
200
+ ),
201
+ /* @__PURE__ */ o("path", { d: "M176 256a64 64 0 1 0 0-128 64 64 0 1 0 0 128zm-32 32c-44.2 0-80 35.8-80 80c0 8.8 7.2 16 16 16H272c8.8 0 16-7.2 16-16c0-44.2-35.8-80-80-80H144z" })
202
+ ]
203
+ }
204
+ ), Wt = ({
205
+ className: e,
206
+ viewBox: t,
207
+ spacing: a,
208
+ title: r,
209
+ monotone: n,
210
+ ...i
211
+ }) => /* @__PURE__ */ m(
212
+ _,
213
+ {
214
+ defaultViewBox: "0 0 512 512",
215
+ defaultClassName: "size-5",
216
+ viewBox: t,
217
+ className: e,
218
+ spacing: a,
219
+ title: r || "Restore",
220
+ ...i,
221
+ children: [
222
+ /* @__PURE__ */ o(
223
+ "path",
224
+ {
225
+ opacity: n ? "1" : "0.4",
226
+ d: "M208 64H432c8.8 0 16 7.2 16 16V304c0 8.8-7.2 16-16 16H416v64h16c44.2 0 80-35.8 80-80V80c0-44.2-35.8-80-80-80H208c-44.2 0-80 35.8-80 80V96h64V80c0-8.8 7.2-16 16-16z"
227
+ }
228
+ ),
229
+ /* @__PURE__ */ o("path", { d: "M64 128c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H320c35.3 0 64-28.7 64-64V192c0-35.3-28.7-64-64-64H64zm32 64H288c17.7 0 32 14.3 32 32s-14.3 32-32 32H96c-17.7 0-32-14.3-32-32s14.3-32 32-32z" })
230
+ ]
231
+ }
232
+ ), Yt = ({
233
+ className: e,
234
+ viewBox: t,
235
+ spacing: a,
236
+ title: r,
237
+ monotone: n,
238
+ ...i
239
+ }) => /* @__PURE__ */ o(
240
+ _,
241
+ {
242
+ defaultViewBox: "0 0 448 512",
243
+ defaultClassName: "size-5",
244
+ viewBox: t,
245
+ className: e,
246
+ spacing: a,
247
+ title: r || "Settings",
248
+ ...i,
249
+ children: /* @__PURE__ */ o("path", { d: "M8 256a56 56 0 1 1 112 0A56 56 0 1 1 8 256zm160 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm216-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z" })
250
+ }
251
+ ), ue = de.createContext({
252
+ getItemProps: () => ({}),
253
+ activeIndex: null,
254
+ /* v8 ignore next 2 */
255
+ setActiveIndex: () => {
256
+ },
257
+ setHasFocusInside: () => {
258
+ },
259
+ isOpen: !1
260
+ }), Ne = (e) => {
261
+ if (typeof e == "string")
262
+ return e;
263
+ if (typeof e == "function")
264
+ return e.displayName || e.name || "Component";
265
+ if (typeof e == "object" && e !== null && "type" in e) {
266
+ const t = e.type;
267
+ if (typeof t == "function" || typeof t == "object")
268
+ return t.displayName || t.name || "Component";
269
+ }
270
+ return "Element";
271
+ }, He = Re(
272
+ ({
273
+ trigger: e,
274
+ children: t,
275
+ label: a = "Open menu",
276
+ defaultPlacement: r = "bottom-start",
277
+ onOpenChange: n,
278
+ spacing: i,
279
+ mode: c = "system",
280
+ focusMode: l = "system",
281
+ ...s
282
+ }, d) => {
283
+ const [u, p] = C(!1), [y, h] = C(!1), [g, k] = C(null), w = Z([]), b = Z([]), T = B(ue), N = Le(), E = Nt(), G = Be(), { floatingStyles: j, refs: Q, context: A } = wt({
284
+ nodeId: E,
285
+ open: u,
286
+ onOpenChange: (Y) => {
287
+ p(Y), n == null || n(Y);
288
+ },
289
+ placement: r,
290
+ strategy: "fixed",
291
+ middleware: [Et({ mainAxis: 10 }), St(), xt()],
292
+ whileElementsMounted: It
293
+ }), ee = _t(A, {
294
+ event: "mousedown",
295
+ toggle: !0,
296
+ ignoreMouse: !1
297
+ }), W = At(A, { role: "menu" }), Fe = Rt(A, { bubbles: !0 }), Ue = Mt(A, {
298
+ listRef: w,
299
+ activeIndex: g,
300
+ nested: !1,
301
+ onNavigate: k,
302
+ loop: !0
303
+ }), $e = Lt(A, {
304
+ listRef: b,
305
+ onMatch: u ? k : void 0,
306
+ activeIndex: g
307
+ }), { getReferenceProps: Ge, getFloatingProps: je, getItemProps: We } = Bt([ee, W, Fe, Ue, $e]), pe = Ne(e) === "Button" || Ne(e) === "ButtonIcon", Ye = pe ? {
308
+ noInternalClick: pe,
309
+ focusMode: l,
310
+ mode: c,
311
+ spacing: i
312
+ } : {}, Ke = re.cloneElement(e, {
313
+ ...Ye,
314
+ "aria-label": a,
315
+ "data-open": u ? "" : void 0,
316
+ "data-focus-inside": y ? "" : void 0,
317
+ ref: Oe([Q.setReference, G.ref, d]),
318
+ ...Ge(
319
+ T.getItemProps({
320
+ ...s
321
+ })
322
+ )
323
+ });
324
+ return O(() => {
325
+ if (!N)
326
+ return;
327
+ function Y() {
328
+ p(!1), n == null || n(!1);
329
+ }
330
+ return N.events.on("click", Y), () => {
331
+ N.events.off("click", Y);
332
+ };
333
+ }, [N, n]), O(() => {
334
+ u && N && N.events.emit("menuopen", { nodeId: E });
335
+ }, [N, u, E]), /* @__PURE__ */ m(Ot, { id: E, children: [
336
+ Ke,
337
+ /* @__PURE__ */ o(
338
+ ue.Provider,
339
+ {
340
+ value: {
341
+ activeIndex: g,
342
+ setActiveIndex: k,
343
+ getItemProps: We,
344
+ setHasFocusInside: h,
345
+ isOpen: u
346
+ },
347
+ children: /* @__PURE__ */ o(Ht, { elementsRef: w, labelsRef: b, children: u && /* @__PURE__ */ o(Dt, { children: /* @__PURE__ */ o(
348
+ zt,
349
+ {
350
+ context: A,
351
+ modal: !1,
352
+ initialFocus: 0,
353
+ returnFocus: !0,
354
+ children: /* @__PURE__ */ o(
355
+ "div",
356
+ {
357
+ ref: Q.setFloating,
358
+ className: "rounded-md bg-surface-light p-4 shadow-sm shadow-border-dark outline-none sm:p-2",
359
+ style: j,
360
+ ...je(),
361
+ children: t
362
+ }
363
+ )
364
+ }
365
+ ) }) })
366
+ }
367
+ )
368
+ ] });
369
+ }
370
+ ), De = Re((e, t) => /* @__PURE__ */ o(Pt, { children: /* @__PURE__ */ o(He, { ...e, ref: t }) }));
371
+ De.displayName = "Menu";
372
+ He.displayName = "MenuComponent";
373
+ const D = de.forwardRef(({ label: e, disabled: t, icon: a, ...r }, n) => {
374
+ const i = de.useContext(ue), c = Be({ label: t ? null : e }), l = Le();
375
+ return /* @__PURE__ */ m(
376
+ "button",
377
+ {
378
+ ...r,
379
+ ref: Oe([c.ref, n]),
380
+ role: "menuitem",
381
+ className: "m-0 flex w-full rounded-md border border-transparent bg-none px-3 py-2 text-left text-base outline-none focus:border focus:border-border-medium focus:bg-surface-lighter focus:underline disabled:cursor-not-allowed disabled:text-copy-medium sm:py-1",
382
+ tabIndex: 0,
383
+ disabled: t,
384
+ ...i.getItemProps({
385
+ onClick(s) {
386
+ var d;
387
+ (d = r.onClick) == null || d.call(r, s), l == null || l.events.emit("click");
388
+ },
389
+ onFocus(s) {
390
+ var d;
391
+ (d = r.onFocus) == null || d.call(r, s), i.setHasFocusInside(!0);
392
+ }
393
+ }),
394
+ children: [
395
+ a,
396
+ e && /* @__PURE__ */ o("span", { className: "pl-2", children: e })
397
+ ]
398
+ }
399
+ );
400
+ });
401
+ D.displayName = "MenuItem";
402
+ const Kt = ({ className: e, ...t }) => {
403
+ const a = f(e, "my-1 border-t border-border-medium");
404
+ return /* @__PURE__ */ o("div", { className: a, ...t });
405
+ };
406
+ /*!
407
+ @versini/ui-menu v1.0.11
408
+ © 2024 gizmette.com
409
+ */
410
+ try {
411
+ window.__VERSINI_UI_MENU__ || (window.__VERSINI_UI_MENU__ = {
412
+ version: "1.0.11",
413
+ buildTime: "09/28/2024 06:57 PM EDT",
414
+ homepage: "https://github.com/aversini/ui-components",
415
+ license: "MIT"
416
+ });
417
+ } catch {
418
+ }
419
+ /*!
420
+ @versini/ui-panel v1.0.10
421
+ © 2024 gizmette.com
422
+ */
423
+ try {
424
+ window.__VERSINI_UI_PANEL__ || (window.__VERSINI_UI_PANEL__ = {
425
+ version: "1.0.10",
426
+ buildTime: "09/28/2024 06:29 PM EDT",
427
+ homepage: "https://github.com/aversini/ui-components",
428
+ license: "MIT"
429
+ });
430
+ } catch {
431
+ }
432
+ const we = "av-messagebox", Ee = "av-panel", Se = "av-button", Xt = (e) => {
433
+ let t = "";
434
+ if (typeof e == "number" || typeof e == "string")
435
+ t = "m-" + e;
436
+ else {
437
+ const a = [];
438
+ (e == null ? void 0 : e.t) !== void 0 && a.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && a.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && a.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && a.push(`ml-${e.l}`), t = a.join(" ");
439
+ }
440
+ return t;
441
+ }, he = "icon", Zt = "button", Jt = "link", qt = ({
442
+ type: e,
443
+ size: t,
444
+ labelRight: a,
445
+ labelLeft: r,
446
+ align: n
447
+ }) => {
448
+ const i = "text-sm font-medium max-h-8 py-0", c = "text-base font-medium max-h-9 py-1", l = "text-lg font-medium max-h-12 py-2";
449
+ switch (e) {
450
+ case Zt:
451
+ return f("px-4", {
452
+ [i]: t === "small",
453
+ [c]: t === "medium",
454
+ [l]: t === "large"
455
+ });
456
+ case Jt:
457
+ return f("px-4 text-center", {
458
+ [i]: t === "small",
459
+ [c]: t === "medium",
460
+ [l]: t === "large"
461
+ });
462
+ case he:
463
+ return f("inline-flex items-center", {
464
+ "justify-center": n === "center",
465
+ "justify-start": n === "left",
466
+ "justify-end": n === "right",
467
+ "h-6 w-6 p-0": t === "small" && !(a || r),
468
+ "h-6 px-4 text-sm font-medium": t === "small" && (a || r),
469
+ "h-8 w-8 p-1": t === "medium" && !(a || r),
470
+ "h-8 px-4 text-base font-medium": t === "medium" && (a || r),
471
+ "h-12 w-12 p-2": t === "large" && !(a || r),
472
+ "h-12 px-4 text-lg font-medium": t === "large" && (a || r)
473
+ });
474
+ }
475
+ }, Qt = ({
476
+ mode: e,
477
+ noBackground: t,
478
+ noTruncate: a,
479
+ variant: r
480
+ }) => {
481
+ if (t)
482
+ return "not-prose rounded-full";
483
+ if (r === "primary")
484
+ return f("not-prose rounded-full", {
485
+ truncate: !a,
486
+ "bg-action-dark text-copy-light": e === "dark",
487
+ "bg-action-light text-copy-lighter": e === "light",
488
+ "bg-action-dark text-copy-light dark:bg-action-light dark:text-copy-lighter": e === "system",
489
+ "bg-action-light text-copy-lighter dark:bg-action-dark dark:text-copy-light": e === "alt-system"
490
+ });
491
+ if (r === "secondary")
492
+ return f("not-prose rounded-full", {
493
+ truncate: !a,
494
+ "bg-action-dark text-copy-light": e === "light",
495
+ "bg-action-light text-copy-lighter": e === "dark",
496
+ "bg-action-dark text-copy-light dark:bg-action-light dark:text-copy-lighter": e === "alt-system",
497
+ "bg-action-light text-copy-lighter dark:bg-action-dark dark:text-copy-light": e === "system"
498
+ });
499
+ if (r === "danger")
500
+ return f("not-prose rounded-full", {
501
+ truncate: !a,
502
+ "bg-action-danger-dark text-copy-light": e === "dark",
503
+ "bg-action-danger-light text-copy-lighter": e === "light",
504
+ "bg-action-danger-dark text-copy-light dark:bg-action-danger-light dark:text-copy-lighter": e === "system",
505
+ "bg-action-danger-light text-copy-lighter dark:bg-action-danger-dark dark:text-copy-light": e === "alt-system"
506
+ });
507
+ }, ea = ({
508
+ mode: e,
509
+ disabled: t,
510
+ variant: a
511
+ }) => {
512
+ if (t)
513
+ return "";
514
+ if (a === "primary")
515
+ return f("hover:text-copy-light-hover", {
516
+ "hover:bg-action-dark-hover": e === "dark",
517
+ "hover:bg-action-light-hover": e === "light",
518
+ "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "system",
519
+ "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "alt-system"
520
+ });
521
+ if (a === "secondary")
522
+ return f("hover:text-copy-light-hover", {
523
+ "hover:bg-action-dark-hover": e === "light",
524
+ "hover:bg-action-light-hover": e === "dark",
525
+ "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "alt-system",
526
+ "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "system"
527
+ });
528
+ if (a === "danger")
529
+ return f("hover:text-copy-light-hover", {
530
+ "hover:bg-action-danger-dark-hover": e === "dark",
531
+ "hover:bg-action-danger-light-hover": e === "light",
532
+ "hover:bg-action-danger-dark-hover dark:hover:bg-action-danger-light-hover": e === "system",
533
+ "hover:bg-action-danger-light-hover dark:hover:bg-action-danger-dark-hover": e === "alt-system"
534
+ });
535
+ }, ta = ({
536
+ mode: e,
537
+ disabled: t,
538
+ variant: a
539
+ }) => {
540
+ if (t)
541
+ return "";
542
+ if (a === "primary")
543
+ return f("active:text-copy-light-active", {
544
+ "active:bg-action-dark-active": e === "dark",
545
+ "active:bg-action-light-active": e === "light",
546
+ "active:bg-action-dark-active dark:active:bg-action-light-active": e === "system",
547
+ "active:bg-action-light-active dark:active:bg-action-dark-active": e === "alt-system"
548
+ });
549
+ if (a === "secondary")
550
+ return f("active:text-copy-light-active", {
551
+ "active:bg-action-dark-active": e === "light",
552
+ "active:bg-action-light-active": e === "dark",
553
+ "active:bg-action-dark-active dark:active:bg-action-light-active": e === "alt-system",
554
+ "active:bg-action-light-active dark:active:bg-action-dark-active": e === "system"
555
+ });
556
+ if (a === "danger")
557
+ return f("active:text-copy-lighter-active", {
558
+ "active:bg-action-danger-dark-active": e === "dark",
559
+ "active:bg-action-danger-light-active": e === "light",
560
+ "active:bg-action-danger-dark-active dark:active:bg-action-danger-light-active": e === "system",
561
+ "active:bg-action-danger-light-active dark:active:bg-action-danger-dark-active": e === "alt-system"
562
+ });
563
+ }, aa = ({
564
+ mode: e,
565
+ noBorder: t,
566
+ variant: a
567
+ }) => {
568
+ if (t)
569
+ return "border border-transparent";
570
+ if (a === "primary")
571
+ return f("border", {
572
+ "border-border-dark": e === "dark",
573
+ "border-border-accent": e === "light",
574
+ "border-border-dark dark:border-border-accent": e === "system",
575
+ "border-border-accent dark:border-border-dark": e === "alt-system"
576
+ });
577
+ if (a === "secondary")
578
+ return f("border", {
579
+ "border-border-dark": e === "light",
580
+ "border-border-accent": e === "dark",
581
+ "border-border-dark dark:border-border-accent": e === "alt-system",
582
+ "border-border-accent dark:border-border-dark": e === "system"
583
+ });
584
+ if (a === "danger")
585
+ return f("border", {
586
+ "border-border-danger-dark": e === "dark",
587
+ "border-border-danger-medium": e === "light",
588
+ "border-border-danger-dark dark:border-border-danger-medium": e === "system",
589
+ "border-border-danger-medium dark:border-border-danger-dark": e === "alt-system"
590
+ });
591
+ }, oa = ({ focusMode: e }) => f("focus:outline", "focus:outline-2", "focus:outline-offset-2", {
592
+ "focus:outline-focus-dark": e === "dark",
593
+ "focus:outline-focus-light": e === "light",
594
+ "focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
595
+ "focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
596
+ }), ze = ({
597
+ type: e,
598
+ className: t,
599
+ raw: a,
600
+ mode: r,
601
+ focusMode: n,
602
+ disabled: i,
603
+ fullWidth: c,
604
+ size: l,
605
+ noBorder: s,
606
+ labelRight: d,
607
+ labelLeft: u,
608
+ spacing: p,
609
+ noBackground: y,
610
+ variant: h,
611
+ noTruncate: g,
612
+ align: k
613
+ }) => (h || (h = "primary"), a ? f(Se, t) : f(
614
+ Se,
615
+ t,
616
+ Xt(p),
617
+ Qt({ mode: r, variant: h, noBackground: y, noTruncate: g }),
618
+ qt({ type: e, size: l, labelRight: d, labelLeft: u, align: k }),
619
+ aa({ mode: r, variant: h, noBorder: s }),
620
+ oa({ focusMode: n }),
621
+ ea({ mode: r, variant: h, disabled: i }),
622
+ ta({ mode: r, variant: h, disabled: i }),
623
+ {
624
+ "w-full": c,
625
+ "disabled:cursor-not-allowed disabled:opacity-50": i
626
+ }
627
+ )), ra = (e, t, a) => {
628
+ var r;
629
+ !t && (!document.activeElement || document.activeElement !== e.currentTarget) && typeof ((r = e == null ? void 0 : e.currentTarget) == null ? void 0 : r.focus) == "function" && e.currentTarget.focus(), typeof a == "function" && a(e);
630
+ }, ge = re.forwardRef((e, t) => {
631
+ const { onClick: a, noInternalClick: r = !1, ...n } = e;
632
+ return /* @__PURE__ */ o(
633
+ "button",
634
+ {
635
+ ref: t,
636
+ onClick: (i) => {
637
+ ra(i, r, a);
638
+ },
639
+ ...n
640
+ }
641
+ );
642
+ });
643
+ ge.displayName = "BaseButton";
644
+ const Pe = re.forwardRef(
645
+ ({
646
+ children: e,
647
+ disabled: t = !1,
648
+ mode: a = "system",
649
+ focusMode: r = "system",
650
+ fullWidth: n = !1,
651
+ className: i,
652
+ type: c = "button",
653
+ raw: l = !1,
654
+ noBorder: s = !1,
655
+ "aria-label": d,
656
+ label: u,
657
+ size: p = "medium",
658
+ labelRight: y,
659
+ labelLeft: h,
660
+ spacing: g,
661
+ noBackground: k = !1,
662
+ align: w = "center",
663
+ ...b
664
+ }, T) => {
665
+ const N = ze({
666
+ type: he,
667
+ mode: a,
668
+ focusMode: r,
669
+ fullWidth: n,
670
+ disabled: t,
671
+ raw: l,
672
+ className: i,
673
+ noBorder: s,
674
+ size: p,
675
+ labelRight: y,
676
+ labelLeft: h,
677
+ spacing: g,
678
+ noBackground: k,
679
+ align: w
680
+ }), E = f({
681
+ "text-copy-accent-dark": a === "light" && !l,
682
+ "text-copy-light": a === "dark" && !l,
683
+ "text-copy-accent-dark dark:text-copy-light": a === "alt-system" && !l,
684
+ "text-copy-light dark:text-copy-accent-dark": a === "system" && !l
685
+ });
686
+ return /* @__PURE__ */ m(
687
+ ge,
688
+ {
689
+ ref: T,
690
+ className: N,
691
+ disabled: t,
692
+ type: c,
693
+ "aria-label": d || u,
694
+ ...b,
695
+ children: [
696
+ h && /* @__PURE__ */ o("span", { className: "pr-2", children: h }),
697
+ /* @__PURE__ */ o("div", { className: E, children: e }),
698
+ y && /* @__PURE__ */ o("span", { className: "pl-2", children: y })
699
+ ]
700
+ }
701
+ );
702
+ }
703
+ );
704
+ Pe.displayName = "ButtonIcon";
705
+ /*!
706
+ @versini/ui-button v1.1.10
707
+ © 2024 gizmette.com
708
+ */
709
+ try {
710
+ window.__VERSINI_UI_BUTTON__ || (window.__VERSINI_UI_BUTTON__ = {
711
+ version: "1.1.10",
712
+ buildTime: "09/28/2024 06:29 PM EDT",
713
+ homepage: "https://github.com/aversini/ui-components",
714
+ license: "MIT"
715
+ });
716
+ } catch {
717
+ }
718
+ const na = re.forwardRef(
719
+ ({
720
+ children: e,
721
+ disabled: t = !1,
722
+ mode: a = "system",
723
+ focusMode: r = "system",
724
+ fullWidth: n = !1,
725
+ className: i,
726
+ type: c = "button",
727
+ raw: l = !1,
728
+ noBorder: s = !1,
729
+ "aria-label": d,
730
+ label: u,
731
+ size: p = "medium",
732
+ labelRight: y,
733
+ labelLeft: h,
734
+ spacing: g,
735
+ noBackground: k = !1,
736
+ align: w = "center",
737
+ active: b = !1,
738
+ ...T
739
+ }, N) => {
740
+ const E = ze({
741
+ type: he,
742
+ mode: a,
743
+ focusMode: r,
744
+ fullWidth: n,
745
+ disabled: t,
746
+ raw: l,
747
+ className: i,
748
+ noBorder: s,
749
+ size: p,
750
+ labelRight: y,
751
+ labelLeft: h,
752
+ spacing: g,
753
+ noBackground: k,
754
+ align: w
755
+ }), G = f({
756
+ "text-copy-accent-dark": a === "light" && !l,
757
+ "text-copy-light": a === "dark" && !l,
758
+ "text-copy-accent-dark dark:text-copy-light": a === "alt-system" && !l,
759
+ "text-copy-light dark:text-copy-accent-dark": a === "system" && !l
760
+ }), j = b ? f(
761
+ "relative",
762
+ "focus-within:static",
763
+ "focus-within:after:border-transparent",
764
+ "after:absolute",
765
+ "after:content-['']",
766
+ "after:border-b-2",
767
+ "after:bottom-[-4px]",
768
+ "after:left-0",
769
+ "after:right-0",
770
+ {
771
+ "after:border-table-dark": a === "dark",
772
+ "after:border-table-light": a === "light",
773
+ "after:border-table-dark dark:after:border-table-light": a === "system",
774
+ "after:border-table-light dark:after:border-table-dark": a === "alt-system"
775
+ }
776
+ ) : "";
777
+ return /* @__PURE__ */ o("div", { className: j, children: /* @__PURE__ */ m(
778
+ ge,
779
+ {
780
+ ref: N,
781
+ className: E,
782
+ disabled: t,
783
+ type: c,
784
+ "aria-label": d || u,
785
+ ...T,
786
+ children: [
787
+ h && /* @__PURE__ */ o("span", { className: "pr-2", children: h }),
788
+ /* @__PURE__ */ o("div", { className: G, children: e }),
789
+ y && /* @__PURE__ */ o("span", { className: "pl-2", children: y })
790
+ ]
791
+ }
792
+ ) });
793
+ }
794
+ );
795
+ na.displayName = "ButtonSort";
796
+ const ia = (e) => {
797
+ let t = "";
798
+ if (typeof e == "number" || typeof e == "string")
799
+ t = "m-" + e;
800
+ else {
801
+ const a = [];
802
+ (e == null ? void 0 : e.t) !== void 0 && a.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && a.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && a.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && a.push(`ml-${e.l}`), t = a.join(" ");
803
+ }
804
+ return t;
805
+ }, sa = ({
806
+ children: e,
807
+ fill: t,
808
+ viewBox: a,
809
+ className: r,
810
+ defaultViewBox: n,
811
+ defaultClassName: i,
812
+ spacing: c,
813
+ title: l,
814
+ semantic: s = !1,
815
+ ...d
816
+ }) => {
817
+ const u = ia(c), p = f(
818
+ u,
819
+ r || i
820
+ );
821
+ return /* @__PURE__ */ m(S, { children: [
822
+ /* @__PURE__ */ o(
823
+ "svg",
824
+ {
825
+ xmlns: "http://www.w3.org/2000/svg",
826
+ className: p,
827
+ viewBox: a || n,
828
+ fill: t || "currentColor",
829
+ role: "img",
830
+ "aria-hidden": !s,
831
+ focusable: !1,
832
+ ...d,
833
+ children: e
834
+ }
835
+ ),
836
+ l && s && /* @__PURE__ */ o("span", { className: "sr-only", children: l })
837
+ ] });
838
+ };
839
+ /*!
840
+ @versini/ui-private v1.4.17
841
+ © 2024 gizmette.com
842
+ */
843
+ try {
844
+ window.__VERSINI_UI_PRIVATE__ || (window.__VERSINI_UI_PRIVATE__ = {
845
+ version: "1.4.17",
846
+ buildTime: "09/28/2024 06:29 PM EDT",
847
+ homepage: "https://github.com/aversini/ui-components",
848
+ license: "MIT"
849
+ });
850
+ } catch {
851
+ }
852
+ const ca = ({
853
+ className: e,
854
+ viewBox: t,
855
+ spacing: a,
856
+ title: r,
857
+ monotone: n,
858
+ ...i
859
+ }) => /* @__PURE__ */ o(
860
+ sa,
861
+ {
862
+ defaultViewBox: "0 0 384 512",
863
+ defaultClassName: "size-5",
864
+ viewBox: t,
865
+ className: e,
866
+ spacing: a,
867
+ title: r || "Close",
868
+ ...i,
869
+ children: /* @__PURE__ */ o("path", { d: "M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3l105.4 105.3c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256l105.3-105.4z" })
870
+ }
871
+ );
872
+ /*!
873
+ @versini/ui-icons v1.13.1
874
+ © 2024 gizmette.com
875
+ */
876
+ try {
877
+ window.__VERSINI_UI_ICONS__ || (window.__VERSINI_UI_ICONS__ = {
878
+ version: "1.13.1",
879
+ buildTime: "09/28/2024 06:29 PM EDT",
880
+ homepage: "https://github.com/aversini/ui-components",
881
+ license: "MIT"
882
+ });
883
+ } catch {
884
+ }
885
+ const K = "panel", te = "messagebox", la = ({
886
+ className: e,
887
+ kind: t,
888
+ borderMode: a
889
+ }) => ({
890
+ main: f("prose prose-lighter flex flex-col bg-surface-medium", {
891
+ [`${Ee} h-full min-h-[95%] sm:h-auto sm:min-h-[10rem] sm:rounded-lg sm:border-2`]: t === K,
892
+ [`${Ee} w-full sm:w-[95%] md:max-w-2xl`]: t === K && !e,
893
+ [`${we} rounded-lg border-2`]: t === te,
894
+ [`${we} w-[95%] sm:w-[50%] md:max-w-2xl`]: t === te && !e,
895
+ [`${e}`]: !!e,
896
+ "sm:border-border-dark": a === "dark" && t === K,
897
+ "sm:border-border-accent": a === "light" && t === K,
898
+ "border-border-dark": a === "dark" && t === te,
899
+ "border-border-accent": a === "light" && t === te
900
+ }),
901
+ content: "flex flex-grow flex-col py-2 sm:py-4 sm:px-4 px-2",
902
+ footer: "flex flex-grow flex-col sm:p-4 p-2",
903
+ header: "sm:p-4 mb-0 p-2",
904
+ close: "sm:p-4 p-2"
905
+ }), q = (e) => pt(
906
+ () => import("./index.BV7w1tBT.B-qjwzFk.js").then((t) => ({
907
+ default: t[e]
908
+ }))
909
+ ), da = q("Modal"), ua = q("ModalClose"), ma = q("ModalContent"), ha = q("ModalDescription"), ga = q("ModalHeading"), H = ({
910
+ open: e,
911
+ onOpenChange: t,
912
+ title: a,
913
+ children: r,
914
+ footer: n,
915
+ borderMode: i = "light",
916
+ kind: c = K,
917
+ className: l
918
+ }) => {
919
+ const s = Z(""), d = la({ className: l, kind: c, borderMode: i });
920
+ return O(() => (e && (s.current = document.title, document.title = `${a} | ${s.current}`), () => {
921
+ e && (document.title = s.current);
922
+ }), [a, e]), /* @__PURE__ */ o(gt, { fallback: /* @__PURE__ */ o("div", {}), children: e && /* @__PURE__ */ o(da, { open: e, onOpenChange: t, children: /* @__PURE__ */ m(ma, { className: d.main, children: [
923
+ /* @__PURE__ */ m("div", { className: "flex flex-row-reverse items-center justify-between", children: [
924
+ /* @__PURE__ */ o(
925
+ ua,
926
+ {
927
+ className: d.close,
928
+ trigger: /* @__PURE__ */ o(
929
+ Pe,
930
+ {
931
+ mode: "dark",
932
+ focusMode: "light",
933
+ noBorder: !0,
934
+ label: "Close",
935
+ children: /* @__PURE__ */ o(ca, {})
936
+ }
937
+ )
938
+ }
939
+ ),
940
+ /* @__PURE__ */ o(ga, { className: d.header, children: a })
941
+ ] }),
942
+ /* @__PURE__ */ o(ha, { className: d.content, children: r }),
943
+ n && /* @__PURE__ */ o("div", { className: d.footer, children: n })
944
+ ] }) }) });
945
+ };
946
+ function J(e) {
947
+ return ft();
948
+ }
949
+ const pa = ({ stats: e }) => {
950
+ const t = (e == null ? void 0 : e.plugins) || [], a = (e == null ? void 0 : e.version) || "", r = (e == null ? void 0 : e.models) || [], n = J(), i = J();
951
+ return /* @__PURE__ */ m(S, { children: [
952
+ /* @__PURE__ */ o("div", { className: "mb-4", children: /* @__PURE__ */ o(
953
+ I,
954
+ {
955
+ header: v.ABOUT.TITLE_CLIENT,
956
+ className: "prose-dark dark:prose-lighter",
957
+ children: X(n, {
958
+ [v.ABOUT.VERSION]: "4.5.2",
959
+ [v.ABOUT.BUILD_TIMESTAMP]: "09/29/2024 05:22 PM EDT"
960
+ })
961
+ }
962
+ ) }),
963
+ /* @__PURE__ */ o(
964
+ I,
965
+ {
966
+ header: v.ABOUT.TITLE_SERVER,
967
+ className: "prose-dark dark:prose-lighter",
968
+ children: X(i, {
969
+ [v.ABOUT.VERSION]: a,
970
+ [oe(v.ABOUT.ENGINE, r.length)]: /* @__PURE__ */ o(S, { children: r.map((c) => /* @__PURE__ */ o("div", { className: "text-right", children: c }, c)) }),
971
+ [oe(v.ABOUT.PLUGIN, t.length)]: /* @__PURE__ */ o(S, { children: t.map((c) => /* @__PURE__ */ o("div", { className: "text-right", children: c }, c)) })
972
+ })
973
+ }
974
+ )
975
+ ] });
976
+ }, fa = ({
977
+ open: e,
978
+ onOpenChange: t
979
+ }) => {
980
+ const { serverStats: a } = B(ne);
981
+ return /* @__PURE__ */ o(H, { open: e, onOpenChange: t, title: Xe, children: /* @__PURE__ */ o(pa, { stats: a }) });
982
+ }, ba = (e) => _e(e), va = (e) => {
983
+ if (!e || e.length === 0)
984
+ return qe;
985
+ const t = e.filter(
986
+ (a) => {
987
+ var r, n;
988
+ return ((r = a == null ? void 0 : a.message) == null ? void 0 : r.role) === Qe && typeof ((n = a == null ? void 0 : a.message) == null ? void 0 : n.processingTime) == "number";
989
+ }
990
+ ).map((a) => a.message.processingTime);
991
+ return et({
992
+ data: t,
993
+ formatter: ba
994
+ });
995
+ }, ya = ({
996
+ isAuthenticated: e,
997
+ stats: t
998
+ }) => {
999
+ const { state: a } = B(ne), r = tt - Number(a == null ? void 0 : a.usage), n = J(), i = J();
1000
+ return e ? /* @__PURE__ */ m(S, { children: [
1001
+ a && a.messages.length > 0 && /* @__PURE__ */ o("div", { className: "mb-4", children: /* @__PURE__ */ o(
1002
+ I,
1003
+ {
1004
+ header: v.CURRENT_STATISTICS.TITLE,
1005
+ className: "prose-dark dark:prose-lighter",
1006
+ children: X(n, {
1007
+ [v.CURRENT_STATISTICS.MODEL_NAME]: (a == null ? void 0 : a.model) || Ze,
1008
+ [v.CURRENT_STATISTICS.TOKENS_USED]: a == null ? void 0 : a.usage,
1009
+ [v.CURRENT_STATISTICS.REMAINING_TOKENS]: Je.format(r),
1010
+ [v.CURRENT_STATISTICS.PROCESSING_TIME]: va(a == null ? void 0 : a.messages)
1011
+ })
1012
+ }
1013
+ ) }),
1014
+ /* @__PURE__ */ o(
1015
+ I,
1016
+ {
1017
+ header: v.MAIN_STATISTICS.TITLE,
1018
+ className: "prose-dark dark:prose-lighter",
1019
+ children: X(i, {
1020
+ [oe(v.MAIN_STATISTICS.TOTAL, t.totalChats)]: t.totalChats,
1021
+ [v.MAIN_STATISTICS.PROCESSING_TIME]: _e(
1022
+ t.averageProcessingTimes
1023
+ )
1024
+ })
1025
+ }
1026
+ )
1027
+ ] }) : null;
1028
+ }, ka = ({
1029
+ open: e,
1030
+ onOpenChange: t
1031
+ }) => {
1032
+ const [a, r] = C({
1033
+ averageProcessingTimes: 0,
1034
+ totalChats: 0
1035
+ }), { isAuthenticated: n, getAccessToken: i, user: c } = $();
1036
+ return O(() => {
1037
+ !e || !c || (async () => {
1038
+ try {
1039
+ const l = await M({
1040
+ accessToken: await i(),
1041
+ type: L.GET_CHATS_STATS,
1042
+ params: {
1043
+ userId: c.username
1044
+ }
1045
+ });
1046
+ l.status === 200 && r(l.data);
1047
+ } catch {
1048
+ }
1049
+ })();
1050
+ }, [e, i, c]), /* @__PURE__ */ o(H, { open: e, onOpenChange: t, title: Ae, children: /* @__PURE__ */ o(ya, { isAuthenticated: n, stats: a }) });
1051
+ }, Ve = ({
1052
+ showConfirmation: e,
1053
+ setShowConfirmation: t,
1054
+ action: a,
1055
+ children: r,
1056
+ customStrings: n
1057
+ }) => /* @__PURE__ */ o(
1058
+ H,
1059
+ {
1060
+ kind: "messagebox",
1061
+ open: e,
1062
+ onOpenChange: t,
1063
+ title: n.title,
1064
+ footer: /* @__PURE__ */ m(me, { columnGap: 2, alignHorizontal: "flex-end", children: [
1065
+ /* @__PURE__ */ o(U, { children: /* @__PURE__ */ o(
1066
+ z,
1067
+ {
1068
+ mode: "dark",
1069
+ variant: "secondary",
1070
+ focusMode: "light",
1071
+ onClick: () => {
1072
+ t(!1);
1073
+ },
1074
+ children: n.cancelAction
1075
+ }
1076
+ ) }),
1077
+ /* @__PURE__ */ o(U, { children: /* @__PURE__ */ o(
1078
+ z,
1079
+ {
1080
+ mode: "dark",
1081
+ variant: "danger",
1082
+ focusMode: "light",
1083
+ onClick: () => {
1084
+ t(!1), a();
1085
+ },
1086
+ children: n.confirmAction
1087
+ }
1088
+ ) })
1089
+ ] }),
1090
+ children: r
1091
+ }
1092
+ );
1093
+ var Ta = typeof window < "u", Ca = function(e, t) {
1094
+ return Ta ? window.matchMedia(e).matches : (process.env.NODE_ENV !== "production" && console.warn("`useMedia` When server side rendering, defaultState should be defined to prevent a hydration mismatches."), !1);
1095
+ }, Na = function(e, t) {
1096
+ var a = C(Ca(e)), r = a[0], n = a[1];
1097
+ return O(function() {
1098
+ var i = !0, c = window.matchMedia(e), l = function() {
1099
+ i && n(!!c.matches);
1100
+ };
1101
+ return c.addEventListener("change", l), n(c.matches), function() {
1102
+ i = !1, c.removeEventListener("change", l);
1103
+ };
1104
+ }, [e]), r;
1105
+ };
1106
+ const wa = async (e, t, a, r) => {
1107
+ try {
1108
+ const n = await M({
1109
+ accessToken: r,
1110
+ type: L.GET_CHAT,
1111
+ params: {
1112
+ id: e.id
1113
+ }
1114
+ });
1115
+ n.status === 200 && (t({
1116
+ type: ot
1117
+ }), t({
1118
+ type: rt,
1119
+ payload: {
1120
+ id: e.id,
1121
+ model: n.data.model,
1122
+ usage: n.data.usage,
1123
+ messages: n.data.messages
1124
+ }
1125
+ }), a(!1));
1126
+ } catch {
1127
+ }
1128
+ }, xe = (e) => {
1129
+ const t = e[0];
1130
+ return nt(t == null ? void 0 : t.content, 100);
1131
+ }, Ea = ({
1132
+ filteredHistory: e,
1133
+ setFilteredHistory: t,
1134
+ dispatch: a,
1135
+ onOpenChange: r
1136
+ }) => {
1137
+ var w;
1138
+ const { user: n, getAccessToken: i } = $(), c = Z({
1139
+ id: 0,
1140
+ timestamp: "",
1141
+ message: ""
1142
+ }), [l, s] = C(!1), d = Na("(min-width: 480px)"), { state: u, dispatch: p } = B(Me), [, y] = F({
1143
+ key: P + at,
1144
+ initialValue: u.sortDirection
1145
+ }), h = e.data.sort(
1146
+ (b, T) => {
1147
+ switch (u.sortedCell) {
1148
+ case "timestamp":
1149
+ if (u.sortDirection === x.ASC)
1150
+ return new Date(b[u.sortedCell]).getTime() - new Date(T[u.sortedCell]).getTime();
1151
+ if (u.sortDirection === x.DESC)
1152
+ return new Date(T[u.sortedCell]).getTime() - new Date(b[u.sortedCell]).getTime();
1153
+ break;
1154
+ default:
1155
+ return 0;
1156
+ }
1157
+ return 0;
1158
+ }
1159
+ ), g = (b) => {
1160
+ switch (u.sortDirection) {
1161
+ case !1:
1162
+ y(x.ASC), p({
1163
+ type: ie,
1164
+ payload: {
1165
+ sortedCell: b,
1166
+ sortDirection: x.ASC
1167
+ }
1168
+ });
1169
+ break;
1170
+ case x.ASC:
1171
+ y(x.DESC), p({
1172
+ type: ie,
1173
+ payload: {
1174
+ sortedCell: b,
1175
+ sortDirection: x.DESC
1176
+ }
1177
+ });
1178
+ break;
1179
+ default:
1180
+ y(x.ASC), p({
1181
+ type: ie,
1182
+ payload: {
1183
+ sortedCell: b,
1184
+ sortDirection: x.ASC
1185
+ }
1186
+ });
1187
+ break;
1188
+ }
1189
+ };
1190
+ return /* @__PURE__ */ m(S, { children: [
1191
+ /* @__PURE__ */ m(
1192
+ Ve,
1193
+ {
1194
+ showConfirmation: l,
1195
+ setShowConfirmation: s,
1196
+ action: async () => {
1197
+ const b = c.current;
1198
+ try {
1199
+ const T = await M({
1200
+ accessToken: await i(),
1201
+ type: L.DELETE_CHAT,
1202
+ params: {
1203
+ userId: (n == null ? void 0 : n.username) || "",
1204
+ id: b.id
1205
+ }
1206
+ });
1207
+ T.status === 200 && t({ data: T.data });
1208
+ } catch {
1209
+ }
1210
+ },
1211
+ customStrings: {
1212
+ confirmAction: "Delete",
1213
+ cancelAction: "Cancel",
1214
+ title: "Delete chat"
1215
+ },
1216
+ children: [
1217
+ /* @__PURE__ */ o("p", { className: "m-0", children: "Are you sure you want to delete the following chat:" }),
1218
+ /* @__PURE__ */ m("ul", { className: "m-0", children: [
1219
+ /* @__PURE__ */ m("li", { children: [
1220
+ "Timestamp:",
1221
+ " ",
1222
+ /* @__PURE__ */ o("span", { className: "text-lg", children: c.current && c.current.timestamp })
1223
+ ] }),
1224
+ /* @__PURE__ */ m("li", { children: [
1225
+ "First message:",
1226
+ " ",
1227
+ /* @__PURE__ */ o("span", { className: "text-lg", children: (w = c.current) == null ? void 0 : w.message })
1228
+ ] })
1229
+ ] })
1230
+ ]
1231
+ }
1232
+ ),
1233
+ /* @__PURE__ */ m(vt, { stickyHeader: !0, stickyFooter: !0, wrapperClassName: "max-h-[60vh]", children: [
1234
+ /* @__PURE__ */ o(yt, { children: /* @__PURE__ */ m(le, { children: [
1235
+ d && /* @__PURE__ */ o(R, { className: "sr-only", children: "Row" }),
1236
+ /* @__PURE__ */ o(
1237
+ kt,
1238
+ {
1239
+ cellId: "timestamp",
1240
+ align: "left",
1241
+ sortDirection: u.sortDirection,
1242
+ sortedCell: u.sortedCell,
1243
+ onClick: () => {
1244
+ g("timestamp");
1245
+ },
1246
+ children: "Date"
1247
+ }
1248
+ ),
1249
+ /* @__PURE__ */ o(R, { children: "First message" }),
1250
+ /* @__PURE__ */ o(R, { className: "text-right", children: "Actions" })
1251
+ ] }) }),
1252
+ /* @__PURE__ */ o(Tt, { children: h.map((b, T) => {
1253
+ var N;
1254
+ return ((N = b == null ? void 0 : b.messages) == null ? void 0 : N.length) > 0 ? /* @__PURE__ */ m(le, { children: [
1255
+ d && /* @__PURE__ */ o(R, { children: T + 1 }),
1256
+ /* @__PURE__ */ o(
1257
+ R,
1258
+ {
1259
+ component: "th",
1260
+ scope: "row",
1261
+ className: "font-medium text-gray-400 sm:whitespace-nowrap",
1262
+ children: b.timestamp
1263
+ }
1264
+ ),
1265
+ /* @__PURE__ */ o(R, { className: "max-w-[100px] text-white sm:max-w-full", children: xe(b.messages) }),
1266
+ /* @__PURE__ */ o(R, { children: /* @__PURE__ */ m("div", { className: "flex justify-end gap-2", children: [
1267
+ /* @__PURE__ */ o(
1268
+ V,
1269
+ {
1270
+ focusMode: "alt-system",
1271
+ noBorder: !0,
1272
+ label: "Restore chat",
1273
+ onClick: async () => {
1274
+ const E = await i();
1275
+ wa(
1276
+ b,
1277
+ a,
1278
+ r,
1279
+ E
1280
+ );
1281
+ },
1282
+ children: /* @__PURE__ */ o(Wt, { className: "h-3 w-3", monotone: !0 })
1283
+ }
1284
+ ),
1285
+ /* @__PURE__ */ o(
1286
+ V,
1287
+ {
1288
+ focusMode: "alt-system",
1289
+ noBorder: !0,
1290
+ label: "Delete chat",
1291
+ onClick: () => {
1292
+ c.current = {
1293
+ id: b.id,
1294
+ timestamp: b.timestamp,
1295
+ message: xe(b.messages)
1296
+ }, s(!l);
1297
+ },
1298
+ children: /* @__PURE__ */ o("div", { className: "text-red-400", children: /* @__PURE__ */ o(Ut, { className: "h-3 w-3", monotone: !0 }) })
1299
+ }
1300
+ )
1301
+ ] }) })
1302
+ ] }, `${v.HISTORY.TITLE}-${b.id}-${T}`) : null;
1303
+ }) }),
1304
+ /* @__PURE__ */ o(Ct, { children: /* @__PURE__ */ o(le, { children: /* @__PURE__ */ o(R, { colSpan: 4, children: /* @__PURE__ */ o("div", { children: oe(
1305
+ `${e.data.length} chat`,
1306
+ e.data.length
1307
+ ) }) }) }) })
1308
+ ] })
1309
+ ] });
1310
+ };
1311
+ function Ie(e, t) {
1312
+ return t ? e.filter(
1313
+ (a) => a.messages.some(
1314
+ (r) => r.content !== null && r.content.toLowerCase().includes(t.toLowerCase())
1315
+ )
1316
+ ) : e;
1317
+ }
1318
+ const Sa = ({
1319
+ onOpenChange: e,
1320
+ historyData: t
1321
+ }) => {
1322
+ const { isAuthenticated: a } = $(), r = Z(null), { dispatch: n } = B(ne), { state: i, dispatch: c } = B(Me), [, l] = F({
1323
+ key: P + it,
1324
+ initialValue: i.searchString
1325
+ }), s = bt(() => t, [t]), [d, u] = C({
1326
+ data: s
1327
+ }), p = (g) => {
1328
+ const k = Ie(s, g);
1329
+ u({
1330
+ data: k
1331
+ }), l(g), c({
1332
+ type: ct,
1333
+ payload: { searchString: g }
1334
+ });
1335
+ }, y = (g) => {
1336
+ p(g.target.value);
1337
+ }, h = async (g) => {
1338
+ g.preventDefault();
1339
+ };
1340
+ return O(() => {
1341
+ const g = Ie(
1342
+ t,
1343
+ i.searchString
1344
+ );
1345
+ u({
1346
+ data: g
1347
+ });
1348
+ }, [t, i.searchString]), a ? d && d.data && /* @__PURE__ */ m(S, { children: [
1349
+ /* @__PURE__ */ o("form", { autoComplete: "off", onSubmit: h, children: /* @__PURE__ */ o(
1350
+ st,
1351
+ {
1352
+ ref: r,
1353
+ defaultValue: i.searchString,
1354
+ focusMode: "light",
1355
+ name: "Search",
1356
+ label: "Search",
1357
+ onChange: y,
1358
+ spacing: { t: 2, b: 2 },
1359
+ ...i.searchString && {
1360
+ rightElement: /* @__PURE__ */ o(
1361
+ z,
1362
+ {
1363
+ disabled: !i.searchString,
1364
+ mode: "dark",
1365
+ noBorder: !0,
1366
+ size: "small",
1367
+ onClick: () => {
1368
+ var g;
1369
+ p(""), (g = r.current) != null && g.value && (r.current.value = "", r.current.focus());
1370
+ },
1371
+ children: "Reset"
1372
+ }
1373
+ )
1374
+ }
1375
+ }
1376
+ ) }),
1377
+ /* @__PURE__ */ o("div", { className: "flex flex-col gap-2 sm:flex-row", children: /* @__PURE__ */ o(
1378
+ Ea,
1379
+ {
1380
+ filteredHistory: d,
1381
+ setFilteredHistory: u,
1382
+ dispatch: n,
1383
+ onOpenChange: e
1384
+ }
1385
+ ) })
1386
+ ] }) : null;
1387
+ }, xa = ({
1388
+ open: e,
1389
+ onOpenChange: t,
1390
+ historyData: a
1391
+ }) => /* @__PURE__ */ o(H, { open: e, onOpenChange: t, title: lt, children: /* @__PURE__ */ o(Sa, { onOpenChange: t, historyData: a }) });
1392
+ /*!
1393
+ @versini/ui-toggle v1.0.7
1394
+ © 2024 gizmette.com
1395
+ */
1396
+ try {
1397
+ window.__VERSINI_UI_TOGGLE__ || (window.__VERSINI_UI_TOGGLE__ = {
1398
+ version: "1.0.7",
1399
+ buildTime: "09/27/2024 11:56 AM EDT",
1400
+ homepage: "https://github.com/aversini/ui-components",
1401
+ license: "MIT"
1402
+ });
1403
+ } catch {
1404
+ }
1405
+ const Ia = "av-toggle", _a = (e) => {
1406
+ let t = "";
1407
+ if (typeof e == "number" || typeof e == "string")
1408
+ t = "m-" + e;
1409
+ else {
1410
+ const a = [];
1411
+ (e == null ? void 0 : e.t) !== void 0 && a.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && a.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && a.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && a.push(`ml-${e.l}`), t = a.join(" ");
1412
+ }
1413
+ return t;
1414
+ }, Aa = () => f("peer", "h-6", "w-11", "rounded-full"), Ra = ({
1415
+ focusMode: e
1416
+ }) => f(
1417
+ "peer-focus:outline",
1418
+ "peer-focus:outline-2",
1419
+ "peer-focus:outline-offset-2",
1420
+ {
1421
+ "peer-focus:outline-focus-dark": e === "dark",
1422
+ "peer-focus:outline-focus-light": e === "light",
1423
+ "peer-focus:outline-focus-light dark:peer-focus:outline-focus-dark": e === "alt-system",
1424
+ "peer-focus:outline-focus-dark dark:peer-focus:outline-focus-light": e === "system"
1425
+ }
1426
+ ), Ma = () => f(
1427
+ "peer-checked:after:translate-x-full",
1428
+ // background color when checked
1429
+ "peer-checked:bg-violet-500",
1430
+ // knob circle and border color when checked
1431
+ "peer-checked:after:bg-white",
1432
+ "peer-checked:after:border-white"
1433
+ ), La = () => f(
1434
+ "after:left-[2px]",
1435
+ "after:top-[2px]",
1436
+ "after:border",
1437
+ "after:border-surface-light dark:after:border-surface-medium",
1438
+ "after:bg-surface-light dark:after:bg-surface-medium",
1439
+ "after:absolute",
1440
+ "after:h-5",
1441
+ "after:w-5",
1442
+ "after:rounded-full",
1443
+ "after:transition-all",
1444
+ "after:content-['']"
1445
+ ), Ba = ({
1446
+ mode: e,
1447
+ noBorder: t
1448
+ }) => f({
1449
+ border: !t,
1450
+ "border-border-dark bg-surface-medium": e === "light",
1451
+ "border-border-light bg-surface-darker": e === "dark",
1452
+ "border-border-light bg-surface-darker dark:border-border-dark dark:bg-surface-medium": e === "alt-system",
1453
+ "border-border-dark bg-surface-medium dark:border-border-light dark:bg-surface-darker": e === "system"
1454
+ }), Oa = ({
1455
+ mode: e,
1456
+ labelHidden: t
1457
+ }) => t ? "sr-only" : f("ml-2 text-sm", {
1458
+ "text-copy-dark": e === "light",
1459
+ "text-copy-lighter": e === "dark",
1460
+ "text-copy-lighter dark:text-copy-dark": e === "alt-system",
1461
+ "text-copy-dark dark:text-copy-lighter": e === "system"
1462
+ }), Ha = ({ spacing: e }) => f(
1463
+ Ia,
1464
+ "relative flex cursor-pointer items-center",
1465
+ _a(e)
1466
+ ), Da = ({
1467
+ mode: e,
1468
+ focusMode: t,
1469
+ labelHidden: a,
1470
+ spacing: r,
1471
+ noBorder: n
1472
+ }) => ({
1473
+ toggle: f(
1474
+ Aa(),
1475
+ Ba({ mode: e, noBorder: n }),
1476
+ Ra({ focusMode: t }),
1477
+ La(),
1478
+ Ma()
1479
+ ),
1480
+ label: Oa({ mode: e, labelHidden: a }),
1481
+ input: "peer sr-only",
1482
+ wrapper: Ha({ spacing: r })
1483
+ }), ae = ({
1484
+ checked: e = !1,
1485
+ onChange: t,
1486
+ label: a,
1487
+ labelHidden: r = !1,
1488
+ name: n,
1489
+ mode: i = "system",
1490
+ focusMode: c = "system",
1491
+ spacing: l,
1492
+ noBorder: s = !1
1493
+ }) => {
1494
+ const d = Da({
1495
+ mode: i,
1496
+ focusMode: c,
1497
+ labelHidden: r,
1498
+ spacing: l,
1499
+ noBorder: s
1500
+ }), u = (p) => {
1501
+ t == null || t(p.target.checked);
1502
+ };
1503
+ return /* @__PURE__ */ m("label", { className: d.wrapper, children: [
1504
+ /* @__PURE__ */ o(
1505
+ "input",
1506
+ {
1507
+ name: n,
1508
+ checked: e,
1509
+ type: "checkbox",
1510
+ className: d.input,
1511
+ onChange: u
1512
+ }
1513
+ ),
1514
+ /* @__PURE__ */ o("div", { className: d.toggle }),
1515
+ /* @__PURE__ */ o("span", { className: d.label, children: a })
1516
+ ] });
1517
+ }, za = ({
1518
+ open: e,
1519
+ onOpenChange: t
1520
+ }) => {
1521
+ const { getAccessToken: a, user: r } = $(), [n, i] = C({
1522
+ loaded: !1,
1523
+ content: "",
1524
+ loadingLocation: !1,
1525
+ location: ""
1526
+ }), c = async (s) => {
1527
+ s.preventDefault();
1528
+ try {
1529
+ await M({
1530
+ accessToken: await a(),
1531
+ type: L.SET_CUSTOM_INSTRUCTIONS,
1532
+ params: {
1533
+ user: r == null ? void 0 : r.username,
1534
+ instructions: n.content,
1535
+ location: n.location
1536
+ }
1537
+ });
1538
+ } catch {
1539
+ }
1540
+ }, l = async () => {
1541
+ i((s) => ({
1542
+ ...s,
1543
+ location: "...",
1544
+ loadingLocation: !0
1545
+ }));
1546
+ try {
1547
+ const s = Date.now(), d = await dt(), u = await M({
1548
+ accessToken: await a(),
1549
+ type: L.GET_LOCATION,
1550
+ params: {
1551
+ latitude: d.latitude,
1552
+ longitude: d.longitude
1553
+ }
1554
+ }), y = Date.now() - s;
1555
+ if (y < 2e3 && await new Promise((h) => setTimeout(h, 2e3 - y)), u.status === 200) {
1556
+ const { city: h, state: g, country: k, displayName: w } = u.data, b = h && g && k ? `${h}, ${g}, ${k}` : w;
1557
+ i((T) => ({
1558
+ ...T,
1559
+ loaded: !0,
1560
+ location: b,
1561
+ loadingLocation: !1
1562
+ }));
1563
+ } else
1564
+ i((h) => ({
1565
+ ...h,
1566
+ loaded: !0,
1567
+ location: "",
1568
+ loadingLocation: !1
1569
+ }));
1570
+ } catch {
1571
+ }
1572
+ };
1573
+ return O(() => {
1574
+ if (!e || !r) {
1575
+ i({
1576
+ loaded: !1,
1577
+ loadingLocation: !1,
1578
+ content: "",
1579
+ location: ""
1580
+ });
1581
+ return;
1582
+ }
1583
+ (async () => {
1584
+ try {
1585
+ const s = await M({
1586
+ accessToken: await a(),
1587
+ type: L.GET_CUSTOM_INSTRUCTIONS,
1588
+ params: {
1589
+ user: r.username
1590
+ }
1591
+ });
1592
+ s.status === 200 && i((d) => ({
1593
+ ...d,
1594
+ loaded: !0,
1595
+ content: s.data.instructions,
1596
+ location: s.data.location
1597
+ }));
1598
+ } catch {
1599
+ }
1600
+ })();
1601
+ }, [r, e]), /* @__PURE__ */ o(S, { children: n.loaded && /* @__PURE__ */ m(
1602
+ H,
1603
+ {
1604
+ open: e,
1605
+ onOpenChange: t,
1606
+ title: "Engine Fine Tuning",
1607
+ footer: /* @__PURE__ */ m(me, { columnGap: 2, alignHorizontal: "flex-end", children: [
1608
+ /* @__PURE__ */ o(U, { children: /* @__PURE__ */ o(
1609
+ z,
1610
+ {
1611
+ mode: "dark",
1612
+ variant: "secondary",
1613
+ focusMode: "light",
1614
+ onClick: () => {
1615
+ t(!1);
1616
+ },
1617
+ children: "Cancel"
1618
+ }
1619
+ ) }),
1620
+ /* @__PURE__ */ o(U, { children: /* @__PURE__ */ o(
1621
+ z,
1622
+ {
1623
+ mode: "dark",
1624
+ variant: "danger",
1625
+ focusMode: "light",
1626
+ onClick: async (s) => {
1627
+ t(!1), await c(s);
1628
+ },
1629
+ children: "Save"
1630
+ }
1631
+ ) })
1632
+ ] }),
1633
+ children: [
1634
+ /* @__PURE__ */ m(
1635
+ I,
1636
+ {
1637
+ header: "Custom Instructions",
1638
+ className: "prose-dark dark:prose-lighter",
1639
+ children: [
1640
+ /* @__PURE__ */ o("p", { children: "What would you like Sassy Saint to know about you to provide better responses?" }),
1641
+ /* @__PURE__ */ o(
1642
+ Te,
1643
+ {
1644
+ mode: "alt-system",
1645
+ autoCapitalize: "off",
1646
+ autoComplete: "off",
1647
+ autoCorrect: "off",
1648
+ name: "customInstructions",
1649
+ label: "Custom Instructions",
1650
+ value: n.content,
1651
+ onChange: (s) => {
1652
+ i((d) => ({
1653
+ ...d,
1654
+ loaded: !0,
1655
+ content: s.target.value
1656
+ }));
1657
+ },
1658
+ helperText: "Press ENTER to add a new line."
1659
+ }
1660
+ )
1661
+ ]
1662
+ }
1663
+ ),
1664
+ /* @__PURE__ */ m(
1665
+ I,
1666
+ {
1667
+ header: "Location",
1668
+ className: "prose-dark dark:prose-lighter",
1669
+ spacing: { t: 4 },
1670
+ children: [
1671
+ /* @__PURE__ */ o("p", { children: "You can share your location to receive customized responses based on your area." }),
1672
+ /* @__PURE__ */ o(
1673
+ Te,
1674
+ {
1675
+ mode: "alt-system",
1676
+ name: "location",
1677
+ label: "Location",
1678
+ value: n.location,
1679
+ onChange: (s) => {
1680
+ i((d) => ({
1681
+ ...d,
1682
+ loaded: !0,
1683
+ location: s.target.value
1684
+ }));
1685
+ },
1686
+ helperText: "Enter your location or press auto-detect."
1687
+ }
1688
+ ),
1689
+ /* @__PURE__ */ o(
1690
+ z,
1691
+ {
1692
+ spacing: { t: 2 },
1693
+ size: "small",
1694
+ noBorder: !0,
1695
+ disabled: n.loadingLocation,
1696
+ onClick: l,
1697
+ children: n.loadingLocation ? "Detecting..." : "Auto-detect"
1698
+ }
1699
+ )
1700
+ ]
1701
+ }
1702
+ )
1703
+ ]
1704
+ }
1705
+ ) });
1706
+ }, Pa = ({
1707
+ open: e,
1708
+ onOpenChange: t
1709
+ }) => {
1710
+ const [a, r] = F({
1711
+ key: P + fe,
1712
+ initialValue: !1
1713
+ }), [n, i] = F({
1714
+ key: P + be,
1715
+ initialValue: !1
1716
+ }), [c, l] = F({
1717
+ key: P + ve,
1718
+ initialValue: !1
1719
+ }), s = (p) => {
1720
+ r(p);
1721
+ }, d = (p) => {
1722
+ i(p);
1723
+ }, u = (p) => {
1724
+ l(p);
1725
+ };
1726
+ return /* @__PURE__ */ o(H, { open: e, onOpenChange: t, title: "Tags", children: /* @__PURE__ */ m(I, { header: v.TAGS.TITLE, className: "prose-dark dark:prose-lighter", children: [
1727
+ /* @__PURE__ */ o("p", { children: v.TAGS.DESCRIPTION }),
1728
+ /* @__PURE__ */ o(
1729
+ ae,
1730
+ {
1731
+ noBorder: !0,
1732
+ label: se[ce.SUMMARIZE_ARTICLE].label,
1733
+ name: fe,
1734
+ onChange: s,
1735
+ checked: a
1736
+ }
1737
+ ),
1738
+ /* @__PURE__ */ o(
1739
+ ae,
1740
+ {
1741
+ spacing: { t: 2 },
1742
+ noBorder: !0,
1743
+ label: se[ce.PROOFREAD_CONTENT].label,
1744
+ name: be,
1745
+ onChange: d,
1746
+ checked: n
1747
+ }
1748
+ ),
1749
+ /* @__PURE__ */ o(
1750
+ ae,
1751
+ {
1752
+ spacing: { t: 2 },
1753
+ noBorder: !0,
1754
+ label: se[ce.REPHRASE_CONTENT].label,
1755
+ name: ve,
1756
+ onChange: u,
1757
+ checked: c
1758
+ }
1759
+ )
1760
+ ] }) });
1761
+ }, Va = () => {
1762
+ const { isAuthenticated: e, user: t, registeringForPasskey: a, authenticationType: r } = $(), [n, i] = F({
1763
+ key: P + ut,
1764
+ initialValue: !1
1765
+ }), [c, l] = C(!1), [s, d] = C(!1), u = J(), p = (t == null ? void 0 : t.username) || "", y = (k) => {
1766
+ i(k);
1767
+ }, h = () => {
1768
+ l(!c);
1769
+ }, g = () => {
1770
+ d(!s);
1771
+ };
1772
+ return e && p ? /* @__PURE__ */ m(S, { children: [
1773
+ c && /* @__PURE__ */ o(
1774
+ za,
1775
+ {
1776
+ open: c,
1777
+ onOpenChange: l
1778
+ }
1779
+ ),
1780
+ s && /* @__PURE__ */ o(Pa, { open: s, onOpenChange: d }),
1781
+ /* @__PURE__ */ m(
1782
+ I,
1783
+ {
1784
+ header: v.PREFERENCES.TITLE,
1785
+ className: "prose-dark dark:prose-lighter",
1786
+ children: [
1787
+ X(u, {
1788
+ [v.PREFERENCES.NAME]: p,
1789
+ [v.PREFERENCES.EMAIL]: (t == null ? void 0 : t.email) || "",
1790
+ [v.PREFERENCES.ENGINE_DETAILS]: /* @__PURE__ */ o(
1791
+ ae,
1792
+ {
1793
+ noBorder: !0,
1794
+ labelHidden: !0,
1795
+ label: v.PREFERENCES.ENGINE_DETAILS,
1796
+ name: v.PREFERENCES.ENGINE_DETAILS,
1797
+ onChange: y,
1798
+ checked: n
1799
+ }
1800
+ )
1801
+ }),
1802
+ /* @__PURE__ */ o(
1803
+ V,
1804
+ {
1805
+ spacing: { t: 2 },
1806
+ size: "small",
1807
+ onClick: h,
1808
+ labelLeft: "Engine Fine Tuning",
1809
+ children: /* @__PURE__ */ o(Ce, { className: "size-3", monotone: !0 })
1810
+ }
1811
+ ),
1812
+ /* @__PURE__ */ o(
1813
+ V,
1814
+ {
1815
+ spacing: { t: 2, l: 2 },
1816
+ size: "small",
1817
+ onClick: g,
1818
+ labelLeft: "Tags",
1819
+ children: /* @__PURE__ */ o(Ce, { className: "size-3", monotone: !0 })
1820
+ }
1821
+ )
1822
+ ]
1823
+ }
1824
+ ),
1825
+ r !== mt.PASSKEY && /* @__PURE__ */ m(
1826
+ I,
1827
+ {
1828
+ spacing: { t: 4 },
1829
+ className: "prose-dark dark:prose-lighter",
1830
+ header: /* @__PURE__ */ o("h2", { className: "m-0", children: /* @__PURE__ */ m(me, { columnGap: 3, alignVertical: "center", children: [
1831
+ /* @__PURE__ */ o(U, { children: /* @__PURE__ */ o(ye, { className: "size-8" }) }),
1832
+ /* @__PURE__ */ o(U, { children: /* @__PURE__ */ o("div", { children: v.PREFERENCES.PASSKEY_TITLE }) })
1833
+ ] }) }),
1834
+ children: [
1835
+ /* @__PURE__ */ o("p", { children: v.PREFERENCES.PASSKEY_INSTRUCTIONS }),
1836
+ /* @__PURE__ */ o(
1837
+ V,
1838
+ {
1839
+ size: "small",
1840
+ spacing: { t: 2 },
1841
+ onClick: a,
1842
+ labelLeft: v.PREFERENCES.PASSKEY_BUTTON,
1843
+ children: /* @__PURE__ */ o(ye, { className: "size-5", monotone: !0 })
1844
+ }
1845
+ )
1846
+ ]
1847
+ }
1848
+ )
1849
+ ] }) : null;
1850
+ }, Fa = ({
1851
+ open: e,
1852
+ onOpenChange: t
1853
+ }) => /* @__PURE__ */ o(H, { open: e, onOpenChange: t, title: ht, children: /* @__PURE__ */ o(Va, {}) }), Ka = () => {
1854
+ const { state: e } = B(ne), [t, a] = C(!1), [r, n] = C(!1), [i, c] = C(!1), [l, s] = C(!1), [d, u] = C([]), [p, y] = C(!1), [h, g] = C({
1855
+ done: !1,
1856
+ progress: !1,
1857
+ timestamp: Date.now()
1858
+ }), { logout: k, getAccessToken: w, user: b } = $(), T = () => {
1859
+ a(!t);
1860
+ }, N = () => {
1861
+ n(!r);
1862
+ }, E = () => {
1863
+ c(!i);
1864
+ }, G = () => {
1865
+ s(!l);
1866
+ }, j = async (A) => {
1867
+ const ee = Date.now();
1868
+ if (A && !(!b || !e || h.progress || h.done === !0 && ee - h.timestamp < 5e3)) {
1869
+ g({
1870
+ done: !0,
1871
+ progress: !0,
1872
+ timestamp: ee
1873
+ });
1874
+ try {
1875
+ const W = await M({
1876
+ accessToken: await w(),
1877
+ type: L.GET_CHATS,
1878
+ params: {
1879
+ userId: b.username
1880
+ }
1881
+ });
1882
+ W.status === 200 && (u(W.data), g({
1883
+ done: !0,
1884
+ progress: !1,
1885
+ timestamp: Date.now()
1886
+ }));
1887
+ } catch {
1888
+ g({
1889
+ done: !0,
1890
+ progress: !1,
1891
+ timestamp: Date.now()
1892
+ });
1893
+ }
1894
+ }
1895
+ }, Q = () => {
1896
+ y(!p);
1897
+ };
1898
+ return /* @__PURE__ */ m(S, { children: [
1899
+ /* @__PURE__ */ o(
1900
+ Ve,
1901
+ {
1902
+ showConfirmation: p,
1903
+ setShowConfirmation: y,
1904
+ action: k,
1905
+ customStrings: {
1906
+ confirmAction: ke,
1907
+ cancelAction: "Cancel",
1908
+ title: ke
1909
+ },
1910
+ children: /* @__PURE__ */ o("p", { children: "Are you sure you want to log out?" })
1911
+ }
1912
+ ),
1913
+ /* @__PURE__ */ o(Fa, { open: t, onOpenChange: a }),
1914
+ /* @__PURE__ */ o(ka, { open: r, onOpenChange: n }),
1915
+ /* @__PURE__ */ o(
1916
+ xa,
1917
+ {
1918
+ open: i,
1919
+ onOpenChange: c,
1920
+ historyData: d
1921
+ }
1922
+ ),
1923
+ /* @__PURE__ */ o(fa, { open: l, onOpenChange: s }),
1924
+ /* @__PURE__ */ o("div", { className: "relative", children: /* @__PURE__ */ o("div", { className: "absolute bottom-[-28px] right-[-7px]", children: /* @__PURE__ */ m(
1925
+ De,
1926
+ {
1927
+ mode: "dark",
1928
+ focusMode: "light",
1929
+ trigger: /* @__PURE__ */ o(V, { children: /* @__PURE__ */ o(Yt, {}) }),
1930
+ defaultPlacement: "bottom-end",
1931
+ onOpenChange: j,
1932
+ children: [
1933
+ /* @__PURE__ */ o(
1934
+ D,
1935
+ {
1936
+ label: "Profile",
1937
+ onClick: T,
1938
+ icon: /* @__PURE__ */ o(jt, {})
1939
+ }
1940
+ ),
1941
+ /* @__PURE__ */ o(
1942
+ D,
1943
+ {
1944
+ label: Ae,
1945
+ onClick: N,
1946
+ icon: /* @__PURE__ */ o(Ft, {})
1947
+ }
1948
+ ),
1949
+ /* @__PURE__ */ o(
1950
+ D,
1951
+ {
1952
+ label: "History",
1953
+ onClick: E,
1954
+ icon: /* @__PURE__ */ o($t, {})
1955
+ }
1956
+ ),
1957
+ /* @__PURE__ */ o(
1958
+ D,
1959
+ {
1960
+ label: "About",
1961
+ onClick: G,
1962
+ icon: /* @__PURE__ */ o(Gt, {})
1963
+ }
1964
+ ),
1965
+ e && e.id && !e.isComponent && /* @__PURE__ */ m(S, { children: [
1966
+ /* @__PURE__ */ o(Kt, {}),
1967
+ /* @__PURE__ */ o(
1968
+ D,
1969
+ {
1970
+ label: "Log out",
1971
+ onClick: Q,
1972
+ icon: /* @__PURE__ */ o("div", { className: "text-red-700", children: /* @__PURE__ */ o(Vt, { monotone: !0 }) })
1973
+ }
1974
+ )
1975
+ ] })
1976
+ ]
1977
+ }
1978
+ ) }) })
1979
+ ] });
1980
+ };
1981
+ export {
1982
+ Ka as default
1983
+ };