@versini/sassysaint 4.2.0 → 4.3.1
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.
- package/dist/chunks/App.C232zHGs.js +500 -0
- package/dist/chunks/LazyHeader.BcKwtFsD.js +1415 -0
- package/dist/chunks/{LazyMarkdownWithExtra.ewFAuyG5.js → LazyMarkdownWithExtra.CacXy27y.js} +1 -1
- package/dist/chunks/{LazyMessageAssistant.Brog9qTL.js → LazyMessageAssistant.9TRoCl8r.js} +4 -4
- package/dist/chunks/{index.BvXbpfqe.js → index.BlSrPZWf.js} +431 -456
- package/dist/chunks/{index.7JJYsiGN.DsnJzdm4.js → index.Bzt9pToY.DmOBHHnp.js} +2 -2
- package/dist/chunks/{useLocalStorage.DJIqD2i3.js → useLocalStorage.C4iGBmg7.js} +166 -156
- package/dist/components/SassySaint/SassySaint.js +1 -1
- package/dist/index.js +4 -4
- package/package.json +3 -3
- package/dist/chunks/App.C-MlCVQG.js +0 -570
- package/dist/chunks/LazyHeader.CpW4p3Sk.js +0 -1438
|
@@ -0,0 +1,1415 @@
|
|
|
1
|
+
import { jsxs as d, jsx as t, Fragment as w } from "react/jsx-runtime";
|
|
2
|
+
import { O as z, i$1 as le, N as de, p as De, o as Oe, g as v, N$1 as B, 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 O, LOCAL_STORAGE_PREFIX as ce, LOCAL_STORAGE_SORT as Ue, ACTION_RESET as je, ACTION_RESTORE as Ye, truncate as Ke, ACTION_SORT as oe, 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.BlSrPZWf.js";
|
|
3
|
+
import * as ne from "react";
|
|
4
|
+
import ot, { forwardRef as Ne, useState as T, useRef as Y, useContext as L, useEffect as _, Suspense as at, lazy as nt, useId as st, useMemo as rt } from "react";
|
|
5
|
+
import { g as ct, AppContext as Z, serviceCall as R, SERVICE_TYPES as H, HistoryContext as Se, E as ie, k as I, et as it, at as lt, lt as ae, J as M, ct as dt, st as ut, rt as mt, At as he } from "./useLocalStorage.C4iGBmg7.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 It, FloatingPortal as vt, FloatingFocusManager as xt, 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 o = e.type;
|
|
24
|
+
if (typeof o == "function" || typeof o == "object")
|
|
25
|
+
return o.displayName || o.name || "Component";
|
|
26
|
+
}
|
|
27
|
+
return "Element";
|
|
28
|
+
}, be = Ne(
|
|
29
|
+
({
|
|
30
|
+
trigger: e,
|
|
31
|
+
children: o,
|
|
32
|
+
label: a = "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 = L(se), E = Ee(), x = ht(), ee = ye(), { floatingStyles: te, refs: X, context: A } = pt({
|
|
41
|
+
nodeId: x,
|
|
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" }), ve = Et(A, { bubbles: !0 }), xe = 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, $, ve, xe, Ae]), Le = pe(e) === "Button" || pe(e) === "ButtonIcon", _e = ot.cloneElement(e, {
|
|
65
|
+
mode: l,
|
|
66
|
+
focusMode: m,
|
|
67
|
+
spacing: r,
|
|
68
|
+
noInternalClick: Le,
|
|
69
|
+
"aria-label": a,
|
|
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 _(() => {
|
|
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]), _(() => {
|
|
89
|
+
u && E && E.events.emit("menuopen", { nodeId: x });
|
|
90
|
+
}, [E, u, x]), /* @__PURE__ */ d(kt, { id: x, 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(It, { elementsRef: k, labelsRef: h, children: u && /* @__PURE__ */ t(vt, { children: /* @__PURE__ */ t(
|
|
103
|
+
xt,
|
|
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: o
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
) }) })
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
] });
|
|
124
|
+
}
|
|
125
|
+
), ke = Ne((e, o) => /* @__PURE__ */ t(At, { children: /* @__PURE__ */ t(be, { ...e, ref: o }) }));
|
|
126
|
+
ke.displayName = "Menu";
|
|
127
|
+
be.displayName = "MenuComponent";
|
|
128
|
+
const D = ne.forwardRef(({ label: e, disabled: o, icon: a, ...n }, s) => {
|
|
129
|
+
const r = ne.useContext(se), l = ye({ label: o ? 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: o,
|
|
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
|
+
a,
|
|
151
|
+
e && /* @__PURE__ */ t("span", { className: "pl-2", children: e })
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
});
|
|
156
|
+
D.displayName = "MenuItem";
|
|
157
|
+
const Mt = ({ className: e, ...o }) => {
|
|
158
|
+
const a = b(e, "my-1 border-t border-border-medium");
|
|
159
|
+
return /* @__PURE__ */ t("div", { className: a, ...o });
|
|
160
|
+
}, Rt = ({
|
|
161
|
+
className: e,
|
|
162
|
+
viewBox: o,
|
|
163
|
+
spacing: a,
|
|
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: o,
|
|
173
|
+
className: e,
|
|
174
|
+
spacing: a,
|
|
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: o,
|
|
182
|
+
borderMode: a
|
|
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`]: o === U,
|
|
186
|
+
[`${le} w-full sm:w-[95%] md:max-w-2xl`]: o === U && !e,
|
|
187
|
+
[`${de} rounded-lg border-2`]: o === J,
|
|
188
|
+
[`${de} w-[95%] sm:w-[50%] md:max-w-2xl`]: o === J && !e,
|
|
189
|
+
[`${e}`]: !!e,
|
|
190
|
+
"sm:border-border-dark": a === "dark" && o === U,
|
|
191
|
+
"sm:border-border-accent": a === "light" && o === U,
|
|
192
|
+
"border-border-dark": a === "dark" && o === J,
|
|
193
|
+
"border-border-accent": a === "light" && o === J
|
|
194
|
+
}),
|
|
195
|
+
content: "flex flex-grow flex-col py-2 sm:py-4 px-4",
|
|
196
|
+
footer: "flex flex-grow flex-col p-4",
|
|
197
|
+
header: "p-4 mb-0",
|
|
198
|
+
close: "p-4"
|
|
199
|
+
}), W = (e) => nt(
|
|
200
|
+
() => import("./index.Bzt9pToY.DmOBHHnp.js").then((o) => ({
|
|
201
|
+
default: o[e]
|
|
202
|
+
}))
|
|
203
|
+
), Lt = W("Modal"), _t = W("ModalClose"), Dt = W("ModalContent"), Ot = W("ModalDescription"), zt = W("ModalHeading"), F = ({
|
|
204
|
+
open: e,
|
|
205
|
+
onOpenChange: o,
|
|
206
|
+
title: a,
|
|
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 _(() => (e && (c.current = document.title, document.title = `${a} | ${c.current}`), () => {
|
|
215
|
+
e && (document.title = c.current);
|
|
216
|
+
}), [a, e]), /* @__PURE__ */ t(at, { fallback: /* @__PURE__ */ t("div", {}), children: e && /* @__PURE__ */ t(Lt, { open: e, onOpenChange: o, 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
|
+
z,
|
|
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: a })
|
|
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: o
|
|
273
|
+
}) => b({
|
|
274
|
+
border: !o,
|
|
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: o
|
|
282
|
+
}) => o ? "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: o,
|
|
294
|
+
labelHidden: a,
|
|
295
|
+
spacing: n,
|
|
296
|
+
noBorder: s
|
|
297
|
+
}) => ({
|
|
298
|
+
toggle: b(
|
|
299
|
+
Bt(),
|
|
300
|
+
$t({ mode: e, noBorder: s }),
|
|
301
|
+
Pt({ focusMode: o }),
|
|
302
|
+
Ft(),
|
|
303
|
+
Vt()
|
|
304
|
+
),
|
|
305
|
+
label: Gt({ mode: e, labelHidden: a }),
|
|
306
|
+
input: "peer sr-only",
|
|
307
|
+
wrapper: Ut({ spacing: n })
|
|
308
|
+
}), Yt = ({
|
|
309
|
+
checked: e = !1,
|
|
310
|
+
onChange: o,
|
|
311
|
+
label: a,
|
|
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
|
+
o == null || o(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: a })
|
|
341
|
+
] });
|
|
342
|
+
}, Kt = ({
|
|
343
|
+
className: e,
|
|
344
|
+
viewBox: o,
|
|
345
|
+
spacing: a,
|
|
346
|
+
title: n,
|
|
347
|
+
monotone: s,
|
|
348
|
+
...r
|
|
349
|
+
}) => /* @__PURE__ */ d(
|
|
350
|
+
v,
|
|
351
|
+
{
|
|
352
|
+
defaultViewBox: "0 0 512 512",
|
|
353
|
+
defaultClassName: "size-5",
|
|
354
|
+
viewBox: o,
|
|
355
|
+
className: e,
|
|
356
|
+
spacing: a,
|
|
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: o,
|
|
373
|
+
spacing: a,
|
|
374
|
+
title: n,
|
|
375
|
+
monotone: s,
|
|
376
|
+
...r
|
|
377
|
+
}) => /* @__PURE__ */ d(
|
|
378
|
+
v,
|
|
379
|
+
{
|
|
380
|
+
defaultViewBox: "0 0 448 512",
|
|
381
|
+
defaultClassName: "size-5",
|
|
382
|
+
viewBox: o,
|
|
383
|
+
className: e,
|
|
384
|
+
spacing: a,
|
|
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: o,
|
|
401
|
+
spacing: a,
|
|
402
|
+
title: n,
|
|
403
|
+
monotone: s,
|
|
404
|
+
...r
|
|
405
|
+
}) => /* @__PURE__ */ d(
|
|
406
|
+
v,
|
|
407
|
+
{
|
|
408
|
+
defaultViewBox: "0 0 448 512",
|
|
409
|
+
defaultClassName: "size-5",
|
|
410
|
+
viewBox: o,
|
|
411
|
+
className: e,
|
|
412
|
+
spacing: a,
|
|
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: o,
|
|
429
|
+
spacing: a,
|
|
430
|
+
title: n,
|
|
431
|
+
monotone: s,
|
|
432
|
+
...r
|
|
433
|
+
}) => /* @__PURE__ */ d(
|
|
434
|
+
v,
|
|
435
|
+
{
|
|
436
|
+
defaultViewBox: "0 0 512 512",
|
|
437
|
+
defaultClassName: "size-5",
|
|
438
|
+
viewBox: o,
|
|
439
|
+
className: e,
|
|
440
|
+
spacing: a,
|
|
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: o,
|
|
457
|
+
spacing: a,
|
|
458
|
+
title: n,
|
|
459
|
+
monotone: s,
|
|
460
|
+
...r
|
|
461
|
+
}) => /* @__PURE__ */ d(
|
|
462
|
+
v,
|
|
463
|
+
{
|
|
464
|
+
defaultViewBox: "0 0 512 512",
|
|
465
|
+
defaultClassName: "size-5",
|
|
466
|
+
viewBox: o,
|
|
467
|
+
className: e,
|
|
468
|
+
spacing: a,
|
|
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: o,
|
|
485
|
+
spacing: a,
|
|
486
|
+
title: n,
|
|
487
|
+
monotone: s,
|
|
488
|
+
...r
|
|
489
|
+
}) => /* @__PURE__ */ d(
|
|
490
|
+
v,
|
|
491
|
+
{
|
|
492
|
+
defaultViewBox: "0 0 512 512",
|
|
493
|
+
defaultClassName: "size-5",
|
|
494
|
+
viewBox: o,
|
|
495
|
+
className: e,
|
|
496
|
+
spacing: a,
|
|
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: o,
|
|
513
|
+
spacing: a,
|
|
514
|
+
title: n,
|
|
515
|
+
monotone: s,
|
|
516
|
+
...r
|
|
517
|
+
}) => /* @__PURE__ */ d(
|
|
518
|
+
v,
|
|
519
|
+
{
|
|
520
|
+
defaultViewBox: "0 0 576 512",
|
|
521
|
+
defaultClassName: "size-5",
|
|
522
|
+
viewBox: o,
|
|
523
|
+
className: e,
|
|
524
|
+
spacing: a,
|
|
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
|
+
), eo = ({
|
|
539
|
+
className: e,
|
|
540
|
+
viewBox: o,
|
|
541
|
+
spacing: a,
|
|
542
|
+
title: n,
|
|
543
|
+
monotone: s,
|
|
544
|
+
...r
|
|
545
|
+
}) => /* @__PURE__ */ d(
|
|
546
|
+
v,
|
|
547
|
+
{
|
|
548
|
+
defaultViewBox: "0 0 512 512",
|
|
549
|
+
defaultClassName: "size-5",
|
|
550
|
+
viewBox: o,
|
|
551
|
+
className: e,
|
|
552
|
+
spacing: a,
|
|
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
|
+
), to = ({
|
|
567
|
+
className: e,
|
|
568
|
+
viewBox: o,
|
|
569
|
+
spacing: a,
|
|
570
|
+
title: n,
|
|
571
|
+
monotone: s,
|
|
572
|
+
...r
|
|
573
|
+
}) => /* @__PURE__ */ t(
|
|
574
|
+
v,
|
|
575
|
+
{
|
|
576
|
+
defaultViewBox: "0 0 448 512",
|
|
577
|
+
defaultClassName: "size-5",
|
|
578
|
+
viewBox: o,
|
|
579
|
+
className: e,
|
|
580
|
+
spacing: a,
|
|
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 oo = ({ stats: e }) => {
|
|
590
|
+
const o = (e == null ? void 0 : e.plugins) || [], a = (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
|
+
B,
|
|
594
|
+
{
|
|
595
|
+
header: f.ABOUT.TITLE_CLIENT,
|
|
596
|
+
className: "prose-dark dark:prose-lighter",
|
|
597
|
+
children: j(s, {
|
|
598
|
+
[f.ABOUT.VERSION]: "4.3.1",
|
|
599
|
+
[f.ABOUT.BUILD_TIMESTAMP]: "09/06/2024 06:47 PM EDT"
|
|
600
|
+
})
|
|
601
|
+
}
|
|
602
|
+
) }),
|
|
603
|
+
/* @__PURE__ */ t(
|
|
604
|
+
B,
|
|
605
|
+
{
|
|
606
|
+
header: f.ABOUT.TITLE_SERVER,
|
|
607
|
+
className: "prose-dark dark:prose-lighter",
|
|
608
|
+
children: j(r, {
|
|
609
|
+
[f.ABOUT.VERSION]: a,
|
|
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, o.length)]: /* @__PURE__ */ t(w, { children: o.map((l) => /* @__PURE__ */ t("div", { className: "text-right", children: l }, l)) })
|
|
612
|
+
})
|
|
613
|
+
}
|
|
614
|
+
)
|
|
615
|
+
] });
|
|
616
|
+
}, ao = ({
|
|
617
|
+
open: e,
|
|
618
|
+
onOpenChange: o
|
|
619
|
+
}) => {
|
|
620
|
+
const { serverStats: a } = L(Z);
|
|
621
|
+
return /* @__PURE__ */ t(F, { open: e, onOpenChange: o, title: ze, children: /* @__PURE__ */ t(oo, { stats: a }) });
|
|
622
|
+
}, no = (e) => Ce(e), so = (e) => {
|
|
623
|
+
if (!e || e.length === 0)
|
|
624
|
+
return Ve;
|
|
625
|
+
const o = e.filter(
|
|
626
|
+
(a) => {
|
|
627
|
+
var n, s;
|
|
628
|
+
return ((n = a == null ? void 0 : a.message) == null ? void 0 : n.role) === Fe && typeof ((s = a == null ? void 0 : a.message) == null ? void 0 : s.processingTime) == "number";
|
|
629
|
+
}
|
|
630
|
+
).map((a) => a.message.processingTime);
|
|
631
|
+
return $e({
|
|
632
|
+
data: o,
|
|
633
|
+
formatter: no
|
|
634
|
+
});
|
|
635
|
+
}, ro = ({
|
|
636
|
+
isAuthenticated: e,
|
|
637
|
+
stats: o
|
|
638
|
+
}) => {
|
|
639
|
+
const { state: a } = L(Z), n = Ge - Number(a == null ? void 0 : a.usage), s = K(), r = K();
|
|
640
|
+
return e ? /* @__PURE__ */ d(w, { children: [
|
|
641
|
+
a && a.messages.length > 0 && /* @__PURE__ */ t("div", { className: "mb-4", children: /* @__PURE__ */ t(
|
|
642
|
+
B,
|
|
643
|
+
{
|
|
644
|
+
header: f.CURRENT_STATISTICS.TITLE,
|
|
645
|
+
className: "prose-dark dark:prose-lighter",
|
|
646
|
+
children: j(s, {
|
|
647
|
+
[f.CURRENT_STATISTICS.MODEL_NAME]: (a == null ? void 0 : a.model) || Be,
|
|
648
|
+
[f.CURRENT_STATISTICS.TOKENS_USED]: a == null ? void 0 : a.usage,
|
|
649
|
+
[f.CURRENT_STATISTICS.REMAINING_TOKENS]: Pe.format(n),
|
|
650
|
+
[f.CURRENT_STATISTICS.PROCESSING_TIME]: so(a == null ? void 0 : a.messages)
|
|
651
|
+
})
|
|
652
|
+
}
|
|
653
|
+
) }),
|
|
654
|
+
/* @__PURE__ */ t(
|
|
655
|
+
B,
|
|
656
|
+
{
|
|
657
|
+
header: f.MAIN_STATISTICS.TITLE,
|
|
658
|
+
className: "prose-dark dark:prose-lighter",
|
|
659
|
+
children: j(r, {
|
|
660
|
+
[Q(f.MAIN_STATISTICS.TOTAL, o.totalChats)]: o.totalChats,
|
|
661
|
+
[f.MAIN_STATISTICS.PROCESSING_TIME]: Ce(
|
|
662
|
+
o.averageProcessingTimes
|
|
663
|
+
)
|
|
664
|
+
})
|
|
665
|
+
}
|
|
666
|
+
)
|
|
667
|
+
] }) : null;
|
|
668
|
+
}, co = ({
|
|
669
|
+
open: e,
|
|
670
|
+
onOpenChange: o
|
|
671
|
+
}) => {
|
|
672
|
+
const [a, n] = T({
|
|
673
|
+
averageProcessingTimes: 0,
|
|
674
|
+
totalChats: 0
|
|
675
|
+
}), { isAuthenticated: s, getAccessToken: r, user: l } = V();
|
|
676
|
+
return _(() => {
|
|
677
|
+
!e || !l || (async () => {
|
|
678
|
+
try {
|
|
679
|
+
const m = await R({
|
|
680
|
+
accessToken: await r(),
|
|
681
|
+
type: H.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: o, title: Te, children: /* @__PURE__ */ t(ro, { isAuthenticated: s, stats: a }) });
|
|
691
|
+
}, Ie = ({
|
|
692
|
+
showConfirmation: e,
|
|
693
|
+
setShowConfirmation: o,
|
|
694
|
+
action: a,
|
|
695
|
+
children: n,
|
|
696
|
+
customStrings: s
|
|
697
|
+
}) => /* @__PURE__ */ t(
|
|
698
|
+
F,
|
|
699
|
+
{
|
|
700
|
+
kind: "messagebox",
|
|
701
|
+
open: e,
|
|
702
|
+
onOpenChange: o,
|
|
703
|
+
title: s.title,
|
|
704
|
+
footer: /* @__PURE__ */ d(re, { columnGap: 2, alignHorizontal: "flex-end", children: [
|
|
705
|
+
/* @__PURE__ */ t(P, { children: /* @__PURE__ */ t(
|
|
706
|
+
O,
|
|
707
|
+
{
|
|
708
|
+
mode: "dark",
|
|
709
|
+
variant: "secondary",
|
|
710
|
+
focusMode: "light",
|
|
711
|
+
onClick: () => {
|
|
712
|
+
o(!1);
|
|
713
|
+
},
|
|
714
|
+
children: s.cancelAction
|
|
715
|
+
}
|
|
716
|
+
) }),
|
|
717
|
+
/* @__PURE__ */ t(P, { children: /* @__PURE__ */ t(
|
|
718
|
+
O,
|
|
719
|
+
{
|
|
720
|
+
mode: "dark",
|
|
721
|
+
variant: "danger",
|
|
722
|
+
focusMode: "light",
|
|
723
|
+
onClick: () => {
|
|
724
|
+
o(!1), a();
|
|
725
|
+
},
|
|
726
|
+
children: s.confirmAction
|
|
727
|
+
}
|
|
728
|
+
) })
|
|
729
|
+
] }),
|
|
730
|
+
children: n
|
|
731
|
+
}
|
|
732
|
+
);
|
|
733
|
+
var io = typeof window < "u", lo = function(e, o) {
|
|
734
|
+
return io ? 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
|
+
}, uo = function(e, o) {
|
|
736
|
+
var a = T(lo(e)), n = a[0], s = a[1];
|
|
737
|
+
return _(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 mo = async (e, o, a, n) => {
|
|
747
|
+
try {
|
|
748
|
+
const s = await R({
|
|
749
|
+
accessToken: n,
|
|
750
|
+
type: H.GET_CHAT,
|
|
751
|
+
params: {
|
|
752
|
+
id: e.id
|
|
753
|
+
}
|
|
754
|
+
});
|
|
755
|
+
s.status === 200 && (o({
|
|
756
|
+
type: je
|
|
757
|
+
}), o({
|
|
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
|
+
}), a(!1));
|
|
766
|
+
} catch {
|
|
767
|
+
}
|
|
768
|
+
}, fe = (e) => {
|
|
769
|
+
const o = e[0];
|
|
770
|
+
return Ke(o == null ? void 0 : o.content, 100);
|
|
771
|
+
}, ho = ({
|
|
772
|
+
filteredHistory: e,
|
|
773
|
+
setFilteredHistory: o,
|
|
774
|
+
dispatch: a,
|
|
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 = uo("(min-width: 480px)"), { state: u, dispatch: g } = L(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 === I.ASC)
|
|
790
|
+
return new Date(h[u.sortedCell]).getTime() - new Date(S[u.sortedCell]).getTime();
|
|
791
|
+
if (u.sortDirection === I.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(I.ASC), g({
|
|
803
|
+
type: oe,
|
|
804
|
+
payload: {
|
|
805
|
+
sortedCell: h,
|
|
806
|
+
sortDirection: I.ASC
|
|
807
|
+
}
|
|
808
|
+
});
|
|
809
|
+
break;
|
|
810
|
+
case I.ASC:
|
|
811
|
+
N(I.DESC), g({
|
|
812
|
+
type: oe,
|
|
813
|
+
payload: {
|
|
814
|
+
sortedCell: h,
|
|
815
|
+
sortDirection: I.DESC
|
|
816
|
+
}
|
|
817
|
+
});
|
|
818
|
+
break;
|
|
819
|
+
default:
|
|
820
|
+
N(I.ASC), g({
|
|
821
|
+
type: oe,
|
|
822
|
+
payload: {
|
|
823
|
+
sortedCell: h,
|
|
824
|
+
sortDirection: I.ASC
|
|
825
|
+
}
|
|
826
|
+
});
|
|
827
|
+
break;
|
|
828
|
+
}
|
|
829
|
+
};
|
|
830
|
+
return /* @__PURE__ */ d(w, { children: [
|
|
831
|
+
/* @__PURE__ */ d(
|
|
832
|
+
Ie,
|
|
833
|
+
{
|
|
834
|
+
showConfirmation: m,
|
|
835
|
+
setShowConfirmation: c,
|
|
836
|
+
action: async () => {
|
|
837
|
+
const h = l.current;
|
|
838
|
+
try {
|
|
839
|
+
const S = await R({
|
|
840
|
+
accessToken: await r(),
|
|
841
|
+
type: H.DELETE_CHAT,
|
|
842
|
+
params: {
|
|
843
|
+
userId: (s == null ? void 0 : s.username) || "",
|
|
844
|
+
id: h.id
|
|
845
|
+
}
|
|
846
|
+
});
|
|
847
|
+
S.status === 200 && o({ 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(ae, { 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(ae, { 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
|
+
z,
|
|
909
|
+
{
|
|
910
|
+
focusMode: "alt-system",
|
|
911
|
+
noBorder: !0,
|
|
912
|
+
label: "Restore chat",
|
|
913
|
+
onClick: async () => {
|
|
914
|
+
const x = await r();
|
|
915
|
+
mo(
|
|
916
|
+
h,
|
|
917
|
+
a,
|
|
918
|
+
n,
|
|
919
|
+
x
|
|
920
|
+
);
|
|
921
|
+
},
|
|
922
|
+
children: /* @__PURE__ */ t(eo, { className: "h-3 w-3", monotone: !0 })
|
|
923
|
+
}
|
|
924
|
+
),
|
|
925
|
+
/* @__PURE__ */ t(
|
|
926
|
+
z,
|
|
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(ae, { 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, o) {
|
|
952
|
+
return o ? e.filter(
|
|
953
|
+
(a) => a.messages.some(
|
|
954
|
+
(n) => n.content !== null && n.content.toLowerCase().includes(o.toLowerCase())
|
|
955
|
+
)
|
|
956
|
+
) : e;
|
|
957
|
+
}
|
|
958
|
+
const po = ({
|
|
959
|
+
onOpenChange: e,
|
|
960
|
+
historyData: o
|
|
961
|
+
}) => {
|
|
962
|
+
const { isAuthenticated: a } = V(), n = Y(null), { dispatch: s } = L(Z), { state: r, dispatch: l } = L(Se), [, m] = ie({
|
|
963
|
+
key: ce + We,
|
|
964
|
+
initialValue: r.searchString
|
|
965
|
+
}), c = rt(() => o, [o]), [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 _(() => {
|
|
981
|
+
const p = ge(
|
|
982
|
+
o,
|
|
983
|
+
r.searchString
|
|
984
|
+
);
|
|
985
|
+
u({
|
|
986
|
+
data: p
|
|
987
|
+
});
|
|
988
|
+
}, [o, r.searchString]), a ? 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
|
+
O,
|
|
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
|
+
ho,
|
|
1019
|
+
{
|
|
1020
|
+
filteredHistory: i,
|
|
1021
|
+
setFilteredHistory: u,
|
|
1022
|
+
dispatch: s,
|
|
1023
|
+
onOpenChange: e
|
|
1024
|
+
}
|
|
1025
|
+
) })
|
|
1026
|
+
] }) : null;
|
|
1027
|
+
}, fo = ({
|
|
1028
|
+
open: e,
|
|
1029
|
+
onOpenChange: o,
|
|
1030
|
+
historyData: a
|
|
1031
|
+
}) => /* @__PURE__ */ t(F, { open: e, onOpenChange: o, title: Je, children: /* @__PURE__ */ t(po, { onOpenChange: o, historyData: a }) }), go = ({
|
|
1032
|
+
open: e,
|
|
1033
|
+
onOpenChange: o
|
|
1034
|
+
}) => {
|
|
1035
|
+
const { getAccessToken: a, 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 R({
|
|
1044
|
+
accessToken: await a(),
|
|
1045
|
+
type: H.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 R({
|
|
1062
|
+
accessToken: await a(),
|
|
1063
|
+
type: H.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 _(() => {
|
|
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 R({
|
|
1100
|
+
accessToken: await a(),
|
|
1101
|
+
type: H.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: o,
|
|
1120
|
+
title: "Engine Fine Tuning",
|
|
1121
|
+
footer: /* @__PURE__ */ d(re, { columnGap: 2, alignHorizontal: "flex-end", children: [
|
|
1122
|
+
/* @__PURE__ */ t(P, { children: /* @__PURE__ */ t(
|
|
1123
|
+
O,
|
|
1124
|
+
{
|
|
1125
|
+
mode: "dark",
|
|
1126
|
+
variant: "secondary",
|
|
1127
|
+
focusMode: "light",
|
|
1128
|
+
onClick: () => {
|
|
1129
|
+
o(!1);
|
|
1130
|
+
},
|
|
1131
|
+
children: "Cancel"
|
|
1132
|
+
}
|
|
1133
|
+
) }),
|
|
1134
|
+
/* @__PURE__ */ t(P, { children: /* @__PURE__ */ t(
|
|
1135
|
+
O,
|
|
1136
|
+
{
|
|
1137
|
+
mode: "dark",
|
|
1138
|
+
variant: "danger",
|
|
1139
|
+
focusMode: "light",
|
|
1140
|
+
onClick: async (c) => {
|
|
1141
|
+
o(!1), await l(c);
|
|
1142
|
+
},
|
|
1143
|
+
children: "Save"
|
|
1144
|
+
}
|
|
1145
|
+
) })
|
|
1146
|
+
] }),
|
|
1147
|
+
children: [
|
|
1148
|
+
/* @__PURE__ */ t("h2", { className: "mt-0", children: "Custom Instructions" }),
|
|
1149
|
+
/* @__PURE__ */ t("p", { children: "What would you like Sassy Saint to know about you to provide better responses?" }),
|
|
1150
|
+
/* @__PURE__ */ t(
|
|
1151
|
+
he,
|
|
1152
|
+
{
|
|
1153
|
+
mode: "dark",
|
|
1154
|
+
focusMode: "light",
|
|
1155
|
+
autoCapitalize: "off",
|
|
1156
|
+
autoComplete: "off",
|
|
1157
|
+
autoCorrect: "off",
|
|
1158
|
+
name: "customInstructions",
|
|
1159
|
+
label: "Custom Instructions",
|
|
1160
|
+
value: s.content,
|
|
1161
|
+
onChange: (c) => {
|
|
1162
|
+
r((i) => ({
|
|
1163
|
+
...i,
|
|
1164
|
+
loaded: !0,
|
|
1165
|
+
content: c.target.value
|
|
1166
|
+
}));
|
|
1167
|
+
},
|
|
1168
|
+
helperText: "Press ENTER to add a new line."
|
|
1169
|
+
}
|
|
1170
|
+
),
|
|
1171
|
+
/* @__PURE__ */ t("h2", { children: "Location" }),
|
|
1172
|
+
/* @__PURE__ */ t("p", { children: "You can share your location to receive customized responses based on your area." }),
|
|
1173
|
+
/* @__PURE__ */ t(
|
|
1174
|
+
he,
|
|
1175
|
+
{
|
|
1176
|
+
mode: "dark",
|
|
1177
|
+
focusMode: "light",
|
|
1178
|
+
name: "location",
|
|
1179
|
+
label: "Location",
|
|
1180
|
+
value: s.location,
|
|
1181
|
+
onChange: (c) => {
|
|
1182
|
+
r((i) => ({
|
|
1183
|
+
...i,
|
|
1184
|
+
loaded: !0,
|
|
1185
|
+
location: c.target.value
|
|
1186
|
+
}));
|
|
1187
|
+
},
|
|
1188
|
+
helperText: "Enter your location or press auto-detect.",
|
|
1189
|
+
rightElement: /* @__PURE__ */ t(
|
|
1190
|
+
O,
|
|
1191
|
+
{
|
|
1192
|
+
size: "small",
|
|
1193
|
+
noBorder: !0,
|
|
1194
|
+
mode: "light",
|
|
1195
|
+
focusMode: "light",
|
|
1196
|
+
disabled: s.loadingLocation,
|
|
1197
|
+
onClick: m,
|
|
1198
|
+
children: s.loadingLocation ? "Detecting..." : "Auto-detect"
|
|
1199
|
+
}
|
|
1200
|
+
)
|
|
1201
|
+
}
|
|
1202
|
+
)
|
|
1203
|
+
]
|
|
1204
|
+
}
|
|
1205
|
+
) });
|
|
1206
|
+
}, Co = () => {
|
|
1207
|
+
const { isAuthenticated: e, user: o, registeringForPasskey: a, authenticationType: n } = V(), [s, r] = ie({
|
|
1208
|
+
key: ce + Ze,
|
|
1209
|
+
initialValue: !1
|
|
1210
|
+
}), [l, m] = T(!1), c = K(), i = (o == null ? void 0 : o.username) || "", u = (N) => {
|
|
1211
|
+
r(N);
|
|
1212
|
+
}, g = () => {
|
|
1213
|
+
m(!l);
|
|
1214
|
+
};
|
|
1215
|
+
return e && i ? /* @__PURE__ */ d(w, { children: [
|
|
1216
|
+
l && /* @__PURE__ */ t(
|
|
1217
|
+
go,
|
|
1218
|
+
{
|
|
1219
|
+
open: l,
|
|
1220
|
+
onOpenChange: m
|
|
1221
|
+
}
|
|
1222
|
+
),
|
|
1223
|
+
/* @__PURE__ */ d(
|
|
1224
|
+
B,
|
|
1225
|
+
{
|
|
1226
|
+
header: f.PREFERENCES.TITLE,
|
|
1227
|
+
className: "prose-dark dark:prose-lighter",
|
|
1228
|
+
children: [
|
|
1229
|
+
j(c, {
|
|
1230
|
+
[f.PREFERENCES.NAME]: i,
|
|
1231
|
+
[f.PREFERENCES.EMAIL]: (o == null ? void 0 : o.email) || "",
|
|
1232
|
+
[f.PREFERENCES.ENGINE_DETAILS]: /* @__PURE__ */ t(
|
|
1233
|
+
Yt,
|
|
1234
|
+
{
|
|
1235
|
+
noBorder: !0,
|
|
1236
|
+
labelHidden: !0,
|
|
1237
|
+
label: f.PREFERENCES.ENGINE_DETAILS,
|
|
1238
|
+
name: f.PREFERENCES.ENGINE_DETAILS,
|
|
1239
|
+
onChange: u,
|
|
1240
|
+
checked: s
|
|
1241
|
+
}
|
|
1242
|
+
)
|
|
1243
|
+
}),
|
|
1244
|
+
/* @__PURE__ */ t(
|
|
1245
|
+
z,
|
|
1246
|
+
{
|
|
1247
|
+
spacing: { t: 2 },
|
|
1248
|
+
size: "small",
|
|
1249
|
+
onClick: g,
|
|
1250
|
+
labelLeft: "Engine Fine Tuning",
|
|
1251
|
+
children: /* @__PURE__ */ t(qt, { className: "size-3", monotone: !0 })
|
|
1252
|
+
}
|
|
1253
|
+
)
|
|
1254
|
+
]
|
|
1255
|
+
}
|
|
1256
|
+
),
|
|
1257
|
+
n !== et.PASSKEY && /* @__PURE__ */ d(
|
|
1258
|
+
B,
|
|
1259
|
+
{
|
|
1260
|
+
spacing: { t: 4 },
|
|
1261
|
+
className: "prose-dark dark:prose-lighter",
|
|
1262
|
+
header: /* @__PURE__ */ t("h2", { className: "m-0", children: /* @__PURE__ */ d(re, { columnGap: 3, alignVertical: "center", children: [
|
|
1263
|
+
/* @__PURE__ */ t(P, { children: /* @__PURE__ */ t(ue, { className: "size-8" }) }),
|
|
1264
|
+
/* @__PURE__ */ t(P, { children: /* @__PURE__ */ t("div", { children: f.PREFERENCES.PASSKEY_TITLE }) })
|
|
1265
|
+
] }) }),
|
|
1266
|
+
children: [
|
|
1267
|
+
/* @__PURE__ */ t("p", { children: f.PREFERENCES.PASSKEY_INSTRUCTIONS }),
|
|
1268
|
+
/* @__PURE__ */ t(
|
|
1269
|
+
z,
|
|
1270
|
+
{
|
|
1271
|
+
size: "small",
|
|
1272
|
+
spacing: { t: 2 },
|
|
1273
|
+
onClick: a,
|
|
1274
|
+
labelLeft: f.PREFERENCES.PASSKEY_BUTTON,
|
|
1275
|
+
children: /* @__PURE__ */ t(ue, { className: "size-5", monotone: !0 })
|
|
1276
|
+
}
|
|
1277
|
+
)
|
|
1278
|
+
]
|
|
1279
|
+
}
|
|
1280
|
+
)
|
|
1281
|
+
] }) : null;
|
|
1282
|
+
}, To = ({
|
|
1283
|
+
open: e,
|
|
1284
|
+
onOpenChange: o
|
|
1285
|
+
}) => /* @__PURE__ */ t(F, { open: e, onOpenChange: o, title: tt, children: /* @__PURE__ */ t(Co, {}) }), ko = () => {
|
|
1286
|
+
const { state: e } = L(Z), [o, a] = T(!1), [n, s] = T(!1), [r, l] = T(!1), [m, c] = T(!1), [i, u] = T([]), [g, N] = T(!1), [C, p] = T({
|
|
1287
|
+
done: !1,
|
|
1288
|
+
progress: !1,
|
|
1289
|
+
timestamp: Date.now()
|
|
1290
|
+
}), { logout: y, getAccessToken: k, user: h } = V(), S = () => {
|
|
1291
|
+
a(!o);
|
|
1292
|
+
}, E = () => {
|
|
1293
|
+
s(!n);
|
|
1294
|
+
}, x = () => {
|
|
1295
|
+
l(!r);
|
|
1296
|
+
}, ee = () => {
|
|
1297
|
+
c(!m);
|
|
1298
|
+
}, te = async (A) => {
|
|
1299
|
+
const q = Date.now();
|
|
1300
|
+
if (A && !(!h || !e || C.progress || C.done === !0 && q - C.timestamp < 5e3)) {
|
|
1301
|
+
p({
|
|
1302
|
+
done: !0,
|
|
1303
|
+
progress: !0,
|
|
1304
|
+
timestamp: q
|
|
1305
|
+
});
|
|
1306
|
+
try {
|
|
1307
|
+
const $ = await R({
|
|
1308
|
+
accessToken: await k(),
|
|
1309
|
+
type: H.GET_CHATS,
|
|
1310
|
+
params: {
|
|
1311
|
+
userId: h.username
|
|
1312
|
+
}
|
|
1313
|
+
});
|
|
1314
|
+
$.status === 200 && (u($.data), p({
|
|
1315
|
+
done: !0,
|
|
1316
|
+
progress: !1,
|
|
1317
|
+
timestamp: Date.now()
|
|
1318
|
+
}));
|
|
1319
|
+
} catch {
|
|
1320
|
+
p({
|
|
1321
|
+
done: !0,
|
|
1322
|
+
progress: !1,
|
|
1323
|
+
timestamp: Date.now()
|
|
1324
|
+
});
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
}, X = () => {
|
|
1328
|
+
N(!g);
|
|
1329
|
+
};
|
|
1330
|
+
return /* @__PURE__ */ d(w, { children: [
|
|
1331
|
+
/* @__PURE__ */ t(
|
|
1332
|
+
Ie,
|
|
1333
|
+
{
|
|
1334
|
+
showConfirmation: g,
|
|
1335
|
+
setShowConfirmation: N,
|
|
1336
|
+
action: y,
|
|
1337
|
+
customStrings: {
|
|
1338
|
+
confirmAction: me,
|
|
1339
|
+
cancelAction: "Cancel",
|
|
1340
|
+
title: me
|
|
1341
|
+
},
|
|
1342
|
+
children: /* @__PURE__ */ t("p", { children: "Are you sure you want to log out?" })
|
|
1343
|
+
}
|
|
1344
|
+
),
|
|
1345
|
+
/* @__PURE__ */ t(To, { open: o, onOpenChange: a }),
|
|
1346
|
+
/* @__PURE__ */ t(co, { open: n, onOpenChange: s }),
|
|
1347
|
+
/* @__PURE__ */ t(
|
|
1348
|
+
fo,
|
|
1349
|
+
{
|
|
1350
|
+
open: r,
|
|
1351
|
+
onOpenChange: l,
|
|
1352
|
+
historyData: i
|
|
1353
|
+
}
|
|
1354
|
+
),
|
|
1355
|
+
/* @__PURE__ */ t(ao, { open: m, onOpenChange: c }),
|
|
1356
|
+
/* @__PURE__ */ t("div", { className: "relative", children: /* @__PURE__ */ t("div", { className: "absolute bottom-[-28px] right-[-7px]", children: /* @__PURE__ */ d(
|
|
1357
|
+
ke,
|
|
1358
|
+
{
|
|
1359
|
+
mode: "dark",
|
|
1360
|
+
focusMode: "light",
|
|
1361
|
+
trigger: /* @__PURE__ */ t(z, { children: /* @__PURE__ */ t(to, {}) }),
|
|
1362
|
+
defaultPlacement: "bottom-end",
|
|
1363
|
+
onOpenChange: te,
|
|
1364
|
+
children: [
|
|
1365
|
+
/* @__PURE__ */ t(
|
|
1366
|
+
D,
|
|
1367
|
+
{
|
|
1368
|
+
label: "Profile",
|
|
1369
|
+
onClick: S,
|
|
1370
|
+
icon: /* @__PURE__ */ t(Zt, {})
|
|
1371
|
+
}
|
|
1372
|
+
),
|
|
1373
|
+
/* @__PURE__ */ t(
|
|
1374
|
+
D,
|
|
1375
|
+
{
|
|
1376
|
+
label: Te,
|
|
1377
|
+
onClick: E,
|
|
1378
|
+
icon: /* @__PURE__ */ t(Wt, {})
|
|
1379
|
+
}
|
|
1380
|
+
),
|
|
1381
|
+
/* @__PURE__ */ t(
|
|
1382
|
+
D,
|
|
1383
|
+
{
|
|
1384
|
+
label: "History",
|
|
1385
|
+
onClick: x,
|
|
1386
|
+
icon: /* @__PURE__ */ t(Jt, {})
|
|
1387
|
+
}
|
|
1388
|
+
),
|
|
1389
|
+
/* @__PURE__ */ t(
|
|
1390
|
+
D,
|
|
1391
|
+
{
|
|
1392
|
+
label: "About",
|
|
1393
|
+
onClick: ee,
|
|
1394
|
+
icon: /* @__PURE__ */ t(Qt, {})
|
|
1395
|
+
}
|
|
1396
|
+
),
|
|
1397
|
+
e && e.id && !e.isComponent && /* @__PURE__ */ d(w, { children: [
|
|
1398
|
+
/* @__PURE__ */ t(Mt, {}),
|
|
1399
|
+
/* @__PURE__ */ t(
|
|
1400
|
+
D,
|
|
1401
|
+
{
|
|
1402
|
+
label: "Log out",
|
|
1403
|
+
onClick: X,
|
|
1404
|
+
icon: /* @__PURE__ */ t("div", { className: "text-red-700", children: /* @__PURE__ */ t(Kt, { monotone: !0 }) })
|
|
1405
|
+
}
|
|
1406
|
+
)
|
|
1407
|
+
] })
|
|
1408
|
+
]
|
|
1409
|
+
}
|
|
1410
|
+
) }) })
|
|
1411
|
+
] });
|
|
1412
|
+
};
|
|
1413
|
+
export {
|
|
1414
|
+
ko as default
|
|
1415
|
+
};
|