@versini/sassysaint 5.0.1 → 5.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1434 @@
1
+ import { jsxs as y, Fragment as D, jsx as i } from "react/jsx-runtime";
2
+ import { LOCAL_STORAGE_PREFIX as A, b as Te, j, R as M, TAG_CONTENT as O, TAGS as C, isLastMessageFromRole as se, CANCEL as _e, CLEAR as Ne, ACTION_RESET as de, ACTION_TOGGLE_TAG as le, ROLE_ASSISTANT as R, ROLE_INTERNAL as Y, ROLE_USER as W, rn as q, ROLE_SYSTEM as we, ROLE_HIDDEN as Ee, MODEL_GPT4 as ce, STATS_SEPARATOR as ee, ACTION_MODEL as ge, ACTION_MESSAGE as L, ACTION_RESET_TAGS as ue, TYPE_QUESTION as Ce, SEND as Re, ACTION_STREAMING as me, ERROR_MESSAGE as Ie, getMessageContaintWrapperClass as Se, MessagesContainerHeader as Be, ACTION_SEARCH as Me, ACTION_SORT as Ae, ACTION_RESTORE as Oe, d as Le, AppFooter as $e, LOCAL_STORAGE_SEARCH as Ue, LOCAL_STORAGE_SORT as Ve } from "./index.BuZgDoDD.js";
3
+ import { AppContext as P, TagsContext as Z, E as $, restCall as ze, we as De, serviceCall as Pe, SERVICE_TYPES as He, HistoryContext as je, f as Ge } from "./index.lZ9DXn26.js";
4
+ import S, { useContext as U, useRef as I, useEffect as E, useState as H, lazy as Fe, Suspense as te, useReducer as G } from "react";
5
+ import s from "clsx";
6
+ var f = [];
7
+ for (var F = 0; F < 256; ++F)
8
+ f.push((F + 256).toString(16).slice(1));
9
+ function We(e, t = 0) {
10
+ return (f[e[t + 0]] + f[e[t + 1]] + f[e[t + 2]] + f[e[t + 3]] + "-" + f[e[t + 4]] + f[e[t + 5]] + "-" + f[e[t + 6]] + f[e[t + 7]] + "-" + f[e[t + 8]] + f[e[t + 9]] + "-" + f[e[t + 10]] + f[e[t + 11]] + f[e[t + 12]] + f[e[t + 13]] + f[e[t + 14]] + f[e[t + 15]]).toLowerCase();
11
+ }
12
+ var V, Ye = new Uint8Array(16);
13
+ function qe() {
14
+ if (!V && (V = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !V))
15
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
16
+ return V(Ye);
17
+ }
18
+ var Ze = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
19
+ const re = {
20
+ randomUUID: Ze
21
+ };
22
+ function J(e, t, r) {
23
+ if (re.randomUUID && !t && !e)
24
+ return re.randomUUID();
25
+ e = e || {};
26
+ var a = e.random || (e.rng || qe)();
27
+ return a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, We(a);
28
+ }
29
+ const Je = () => {
30
+ const { dispatch: e, state: t } = U(P), { dispatch: r } = U(Z), a = "mt-2 flex justify-center rounded-md", n = I(null), o = I(!1), [g] = $({
31
+ key: A + "summarize-article",
32
+ initialValue: !1
33
+ }), [d] = $({
34
+ key: A + "proofread-content",
35
+ initialValue: !1
36
+ }), [p] = $({
37
+ key: A + "rephrase-content",
38
+ initialValue: !1
39
+ }), u = (c) => {
40
+ c.preventDefault(), e({
41
+ type: de
42
+ });
43
+ };
44
+ E(() => {
45
+ (t == null ? void 0 : t.streaming) === !0 && !o.current && n.current && (o.current = !0, n.current.focus()), (t == null ? void 0 : t.streaming) === !1 && (o.current = !1);
46
+ }, [t]);
47
+ const m = (c, h) => {
48
+ c.preventDefault(), r({
49
+ type: le,
50
+ payload: {
51
+ tag: h
52
+ }
53
+ });
54
+ };
55
+ return /* @__PURE__ */ y(D, { children: [
56
+ /* @__PURE__ */ y(Te, { alignHorizontal: "center", columnGap: 2, children: [
57
+ /* @__PURE__ */ i(j, { children: g && /* @__PURE__ */ i("div", { className: a, children: /* @__PURE__ */ i(
58
+ M,
59
+ {
60
+ noBorder: !0,
61
+ mode: "dark",
62
+ focusMode: "light",
63
+ size: "small",
64
+ onClick: (c) => m(c, C.SUMMARIZE_ARTICLE),
65
+ children: O[C.SUMMARIZE_ARTICLE].label
66
+ }
67
+ ) }) }),
68
+ /* @__PURE__ */ i(j, { children: d && /* @__PURE__ */ i("div", { className: a, children: /* @__PURE__ */ i(
69
+ M,
70
+ {
71
+ noBorder: !0,
72
+ mode: "dark",
73
+ focusMode: "light",
74
+ size: "small",
75
+ onClick: (c) => m(c, C.PROOFREAD_CONTENT),
76
+ children: O[C.PROOFREAD_CONTENT].label
77
+ }
78
+ ) }) }),
79
+ /* @__PURE__ */ i(j, { children: p && /* @__PURE__ */ i("div", { className: a, children: /* @__PURE__ */ i(
80
+ M,
81
+ {
82
+ noBorder: !0,
83
+ mode: "dark",
84
+ focusMode: "light",
85
+ size: "small",
86
+ onClick: (c) => m(c, C.REPHRASE_CONTENT),
87
+ children: O[C.REPHRASE_CONTENT].label
88
+ }
89
+ ) }) })
90
+ ] }),
91
+ se(R, t) && /* @__PURE__ */ i("div", { className: a, children: /* @__PURE__ */ i(
92
+ M,
93
+ {
94
+ noBorder: !0,
95
+ mode: "dark",
96
+ focusMode: "light",
97
+ ref: n,
98
+ onClick: u,
99
+ children: t != null && t.streaming ? _e : Ne
100
+ }
101
+ ) })
102
+ ] });
103
+ };
104
+ /*!
105
+ @versini/ui-bubble v1.0.10
106
+ © 2024 gizmette.com
107
+ */
108
+ try {
109
+ window.__VERSINI_UI_BUBBLE__ || (window.__VERSINI_UI_BUBBLE__ = {
110
+ version: "1.0.10",
111
+ buildTime: "09/28/2024 06:29 PM EDT",
112
+ homepage: "https://github.com/aversini/ui-components",
113
+ license: "MIT"
114
+ });
115
+ } catch {
116
+ }
117
+ const Ke = "av-bubble", ae = "av-button", Qe = (e) => {
118
+ let t = "";
119
+ if (typeof e == "number" || typeof e == "string")
120
+ t = "m-" + e;
121
+ else {
122
+ const r = [];
123
+ (e == null ? void 0 : e.t) !== void 0 && r.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && r.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && r.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && r.push(`ml-${e.l}`), t = r.join(" ");
124
+ }
125
+ return t;
126
+ }, K = "icon", Xe = "button", et = "link", tt = ({
127
+ type: e,
128
+ size: t,
129
+ labelRight: r,
130
+ labelLeft: a,
131
+ align: n
132
+ }) => {
133
+ const o = "text-sm font-medium max-h-8 py-0", g = "text-base font-medium max-h-9 py-1", d = "text-lg font-medium max-h-12 py-2";
134
+ switch (e) {
135
+ case Xe:
136
+ return s("px-4", {
137
+ [o]: t === "small",
138
+ [g]: t === "medium",
139
+ [d]: t === "large"
140
+ });
141
+ case et:
142
+ return s("px-4 text-center", {
143
+ [o]: t === "small",
144
+ [g]: t === "medium",
145
+ [d]: t === "large"
146
+ });
147
+ case K:
148
+ return s("inline-flex items-center", {
149
+ "justify-center": n === "center",
150
+ "justify-start": n === "left",
151
+ "justify-end": n === "right",
152
+ "h-6 w-6 p-0": t === "small" && !(r || a),
153
+ "h-6 px-4 text-sm font-medium": t === "small" && (r || a),
154
+ "h-8 w-8 p-1": t === "medium" && !(r || a),
155
+ "h-8 px-4 text-base font-medium": t === "medium" && (r || a),
156
+ "h-12 w-12 p-2": t === "large" && !(r || a),
157
+ "h-12 px-4 text-lg font-medium": t === "large" && (r || a)
158
+ });
159
+ }
160
+ }, rt = ({
161
+ mode: e,
162
+ noBackground: t,
163
+ noTruncate: r,
164
+ variant: a
165
+ }) => {
166
+ if (t)
167
+ return "not-prose rounded-full";
168
+ if (a === "primary")
169
+ return s("not-prose rounded-full", {
170
+ truncate: !r,
171
+ "bg-action-dark text-copy-light": e === "dark",
172
+ "bg-action-light text-copy-lighter": e === "light",
173
+ "bg-action-dark text-copy-light dark:bg-action-light dark:text-copy-lighter": e === "system",
174
+ "bg-action-light text-copy-lighter dark:bg-action-dark dark:text-copy-light": e === "alt-system"
175
+ });
176
+ if (a === "secondary")
177
+ return s("not-prose rounded-full", {
178
+ truncate: !r,
179
+ "bg-action-dark text-copy-light": e === "light",
180
+ "bg-action-light text-copy-lighter": e === "dark",
181
+ "bg-action-dark text-copy-light dark:bg-action-light dark:text-copy-lighter": e === "alt-system",
182
+ "bg-action-light text-copy-lighter dark:bg-action-dark dark:text-copy-light": e === "system"
183
+ });
184
+ if (a === "danger")
185
+ return s("not-prose rounded-full", {
186
+ truncate: !r,
187
+ "bg-action-danger-dark text-copy-light": e === "dark",
188
+ "bg-action-danger-light text-copy-lighter": e === "light",
189
+ "bg-action-danger-dark text-copy-light dark:bg-action-danger-light dark:text-copy-lighter": e === "system",
190
+ "bg-action-danger-light text-copy-lighter dark:bg-action-danger-dark dark:text-copy-light": e === "alt-system"
191
+ });
192
+ }, at = ({
193
+ mode: e,
194
+ disabled: t,
195
+ variant: r
196
+ }) => {
197
+ if (t)
198
+ return "";
199
+ if (r === "primary")
200
+ return s("hover:text-copy-light-hover", {
201
+ "hover:bg-action-dark-hover": e === "dark",
202
+ "hover:bg-action-light-hover": e === "light",
203
+ "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "system",
204
+ "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "alt-system"
205
+ });
206
+ if (r === "secondary")
207
+ return s("hover:text-copy-light-hover", {
208
+ "hover:bg-action-dark-hover": e === "light",
209
+ "hover:bg-action-light-hover": e === "dark",
210
+ "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "alt-system",
211
+ "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "system"
212
+ });
213
+ if (r === "danger")
214
+ return s("hover:text-copy-light-hover", {
215
+ "hover:bg-action-danger-dark-hover": e === "dark",
216
+ "hover:bg-action-danger-light-hover": e === "light",
217
+ "hover:bg-action-danger-dark-hover dark:hover:bg-action-danger-light-hover": e === "system",
218
+ "hover:bg-action-danger-light-hover dark:hover:bg-action-danger-dark-hover": e === "alt-system"
219
+ });
220
+ }, ot = ({
221
+ mode: e,
222
+ disabled: t,
223
+ variant: r
224
+ }) => {
225
+ if (t)
226
+ return "";
227
+ if (r === "primary")
228
+ return s("active:text-copy-light-active", {
229
+ "active:bg-action-dark-active": e === "dark",
230
+ "active:bg-action-light-active": e === "light",
231
+ "active:bg-action-dark-active dark:active:bg-action-light-active": e === "system",
232
+ "active:bg-action-light-active dark:active:bg-action-dark-active": e === "alt-system"
233
+ });
234
+ if (r === "secondary")
235
+ return s("active:text-copy-light-active", {
236
+ "active:bg-action-dark-active": e === "light",
237
+ "active:bg-action-light-active": e === "dark",
238
+ "active:bg-action-dark-active dark:active:bg-action-light-active": e === "alt-system",
239
+ "active:bg-action-light-active dark:active:bg-action-dark-active": e === "system"
240
+ });
241
+ if (r === "danger")
242
+ return s("active:text-copy-lighter-active", {
243
+ "active:bg-action-danger-dark-active": e === "dark",
244
+ "active:bg-action-danger-light-active": e === "light",
245
+ "active:bg-action-danger-dark-active dark:active:bg-action-danger-light-active": e === "system",
246
+ "active:bg-action-danger-light-active dark:active:bg-action-danger-dark-active": e === "alt-system"
247
+ });
248
+ }, it = ({
249
+ mode: e,
250
+ noBorder: t,
251
+ variant: r
252
+ }) => {
253
+ if (t)
254
+ return "border border-transparent";
255
+ if (r === "primary")
256
+ return s("border", {
257
+ "border-border-dark": e === "dark",
258
+ "border-border-accent": e === "light",
259
+ "border-border-dark dark:border-border-accent": e === "system",
260
+ "border-border-accent dark:border-border-dark": e === "alt-system"
261
+ });
262
+ if (r === "secondary")
263
+ return s("border", {
264
+ "border-border-dark": e === "light",
265
+ "border-border-accent": e === "dark",
266
+ "border-border-dark dark:border-border-accent": e === "alt-system",
267
+ "border-border-accent dark:border-border-dark": e === "system"
268
+ });
269
+ if (r === "danger")
270
+ return s("border", {
271
+ "border-border-danger-dark": e === "dark",
272
+ "border-border-danger-medium": e === "light",
273
+ "border-border-danger-dark dark:border-border-danger-medium": e === "system",
274
+ "border-border-danger-medium dark:border-border-danger-dark": e === "alt-system"
275
+ });
276
+ }, nt = ({ focusMode: e }) => s("focus:outline", "focus:outline-2", "focus:outline-offset-2", {
277
+ "focus:outline-focus-dark": e === "dark",
278
+ "focus:outline-focus-light": e === "light",
279
+ "focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
280
+ "focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
281
+ }), he = ({
282
+ type: e,
283
+ className: t,
284
+ raw: r,
285
+ mode: a,
286
+ focusMode: n,
287
+ disabled: o,
288
+ fullWidth: g,
289
+ size: d,
290
+ noBorder: p,
291
+ labelRight: u,
292
+ labelLeft: m,
293
+ spacing: c,
294
+ noBackground: h,
295
+ variant: l,
296
+ noTruncate: b,
297
+ align: v
298
+ }) => (l || (l = "primary"), r ? s(ae, t) : s(
299
+ ae,
300
+ t,
301
+ Qe(c),
302
+ rt({ mode: a, variant: l, noBackground: h, noTruncate: b }),
303
+ tt({ type: e, size: d, labelRight: u, labelLeft: m, align: v }),
304
+ it({ mode: a, variant: l, noBorder: p }),
305
+ nt({ focusMode: n }),
306
+ at({ mode: a, variant: l, disabled: o }),
307
+ ot({ mode: a, variant: l, disabled: o }),
308
+ {
309
+ "w-full": g,
310
+ "disabled:cursor-not-allowed disabled:opacity-50": o
311
+ }
312
+ )), st = (e, t, r) => {
313
+ var a;
314
+ !t && (!document.activeElement || document.activeElement !== e.currentTarget) && typeof ((a = e == null ? void 0 : e.currentTarget) == null ? void 0 : a.focus) == "function" && e.currentTarget.focus(), typeof r == "function" && r(e);
315
+ }, Q = S.forwardRef((e, t) => {
316
+ const { onClick: r, noInternalClick: a = !1, ...n } = e;
317
+ return /* @__PURE__ */ i(
318
+ "button",
319
+ {
320
+ ref: t,
321
+ onClick: (o) => {
322
+ st(o, a, r);
323
+ },
324
+ ...n
325
+ }
326
+ );
327
+ });
328
+ Q.displayName = "BaseButton";
329
+ const pe = S.forwardRef(
330
+ ({
331
+ children: e,
332
+ disabled: t = !1,
333
+ mode: r = "system",
334
+ focusMode: a = "system",
335
+ fullWidth: n = !1,
336
+ className: o,
337
+ type: g = "button",
338
+ raw: d = !1,
339
+ noBorder: p = !1,
340
+ "aria-label": u,
341
+ label: m,
342
+ size: c = "medium",
343
+ labelRight: h,
344
+ labelLeft: l,
345
+ spacing: b,
346
+ noBackground: v = !1,
347
+ align: _ = "center",
348
+ ...N
349
+ }, w) => {
350
+ const k = he({
351
+ type: K,
352
+ mode: r,
353
+ focusMode: a,
354
+ fullWidth: n,
355
+ disabled: t,
356
+ raw: d,
357
+ className: o,
358
+ noBorder: p,
359
+ size: c,
360
+ labelRight: h,
361
+ labelLeft: l,
362
+ spacing: b,
363
+ noBackground: v,
364
+ align: _
365
+ }), x = s({
366
+ "text-copy-accent-dark": r === "light" && !d,
367
+ "text-copy-light": r === "dark" && !d,
368
+ "text-copy-accent-dark dark:text-copy-light": r === "alt-system" && !d,
369
+ "text-copy-light dark:text-copy-accent-dark": r === "system" && !d
370
+ });
371
+ return /* @__PURE__ */ y(
372
+ Q,
373
+ {
374
+ ref: w,
375
+ className: k,
376
+ disabled: t,
377
+ type: g,
378
+ "aria-label": u || m,
379
+ ...N,
380
+ children: [
381
+ l && /* @__PURE__ */ i("span", { className: "pr-2", children: l }),
382
+ /* @__PURE__ */ i("div", { className: x, children: e }),
383
+ h && /* @__PURE__ */ i("span", { className: "pl-2", children: h })
384
+ ]
385
+ }
386
+ );
387
+ }
388
+ );
389
+ pe.displayName = "ButtonIcon";
390
+ /*!
391
+ @versini/ui-button v1.1.10
392
+ © 2024 gizmette.com
393
+ */
394
+ try {
395
+ window.__VERSINI_UI_BUTTON__ || (window.__VERSINI_UI_BUTTON__ = {
396
+ version: "1.1.10",
397
+ buildTime: "09/28/2024 06:29 PM EDT",
398
+ homepage: "https://github.com/aversini/ui-components",
399
+ license: "MIT"
400
+ });
401
+ } catch {
402
+ }
403
+ const dt = S.forwardRef(
404
+ ({
405
+ children: e,
406
+ disabled: t = !1,
407
+ mode: r = "system",
408
+ focusMode: a = "system",
409
+ fullWidth: n = !1,
410
+ className: o,
411
+ type: g = "button",
412
+ raw: d = !1,
413
+ noBorder: p = !1,
414
+ "aria-label": u,
415
+ label: m,
416
+ size: c = "medium",
417
+ labelRight: h,
418
+ labelLeft: l,
419
+ spacing: b,
420
+ noBackground: v = !1,
421
+ align: _ = "center",
422
+ active: N = !1,
423
+ ...w
424
+ }, k) => {
425
+ const x = he({
426
+ type: K,
427
+ mode: r,
428
+ focusMode: a,
429
+ fullWidth: n,
430
+ disabled: t,
431
+ raw: d,
432
+ className: o,
433
+ noBorder: p,
434
+ size: c,
435
+ labelRight: h,
436
+ labelLeft: l,
437
+ spacing: b,
438
+ noBackground: v,
439
+ align: _
440
+ }), B = s({
441
+ "text-copy-accent-dark": r === "light" && !d,
442
+ "text-copy-light": r === "dark" && !d,
443
+ "text-copy-accent-dark dark:text-copy-light": r === "alt-system" && !d,
444
+ "text-copy-light dark:text-copy-accent-dark": r === "system" && !d
445
+ }), T = N ? s(
446
+ "relative",
447
+ "focus-within:static",
448
+ "focus-within:after:border-transparent",
449
+ "after:absolute",
450
+ "after:content-['']",
451
+ "after:border-b-2",
452
+ "after:bottom-[-4px]",
453
+ "after:left-0",
454
+ "after:right-0",
455
+ {
456
+ "after:border-table-dark": r === "dark",
457
+ "after:border-table-light": r === "light",
458
+ "after:border-table-dark dark:after:border-table-light": r === "system",
459
+ "after:border-table-light dark:after:border-table-dark": r === "alt-system"
460
+ }
461
+ ) : "";
462
+ return /* @__PURE__ */ i("div", { className: T, children: /* @__PURE__ */ y(
463
+ Q,
464
+ {
465
+ ref: k,
466
+ className: x,
467
+ disabled: t,
468
+ type: g,
469
+ "aria-label": u || m,
470
+ ...w,
471
+ children: [
472
+ l && /* @__PURE__ */ i("span", { className: "pr-2", children: l }),
473
+ /* @__PURE__ */ i("div", { className: B, children: e }),
474
+ h && /* @__PURE__ */ i("span", { className: "pl-2", children: h })
475
+ ]
476
+ }
477
+ ) });
478
+ }
479
+ );
480
+ dt.displayName = "ButtonSort";
481
+ const lt = (e) => {
482
+ let t = "";
483
+ if (typeof e == "number" || typeof e == "string")
484
+ t = "m-" + e;
485
+ else {
486
+ const r = [];
487
+ (e == null ? void 0 : e.t) !== void 0 && r.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && r.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && r.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && r.push(`ml-${e.l}`), t = r.join(" ");
488
+ }
489
+ return t;
490
+ }, be = ({
491
+ children: e,
492
+ fill: t,
493
+ viewBox: r,
494
+ className: a,
495
+ defaultViewBox: n,
496
+ defaultClassName: o,
497
+ spacing: g,
498
+ title: d,
499
+ semantic: p = !1,
500
+ ...u
501
+ }) => {
502
+ const m = lt(g), c = s(
503
+ m,
504
+ a || o
505
+ );
506
+ return /* @__PURE__ */ y(D, { children: [
507
+ /* @__PURE__ */ i(
508
+ "svg",
509
+ {
510
+ xmlns: "http://www.w3.org/2000/svg",
511
+ className: c,
512
+ viewBox: r || n,
513
+ fill: t || "currentColor",
514
+ role: "img",
515
+ "aria-hidden": !p,
516
+ focusable: !1,
517
+ ...u,
518
+ children: e
519
+ }
520
+ ),
521
+ d && p && /* @__PURE__ */ i("span", { className: "sr-only", children: d })
522
+ ] });
523
+ };
524
+ /*!
525
+ @versini/ui-private v1.4.17
526
+ © 2024 gizmette.com
527
+ */
528
+ try {
529
+ window.__VERSINI_UI_PRIVATE__ || (window.__VERSINI_UI_PRIVATE__ = {
530
+ version: "1.4.17",
531
+ buildTime: "09/28/2024 06:29 PM EDT",
532
+ homepage: "https://github.com/aversini/ui-components",
533
+ license: "MIT"
534
+ });
535
+ } catch {
536
+ }
537
+ const ct = ({
538
+ className: e,
539
+ viewBox: t,
540
+ spacing: r,
541
+ title: a,
542
+ monotone: n,
543
+ ...o
544
+ }) => /* @__PURE__ */ y(
545
+ be,
546
+ {
547
+ defaultViewBox: "0 0 448 512",
548
+ defaultClassName: "size-5",
549
+ viewBox: t,
550
+ className: e,
551
+ spacing: r,
552
+ title: a || "Copied",
553
+ ...o,
554
+ children: [
555
+ /* @__PURE__ */ i(
556
+ "path",
557
+ {
558
+ opacity: "0.4",
559
+ d: "M64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zM337 209L209 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L303 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"
560
+ }
561
+ ),
562
+ /* @__PURE__ */ i("path", { d: "M337 175c9.4 9.4 9.4 24.6 0 33.9L209 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L303 175c9.4-9.4 24.6-9.4 33.9 0z" })
563
+ ]
564
+ }
565
+ ), gt = ({
566
+ className: e,
567
+ viewBox: t,
568
+ spacing: r,
569
+ title: a,
570
+ monotone: n,
571
+ ...o
572
+ }) => /* @__PURE__ */ i(
573
+ be,
574
+ {
575
+ defaultViewBox: "0 0 512 512",
576
+ defaultClassName: "size-5",
577
+ viewBox: t,
578
+ className: e,
579
+ spacing: r,
580
+ title: a || "Copy",
581
+ ...o,
582
+ children: /* @__PURE__ */ i("path", { d: "M64 464H288c8.8 0 16-7.2 16-16V384h48v64c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V224c0-35.3 28.7-64 64-64h64v48H64c-8.8 0-16 7.2-16 16V448c0 8.8 7.2 16 16 16zM224 304H448c8.8 0 16-7.2 16-16V64c0-8.8-7.2-16-16-16H224c-8.8 0-16 7.2-16 16V288c0 8.8 7.2 16 16 16zm-64-16V64c0-35.3 28.7-64 64-64H448c35.3 0 64 28.7 64 64V288c0 35.3-28.7 64-64 64H224c-35.3 0-64-28.7-64-64z" })
583
+ }
584
+ );
585
+ /*!
586
+ @versini/ui-icons v1.13.1
587
+ © 2024 gizmette.com
588
+ */
589
+ try {
590
+ window.__VERSINI_UI_ICONS__ || (window.__VERSINI_UI_ICONS__ = {
591
+ version: "1.13.1",
592
+ buildTime: "09/28/2024 06:29 PM EDT",
593
+ homepage: "https://github.com/aversini/ui-components",
594
+ license: "MIT"
595
+ });
596
+ } catch {
597
+ }
598
+ const ut = (e) => {
599
+ let t = "";
600
+ if (typeof e == "number" || typeof e == "string")
601
+ t = "m-" + e;
602
+ else {
603
+ const r = [];
604
+ (e == null ? void 0 : e.t) !== void 0 && r.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && r.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && r.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && r.push(`ml-${e.l}`), t = r.join(" ");
605
+ }
606
+ return t;
607
+ }, mt = () => "p-4 sm:max-w-md md:max-w-2xl", ht = ({ kind: e }) => s({
608
+ "bg-surface-lighter dark:bg-surface-dark": e === "left",
609
+ "bg-surface-accent": e === "right"
610
+ }), pt = ({ kind: e }) => s(
611
+ "prose prose-dark dark:prose-lighter prose-p:my-3 prose-blockquote:my-3 prose-ol:my-3 prose-ul:my-3 prose-ul:prose-li:marker:text-black",
612
+ {
613
+ "text-copy-lighter": e === "right"
614
+ }
615
+ ), bt = ({ kind: e }) => s("rounded-b-xl", {
616
+ "rounded-tr-xl": e === "left",
617
+ "rounded-tl-xl": e === "right"
618
+ }), ft = ({
619
+ kind: e,
620
+ className: t,
621
+ spacing: r
622
+ }) => {
623
+ const a = s(
624
+ t,
625
+ Ke,
626
+ "flex items-start",
627
+ ut(r),
628
+ {
629
+ "flex-row-reverse": e === "right"
630
+ }
631
+ ), n = s(
632
+ "flex flex-col empty:hidden",
633
+ mt(),
634
+ pt({ kind: e }),
635
+ ht({ kind: e }),
636
+ bt({ kind: e })
637
+ ), o = "pr-2 pt-1 text-end text-xs text-copy-light", g = s("flex flex-col-reverse gap-2 sm:flex-row", {
638
+ "ml-2": e === "left",
639
+ "mr-2": e === "right"
640
+ });
641
+ return {
642
+ wrapper: a,
643
+ main: n,
644
+ footer: o,
645
+ copyButton: g
646
+ };
647
+ }, yt = ({
648
+ children: e,
649
+ kind: t = "left",
650
+ className: r,
651
+ footer: a,
652
+ rawFooter: n,
653
+ copyToClipboard: o,
654
+ copyToClipboardFocusMode: g = "system",
655
+ copyToClipboardMode: d = "system",
656
+ spacing: p
657
+ }) => {
658
+ const [u, m] = H(!1), c = ft({ kind: t, className: r, spacing: p }), h = !!o && (typeof o == "function" || typeof o == "string" || typeof e == "string"), l = () => {
659
+ m(!0), typeof o == "function" ? o(e) : typeof o == "string" ? navigator.clipboard.writeText(o) : typeof e == "string" && navigator.clipboard.writeText(e);
660
+ };
661
+ return E(() => {
662
+ let b;
663
+ return u && (b = window.setTimeout(() => {
664
+ m(!1);
665
+ }, 3e3)), () => {
666
+ clearTimeout(b);
667
+ };
668
+ }, [u]), /* @__PURE__ */ y("div", { className: c.wrapper, children: [
669
+ /* @__PURE__ */ y("div", { children: [
670
+ /* @__PURE__ */ i("div", { className: c.main, children: e }),
671
+ a && Object.keys(a).map((b) => a[b] ? /* @__PURE__ */ i("div", { className: "prose-p:m-0", children: /* @__PURE__ */ y("p", { className: c.footer, children: [
672
+ b,
673
+ ": ",
674
+ a[b]
675
+ ] }) }, `-${b}`) : null),
676
+ n && n
677
+ ] }),
678
+ h && /* @__PURE__ */ i("div", { className: c.copyButton, children: /* @__PURE__ */ i(
679
+ pe,
680
+ {
681
+ noBorder: !0,
682
+ noBackground: !0,
683
+ size: "small",
684
+ mode: d,
685
+ focusMode: g,
686
+ label: u ? "Copied to clipboard" : "Copy to clipboard",
687
+ onClick: l,
688
+ disabled: u,
689
+ children: u ? /* @__PURE__ */ i(ct, { className: "size-3" }) : /* @__PURE__ */ i(gt, { className: "size-3" })
690
+ }
691
+ ) })
692
+ ] });
693
+ }, oe = "av-button", vt = (e) => {
694
+ let t = "";
695
+ if (typeof e == "number" || typeof e == "string")
696
+ t = "m-" + e;
697
+ else {
698
+ const r = [];
699
+ (e == null ? void 0 : e.t) !== void 0 && r.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && r.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && r.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && r.push(`ml-${e.l}`), t = r.join(" ");
700
+ }
701
+ return t;
702
+ }, fe = "icon", ye = "button", kt = "link", xt = ({
703
+ type: e,
704
+ size: t,
705
+ labelRight: r,
706
+ labelLeft: a,
707
+ align: n
708
+ }) => {
709
+ const o = "text-sm font-medium max-h-8 py-0", g = "text-base font-medium max-h-9 py-1", d = "text-lg font-medium max-h-12 py-2";
710
+ switch (e) {
711
+ case ye:
712
+ return s("px-4", {
713
+ [o]: t === "small",
714
+ [g]: t === "medium",
715
+ [d]: t === "large"
716
+ });
717
+ case kt:
718
+ return s("px-4 text-center", {
719
+ [o]: t === "small",
720
+ [g]: t === "medium",
721
+ [d]: t === "large"
722
+ });
723
+ case fe:
724
+ return s("inline-flex items-center", {
725
+ "justify-center": n === "center",
726
+ "justify-start": n === "left",
727
+ "justify-end": n === "right",
728
+ "h-6 w-6 p-0": t === "small" && !(r || a),
729
+ "h-6 px-4 text-sm font-medium": t === "small" && (r || a),
730
+ "h-8 w-8 p-1": t === "medium" && !(r || a),
731
+ "h-8 px-4 text-base font-medium": t === "medium" && (r || a),
732
+ "h-12 w-12 p-2": t === "large" && !(r || a),
733
+ "h-12 px-4 text-lg font-medium": t === "large" && (r || a)
734
+ });
735
+ }
736
+ }, Tt = ({
737
+ mode: e,
738
+ noBackground: t,
739
+ noTruncate: r,
740
+ variant: a
741
+ }) => {
742
+ if (t)
743
+ return "not-prose rounded-full";
744
+ if (a === "primary")
745
+ return s("not-prose rounded-full", {
746
+ truncate: !r,
747
+ "bg-action-dark text-copy-light": e === "dark",
748
+ "bg-action-light text-copy-lighter": e === "light",
749
+ "bg-action-dark text-copy-light dark:bg-action-light dark:text-copy-lighter": e === "system",
750
+ "bg-action-light text-copy-lighter dark:bg-action-dark dark:text-copy-light": e === "alt-system"
751
+ });
752
+ if (a === "secondary")
753
+ return s("not-prose rounded-full", {
754
+ truncate: !r,
755
+ "bg-action-dark text-copy-light": e === "light",
756
+ "bg-action-light text-copy-lighter": e === "dark",
757
+ "bg-action-dark text-copy-light dark:bg-action-light dark:text-copy-lighter": e === "alt-system",
758
+ "bg-action-light text-copy-lighter dark:bg-action-dark dark:text-copy-light": e === "system"
759
+ });
760
+ if (a === "danger")
761
+ return s("not-prose rounded-full", {
762
+ truncate: !r,
763
+ "bg-action-danger-dark text-copy-light": e === "dark",
764
+ "bg-action-danger-light text-copy-lighter": e === "light",
765
+ "bg-action-danger-dark text-copy-light dark:bg-action-danger-light dark:text-copy-lighter": e === "system",
766
+ "bg-action-danger-light text-copy-lighter dark:bg-action-danger-dark dark:text-copy-light": e === "alt-system"
767
+ });
768
+ }, _t = ({
769
+ mode: e,
770
+ disabled: t,
771
+ variant: r
772
+ }) => {
773
+ if (t)
774
+ return "";
775
+ if (r === "primary")
776
+ return s("hover:text-copy-light-hover", {
777
+ "hover:bg-action-dark-hover": e === "dark",
778
+ "hover:bg-action-light-hover": e === "light",
779
+ "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "system",
780
+ "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "alt-system"
781
+ });
782
+ if (r === "secondary")
783
+ return s("hover:text-copy-light-hover", {
784
+ "hover:bg-action-dark-hover": e === "light",
785
+ "hover:bg-action-light-hover": e === "dark",
786
+ "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "alt-system",
787
+ "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "system"
788
+ });
789
+ if (r === "danger")
790
+ return s("hover:text-copy-light-hover", {
791
+ "hover:bg-action-danger-dark-hover": e === "dark",
792
+ "hover:bg-action-danger-light-hover": e === "light",
793
+ "hover:bg-action-danger-dark-hover dark:hover:bg-action-danger-light-hover": e === "system",
794
+ "hover:bg-action-danger-light-hover dark:hover:bg-action-danger-dark-hover": e === "alt-system"
795
+ });
796
+ }, Nt = ({
797
+ mode: e,
798
+ disabled: t,
799
+ variant: r
800
+ }) => {
801
+ if (t)
802
+ return "";
803
+ if (r === "primary")
804
+ return s("active:text-copy-light-active", {
805
+ "active:bg-action-dark-active": e === "dark",
806
+ "active:bg-action-light-active": e === "light",
807
+ "active:bg-action-dark-active dark:active:bg-action-light-active": e === "system",
808
+ "active:bg-action-light-active dark:active:bg-action-dark-active": e === "alt-system"
809
+ });
810
+ if (r === "secondary")
811
+ return s("active:text-copy-light-active", {
812
+ "active:bg-action-dark-active": e === "light",
813
+ "active:bg-action-light-active": e === "dark",
814
+ "active:bg-action-dark-active dark:active:bg-action-light-active": e === "alt-system",
815
+ "active:bg-action-light-active dark:active:bg-action-dark-active": e === "system"
816
+ });
817
+ if (r === "danger")
818
+ return s("active:text-copy-lighter-active", {
819
+ "active:bg-action-danger-dark-active": e === "dark",
820
+ "active:bg-action-danger-light-active": e === "light",
821
+ "active:bg-action-danger-dark-active dark:active:bg-action-danger-light-active": e === "system",
822
+ "active:bg-action-danger-light-active dark:active:bg-action-danger-dark-active": e === "alt-system"
823
+ });
824
+ }, wt = ({
825
+ mode: e,
826
+ noBorder: t,
827
+ variant: r
828
+ }) => {
829
+ if (t)
830
+ return "border border-transparent";
831
+ if (r === "primary")
832
+ return s("border", {
833
+ "border-border-dark": e === "dark",
834
+ "border-border-accent": e === "light",
835
+ "border-border-dark dark:border-border-accent": e === "system",
836
+ "border-border-accent dark:border-border-dark": e === "alt-system"
837
+ });
838
+ if (r === "secondary")
839
+ return s("border", {
840
+ "border-border-dark": e === "light",
841
+ "border-border-accent": e === "dark",
842
+ "border-border-dark dark:border-border-accent": e === "alt-system",
843
+ "border-border-accent dark:border-border-dark": e === "system"
844
+ });
845
+ if (r === "danger")
846
+ return s("border", {
847
+ "border-border-danger-dark": e === "dark",
848
+ "border-border-danger-medium": e === "light",
849
+ "border-border-danger-dark dark:border-border-danger-medium": e === "system",
850
+ "border-border-danger-medium dark:border-border-danger-dark": e === "alt-system"
851
+ });
852
+ }, Et = ({ focusMode: e }) => s("focus:outline", "focus:outline-2", "focus:outline-offset-2", {
853
+ "focus:outline-focus-dark": e === "dark",
854
+ "focus:outline-focus-light": e === "light",
855
+ "focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
856
+ "focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
857
+ }), ve = ({
858
+ type: e,
859
+ className: t,
860
+ raw: r,
861
+ mode: a,
862
+ focusMode: n,
863
+ disabled: o,
864
+ fullWidth: g,
865
+ size: d,
866
+ noBorder: p,
867
+ labelRight: u,
868
+ labelLeft: m,
869
+ spacing: c,
870
+ noBackground: h,
871
+ variant: l,
872
+ noTruncate: b,
873
+ align: v
874
+ }) => (l || (l = "primary"), r ? s(oe, t) : s(
875
+ oe,
876
+ t,
877
+ vt(c),
878
+ Tt({ mode: a, variant: l, noBackground: h, noTruncate: b }),
879
+ xt({ type: e, size: d, labelRight: u, labelLeft: m, align: v }),
880
+ wt({ mode: a, variant: l, noBorder: p }),
881
+ Et({ focusMode: n }),
882
+ _t({ mode: a, variant: l, disabled: o }),
883
+ Nt({ mode: a, variant: l, disabled: o }),
884
+ {
885
+ "w-full": g,
886
+ "disabled:cursor-not-allowed disabled:opacity-50": o
887
+ }
888
+ )), Ct = (e, t, r) => {
889
+ var a;
890
+ !t && (!document.activeElement || document.activeElement !== e.currentTarget) && typeof ((a = e == null ? void 0 : e.currentTarget) == null ? void 0 : a.focus) == "function" && e.currentTarget.focus(), typeof r == "function" && r(e);
891
+ }, X = S.forwardRef((e, t) => {
892
+ const { onClick: r, noInternalClick: a = !1, ...n } = e;
893
+ return /* @__PURE__ */ i(
894
+ "button",
895
+ {
896
+ ref: t,
897
+ onClick: (o) => {
898
+ Ct(o, a, r);
899
+ },
900
+ ...n
901
+ }
902
+ );
903
+ });
904
+ X.displayName = "BaseButton";
905
+ const ke = S.forwardRef(
906
+ ({
907
+ children: e,
908
+ disabled: t = !1,
909
+ mode: r = "system",
910
+ focusMode: a = "system",
911
+ fullWidth: n = !1,
912
+ className: o,
913
+ size: g = "medium",
914
+ raw: d = !1,
915
+ noBorder: p = !1,
916
+ spacing: u,
917
+ variant: m = "primary",
918
+ noTruncate: c = !1,
919
+ ...h
920
+ }, l) => {
921
+ const b = ve({
922
+ type: ye,
923
+ mode: r,
924
+ focusMode: a,
925
+ fullWidth: n,
926
+ disabled: t,
927
+ raw: d,
928
+ className: o,
929
+ size: g,
930
+ noBorder: p,
931
+ spacing: u,
932
+ variant: m,
933
+ noTruncate: c
934
+ });
935
+ return /* @__PURE__ */ i(
936
+ X,
937
+ {
938
+ ref: l,
939
+ className: b,
940
+ disabled: t,
941
+ ...h,
942
+ children: e
943
+ }
944
+ );
945
+ }
946
+ );
947
+ ke.displayName = "Button";
948
+ /*!
949
+ @versini/ui-button v1.1.10
950
+ © 2024 gizmette.com
951
+ */
952
+ try {
953
+ window.__VERSINI_UI_BUTTON__ || (window.__VERSINI_UI_BUTTON__ = {
954
+ version: "1.1.10",
955
+ buildTime: "09/28/2024 06:29 PM EDT",
956
+ homepage: "https://github.com/aversini/ui-components",
957
+ license: "MIT"
958
+ });
959
+ } catch {
960
+ }
961
+ const Rt = S.forwardRef(
962
+ ({
963
+ children: e,
964
+ disabled: t = !1,
965
+ mode: r = "system",
966
+ focusMode: a = "system",
967
+ fullWidth: n = !1,
968
+ className: o,
969
+ type: g = "button",
970
+ raw: d = !1,
971
+ noBorder: p = !1,
972
+ "aria-label": u,
973
+ label: m,
974
+ size: c = "medium",
975
+ labelRight: h,
976
+ labelLeft: l,
977
+ spacing: b,
978
+ noBackground: v = !1,
979
+ align: _ = "center",
980
+ active: N = !1,
981
+ ...w
982
+ }, k) => {
983
+ const x = ve({
984
+ type: fe,
985
+ mode: r,
986
+ focusMode: a,
987
+ fullWidth: n,
988
+ disabled: t,
989
+ raw: d,
990
+ className: o,
991
+ noBorder: p,
992
+ size: c,
993
+ labelRight: h,
994
+ labelLeft: l,
995
+ spacing: b,
996
+ noBackground: v,
997
+ align: _
998
+ }), B = s({
999
+ "text-copy-accent-dark": r === "light" && !d,
1000
+ "text-copy-light": r === "dark" && !d,
1001
+ "text-copy-accent-dark dark:text-copy-light": r === "alt-system" && !d,
1002
+ "text-copy-light dark:text-copy-accent-dark": r === "system" && !d
1003
+ }), T = N ? s(
1004
+ "relative",
1005
+ "focus-within:static",
1006
+ "focus-within:after:border-transparent",
1007
+ "after:absolute",
1008
+ "after:content-['']",
1009
+ "after:border-b-2",
1010
+ "after:bottom-[-4px]",
1011
+ "after:left-0",
1012
+ "after:right-0",
1013
+ {
1014
+ "after:border-table-dark": r === "dark",
1015
+ "after:border-table-light": r === "light",
1016
+ "after:border-table-dark dark:after:border-table-light": r === "system",
1017
+ "after:border-table-light dark:after:border-table-dark": r === "alt-system"
1018
+ }
1019
+ ) : "";
1020
+ return /* @__PURE__ */ i("div", { className: T, children: /* @__PURE__ */ y(
1021
+ X,
1022
+ {
1023
+ ref: k,
1024
+ className: x,
1025
+ disabled: t,
1026
+ type: g,
1027
+ "aria-label": u || m,
1028
+ ...w,
1029
+ children: [
1030
+ l && /* @__PURE__ */ i("span", { className: "pr-2", children: l }),
1031
+ /* @__PURE__ */ i("div", { className: B, children: e }),
1032
+ h && /* @__PURE__ */ i("span", { className: "pl-2", children: h })
1033
+ ]
1034
+ }
1035
+ ) });
1036
+ }
1037
+ );
1038
+ Rt.displayName = "ButtonSort";
1039
+ const It = 200, St = ({
1040
+ string: e,
1041
+ idealLength: t = It
1042
+ }) => {
1043
+ if (e.length <= t)
1044
+ return { string: e, isTruncated: !1 };
1045
+ if (e.charAt(t) === " ")
1046
+ return { string: e.slice(0, t), isTruncated: !0 };
1047
+ const r = e.slice(t).search(" ");
1048
+ return {
1049
+ string: e.slice(0, t + r),
1050
+ isTruncated: !0
1051
+ };
1052
+ }, Bt = ({
1053
+ children: e,
1054
+ length: t = 200,
1055
+ mode: r = "system",
1056
+ focusMode: a = "system"
1057
+ }) => {
1058
+ const [n, o] = H(!1);
1059
+ if (typeof e != "string")
1060
+ return e;
1061
+ const { string: g, isTruncated: d } = St({
1062
+ string: e,
1063
+ idealLength: t
1064
+ });
1065
+ return /* @__PURE__ */ y("span", { children: [
1066
+ n ? e : g,
1067
+ d && /* @__PURE__ */ i(
1068
+ ke,
1069
+ {
1070
+ mode: r,
1071
+ focusMode: a,
1072
+ spacing: { l: 2 },
1073
+ size: "small",
1074
+ onClick: (p) => {
1075
+ p.preventDefault(), o(!n);
1076
+ },
1077
+ children: n ? "less..." : "more..."
1078
+ }
1079
+ )
1080
+ ] });
1081
+ };
1082
+ /*!
1083
+ @versini/ui-truncate v1.0.7
1084
+ © 2024 gizmette.com
1085
+ */
1086
+ try {
1087
+ window.__VERSINI_UI_TRUNCATE__ || (window.__VERSINI_UI_TRUNCATE__ = {
1088
+ version: "1.0.7",
1089
+ buildTime: "09/28/2024 06:29 PM EDT",
1090
+ homepage: "https://github.com/aversini/ui-components",
1091
+ license: "MIT"
1092
+ });
1093
+ } catch {
1094
+ }
1095
+ const ie = Fe(
1096
+ () => import(
1097
+ /* webpackChunkName: "LazyMessageAssistant" */
1098
+ "./LazyMessageAssistant.CDMHbVPp.js"
1099
+ ).then((e) => e.LazyMessageAssistant)
1100
+ ), Mt = () => {
1101
+ const { state: e } = U(P);
1102
+ return /* @__PURE__ */ y(D, { children: [
1103
+ e && e.messages.length > 0 && e.messages.map((t, r) => {
1104
+ const { role: a, content: n, name: o, processingTime: g } = t.message;
1105
+ return (a === R || a === Y) && n ? /* @__PURE__ */ i(te, { fallback: /* @__PURE__ */ i("span", {}), children: /* @__PURE__ */ i(
1106
+ ie,
1107
+ {
1108
+ name: o,
1109
+ processingTime: g,
1110
+ children: n
1111
+ }
1112
+ ) }, `${r}-${a}`) : a === W && n ? /* @__PURE__ */ i(
1113
+ yt,
1114
+ {
1115
+ kind: "right",
1116
+ copyToClipboard: n,
1117
+ copyToClipboardFocusMode: "light",
1118
+ children: /* @__PURE__ */ i(Bt, { mode: "light", focusMode: "light", children: n })
1119
+ },
1120
+ `${r}-${a}`
1121
+ ) : null;
1122
+ }),
1123
+ se(W, e) && /* @__PURE__ */ i(te, { fallback: /* @__PURE__ */ i("span", {}), children: /* @__PURE__ */ i(ie, { loading: !0 }) })
1124
+ ] });
1125
+ }, z = (e, t) => {
1126
+ e({
1127
+ type: me,
1128
+ payload: {
1129
+ streaming: t
1130
+ }
1131
+ });
1132
+ }, ne = (e) => {
1133
+ z(e, !1), e({
1134
+ type: L,
1135
+ payload: {
1136
+ message: {
1137
+ role: Y,
1138
+ content: Ie
1139
+ }
1140
+ }
1141
+ });
1142
+ }, At = () => {
1143
+ const { state: e, dispatch: t } = U(P), { state: r, dispatch: a } = U(Z), [n, o] = H(""), { getAccessToken: g, user: d } = q(), p = I(!1), u = I(null), m = I(
1144
+ null
1145
+ );
1146
+ E(() => {
1147
+ (async () => {
1148
+ var l;
1149
+ if (!e || e.messages.length === 0) {
1150
+ (l = m == null ? void 0 : m.current) == null || l.cancel();
1151
+ return;
1152
+ }
1153
+ const h = e.messages[e.messages.length - 1];
1154
+ if (!(e.messages.length === 0 || h.message.role === R || h.message.role === we || h.message.role === Y || h.message.role === Ee))
1155
+ try {
1156
+ const b = await ze({
1157
+ accessToken: await g(),
1158
+ name: "generate",
1159
+ data: {
1160
+ messages: e.messages,
1161
+ model: ce,
1162
+ user: (d == null ? void 0 : d.username) || "",
1163
+ id: e.id,
1164
+ usage: e.usage
1165
+ }
1166
+ });
1167
+ if (b && b.ok) {
1168
+ const v = J();
1169
+ m.current = b.body.getReader();
1170
+ const _ = new TextDecoder();
1171
+ for (; ; ) {
1172
+ z(t, !0);
1173
+ const { done: N, value: w } = await m.current.read();
1174
+ if (N) {
1175
+ z(t, !1);
1176
+ break;
1177
+ }
1178
+ const k = _.decode(w, { stream: !0 }), x = k.indexOf(ee);
1179
+ if (x !== -1) {
1180
+ const B = k.substring(0, x), T = JSON.parse(
1181
+ k.substring(x + ee.length)
1182
+ );
1183
+ t({
1184
+ type: ge,
1185
+ payload: {
1186
+ model: T.model,
1187
+ usage: T.usage
1188
+ }
1189
+ }), t({
1190
+ type: L,
1191
+ payload: {
1192
+ message: {
1193
+ content: B,
1194
+ role: R,
1195
+ messageId: v,
1196
+ processingTime: T.processingTime,
1197
+ name: T.name
1198
+ }
1199
+ }
1200
+ }), z(t, !1);
1201
+ break;
1202
+ } else
1203
+ t({
1204
+ type: L,
1205
+ payload: {
1206
+ message: {
1207
+ content: k,
1208
+ role: R,
1209
+ messageId: v
1210
+ }
1211
+ }
1212
+ });
1213
+ }
1214
+ } else
1215
+ ne(t);
1216
+ } catch (b) {
1217
+ console.error(b), ne(t);
1218
+ }
1219
+ })();
1220
+ }, [e == null ? void 0 : e.messages]);
1221
+ const c = async (h) => {
1222
+ h.preventDefault(), t({
1223
+ type: L,
1224
+ payload: {
1225
+ message: {
1226
+ role: W,
1227
+ content: n
1228
+ }
1229
+ }
1230
+ }), o("");
1231
+ };
1232
+ return E(() => {
1233
+ (e == null ? void 0 : e.streaming) === !1 && !p.current && u.current && (p.current = !0, u.current.focus()), (e == null ? void 0 : e.streaming) === !0 && p.current === !0 && (p.current = !1);
1234
+ }, [e]), E(() => {
1235
+ r.tag !== "" && O[r.tag] && (o(O[r.tag].content), u.current && u.current.focus(), a({
1236
+ type: ue
1237
+ }));
1238
+ }, [r, a]), /* @__PURE__ */ i("form", { className: "mt-2", onSubmit: c, children: /* @__PURE__ */ i(
1239
+ De,
1240
+ {
1241
+ mode: "dark",
1242
+ focusMode: "light",
1243
+ ref: u,
1244
+ name: "chat-input",
1245
+ label: Ce,
1246
+ helperText: "Press ENTER to add a new line",
1247
+ helperTextOnFocus: !0,
1248
+ required: !0,
1249
+ value: n,
1250
+ onChange: (h) => o(h.target.value),
1251
+ rightElement: /* @__PURE__ */ i(
1252
+ M,
1253
+ {
1254
+ disabled: e == null ? void 0 : e.streaming,
1255
+ noBorder: !0,
1256
+ type: "submit",
1257
+ mode: "light",
1258
+ focusMode: "light",
1259
+ children: Re
1260
+ }
1261
+ )
1262
+ }
1263
+ ) });
1264
+ }, Ot = () => {
1265
+ const { isAuthenticated: e } = q(), t = Se(e);
1266
+ return /* @__PURE__ */ y(D, { children: [
1267
+ /* @__PURE__ */ y("div", { className: t, children: [
1268
+ /* @__PURE__ */ i(Be, {}),
1269
+ /* @__PURE__ */ i(Mt, {})
1270
+ ] }),
1271
+ /* @__PURE__ */ i(Je, {}),
1272
+ /* @__PURE__ */ i(At, {})
1273
+ ] });
1274
+ }, Lt = (e, t) => (t == null ? void 0 : t.type) === le ? {
1275
+ tag: t.payload.tag
1276
+ } : (t == null ? void 0 : t.type) === ue ? {
1277
+ tag: ""
1278
+ } : e, $t = (e, t) => (t == null ? void 0 : t.type) === Me ? {
1279
+ searchString: t.payload.searchString,
1280
+ sortedCell: e.sortedCell,
1281
+ sortDirection: e.sortDirection
1282
+ } : (t == null ? void 0 : t.type) === Ae ? {
1283
+ searchString: e.searchString,
1284
+ sortedCell: t.payload.sortedCell,
1285
+ sortDirection: t.payload.sortDirection
1286
+ } : e, Ut = (e, t) => {
1287
+ if ((t == null ? void 0 : t.type) === Oe) {
1288
+ const r = t.payload.messages.map((a) => ({
1289
+ message: {
1290
+ role: a.role,
1291
+ content: a.content,
1292
+ name: a.name,
1293
+ processingTime: a.processingTime
1294
+ }
1295
+ }));
1296
+ return {
1297
+ id: t.payload.id,
1298
+ model: t.payload.model,
1299
+ usage: t.payload.usage,
1300
+ isComponent: e.isComponent,
1301
+ messages: r
1302
+ };
1303
+ }
1304
+ if ((t == null ? void 0 : t.type) === L) {
1305
+ const r = t.payload.message.role, a = t.payload.message.content, n = t.payload.message.name, o = t.payload.message.processingTime, g = t.payload.message.messageId;
1306
+ if (r !== "") {
1307
+ const d = {
1308
+ role: r,
1309
+ content: a,
1310
+ name: n,
1311
+ processingTime: o,
1312
+ messageId: g
1313
+ };
1314
+ if (r === R) {
1315
+ const p = e.messages.findIndex(
1316
+ (u) => u.message.messageId === g
1317
+ );
1318
+ if (p !== -1) {
1319
+ const u = e.messages.map((m, c) => c === p ? {
1320
+ message: {
1321
+ ...m.message,
1322
+ content: `${m.message.content}${a}`,
1323
+ processingTime: o,
1324
+ name: n
1325
+ }
1326
+ } : m);
1327
+ return {
1328
+ id: e.id,
1329
+ model: e.model,
1330
+ usage: e.usage,
1331
+ isComponent: e.isComponent,
1332
+ messages: u
1333
+ };
1334
+ }
1335
+ }
1336
+ return {
1337
+ id: e.id,
1338
+ model: e.model,
1339
+ usage: e.usage,
1340
+ isComponent: e.isComponent,
1341
+ messages: [
1342
+ ...e.messages,
1343
+ {
1344
+ message: d
1345
+ }
1346
+ ]
1347
+ };
1348
+ }
1349
+ }
1350
+ return (t == null ? void 0 : t.type) === de ? {
1351
+ id: J(),
1352
+ model: e.model,
1353
+ usage: 0,
1354
+ messages: [],
1355
+ isComponent: e.isComponent
1356
+ } : (t == null ? void 0 : t.type) === ge ? {
1357
+ id: e.id,
1358
+ model: t.payload.model,
1359
+ usage: t.payload.usage,
1360
+ messages: e.messages,
1361
+ isComponent: e.isComponent
1362
+ } : (t == null ? void 0 : t.type) === me ? {
1363
+ ...e,
1364
+ streaming: t.payload.streaming
1365
+ } : e;
1366
+ };
1367
+ function xe({ isComponent: e = !1 }) {
1368
+ const t = I(!1), { getAccessToken: r } = q(), [a] = $({
1369
+ key: A + Ue,
1370
+ initialValue: ""
1371
+ }), [n] = $({
1372
+ key: A + Ve,
1373
+ initialValue: Ge.ASC
1374
+ }), [o, g] = G(Ut, {
1375
+ id: J(),
1376
+ model: ce,
1377
+ usage: 0,
1378
+ messages: [],
1379
+ isComponent: e
1380
+ }), [d, p] = G($t, {
1381
+ searchString: a,
1382
+ sortedCell: "timestamp",
1383
+ sortDirection: n
1384
+ }), [u, m] = G(Lt, {
1385
+ tag: ""
1386
+ }), [c, h] = H({
1387
+ version: "",
1388
+ models: [],
1389
+ plugins: []
1390
+ });
1391
+ return E(() => {
1392
+ c.version !== "" || t.current || (async () => {
1393
+ try {
1394
+ t.current = !0;
1395
+ const l = await Pe({
1396
+ accessToken: await r(),
1397
+ type: He.ABOUT
1398
+ });
1399
+ t.current = !1, l.status === 200 && h(l.data);
1400
+ } catch {
1401
+ }
1402
+ })();
1403
+ }, [c, r]), E(() => {
1404
+ var l;
1405
+ (l = document.getElementById("logo")) == null || l.classList.add("fadeOut"), setTimeout(() => {
1406
+ var b;
1407
+ (b = document.getElementById("root")) == null || b.classList.replace("app-hidden", "fadeIn");
1408
+ }, 500);
1409
+ }), /* @__PURE__ */ i(P.Provider, { value: { state: o, dispatch: g, serverStats: c }, children: /* @__PURE__ */ i(
1410
+ je.Provider,
1411
+ {
1412
+ value: {
1413
+ state: d,
1414
+ dispatch: p
1415
+ },
1416
+ children: /* @__PURE__ */ y(
1417
+ Z.Provider,
1418
+ {
1419
+ value: { state: u, dispatch: m },
1420
+ children: [
1421
+ /* @__PURE__ */ i(Le, { children: /* @__PURE__ */ i(Ot, {}) }),
1422
+ /* @__PURE__ */ i($e, { serverStats: c })
1423
+ ]
1424
+ }
1425
+ )
1426
+ }
1427
+ ) });
1428
+ }
1429
+ xe.displayName = "App";
1430
+ const jt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: xe }, Symbol.toStringTag, { value: "Module" }));
1431
+ export {
1432
+ jt as App,
1433
+ yt as le
1434
+ };