@versini/sassysaint 8.120.2 → 8.121.1

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 (84) hide show
  1. package/dist/chunks/{AboutChangelog.DoiRugZu.js → AboutChangelog.CueW7QKj.js} +2 -2
  2. package/dist/chunks/{AboutEntry.2lb6aCPw.js → AboutEntry.dQ_4JNsz.js} +7 -7
  3. package/dist/chunks/{App.LXYuxuaD.js → App.6iDkXSOb.js} +16 -16
  4. package/dist/chunks/{BubbleActions.BSynTDf9.js → BubbleActions.DB_SDTs9.js} +3 -3
  5. package/dist/chunks/ButtonIconDelete.B3hYKTP6.js +668 -0
  6. package/dist/chunks/{Chart.D4ePChIu.js → Chart.m2plpxTN.js} +2 -2
  7. package/dist/chunks/{ChatBubbleAssistant.C1YCh4fN.js → ChatBubbleAssistant.DhP5KHH7.js} +5 -5
  8. package/dist/chunks/{ChatBubbleUser.D7rYXigx.js → ChatBubbleUser.DythvYOo.js} +4 -4
  9. package/dist/chunks/HistoryEntry._G88vZeP.js +721 -0
  10. package/dist/chunks/{LoginEntry.DXYZbzqN.js → LoginEntry.BBF4_rEV.js} +4 -4
  11. package/dist/chunks/{LogoEntry.DfnJLwfC.js → LogoEntry.BtwLANob.js} +82 -116
  12. package/dist/chunks/{MemoriesEntry.CWLD3Ziw.js → MemoriesEntry.r2Wtd8nu.js} +34 -35
  13. package/dist/chunks/{ProfileEntry.CF04C2No.js → ProfileEntry.DwGmWxH2.js} +4 -4
  14. package/dist/chunks/{SettingsEntry.CyITTF2y.js → SettingsEntry.D7b4vTwv.js} +5 -5
  15. package/dist/chunks/{UsageEntry.CYDJzsdG.js → UsageEntry.BB5KalRi.js} +5 -5
  16. package/dist/chunks/{_baseUniq.CSGd2q_x.js → _baseUniq.22z3R--R.js} +1 -1
  17. package/dist/chunks/{arc.BJiHJp13.js → arc.Cg0BJN6o.js} +1 -1
  18. package/dist/chunks/{architecture-U656AL7Q.DsDjCJCZ.js → architecture-U656AL7Q.D7Nmp0uq.js} +1 -1
  19. package/dist/chunks/{architectureDiagram-VXUJARFQ.BY-J8uT9.js → architectureDiagram-VXUJARFQ.D58LaEiy.js} +4 -4
  20. package/dist/chunks/{blockDiagram-VD42YOAC.DK7lHaHz.js → blockDiagram-VD42YOAC.BS_n-q2N.js} +5 -5
  21. package/dist/chunks/{browser.BsROFTmt.js → browser.YA6spcA7.js} +1 -1
  22. package/dist/chunks/{c4Diagram-YG6GDRKO.Qe2wImGt.js → c4Diagram-YG6GDRKO.lVOg2-ZH.js} +2 -2
  23. package/dist/chunks/{channel.DePjU_zU.js → channel.DqxR-oS7.js} +1 -1
  24. package/dist/chunks/{chunk-4BX2VUAB.CpiHY6xd.js → chunk-4BX2VUAB.D5lbe9g-.js} +1 -1
  25. package/dist/chunks/{chunk-55IACEB6.D9v7O2f8.js → chunk-55IACEB6.BlgGY9Q6.js} +1 -1
  26. package/dist/chunks/{chunk-B4BG7PRW.CZiUAwII.js → chunk-B4BG7PRW.Bn-86p3H.js} +4 -4
  27. package/dist/chunks/{chunk-DI55MBZ5.CsrXEMzK.js → chunk-DI55MBZ5.C2fqe7wu.js} +3 -3
  28. package/dist/chunks/{chunk-FMBD7UC4.kvQChVDk.js → chunk-FMBD7UC4.8IJZbT_o.js} +1 -1
  29. package/dist/chunks/{chunk-QN33PNHL.C52xMkBM.js → chunk-QN33PNHL.DOV2bTYS.js} +1 -1
  30. package/dist/chunks/{chunk-QZHKN3VN.DoS3CMXU.js → chunk-QZHKN3VN.CM1K8z3e.js} +1 -1
  31. package/dist/chunks/{chunk-TZMSLE5B.DSg6yj4E.js → chunk-TZMSLE5B.CH_b17FM.js} +1 -1
  32. package/dist/chunks/{classDiagram-2ON5EDUG.sF4InxFe.js → classDiagram-2ON5EDUG.DeWSBBaZ.js} +2 -2
  33. package/dist/chunks/{classDiagram-v2-WZHVMYZB.sF4InxFe.js → classDiagram-v2-WZHVMYZB.DeWSBBaZ.js} +2 -2
  34. package/dist/chunks/{clone.CVPkDcM5.js → clone.B0TtmQHA.js} +1 -1
  35. package/dist/chunks/{cose-bilkent-S5V4N54A.BfP6Pw4_.js → cose-bilkent-S5V4N54A.IzOlhIoo.js} +2 -2
  36. package/dist/chunks/{dagre-6UL2VRFP.CDSC4KTt.js → dagre-6UL2VRFP.COZ3hsXn.js} +5 -5
  37. package/dist/chunks/{diagram-PSM6KHXK.BKu8xN5f.js → diagram-PSM6KHXK.JEnBJXhp.js} +4 -4
  38. package/dist/chunks/{diagram-QEK2KX5R.CV6FCkl1.js → diagram-QEK2KX5R.Bb3EEO2D.js} +3 -3
  39. package/dist/chunks/{diagram-S2PKOQOG.CE2fqmGK.js → diagram-S2PKOQOG.B_aUDr5F.js} +3 -3
  40. package/dist/chunks/{erDiagram-Q2GNP2WA.DvPF0zmB.js → erDiagram-Q2GNP2WA.CYpL6V9w.js} +4 -4
  41. package/dist/chunks/{flowDiagram-NV44I4VS.DuwDLdNV.js → flowDiagram-NV44I4VS.CF9-8TaP.js} +5 -5
  42. package/dist/chunks/{ganttDiagram-JELNMOA3.COhtg4Ox.js → ganttDiagram-JELNMOA3.CdE8GB2s.js} +2 -2
  43. package/dist/chunks/{gitGraph-F6HP7TQM.DlTeaeqU.js → gitGraph-F6HP7TQM.BWmUmcZV.js} +1 -1
  44. package/dist/chunks/{gitGraphDiagram-NY62KEGX.D9HKSUvx.js → gitGraphDiagram-NY62KEGX.Cn0Cu7Ww.js} +4 -4
  45. package/dist/chunks/{graph.CVvFC68c.js → graph.B0nity3n.js} +2 -2
  46. package/dist/chunks/{index.BDAcSpU5.js → index.Biab5cek.js} +1 -1
  47. package/dist/chunks/{index.Bk1zpyWs.js → index.BkSC8d7B.js} +3 -3
  48. package/dist/chunks/{index.DGQNdcmV.js → index.C2WmpF2e.js} +1 -1
  49. package/dist/chunks/{index.B8Hpndux.js → index.CAuXCAe5.js} +1 -1
  50. package/dist/chunks/{index.B0rqfWlE.js → index.CJxTPes-.js} +1 -1
  51. package/dist/chunks/{index.D53DWjsz.js → index.Ci5e_98Z.js} +3 -3
  52. package/dist/chunks/{index.I0YKXWDW.js → index.D3dY6con.js} +1 -1
  53. package/dist/chunks/{index.CPrdgeh7.js → index.D_0HoqM8.js} +1 -1
  54. package/dist/chunks/{index.MdqXJbz5.js → index.Ds4-4dzy.js} +316 -344
  55. package/dist/chunks/{info-NVLQJR56.D3stHz25.js → info-NVLQJR56.DfoQxnaP.js} +1 -1
  56. package/dist/chunks/{infoDiagram-WHAUD3N6.BIvDCJy6.js → infoDiagram-WHAUD3N6.CbDQCj4t.js} +2 -2
  57. package/dist/chunks/{journeyDiagram-XKPGCS4Q.BdAmj6HJ.js → journeyDiagram-XKPGCS4Q.BGwMjBf9.js} +4 -4
  58. package/dist/chunks/{kanban-definition-3W4ZIXB7.CqK6qeLd.js → kanban-definition-3W4ZIXB7.CS-TV1ji.js} +2 -2
  59. package/dist/chunks/{layout.BdufB78T.js → layout.DKjnDekM.js} +4 -4
  60. package/dist/chunks/{mermaid-parser.core.VCpWUlic.js → mermaid-parser.core.CBflstHb.js} +10 -10
  61. package/dist/chunks/{min.DgG7zTox.js → min.eDGqv0vt.js} +2 -2
  62. package/dist/chunks/{mindmap-definition-VGOIOE7T.BW-PNhZD.js → mindmap-definition-VGOIOE7T.GckYx6Fd.js} +3 -3
  63. package/dist/chunks/{packet-BFZMPI3H.BUoS4gNB.js → packet-BFZMPI3H.DzGbdOiU.js} +1 -1
  64. package/dist/chunks/{pie-7BOR55EZ.BlIbPo6j.js → pie-7BOR55EZ.CRxLvxJh.js} +1 -1
  65. package/dist/chunks/{pieDiagram-ADFJNKIX.NE-fVH6e.js → pieDiagram-ADFJNKIX.BuekQ8o8.js} +4 -4
  66. package/dist/chunks/{quadrantDiagram-AYHSOK5B.hstKbyhk.js → quadrantDiagram-AYHSOK5B.Cz1W80fL.js} +1 -1
  67. package/dist/chunks/{radar-NHE76QYJ.BWSNlMTC.js → radar-NHE76QYJ.D_eJ0pAQ.js} +1 -1
  68. package/dist/chunks/{rehype-mermaid.CysVWi5J.js → rehype-mermaid.C6vWaLbm.js} +33 -33
  69. package/dist/chunks/{requirementDiagram-UZGBJVZJ.Chaf_g91.js → requirementDiagram-UZGBJVZJ.D29ENfNv.js} +3 -3
  70. package/dist/chunks/{sankeyDiagram-TZEHDZUN.CK88CAhG.js → sankeyDiagram-TZEHDZUN.BkA8zy0e.js} +1 -1
  71. package/dist/chunks/{sequenceDiagram-WL72ISMW.DaHa-qh1.js → sequenceDiagram-WL72ISMW.CohhptW1.js} +3 -3
  72. package/dist/chunks/{stateDiagram-FKZM4ZOC.CkNLPjIg.js → stateDiagram-FKZM4ZOC.DXcdl9T3.js} +4 -4
  73. package/dist/chunks/{stateDiagram-v2-4FDKWEC3.Dzi34EM6.js → stateDiagram-v2-4FDKWEC3.CyTSxcZ6.js} +2 -2
  74. package/dist/chunks/{timeline-definition-IT6M3QCI.BsHG309-.js → timeline-definition-IT6M3QCI.BvhsFWgy.js} +2 -2
  75. package/dist/chunks/{treemap-KMMF4GRG.CiCns-I1.js → treemap-KMMF4GRG.DdhwEUUj.js} +1 -1
  76. package/dist/chunks/{useMarkdown.CYWo-hGo.js → useMarkdown.CdWXCETb.js} +8 -8
  77. package/dist/chunks/{xychartDiagram-PRI3JC2R.xfQd6NZ0.js → xychartDiagram-PRI3JC2R.vlO9NN_Y.js} +1 -1
  78. package/dist/components/SassySaint/SassySaint.js +1 -1
  79. package/dist/index.js +3 -3
  80. package/package.json +3 -3
  81. package/dist/chunks/ButtonIconDelete.wI-EXJFx.js +0 -550
  82. package/dist/chunks/HistoryDataGrid.B7G6X-Tv.js +0 -467
  83. package/dist/chunks/HistoryEntry.DJE028Vp.js +0 -305
  84. package/dist/chunks/InlineFilter.CdKFyOpD.js +0 -123
