@versini/sassysaint 5.1.6 → 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.
@@ -0,0 +1,2756 @@
1
+ import { jsxs as v, jsx as r, Fragment as _ } from "react/jsx-runtime";
2
+ import { g as $, D as O, CARDS as w, renderDataAsList as le, pluralize as pe, AppContext as me, ABOUT_TITLE as Mt, DEFAULT_AI_ENGINE as se, numberFormatter as Lt, durationFormatter as Qe, NA as Ot, ROLE_ASSISTANT as Pt, extractAverage as Dt, GPT4_MAX_TOKENS as Bt, rn as te, STATS as et, b as Ae, j as ee, R as J, HistoryContext as tt, LOCAL_STORAGE_PREFIX as z, LOCAL_STORAGE_SORT as $t, O as Q, ACTION_RESET as Vt, ACTION_RESTORE as zt, truncate as Ht, ACTION_SORT as ke, LOCAL_STORAGE_SEARCH as Ft, me as Gt, ACTION_SEARCH as Ut, HISTORY_TITLE as jt, LOCAL_STORAGE_ENGINE_TOGGLE as ot, ENGINE_OPENAI as Ce, ENGINE_ANTHROPIC as Te, ACTION_ENGINE as rt, getCurrentGeoLocation as Kt, LOCAL_STORAGE_TAG_SUMMARIZE as $e, LOCAL_STORAGE_TAG_PROOFREAD as Ve, LOCAL_STORAGE_TAG_REPHRASE as ze, TAG_CONTENT as we, TAGS as Ee, LOCAL_STORAGE_CHAT_DETAILS as Wt, G as Yt, v as He, PROFILE_TITLE as Zt, LOG_OUT as Fe } from "./index.BbfwgIO_.js";
3
+ import { serviceCall as H, SERVICE_TYPES as F, E as G, f as D, ce as qt, ge as Xt, me as Ne, ie as V, ue as Jt, be as Qt, he as eo, we as Ge } from "./index.CGGeNJS3.js";
4
+ import * as f from "react";
5
+ import I, { useId as to, forwardRef as nt, useState as x, useRef as ce, useContext as B, useEffect as U, Suspense as oo, lazy as ro, useMemo as no } from "react";
6
+ import C from "clsx";
7
+ import { useFloatingTree as at, useFloatingNodeId as ao, useListItem as it, useFloating as io, offset as so, flip as lo, shift as co, autoUpdate as uo, useClick as mo, useRole as ho, useDismiss as go, useListNavigation as po, useTypeahead as fo, useInteractions as bo, useMergeRefs as st, FloatingNode as vo, FloatingList as yo, FloatingPortal as ko, FloatingFocusManager as Co, FloatingTree as To } from "@floating-ui/react";
8
+ const wo = ({
9
+ className: e,
10
+ viewBox: t,
11
+ spacing: o,
12
+ title: n,
13
+ monotone: a,
14
+ ...i
15
+ }) => /* @__PURE__ */ v(
16
+ $,
17
+ {
18
+ defaultViewBox: "0 0 512 512",
19
+ defaultClassName: "size-5",
20
+ viewBox: t,
21
+ className: e,
22
+ spacing: o,
23
+ title: n || "Back",
24
+ ...i,
25
+ children: [
26
+ /* @__PURE__ */ r(
27
+ "path",
28
+ {
29
+ opacity: a ? "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__ */ r("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
+ ), Eo = ({
37
+ className: e,
38
+ viewBox: t,
39
+ spacing: o,
40
+ title: n,
41
+ monotone: a,
42
+ ...i
43
+ }) => /* @__PURE__ */ v(
44
+ $,
45
+ {
46
+ defaultViewBox: "0 0 448 512",
47
+ defaultClassName: "size-5",
48
+ viewBox: t,
49
+ className: e,
50
+ spacing: o,
51
+ title: n || "Chart",
52
+ ...i,
53
+ children: [
54
+ /* @__PURE__ */ r(
55
+ "path",
56
+ {
57
+ opacity: a ? "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__ */ r("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
+ ), No = ({
65
+ className: e,
66
+ viewBox: t,
67
+ spacing: o,
68
+ title: n,
69
+ monotone: a,
70
+ ...i
71
+ }) => /* @__PURE__ */ v(
72
+ $,
73
+ {
74
+ defaultViewBox: "0 0 448 512",
75
+ defaultClassName: "size-5",
76
+ viewBox: t,
77
+ className: e,
78
+ spacing: o,
79
+ title: n || "Delete",
80
+ ...i,
81
+ children: [
82
+ /* @__PURE__ */ r(
83
+ "path",
84
+ {
85
+ opacity: a ? "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__ */ r("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
+ ), Ue = ({
93
+ className: e,
94
+ viewBox: t,
95
+ spacing: o,
96
+ title: n,
97
+ monotone: a,
98
+ ...i
99
+ }) => /* @__PURE__ */ v(
100
+ $,
101
+ {
102
+ defaultViewBox: "0 0 512 512",
103
+ defaultClassName: "size-5",
104
+ viewBox: t,
105
+ className: e,
106
+ spacing: o,
107
+ title: n || "Edit",
108
+ ...i,
109
+ children: [
110
+ /* @__PURE__ */ r(
111
+ "path",
112
+ {
113
+ opacity: a ? "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__ */ r("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
+ ), Io = ({
121
+ className: e,
122
+ viewBox: t,
123
+ spacing: o,
124
+ title: n,
125
+ monotone: a,
126
+ ...i
127
+ }) => /* @__PURE__ */ v(
128
+ $,
129
+ {
130
+ defaultViewBox: "0 0 512 512",
131
+ defaultClassName: "size-5",
132
+ viewBox: t,
133
+ className: e,
134
+ spacing: o,
135
+ title: n || "History",
136
+ ...i,
137
+ children: [
138
+ /* @__PURE__ */ r(
139
+ "path",
140
+ {
141
+ opacity: a ? "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__ */ r("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
+ ), So = ({
149
+ className: e,
150
+ viewBox: t,
151
+ spacing: o,
152
+ title: n,
153
+ monotone: a,
154
+ ...i
155
+ }) => /* @__PURE__ */ v(
156
+ $,
157
+ {
158
+ defaultViewBox: "0 0 512 512",
159
+ defaultClassName: "size-5",
160
+ viewBox: t,
161
+ className: e,
162
+ spacing: o,
163
+ title: n || "Info",
164
+ ...i,
165
+ children: [
166
+ /* @__PURE__ */ r(
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__ */ r("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
+ ), xo = ({
177
+ className: e,
178
+ viewBox: t,
179
+ spacing: o,
180
+ title: n,
181
+ monotone: a,
182
+ ...i
183
+ }) => /* @__PURE__ */ v(
184
+ $,
185
+ {
186
+ defaultViewBox: "0 0 576 512",
187
+ defaultClassName: "size-5",
188
+ viewBox: t,
189
+ className: e,
190
+ spacing: o,
191
+ title: n || "Profile",
192
+ ...i,
193
+ children: [
194
+ /* @__PURE__ */ r(
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__ */ r("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
+ ), _o = ({
205
+ className: e,
206
+ viewBox: t,
207
+ spacing: o,
208
+ title: n,
209
+ monotone: a,
210
+ ...i
211
+ }) => /* @__PURE__ */ v(
212
+ $,
213
+ {
214
+ defaultViewBox: "0 0 512 512",
215
+ defaultClassName: "size-5",
216
+ viewBox: t,
217
+ className: e,
218
+ spacing: o,
219
+ title: n || "Restore",
220
+ ...i,
221
+ children: [
222
+ /* @__PURE__ */ r(
223
+ "path",
224
+ {
225
+ opacity: a ? "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__ */ r("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
+ ), Ro = ({
233
+ className: e,
234
+ viewBox: t,
235
+ spacing: o,
236
+ title: n,
237
+ monotone: a,
238
+ ...i
239
+ }) => /* @__PURE__ */ r(
240
+ $,
241
+ {
242
+ defaultViewBox: "0 0 448 512",
243
+ defaultClassName: "size-5",
244
+ viewBox: t,
245
+ className: e,
246
+ spacing: o,
247
+ title: n || "Settings",
248
+ ...i,
249
+ children: /* @__PURE__ */ r("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
+ );
252
+ function de(e) {
253
+ return to();
254
+ }
255
+ const Se = f.createContext({
256
+ getItemProps: () => ({}),
257
+ activeIndex: null,
258
+ /* v8 ignore next 2 */
259
+ setActiveIndex: () => {
260
+ },
261
+ setHasFocusInside: () => {
262
+ },
263
+ isOpen: !1
264
+ }), je = (e) => {
265
+ if (typeof e == "string")
266
+ return e;
267
+ if (typeof e == "function")
268
+ return e.displayName || e.name || "Component";
269
+ if (typeof e == "object" && e !== null && "type" in e) {
270
+ const t = e.type;
271
+ if (typeof t == "function" || typeof t == "object")
272
+ return t.displayName || t.name || "Component";
273
+ }
274
+ return "Element";
275
+ }, lt = nt(
276
+ ({
277
+ trigger: e,
278
+ children: t,
279
+ label: o = "Open menu",
280
+ defaultPlacement: n = "bottom-start",
281
+ onOpenChange: a,
282
+ spacing: i,
283
+ mode: s = "system",
284
+ focusMode: l = "system",
285
+ ...h
286
+ }, u) => {
287
+ const [m, g] = x(!1), [b, d] = x(!1), [c, y] = x(null), T = ce([]), p = ce([]), k = B(Se), E = at(), S = ao(), M = it(), { floatingStyles: R, refs: P, context: N } = io({
288
+ nodeId: S,
289
+ open: m,
290
+ onOpenChange: (ae) => {
291
+ g(ae), a == null || a(ae);
292
+ },
293
+ placement: n,
294
+ strategy: "fixed",
295
+ middleware: [so({ mainAxis: 10 }), lo(), co()],
296
+ whileElementsMounted: uo
297
+ }), re = mo(N, {
298
+ event: "mousedown",
299
+ toggle: !0,
300
+ ignoreMouse: !1
301
+ }), X = ho(N, { role: "menu" }), j = go(N, { bubbles: !0 }), ne = po(N, {
302
+ listRef: T,
303
+ activeIndex: c,
304
+ nested: !1,
305
+ onNavigate: y,
306
+ loop: !0
307
+ }), L = fo(N, {
308
+ listRef: p,
309
+ onMatch: m ? y : void 0,
310
+ activeIndex: c
311
+ }), { getReferenceProps: K, getFloatingProps: A, getItemProps: _t } = bo([re, X, j, ne, L]), Be = je(e) === "Button" || je(e) === "ButtonIcon", Rt = Be ? {
312
+ noInternalClick: Be,
313
+ focusMode: l,
314
+ mode: s,
315
+ spacing: i
316
+ } : {}, At = I.cloneElement(e, {
317
+ ...Rt,
318
+ "aria-label": o,
319
+ "data-open": m ? "" : void 0,
320
+ "data-focus-inside": b ? "" : void 0,
321
+ ref: st([P.setReference, M.ref, u]),
322
+ ...K(
323
+ k.getItemProps({
324
+ ...h
325
+ })
326
+ )
327
+ });
328
+ return U(() => {
329
+ if (!E)
330
+ return;
331
+ function ae() {
332
+ g(!1), a == null || a(!1);
333
+ }
334
+ return E.events.on("click", ae), () => {
335
+ E.events.off("click", ae);
336
+ };
337
+ }, [E, a]), U(() => {
338
+ m && E && E.events.emit("menuopen", { nodeId: S });
339
+ }, [E, m, S]), /* @__PURE__ */ v(vo, { id: S, children: [
340
+ At,
341
+ /* @__PURE__ */ r(
342
+ Se.Provider,
343
+ {
344
+ value: {
345
+ activeIndex: c,
346
+ setActiveIndex: y,
347
+ getItemProps: _t,
348
+ setHasFocusInside: d,
349
+ isOpen: m
350
+ },
351
+ children: /* @__PURE__ */ r(yo, { elementsRef: T, labelsRef: p, children: m && /* @__PURE__ */ r(ko, { children: /* @__PURE__ */ r(
352
+ Co,
353
+ {
354
+ context: N,
355
+ modal: !1,
356
+ initialFocus: 0,
357
+ returnFocus: !0,
358
+ children: /* @__PURE__ */ r(
359
+ "div",
360
+ {
361
+ ref: P.setFloating,
362
+ className: "rounded-md bg-surface-light p-4 shadow-sm shadow-border-dark outline-none sm:p-2",
363
+ style: R,
364
+ ...A(),
365
+ children: t
366
+ }
367
+ )
368
+ }
369
+ ) }) })
370
+ }
371
+ )
372
+ ] });
373
+ }
374
+ ), ct = nt((e, t) => /* @__PURE__ */ r(To, { children: /* @__PURE__ */ r(lt, { ...e, ref: t }) }));
375
+ ct.displayName = "Menu";
376
+ lt.displayName = "MenuComponent";
377
+ const W = f.forwardRef(
378
+ ({
379
+ label: e,
380
+ disabled: t,
381
+ icon: o,
382
+ raw: n = !1,
383
+ children: a,
384
+ ignoreClick: i = !1,
385
+ ...s
386
+ }, l) => {
387
+ const h = f.useContext(Se), u = it({ label: t ? null : e }), m = at(), g = st([u.ref, l]);
388
+ return n && a ? /* @__PURE__ */ r(
389
+ "div",
390
+ {
391
+ role: "menuitem",
392
+ ...h.getItemProps({
393
+ onClick(b) {
394
+ var d;
395
+ i || ((d = s.onClick) == null || d.call(s, b), m == null || m.events.emit("click"));
396
+ }
397
+ }),
398
+ children: a
399
+ }
400
+ ) : /* @__PURE__ */ v(
401
+ "button",
402
+ {
403
+ ...s,
404
+ ref: g,
405
+ role: "menuitem",
406
+ 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",
407
+ tabIndex: 0,
408
+ disabled: t,
409
+ ...h.getItemProps({
410
+ onClick(b) {
411
+ var d;
412
+ i || ((d = s.onClick) == null || d.call(s, b), m == null || m.events.emit("click"));
413
+ },
414
+ onFocus(b) {
415
+ var d;
416
+ (d = s.onFocus) == null || d.call(s, b), h.setHasFocusInside(!0);
417
+ }
418
+ }),
419
+ children: [
420
+ o,
421
+ e && /* @__PURE__ */ r("span", { className: "pl-2", children: e })
422
+ ]
423
+ }
424
+ );
425
+ }
426
+ );
427
+ W.displayName = "MenuItem";
428
+ const Ke = ({ className: e, ...t }) => {
429
+ const o = C(e, "my-1 border-t border-border-medium");
430
+ return /* @__PURE__ */ r("div", { className: o, ...t });
431
+ };
432
+ /*!
433
+ @versini/ui-menu v1.1.0
434
+ © 2024 gizmette.com
435
+ */
436
+ try {
437
+ window.__VERSINI_UI_MENU__ || (window.__VERSINI_UI_MENU__ = {
438
+ version: "1.1.0",
439
+ buildTime: "10/05/2024 01:10 PM EDT",
440
+ homepage: "https://github.com/aversini/ui-components",
441
+ license: "MIT"
442
+ });
443
+ } catch {
444
+ }
445
+ /*!
446
+ @versini/ui-togglegroup v1.1.0
447
+ © 2024 gizmette.com
448
+ */
449
+ try {
450
+ window.__VERSINI_UI_TOGGLEGROUP__ || (window.__VERSINI_UI_TOGGLEGROUP__ = {
451
+ version: "1.1.0",
452
+ buildTime: "10/05/2024 12:04 PM EDT",
453
+ homepage: "https://github.com/aversini/ui-components",
454
+ license: "MIT"
455
+ });
456
+ } catch {
457
+ }
458
+ const Ao = "av-togglegroup", Mo = "av-togglegroup-item-wrapper", Lo = "av-togglegroup-item";
459
+ function Me(e, t = []) {
460
+ let o = [];
461
+ function n(i, s) {
462
+ const l = f.createContext(s), h = o.length;
463
+ o = [...o, s];
464
+ function u(g) {
465
+ const { scope: b, children: d, ...c } = g, y = (b == null ? void 0 : b[e][h]) || l, T = f.useMemo(() => c, Object.values(c));
466
+ return /* @__PURE__ */ r(y.Provider, { value: T, children: d });
467
+ }
468
+ function m(g, b) {
469
+ const d = (b == null ? void 0 : b[e][h]) || l, c = f.useContext(d);
470
+ if (c) return c;
471
+ if (s !== void 0) return s;
472
+ throw new Error(`\`${g}\` must be used within \`${i}\``);
473
+ }
474
+ return u.displayName = i + "Provider", [u, m];
475
+ }
476
+ const a = () => {
477
+ const i = o.map((s) => f.createContext(s));
478
+ return function(s) {
479
+ const l = (s == null ? void 0 : s[e]) || i;
480
+ return f.useMemo(
481
+ () => ({ [`__scope${e}`]: { ...s, [e]: l } }),
482
+ [s, l]
483
+ );
484
+ };
485
+ };
486
+ return a.scopeName = e, [n, Oo(a, ...t)];
487
+ }
488
+ function Oo(...e) {
489
+ const t = e[0];
490
+ if (e.length === 1) return t;
491
+ const o = () => {
492
+ const n = e.map((a) => ({
493
+ useScope: a(),
494
+ scopeName: a.scopeName
495
+ }));
496
+ return function(a) {
497
+ const i = n.reduce((s, { useScope: l, scopeName: h }) => {
498
+ const u = l(a)[`__scope${h}`];
499
+ return { ...s, ...u };
500
+ }, {});
501
+ return f.useMemo(() => ({ [`__scope${t.scopeName}`]: i }), [i]);
502
+ };
503
+ };
504
+ return o.scopeName = t.scopeName, o;
505
+ }
506
+ function Po(e, t) {
507
+ typeof e == "function" ? e(t) : e != null && (e.current = t);
508
+ }
509
+ function dt(...e) {
510
+ return (t) => e.forEach((o) => Po(o, t));
511
+ }
512
+ function xe(...e) {
513
+ return f.useCallback(dt(...e), e);
514
+ }
515
+ var fe = f.forwardRef((e, t) => {
516
+ const { children: o, ...n } = e, a = f.Children.toArray(o), i = a.find(Bo);
517
+ if (i) {
518
+ const s = i.props.children, l = a.map((h) => h === i ? f.Children.count(s) > 1 ? f.Children.only(null) : f.isValidElement(s) ? s.props.children : null : h);
519
+ return /* @__PURE__ */ r(_e, { ...n, ref: t, children: f.isValidElement(s) ? f.cloneElement(s, void 0, l) : null });
520
+ }
521
+ return /* @__PURE__ */ r(_e, { ...n, ref: t, children: o });
522
+ });
523
+ fe.displayName = "Slot";
524
+ var _e = f.forwardRef((e, t) => {
525
+ const { children: o, ...n } = e;
526
+ if (f.isValidElement(o)) {
527
+ const a = Vo(o);
528
+ return f.cloneElement(o, {
529
+ ...$o(n, o.props),
530
+ // @ts-ignore
531
+ ref: t ? dt(t, a) : a
532
+ });
533
+ }
534
+ return f.Children.count(o) > 1 ? f.Children.only(null) : null;
535
+ });
536
+ _e.displayName = "SlotClone";
537
+ var Do = ({ children: e }) => /* @__PURE__ */ r(_, { children: e });
538
+ function Bo(e) {
539
+ return f.isValidElement(e) && e.type === Do;
540
+ }
541
+ function $o(e, t) {
542
+ const o = { ...t };
543
+ for (const n in t) {
544
+ const a = e[n], i = t[n];
545
+ /^on[A-Z]/.test(n) ? a && i ? o[n] = (...s) => {
546
+ i(...s), a(...s);
547
+ } : a && (o[n] = a) : n === "style" ? o[n] = { ...a, ...i } : n === "className" && (o[n] = [a, i].filter(Boolean).join(" "));
548
+ }
549
+ return { ...e, ...o };
550
+ }
551
+ function Vo(e) {
552
+ var t, o;
553
+ let n = (t = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : t.get, a = n && "isReactWarning" in n && n.isReactWarning;
554
+ return a ? e.ref : (n = (o = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : o.get, a = n && "isReactWarning" in n && n.isReactWarning, a ? e.props.ref : e.props.ref || e.ref);
555
+ }
556
+ var zo = [
557
+ "a",
558
+ "button",
559
+ "div",
560
+ "form",
561
+ "h2",
562
+ "h3",
563
+ "img",
564
+ "input",
565
+ "label",
566
+ "li",
567
+ "nav",
568
+ "ol",
569
+ "p",
570
+ "span",
571
+ "svg",
572
+ "ul"
573
+ ], ue = zo.reduce((e, t) => {
574
+ const o = f.forwardRef((n, a) => {
575
+ const { asChild: i, ...s } = n, l = i ? fe : t;
576
+ return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ r(l, { ...s, ref: a });
577
+ });
578
+ return o.displayName = `Primitive.${t}`, { ...e, [t]: o };
579
+ }, {});
580
+ function Y(e, t, { checkForDefaultPrevented: o = !0 } = {}) {
581
+ return function(n) {
582
+ if (e == null || e(n), o === !1 || !n.defaultPrevented)
583
+ return t == null ? void 0 : t(n);
584
+ };
585
+ }
586
+ function Ho(e) {
587
+ const t = e + "CollectionProvider", [o, n] = Me(t), [a, i] = o(
588
+ t,
589
+ { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
590
+ ), s = (d) => {
591
+ const { scope: c, children: y } = d, T = I.useRef(null), p = I.useRef(/* @__PURE__ */ new Map()).current;
592
+ return /* @__PURE__ */ r(a, { scope: c, itemMap: p, collectionRef: T, children: y });
593
+ };
594
+ s.displayName = t;
595
+ const l = e + "CollectionSlot", h = I.forwardRef(
596
+ (d, c) => {
597
+ const { scope: y, children: T } = d, p = i(l, y), k = xe(c, p.collectionRef);
598
+ return /* @__PURE__ */ r(fe, { ref: k, children: T });
599
+ }
600
+ );
601
+ h.displayName = l;
602
+ const u = e + "CollectionItemSlot", m = "data-radix-collection-item", g = I.forwardRef(
603
+ (d, c) => {
604
+ const { scope: y, children: T, ...p } = d, k = I.useRef(null), E = xe(c, k), S = i(u, y);
605
+ return I.useEffect(() => (S.itemMap.set(k, { ref: k, ...p }), () => void S.itemMap.delete(k))), /* @__PURE__ */ r(fe, { [m]: "", ref: E, children: T });
606
+ }
607
+ );
608
+ g.displayName = u;
609
+ function b(d) {
610
+ const c = i(e + "CollectionConsumer", d);
611
+ return I.useCallback(() => {
612
+ const y = c.collectionRef.current;
613
+ if (!y) return [];
614
+ const T = Array.from(y.querySelectorAll(`[${m}]`));
615
+ return Array.from(c.itemMap.values()).sort(
616
+ (p, k) => T.indexOf(p.ref.current) - T.indexOf(k.ref.current)
617
+ );
618
+ }, [c.collectionRef, c.itemMap]);
619
+ }
620
+ return [
621
+ { Provider: s, Slot: h, ItemSlot: g },
622
+ b,
623
+ n
624
+ ];
625
+ }
626
+ var Fo = globalThis != null && globalThis.document ? f.useLayoutEffect : () => {
627
+ }, Go = f.useId || (() => {
628
+ }), Uo = 0;
629
+ function jo(e) {
630
+ const [t, o] = f.useState(Go());
631
+ return Fo(() => {
632
+ o((n) => n ?? String(Uo++));
633
+ }, [e]), t ? `radix-${t}` : "";
634
+ }
635
+ function Le(e) {
636
+ const t = f.useRef(e);
637
+ return f.useEffect(() => {
638
+ t.current = e;
639
+ }), f.useMemo(() => (...o) => {
640
+ var n;
641
+ return (n = t.current) == null ? void 0 : n.call(t, ...o);
642
+ }, []);
643
+ }
644
+ function ve({
645
+ prop: e,
646
+ defaultProp: t,
647
+ onChange: o = () => {
648
+ }
649
+ }) {
650
+ const [n, a] = Ko({ defaultProp: t, onChange: o }), i = e !== void 0, s = i ? e : n, l = Le(o), h = f.useCallback(
651
+ (u) => {
652
+ if (i) {
653
+ const m = typeof u == "function" ? u(e) : u;
654
+ m !== e && l(m);
655
+ } else
656
+ a(u);
657
+ },
658
+ [i, e, a, l]
659
+ );
660
+ return [s, h];
661
+ }
662
+ function Ko({
663
+ defaultProp: e,
664
+ onChange: t
665
+ }) {
666
+ const o = f.useState(e), [n] = o, a = f.useRef(n), i = Le(t);
667
+ return f.useEffect(() => {
668
+ a.current !== n && (i(n), a.current = n);
669
+ }, [n, a, i]), o;
670
+ }
671
+ var Wo = f.createContext(void 0);
672
+ function ut(e) {
673
+ const t = f.useContext(Wo);
674
+ return e || t || "ltr";
675
+ }
676
+ var Ie = "rovingFocusGroup.onEntryFocus", Yo = { bubbles: !1, cancelable: !0 }, ye = "RovingFocusGroup", [Re, mt, Zo] = Ho(ye), [qo, ht] = Me(
677
+ ye,
678
+ [Zo]
679
+ ), [Xo, Jo] = qo(ye), gt = f.forwardRef(
680
+ (e, t) => /* @__PURE__ */ r(Re.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ r(Re.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ r(Qo, { ...e, ref: t }) }) })
681
+ );
682
+ gt.displayName = ye;
683
+ var Qo = f.forwardRef((e, t) => {
684
+ const {
685
+ __scopeRovingFocusGroup: o,
686
+ orientation: n,
687
+ loop: a = !1,
688
+ dir: i,
689
+ currentTabStopId: s,
690
+ defaultCurrentTabStopId: l,
691
+ onCurrentTabStopIdChange: h,
692
+ onEntryFocus: u,
693
+ preventScrollOnEntryFocus: m = !1,
694
+ ...g
695
+ } = e, b = f.useRef(null), d = xe(t, b), c = ut(i), [y = null, T] = ve({
696
+ prop: s,
697
+ defaultProp: l,
698
+ onChange: h
699
+ }), [p, k] = f.useState(!1), E = Le(u), S = mt(o), M = f.useRef(!1), [R, P] = f.useState(0);
700
+ return f.useEffect(() => {
701
+ const N = b.current;
702
+ if (N)
703
+ return N.addEventListener(Ie, E), () => N.removeEventListener(Ie, E);
704
+ }, [E]), /* @__PURE__ */ r(
705
+ Xo,
706
+ {
707
+ scope: o,
708
+ orientation: n,
709
+ dir: c,
710
+ loop: a,
711
+ currentTabStopId: y,
712
+ onItemFocus: f.useCallback(
713
+ (N) => T(N),
714
+ [T]
715
+ ),
716
+ onItemShiftTab: f.useCallback(() => k(!0), []),
717
+ onFocusableItemAdd: f.useCallback(
718
+ () => P((N) => N + 1),
719
+ []
720
+ ),
721
+ onFocusableItemRemove: f.useCallback(
722
+ () => P((N) => N - 1),
723
+ []
724
+ ),
725
+ children: /* @__PURE__ */ r(
726
+ ue.div,
727
+ {
728
+ tabIndex: p || R === 0 ? -1 : 0,
729
+ "data-orientation": n,
730
+ ...g,
731
+ ref: d,
732
+ style: { outline: "none", ...e.style },
733
+ onMouseDown: Y(e.onMouseDown, () => {
734
+ M.current = !0;
735
+ }),
736
+ onFocus: Y(e.onFocus, (N) => {
737
+ const re = !M.current;
738
+ if (N.target === N.currentTarget && re && !p) {
739
+ const X = new CustomEvent(Ie, Yo);
740
+ if (N.currentTarget.dispatchEvent(X), !X.defaultPrevented) {
741
+ const j = S().filter((A) => A.focusable), ne = j.find((A) => A.active), L = j.find((A) => A.id === y), K = [ne, L, ...j].filter(
742
+ Boolean
743
+ ).map((A) => A.ref.current);
744
+ bt(K, m);
745
+ }
746
+ }
747
+ M.current = !1;
748
+ }),
749
+ onBlur: Y(e.onBlur, () => k(!1))
750
+ }
751
+ )
752
+ }
753
+ );
754
+ }), pt = "RovingFocusGroupItem", ft = f.forwardRef(
755
+ (e, t) => {
756
+ const {
757
+ __scopeRovingFocusGroup: o,
758
+ focusable: n = !0,
759
+ active: a = !1,
760
+ tabStopId: i,
761
+ ...s
762
+ } = e, l = jo(), h = i || l, u = Jo(pt, o), m = u.currentTabStopId === h, g = mt(o), { onFocusableItemAdd: b, onFocusableItemRemove: d } = u;
763
+ return f.useEffect(() => {
764
+ if (n)
765
+ return b(), () => d();
766
+ }, [n, b, d]), /* @__PURE__ */ r(
767
+ Re.ItemSlot,
768
+ {
769
+ scope: o,
770
+ id: h,
771
+ focusable: n,
772
+ active: a,
773
+ children: /* @__PURE__ */ r(
774
+ ue.span,
775
+ {
776
+ tabIndex: m ? 0 : -1,
777
+ "data-orientation": u.orientation,
778
+ ...s,
779
+ ref: t,
780
+ onMouseDown: Y(e.onMouseDown, (c) => {
781
+ n ? u.onItemFocus(h) : c.preventDefault();
782
+ }),
783
+ onFocus: Y(e.onFocus, () => u.onItemFocus(h)),
784
+ onKeyDown: Y(e.onKeyDown, (c) => {
785
+ if (c.key === "Tab" && c.shiftKey) {
786
+ u.onItemShiftTab();
787
+ return;
788
+ }
789
+ if (c.target !== c.currentTarget) return;
790
+ const y = or(c, u.orientation, u.dir);
791
+ if (y !== void 0) {
792
+ if (c.metaKey || c.ctrlKey || c.altKey || c.shiftKey) return;
793
+ c.preventDefault();
794
+ let T = g().filter((p) => p.focusable).map((p) => p.ref.current);
795
+ if (y === "last") T.reverse();
796
+ else if (y === "prev" || y === "next") {
797
+ y === "prev" && T.reverse();
798
+ const p = T.indexOf(c.currentTarget);
799
+ T = u.loop ? rr(T, p + 1) : T.slice(p + 1);
800
+ }
801
+ setTimeout(() => bt(T));
802
+ }
803
+ })
804
+ }
805
+ )
806
+ }
807
+ );
808
+ }
809
+ );
810
+ ft.displayName = pt;
811
+ var er = {
812
+ ArrowLeft: "prev",
813
+ ArrowUp: "prev",
814
+ ArrowRight: "next",
815
+ ArrowDown: "next",
816
+ PageUp: "first",
817
+ Home: "first",
818
+ PageDown: "last",
819
+ End: "last"
820
+ };
821
+ function tr(e, t) {
822
+ return t !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
823
+ }
824
+ function or(e, t, o) {
825
+ const n = tr(e.key, o);
826
+ if (!(t === "vertical" && ["ArrowLeft", "ArrowRight"].includes(n)) && !(t === "horizontal" && ["ArrowUp", "ArrowDown"].includes(n)))
827
+ return er[n];
828
+ }
829
+ function bt(e, t = !1) {
830
+ const o = document.activeElement;
831
+ for (const n of e)
832
+ if (n === o || (n.focus({ preventScroll: t }), document.activeElement !== o)) return;
833
+ }
834
+ function rr(e, t) {
835
+ return e.map((o, n) => e[(t + n) % e.length]);
836
+ }
837
+ var nr = gt, ar = ft, ir = "Toggle", vt = f.forwardRef((e, t) => {
838
+ const { pressed: o, defaultPressed: n = !1, onPressedChange: a, ...i } = e, [s = !1, l] = ve({
839
+ prop: o,
840
+ onChange: a,
841
+ defaultProp: n
842
+ });
843
+ return /* @__PURE__ */ r(
844
+ ue.button,
845
+ {
846
+ type: "button",
847
+ "aria-pressed": s,
848
+ "data-state": s ? "on" : "off",
849
+ "data-disabled": e.disabled ? "" : void 0,
850
+ ...i,
851
+ ref: t,
852
+ onClick: Y(e.onClick, () => {
853
+ e.disabled || l(!s);
854
+ })
855
+ }
856
+ );
857
+ });
858
+ vt.displayName = ir;
859
+ var oe = "ToggleGroup", [yt, Tn] = Me(oe, [
860
+ ht
861
+ ]), kt = ht(), Oe = I.forwardRef((e, t) => {
862
+ const { type: o, ...n } = e;
863
+ if (o === "single")
864
+ return /* @__PURE__ */ r(sr, { ...n, ref: t });
865
+ if (o === "multiple")
866
+ return /* @__PURE__ */ r(lr, { ...n, ref: t });
867
+ throw new Error(`Missing prop \`type\` expected on \`${oe}\``);
868
+ });
869
+ Oe.displayName = oe;
870
+ var [Ct, Tt] = yt(oe), sr = I.forwardRef((e, t) => {
871
+ const {
872
+ value: o,
873
+ defaultValue: n,
874
+ onValueChange: a = () => {
875
+ },
876
+ ...i
877
+ } = e, [s, l] = ve({
878
+ prop: o,
879
+ defaultProp: n,
880
+ onChange: a
881
+ });
882
+ return /* @__PURE__ */ r(
883
+ Ct,
884
+ {
885
+ scope: e.__scopeToggleGroup,
886
+ type: "single",
887
+ value: s ? [s] : [],
888
+ onItemActivate: l,
889
+ onItemDeactivate: I.useCallback(() => l(""), [l]),
890
+ children: /* @__PURE__ */ r(wt, { ...i, ref: t })
891
+ }
892
+ );
893
+ }), lr = I.forwardRef((e, t) => {
894
+ const {
895
+ value: o,
896
+ defaultValue: n,
897
+ onValueChange: a = () => {
898
+ },
899
+ ...i
900
+ } = e, [s = [], l] = ve({
901
+ prop: o,
902
+ defaultProp: n,
903
+ onChange: a
904
+ }), h = I.useCallback(
905
+ (m) => l((g = []) => [...g, m]),
906
+ [l]
907
+ ), u = I.useCallback(
908
+ (m) => l((g = []) => g.filter((b) => b !== m)),
909
+ [l]
910
+ );
911
+ return /* @__PURE__ */ r(
912
+ Ct,
913
+ {
914
+ scope: e.__scopeToggleGroup,
915
+ type: "multiple",
916
+ value: s,
917
+ onItemActivate: h,
918
+ onItemDeactivate: u,
919
+ children: /* @__PURE__ */ r(wt, { ...i, ref: t })
920
+ }
921
+ );
922
+ });
923
+ Oe.displayName = oe;
924
+ var [cr, dr] = yt(oe), wt = I.forwardRef(
925
+ (e, t) => {
926
+ const {
927
+ __scopeToggleGroup: o,
928
+ disabled: n = !1,
929
+ rovingFocus: a = !0,
930
+ orientation: i,
931
+ dir: s,
932
+ loop: l = !0,
933
+ ...h
934
+ } = e, u = kt(o), m = ut(s), g = { role: "group", dir: m, ...h };
935
+ return /* @__PURE__ */ r(cr, { scope: o, rovingFocus: a, disabled: n, children: a ? /* @__PURE__ */ r(
936
+ nr,
937
+ {
938
+ asChild: !0,
939
+ ...u,
940
+ orientation: i,
941
+ dir: m,
942
+ loop: l,
943
+ children: /* @__PURE__ */ r(ue.div, { ...g, ref: t })
944
+ }
945
+ ) : /* @__PURE__ */ r(ue.div, { ...g, ref: t }) });
946
+ }
947
+ ), be = "ToggleGroupItem", Et = I.forwardRef(
948
+ (e, t) => {
949
+ const o = Tt(be, e.__scopeToggleGroup), n = dr(be, e.__scopeToggleGroup), a = kt(e.__scopeToggleGroup), i = o.value.includes(e.value), s = n.disabled || e.disabled, l = { ...e, pressed: i, disabled: s }, h = I.useRef(null);
950
+ return n.rovingFocus ? /* @__PURE__ */ r(
951
+ ar,
952
+ {
953
+ asChild: !0,
954
+ ...a,
955
+ focusable: !s,
956
+ active: i,
957
+ ref: h,
958
+ children: /* @__PURE__ */ r(We, { ...l, ref: t })
959
+ }
960
+ ) : /* @__PURE__ */ r(We, { ...l, ref: t });
961
+ }
962
+ );
963
+ Et.displayName = be;
964
+ var We = I.forwardRef(
965
+ (e, t) => {
966
+ const { __scopeToggleGroup: o, value: n, ...a } = e, i = Tt(be, o), s = { role: "radio", "aria-checked": e.pressed, "aria-pressed": void 0 }, l = i.type === "single" ? s : void 0;
967
+ return /* @__PURE__ */ r(
968
+ vt,
969
+ {
970
+ ...l,
971
+ ...a,
972
+ ref: t,
973
+ onPressedChange: (h) => {
974
+ h ? i.onItemActivate(n) : i.onItemDeactivate(n);
975
+ }
976
+ }
977
+ );
978
+ }
979
+ ), ur = Oe, mr = Et;
980
+ const Nt = I.createContext({
981
+ size: "medium",
982
+ focusMode: "system",
983
+ mode: "system"
984
+ }), hr = (e) => {
985
+ let t = "";
986
+ if (typeof e == "number" || typeof e == "string")
987
+ t = "m-" + e;
988
+ else {
989
+ const o = [];
990
+ (e == null ? void 0 : e.t) !== void 0 && o.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && o.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && o.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && o.push(`ml-${e.l}`), t = o.join(" ");
991
+ }
992
+ return t;
993
+ }, gr = ({ focusMode: e }) => C("focus:outline", "focus:outline-2", "focus:outline-offset", {
994
+ "focus:outline-focus-light": e === "light",
995
+ "focus:outline-focus-dark": e === "dark",
996
+ "focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
997
+ "focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
998
+ }), pr = ({ mode: e }) => C({
999
+ "data-[state=on]:bg-surface-medium": e === "dark",
1000
+ "data-[state=on]:bg-surface-lightest": e === "light",
1001
+ "data-[state=on]:bg-surface-lightest dark:data-[state=on]:bg-surface-medium": e === "system",
1002
+ "data-[state=on]:bg-surface-medium dark:data-[state=on]:bg-surface-lightest": e === "alt-system"
1003
+ }), fr = ({ size: e }) => C({
1004
+ "h-5 px-2": e === "small",
1005
+ "h-6 px-3": e === "medium",
1006
+ "h-7 px-4": e === "large"
1007
+ }), br = ({ mode: e }) => C(
1008
+ Mo,
1009
+ "px-1",
1010
+ "relative",
1011
+ "border-r",
1012
+ "last:border-transparent",
1013
+ "has-[button[aria-checked='true']]:border-transparent",
1014
+ "has-[+_*_button[aria-checked='false']]:border-border-medium",
1015
+ {
1016
+ "border-surface-light": e === "light",
1017
+ "border-surface-darker": e === "dark",
1018
+ "border-surface-light dark:border-surface-darker": e === "system",
1019
+ "border-surface-darker dark:border-surface-light": e === "alt-system"
1020
+ }
1021
+ ), vr = ({
1022
+ focusMode: e,
1023
+ mode: t,
1024
+ size: o
1025
+ }) => ({
1026
+ wrapperClass: br({ mode: t }),
1027
+ itemClass: C(
1028
+ Lo,
1029
+ "flex items-center justify-center bg-transparent",
1030
+ "rounded-sm",
1031
+ "transition duration-200 ease",
1032
+ fr({ size: o }),
1033
+ gr({ focusMode: e }),
1034
+ pr({ mode: t })
1035
+ )
1036
+ }), yr = ({
1037
+ mode: e,
1038
+ spacing: t
1039
+ }) => C(
1040
+ Ao,
1041
+ hr(t),
1042
+ "inline-flex p-1",
1043
+ "rounded-sm",
1044
+ {
1045
+ "bg-surface-light text-copy-dark": e === "light",
1046
+ "bg-surface-darker text-copy-lighter": e === "dark",
1047
+ "bg-surface-light text-copy-dark dark:bg-surface-darker dark:text-copy-lighter": e === "system",
1048
+ "bg-surface-darker text-copy-lighter dark:bg-surface-light dark:text-copy-dark": e === "alt-system"
1049
+ }
1050
+ ), kr = ({
1051
+ children: e,
1052
+ value: t,
1053
+ onValueChange: o,
1054
+ disabled: n,
1055
+ mode: a = "system",
1056
+ focusMode: i = "system",
1057
+ size: s = "medium",
1058
+ defaultValue: l,
1059
+ spacing: h,
1060
+ ...u
1061
+ }) => {
1062
+ const m = yr({ mode: a, spacing: h }), g = { size: s, focusMode: i, mode: a };
1063
+ return /* @__PURE__ */ r(Nt.Provider, { value: g, children: /* @__PURE__ */ r(
1064
+ ur,
1065
+ {
1066
+ disabled: n,
1067
+ className: m,
1068
+ value: t,
1069
+ defaultValue: l,
1070
+ onValueChange: o,
1071
+ ...u,
1072
+ type: "single",
1073
+ children: e
1074
+ }
1075
+ ) });
1076
+ }, Cr = ({ value: e, disabled: t }) => {
1077
+ const { size: o, focusMode: n, mode: a } = B(Nt), { itemClass: i, wrapperClass: s } = vr({
1078
+ focusMode: n,
1079
+ mode: a,
1080
+ size: o
1081
+ });
1082
+ return /* @__PURE__ */ r("div", { className: s, children: /* @__PURE__ */ r(
1083
+ mr,
1084
+ {
1085
+ disabled: t,
1086
+ className: i,
1087
+ value: e,
1088
+ children: e
1089
+ }
1090
+ ) });
1091
+ };
1092
+ /*!
1093
+ @versini/ui-panel v1.0.12
1094
+ © 2024 gizmette.com
1095
+ */
1096
+ try {
1097
+ window.__VERSINI_UI_PANEL__ || (window.__VERSINI_UI_PANEL__ = {
1098
+ version: "1.0.12",
1099
+ buildTime: "10/02/2024 06:10 PM EDT",
1100
+ homepage: "https://github.com/aversini/ui-components",
1101
+ license: "MIT"
1102
+ });
1103
+ } catch {
1104
+ }
1105
+ const Ye = "av-messagebox", Ze = "av-panel", qe = "av-button", Tr = (e) => {
1106
+ let t = "";
1107
+ if (typeof e == "number" || typeof e == "string")
1108
+ t = "m-" + e;
1109
+ else {
1110
+ const o = [];
1111
+ (e == null ? void 0 : e.t) !== void 0 && o.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && o.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && o.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && o.push(`ml-${e.l}`), t = o.join(" ");
1112
+ }
1113
+ return t;
1114
+ }, Pe = "icon", wr = "button", Er = "link", Nr = ({
1115
+ type: e,
1116
+ size: t,
1117
+ labelRight: o,
1118
+ labelLeft: n,
1119
+ align: a
1120
+ }) => {
1121
+ const i = "text-sm font-medium max-h-8 py-0", s = "text-base font-medium max-h-9 py-1", l = "text-lg font-medium max-h-12 py-2";
1122
+ switch (e) {
1123
+ case wr:
1124
+ return C("px-4", {
1125
+ [i]: t === "small",
1126
+ [s]: t === "medium",
1127
+ [l]: t === "large"
1128
+ });
1129
+ case Er:
1130
+ return C("px-4 text-center", {
1131
+ [i]: t === "small",
1132
+ [s]: t === "medium",
1133
+ [l]: t === "large"
1134
+ });
1135
+ case Pe:
1136
+ return C("inline-flex items-center", {
1137
+ "justify-center": a === "center",
1138
+ "justify-start": a === "left",
1139
+ "justify-end": a === "right",
1140
+ "h-6 w-6 p-0": t === "small" && !(o || n),
1141
+ "h-6 px-4 text-sm font-medium": t === "small" && (o || n),
1142
+ "h-8 w-8 p-1": t === "medium" && !(o || n),
1143
+ "h-8 px-4 text-base font-medium": t === "medium" && (o || n),
1144
+ "h-12 w-12 p-2": t === "large" && !(o || n),
1145
+ "h-12 px-4 text-lg font-medium": t === "large" && (o || n)
1146
+ });
1147
+ }
1148
+ }, Ir = ({
1149
+ mode: e,
1150
+ noBackground: t,
1151
+ noTruncate: o,
1152
+ variant: n
1153
+ }) => {
1154
+ if (t)
1155
+ return "not-prose rounded-full";
1156
+ if (n === "primary")
1157
+ return C("not-prose rounded-full", {
1158
+ truncate: !o,
1159
+ "bg-action-dark text-copy-light": e === "dark",
1160
+ "bg-action-light text-copy-lighter": e === "light",
1161
+ "bg-action-dark text-copy-light dark:bg-action-light dark:text-copy-lighter": e === "system",
1162
+ "bg-action-light text-copy-lighter dark:bg-action-dark dark:text-copy-light": e === "alt-system"
1163
+ });
1164
+ if (n === "secondary")
1165
+ return C("not-prose rounded-full", {
1166
+ truncate: !o,
1167
+ "bg-action-dark text-copy-light": e === "light",
1168
+ "bg-action-light text-copy-lighter": e === "dark",
1169
+ "bg-action-dark text-copy-light dark:bg-action-light dark:text-copy-lighter": e === "alt-system",
1170
+ "bg-action-light text-copy-lighter dark:bg-action-dark dark:text-copy-light": e === "system"
1171
+ });
1172
+ if (n === "danger")
1173
+ return C("not-prose rounded-full", {
1174
+ truncate: !o,
1175
+ "bg-action-danger-dark text-copy-light": e === "dark",
1176
+ "bg-action-danger-light text-copy-lighter": e === "light",
1177
+ "bg-action-danger-dark text-copy-light dark:bg-action-danger-light dark:text-copy-lighter": e === "system",
1178
+ "bg-action-danger-light text-copy-lighter dark:bg-action-danger-dark dark:text-copy-light": e === "alt-system"
1179
+ });
1180
+ }, Sr = ({
1181
+ mode: e,
1182
+ disabled: t,
1183
+ variant: o
1184
+ }) => {
1185
+ if (t)
1186
+ return "";
1187
+ if (o === "primary")
1188
+ return C("hover:text-copy-light-hover", {
1189
+ "hover:bg-action-dark-hover": e === "dark",
1190
+ "hover:bg-action-light-hover": e === "light",
1191
+ "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "system",
1192
+ "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "alt-system"
1193
+ });
1194
+ if (o === "secondary")
1195
+ return C("hover:text-copy-light-hover", {
1196
+ "hover:bg-action-dark-hover": e === "light",
1197
+ "hover:bg-action-light-hover": e === "dark",
1198
+ "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "alt-system",
1199
+ "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "system"
1200
+ });
1201
+ if (o === "danger")
1202
+ return C("hover:text-copy-light-hover", {
1203
+ "hover:bg-action-danger-dark-hover": e === "dark",
1204
+ "hover:bg-action-danger-light-hover": e === "light",
1205
+ "hover:bg-action-danger-dark-hover dark:hover:bg-action-danger-light-hover": e === "system",
1206
+ "hover:bg-action-danger-light-hover dark:hover:bg-action-danger-dark-hover": e === "alt-system"
1207
+ });
1208
+ }, xr = ({
1209
+ mode: e,
1210
+ disabled: t,
1211
+ variant: o
1212
+ }) => {
1213
+ if (t)
1214
+ return "";
1215
+ if (o === "primary")
1216
+ return C("active:text-copy-light-active", {
1217
+ "active:bg-action-dark-active": e === "dark",
1218
+ "active:bg-action-light-active": e === "light",
1219
+ "active:bg-action-dark-active dark:active:bg-action-light-active": e === "system",
1220
+ "active:bg-action-light-active dark:active:bg-action-dark-active": e === "alt-system"
1221
+ });
1222
+ if (o === "secondary")
1223
+ return C("active:text-copy-light-active", {
1224
+ "active:bg-action-dark-active": e === "light",
1225
+ "active:bg-action-light-active": e === "dark",
1226
+ "active:bg-action-dark-active dark:active:bg-action-light-active": e === "alt-system",
1227
+ "active:bg-action-light-active dark:active:bg-action-dark-active": e === "system"
1228
+ });
1229
+ if (o === "danger")
1230
+ return C("active:text-copy-lighter-active", {
1231
+ "active:bg-action-danger-dark-active": e === "dark",
1232
+ "active:bg-action-danger-light-active": e === "light",
1233
+ "active:bg-action-danger-dark-active dark:active:bg-action-danger-light-active": e === "system",
1234
+ "active:bg-action-danger-light-active dark:active:bg-action-danger-dark-active": e === "alt-system"
1235
+ });
1236
+ }, _r = ({
1237
+ mode: e,
1238
+ noBorder: t,
1239
+ variant: o
1240
+ }) => {
1241
+ if (t)
1242
+ return "border border-transparent";
1243
+ if (o === "primary")
1244
+ return C("border", {
1245
+ "border-border-dark": e === "dark",
1246
+ "border-border-accent": e === "light",
1247
+ "border-border-dark dark:border-border-accent": e === "system",
1248
+ "border-border-accent dark:border-border-dark": e === "alt-system"
1249
+ });
1250
+ if (o === "secondary")
1251
+ return C("border", {
1252
+ "border-border-dark": e === "light",
1253
+ "border-border-accent": e === "dark",
1254
+ "border-border-dark dark:border-border-accent": e === "alt-system",
1255
+ "border-border-accent dark:border-border-dark": e === "system"
1256
+ });
1257
+ if (o === "danger")
1258
+ return C("border", {
1259
+ "border-border-danger-dark": e === "dark",
1260
+ "border-border-danger-medium": e === "light",
1261
+ "border-border-danger-dark dark:border-border-danger-medium": e === "system",
1262
+ "border-border-danger-medium dark:border-border-danger-dark": e === "alt-system"
1263
+ });
1264
+ }, Rr = ({ focusMode: e }) => C("focus:outline", "focus:outline-2", "focus:outline-offset-2", {
1265
+ "focus:outline-focus-dark": e === "dark",
1266
+ "focus:outline-focus-light": e === "light",
1267
+ "focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
1268
+ "focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
1269
+ }), It = ({
1270
+ type: e,
1271
+ className: t,
1272
+ raw: o,
1273
+ mode: n,
1274
+ focusMode: a,
1275
+ disabled: i,
1276
+ fullWidth: s,
1277
+ size: l,
1278
+ noBorder: h,
1279
+ labelRight: u,
1280
+ labelLeft: m,
1281
+ spacing: g,
1282
+ noBackground: b,
1283
+ variant: d,
1284
+ noTruncate: c,
1285
+ align: y
1286
+ }) => (d || (d = "primary"), o ? C(qe, t) : C(
1287
+ qe,
1288
+ t,
1289
+ Tr(g),
1290
+ Ir({ mode: n, variant: d, noBackground: b, noTruncate: c }),
1291
+ Nr({ type: e, size: l, labelRight: u, labelLeft: m, align: y }),
1292
+ _r({ mode: n, variant: d, noBorder: h }),
1293
+ Rr({ focusMode: a }),
1294
+ Sr({ mode: n, variant: d, disabled: i }),
1295
+ xr({ mode: n, variant: d, disabled: i }),
1296
+ {
1297
+ "w-full": s,
1298
+ "disabled:cursor-not-allowed disabled:opacity-50": i
1299
+ }
1300
+ )), Ar = (e, t, o) => {
1301
+ var n;
1302
+ !t && (!document.activeElement || document.activeElement !== e.currentTarget) && typeof ((n = e == null ? void 0 : e.currentTarget) == null ? void 0 : n.focus) == "function" && e.currentTarget.focus(), typeof o == "function" && o(e);
1303
+ }, De = I.forwardRef((e, t) => {
1304
+ const { onClick: o, noInternalClick: n = !1, ...a } = e;
1305
+ return /* @__PURE__ */ r(
1306
+ "button",
1307
+ {
1308
+ ref: t,
1309
+ onClick: (i) => {
1310
+ Ar(i, n, o);
1311
+ },
1312
+ ...a
1313
+ }
1314
+ );
1315
+ });
1316
+ De.displayName = "BaseButton";
1317
+ const St = I.forwardRef(
1318
+ ({
1319
+ children: e,
1320
+ disabled: t = !1,
1321
+ mode: o = "system",
1322
+ focusMode: n = "system",
1323
+ fullWidth: a = !1,
1324
+ className: i,
1325
+ type: s = "button",
1326
+ raw: l = !1,
1327
+ noBorder: h = !1,
1328
+ "aria-label": u,
1329
+ label: m,
1330
+ size: g = "medium",
1331
+ labelRight: b,
1332
+ labelLeft: d,
1333
+ spacing: c,
1334
+ noBackground: y = !1,
1335
+ align: T = "center",
1336
+ ...p
1337
+ }, k) => {
1338
+ const E = It({
1339
+ type: Pe,
1340
+ mode: o,
1341
+ focusMode: n,
1342
+ fullWidth: a,
1343
+ disabled: t,
1344
+ raw: l,
1345
+ className: i,
1346
+ noBorder: h,
1347
+ size: g,
1348
+ labelRight: b,
1349
+ labelLeft: d,
1350
+ spacing: c,
1351
+ noBackground: y,
1352
+ align: T
1353
+ }), S = C({
1354
+ "text-copy-accent-dark": o === "light" && !l,
1355
+ "text-copy-light": o === "dark" && !l,
1356
+ "text-copy-accent-dark dark:text-copy-light": o === "alt-system" && !l,
1357
+ "text-copy-light dark:text-copy-accent-dark": o === "system" && !l
1358
+ });
1359
+ return /* @__PURE__ */ v(
1360
+ De,
1361
+ {
1362
+ ref: k,
1363
+ className: E,
1364
+ disabled: t,
1365
+ type: s,
1366
+ "aria-label": u || m,
1367
+ ...p,
1368
+ children: [
1369
+ d && /* @__PURE__ */ r("span", { className: "pr-2", children: d }),
1370
+ /* @__PURE__ */ r("div", { className: S, children: e }),
1371
+ b && /* @__PURE__ */ r("span", { className: "pl-2", children: b })
1372
+ ]
1373
+ }
1374
+ );
1375
+ }
1376
+ );
1377
+ St.displayName = "ButtonIcon";
1378
+ /*!
1379
+ @versini/ui-button v1.1.10
1380
+ © 2024 gizmette.com
1381
+ */
1382
+ try {
1383
+ window.__VERSINI_UI_BUTTON__ || (window.__VERSINI_UI_BUTTON__ = {
1384
+ version: "1.1.10",
1385
+ buildTime: "10/02/2024 06:10 PM EDT",
1386
+ homepage: "https://github.com/aversini/ui-components",
1387
+ license: "MIT"
1388
+ });
1389
+ } catch {
1390
+ }
1391
+ const Mr = I.forwardRef(
1392
+ ({
1393
+ children: e,
1394
+ disabled: t = !1,
1395
+ mode: o = "system",
1396
+ focusMode: n = "system",
1397
+ fullWidth: a = !1,
1398
+ className: i,
1399
+ type: s = "button",
1400
+ raw: l = !1,
1401
+ noBorder: h = !1,
1402
+ "aria-label": u,
1403
+ label: m,
1404
+ size: g = "medium",
1405
+ labelRight: b,
1406
+ labelLeft: d,
1407
+ spacing: c,
1408
+ noBackground: y = !1,
1409
+ align: T = "center",
1410
+ active: p = !1,
1411
+ ...k
1412
+ }, E) => {
1413
+ const S = It({
1414
+ type: Pe,
1415
+ mode: o,
1416
+ focusMode: n,
1417
+ fullWidth: a,
1418
+ disabled: t,
1419
+ raw: l,
1420
+ className: i,
1421
+ noBorder: h,
1422
+ size: g,
1423
+ labelRight: b,
1424
+ labelLeft: d,
1425
+ spacing: c,
1426
+ noBackground: y,
1427
+ align: T
1428
+ }), M = C({
1429
+ "text-copy-accent-dark": o === "light" && !l,
1430
+ "text-copy-light": o === "dark" && !l,
1431
+ "text-copy-accent-dark dark:text-copy-light": o === "alt-system" && !l,
1432
+ "text-copy-light dark:text-copy-accent-dark": o === "system" && !l
1433
+ }), R = p ? C(
1434
+ "relative",
1435
+ "focus-within:static",
1436
+ "focus-within:after:border-transparent",
1437
+ "after:absolute",
1438
+ "after:content-['']",
1439
+ "after:border-b-2",
1440
+ "after:bottom-[-4px]",
1441
+ "after:left-0",
1442
+ "after:right-0",
1443
+ {
1444
+ "after:border-table-dark": o === "dark",
1445
+ "after:border-table-light": o === "light",
1446
+ "after:border-table-dark dark:after:border-table-light": o === "system",
1447
+ "after:border-table-light dark:after:border-table-dark": o === "alt-system"
1448
+ }
1449
+ ) : "";
1450
+ return /* @__PURE__ */ r("div", { className: R, children: /* @__PURE__ */ v(
1451
+ De,
1452
+ {
1453
+ ref: E,
1454
+ className: S,
1455
+ disabled: t,
1456
+ type: s,
1457
+ "aria-label": u || m,
1458
+ ...k,
1459
+ children: [
1460
+ d && /* @__PURE__ */ r("span", { className: "pr-2", children: d }),
1461
+ /* @__PURE__ */ r("div", { className: M, children: e }),
1462
+ b && /* @__PURE__ */ r("span", { className: "pl-2", children: b })
1463
+ ]
1464
+ }
1465
+ ) });
1466
+ }
1467
+ );
1468
+ Mr.displayName = "ButtonSort";
1469
+ const Lr = (e) => {
1470
+ let t = "";
1471
+ if (typeof e == "number" || typeof e == "string")
1472
+ t = "m-" + e;
1473
+ else {
1474
+ const o = [];
1475
+ (e == null ? void 0 : e.t) !== void 0 && o.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && o.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && o.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && o.push(`ml-${e.l}`), t = o.join(" ");
1476
+ }
1477
+ return t;
1478
+ }, Or = ({
1479
+ children: e,
1480
+ fill: t,
1481
+ viewBox: o,
1482
+ className: n,
1483
+ defaultViewBox: a,
1484
+ defaultClassName: i,
1485
+ spacing: s,
1486
+ title: l,
1487
+ semantic: h = !1,
1488
+ ...u
1489
+ }) => {
1490
+ const m = Lr(s), g = C(
1491
+ m,
1492
+ n || i
1493
+ );
1494
+ return /* @__PURE__ */ v(_, { children: [
1495
+ /* @__PURE__ */ r(
1496
+ "svg",
1497
+ {
1498
+ xmlns: "http://www.w3.org/2000/svg",
1499
+ className: g,
1500
+ viewBox: o || a,
1501
+ fill: t || "currentColor",
1502
+ role: "img",
1503
+ "aria-hidden": !h,
1504
+ focusable: !1,
1505
+ ...u,
1506
+ children: e
1507
+ }
1508
+ ),
1509
+ l && h && /* @__PURE__ */ r("span", { className: "sr-only", children: l })
1510
+ ] });
1511
+ };
1512
+ /*!
1513
+ @versini/ui-private v1.4.17
1514
+ © 2024 gizmette.com
1515
+ */
1516
+ try {
1517
+ window.__VERSINI_UI_PRIVATE__ || (window.__VERSINI_UI_PRIVATE__ = {
1518
+ version: "1.4.17",
1519
+ buildTime: "10/02/2024 06:10 PM EDT",
1520
+ homepage: "https://github.com/aversini/ui-components",
1521
+ license: "MIT"
1522
+ });
1523
+ } catch {
1524
+ }
1525
+ const Pr = ({
1526
+ className: e,
1527
+ viewBox: t,
1528
+ spacing: o,
1529
+ title: n,
1530
+ monotone: a,
1531
+ ...i
1532
+ }) => /* @__PURE__ */ r(
1533
+ Or,
1534
+ {
1535
+ defaultViewBox: "0 0 384 512",
1536
+ defaultClassName: "size-5",
1537
+ viewBox: t,
1538
+ className: e,
1539
+ spacing: o,
1540
+ title: n || "Close",
1541
+ ...i,
1542
+ children: /* @__PURE__ */ r("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" })
1543
+ }
1544
+ );
1545
+ /*!
1546
+ @versini/ui-icons v1.14.0
1547
+ © 2024 gizmette.com
1548
+ */
1549
+ try {
1550
+ window.__VERSINI_UI_ICONS__ || (window.__VERSINI_UI_ICONS__ = {
1551
+ version: "1.14.0",
1552
+ buildTime: "10/02/2024 06:10 PM EDT",
1553
+ homepage: "https://github.com/aversini/ui-components",
1554
+ license: "MIT"
1555
+ });
1556
+ } catch {
1557
+ }
1558
+ const ie = "panel", ge = "messagebox", Dr = ({
1559
+ className: e,
1560
+ kind: t,
1561
+ borderMode: o
1562
+ }) => ({
1563
+ main: C("prose prose-lighter flex flex-col bg-surface-medium", {
1564
+ [`${Ze} max-h-full sm:max-h-[95%] min-h-full sm:min-h-[10rem] sm:rounded-lg sm:border-2`]: t === ie,
1565
+ [`${Ze} w-full sm:w-[95%] md:max-w-2xl`]: t === ie && !e,
1566
+ [`${Ye} rounded-lg border-2`]: t === ge,
1567
+ [`${Ye} w-[95%] sm:w-[50%] md:max-w-2xl`]: t === ge && !e,
1568
+ [`${e}`]: !!e,
1569
+ "sm:border-border-dark": o === "dark" && t === ie,
1570
+ "sm:border-border-accent": o === "light" && t === ie,
1571
+ "border-border-dark": o === "dark" && t === ge,
1572
+ "border-border-accent": o === "light" && t === ge
1573
+ }),
1574
+ content: "flex flex-col py-2 sm:py-4 sm:px-4 px-2 overflow-y-auto",
1575
+ footer: "flex flex-grow flex-col sm:p-4 p-2",
1576
+ header: "sm:p-4 mb-0 p-2",
1577
+ close: "sm:p-4 p-2"
1578
+ }), he = (e) => ro(
1579
+ () => import("./index.jf7dGfT1.B5RD15ln.js").then((t) => ({
1580
+ default: t[e]
1581
+ }))
1582
+ ), Br = he("Modal"), $r = he("ModalClose"), Vr = he("ModalContent"), zr = he("ModalDescription"), Hr = he("ModalHeading"), q = ({
1583
+ open: e,
1584
+ onOpenChange: t,
1585
+ title: o,
1586
+ children: n,
1587
+ footer: a,
1588
+ borderMode: i = "light",
1589
+ kind: s = ie,
1590
+ className: l
1591
+ }) => {
1592
+ const h = ce(""), u = Dr({ className: l, kind: s, borderMode: i });
1593
+ return U(() => (e && (h.current = document.title, document.title = `${o} | ${h.current}`), () => {
1594
+ e && (document.title = h.current);
1595
+ }), [o, e]), /* @__PURE__ */ r(oo, { fallback: /* @__PURE__ */ r("div", {}), children: e && /* @__PURE__ */ r(Br, { open: e, onOpenChange: t, children: /* @__PURE__ */ v(Vr, { className: u.main, children: [
1596
+ /* @__PURE__ */ v("div", { className: "flex flex-row-reverse items-center justify-between", children: [
1597
+ /* @__PURE__ */ r(
1598
+ $r,
1599
+ {
1600
+ className: u.close,
1601
+ trigger: /* @__PURE__ */ r(
1602
+ St,
1603
+ {
1604
+ mode: "dark",
1605
+ focusMode: "light",
1606
+ noBorder: !0,
1607
+ label: "Close",
1608
+ children: /* @__PURE__ */ r(Pr, {})
1609
+ }
1610
+ )
1611
+ }
1612
+ ),
1613
+ /* @__PURE__ */ r(Hr, { className: u.header, children: o })
1614
+ ] }),
1615
+ /* @__PURE__ */ r(zr, { className: u.content, children: n }),
1616
+ a && /* @__PURE__ */ r("div", { className: u.footer, children: a })
1617
+ ] }) }) });
1618
+ }, Fr = ({ stats: e }) => {
1619
+ const t = (e == null ? void 0 : e.plugins) || [], o = (e == null ? void 0 : e.version) || "", n = (e == null ? void 0 : e.models) || [], a = de(), i = de();
1620
+ return /* @__PURE__ */ v(_, { children: [
1621
+ /* @__PURE__ */ r("div", { className: "mb-4", children: /* @__PURE__ */ r(
1622
+ O,
1623
+ {
1624
+ header: w.ABOUT.TITLE_CLIENT,
1625
+ className: "prose-dark dark:prose-lighter",
1626
+ children: le(a, {
1627
+ [w.ABOUT.VERSION]: "5.1.0",
1628
+ [w.ABOUT.BUILD_TIMESTAMP]: "10/05/2024 02:51 PM EDT"
1629
+ })
1630
+ }
1631
+ ) }),
1632
+ /* @__PURE__ */ r(
1633
+ O,
1634
+ {
1635
+ header: w.ABOUT.TITLE_SERVER,
1636
+ className: "prose-dark dark:prose-lighter",
1637
+ children: le(i, {
1638
+ [w.ABOUT.VERSION]: o,
1639
+ [pe(w.ABOUT.ENGINE, n.length)]: /* @__PURE__ */ r(_, { children: n.map((s) => /* @__PURE__ */ r("div", { className: "text-right", children: s }, s)) }),
1640
+ [pe(w.ABOUT.PLUGIN, t.length)]: /* @__PURE__ */ r(_, { children: t.map((s) => /* @__PURE__ */ r("div", { className: "text-right", children: s }, s)) })
1641
+ })
1642
+ }
1643
+ )
1644
+ ] });
1645
+ }, Gr = ({
1646
+ open: e,
1647
+ onOpenChange: t
1648
+ }) => {
1649
+ const { serverStats: o } = B(me);
1650
+ return /* @__PURE__ */ r(q, { open: e, onOpenChange: t, title: Mt, children: /* @__PURE__ */ r(Fr, { stats: o }) });
1651
+ }, Ur = (e) => Qe(e), jr = (e) => {
1652
+ if (!e || e.length === 0)
1653
+ return Ot;
1654
+ const t = e.filter(
1655
+ (o) => {
1656
+ var n, a;
1657
+ return ((n = o == null ? void 0 : o.message) == null ? void 0 : n.role) === Pt && typeof ((a = o == null ? void 0 : o.message) == null ? void 0 : a.processingTime) == "number";
1658
+ }
1659
+ ).map((o) => o.message.processingTime);
1660
+ return Dt({
1661
+ data: t,
1662
+ formatter: Ur
1663
+ });
1664
+ }, Kr = ({
1665
+ isAuthenticated: e,
1666
+ stats: t
1667
+ }) => {
1668
+ const { state: o } = B(me), n = Bt - Number(o == null ? void 0 : o.usage), a = de(), i = de();
1669
+ return e ? /* @__PURE__ */ v(_, { children: [
1670
+ o && o.messages.length > 0 && /* @__PURE__ */ r("div", { className: "mb-4", children: /* @__PURE__ */ r(
1671
+ O,
1672
+ {
1673
+ header: w.CURRENT_STATISTICS.TITLE,
1674
+ className: "prose-dark dark:prose-lighter",
1675
+ children: le(a, {
1676
+ [w.CURRENT_STATISTICS.MODEL_NAME]: (o == null ? void 0 : o.model) || se,
1677
+ [w.CURRENT_STATISTICS.TOKENS_USED]: o == null ? void 0 : o.usage,
1678
+ [w.CURRENT_STATISTICS.REMAINING_TOKENS]: Lt.format(n),
1679
+ [w.CURRENT_STATISTICS.PROCESSING_TIME]: jr(o == null ? void 0 : o.messages)
1680
+ })
1681
+ }
1682
+ ) }),
1683
+ /* @__PURE__ */ r(
1684
+ O,
1685
+ {
1686
+ header: w.MAIN_STATISTICS.TITLE,
1687
+ className: "prose-dark dark:prose-lighter",
1688
+ children: le(i, {
1689
+ [pe(w.MAIN_STATISTICS.TOTAL, t.totalChats)]: t.totalChats,
1690
+ [w.MAIN_STATISTICS.PROCESSING_TIME]: Qe(
1691
+ t.averageProcessingTimes
1692
+ )
1693
+ })
1694
+ }
1695
+ )
1696
+ ] }) : null;
1697
+ }, Wr = ({
1698
+ open: e,
1699
+ onOpenChange: t
1700
+ }) => {
1701
+ const [o, n] = x({
1702
+ averageProcessingTimes: 0,
1703
+ totalChats: 0
1704
+ }), { isAuthenticated: a, getAccessToken: i, user: s } = te();
1705
+ return U(() => {
1706
+ !e || !s || (async () => {
1707
+ try {
1708
+ const l = await H({
1709
+ accessToken: await i(),
1710
+ type: F.GET_CHATS_STATS,
1711
+ params: {
1712
+ userId: s.username
1713
+ }
1714
+ });
1715
+ l.status === 200 && n(l.data);
1716
+ } catch {
1717
+ }
1718
+ })();
1719
+ }, [e, i, s]), /* @__PURE__ */ r(q, { open: e, onOpenChange: t, title: et, children: /* @__PURE__ */ r(Kr, { isAuthenticated: a, stats: o }) });
1720
+ }, xt = ({
1721
+ showConfirmation: e,
1722
+ setShowConfirmation: t,
1723
+ action: o,
1724
+ children: n,
1725
+ customStrings: a
1726
+ }) => /* @__PURE__ */ r(
1727
+ q,
1728
+ {
1729
+ kind: "messagebox",
1730
+ open: e,
1731
+ onOpenChange: t,
1732
+ title: a.title,
1733
+ footer: /* @__PURE__ */ v(Ae, { columnGap: 2, alignHorizontal: "flex-end", children: [
1734
+ /* @__PURE__ */ r(ee, { children: /* @__PURE__ */ r(
1735
+ J,
1736
+ {
1737
+ mode: "dark",
1738
+ variant: "secondary",
1739
+ focusMode: "light",
1740
+ onClick: () => {
1741
+ t(!1);
1742
+ },
1743
+ children: a.cancelAction
1744
+ }
1745
+ ) }),
1746
+ /* @__PURE__ */ r(ee, { children: /* @__PURE__ */ r(
1747
+ J,
1748
+ {
1749
+ mode: "dark",
1750
+ variant: "danger",
1751
+ focusMode: "light",
1752
+ onClick: () => {
1753
+ t(!1), o();
1754
+ },
1755
+ children: a.confirmAction
1756
+ }
1757
+ ) })
1758
+ ] }),
1759
+ children: n
1760
+ }
1761
+ );
1762
+ var Yr = typeof window < "u", Zr = function(e, t) {
1763
+ return Yr ? 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);
1764
+ }, qr = function(e, t) {
1765
+ var o = x(Zr(e)), n = o[0], a = o[1];
1766
+ return U(function() {
1767
+ var i = !0, s = window.matchMedia(e), l = function() {
1768
+ i && a(!!s.matches);
1769
+ };
1770
+ return s.addEventListener("change", l), a(s.matches), function() {
1771
+ i = !1, s.removeEventListener("change", l);
1772
+ };
1773
+ }, [e]), n;
1774
+ };
1775
+ const Xr = async (e, t, o, n) => {
1776
+ try {
1777
+ const a = await H({
1778
+ accessToken: n,
1779
+ type: F.GET_CHAT,
1780
+ params: {
1781
+ id: e.id
1782
+ }
1783
+ });
1784
+ a.status === 200 && (t({
1785
+ type: Vt
1786
+ }), t({
1787
+ type: zt,
1788
+ payload: {
1789
+ id: e.id,
1790
+ model: a.data.model,
1791
+ usage: a.data.usage,
1792
+ messages: a.data.messages
1793
+ }
1794
+ }), o(!1));
1795
+ } catch {
1796
+ }
1797
+ }, Xe = (e) => {
1798
+ const t = e[0];
1799
+ return Ht(t == null ? void 0 : t.content, 100);
1800
+ }, Jr = ({
1801
+ filteredHistory: e,
1802
+ setFilteredHistory: t,
1803
+ dispatch: o,
1804
+ onOpenChange: n
1805
+ }) => {
1806
+ var T;
1807
+ const { user: a, getAccessToken: i } = te(), s = ce({
1808
+ id: 0,
1809
+ timestamp: "",
1810
+ message: ""
1811
+ }), [l, h] = x(!1), u = qr("(min-width: 480px)"), { state: m, dispatch: g } = B(tt), [, b] = G({
1812
+ key: z + $t,
1813
+ initialValue: m.sortDirection
1814
+ }), d = e.data.sort(
1815
+ (p, k) => {
1816
+ switch (m.sortedCell) {
1817
+ case "timestamp":
1818
+ if (m.sortDirection === D.ASC)
1819
+ return new Date(p[m.sortedCell]).getTime() - new Date(k[m.sortedCell]).getTime();
1820
+ if (m.sortDirection === D.DESC)
1821
+ return new Date(k[m.sortedCell]).getTime() - new Date(p[m.sortedCell]).getTime();
1822
+ break;
1823
+ default:
1824
+ return 0;
1825
+ }
1826
+ return 0;
1827
+ }
1828
+ ), c = (p) => {
1829
+ switch (m.sortDirection) {
1830
+ case !1:
1831
+ b(D.ASC), g({
1832
+ type: ke,
1833
+ payload: {
1834
+ sortedCell: p,
1835
+ sortDirection: D.ASC
1836
+ }
1837
+ });
1838
+ break;
1839
+ case D.ASC:
1840
+ b(D.DESC), g({
1841
+ type: ke,
1842
+ payload: {
1843
+ sortedCell: p,
1844
+ sortDirection: D.DESC
1845
+ }
1846
+ });
1847
+ break;
1848
+ default:
1849
+ b(D.ASC), g({
1850
+ type: ke,
1851
+ payload: {
1852
+ sortedCell: p,
1853
+ sortDirection: D.ASC
1854
+ }
1855
+ });
1856
+ break;
1857
+ }
1858
+ };
1859
+ return /* @__PURE__ */ v(_, { children: [
1860
+ /* @__PURE__ */ v(
1861
+ xt,
1862
+ {
1863
+ showConfirmation: l,
1864
+ setShowConfirmation: h,
1865
+ action: async () => {
1866
+ const p = s.current;
1867
+ try {
1868
+ const k = await H({
1869
+ accessToken: await i(),
1870
+ type: F.DELETE_CHAT,
1871
+ params: {
1872
+ userId: (a == null ? void 0 : a.username) || "",
1873
+ id: p.id
1874
+ }
1875
+ });
1876
+ k.status === 200 && t({ data: k.data });
1877
+ } catch {
1878
+ }
1879
+ },
1880
+ customStrings: {
1881
+ confirmAction: "Delete",
1882
+ cancelAction: "Cancel",
1883
+ title: "Delete chat"
1884
+ },
1885
+ children: [
1886
+ /* @__PURE__ */ r("p", { className: "m-0", children: "Are you sure you want to delete the following chat:" }),
1887
+ /* @__PURE__ */ v("ul", { className: "m-0", children: [
1888
+ /* @__PURE__ */ v("li", { children: [
1889
+ "Timestamp:",
1890
+ " ",
1891
+ /* @__PURE__ */ r("span", { className: "text-lg", children: s.current && s.current.timestamp })
1892
+ ] }),
1893
+ /* @__PURE__ */ v("li", { children: [
1894
+ "First message:",
1895
+ " ",
1896
+ /* @__PURE__ */ r("span", { className: "text-lg", children: (T = s.current) == null ? void 0 : T.message })
1897
+ ] })
1898
+ ] })
1899
+ ]
1900
+ }
1901
+ ),
1902
+ /* @__PURE__ */ v(qt, { stickyHeader: !0, stickyFooter: !0, wrapperClassName: "max-h-[60vh]", children: [
1903
+ /* @__PURE__ */ r(Xt, { children: /* @__PURE__ */ v(Ne, { children: [
1904
+ u && /* @__PURE__ */ r(V, { className: "sr-only", children: "Row" }),
1905
+ /* @__PURE__ */ r(
1906
+ Jt,
1907
+ {
1908
+ cellId: "timestamp",
1909
+ align: "left",
1910
+ sortDirection: m.sortDirection,
1911
+ sortedCell: m.sortedCell,
1912
+ onClick: () => {
1913
+ c("timestamp");
1914
+ },
1915
+ children: "Date"
1916
+ }
1917
+ ),
1918
+ /* @__PURE__ */ r(V, { children: "First message" }),
1919
+ /* @__PURE__ */ r(V, { className: "text-right", children: "Actions" })
1920
+ ] }) }),
1921
+ /* @__PURE__ */ r(Qt, { children: d.map((p, k) => {
1922
+ var E;
1923
+ return ((E = p == null ? void 0 : p.messages) == null ? void 0 : E.length) > 0 ? /* @__PURE__ */ v(Ne, { children: [
1924
+ u && /* @__PURE__ */ r(V, { children: k + 1 }),
1925
+ /* @__PURE__ */ r(
1926
+ V,
1927
+ {
1928
+ component: "th",
1929
+ scope: "row",
1930
+ className: "font-medium text-gray-400 sm:whitespace-nowrap",
1931
+ children: p.timestamp
1932
+ }
1933
+ ),
1934
+ /* @__PURE__ */ r(V, { className: "max-w-[100px] text-white sm:max-w-full", children: Xe(p.messages) }),
1935
+ /* @__PURE__ */ r(V, { children: /* @__PURE__ */ v("div", { className: "flex justify-end gap-2", children: [
1936
+ /* @__PURE__ */ r(
1937
+ Q,
1938
+ {
1939
+ focusMode: "alt-system",
1940
+ noBorder: !0,
1941
+ label: "Restore chat",
1942
+ onClick: async () => {
1943
+ const S = await i();
1944
+ Xr(
1945
+ p,
1946
+ o,
1947
+ n,
1948
+ S
1949
+ );
1950
+ },
1951
+ children: /* @__PURE__ */ r(_o, { className: "h-3 w-3", monotone: !0 })
1952
+ }
1953
+ ),
1954
+ /* @__PURE__ */ r(
1955
+ Q,
1956
+ {
1957
+ focusMode: "alt-system",
1958
+ noBorder: !0,
1959
+ label: "Delete chat",
1960
+ onClick: () => {
1961
+ s.current = {
1962
+ id: p.id,
1963
+ timestamp: p.timestamp,
1964
+ message: Xe(p.messages)
1965
+ }, h(!l);
1966
+ },
1967
+ children: /* @__PURE__ */ r("div", { className: "text-red-400", children: /* @__PURE__ */ r(No, { className: "h-3 w-3", monotone: !0 }) })
1968
+ }
1969
+ )
1970
+ ] }) })
1971
+ ] }, `${w.HISTORY.TITLE}-${p.id}-${k}`) : null;
1972
+ }) }),
1973
+ /* @__PURE__ */ r(eo, { children: /* @__PURE__ */ r(Ne, { children: /* @__PURE__ */ r(V, { colSpan: 4, children: /* @__PURE__ */ r("div", { children: pe(
1974
+ `${e.data.length} chat`,
1975
+ e.data.length
1976
+ ) }) }) }) })
1977
+ ] })
1978
+ ] });
1979
+ };
1980
+ function Je(e, t) {
1981
+ return t ? e.filter(
1982
+ (o) => o.messages.some(
1983
+ (n) => n.content !== null && n.content.toLowerCase().includes(t.toLowerCase())
1984
+ )
1985
+ ) : e;
1986
+ }
1987
+ const Qr = ({
1988
+ onOpenChange: e,
1989
+ historyData: t
1990
+ }) => {
1991
+ const { isAuthenticated: o } = te(), n = ce(null), { dispatch: a } = B(me), { state: i, dispatch: s } = B(tt), [, l] = G({
1992
+ key: z + Ft,
1993
+ initialValue: i.searchString
1994
+ }), h = no(() => t, [t]), [u, m] = x({
1995
+ data: h
1996
+ }), g = (c) => {
1997
+ const y = Je(h, c);
1998
+ m({
1999
+ data: y
2000
+ }), l(c), s({
2001
+ type: Ut,
2002
+ payload: { searchString: c }
2003
+ });
2004
+ }, b = (c) => {
2005
+ g(c.target.value);
2006
+ }, d = async (c) => {
2007
+ c.preventDefault();
2008
+ };
2009
+ return U(() => {
2010
+ const c = Je(
2011
+ t,
2012
+ i.searchString
2013
+ );
2014
+ m({
2015
+ data: c
2016
+ });
2017
+ }, [t, i.searchString]), o ? u && u.data && /* @__PURE__ */ v(_, { children: [
2018
+ /* @__PURE__ */ r("form", { autoComplete: "off", onSubmit: d, children: /* @__PURE__ */ r(
2019
+ Gt,
2020
+ {
2021
+ ref: n,
2022
+ defaultValue: i.searchString,
2023
+ focusMode: "light",
2024
+ name: "Search",
2025
+ label: "Search",
2026
+ onChange: b,
2027
+ spacing: { t: 2, b: 2 },
2028
+ ...i.searchString && {
2029
+ rightElement: /* @__PURE__ */ r(
2030
+ J,
2031
+ {
2032
+ disabled: !i.searchString,
2033
+ mode: "dark",
2034
+ noBorder: !0,
2035
+ size: "small",
2036
+ onClick: () => {
2037
+ var c;
2038
+ g(""), (c = n.current) != null && c.value && (n.current.value = "", n.current.focus());
2039
+ },
2040
+ children: "Reset"
2041
+ }
2042
+ )
2043
+ }
2044
+ }
2045
+ ) }),
2046
+ /* @__PURE__ */ r("div", { className: "flex flex-col gap-2 sm:flex-row", children: /* @__PURE__ */ r(
2047
+ Jr,
2048
+ {
2049
+ filteredHistory: u,
2050
+ setFilteredHistory: m,
2051
+ dispatch: a,
2052
+ onOpenChange: e
2053
+ }
2054
+ ) })
2055
+ ] }) : null;
2056
+ }, en = ({
2057
+ open: e,
2058
+ onOpenChange: t,
2059
+ historyData: o
2060
+ }) => /* @__PURE__ */ r(q, { open: e, onOpenChange: t, title: jt, children: /* @__PURE__ */ r(Qr, { onOpenChange: t, historyData: o }) });
2061
+ /*!
2062
+ @versini/ui-toggle v1.0.7
2063
+ © 2024 gizmette.com
2064
+ */
2065
+ try {
2066
+ window.__VERSINI_UI_TOGGLE__ || (window.__VERSINI_UI_TOGGLE__ = {
2067
+ version: "1.0.7",
2068
+ buildTime: "09/27/2024 11:56 AM EDT",
2069
+ homepage: "https://github.com/aversini/ui-components",
2070
+ license: "MIT"
2071
+ });
2072
+ } catch {
2073
+ }
2074
+ const tn = "av-toggle", on = (e) => {
2075
+ let t = "";
2076
+ if (typeof e == "number" || typeof e == "string")
2077
+ t = "m-" + e;
2078
+ else {
2079
+ const o = [];
2080
+ (e == null ? void 0 : e.t) !== void 0 && o.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && o.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && o.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && o.push(`ml-${e.l}`), t = o.join(" ");
2081
+ }
2082
+ return t;
2083
+ }, rn = () => C("peer", "h-6", "w-11", "rounded-full"), nn = ({
2084
+ focusMode: e
2085
+ }) => C(
2086
+ "peer-focus:outline",
2087
+ "peer-focus:outline-2",
2088
+ "peer-focus:outline-offset-2",
2089
+ {
2090
+ "peer-focus:outline-focus-dark": e === "dark",
2091
+ "peer-focus:outline-focus-light": e === "light",
2092
+ "peer-focus:outline-focus-light dark:peer-focus:outline-focus-dark": e === "alt-system",
2093
+ "peer-focus:outline-focus-dark dark:peer-focus:outline-focus-light": e === "system"
2094
+ }
2095
+ ), an = () => C(
2096
+ "peer-checked:after:translate-x-full",
2097
+ // background color when checked
2098
+ "peer-checked:bg-violet-500",
2099
+ // knob circle and border color when checked
2100
+ "peer-checked:after:bg-white",
2101
+ "peer-checked:after:border-white"
2102
+ ), sn = () => C(
2103
+ "after:left-[2px]",
2104
+ "after:top-[2px]",
2105
+ "after:border",
2106
+ "after:border-surface-light dark:after:border-surface-medium",
2107
+ "after:bg-surface-light dark:after:bg-surface-medium",
2108
+ "after:absolute",
2109
+ "after:h-5",
2110
+ "after:w-5",
2111
+ "after:rounded-full",
2112
+ "after:transition-all",
2113
+ "after:content-['']"
2114
+ ), ln = ({
2115
+ mode: e,
2116
+ noBorder: t
2117
+ }) => C({
2118
+ border: !t,
2119
+ "border-border-dark bg-surface-medium": e === "light",
2120
+ "border-border-light bg-surface-darker": e === "dark",
2121
+ "border-border-light bg-surface-darker dark:border-border-dark dark:bg-surface-medium": e === "alt-system",
2122
+ "border-border-dark bg-surface-medium dark:border-border-light dark:bg-surface-darker": e === "system"
2123
+ }), cn = ({
2124
+ mode: e,
2125
+ labelHidden: t
2126
+ }) => t ? "sr-only" : C("ml-2 text-sm", {
2127
+ "text-copy-dark": e === "light",
2128
+ "text-copy-lighter": e === "dark",
2129
+ "text-copy-lighter dark:text-copy-dark": e === "alt-system",
2130
+ "text-copy-dark dark:text-copy-lighter": e === "system"
2131
+ }), dn = ({ spacing: e }) => C(
2132
+ tn,
2133
+ "relative flex cursor-pointer items-center",
2134
+ on(e)
2135
+ ), un = ({
2136
+ mode: e,
2137
+ focusMode: t,
2138
+ labelHidden: o,
2139
+ spacing: n,
2140
+ noBorder: a
2141
+ }) => ({
2142
+ toggle: C(
2143
+ rn(),
2144
+ ln({ mode: e, noBorder: a }),
2145
+ nn({ focusMode: t }),
2146
+ sn(),
2147
+ an()
2148
+ ),
2149
+ label: cn({ mode: e, labelHidden: o }),
2150
+ input: "peer sr-only",
2151
+ wrapper: dn({ spacing: n })
2152
+ }), Z = ({
2153
+ checked: e = !1,
2154
+ onChange: t,
2155
+ label: o,
2156
+ labelHidden: n = !1,
2157
+ name: a,
2158
+ mode: i = "system",
2159
+ focusMode: s = "system",
2160
+ spacing: l,
2161
+ noBorder: h = !1
2162
+ }) => {
2163
+ const u = un({
2164
+ mode: i,
2165
+ focusMode: s,
2166
+ labelHidden: n,
2167
+ spacing: l,
2168
+ noBorder: h
2169
+ }), m = (g) => {
2170
+ t == null || t(g.target.checked);
2171
+ };
2172
+ return /* @__PURE__ */ v("label", { className: u.wrapper, children: [
2173
+ /* @__PURE__ */ r(
2174
+ "input",
2175
+ {
2176
+ name: a,
2177
+ checked: e,
2178
+ type: "checkbox",
2179
+ className: u.input,
2180
+ onChange: m
2181
+ }
2182
+ ),
2183
+ /* @__PURE__ */ r("div", { className: u.toggle }),
2184
+ /* @__PURE__ */ r("span", { className: u.label, children: o })
2185
+ ] });
2186
+ }, mn = ({
2187
+ open: e,
2188
+ onOpenChange: t
2189
+ }) => {
2190
+ const { dispatch: o } = B(me), { getAccessToken: n, user: a } = te(), [i, s] = x({
2191
+ loaded: !1,
2192
+ instructions: "",
2193
+ loadingLocation: !1,
2194
+ location: "",
2195
+ engine: se
2196
+ }), [l, h] = G({
2197
+ key: z + ot,
2198
+ initialValue: !1
2199
+ }), u = async (d) => {
2200
+ d.preventDefault();
2201
+ try {
2202
+ await H({
2203
+ accessToken: await n(),
2204
+ type: F.SET_USER_PREFERENCES,
2205
+ params: {
2206
+ user: a == null ? void 0 : a.username,
2207
+ instructions: i.instructions,
2208
+ location: i.location,
2209
+ engine: i.engine
2210
+ }
2211
+ }), o({
2212
+ type: rt,
2213
+ payload: {
2214
+ engine: i.engine
2215
+ }
2216
+ });
2217
+ } catch {
2218
+ }
2219
+ }, m = async () => {
2220
+ s((d) => ({
2221
+ ...d,
2222
+ location: "...",
2223
+ loadingLocation: !0
2224
+ }));
2225
+ try {
2226
+ const d = Date.now(), c = await Kt(), y = await H({
2227
+ accessToken: await n(),
2228
+ type: F.GET_LOCATION,
2229
+ params: {
2230
+ latitude: c.latitude,
2231
+ longitude: c.longitude
2232
+ }
2233
+ }), p = Date.now() - d;
2234
+ if (p < 2e3 && await new Promise((k) => setTimeout(k, 2e3 - p)), y.status === 200) {
2235
+ const { city: k, state: E, country: S, displayName: M } = y.data, R = k && E && S ? `${k}, ${E}, ${S}` : M;
2236
+ s((P) => ({
2237
+ ...P,
2238
+ loaded: !0,
2239
+ location: R,
2240
+ loadingLocation: !1
2241
+ }));
2242
+ } else
2243
+ s((k) => ({
2244
+ ...k,
2245
+ loaded: !0,
2246
+ location: "",
2247
+ loadingLocation: !1
2248
+ }));
2249
+ } catch {
2250
+ }
2251
+ }, g = (d) => {
2252
+ s((c) => ({
2253
+ ...c,
2254
+ engine: d ? Ce : Te
2255
+ }));
2256
+ }, b = (d) => {
2257
+ s((c) => ({
2258
+ ...c,
2259
+ engine: d ? Te : Ce
2260
+ }));
2261
+ };
2262
+ return U(() => {
2263
+ if (!e || !a) {
2264
+ s({
2265
+ loaded: !1,
2266
+ loadingLocation: !1,
2267
+ instructions: "",
2268
+ location: "",
2269
+ engine: se
2270
+ });
2271
+ return;
2272
+ }
2273
+ (async () => {
2274
+ try {
2275
+ const d = await H({
2276
+ accessToken: await n(),
2277
+ type: F.GET_USER_PREFERENCES,
2278
+ params: {
2279
+ user: a.username
2280
+ }
2281
+ });
2282
+ d.status === 200 && s((c) => ({
2283
+ ...c,
2284
+ loaded: !0,
2285
+ instructions: d.data.instructions || "",
2286
+ location: d.data.location || "",
2287
+ engine: d.data.engine || se
2288
+ }));
2289
+ } catch {
2290
+ }
2291
+ })();
2292
+ }, [a, e]), /* @__PURE__ */ r(_, { children: i.loaded && /* @__PURE__ */ r(
2293
+ q,
2294
+ {
2295
+ open: e,
2296
+ onOpenChange: t,
2297
+ title: "Engine Fine Tuning",
2298
+ footer: /* @__PURE__ */ v(Ae, { columnGap: 2, alignHorizontal: "flex-end", children: [
2299
+ /* @__PURE__ */ r(ee, { children: /* @__PURE__ */ r(
2300
+ J,
2301
+ {
2302
+ mode: "dark",
2303
+ variant: "secondary",
2304
+ focusMode: "light",
2305
+ onClick: () => {
2306
+ t(!1);
2307
+ },
2308
+ children: "Cancel"
2309
+ }
2310
+ ) }),
2311
+ /* @__PURE__ */ r(ee, { children: /* @__PURE__ */ r(
2312
+ J,
2313
+ {
2314
+ mode: "dark",
2315
+ variant: "danger",
2316
+ focusMode: "light",
2317
+ onClick: async (d) => {
2318
+ t(!1), await u(d);
2319
+ },
2320
+ children: "Save"
2321
+ }
2322
+ ) })
2323
+ ] }),
2324
+ children: /* @__PURE__ */ v(_, { children: [
2325
+ /* @__PURE__ */ v(
2326
+ O,
2327
+ {
2328
+ header: "AI Engine",
2329
+ className: "prose-dark dark:prose-lighter",
2330
+ children: [
2331
+ /* @__PURE__ */ r("p", { children: "Select the AI engine that will be used to generate responses." }),
2332
+ /* @__PURE__ */ r(
2333
+ Z,
2334
+ {
2335
+ noBorder: !0,
2336
+ label: "OpenAI",
2337
+ name: "OpenAI",
2338
+ onChange: g,
2339
+ checked: i.engine === Ce
2340
+ }
2341
+ ),
2342
+ /* @__PURE__ */ r(
2343
+ Z,
2344
+ {
2345
+ spacing: { t: 2 },
2346
+ noBorder: !0,
2347
+ label: "Anthropic",
2348
+ name: "Anthropic",
2349
+ onChange: b,
2350
+ checked: i.engine === Te
2351
+ }
2352
+ ),
2353
+ /* @__PURE__ */ r("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." }),
2354
+ /* @__PURE__ */ r(
2355
+ Z,
2356
+ {
2357
+ spacing: { t: 2 },
2358
+ noBorder: !0,
2359
+ label: "Show Engine Toggle in Menu",
2360
+ name: "show-toggle-engine-menu",
2361
+ onChange: h,
2362
+ checked: l
2363
+ }
2364
+ ),
2365
+ /* @__PURE__ */ r("p", { className: "text-xs", children: "This option will show the engine toggle in the main menu. This is useful if you want to quickly switch between engines." })
2366
+ ]
2367
+ }
2368
+ ),
2369
+ /* @__PURE__ */ v(
2370
+ O,
2371
+ {
2372
+ spacing: { t: 4 },
2373
+ header: "Custom Instructions",
2374
+ className: "prose-dark dark:prose-lighter",
2375
+ children: [
2376
+ /* @__PURE__ */ r("p", { children: "What would you like Sassy Saint to know about you to provide better responses?" }),
2377
+ /* @__PURE__ */ r(
2378
+ Ge,
2379
+ {
2380
+ mode: "alt-system",
2381
+ autoCapitalize: "off",
2382
+ autoComplete: "off",
2383
+ autoCorrect: "off",
2384
+ name: "customInstructions",
2385
+ label: "Custom Instructions",
2386
+ value: i.instructions,
2387
+ onChange: (d) => {
2388
+ s((c) => ({
2389
+ ...c,
2390
+ loaded: !0,
2391
+ instructions: d.target.value
2392
+ }));
2393
+ },
2394
+ helperText: "Press ENTER to add a new line."
2395
+ }
2396
+ )
2397
+ ]
2398
+ }
2399
+ ),
2400
+ /* @__PURE__ */ v(
2401
+ O,
2402
+ {
2403
+ header: "Location",
2404
+ className: "prose-dark dark:prose-lighter",
2405
+ spacing: { t: 4 },
2406
+ children: [
2407
+ /* @__PURE__ */ r("p", { children: "You can share your location to receive customized responses based on your area." }),
2408
+ /* @__PURE__ */ r(
2409
+ Ge,
2410
+ {
2411
+ mode: "alt-system",
2412
+ name: "location",
2413
+ label: "Location",
2414
+ value: i.location,
2415
+ onChange: (d) => {
2416
+ s((c) => ({
2417
+ ...c,
2418
+ loaded: !0,
2419
+ location: d.target.value
2420
+ }));
2421
+ },
2422
+ helperText: "Enter your location or press auto-detect."
2423
+ }
2424
+ ),
2425
+ /* @__PURE__ */ r(
2426
+ J,
2427
+ {
2428
+ spacing: { t: 2 },
2429
+ size: "small",
2430
+ noBorder: !0,
2431
+ disabled: i.loadingLocation,
2432
+ onClick: m,
2433
+ children: i.loadingLocation ? "Detecting..." : "Auto-detect"
2434
+ }
2435
+ )
2436
+ ]
2437
+ }
2438
+ )
2439
+ ] })
2440
+ }
2441
+ ) });
2442
+ }, hn = ({
2443
+ open: e,
2444
+ onOpenChange: t
2445
+ }) => {
2446
+ const [o, n] = G({
2447
+ key: z + $e,
2448
+ initialValue: !1
2449
+ }), [a, i] = G({
2450
+ key: z + Ve,
2451
+ initialValue: !1
2452
+ }), [s, l] = G({
2453
+ key: z + ze,
2454
+ initialValue: !1
2455
+ }), h = (g) => {
2456
+ n(g);
2457
+ }, u = (g) => {
2458
+ i(g);
2459
+ }, m = (g) => {
2460
+ l(g);
2461
+ };
2462
+ return /* @__PURE__ */ r(q, { open: e, onOpenChange: t, title: "Tags", children: /* @__PURE__ */ v(O, { header: w.TAGS.TITLE, className: "prose-dark dark:prose-lighter", children: [
2463
+ /* @__PURE__ */ r("p", { children: w.TAGS.DESCRIPTION }),
2464
+ /* @__PURE__ */ r(
2465
+ Z,
2466
+ {
2467
+ noBorder: !0,
2468
+ label: we[Ee.SUMMARIZE_ARTICLE].label,
2469
+ name: $e,
2470
+ onChange: h,
2471
+ checked: o
2472
+ }
2473
+ ),
2474
+ /* @__PURE__ */ r(
2475
+ Z,
2476
+ {
2477
+ spacing: { t: 2 },
2478
+ noBorder: !0,
2479
+ label: we[Ee.PROOFREAD_CONTENT].label,
2480
+ name: Ve,
2481
+ onChange: u,
2482
+ checked: a
2483
+ }
2484
+ ),
2485
+ /* @__PURE__ */ r(
2486
+ Z,
2487
+ {
2488
+ spacing: { t: 2 },
2489
+ noBorder: !0,
2490
+ label: we[Ee.REPHRASE_CONTENT].label,
2491
+ name: ze,
2492
+ onChange: m,
2493
+ checked: s
2494
+ }
2495
+ )
2496
+ ] }) });
2497
+ }, gn = () => {
2498
+ const { isAuthenticated: e, user: t, registeringForPasskey: o, authenticationType: n } = te(), [a, i] = G({
2499
+ key: z + Wt,
2500
+ initialValue: !1
2501
+ }), [s, l] = x(!1), [h, u] = x(!1), m = de(), g = (t == null ? void 0 : t.username) || "", b = (y) => {
2502
+ i(y);
2503
+ }, d = () => {
2504
+ l(!s);
2505
+ }, c = () => {
2506
+ u(!h);
2507
+ };
2508
+ return e && g ? /* @__PURE__ */ v(_, { children: [
2509
+ s && /* @__PURE__ */ r(
2510
+ mn,
2511
+ {
2512
+ open: s,
2513
+ onOpenChange: l
2514
+ }
2515
+ ),
2516
+ h && /* @__PURE__ */ r(hn, { open: h, onOpenChange: u }),
2517
+ /* @__PURE__ */ v(
2518
+ O,
2519
+ {
2520
+ header: w.PREFERENCES.TITLE,
2521
+ className: "prose-dark dark:prose-lighter",
2522
+ children: [
2523
+ le(m, {
2524
+ [w.PREFERENCES.NAME]: g,
2525
+ [w.PREFERENCES.EMAIL]: (t == null ? void 0 : t.email) || "",
2526
+ [w.PREFERENCES.ENGINE_DETAILS]: /* @__PURE__ */ r(
2527
+ Z,
2528
+ {
2529
+ noBorder: !0,
2530
+ labelHidden: !0,
2531
+ label: w.PREFERENCES.ENGINE_DETAILS,
2532
+ name: w.PREFERENCES.ENGINE_DETAILS,
2533
+ onChange: b,
2534
+ checked: a
2535
+ }
2536
+ )
2537
+ }),
2538
+ /* @__PURE__ */ r(
2539
+ Q,
2540
+ {
2541
+ spacing: { t: 2 },
2542
+ size: "small",
2543
+ onClick: d,
2544
+ labelLeft: "Engine Fine Tuning",
2545
+ children: /* @__PURE__ */ r(Ue, { className: "size-3", monotone: !0 })
2546
+ }
2547
+ ),
2548
+ /* @__PURE__ */ r(
2549
+ Q,
2550
+ {
2551
+ spacing: { t: 2, l: 2 },
2552
+ size: "small",
2553
+ onClick: c,
2554
+ labelLeft: "Tags",
2555
+ children: /* @__PURE__ */ r(Ue, { className: "size-3", monotone: !0 })
2556
+ }
2557
+ )
2558
+ ]
2559
+ }
2560
+ ),
2561
+ n !== Yt.PASSKEY && /* @__PURE__ */ v(
2562
+ O,
2563
+ {
2564
+ spacing: { t: 4 },
2565
+ className: "prose-dark dark:prose-lighter",
2566
+ header: /* @__PURE__ */ r("h2", { className: "m-0", children: /* @__PURE__ */ v(Ae, { columnGap: 3, alignVertical: "center", children: [
2567
+ /* @__PURE__ */ r(ee, { children: /* @__PURE__ */ r(He, { className: "size-8" }) }),
2568
+ /* @__PURE__ */ r(ee, { children: /* @__PURE__ */ r("div", { children: w.PREFERENCES.PASSKEY_TITLE }) })
2569
+ ] }) }),
2570
+ children: [
2571
+ /* @__PURE__ */ r("p", { children: w.PREFERENCES.PASSKEY_INSTRUCTIONS }),
2572
+ /* @__PURE__ */ r(
2573
+ Q,
2574
+ {
2575
+ size: "small",
2576
+ spacing: { t: 2 },
2577
+ onClick: o,
2578
+ labelLeft: w.PREFERENCES.PASSKEY_BUTTON,
2579
+ children: /* @__PURE__ */ r(He, { className: "size-5", monotone: !0 })
2580
+ }
2581
+ )
2582
+ ]
2583
+ }
2584
+ )
2585
+ ] }) : null;
2586
+ }, pn = ({
2587
+ open: e,
2588
+ onOpenChange: t
2589
+ }) => /* @__PURE__ */ r(q, { open: e, onOpenChange: t, title: Zt, children: /* @__PURE__ */ r(gn, {}) }), wn = () => {
2590
+ const { state: e, dispatch: t, serverStats: o } = B(me), [n, a] = x((e == null ? void 0 : e.engine) || se), [i, s] = x(!1), [l, h] = x(!1), [u, m] = x(!1), [g, b] = x(!1), [d, c] = x([]), [y, T] = x(!1), [p, k] = x({
2591
+ done: !1,
2592
+ progress: !1,
2593
+ timestamp: Date.now()
2594
+ }), [E] = G({
2595
+ key: z + ot,
2596
+ initialValue: !1
2597
+ }), { logout: S, getAccessToken: M, user: R } = te(), P = () => {
2598
+ s(!i);
2599
+ }, N = () => {
2600
+ h(!l);
2601
+ }, re = () => {
2602
+ m(!u);
2603
+ }, X = () => {
2604
+ b(!g);
2605
+ }, j = async (L) => {
2606
+ const K = Date.now();
2607
+ if (L && !(!R || !e || p.progress || p.done === !0 && K - p.timestamp < 5e3)) {
2608
+ k({
2609
+ done: !0,
2610
+ progress: !0,
2611
+ timestamp: K
2612
+ });
2613
+ try {
2614
+ const A = await H({
2615
+ accessToken: await M(),
2616
+ type: F.GET_CHATS,
2617
+ params: {
2618
+ userId: R.username
2619
+ }
2620
+ });
2621
+ A.status === 200 && (c(A.data), k({
2622
+ done: !0,
2623
+ progress: !1,
2624
+ timestamp: Date.now()
2625
+ }));
2626
+ } catch {
2627
+ k({
2628
+ done: !0,
2629
+ progress: !1,
2630
+ timestamp: Date.now()
2631
+ });
2632
+ }
2633
+ }
2634
+ }, ne = () => {
2635
+ T(!y);
2636
+ };
2637
+ return U(() => {
2638
+ e && e.engine && e.engine !== n && a(e.engine);
2639
+ }, [e, n]), /* @__PURE__ */ v(_, { children: [
2640
+ /* @__PURE__ */ r(
2641
+ xt,
2642
+ {
2643
+ showConfirmation: y,
2644
+ setShowConfirmation: T,
2645
+ action: S,
2646
+ customStrings: {
2647
+ confirmAction: Fe,
2648
+ cancelAction: "Cancel",
2649
+ title: Fe
2650
+ },
2651
+ children: /* @__PURE__ */ r("p", { children: "Are you sure you want to log out?" })
2652
+ }
2653
+ ),
2654
+ /* @__PURE__ */ r(pn, { open: i, onOpenChange: s }),
2655
+ /* @__PURE__ */ r(Wr, { open: l, onOpenChange: h }),
2656
+ /* @__PURE__ */ r(
2657
+ en,
2658
+ {
2659
+ open: u,
2660
+ onOpenChange: m,
2661
+ historyData: d
2662
+ }
2663
+ ),
2664
+ /* @__PURE__ */ r(Gr, { open: g, onOpenChange: b }),
2665
+ /* @__PURE__ */ r("div", { className: "relative", children: /* @__PURE__ */ r("div", { className: "absolute bottom-[-28px] right-[-7px]", children: /* @__PURE__ */ v(
2666
+ ct,
2667
+ {
2668
+ mode: "dark",
2669
+ focusMode: "light",
2670
+ trigger: /* @__PURE__ */ r(Q, { children: /* @__PURE__ */ r(Ro, {}) }),
2671
+ defaultPlacement: "bottom-end",
2672
+ onOpenChange: j,
2673
+ children: [
2674
+ /* @__PURE__ */ r(
2675
+ W,
2676
+ {
2677
+ label: "Profile",
2678
+ onClick: P,
2679
+ icon: /* @__PURE__ */ r(xo, {})
2680
+ }
2681
+ ),
2682
+ /* @__PURE__ */ r(
2683
+ W,
2684
+ {
2685
+ label: et,
2686
+ onClick: N,
2687
+ icon: /* @__PURE__ */ r(Eo, {})
2688
+ }
2689
+ ),
2690
+ /* @__PURE__ */ r(
2691
+ W,
2692
+ {
2693
+ label: "History",
2694
+ onClick: re,
2695
+ icon: /* @__PURE__ */ r(Io, {})
2696
+ }
2697
+ ),
2698
+ /* @__PURE__ */ r(
2699
+ W,
2700
+ {
2701
+ label: "About",
2702
+ onClick: X,
2703
+ icon: /* @__PURE__ */ r(So, {})
2704
+ }
2705
+ ),
2706
+ E && o && /* @__PURE__ */ v(_, { children: [
2707
+ /* @__PURE__ */ r(Ke, {}),
2708
+ /* @__PURE__ */ r(W, { raw: !0, ignoreClick: !0, children: /* @__PURE__ */ r(
2709
+ kr,
2710
+ {
2711
+ size: "small",
2712
+ mode: "dark",
2713
+ focusMode: "light",
2714
+ value: n,
2715
+ onValueChange: async (L) => {
2716
+ if (L)
2717
+ try {
2718
+ await H({
2719
+ accessToken: await M(),
2720
+ type: F.SET_USER_PREFERENCES,
2721
+ params: {
2722
+ user: R == null ? void 0 : R.username,
2723
+ engine: L
2724
+ }
2725
+ }), t({
2726
+ type: rt,
2727
+ payload: {
2728
+ engine: L
2729
+ }
2730
+ });
2731
+ } catch {
2732
+ }
2733
+ },
2734
+ children: o && o.engines.map((L) => /* @__PURE__ */ r(Cr, { value: L }, L))
2735
+ }
2736
+ ) })
2737
+ ] }),
2738
+ e && e.id && !e.isComponent && /* @__PURE__ */ v(_, { children: [
2739
+ /* @__PURE__ */ r(Ke, {}),
2740
+ /* @__PURE__ */ r(
2741
+ W,
2742
+ {
2743
+ label: "Log out",
2744
+ onClick: ne,
2745
+ icon: /* @__PURE__ */ r("div", { className: "text-red-700", children: /* @__PURE__ */ r(wo, { monotone: !0 }) })
2746
+ }
2747
+ )
2748
+ ] })
2749
+ ]
2750
+ }
2751
+ ) }) })
2752
+ ] });
2753
+ };
2754
+ export {
2755
+ wn as default
2756
+ };