@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.
- package/dist/{B4MFY5CR-CxaAsbN9.js → B4MFY5CR-8GgnGmqi.js} +1 -1
- package/dist/{B4MFY5CR-Dejj9XNi.cjs → B4MFY5CR-CI47xCz8.cjs} +1 -1
- package/dist/{HO4MOOFI-aeWm2iw3.cjs → HO4MOOFI-CBsTO_4Q.cjs} +1 -1
- package/dist/{HO4MOOFI-DyGZciGV.js → HO4MOOFI-DdmHf8g_.js} +2 -2
- package/dist/{HUY7CZI3-CLInB0IP.cjs → HUY7CZI3-CEbyfdG_.cjs} +1 -1
- package/dist/{HUY7CZI3-BKHbLpsl.js → HUY7CZI3-aYltl_N0.js} +2 -2
- package/dist/digital-asset-manager-BJYvnk1b.cjs +1 -0
- package/dist/{digital-asset-manager-DJEJxRa5.js → digital-asset-manager-CXnvfs-d.js} +290 -277
- package/dist/index-B1F3Hhby.cjs +2 -0
- package/dist/{index-TNPTcXFM.js → index-C92l-a7n.js} +1494 -1458
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/digital-asset-manager-GB5X0F5T.cjs +0 -1
- package/dist/index-BV5BWsTF.cjs +0 -2
|
@@ -1,140 +1,140 @@
|
|
|
1
|
-
import { jsx as e, jsxs as i, Fragment as
|
|
2
|
-
import ie, { useState as f, useMemo as
|
|
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
|
|
5
|
-
import { find as
|
|
6
|
-
import { Loader as
|
|
7
|
-
import { useDropzone as
|
|
8
|
-
import { useQueryClient as
|
|
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
|
|
11
|
-
const
|
|
12
|
-
const n =
|
|
13
|
-
return
|
|
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:
|
|
17
|
-
name:
|
|
18
|
-
optimize:
|
|
19
|
-
}) =>
|
|
20
|
-
action:
|
|
21
|
-
data: { file: a, folderId:
|
|
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
|
-
|
|
27
|
-
queryKey: [
|
|
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
|
-
},
|
|
35
|
-
const n =
|
|
36
|
-
return
|
|
37
|
-
mutationFn: async (a) =>
|
|
38
|
-
action:
|
|
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
|
-
|
|
45
|
-
queryKey: [
|
|
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
|
-
},
|
|
53
|
-
const n =
|
|
54
|
-
return
|
|
55
|
-
mutationFn: async (a) =>
|
|
56
|
-
action:
|
|
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
|
-
|
|
63
|
-
queryKey: [
|
|
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
|
-
},
|
|
71
|
-
const
|
|
70
|
+
}, lt = (n = {}) => {
|
|
71
|
+
const l = $(), c = _(), { search: a, page: m = 1, limit: r = 30 } = n;
|
|
72
72
|
return le({
|
|
73
|
-
queryKey: [
|
|
73
|
+
queryKey: [B, N.GET_ASSETS, a, m, r],
|
|
74
74
|
queryFn: async () => {
|
|
75
|
-
const
|
|
76
|
-
action:
|
|
75
|
+
const d = await c(l, {
|
|
76
|
+
action: N.GET_ASSETS,
|
|
77
77
|
data: {
|
|
78
78
|
search: a,
|
|
79
|
-
page:
|
|
80
|
-
limit:
|
|
79
|
+
page: m,
|
|
80
|
+
limit: r
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
|
-
return
|
|
83
|
+
return d.page = m, d.limit = r, d;
|
|
84
84
|
},
|
|
85
85
|
staleTime: 1e3 * 60 * 5,
|
|
86
86
|
retry: 1
|
|
87
87
|
});
|
|
88
|
-
},
|
|
89
|
-
const
|
|
88
|
+
}, rt = (n) => {
|
|
89
|
+
const l = $(), c = _();
|
|
90
90
|
return le({
|
|
91
|
-
queryKey: [
|
|
92
|
-
queryFn: async () => n ? await
|
|
93
|
-
action:
|
|
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
|
|
101
|
-
const
|
|
102
|
-
return
|
|
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
|
|
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(
|
|
113
|
+
}).format(l);
|
|
114
114
|
}
|
|
115
|
-
function te(n,
|
|
116
|
-
let
|
|
117
|
-
return (!a || typeof a != "string") && (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
|
|
119
|
+
const st = ({
|
|
120
120
|
assetId: n,
|
|
121
|
-
onBack:
|
|
122
|
-
onEdit:
|
|
121
|
+
onBack: l,
|
|
122
|
+
onEdit: c,
|
|
123
123
|
onSave: a,
|
|
124
|
-
isSaving:
|
|
124
|
+
isSaving: m
|
|
125
125
|
}) => {
|
|
126
|
-
var
|
|
127
|
-
const { data:
|
|
126
|
+
var x, C, E;
|
|
127
|
+
const { data: r, isLoading: d, isError: y } = rt(n || ""), [g, u] = f("");
|
|
128
128
|
return ie.useEffect(() => {
|
|
129
|
-
|
|
130
|
-
}, [
|
|
131
|
-
/* @__PURE__ */ e("div", { className: "flex justify-center mb-4", children: /* @__PURE__ */ e(
|
|
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:
|
|
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(
|
|
136
|
-
|
|
137
|
-
|
|
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
|
-
|
|
148
|
+
h,
|
|
149
149
|
{
|
|
150
150
|
variant: "outline",
|
|
151
151
|
size: "sm",
|
|
152
|
-
onClick:
|
|
153
|
-
disabled:
|
|
152
|
+
onClick: l,
|
|
153
|
+
disabled: m,
|
|
154
154
|
children: [
|
|
155
|
-
/* @__PURE__ */ e(
|
|
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(
|
|
161
|
+
/* @__PURE__ */ e(h, { variant: "outline", onClick: l, disabled: m, children: "Cancel" }),
|
|
162
162
|
/* @__PURE__ */ i(
|
|
163
|
-
|
|
163
|
+
h,
|
|
164
164
|
{
|
|
165
165
|
variant: "default",
|
|
166
|
-
onClick: () =>
|
|
167
|
-
disabled:
|
|
166
|
+
onClick: () => c(r),
|
|
167
|
+
disabled: m,
|
|
168
168
|
children: [
|
|
169
|
-
/* @__PURE__ */ e(
|
|
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: `${
|
|
181
|
-
alt:
|
|
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(
|
|
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:
|
|
190
|
-
{ label: "Type", value:
|
|
189
|
+
{ label: "File Name", value: r.name },
|
|
190
|
+
{ label: "Type", value: r.type, capitalize: !0 },
|
|
191
191
|
{
|
|
192
192
|
label: "Format",
|
|
193
|
-
value: ((C =
|
|
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:
|
|
198
|
+
value: nt(r.size)
|
|
199
199
|
},
|
|
200
200
|
{
|
|
201
201
|
label: "Dimensions",
|
|
202
|
-
value: `${
|
|
202
|
+
value: `${r.width || 0} × ${r.height || 0}`
|
|
203
203
|
},
|
|
204
204
|
{
|
|
205
205
|
label: "Created",
|
|
206
|
-
value: ee(
|
|
206
|
+
value: ee(r.createdAt)
|
|
207
207
|
},
|
|
208
208
|
{
|
|
209
209
|
label: "Updated",
|
|
210
210
|
value: ee(
|
|
211
|
-
((
|
|
211
|
+
((E = r.metadata) == null ? void 0 : E.updatedAt) || r.createdAt
|
|
212
212
|
)
|
|
213
213
|
}
|
|
214
|
-
].map((
|
|
215
|
-
/* @__PURE__ */ e(
|
|
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" +
|
|
221
|
-
children:
|
|
220
|
+
className: "w-max text-left font-medium text-gray-900" + s.capitalize ? " capitalize" : "",
|
|
221
|
+
children: s.value
|
|
222
222
|
}
|
|
223
223
|
)
|
|
224
|
-
] },
|
|
224
|
+
] }, s.label)) })
|
|
225
225
|
] }),
|
|
226
|
-
|
|
227
|
-
/* @__PURE__ */ e(
|
|
228
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-2 text-sm border rounded-md p-2", children:
|
|
229
|
-
/* @__PURE__ */ e("div", { className: "w-max text-left font-medium text-gray-900", children:
|
|
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
|
-
|
|
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(
|
|
238
|
+
/* @__PURE__ */ e(M, { className: "w-full text-center", children: "Description" }),
|
|
239
239
|
/* @__PURE__ */ e(
|
|
240
|
-
|
|
240
|
+
Ce,
|
|
241
241
|
{
|
|
242
242
|
id: "description",
|
|
243
|
-
value:
|
|
243
|
+
value: g,
|
|
244
244
|
placeholder: "Enter a description for the asset",
|
|
245
|
-
onChange: (
|
|
245
|
+
onChange: (s) => u(s.target.value),
|
|
246
246
|
rows: 3,
|
|
247
|
-
disabled:
|
|
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(
|
|
256
|
-
disabled:
|
|
257
|
-
className: `py-0 bg-blue-500 text-white px-3 py-0.5 rounded-md text-sm ${
|
|
258
|
-
children:
|
|
259
|
-
/* @__PURE__ */ e(
|
|
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
|
-
},
|
|
269
|
-
function
|
|
270
|
-
const
|
|
271
|
-
return
|
|
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
|
|
273
|
+
const dt = ({
|
|
274
274
|
isUpdatingAsset: n,
|
|
275
|
-
allowedTypes:
|
|
276
|
-
maxFileSize:
|
|
275
|
+
allowedTypes: l,
|
|
276
|
+
maxFileSize: c,
|
|
277
277
|
uploadAsset: a,
|
|
278
|
-
isUploadingAsset:
|
|
278
|
+
isUploadingAsset: m,
|
|
279
|
+
onUploaded: r
|
|
279
280
|
}) => {
|
|
280
|
-
const [
|
|
281
|
-
const
|
|
282
|
-
return
|
|
281
|
+
const [d, y] = f(() => {
|
|
282
|
+
const s = localStorage.getItem("chai_optimize_images");
|
|
283
|
+
return s !== null ? s === "true" : !0;
|
|
283
284
|
});
|
|
284
|
-
|
|
285
|
-
localStorage.setItem("chai_optimize_images",
|
|
286
|
-
}, [
|
|
287
|
-
const
|
|
288
|
-
async (
|
|
289
|
-
const
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
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,
|
|
301
|
-
), { getRootProps:
|
|
302
|
-
onDrop:
|
|
310
|
+
[a, d]
|
|
311
|
+
), { getRootProps: x, getInputProps: C, isDragActive: E } = et({
|
|
312
|
+
onDrop: u,
|
|
303
313
|
accept: {
|
|
304
|
-
"image/*":
|
|
314
|
+
"image/*": l.includes("image") ? [] : []
|
|
305
315
|
},
|
|
306
|
-
maxSize:
|
|
307
|
-
disabled: n ||
|
|
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] ${
|
|
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
|
-
...
|
|
326
|
+
...x(),
|
|
317
327
|
className: ae(
|
|
318
328
|
"rounded-lg text-center cursor-pointer w-full h-max flex flex-col justify-center",
|
|
319
|
-
|
|
320
|
-
|
|
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", { ...
|
|
324
|
-
|
|
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(
|
|
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(
|
|
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:
|
|
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
|
-
|
|
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:
|
|
395
|
-
children:
|
|
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
|
-
|
|
410
|
+
Ie,
|
|
401
411
|
{
|
|
402
|
-
checked:
|
|
403
|
-
onCheckedChange: (
|
|
404
|
-
|
|
412
|
+
checked: d,
|
|
413
|
+
onCheckedChange: (s) => {
|
|
414
|
+
y(s);
|
|
405
415
|
},
|
|
406
|
-
onClick: (
|
|
407
|
-
|
|
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(
|
|
414
|
-
/* @__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 ${
|
|
418
|
-
children: /* @__PURE__ */ e(
|
|
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(
|
|
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
|
|
445
|
+
function bt({
|
|
436
446
|
close: n,
|
|
437
|
-
onSelect:
|
|
438
|
-
mode:
|
|
447
|
+
onSelect: l,
|
|
448
|
+
mode: c = "image",
|
|
439
449
|
assetId: a
|
|
440
450
|
}) {
|
|
441
|
-
const
|
|
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(""), [
|
|
444
|
-
|
|
445
|
-
a && (
|
|
446
|
-
}, [a]),
|
|
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(
|
|
458
|
+
re(L), Y(1);
|
|
449
459
|
}, 300);
|
|
450
460
|
return () => clearTimeout(t);
|
|
451
|
-
}, [
|
|
452
|
-
const { data:
|
|
461
|
+
}, [L]);
|
|
462
|
+
const { data: D, isLoading: X } = lt({
|
|
453
463
|
search: O.toLowerCase().trim(),
|
|
454
464
|
page: w,
|
|
455
|
-
limit:
|
|
456
|
-
}), T = (
|
|
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 &&
|
|
468
|
+
t >= 1 && t <= S && Y(t);
|
|
459
469
|
},
|
|
460
470
|
[S]
|
|
461
|
-
), ue =
|
|
462
|
-
|
|
463
|
-
}, [w,
|
|
464
|
-
|
|
465
|
-
}, [w,
|
|
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 =
|
|
477
|
+
}, ge = k(
|
|
468
478
|
(t) => {
|
|
469
|
-
|
|
479
|
+
K((o) => Be(o, { id: t.id }) ? [] : [t]);
|
|
470
480
|
},
|
|
471
481
|
[!1]
|
|
472
|
-
), pe =
|
|
473
|
-
|
|
482
|
+
), pe = k(() => {
|
|
483
|
+
K([]);
|
|
474
484
|
}, []), xe = () => {
|
|
475
|
-
A.length !== 0 && (
|
|
476
|
-
|
|
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
|
-
|
|
495
|
+
x(t);
|
|
486
496
|
}, Ne = async () => {
|
|
487
|
-
|
|
497
|
+
u && (E(u == null ? void 0 : u.id), await oe(u.id, {
|
|
488
498
|
onSuccess: () => {
|
|
489
|
-
|
|
499
|
+
E(null), x(null);
|
|
490
500
|
},
|
|
491
501
|
onError: () => {
|
|
492
|
-
|
|
502
|
+
E(null);
|
|
493
503
|
}
|
|
494
|
-
}),
|
|
504
|
+
}), x(null));
|
|
495
505
|
}, ye = (t) => {
|
|
496
|
-
|
|
497
|
-
}, be = async (t,
|
|
506
|
+
g(t.id), v("details");
|
|
507
|
+
}, be = async (t, o) => {
|
|
498
508
|
try {
|
|
499
|
-
const
|
|
500
|
-
|
|
509
|
+
const p = localStorage.getItem("chai_optimize_images") !== "false";
|
|
510
|
+
o ? (await Z({
|
|
501
511
|
file: t,
|
|
502
512
|
folderId: void 0,
|
|
503
|
-
name:
|
|
504
|
-
optimize:
|
|
513
|
+
name: s.name || "",
|
|
514
|
+
optimize: p
|
|
505
515
|
}), b({ show: !1, file: "" })) : (await J({
|
|
506
|
-
id:
|
|
516
|
+
id: s.id || "",
|
|
507
517
|
file: t
|
|
508
518
|
}), b({ show: !1, file: "" }));
|
|
509
|
-
} catch (
|
|
510
|
-
console.error("Error saving edited image:",
|
|
519
|
+
} catch (p) {
|
|
520
|
+
console.error("Error saving edited image:", p);
|
|
511
521
|
}
|
|
512
|
-
}
|
|
513
|
-
|
|
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
|
-
|
|
528
|
+
z === "grid" ? /* @__PURE__ */ i(F, { children: [
|
|
517
529
|
/* @__PURE__ */ e(
|
|
518
|
-
|
|
530
|
+
dt,
|
|
519
531
|
{
|
|
520
532
|
maxFileSize: 10,
|
|
521
|
-
allowedTypes:
|
|
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
|
-
|
|
544
|
+
Ge,
|
|
532
545
|
{
|
|
533
546
|
strokeWidth: 3,
|
|
534
|
-
className: `absolute left-2 top-2.5 h-4 w-4 text-muted-foreground ${
|
|
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
|
-
|
|
551
|
+
Ee,
|
|
539
552
|
{
|
|
540
553
|
placeholder: "Search assets...",
|
|
541
554
|
onChange: fe,
|
|
542
|
-
value:
|
|
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(
|
|
549
|
-
|
|
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
|
-
|
|
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(
|
|
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((
|
|
591
|
-
C && (
|
|
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(
|
|
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((
|
|
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(
|
|
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:
|
|
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((
|
|
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
|
-
|
|
643
|
+
h,
|
|
631
644
|
{
|
|
632
645
|
variant: "secondary",
|
|
633
646
|
size: "icon",
|
|
634
647
|
className: "h-8 w-8 rounded-full",
|
|
635
|
-
onClick: (
|
|
636
|
-
|
|
648
|
+
onClick: (o) => {
|
|
649
|
+
o.stopPropagation(), ye(t);
|
|
637
650
|
},
|
|
638
|
-
children: /* @__PURE__ */ e(
|
|
651
|
+
children: /* @__PURE__ */ e(Ve, { className: "h-4 w-4" })
|
|
639
652
|
}
|
|
640
653
|
),
|
|
641
654
|
/* @__PURE__ */ e(
|
|
642
|
-
|
|
655
|
+
h,
|
|
643
656
|
{
|
|
644
657
|
variant: "secondary",
|
|
645
658
|
size: "icon",
|
|
646
659
|
className: "h-8 w-8 rounded-full",
|
|
647
|
-
onClick: (
|
|
648
|
-
|
|
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(
|
|
668
|
+
children: /* @__PURE__ */ e(Ye, { className: "h-4 w-4" })
|
|
656
669
|
}
|
|
657
670
|
),
|
|
658
671
|
/* @__PURE__ */ e(
|
|
659
|
-
|
|
672
|
+
h,
|
|
660
673
|
{
|
|
661
674
|
variant: "destructive",
|
|
662
675
|
size: "icon",
|
|
663
676
|
className: "h-8 w-8 rounded-full",
|
|
664
|
-
onClick: (
|
|
665
|
-
|
|
677
|
+
onClick: (o) => {
|
|
678
|
+
o.stopPropagation(), ve(t);
|
|
666
679
|
},
|
|
667
|
-
children: /* @__PURE__ */ e(
|
|
680
|
+
children: /* @__PURE__ */ e(He, { className: "h-4 w-4" })
|
|
668
681
|
}
|
|
669
682
|
)
|
|
670
683
|
] }),
|
|
671
|
-
A.some((
|
|
672
|
-
|
|
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
|
-
|
|
697
|
+
h,
|
|
685
698
|
{
|
|
686
699
|
variant: "outline",
|
|
687
700
|
size: "sm",
|
|
688
701
|
onClick: he,
|
|
689
|
-
disabled: !
|
|
702
|
+
disabled: !G,
|
|
690
703
|
children: "Previous"
|
|
691
704
|
}
|
|
692
705
|
),
|
|
693
|
-
Array.from({ length: Math.min(5, S) }, (t,
|
|
694
|
-
const
|
|
706
|
+
Array.from({ length: Math.min(5, S) }, (t, o) => {
|
|
707
|
+
const p = o + 1;
|
|
695
708
|
return /* @__PURE__ */ e(
|
|
696
|
-
|
|
709
|
+
h,
|
|
697
710
|
{
|
|
698
|
-
variant: w ===
|
|
711
|
+
variant: w === p ? "default" : "outline",
|
|
699
712
|
size: "sm",
|
|
700
|
-
onClick: () =>
|
|
701
|
-
children:
|
|
713
|
+
onClick: () => P(p),
|
|
714
|
+
children: p
|
|
702
715
|
},
|
|
703
|
-
|
|
716
|
+
p
|
|
704
717
|
);
|
|
705
718
|
}),
|
|
706
|
-
S > 5 && /* @__PURE__ */ i(
|
|
719
|
+
S > 5 && /* @__PURE__ */ i(F, { children: [
|
|
707
720
|
/* @__PURE__ */ e("span", { className: "text-muted-foreground", children: "..." }),
|
|
708
721
|
/* @__PURE__ */ e(
|
|
709
|
-
|
|
722
|
+
h,
|
|
710
723
|
{
|
|
711
724
|
variant: w === S ? "default" : "outline",
|
|
712
725
|
size: "sm",
|
|
713
|
-
onClick: () =>
|
|
726
|
+
onClick: () => P(S),
|
|
714
727
|
children: S
|
|
715
728
|
}
|
|
716
729
|
)
|
|
717
730
|
] }),
|
|
718
731
|
/* @__PURE__ */ e(
|
|
719
|
-
|
|
732
|
+
h,
|
|
720
733
|
{
|
|
721
734
|
variant: "outline",
|
|
722
735
|
size: "sm",
|
|
723
736
|
onClick: ue,
|
|
724
|
-
disabled: !
|
|
737
|
+
disabled: !Q,
|
|
725
738
|
children: "Next"
|
|
726
739
|
}
|
|
727
740
|
)
|
|
728
741
|
] }) })
|
|
729
742
|
] })
|
|
730
743
|
] }) : /* @__PURE__ */ e(
|
|
731
|
-
|
|
744
|
+
st,
|
|
732
745
|
{
|
|
733
|
-
assetId:
|
|
746
|
+
assetId: y || a || "",
|
|
734
747
|
onBack: () => {
|
|
735
|
-
|
|
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 (
|
|
747
|
-
|
|
759
|
+
if (y) {
|
|
760
|
+
I(!0);
|
|
748
761
|
try {
|
|
749
|
-
const
|
|
750
|
-
|
|
762
|
+
const o = T.find((p) => p.id === y);
|
|
763
|
+
o && await J(qe(o, { description: t }));
|
|
751
764
|
} finally {
|
|
752
|
-
|
|
765
|
+
I(!1);
|
|
753
766
|
}
|
|
754
767
|
}
|
|
755
768
|
},
|
|
756
|
-
isSaving:
|
|
769
|
+
isSaving: q
|
|
757
770
|
}
|
|
758
771
|
)
|
|
759
772
|
] }),
|
|
760
|
-
|
|
761
|
-
|
|
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(
|
|
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
|
-
|
|
778
|
+
ct,
|
|
766
779
|
{
|
|
767
|
-
imageUrl:
|
|
780
|
+
imageUrl: s.file,
|
|
768
781
|
onSave: be,
|
|
769
782
|
onClose: () => b({ show: !1, file: "" }),
|
|
770
|
-
defaultSavedImageName:
|
|
771
|
-
isEditing: !!
|
|
783
|
+
defaultSavedImageName: s.name,
|
|
784
|
+
isEditing: !!s.id
|
|
772
785
|
}
|
|
773
786
|
)
|
|
774
787
|
}
|
|
775
788
|
),
|
|
776
|
-
|
|
777
|
-
|
|
789
|
+
u && /* @__PURE__ */ e(
|
|
790
|
+
Te,
|
|
778
791
|
{
|
|
779
|
-
open: !!
|
|
780
|
-
onOpenChange: () =>
|
|
781
|
-
children: /* @__PURE__ */ i(
|
|
782
|
-
/* @__PURE__ */ i(
|
|
783
|
-
/* @__PURE__ */ e(
|
|
784
|
-
/* @__PURE__ */ i(
|
|
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
|
-
|
|
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(
|
|
792
|
-
/* @__PURE__ */ e(
|
|
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
|
-
|
|
813
|
+
bt as default
|
|
801
814
|
};
|