@chaibuilder/pages 0.5.2 → 0.5.3-rc.2

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,140 +1,140 @@
1
- import { jsx as e, jsxs as i, Fragment as I } from "react/jsx-runtime";
2
- import ie, { useState as f, useMemo as we, useEffect as G, useCallback as D, Suspense as Ae } from "react";
1
+ import { jsx as e, jsxs as i, Fragment as F } from "react/jsx-runtime";
2
+ import ie, { useState as f, useMemo as Ae, useEffect as R, useCallback as k, Suspense as Se } from "react";
3
3
  import { mergeClasses as ae } from "@chaibuilder/sdk";
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
- import { useDropzone as Je } from "react-dropzone";
8
- import { useQueryClient as R, useMutation as W, useQuery as le } from "@tanstack/react-query";
4
+ import { Button as h, Label as M, Textarea as Ce, Input as Ee, Dialog as Te, DialogContent as ke, DialogHeader as ze, DialogTitle as De, DialogDescription as Pe, DialogFooter as je, Switch as Ie, TooltipProvider as Fe, Tooltip as Ue, TooltipTrigger as $e, TooltipContent as _e } from "@chaibuilder/sdk/ui";
5
+ import { find as Be, merge as qe, pick as Le, first as Me } from "lodash-es";
6
+ import { Loader as U, AlertCircle as Oe, ChevronLeft as Ke, Pencil as Qe, Search as Ge, Archive as Re, Film as We, ImageIcon as Ve, Edit as Ye, Trash2 as He, Check as Xe, Upload as Ze, AlertTriangle as Je } from "lucide-react";
7
+ import { useDropzone as et } from "react-dropzone";
8
+ import { useQueryClient as W, useMutation as V, useQuery as le } from "@tanstack/react-query";
9
9
  import { toast as j } from "sonner";
