@versini/sassysaint 8.74.2 → 8.75.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.CKksZqHG.js → AboutChangelog.B-ISSR7l.js} +2 -2
  2. package/dist/chunks/{AboutEntry.glCt_1V2.js → AboutEntry.DrUARPjo.js} +7 -7
  3. package/dist/chunks/{App.fPigJREV.js → App.D58BIK-t.js} +16 -16
  4. package/dist/chunks/{Chart.B9hB35Ov.js → Chart.BSERLsUR.js} +2 -2
  5. package/dist/chunks/{ChatBubbleAssistant.cQmeFm3l.js → ChatBubbleAssistant.Biu6NFb6.js} +4 -4
  6. package/dist/chunks/{ChatBubbleUser.QckqWgJe.js → ChatBubbleUser.ZlrQ6y0L.js} +3 -3
  7. package/dist/chunks/{ChatHistoryTable.DTewVIoT.js → ChatHistoryTable.Bjzq0jXS.js} +37 -63
  8. package/dist/chunks/{HistoryEntry.CTG2HMFf.js → HistoryEntry.feqJtRTV.js} +3 -3
  9. package/dist/chunks/{ProfileEntry.DYYzBE5s.js → ProfileEntry.B8yuMCEl.js} +2 -2
  10. package/dist/chunks/{SettingsEntry.D29H8z_6.js → SettingsEntry.DBzoen7C.js} +3 -3
  11. package/dist/chunks/{Table.4AY7ytZo.js → Table.BdYF4eSq.js} +83 -56
  12. package/dist/chunks/{UsageEntry.BUPgYfi_.js → UsageEntry.BVPC-rT8.js} +3 -3
  13. package/dist/chunks/UserMemoriesPanel.Dun6Xh1A.js +769 -0
  14. package/dist/chunks/{index.DWl4Hcyk.js → index.3yc2BaIg.js} +899 -794
  15. package/dist/chunks/{index.CpOVLW1-.js → index.B5xEHWE9.js} +1 -1
  16. package/dist/chunks/{index.C58UQ9Se.js → index.CS-FSWLu.js} +1 -1
  17. package/dist/chunks/{index.B87G0G-b.js → index.CtIazJ3c.js} +1 -1
  18. package/dist/chunks/{index.BqIB-hbB.js → index.D1gDsFSj.js} +3 -3
  19. package/dist/chunks/{index.ChttSd_v.js → index.DiXRu8Y4.js} +2 -2
  20. package/dist/chunks/{index.x0F3_X3L.js → index.bZe39l-0.js} +1 -1
  21. package/dist/chunks/{index.i2-wyoMZ.js → index.ttAvuNwj.js} +1 -1
  22. package/dist/chunks/{useMarkdown.CDrOqrBw.js → useMarkdown.Bp7kgBs6.js} +6 -6
  23. package/dist/components/SassySaint/SassySaint.js +1 -1
  24. package/dist/index.js +4 -4
  25. package/dist/style.css +1 -1
  26. package/package.json +3 -3
  27. package/dist/chunks/UserMemoriesPanel.Dpnz-uAb.js +0 -429
