@versini/sassysaint 8.57.0 → 8.58.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.
Files changed (27) hide show
  1. package/dist/chunks/{AboutChangelog.DzmH2Ft2.js → AboutChangelog.CB0dcRCM.js} +2 -2
  2. package/dist/chunks/{AboutEntry.DD3TTwq6.js → AboutEntry.DC6pIWQs.js} +7 -7
  3. package/dist/chunks/{App.D-eIGXB_.js → App.B8ehtPCy.js} +404 -401
  4. package/dist/chunks/{Chart.BYV6EqEz.js → Chart.D-VIQysU.js} +2 -2
  5. package/dist/chunks/{ChatBubbleAssistant.Cos_gf6Y.js → ChatBubbleAssistant.CyJgR8J8.js} +4 -4
  6. package/dist/chunks/{ChatBubbleUser.Bk0Fip7I.js → ChatBubbleUser.tWOit_f_.js} +3 -3
  7. package/dist/chunks/ChatHistoryTable.2v_Tv5Xj.js +317 -0
  8. package/dist/chunks/HistoryEntry.Dh5bLuYX.js +332 -0
  9. package/dist/chunks/{ProfileEntry.Mao95CEE.js → ProfileEntry.Dno0c0_1.js} +2 -2
  10. package/dist/chunks/{SettingsEntry.BCzuEKBT.js → SettingsEntry.IGOE-6JU.js} +3 -3
  11. package/dist/chunks/{Table.D8oP0Hfr.js → Table.CAzmyLPU.js} +2 -2
  12. package/dist/chunks/{UsageEntry.DsM00cbQ.js → UsageEntry.BStP6ETh.js} +3 -3
  13. package/dist/chunks/{UserMemoriesPanel.ByHUtoql.js → UserMemoriesPanel.w335l_3o.js} +3 -3
  14. package/dist/chunks/{index.Dhmu-uQg.js → index.Bm2rN-Q4.js} +1 -1
  15. package/dist/chunks/{index.CjLTtni3.js → index.BmuSGkDt.js} +1 -1
  16. package/dist/chunks/{index.C2glMPDi.js → index.Br-5S8Zv.js} +2 -2
  17. package/dist/chunks/{index.CQfod5uZ.js → index.CRS7yOjI.js} +1 -1
  18. package/dist/chunks/{index.M7cagQ1Z.js → index.CVdabB4A.js} +1 -1
  19. package/dist/chunks/{index.BAwdeYEk.js → index.CYzjDPpw.js} +3 -3
  20. package/dist/chunks/{index.C5_-KbC2.js → index.D3golFwx.js} +210 -194
  21. package/dist/chunks/{useMarkdown.B-G3RHi6.js → useMarkdown.B9WkUC07.js} +6 -6
  22. package/dist/components/SassySaint/SassySaint.js +1 -1
  23. package/dist/index.js +4 -4
  24. package/dist/style.css +2 -2
  25. package/package.json +5 -5
  26. package/dist/chunks/ChatHistoryTable.D26AKQqJ.js +0 -236
  27. package/dist/chunks/HistoryEntry.CrQhebc8.js +0 -291
@@ -1,7 +1,7 @@
1
1
  import { jsx as Ap } from "react/jsx-runtime";
2
- import { getDefaultExportFromCjs as ln } from "./App.D-eIGXB_.js";
2
+ import { getDefaultExportFromCjs as ln } from "./App.B8ehtPCy.js";
3
3
  import Cp, { useState as Pp, useEffect as Op } from "react";
4
- import { TRIMESTERS as rn, TRIMESTERS_SHORT as Lp, isProbablyMobile as Ep } from "./index.C5_-KbC2.js";
4
+ import { TRIMESTERS as rn, TRIMESTERS_SHORT as Lp, isProbablyMobile as Ep } from "./index.D3golFwx.js";
5
5
  var ls = { exports: {} }, Ip = ls.exports, on;
