@chaibuilder/pages 0.4.8 → 0.4.9

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,114 +1,114 @@
1
- import { jsxs as a, Fragment as Q, jsx as e } from "react/jsx-runtime";
2
- import X, { useState as S, useCallback as A, useMemo as oe, useRef as ce, Suspense as Y } from "react";
3
- import { mergeClasses as $ } from "@chaibuilder/sdk";
4
- import { Tabs as de, TabsList as ue, TabsTrigger as H, Button as f, TabsContent as V, Input as me, Card as he, CardContent as ge, Dialog as pe, DialogContent as fe, DialogHeader as ye, DialogTitle as ve, DialogDescription as xe, DialogFooter as Ne } from "@chaibuilder/sdk/ui";
5
- import { debounce as Ae, find as we, merge as Se } from "lodash-es";
6
- import { Search as be, Film as Ce, ImageIcon as Ee, Edit as Te, Trash2 as De, Loader2 as W, Upload as Pe } from "lucide-react";
7
- import { useDropzone as Ue } from "react-dropzone";
8
- import { useQueryClient as R, useMutation as K, useQuery as ze } from "@tanstack/react-query";
1
+ import { jsxs as t, Fragment as Q, jsx as e } from "react/jsx-runtime";
2
+ import J, { useState as S, useCallback as w, useMemo as de, useRef as ue, Suspense as $ } from "react";
3
+ import { mergeClasses as H } from "@chaibuilder/sdk";
4
+ import { Tabs as me, TabsList as he, TabsTrigger as V, Button as f, TabsContent as W, Input as ge, Card as pe, CardContent as fe, Dialog as ye, DialogContent as ve, DialogHeader as xe, DialogTitle as Ne, DialogDescription as we, DialogFooter as Ae } from "@chaibuilder/sdk/ui";
5
+ import { debounce as Se, find as be, pick as R, first as X, merge as Ce } from "lodash-es";
6
+ import { Search as Ee, Film as Te, ImageIcon as De, Edit as Pe, Trash2 as Ue, Loader2 as Z, Upload as Fe } from "lucide-react";
7
+ import { useDropzone as ze } from "react-dropzone";
8
+ import { useQueryClient as K, useMutation as G, useQuery as ke } from "@tanstack/react-query";
9
9
  import { toast as b } from "sonner";