@@ -0,0 +1,769 @@
1
+ import { jsxs as r, jsx as e, Fragment as R } from "react/jsx-runtime";
2
+ import { I as Ce, L, j as y, C as b, n as we, LOCAL_STORAGE_PREFIX as W, LOCAL_STORAGE_SORT_MEMORY_DIRECTION as ve, LOCAL_STORAGE_SORT_MEMORY_COLUMN as ke, useUserMemories as Se, useExpiredMemories as Te, useDeleteMemory as Me, useDeleteAllActiveMemories as De, useDeleteAllExpiredMemories as Ee, useUpdateMemory as be, useRestoreMemory as Re, te as I } from "./index.3yc2BaIg.js";
3
+ import { oe as le, G as O, E as Z, e as s, ConfirmationPanel as $, st as _ } from "./App.D58BIK-t.js";
4
+ import N from "clsx";
5
+ import { useState as C, useEffect as Le, useRef as ee } from "react";
6
+ import { Re as ze } from "./index.bZe39l-0.js";
7
+ import { j as te, D as re, G as E, M as a, F as B, H as ie, l as ne, U as oe, n as Ie } from "./Table.BdYF4eSq.js";
8
+ const Oe = ({
9
+ className: A,
10
+ viewBox: w,
11
+ title: l,
12
+ monotone: n,
13
+ ...S
14
+ }) => /* @__PURE__ */ r(
15
+ Ce,
16
+ {
17
+ defaultViewBox: "0 0 512 512",
18
+ size: "size-5",
19
+ viewBox: w,
20
+ className: A,
21
+ title: l || "Edit",
22
+ ...S,
23
+ children: [
24
+ /* @__PURE__ */ e(
25
+ "path",
26
+ {
27
+ d: "M0 160c0-53 43-96 96-96h96c17.7 0 32 14.3 32 32s-14.3 32-32 32H96c-17.7 0-32 14.3-32 32v256c0 17.7 14.3 32 32 32h256c17.7 0 32-14.3 32-32v-96c0-17.7 14.3-32 32-32s32 14.3 32 32v96c0 53-43 96-96 96H96c-53 0-96-43-96-96z",
28
+ opacity: n ? "1" : "0.4"
29
+ }
30
+ ),
31
+ /* @__PURE__ */ e("path", { d: "m392.4 21.7-30.1 30 97.9 97.9 30.1-30.1c21.9-21.9 21.9-57.3 0-79.2l-18.7-18.6c-21.9-21.9-57.3-21.9-79.2 0m-52.7 52.6L172.4 241.7c-6.1 6.1-10.8 13.6-13.5 21.9l-29.6 88.8c-2.9 8.6-.6 18.1 5.8 24.6s15.9 8.7 24.6 5.8l88.8-29.6c8.2-2.7 15.7-7.4 21.9-13.5l167.3-167.4z" })
32
+ ]
33
+ }
34
+ ), _e = ({
35
+ open: A,
36
+ onOpenChange: w,
37
+ initialText: l,
38
+ metadata: n,
39
+ onSave: S,
40
+ isSaving: m = !1
41
+ }) => {
42
+ const [p, z] = C(l), [h, v] = C("none");
43
+ Le(() => {
44
+ if (A) {
45
+ z(l);
46
+ const o = n?.expiration || "none";
47
+ v(o);
48
+ }
49
+ }, [A, l, n?.expiration]);
50
+ const T = () => {
51
+ if (p.trim().length >= 3) {
52
+ const o = h === "none" ? null : h;
53
+ S(p.trim(), o);
54
+ }
55
+ }, u = p.trim().length >= 3, M = p.trim() !== l.trim() || h !== (n?.expiration || "none");
56
+ return /* @__PURE__ */ e(
57
+ le,
58
+ {
59
+ open: A,
60
+ onOpenChange: w,
61
+ title: "Edit Memory",
62
+ animation: !0,
63
+ animationType: "fade",
64
+ footer: /* @__PURE__ */ r(L, { columnGap: 2, alignHorizontal: "flex-end", children: [
65
+ /* @__PURE__ */ e(y, { children: /* @__PURE__ */ e(
66
+ b,
67
+ {
68
+ mode: "dark",
69
+ variant: "secondary",
70
+ noBorder: !0,
71
+ focusMode: "light",
72
+ onClick: () => w(!1),
73
+ disabled: m,
74
+ children: "Cancel"
75
+ }
76
+ ) }),
77
+ /* @__PURE__ */ e(y, { children: /* @__PURE__ */ e(
78
+ b,
79
+ {
80
+ mode: "dark",
81
+ focusMode: "light",
82
+ disabled: m || !u || !M,
83
+ onClick: T,
84
+ children: m ? "Saving..." : "Save"
85
+ }
86
+ ) })
87
+ ] }),
88
+ children: /* @__PURE__ */ r("div", { className: "flex flex-col pt-2 gap-4", children: [
89
+ /* @__PURE__ */ e(
90
+ ze,
91
+ {
92
+ mode: "dark",
93
+ focusMode: "light",
94
+ label: "Memory text",
95
+ name: "memoryText",
96
+ value: p,
97
+ onChange: (o) => z(o.target.value),
98
+ autoFocus: !0,
99
+ helperText: p.trim().length < 3 ? "Memory text must be at least 3 characters" : `${p.length} characters`
100
+ }
101
+ ),
102
+ /* @__PURE__ */ r("div", { className: "flex flex-col gap-3 p-4 bg-slate-800/50 rounded-md border border-slate-700/50", children: [
103
+ /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-slate-300 m-0", children: "Memory Expiration" }),
104
+ /* @__PURE__ */ e("p", { className: "text-xs text-slate-400 m-0", children: "Set when this memory should expire and be automatically removed." }),
105
+ /* @__PURE__ */ r("div", { className: "flex flex-col gap-2", children: [
106
+ /* @__PURE__ */ e(
107
+ O,
108
+ {
109
+ mode: "dark",
110
+ focusMode: "light",
111
+ noBorder: !0,
112
+ narrow: !0,
113
+ label: "Never expire",
114
+ name: "expiration-none",
115
+ checked: h === "none",
116
+ onChange: (o) => {
117
+ o && v("none");
118
+ }
119
+ }
120
+ ),
121
+ /* @__PURE__ */ e(
122
+ O,
123
+ {
124
+ mode: "dark",
125
+ focusMode: "light",
126
+ noBorder: !0,
127
+ narrow: !0,
128
+ label: "Short (1 month)",
129
+ name: "expiration-short",
130
+ checked: h === "short",
131
+ onChange: (o) => {
132
+ o && v("short");
133
+ }
134
+ }
135
+ ),
136
+ /* @__PURE__ */ e(
137
+ O,
138
+ {
139
+ mode: "dark",
140
+ focusMode: "light",
141
+ noBorder: !0,
142
+ narrow: !0,
143
+ label: "Medium (6 months)",
144
+ name: "expiration-medium",
145
+ checked: h === "medium",
146
+ onChange: (o) => {
147
+ o && v("medium");
148
+ }
149
+ }
150
+ ),
151
+ /* @__PURE__ */ e(
152
+ O,
153
+ {
154
+ mode: "dark",
155
+ focusMode: "light",
156
+ noBorder: !0,
157
+ narrow: !0,
158
+ label: "Long (1 year)",
159
+ name: "expiration-long",
160
+ checked: h === "long",
161
+ onChange: (o) => {
162
+ o && v("long");
163
+ }
164
+ }
165
+ )
166
+ ] })
167
+ ] }),
168
+ n && /* @__PURE__ */ r("div", { className: "flex flex-col gap-3 p-4 bg-slate-800/50 rounded-md border border-slate-700/50", children: [
169
+ /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-slate-300 m-0", children: "Memory Details" }),
170
+ n.categories && n.categories.length > 0 && /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
171
+ /* @__PURE__ */ e("span", { className: "text-xs text-slate-400 uppercase", children: "Category" }),
172
+ /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1", children: n.categories.map((o, D) => /* @__PURE__ */ e(
173
+ "span",
174
+ {
175
+ className: "text-xs px-2 py-1 bg-slate-700/50 text-slate-200 rounded",
176
+ children: o
177
+ },
178
+ `${o}-${D}`
179
+ )) })
180
+ ] }),
181
+ /* @__PURE__ */ r("div", { className: "flex flex-col sm:flex-row gap-4", children: [
182
+ /* @__PURE__ */ r("div", { className: "flex flex-col gap-3 sm:flex-1", children: [
183
+ n.confidence !== void 0 && n.confidence !== null && /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
184
+ /* @__PURE__ */ e("span", { className: "text-xs text-slate-400 uppercase", children: "Confidence" }),
185
+ /* @__PURE__ */ r("span", { className: "text-sm text-slate-200", children: [
186
+ (n.confidence * 100).toFixed(0),
187
+ "%"
188
+ ] })
189
+ ] }),
190
+ n.status && /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
191
+ /* @__PURE__ */ e("span", { className: "text-xs text-slate-400 uppercase", children: "Status" }),
192
+ /* @__PURE__ */ e("span", { className: "text-sm text-slate-200 capitalize", children: n.status })
193
+ ] }),
194
+ n.sourceType && /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
195
+ /* @__PURE__ */ e("span", { className: "text-xs text-slate-400 uppercase", children: "Source Type" }),
196
+ /* @__PURE__ */ e("span", { className: "text-sm text-slate-200 capitalize", children: n.sourceType })
197
+ ] })
198
+ ] }),
199
+ /* @__PURE__ */ r("div", { className: "flex flex-col gap-3 sm:flex-1", children: [
200
+ n.quote && /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
201
+ /* @__PURE__ */ e("span", { className: "text-xs text-slate-400 uppercase", children: "Original Prompt" }),
202
+ /* @__PURE__ */ r("p", { className: "text-sm text-slate-200 m-0 italic", children: [
203
+ '"',
204
+ n.quote,
205
+ '"'
206
+ ] })
207
+ ] }),
208
+ n.canonicalText && /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
209
+ /* @__PURE__ */ e("span", { className: "text-xs text-slate-400 uppercase", children: "Canonical Text" }),
210
+ /* @__PURE__ */ e("p", { className: "text-sm text-slate-200 m-0 font-mono", children: n.canonicalText })
211
+ ] })
212
+ ] })
213
+ ] })
214
+ ] })
215
+ ] })
216
+ }
217
+ );
218
+ }, je = ({
219
+ open: A,
220
+ onOpenChange: w,
221
+ user: l
222
+ }) => {
223
+ const { getAccessToken: n } = we(), [S] = C(void 0), [m, p] = C("active"), [z, h] = Z({
224
+ key: W + ve,
225
+ initialValue: s.DESC
226
+ }), [v, T] = Z({
227
+ key: W + ke,
228
+ initialValue: "createdAt"
229
+ }), [u, M] = C(z || s.DESC), [o, D] = C(
230
+ v || "createdAt"
231
+ ), { data: f, isLoading: F, isError: H } = Se({
232
+ user: l,
233
+ query: S,
234
+ getAccessToken: n,
235
+ enabled: A && m === "active"
236
+ }), {
237
+ data: g,
238
+ isLoading: q,
239
+ isError: j
240
+ } = Te({
241
+ user: l,
242
+ query: S,
243
+ getAccessToken: n,
244
+ enabled: A && m === "expired"
245
+ }), G = Me({ getAccessToken: n }), V = De({ getAccessToken: n }), X = Ee({ getAccessToken: n }), P = be({ getAccessToken: n }), Y = Re({ getAccessToken: n }), [se, J] = C(!1), k = ee(null), [ae, K] = C(!1), [ce, U] = C(!1), x = ee(null), Q = (t, i, c, d) => {
246
+ k.current = { id: t, text: i, description: c, createdAt: d }, J(!0);
247
+ }, de = () => {
248
+ k.current && G.mutate({ user: l, memoryId: k.current.id });
249
+ }, me = (t, i, c, d, ue, fe, ge, ye, Ae, Ne) => {
250
+ x.current = {
251
+ id: t,
252
+ description: i,
253
+ categories: c,
254
+ quote: d,
255
+ canonicalText: ue,
256
+ confidence: fe,
257
+ status: ge,
258
+ sourceType: ye,
259
+ expiration: Ae,
260
+ expiresAt: Ne
261
+ }, U(!0);
262
+ }, xe = (t, i) => {
263
+ x.current && l && P.mutate(
264
+ {
265
+ user: l,
266
+ memoryId: x.current.id,
267
+ description: t,
268
+ expiration: i || void 0
269
+ },
270
+ {
271
+ onSuccess: () => {
272
+ U(!1);
273
+ }
274
+ }
275
+ );
276
+ }, he = () => {
277
+ l && K(!0);
278
+ }, pe = () => {
279
+ l && (m === "active" ? V.mutate({ user: l }) : X.mutate({ user: l }));
280
+ };
281
+ return /* @__PURE__ */ r(R, { children: [
282
+ /* @__PURE__ */ e(
283
+ _e,
284
+ {
285
+ open: ce,
286
+ onOpenChange: U,
287
+ initialText: x.current?.description || "",
288
+ metadata: x.current ? {
289
+ categories: x.current.categories,
290
+ quote: x.current.quote,
291
+ canonicalText: x.current.canonicalText,
292
+ confidence: x.current.confidence,
293
+ status: x.current.status,
294
+ sourceType: x.current.sourceType,
295
+ expiration: x.current.expiration,
296
+ expiresAt: x.current.expiresAt
297
+ } : void 0,
298
+ onSave: xe,
299
+ isSaving: P.isPending
300
+ }
301
+ ),
302
+ /* @__PURE__ */ r(
303
+ $,
304
+ {
305
+ showConfirmation: se,
306
+ setShowConfirmation: J,
307
+ action: de,
308
+ customStrings: {
309
+ title: "Delete memory",
310
+ confirmAction: "Delete",
311
+ cancelAction: "Cancel"
312
+ },
313
+ children: [
314
+ /* @__PURE__ */ e("p", { className: "m-0", children: "Are you sure you want to delete this memory?" }),
315
+ /* @__PURE__ */ r("ul", { className: "m-0 mt-2 list-disc list-inside text-xs opacity-80", children: [
316
+ /* @__PURE__ */ r("li", { children: [
317
+ "Excerpt:",
318
+ " ",
319
+ (k.current?.description || k.current?.text || "").slice(0, 80)
320
+ ] }),
321
+ /* @__PURE__ */ r("li", { children: [
322
+ "Created:",
323
+ " ",
324
+ k.current?.createdAt ? new Date(k.current.createdAt).toLocaleString() : "-"
325
+ ] })
326
+ ] })
327
+ ]
328
+ }
329
+ ),
330
+ /* @__PURE__ */ e(
331
+ $,
332
+ {
333
+ showConfirmation: ae,
334
+ setShowConfirmation: K,
335
+ action: pe,
336
+ customStrings: {
337
+ title: m === "active" ? "Delete all active memories" : "Delete all expired memories",
338
+ confirmAction: "Delete all",
339
+ cancelAction: "Cancel"
340
+ },
341
+ children: /* @__PURE__ */ e("p", { className: "m-0", children: m === "active" ? "This will permanently delete all active memories for this user. This action cannot be undone." : "This will permanently delete all expired memories for this user. This action cannot be undone." })
342
+ }
343
+ ),
344
+ /* @__PURE__ */ e(
345
+ le,
346
+ {
347
+ open: A,
348
+ onOpenChange: (t) => w(t),
349
+ title: "User Memories",
350
+ animation: !0,
351
+ animationType: "fade",
352
+ footer: /* @__PURE__ */ r(L, { columnGap: 2, alignHorizontal: "flex-end", children: [
353
+ /* @__PURE__ */ e(y, { children: /* @__PURE__ */ e(
354
+ b,
355
+ {
356
+ mode: "dark",
357
+ variant: "secondary",
358
+ noBorder: !0,
359
+ focusMode: "light",
360
+ onClick: () => w(!1),
361
+ children: "Close"
362
+ }
363
+ ) }),
364
+ /* @__PURE__ */ e(y, { children: /* @__PURE__ */ e(
365
+ b,
366
+ {
367
+ mode: "dark",
368
+ focusMode: "light",
369
+ variant: "danger",
370
+ disabled: (m === "active" ? V.isPending : X.isPending) || (m === "active" ? (f?.total ?? 0) === 0 : (g?.total ?? 0) === 0),
371
+ onClick: he,
372
+ children: "Delete All"
373
+ }
374
+ ) })
375
+ ] }),
376
+ children: /* @__PURE__ */ r("div", { className: "flex flex-col gap-4 @container/editmemoriespanel", children: [
377
+ /* @__PURE__ */ r(L, { columnGap: 2, alignHorizontal: "center", children: [
378
+ /* @__PURE__ */ e(y, { children: /* @__PURE__ */ e(
379
+ b,
380
+ {
381
+ focusMode: "light",
382
+ mode: m === "active" ? "dark" : "light",
383
+ size: "small",
384
+ noBorder: !0,
385
+ onClick: () => p("active"),
386
+ children: "Active Memories"
387
+ }
388
+ ) }),
389
+ /* @__PURE__ */ e(y, { children: /* @__PURE__ */ e(
390
+ b,
391
+ {
392
+ focusMode: "light",
393
+ mode: m === "expired" ? "dark" : "light",
394
+ size: "small",
395
+ noBorder: !0,
396
+ onClick: () => p("expired"),
397
+ children: "Expired Memories"
398
+ }
399
+ ) })
400
+ ] }),
401
+ /* @__PURE__ */ e(
402
+ "div",
403
+ {
404
+ className: N(
405
+ "flex flex-col sm:flex-row",
406
+ "sm:max-h-[50vh] sm:min-h-[50vh]"
407
+ ),
408
+ children: m === "active" ? /* @__PURE__ */ r(R, { children: [
409
+ F && /* @__PURE__ */ e("p", { className: "m-0", children: "Loading memories..." }),
410
+ H && /* @__PURE__ */ e("p", { className: "m-0 text-red-500", children: "Failed to load memories." }),
411
+ !F && !H && (f && f.items.length > 0 ? /* @__PURE__ */ r(te, { stickyHeader: !0, stickyFooter: !0, compact: !0, mode: "alt-system", children: [
412
+ /* @__PURE__ */ e(re, { children: /* @__PURE__ */ r(E, { children: [
413
+ /* @__PURE__ */ e(a, { className: "sr-only", children: "Row" }),
414
+ /* @__PURE__ */ e(a, { children: "Memory" }),
415
+ /* @__PURE__ */ e(
416
+ B,
417
+ {
418
+ focusMode: "system",
419
+ buttonClassName: "text-xs sm:text-sm",
420
+ cellId: "createdAt",
421
+ align: "left",
422
+ sortDirection: u,
423
+ sortedCell: o,
424
+ onClick: () => {
425
+ D("createdAt"), T("createdAt"), M((t) => {
426
+ const i = t === s.ASC ? s.DESC : s.ASC;
427
+ return h(i), i;
428
+ });
429
+ },
430
+ children: "Date"
431
+ }
432
+ ),
433
+ /* @__PURE__ */ e(
434
+ B,
435
+ {
436
+ focusMode: "system",
437
+ buttonClassName: "text-xs sm:text-sm",
438
+ cellId: "expiresAt",
439
+ align: "left",
440
+ sortDirection: u,
441
+ sortedCell: o,
442
+ onClick: () => {
443
+ D("expiresAt"), T("expiresAt"), M((t) => {
444
+ const i = t === s.ASC ? s.DESC : s.ASC;
445
+ return h(i), i;
446
+ });
447
+ },
448
+ children: "Expires"
449
+ }
450
+ ),
451
+ /* @__PURE__ */ e(a, { align: "right", children: "Actions" })
452
+ ] }) }),
453
+ /* @__PURE__ */ e(ie, { children: [...f.items].sort((t, i) => {
454
+ if (o === "createdAt") {
455
+ const c = t.createdAt ? new Date(t.createdAt).getTime() : 0, d = i.createdAt ? new Date(i.createdAt).getTime() : 0;
456
+ return u === s.ASC ? c - d : d - c;
457
+ }
458
+ if (o === "expiresAt") {
459
+ const c = t.expiresAt ? new Date(t.expiresAt).getTime() : Number.MAX_SAFE_INTEGER, d = i.expiresAt ? new Date(i.expiresAt).getTime() : Number.MAX_SAFE_INTEGER;
460
+ return u === s.ASC ? c - d : d - c;
461
+ }
462
+ return 0;
463
+ }).map((t, i) => /* @__PURE__ */ r(E, { children: [
464
+ /* @__PURE__ */ e(a, { className: N("dark:text-gray-400"), children: i + 1 }),
465
+ /* @__PURE__ */ e(
466
+ a,
467
+ {
468
+ className: N(
469
+ "dark:text-white",
470
+ "max-w-[100px] sm:max-w-[400px]",
471
+ "text-xs sm:text-sm"
472
+ ),
473
+ style: {
474
+ wordBreak: "break-word"
475
+ },
476
+ children: t.description || t.text
477
+ }
478
+ ),
479
+ /* @__PURE__ */ e(
480
+ a,
481
+ {
482
+ component: "th",
483
+ scope: "row",
484
+ className: N(
485
+ "dark:text-gray-400",
486
+ "sm:whitespace-nowrap text-xs sm:text-sm max-w-20 sm:max-w-none"
487
+ ),
488
+ children: t.createdAt ? new Date(t.createdAt).toLocaleDateString() : "-"
489
+ }
490
+ ),
491
+ /* @__PURE__ */ e(
492
+ a,
493
+ {
494
+ className: N(
495
+ "dark:text-gray-400",
496
+ "sm:whitespace-nowrap text-xs sm:text-sm"
497
+ ),
498
+ children: t.expiresAt ? new Date(t.expiresAt).toLocaleDateString() : "Never"
499
+ }
500
+ ),
501
+ /* @__PURE__ */ e(a, { className: "align-top", align: "right", children: /* @__PURE__ */ r(
502
+ L,
503
+ {
504
+ columnGap: 2,
505
+ alignHorizontal: "flex-end",
506
+ children: [
507
+ /* @__PURE__ */ e(y, { children: /* @__PURE__ */ e(
508
+ _,
509
+ {
510
+ label: "Edit memory",
511
+ mode: "system",
512
+ placement: "top",
513
+ trigger: /* @__PURE__ */ e(
514
+ I,
515
+ {
516
+ focusMode: "system",
517
+ noBorder: !0,
518
+ label: "Edit memory",
519
+ variant: "primary",
520
+ disabled: P.isPending,
521
+ onClick: () => me(
522
+ t.memoryId,
523
+ t.description || t.text,
524
+ t.categories,
525
+ t.quote,
526
+ t.canonicalText,
527
+ t.confidence,
528
+ t.status,
529
+ t.sourceType,
530
+ t.expiration,
531
+ t.expiresAt
532
+ ),
533
+ children: /* @__PURE__ */ e(Oe, { size: "size-3", monotone: !0 })
534
+ }
535
+ )
536
+ }
537
+ ) }),
538
+ /* @__PURE__ */ e(y, { children: /* @__PURE__ */ e(
539
+ _,
540
+ {
541
+ label: "Delete memory",
542
+ mode: "system",
543
+ placement: "top",
544
+ trigger: /* @__PURE__ */ e(
545
+ I,
546
+ {
547
+ focusMode: "system",
548
+ noBorder: !0,
549
+ label: "Delete memory",
550
+ variant: "primary",
551
+ iconClassName: "text-red-700 dark:text-red-500",
552
+ disabled: G.isPending,
553
+ onClick: () => Q(
554
+ t.memoryId,
555
+ t.text,
556
+ t.description,
557
+ t.createdAt
558
+ ),
559
+ children: /* @__PURE__ */ e(ne, { size: "size-3", monotone: !0 })
560
+ }
561
+ )
562
+ }
563
+ ) })
564
+ ]
565
+ }
566
+ ) })
567
+ ] }, t.memoryId)) }),
568
+ /* @__PURE__ */ e(oe, { children: /* @__PURE__ */ e(E, { children: /* @__PURE__ */ r(a, { colSpan: 5, children: [
569
+ f.total,
570
+ " memor",
571
+ f.total === 1 ? "y" : "ies",
572
+ f.totalTokenUsage !== void 0 && f.totalTokenUsage > 0 && /* @__PURE__ */ r(R, { children: [
573
+ " ",
574
+ "(approximately",
575
+ " ",
576
+ Math.round(
577
+ f.totalTokenUsage
578
+ ).toLocaleString(),
579
+ " ",
580
+ "token",
581
+ Math.round(f.totalTokenUsage) === 1 ? "" : "s",
582
+ ")"
583
+ ] })
584
+ ] }) }) })
585
+ ] }) : /* @__PURE__ */ e("p", { className: "m-0 italic opacity-70", children: "No memories stored." }))
586
+ ] }) : /* @__PURE__ */ r(R, { children: [
587
+ q && /* @__PURE__ */ e("p", { className: "m-0", children: "Loading expired memories..." }),
588
+ j && /* @__PURE__ */ e("p", { className: "m-0 text-red-500", children: "Failed to load expired memories." }),
589
+ !q && !j && (g && g.items.length > 0 ? /* @__PURE__ */ r(te, { stickyHeader: !0, stickyFooter: !0, compact: !0, mode: "alt-system", children: [
590
+ /* @__PURE__ */ e(re, { children: /* @__PURE__ */ r(E, { children: [
591
+ /* @__PURE__ */ e(a, { className: "sr-only", children: "Row" }),
592
+ /* @__PURE__ */ e(a, { children: "Memory" }),
593
+ /* @__PURE__ */ e(
594
+ B,
595
+ {
596
+ focusMode: "system",
597
+ buttonClassName: "text-xs sm:text-sm",
598
+ cellId: "createdAt",
599
+ align: "left",
600
+ sortDirection: u,
601
+ sortedCell: o,
602
+ onClick: () => {
603
+ D("createdAt"), T("createdAt"), M((t) => {
604
+ const i = t === s.ASC ? s.DESC : s.ASC;
605
+ return h(i), i;
606
+ });
607
+ },
608
+ children: "Date"
609
+ }
610
+ ),
611
+ /* @__PURE__ */ e(
612
+ B,
613
+ {
614
+ focusMode: "system",
615
+ buttonClassName: "text-xs sm:text-sm",
616
+ cellId: "expiresAt",
617
+ align: "left",
618
+ sortDirection: u,
619
+ sortedCell: o,
620
+ onClick: () => {
621
+ D("expiresAt"), T("expiresAt"), M((t) => {
622
+ const i = t === s.ASC ? s.DESC : s.ASC;
623
+ return h(i), i;
624
+ });
625
+ },
626
+ children: "Expired"
627
+ }
628
+ ),
629
+ /* @__PURE__ */ e(a, { align: "right", children: "Actions" })
630
+ ] }) }),
631
+ /* @__PURE__ */ e(ie, { children: [...g.items].sort((t, i) => {
632
+ if (o === "createdAt") {
633
+ const c = t.createdAt ? new Date(t.createdAt).getTime() : 0, d = i.createdAt ? new Date(i.createdAt).getTime() : 0;
634
+ return u === s.ASC ? c - d : d - c;
635
+ }
636
+ if (o === "expiresAt") {
637
+ const c = t.expiresAt ? new Date(t.expiresAt).getTime() : Number.MAX_SAFE_INTEGER, d = i.expiresAt ? new Date(i.expiresAt).getTime() : Number.MAX_SAFE_INTEGER;
638
+ return u === s.ASC ? c - d : d - c;
639
+ }
640
+ return 0;
641
+ }).map((t, i) => /* @__PURE__ */ r(E, { children: [
642
+ /* @__PURE__ */ e(a, { className: N("dark:text-gray-400"), children: i + 1 }),
643
+ /* @__PURE__ */ e(
644
+ a,
645
+ {
646
+ className: N(
647
+ "dark:text-white",
648
+ "max-w-[100px] sm:max-w-[400px]",
649
+ "text-xs sm:text-sm"
650
+ ),
651
+ style: {
652
+ wordBreak: "break-word"
653
+ },
654
+ children: t.description || t.text
655
+ }
656
+ ),
657
+ /* @__PURE__ */ e(
658
+ a,
659
+ {
660
+ component: "th",
661
+ scope: "row",
662
+ className: N(
663
+ "dark:text-gray-400",
664
+ "sm:whitespace-nowrap text-xs sm:text-sm max-w-20 sm:max-w-none"
665
+ ),
666
+ children: t.createdAt ? new Date(t.createdAt).toLocaleDateString() : "-"
667
+ }
668
+ ),
669
+ /* @__PURE__ */ e(
670
+ a,
671
+ {
672
+ className: N(
673
+ "dark:text-gray-400",
674
+ "sm:whitespace-nowrap text-xs sm:text-sm"
675
+ ),
676
+ children: t.expiresAt ? new Date(t.expiresAt).toLocaleDateString() : "-"
677
+ }
678
+ ),
679
+ /* @__PURE__ */ e(a, { className: "align-top", align: "right", children: /* @__PURE__ */ r(
680
+ L,
681
+ {
682
+ columnGap: 2,
683
+ alignHorizontal: "flex-end",
684
+ children: [
685
+ /* @__PURE__ */ e(y, { children: /* @__PURE__ */ e(
686
+ _,
687
+ {
688
+ label: "Restore memory",
689
+ mode: "system",
690
+ placement: "top",
691
+ trigger: /* @__PURE__ */ e(
692
+ I,
693
+ {
694
+ focusMode: "system",
695
+ noBorder: !0,
696
+ label: "Restore memory",
697
+ variant: "primary",
698
+ disabled: Y.isPending,
699
+ onClick: () => {
700
+ l && Y.mutate({
701
+ user: l,
702
+ memoryId: t.memoryId
703
+ });
704
+ },
705
+ children: /* @__PURE__ */ e(Ie, { size: "size-3", monotone: !0 })
706
+ }
707
+ )
708
+ }
709
+ ) }),
710
+ /* @__PURE__ */ e(y, { children: /* @__PURE__ */ e(
711
+ _,
712
+ {
713
+ label: "Delete memory",
714
+ mode: "system",
715
+ placement: "top",
716
+ trigger: /* @__PURE__ */ e(
717
+ I,
718
+ {
719
+ focusMode: "system",
720
+ noBorder: !0,
721
+ label: "Delete memory",
722
+ variant: "primary",
723
+ iconClassName: "text-red-700 dark:text-red-500",
724
+ disabled: G.isPending,
725
+ onClick: () => Q(
726
+ t.memoryId,
727
+ t.text,
728
+ t.description,
729
+ t.createdAt
730
+ ),
731
+ children: /* @__PURE__ */ e(ne, { size: "size-3", monotone: !0 })
732
+ }
733
+ )
734
+ }
735
+ ) })
736
+ ]
737
+ }
738
+ ) })
739
+ ] }, t.memoryId)) }),
740
+ /* @__PURE__ */ e(oe, { children: /* @__PURE__ */ e(E, { children: /* @__PURE__ */ r(a, { colSpan: 5, children: [
741
+ g.total,
742
+ " expired memor",
743
+ g.total === 1 ? "y" : "ies",
744
+ g.totalTokenUsage !== void 0 && g.totalTokenUsage > 0 && /* @__PURE__ */ r(R, { children: [
745
+ " ",
746
+ "(approximately",
747
+ " ",
748
+ Math.round(
749
+ g.totalTokenUsage
750
+ ).toLocaleString(),
751
+ " ",
752
+ "token",
753
+ Math.round(g.totalTokenUsage) === 1 ? "" : "s",
754
+ ")"
755
+ ] })
756
+ ] }) }) })
757
+ ] }) : /* @__PURE__ */ e("p", { className: "m-0 italic opacity-70", children: "No expired memories." }))
758
+ ] })
759
+ }
760
+ )
761
+ ] })
762
+ }
763
+ )
764
+ ] });
765
+ };
766
+ export {
767
+ je as UserMemoriesPanel,
768
+ je as default
769
+ };