@versini/sassysaint 8.39.10 → 8.40.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 (23) hide show
  1. package/dist/chunks/{AboutChangelog.CCL6woFi.js → AboutChangelog.sxwJVJMw.js} +2 -2
  2. package/dist/chunks/{AboutEntry.CdUMph5q.js → AboutEntry.BQ81lUub.js} +5 -5
  3. package/dist/chunks/App.B9gc6fg7.js +14162 -0
  4. package/dist/chunks/{Chart.BDCtfHpJ.js → Chart.C49WdExM.js} +2 -2
  5. package/dist/chunks/ChatBubbleAssistant.BGAdbVxr.js +75 -0
  6. package/dist/chunks/{HistoryEntry.DzQ2MSaZ.js → HistoryEntry.B9fK7Ffl.js} +231 -216
  7. package/dist/chunks/{LNWAZHJI.D7CCdvNo.js → LNWAZHJI.CdnUhcqc.js} +1 -1
  8. package/dist/chunks/{ProfileEntry.YotUrCiu.js → ProfileEntry.CfrDx_1j.js} +2 -2
  9. package/dist/chunks/{SettingsEntry.CnnDhK6w.js → SettingsEntry.D75eEHLZ.js} +2 -2
  10. package/dist/chunks/{UsageEntry.D2ZOKNfK.js → UsageEntry.In0ugMi8.js} +3 -3
  11. package/dist/chunks/{index.Dx6oN_z4.js → index.BKnr6q_J.js} +1 -1
  12. package/dist/chunks/{index.RXuXaAsE.js → index.Cl7AhqCZ.js} +1 -1
  13. package/dist/chunks/{index.Dym4y9es.js → index.CrPLofea.js} +626 -592
  14. package/dist/chunks/{index.7uobAuKV.js → index.D3As27U8.js} +2 -2
  15. package/dist/chunks/{index.f7-kYhdF.js → index.DBcnZQzl.js} +1 -1
  16. package/dist/chunks/{index.CVlucvO6.js → index.uP1AYao7.js} +3 -3
  17. package/dist/chunks/{useMarkdown.ClVoAzdf.js → useMarkdown.4lWqmQ_l.js} +6 -6
  18. package/dist/components/SassySaint/SassySaint.js +1 -1
  19. package/dist/index.js +4 -4
  20. package/dist/style.css +1 -1
  21. package/package.json +3 -3
  22. package/dist/chunks/App.fCKFZhqI.js +0 -10314
  23. package/dist/chunks/ChatBubbleAssistant.DNqS0sbL.js +0 -74
