@chaibuilder/pages 0.4.20-beta.2 → 0.5.0-beta.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.
@@ -1,13 +1,13 @@
1
1
  import { jsx as e, jsxs as i, Fragment as I } from "react/jsx-runtime";
2
- import ie, { useState as f, useMemo as be, useEffect as G, useCallback as D, Suspense as Ae } from "react";
2
+ import ie, { useState as f, useMemo as we, useEffect as G, useCallback as D, Suspense as Ae } from "react";
3
3
  import { mergeClasses as ae } from "@chaibuilder/sdk";
4
- import { Button as u, Label as q, Textarea as Se, Input as Ce, Dialog as Ee, DialogContent as Te, DialogHeader as ke, DialogTitle as ze, DialogDescription as De, DialogFooter as Pe, Switch as je, TooltipProvider as Ie, Tooltip as Fe, TooltipTrigger as Ue, TooltipContent as $e } from "@chaibuilder/sdk/ui";
5
- import { find as _e, merge as Be, pick as Oe, first as qe } from "lodash-es";
6
- import { Loader as F, AlertCircle as Le, ChevronLeft as Me, Pencil as Ke, Search as Qe, Archive as Ge, Film as Re, ImageIcon as We, Edit as Ve, Trash2 as Ye, Check as He, Upload as Xe, AlertTriangle as Ze } from "lucide-react";
4
+ import { Button as u, Label as L, Textarea as Se, Input as Ce, Dialog as Ee, DialogContent as Te, DialogHeader as ke, DialogTitle as ze, DialogDescription as De, DialogFooter as je, Switch as Pe, TooltipProvider as Ie, Tooltip as Fe, TooltipTrigger as Ue, TooltipContent as $e } from "@chaibuilder/sdk/ui";
5
+ import { find as _e, merge as Be, pick as qe, first as Le } from "lodash-es";
6
+ import { Loader as F, AlertCircle as Me, ChevronLeft as Oe, Pencil as Ke, Search as Qe, Archive as Ge, Film as Re, ImageIcon as We, Edit as Ve, Trash2 as Ye, Check as He, Upload as Xe, AlertTriangle as Ze } from "lucide-react";
7
7
  import { useDropzone as Je } from "react-dropzone";
8
8
  import { useQueryClient as R, useMutation as W, useQuery as le } from "@tanstack/react-query";
9
- import { toast as P } from "sonner";
10
- import { W as U, X as $, Y as y, Z as _ } from "./index-HVr8s8no.js";
9
+ import { toast as j } from "sonner";
10
+ import { W as U, X as $, Y as y, Z as _ } from "./index-Cm83yAXd.js";
11
11
  const et = () => {
12
12
  const n = U(), r = R(), s = $();
13
13
  return W({
@@ -25,10 +25,10 @@ const et = () => {
25
25
  throw new Error(a == null ? void 0 : a.error);
26
26
  r.invalidateQueries({
27
27
  queryKey: [_, y.GET_ASSETS]
28
- }), P.success("Asset uploaded successfully");
28
+ }), j.success("Asset uploaded successfully");
29
29
  },
30
30
  onError: () => {
31
- P.error("Failed to upload asset");
31
+ j.error("Failed to upload asset");
32
32
  }
33
33
  });
34
34
  }, tt = () => {
@@ -43,10 +43,10 @@ const et = () => {
43
43
  throw new Error(a == null ? void 0 : a.error);
44
44
  r.invalidateQueries({
45
45
  queryKey: [_, y.GET_ASSETS]
46
- }), P.success("Asset deleted successfully");
46
+ }), j.success("Asset deleted successfully");
47
47
  },
48
48
  onError: () => {
49
- P.error("Failed to delete asset");
49
+ j.error("Failed to delete asset");
50
50
  }
51
51
  });
52
52
  }, it = () => {
@@ -61,10 +61,10 @@ const et = () => {
61
61
  throw new Error(a == null ? void 0 : a.error);
62
62
  r.invalidateQueries({
63
63
  queryKey: [_, y.GET_ASSETS]
64
- }), P.success("Asset updated successfully");
64
+ }), j.success("Asset updated successfully");
65
65
  },
66
66
  onError: () => {
67
- P.error("Failed to update asset");
67
+ j.error("Failed to update asset");
68
68
  }
69
69
  });
