@chaibuilder/pages 0.14.0 → 0.14.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/{2AITGKQY-BLi5HVHf.cjs → 2AITGKQY-DWDDkd18.cjs} +1 -1
- package/dist/{2AITGKQY-iyhQ7kgG.js → 2AITGKQY-DtQPkxBe.js} +2 -2
- package/dist/{NCMVHL6D-CKYg8-AM.cjs → NCMVHL6D-6CkVnw0a.cjs} +1 -1
- package/dist/{NCMVHL6D-PLvSyK5P.js → NCMVHL6D-CksZXXOw.js} +4 -4
- package/dist/{ZDWCUMSJ-CuLkdxY-.js → ZDWCUMSJ-BXQ01VPt.js} +1 -1
- package/dist/{ZDWCUMSJ-BJZ_Yi-4.cjs → ZDWCUMSJ-DoM-AA0C.cjs} +1 -1
- package/dist/{add-new-language-page--ah9yzN3.cjs → add-new-language-page-BA73lQnm.cjs} +1 -1
- package/dist/{add-new-language-page-WM_Ve2vH.js → add-new-language-page-D8iXtyLA.js} +2 -2
- package/dist/{add-new-page-Bs_NXM9x.js → add-new-page-DESlqvED.js} +1 -1
- package/dist/{add-new-page-CnUo6xzd.cjs → add-new-page-EOMgMSeq.cjs} +1 -1
- package/dist/{delete-page-D8xhYESu.js → delete-page-BP1Df8QL.js} +1 -1
- package/dist/{delete-page-Cf88UkqJ.cjs → delete-page-ZvnuEow6.cjs} +1 -1
- package/dist/{digital-asset-manager-BAFTqxsM.js → digital-asset-manager-Bb81T3mS.js} +146 -146
- package/dist/{digital-asset-manager-D_lcprwY.cjs → digital-asset-manager-BxWb1j_y.cjs} +1 -1
- package/dist/{duplicate-page-CqXTGmWt.js → duplicate-page-B1j0H7gP.js} +28 -28
- package/dist/{duplicate-page-BX1gOez-.cjs → duplicate-page-W5xbmPSC.cjs} +1 -1
- package/dist/{dynamic-page-selector-9JIQrcq5.cjs → dynamic-page-selector-BZKJmSx5.cjs} +1 -1
- package/dist/{dynamic-page-selector-0TiUnfUg.js → dynamic-page-selector-Crjyco6l.js} +1 -1
- package/dist/{index-D7kegQ3M.js → index-DFvsMFVH.js} +919 -912
- package/dist/index-Qnh8Lkr0.cjs +5 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +8 -8
- package/dist/{json-diff-viewer-C2GK_BDh.js → json-diff-viewer-BGGSLqtx.js} +6 -6
- package/dist/{json-diff-viewer-Be-PVOZN.cjs → json-diff-viewer-DRkE-x_z.cjs} +1 -1
- package/dist/{lang-panel-CePltxo2.cjs → lang-panel-9T8dIx2p.cjs} +1 -1
- package/dist/{lang-panel-CPFS1ssC.js → lang-panel-B3tr2uhr.js} +2 -2
- package/dist/{mark-as-template-DeB23sWR.cjs → mark-as-template-DPVPRgbi.cjs} +1 -1
- package/dist/{mark-as-template-jdwcgRIB.js → mark-as-template-L9cHzL84.js} +1 -1
- package/dist/{no-language-page-content-Dsm2H3pc.cjs → no-language-page-content-Cy_D-3jE.cjs} +1 -1
- package/dist/{no-language-page-content-DUM4KxWu.js → no-language-page-content-DP7gmy0s.js} +1 -1
- package/dist/{page-creator-BjuYmKfc.js → page-creator-Ctn5ixJE.js} +29 -29
- package/dist/{page-creator-DG0LwvL1.cjs → page-creator-DDaI1HYj.cjs} +1 -1
- package/dist/{page-lock-request-B9WPmFcd.cjs → page-lock-request-BKrxnEtQ.cjs} +1 -1
- package/dist/{page-lock-request-BceB1S-X.js → page-lock-request-CjJFJKL2.js} +3 -3
- package/dist/{page-locked-by-dialog-BEWfFLSc.js → page-locked-by-dialog-DmsSmAY2.js} +1 -1
- package/dist/{page-locked-by-dialog-2MULM3jh.cjs → page-locked-by-dialog-b25_rn2m.cjs} +1 -1
- package/dist/{page-manager-new-BONZN4c5.cjs → page-manager-new-DiZVY7Me.cjs} +1 -1
- package/dist/{page-manager-new-DV6A9WFv.js → page-manager-new-EsIg6iQn.js} +28 -28
- package/dist/{page-manager-search-and-filter-DIiowi9F.js → page-manager-search-and-filter-Bt4T_dnB.js} +2 -2
- package/dist/{page-manager-search-and-filter-3h4URMP_.cjs → page-manager-search-and-filter-CgY2qiXU.cjs} +1 -1
- package/dist/{page-revisions-content-BIxeZeND.js → page-revisions-content-CsT6aF2I.js} +7 -7
- package/dist/{page-revisions-content-CQbt25XX.cjs → page-revisions-content-DtI8CmtR.cjs} +1 -1
- package/dist/{publish-pages-content-im9dPOBM.cjs → publish-pages-content-DpC7RcTw.cjs} +1 -1
- package/dist/{publish-pages-content-CdKHrfys.js → publish-pages-content-KAuhOPv0.js} +45 -45
- package/dist/{save-to-lib-DOh-850u.cjs → save-to-lib-BGpWGHJo.cjs} +1 -1
- package/dist/{save-to-lib-DGII9CEP.js → save-to-lib-CeWaSQdB.js} +23 -23
- package/dist/{seo-panel-Bxo4f-a_.js → seo-panel-Dhhpe_7z.js} +1 -1
- package/dist/{seo-panel-2VdpoGSg.cjs → seo-panel-JDQ_7bOx.cjs} +1 -1
- package/dist/{shared-json-ld-C1OewNgp.cjs → shared-json-ld-BYbdMttx.cjs} +1 -1
- package/dist/{shared-json-ld-gbnBFljN.js → shared-json-ld-BliIbNv9.js} +1 -1
- package/dist/{slug-input-CfuQV97Z.cjs → slug-input-QxBMijHP.cjs} +1 -1
- package/dist/{slug-input-BmcGmc_i.js → slug-input-hJdU8DaF.js} +1 -1
- package/dist/{theme-panel-footer-FrY4U8zn.cjs → theme-panel-footer-BZnPvTkM.cjs} +1 -1
- package/dist/{theme-panel-footer-D3SwHqGR.js → theme-panel-footer-D2B7iYW2.js} +1 -1
- package/dist/{unmark-as-template-CihtTMOb.cjs → unmark-as-template-Byn2RRAp.cjs} +1 -1
- package/dist/{unmark-as-template-UwmCCn0u.js → unmark-as-template-Dcpkj7EZ.js} +1 -1
- package/dist/{unpublish-page-DzLtZcNw.cjs → unpublish-page-5Fi1wKXb.cjs} +1 -1
- package/dist/{unpublish-page-CNwIU6AS.js → unpublish-page-CPLlsfm4.js} +1 -1
- package/dist/{use-page-expand-manager-BCFQnVkT.js → use-page-expand-manager-DkyBiNpx.js} +9 -9
- package/dist/{use-page-expand-manager-B7JtHdg5.cjs → use-page-expand-manager-To-SsGy3.cjs} +1 -1
- package/dist/web-preview-CVvxe5Ll.cjs +1 -0
- package/dist/web-preview-YuuoRaZn.js +73 -0
- package/package.json +3 -3
- package/dist/index-LU0FTfeN.cjs +0 -5
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as a, jsx as e, Fragment as Q } from "react/jsx-runtime";
|
|
2
2
|
import { mergeClasses as ce } from "@chaibuilder/sdk";
|
|
3
3
|
import { Button as g, Input as oe, Label as _, Textarea as ze, TooltipProvider as B, Tooltip as M, TooltipTrigger as $, TooltipContent as P, Dialog as De, DialogContent as je, DialogHeader as Fe, DialogTitle as Ue, DialogDescription as Le, DialogFooter as Be, Switch as Me } from "@chaibuilder/sdk/ui";
|
|
4
4
|
import { find as $e, merge as Pe, pick as Oe, first as qe, isEmpty as Ke } from "lodash-es";
|
|
5
|
-
import { ChevronLeft as de, ChevronRight as Ge, Loader as O, AlertCircle as Re, Copy as me, Pencil as _e, Link as Qe, Search as We, RefreshCwIcon as Ve, Archive as He, Film as
|
|
6
|
-
import ue, { createContext as rt, Component as
|
|
5
|
+
import { ChevronLeft as de, ChevronRight as Ge, Loader as O, AlertCircle as Re, Copy as me, Pencil as _e, Link as Qe, Search as We, RefreshCwIcon as Ve, Archive as He, Film as Je, ImageIcon as Xe, Edit as Ze, Trash2 as Ye, Check as et, Upload as tt, AlertTriangle as it } from "lucide-react";
|
|
6
|
+
import ue, { createContext as rt, Component as lt, createElement as ae, useState as b, useMemo as he, useEffect as W, useCallback as L, Suspense as at } from "react";
|
|
7
7
|
import { useDropzone as nt } from "react-dropzone";
|
|
8
8
|
import { toast as A } from "sonner";
|
|
9
9
|
import { f as st, c as ct } from "./image-compression-DsZ1oqpb.js";
|
|
10
|
-
import { useQueryClient as
|
|
11
|
-
import {
|
|
12
|
-
const ot = rt(null),
|
|
10
|
+
import { useQueryClient as Z, useMutation as Y, useQuery as fe } from "@tanstack/react-query";
|
|
11
|
+
import { aJ as q, al as K, A as E } from "./index-DFvsMFVH.js";
|
|
12
|
+
const ot = rt(null), X = {
|
|
13
13
|
didCatch: !1,
|
|
14
14
|
error: null
|
|
15
15
|
};
|
|
16
|
-
class dt extends
|
|
17
|
-
constructor(
|
|
18
|
-
super(
|
|
16
|
+
class dt extends lt {
|
|
17
|
+
constructor(l) {
|
|
18
|
+
super(l), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = X;
|
|
19
19
|
}
|
|
20
|
-
static getDerivedStateFromError(
|
|
20
|
+
static getDerivedStateFromError(l) {
|
|
21
21
|
return {
|
|
22
22
|
didCatch: !0,
|
|
23
|
-
error:
|
|
23
|
+
error: l
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
resetErrorBoundary() {
|
|
27
27
|
const {
|
|
28
|
-
error:
|
|
28
|
+
error: l
|
|
29
29
|
} = this.state;
|
|
30
|
-
if (
|
|
30
|
+
if (l !== null) {
|
|
31
31
|
for (var c, i, o = arguments.length, r = new Array(o), d = 0; d < o; d++)
|
|
32
32
|
r[d] = arguments[d];
|
|
33
33
|
(c = (i = this.props).onReset) === null || c === void 0 || c.call(i, {
|
|
34
34
|
args: r,
|
|
35
35
|
reason: "imperative-api"
|
|
36
|
-
}), this.setState(
|
|
36
|
+
}), this.setState(X);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
componentDidCatch(
|
|
39
|
+
componentDidCatch(l, c) {
|
|
40
40
|
var i, o;
|
|
41
|
-
(i = (o = this.props).onError) === null || i === void 0 || i.call(o,
|
|
41
|
+
(i = (o = this.props).onError) === null || i === void 0 || i.call(o, l, c);
|
|
42
42
|
}
|
|
43
|
-
componentDidUpdate(
|
|
43
|
+
componentDidUpdate(l, c) {
|
|
44
44
|
const {
|
|
45
45
|
didCatch: i
|
|
46
46
|
} = this.state, {
|
|
47
47
|
resetKeys: o
|
|
48
48
|
} = this.props;
|
|
49
|
-
if (i && c.error !== null && mt(
|
|
49
|
+
if (i && c.error !== null && mt(l.resetKeys, o)) {
|
|
50
50
|
var r, d;
|
|
51
51
|
(r = (d = this.props).onReset) === null || r === void 0 || r.call(d, {
|
|
52
52
|
next: o,
|
|
53
|
-
prev:
|
|
53
|
+
prev: l.resetKeys,
|
|
54
54
|
reason: "keys"
|
|
55
|
-
}), this.setState(
|
|
55
|
+
}), this.setState(X);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
render() {
|
|
59
59
|
const {
|
|
60
|
-
children:
|
|
60
|
+
children: l,
|
|
61
61
|
fallbackRender: c,
|
|
62
62
|
FallbackComponent: i,
|
|
63
63
|
fallback: o
|
|
@@ -65,7 +65,7 @@ class dt extends at {
|
|
|
65
65
|
didCatch: r,
|
|
66
66
|
error: d
|
|
67
67
|
} = this.state;
|
|
68
|
-
let v =
|
|
68
|
+
let v = l;
|
|
69
69
|
if (r) {
|
|
70
70
|
const y = {
|
|
71
71
|
error: d,
|
|
@@ -74,13 +74,13 @@ class dt extends at {
|
|
|
74
74
|
if (typeof c == "function")
|
|
75
75
|
v = c(y);
|
|
76
76
|
else if (i)
|
|
77
|
-
v =
|
|
77
|
+
v = ae(i, y);
|
|
78
78
|
else if (o !== void 0)
|
|
79
79
|
v = o;
|
|
80
80
|
else
|
|
81
81
|
throw d;
|
|
82
82
|
}
|
|
83
|
-
return
|
|
83
|
+
return ae(ot.Provider, {
|
|
84
84
|
value: {
|
|
85
85
|
didCatch: r,
|
|
86
86
|
error: d,
|
|
@@ -90,11 +90,11 @@ class dt extends at {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
function mt() {
|
|
93
|
-
let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [],
|
|
94
|
-
return s.length !==
|
|
93
|
+
let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
|
|
94
|
+
return s.length !== l.length || s.some((c, i) => !Object.is(c, l[i]));
|
|
95
95
|
}
|
|
96
96
|
const ut = () => {
|
|
97
|
-
const s = q(),
|
|
97
|
+
const s = q(), l = Z(), c = K();
|
|
98
98
|
return Y({
|
|
99
99
|
mutationFn: async (i) => {
|
|
100
100
|
const o = i.map(async (d) => c(s, {
|
|
@@ -108,7 +108,7 @@ const ut = () => {
|
|
|
108
108
|
if (i != null && i.some((r) => r.error))
|
|
109
109
|
throw new Error(((o = i == null ? void 0 : i.find((r) => r.error)) == null ? void 0 : o.error) || "Failed to upload asset");
|
|
110
110
|
{
|
|
111
|
-
|
|
111
|
+
l.invalidateQueries({
|
|
112
112
|
queryKey: [E.GET_ASSETS]
|
|
113
113
|
});
|
|
114
114
|
const r = i == null ? void 0 : i.length;
|
|
@@ -120,7 +120,7 @@ const ut = () => {
|
|
|
120
120
|
}
|
|
121
121
|
});
|
|
122
122
|
}, ht = () => {
|
|
123
|
-
const s = q(),
|
|
123
|
+
const s = q(), l = Z(), c = K();
|
|
124
124
|
return Y({
|
|
125
125
|
mutationFn: async (i) => c(s, {
|
|
126
126
|
action: E.DELETE_ASSET,
|
|
@@ -129,7 +129,7 @@ const ut = () => {
|
|
|
129
129
|
onSuccess: (i) => {
|
|
130
130
|
if (i != null && i.error)
|
|
131
131
|
throw new Error(i == null ? void 0 : i.error);
|
|
132
|
-
|
|
132
|
+
l.invalidateQueries({
|
|
133
133
|
queryKey: [E.GET_ASSETS]
|
|
134
134
|
}), A.success("Asset deleted successfully");
|
|
135
135
|
},
|
|
@@ -138,7 +138,7 @@ const ut = () => {
|
|
|
138
138
|
}
|
|
139
139
|
});
|
|
140
140
|
}, ft = () => {
|
|
141
|
-
const s = q(),
|
|
141
|
+
const s = q(), l = Z(), c = K();
|
|
142
142
|
return Y({
|
|
143
143
|
mutationFn: async (i) => c(s, {
|
|
144
144
|
action: E.UPDATE_ASSET,
|
|
@@ -147,7 +147,7 @@ const ut = () => {
|
|
|
147
147
|
onSuccess: (i) => {
|
|
148
148
|
if (i != null && i.error)
|
|
149
149
|
throw new Error(i == null ? void 0 : i.error);
|
|
150
|
-
|
|
150
|
+
l.invalidateQueries({
|
|
151
151
|
queryKey: [E.GET_ASSETS]
|
|
152
152
|
}), A.success("Asset updated successfully");
|
|
153
153
|
},
|
|
@@ -158,7 +158,7 @@ const ut = () => {
|
|
|
158
158
|
};
|
|
159
159
|
function pt({
|
|
160
160
|
currentPage: s,
|
|
161
|
-
totalPages:
|
|
161
|
+
totalPages: l,
|
|
162
162
|
onPageChange: c,
|
|
163
163
|
pageRangeDisplayed: i = 3,
|
|
164
164
|
showPageInput: o = !0,
|
|
@@ -166,28 +166,28 @@ function pt({
|
|
|
166
166
|
}) {
|
|
167
167
|
const [d, v] = b(String(s)), y = he(() => {
|
|
168
168
|
const n = Math.floor(i / 2);
|
|
169
|
-
let m = Math.max(1, s - n), h = Math.min(
|
|
170
|
-
h - m + 1 < i && (m === 1 ? h = Math.min(
|
|
169
|
+
let m = Math.max(1, s - n), h = Math.min(l, s + n);
|
|
170
|
+
h - m + 1 < i && (m === 1 ? h = Math.min(l, m + i - 1) : h === l && (m = Math.max(1, h - i + 1)));
|
|
171
171
|
const x = [];
|
|
172
172
|
m > 1 && (x.push(1), m > 2 && x.push("..."));
|
|
173
173
|
for (let N = m; N <= h; N++)
|
|
174
174
|
x.push(N);
|
|
175
|
-
return h <
|
|
176
|
-
}, [s,
|
|
177
|
-
n !== s && n >= 1 && n <=
|
|
175
|
+
return h < l && (h < l - 1 && x.push("..."), x.push(l)), x;
|
|
176
|
+
}, [s, l, i]), p = (n) => {
|
|
177
|
+
n !== s && n >= 1 && n <= l && (c(n), v(String(n)));
|
|
178
178
|
}, w = () => {
|
|
179
179
|
s > 1 && p(s - 1);
|
|
180
180
|
}, S = () => {
|
|
181
|
-
s <
|
|
181
|
+
s < l && p(s + 1);
|
|
182
182
|
}, C = () => {
|
|
183
183
|
const n = Number(d);
|
|
184
|
-
!isNaN(n) && n >= 1 && n <=
|
|
184
|
+
!isNaN(n) && n >= 1 && n <= l && p(n);
|
|
185
185
|
}, f = (n) => {
|
|
186
186
|
n.key === "Enter" && C();
|
|
187
187
|
};
|
|
188
|
-
return
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
/* @__PURE__ */
|
|
188
|
+
return l <= 1 ? null : /* @__PURE__ */ a("div", { className: `flex flex-wrap items-center justify-center gap-3 ${r}`, children: [
|
|
189
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
190
|
+
/* @__PURE__ */ a(
|
|
191
191
|
g,
|
|
192
192
|
{
|
|
193
193
|
variant: "outline",
|
|
@@ -217,13 +217,13 @@ function pt({
|
|
|
217
217
|
h
|
|
218
218
|
);
|
|
219
219
|
}) }),
|
|
220
|
-
/* @__PURE__ */
|
|
220
|
+
/* @__PURE__ */ a(
|
|
221
221
|
g,
|
|
222
222
|
{
|
|
223
223
|
variant: "outline",
|
|
224
224
|
size: "sm",
|
|
225
225
|
onClick: S,
|
|
226
|
-
disabled: s ===
|
|
226
|
+
disabled: s === l,
|
|
227
227
|
className: "px-2 py-1 text-sm hover:bg-gray-50",
|
|
228
228
|
children: [
|
|
229
229
|
"Next",
|
|
@@ -232,14 +232,14 @@ function pt({
|
|
|
232
232
|
}
|
|
233
233
|
)
|
|
234
234
|
] }),
|
|
235
|
-
o && /* @__PURE__ */
|
|
235
|
+
o && /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
236
236
|
/* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground", children: "Go to" }),
|
|
237
237
|
/* @__PURE__ */ e(
|
|
238
238
|
oe,
|
|
239
239
|
{
|
|
240
240
|
type: "number",
|
|
241
241
|
min: 1,
|
|
242
|
-
max:
|
|
242
|
+
max: l,
|
|
243
243
|
value: d,
|
|
244
244
|
onChange: (n) => {
|
|
245
245
|
const m = n.target.value.replace(/[^\d]/g, "");
|
|
@@ -255,7 +255,7 @@ function pt({
|
|
|
255
255
|
variant: "outline",
|
|
256
256
|
size: "sm",
|
|
257
257
|
onClick: C,
|
|
258
|
-
disabled: d === "" || Number(d) < 1 || Number(d) >
|
|
258
|
+
disabled: d === "" || Number(d) < 1 || Number(d) > l,
|
|
259
259
|
children: "Go"
|
|
260
260
|
}
|
|
261
261
|
)
|
|
@@ -263,11 +263,11 @@ function pt({
|
|
|
263
263
|
] });
|
|
264
264
|
}
|
|
265
265
|
const gt = (s = {}) => {
|
|
266
|
-
const
|
|
266
|
+
const l = q(), c = K(), { search: i, page: o = 1, limit: r = 30 } = s;
|
|
267
267
|
return fe({
|
|
268
268
|
queryKey: [E.GET_ASSETS, i, o, r],
|
|
269
269
|
queryFn: async () => {
|
|
270
|
-
const d = await c(
|
|
270
|
+
const d = await c(l, {
|
|
271
271
|
action: E.GET_ASSETS,
|
|
272
272
|
data: {
|
|
273
273
|
search: i,
|
|
@@ -281,10 +281,10 @@ const gt = (s = {}) => {
|
|
|
281
281
|
retry: 1
|
|
282
282
|
});
|
|
283
283
|
}, vt = (s) => {
|
|
284
|
-
const
|
|
284
|
+
const l = q(), c = K();
|
|
285
285
|
return fe({
|
|
286
286
|
queryKey: [E.GET_ASSET, s],
|
|
287
|
-
queryFn: async () => s ? await c(
|
|
287
|
+
queryFn: async () => s ? await c(l, {
|
|
288
288
|
action: E.GET_ASSET,
|
|
289
289
|
data: { id: s }
|
|
290
290
|
}) : null,
|
|
@@ -293,27 +293,27 @@ const gt = (s = {}) => {
|
|
|
293
293
|
});
|
|
294
294
|
};
|
|
295
295
|
function xt(s) {
|
|
296
|
-
const
|
|
297
|
-
return
|
|
296
|
+
const l = isNaN(s) ? 0 : typeof s == "number" ? s : parseInt(s);
|
|
297
|
+
return l ? l < 1024 ? `${l.toFixed(2)} B` : l < 1024 * 1024 ? `${(l / 1024).toFixed(2)} KB` : `${(l / (1024 * 1024)).toFixed(2)} MB` : "0 B";
|
|
298
298
|
}
|
|
299
299
|
function ne(s) {
|
|
300
300
|
if (!s) return "N/A";
|
|
301
|
-
const
|
|
301
|
+
const l = new Date(s);
|
|
302
302
|
return new Intl.DateTimeFormat("en-US", {
|
|
303
303
|
month: "short",
|
|
304
304
|
day: "numeric",
|
|
305
305
|
year: "numeric",
|
|
306
306
|
hour: "2-digit",
|
|
307
307
|
minute: "2-digit"
|
|
308
|
-
}).format(
|
|
308
|
+
}).format(l);
|
|
309
309
|
}
|
|
310
|
-
function se(s,
|
|
311
|
-
let c = s, i =
|
|
310
|
+
function se(s, l) {
|
|
311
|
+
let c = s, i = l == null ? void 0 : l.description;
|
|
312
312
|
return (!i || typeof i != "string") && (i = ""), (!c || typeof c != "string") && (c = ""), c !== i;
|
|
313
313
|
}
|
|
314
314
|
const yt = ({
|
|
315
315
|
assetId: s,
|
|
316
|
-
onBack:
|
|
316
|
+
onBack: l,
|
|
317
317
|
onEdit: c,
|
|
318
318
|
onSave: i,
|
|
319
319
|
isSaving: o
|
|
@@ -330,12 +330,12 @@ const yt = ({
|
|
|
330
330
|
};
|
|
331
331
|
return ue.useEffect(() => {
|
|
332
332
|
r != null && r.description && p(r.description);
|
|
333
|
-
}, [r]), d ? /* @__PURE__ */ e("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ e(O, { className: "h-8 w-8 animate-spin" }) }) : v || !(r != null && r.id) ? /* @__PURE__ */ e("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */
|
|
333
|
+
}, [r]), d ? /* @__PURE__ */ e("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ e(O, { className: "h-8 w-8 animate-spin" }) }) : v || !(r != null && r.id) ? /* @__PURE__ */ e("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ a("div", { className: "text-center max-w-md mx-auto p-6", children: [
|
|
334
334
|
/* @__PURE__ */ e("div", { className: "flex justify-center mb-4", children: /* @__PURE__ */ e(Re, { className: "h-12 w-12 text-gray-400" }) }),
|
|
335
335
|
/* @__PURE__ */ e("h3", { className: "text-lg font-medium text-gray-900 mb-2", children: "No Asset Found" }),
|
|
336
336
|
/* @__PURE__ */ e("p", { className: "text-sm text-gray-500 mb-6", children: v ? "There was an error loading the asset. Please try again later." : "The asset you're looking for doesn't exist or has been removed." }),
|
|
337
|
-
/* @__PURE__ */
|
|
338
|
-
/* @__PURE__ */ e(g, { variant: "outline", onClick:
|
|
337
|
+
/* @__PURE__ */ a("div", { className: "flex justify-center gap-4", children: [
|
|
338
|
+
/* @__PURE__ */ e(g, { variant: "outline", onClick: l, children: "Back to Assets" }),
|
|
339
339
|
v && /* @__PURE__ */ e(
|
|
340
340
|
g,
|
|
341
341
|
{
|
|
@@ -345,14 +345,14 @@ const yt = ({
|
|
|
345
345
|
}
|
|
346
346
|
)
|
|
347
347
|
] })
|
|
348
|
-
] }) }) : /* @__PURE__ */
|
|
349
|
-
/* @__PURE__ */
|
|
350
|
-
/* @__PURE__ */
|
|
348
|
+
] }) }) : /* @__PURE__ */ a("div", { className: "flex-1 flex flex-col gap-y-4 overflow-hidden", children: [
|
|
349
|
+
/* @__PURE__ */ a("div", { className: "flex items-center justify-between", children: [
|
|
350
|
+
/* @__PURE__ */ a(
|
|
351
351
|
g,
|
|
352
352
|
{
|
|
353
353
|
variant: "outline",
|
|
354
354
|
size: "sm",
|
|
355
|
-
onClick:
|
|
355
|
+
onClick: l,
|
|
356
356
|
disabled: o,
|
|
357
357
|
children: [
|
|
358
358
|
/* @__PURE__ */ e(de, { className: "h-4 w-4" }),
|
|
@@ -360,9 +360,9 @@ const yt = ({
|
|
|
360
360
|
]
|
|
361
361
|
}
|
|
362
362
|
),
|
|
363
|
-
/* @__PURE__ */
|
|
364
|
-
/* @__PURE__ */ e(g, { variant: "outline", onClick:
|
|
365
|
-
/* @__PURE__ */
|
|
363
|
+
/* @__PURE__ */ a("div", { className: "flex gap-2", children: [
|
|
364
|
+
/* @__PURE__ */ e(g, { variant: "outline", onClick: l, disabled: o, children: "Cancel" }),
|
|
365
|
+
/* @__PURE__ */ a(
|
|
366
366
|
g,
|
|
367
367
|
{
|
|
368
368
|
variant: "outline",
|
|
@@ -374,7 +374,7 @@ const yt = ({
|
|
|
374
374
|
]
|
|
375
375
|
}
|
|
376
376
|
),
|
|
377
|
-
/* @__PURE__ */
|
|
377
|
+
/* @__PURE__ */ a(
|
|
378
378
|
g,
|
|
379
379
|
{
|
|
380
380
|
variant: "default",
|
|
@@ -388,7 +388,7 @@ const yt = ({
|
|
|
388
388
|
)
|
|
389
389
|
] })
|
|
390
390
|
] }),
|
|
391
|
-
/* @__PURE__ */
|
|
391
|
+
/* @__PURE__ */ a("div", { className: "grid grid-cols-2 items-start gap-6 flex-1 overflow-hidden", children: [
|
|
392
392
|
/* @__PURE__ */ e("div", { className: "relative h-[calc(80vh-200px)] w-full flex items-start justify-center", children: /* @__PURE__ */ e(
|
|
393
393
|
"img",
|
|
394
394
|
{
|
|
@@ -397,8 +397,8 @@ const yt = ({
|
|
|
397
397
|
className: "w-full h-full object-contain rounded-lg max-h-max max-w-max"
|
|
398
398
|
}
|
|
399
399
|
) }),
|
|
400
|
-
/* @__PURE__ */
|
|
401
|
-
/* @__PURE__ */
|
|
400
|
+
/* @__PURE__ */ a("div", { className: "space-y-6", children: [
|
|
401
|
+
/* @__PURE__ */ a("div", { className: "grid gap-3 border rounded-md pt-2 bg-gray-100", children: [
|
|
402
402
|
/* @__PURE__ */ e(_, { className: "w-full text-center", children: "Details" }),
|
|
403
403
|
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-2 text-sm border rounded-md p-2 bg-white", children: [
|
|
404
404
|
{ label: "File Name", value: r.name },
|
|
@@ -431,10 +431,10 @@ const yt = ({
|
|
|
431
431
|
value: r.url,
|
|
432
432
|
copyable: !0
|
|
433
433
|
}
|
|
434
|
-
].map((n) => /* @__PURE__ */
|
|
434
|
+
].map((n) => /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
435
435
|
/* @__PURE__ */ e(_, { className: "w-max text-left px-2 w-1/4 font-normal text-gray-700", children: n.label }),
|
|
436
436
|
":",
|
|
437
|
-
/* @__PURE__ */
|
|
437
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
438
438
|
/* @__PURE__ */ e(
|
|
439
439
|
"div",
|
|
440
440
|
{
|
|
@@ -455,18 +455,18 @@ const yt = ({
|
|
|
455
455
|
] })
|
|
456
456
|
] }, n.label)) })
|
|
457
457
|
] }),
|
|
458
|
-
r.usedOn && r.usedOn.length > 0 && /* @__PURE__ */
|
|
458
|
+
r.usedOn && r.usedOn.length > 0 && /* @__PURE__ */ a("div", { className: "grid gap-3", children: [
|
|
459
459
|
/* @__PURE__ */ e(_, { children: "Used On" }),
|
|
460
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-2 text-sm border rounded-md p-2", children: r.usedOn.map((n, m) => /* @__PURE__ */
|
|
460
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-2 text-sm border rounded-md p-2", children: r.usedOn.map((n, m) => /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
461
461
|
/* @__PURE__ */ e("div", { className: "w-max text-left font-medium text-gray-900", children: n.name }),
|
|
462
|
-
/* @__PURE__ */
|
|
462
|
+
/* @__PURE__ */ a("div", { className: "text-gray-500", children: [
|
|
463
463
|
"(",
|
|
464
464
|
n.slug,
|
|
465
465
|
")"
|
|
466
466
|
] })
|
|
467
467
|
] }, m)) })
|
|
468
468
|
] }),
|
|
469
|
-
/* @__PURE__ */
|
|
469
|
+
/* @__PURE__ */ a("div", { className: "grid gap-3 border rounded-md pt-2 bg-gray-100 relative", children: [
|
|
470
470
|
/* @__PURE__ */ e(_, { className: "w-full text-center", children: "Description" }),
|
|
471
471
|
/* @__PURE__ */ e(
|
|
472
472
|
ze,
|
|
@@ -487,7 +487,7 @@ const yt = ({
|
|
|
487
487
|
onClick: () => i(y),
|
|
488
488
|
disabled: o || !se(y, r),
|
|
489
489
|
className: `py-0 bg-blue-500 text-white px-3 py-0.5 rounded-md text-sm ${o || !se(y, r) ? "opacity-50 cursor-not-allowed" : ""}`,
|
|
490
|
-
children: o ? /* @__PURE__ */
|
|
490
|
+
children: o ? /* @__PURE__ */ a(Q, { children: [
|
|
491
491
|
/* @__PURE__ */ e(O, { className: "h-4 w-4 mr-2 animate-spin" }),
|
|
492
492
|
"Saving..."
|
|
493
493
|
] }) : "Save"
|
|
@@ -497,7 +497,7 @@ const yt = ({
|
|
|
497
497
|
] })
|
|
498
498
|
] })
|
|
499
499
|
] });
|
|
500
|
-
}, Nt = ue.lazy(() => import("./image-editor-CzFST20j.js")), bt = 25 * 1024 * 1024, wt = ({ isUpdatingAsset: s, allowedTypes:
|
|
500
|
+
}, Nt = ue.lazy(() => import("./image-editor-CzFST20j.js")), bt = 25 * 1024 * 1024, wt = ({ isUpdatingAsset: s, allowedTypes: l, uploadAssets: c, isUploadingAsset: i, onUploaded: o }) => {
|
|
501
501
|
const [r, d] = b(() => {
|
|
502
502
|
const f = localStorage.getItem("chai_optimize_images");
|
|
503
503
|
return f !== null ? f === "true" : !0;
|
|
@@ -542,7 +542,7 @@ const yt = ({
|
|
|
542
542
|
}, { getRootProps: w, getInputProps: S, isDragActive: C } = nt({
|
|
543
543
|
onDrop: p,
|
|
544
544
|
accept: {
|
|
545
|
-
"image/*":
|
|
545
|
+
"image/*": l.includes("image") ? [] : []
|
|
546
546
|
},
|
|
547
547
|
disabled: s || i,
|
|
548
548
|
multiple: !0
|
|
@@ -551,7 +551,7 @@ const yt = ({
|
|
|
551
551
|
"div",
|
|
552
552
|
{
|
|
553
553
|
className: `flex h-[60px] w-full flex-col items-center justify-center rounded-lg border-2 border-dashed border-slate-300 p-0 py-2 hover:border-black/50 ${v ? "pointer-events-none bg-gray-100 opacity-90" : "bg-gray-100 hover:border-black/50 hover:bg-gray-100"}`,
|
|
554
|
-
children: /* @__PURE__ */
|
|
554
|
+
children: /* @__PURE__ */ a(
|
|
555
555
|
"div",
|
|
556
556
|
{
|
|
557
557
|
...w(),
|
|
@@ -562,18 +562,18 @@ const yt = ({
|
|
|
562
562
|
),
|
|
563
563
|
children: [
|
|
564
564
|
/* @__PURE__ */ e("input", { ...S() }),
|
|
565
|
-
v ? /* @__PURE__ */ e("div", { className: "flex flex-col items-center px-6", children: /* @__PURE__ */
|
|
565
|
+
v ? /* @__PURE__ */ e("div", { className: "flex flex-col items-center px-6", children: /* @__PURE__ */ a("div", { className: "flex items-center justify-center gap-2 leading-tight", children: [
|
|
566
566
|
/* @__PURE__ */ e("div", { className: "flex items-center justify-center rounded-full bg-indigo-100 p-2", children: /* @__PURE__ */ e(O, { className: "h-4 w-4 animate-spin text-indigo-500" }) }),
|
|
567
|
-
/* @__PURE__ */
|
|
567
|
+
/* @__PURE__ */ a("div", { className: "text-left", children: [
|
|
568
568
|
/* @__PURE__ */ e("div", { className: "font-medium", children: s ? "Updating file..." : "Uploading file..." }),
|
|
569
|
-
/* @__PURE__ */
|
|
569
|
+
/* @__PURE__ */ a("div", { className: "text-xs font-light text-muted-foreground", children: [
|
|
570
570
|
"Please wait while we ",
|
|
571
571
|
s ? "update" : "upload",
|
|
572
572
|
" your file..."
|
|
573
573
|
] })
|
|
574
574
|
] })
|
|
575
|
-
] }) }) : /* @__PURE__ */
|
|
576
|
-
/* @__PURE__ */ e("div", { className: "flex flex-col items-center", children: /* @__PURE__ */
|
|
575
|
+
] }) }) : /* @__PURE__ */ a("div", { className: "flex w-full items-center justify-between px-6", children: [
|
|
576
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col items-center", children: /* @__PURE__ */ a("div", { className: "flex items-center justify-between gap-2 leading-tight", children: [
|
|
577
577
|
/* @__PURE__ */ e(
|
|
578
578
|
"div",
|
|
579
579
|
{
|
|
@@ -581,21 +581,21 @@ const yt = ({
|
|
|
581
581
|
children: /* @__PURE__ */ e(tt, { className: "h-4 w-4 text-indigo-500" })
|
|
582
582
|
}
|
|
583
583
|
),
|
|
584
|
-
/* @__PURE__ */
|
|
585
|
-
/* @__PURE__ */
|
|
584
|
+
/* @__PURE__ */ a("div", { className: "text-left", children: [
|
|
585
|
+
/* @__PURE__ */ a("div", { className: "font-medium", children: [
|
|
586
586
|
"Drop your file here or",
|
|
587
587
|
" ",
|
|
588
588
|
/* @__PURE__ */ e("span", { className: "cursor-pointer text-indigo-500 hover:underline", children: "browse" })
|
|
589
589
|
] }),
|
|
590
|
-
/* @__PURE__ */ e("div", { className: "text-xs font-light text-muted-foreground", children: /* @__PURE__ */
|
|
590
|
+
/* @__PURE__ */ e("div", { className: "text-xs font-light text-muted-foreground", children: /* @__PURE__ */ a("span", { className: "", children: [
|
|
591
591
|
"Accepted file types: ",
|
|
592
|
-
/* @__PURE__ */ e("span", { className: "capitalize text-indigo-400", children:
|
|
592
|
+
/* @__PURE__ */ e("span", { className: "capitalize text-indigo-400", children: l.join(", ") })
|
|
593
593
|
] }) })
|
|
594
594
|
] })
|
|
595
595
|
] }) }),
|
|
596
|
-
/* @__PURE__ */
|
|
597
|
-
/* @__PURE__ */
|
|
598
|
-
/* @__PURE__ */
|
|
596
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
597
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
598
|
+
/* @__PURE__ */ a("span", { className: "text-xs", children: [
|
|
599
599
|
"Optimization:",
|
|
600
600
|
" ",
|
|
601
601
|
/* @__PURE__ */ e("span", { className: r ? "text-indigo-600" : "text-gray-400", children: r ? "On" : "Off" })
|
|
@@ -614,7 +614,7 @@ const yt = ({
|
|
|
614
614
|
}
|
|
615
615
|
)
|
|
616
616
|
] }),
|
|
617
|
-
/* @__PURE__ */ e(B, { children: /* @__PURE__ */
|
|
617
|
+
/* @__PURE__ */ e(B, { children: /* @__PURE__ */ a(M, { children: [
|
|
618
618
|
/* @__PURE__ */ e($, { asChild: !0, children: /* @__PURE__ */ e(
|
|
619
619
|
"span",
|
|
620
620
|
{
|
|
@@ -622,7 +622,7 @@ const yt = ({
|
|
|
622
622
|
children: /* @__PURE__ */ e(it, { className: "mr-1 h-4 w-4" })
|
|
623
623
|
}
|
|
624
624
|
) }),
|
|
625
|
-
/* @__PURE__ */ e(P, { side: "top", children: /* @__PURE__ */
|
|
625
|
+
/* @__PURE__ */ e(P, { side: "top", children: /* @__PURE__ */ a("p", { className: "text-xs text-white", children: [
|
|
626
626
|
"Warning: Unoptimized images may affect ",
|
|
627
627
|
/* @__PURE__ */ e("br", {}),
|
|
628
628
|
" performance and page load times"
|
|
@@ -636,8 +636,8 @@ const yt = ({
|
|
|
636
636
|
}
|
|
637
637
|
);
|
|
638
638
|
};
|
|
639
|
-
function Ut({ close: s, onSelect:
|
|
640
|
-
const d = he(() => [c], [c]), [v, y] = b(null), [p, w] = b(null), [S, C] = b(null), [f, n] = b({ show: !1, file: "" }), [m, h] = b(!1), [x, N] = b(i ? "details" : "grid"), [z, V] = b(""), [D, j] = b(""), [G, H] = b(1), [ee] = b(30), [k,
|
|
639
|
+
function Ut({ close: s, onSelect: l, mode: c = "image", assetId: i }) {
|
|
640
|
+
const d = he(() => [c], [c]), [v, y] = b(null), [p, w] = b(null), [S, C] = b(null), [f, n] = b({ show: !1, file: "" }), [m, h] = b(!1), [x, N] = b(i ? "details" : "grid"), [z, V] = b(""), [D, j] = b(""), [G, H] = b(1), [ee] = b(30), [k, J] = b([]);
|
|
641
641
|
W(() => {
|
|
642
642
|
i && (y(i), N("details"));
|
|
643
643
|
}, [i]), W(() => {
|
|
@@ -654,27 +654,27 @@ function Ut({ close: s, onSelect: a, mode: c = "image", assetId: i }) {
|
|
|
654
654
|
search: z.toLowerCase().trim(),
|
|
655
655
|
page: G,
|
|
656
656
|
limit: ee
|
|
657
|
-
}),
|
|
657
|
+
}), I = (F == null ? void 0 : F.assets) || [], ge = (F == null ? void 0 : F.total) || 0, T = Math.ceil(ge / ee);
|
|
658
658
|
W(() => {
|
|
659
|
-
R ||
|
|
660
|
-
}, [R,
|
|
661
|
-
const ve = (
|
|
659
|
+
R || T <= 0 || H((t) => t > T ? T : t < 1 ? 1 : t);
|
|
660
|
+
}, [R, T]);
|
|
661
|
+
const ve = (I == null ? void 0 : I.length) > 0, { mutate: xe } = ht(), { mutateAsync: te, isPending: ye } = ut(), { mutate: ie, isPending: Ne } = ft(), re = L(
|
|
662
662
|
(t) => {
|
|
663
|
-
const u = Math.min(Math.max(1, t), Math.max(1,
|
|
663
|
+
const u = Math.min(Math.max(1, t), Math.max(1, T));
|
|
664
664
|
u !== G && H(u);
|
|
665
665
|
},
|
|
666
|
-
[
|
|
666
|
+
[T, G]
|
|
667
667
|
), be = (t) => {
|
|
668
668
|
j(t.target.value);
|
|
669
669
|
}, we = L(
|
|
670
670
|
(t) => {
|
|
671
|
-
|
|
671
|
+
J((u) => $e(u, { id: t.id }) ? [] : [t]);
|
|
672
672
|
},
|
|
673
673
|
[!1]
|
|
674
674
|
), Ce = L(() => {
|
|
675
|
-
|
|
676
|
-
}, []),
|
|
677
|
-
(t == null ? void 0 : t.length) !== 0 && (
|
|
675
|
+
J([]);
|
|
676
|
+
}, []), le = (t) => {
|
|
677
|
+
(t == null ? void 0 : t.length) !== 0 && (l(Oe(qe(t || k), ["id", "url", "width", "height", "description"])), s());
|
|
678
678
|
}, Ae = async (t) => {
|
|
679
679
|
w(t);
|
|
680
680
|
}, Se = async () => {
|
|
@@ -705,18 +705,18 @@ function Ut({ close: s, onSelect: a, mode: c = "image", assetId: i }) {
|
|
|
705
705
|
} catch (U) {
|
|
706
706
|
console.error("Error saving edited image:", U);
|
|
707
707
|
}
|
|
708
|
-
},
|
|
709
|
-
|
|
710
|
-
}, []),
|
|
708
|
+
}, Te = L((t) => {
|
|
709
|
+
J([t]);
|
|
710
|
+
}, []), Ie = L(
|
|
711
711
|
(t) => {
|
|
712
712
|
re(t);
|
|
713
713
|
},
|
|
714
714
|
[re]
|
|
715
715
|
);
|
|
716
|
-
return /* @__PURE__ */
|
|
717
|
-
/* @__PURE__ */
|
|
716
|
+
return /* @__PURE__ */ a(Q, { children: [
|
|
717
|
+
/* @__PURE__ */ a("div", { className: "flex h-[80vh] max-h-[1232px] w-[80vw] max-w-[1232px] flex-col space-y-4", children: [
|
|
718
718
|
/* @__PURE__ */ e("h1", { className: "text-lg font-medium", children: "Digital Asset Manager" }),
|
|
719
|
-
x === "grid" ? /* @__PURE__ */
|
|
719
|
+
x === "grid" ? /* @__PURE__ */ a(Q, { children: [
|
|
720
720
|
/* @__PURE__ */ e(
|
|
721
721
|
wt,
|
|
722
722
|
{
|
|
@@ -725,12 +725,12 @@ function Ut({ close: s, onSelect: a, mode: c = "image", assetId: i }) {
|
|
|
725
725
|
uploadAssets: te,
|
|
726
726
|
isUpdatingAsset: Ne,
|
|
727
727
|
isUploadingAsset: ye,
|
|
728
|
-
onUploaded:
|
|
728
|
+
onUploaded: Te
|
|
729
729
|
}
|
|
730
730
|
),
|
|
731
|
-
/* @__PURE__ */
|
|
732
|
-
/* @__PURE__ */
|
|
733
|
-
/* @__PURE__ */
|
|
731
|
+
/* @__PURE__ */ a("div", { className: "relative flex flex-1 flex-col gap-y-3 overflow-hidden rounded-lg border p-2", children: [
|
|
732
|
+
/* @__PURE__ */ a("div", { className: "flex items-center justify-between gap-3", children: [
|
|
733
|
+
/* @__PURE__ */ a("div", { className: "relative w-1/2", children: [
|
|
734
734
|
/* @__PURE__ */ e(
|
|
735
735
|
We,
|
|
736
736
|
{
|
|
@@ -748,8 +748,8 @@ function Ut({ close: s, onSelect: a, mode: c = "image", assetId: i }) {
|
|
|
748
748
|
}
|
|
749
749
|
)
|
|
750
750
|
] }),
|
|
751
|
-
/* @__PURE__ */
|
|
752
|
-
k.length > 0 ? /* @__PURE__ */ e("div", { className: "flex items-center justify-between", children: /* @__PURE__ */
|
|
751
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-x-2", children: [
|
|
752
|
+
k.length > 0 ? /* @__PURE__ */ e("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
753
753
|
k.length > 0 && /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e(
|
|
754
754
|
g,
|
|
755
755
|
{
|
|
@@ -764,7 +764,7 @@ function Ut({ close: s, onSelect: a, mode: c = "image", assetId: i }) {
|
|
|
764
764
|
g,
|
|
765
765
|
{
|
|
766
766
|
size: "sm",
|
|
767
|
-
onClick: () =>
|
|
767
|
+
onClick: () => le(k),
|
|
768
768
|
disabled: k.length === 0,
|
|
769
769
|
children: "Select Asset"
|
|
770
770
|
}
|
|
@@ -773,7 +773,7 @@ function Ut({ close: s, onSelect: a, mode: c = "image", assetId: i }) {
|
|
|
773
773
|
/* @__PURE__ */ e(g, { variant: "ghost", size: "icon", onClick: () => pe(), children: /* @__PURE__ */ e(Ve, { className: "h-4 w-4" }) })
|
|
774
774
|
] })
|
|
775
775
|
] }),
|
|
776
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto pb-[66px]", children: R ? /* @__PURE__ */
|
|
776
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto pb-[66px]", children: R ? /* @__PURE__ */ a("div", { className: "columns-1 gap-3 space-y-3 sm:columns-3 md:columns-5", children: [
|
|
777
777
|
/* @__PURE__ */ e("div", { className: "h-64 w-full animate-pulse rounded bg-gray-200" }),
|
|
778
778
|
/* @__PURE__ */ e("div", { className: "h-64 w-full animate-pulse rounded bg-gray-200" }),
|
|
779
779
|
/* @__PURE__ */ e("div", { className: "h-64 w-full animate-pulse rounded bg-gray-200" }),
|
|
@@ -784,12 +784,12 @@ function Ut({ close: s, onSelect: a, mode: c = "image", assetId: i }) {
|
|
|
784
784
|
/* @__PURE__ */ e("div", { className: "h-64 w-full animate-pulse rounded bg-gray-200" }),
|
|
785
785
|
/* @__PURE__ */ e("div", { className: "h-64 w-full animate-pulse rounded bg-gray-200" }),
|
|
786
786
|
/* @__PURE__ */ e("div", { className: "h-64 w-full animate-pulse rounded bg-gray-200" })
|
|
787
|
-
] }) : !R && !ve ? /* @__PURE__ */
|
|
787
|
+
] }) : !R && !ve ? /* @__PURE__ */ a("div", { className: "flex h-full flex-col items-center justify-center rounded-lg border", children: [
|
|
788
788
|
/* @__PURE__ */ e("div", { className: "text-muted-foreground", children: /* @__PURE__ */ e(He, { className: "h-9 w-9 text-indigo-500" }) }),
|
|
789
789
|
/* @__PURE__ */ e("div", { className: "text-lg text-muted-foreground", children: "No assets found" }),
|
|
790
790
|
/* @__PURE__ */ e("div", { className: "text-sm text-muted-foreground", children: z.length > 0 ? "No assets found for your search: " + z : "Start uploading assets to get started" }),
|
|
791
791
|
/* @__PURE__ */ e("br", {})
|
|
792
|
-
] }) : /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-3 p-1", children:
|
|
792
|
+
] }) : /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-3 p-1", children: I == null ? void 0 : I.map((t) => /* @__PURE__ */ a(
|
|
793
793
|
"div",
|
|
794
794
|
{
|
|
795
795
|
className: ce(
|
|
@@ -799,9 +799,9 @@ function Ut({ close: s, onSelect: a, mode: c = "image", assetId: i }) {
|
|
|
799
799
|
S === t.id ? "pointer-events-none opacity-50" : ""
|
|
800
800
|
),
|
|
801
801
|
onClick: () => we(t),
|
|
802
|
-
onDoubleClick: () =>
|
|
802
|
+
onDoubleClick: () => le([t]),
|
|
803
803
|
children: [
|
|
804
|
-
/* @__PURE__ */
|
|
804
|
+
/* @__PURE__ */ a("div", { className: "aspect-square relative overflow-hidden", children: [
|
|
805
805
|
S === t.id ? /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-black/50", children: /* @__PURE__ */ e(O, { className: "h-8 w-8 animate-spin text-white" }) }) : null,
|
|
806
806
|
t.type === "image" ? /* @__PURE__ */ e(
|
|
807
807
|
"img",
|
|
@@ -810,8 +810,8 @@ function Ut({ close: s, onSelect: a, mode: c = "image", assetId: i }) {
|
|
|
810
810
|
alt: t.name,
|
|
811
811
|
className: `h-full min-h-[80px] w-full object-contain ${k.some((u) => u.id === t.id) ? "" : "group-hover:blur group-hover:contrast-50"}`
|
|
812
812
|
}
|
|
813
|
-
) : /* @__PURE__ */
|
|
814
|
-
/* @__PURE__ */ e(
|
|
813
|
+
) : /* @__PURE__ */ a("div", { className: "flex h-full items-center justify-center", children: [
|
|
814
|
+
/* @__PURE__ */ e(Je, { className: "h-12 w-12 text-muted-foreground" }),
|
|
815
815
|
t.thumbnailUrl && /* @__PURE__ */ e(
|
|
816
816
|
"img",
|
|
817
817
|
{
|
|
@@ -822,12 +822,12 @@ function Ut({ close: s, onSelect: a, mode: c = "image", assetId: i }) {
|
|
|
822
822
|
)
|
|
823
823
|
] })
|
|
824
824
|
] }),
|
|
825
|
-
/* @__PURE__ */
|
|
825
|
+
/* @__PURE__ */ a("div", { className: "flex items-end justify-between border-t-[1px] border-black/10 bg-white px-2 py-1", children: [
|
|
826
826
|
/* @__PURE__ */ e("div", { className: "truncate text-xs leading-tight", title: t.name, children: t.name }),
|
|
827
827
|
/* @__PURE__ */ e("div", { className: "flex items-center justify-between whitespace-nowrap text-[9px] font-light text-muted-foreground", children: /* @__PURE__ */ e("span", { children: st((t == null ? void 0 : t.size) || 0) }) })
|
|
828
828
|
] }),
|
|
829
|
-
!k.some((u) => u.id === t.id) && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center opacity-0 transition-opacity group-hover:opacity-100", children: /* @__PURE__ */
|
|
830
|
-
/* @__PURE__ */ e(B, { children: /* @__PURE__ */
|
|
829
|
+
!k.some((u) => u.id === t.id) && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center opacity-0 transition-opacity group-hover:opacity-100", children: /* @__PURE__ */ a("div", { className: "grid grid-cols-4 gap-2 p-2", children: [
|
|
830
|
+
/* @__PURE__ */ e(B, { children: /* @__PURE__ */ a(M, { children: [
|
|
831
831
|
/* @__PURE__ */ e($, { asChild: !0, children: /* @__PURE__ */ e(
|
|
832
832
|
g,
|
|
833
833
|
{
|
|
@@ -837,12 +837,12 @@ function Ut({ close: s, onSelect: a, mode: c = "image", assetId: i }) {
|
|
|
837
837
|
onClick: (u) => {
|
|
838
838
|
u.stopPropagation(), Ee(t);
|
|
839
839
|
},
|
|
840
|
-
children: /* @__PURE__ */ e(
|
|
840
|
+
children: /* @__PURE__ */ e(Xe, { className: "h-4 w-4" })
|
|
841
841
|
}
|
|
842
842
|
) }),
|
|
843
843
|
/* @__PURE__ */ e(P, { children: /* @__PURE__ */ e("p", { children: "View Details" }) })
|
|
844
844
|
] }) }),
|
|
845
|
-
/* @__PURE__ */ e(B, { children: /* @__PURE__ */
|
|
845
|
+
/* @__PURE__ */ e(B, { children: /* @__PURE__ */ a(M, { children: [
|
|
846
846
|
/* @__PURE__ */ e($, { asChild: !0, children: /* @__PURE__ */ e(
|
|
847
847
|
g,
|
|
848
848
|
{
|
|
@@ -857,7 +857,7 @@ function Ut({ close: s, onSelect: a, mode: c = "image", assetId: i }) {
|
|
|
857
857
|
) }),
|
|
858
858
|
/* @__PURE__ */ e(P, { children: /* @__PURE__ */ e("p", { children: "Copy URL" }) })
|
|
859
859
|
] }) }),
|
|
860
|
-
/* @__PURE__ */ e(B, { children: /* @__PURE__ */
|
|
860
|
+
/* @__PURE__ */ e(B, { children: /* @__PURE__ */ a(M, { children: [
|
|
861
861
|
/* @__PURE__ */ e($, { asChild: !0, children: /* @__PURE__ */ e(
|
|
862
862
|
g,
|
|
863
863
|
{
|
|
@@ -872,12 +872,12 @@ function Ut({ close: s, onSelect: a, mode: c = "image", assetId: i }) {
|
|
|
872
872
|
name: t.name
|
|
873
873
|
});
|
|
874
874
|
},
|
|
875
|
-
children: /* @__PURE__ */ e(
|
|
875
|
+
children: /* @__PURE__ */ e(Ze, { className: "h-4 w-4" })
|
|
876
876
|
}
|
|
877
877
|
) }),
|
|
878
878
|
/* @__PURE__ */ e(P, { children: /* @__PURE__ */ e("p", { children: "Edit Image" }) })
|
|
879
879
|
] }) }),
|
|
880
|
-
/* @__PURE__ */ e(B, { children: /* @__PURE__ */
|
|
880
|
+
/* @__PURE__ */ e(B, { children: /* @__PURE__ */ a(M, { children: [
|
|
881
881
|
/* @__PURE__ */ e($, { asChild: !0, children: /* @__PURE__ */ e(
|
|
882
882
|
g,
|
|
883
883
|
{
|
|
@@ -898,12 +898,12 @@ function Ut({ close: s, onSelect: a, mode: c = "image", assetId: i }) {
|
|
|
898
898
|
},
|
|
899
899
|
t.id
|
|
900
900
|
)) }) }),
|
|
901
|
-
|
|
901
|
+
T > 1 && /* @__PURE__ */ e("div", { className: "absolute bottom-0 left-0 right-0 border-t bg-white p-4", children: /* @__PURE__ */ e(dt, { fallback: /* @__PURE__ */ e("div", { className: "text-red-500", children: "Error loading pagination" }), children: /* @__PURE__ */ e(
|
|
902
902
|
pt,
|
|
903
903
|
{
|
|
904
904
|
currentPage: G,
|
|
905
|
-
totalPages:
|
|
906
|
-
onPageChange:
|
|
905
|
+
totalPages: T,
|
|
906
|
+
onPageChange: Ie,
|
|
907
907
|
pageRangeDisplayed: 3,
|
|
908
908
|
showPageInput: !0
|
|
909
909
|
}
|
|
@@ -928,7 +928,7 @@ function Ut({ close: s, onSelect: a, mode: c = "image", assetId: i }) {
|
|
|
928
928
|
if (v) {
|
|
929
929
|
h(!0);
|
|
930
930
|
try {
|
|
931
|
-
const u =
|
|
931
|
+
const u = I.find((U) => U.id === v);
|
|
932
932
|
u && await ie(Pe(u, { description: t }));
|
|
933
933
|
} finally {
|
|
934
934
|
h(!1);
|
|
@@ -940,7 +940,7 @@ function Ut({ close: s, onSelect: a, mode: c = "image", assetId: i }) {
|
|
|
940
940
|
)
|
|
941
941
|
] }),
|
|
942
942
|
f.show && /* @__PURE__ */ e(
|
|
943
|
-
|
|
943
|
+
at,
|
|
944
944
|
{
|
|
945
945
|
fallback: /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ e(O, { className: "h-8 w-8 animate-spin" }) }),
|
|
946
946
|
children: /* @__PURE__ */ e(
|
|
@@ -955,16 +955,16 @@ function Ut({ close: s, onSelect: a, mode: c = "image", assetId: i }) {
|
|
|
955
955
|
)
|
|
956
956
|
}
|
|
957
957
|
),
|
|
958
|
-
p && /* @__PURE__ */ e(De, { open: !!p, onOpenChange: () => w(null), children: /* @__PURE__ */
|
|
959
|
-
/* @__PURE__ */
|
|
958
|
+
p && /* @__PURE__ */ e(De, { open: !!p, onOpenChange: () => w(null), children: /* @__PURE__ */ a(je, { children: [
|
|
959
|
+
/* @__PURE__ */ a(Fe, { children: [
|
|
960
960
|
/* @__PURE__ */ e(Ue, { children: "Delete Asset" }),
|
|
961
|
-
/* @__PURE__ */
|
|
961
|
+
/* @__PURE__ */ a(Le, { children: [
|
|
962
962
|
'Are you sure you want to delete "',
|
|
963
963
|
p.name,
|
|
964
964
|
'"? This action cannot be undone.'
|
|
965
965
|
] })
|
|
966
966
|
] }),
|
|
967
|
-
/* @__PURE__ */
|
|
967
|
+
/* @__PURE__ */ a(Be, { className: "gap-2 sm:gap-0", children: [
|
|
968
968
|
/* @__PURE__ */ e(g, { variant: "outline", onClick: () => w(null), children: "Cancel" }),
|
|
969
969
|
/* @__PURE__ */ e(g, { variant: "destructive", onClick: Se, children: "Delete" })
|
|
970
970
|
] })
|