10
- import { W as z, X as F, Y as y, Z as M } from "./index-CCLkatX6.js";
11
- const Fe = () => {
12
- const t = z(), r = R(), o = F();
13
- return K({
10
+ import { W as F, X as z, Y as y, Z as k } from "./index-B9yYtFHS.js";
11
+ const Me = () => {
12
+ const a = F(), r = K(), o = z();
13
+ return G({
14
14
  mutationFn: async ({
15
15
  file: i,
16
- folderId: d,
17
- name: u
18
- }) => o(t, {
16
+ folderId: u,
17
+ name: m
18
+ }) => o(a, {
19
19
  action: y.UPLOAD_ASSET,
20
- data: { file: i, folderId: d, name: u }
20
+ data: { file: i, folderId: u, name: m }
21
21
  }),
22
22
  onSuccess: () => {
23
23
  r.invalidateQueries({
24
- queryKey: [M, y.GET_ASSETS]
24
+ queryKey: [k, y.GET_ASSETS]
25
25
  }), b.success("Asset uploaded successfully");
26
26
  },
27
27
  onError: () => {
28
28
  b.error("Failed to upload asset");
29
29
  }
30
30
  });
31
- }, Me = () => {
32
- const t = z(), r = R(), o = F();
33
- return K({
34
- mutationFn: async (i) => o(t, {
31
+ }, Ie = () => {
32
+ const a = F(), r = K(), o = z();
33
+ return G({
34
+ mutationFn: async (i) => o(a, {
35
35
  action: y.DELETE_ASSET,
36
36
  data: { id: i }
37
37
  }),
38
38
  onSuccess: () => {
39
39
  r.invalidateQueries({
40
- queryKey: [M, y.GET_ASSETS]
40
+ queryKey: [k, y.GET_ASSETS]
41
41
  }), b.success("Asset deleted successfully");
42
42
  },
43
43
  onError: () => {
44
44
  b.error("Failed to delete asset");
45
45
  }
46
46
  });
47
- }, Ie = () => {
48
- const t = z(), r = R(), o = F();
49
- return K({
50
- mutationFn: async (i) => o(t, {
47
+ }, qe = () => {
48
+ const a = F(), r = K(), o = z();
49
+ return G({
50
+ mutationFn: async (i) => o(a, {
51
51
  action: y.UPDATE_ASSET,
52
52
  data: i
53
53
  }),
54
54
  onSuccess: () => {
55
55
  r.invalidateQueries({
56
- queryKey: [M, y.GET_ASSETS]
56
+ queryKey: [k, y.GET_ASSETS]
57
57
  }), b.success("Asset updated successfully");
58
58
  },
59
59
  onError: () => {
60
60
  b.error("Failed to update asset");
61
61
  }
62
62
  });
63
- }, ke = (t = {}) => {
64
- const r = z(), o = F(), { search: i, page: d = 1, limit: u = 10 } = t;
65
- return ze({
66
- queryKey: [M, y.GET_ASSETS, i, d, u],
67
- queryFn: async () => (await o(r, {
63
+ }, je = (a = {}) => {
64
+ const r = F(), o = z(), { search: i, page: u = 1, limit: m = 10 } = a;
65
+ return ke({
66
+ queryKey: [k, y.GET_ASSETS, i, u, m],
67
+ queryFn: async () => await o(r, {
68
68
  action: y.GET_ASSETS,
69
69
  data: {
70
70
  search: i,
71
- page: d,
72
- limit: u
71
+ page: u,
72
+ limit: m
73
73
  }
74
- })).data,
74
+ }),
75
75
  retry: 1
76
76
  });
77
77
  };
78
- function qe() {
79
- const [r, o] = S([]), [i, d] = S({
78
+ function _e() {
79
+ const [r, o] = S([]), [i, u] = S({
80
80
  query: "",
81
81
  page: 1,
82
82
  pageSize: 10
83
- }), u = Ae(() => i.query, 300)(), { data: n, isLoading: C } = ke({
84
- search: (u == null ? void 0 : u.toLowerCase().trim()) || "",
83
+ }), m = Se(() => i.query, 300)(), { data: n, isLoading: C } = je({
84
+ search: (m == null ? void 0 : m.toLowerCase().trim()) || "",
85
85
  page: i.page,
86
86
  limit: i.pageSize
87
- }), v = n ? Math.ceil(n.total / n.pageSize) : 0, c = (n == null ? void 0 : n.page) || 1, g = c < v, m = c > 1, { mutate: E, isPending: I } = Ie(), { mutate: w, isPending: p } = Fe(), { mutate: T, isPending: D } = Me(), x = A(
88
- (h) => {
89
- h >= 1 && h <= v && d((N) => ({
87
+ }), v = n ? Math.ceil(n.total / n.pageSize) : 0, c = (n == null ? void 0 : n.page) || 1, p = c < v, h = c > 1, { mutate: E, isPending: M } = qe(), { mutate: A, isPending: d } = Me(), { mutate: T, isPending: D } = Ie(), x = w(
88
+ (g) => {
89
+ g >= 1 && g <= v && u((N) => ({
90
90
  ...N,
91
- page: h
91
+ page: g
92
92
  }));
93
93
  },
94
94
  [v]
95
- ), k = A(() => {
96
- g && x(c + 1);
97
- }, [c, g, x]), q = A(() => {
98
- m && x(c - 1);
99
- }, [c, m, x]), j = A((h) => {
100
- d((N) => ({
95
+ ), I = w(() => {
96
+ p && x(c + 1);
97
+ }, [c, p, x]), q = w(() => {
98
+ h && x(c - 1);
99
+ }, [c, h, x]), j = w((g) => {
100
+ u((N) => ({
101
101
  ...N,
102
- query: h,
102
+ query: g,
103
103
  page: 1
104
104
  // Reset to first page on new search
105
105
  }));
106
- }, []), P = A(
107
- (h) => {
108
- o((N) => we(N, { id: h.id }) ? [] : [h]);
106
+ }, []), P = w(
107
+ (g) => {
108
+ o((N) => be(N, { id: g.id }) ? [] : [g]);
109
109
  },
110
110
  [!1]
111
- ), _ = A(() => {
111
+ ), _ = w(() => {
112
112
  o([]);
113
113
  }, []);
114
114
  return {
@@ -118,111 +118,123 @@ function qe() {
118
118
  assets: (n == null ? void 0 : n.assets) || [],
119
119
  currentPage: c,
120
120
  totalPages: v,
121
- hasNextPage: g,
122
- hasPreviousPage: m,
121
+ hasNextPage: p,
122
+ hasPreviousPage: h,
123
123
  // Mutations
124
- uploadAsset: w,
124
+ uploadAsset: A,
125
125
  updateAsset: E,
126
126
  deleteAsset: T,
127
127
  goToPage: x,
128
- nextPage: k,
128
+ nextPage: I,
129
129
  previousPage: q,
130
130
  updateSearchQuery: j,
131
131
  clearSelectedAssets: _,
132
132
  updateSelectedAssets: P,
133
133
  // Loading
134
134
  isLoadingAssets: C,
135
- isUploadingAsset: p,
136
- isUpdatingAsset: I,
135
+ isUploadingAsset: d,
136
+ isUpdatingAsset: M,
137
137
  isDeletingAsset: D
138
138
  };
139
139
  }
140
- const je = X.lazy(() => import("./asset-metadata-editor-r5vYHUfm.js")), _e = X.lazy(() => import("./image-editor-CwVua57o.js"));
141
- function Xe({
142
- close: t,
140
+ const Le = J.lazy(() => import("./asset-metadata-editor-CyTBhS-V.js")), Be = J.lazy(() => import("./image-editor-By8RDHso.js"));
141
+ function Je({
142
+ close: a,
143
143
  onSelect: r,
144
144
  mode: o = "image"
145
145
  }) {
146
- const d = oe(() => [o], [o]), [u, n] = S("browse"), [C, v] = S(null), [c, g] = S(null), [m, E] = S({ show: !1, file: "" }), {
146
+ const u = de(() => [o], [o]), [m, n] = S("browse"), [C, v] = S(null), [c, p] = S(null), [h, E] = S({ show: !1, file: "" }), {
147
147
  // Data
148
- query: I,
149
- assets: w,
150
- selectedAssets: p,
148
+ query: M,
149
+ assets: A,
150
+ selectedAssets: d,
151
151
  // Mutations
152
152
  uploadAsset: T,
153
153
  updateAsset: D,
154
154
  deleteAsset: x,
155
- updateSearchQuery: k,
155
+ updateSearchQuery: I,
156
156
  clearSelectedAssets: q,
157
157
  updateSelectedAssets: j,
158
158
  // Loading
159
159
  isLoadingAssets: P,
160
160
  isUploadingAsset: _,
161
- isUpdatingAsset: h
161
+ isUpdatingAsset: g
162
162
  // isDeletingAsset,
163
- } = qe(), N = ce(null), G = A(
163
+ } = _e(), N = ue(null), O = w(
164
164
  async (s) => new Promise((l, L) => {
165
- const O = s[0], U = new FileReader();
166
- U.readAsDataURL(O), U.onload = async () => {
167
- const B = await T({
168
- file: U.result,
169
- folderId: null,
170
- name: O.name
171
- });
172
- n("browse"), l(B);
165
+ const Y = s[0], U = new FileReader();
166
+ U.readAsDataURL(Y), U.onload = async () => {
167
+ const B = await T(
168
+ {
169
+ file: U.result,
170
+ folderId: null,
171
+ name: Y.name
172
+ },
173
+ {
174
+ onSuccess: () => {
175
+ n("browse");
176
+ }
177
+ }
178
+ );
179
+ l(B);
173
180
  }, U.onerror = (B) => L(B);
174
181
  }),
175
182
  [T]
176
- ), { getRootProps: Z, getInputProps: J, isDragActive: ee } = Ue({
177
- onDrop: G,
183
+ ), { getRootProps: ee, getInputProps: se, isDragActive: te } = ze({
184
+ onDrop: O,
178
185
  accept: {
179
- "image/*": d.includes("image") ? [] : [],
180
- "video/*": d.includes("video") ? [] : []
186
+ "image/*": u.includes("image") ? [] : []
181
187
  },
182
188
  maxSize: 10 * 1024 * 1024
183
- }), se = () => {
184
- r([p[0].url]), t();
185
- }, ae = async (s) => {
186
- g(s);
187
- }, te = async () => {
188
- c && (await x(c.id), g(null));
189
- }, le = (s) => {
190
- v(s);
191
- }, ie = async (s, l) => {
192
- await D(Se(s, l)), t();
189
+ }), ae = () => {
190
+ console.log(
191
+ "selectedAssets",
192
+ d,
193
+ R(X(d), ["url", "width", "height", "description"])
194
+ ), d.length !== 0 && (r(
195
+ R(X(d), ["url", "width", "height", "description"])
196
+ ), a());
197
+ }, le = async (s) => {
198
+ p(s);
199
+ }, ie = async () => {
200
+ c && (await x(c.id), p(null));
193
201
  }, ne = (s) => {
194
- k(s.target.value);
202
+ v(s);
195
203
  }, re = async (s, l) => {
204
+ await D(Ce(s, R(l, ["id", "description"]))), a();
205
+ }, oe = (s) => {
206
+ I(s.target.value);
207
+ }, ce = async (s, l) => {
196
208
  try {
197
209
  l ? await T({
198
210
  file: s,
199
211
  folderId: null,
200
- name: m.name || ""
212
+ name: h.name || ""
201
213
  }) : await D({
202
- id: m.id || "",
214
+ id: h.id || "",
203
215
  file: s
204
216
  }), E({ show: !1, file: "" }), n("browse");
205
217
  } catch (L) {
206
218
  console.error("Error saving edited image:", L);
207
219
  }
208
220
  };
209
- return /* @__PURE__ */ a(Q, { children: [
210
- /* @__PURE__ */ a("div", { className: "min-w-[700px] min-h-[600px] w-[900px] max-w-[900px]", children: [
221
+ return /* @__PURE__ */ t(Q, { children: [
222
+ /* @__PURE__ */ t("div", { className: "min-w-[700px] min-h-[600px] w-[900px] max-w-[900px]", children: [
211
223
  /* @__PURE__ */ e("h1", { className: "text-lg font-medium pb-4", children: "Digital Asset Manager" }),
212
- /* @__PURE__ */ a(
213
- de,
224
+ /* @__PURE__ */ t(
225
+ me,
214
226
  {
215
- value: u,
227
+ value: m,
216
228
  onValueChange: (s) => n(s),
217
229
  className: "flex-1 flex flex-col h-full",
218
230
  children: [
219
- /* @__PURE__ */ a("div", { className: "flex justify-between items-center mb-2", children: [
220
- /* @__PURE__ */ a(ue, { children: [
221
- /* @__PURE__ */ e(H, { value: "browse", children: "Browse Assets" }),
222
- /* @__PURE__ */ e(H, { value: "upload", children: "Upload" })
231
+ /* @__PURE__ */ t("div", { className: "flex justify-between items-center mb-2", children: [
232
+ /* @__PURE__ */ t(he, { children: [
233
+ /* @__PURE__ */ e(V, { value: "browse", children: "Browse Assets" }),
234
+ /* @__PURE__ */ e(V, { value: "upload", children: "Upload" })
223
235
  ] }),
224
- /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
225
- p.length > 0 && /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e(
236
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
237
+ d.length > 0 && /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e(
226
238
  f,
227
239
  {
228
240
  variant: "outline",
@@ -236,27 +248,27 @@ function Xe({
236
248
  f,
237
249
  {
238
250
  size: "sm",
239
- onClick: se,
240
- disabled: p.length === 0,
251
+ onClick: ae,
252
+ disabled: d.length === 0,
241
253
  children: "Select Asset"
242
254
  }
243
255
  )
244
256
  ] })
245
257
  ] }),
246
- /* @__PURE__ */ a(V, { value: "browse", className: "flex-1 flex flex-col", children: [
247
- /* @__PURE__ */ e("div", { className: "flex items-center gap-2 mb-2", children: /* @__PURE__ */ a("div", { className: "relative w-full", children: [
248
- /* @__PURE__ */ e(be, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
258
+ /* @__PURE__ */ t(W, { value: "browse", className: "flex-1 flex flex-col", children: [
259
+ /* @__PURE__ */ e("div", { className: "flex items-center gap-2 mb-2", children: /* @__PURE__ */ t("div", { className: "relative w-full", children: [
260
+ /* @__PURE__ */ e(Ee, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
249
261
  /* @__PURE__ */ e(
250
- me,
262
+ ge,
251
263
  {
252
264
  placeholder: "Search assets...",
253
- value: I,
254
- onChange: ne,
265
+ value: M,
266
+ onChange: oe,
255
267
  className: "pl-8"
256
268
  }
257
269
  )
258
270
  ] }) }),
259
- P && w.length === 0 ? /* @__PURE__ */ a("div", { className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2 overflow-y-auto max-h-[550px] p-1", children: [
271
+ P && A.length === 0 ? /* @__PURE__ */ t("div", { className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2 overflow-y-auto max-h-[550px] p-1", children: [
260
272
  /* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
261
273
  /* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
262
274
  /* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
@@ -267,37 +279,37 @@ function Xe({
267
279
  /* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
268
280
  /* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
269
281
  /* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" })
270
- ] }) : w.length === 0 ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center justify-center h-full text-center p-12 h-[380px]", children: [
271
- /* @__PURE__ */ a("div", { className: "text-muted-foreground mb-2", children: [
282
+ ] }) : A.length === 0 ? /* @__PURE__ */ t("div", { className: "flex flex-col items-center justify-center text-center p-12 h-[380px]", children: [
283
+ /* @__PURE__ */ t("div", { className: "text-muted-foreground mb-2", children: [
272
284
  /* @__PURE__ */ e("h3", { className: "text-gray-800 font-medium", children: "No assets to display" }),
273
285
  /* @__PURE__ */ e("p", { className: "text-sm", children: "You haven't uploaded any assets yet. Start by uploading your first asset." })
274
286
  ] }),
275
287
  /* @__PURE__ */ e("div", { className: "flex gap-2 pt-4", children: /* @__PURE__ */ e(f, { size: "lg", onClick: () => n("upload"), children: "Upload Assets" }) })
276
- ] }) : /* @__PURE__ */ a(
288
+ ] }) : /* @__PURE__ */ t(
277
289
  "div",
278
290
  {
279
291
  ref: N,
280
292
  className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2 overflow-y-auto max-h-[550px] p-1",
281
293
  children: [
282
- w.map((s) => /* @__PURE__ */ e(
283
- he,
294
+ A.map((s) => /* @__PURE__ */ e(
295
+ pe,
284
296
  {
285
- className: $(
297
+ className: H(
286
298
  "cursor-pointer overflow-hidden transition-all",
287
- p.some((l) => l.id === s.id) ? "ring-2 ring-primary" : "hover:ring-2 hover:ring-primary/20"
299
+ d.some((l) => l.id === s.id) ? "ring-2 ring-primary" : "hover:ring-2 hover:ring-primary/20"
288
300
  ),
289
301
  onClick: () => j(s),
290
- children: /* @__PURE__ */ a(ge, { className: "p-0 relative group", children: [
291
- /* @__PURE__ */ a("div", { className: "aspect-square relative overflow-hidden bg-muted", children: [
302
+ children: /* @__PURE__ */ t(fe, { className: "p-0 relative group", children: [
303
+ /* @__PURE__ */ t("div", { className: "aspect-square relative overflow-hidden bg-muted", children: [
292
304
  s.type === "image" ? /* @__PURE__ */ e(
293
305
  "img",
294
306
  {
295
307
  src: s.thumbnailUrl || "/placeholder.svg",
296
308
  alt: s.name,
297
- className: "object-cover w-full h-full"
309
+ className: "object-cover w-full h-full min-h-[100px]"
298
310
  }
299
- ) : /* @__PURE__ */ a("div", { className: "flex items-center justify-center h-full", children: [
300
- /* @__PURE__ */ e(Ce, { className: "h-12 w-12 text-muted-foreground" }),
311
+ ) : /* @__PURE__ */ t("div", { className: "flex items-center justify-center h-full", children: [
312
+ /* @__PURE__ */ e(Te, { className: "h-12 w-12 text-muted-foreground" }),
301
313
  s.thumbnailUrl && /* @__PURE__ */ e(
302
314
  "img",
303
315
  {
@@ -307,7 +319,7 @@ function Xe({
307
319
  }
308
320
  )
309
321
  ] }),
310
- /* @__PURE__ */ a("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2", children: [
322
+ /* @__PURE__ */ t("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2", children: [
311
323
  /* @__PURE__ */ e(
312
324
  f,
313
325
  {
@@ -315,9 +327,9 @@ function Xe({
315
327
  size: "icon",
316
328
  className: "h-8 w-8",
317
329
  onClick: (l) => {
318
- l.stopPropagation(), le(s);
330
+ l.stopPropagation(), ne(s);
319
331
  },
320
- children: /* @__PURE__ */ e(Ee, { className: "h-4 w-4" })
332
+ children: /* @__PURE__ */ e(De, { className: "h-4 w-4" })
321
333
  }
322
334
  ),
323
335
  /* @__PURE__ */ e(
@@ -334,7 +346,7 @@ function Xe({
334
346
  name: s.name
335
347
  });
336
348
  },
337
- children: /* @__PURE__ */ e(Te, { className: "h-4 w-4" })
349
+ children: /* @__PURE__ */ e(Pe, { className: "h-4 w-4" })
338
350
  }
339
351
  ),
340
352
  /* @__PURE__ */ e(
@@ -344,17 +356,17 @@ function Xe({
344
356
  size: "icon",
345
357
  className: "h-8 w-8",
346
358
  onClick: (l) => {
347
- l.stopPropagation(), ae(s);
359
+ l.stopPropagation(), le(s);
348
360
  },
349
- children: /* @__PURE__ */ e(De, { className: "h-4 w-4" })
361
+ children: /* @__PURE__ */ e(Ue, { className: "h-4 w-4" })
350
362
  }
351
363
  )
352
364
  ] }),
353
- p.some((l) => l.id === s.id) && /* @__PURE__ */ e("div", { className: "absolute top-2 left-2", children: /* @__PURE__ */ e(
365
+ d.some((l) => l.id === s.id) && /* @__PURE__ */ e("div", { className: "absolute top-2 left-2", children: /* @__PURE__ */ e(
354
366
  "input",
355
367
  {
356
368
  type: "checkbox",
357
- checked: p.some(
369
+ checked: d.some(
358
370
  (l) => l.id === s.id
359
371
  ),
360
372
  readOnly: !0,
@@ -362,7 +374,7 @@ function Xe({
362
374
  }
363
375
  ) })
364
376
  ] }),
365
- /* @__PURE__ */ a("div", { className: "p-2", children: [
377
+ /* @__PURE__ */ t("div", { className: "p-2", children: [
366
378
  /* @__PURE__ */ e(
367
379
  "div",
368
380
  {
@@ -371,44 +383,44 @@ function Xe({
371
383
  children: s.name
372
384
  }
373
385
  ),
374
- /* @__PURE__ */ a("div", { className: "text-xs text-muted-foreground flex items-center justify-between", children: [
375
- /* @__PURE__ */ e("span", { children: Le((s == null ? void 0 : s.size) || 0) }),
376
- /* @__PURE__ */ e("span", { children: Be(s.createdAt) })
386
+ /* @__PURE__ */ t("div", { className: "text-xs text-muted-foreground flex items-center justify-between", children: [
387
+ /* @__PURE__ */ e("span", { children: Qe((s == null ? void 0 : s.size) || 0) }),
388
+ /* @__PURE__ */ e("span", { children: Re(s.createdAt) })
377
389
  ] })
378
390
  ] })
379
391
  ] })
380
392
  },
381
393
  s.id
382
394
  )),
383
- P && w.length > 0 && /* @__PURE__ */ e("div", { className: "col-span-full flex justify-center py-4", children: /* @__PURE__ */ e(W, { className: "h-6 w-6 animate-spin text-muted-foreground" }) })
395
+ P && A.length > 0 && /* @__PURE__ */ e("div", { className: "col-span-full flex justify-center py-4", children: /* @__PURE__ */ e(Z, { className: "h-6 w-6 animate-spin text-muted-foreground" }) })
384
396
  ]
385
397
  }
386
398
  )
387
399
  ] }),
388
- /* @__PURE__ */ e(V, { value: "upload", className: "flex-1 ", children: /* @__PURE__ */ a(
400
+ /* @__PURE__ */ e(W, { value: "upload", className: "flex-1 ", children: /* @__PURE__ */ t(
389
401
  "div",
390
402
  {
391
- ...Z(),
392
- className: $(
403
+ ...ee(),
404
+ className: H(
393
405
  "border-2 border-dashed rounded-lg h-[380px] flex flex-col items-center justify-center text-center cursor-pointer hover:bg-gray-50",
394
- ee ? "border-primary bg-primary/5" : "border-muted-foreground/20"
406
+ te ? "border-primary bg-primary/5" : "border-muted-foreground/20"
395
407
  ),
396
408
  children: [
397
- /* @__PURE__ */ e("input", { ...J() }),
398
- h || _ ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center", children: [
399
- /* @__PURE__ */ e(W, { className: "h-12 w-12 text-primary animate-spin mb-4" }),
409
+ /* @__PURE__ */ e("input", { ...se() }),
410
+ g || _ ? /* @__PURE__ */ t("div", { className: "flex flex-col items-center", children: [
411
+ /* @__PURE__ */ e(Z, { className: "h-12 w-12 text-primary animate-spin mb-4" }),
400
412
  /* @__PURE__ */ e("h3", { className: "text-lg font-medium mb-1", children: "Uploading files..." }),
401
413
  /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "Please wait while your files are being processed." })
402
- ] }) : /* @__PURE__ */ a(Q, { children: [
403
- /* @__PURE__ */ e(Pe, { className: "h-12 w-12 text-muted-foreground mb-4" }),
414
+ ] }) : /* @__PURE__ */ t(Q, { children: [
415
+ /* @__PURE__ */ e(Fe, { className: "h-12 w-12 text-muted-foreground mb-4" }),
404
416
  /* @__PURE__ */ e("h3", { className: "text-lg font-medium mb-1", children: "Drag & drop files here" }),
405
417
  /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground mb-4", children: "or click to browse your files" }),
406
- /* @__PURE__ */ a("div", { className: "text-xs text-muted-foreground", children: [
407
- /* @__PURE__ */ a("p", { children: [
418
+ /* @__PURE__ */ t("div", { className: "text-xs text-muted-foreground", children: [
419
+ /* @__PURE__ */ t("p", { children: [
408
420
  "Accepted file types: ",
409
- d.join(", ")
421
+ u.join(", ")
410
422
  ] }),
411
- /* @__PURE__ */ a("p", { children: [
423
+ /* @__PURE__ */ t("p", { children: [
412
424
  "Maximum file size: ",
413
425
  10,
414
426
  "MB"
@@ -422,54 +434,54 @@ function Xe({
422
434
  }
423
435
  )
424
436
  ] }),
425
- C && /* @__PURE__ */ e(Y, { fallback: /* @__PURE__ */ e("div", { children: "Loading..." }), children: /* @__PURE__ */ e(
426
- je,
437
+ C && /* @__PURE__ */ e($, { fallback: /* @__PURE__ */ e("div", { children: "Loading..." }), children: /* @__PURE__ */ e(
438
+ Le,
427
439
  {
428
440
  asset: C,
429
- onSave: (s) => ie(C, s),
441
+ onSave: (s) => re(C, s),
430
442
  onCancel: () => {
431
443
  v(null);
432
444
  }
433
445
  }
434
446
  ) }),
435
- m.show && /* @__PURE__ */ e(Y, { fallback: /* @__PURE__ */ e("div", { children: "Loading..." }), children: /* @__PURE__ */ e(
436
- _e,
447
+ h.show && /* @__PURE__ */ e($, { fallback: /* @__PURE__ */ e("div", { children: "Loading..." }), children: /* @__PURE__ */ e(
448
+ Be,
437
449
  {
438
- imageUrl: m.file,
439
- onSave: re,
450
+ imageUrl: h.file,
451
+ onSave: ce,
440
452
  onClose: () => E({ show: !1, file: "" }),
441
- defaultSavedImageName: m.name,
442
- isEditing: !!m.id
453
+ defaultSavedImageName: h.name,
454
+ isEditing: !!h.id
443
455
  }
444
456
  ) }),
445
457
  c && /* @__PURE__ */ e(
446
- pe,
458
+ ye,
447
459
  {
448
460
  open: !!c,
449
- onOpenChange: () => g(null),
450
- children: /* @__PURE__ */ a(fe, { children: [
451
- /* @__PURE__ */ a(ye, { children: [
452
- /* @__PURE__ */ e(ve, { children: "Delete Asset" }),
453
- /* @__PURE__ */ a(xe, { children: [
461
+ onOpenChange: () => p(null),
462
+ children: /* @__PURE__ */ t(ve, { children: [
463
+ /* @__PURE__ */ t(xe, { children: [
464
+ /* @__PURE__ */ e(Ne, { children: "Delete Asset" }),
465
+ /* @__PURE__ */ t(we, { children: [
454
466
  'Are you sure you want to delete "',
455
467
  c.name,
456
468
  '"? This action cannot be undone.'
457
469
  ] })
458
470
  ] }),
459
- /* @__PURE__ */ a(Ne, { className: "gap-2 sm:gap-0", children: [
460
- /* @__PURE__ */ e(f, { variant: "outline", onClick: () => g(null), children: "Cancel" }),
461
- /* @__PURE__ */ e(f, { variant: "destructive", onClick: te, children: "Delete" })
471
+ /* @__PURE__ */ t(Ae, { className: "gap-2 sm:gap-0", children: [
472
+ /* @__PURE__ */ e(f, { variant: "outline", onClick: () => p(null), children: "Cancel" }),
473
+ /* @__PURE__ */ e(f, { variant: "destructive", onClick: ie, children: "Delete" })
462
474
  ] })
463
475
  ] })
464
476
  }
465
477
  )
466
478
  ] });
467
479
  }
468
- function Le(t) {
469
- return t < 1024 ? `${t.toFixed(2)} KB` : `${(t / 1024).toFixed(2)} MB`;
480
+ function Qe(a) {
481
+ return a < 1024 ? `${a.toFixed(2)} B` : a < 1024 * 1024 ? `${(a / 1024).toFixed(2)} KB` : `${(a / (1024 * 1024)).toFixed(2)} MB`;
470
482
  }
471
- function Be(t) {
472
- const r = new Date(t);
483
+ function Re(a) {
484
+ const r = new Date(a);
473
485
  return new Intl.DateTimeFormat("en-US", {
474
486
  month: "short",
475
487
  day: "numeric",
@@ -477,5 +489,5 @@ function Be(t) {
477
489
  }).format(r);
478
490
  }
479
491
  export {
480
- Xe as default
492
+ Je as default
481
493
  };