70
70
  }, at = (n = {}) => {
@@ -123,17 +123,17 @@ const nt = ({
123
123
  onSave: a,
124
124
  isSaving: d
125
125
  }) => {
126
- var N, S, h;
127
- const { data: l, isLoading: g, isError: x } = lt(n || ""), [v, m] = f("");
126
+ var N, C, h;
127
+ const { data: l, isLoading: g, isError: p } = lt(n || ""), [v, m] = f("");
128
128
  return ie.useEffect(() => {
129
129
  l != null && l.description && m(l.description);
130
- }, [l]), g ? /* @__PURE__ */ e("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ e(F, { className: "h-8 w-8 animate-spin" }) }) : x || !(l != null && l.id) ? /* @__PURE__ */ e("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ i("div", { className: "text-center max-w-md mx-auto p-6", children: [
131
- /* @__PURE__ */ e("div", { className: "flex justify-center mb-4", children: /* @__PURE__ */ e(Le, { className: "h-12 w-12 text-gray-400" }) }),
130
+ }, [l]), g ? /* @__PURE__ */ e("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ e(F, { className: "h-8 w-8 animate-spin" }) }) : p || !(l != null && l.id) ? /* @__PURE__ */ e("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ i("div", { className: "text-center max-w-md mx-auto p-6", children: [
131
+ /* @__PURE__ */ e("div", { className: "flex justify-center mb-4", children: /* @__PURE__ */ e(Me, { className: "h-12 w-12 text-gray-400" }) }),
132
132
  /* @__PURE__ */ e("h3", { className: "text-lg font-medium text-gray-900 mb-2", children: "No Asset Found" }),
133
- /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 mb-6", children: x ? "There was an error loading the asset. Please try again later." : "The asset you're looking for doesn't exist or has been removed." }),
133
+ /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 mb-6", children: p ? "There was an error loading the asset. Please try again later." : "The asset you're looking for doesn't exist or has been removed." }),
134
134
  /* @__PURE__ */ i("div", { className: "flex justify-center gap-4", children: [
135
135
  /* @__PURE__ */ e(u, { variant: "outline", onClick: r, children: "Back to Assets" }),
136
- x && /* @__PURE__ */ e(
136
+ p && /* @__PURE__ */ e(
137
137
  u,
138
138
  {
139
139
  variant: "default",
@@ -152,7 +152,7 @@ const nt = ({
152
152
  onClick: r,
153
153
  disabled: d,
154
154
  children: [
155
- /* @__PURE__ */ e(Me, { className: "h-4 w-4" }),
155
+ /* @__PURE__ */ e(Oe, { className: "h-4 w-4" }),
156
156
  "Back to Assets"
157
157
  ]
158
158
  }
@@ -179,18 +179,18 @@ const nt = ({
179
179
  {
180
180
  src: `${l.url}?v=${((N = l.metadata) == null ? void 0 : N.updatedAt) || l.createdAt}`,
181
181
  alt: l.name,
182
- className: "w-full h-full object-contain rounded-lg max-h-max max-w-max shadow-2xl shadow-black/30"
182
+ className: "w-full h-full object-contain rounded-lg max-h-max max-w-max"
183
183
  }
184
184
  ) }),
185
185
  /* @__PURE__ */ i("div", { className: "space-y-6", children: [
186
186
  /* @__PURE__ */ i("div", { className: "grid gap-3 border rounded-md pt-2 bg-gray-100", children: [
187
- /* @__PURE__ */ e(q, { className: "w-full text-center", children: "Details" }),
187
+ /* @__PURE__ */ e(L, { className: "w-full text-center", children: "Details" }),
188
188
  /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-2 text-sm border rounded-md p-2 bg-white", children: [
189
189
  { label: "File Name", value: l.name },
190
190
  { label: "Type", value: l.type, capitalize: !0 },
191
191
  {
192
192
  label: "Format",
193
- value: ((S = l.metadata) == null ? void 0 : S.format) || l.type,
193
+ value: ((C = l.metadata) == null ? void 0 : C.format) || l.type,
194
194
  capitalize: !0
195
195
  },
196
196
  {
@@ -211,38 +211,38 @@ const nt = ({
211
211
  ((h = l.metadata) == null ? void 0 : h.updatedAt) || l.createdAt
212
212
  )
213
213
  }
214
- ].map((c) => /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
215
- /* @__PURE__ */ e(q, { className: "w-max text-left px-2 w-1/4 font-normal text-gray-700", children: c.label }),
214
+ ].map((o) => /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
215
+ /* @__PURE__ */ e(L, { className: "w-max text-left px-2 w-1/4 font-normal text-gray-700", children: o.label }),
216
216
  ":",
217
217
  /* @__PURE__ */ e(
218
218
  "div",
219
219
  {
220
- className: "w-max text-left font-medium text-gray-900" + c.capitalize ? " capitalize" : "",
221
- children: c.value
220
+ className: "w-max text-left font-medium text-gray-900" + o.capitalize ? " capitalize" : "",
221
+ children: o.value
222
222
  }
223
223
  )
224
- ] }, c.label)) })
224
+ ] }, o.label)) })
225
225
  ] }),
226
226
  l.usedOn && l.usedOn.length > 0 && /* @__PURE__ */ i("div", { className: "grid gap-3", children: [
227
- /* @__PURE__ */ e(q, { children: "Used On" }),
228
- /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-2 text-sm border rounded-md p-2", children: l.usedOn.map((c, w) => /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
229
- /* @__PURE__ */ e("div", { className: "w-max text-left font-medium text-gray-900", children: c.name }),
227
+ /* @__PURE__ */ e(L, { children: "Used On" }),
228
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-2 text-sm border rounded-md p-2", children: l.usedOn.map((o, b) => /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
229
+ /* @__PURE__ */ e("div", { className: "w-max text-left font-medium text-gray-900", children: o.name }),
230
230
  /* @__PURE__ */ i("div", { className: "text-gray-500", children: [
231
231
  "(",
232
- c.slug,
232
+ o.slug,
233
233
  ")"
234
234
  ] })
235
- ] }, w)) })
235
+ ] }, b)) })
236
236
  ] }),