6
6
  function Dp() {
7
7
  return on || (on = 1, (function(ke, ne) {
@@ -1,10 +1,10 @@
1
1
  import { jsx as M } from "react/jsx-runtime";
2
- import { n as N, useUserPreferences as O, convertCamelCaseToReadable as P, numberFormatter as R, pluralize as y, ne as L } from "./index.C5_-KbC2.js";
3
- import { BUBBLE_FOOTER_EMPTY as _ } from "./index.M7cagQ1Z.js";
2
+ import { n as N, useUserPreferences as O, convertCamelCaseToReadable as P, numberFormatter as R, pluralize as y, ne as L } from "./index.D3golFwx.js";
3
+ import { BUBBLE_FOOTER_EMPTY as _ } from "./index.CVdabB4A.js";
4
4
  import w from "clsx";
5
5
  import v, { useState as b, useRef as A, useEffect as U, useContext as B } from "react";
6
- import { ChatContext as G, AsyncBubble as E } from "./App.D-eIGXB_.js";
7
- import { useMarkdown as D } from "./useMarkdown.B-G3RHi6.js";
6
+ import { ChatContext as G, AsyncBubble as E } from "./App.B8ehtPCy.js";
7
+ import { useMarkdown as D } from "./useMarkdown.B9WkUC07.js";
8
8
  const j = 2, q = j * 1e3, x = "", I = (e) => e * (2 - e);
9
9
  function W(e, n = !0) {
10
10
  const [a, p] = b(0), [i, C] = b(0), [t, T] = b(e), r = A(0), s = A(0);
@@ -1,8 +1,8 @@
1
1
  import { jsx as n, Fragment as b, jsxs as A } from "react/jsx-runtime";
2
2
  import { useState as C, useMemo as u, isValidElement as p, useEffect as I } from "react";
3
- import { AsyncBubble as w } from "./App.D-eIGXB_.js";
4
- import { useMarkdown as _ } from "./useMarkdown.B-G3RHi6.js";
5
- import { C as M } from "./index.C5_-KbC2.js";
3
+ import { AsyncBubble as w } from "./App.B8ehtPCy.js";
4
+ import { useMarkdown as _ } from "./useMarkdown.B9WkUC07.js";
5
+ import { C as M } from "./index.D3golFwx.js";
6
6
  const R = 200, N = ({
7
7
  string: e,
8
8
  idealLength: r = R
@@ -0,0 +1,317 @@
1
+ import { jsxs as m, jsx as e } from "react/jsx-runtime";
2
+ import { I as g, de as N, Oe as C, INFINITE_SCROLL_THRESHOLD as y, CARDS as A, pluralize as E, te as p, numberFormatter as k, ue as b, isProbablyMobile as D, y as U, i$1 as B, E as I } from "./index.D3golFwx.js";
3
+ import { st as u, p$1 as P, z as L, p$2 as V } from "./App.B8ehtPCy.js";
4
+ import h from "clsx";
5
+ import { Fragment as $ } from "react";
6
+ import { j as _, D as H, G as M, H as Y, U as F, M as a, F as R, l as G } from "./Table.CAzmyLPU.js";
7
+ const K = ({
8
+ className: c,
9
+ viewBox: l,
10
+ title: o,
11
+ monotone: i,
12
+ ...n
13
+ }) => /* @__PURE__ */ m(
14
+ g,
15
+ {
16
+ defaultViewBox: "0 0 512 512",
17
+ size: "size-5",
18
+ viewBox: l,
19
+ className: c,
20
+ title: o || "Restore",
21
+ ...n,
22
+ children: [
23
+ /* @__PURE__ */ e(
24
+ "path",
25
+ {
26
+ d: "M128 80v16h64V80c0-8.8 7.2-16 16-16h224c8.8 0 16 7.2 16 16v224c0 8.8-7.2 16-16 16h-16v64h16c44.2 0 80-35.8 80-80V80c0-44.2-35.8-80-80-80H208c-44.2 0-80 35.8-80 80",
27
+ opacity: i ? "1" : "0.4"
28
+ }
29
+ ),
30
+ /* @__PURE__ */ e("path", { d: "M64 128c-35.3 0-64 28.7-64 64v256c0 35.3 28.7 64 64 64h256c35.3 0 64-28.7 64-64V192c0-35.3-28.7-64-64-64zm32 64h192c17.7 0 32 14.3 32 32s-14.3 32-32 32H96c-17.7 0-32-14.3-32-32s14.3-32 32-32" })
31
+ ]
32
+ }
33
+ ), W = ({
34
+ className: c,
35
+ viewBox: l,
36
+ title: o,
37
+ monotone: i,
38
+ ...n
39
+ }) => /* @__PURE__ */ m(
40
+ g,
41
+ {
42
+ defaultViewBox: "0 0 512 512",
43
+ size: "size-5",
44
+ viewBox: l,
45
+ className: c,
46
+ title: o || "Star in Circle",
47
+ ...n,
48
+ children: [
49
+ /* @__PURE__ */ e(
50
+ "path",
51
+ {
52
+ d: "M0 256a256 256 0 1 0 512 0 256 256 0 1 0-512 0m111.4-47c1.9-5.8 6.9-10 12.9-10.9 27-3.9 54-7.9 81.1-11.8 12.1-24.5 24.2-49 36.2-73.4 2.7-5.5 8.3-8.9 14.3-8.9s11.7 3.5 14.3 8.9c12.1 24.5 24.2 49 36.2 73.4 27 3.9 54 7.9 81 11.8 6 .9 11 5.1 12.9 10.9s.3 12.2-4 16.4l-58.6 57.2 13.8 80.7c1 6-1.4 12.1-6.4 15.6-2.8 2-6.1 3.1-9.4 3.1-2.5 0-5.1-.6-7.4-1.8-24.2-12.7-48.3-25.4-72.5-38.1-24.2 12.7-48.3 25.4-72.5 38.1-2.3 1.2-4.9 1.8-7.4 1.8-3.3 0-6.6-1-9.4-3.1-4.9-3.6-7.4-9.6-6.4-15.6l13.8-80.7-58.6-57.2c-4.4-4.3-5.9-10.6-4-16.4z",
53
+ opacity: ".4"
54
+ }
55
+ ),
56
+ /* @__PURE__ */ e("path", { d: "M270.3 112.9c-2.7-5.5-8.3-8.9-14.3-8.9s-11.7 3.5-14.3 8.9l-36.2 73.4-81.1 11.8c-6 .9-11 5.1-12.9 10.9s-.3 12.2 4 16.4l58.6 57.2-13.8 80.7c-1 6 1.4 12.1 6.4 15.6s11.5 4.1 16.9 1.2l72.4-38 72.5 38.1c5.4 2.8 11.9 2.4 16.9-1.2s7.4-9.6 6.4-15.6L338 282.7l58.6-57.2c4.4-4.3 5.9-10.6 4-16.4s-6.9-10-12.9-10.9l-81-11.8-36.2-73.4z" })
57
+ ]
58
+ }
59
+ ), j = ({
60
+ className: c,
61
+ viewBox: l,
62
+ title: o,
63
+ monotone: i,
64
+ ...n
65
+ }) => /* @__PURE__ */ m(
66
+ g,
67
+ {
68
+ defaultViewBox: "0 0 512 512",
69
+ size: "size-5",
70
+ viewBox: l,
71
+ className: c,
72
+ title: o || "Star in Circle",
73
+ ...n,
74
+ children: [
75
+ /* @__PURE__ */ e(
76
+ "path",
77
+ {
78
+ d: "M32 256a224 224 0 1 0 448 0 224 224 0 1 0-448 0m79.4-47c1.9-5.8 6.9-10 12.9-10.9l81-11.8 36.2-73.4c2.7-5.5 8.3-8.9 14.3-8.9s11.7 3.5 14.3 8.9l36.2 73.4 81.1 11.8c6 .9 11 5.1 12.9 10.9s.3 12.2-4 16.4l-58.6 57.2 13.8 80.7c1 6-1.4 12.1-6.4 15.6s-11.5 4.1-16.9 1.2l-72.2-38-72.5 38.1c-5.4 2.8-11.9 2.4-16.8-1.2s-7.4-9.6-6.4-15.6l13.8-80.7-58.6-57.2c-4.4-4.3-5.9-10.6-4-16.4z",
79
+ opacity: ".4"
80
+ }
81
+ ),
82
+ /* @__PURE__ */ e("path", { d: "M256 32a224 224 0 1 1 0 448 224 224 0 1 1 0-448m0 480a256 256 0 1 0 0-512 256 256 0 1 0 0 512m14.3-399.1c-2.7-5.5-8.3-8.9-14.3-8.9s-11.7 3.5-14.3 8.9l-36.2 73.4-81 11.8c-6 .9-11 5.1-12.9 10.9s-.3 12.2 4 16.4l58.6 57.2-13.8 80.7c-1 6 1.4 12.1 6.4 15.6s11.5 4.1 16.8 1.2l72.4-38 72.5 38.1c5.4 2.8 11.9 2.4 16.9-1.2s7.4-9.6 6.4-15.6L338 282.7l58.6-57.2c4.4-4.3 5.9-10.6 4-16.4s-6.9-10-12.9-10.9l-81.1-11.8-36.2-73.4zm-40 95.1 25.7-51.8 25.6 51.9c2.3 4.7 6.8 8 12 8.8l57.3 8.3-41.5 40.4c-3.8 3.7-5.5 9-4.6 14.2l9.8 57.1-51.2-26.9c-4.7-2.5-10.2-2.5-14.9 0l-51.2 26.9 9.8-57.1c.9-5.2-.8-10.5-4.6-14.2L161 225.1l57.3-8.3c5.2-.8 9.7-4 12-8.8" })
83
+ ]
84
+ }
85
+ ), q = {
86
+ [I]: V,
87
+ [B]: L,
88
+ [U]: P
89
+ }, t = {
90
+ ROW: "row",
91
+ TIMESTAMP: N,
92
+ SUMMARY: "summary",
93
+ PROVIDER: "provider",
94
+ TOKEN_USAGE: C,
95
+ ACTIONS: "actions"
96
+ }, J = [
97
+ t.ROW,
98
+ t.TIMESTAMP,
99
+ t.SUMMARY,
100
+ t.ACTIONS
101
+ ], Q = [
102
+ t.ROW,
103
+ t.SUMMARY,
104
+ t.TIMESTAMP,
105
+ t.TOKEN_USAGE,
106
+ t.PROVIDER,
107
+ t.ACTIONS
108
+ ], le = ({
109
+ filteredHistory: c,
110
+ historyState: l,
111
+ lastEntryToLoad: o,
112
+ onClickSort: i,
113
+ onClickRestore: n,
114
+ onClickDelete: w,
115
+ onClickFavorite: O,
116
+ infinityScrollMarkerRef: S
117
+ }) => {
118
+ const v = D() ? J : Q, T = (s) => {
119
+ switch (s) {
120
+ case t.ROW:
121
+ return /* @__PURE__ */ e(a, { className: "sr-only", children: "Row" }, s);
122
+ case t.TIMESTAMP:
123
+ return /* @__PURE__ */ e(
124
+ R,
125
+ {
126
+ buttonClassName: "text-xs sm:text-sm",
127
+ cellId: N,
128
+ align: "left",
129
+ sortDirection: l.sortDirection,
130
+ sortedCell: l.sortedCell,
131
+ onClick: () => {
132
+ i(N);
133
+ },
134
+ children: "Date"
135
+ },
136
+ s
137
+ );
138
+ case t.SUMMARY:
139
+ return /* @__PURE__ */ e(a, { className: "text-xs sm:text-sm", children: "Summary" }, s);
140
+ case t.PROVIDER:
141
+ return /* @__PURE__ */ e(a, { className: "text-xs sm:text-sm", children: "Provider" }, s);
142
+ case t.TOKEN_USAGE:
143
+ return /* @__PURE__ */ e(
144
+ R,
145
+ {
146
+ buttonClassName: "text-xs sm:text-sm",
147
+ cellId: C,
148
+ align: "right",
149
+ sortDirection: l.sortDirection,
150
+ sortedCell: l.sortedCell,
151
+ onClick: () => {
152
+ i(C);
153
+ },
154
+ children: "Tokens"
155
+ },
156
+ s
157
+ );
158
+ case t.ACTIONS:
159
+ return /* @__PURE__ */ e(a, { className: "text-xs sm:text-sm text-right", children: "Actions" }, s);
160
+ default:
161
+ return null;
162
+ }
163
+ }, z = (s, r, x) => {
164
+ switch (s) {
165
+ case t.ROW:
166
+ return /* @__PURE__ */ e(a, { children: x + 1 }, s);
167
+ case t.TIMESTAMP:
168
+ return /* @__PURE__ */ e(
169
+ a,
170
+ {
171
+ component: "th",
172
+ scope: "row",
173
+ className: h(
174
+ "dark:text-gray-400",
175
+ "sm:whitespace-nowrap text-xs sm:text-sm max-w-20 sm:max-w-none"
176
+ ),
177
+ children: r.timestamp.split(",")[0]
178
+ },
179
+ s
180
+ );
181
+ case t.SUMMARY: {
182
+ const d = r.summary || (r.messages.length > 0 ? r.messages[0]?.content : "");
183
+ return /* @__PURE__ */ e(
184
+ a,
185
+ {
186
+ className: h(
187
+ "dark:text-white",
188
+ "max-w-[100px] sm:max-w-full text-xs sm:text-sm"
189
+ ),
190
+ style: {
191
+ wordBreak: "break-word"
192
+ },
193
+ children: d
194
+ },
195
+ s
196
+ );
197
+ }
198
+ case t.PROVIDER: {
199
+ const d = r.model ? b(r.model) : null, f = d ? q[d] : null;
200
+ return /* @__PURE__ */ e(
201
+ a,
202
+ {
203
+ component: "th",
204
+ scope: "row",
205
+ className: h("dark:text-gray-400"),
206
+ align: "center",
207
+ children: f ? /* @__PURE__ */ e(
208
+ f,
209
+ {
210
+ size: "size-4 sm:size-5",
211
+ semantic: !0,
212
+ title: r.model || d
213
+ }
214
+ ) : null
215
+ },
216
+ s
217
+ );
218
+ }
219
+ case t.TOKEN_USAGE:
220
+ return /* @__PURE__ */ e(
221
+ a,
222
+ {
223
+ className: h("dark:text-gray-400", "text-xs sm:text-sm"),
224
+ align: "right",
225
+ children: r.tokenUsage ? k.format(r.tokenUsage) : "0"
226
+ },
227
+ s
228
+ );
229
+ case t.ACTIONS:
230
+ return /* @__PURE__ */ e(a, { children: /* @__PURE__ */ m("div", { className: "flex flex-col items-end sm:flex-row gap-2", children: [
231
+ /* @__PURE__ */ e(
232
+ u,
233
+ {
234
+ label: "Restore chat",
235
+ mode: "alt-system",
236
+ placement: "top",
237
+ trigger: /* @__PURE__ */ e(
238
+ p,
239
+ {
240
+ focusMode: "alt-system",
241
+ noBorder: !0,
242
+ label: "Restore chat",
243
+ variant: "primary",
244
+ iconClassName: "text-green-800 dark:text-green-500",
245
+ onClick: async () => {
246
+ await n(r);
247
+ },
248
+ children: /* @__PURE__ */ e(K, { size: "size-3", monotone: !0 })
249
+ }
250
+ )
251
+ }
252
+ ),
253
+ /* @__PURE__ */ e(
254
+ u,
255
+ {
256
+ label: r.favoriteChat ? "Remove from favorites" : "Add to favorites",
257
+ mode: "alt-system",
258
+ placement: "top",
259
+ trigger: /* @__PURE__ */ e(
260
+ p,
261
+ {
262
+ focusMode: "alt-system",
263
+ noBorder: !0,
264
+ label: r.favoriteChat ? "Remove from favorites" : "Add to favorites",
265
+ variant: "primary",
266
+ onClick: async () => {
267
+ await O(r);
268
+ },
269
+ children: r.favoriteChat ? /* @__PURE__ */ e(W, { size: "size-4", monotone: !0 }) : /* @__PURE__ */ e(j, { size: "size-4", monotone: !0 })
270
+ }
271
+ )
272
+ }
273
+ ),
274
+ /* @__PURE__ */ e(
275
+ u,
276
+ {
277
+ label: "Delete chat",
278
+ mode: "alt-system",
279
+ placement: "top",
280
+ trigger: /* @__PURE__ */ e(
281
+ p,
282
+ {
283
+ focusMode: "alt-system",
284
+ noBorder: !0,
285
+ label: "Delete chat",
286
+ variant: "primary",
287
+ iconClassName: "text-red-700 dark:text-red-500",
288
+ onClick: () => {
289
+ w(r);
290
+ },
291
+ children: /* @__PURE__ */ e(G, { size: "size-3", monotone: !0 })
292
+ }
293
+ )
294
+ }
295
+ )
296
+ ] }) }, s);
297
+ default:
298
+ return null;
299
+ }
300
+ };
301
+ return /* @__PURE__ */ m(_, { stickyHeader: !0, stickyFooter: !0, compact: !0, mode: "alt-system", children: [
302
+ /* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(M, { children: v.map((s) => T(s)) }) }),
303
+ /* @__PURE__ */ e(Y, { children: c.slice(0, o).map((s, r) => s?.messages?.length > 0 ? /* @__PURE__ */ m($, { children: [
304
+ r === o - y && /* @__PURE__ */ e("tr", { ref: S }),
305
+ /* @__PURE__ */ e(M, { children: v.map(
306
+ (x) => z(x, s, r)
307
+ ) })
308
+ ] }, `${A.HISTORY.TITLE}-${s.id}-${r}`) : null) }),
309
+ /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(M, { children: /* @__PURE__ */ e(a, { colSpan: 1e3, children: /* @__PURE__ */ e("div", { children: E(
310
+ `${c.length} chat`,
311
+ c.length
312
+ ) }) }) }) })
313
+ ] });
314
+ };
315
+ export {
316
+ le as ChatHistoryTable
317
+ };
@@ -0,0 +1,332 @@
1
+ import { jsxs as n, jsx as t, Fragment as Q } from "react/jsx-runtime";
2
+ import { I as Z, n as P, INFINITE_SCROLL_LIMIT as G, INFINITE_SCROLL_THRESHOLD as ee, LOCAL_STORAGE_PREFIX as y, LOCAL_STORAGE_SORT_TIMESTAMP as te, LOCAL_STORAGE_SORT_TOKEN_USAGE as re, LOCAL_STORAGE_SORT as ae, de as L, useUserPreferences as se, APP_CLASSNAME as oe, mutateCall as b, SERVICE_TYPES as x, setNewProvider as ie, ACTION_SORT as ne, Oe as ce, TOAST_CHAT_DELETED as le, TOAST_PROVIDER_CHANGED as de, useChatsHistory as he, LOCAL_STORAGE_SEARCH as me, LOCAL_STORAGE_FAVORITES_ONLY as ue, HISTORY_TITLE as Ce, S as Se, Y as pe, debounce as Te, C as fe, ACTION_SEARCH as ye } from "./index.D3golFwx.js";
3
+ import { HistoryContext as z, ChatContext as M, useAiChat as Ee, E, e as m, ConfirmationPanel as ge, LazyToastContainerWrapper as Ae, showErrorToast as _e, CHAT_SET_PROVIDER as Oe, showSuccessToast as De, CHAT_SET_STATUS as ve, se as Le, O as Re } from "./App.B8ehtPCy.js";
4
+ import { useRef as H, useState as F, useContext as R, useCallback as ke, useEffect as U, Suspense as Ie, lazy as we } from "react";
5
+ const Ne = ({
6
+ className: l,
7
+ viewBox: h,
8
+ title: T,
9
+ monotone: u,
10
+ ...d
11
+ }) => /* @__PURE__ */ n(
12
+ Z,
13
+ {
14
+ defaultViewBox: "0 0 512 512",
15
+ size: "size-5",
16
+ viewBox: h,
17
+ className: l,
18
+ title: T || "Search",
19
+ ...d,
20
+ children: [
21
+ /* @__PURE__ */ t(
22
+ "path",
23
+ {
24
+ d: "M0 208a208 208 0 1 0 416 0 208 208 0 1 0-416 0m352 0a144 144 0 1 1-288 0 144 144 0 1 1 288 0",
25
+ opacity: u ? "1" : "0.4"
26
+ }
27
+ ),
28
+ /* @__PURE__ */ t("path", { d: "m330.7 376 126.7 126.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L376 330.7c-12.7 17.3-28 32.6-45.3 45.3" })
29
+ ]
30
+ }
31
+ ), be = we(
32
+ () => import(
33
+ /* webpackChunkName: "history-table" */
34
+ "./ChatHistoryTable.2v_Tv5Xj.js"
35
+ ).then((l) => ({ default: l.ChatHistoryTable }))
36
+ ), xe = ({
37
+ filteredHistory: l,
38
+ dispatch: h,
39
+ onOpenChange: T,
40
+ mutate: u
41
+ }) => {
42
+ const { user: d, getAccessToken: C } = P(), S = H(null), o = H({
43
+ id: "",
44
+ timestamp: "",
45
+ message: ""
46
+ }), [c, g] = F(!1), [p, k] = F(
47
+ G + ee
48
+ ), { state: i, dispatch: A } = R(z), I = {
49
+ searchString: i.searchString || "",
50
+ sortDirection: i.sortDirection || m.DESC,
51
+ sortedCell: i.sortedCell || L
52
+ }, {
53
+ state: { provider: f },
54
+ setChatId: w,
55
+ setInitialMessages: _
56
+ } = R(M), { setInput: N } = Ee(), [O, D] = E({
57
+ key: y + te,
58
+ initialValue: m.DESC
59
+ }), [s, B] = E({
60
+ key: y + re,
61
+ initialValue: m.ASC
62
+ }), [, Y] = E({
63
+ key: y + ae,
64
+ initialValue: L
65
+ }), { refetch: j } = se({
66
+ user: d?.username,
67
+ getAccessToken: C
68
+ }), $ = (e) => {
69
+ const a = i.sortedCell === e;
70
+ let r, v;
71
+ switch (e) {
72
+ case L:
73
+ v = D, r = a ? i.sortDirection : O;
74
+ break;
75
+ case ce:
76
+ v = B, r = a ? i.sortDirection : s;
77
+ break;
78
+ default:
79
+ v = D, r = a ? i.sortDirection : O;
80
+ break;
81
+ }
82
+ const V = r === m.ASC ? m.DESC : m.ASC;
83
+ v(V), Y(e), A({
84
+ type: ne,
85
+ payload: {
86
+ sortedCell: e,
87
+ sortDirection: V
88
+ }
89
+ });
90
+ }, K = async () => {
91
+ const e = o.current;
92
+ try {
93
+ await b({
94
+ accessToken: await C(),
95
+ type: x.DELETE_CHAT,
96
+ params: {
97
+ userId: d?.username || "",
98
+ id: e.id
99
+ }
100
+ }), u(""), await _e(le, {
101
+ autoClose: 2e3,
102
+ containerId: "history-table"
103
+ });
104
+ } catch {
105
+ }
106
+ }, W = async (e) => {
107
+ try {
108
+ const a = await C(), r = await b({
109
+ accessToken: a,
110
+ type: x.GET_CHAT,
111
+ params: {
112
+ id: e.id
113
+ }
114
+ });
115
+ r.status === 200 && (r.data.provider !== f && (await ie({
116
+ provider: r.data.provider,
117
+ accessToken: a,
118
+ username: d?.username || ""
119
+ }), h({
120
+ type: Oe,
121
+ payload: {
122
+ provider: r.data.provider
123
+ }
124
+ }), j(), await De(
125
+ `${de} ${r.data.provider}`,
126
+ {
127
+ containerId: "toggle-provider"
128
+ }
129
+ )), h({
130
+ type: ve,
131
+ payload: {
132
+ restoring: !0,
133
+ restoredModel: r.data?.model || "",
134
+ restoredUsage: r.data?.tokenUsage || 0
135
+ }
136
+ }), N(""), w(e.id), _(r.data.messages), T(!1));
137
+ } catch {
138
+ }
139
+ }, X = (e) => {
140
+ o.current = {
141
+ id: e.id,
142
+ timestamp: e.timestamp,
143
+ message: e.messages.length > 0 ? e.messages[0]?.content : ""
144
+ }, g(!c);
145
+ }, q = async (e) => {
146
+ try {
147
+ (await b({
148
+ accessToken: await C(),
149
+ type: x.TOGGLE_FAVORITE_CHAT,
150
+ params: {
151
+ userId: d?.username || "",
152
+ id: e.id
153
+ }
154
+ })).status === 200 && u("");
155
+ } catch {
156
+ }
157
+ }, J = ke((e) => {
158
+ e[0].isIntersecting && k((r) => r + G);
159
+ }, []);
160
+ return U(() => {
161
+ const e = {
162
+ // root: null,
163
+ rootMargin: "20px"
164
+ }, a = new IntersectionObserver(J, e);
165
+ S.current && a.observe(S.current);
166
+ }), /* @__PURE__ */ n(Q, { children: [
167
+ /* @__PURE__ */ n(
168
+ ge,
169
+ {
170
+ showConfirmation: c,
171
+ setShowConfirmation: g,
172
+ action: K,
173
+ customStrings: {
174
+ confirmAction: "Delete",
175
+ cancelAction: "Cancel",
176
+ title: "Delete chat"
177
+ },
178
+ children: [
179
+ /* @__PURE__ */ t("p", { className: "m-0", children: "Are you sure you want to delete the following chat:" }),
180
+ /* @__PURE__ */ n("ul", { className: "m-0", children: [
181
+ /* @__PURE__ */ n("li", { children: [
182
+ "Timestamp:",
183
+ " ",
184
+ /* @__PURE__ */ t("span", { className: "text-lg", children: o.current && o.current.timestamp })
185
+ ] }),
186
+ /* @__PURE__ */ n("li", { children: [
187
+ "First message:",
188
+ " ",
189
+ /* @__PURE__ */ t("span", { className: "text-lg", children: o.current?.message })
190
+ ] })
191
+ ] })
192
+ ]
193
+ }
194
+ ),
195
+ /* @__PURE__ */ t("div", { className: oe, children: /* @__PURE__ */ t(Ae, { containerId: "history-table" }) }),
196
+ /* @__PURE__ */ t(Ie, { fallback: /* @__PURE__ */ t("div", {}), children: /* @__PURE__ */ t(
197
+ be,
198
+ {
199
+ filteredHistory: l,
200
+ historyState: I,
201
+ lastEntryToLoad: p,
202
+ onClickSort: $,
203
+ onClickRestore: W,
204
+ onClickDelete: X,
205
+ onClickFavorite: q,
206
+ infinityScrollMarkerRef: S
207
+ }
208
+ ) })
209
+ ] });
210
+ }, Pe = ({
211
+ open: l,
212
+ onOpenChange: h
213
+ }) => {
214
+ const { getAccessToken: T, user: u } = P(), { dispatch: d } = R(M), [C, S] = F([]), o = H(null), { state: c, dispatch: g } = R(z), {
215
+ data: p,
216
+ refetch: k,
217
+ isLoading: i,
218
+ isError: A
219
+ } = he({
220
+ enabled: l,
221
+ user: u?.username || "",
222
+ searchString: c.searchString || "",
223
+ sortDirection: c.sortDirection || m.DESC,
224
+ sortedCell: c.sortedCell || L,
225
+ getAccessToken: T
226
+ }), [, I] = E({
227
+ key: y + me,
228
+ initialValue: c.searchString
229
+ }), [f, w] = E({
230
+ key: y + ue,
231
+ initialValue: !1
232
+ });
233
+ U(() => {
234
+ p && S(
235
+ f ? p.filter((s) => s.favoriteChat === !0) : p
236
+ );
237
+ }, [p, f]);
238
+ const _ = async (s) => {
239
+ I(s), g({
240
+ type: ye,
241
+ payload: { searchString: s }
242
+ });
243
+ }, N = Te((s) => {
244
+ _(s.target.value.trim());
245
+ }, 500), O = async (s) => {
246
+ s.preventDefault();
247
+ }, D = (s) => {
248
+ w(s);
249
+ };
250
+ return /* @__PURE__ */ n(
251
+ Le,
252
+ {
253
+ open: l,
254
+ onOpenChange: h,
255
+ title: Ce,
256
+ animation: !0,
257
+ animationType: "fade",
258
+ children: [
259
+ /* @__PURE__ */ t(
260
+ Se,
261
+ {
262
+ header: "Filters",
263
+ className: "prose-dark dark:prose-lighter mb-4",
264
+ noBorder: !0,
265
+ compact: !0,
266
+ children: /* @__PURE__ */ n("form", { autoComplete: "off", onSubmit: O, children: [
267
+ /* @__PURE__ */ t(
268
+ pe,
269
+ {
270
+ placeholder: "Search",
271
+ labelHidden: !0,
272
+ noBorder: !0,
273
+ autoCapitalize: "off",
274
+ autoComplete: "off",
275
+ autoCorrect: "off",
276
+ ref: o,
277
+ defaultValue: c.searchString,
278
+ mode: "alt-system",
279
+ name: "Search",
280
+ label: "Search",
281
+ onChange: N,
282
+ className: "my-2",
283
+ rightElement: /* @__PURE__ */ t("div", { className: "dark:text-copy-dark text-copy-light", children: /* @__PURE__ */ t(Ne, { monotone: !0, size: "size-3" }) })
284
+ }
285
+ ),
286
+ /* @__PURE__ */ n("div", { className: "flex flex-col justify-between sm:flex-row gap-2 sm:mb-0 mb-1", children: [
287
+ /* @__PURE__ */ t("div", { className: "order-1 sm:order-0", children: /* @__PURE__ */ t(
288
+ Re,
289
+ {
290
+ name: "favorites-only",
291
+ checked: f,
292
+ onChange: D,
293
+ label: "Show favorites only",
294
+ narrow: !0,
295
+ noBorder: !0
296
+ }
297
+ ) }),
298
+ /* @__PURE__ */ t(
299
+ fe,
300
+ {
301
+ size: "small",
302
+ disabled: c.searchString === "",
303
+ onClick: () => {
304
+ _(""), o.current?.value && (o.current.value = "", o.current.focus());
305
+ },
306
+ children: "Reset Search"
307
+ }
308
+ )
309
+ ] })
310
+ ] })
311
+ }
312
+ ),
313
+ /* @__PURE__ */ n("div", { className: "flex flex-col sm:flex-row max-h-[75vh] min-h-[60vh]", children: [
314
+ i && /* @__PURE__ */ t("p", { className: "m-0", children: "Loading..." }),
315
+ A && /* @__PURE__ */ t("p", { className: "m-0 text-red-500", children: "Failed to load history." }),
316
+ !i && !A && /* @__PURE__ */ t(
317
+ xe,
318
+ {
319
+ mutate: k,
320
+ filteredHistory: C,
321
+ dispatch: d,
322
+ onOpenChange: h
323
+ }
324
+ )
325
+ ] })
326
+ ]
327
+ }
328
+ );
329
+ };
330
+ export {
331
+ Pe as HistoryPanel
332
+ };
@@ -1,6 +1,6 @@
1
1
  import { jsxs as t, Fragment as m, jsx as e } from "react/jsx-runtime";
2
- import { se as h } from "./App.D-eIGXB_.js";
3
- import { n as S, i as R, S as a, renderDataAsList as N, CARDS as r, it as P, isTauri as u, te as T, l as E, L as p, j as l, PROFILE_TITLE as C } from "./index.C5_-KbC2.js";
2
+ import { se as h } from "./App.B8ehtPCy.js";
3
+ import { n as S, i as R, S as a, renderDataAsList as N, CARDS as r, it as P, isTauri as u, te as T, l as E, L as p, j as l, PROFILE_TITLE as C } from "./index.D3golFwx.js";
4
4
  const A = () => {
5
5
  const { isAuthenticated: n, user: i, registeringForPasskey: o, authenticationType: c } = S(), d = R(), s = i?.username || "";
6
6
  return n && s ? /* @__PURE__ */ t(m, { children: [