@@ -0,0 +1,721 @@
1
+ import { jsx as t, jsxs as C, Fragment as F } from "react/jsx-runtime";
2
+ import { y as v, V as Z, INFINITE_SCROLL_THRESHOLD as ue, INFINITE_SCROLL_LIMIT as de, n as ae, LOCAL_STORAGE_PREFIX as G, LOCAL_STORAGE_SORT_TIMESTAMP as me, LOCAL_STORAGE_SORT_TOKEN_USAGE as he, LOCAL_STORAGE_SORT as fe, LOCAL_STORAGE_CHAT_ID as pe, useDeleteChat as Ce, graphQLRequest as ge, SERVICE_TYPES as ye, ACTION_SORT as xe, LOCAL_STORAGE_SEARCH as Se, LOCAL_STORAGE_KEYWORD_MATCH_ALL as Te, LOCAL_STORAGE_HISTORY_WITH_MEDIA_ONLY as be, useChatsHistory as Ae, useUserChatStats as De, ACTION_SEARCH as _e } from "./index.Ds4-4dzy.js";
3
+ import { DataGridContext as K, useColumnMeasurement as we, getBodyClass as ke, DataGridHeader as Ie, DataGridRow as oe, DataGridCell as w, DataGridCellSort as X, ButtonIconDelete as Ee, DataGrid as Re, InlineFilter as Ne, AnimatedWrapper as Le } from "./ButtonIconDelete.B3hYKTP6.js";
4
+ import { pluralize as J, isProbablyMobile as le, numberFormatter as Oe, ResponsiveTooltip as ve, useAiChat as Me, useLocalStorage as P, LazyToastContainerWrapper as He, v4 as Ge, CHAT_RESET as Pe, CHAT_SET_ATTACHMENTS as Be, CHAT_SET_STATUS as Fe, showErrorToast as Ue, ConfirmationPanel as Ve, Panel as $e, debounce as We, Toggle as ee, ButtonCancel as Ye } from "./App.6iDkXSOb.js";
5
+ import { forwardRef as qe, useContext as j, useRef as M, useState as W, useCallback as Y, useEffect as B, useImperativeHandle as je, useMemo as Q } from "react";
6
+ import { CellWrapper as te, IconCloseLight as ze, ButtonIcon as Ke, IconRestore as Xe, CARDS as Qe, HistoryContext as ie, ChatContext as Ze, SortDirections as H, APP_CLASSNAME as Je, TOAST_CHAT_DELETED as et, HISTORY_TITLE as tt } from "./LogoEntry.BtwLANob.js";
7
+ import R from "clsx";
8
+ const rt = 20, st = 5, nt = "20px", re = "data-row-index";
9
+ function at(e) {
10
+ let r = e.parentElement;
11
+ for (; r; ) {
12
+ const a = getComputedStyle(r).overflowY;
13
+ if (a === "auto" || a === "scroll")
14
+ return r;
15
+ r = r.parentElement;
16
+ }
17
+ return null;
18
+ }
19
+ function ot({ data: e, children: r, batchSize: n = rt, threshold: a = st, rootMargin: c = nt, onVisibleCountChange: x, className: g }, u) {
20
+ const l = j(K), y = M(null), f = M(null), i = M(null), o = e.length, A = Math.min(n + a, o), [d, I] = W(A), S = d < o, m = Y((s) => {
21
+ const b = y.current;
22
+ if (!b)
23
+ return;
24
+ const p = b.querySelector(`[${re}="${s}"]`);
25
+ if (p) {
26
+ const _ = p.querySelector('[role="row"]');
27
+ _ && _.scrollIntoView({
28
+ behavior: "smooth",
29
+ block: "center"
30
+ });
31
+ }
32
+ }, []);
33
+ B(() => {
34
+ if (i.current !== null) {
35
+ const s = i.current;
36
+ s < d && (requestAnimationFrame(() => {
37
+ m(s);
38
+ }), i.current = null);
39
+ }
40
+ }, [
41
+ d,
42
+ m
43
+ ]), je(u, () => ({
44
+ scrollToIndex: (s) => {
45
+ if (s < 0 || s >= o) {
46
+ console.warn(`scrollToIndex: index ${s} is out of bounds (0-${o - 1})`);
47
+ return;
48
+ }
49
+ if (s < d) {
50
+ m(s);
51
+ return;
52
+ }
53
+ const b = Math.min(s + a + 1, o);
54
+ i.current = s, I(b);
55
+ }
56
+ }), [
57
+ o,
58
+ d,
59
+ a,
60
+ m
61
+ ]), B(() => {
62
+ I(Math.min(n + a, o));
63
+ }, [
64
+ o,
65
+ n,
66
+ a
67
+ ]), B(() => {
68
+ x?.(d, o);
69
+ }, [
70
+ d,
71
+ o,
72
+ x
73
+ ]);
74
+ const T = Y((s) => {
75
+ s[0]?.isIntersecting && I((p) => Math.min(p + n, o));
76
+ }, [
77
+ n,
78
+ o
79
+ ]), N = Y((s) => {
80
+ if (f.current && (f.current.disconnect(), f.current = null), s && S) {
81
+ const b = at(s);
82
+ f.current = new IntersectionObserver(T, {
83
+ root: b,
84
+ rootMargin: c
85
+ }), f.current.observe(s);
86
+ }
87
+ }, [
88
+ S,
89
+ T,
90
+ c
91
+ ]);
92
+ B(() => () => {
93
+ f.current?.disconnect();
94
+ }, []);
95
+ const L = Q(() => S ? Math.max(0, d - a) : -1, [
96
+ S,
97
+ d,
98
+ a
99
+ ]), U = Q(() => ({
100
+ ...l,
101
+ cellWrapper: te.BODY
102
+ }), [
103
+ l
104
+ ]), V = Q(() => {
105
+ const s = [], b = Math.min(d, o) - 1;
106
+ for (let p = 0; p < d && p < o; p++) {
107
+ p === L && s.push(/* @__PURE__ */ t("div", {
108
+ ref: N,
109
+ "aria-hidden": "true",
110
+ style: {
111
+ height: "1px",
112
+ background: "transparent"
113
+ }
114
+ }, "__infinite-scroll-marker-inline__"));
115
+ const _ = !S && p === b;
116
+ s.push(/* @__PURE__ */ t(K.Provider, {
117
+ value: {
118
+ ...U,
119
+ isLastRow: _
120
+ },
121
+ children: /* @__PURE__ */ t("div", {
122
+ [re]: p,
123
+ style: {
124
+ display: "contents"
125
+ },
126
+ children: r(e[p], p)
127
+ })
128
+ }, p));
129
+ }
130
+ return L === d && S && s.push(/* @__PURE__ */ t("div", {
131
+ ref: N,
132
+ "aria-hidden": "true",
133
+ style: {
134
+ height: "1px",
135
+ background: "transparent"
136
+ }
137
+ }, "__infinite-scroll-marker-end__")), s;
138
+ }, [
139
+ e,
140
+ d,
141
+ o,
142
+ L,
143
+ S,
144
+ r,
145
+ N,
146
+ U
147
+ ]);
148
+ we(y, V);
149
+ const O = ke(g);
150
+ return /* @__PURE__ */ t(K.Provider, {
151
+ value: {
152
+ ...l,
153
+ cellWrapper: te.BODY
154
+ },
155
+ children: /* @__PURE__ */ t("div", {
156
+ ref: y,
157
+ role: "rowgroup",
158
+ className: O,
159
+ children: V
160
+ })
161
+ });
162
+ }
163
+ const lt = /* @__PURE__ */ qe(ot), it = ({
164
+ sortDirection: e,
165
+ sortedCell: r,
166
+ onSortChange: n,
167
+ caption: a,
168
+ isSearchActive: c = !1,
169
+ showTokenUsage: x = !0
170
+ }) => {
171
+ const g = (u) => {
172
+ n(u);
173
+ };
174
+ return /* @__PURE__ */ t(Ie, { caption: a, children: /* @__PURE__ */ C(oe, { children: [
175
+ /* @__PURE__ */ t(w, { className: "invisible", children: "Row" }),
176
+ x ? /* @__PURE__ */ C(F, { children: [
177
+ /* @__PURE__ */ t(w, { className: "text-xs sm:text-sm", children: "Summary" }),
178
+ c ? /* @__PURE__ */ t(w, { className: "text-xs sm:text-sm", children: "Date" }) : /* @__PURE__ */ t(
179
+ X,
180
+ {
181
+ buttonClassName: "text-xs sm:text-sm",
182
+ cellId: v,
183
+ align: "left",
184
+ sortDirection: r === v ? e : !1,
185
+ sortedCell: r,
186
+ onSort: g,
187
+ children: "Date"
188
+ }
189
+ ),
190
+ c ? /* @__PURE__ */ t(w, { align: "right", className: "text-xs sm:text-sm", children: "Tokens" }) : /* @__PURE__ */ t(
191
+ X,
192
+ {
193
+ buttonClassName: "text-xs sm:text-sm",
194
+ cellId: Z,
195
+ align: "right",
196
+ sortDirection: r === Z ? e : !1,
197
+ sortedCell: r,
198
+ onSort: g,
199
+ children: "Tokens"
200
+ }
201
+ )
202
+ ] }) : /* @__PURE__ */ C(F, { children: [
203
+ c ? /* @__PURE__ */ t(w, { className: "text-xs sm:text-sm", children: "Date" }) : /* @__PURE__ */ t(
204
+ X,
205
+ {
206
+ buttonClassName: "text-xs sm:text-sm",
207
+ cellId: v,
208
+ align: "left",
209
+ sortDirection: r === v ? e : !1,
210
+ sortedCell: r,
211
+ onSort: g,
212
+ children: "Date"
213
+ }
214
+ ),
215
+ /* @__PURE__ */ t(w, { className: "text-xs sm:text-sm", children: "Summary" })
216
+ ] }),
217
+ /* @__PURE__ */ t(w, { align: "right", className: "text-xs sm:text-sm", children: "Actions" })
218
+ ] }) });
219
+ };
220
+ const ct = "av-pill", ut = ({ variant: e }) => R("rounded-xs border", {
221
+ "border-border-information": e === "information",
222
+ "border-border-warning": e === "warning",
223
+ "border-border-success": e === "success",
224
+ "border-border-error": e === "error"
225
+ }), se = ({ variant: e }) => R("not-prose", {
226
+ "text-copy-information": e === "information",
227
+ "text-copy-warning": e === "warning",
228
+ "text-copy-success": e === "success",
229
+ "text-copy-error": e === "error"
230
+ }), dt = ({ variant: e }) => R({
231
+ "bg-surface-information": e === "information",
232
+ "bg-surface-warning": e === "warning",
233
+ "bg-surface-success": e === "success",
234
+ "bg-surface-error": e === "error"
235
+ }), mt = (e) => {
236
+ const { className: r, variant: n } = e;
237
+ return {
238
+ main: R(ct, "inline-flex items-center gap-1 px-2 py-0.5 text-xs", ut({
239
+ variant: n
240
+ }), se({
241
+ variant: n
242
+ }), dt(e), r),
243
+ button: R("inline-flex items-center justify-center", "ml-1", "focus:outline", "focus:outline-1", "focus:outline-offset-1", "focus:outline-focus-dark", "hover:bg-surface-medium/50", "rounded-full", se({
244
+ variant: n
245
+ }))
246
+ };
247
+ }, ne = ({ label: e, className: r, variant: n = "information", description: a, onClose: c }) => {
248
+ const [x, g] = W(!0), u = (y) => {
249
+ c && (c(y), y.defaultPrevented || g(!1));
250
+ };
251
+ if (!x)
252
+ return null;
253
+ const l = mt({
254
+ className: r,
255
+ variant: n
256
+ });
257
+ return /* @__PURE__ */ C("div", {
258
+ role: "text",
259
+ className: l.main,
260
+ children: [
261
+ a && /* @__PURE__ */ t("span", {
262
+ className: "sr-only",
263
+ children: a
264
+ }),
265
+ /* @__PURE__ */ t("span", {
266
+ children: e
267
+ }),
268
+ c && /* @__PURE__ */ t("button", {
269
+ type: "button",
270
+ onClick: u,
271
+ className: l.button,
272
+ "aria-label": "Close",
273
+ children: /* @__PURE__ */ t(ze, {
274
+ size: "size-3"
275
+ })
276
+ })
277
+ ]
278
+ });
279
+ };
280
+ function ht(e, r, n) {
281
+ return n && r > e ? `Showing ${J(`${e} chat`, e)} out of ${r}` : J(`${e} chat`, e);
282
+ }
283
+ const q = {
284
+ rowNumber: "dark:text-copy-medium",
285
+ summary: "dark:text-white sm:max-w-full text-xs sm:text-sm",
286
+ timestamp: "dark:text-copy-medium sm:whitespace-nowrap text-xs sm:text-sm max-w-20 sm:max-w-none",
287
+ tokenUsage: "dark:text-copy-medium text-xs sm:text-sm"
288
+ };
289
+ function ft({
290
+ item: e,
291
+ index: r,
292
+ onClickRestore: n,
293
+ onClickDelete: a,
294
+ showTokenUsage: c = !0,
295
+ isActive: x = !1
296
+ }) {
297
+ const g = e.timestamp.split(",")[0], u = e.similarityScore !== void 0 && e.similarityScore !== null ? Math.round(e.similarityScore * 100) : null, l = u !== null && u < 40 ? "warning" : "success", y = e.keywordMatch === !0, f = /* @__PURE__ */ t(w, { className: R(q.summary), children: /* @__PURE__ */ C("div", { className: "flex flex-col gap-1", children: [
298
+ (u !== null || y) && /* @__PURE__ */ C("div", { className: "flex flex-wrap gap-1", children: [
299
+ u !== null && /* @__PURE__ */ t(
300
+ ne,
301
+ {
302
+ variant: l,
303
+ label: `${u}% semantic`
304
+ }
305
+ ),
306
+ y && /* @__PURE__ */ t(ne, { variant: "information", label: "keyword" })
307
+ ] }),
308
+ le() ? /* @__PURE__ */ t("span", { title: e.summary, children: e.summary }) : /* @__PURE__ */ t("span", { className: "truncate", title: e.summary, children: e.summary })
309
+ ] }) }), i = /* @__PURE__ */ t(w, { className: R(q.timestamp), children: g }), o = c ? /* @__PURE__ */ t(w, { align: "right", className: R(q.tokenUsage), children: e.tokenUsage ? Oe.format(e.tokenUsage) : "0" }) : null, A = /* @__PURE__ */ t(w, { align: "center", borderLeft: !0, children: /* @__PURE__ */ C("div", { className: "flex flex-col items-end sm:flex-row gap-2", children: [
310
+ /* @__PURE__ */ t(
311
+ ve,
312
+ {
313
+ label: "Restore chat",
314
+ placement: "top",
315
+ trigger: /* @__PURE__ */ t(
316
+ Ke,
317
+ {
318
+ noBorder: !0,
319
+ label: "Restore chat",
320
+ variant: "primary",
321
+ onClick: async () => {
322
+ await n(e);
323
+ },
324
+ children: /* @__PURE__ */ t(
325
+ Xe,
326
+ {
327
+ size: "size-3",
328
+ monotone: !0,
329
+ className: "text-copy-success dark:text-copy-success-light"
330
+ }
331
+ )
332
+ }
333
+ )
334
+ }
335
+ ),
336
+ /* @__PURE__ */ t(
337
+ Ee,
338
+ {
339
+ label: "Delete chat",
340
+ disabled: !1,
341
+ onClick: () => {
342
+ a(e);
343
+ }
344
+ }
345
+ )
346
+ ] }) });
347
+ return /* @__PURE__ */ C(oe, { active: x, children: [
348
+ /* @__PURE__ */ t(w, { className: R(q.rowNumber), children: r + 1 }),
349
+ c ? /* @__PURE__ */ C(F, { children: [
350
+ f,
351
+ i,
352
+ o
353
+ ] }) : /* @__PURE__ */ C(F, { children: [
354
+ i,
355
+ f
356
+ ] }),
357
+ A
358
+ ] });
359
+ }
360
+ const pt = ({
361
+ filteredHistory: e,
362
+ sortDirection: r,
363
+ sortedCell: n,
364
+ onSortChange: a,
365
+ onClickRestore: c,
366
+ onClickDelete: x,
367
+ isLoading: g = !1,
368
+ totalHistoryCount: u,
369
+ isFiltered: l = !1,
370
+ isSearchActive: y = !1,
371
+ activeChatId: f
372
+ }) => {
373
+ const i = le(), o = M(null), A = M(!1);
374
+ B(() => {
375
+ if (!f || A.current)
376
+ return;
377
+ const m = e.findIndex(
378
+ (T) => T.id === f
379
+ );
380
+ if (m !== -1) {
381
+ A.current = !0;
382
+ const T = setTimeout(() => {
383
+ o.current?.scrollToIndex(m);
384
+ }, 100);
385
+ return () => clearTimeout(T);
386
+ }
387
+ }, [f, e]), B(() => {
388
+ A.current = !1;
389
+ }, [f]);
390
+ const d = ht(
391
+ e.length,
392
+ u ?? e.length,
393
+ l
394
+ );
395
+ return /* @__PURE__ */ C(
396
+ Re,
397
+ {
398
+ columns: i ? ["auto", "auto", "1fr", "0.4fr"] : [
399
+ "auto",
400
+ "minmax(10px, 1fr)",
401
+ "0.3fr",
402
+ "0.3fr",
403
+ "0.3fr"
404
+ ],
405
+ loading: g && e.length > 0,
406
+ children: [
407
+ /* @__PURE__ */ t(
408
+ it,
409
+ {
410
+ sortDirection: r,
411
+ sortedCell: n,
412
+ onSortChange: a,
413
+ caption: d,
414
+ isSearchActive: y,
415
+ showTokenUsage: !i
416
+ }
417
+ ),
418
+ g && e.length === 0 ? /* @__PURE__ */ t("div", { className: "p-4 text-center", role: "status", "aria-live": "polite", children: "Loading..." }) : /* @__PURE__ */ t(
419
+ lt,
420
+ {
421
+ ref: o,
422
+ data: e.filter((m) => m?.summary),
423
+ batchSize: de,
424
+ threshold: ue,
425
+ children: (m, T) => /* @__PURE__ */ t(
426
+ ft,
427
+ {
428
+ item: m,
429
+ index: T,
430
+ onClickRestore: c,
431
+ onClickDelete: x,
432
+ showTokenUsage: !i,
433
+ isActive: f === m.id
434
+ },
435
+ `${Qe.HISTORY.TITLE}-${m.id}-${T}`
436
+ )
437
+ }
438
+ )
439
+ ]
440
+ }
441
+ );
442
+ }, Ct = ({
443
+ filteredHistory: e,
444
+ onOpenChange: r,
445
+ mutate: n,
446
+ isLoading: a = !1,
447
+ totalHistoryCount: c,
448
+ isFiltered: x = !1,
449
+ isSearchActive: g = !1,
450
+ requestConfirmation: u
451
+ }) => {
452
+ const { user: l, getAccessToken: y } = ae(), f = M({
453
+ id: "",
454
+ timestamp: "",
455
+ message: ""
456
+ }), { state: i, dispatch: o } = j(ie), A = {
457
+ sortDirection: i.sortDirection || H.DESC,
458
+ sortedCell: i.sortedCell || v
459
+ }, {
460
+ setChatId: d,
461
+ setInitialMessages: I,
462
+ dispatch: S
463
+ } = j(Ze), { setInput: m } = Me(), [T, N] = P({
464
+ key: G + me,
465
+ initialValue: H.DESC
466
+ }), [L, U] = P({
467
+ key: G + he,
468
+ initialValue: H.ASC
469
+ }), [, V] = P({
470
+ key: G + fe,
471
+ initialValue: v
472
+ }), [O] = P({
473
+ key: G + pe,
474
+ initialValue: ""
475
+ }), { mutateAsync: s } = Ce({ getAccessToken: y }), b = (h) => {
476
+ const E = i.sortedCell === h;
477
+ let k, $;
478
+ switch (h) {
479
+ case v:
480
+ $ = N, k = E ? i.sortDirection : T;
481
+ break;
482
+ case Z:
483
+ $ = U, k = E ? i.sortDirection : L;
484
+ break;
485
+ default:
486
+ $ = N, k = E ? i.sortDirection : T;
487
+ break;
488
+ }
489
+ const D = k === H.ASC ? H.DESC : H.ASC;
490
+ $(D), V(h), o({
491
+ type: xe,
492
+ payload: {
493
+ sortedCell: h,
494
+ sortDirection: D
495
+ }
496
+ });
497
+ }, p = async (h) => {
498
+ try {
499
+ await s({
500
+ userId: l?.username || "",
501
+ id: h
502
+ }), n(""), await Ue(et, {
503
+ autoClose: 2e3,
504
+ containerId: "history-table"
505
+ });
506
+ } catch {
507
+ }
508
+ }, _ = async (h) => {
509
+ try {
510
+ const E = await y(), k = await ge({
511
+ accessToken: E,
512
+ type: ye.GET_CHAT,
513
+ params: {
514
+ id: h.id
515
+ }
516
+ });
517
+ S({
518
+ type: Fe,
519
+ payload: {
520
+ streaming: !1,
521
+ loading: !1,
522
+ restoring: !0,
523
+ restoredModel: k.data?.model || "",
524
+ restoredTimestamp: k.data?.timestamp || "",
525
+ restoredUsage: k.data?.tokenUsage || 0
526
+ }
527
+ }), m(""), d(h.id), I(k.data.messages), r(!1);
528
+ } catch {
529
+ }
530
+ }, z = (h) => {
531
+ f.current = {
532
+ id: h.id,
533
+ timestamp: h.timestamp,
534
+ message: h.summary
535
+ }, u(
536
+ () => p(h.id),
537
+ /* @__PURE__ */ C(F, { children: [
538
+ /* @__PURE__ */ t("p", { className: "m-0", children: "Are you sure you want to delete the following chat:" }),
539
+ /* @__PURE__ */ C("ul", { className: "m-0", children: [
540
+ /* @__PURE__ */ C("li", { children: [
541
+ "Timestamp: ",
542
+ /* @__PURE__ */ t("span", { className: "text-lg", children: h.timestamp })
543
+ ] }),
544
+ /* @__PURE__ */ C("li", { children: [
545
+ "First message: ",
546
+ /* @__PURE__ */ t("span", { className: "text-lg", children: h.summary })
547
+ ] })
548
+ ] })
549
+ ] })
550
+ ), O === h.id && (d(Ge()), I([]), m(""), S({
551
+ type: Pe,
552
+ payload: {
553
+ privateChat: !1,
554
+ reasoningText: !1
555
+ }
556
+ }), S({
557
+ type: Be,
558
+ payload: {
559
+ attachments: 0
560
+ }
561
+ }));
562
+ };
563
+ return /* @__PURE__ */ C("div", { children: [
564
+ /* @__PURE__ */ t("div", { className: Je, children: /* @__PURE__ */ t(He, { containerId: "history-table" }) }),
565
+ /* @__PURE__ */ t(
566
+ pt,
567
+ {
568
+ filteredHistory: e,
569
+ sortDirection: A.sortDirection,
570
+ sortedCell: A.sortedCell,
571
+ onSortChange: b,
572
+ onClickRestore: _,
573
+ onClickDelete: z,
574
+ isLoading: a,
575
+ totalHistoryCount: c,
576
+ isFiltered: x,
577
+ isSearchActive: g,
578
+ activeChatId: O
579
+ }
580
+ )
581
+ ] });
582
+ }, Dt = ({
583
+ open: e,
584
+ onOpenChange: r
585
+ }) => {
586
+ const n = M(null), { getAccessToken: a, user: c } = ae(), [x, g] = W([]), u = M(null), { state: l, dispatch: y } = j(ie), [, f] = P({
587
+ key: G + Se,
588
+ initialValue: l.searchString
589
+ }), [i, o] = P({
590
+ key: G + Te,
591
+ initialValue: !0
592
+ }), [A, d] = P({
593
+ key: G + be,
594
+ initialValue: !1
595
+ }), [I, S] = W(!1), [m, T] = W(null), [N, L] = W(null), U = Y(
596
+ (D, ce) => {
597
+ T(() => D), L(ce), S(!0);
598
+ },
599
+ []
600
+ ), V = Y(() => {
601
+ m && m(), T(null), L(null);
602
+ }, [m]), {
603
+ data: O,
604
+ refetch: s,
605
+ isLoading: b,
606
+ isError: p
607
+ } = Ae({
608
+ enabled: e,
609
+ user: c?.username || "",
610
+ searchString: l.searchString || "",
611
+ sortDirection: l.sortDirection || H.DESC,
612
+ sortedCell: l.sortedCell || v,
613
+ getAccessToken: a,
614
+ keywordMatchAll: i,
615
+ withMediaOnly: A
616
+ }), { data: _ } = De({
617
+ user: c?.username,
618
+ getAccessToken: a
619
+ }), z = _ && _.totalChats ? _.totalChats - _.privateChats - _.deletedChats : 0;
620
+ B(() => {
621
+ O && g(O);
622
+ }, [O]);
623
+ const h = async (D) => {
624
+ f(D), y({
625
+ type: _e,
626
+ payload: { searchString: D }
627
+ });
628
+ }, E = We((D) => {
629
+ h(D.target.value.trim());
630
+ }, 800), k = (D) => {
631
+ o(D);
632
+ }, $ = (D) => {
633
+ d(D);
634
+ };
635
+ return /* @__PURE__ */ C(F, { children: [
636
+ /* @__PURE__ */ t(
637
+ Ve,
638
+ {
639
+ showConfirmation: I,
640
+ setShowConfirmation: S,
641
+ action: V,
642
+ customStrings: {
643
+ confirmAction: "Delete",
644
+ cancelAction: "Cancel",
645
+ title: "Delete chat"
646
+ },
647
+ children: N
648
+ }
649
+ ),
650
+ /* @__PURE__ */ t(
651
+ $e,
652
+ {
653
+ open: e,
654
+ onOpenChange: r,
655
+ title: tt,
656
+ animation: !0,
657
+ animationType: "fade",
658
+ blurEffect: "large",
659
+ initialFocus: n,
660
+ className: "h-full sm:h-max",
661
+ footer: /* @__PURE__ */ t("div", { className: "flex flex-wrap justify-end gap-x-2 pb-8 sm:pb-0", children: /* @__PURE__ */ t("div", { className: "box-border max-w-full basis-auto", children: /* @__PURE__ */ t(Ye, { onOpenChange: r, ref: n }) }) }),
662
+ children: /* @__PURE__ */ C("div", { className: "flex h-full flex-col gap-4", children: [
663
+ /* @__PURE__ */ t(
664
+ Ne,
665
+ {
666
+ header: b && l.searchString ? "Loading..." : l.searchString ? "Filters applied" : "Filters",
667
+ toggles: /* @__PURE__ */ C(F, { children: [
668
+ /* @__PURE__ */ t(
669
+ ee,
670
+ {
671
+ name: "keyword-match-all",
672
+ checked: i,
673
+ onChange: k,
674
+ label: "Match all keywords",
675
+ narrow: !0,
676
+ noBorder: !0
677
+ }
678
+ ),
679
+ /* @__PURE__ */ t(
680
+ ee,
681
+ {
682
+ name: "history-with-media-only",
683
+ checked: A,
684
+ onChange: $,
685
+ label: "Generated images only",
686
+ narrow: !0,
687
+ noBorder: !0
688
+ }
689
+ )
690
+ ] }),
691
+ inputSearchRef: u,
692
+ onSearchChange: E,
693
+ defaultValue: l.searchString,
694
+ resetDisabled: l.searchString === "",
695
+ onResetSearch: () => {
696
+ h(""), u.current?.value && (u.current.value = "", u.current.focus());
697
+ }
698
+ }
699
+ ),
700
+ p && /* @__PURE__ */ t("p", { className: "m-0 text-copy-error-light", children: "Failed to load history." }),
701
+ !p && /* @__PURE__ */ t(Le, { dependency: x?.length ?? 0, children: /* @__PURE__ */ t(
702
+ Ct,
703
+ {
704
+ mutate: s,
705
+ filteredHistory: x,
706
+ onOpenChange: r,
707
+ isLoading: b,
708
+ totalHistoryCount: z,
709
+ isFiltered: !!l.searchString,
710
+ isSearchActive: !!l.searchString,
711
+ requestConfirmation: U
712
+ }
713
+ ) })
714
+ ] })
715
+ }
716
+ )
717
+ ] });
718
+ };
719
+ export {
720
+ Dt as HistoryPanel
721
+ };