@versini/sassysaint 8.40.2 → 8.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,75 +0,0 @@
1
- import { jsx as A } from "react/jsx-runtime";
2
- import { LOCAL_STORAGE_PREFIX as k, LOCAL_STORAGE_CHAT_DETAILS as R, convertCamelCaseToReadable as _, numberFormatter as w, pluralize as F, re as G } from "./index.DPutGpC0.js";
3
- import { ChatContext as N, E as U, Me as y, Oe as S } from "./App.CXZi-n86.js";
4
- import b from "clsx";
5
- import P, { useState as h, useRef as g, useEffect as L, useContext as v } from "react";
6
- import { useMarkdown as I } from "./useMarkdown.C2s02oz2.js";
7
- const D = 2, j = D * 1e3, M = "", q = (e) => e * (2 - e);
8
- function V(e, a = !0) {
9
- const [i, C] = h(0), [c, p] = h(0), [t, T] = h(e), r = g(0), o = g(0);
10
- return t !== e && (T(e), p(e.startsWith(t) ? i : 0)), L(() => {
11
- if (!a)
12
- return;
13
- const u = e.split(M).length, s = (l) => {
14
- o.current || (o.current = l);
15
- const m = l - o.current, f = Math.min(m / j, 1), n = q(f), O = c + (u - c) * n;
16
- C(Math.floor(O)), f < 1 && (r.current = requestAnimationFrame(s));
17
- };
18
- return o.current = 0, r.current = requestAnimationFrame(s), () => {
19
- r.current && cancelAnimationFrame(r.current);
20
- };
21
- }, [c, e, a]), a ? e.split(M).slice(0, i).join(M) : e;
22
- }
23
- const d = {
24
- MODEL: "Model",
25
- PLUGIN: "Plugin",
26
- USAGE: "Session usage"
27
- }, x = b("max-w-[99cqw] mt-3"), E = b("max-w-xs", "sm:max-w-3xl", "prose-li:ps-3"), X = P.memo(
28
- ({
29
- content: e,
30
- annotations: a,
31
- toolName: i,
32
- role: C,
33
- smooth: c = !1,
34
- isLastAssistantMessage: p = !1
35
- }) => {
36
- const t = V(e, c), {
37
- state: { streaming: T, restoredModel: r, tokenUsage: o }
38
- } = v(N), u = a?.model || r, s = o, [l, m] = I(), [f] = U({
39
- key: k + R,
40
- initialValue: !1
41
- });
42
- let n;
43
- return f && (n = {
44
- [d.MODEL]: u || null,
45
- [d.PLUGIN]: i ? _(i) : null
46
- }, s && (p ? n[d.USAGE] = `${w.format(s)} ${F("token", s)}` : n[d.USAGE] = y)), L(() => {
47
- t && m(t);
48
- }, [t, m]), C === G ? /* @__PURE__ */ A(
49
- S,
50
- {
51
- tail: !0,
52
- className: x,
53
- contentClassName: E,
54
- noMaxWidth: !0,
55
- children: /* @__PURE__ */ A("div", { className: "flex items-center justify-center italic text-copy-error-dark dark:text-red-300", children: l })
56
- }
57
- ) : /* @__PURE__ */ A(
58
- S,
59
- {
60
- tail: !0,
61
- copyToClipboardMode: "dark",
62
- copyToClipboardFocusMode: "light",
63
- copyToClipboard: T ? "loading..." : e,
64
- footer: n,
65
- className: x,
66
- contentClassName: E,
67
- noMaxWidth: !0,
68
- children: l
69
- }
70
- );
71
- }
72
- );
73
- export {
74
- X as default
75
- };