@@ -1,169 +1,169 @@
1
- import { jsxs as m, jsx as e, Fragment as Q } from "react/jsx-runtime";
2
- import { I, INFINITE_SCROLL_THRESHOLD as V, CARDS as Z, pluralize as ee, ue as w, numberFormatter as te, isProbablyMobile as se, n as B, INFINITE_SCROLL_LIMIT as b, LOCAL_STORAGE_PREFIX as $, LOCAL_STORAGE_SORT as re, APP_CLASSNAME as ae, ACTION_SORT as z, TOAST_CHAT_DELETED as oe, TOAST_PROVIDER_CHANGED as ne, LOCAL_STORAGE_SEARCH as ce, HISTORY_TITLE as ie, pe as le, debounce as de, ACTION_SEARCH as me } from "./index.Dym4y9es.js";
3
- import { De as he, He as ue, qe as O, Ge as pe, Fe as Ce, Pe as u, Ye as L, st as H, de as Se, a as Te, p as ge, p$1 as xe, y as fe, a$1 as ye, i$1 as Ee, HistoryContext as F, ChatContext as G, useAiChat as Ae, E as Y, useUserPreferences as Ne, ConfirmationPanel as Re, LazyToastContainerWrapper as ve, mutateCall as P, SERVICE_TYPES as U, showErrorToast as De, setNewProvider as Oe, CHAT_SET_PROVIDER as we, showSuccessToast as Me, CHAT_SET_STATUS as ke, E$1 as N, useChatsHistory as Ie, tt as _e, a$2 as be } from "./App.fCKFZhqI.js";
4
- import { Fragment as ze, useRef as M, useState as R, useContext as v, useCallback as Le, useEffect as k } from "react";
5
- const He = ({
1
+ import { jsxs as h, jsx as e, Fragment as ne } from "react/jsx-runtime";
2
+ import { I as z, ue$1 as A, Ae as M, INFINITE_SCROLL_THRESHOLD as F, CARDS as ce, pluralize as ie, ue as I, numberFormatter as le, de, isProbablyMobile as me, E as he, a as ue, i as Ce, n as Y, INFINITE_SCROLL_LIMIT as U, LOCAL_STORAGE_PREFIX as v, LOCAL_STORAGE_SORT_TIMESTAMP as pe, LOCAL_STORAGE_SORT_TOKEN_USAGE as Se, LOCAL_STORAGE_SORT as Te, APP_CLASSNAME as ge, ACTION_SORT as Ee, TOAST_CHAT_DELETED as xe, TOAST_PROVIDER_CHANGED as fe, LOCAL_STORAGE_SEARCH as ye, HISTORY_TITLE as Ae, pe$1 as De, debounce as Oe, ACTION_SEARCH as Re } from "./index.CrPLofea.js";
3
+ import { De as Ne, He as ve, qe as k, Ge as we, Fe as Me, Pe as p, Ye as V, st as $, a as _e, p as ke, p$1 as Ie, HistoryContext as K, ChatContext as W, useAiChat as be, E as w, E$1 as y, useUserPreferences as Le, ConfirmationPanel as ze, LazyToastContainerWrapper as He, mutateCall as B, SERVICE_TYPES as G, showErrorToast as Pe, setNewProvider as Ue, CHAT_SET_PROVIDER as Ve, showSuccessToast as $e, CHAT_SET_STATUS as Be, useChatsHistory as Ge, tt as Fe, a$1 as Ye } from "./App.B9gc6fg7.js";
4
+ import { Fragment as Ke, useRef as b, useState as L, useContext as _, useCallback as We, useEffect as j } from "react";
5
+ const je = ({
6
6
  className: c,
7
- viewBox: a,
8
- title: l,
9
- monotone: d,
7
+ viewBox: o,
8
+ title: d,
9
+ monotone: m,
10
10
  ...i
11
- }) => /* @__PURE__ */ m(
12
- I,
11
+ }) => /* @__PURE__ */ h(
12
+ z,
13
13
  {
14
14
  defaultViewBox: "0 0 448 512",
15
15
  size: "size-5",
16
- viewBox: a,
16
+ viewBox: o,
17
17
  className: c,
18
- title: l || "Delete",
18
+ title: d || "Delete",
19
19
  ...i,
20
20
  children: [
21
21
  /* @__PURE__ */ e(
22
22
  "path",
23
23
  {
24
24
  d: "M32 96v352c0 35.3 28.7 64 64 64h256c35.3 0 64-28.7 64-64V96zm80 80c0-8.8 7.2-16 16-16s16 7.2 16 16v224c0 8.8-7.2 16-16 16s-16-7.2-16-16zm96 0c0-8.8 7.2-16 16-16s16 7.2 16 16v224c0 8.8-7.2 16-16 16s-16-7.2-16-16zm96 0c0-8.8 7.2-16 16-16s16 7.2 16 16v224c0 8.8-7.2 16-16 16s-16-7.2-16-16z",
25
- opacity: d ? "1" : "0.4"
25
+ opacity: m ? "1" : "0.4"
26
26
  }
27
27
  ),
28
28
  /* @__PURE__ */ e("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 32 32 32h384c17.7 0 32-14.3 32-32s-14.3-32-32-32h-96l-7.2-14.3C307.4 6.8 296.3 0 284.2 0z" })
29
29
  ]
30
30
  }
31
- ), Pe = ({
31
+ ), qe = ({
32
32
  className: c,
33
- viewBox: a,
34
- title: l,
35
- monotone: d,
33
+ viewBox: o,
34
+ title: d,
35
+ monotone: m,
36
36
  ...i
37
- }) => /* @__PURE__ */ m(
38
- I,
37
+ }) => /* @__PURE__ */ h(
38
+ z,
39
39
  {
40
40
  defaultViewBox: "0 0 512 512",
41
41
  size: "size-5",
42
- viewBox: a,
42
+ viewBox: o,
43
43
  className: c,
44
- title: l || "Restore",
44
+ title: d || "Restore",
45
45
  ...i,
46
46
  children: [
47
47
  /* @__PURE__ */ e(
48
48
  "path",
49
49
  {
50
50
  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",
51
- opacity: d ? "1" : "0.4"
51
+ opacity: m ? "1" : "0.4"
52
52
  }
53
53
  ),
54
54
  /* @__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" })
55
55
  ]
56
56
  }
57
- ), Ue = ({
57
+ ), Xe = ({
58
58
  className: c,
59
- viewBox: a,
60
- title: l,
61
- monotone: d,
59
+ viewBox: o,
60
+ title: d,
61
+ monotone: m,
62
62
  ...i
63
- }) => /* @__PURE__ */ m(
64
- I,
63
+ }) => /* @__PURE__ */ h(
64
+ z,
65
65
  {
66
66
  defaultViewBox: "0 0 512 512",
67
67
  size: "size-5",
68
- viewBox: a,
68
+ viewBox: o,
69
69
  className: c,
70
- title: l || "Search",
70
+ title: d || "Search",
71
71
  ...i,
72
72
  children: [
73
73
  /* @__PURE__ */ e(
74
74
  "path",
75
75
  {
76
76
  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",
77
- opacity: d ? "1" : "0.4"
77
+ opacity: m ? "1" : "0.4"
78
78
  }
79
79
  ),
80
80
  /* @__PURE__ */ e("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" })
81
81
  ]
82
82
  }
83
- ), Ve = {
84
- [Ee]: xe,
85
- [ye]: ge,
86
- [fe]: Te
83
+ ), Je = {
84
+ [Ce]: Ie,
85
+ [ue]: ke,
86
+ [he]: _e
87
87
  }, r = {
88
88
  ROW: "row",
89
- TIMESTAMP: "timestamp",
89
+ TIMESTAMP: A,
90
90
  SUMMARY: "summary",
91
91
  PROVIDER: "provider",
92
- TOKEN_USAGE: "tokenUsage",
92
+ TOKEN_USAGE: M,
93
93
  ACTIONS: "actions"
94
- }, Be = [
94
+ }, Qe = [
95
95
  r.ROW,
96
96
  r.TIMESTAMP,
97
97
  r.SUMMARY,
98
98
  r.ACTIONS
99
- ], $e = [
99
+ ], Ze = [
100
100
  r.ROW,
101
101
  r.SUMMARY,
102
102
  r.TIMESTAMP,
103
103
  r.TOKEN_USAGE,
104
104
  r.PROVIDER,
105
105
  r.ACTIONS
106
- ], Fe = ({
106
+ ], et = ({
107
107
  filteredHistory: c,
108
- historyState: a,
109
- lastEntryToLoad: l,
110
- onClickSort: d,
108
+ historyState: o,
109
+ lastEntryToLoad: d,
110
+ onClickSort: m,
111
111
  onClickRestore: i,
112
- onClickDelete: g,
112
+ onClickDelete: E,
113
113
  infinityScrollMarkerRef: x
114
114
  }) => {
115
- const o = se() ? Be : $e, A = (t) => {
115
+ const l = me() ? Qe : Ze, D = (t) => {
116
116
  switch (t) {
117
117
  case r.ROW:
118
- return /* @__PURE__ */ e(u, { className: "sr-only", children: "Row" }, t);
118
+ return /* @__PURE__ */ e(p, { className: "sr-only", children: "Row" }, t);
119
119
  case r.TIMESTAMP:
120
120
  return /* @__PURE__ */ e(
121
- L,
121
+ V,
122
122
  {
123
123
  buttonClassName: "text-xs sm:text-sm",
124
- cellId: "timestamp",
124
+ cellId: A,
125
125
  align: "left",
126
- sortDirection: a.sortDirection,
127
- sortedCell: a.sortedCell,
126
+ sortDirection: o.sortDirection,
127
+ sortedCell: o.sortedCell,
128
128
  onClick: () => {
129
- d("timestamp");
129
+ m(A);
130
130
  },
131
131
  children: "Date"
132
132
  },
133
133
  t
134
134
  );
135
135
  case r.SUMMARY:
136
- return /* @__PURE__ */ e(u, { className: "text-xs sm:text-sm", children: "Summary" }, t);
136
+ return /* @__PURE__ */ e(p, { className: "text-xs sm:text-sm", children: "Summary" }, t);
137
137
  case r.PROVIDER:
138
- return /* @__PURE__ */ e(u, { className: "text-xs sm:text-sm", children: "Provider" }, t);
138
+ return /* @__PURE__ */ e(p, { className: "text-xs sm:text-sm", children: "Provider" }, t);
139
139
  case r.TOKEN_USAGE:
140
140
  return /* @__PURE__ */ e(
141
- L,
141
+ V,
142
142
  {
143
143
  buttonClassName: "text-xs sm:text-sm",
144
- cellId: "tokenUsage",
144
+ cellId: M,
145
145
  align: "right",
146
- sortDirection: a.sortDirection,
147
- sortedCell: a.sortedCell,
146
+ sortDirection: o.sortDirection,
147
+ sortedCell: o.sortedCell,
148
148
  onClick: () => {
149
- d("tokenUsage");
149
+ m(M);
150
150
  },
151
151
  children: "Tokens"
152
152
  },
153
153
  t
154
154
  );
155
155
  case r.ACTIONS:
156
- return /* @__PURE__ */ e(u, { className: "text-xs sm:text-sm text-right", children: "Actions" }, t);
156
+ return /* @__PURE__ */ e(p, { className: "text-xs sm:text-sm text-right", children: "Actions" }, t);
157
157
  default:
158
158
  return null;
159
159
  }
160
160
  }, f = (t, s, T) => {
161
161
  switch (t) {
162
162
  case r.ROW:
163
- return /* @__PURE__ */ e(u, { children: T + 1 }, t);
163
+ return /* @__PURE__ */ e(p, { children: T + 1 }, t);
164
164
  case r.TIMESTAMP:
165
165
  return /* @__PURE__ */ e(
166
- u,
166
+ p,
167
167
  {
168
168
  component: "th",
169
169
  scope: "row",
@@ -173,34 +173,34 @@ const He = ({
173
173
  t
174
174
  );
175
175
  case r.SUMMARY: {
176
- const C = s.summary || (s.messages.length > 0 ? s.messages[0]?.content : "");
176
+ const S = s.summary || (s.messages.length > 0 ? s.messages[0]?.content : "");
177
177
  return /* @__PURE__ */ e(
178
- u,
178
+ p,
179
179
  {
180
180
  className: "max-w-[100px] text-white sm:max-w-full text-xs sm:text-sm",
181
181
  style: {
182
182
  wordBreak: "break-word"
183
183
  },
184
- children: C
184
+ children: S
185
185
  },
186
186
  t
187
187
  );
188
188
  }
189
189
  case r.PROVIDER: {
190
- const C = s.model ? Se(s.model) : null, y = C ? Ve[C] : null;
190
+ const S = s.model ? de(s.model) : null, O = S ? Je[S] : null;
191
191
  return /* @__PURE__ */ e(
192
- u,
192
+ p,
193
193
  {
194
194
  component: "th",
195
195
  scope: "row",
196
196
  className: "text-gray-400",
197
197
  align: "center",
198
- children: y ? /* @__PURE__ */ e(
199
- y,
198
+ children: O ? /* @__PURE__ */ e(
199
+ O,
200
200
  {
201
201
  size: "size-4 sm:size-5",
202
202
  semantic: !0,
203
- title: s.model || C
203
+ title: s.model || S
204
204
  }
205
205
  ) : null
206
206
  },
@@ -209,24 +209,24 @@ const He = ({
209
209
  }
210
210
  case r.TOKEN_USAGE:
211
211
  return /* @__PURE__ */ e(
212
- u,
212
+ p,
213
213
  {
214
214
  className: "text-gray-400 text-xs sm:text-sm",
215
215
  align: "right",
216
- children: s.tokenUsage ? te.format(s.tokenUsage) : "0"
216
+ children: s.tokenUsage ? le.format(s.tokenUsage) : "0"
217
217
  },
218
218
  t
219
219
  );
220
220
  case r.ACTIONS:
221
- return /* @__PURE__ */ e(u, { children: /* @__PURE__ */ m("div", { className: "flex flex-col items-end sm:flex-row gap-2", children: [
221
+ return /* @__PURE__ */ e(p, { children: /* @__PURE__ */ h("div", { className: "flex flex-col items-end sm:flex-row gap-2", children: [
222
222
  /* @__PURE__ */ e(
223
- H,
223
+ $,
224
224
  {
225
225
  label: "Restore chat",
226
226
  mode: "alt-system",
227
227
  placement: "top",
228
228
  trigger: /* @__PURE__ */ e(
229
- w,
229
+ I,
230
230
  {
231
231
  focusMode: "alt-system",
232
232
  noBorder: !0,
@@ -236,19 +236,19 @@ const He = ({
236
236
  onClick: async () => {
237
237
  await i(s);
238
238
  },
239
- children: /* @__PURE__ */ e(Pe, { size: "size-3", monotone: !0 })
239
+ children: /* @__PURE__ */ e(qe, { size: "size-3", monotone: !0 })
240
240
  }
241
241
  )
242
242
  }
243
243
  ),
244
244
  /* @__PURE__ */ e(
245
- H,
245
+ $,
246
246
  {
247
247
  label: "Delete chat",
248
248
  mode: "alt-system",
249
249
  placement: "top",
250
250
  trigger: /* @__PURE__ */ e(
251
- w,
251
+ I,
252
252
  {
253
253
  focusMode: "alt-system",
254
254
  noBorder: !0,
@@ -256,9 +256,9 @@ const He = ({
256
256
  variant: "primary",
257
257
  iconClassName: "text-red-700 dark:text-red-500",
258
258
  onClick: () => {
259
- g(s);
259
+ E(s);
260
260
  },
261
- children: /* @__PURE__ */ e(He, { size: "size-3", monotone: !0 })
261
+ children: /* @__PURE__ */ e(je, { size: "size-3", monotone: !0 })
262
262
  }
263
263
  )
264
264
  }
@@ -268,133 +268,152 @@ const He = ({
268
268
  return null;
269
269
  }
270
270
  };
271
- return /* @__PURE__ */ m(he, { stickyHeader: !0, stickyFooter: !0, compact: !0, children: [
272
- /* @__PURE__ */ e(ue, { children: /* @__PURE__ */ e(O, { children: o.map((t) => A(t)) }) }),
273
- /* @__PURE__ */ e(pe, { children: c.slice(0, l).map((t, s) => t?.messages?.length > 0 ? /* @__PURE__ */ m(ze, { children: [
274
- s === l - V && /* @__PURE__ */ e("tr", { ref: x }),
275
- /* @__PURE__ */ e(O, { children: o.map(
271
+ return /* @__PURE__ */ h(Ne, { stickyHeader: !0, stickyFooter: !0, compact: !0, children: [
272
+ /* @__PURE__ */ e(ve, { children: /* @__PURE__ */ e(k, { children: l.map((t) => D(t)) }) }),
273
+ /* @__PURE__ */ e(we, { children: c.slice(0, d).map((t, s) => t?.messages?.length > 0 ? /* @__PURE__ */ h(Ke, { children: [
274
+ s === d - F && /* @__PURE__ */ e("tr", { ref: x }),
275
+ /* @__PURE__ */ e(k, { children: l.map(
276
276
  (T) => f(T, t, s)
277
277
  ) })
278
- ] }, `${Z.HISTORY.TITLE}-${t.id}-${s}`) : null) }),
279
- /* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ e(O, { children: /* @__PURE__ */ e(u, { colSpan: 1e3, children: /* @__PURE__ */ e("div", { children: ee(
278
+ ] }, `${ce.HISTORY.TITLE}-${t.id}-${s}`) : null) }),
279
+ /* @__PURE__ */ e(Me, { children: /* @__PURE__ */ e(k, { children: /* @__PURE__ */ e(p, { colSpan: 1e3, children: /* @__PURE__ */ e("div", { children: ie(
280
280
  `${c.length} chat`,
281
281
  c.length
282
282
  ) }) }) }) })
283
283
  ] });
284
- }, Ge = ({
284
+ }, tt = ({
285
285
  filteredHistory: c,
286
- dispatch: a,
287
- onOpenChange: l,
288
- mutate: d
286
+ dispatch: o,
287
+ onOpenChange: d,
288
+ mutate: m
289
289
  }) => {
290
- const { user: i, getAccessToken: g } = B(), x = M(null), h = M({
290
+ const { user: i, getAccessToken: E } = Y(), x = b(null), u = b({
291
291
  id: "",
292
292
  timestamp: "",
293
293
  message: ""
294
- }), [o, A] = R(!1), [f, t] = R(
295
- b + V
296
- ), { state: s, dispatch: T } = v(F), {
297
- state: { provider: C },
298
- setChatId: y,
299
- setInitialMessages: D
300
- } = v(G), { setInput: _ } = Ae(), [, S] = Y({
301
- key: $ + re,
302
- initialValue: s.sortDirection
303
- }), { refetch: W } = Ne({
294
+ }), [l, D] = L(!1), [f, t] = L(
295
+ U + F
296
+ ), { state: s, dispatch: T } = _(K), S = {
297
+ searchString: s.searchString || "",
298
+ sortDirection: s.sortDirection || y.DESC,
299
+ sortedCell: s.sortedCell || A
300
+ }, {
301
+ state: { provider: O },
302
+ setChatId: g,
303
+ setInitialMessages: q
304
+ } = _(W), { setInput: X } = be(), [H, P] = w({
305
+ key: v + pe,
306
+ initialValue: y.DESC
307
+ }), [J, Q] = w({
308
+ key: v + Se,
309
+ initialValue: y.ASC
310
+ }), [, Z] = w({
311
+ key: v + Te,
312
+ initialValue: A
313
+ }), { refetch: ee } = Le({
304
314
  user: i?.username,
305
- getAccessToken: g
306
- }), K = (n) => {
307
- switch (s.sortDirection) {
308
- case N.ASC:
309
- S(N.DESC), T({
310
- type: z,
311
- payload: {
312
- sortedCell: n,
313
- sortDirection: N.DESC
314
- }
315
- });
315
+ getAccessToken: E
316
+ }), te = (a) => {
317
+ const C = s.sortedCell === a;
318
+ let n, R;
319
+ switch (a) {
320
+ case A:
321
+ R = P, n = C ? s.sortDirection : H;
322
+ break;
323
+ case M:
324
+ R = Q, n = C ? s.sortDirection : J;
316
325
  break;
317
326
  default:
318
- S(N.ASC), T({
319
- type: z,
320
- payload: {
321
- sortedCell: n,
322
- sortDirection: N.ASC
323
- }
324
- });
327
+ R = P, n = C ? s.sortDirection : H;
325
328
  break;
326
329
  }
327
- }, j = async () => {
328
- const n = h.current;
330
+ let N;
331
+ switch (n) {
332
+ case y.ASC:
333
+ N = y.DESC;
334
+ break;
335
+ default:
336
+ N = y.ASC;
337
+ break;
338
+ }
339
+ R(N), Z(a), T({
340
+ type: Ee,
341
+ payload: {
342
+ sortedCell: a,
343
+ sortDirection: N
344
+ }
345
+ });
346
+ }, se = async () => {
347
+ const a = u.current;
329
348
  try {
330
- await P({
331
- accessToken: await g(),
332
- type: U.DELETE_CHAT,
349
+ await B({
350
+ accessToken: await E(),
351
+ type: G.DELETE_CHAT,
333
352
  params: {
334
353
  userId: i?.username || "",
335
- id: n.id
354
+ id: a.id
336
355
  }
337
- }), d(""), await De(oe, {
356
+ }), m(""), await Pe(xe, {
338
357
  autoClose: 2e3,
339
358
  containerId: "history-table"
340
359
  });
341
360
  } catch {
342
361
  }
343
- }, q = async (n) => {
362
+ }, re = async (a) => {
344
363
  try {
345
- const E = await g(), p = await P({
346
- accessToken: E,
347
- type: U.GET_CHAT,
364
+ const C = await E(), n = await B({
365
+ accessToken: C,
366
+ type: G.GET_CHAT,
348
367
  params: {
349
- id: n.id
368
+ id: a.id
350
369
  }
351
370
  });
352
- p.status === 200 && (p.data.provider !== C && (await Oe({
353
- provider: p.data.provider,
354
- accessToken: E,
371
+ n.status === 200 && (n.data.provider !== O && (await Ue({
372
+ provider: n.data.provider,
373
+ accessToken: C,
355
374
  username: i?.username || ""
356
- }), a({
357
- type: we,
375
+ }), o({
376
+ type: Ve,
358
377
  payload: {
359
- provider: p.data.provider
378
+ provider: n.data.provider
360
379
  }
361
- }), W(), await Me(
362
- `${ne} ${p.data.provider}`,
380
+ }), ee(), await $e(
381
+ `${fe} ${n.data.provider}`,
363
382
  {
364
383
  containerId: "toggle-provider"
365
384
  }
366
- )), a({
367
- type: ke,
385
+ )), o({
386
+ type: Be,
368
387
  payload: {
369
388
  restoring: !0,
370
- restoredModel: p.data?.model || "",
371
- restoredUsage: p.data?.tokenUsage || 0
389
+ restoredModel: n.data?.model || "",
390
+ restoredUsage: n.data?.tokenUsage || 0
372
391
  }
373
- }), _(""), y(n.id), D(p.data.messages), l(!1));
392
+ }), X(""), g(a.id), q(n.data.messages), d(!1));
374
393
  } catch {
375
394
  }
376
- }, X = (n) => {
377
- h.current = {
378
- id: n.id,
379
- timestamp: n.timestamp,
380
- message: n.messages.length > 0 ? n.messages[0]?.content : ""
381
- }, A(!o);
382
- }, J = Le((n) => {
383
- n[0].isIntersecting && t((p) => p + b);
395
+ }, ae = (a) => {
396
+ u.current = {
397
+ id: a.id,
398
+ timestamp: a.timestamp,
399
+ message: a.messages.length > 0 ? a.messages[0]?.content : ""
400
+ }, D(!l);
401
+ }, oe = We((a) => {
402
+ a[0].isIntersecting && t((n) => n + U);
384
403
  }, []);
385
- return k(() => {
386
- const n = {
404
+ return j(() => {
405
+ const a = {
387
406
  // root: null,
388
407
  rootMargin: "20px"
389
- }, E = new IntersectionObserver(J, n);
390
- x.current && E.observe(x.current);
391
- }), /* @__PURE__ */ m(Q, { children: [
392
- /* @__PURE__ */ m(
393
- Re,
408
+ }, C = new IntersectionObserver(oe, a);
409
+ x.current && C.observe(x.current);
410
+ }), /* @__PURE__ */ h(ne, { children: [
411
+ /* @__PURE__ */ h(
412
+ ze,
394
413
  {
395
- showConfirmation: o,
396
- setShowConfirmation: A,
397
- action: j,
414
+ showConfirmation: l,
415
+ setShowConfirmation: D,
416
+ action: se,
398
417
  customStrings: {
399
418
  confirmAction: "Delete",
400
419
  cancelAction: "Cancel",
@@ -402,78 +421,74 @@ const He = ({
402
421
  },
403
422
  children: [
404
423
  /* @__PURE__ */ e("p", { className: "m-0", children: "Are you sure you want to delete the following chat:" }),
405
- /* @__PURE__ */ m("ul", { className: "m-0", children: [
406
- /* @__PURE__ */ m("li", { children: [
424
+ /* @__PURE__ */ h("ul", { className: "m-0", children: [
425
+ /* @__PURE__ */ h("li", { children: [
407
426
  "Timestamp:",
408
427
  " ",
409
- /* @__PURE__ */ e("span", { className: "text-lg", children: h.current && h.current.timestamp })
428
+ /* @__PURE__ */ e("span", { className: "text-lg", children: u.current && u.current.timestamp })
410
429
  ] }),
411
- /* @__PURE__ */ m("li", { children: [
430
+ /* @__PURE__ */ h("li", { children: [
412
431
  "First message:",
413
432
  " ",
414
- /* @__PURE__ */ e("span", { className: "text-lg", children: h.current?.message })
433
+ /* @__PURE__ */ e("span", { className: "text-lg", children: u.current?.message })
415
434
  ] })
416
435
  ] })
417
436
  ]
418
437
  }
419
438
  ),
420
- /* @__PURE__ */ e("div", { className: ae, children: /* @__PURE__ */ e(ve, { containerId: "history-table" }) }),
439
+ /* @__PURE__ */ e("div", { className: ge, children: /* @__PURE__ */ e(He, { containerId: "history-table" }) }),
421
440
  /* @__PURE__ */ e(
422
- Fe,
441
+ et,
423
442
  {
424
443
  filteredHistory: c,
425
- historyState: s,
444
+ historyState: S,
426
445
  lastEntryToLoad: f,
427
- onClickSort: K,
428
- onClickRestore: q,
429
- onClickDelete: X,
446
+ onClickSort: te,
447
+ onClickRestore: re,
448
+ onClickDelete: ae,
430
449
  infinityScrollMarkerRef: x
431
450
  }
432
451
  )
433
452
  ] });
434
- }, qe = ({
453
+ }, nt = ({
435
454
  open: c,
436
- onOpenChange: a
455
+ onOpenChange: o
437
456
  }) => {
438
- const { getAccessToken: l, user: d } = B(), { dispatch: i } = v(G), [g, x] = R([]), h = M(null), { state: o, dispatch: A } = v(F), [f, t] = R(
439
- o.sortDirection
440
- ), { data: s, refetch: T } = Ie({
457
+ const { getAccessToken: d, user: m } = Y(), { dispatch: i } = _(W), [E, x] = L([]), u = b(null), { state: l, dispatch: D } = _(K), { data: f, refetch: t } = Ge({
441
458
  enabled: c,
442
- user: d?.username || "",
443
- searchString: o.searchString,
444
- sortDirection: f,
445
- sortedCell: o.sortedCell,
446
- getAccessToken: l
447
- }), [, C] = Y({
448
- key: $ + ce,
449
- initialValue: o.searchString
459
+ user: m?.username || "",
460
+ searchString: l.searchString || "",
461
+ sortDirection: l.sortDirection || y.DESC,
462
+ sortedCell: l.sortedCell || A,
463
+ getAccessToken: d
464
+ }), [, s] = w({
465
+ key: v + ye,
466
+ initialValue: l.searchString
450
467
  });
451
- k(() => {
452
- o.sortDirection !== f && t(o.sortDirection);
453
- }, [o, f]), k(() => {
454
- s && x(s);
455
- }, [s]);
456
- const y = async (S) => {
457
- C(S), A({
458
- type: me,
459
- payload: { searchString: S }
468
+ j(() => {
469
+ f && x(f);
470
+ }, [f]);
471
+ const T = async (g) => {
472
+ s(g), D({
473
+ type: Re,
474
+ payload: { searchString: g }
460
475
  });
461
- }, D = de((S) => {
462
- y(S.target.value.trim());
476
+ }, S = Oe((g) => {
477
+ T(g.target.value.trim());
463
478
  }, 500);
464
- return /* @__PURE__ */ m(
465
- _e,
479
+ return /* @__PURE__ */ h(
480
+ Fe,
466
481
  {
467
482
  open: c,
468
- onOpenChange: a,
469
- title: ie,
483
+ onOpenChange: o,
484
+ title: Ae,
470
485
  animation: !0,
471
486
  animationType: "fade",
472
487
  children: [
473
- /* @__PURE__ */ e("form", { autoComplete: "off", onSubmit: async (S) => {
474
- S.preventDefault();
488
+ /* @__PURE__ */ e("form", { autoComplete: "off", onSubmit: async (g) => {
489
+ g.preventDefault();
475
490
  }, children: /* @__PURE__ */ e(
476
- le,
491
+ De,
477
492
  {
478
493
  placeholder: "Search",
479
494
  labelHidden: !0,
@@ -481,37 +496,37 @@ const He = ({
481
496
  autoCapitalize: "off",
482
497
  autoComplete: "off",
483
498
  autoCorrect: "off",
484
- ref: h,
485
- defaultValue: o.searchString,
499
+ ref: u,
500
+ defaultValue: l.searchString,
486
501
  focusMode: "light",
487
502
  mode: "light",
488
503
  name: "Search",
489
504
  label: "Search",
490
- onChange: D,
505
+ onChange: S,
491
506
  className: "my-2",
492
507
  rightElement: /* @__PURE__ */ e("div", { className: "text-copy-dark", children: /* @__PURE__ */ e(
493
- w,
508
+ I,
494
509
  {
495
510
  mode: "dark",
496
511
  focusMode: "dark",
497
512
  label: "Search",
498
513
  size: "small",
499
514
  onClick: () => {
500
- y(""), h.current?.value && (h.current.value = "", h.current.focus());
515
+ T(""), u.current?.value && (u.current.value = "", u.current.focus());
501
516
  },
502
- disabled: o.searchString === "",
503
- children: o.searchString !== "" ? /* @__PURE__ */ e(be, { monotone: !0, size: "size-3" }) : /* @__PURE__ */ e(Ue, { monotone: !0, size: "size-3" })
517
+ disabled: l.searchString === "",
518
+ children: l.searchString !== "" ? /* @__PURE__ */ e(Ye, { monotone: !0, size: "size-3" }) : /* @__PURE__ */ e(Xe, { monotone: !0, size: "size-3" })
504
519
  }
505
520
  ) })
506
521
  }
507
522
  ) }),
508
523
  /* @__PURE__ */ e("div", { className: "flex flex-col sm:flex-row max-h-[75vh] min-h-[60vh]", children: /* @__PURE__ */ e(
509
- Ge,
524
+ tt,
510
525
  {
511
- mutate: T,
512
- filteredHistory: g,
526
+ mutate: t,
527
+ filteredHistory: E,
513
528
  dispatch: i,
514
- onOpenChange: a
529
+ onOpenChange: o
515
530
  }
516
531
  ) })
517
532
  ]
@@ -519,5 +534,5 @@ const He = ({
519
534
  );
520
535
  };
521
536
  export {
522
- qe as HistoryPanel
537
+ nt as HistoryPanel
523
538
  };