237
237
  /* @__PURE__ */ i("div", { className: "grid gap-3 border rounded-md pt-2 bg-gray-100 relative", children: [
238
- /* @__PURE__ */ e(q, { className: "w-full text-center", children: "Description" }),
238
+ /* @__PURE__ */ e(L, { className: "w-full text-center", children: "Description" }),
239
239
  /* @__PURE__ */ e(
240
240
  Se,
241
241
  {
242
242
  id: "description",
243
243
  value: v,
244
244
  placeholder: "Enter a description for the asset",
245
- onChange: (c) => m(c.target.value),
245
+ onChange: (o) => m(o.target.value),
246
246
  rows: 3,
247
247
  disabled: d,
248
248
  className: "hover:border-black/40 bg-white"
@@ -284,21 +284,21 @@ const ot = ({
284
284
  G(() => {
285
285
  localStorage.setItem("chai_optimize_images", l.toString());
286
286
  }, [l]);
287
- const x = n || d, v = D(
288
- async (h) => new Promise((c, w) => {
289
- const B = h[0], C = new FileReader();
290
- C.readAsDataURL(B), C.onload = async () => {
291
- const j = await a({
292
- file: C.result,
287
+ const p = n || d, v = D(
288
+ async (h) => new Promise((o, b) => {
289
+ const B = h[0], E = new FileReader();
290
+ E.readAsDataURL(B), E.onload = async () => {
291
+ const P = await a({
292
+ file: E.result,
293
293
  folderId: void 0,
294
294
  name: B.name,
295
295
  optimize: l
296
296
  });
297
- c(j);
298
- }, C.onerror = (j) => w(j);
297
+ o(P);
298
+ }, E.onerror = (P) => b(P);
299
299
  }),
300
300
  [a, l]
301
- ), { getRootProps: m, getInputProps: N, isDragActive: S } = Je({
301
+ ), { getRootProps: m, getInputProps: N, isDragActive: C } = Je({
302
302
  onDrop: v,
303
303
  accept: {
304
304
  "image/*": r.includes("image") ? [] : []
@@ -309,35 +309,42 @@ const ot = ({
309
309
  return /* @__PURE__ */ e(
310
310
  "div",
311
311
  {
312
- className: `flex flex-col items-center justify-center w-full border-2 hover:border-black/50 border-dashed p-0 rounded-lg border-slate-300 py-2 h-[60px] ${x ? "opacity-90 bg-gray-100 pointer-events-none" : "hover:border-black/50 hover:bg-gray-100"}`,
312
+ className: `flex flex-col items-center justify-center w-full border-2 hover:border-black/50 border-dashed p-0 rounded-lg border-slate-300 py-2 h-[60px] ${p ? "opacity-90 bg-gray-100 pointer-events-none" : "hover:border-black/50 bg-gray-100 hover:bg-gray-100"}`,
313
313
  children: /* @__PURE__ */ i(
314
314
  "div",
315
315
  {
316
316
  ...m(),
317
317
  className: ae(
318
- "rounded-lg text-center cursor-pointer w-full h-max flex flex-col items-center justify-center",
319
- S ? "border-primary bg-primary/5" : "border-muted-foreground/20"
318
+ "rounded-lg text-center cursor-pointer w-full h-max flex flex-col justify-center",
319
+ p ? "items-start" : "items-center",
320
+ C ? "border-primary bg-primary/5" : "border-muted-foreground/20"
320
321
  ),
321
322
  children: [
322
323
  /* @__PURE__ */ e("input", { ...N() }),
323
- x ? /* @__PURE__ */ e("div", { className: "flex flex-col items-center", children: /* @__PURE__ */ i("div", { className: "leading-tight flex items-center gap-2", children: [
324
- /* @__PURE__ */ e(
325
- "div",
326
- {
327
- className: "flex items-center justify-center rounded-full bg-indigo-100 p-2",
328
- children: /* @__PURE__ */ e(F, { className: "h-4 w-4 text-indigo-500 animate-spin" })
329
- }
330
- ),
331
- /* @__PURE__ */ i("div", { className: "text-left", children: [
332
- /* @__PURE__ */ e("div", { className: "font-medium", children: n ? "Updating file..." : "Uploading file..." }),
333
- /* @__PURE__ */ i("div", { className: "text-xs text-muted-foreground font-light", children: [
334
- "Please wait while we ",
335
- n ? "update" : "upload",
336
- " ",
337
- "your file..."
338
- ] })
339
- ] })
340
- ] }) }) : /* @__PURE__ */ i("div", { className: "flex items-center justify-between w-full px-6", children: [
324
+ p ? /* @__PURE__ */ e("div", { className: "flex flex-col items-center px-6", children: /* @__PURE__ */ i(
325
+ "div",
326
+ {
327
+ className: "leading-tight flex items-center justify-center gap-2",
328
+ children: [
329
+ /* @__PURE__ */ e(
330
+ "div",
331
+ {
332
+ className: "flex items-center justify-center rounded-full bg-indigo-100 p-2",
333
+ children: /* @__PURE__ */ e(F, { className: "h-4 w-4 text-indigo-500 animate-spin" })
334
+ }
335
+ ),
336
+ /* @__PURE__ */ i("div", { className: "text-left", children: [
337
+ /* @__PURE__ */ e("div", { className: "font-medium", children: n ? "Updating file..." : "Uploading file..." }),
338
+ /* @__PURE__ */ i("div", { className: "text-xs text-muted-foreground font-light", children: [
339
+ "Please wait while we ",
340
+ n ? "update" : "upload",
341
+ " ",
342
+ "your file..."
343
+ ] })
344
+ ] })
345
+ ]
346
+ }
347
+ ) }) : /* @__PURE__ */ i("div", { className: "flex items-center justify-between w-full px-6", children: [
341
348
  /* @__PURE__ */ e("div", { className: "flex flex-col items-center", children: /* @__PURE__ */ i(
342
349
  "div",
343
350
  {
@@ -390,7 +397,7 @@ const ot = ({
390
397
  )
391
398
  ] }),
392
399
  /* @__PURE__ */ e(
393
- je,
400
+ Pe,
394
401
  {
395
402
  checked: l,
396
403
  onCheckedChange: (h) => {
@@ -431,42 +438,42 @@ function yt({
431
438
  mode: s = "image",
432
439
  assetId: a
433
440
  }) {
434
- const g = be(() => [s], [s]), [x, v] = f(null), [m, N] = f(null), [S, h] = f(null), [c, w] = f({ show: !1, file: "" }), [B, C] = f(!1), [j, L] = f(
441
+ const g = we(() => [s], [s]), [p, v] = f(null), [m, N] = f(null), [C, h] = f(null), [o, b] = f({ show: !1, file: "" }), [B, E] = f(!1), [P, M] = f(
435
442
  a ? "details" : "grid"
436
- ), [M, re] = f(""), [O, ne] = f(""), [b, V] = f(1), [Y] = f(30), [E, H] = f([]);
443
+ ), [O, re] = f(""), [q, ne] = f(""), [w, V] = f(1), [Y] = f(30), [A, H] = f([]);
437
444
  G(() => {
438
- a && (v(a), L("details"));
445
+ a && (v(a), M("details"));
439
446
  }, [a]), G(() => {
440
447
  const t = setTimeout(() => {
441
- re(O), V(1);
448
+ re(q), V(1);
442
449
  }, 300);
443
450
  return () => clearTimeout(t);
444
- }, [O]);
451
+ }, [q]);
445
452
  const { data: k, isLoading: X } = at({
446
- search: M.toLowerCase().trim(),
447
- page: b,
453
+ search: O.toLowerCase().trim(),
454
+ page: w,
448
455
  limit: Y
449
- }), T = (k == null ? void 0 : k.assets) || [], se = (k == null ? void 0 : k.total) || 0, A = Math.ceil(se / Y), K = b < A, Q = b > 1, ce = (T == null ? void 0 : T.length) > 0, { mutate: oe } = tt(), { mutate: Z, isPending: de } = et(), { mutate: J, isPending: me } = it(), z = D(
456
+ }), T = (k == null ? void 0 : k.assets) || [], se = (k == null ? void 0 : k.total) || 0, S = Math.ceil(se / Y), K = w < S, Q = w > 1, ce = (T == null ? void 0 : T.length) > 0, { mutate: oe } = tt(), { mutate: Z, isPending: de } = et(), { mutate: J, isPending: me } = it(), z = D(
450
457
  (t) => {
451
- t >= 1 && t <= A && V(t);
458
+ t >= 1 && t <= S && V(t);
452
459
  },
453
- [A]
460
+ [S]
454
461
  ), ue = D(() => {
455
- K && z(b + 1);
456
- }, [b, K, z]), he = D(() => {
457
- Q && z(b - 1);
458
- }, [b, Q, z]), fe = (t) => {
462
+ K && z(w + 1);
463
+ }, [w, K, z]), he = D(() => {
464
+ Q && z(w - 1);
465
+ }, [w, Q, z]), fe = (t) => {
459
466
  ne(t.target.value);
460
467
  }, ge = D(
461
468
  (t) => {
462
- H((o) => _e(o, { id: t.id }) ? [] : [t]);
469
+ H((c) => _e(c, { id: t.id }) ? [] : [t]);
463
470
  },
464
471
  [!1]
465
472
  ), pe = D(() => {
466
473
  H([]);
467
474
  }, []), xe = () => {
468
- E.length !== 0 && (r(
469
- Oe(qe(E), [
475
+ A.length !== 0 && (r(
476
+ qe(Le(A), [
470
477
  "id",
471
478
  "url",
472
479
  "width",
@@ -486,27 +493,27 @@ function yt({
486
493
  }
487
494
  }), N(null));
488
495
  }, ye = (t) => {
489
- v(t.id), L("details");
490
- }, we = async (t, o) => {
496
+ v(t.id), M("details");
497
+ }, be = async (t, c) => {
491
498
  try {
492
- const p = localStorage.getItem("chai_optimize_images") !== "false";
493
- o ? (await Z({
499
+ const x = localStorage.getItem("chai_optimize_images") !== "false";
500
+ c ? (await Z({
494
501
  file: t,
495
502
  folderId: void 0,
496
- name: c.name || "",
497
- optimize: p
498
- }), w({ show: !1, file: "" })) : (await J({
499
- id: c.id || "",
503
+ name: o.name || "",
504
+ optimize: x
505
+ }), b({ show: !1, file: "" })) : (await J({
506
+ id: o.id || "",
500
507
  file: t
501
- }), w({ show: !1, file: "" }));
502
- } catch (p) {
503
- console.error("Error saving edited image:", p);
508
+ }), b({ show: !1, file: "" }));
509
+ } catch (x) {
510
+ console.error("Error saving edited image:", x);
504
511
  }
505
512
  };
506
513
  return /* @__PURE__ */ i(I, { children: [
507
514
  /* @__PURE__ */ i("div", { className: "max-w-[1232px] max-h-[1232px] w-[80vw] h-[80vh] space-y-4 flex flex-col", children: [
508
515
  /* @__PURE__ */ e("h1", { className: "text-lg font-medium", children: "Digital Asset Manager" }),
509
- j === "grid" ? /* @__PURE__ */ i(I, { children: [
516
+ P === "grid" ? /* @__PURE__ */ i(I, { children: [
510
517
  /* @__PURE__ */ e(
511
518
  ot,
512
519
  {
@@ -524,7 +531,7 @@ function yt({
524
531
  Qe,
525
532
  {
526
533
  strokeWidth: 3,
527
- className: `absolute left-2 top-2.5 h-4 w-4 text-muted-foreground ${O.length > 0 ? "text-indigo-800" : ""}`
534
+ className: `absolute left-2 top-2.5 h-4 w-4 text-muted-foreground ${q.length > 0 ? "text-indigo-800" : ""}`
528
535
  }
529
536
  ),
530
537
  /* @__PURE__ */ e(
@@ -532,13 +539,13 @@ function yt({
532
539
  {
533
540
  placeholder: "Search assets...",
534
541
  onChange: fe,
535
- value: O,
536
- className: "pl-8 hover:shadow-lg"
542
+ value: q,
543
+ className: "pl-8"
537
544
  }
538
545
  )
539
546
  ] }),
540
- E.length > 0 ? /* @__PURE__ */ e("div", { className: "flex justify-between items-center", children: /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
541
- E.length > 0 && /* @__PURE__ */ e(I, { children: /* @__PURE__ */ e(
547
+ A.length > 0 ? /* @__PURE__ */ e("div", { className: "flex justify-between items-center", children: /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
548
+ A.length > 0 && /* @__PURE__ */ e(I, { children: /* @__PURE__ */ e(
542
549
  u,
543
550
  {
544
551
  variant: "outline",
@@ -553,13 +560,13 @@ function yt({
553
560
  {
554
561
  size: "sm",
555
562
  onClick: xe,
556
- disabled: E.length === 0,
563
+ disabled: A.length === 0,
557
564
  children: "Select Asset"
558
565
  }
559
566
  )
560
567
  ] }) }) : null
561
568
  ] }),
562
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto", children: X ? /* @__PURE__ */ i("div", { className: "columns-1 gap-3 space-y-3 sm:columns-3 md:columns-5", children: [
569
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto pb-[66px]", children: X ? /* @__PURE__ */ i("div", { className: "columns-1 gap-3 space-y-3 sm:columns-3 md:columns-5", children: [
563
570
  /* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
564
571
  /* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
565
572
  /* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
@@ -573,27 +580,27 @@ function yt({
573
580
  ] }) : !X && !ce ? /* @__PURE__ */ i("div", { className: "flex flex-col items-center justify-center h-full border rounded-lg", children: [
574
581
  /* @__PURE__ */ e("div", { className: "text-muted-foreground", children: /* @__PURE__ */ e(Ge, { className: "h-9 w-9 text-indigo-500" }) }),
575
582
  /* @__PURE__ */ e("div", { className: "text-muted-foreground text-lg", children: "No assets found" }),
576
- /* @__PURE__ */ e("div", { className: "text-muted-foreground text-sm", children: M.length > 0 ? "No assets found for your search: " + M : "Start uploading assets to get started" }),
583
+ /* @__PURE__ */ e("div", { className: "text-muted-foreground text-sm", children: O.length > 0 ? "No assets found for your search: " + O : "Start uploading assets to get started" }),
577
584
  /* @__PURE__ */ e("br", {})
578
585
  ] }) : /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-3 p-1", children: T == null ? void 0 : T.map((t) => /* @__PURE__ */ i(
579
586
  "div",
580
587
  {
581
588
  className: ae(
582
589
  "relative cursor-pointer overflow-hidden transition-all rounded-lg border-2 group max-w-[180px] max-h-[180px] flex flex-col justify-between",
583
- E.some((o) => o.id === t.id) ? "border-4 border-blue-500" : "hover:border-black/50",
584
- S && (m == null ? void 0 : m.id) === t.id ? "opacity-50 pointer-events-none" : "",
585
- S === t.id ? "opacity-50 pointer-events-none" : ""
590
+ A.some((c) => c.id === t.id) ? "border-blue-500" : "hover:border-black/90",
591
+ C && (m == null ? void 0 : m.id) === t.id ? "opacity-50 pointer-events-none" : "",
592
+ C === t.id ? "opacity-50 pointer-events-none" : ""
586
593
  ),
587
594
  onClick: () => ge(t),
588
595
  children: [
589
596
  /* @__PURE__ */ i("div", { className: "aspect-square relative overflow-hidden", children: [
590
- S === t.id ? /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-black/50", children: /* @__PURE__ */ e(F, { className: "h-8 w-8 animate-spin text-white" }) }) : null,
597
+ C === t.id ? /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-black/50", children: /* @__PURE__ */ e(F, { className: "h-8 w-8 animate-spin text-white" }) }) : null,
591
598
  t.type === "image" ? /* @__PURE__ */ e(
592
599
  "img",
593
600
  {
594
601
  src: `${t.thumbnailUrl || "/placeholder.svg"}?v=${(t == null ? void 0 : t.updatedAt) || t.createdAt}`,
595
602
  alt: t.name,
596
- className: "object-contain w-full h-full min-h-[80px]"
603
+ className: `object-contain w-full h-full min-h-[80px] ${A.some((c) => c.id === t.id) ? "" : "group-hover:blur-sm group-hover:contrast-50"}`
597
604
  }
598
605
  ) : /* @__PURE__ */ i("div", { className: "flex items-center justify-center h-full", children: [
599
606
  /* @__PURE__ */ e(Re, { className: "h-12 w-12 text-muted-foreground" }),
@@ -607,30 +614,26 @@ function yt({
607
614
  )
608
615
  ] })
609
616
  ] }),
610
- /* @__PURE__ */ i("div", { className: "py-1 px-2", children: [
611
- /* @__PURE__ */ e("div", { className: "text-xs truncate", title: t.name, children: t.name }),
612
- /* @__PURE__ */ i("div", { className: "text-[10px] font-light text-muted-foreground flex items-center justify-between", children: [
613
- /* @__PURE__ */ e("span", { children: ct((t == null ? void 0 : t.size) || 0) }),
614
- /* @__PURE__ */ i("span", { children: [
615
- "Used on",
616
- " ",
617
- /* @__PURE__ */ i("span", { className: "font-normal", children: [
618
- (t == null ? void 0 : t.usedOnCount) || 0,
619
- " "
620
- ] }),
621
- (t == null ? void 0 : t.usedOnCount) === 1 ? "page" : "pages"
622
- ] })
623
- ] })
617
+ /* @__PURE__ */ i("div", { className: "py-1 px-2 flex items-end justify-between bg-white border-t-[1px] border-black/10", children: [
618
+ /* @__PURE__ */ e(
619
+ "div",
620
+ {
621
+ className: "text-xs truncate leading-tight",
622
+ title: t.name,
623
+ children: t.name
624
+ }
625
+ ),
626
+ /* @__PURE__ */ e("div", { className: "text-[9px] whitespace-nowrap font-light text-muted-foreground flex items-center justify-between", children: /* @__PURE__ */ e("span", { children: ct((t == null ? void 0 : t.size) || 0) }) })
624
627
  ] }),
625
- /* @__PURE__ */ i("div", { className: "absolute inset-0 bg-black/80 border-white border-4 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2", children: [
628
+ !A.some((c) => c.id === t.id) && /* @__PURE__ */ i("div", { className: "absolute inset-0 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2", children: [
626
629
  /* @__PURE__ */ e(
627
630
  u,
628
631
  {
629
632
  variant: "secondary",
630
633
  size: "icon",
631
634
  className: "h-8 w-8 rounded-full",
632
- onClick: (o) => {
633
- o.stopPropagation(), ye(t);
635
+ onClick: (c) => {
636
+ c.stopPropagation(), ye(t);
634
637
  },
635
638
  children: /* @__PURE__ */ e(We, { className: "h-4 w-4" })
636
639
  }
@@ -641,8 +644,8 @@ function yt({
641
644
  variant: "secondary",
642
645
  size: "icon",
643
646
  className: "h-8 w-8 rounded-full",
644
- onClick: (o) => {
645
- o.stopPropagation(), w({
647
+ onClick: (c) => {
648
+ c.stopPropagation(), b({
646
649
  id: t.id,
647
650
  show: !0,
648
651
  file: t.url,
@@ -658,14 +661,14 @@ function yt({
658
661
  variant: "destructive",
659
662
  size: "icon",
660
663
  className: "h-8 w-8 rounded-full",
661
- onClick: (o) => {
662
- o.stopPropagation(), ve(t);
664
+ onClick: (c) => {
665
+ c.stopPropagation(), ve(t);
663
666
  },
664
667
  children: /* @__PURE__ */ e(Ye, { className: "h-4 w-4" })
665
668
  }
666
669
  )
667
670
  ] }),
668
- E.some((o) => o.id === t.id) && /* @__PURE__ */ e("div", { className: "absolute top-2 right-2 border border-white h-max rounded-full bg-blue-500 p-1", children: /* @__PURE__ */ e(
671
+ A.some((c) => c.id === t.id) && /* @__PURE__ */ e("div", { className: "absolute top-1 right-1 border border-white h-max rounded-full bg-blue-500 p-1", children: /* @__PURE__ */ e(
669
672
  He,
670
673
  {
671
674
  className: "w-3 h-3 text-white",
@@ -676,7 +679,7 @@ function yt({
676
679
  },
677
680
  t.id
678
681
  )) }) }),
679
- A > 1 && /* @__PURE__ */ e("div", { className: "absolute bottom-0 left-0 right-0 bg-white border-t p-4", children: /* @__PURE__ */ i("div", { className: "flex items-center justify-center space-x-2", children: [
682
+ S > 1 && /* @__PURE__ */ e("div", { className: "absolute bottom-0 left-0 right-0 bg-white border-t p-4", children: /* @__PURE__ */ i("div", { className: "flex items-center justify-center space-x-2", children: [
680
683
  /* @__PURE__ */ e(
681
684
  u,
682
685
  {
@@ -687,28 +690,28 @@ function yt({
687
690
  children: "Previous"
688
691
  }
689
692
  ),
690
- Array.from({ length: Math.min(5, A) }, (t, o) => {
691
- const p = o + 1;
693
+ Array.from({ length: Math.min(5, S) }, (t, c) => {
694
+ const x = c + 1;
692
695
  return /* @__PURE__ */ e(
693
696
  u,
694
697
  {
695
- variant: b === p ? "default" : "outline",
698
+ variant: w === x ? "default" : "outline",
696
699
  size: "sm",
697
- onClick: () => z(p),
698
- children: p
700
+ onClick: () => z(x),
701
+ children: x
699
702
  },
700
- p
703
+ x
701
704
  );
702
705
  }),
703
- A > 5 && /* @__PURE__ */ i(I, { children: [
706
+ S > 5 && /* @__PURE__ */ i(I, { children: [
704
707
  /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: "..." }),
705
708
  /* @__PURE__ */ e(
706
709
  u,
707
710
  {
708
- variant: b === A ? "default" : "outline",
711
+ variant: w === S ? "default" : "outline",
709
712
  size: "sm",
710
- onClick: () => z(A),
711
- children: A
713
+ onClick: () => z(S),
714
+ children: S
712
715
  }
713
716
  )
714
717
  ] }),
@@ -727,12 +730,12 @@ function yt({
727
730
  ] }) : /* @__PURE__ */ e(
728
731
  nt,
729
732
  {
730
- assetId: x || a || "",
733
+ assetId: p || a || "",
731
734
  onBack: () => {
732
- L("grid"), v(null);
735
+ M("grid"), v(null);
733
736
  },
734
737
  onEdit: (t) => {
735
- w({
738
+ b({
736
739
  id: t.id,
737
740
  show: !0,
738
741
  file: t.url,
@@ -740,13 +743,13 @@ function yt({
740
743
  });
741
744
  },
742
745
  onSave: async (t) => {
743
- if (x) {
744
- C(!0);
746
+ if (p) {
747
+ E(!0);
745
748
  try {
746
- const o = T.find((p) => p.id === x);
747
- o && await J(Be(o, { description: t }));
749
+ const c = T.find((x) => x.id === p);
750
+ c && await J(Be(c, { description: t }));
748
751
  } finally {
749
- C(!1);
752
+ E(!1);
750
753
  }
751
754
  }
752
755
  },
@@ -754,18 +757,18 @@ function yt({
754
757
  }
755
758
  )
756
759
  ] }),
757
- c.show && /* @__PURE__ */ e(
760
+ o.show && /* @__PURE__ */ e(
758
761
  Ae,
759
762
  {
760
763
  fallback: /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ e(F, { className: "h-8 w-8 animate-spin" }) }),
761
764
  children: /* @__PURE__ */ e(
762
765
  st,
763
766
  {
764
- imageUrl: c.file,
765
- onSave: we,
766
- onClose: () => w({ show: !1, file: "" }),
767
- defaultSavedImageName: c.name,
768
- isEditing: !!c.id
767
+ imageUrl: o.file,
768
+ onSave: be,
769
+ onClose: () => b({ show: !1, file: "" }),
770
+ defaultSavedImageName: o.name,
771
+ isEditing: !!o.id
769
772
  }
770
773
  )
771
774
  }
@@ -784,7 +787,7 @@ function yt({
784
787
  '"? This action cannot be undone.'
785
788
  ] })
786
789
  ] }),
787
- /* @__PURE__ */ i(Pe, { className: "gap-2 sm:gap-0", children: [
790
+ /* @__PURE__ */ i(je, { className: "gap-2 sm:gap-0", children: [
788
791
  /* @__PURE__ */ e(u, { variant: "outline", onClick: () => N(null), children: "Cancel" }),
789
792
  /* @__PURE__ */ e(u, { variant: "destructive", onClick: Ne, children: "Delete" })
790
793
  ] })