@versini/sassysaint 5.1.7 → 5.2.0

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