@versini/sassysaint 5.0.1 → 5.1.2

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,1429 +0,0 @@
1
- import { jsxs as d, jsx as t, Fragment as w } from "react/jsx-runtime";
2
- import { O as B, i$1 as le, N as de, p as De, o as Oe, g as I, N$1 as R, CARDS as f, renderDataAsList as j, pluralize as Q, ABOUT_TITLE as ze, MODEL_GPT4 as Be, numberFormatter as Pe, durationFormatter as Ce, NA as Ve, ROLE_ASSISTANT as Fe, extractAverage as $e, GPT4_MAX_TOKENS as Ge, qr as V, STATS as Te, b as re, j$1 as P, x as z, LOCAL_STORAGE_PREFIX as ce, LOCAL_STORAGE_SORT as Ue, ACTION_RESET as je, ACTION_RESTORE as Ye, truncate as Ke, ACTION_SORT as ae, LOCAL_STORAGE_SEARCH as We, G as Xe, ACTION_SEARCH as qe, HISTORY_TITLE as Je, getCurrentGeoLocation as Qe, LOCAL_STORAGE_CHAT_DETAILS as Ze, W as et, v as ue, PROFILE_TITLE as tt, LOG_OUT as me } from "./index.CMDql_8l.js";
3
- import * as ne from "react";
4
- import at, { forwardRef as Ne, useState as T, useRef as Y, useContext as _, useEffect as D, Suspense as ot, lazy as nt, useId as st, useMemo as rt } from "react";
5
- import { g as ct, AppContext as Z, serviceCall as H, SERVICE_TYPES as L, HistoryContext as Se, E as ie, k as x, et as it, at as lt, lt as oe, J as M, ct as dt, st as ut, rt as mt, Tt as he } from "./useLocalStorage.D91BITud.js";
6
- import b from "clsx";
7
- import { useFloatingTree as Ee, useFloatingNodeId as ht, useListItem as ye, useFloating as pt, offset as ft, flip as gt, shift as Ct, autoUpdate as Tt, useClick as Nt, useRole as St, useDismiss as Et, useListNavigation as yt, useTypeahead as wt, useInteractions as bt, useMergeRefs as we, FloatingNode as kt, FloatingList as xt, FloatingPortal as It, FloatingFocusManager as vt, FloatingTree as At } from "@floating-ui/react";
8
- const se = ne.createContext({
9
- getItemProps: () => ({}),
10
- activeIndex: null,
11
- /* v8 ignore next 2 */
12
- setActiveIndex: () => {
13
- },
14
- setHasFocusInside: () => {
15
- },
16
- isOpen: !1
17
- }), pe = (e) => {
18
- if (typeof e == "string")
19
- return e;
20
- if (typeof e == "function")
21
- return e.displayName || e.name || "Component";
22
- if (typeof e == "object" && e !== null && "type" in e) {
23
- const a = e.type;
24
- if (typeof a == "function" || typeof a == "object")
25
- return a.displayName || a.name || "Component";
26
- }
27
- return "Element";
28
- }, be = Ne(
29
- ({
30
- trigger: e,
31
- children: a,
32
- label: o = "Open menu",
33
- defaultPlacement: n = "bottom-start",
34
- onOpenChange: s,
35
- spacing: r,
36
- mode: l = "system",
37
- focusMode: m = "system",
38
- ...c
39
- }, i) => {
40
- const [u, g] = T(!1), [N, C] = T(!1), [p, y] = T(null), k = Y([]), h = Y([]), S = _(se), E = Ee(), v = ht(), ee = ye(), { floatingStyles: te, refs: X, context: A } = pt({
41
- nodeId: v,
42
- open: u,
43
- onOpenChange: (G) => {
44
- g(G), s == null || s(G);
45
- },
46
- placement: n,
47
- strategy: "fixed",
48
- middleware: [ft({ mainAxis: 10 }), gt(), Ct()],
49
- whileElementsMounted: Tt
50
- }), q = Nt(A, {
51
- event: "mousedown",
52
- toggle: !0,
53
- ignoreMouse: !1
54
- }), $ = St(A, { role: "menu" }), Ie = Et(A, { bubbles: !0 }), ve = yt(A, {
55
- listRef: k,
56
- activeIndex: p,
57
- nested: !1,
58
- onNavigate: y,
59
- loop: !0
60
- }), Ae = wt(A, {
61
- listRef: h,
62
- onMatch: u ? y : void 0,
63
- activeIndex: p
64
- }), { getReferenceProps: Me, getFloatingProps: Re, getItemProps: He } = bt([q, $, Ie, ve, Ae]), Le = pe(e) === "Button" || pe(e) === "ButtonIcon", _e = at.cloneElement(e, {
65
- mode: l,
66
- focusMode: m,
67
- spacing: r,
68
- noInternalClick: Le,
69
- "aria-label": o,
70
- "data-open": u ? "" : void 0,
71
- "data-focus-inside": N ? "" : void 0,
72
- ref: we([X.setReference, ee.ref, i]),
73
- ...Me(
74
- S.getItemProps({
75
- ...c
76
- })
77
- )
78
- });
79
- return D(() => {
80
- if (!E)
81
- return;
82
- function G() {
83
- g(!1), s == null || s(!1);
84
- }
85
- return E.events.on("click", G), () => {
86
- E.events.off("click", G);
87
- };
88
- }, [E, s]), D(() => {
89
- u && E && E.events.emit("menuopen", { nodeId: v });
90
- }, [E, u, v]), /* @__PURE__ */ d(kt, { id: v, children: [
91
- _e,
92
- /* @__PURE__ */ t(
93
- se.Provider,
94
- {
95
- value: {
96
- activeIndex: p,
97
- setActiveIndex: y,
98
- getItemProps: He,
99
- setHasFocusInside: C,
100
- isOpen: u
101
- },
102
- children: /* @__PURE__ */ t(xt, { elementsRef: k, labelsRef: h, children: u && /* @__PURE__ */ t(It, { children: /* @__PURE__ */ t(
103
- vt,
104
- {
105
- context: A,
106
- modal: !1,
107
- initialFocus: 0,
108
- returnFocus: !0,
109
- children: /* @__PURE__ */ t(
110
- "div",
111
- {
112
- ref: X.setFloating,
113
- className: "rounded-md bg-surface-light p-4 shadow-sm shadow-border-dark outline-none sm:p-2",
114
- style: te,
115
- ...Re(),
116
- children: a
117
- }
118
- )
119
- }
120
- ) }) })
121
- }
122
- )
123
- ] });
124
- }
125
- ), ke = Ne((e, a) => /* @__PURE__ */ t(At, { children: /* @__PURE__ */ t(be, { ...e, ref: a }) }));
126
- ke.displayName = "Menu";
127
- be.displayName = "MenuComponent";
128
- const O = ne.forwardRef(({ label: e, disabled: a, icon: o, ...n }, s) => {
129
- const r = ne.useContext(se), l = ye({ label: a ? null : e }), m = Ee();
130
- return /* @__PURE__ */ d(
131
- "button",
132
- {
133
- ...n,
134
- ref: we([l.ref, s]),
135
- role: "menuitem",
136
- 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",
137
- tabIndex: 0,
138
- disabled: a,
139
- ...r.getItemProps({
140
- onClick(c) {
141
- var i;
142
- (i = n.onClick) == null || i.call(n, c), m == null || m.events.emit("click");
143
- },
144
- onFocus(c) {
145
- var i;
146
- (i = n.onFocus) == null || i.call(n, c), r.setHasFocusInside(!0);
147
- }
148
- }),
149
- children: [
150
- o,
151
- e && /* @__PURE__ */ t("span", { className: "pl-2", children: e })
152
- ]
153
- }
154
- );
155
- });
156
- O.displayName = "MenuItem";
157
- const Mt = ({ className: e, ...a }) => {
158
- const o = b(e, "my-1 border-t border-border-medium");
159
- return /* @__PURE__ */ t("div", { className: o, ...a });
160
- }, Rt = ({
161
- className: e,
162
- viewBox: a,
163
- spacing: o,
164
- title: n,
165
- monotone: s,
166
- ...r
167
- }) => /* @__PURE__ */ t(
168
- ct,
169
- {
170
- defaultViewBox: "0 0 384 512",
171
- defaultClassName: "size-5",
172
- viewBox: a,
173
- className: e,
174
- spacing: o,
175
- title: n || "Close",
176
- ...r,
177
- children: /* @__PURE__ */ t("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" })
178
- }
179
- ), U = "panel", J = "messagebox", Ht = ({
180
- className: e,
181
- kind: a,
182
- borderMode: o
183
- }) => ({
184
- main: b("prose prose-lighter flex flex-col bg-surface-medium", {
185
- [`${le} h-full min-h-[95%] sm:h-auto sm:min-h-[10rem] sm:rounded-lg sm:border-2`]: a === U,
186
- [`${le} w-full sm:w-[95%] md:max-w-2xl`]: a === U && !e,
187
- [`${de} rounded-lg border-2`]: a === J,
188
- [`${de} w-[95%] sm:w-[50%] md:max-w-2xl`]: a === J && !e,
189
- [`${e}`]: !!e,
190
- "sm:border-border-dark": o === "dark" && a === U,
191
- "sm:border-border-accent": o === "light" && a === U,
192
- "border-border-dark": o === "dark" && a === J,
193
- "border-border-accent": o === "light" && a === J
194
- }),
195
- content: "flex flex-grow flex-col py-2 sm:py-4 sm:px-4 px-2",
196
- footer: "flex flex-grow flex-col sm:p-4 p-2",
197
- header: "sm:p-4 mb-0 p-2",
198
- close: "sm:p-4 p-2"
199
- }), W = (e) => nt(
200
- () => import("./index.BA5202H5.DKMEJZV8.js").then((a) => ({
201
- default: a[e]
202
- }))
203
- ), Lt = W("Modal"), _t = W("ModalClose"), Dt = W("ModalContent"), Ot = W("ModalDescription"), zt = W("ModalHeading"), F = ({
204
- open: e,
205
- onOpenChange: a,
206
- title: o,
207
- children: n,
208
- footer: s,
209
- borderMode: r = "light",
210
- kind: l = U,
211
- className: m
212
- }) => {
213
- const c = Y(""), i = Ht({ className: m, kind: l, borderMode: r });
214
- return D(() => (e && (c.current = document.title, document.title = `${o} | ${c.current}`), () => {
215
- e && (document.title = c.current);
216
- }), [o, e]), /* @__PURE__ */ t(ot, { fallback: /* @__PURE__ */ t("div", {}), children: e && /* @__PURE__ */ t(Lt, { open: e, onOpenChange: a, children: /* @__PURE__ */ d(Dt, { className: i.main, children: [
217
- /* @__PURE__ */ d("div", { className: "flex flex-row-reverse items-center justify-between", children: [
218
- /* @__PURE__ */ t(
219
- _t,
220
- {
221
- className: i.close,
222
- trigger: /* @__PURE__ */ t(
223
- B,
224
- {
225
- mode: "dark",
226
- focusMode: "light",
227
- noBorder: !0,
228
- label: "Close",
229
- children: /* @__PURE__ */ t(Rt, {})
230
- }
231
- )
232
- }
233
- ),
234
- /* @__PURE__ */ t(zt, { className: i.header, children: o })
235
- ] }),
236
- /* @__PURE__ */ t(Ot, { className: i.content, children: n }),
237
- s && /* @__PURE__ */ t("div", { className: i.footer, children: s })
238
- ] }) }) });
239
- }, Bt = () => b("peer", "h-6", "w-11", "rounded-full"), Pt = ({
240
- focusMode: e
241
- }) => b(
242
- "peer-focus:outline",
243
- "peer-focus:outline-2",
244
- "peer-focus:outline-offset-2",
245
- {
246
- "peer-focus:outline-focus-dark": e === "dark",
247
- "peer-focus:outline-focus-light": e === "light",
248
- "peer-focus:outline-focus-light dark:peer-focus:outline-focus-dark": e === "alt-system",
249
- "peer-focus:outline-focus-dark dark:peer-focus:outline-focus-light": e === "system"
250
- }
251
- ), Vt = () => b(
252
- "peer-checked:after:translate-x-full",
253
- // background color when checked
254
- "peer-checked:bg-violet-500",
255
- // knob circle and border color when checked
256
- "peer-checked:after:bg-white",
257
- "peer-checked:after:border-white"
258
- ), Ft = () => b(
259
- "after:left-[2px]",
260
- "after:top-[2px]",
261
- "after:border",
262
- "after:border-surface-light dark:after:border-surface-medium",
263
- "after:bg-surface-light dark:after:bg-surface-medium",
264
- "after:absolute",
265
- "after:h-5",
266
- "after:w-5",
267
- "after:rounded-full",
268
- "after:transition-all",
269
- "after:content-['']"
270
- ), $t = ({
271
- mode: e,
272
- noBorder: a
273
- }) => b({
274
- border: !a,
275
- "border-border-dark bg-surface-medium": e === "light",
276
- "border-border-light bg-surface-darker": e === "dark",
277
- "border-border-light bg-surface-darker dark:border-border-dark dark:bg-surface-medium": e === "alt-system",
278
- "border-border-dark bg-surface-medium dark:border-border-light dark:bg-surface-darker": e === "system"
279
- }), Gt = ({
280
- mode: e,
281
- labelHidden: a
282
- }) => a ? "sr-only" : b("ml-2 text-sm", {
283
- "text-copy-dark": e === "light",
284
- "text-copy-lighter": e === "dark",
285
- "text-copy-lighter dark:text-copy-dark": e === "alt-system",
286
- "text-copy-dark dark:text-copy-lighter": e === "system"
287
- }), Ut = ({ spacing: e }) => b(
288
- De,
289
- "relative flex cursor-pointer items-center",
290
- Oe(e)
291
- ), jt = ({
292
- mode: e,
293
- focusMode: a,
294
- labelHidden: o,
295
- spacing: n,
296
- noBorder: s
297
- }) => ({
298
- toggle: b(
299
- Bt(),
300
- $t({ mode: e, noBorder: s }),
301
- Pt({ focusMode: a }),
302
- Ft(),
303
- Vt()
304
- ),
305
- label: Gt({ mode: e, labelHidden: o }),
306
- input: "peer sr-only",
307
- wrapper: Ut({ spacing: n })
308
- }), Yt = ({
309
- checked: e = !1,
310
- onChange: a,
311
- label: o,
312
- labelHidden: n = !1,
313
- name: s,
314
- mode: r = "system",
315
- focusMode: l = "system",
316
- spacing: m,
317
- noBorder: c = !1
318
- }) => {
319
- const i = jt({
320
- mode: r,
321
- focusMode: l,
322
- labelHidden: n,
323
- spacing: m,
324
- noBorder: c
325
- }), u = (g) => {
326
- a == null || a(g.target.checked);
327
- };
328
- return /* @__PURE__ */ d("label", { className: i.wrapper, children: [
329
- /* @__PURE__ */ t(
330
- "input",
331
- {
332
- name: s,
333
- checked: e,
334
- type: "checkbox",
335
- className: i.input,
336
- onChange: u
337
- }
338
- ),
339
- /* @__PURE__ */ t("div", { className: i.toggle }),
340
- /* @__PURE__ */ t("span", { className: i.label, children: o })
341
- ] });
342
- }, Kt = ({
343
- className: e,
344
- viewBox: a,
345
- spacing: o,
346
- title: n,
347
- monotone: s,
348
- ...r
349
- }) => /* @__PURE__ */ d(
350
- I,
351
- {
352
- defaultViewBox: "0 0 512 512",
353
- defaultClassName: "size-5",
354
- viewBox: a,
355
- className: e,
356
- spacing: o,
357
- title: n || "Back",
358
- ...r,
359
- children: [
360
- /* @__PURE__ */ t(
361
- "path",
362
- {
363
- opacity: s ? "1" : "0.4",
364
- 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"
365
- }
366
- ),
367
- /* @__PURE__ */ t("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" })
368
- ]
369
- }
370
- ), Wt = ({
371
- className: e,
372
- viewBox: a,
373
- spacing: o,
374
- title: n,
375
- monotone: s,
376
- ...r
377
- }) => /* @__PURE__ */ d(
378
- I,
379
- {
380
- defaultViewBox: "0 0 448 512",
381
- defaultClassName: "size-5",
382
- viewBox: a,
383
- className: e,
384
- spacing: o,
385
- title: n || "Chart",
386
- ...r,
387
- children: [
388
- /* @__PURE__ */ t(
389
- "path",
390
- {
391
- opacity: s ? "1" : "0.4",
392
- 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"
393
- }
394
- ),
395
- /* @__PURE__ */ t("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" })
396
- ]
397
- }
398
- ), Xt = ({
399
- className: e,
400
- viewBox: a,
401
- spacing: o,
402
- title: n,
403
- monotone: s,
404
- ...r
405
- }) => /* @__PURE__ */ d(
406
- I,
407
- {
408
- defaultViewBox: "0 0 448 512",
409
- defaultClassName: "size-5",
410
- viewBox: a,
411
- className: e,
412
- spacing: o,
413
- title: n || "Delete",
414
- ...r,
415
- children: [
416
- /* @__PURE__ */ t(
417
- "path",
418
- {
419
- opacity: s ? "1" : "0.4",
420
- 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"
421
- }
422
- ),
423
- /* @__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 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" })
424
- ]
425
- }
426
- ), qt = ({
427
- className: e,
428
- viewBox: a,
429
- spacing: o,
430
- title: n,
431
- monotone: s,
432
- ...r
433
- }) => /* @__PURE__ */ d(
434
- I,
435
- {
436
- defaultViewBox: "0 0 512 512",
437
- defaultClassName: "size-5",
438
- viewBox: a,
439
- className: e,
440
- spacing: o,
441
- title: n || "Edit",
442
- ...r,
443
- children: [
444
- /* @__PURE__ */ t(
445
- "path",
446
- {
447
- opacity: s ? "1" : "0.4",
448
- 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"
449
- }
450
- ),
451
- /* @__PURE__ */ t("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" })
452
- ]
453
- }
454
- ), Jt = ({
455
- className: e,
456
- viewBox: a,
457
- spacing: o,
458
- title: n,
459
- monotone: s,
460
- ...r
461
- }) => /* @__PURE__ */ d(
462
- I,
463
- {
464
- defaultViewBox: "0 0 512 512",
465
- defaultClassName: "size-5",
466
- viewBox: a,
467
- className: e,
468
- spacing: o,
469
- title: n || "History",
470
- ...r,
471
- children: [
472
- /* @__PURE__ */ t(
473
- "path",
474
- {
475
- opacity: s ? "1" : "0.4",
476
- 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"
477
- }
478
- ),
479
- /* @__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" })
480
- ]
481
- }
482
- ), Qt = ({
483
- className: e,
484
- viewBox: a,
485
- spacing: o,
486
- title: n,
487
- monotone: s,
488
- ...r
489
- }) => /* @__PURE__ */ d(
490
- I,
491
- {
492
- defaultViewBox: "0 0 512 512",
493
- defaultClassName: "size-5",
494
- viewBox: a,
495
- className: e,
496
- spacing: o,
497
- title: n || "Info",
498
- ...r,
499
- children: [
500
- /* @__PURE__ */ t(
501
- "path",
502
- {
503
- opacity: "0.4",
504
- 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"
505
- }
506
- ),
507
- /* @__PURE__ */ t("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" })
508
- ]
509
- }
510
- ), Zt = ({
511
- className: e,
512
- viewBox: a,
513
- spacing: o,
514
- title: n,
515
- monotone: s,
516
- ...r
517
- }) => /* @__PURE__ */ d(
518
- I,
519
- {
520
- defaultViewBox: "0 0 576 512",
521
- defaultClassName: "size-5",
522
- viewBox: a,
523
- className: e,
524
- spacing: o,
525
- title: n || "Profile",
526
- ...r,
527
- children: [
528
- /* @__PURE__ */ t(
529
- "path",
530
- {
531
- opacity: "0.4",
532
- 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"
533
- }
534
- ),
535
- /* @__PURE__ */ t("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" })
536
- ]
537
- }
538
- ), ea = ({
539
- className: e,
540
- viewBox: a,
541
- spacing: o,
542
- title: n,
543
- monotone: s,
544
- ...r
545
- }) => /* @__PURE__ */ d(
546
- I,
547
- {
548
- defaultViewBox: "0 0 512 512",
549
- defaultClassName: "size-5",
550
- viewBox: a,
551
- className: e,
552
- spacing: o,
553
- title: n || "Restore",
554
- ...r,
555
- children: [
556
- /* @__PURE__ */ t(
557
- "path",
558
- {
559
- opacity: s ? "1" : "0.4",
560
- 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"
561
- }
562
- ),
563
- /* @__PURE__ */ t("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" })
564
- ]
565
- }
566
- ), ta = ({
567
- className: e,
568
- viewBox: a,
569
- spacing: o,
570
- title: n,
571
- monotone: s,
572
- ...r
573
- }) => /* @__PURE__ */ t(
574
- I,
575
- {
576
- defaultViewBox: "0 0 448 512",
577
- defaultClassName: "size-5",
578
- viewBox: a,
579
- className: e,
580
- spacing: o,
581
- title: n || "Settings",
582
- ...r,
583
- children: /* @__PURE__ */ t("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" })
584
- }
585
- );
586
- function K(e) {
587
- return st();
588
- }
589
- const aa = ({ stats: e }) => {
590
- const a = (e == null ? void 0 : e.plugins) || [], o = (e == null ? void 0 : e.version) || "", n = (e == null ? void 0 : e.models) || [], s = K(), r = K();
591
- return /* @__PURE__ */ d(w, { children: [
592
- /* @__PURE__ */ t("div", { className: "mb-4", children: /* @__PURE__ */ t(
593
- R,
594
- {
595
- header: f.ABOUT.TITLE_CLIENT,
596
- className: "prose-dark dark:prose-lighter",
597
- children: j(s, {
598
- [f.ABOUT.VERSION]: "4.3.6",
599
- [f.ABOUT.BUILD_TIMESTAMP]: "09/14/2024 05:59 PM EDT"
600
- })
601
- }
602
- ) }),
603
- /* @__PURE__ */ t(
604
- R,
605
- {
606
- header: f.ABOUT.TITLE_SERVER,
607
- className: "prose-dark dark:prose-lighter",
608
- children: j(r, {
609
- [f.ABOUT.VERSION]: o,
610
- [Q(f.ABOUT.ENGINE, n.length)]: /* @__PURE__ */ t(w, { children: n.map((l) => /* @__PURE__ */ t("div", { className: "text-right", children: l }, l)) }),
611
- [Q(f.ABOUT.PLUGIN, a.length)]: /* @__PURE__ */ t(w, { children: a.map((l) => /* @__PURE__ */ t("div", { className: "text-right", children: l }, l)) })
612
- })
613
- }
614
- )
615
- ] });
616
- }, oa = ({
617
- open: e,
618
- onOpenChange: a
619
- }) => {
620
- const { serverStats: o } = _(Z);
621
- return /* @__PURE__ */ t(F, { open: e, onOpenChange: a, title: ze, children: /* @__PURE__ */ t(aa, { stats: o }) });
622
- }, na = (e) => Ce(e), sa = (e) => {
623
- if (!e || e.length === 0)
624
- return Ve;
625
- const a = e.filter(
626
- (o) => {
627
- var n, s;
628
- return ((n = o == null ? void 0 : o.message) == null ? void 0 : n.role) === Fe && typeof ((s = o == null ? void 0 : o.message) == null ? void 0 : s.processingTime) == "number";
629
- }
630
- ).map((o) => o.message.processingTime);
631
- return $e({
632
- data: a,
633
- formatter: na
634
- });
635
- }, ra = ({
636
- isAuthenticated: e,
637
- stats: a
638
- }) => {
639
- const { state: o } = _(Z), n = Ge - Number(o == null ? void 0 : o.usage), s = K(), r = K();
640
- return e ? /* @__PURE__ */ d(w, { children: [
641
- o && o.messages.length > 0 && /* @__PURE__ */ t("div", { className: "mb-4", children: /* @__PURE__ */ t(
642
- R,
643
- {
644
- header: f.CURRENT_STATISTICS.TITLE,
645
- className: "prose-dark dark:prose-lighter",
646
- children: j(s, {
647
- [f.CURRENT_STATISTICS.MODEL_NAME]: (o == null ? void 0 : o.model) || Be,
648
- [f.CURRENT_STATISTICS.TOKENS_USED]: o == null ? void 0 : o.usage,
649
- [f.CURRENT_STATISTICS.REMAINING_TOKENS]: Pe.format(n),
650
- [f.CURRENT_STATISTICS.PROCESSING_TIME]: sa(o == null ? void 0 : o.messages)
651
- })
652
- }
653
- ) }),
654
- /* @__PURE__ */ t(
655
- R,
656
- {
657
- header: f.MAIN_STATISTICS.TITLE,
658
- className: "prose-dark dark:prose-lighter",
659
- children: j(r, {
660
- [Q(f.MAIN_STATISTICS.TOTAL, a.totalChats)]: a.totalChats,
661
- [f.MAIN_STATISTICS.PROCESSING_TIME]: Ce(
662
- a.averageProcessingTimes
663
- )
664
- })
665
- }
666
- )
667
- ] }) : null;
668
- }, ca = ({
669
- open: e,
670
- onOpenChange: a
671
- }) => {
672
- const [o, n] = T({
673
- averageProcessingTimes: 0,
674
- totalChats: 0
675
- }), { isAuthenticated: s, getAccessToken: r, user: l } = V();
676
- return D(() => {
677
- !e || !l || (async () => {
678
- try {
679
- const m = await H({
680
- accessToken: await r(),
681
- type: L.GET_CHATS_STATS,
682
- params: {
683
- userId: l.username
684
- }
685
- });
686
- m.status === 200 && n(m.data);
687
- } catch {
688
- }
689
- })();
690
- }, [e, r, l]), /* @__PURE__ */ t(F, { open: e, onOpenChange: a, title: Te, children: /* @__PURE__ */ t(ra, { isAuthenticated: s, stats: o }) });
691
- }, xe = ({
692
- showConfirmation: e,
693
- setShowConfirmation: a,
694
- action: o,
695
- children: n,
696
- customStrings: s
697
- }) => /* @__PURE__ */ t(
698
- F,
699
- {
700
- kind: "messagebox",
701
- open: e,
702
- onOpenChange: a,
703
- title: s.title,
704
- footer: /* @__PURE__ */ d(re, { columnGap: 2, alignHorizontal: "flex-end", children: [
705
- /* @__PURE__ */ t(P, { children: /* @__PURE__ */ t(
706
- z,
707
- {
708
- mode: "dark",
709
- variant: "secondary",
710
- focusMode: "light",
711
- onClick: () => {
712
- a(!1);
713
- },
714
- children: s.cancelAction
715
- }
716
- ) }),
717
- /* @__PURE__ */ t(P, { children: /* @__PURE__ */ t(
718
- z,
719
- {
720
- mode: "dark",
721
- variant: "danger",
722
- focusMode: "light",
723
- onClick: () => {
724
- a(!1), o();
725
- },
726
- children: s.confirmAction
727
- }
728
- ) })
729
- ] }),
730
- children: n
731
- }
732
- );
733
- var ia = typeof window < "u", la = function(e, a) {
734
- return ia ? 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);
735
- }, da = function(e, a) {
736
- var o = T(la(e)), n = o[0], s = o[1];
737
- return D(function() {
738
- var r = !0, l = window.matchMedia(e), m = function() {
739
- r && s(!!l.matches);
740
- };
741
- return l.addEventListener("change", m), s(l.matches), function() {
742
- r = !1, l.removeEventListener("change", m);
743
- };
744
- }, [e]), n;
745
- };
746
- const ua = async (e, a, o, n) => {
747
- try {
748
- const s = await H({
749
- accessToken: n,
750
- type: L.GET_CHAT,
751
- params: {
752
- id: e.id
753
- }
754
- });
755
- s.status === 200 && (a({
756
- type: je
757
- }), a({
758
- type: Ye,
759
- payload: {
760
- id: e.id,
761
- model: s.data.model,
762
- usage: s.data.usage,
763
- messages: s.data.messages
764
- }
765
- }), o(!1));
766
- } catch {
767
- }
768
- }, fe = (e) => {
769
- const a = e[0];
770
- return Ke(a == null ? void 0 : a.content, 100);
771
- }, ma = ({
772
- filteredHistory: e,
773
- setFilteredHistory: a,
774
- dispatch: o,
775
- onOpenChange: n
776
- }) => {
777
- var k;
778
- const { user: s, getAccessToken: r } = V(), l = Y({
779
- id: 0,
780
- timestamp: "",
781
- message: ""
782
- }), [m, c] = T(!1), i = da("(min-width: 480px)"), { state: u, dispatch: g } = _(Se), [, N] = ie({
783
- key: ce + Ue,
784
- initialValue: u.sortDirection
785
- }), C = e.data.sort(
786
- (h, S) => {
787
- switch (u.sortedCell) {
788
- case "timestamp":
789
- if (u.sortDirection === x.ASC)
790
- return new Date(h[u.sortedCell]).getTime() - new Date(S[u.sortedCell]).getTime();
791
- if (u.sortDirection === x.DESC)
792
- return new Date(S[u.sortedCell]).getTime() - new Date(h[u.sortedCell]).getTime();
793
- break;
794
- default:
795
- return 0;
796
- }
797
- return 0;
798
- }
799
- ), p = (h) => {
800
- switch (u.sortDirection) {
801
- case !1:
802
- N(x.ASC), g({
803
- type: ae,
804
- payload: {
805
- sortedCell: h,
806
- sortDirection: x.ASC
807
- }
808
- });
809
- break;
810
- case x.ASC:
811
- N(x.DESC), g({
812
- type: ae,
813
- payload: {
814
- sortedCell: h,
815
- sortDirection: x.DESC
816
- }
817
- });
818
- break;
819
- default:
820
- N(x.ASC), g({
821
- type: ae,
822
- payload: {
823
- sortedCell: h,
824
- sortDirection: x.ASC
825
- }
826
- });
827
- break;
828
- }
829
- };
830
- return /* @__PURE__ */ d(w, { children: [
831
- /* @__PURE__ */ d(
832
- xe,
833
- {
834
- showConfirmation: m,
835
- setShowConfirmation: c,
836
- action: async () => {
837
- const h = l.current;
838
- try {
839
- const S = await H({
840
- accessToken: await r(),
841
- type: L.DELETE_CHAT,
842
- params: {
843
- userId: (s == null ? void 0 : s.username) || "",
844
- id: h.id
845
- }
846
- });
847
- S.status === 200 && a({ data: S.data });
848
- } catch {
849
- }
850
- },
851
- customStrings: {
852
- confirmAction: "Delete",
853
- cancelAction: "Cancel",
854
- title: "Delete chat"
855
- },
856
- children: [
857
- /* @__PURE__ */ t("p", { className: "m-0", children: "Are you sure you want to delete the following chat:" }),
858
- /* @__PURE__ */ d("ul", { className: "m-0", children: [
859
- /* @__PURE__ */ d("li", { children: [
860
- "Timestamp:",
861
- " ",
862
- /* @__PURE__ */ t("span", { className: "text-lg", children: l.current && l.current.timestamp })
863
- ] }),
864
- /* @__PURE__ */ d("li", { children: [
865
- "First message:",
866
- " ",
867
- /* @__PURE__ */ t("span", { className: "text-lg", children: (k = l.current) == null ? void 0 : k.message })
868
- ] })
869
- ] })
870
- ]
871
- }
872
- ),
873
- /* @__PURE__ */ d(it, { stickyHeader: !0, stickyFooter: !0, wrapperClassName: "max-h-[60vh]", children: [
874
- /* @__PURE__ */ t(lt, { children: /* @__PURE__ */ d(oe, { children: [
875
- i && /* @__PURE__ */ t(M, { className: "sr-only", children: "Row" }),
876
- /* @__PURE__ */ t(
877
- dt,
878
- {
879
- cellId: "timestamp",
880
- align: "left",
881
- sortDirection: u.sortDirection,
882
- sortedCell: u.sortedCell,
883
- onClick: () => {
884
- p("timestamp");
885
- },
886
- children: "Date"
887
- }
888
- ),
889
- /* @__PURE__ */ t(M, { children: "First message" }),
890
- /* @__PURE__ */ t(M, { className: "text-right", children: "Actions" })
891
- ] }) }),
892
- /* @__PURE__ */ t(ut, { children: C.map((h, S) => {
893
- var E;
894
- return ((E = h == null ? void 0 : h.messages) == null ? void 0 : E.length) > 0 ? /* @__PURE__ */ d(oe, { children: [
895
- i && /* @__PURE__ */ t(M, { children: S + 1 }),
896
- /* @__PURE__ */ t(
897
- M,
898
- {
899
- component: "th",
900
- scope: "row",
901
- className: "font-medium text-gray-400 sm:whitespace-nowrap",
902
- children: h.timestamp
903
- }
904
- ),
905
- /* @__PURE__ */ t(M, { className: "max-w-[100px] text-white sm:max-w-full", children: fe(h.messages) }),
906
- /* @__PURE__ */ t(M, { children: /* @__PURE__ */ d("div", { className: "flex justify-end gap-2", children: [
907
- /* @__PURE__ */ t(
908
- B,
909
- {
910
- focusMode: "alt-system",
911
- noBorder: !0,
912
- label: "Restore chat",
913
- onClick: async () => {
914
- const v = await r();
915
- ua(
916
- h,
917
- o,
918
- n,
919
- v
920
- );
921
- },
922
- children: /* @__PURE__ */ t(ea, { className: "h-3 w-3", monotone: !0 })
923
- }
924
- ),
925
- /* @__PURE__ */ t(
926
- B,
927
- {
928
- focusMode: "alt-system",
929
- noBorder: !0,
930
- label: "Delete chat",
931
- onClick: () => {
932
- l.current = {
933
- id: h.id,
934
- timestamp: h.timestamp,
935
- message: fe(h.messages)
936
- }, c(!m);
937
- },
938
- children: /* @__PURE__ */ t("div", { className: "text-red-400", children: /* @__PURE__ */ t(Xt, { className: "h-3 w-3", monotone: !0 }) })
939
- }
940
- )
941
- ] }) })
942
- ] }, `${f.HISTORY.TITLE}-${h.id}-${S}`) : null;
943
- }) }),
944
- /* @__PURE__ */ t(mt, { children: /* @__PURE__ */ t(oe, { children: /* @__PURE__ */ t(M, { colSpan: 4, children: /* @__PURE__ */ t("div", { children: Q(
945
- `${e.data.length} chat`,
946
- e.data.length
947
- ) }) }) }) })
948
- ] })
949
- ] });
950
- };
951
- function ge(e, a) {
952
- return a ? e.filter(
953
- (o) => o.messages.some(
954
- (n) => n.content !== null && n.content.toLowerCase().includes(a.toLowerCase())
955
- )
956
- ) : e;
957
- }
958
- const ha = ({
959
- onOpenChange: e,
960
- historyData: a
961
- }) => {
962
- const { isAuthenticated: o } = V(), n = Y(null), { dispatch: s } = _(Z), { state: r, dispatch: l } = _(Se), [, m] = ie({
963
- key: ce + We,
964
- initialValue: r.searchString
965
- }), c = rt(() => a, [a]), [i, u] = T({
966
- data: c
967
- }), g = (p) => {
968
- const y = ge(c, p);
969
- u({
970
- data: y
971
- }), m(p), l({
972
- type: qe,
973
- payload: { searchString: p }
974
- });
975
- }, N = (p) => {
976
- g(p.target.value);
977
- }, C = async (p) => {
978
- p.preventDefault();
979
- };
980
- return D(() => {
981
- const p = ge(
982
- a,
983
- r.searchString
984
- );
985
- u({
986
- data: p
987
- });
988
- }, [a, r.searchString]), o ? i && i.data && /* @__PURE__ */ d(w, { children: [
989
- /* @__PURE__ */ t("form", { autoComplete: "off", onSubmit: C, children: /* @__PURE__ */ t(
990
- Xe,
991
- {
992
- ref: n,
993
- defaultValue: r.searchString,
994
- focusMode: "light",
995
- name: "Search",
996
- label: "Search",
997
- onChange: N,
998
- spacing: { t: 2, b: 2 },
999
- ...r.searchString && {
1000
- rightElement: /* @__PURE__ */ t(
1001
- z,
1002
- {
1003
- disabled: !r.searchString,
1004
- mode: "dark",
1005
- noBorder: !0,
1006
- size: "small",
1007
- onClick: () => {
1008
- var p;
1009
- g(""), (p = n.current) != null && p.value && (n.current.value = "", n.current.focus());
1010
- },
1011
- children: "Reset"
1012
- }
1013
- )
1014
- }
1015
- }
1016
- ) }),
1017
- /* @__PURE__ */ t("div", { className: "flex flex-col gap-2 sm:flex-row", children: /* @__PURE__ */ t(
1018
- ma,
1019
- {
1020
- filteredHistory: i,
1021
- setFilteredHistory: u,
1022
- dispatch: s,
1023
- onOpenChange: e
1024
- }
1025
- ) })
1026
- ] }) : null;
1027
- }, pa = ({
1028
- open: e,
1029
- onOpenChange: a,
1030
- historyData: o
1031
- }) => /* @__PURE__ */ t(F, { open: e, onOpenChange: a, title: Je, children: /* @__PURE__ */ t(ha, { onOpenChange: a, historyData: o }) }), fa = ({
1032
- open: e,
1033
- onOpenChange: a
1034
- }) => {
1035
- const { getAccessToken: o, user: n } = V(), [s, r] = T({
1036
- loaded: !1,
1037
- content: "",
1038
- loadingLocation: !1,
1039
- location: ""
1040
- }), l = async (c) => {
1041
- c.preventDefault();
1042
- try {
1043
- await H({
1044
- accessToken: await o(),
1045
- type: L.SET_CUSTOM_INSTRUCTIONS,
1046
- params: {
1047
- user: n == null ? void 0 : n.username,
1048
- instructions: s.content,
1049
- location: s.location
1050
- }
1051
- });
1052
- } catch {
1053
- }
1054
- }, m = async () => {
1055
- r((c) => ({
1056
- ...c,
1057
- location: "...",
1058
- loadingLocation: !0
1059
- }));
1060
- try {
1061
- const c = Date.now(), i = await Qe(), u = await H({
1062
- accessToken: await o(),
1063
- type: L.GET_LOCATION,
1064
- params: {
1065
- latitude: i.latitude,
1066
- longitude: i.longitude
1067
- }
1068
- }), N = Date.now() - c;
1069
- if (N < 2e3 && await new Promise((C) => setTimeout(C, 2e3 - N)), u.status === 200) {
1070
- const { city: C, state: p, country: y, displayName: k } = u.data, h = C && p && y ? `${C}, ${p}, ${y}` : k;
1071
- r((S) => ({
1072
- ...S,
1073
- loaded: !0,
1074
- location: h,
1075
- loadingLocation: !1
1076
- }));
1077
- } else
1078
- r((C) => ({
1079
- ...C,
1080
- loaded: !0,
1081
- location: "",
1082
- loadingLocation: !1
1083
- }));
1084
- } catch {
1085
- }
1086
- };
1087
- return D(() => {
1088
- if (!e || !n) {
1089
- r({
1090
- loaded: !1,
1091
- loadingLocation: !1,
1092
- content: "",
1093
- location: ""
1094
- });
1095
- return;
1096
- }
1097
- (async () => {
1098
- try {
1099
- const c = await H({
1100
- accessToken: await o(),
1101
- type: L.GET_CUSTOM_INSTRUCTIONS,
1102
- params: {
1103
- user: n.username
1104
- }
1105
- });
1106
- c.status === 200 && r((i) => ({
1107
- ...i,
1108
- loaded: !0,
1109
- content: c.data.instructions,
1110
- location: c.data.location
1111
- }));
1112
- } catch {
1113
- }
1114
- })();
1115
- }, [n, e]), /* @__PURE__ */ t(w, { children: s.loaded && /* @__PURE__ */ d(
1116
- F,
1117
- {
1118
- open: e,
1119
- onOpenChange: a,
1120
- title: "Engine Fine Tuning",
1121
- footer: /* @__PURE__ */ d(re, { columnGap: 2, alignHorizontal: "flex-end", children: [
1122
- /* @__PURE__ */ t(P, { children: /* @__PURE__ */ t(
1123
- z,
1124
- {
1125
- mode: "dark",
1126
- variant: "secondary",
1127
- focusMode: "light",
1128
- onClick: () => {
1129
- a(!1);
1130
- },
1131
- children: "Cancel"
1132
- }
1133
- ) }),
1134
- /* @__PURE__ */ t(P, { children: /* @__PURE__ */ t(
1135
- z,
1136
- {
1137
- mode: "dark",
1138
- variant: "danger",
1139
- focusMode: "light",
1140
- onClick: async (c) => {
1141
- a(!1), await l(c);
1142
- },
1143
- children: "Save"
1144
- }
1145
- ) })
1146
- ] }),
1147
- children: [
1148
- /* @__PURE__ */ d(
1149
- R,
1150
- {
1151
- header: "Custom Instructions",
1152
- className: "prose-dark dark:prose-lighter",
1153
- children: [
1154
- /* @__PURE__ */ t("p", { children: "What would you like Sassy Saint to know about you to provide better responses?" }),
1155
- /* @__PURE__ */ t(
1156
- he,
1157
- {
1158
- mode: "alt-system",
1159
- autoCapitalize: "off",
1160
- autoComplete: "off",
1161
- autoCorrect: "off",
1162
- name: "customInstructions",
1163
- label: "Custom Instructions",
1164
- value: s.content,
1165
- onChange: (c) => {
1166
- r((i) => ({
1167
- ...i,
1168
- loaded: !0,
1169
- content: c.target.value
1170
- }));
1171
- },
1172
- helperText: "Press ENTER to add a new line."
1173
- }
1174
- )
1175
- ]
1176
- }
1177
- ),
1178
- /* @__PURE__ */ d(
1179
- R,
1180
- {
1181
- header: "Location",
1182
- className: "prose-dark dark:prose-lighter",
1183
- spacing: { t: 4 },
1184
- children: [
1185
- /* @__PURE__ */ t("p", { children: "You can share your location to receive customized responses based on your area." }),
1186
- /* @__PURE__ */ t(
1187
- he,
1188
- {
1189
- mode: "alt-system",
1190
- name: "location",
1191
- label: "Location",
1192
- value: s.location,
1193
- onChange: (c) => {
1194
- r((i) => ({
1195
- ...i,
1196
- loaded: !0,
1197
- location: c.target.value
1198
- }));
1199
- },
1200
- helperText: "Enter your location or press auto-detect."
1201
- }
1202
- ),
1203
- /* @__PURE__ */ t(
1204
- z,
1205
- {
1206
- spacing: { t: 2 },
1207
- size: "small",
1208
- noBorder: !0,
1209
- disabled: s.loadingLocation,
1210
- onClick: m,
1211
- children: s.loadingLocation ? "Detecting..." : "Auto-detect"
1212
- }
1213
- )
1214
- ]
1215
- }
1216
- )
1217
- ]
1218
- }
1219
- ) });
1220
- }, ga = () => {
1221
- const { isAuthenticated: e, user: a, registeringForPasskey: o, authenticationType: n } = V(), [s, r] = ie({
1222
- key: ce + Ze,
1223
- initialValue: !1
1224
- }), [l, m] = T(!1), c = K(), i = (a == null ? void 0 : a.username) || "", u = (N) => {
1225
- r(N);
1226
- }, g = () => {
1227
- m(!l);
1228
- };
1229
- return e && i ? /* @__PURE__ */ d(w, { children: [
1230
- l && /* @__PURE__ */ t(
1231
- fa,
1232
- {
1233
- open: l,
1234
- onOpenChange: m
1235
- }
1236
- ),
1237
- /* @__PURE__ */ d(
1238
- R,
1239
- {
1240
- header: f.PREFERENCES.TITLE,
1241
- className: "prose-dark dark:prose-lighter",
1242
- children: [
1243
- j(c, {
1244
- [f.PREFERENCES.NAME]: i,
1245
- [f.PREFERENCES.EMAIL]: (a == null ? void 0 : a.email) || "",
1246
- [f.PREFERENCES.ENGINE_DETAILS]: /* @__PURE__ */ t(
1247
- Yt,
1248
- {
1249
- noBorder: !0,
1250
- labelHidden: !0,
1251
- label: f.PREFERENCES.ENGINE_DETAILS,
1252
- name: f.PREFERENCES.ENGINE_DETAILS,
1253
- onChange: u,
1254
- checked: s
1255
- }
1256
- )
1257
- }),
1258
- /* @__PURE__ */ t(
1259
- B,
1260
- {
1261
- spacing: { t: 2 },
1262
- size: "small",
1263
- onClick: g,
1264
- labelLeft: "Engine Fine Tuning",
1265
- children: /* @__PURE__ */ t(qt, { className: "size-3", monotone: !0 })
1266
- }
1267
- )
1268
- ]
1269
- }
1270
- ),
1271
- n !== et.PASSKEY && /* @__PURE__ */ d(
1272
- R,
1273
- {
1274
- spacing: { t: 4 },
1275
- className: "prose-dark dark:prose-lighter",
1276
- header: /* @__PURE__ */ t("h2", { className: "m-0", children: /* @__PURE__ */ d(re, { columnGap: 3, alignVertical: "center", children: [
1277
- /* @__PURE__ */ t(P, { children: /* @__PURE__ */ t(ue, { className: "size-8" }) }),
1278
- /* @__PURE__ */ t(P, { children: /* @__PURE__ */ t("div", { children: f.PREFERENCES.PASSKEY_TITLE }) })
1279
- ] }) }),
1280
- children: [
1281
- /* @__PURE__ */ t("p", { children: f.PREFERENCES.PASSKEY_INSTRUCTIONS }),
1282
- /* @__PURE__ */ t(
1283
- B,
1284
- {
1285
- size: "small",
1286
- spacing: { t: 2 },
1287
- onClick: o,
1288
- labelLeft: f.PREFERENCES.PASSKEY_BUTTON,
1289
- children: /* @__PURE__ */ t(ue, { className: "size-5", monotone: !0 })
1290
- }
1291
- )
1292
- ]
1293
- }
1294
- )
1295
- ] }) : null;
1296
- }, Ca = ({
1297
- open: e,
1298
- onOpenChange: a
1299
- }) => /* @__PURE__ */ t(F, { open: e, onOpenChange: a, title: tt, children: /* @__PURE__ */ t(ga, {}) }), ba = () => {
1300
- const { state: e } = _(Z), [a, o] = T(!1), [n, s] = T(!1), [r, l] = T(!1), [m, c] = T(!1), [i, u] = T([]), [g, N] = T(!1), [C, p] = T({
1301
- done: !1,
1302
- progress: !1,
1303
- timestamp: Date.now()
1304
- }), { logout: y, getAccessToken: k, user: h } = V(), S = () => {
1305
- o(!a);
1306
- }, E = () => {
1307
- s(!n);
1308
- }, v = () => {
1309
- l(!r);
1310
- }, ee = () => {
1311
- c(!m);
1312
- }, te = async (A) => {
1313
- const q = Date.now();
1314
- if (A && !(!h || !e || C.progress || C.done === !0 && q - C.timestamp < 5e3)) {
1315
- p({
1316
- done: !0,
1317
- progress: !0,
1318
- timestamp: q
1319
- });
1320
- try {
1321
- const $ = await H({
1322
- accessToken: await k(),
1323
- type: L.GET_CHATS,
1324
- params: {
1325
- userId: h.username
1326
- }
1327
- });
1328
- $.status === 200 && (u($.data), p({
1329
- done: !0,
1330
- progress: !1,
1331
- timestamp: Date.now()
1332
- }));
1333
- } catch {
1334
- p({
1335
- done: !0,
1336
- progress: !1,
1337
- timestamp: Date.now()
1338
- });
1339
- }
1340
- }
1341
- }, X = () => {
1342
- N(!g);
1343
- };
1344
- return /* @__PURE__ */ d(w, { children: [
1345
- /* @__PURE__ */ t(
1346
- xe,
1347
- {
1348
- showConfirmation: g,
1349
- setShowConfirmation: N,
1350
- action: y,
1351
- customStrings: {
1352
- confirmAction: me,
1353
- cancelAction: "Cancel",
1354
- title: me
1355
- },
1356
- children: /* @__PURE__ */ t("p", { children: "Are you sure you want to log out?" })
1357
- }
1358
- ),
1359
- /* @__PURE__ */ t(Ca, { open: a, onOpenChange: o }),
1360
- /* @__PURE__ */ t(ca, { open: n, onOpenChange: s }),
1361
- /* @__PURE__ */ t(
1362
- pa,
1363
- {
1364
- open: r,
1365
- onOpenChange: l,
1366
- historyData: i
1367
- }
1368
- ),
1369
- /* @__PURE__ */ t(oa, { open: m, onOpenChange: c }),
1370
- /* @__PURE__ */ t("div", { className: "relative", children: /* @__PURE__ */ t("div", { className: "absolute bottom-[-28px] right-[-7px]", children: /* @__PURE__ */ d(
1371
- ke,
1372
- {
1373
- mode: "dark",
1374
- focusMode: "light",
1375
- trigger: /* @__PURE__ */ t(B, { children: /* @__PURE__ */ t(ta, {}) }),
1376
- defaultPlacement: "bottom-end",
1377
- onOpenChange: te,
1378
- children: [
1379
- /* @__PURE__ */ t(
1380
- O,
1381
- {
1382
- label: "Profile",
1383
- onClick: S,
1384
- icon: /* @__PURE__ */ t(Zt, {})
1385
- }
1386
- ),
1387
- /* @__PURE__ */ t(
1388
- O,
1389
- {
1390
- label: Te,
1391
- onClick: E,
1392
- icon: /* @__PURE__ */ t(Wt, {})
1393
- }
1394
- ),
1395
- /* @__PURE__ */ t(
1396
- O,
1397
- {
1398
- label: "History",
1399
- onClick: v,
1400
- icon: /* @__PURE__ */ t(Jt, {})
1401
- }
1402
- ),
1403
- /* @__PURE__ */ t(
1404
- O,
1405
- {
1406
- label: "About",
1407
- onClick: ee,
1408
- icon: /* @__PURE__ */ t(Qt, {})
1409
- }
1410
- ),
1411
- e && e.id && !e.isComponent && /* @__PURE__ */ d(w, { children: [
1412
- /* @__PURE__ */ t(Mt, {}),
1413
- /* @__PURE__ */ t(
1414
- O,
1415
- {
1416
- label: "Log out",
1417
- onClick: X,
1418
- icon: /* @__PURE__ */ t("div", { className: "text-red-700", children: /* @__PURE__ */ t(Kt, { monotone: !0 }) })
1419
- }
1420
- )
1421
- ] })
1422
- ]
1423
- }
1424
- ) }) })
1425
- ] });
1426
- };
1427
- export {
1428
- ba as default
1429
- };