10
- import { W as U, X as $, Y as y, Z as _ } from "./index-TNPTcXFM.js";
11
- const et = () => {
12
- const n = U(), r = R(), s = $();
13
- return W({
10
+ import { W as $, X as _, Y as N, Z as B } from "./index-C92l-a7n.js";
11
+ const tt = () => {
12
+ const n = $(), l = W(), c = _();
13
+ return V({
14
14
  mutationFn: async ({
15
15
  file: a,
16
- folderId: d,
17
- name: l,
18
- optimize: g = !0
19
- }) => s(n, {
20
- action: y.UPLOAD_ASSET,
21
- data: { file: a, folderId: d, name: l, optimize: g }
16
+ folderId: m,
17
+ name: r,
18
+ optimize: d = !0
19
+ }) => c(n, {
20
+ action: N.UPLOAD_ASSET,
21
+ data: { file: a, folderId: m, name: r, optimize: d }
22
22
  }),
23
23
  onSuccess: (a) => {
24
24
  if (a != null && a.error)
25
25
  throw new Error(a == null ? void 0 : a.error);
26
- r.invalidateQueries({
27
- queryKey: [_, y.GET_ASSETS]
26
+ l.invalidateQueries({
27
+ queryKey: [B, N.GET_ASSETS]
28
28
  }), j.success("Asset uploaded successfully");
29
29
  },
30
30
  onError: () => {
31
31
  j.error("Failed to upload asset");
32
32
  }
33
33
  });
34
- }, tt = () => {
35
- const n = U(), r = R(), s = $();
36
- return W({
37
- mutationFn: async (a) => s(n, {
38
- action: y.DELETE_ASSET,
34
+ }, it = () => {
35
+ const n = $(), l = W(), c = _();
36
+ return V({
37
+ mutationFn: async (a) => c(n, {
38
+ action: N.DELETE_ASSET,
39
39
  data: { id: a }
40
40
  }),
41
41
  onSuccess: (a) => {
42
42
  if (a != null && a.error)
43
43
  throw new Error(a == null ? void 0 : a.error);
44
- r.invalidateQueries({
45
- queryKey: [_, y.GET_ASSETS]
44
+ l.invalidateQueries({
45
+ queryKey: [B, N.GET_ASSETS]
46
46
  }), j.success("Asset deleted successfully");
47
47
  },
48
48
  onError: () => {
49
49
  j.error("Failed to delete asset");
50
50
  }
51
51
  });
52
- }, it = () => {
53
- const n = U(), r = R(), s = $();
54
- return W({
55
- mutationFn: async (a) => s(n, {
56
- action: y.UPDATE_ASSET,
52
+ }, at = () => {
53
+ const n = $(), l = W(), c = _();
54
+ return V({
55
+ mutationFn: async (a) => c(n, {
56
+ action: N.UPDATE_ASSET,
57
57
  data: a
58
58
  }),
59
59
  onSuccess: (a) => {
60
60
  if (a != null && a.error)
61
61
  throw new Error(a == null ? void 0 : a.error);
62
- r.invalidateQueries({
63
- queryKey: [_, y.GET_ASSETS]
62
+ l.invalidateQueries({
63
+ queryKey: [B, N.GET_ASSETS]
64
64
  }), j.success("Asset updated successfully");
65
65
  },
66
66
  onError: () => {
67
67
  j.error("Failed to update asset");
68
68
  }
69
69
  });
70
- }, at = (n = {}) => {
71
- const r = U(), s = $(), { search: a, page: d = 1, limit: l = 30 } = n;
70
+ }, lt = (n = {}) => {
71
+ const l = $(), c = _(), { search: a, page: m = 1, limit: r = 30 } = n;
72
72
  return le({
73
- queryKey: [_, y.GET_ASSETS, a, d, l],
73
+ queryKey: [B, N.GET_ASSETS, a, m, r],
74
74
  queryFn: async () => {
75
- const g = await s(r, {
76
- action: y.GET_ASSETS,
75
+ const d = await c(l, {
76
+ action: N.GET_ASSETS,
77
77
  data: {
78
78
  search: a,
79
- page: d,
80
- limit: l
79
+ page: m,
80
+ limit: r
81
81
  }
82
82
  });
83
- return g.page = d, g.limit = l, g;
83
+ return d.page = m, d.limit = r, d;
84
84
  },
85
85
  staleTime: 1e3 * 60 * 5,
86
86
  retry: 1
87
87
  });
88
- }, lt = (n) => {
89
- const r = U(), s = $();
88
+ }, rt = (n) => {
89
+ const l = $(), c = _();
90
90
  return le({
91
- queryKey: [_, y.GET_ASSET, n],
92
- queryFn: async () => n ? await s(r, {
93
- action: y.GET_ASSET,
91
+ queryKey: [B, N.GET_ASSET, n],
92
+ queryFn: async () => n ? await c(l, {
93
+ action: N.GET_ASSET,
94
94
  data: { id: n }
95
95
  }) : null,
96
96
  staleTime: 1e3 * 60 * 5,
97
97
  retry: 1
98
98
  });
99
99
  };
100
- function rt(n) {
101
- const r = isNaN(n) ? 0 : typeof n == "number" ? n : parseInt(n);
102
- return r ? r < 1024 ? `${r.toFixed(2)} B` : r < 1024 * 1024 ? `${(r / 1024).toFixed(2)} KB` : `${(r / (1024 * 1024)).toFixed(2)} MB` : "0 B";
100
+ function nt(n) {
101
+ const l = isNaN(n) ? 0 : typeof n == "number" ? n : parseInt(n);
102
+ return l ? l < 1024 ? `${l.toFixed(2)} B` : l < 1024 * 1024 ? `${(l / 1024).toFixed(2)} KB` : `${(l / (1024 * 1024)).toFixed(2)} MB` : "0 B";
103
103
  }
104
104
  function ee(n) {
105
105
  if (!n) return "N/A";
106
- const r = new Date(n);
106
+ const l = new Date(n);
107
107
  return new Intl.DateTimeFormat("en-US", {
108
108
  month: "short",
109
109
  day: "numeric",
110
110
  year: "numeric",
111
111
  hour: "2-digit",
112
112
  minute: "2-digit"
113
- }).format(r);
113
+ }).format(l);
114
114
  }
115
- function te(n, r) {
116
- let s = n, a = r == null ? void 0 : r.description;
117
- return (!a || typeof a != "string") && (a = ""), (!s || typeof s != "string") && (s = ""), s !== a;
115
+ function te(n, l) {
116
+ let c = n, a = l == null ? void 0 : l.description;
117
+ return (!a || typeof a != "string") && (a = ""), (!c || typeof c != "string") && (c = ""), c !== a;
118
118
  }
119
- const nt = ({
119
+ const st = ({
120
120
  assetId: n,
121
- onBack: r,
122
- onEdit: s,
121
+ onBack: l,
122
+ onEdit: c,
123
123
  onSave: a,
124
- isSaving: d
124
+ isSaving: m
125
125
  }) => {
126
- var N, C, h;
127
- const { data: l, isLoading: g, isError: p } = lt(n || ""), [v, m] = f("");
126
+ var x, C, E;
127
+ const { data: r, isLoading: d, isError: y } = rt(n || ""), [g, u] = f("");
128
128
  return ie.useEffect(() => {
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" }) }) : 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" }) }),
129
+ r != null && r.description && u(r.description);
130
+ }, [r]), d ? /* @__PURE__ */ e("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ e(U, { className: "h-8 w-8 animate-spin" }) }) : y || !(r != null && r.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(Oe, { 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: 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." }),
133
+ /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 mb-6", children: y ? "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
- /* @__PURE__ */ e(u, { variant: "outline", onClick: r, children: "Back to Assets" }),
136
- p && /* @__PURE__ */ e(
137
- u,
135
+ /* @__PURE__ */ e(h, { variant: "outline", onClick: l, children: "Back to Assets" }),
136
+ y && /* @__PURE__ */ e(
137
+ h,
138
138
  {
139
139
  variant: "default",
140
140
  onClick: () => window.location.reload(),
@@ -145,28 +145,28 @@ const nt = ({
145
145
  ] }) }) : /* @__PURE__ */ i("div", { className: "flex-1 flex flex-col gap-y-4 overflow-hidden", children: [
146
146
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
147
147
  /* @__PURE__ */ i(
148
- u,
148
+ h,
149
149
  {
150
150
  variant: "outline",
151
151
  size: "sm",
152
- onClick: r,
153
- disabled: d,
152
+ onClick: l,
153
+ disabled: m,
154
154
  children: [
155
- /* @__PURE__ */ e(Oe, { className: "h-4 w-4" }),
155
+ /* @__PURE__ */ e(Ke, { className: "h-4 w-4" }),
156
156
  "Back to Assets"
157
157
  ]
158
158
  }
159
159
  ),
160
160
  /* @__PURE__ */ i("div", { className: "flex gap-2", children: [
161
- /* @__PURE__ */ e(u, { variant: "outline", onClick: r, disabled: d, children: "Cancel" }),
161
+ /* @__PURE__ */ e(h, { variant: "outline", onClick: l, disabled: m, children: "Cancel" }),
162
162
  /* @__PURE__ */ i(
163
- u,
163
+ h,
164
164
  {
165
165
  variant: "default",
166
- onClick: () => s(l),
167
- disabled: d,
166
+ onClick: () => c(r),
167
+ disabled: m,
168
168
  children: [
169
- /* @__PURE__ */ e(Ke, { className: "h-4 w-4" }),
169
+ /* @__PURE__ */ e(Qe, { className: "h-4 w-4" }),
170
170
  "Edit Image"
171
171
  ]
172
172
  }
@@ -177,74 +177,74 @@ const nt = ({
177
177
  /* @__PURE__ */ e("div", { className: "relative h-[calc(80vh-200px)] w-full flex items-start justify-center", children: /* @__PURE__ */ e(
178
178
  "img",
179
179
  {
180
- src: `${l.url}?v=${((N = l.metadata) == null ? void 0 : N.updatedAt) || l.createdAt}`,
181
- alt: l.name,
180
+ src: `${r.url}?v=${((x = r.metadata) == null ? void 0 : x.updatedAt) || r.createdAt}`,
181
+ alt: r.name,
182
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(L, { className: "w-full text-center", children: "Details" }),
187
+ /* @__PURE__ */ e(M, { 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
- { label: "File Name", value: l.name },
190
- { label: "Type", value: l.type, capitalize: !0 },
189
+ { label: "File Name", value: r.name },
190
+ { label: "Type", value: r.type, capitalize: !0 },
191
191
  {
192
192
  label: "Format",
193
- value: ((C = l.metadata) == null ? void 0 : C.format) || l.type,
193
+ value: ((C = r.metadata) == null ? void 0 : C.format) || r.type,
194
194
  capitalize: !0
195
195
  },
196
196
  {
197
197
  label: "Size",
198
- value: rt(l.size)
198
+ value: nt(r.size)
199
199
  },
200
200
  {
201
201
  label: "Dimensions",
202
- value: `${l.width || 0} × ${l.height || 0}`
202
+ value: `${r.width || 0} × ${r.height || 0}`
203
203
  },
204
204
  {
205
205
  label: "Created",
206
- value: ee(l.createdAt)
206
+ value: ee(r.createdAt)
207
207
  },
208
208
  {
209
209
  label: "Updated",
210
210
  value: ee(
211
- ((h = l.metadata) == null ? void 0 : h.updatedAt) || l.createdAt
211
+ ((E = r.metadata) == null ? void 0 : E.updatedAt) || r.createdAt
212
212
  )
213
213
  }
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 }),
214
+ ].map((s) => /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
215
+ /* @__PURE__ */ e(M, { className: "w-max text-left px-2 w-1/4 font-normal text-gray-700", children: s.label }),
216
216
  ":",
217
217
  /* @__PURE__ */ e(
218
218
  "div",
219
219
  {
220
- className: "w-max text-left font-medium text-gray-900" + o.capitalize ? " capitalize" : "",
221
- children: o.value
220
+ className: "w-max text-left font-medium text-gray-900" + s.capitalize ? " capitalize" : "",
221
+ children: s.value
222
222
  }
223
223
  )
224
- ] }, o.label)) })
224
+ ] }, s.label)) })
225
225
  ] }),
226
- l.usedOn && l.usedOn.length > 0 && /* @__PURE__ */ i("div", { className: "grid gap-3", children: [
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 }),
226
+ r.usedOn && r.usedOn.length > 0 && /* @__PURE__ */ i("div", { className: "grid gap-3", children: [
227
+ /* @__PURE__ */ e(M, { children: "Used On" }),
228
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-2 text-sm border rounded-md p-2", children: r.usedOn.map((s, 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: s.name }),
230
230
  /* @__PURE__ */ i("div", { className: "text-gray-500", children: [
231
231
  "(",
232
- o.slug,
232
+ s.slug,
233
233
  ")"
234
234
  ] })
235
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(L, { className: "w-full text-center", children: "Description" }),
238
+ /* @__PURE__ */ e(M, { className: "w-full text-center", children: "Description" }),
239
239
  /* @__PURE__ */ e(
240
- Se,
240
+ Ce,
241
241
  {
242
242
  id: "description",
243
- value: v,
243
+ value: g,
244
244
  placeholder: "Enter a description for the asset",
245
- onChange: (o) => m(o.target.value),
245
+ onChange: (s) => u(s.target.value),
246
246
  rows: 3,
247
- disabled: d,
247
+ disabled: m,
248
248
  className: "hover:border-black/40 bg-white"
249
249
  }
250
250
  ),
@@ -252,11 +252,11 @@ const nt = ({
252
252
  "button",
253
253
  {
254
254
  type: "button",
255
- onClick: () => a(v),
256
- disabled: d || !te(v, l),
257
- className: `py-0 bg-blue-500 text-white px-3 py-0.5 rounded-md text-sm ${d || !te(v, l) ? "opacity-50 cursor-not-allowed" : ""}`,
258
- children: d ? /* @__PURE__ */ i(I, { children: [
259
- /* @__PURE__ */ e(F, { className: "h-4 w-4 mr-2 animate-spin" }),
255
+ onClick: () => a(g),
256
+ disabled: m || !te(g, r),
257
+ className: `py-0 bg-blue-500 text-white px-3 py-0.5 rounded-md text-sm ${m || !te(g, r) ? "opacity-50 cursor-not-allowed" : ""}`,
258
+ children: m ? /* @__PURE__ */ i(F, { children: [
259
+ /* @__PURE__ */ e(U, { className: "h-4 w-4 mr-2 animate-spin" }),
260
260
  "Saving..."
261
261
  ] }) : "Save"
262
262
  }
@@ -265,63 +265,73 @@ const nt = ({
265
265
  ] })
266
266
  ] })
267
267
  ] });
268
- }, st = ie.lazy(() => import("./image-editor-CzFST20j.js"));
269
- function ct(n) {
270
- const r = isNaN(n) ? 0 : typeof n == "number" ? n : parseInt(n);
271
- return r ? r < 1024 ? `${r.toFixed(2)} B` : r < 1024 * 1024 ? `${(r / 1024).toFixed(2)} KB` : `${(r / (1024 * 1024)).toFixed(2)} MB` : "0 B";
268
+ }, ct = ie.lazy(() => import("./image-editor-CzFST20j.js"));
269
+ function ot(n) {
270
+ const l = isNaN(n) ? 0 : typeof n == "number" ? n : parseInt(n);
271
+ return l ? l < 1024 ? `${l.toFixed(2)} B` : l < 1024 * 1024 ? `${(l / 1024).toFixed(2)} KB` : `${(l / (1024 * 1024)).toFixed(2)} MB` : "0 B";
272
272
  }
273
- const ot = ({
273
+ const dt = ({
274
274
  isUpdatingAsset: n,
275
- allowedTypes: r,
276
- maxFileSize: s,
275
+ allowedTypes: l,
276
+ maxFileSize: c,
277
277
  uploadAsset: a,
278
- isUploadingAsset: d
278
+ isUploadingAsset: m,
279
+ onUploaded: r
279
280
  }) => {
280
- const [l, g] = f(() => {
281
- const h = localStorage.getItem("chai_optimize_images");
282
- return h !== null ? h === "true" : !0;
281
+ const [d, y] = f(() => {
282
+ const s = localStorage.getItem("chai_optimize_images");
283
+ return s !== null ? s === "true" : !0;
283
284
  });
284
- G(() => {
285
- localStorage.setItem("chai_optimize_images", l.toString());
286
- }, [l]);
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
- folderId: void 0,
294
- name: B.name,
295
- optimize: l
296
- });
297
- o(P);
298
- }, E.onerror = (P) => b(P);
285
+ R(() => {
286
+ localStorage.setItem("chai_optimize_images", d.toString());
287
+ }, [d]);
288
+ const g = n || m, u = k(
289
+ async (s) => new Promise((b, q) => {
290
+ const I = s[0], z = new FileReader();
291
+ z.readAsDataURL(I), z.onload = async () => {
292
+ a(
293
+ {
294
+ file: z.result,
295
+ folderId: void 0,
296
+ name: I.name,
297
+ optimize: d
298
+ },
299
+ {
300
+ onSuccess: (v) => {
301
+ r && r(v), b(v);
302
+ },
303
+ onError: (v) => {
304
+ q(v);
305
+ }
306
+ }
307
+ );
308
+ }, z.onerror = (v) => q(v);
299
309
  }),
300
- [a, l]
301
- ), { getRootProps: m, getInputProps: N, isDragActive: C } = Je({
302
- onDrop: v,
310
+ [a, d]
311
+ ), { getRootProps: x, getInputProps: C, isDragActive: E } = et({
312
+ onDrop: u,
303
313
  accept: {
304
- "image/*": r.includes("image") ? [] : []
314
+ "image/*": l.includes("image") ? [] : []
305
315
  },
306
- maxSize: s * 1024 * 1024,
307
- disabled: n || d
316
+ maxSize: c * 1024 * 1024,
317
+ disabled: n || m
308
318
  });
309
319
  return /* @__PURE__ */ e(
310
320
  "div",
311
321
  {
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"}`,
322
+ 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] ${g ? "opacity-90 bg-gray-100 pointer-events-none" : "hover:border-black/50 bg-gray-100 hover:bg-gray-100"}`,
313
323
  children: /* @__PURE__ */ i(
314
324
  "div",
315
325
  {
316
- ...m(),
326
+ ...x(),
317
327
  className: ae(
318
328
  "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"
329
+ g ? "items-start" : "items-center",
330
+ E ? "border-primary bg-primary/5" : "border-muted-foreground/20"
321
331
  ),
322
332
  children: [
323
- /* @__PURE__ */ e("input", { ...N() }),
324
- p ? /* @__PURE__ */ e("div", { className: "flex flex-col items-center px-6", children: /* @__PURE__ */ i(
333
+ /* @__PURE__ */ e("input", { ...C() }),
334
+ g ? /* @__PURE__ */ e("div", { className: "flex flex-col items-center px-6", children: /* @__PURE__ */ i(
325
335
  "div",
326
336
  {
327
337
  className: "leading-tight flex items-center justify-center gap-2",
@@ -330,7 +340,7 @@ const ot = ({
330
340
  "div",
331
341
  {
332
342
  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" })
343
+ children: /* @__PURE__ */ e(U, { className: "h-4 w-4 text-indigo-500 animate-spin" })
334
344
  }
335
345
  ),
336
346
  /* @__PURE__ */ i("div", { className: "text-left", children: [
@@ -354,7 +364,7 @@ const ot = ({
354
364
  "div",
355
365
  {
356
366
  className: "flex items-center justify-center rounded-full bg-indigo-100 p-2 border border-indigo-500",
357
- children: /* @__PURE__ */ e(Xe, { className: "h-4 w-4 text-indigo-500" })
367
+ children: /* @__PURE__ */ e(Ze, { className: "h-4 w-4 text-indigo-500" })
358
368
  }
359
369
  ),
360
370
  /* @__PURE__ */ i("div", { className: "text-left", children: [
@@ -367,14 +377,14 @@ const ot = ({
367
377
  /* @__PURE__ */ i("span", { className: "", children: [
368
378
  "Accepted file types:",
369
379
  " ",
370
- /* @__PURE__ */ e("span", { className: "capitalize text-indigo-400", children: r.join(", ") }),
380
+ /* @__PURE__ */ e("span", { className: "capitalize text-indigo-400", children: l.join(", ") }),
371
381
  " & "
372
382
  ] }),
373
383
  /* @__PURE__ */ i("span", { children: [
374
384
  "Max file size:",
375
385
  " ",
376
386
  /* @__PURE__ */ i("span", { className: "capitalize text-indigo-400", children: [
377
- s,
387
+ c,
378
388
  " MB"
379
389
  ] })
380
390
  ] })
@@ -391,34 +401,34 @@ const ot = ({
391
401
  /* @__PURE__ */ e(
392
402
  "span",
393
403
  {
394
- className: l ? "text-indigo-600" : "text-gray-400",
395
- children: l ? "On" : "Off"
404
+ className: d ? "text-indigo-600" : "text-gray-400",
405
+ children: d ? "On" : "Off"
396
406
  }
397
407
  )
398
408
  ] }),
399
409
  /* @__PURE__ */ e(
400
- Pe,
410
+ Ie,
401
411
  {
402
- checked: l,
403
- onCheckedChange: (h) => {
404
- g(h);
412
+ checked: d,
413
+ onCheckedChange: (s) => {
414
+ y(s);
405
415
  },
406
- onClick: (h) => {
407
- h.stopPropagation();
416
+ onClick: (s) => {
417
+ s.stopPropagation();
408
418
  },
409
419
  className: "data-[state=checked]:bg-indigo-500"
410
420
  }
411
421
  )
412
422
  ] }),
413
- /* @__PURE__ */ e(Ie, { children: /* @__PURE__ */ i(Fe, { children: [
414
- /* @__PURE__ */ e(Ue, { asChild: !0, children: /* @__PURE__ */ e(
423
+ /* @__PURE__ */ e(Fe, { children: /* @__PURE__ */ i(Ue, { children: [
424
+ /* @__PURE__ */ e($e, { asChild: !0, children: /* @__PURE__ */ e(
415
425
  "span",
416
426
  {
417
- className: `text-amber-500 flex items-center cursor-help ${l ? "invisible" : ""}`,
418
- children: /* @__PURE__ */ e(Ze, { className: "h-4 w-4 mr-1" })
427
+ className: `text-amber-500 flex items-center cursor-help ${d ? "invisible" : ""}`,
428
+ children: /* @__PURE__ */ e(Je, { className: "h-4 w-4 mr-1" })
419
429
  }
420
430
  ) }),
421
- /* @__PURE__ */ e($e, { side: "top", children: /* @__PURE__ */ i("p", { className: "text-white text-xs", children: [
431
+ /* @__PURE__ */ e(_e, { side: "top", children: /* @__PURE__ */ i("p", { className: "text-white text-xs", children: [
422
432
  "Warning: Unoptimized images may affect ",
423
433
  /* @__PURE__ */ e("br", {}),
424
434
  " performance and page load times"
@@ -432,48 +442,48 @@ const ot = ({
432
442
  }
433
443
  );
434
444
  };
435
- function yt({
445
+ function bt({
436
446
  close: n,
437
- onSelect: r,
438
- mode: s = "image",
447
+ onSelect: l,
448
+ mode: c = "image",
439
449
  assetId: a
440
450
  }) {
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(
451
+ const d = Ae(() => [c], [c]), [y, g] = f(null), [u, x] = f(null), [C, E] = f(null), [s, b] = f({ show: !1, file: "" }), [q, I] = f(!1), [z, v] = f(
442
452
  a ? "details" : "grid"
443
- ), [O, re] = f(""), [q, ne] = f(""), [w, V] = f(1), [Y] = f(30), [A, H] = f([]);
444
- G(() => {
445
- a && (v(a), M("details"));
446
- }, [a]), G(() => {
453
+ ), [O, re] = f(""), [L, ne] = f(""), [w, Y] = f(1), [H] = f(30), [A, K] = f([]);
454
+ R(() => {
455
+ a && (g(a), v("details"));
456
+ }, [a]), R(() => {
447
457
  const t = setTimeout(() => {
448
- re(q), V(1);
458
+ re(L), Y(1);
449
459
  }, 300);
450
460
  return () => clearTimeout(t);
451
- }, [q]);
452
- const { data: k, isLoading: X } = at({
461
+ }, [L]);
462
+ const { data: D, isLoading: X } = lt({
453
463
  search: O.toLowerCase().trim(),
454
464
  page: w,
455
- limit: Y
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(
465
+ limit: H
466
+ }), T = (D == null ? void 0 : D.assets) || [], se = (D == null ? void 0 : D.total) || 0, S = Math.ceil(se / H), Q = w < S, G = w > 1, ce = (T == null ? void 0 : T.length) > 0, { mutate: oe } = it(), { mutate: Z, isPending: de } = tt(), { mutate: J, isPending: me } = at(), P = k(
457
467
  (t) => {
458
- t >= 1 && t <= S && V(t);
468
+ t >= 1 && t <= S && Y(t);
459
469
  },
460
470
  [S]
461
- ), ue = D(() => {
462
- K && z(w + 1);
463
- }, [w, K, z]), he = D(() => {
464
- Q && z(w - 1);
465
- }, [w, Q, z]), fe = (t) => {
471
+ ), ue = k(() => {
472
+ Q && P(w + 1);
473
+ }, [w, Q, P]), he = k(() => {
474
+ G && P(w - 1);
475
+ }, [w, G, P]), fe = (t) => {
466
476
  ne(t.target.value);
467
- }, ge = D(
477
+ }, ge = k(
468
478
  (t) => {
469
- H((c) => _e(c, { id: t.id }) ? [] : [t]);
479
+ K((o) => Be(o, { id: t.id }) ? [] : [t]);
470
480
  },
471
481
  [!1]
472
- ), pe = D(() => {
473
- H([]);
482
+ ), pe = k(() => {
483
+ K([]);
474
484
  }, []), xe = () => {
475
- A.length !== 0 && (r(
476
- qe(Le(A), [
485
+ A.length !== 0 && (l(
486
+ Le(Me(A), [
477
487
  "id",
478
488
  "url",
479
489
  "width",
@@ -482,71 +492,74 @@ function yt({
482
492
  ])
483
493
  ), n());
484
494
  }, ve = async (t) => {
485
- N(t);
495
+ x(t);
486
496
  }, Ne = async () => {
487
- m && (h(m == null ? void 0 : m.id), await oe(m.id, {
497
+ u && (E(u == null ? void 0 : u.id), await oe(u.id, {
488
498
  onSuccess: () => {
489
- h(null), N(null);
499
+ E(null), x(null);
490
500
  },
491
501
  onError: () => {
492
- h(null);
502
+ E(null);
493
503
  }
494
- }), N(null));
504
+ }), x(null));
495
505
  }, ye = (t) => {
496
- v(t.id), M("details");
497
- }, be = async (t, c) => {
506
+ g(t.id), v("details");
507
+ }, be = async (t, o) => {
498
508
  try {
499
- const x = localStorage.getItem("chai_optimize_images") !== "false";
500
- c ? (await Z({
509
+ const p = localStorage.getItem("chai_optimize_images") !== "false";
510
+ o ? (await Z({
501
511
  file: t,
502
512
  folderId: void 0,
503
- name: o.name || "",
504
- optimize: x
513
+ name: s.name || "",
514
+ optimize: p
505
515
  }), b({ show: !1, file: "" })) : (await J({
506
- id: o.id || "",
516
+ id: s.id || "",
507
517
  file: t
508
518
  }), b({ show: !1, file: "" }));
509
- } catch (x) {
510
- console.error("Error saving edited image:", x);
519
+ } catch (p) {
520
+ console.error("Error saving edited image:", p);
511
521
  }
512
- };
513
- return /* @__PURE__ */ i(I, { children: [
522
+ }, we = k((t) => {
523
+ K([t]);
524
+ }, []);
525
+ return /* @__PURE__ */ i(F, { children: [
514
526
  /* @__PURE__ */ i("div", { className: "max-w-[1232px] max-h-[1232px] w-[80vw] h-[80vh] space-y-4 flex flex-col", children: [
515
527
  /* @__PURE__ */ e("h1", { className: "text-lg font-medium", children: "Digital Asset Manager" }),
516
- P === "grid" ? /* @__PURE__ */ i(I, { children: [
528
+ z === "grid" ? /* @__PURE__ */ i(F, { children: [
517
529
  /* @__PURE__ */ e(
518
- ot,
530
+ dt,
519
531
  {
520
532
  maxFileSize: 10,
521
- allowedTypes: g,
533
+ allowedTypes: d,
522
534
  uploadAsset: Z,
523
535
  isUpdatingAsset: me,
524
- isUploadingAsset: de
536
+ isUploadingAsset: de,
537
+ onUploaded: we
525
538
  }
526
539
  ),
527
540
  /* @__PURE__ */ i("div", { className: "border p-2 rounded-lg flex-1 flex flex-col gap-y-3 overflow-hidden relative", children: [
528
541
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-3", children: [
529
542
  /* @__PURE__ */ i("div", { className: "relative w-1/2 ", children: [
530
543
  /* @__PURE__ */ e(
531
- Qe,
544
+ Ge,
532
545
  {
533
546
  strokeWidth: 3,
534
- className: `absolute left-2 top-2.5 h-4 w-4 text-muted-foreground ${q.length > 0 ? "text-indigo-800" : ""}`
547
+ className: `absolute left-2 top-2.5 h-4 w-4 text-muted-foreground ${L.length > 0 ? "text-indigo-800" : ""}`
535
548
  }
536
549
  ),
537
550
  /* @__PURE__ */ e(
538
- Ce,
551
+ Ee,
539
552
  {
540
553
  placeholder: "Search assets...",
541
554
  onChange: fe,
542
- value: q,
555
+ value: L,
543
556
  className: "pl-8"
544
557
  }
545
558
  )
546
559
  ] }),
547
560
  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(
549
- u,
561
+ A.length > 0 && /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(
562
+ h,
550
563
  {
551
564
  variant: "outline",
552
565
  size: "sm",
@@ -556,7 +569,7 @@ function yt({
556
569
  }
557
570
  ) }),
558
571
  /* @__PURE__ */ e(
559
- u,
572
+ h,
560
573
  {
561
574
  size: "sm",
562
575
  onClick: xe,
@@ -578,7 +591,7 @@ function yt({
578
591
  /* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
579
592
  /* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" })
580
593
  ] }) : !X && !ce ? /* @__PURE__ */ i("div", { className: "flex flex-col items-center justify-center h-full border rounded-lg", children: [
581
- /* @__PURE__ */ e("div", { className: "text-muted-foreground", children: /* @__PURE__ */ e(Ge, { className: "h-9 w-9 text-indigo-500" }) }),
594
+ /* @__PURE__ */ e("div", { className: "text-muted-foreground", children: /* @__PURE__ */ e(Re, { className: "h-9 w-9 text-indigo-500" }) }),
582
595
  /* @__PURE__ */ e("div", { className: "text-muted-foreground text-lg", children: "No assets found" }),
583
596
  /* @__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" }),
584
597
  /* @__PURE__ */ e("br", {})
@@ -587,23 +600,23 @@ function yt({
587
600
  {
588
601
  className: ae(
589
602
  "relative cursor-pointer overflow-hidden transition-all rounded-lg border-2 group max-w-[180px] max-h-[180px] flex flex-col justify-between",
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" : "",
603
+ A.some((o) => o.id === t.id) ? "border-blue-500" : "hover:border-black/90",
604
+ C && (u == null ? void 0 : u.id) === t.id ? "opacity-50 pointer-events-none" : "",
592
605
  C === t.id ? "opacity-50 pointer-events-none" : ""
593
606
  ),
594
607
  onClick: () => ge(t),
595
608
  children: [
596
609
  /* @__PURE__ */ i("div", { className: "aspect-square relative overflow-hidden", children: [
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,
610
+ C === t.id ? /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-black/50", children: /* @__PURE__ */ e(U, { className: "h-8 w-8 animate-spin text-white" }) }) : null,
598
611
  t.type === "image" ? /* @__PURE__ */ e(
599
612
  "img",
600
613
  {
601
614
  src: `${t.thumbnailUrl || "/placeholder.svg"}?v=${(t == null ? void 0 : t.updatedAt) || t.createdAt}`,
602
615
  alt: t.name,
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"}`
616
+ className: `object-contain w-full h-full min-h-[80px] ${A.some((o) => o.id === t.id) ? "" : "group-hover:blur-sm group-hover:contrast-50"}`
604
617
  }
605
618
  ) : /* @__PURE__ */ i("div", { className: "flex items-center justify-center h-full", children: [
606
- /* @__PURE__ */ e(Re, { className: "h-12 w-12 text-muted-foreground" }),
619
+ /* @__PURE__ */ e(We, { className: "h-12 w-12 text-muted-foreground" }),
607
620
  t.thumbnailUrl && /* @__PURE__ */ e(
608
621
  "img",
609
622
  {
@@ -623,53 +636,53 @@ function yt({
623
636
  children: t.name
624
637
  }
625
638
  ),
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) }) })
639
+ /* @__PURE__ */ e("div", { className: "text-[9px] whitespace-nowrap font-light text-muted-foreground flex items-center justify-between", children: /* @__PURE__ */ e("span", { children: ot((t == null ? void 0 : t.size) || 0) }) })
627
640
  ] }),
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: [
641
+ !A.some((o) => o.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: [
629
642
  /* @__PURE__ */ e(
630
- u,
643
+ h,
631
644
  {
632
645
  variant: "secondary",
633
646
  size: "icon",
634
647
  className: "h-8 w-8 rounded-full",
635
- onClick: (c) => {
636
- c.stopPropagation(), ye(t);
648
+ onClick: (o) => {
649
+ o.stopPropagation(), ye(t);
637
650
  },
638
- children: /* @__PURE__ */ e(We, { className: "h-4 w-4" })
651
+ children: /* @__PURE__ */ e(Ve, { className: "h-4 w-4" })
639
652
  }
640
653
  ),
641
654
  /* @__PURE__ */ e(
642
- u,
655
+ h,
643
656
  {
644
657
  variant: "secondary",
645
658
  size: "icon",
646
659
  className: "h-8 w-8 rounded-full",
647
- onClick: (c) => {
648
- c.stopPropagation(), b({
660
+ onClick: (o) => {
661
+ o.stopPropagation(), b({
649
662
  id: t.id,
650
663
  show: !0,
651
664
  file: t.url,
652
665
  name: t.name
653
666
  });
654
667
  },
655
- children: /* @__PURE__ */ e(Ve, { className: "h-4 w-4" })
668
+ children: /* @__PURE__ */ e(Ye, { className: "h-4 w-4" })
656
669
  }
657
670
  ),
658
671
  /* @__PURE__ */ e(
659
- u,
672
+ h,
660
673
  {
661
674
  variant: "destructive",
662
675
  size: "icon",
663
676
  className: "h-8 w-8 rounded-full",
664
- onClick: (c) => {
665
- c.stopPropagation(), ve(t);
677
+ onClick: (o) => {
678
+ o.stopPropagation(), ve(t);
666
679
  },
667
- children: /* @__PURE__ */ e(Ye, { className: "h-4 w-4" })
680
+ children: /* @__PURE__ */ e(He, { className: "h-4 w-4" })
668
681
  }
669
682
  )
670
683
  ] }),
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(
672
- He,
684
+ A.some((o) => o.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(
685
+ Xe,
673
686
  {
674
687
  className: "w-3 h-3 text-white",
675
688
  strokeWidth: 5
@@ -681,58 +694,58 @@ function yt({
681
694
  )) }) }),
682
695
  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: [
683
696
  /* @__PURE__ */ e(
684
- u,
697
+ h,
685
698
  {
686
699
  variant: "outline",
687
700
  size: "sm",
688
701
  onClick: he,
689
- disabled: !Q,
702
+ disabled: !G,
690
703
  children: "Previous"
691
704
  }
692
705
  ),
693
- Array.from({ length: Math.min(5, S) }, (t, c) => {
694
- const x = c + 1;
706
+ Array.from({ length: Math.min(5, S) }, (t, o) => {
707
+ const p = o + 1;
695
708
  return /* @__PURE__ */ e(
696
- u,
709
+ h,
697
710
  {
698
- variant: w === x ? "default" : "outline",
711
+ variant: w === p ? "default" : "outline",
699
712
  size: "sm",
700
- onClick: () => z(x),
701
- children: x
713
+ onClick: () => P(p),
714
+ children: p
702
715
  },
703
- x
716
+ p
704
717
  );
705
718
  }),
706
- S > 5 && /* @__PURE__ */ i(I, { children: [
719
+ S > 5 && /* @__PURE__ */ i(F, { children: [
707
720
  /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: "..." }),
708
721
  /* @__PURE__ */ e(
709
- u,
722
+ h,
710
723
  {
711
724
  variant: w === S ? "default" : "outline",
712
725
  size: "sm",
713
- onClick: () => z(S),
726
+ onClick: () => P(S),
714
727
  children: S
715
728
  }
716
729
  )
717
730
  ] }),
718
731
  /* @__PURE__ */ e(
719
- u,
732
+ h,
720
733
  {
721
734
  variant: "outline",
722
735
  size: "sm",
723
736
  onClick: ue,
724
- disabled: !K,
737
+ disabled: !Q,
725
738
  children: "Next"
726
739
  }
727
740
  )
728
741
  ] }) })
729
742
  ] })
730
743
  ] }) : /* @__PURE__ */ e(
731
- nt,
744
+ st,
732
745
  {
733
- assetId: p || a || "",
746
+ assetId: y || a || "",
734
747
  onBack: () => {
735
- M("grid"), v(null);
748
+ v("grid"), g(null);
736
749
  },
737
750
  onEdit: (t) => {
738
751
  b({
@@ -743,53 +756,53 @@ function yt({
743
756
  });
744
757
  },
745
758
  onSave: async (t) => {
746
- if (p) {
747
- E(!0);
759
+ if (y) {
760
+ I(!0);
748
761
  try {
749
- const c = T.find((x) => x.id === p);
750
- c && await J(Be(c, { description: t }));
762
+ const o = T.find((p) => p.id === y);
763
+ o && await J(qe(o, { description: t }));
751
764
  } finally {
752
- E(!1);
765
+ I(!1);
753
766
  }
754
767
  }
755
768
  },
756
- isSaving: B
769
+ isSaving: q
757
770
  }
758
771
  )
759
772
  ] }),
760
- o.show && /* @__PURE__ */ e(
761
- Ae,
773
+ s.show && /* @__PURE__ */ e(
774
+ Se,
762
775
  {
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" }) }),
776
+ fallback: /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ e(U, { className: "h-8 w-8 animate-spin" }) }),
764
777
  children: /* @__PURE__ */ e(
765
- st,
778
+ ct,
766
779
  {
767
- imageUrl: o.file,
780
+ imageUrl: s.file,
768
781
  onSave: be,
769
782
  onClose: () => b({ show: !1, file: "" }),
770
- defaultSavedImageName: o.name,
771
- isEditing: !!o.id
783
+ defaultSavedImageName: s.name,
784
+ isEditing: !!s.id
772
785
  }
773
786
  )
774
787
  }
775
788
  ),
776
- m && /* @__PURE__ */ e(
777
- Ee,
789
+ u && /* @__PURE__ */ e(
790
+ Te,
778
791
  {
779
- open: !!m,
780
- onOpenChange: () => N(null),
781
- children: /* @__PURE__ */ i(Te, { children: [
782
- /* @__PURE__ */ i(ke, { children: [
783
- /* @__PURE__ */ e(ze, { children: "Delete Asset" }),
784
- /* @__PURE__ */ i(De, { children: [
792
+ open: !!u,
793
+ onOpenChange: () => x(null),
794
+ children: /* @__PURE__ */ i(ke, { children: [
795
+ /* @__PURE__ */ i(ze, { children: [
796
+ /* @__PURE__ */ e(De, { children: "Delete Asset" }),
797
+ /* @__PURE__ */ i(Pe, { children: [
785
798
  'Are you sure you want to delete "',
786
- m.name,
799
+ u.name,
787
800
  '"? This action cannot be undone.'
788
801
  ] })
789
802
  ] }),
790
803
  /* @__PURE__ */ i(je, { className: "gap-2 sm:gap-0", children: [
791
- /* @__PURE__ */ e(u, { variant: "outline", onClick: () => N(null), children: "Cancel" }),
792
- /* @__PURE__ */ e(u, { variant: "destructive", onClick: Ne, children: "Delete" })
804
+ /* @__PURE__ */ e(h, { variant: "outline", onClick: () => x(null), children: "Cancel" }),
805
+ /* @__PURE__ */ e(h, { variant: "destructive", onClick: Ne, children: "Delete" })
793
806
  ] })
794
807
  ] })
795
808
  }
@@ -797,5 +810,5 @@ function yt({
797
810
  ] });
798
811
  }
799
812
  export {
800
- yt as default
813
+ bt as default
801
814
  };