@chaibuilder/sdk 4.0.0-beta.49 → 4.0.0-beta.51
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/README.md +35 -52
- package/dist/{2SSKDMRQ-CjvuNdPo.cjs → 2SSKDMRQ-BSYe_xPq.cjs} +1 -1
- package/dist/{2SSKDMRQ-Dvf9zadl.js → 2SSKDMRQ-Dv-C_YAA.js} +3 -3
- package/dist/{AP7HFJJL-DYFttFoI.cjs → AP7HFJJL-BJolKJBt.cjs} +1 -1
- package/dist/{AP7HFJJL-q4dJdyFs.js → AP7HFJJL-DhdVstVC.js} +1 -1
- package/dist/{IconPicker-Bf163F7t.js → IconPicker-BBkl0T8b.js} +13 -13
- package/dist/{IconPicker-JWhYq2Gp.cjs → IconPicker-C0WWlb8t.cjs} +1 -1
- package/dist/{WDYDFRGG-O9GIrtX0.js → WDYDFRGG-CJs2MxSq.js} +4 -4
- package/dist/{WDYDFRGG-BEksfGMC.cjs → WDYDFRGG-DRt6Zg7Q.cjs} +1 -1
- package/dist/{actions-registery-BHbZHkE3.cjs → actions-registery-CLL3KrNv.cjs} +2 -2
- package/dist/{actions-registery-gJb_wq2F.js → actions-registery-CrGIlqUX.js} +88 -88
- package/dist/actions.cjs +1 -1
- package/dist/actions.js +2 -2
- package/dist/{add-new-language-page-BfUp5Ua2.cjs → add-new-language-page-ByMSfRcN.cjs} +1 -1
- package/dist/{add-new-language-page-CRR93tLq.js → add-new-language-page-DtVoDNfI.js} +35 -35
- package/dist/{add-new-page-B8NGK6WS.cjs → add-new-page-CnuChfJz.cjs} +1 -1
- package/dist/add-new-page-DanzzvYo.js +31 -0
- package/dist/{ai-panel-default-lang-BXYQye3N.js → ai-panel-default-lang-BaPz2d_6.js} +35 -35
- package/dist/{ai-panel-default-lang-VhgmHFoQ.cjs → ai-panel-default-lang-CoIQSz_Y.cjs} +2 -2
- package/dist/{ai-panel-other-lang-DaCf-cq4.js → ai-panel-other-lang--i-5z4e2.js} +22 -22
- package/dist/{ai-panel-other-lang-Ds0EXeUC.cjs → ai-panel-other-lang-ChlMVodg.cjs} +1 -1
- package/dist/{ai-prompt-input-7iWk72w5.js → ai-prompt-input-BQi0VDJC.js} +77 -77
- package/dist/{ai-prompt-input-nZ5_Dm7X.cjs → ai-prompt-input-BT5426AB.cjs} +1 -1
- package/dist/{ai-translation-prompt-1OUs1P7n.js → ai-translation-prompt-BN78s33t.js} +8 -8
- package/dist/{ai-translation-prompt-B16cK-1Q.cjs → ai-translation-prompt-BQPaekp3.cjs} +1 -1
- package/dist/{apply-binding-CBSjMYSk.cjs → apply-binding-Cjh1kqMO.cjs} +1 -1
- package/dist/{apply-binding-vAuN-TGV.js → apply-binding-v_W4uR3U.js} +28 -28
- package/dist/{plugin-BSjgGgwo.js → chai-theme-helpers-BEf2rwE4.js} +83 -83
- package/dist/chai-theme-helpers-q3nwoNht.cjs +22 -0
- package/dist/{change-password-modal-D5eXjiYq.cjs → change-password-modal-DHUrrKw7.cjs} +1 -1
- package/dist/{change-password-modal-CdvJR1Ln.js → change-password-modal-pEp-nMNb.js} +30 -30
- package/dist/{code-display-DdWcOQ_i.js → code-display-BaLKScgW.js} +5 -5
- package/dist/{code-display-BR-gij5j.cjs → code-display-i7jb2kmw.cjs} +1 -1
- package/dist/{code-editor-CyLjDiEp.js → code-editor-CRoniyP0.js} +12 -12
- package/dist/{code-editor-SWbfFj1E.cjs → code-editor-gwFRjQ2_.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +0 -5
- package/dist/core.js +49 -49
- package/dist/{css-import-modal-Be47CBJn.js → css-import-modal-B3qxX9Iv.js} +14 -14
- package/dist/{css-import-modal-Bdwgd05S.cjs → css-import-modal-nAB5FSwn.cjs} +2 -2
- package/dist/{delete-page-C99K2qzS.js → delete-page-DbawNFf7.js} +13 -13
- package/dist/{delete-page-DLohaU-U.cjs → delete-page-YP1HEAoD.cjs} +1 -1
- package/dist/{digital-asset-manager-BZMb6sC7.js → digital-asset-manager-DTD5mf24.js} +388 -357
- package/dist/digital-asset-manager-kJnuMqpw.cjs +1 -0
- package/dist/{duplicate-page-D5Gtvqdv.cjs → duplicate-page-CxqW_EO7.cjs} +1 -1
- package/dist/{duplicate-page-CDc2X0eW.js → duplicate-page-DnRb1y6K.js} +19 -19
- package/dist/{dynamic-page-selector-DZHhX008.cjs → dynamic-page-selector-2EqJhUrB.cjs} +1 -1
- package/dist/{dynamic-page-selector-DvNBXo6o.js → dynamic-page-selector-D6VLDIN9.js} +17 -17
- package/dist/{get-chai-builder-tailwind-config-7CxFxEYL.cjs → get-chai-builder-tailwind-config-DNp8Vhme.cjs} +1 -1
- package/dist/{get-chai-builder-tailwind-config-DC4sDOYK.js → get-chai-builder-tailwind-config-k8l5sdcw.js} +3 -3
- package/dist/{get-chai-builder-theme-BpuwSLeS.js → get-chai-builder-theme-DLpviqPJ.js} +1 -1
- package/dist/get-chai-builder-theme-Du4ARJlw.cjs +1 -0
- package/dist/{image-editor-DwhTYkVR.cjs → image-editor-BQcOGsli.cjs} +1 -1
- package/dist/{image-editor-BBvvi9Vm.js → image-editor-CMf731xL.js} +15 -15
- package/dist/index-BYrRPW_c.cjs +5 -0
- package/dist/index-D-r_K4yA.cjs +160 -0
- package/dist/{index-OuHV9Ann.js → index-DPV6NiJ-.js} +5894 -6049
- package/dist/index-DqzFD1CG.js +4861 -0
- package/dist/{mark-as-template-CP_F9ZQ4.js → mark-as-template-D7jqSCXw.js} +28 -28
- package/dist/{mark-as-template-B9yLcasI.cjs → mark-as-template-DyB56HzI.cjs} +1 -1
- package/dist/{nested-path-selector-content-DmtCI3q9.js → nested-path-selector-content-dwSikrsV.js} +2 -2
- package/dist/{nested-path-selector-content-aTdu-o0e.cjs → nested-path-selector-content-g9_Tq_sR.cjs} +1 -1
- package/dist/no-language-page-content-BRITuyfN.js +43 -0
- package/dist/{no-language-page-content-C-MCdPXt.cjs → no-language-page-content-ZvMNVY-Y.cjs} +1 -1
- package/dist/{no-language-page-dialog-D4QIAHnE.cjs → no-language-page-dialog-Cndq8xRP.cjs} +1 -1
- package/dist/no-language-page-dialog-D7L9nVb9.js +10 -0
- package/dist/page-creator-BAIbU14q.js +652 -0
- package/dist/page-creator-qL3-M8g3.cjs +1 -0
- package/dist/{page-manager-new-ah6QYar2.cjs → page-manager-new-By3eGO3i.cjs} +1 -1
- package/dist/{page-manager-new-ttsrxdW9.js → page-manager-new-YRG89y4f.js} +63 -63
- package/dist/page-manager-search-and-filter-BbdgOU9V.cjs +1 -0
- package/dist/page-manager-search-and-filter-Cllju4CV.js +184 -0
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +0 -15
- package/dist/pages.js +20 -21
- package/dist/{publish-pages-content-KZVMHT6V.js → publish-pages-content-CG5LBUnY.js} +48 -48
- package/dist/{publish-pages-content-BrajJUcP.cjs → publish-pages-content-DxMiBxNU.cjs} +1 -1
- package/dist/{register-chai-top-bar-DyW9GPzV.cjs → register-chai-top-bar-CCssW5dL.cjs} +1 -1
- package/dist/{register-chai-top-bar-D6GjnauV.js → register-chai-top-bar-DWmJ2efT.js} +11 -11
- package/dist/render.cjs +1 -1
- package/dist/render.js +54 -54
- package/dist/{rte-widget-modal-CiTwsXTr.cjs → rte-widget-modal-CsTqFJc_.cjs} +1 -1
- package/dist/{rte-widget-modal-IU8JzPuZ.js → rte-widget-modal-DoeTMRtX.js} +2 -2
- package/dist/runtime-client.cjs +1 -1
- package/dist/runtime-client.js +1 -1
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.js +1 -1
- package/dist/sdk.css +1 -1
- package/dist/{selected-block-display-CidmQ-wz.js → selected-block-display-Ck1kkNEi.js} +17 -28
- package/dist/{selected-block-display-CAFEOrLV.cjs → selected-block-display-DSow6N4b.cjs} +1 -1
- package/dist/seo-panel---mYZmLD.js +559 -0
- package/dist/seo-panel-mfX63fua.cjs +1 -0
- package/dist/{shared-json-ld-uvMmwCYp.js → shared-json-ld-B3I_RLE2.js} +46 -46
- package/dist/{shared-json-ld-CMH-eRUq.cjs → shared-json-ld-CGgwUOlW.cjs} +1 -1
- package/dist/{slug-input-DLWTMTsO.js → slug-input-DQ4t3-Tt.js} +5 -5
- package/dist/{slug-input-CiHC5l3r.cjs → slug-input-DaNbl597.cjs} +1 -1
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.js +2 -2
- package/dist/types.d.ts +0 -96
- package/dist/{unmark-as-template-F7TdgWjI.cjs → unmark-as-template-CZ65AE4v.cjs} +1 -1
- package/dist/{unmark-as-template-C5ovsEBP.js → unmark-as-template-DvmoTbVu.js} +11 -11
- package/dist/unpublish-page-3--vO5b0.js +28 -0
- package/dist/{unpublish-page-CUr8Xub6.cjs → unpublish-page-B46TiWlU.cjs} +1 -1
- package/dist/{unpublished-partials-modal-BhNAub_z.js → unpublished-partials-modal-DVMz3q83.js} +18 -15
- package/dist/{unpublished-partials-modal-Cv5R9-hi.cjs → unpublished-partials-modal-U5lKBOSR.cjs} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +2 -2
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +2 -2
- package/dist/{web-preview-D9pXonAv.js → web-preview-D5o5XQo0.js} +2 -2
- package/dist/{web-preview-CuMYekVJ.cjs → web-preview-Da3RhcjQ.cjs} +1 -1
- package/package.json +1 -1
- package/dist/active-in-another-tab-B4Ur0JP7.js +0 -35
- package/dist/active-in-another-tab-BPdx4lWh.cjs +0 -1
- package/dist/add-new-page-Ppy5-y5j.js +0 -31
- package/dist/continue-editing-in-this-client-BrSvK-Ay.js +0 -25
- package/dist/continue-editing-in-this-client-Cmi-GkYZ.cjs +0 -1
- package/dist/design-token-usage-D1lWCJ3L.js +0 -114
- package/dist/design-token-usage-eY2wQ0l3.cjs +0 -1
- package/dist/digital-asset-manager-Z5aJxkq0.cjs +0 -1
- package/dist/get-chai-builder-theme-B5RkBTsB.cjs +0 -1
- package/dist/image-compression-DPFITwOL.js +0 -37
- package/dist/image-compression-UaU7Bwqe.cjs +0 -1
- package/dist/index-BVwFJWDq.cjs +0 -5
- package/dist/index-DCJDQs1a.cjs +0 -160
- package/dist/index-LBTm1Jmk.js +0 -5199
- package/dist/json-diff-viewer-Cb1CmRqP.cjs +0 -8
- package/dist/json-diff-viewer-DG6qMOBS.js +0 -261
- package/dist/lang-panel-B3USOxGq.js +0 -216
- package/dist/lang-panel-DxoJ0v4y.cjs +0 -1
- package/dist/manage-design-tokens-6YGIctip.js +0 -446
- package/dist/manage-design-tokens-modal-BSSCXH8Y.cjs +0 -1
- package/dist/manage-design-tokens-modal-CzsnN49F.js +0 -161
- package/dist/manage-design-tokens-udLBvkHA.cjs +0 -1
- package/dist/no-language-page-content-D8t5dfgh.js +0 -43
- package/dist/no-language-page-dialog-C_fHI2zI.js +0 -10
- package/dist/page-creator-Cz_ah-qE.cjs +0 -1
- package/dist/page-creator-DKEkuGCO.js +0 -796
- package/dist/page-lock-CwZKJ4IE.js +0 -30
- package/dist/page-lock-DdCvtA-I.cjs +0 -1
- package/dist/page-locked-dialog-CrTDBoC4.cjs +0 -1
- package/dist/page-locked-dialog-DqLlooUz.js +0 -136
- package/dist/page-manager-search-and-filter-D7AupT6_.cjs +0 -1
- package/dist/page-manager-search-and-filter-bsqZ6wnI.js +0 -210
- package/dist/page-revisions-content-B6hsIla7.cjs +0 -1
- package/dist/page-revisions-content-C5O8_Fms.js +0 -459
- package/dist/plugin-DHpuZZXz.cjs +0 -22
- package/dist/save-to-lib-DMnv7ENo.js +0 -429
- package/dist/save-to-lib-Dc700Aop.cjs +0 -1
- package/dist/seo-panel-Br8gxDxu.js +0 -789
- package/dist/seo-panel-CMY-adM-.cjs +0 -2
- package/dist/take-over-request-IRLgF1dG.cjs +0 -1
- package/dist/take-over-request-KdR1_h_K.js +0 -64
- package/dist/translation-warning-modal-CLZ9tC1F.cjs +0 -1
- package/dist/translation-warning-modal-CzNt6LDO.js +0 -27
- package/dist/unpublish-page-0fR1o0b7.js +0 -28
|
@@ -1,114 +1,145 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import { useQueryClient as
|
|
13
|
-
import {
|
|
14
|
-
import { c as
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import { jsxs as n, jsx as e, Fragment as H } from "react/jsx-runtime";
|
|
2
|
+
import { find as $e, merge as Me, pick as Y, first as Le, isEmpty as _e } from "lodash-es";
|
|
3
|
+
import { ChevronLeft as he, ChevronRight as Pe, Loader as G, AlertCircle as qe, Copy as fe, Pencil as Be, Link as Oe, Search as Ge, RefreshCwIcon as Re, Archive as Ke, Film as Qe, ImageIcon as We, Edit as Ve, Trash2 as He, Check as Xe, Upload as Ze, AlertTriangle as Je } from "lucide-react";
|
|
4
|
+
import pe, { useState as y, useMemo as ge, useEffect as O, useCallback as L, Suspense as Ye } from "react";
|
|
5
|
+
import { useDropzone as et } from "react-dropzone";
|
|
6
|
+
import { ErrorBoundary as tt } from "react-error-boundary";
|
|
7
|
+
import { useTranslation as te } from "react-i18next";
|
|
8
|
+
import { toast as w } from "sonner";
|
|
9
|
+
import { B as p, z as xe } from "./register-chai-top-bar-DWmJ2efT.js";
|
|
10
|
+
import { p as V, T as it, ae as _, F as P, G as q, H as B, D as at, e as lt, f as rt, g as nt, o as st, q as ct, af as ot } from "./index-DPV6NiJ-.js";
|
|
11
|
+
import dt from "compressorjs";
|
|
12
|
+
import { useQueryClient as ie, useMutation as ae, useQuery as ve } from "@tanstack/react-query";
|
|
13
|
+
import { ai as R, aj as K, ag as A } from "./index-DqzFD1CG.js";
|
|
14
|
+
import { c as ye } from "./common-functions-D2lMFR6K.js";
|
|
15
|
+
const de = 0.5 * 1024 * 1024, mt = 10 * 1024 * 1024;
|
|
16
|
+
function ee(s) {
|
|
17
|
+
const l = isNaN(s) ? 0 : typeof s == "number" ? s : parseInt(s);
|
|
18
|
+
return l ? l < 1024 ? `${l.toFixed(2)} B` : l < 1024 * 1024 ? `${(l / 1024).toFixed(2)} KB` : `${(l / (1024 * 1024)).toFixed(2)} MB` : "0 B";
|
|
19
|
+
}
|
|
20
|
+
function ut(s) {
|
|
21
|
+
return new Promise((l, u) => {
|
|
22
|
+
if (s.size <= de) {
|
|
23
|
+
l(s);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
new dt(s, {
|
|
27
|
+
quality: 0.9,
|
|
28
|
+
// 80% quality
|
|
29
|
+
maxWidth: 2048,
|
|
30
|
+
// Limit max width
|
|
31
|
+
maxHeight: 2048,
|
|
32
|
+
// Limit max height
|
|
33
|
+
convertSize: de,
|
|
34
|
+
// Try to keep under 3MB
|
|
35
|
+
success(i) {
|
|
36
|
+
l(i);
|
|
37
|
+
},
|
|
38
|
+
error(i) {
|
|
39
|
+
w.error(
|
|
40
|
+
`Failed to compress image. Image size is ${ee(s.size)}, which exceeds the maximum allowed size of ${ee(mt)}.`
|
|
41
|
+
), u(i);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
const ht = () => {
|
|
47
|
+
const s = R(), l = ie(), u = K();
|
|
48
|
+
return ae({
|
|
49
|
+
mutationFn: async (i) => {
|
|
50
|
+
const c = i.map(async (r) => u(s, {
|
|
51
|
+
action: A.UPLOAD_ASSET,
|
|
52
|
+
data: r
|
|
22
53
|
}));
|
|
23
54
|
return await Promise.all(c);
|
|
24
55
|
},
|
|
25
|
-
onSuccess: (
|
|
56
|
+
onSuccess: (i) => {
|
|
26
57
|
var c;
|
|
27
|
-
if (
|
|
28
|
-
throw new Error(((c =
|
|
58
|
+
if (i != null && i.some((a) => a.error))
|
|
59
|
+
throw new Error(((c = i == null ? void 0 : i.find((a) => a.error)) == null ? void 0 : c.error) || "Failed to upload asset");
|
|
29
60
|
{
|
|
30
|
-
|
|
31
|
-
queryKey: [
|
|
61
|
+
l.invalidateQueries({
|
|
62
|
+
queryKey: [A.GET_ASSETS]
|
|
32
63
|
});
|
|
33
|
-
const
|
|
34
|
-
|
|
64
|
+
const a = i == null ? void 0 : i.length;
|
|
65
|
+
w.success(`${a === 1 ? "Asset" : a + " Assets"} uploaded successfully`);
|
|
35
66
|
}
|
|
36
67
|
},
|
|
37
68
|
onError: () => {
|
|
38
|
-
|
|
69
|
+
w.error("Failed to upload asset");
|
|
39
70
|
}
|
|
40
71
|
});
|
|
41
|
-
},
|
|
42
|
-
const s =
|
|
43
|
-
return
|
|
44
|
-
mutationFn: async (
|
|
45
|
-
action:
|
|
46
|
-
data: { id:
|
|
72
|
+
}, ft = () => {
|
|
73
|
+
const s = R(), l = ie(), u = K();
|
|
74
|
+
return ae({
|
|
75
|
+
mutationFn: async (i) => u(s, {
|
|
76
|
+
action: A.DELETE_ASSET,
|
|
77
|
+
data: { id: i }
|
|
47
78
|
}),
|
|
48
|
-
onSuccess: (
|
|
49
|
-
if (
|
|
50
|
-
throw new Error(
|
|
51
|
-
|
|
52
|
-
queryKey: [
|
|
53
|
-
}),
|
|
79
|
+
onSuccess: (i) => {
|
|
80
|
+
if (i != null && i.error)
|
|
81
|
+
throw new Error(i == null ? void 0 : i.error);
|
|
82
|
+
l.invalidateQueries({
|
|
83
|
+
queryKey: [A.GET_ASSETS]
|
|
84
|
+
}), w.success("Asset deleted successfully");
|
|
54
85
|
},
|
|
55
86
|
onError: () => {
|
|
56
|
-
|
|
87
|
+
w.error("Failed to delete asset");
|
|
57
88
|
}
|
|
58
89
|
});
|
|
59
|
-
},
|
|
60
|
-
const s =
|
|
61
|
-
return
|
|
62
|
-
mutationFn: async (
|
|
63
|
-
action:
|
|
64
|
-
data:
|
|
90
|
+
}, pt = () => {
|
|
91
|
+
const s = R(), l = ie(), u = K();
|
|
92
|
+
return ae({
|
|
93
|
+
mutationFn: async (i) => u(s, {
|
|
94
|
+
action: A.UPDATE_ASSET,
|
|
95
|
+
data: i
|
|
65
96
|
}),
|
|
66
|
-
onSuccess: (
|
|
67
|
-
if (
|
|
68
|
-
throw new Error(
|
|
69
|
-
|
|
70
|
-
queryKey: [
|
|
71
|
-
}),
|
|
72
|
-
queryKey: [
|
|
73
|
-
}),
|
|
97
|
+
onSuccess: (i) => {
|
|
98
|
+
if (i != null && i.error)
|
|
99
|
+
throw new Error(i == null ? void 0 : i.error);
|
|
100
|
+
l.invalidateQueries({
|
|
101
|
+
queryKey: [A.GET_ASSETS]
|
|
102
|
+
}), i != null && i.id && l.invalidateQueries({
|
|
103
|
+
queryKey: [A.GET_ASSET, i.id]
|
|
104
|
+
}), w.success("Asset updated successfully");
|
|
74
105
|
},
|
|
75
106
|
onError: () => {
|
|
76
|
-
|
|
107
|
+
w.error("Failed to update asset");
|
|
77
108
|
}
|
|
78
109
|
});
|
|
79
110
|
};
|
|
80
|
-
function
|
|
111
|
+
function gt({
|
|
81
112
|
currentPage: s,
|
|
82
|
-
totalPages:
|
|
83
|
-
onPageChange:
|
|
84
|
-
pageRangeDisplayed:
|
|
113
|
+
totalPages: l,
|
|
114
|
+
onPageChange: u,
|
|
115
|
+
pageRangeDisplayed: i = 3,
|
|
85
116
|
showPageInput: c = !0,
|
|
86
|
-
className:
|
|
117
|
+
className: a = ""
|
|
87
118
|
}) {
|
|
88
|
-
const [
|
|
89
|
-
const o = Math.floor(
|
|
90
|
-
let m = Math.max(1, s - o), d = Math.min(
|
|
91
|
-
d - m + 1 <
|
|
119
|
+
const [r, k] = y(String(s)), N = ge(() => {
|
|
120
|
+
const o = Math.floor(i / 2);
|
|
121
|
+
let m = Math.max(1, s - o), d = Math.min(l, s + o);
|
|
122
|
+
d - m + 1 < i && (m === 1 ? d = Math.min(l, m + i - 1) : d === l && (m = Math.max(1, d - i + 1)));
|
|
92
123
|
const f = [];
|
|
93
124
|
m > 1 && (f.push(1), m > 2 && f.push("..."));
|
|
94
125
|
for (let v = m; v <= d; v++)
|
|
95
126
|
f.push(v);
|
|
96
|
-
return d <
|
|
97
|
-
}, [s,
|
|
98
|
-
o !== s && o >= 1 && o <=
|
|
127
|
+
return d < l && (d < l - 1 && f.push("..."), f.push(l)), f;
|
|
128
|
+
}, [s, l, i]), x = (o) => {
|
|
129
|
+
o !== s && o >= 1 && o <= l && (u(o), k(String(o)));
|
|
99
130
|
}, g = () => {
|
|
100
131
|
s > 1 && x(s - 1);
|
|
101
|
-
},
|
|
102
|
-
s <
|
|
132
|
+
}, b = () => {
|
|
133
|
+
s < l && x(s + 1);
|
|
103
134
|
}, C = () => {
|
|
104
|
-
const o = Number(
|
|
105
|
-
!isNaN(o) && o >= 1 && o <=
|
|
135
|
+
const o = Number(r);
|
|
136
|
+
!isNaN(o) && o >= 1 && o <= l && x(o);
|
|
106
137
|
}, S = (o) => {
|
|
107
138
|
o.key === "Enter" && C();
|
|
108
139
|
};
|
|
109
|
-
return
|
|
110
|
-
/* @__PURE__ */
|
|
111
|
-
/* @__PURE__ */
|
|
140
|
+
return l <= 1 ? null : /* @__PURE__ */ n("div", { className: `flex flex-wrap items-center justify-center gap-3 ${a}`, children: [
|
|
141
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
142
|
+
/* @__PURE__ */ n(
|
|
112
143
|
p,
|
|
113
144
|
{
|
|
114
145
|
variant: "outline",
|
|
@@ -117,7 +148,7 @@ function ht({
|
|
|
117
148
|
disabled: s === 1,
|
|
118
149
|
className: "px-2 py-1 text-sm hover:bg-gray-50",
|
|
119
150
|
children: [
|
|
120
|
-
/* @__PURE__ */ e(
|
|
151
|
+
/* @__PURE__ */ e(he, { className: "h-4 w-4" }),
|
|
121
152
|
"Previous"
|
|
122
153
|
]
|
|
123
154
|
}
|
|
@@ -138,33 +169,33 @@ function ht({
|
|
|
138
169
|
d
|
|
139
170
|
);
|
|
140
171
|
}) }),
|
|
141
|
-
/* @__PURE__ */
|
|
172
|
+
/* @__PURE__ */ n(
|
|
142
173
|
p,
|
|
143
174
|
{
|
|
144
175
|
variant: "outline",
|
|
145
176
|
size: "sm",
|
|
146
|
-
onClick:
|
|
147
|
-
disabled: s ===
|
|
177
|
+
onClick: b,
|
|
178
|
+
disabled: s === l,
|
|
148
179
|
className: "px-2 py-1 text-sm hover:bg-gray-50",
|
|
149
180
|
children: [
|
|
150
181
|
"Next",
|
|
151
|
-
/* @__PURE__ */ e(
|
|
182
|
+
/* @__PURE__ */ e(Pe, { className: "h-4 w-4" })
|
|
152
183
|
]
|
|
153
184
|
}
|
|
154
185
|
)
|
|
155
186
|
] }),
|
|
156
|
-
c && /* @__PURE__ */
|
|
187
|
+
c && /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
157
188
|
/* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground", children: "Go to" }),
|
|
158
189
|
/* @__PURE__ */ e(
|
|
159
|
-
|
|
190
|
+
xe,
|
|
160
191
|
{
|
|
161
192
|
type: "number",
|
|
162
193
|
min: 1,
|
|
163
|
-
max:
|
|
164
|
-
value:
|
|
194
|
+
max: l,
|
|
195
|
+
value: r,
|
|
165
196
|
onChange: (o) => {
|
|
166
197
|
const m = o.target.value.replace(/[^\d]/g, "");
|
|
167
|
-
|
|
198
|
+
k(m);
|
|
168
199
|
},
|
|
169
200
|
onKeyDown: S,
|
|
170
201
|
className: "h-8 w-16 px-2 py-1"
|
|
@@ -176,153 +207,153 @@ function ht({
|
|
|
176
207
|
variant: "outline",
|
|
177
208
|
size: "sm",
|
|
178
209
|
onClick: C,
|
|
179
|
-
disabled:
|
|
210
|
+
disabled: r === "" || Number(r) < 1 || Number(r) > l,
|
|
180
211
|
children: "Go"
|
|
181
212
|
}
|
|
182
213
|
)
|
|
183
214
|
] })
|
|
184
215
|
] });
|
|
185
216
|
}
|
|
186
|
-
const
|
|
187
|
-
const
|
|
188
|
-
return
|
|
189
|
-
queryKey: [
|
|
217
|
+
const xt = (s = {}) => {
|
|
218
|
+
const l = R(), u = K(), { search: i, page: c = 1, limit: a = 30 } = s;
|
|
219
|
+
return ve({
|
|
220
|
+
queryKey: [A.GET_ASSETS, i, c, a],
|
|
190
221
|
queryFn: async () => {
|
|
191
|
-
const
|
|
192
|
-
action:
|
|
222
|
+
const r = await u(l, {
|
|
223
|
+
action: A.GET_ASSETS,
|
|
193
224
|
data: {
|
|
194
|
-
search:
|
|
225
|
+
search: i,
|
|
195
226
|
page: c,
|
|
196
|
-
limit:
|
|
227
|
+
limit: a
|
|
197
228
|
}
|
|
198
229
|
});
|
|
199
|
-
return
|
|
230
|
+
return r.page = c, r.limit = a, r;
|
|
200
231
|
},
|
|
201
232
|
staleTime: 1 / 0,
|
|
202
233
|
retry: 1
|
|
203
234
|
});
|
|
204
|
-
},
|
|
205
|
-
const
|
|
206
|
-
return
|
|
207
|
-
queryKey: [
|
|
208
|
-
queryFn: async () => s ? await
|
|
209
|
-
action:
|
|
235
|
+
}, vt = (s) => {
|
|
236
|
+
const l = R(), u = K();
|
|
237
|
+
return ve({
|
|
238
|
+
queryKey: [A.GET_ASSET, s],
|
|
239
|
+
queryFn: async () => s ? await u(l, {
|
|
240
|
+
action: A.GET_ASSET,
|
|
210
241
|
data: { id: s }
|
|
211
242
|
}) : null,
|
|
212
243
|
staleTime: 1 / 0,
|
|
213
244
|
retry: 1
|
|
214
245
|
});
|
|
215
246
|
};
|
|
216
|
-
function
|
|
217
|
-
const
|
|
218
|
-
return
|
|
247
|
+
function yt(s) {
|
|
248
|
+
const l = isNaN(s) ? 0 : typeof s == "number" ? s : parseInt(s);
|
|
249
|
+
return l ? l < 1024 ? `${l.toFixed(2)} B` : l < 1024 * 1024 ? `${(l / 1024).toFixed(2)} KB` : `${(l / (1024 * 1024)).toFixed(2)} MB` : "0 B";
|
|
219
250
|
}
|
|
220
|
-
function
|
|
251
|
+
function me(s) {
|
|
221
252
|
if (!s) return "N/A";
|
|
222
|
-
const
|
|
253
|
+
const l = new Date(s);
|
|
223
254
|
return new Intl.DateTimeFormat("en-US", {
|
|
224
255
|
month: "short",
|
|
225
256
|
day: "numeric",
|
|
226
257
|
year: "numeric",
|
|
227
258
|
hour: "2-digit",
|
|
228
259
|
minute: "2-digit"
|
|
229
|
-
}).format(
|
|
260
|
+
}).format(l);
|
|
230
261
|
}
|
|
231
|
-
function
|
|
232
|
-
let
|
|
233
|
-
return (!
|
|
262
|
+
function ue(s, l) {
|
|
263
|
+
let u = s, i = l == null ? void 0 : l.description;
|
|
264
|
+
return (!i || typeof i != "string") && (i = ""), (!u || typeof u != "string") && (u = ""), u !== i;
|
|
234
265
|
}
|
|
235
|
-
const
|
|
266
|
+
const Nt = ({ assetId: s, onBack: l, onEdit: u, onSave: i, isSaving: c }) => {
|
|
236
267
|
var o, m;
|
|
237
|
-
const { t:
|
|
268
|
+
const { t: a } = te(), { data: r, isLoading: k, isError: N } = vt(s || ""), [x, g] = y(""), [b, C] = y(!1);
|
|
238
269
|
O(() => {
|
|
239
270
|
const d = new Image();
|
|
240
|
-
return d.src = (
|
|
271
|
+
return d.src = (r == null ? void 0 : r.url) || "", d.onload = () => C(!0), () => {
|
|
241
272
|
d.onload = null;
|
|
242
273
|
};
|
|
243
|
-
}, [
|
|
274
|
+
}, [r]);
|
|
244
275
|
const S = async (d, f) => {
|
|
245
276
|
try {
|
|
246
|
-
await navigator.clipboard.writeText(d),
|
|
277
|
+
await navigator.clipboard.writeText(d), w.success(a("{{type}} copied to clipboard", { type: f }));
|
|
247
278
|
} catch (v) {
|
|
248
|
-
|
|
279
|
+
w.error(a("Failed to copy {{type}}", { type: f }), {
|
|
249
280
|
description: v == null ? void 0 : v.message
|
|
250
281
|
});
|
|
251
282
|
}
|
|
252
283
|
};
|
|
253
|
-
return
|
|
254
|
-
|
|
255
|
-
}, [
|
|
256
|
-
/* @__PURE__ */ e("div", { className: "mb-4 flex justify-center", children: /* @__PURE__ */ e(
|
|
257
|
-
/* @__PURE__ */ e("h3", { className: "mb-2 text-lg font-medium text-gray-900", children:
|
|
258
|
-
/* @__PURE__ */ e("p", { className: "mb-6 text-sm text-gray-500", children:
|
|
259
|
-
/* @__PURE__ */
|
|
260
|
-
/* @__PURE__ */ e(p, { variant: "outline", onClick:
|
|
261
|
-
N && /* @__PURE__ */ e(p, { variant: "default", onClick: () => window.location.reload(), children:
|
|
284
|
+
return pe.useEffect(() => {
|
|
285
|
+
r != null && r.description && g(r.description);
|
|
286
|
+
}, [r]), k || !b ? /* @__PURE__ */ e("div", { className: "flex flex-1 items-center justify-center", children: /* @__PURE__ */ e(G, { className: "h-8 w-8 animate-spin" }) }) : N || !(r != null && r.id) ? /* @__PURE__ */ e("div", { className: "flex flex-1 items-center justify-center", children: /* @__PURE__ */ n("div", { className: "mx-auto max-w-md p-6 text-center", children: [
|
|
287
|
+
/* @__PURE__ */ e("div", { className: "mb-4 flex justify-center", children: /* @__PURE__ */ e(qe, { className: "h-12 w-12 text-gray-400" }) }),
|
|
288
|
+
/* @__PURE__ */ e("h3", { className: "mb-2 text-lg font-medium text-gray-900", children: a("No Asset Found") }),
|
|
289
|
+
/* @__PURE__ */ e("p", { className: "mb-6 text-sm text-gray-500", children: a(N ? "There was an error loading the asset. Please try again later." : "The asset you're looking for doesn't exist or has been removed.") }),
|
|
290
|
+
/* @__PURE__ */ n("div", { className: "flex justify-center gap-4", children: [
|
|
291
|
+
/* @__PURE__ */ e(p, { variant: "outline", onClick: l, children: a("Back to Assets") }),
|
|
292
|
+
N && /* @__PURE__ */ e(p, { variant: "default", onClick: () => window.location.reload(), children: a("Try Again") })
|
|
262
293
|
] })
|
|
263
|
-
] }) }) : /* @__PURE__ */
|
|
264
|
-
/* @__PURE__ */
|
|
265
|
-
/* @__PURE__ */
|
|
266
|
-
/* @__PURE__ */ e(
|
|
267
|
-
|
|
294
|
+
] }) }) : /* @__PURE__ */ n("div", { className: "flex flex-1 flex-col gap-y-4 overflow-hidden", children: [
|
|
295
|
+
/* @__PURE__ */ n("div", { className: "flex items-center justify-between", children: [
|
|
296
|
+
/* @__PURE__ */ n(p, { variant: "outline", size: "sm", onClick: l, disabled: c, children: [
|
|
297
|
+
/* @__PURE__ */ e(he, { className: "h-4 w-4" }),
|
|
298
|
+
a("Back to Assets")
|
|
268
299
|
] }),
|
|
269
|
-
/* @__PURE__ */
|
|
270
|
-
/* @__PURE__ */ e(p, { variant: "outline", onClick:
|
|
271
|
-
/* @__PURE__ */
|
|
272
|
-
/* @__PURE__ */ e(
|
|
273
|
-
|
|
300
|
+
/* @__PURE__ */ n("div", { className: "flex gap-2", children: [
|
|
301
|
+
/* @__PURE__ */ e(p, { variant: "outline", onClick: l, disabled: c, children: a("Cancel") }),
|
|
302
|
+
/* @__PURE__ */ n(p, { variant: "outline", onClick: () => S(r.url, a("Asset URL")), disabled: c, children: [
|
|
303
|
+
/* @__PURE__ */ e(fe, { className: "mr-2 h-4 w-4" }),
|
|
304
|
+
a("Copy URL")
|
|
274
305
|
] }),
|
|
275
|
-
/* @__PURE__ */
|
|
276
|
-
/* @__PURE__ */ e(
|
|
277
|
-
|
|
306
|
+
/* @__PURE__ */ n(p, { variant: "default", onClick: () => u(r), disabled: c, children: [
|
|
307
|
+
/* @__PURE__ */ e(Be, { className: "h-4 w-4" }),
|
|
308
|
+
a("Edit Image")
|
|
278
309
|
] })
|
|
279
310
|
] })
|
|
280
311
|
] }),
|
|
281
|
-
/* @__PURE__ */
|
|
312
|
+
/* @__PURE__ */ n("div", { className: "grid flex-1 grid-cols-2 items-start gap-6 overflow-hidden", children: [
|
|
282
313
|
/* @__PURE__ */ e("div", { className: "relative flex h-[calc(80vh-200px)] w-full items-start justify-center", children: /* @__PURE__ */ e(
|
|
283
314
|
"img",
|
|
284
315
|
{
|
|
285
|
-
src:
|
|
286
|
-
alt:
|
|
316
|
+
src: r.url,
|
|
317
|
+
alt: r.name,
|
|
287
318
|
className: "h-full max-h-max w-full max-w-max rounded-lg object-contain"
|
|
288
319
|
}
|
|
289
320
|
) }),
|
|
290
|
-
/* @__PURE__ */
|
|
291
|
-
/* @__PURE__ */
|
|
292
|
-
/* @__PURE__ */ e(V, { className: "w-full text-center", children:
|
|
321
|
+
/* @__PURE__ */ n("div", { className: "space-y-6", children: [
|
|
322
|
+
/* @__PURE__ */ n("div", { className: "grid gap-3 rounded-md border bg-gray-100 pt-2", children: [
|
|
323
|
+
/* @__PURE__ */ e(V, { className: "w-full text-center", children: a("Details") }),
|
|
293
324
|
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-2 rounded-md border bg-white p-2 text-sm", children: [
|
|
294
|
-
{ label:
|
|
295
|
-
{ label:
|
|
325
|
+
{ label: a("File Name"), value: r.name },
|
|
326
|
+
{ label: a("Type"), value: r.type, capitalize: !0 },
|
|
296
327
|
{
|
|
297
|
-
label:
|
|
298
|
-
value: ((o =
|
|
328
|
+
label: a("Format"),
|
|
329
|
+
value: ((o = r.metadata) == null ? void 0 : o.format) || r.type,
|
|
299
330
|
capitalize: !0
|
|
300
331
|
},
|
|
301
332
|
{
|
|
302
|
-
label:
|
|
303
|
-
value:
|
|
333
|
+
label: a("Size"),
|
|
334
|
+
value: yt(r.size)
|
|
304
335
|
},
|
|
305
336
|
{
|
|
306
|
-
label:
|
|
307
|
-
value: `${
|
|
337
|
+
label: a("Dimensions"),
|
|
338
|
+
value: `${r.width || 0} × ${r.height || 0}`
|
|
308
339
|
},
|
|
309
340
|
{
|
|
310
|
-
label:
|
|
311
|
-
value:
|
|
341
|
+
label: a("Created"),
|
|
342
|
+
value: me(r.createdAt)
|
|
312
343
|
},
|
|
313
344
|
{
|
|
314
|
-
label:
|
|
315
|
-
value:
|
|
345
|
+
label: a("Updated"),
|
|
346
|
+
value: me(((m = r.metadata) == null ? void 0 : m.updatedAt) || (r == null ? void 0 : r.updatedAt) || r.createdAt)
|
|
316
347
|
},
|
|
317
348
|
{
|
|
318
|
-
label:
|
|
319
|
-
value:
|
|
349
|
+
label: a("URL"),
|
|
350
|
+
value: r.url,
|
|
320
351
|
copyable: !0
|
|
321
352
|
}
|
|
322
|
-
].map((d) => /* @__PURE__ */
|
|
353
|
+
].map((d) => /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
323
354
|
/* @__PURE__ */ e(V, { className: "w-1/4 w-max px-2 text-left font-normal text-gray-700", children: d.label }),
|
|
324
355
|
":",
|
|
325
|
-
/* @__PURE__ */
|
|
356
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
326
357
|
/* @__PURE__ */ e(
|
|
327
358
|
"div",
|
|
328
359
|
{
|
|
@@ -337,31 +368,31 @@ const xt = ({ assetId: s, onBack: n, onEdit: h, onSave: a, isSaving: c }) => {
|
|
|
337
368
|
size: "icon",
|
|
338
369
|
className: "h-6 w-6",
|
|
339
370
|
onClick: () => S(d.value, d.label),
|
|
340
|
-
children: /* @__PURE__ */ e(
|
|
371
|
+
children: /* @__PURE__ */ e(Oe, { className: "h-3 w-3" })
|
|
341
372
|
}
|
|
342
373
|
)
|
|
343
374
|
] })
|
|
344
375
|
] }, d.label)) })
|
|
345
376
|
] }),
|
|
346
|
-
|
|
347
|
-
/* @__PURE__ */ e(V, { children:
|
|
348
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-2 rounded-md border p-2 text-sm", children:
|
|
377
|
+
r.usedOn && r.usedOn.length > 0 && /* @__PURE__ */ n("div", { className: "grid gap-3", children: [
|
|
378
|
+
/* @__PURE__ */ e(V, { children: a("Used On") }),
|
|
379
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-2 rounded-md border p-2 text-sm", children: r.usedOn.map((d, f) => /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
349
380
|
/* @__PURE__ */ e("div", { className: "w-max text-left font-medium text-gray-900", children: d.name }),
|
|
350
|
-
/* @__PURE__ */
|
|
381
|
+
/* @__PURE__ */ n("div", { className: "text-gray-500", children: [
|
|
351
382
|
"(",
|
|
352
383
|
d.slug,
|
|
353
384
|
")"
|
|
354
385
|
] })
|
|
355
386
|
] }, f)) })
|
|
356
387
|
] }),
|
|
357
|
-
/* @__PURE__ */
|
|
358
|
-
/* @__PURE__ */ e(V, { className: "w-full text-center", children:
|
|
388
|
+
/* @__PURE__ */ n("div", { className: "relative grid gap-3 rounded-md border bg-gray-100 pt-2", children: [
|
|
389
|
+
/* @__PURE__ */ e(V, { className: "w-full text-center", children: a("Description") }),
|
|
359
390
|
/* @__PURE__ */ e(
|
|
360
|
-
|
|
391
|
+
it,
|
|
361
392
|
{
|
|
362
393
|
id: "description",
|
|
363
394
|
value: x,
|
|
364
|
-
placeholder:
|
|
395
|
+
placeholder: a("Enter a description for the asset"),
|
|
365
396
|
onChange: (d) => g(d.target.value),
|
|
366
397
|
rows: 3,
|
|
367
398
|
disabled: c,
|
|
@@ -372,131 +403,131 @@ const xt = ({ assetId: s, onBack: n, onEdit: h, onSave: a, isSaving: c }) => {
|
|
|
372
403
|
"button",
|
|
373
404
|
{
|
|
374
405
|
type: "button",
|
|
375
|
-
onClick: () =>
|
|
376
|
-
disabled: c || !
|
|
377
|
-
className: `rounded-md bg-blue-500 px-3 py-0 py-0.5 text-sm text-white ${c || !
|
|
378
|
-
children: c ? /* @__PURE__ */
|
|
379
|
-
/* @__PURE__ */ e(
|
|
380
|
-
|
|
381
|
-
] }) :
|
|
406
|
+
onClick: () => i(x),
|
|
407
|
+
disabled: c || !ue(x, r),
|
|
408
|
+
className: `rounded-md bg-blue-500 px-3 py-0 py-0.5 text-sm text-white ${c || !ue(x, r) ? "cursor-not-allowed opacity-50" : ""}`,
|
|
409
|
+
children: c ? /* @__PURE__ */ n(H, { children: [
|
|
410
|
+
/* @__PURE__ */ e(G, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
411
|
+
a("Saving...")
|
|
412
|
+
] }) : a("Save")
|
|
382
413
|
}
|
|
383
414
|
) })
|
|
384
415
|
] })
|
|
385
416
|
] })
|
|
386
417
|
] })
|
|
387
418
|
] });
|
|
388
|
-
},
|
|
389
|
-
const { t:
|
|
419
|
+
}, wt = pe.lazy(() => import("./image-editor-CMf731xL.js")), bt = 25 * 1024 * 1024, At = ({ isUpdatingAsset: s, allowedTypes: l, uploadAssets: u, isUploadingAsset: i, onUploaded: c }) => {
|
|
420
|
+
const { t: a } = te(), [r, k] = y(() => {
|
|
390
421
|
const o = localStorage.getItem("chai_optimize_images");
|
|
391
422
|
return o !== null ? o === "true" : !0;
|
|
392
423
|
});
|
|
393
424
|
O(() => {
|
|
394
|
-
localStorage.setItem("chai_optimize_images",
|
|
395
|
-
}, [
|
|
396
|
-
const N = s ||
|
|
425
|
+
localStorage.setItem("chai_optimize_images", r.toString());
|
|
426
|
+
}, [r]);
|
|
427
|
+
const N = s || i, x = L(
|
|
397
428
|
async (o) => {
|
|
398
429
|
try {
|
|
399
430
|
const m = o;
|
|
400
431
|
if (!m.every((E) => E.type.startsWith("image/")))
|
|
401
|
-
return
|
|
432
|
+
return w.error(a("Invalid file type. Please upload a valid file.")), Promise.reject(new Error("Invalid file type"));
|
|
402
433
|
const d = m.map(async (E) => {
|
|
403
434
|
let j = E;
|
|
404
|
-
return E.type.startsWith("image/") &&
|
|
435
|
+
return E.type.startsWith("image/") && r && (j = await ut(E)), new Promise((X, F) => {
|
|
405
436
|
const U = new FileReader();
|
|
406
437
|
U.readAsDataURL(j), U.onload = async () => {
|
|
407
438
|
X({
|
|
408
439
|
file: U.result,
|
|
409
440
|
folderId: void 0,
|
|
410
441
|
name: E.name,
|
|
411
|
-
optimize:
|
|
442
|
+
optimize: r
|
|
412
443
|
});
|
|
413
444
|
}, U.onerror = () => F(null);
|
|
414
445
|
});
|
|
415
|
-
}), f = await Promise.all(d), v = await
|
|
446
|
+
}), f = await Promise.all(d), v = await u(f);
|
|
416
447
|
return (v == null ? void 0 : v.length) === 1 && c(v[0]), v;
|
|
417
448
|
} catch (m) {
|
|
418
449
|
return Promise.reject(m);
|
|
419
450
|
}
|
|
420
451
|
},
|
|
421
|
-
[
|
|
452
|
+
[u, r, c, a]
|
|
422
453
|
), g = (o) => {
|
|
423
454
|
const m = [];
|
|
424
455
|
let d = 0;
|
|
425
456
|
return o.forEach((f) => {
|
|
426
|
-
f.size >
|
|
427
|
-
}), d > 0 &&
|
|
428
|
-
`${d === 1 && o.length === 1 ?
|
|
429
|
-
),
|
|
430
|
-
}, { getRootProps:
|
|
457
|
+
f.size > bt ? d++ : m.push(f);
|
|
458
|
+
}), d > 0 && w.error(
|
|
459
|
+
`${d === 1 && o.length === 1 ? a("File") : d + a(d === 1 ? " file" : " files")} ${a("exceed the maximum size limit of 10MB.")}`
|
|
460
|
+
), _e(m) ? [] : x(m);
|
|
461
|
+
}, { getRootProps: b, getInputProps: C, isDragActive: S } = et({
|
|
431
462
|
onDrop: g,
|
|
432
463
|
accept: {
|
|
433
|
-
"image/*":
|
|
464
|
+
"image/*": l.includes("image") ? [] : []
|
|
434
465
|
},
|
|
435
|
-
disabled: s ||
|
|
466
|
+
disabled: s || i,
|
|
436
467
|
multiple: !0
|
|
437
468
|
});
|
|
438
469
|
return /* @__PURE__ */ e(
|
|
439
470
|
"div",
|
|
440
471
|
{
|
|
441
472
|
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 ${N ? "pointer-events-none bg-gray-100 opacity-90" : "bg-gray-100 hover:border-black/50 hover:bg-gray-100"}`,
|
|
442
|
-
children: /* @__PURE__ */
|
|
473
|
+
children: /* @__PURE__ */ n(
|
|
443
474
|
"div",
|
|
444
475
|
{
|
|
445
|
-
...
|
|
446
|
-
className:
|
|
476
|
+
...b(),
|
|
477
|
+
className: ye(
|
|
447
478
|
"flex h-max w-full cursor-pointer flex-col justify-center rounded-lg text-center",
|
|
448
479
|
N ? "items-start" : "items-center",
|
|
449
480
|
S ? "border-primary bg-primary/5" : "border-muted-foreground/20"
|
|
450
481
|
),
|
|
451
482
|
children: [
|
|
452
483
|
/* @__PURE__ */ e("input", { ...C() }),
|
|
453
|
-
N ? /* @__PURE__ */ e("div", { className: "flex flex-col items-center px-6", children: /* @__PURE__ */
|
|
454
|
-
/* @__PURE__ */ e("div", { className: "flex items-center justify-center rounded-full bg-indigo-100 p-2", children: /* @__PURE__ */ e(
|
|
455
|
-
/* @__PURE__ */
|
|
456
|
-
/* @__PURE__ */ e("div", { className: "font-medium", children:
|
|
457
|
-
/* @__PURE__ */
|
|
458
|
-
|
|
484
|
+
N ? /* @__PURE__ */ e("div", { className: "flex flex-col items-center px-6", children: /* @__PURE__ */ n("div", { className: "flex items-center justify-center gap-2 leading-tight", children: [
|
|
485
|
+
/* @__PURE__ */ e("div", { className: "flex items-center justify-center rounded-full bg-indigo-100 p-2", children: /* @__PURE__ */ e(G, { className: "h-4 w-4 animate-spin text-indigo-500" }) }),
|
|
486
|
+
/* @__PURE__ */ n("div", { className: "text-left", children: [
|
|
487
|
+
/* @__PURE__ */ e("div", { className: "font-medium", children: a(s ? "Updating file..." : "Uploading file...") }),
|
|
488
|
+
/* @__PURE__ */ n("div", { className: "text-xs font-light text-muted-foreground", children: [
|
|
489
|
+
a("Please wait while we"),
|
|
459
490
|
" ",
|
|
460
|
-
|
|
491
|
+
a(s ? "update" : "upload"),
|
|
461
492
|
" ",
|
|
462
|
-
|
|
493
|
+
a("your file...")
|
|
463
494
|
] })
|
|
464
495
|
] })
|
|
465
|
-
] }) }) : /* @__PURE__ */
|
|
466
|
-
/* @__PURE__ */ e("div", { className: "flex flex-col items-center", children: /* @__PURE__ */
|
|
496
|
+
] }) }) : /* @__PURE__ */ n("div", { className: "flex w-full items-center justify-between px-6", children: [
|
|
497
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col items-center", children: /* @__PURE__ */ n("div", { className: "flex items-center justify-between gap-2 leading-tight", children: [
|
|
467
498
|
/* @__PURE__ */ e(
|
|
468
499
|
"div",
|
|
469
500
|
{
|
|
470
501
|
className: "flex items-center justify-center rounded-full border border-indigo-500 bg-indigo-100 p-2",
|
|
471
|
-
children: /* @__PURE__ */ e(
|
|
502
|
+
children: /* @__PURE__ */ e(Ze, { className: "h-4 w-4 text-indigo-500" })
|
|
472
503
|
}
|
|
473
504
|
),
|
|
474
|
-
/* @__PURE__ */
|
|
475
|
-
/* @__PURE__ */
|
|
476
|
-
|
|
505
|
+
/* @__PURE__ */ n("div", { className: "text-left", children: [
|
|
506
|
+
/* @__PURE__ */ n("div", { className: "font-medium", children: [
|
|
507
|
+
a("Drop your file here or"),
|
|
477
508
|
" ",
|
|
478
|
-
/* @__PURE__ */ e("span", { className: "cursor-pointer text-indigo-500 hover:underline", children:
|
|
509
|
+
/* @__PURE__ */ e("span", { className: "cursor-pointer text-indigo-500 hover:underline", children: a("browse") })
|
|
479
510
|
] }),
|
|
480
|
-
/* @__PURE__ */ e("div", { className: "text-xs font-light text-muted-foreground", children: /* @__PURE__ */
|
|
481
|
-
|
|
511
|
+
/* @__PURE__ */ e("div", { className: "text-xs font-light text-muted-foreground", children: /* @__PURE__ */ n("span", { className: "", children: [
|
|
512
|
+
a("Accepted file types:"),
|
|
482
513
|
" ",
|
|
483
|
-
/* @__PURE__ */ e("span", { className: "capitalize text-indigo-400", children:
|
|
514
|
+
/* @__PURE__ */ e("span", { className: "capitalize text-indigo-400", children: l.join(", ") })
|
|
484
515
|
] }) })
|
|
485
516
|
] })
|
|
486
517
|
] }) }),
|
|
487
|
-
/* @__PURE__ */
|
|
488
|
-
/* @__PURE__ */
|
|
489
|
-
/* @__PURE__ */
|
|
490
|
-
|
|
518
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
519
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
520
|
+
/* @__PURE__ */ n("span", { className: "text-xs", children: [
|
|
521
|
+
a("Optimization:"),
|
|
491
522
|
" ",
|
|
492
|
-
/* @__PURE__ */ e("span", { className:
|
|
523
|
+
/* @__PURE__ */ e("span", { className: r ? "text-indigo-600" : "text-gray-400", children: a(r ? "On" : "Off") })
|
|
493
524
|
] }),
|
|
494
525
|
/* @__PURE__ */ e(
|
|
495
|
-
|
|
526
|
+
ot,
|
|
496
527
|
{
|
|
497
|
-
checked:
|
|
528
|
+
checked: r,
|
|
498
529
|
onCheckedChange: (o) => {
|
|
499
|
-
|
|
530
|
+
k(o);
|
|
500
531
|
},
|
|
501
532
|
onClick: (o) => {
|
|
502
533
|
o.stopPropagation();
|
|
@@ -505,15 +536,15 @@ const xt = ({ assetId: s, onBack: n, onEdit: h, onSave: a, isSaving: c }) => {
|
|
|
505
536
|
}
|
|
506
537
|
)
|
|
507
538
|
] }),
|
|
508
|
-
/* @__PURE__ */ e(_, { children: /* @__PURE__ */
|
|
509
|
-
/* @__PURE__ */ e(
|
|
539
|
+
/* @__PURE__ */ e(_, { children: /* @__PURE__ */ n(P, { children: [
|
|
540
|
+
/* @__PURE__ */ e(q, { asChild: !0, children: /* @__PURE__ */ e(
|
|
510
541
|
"span",
|
|
511
542
|
{
|
|
512
|
-
className: `flex cursor-help items-center text-amber-500 ${
|
|
513
|
-
children: /* @__PURE__ */ e(
|
|
543
|
+
className: `flex cursor-help items-center text-amber-500 ${r ? "invisible" : ""}`,
|
|
544
|
+
children: /* @__PURE__ */ e(Je, { className: "mr-1 h-4 w-4" })
|
|
514
545
|
}
|
|
515
546
|
) }),
|
|
516
|
-
/* @__PURE__ */ e(
|
|
547
|
+
/* @__PURE__ */ e(B, { side: "top", children: /* @__PURE__ */ e("p", { className: "text-xs text-white", children: a("Warning: Unoptimized images may affect performance and page load times") }) })
|
|
517
548
|
] }) })
|
|
518
549
|
] })
|
|
519
550
|
] })
|
|
@@ -523,142 +554,142 @@ const xt = ({ assetId: s, onBack: n, onEdit: h, onSave: a, isSaving: c }) => {
|
|
|
523
554
|
}
|
|
524
555
|
);
|
|
525
556
|
};
|
|
526
|
-
function
|
|
527
|
-
const { t: c } =
|
|
557
|
+
function _t({ close: s, onSelect: l, mode: u = "image", assetId: i }) {
|
|
558
|
+
const { t: c } = te(), a = !1, r = 10, k = ge(() => [u], [u]), [N, x] = y(null), [g, b] = y(null), [C, S] = y(null), [o, m] = y({ show: !1, file: "" }), [d, f] = y(!1), [v, E] = y(i ? "details" : "grid"), [j, X] = y(""), [F, U] = y(""), [Q, Z] = y(1), [le] = y(30), [I, J] = y([]);
|
|
528
559
|
O(() => {
|
|
529
|
-
|
|
530
|
-
}, [
|
|
560
|
+
i && (x(i), E("details"));
|
|
561
|
+
}, [i]), O(() => {
|
|
531
562
|
const t = setTimeout(() => {
|
|
532
563
|
X(F), Z(1);
|
|
533
564
|
}, 300);
|
|
534
565
|
return () => clearTimeout(t);
|
|
535
566
|
}, [F]);
|
|
536
567
|
const {
|
|
537
|
-
data:
|
|
568
|
+
data: $,
|
|
538
569
|
isLoading: W,
|
|
539
|
-
refetch:
|
|
540
|
-
} =
|
|
570
|
+
refetch: Ne
|
|
571
|
+
} = xt({
|
|
541
572
|
search: j.toLowerCase().trim(),
|
|
542
|
-
page:
|
|
543
|
-
limit:
|
|
544
|
-
}), D = (
|
|
573
|
+
page: Q,
|
|
574
|
+
limit: le
|
|
575
|
+
}), D = ($ == null ? void 0 : $.assets) || [], we = ($ == null ? void 0 : $.total) || 0, T = Math.ceil(we / le);
|
|
545
576
|
O(() => {
|
|
546
577
|
W || T <= 0 || Z((t) => t > T ? T : t < 1 ? 1 : t);
|
|
547
578
|
}, [W, T]);
|
|
548
|
-
const
|
|
579
|
+
const be = (D == null ? void 0 : D.length) > 0, { mutate: Ae } = ft(), { mutateAsync: re, isPending: Ce } = ht(), { mutateAsync: ne, isPending: Se } = pt(), se = L(
|
|
549
580
|
(t) => {
|
|
550
|
-
const
|
|
551
|
-
|
|
581
|
+
const h = Math.min(Math.max(1, t), Math.max(1, T));
|
|
582
|
+
h !== Q && Z(h);
|
|
552
583
|
},
|
|
553
|
-
[T,
|
|
554
|
-
),
|
|
584
|
+
[T, Q]
|
|
585
|
+
), Ee = (t) => {
|
|
555
586
|
U(t.target.value);
|
|
556
|
-
},
|
|
587
|
+
}, Ie = L(
|
|
557
588
|
(t) => {
|
|
558
|
-
J((
|
|
589
|
+
J((h) => $e(h, { id: t.id }) ? [] : [t]);
|
|
559
590
|
},
|
|
560
|
-
[
|
|
561
|
-
),
|
|
591
|
+
[a]
|
|
592
|
+
), ke = L(() => {
|
|
562
593
|
J([]);
|
|
563
|
-
}, []),
|
|
564
|
-
(t == null ? void 0 : t.length) !== 0 && (
|
|
565
|
-
},
|
|
566
|
-
|
|
567
|
-
},
|
|
568
|
-
g && (S(g == null ? void 0 : g.id), await
|
|
594
|
+
}, []), ce = (t) => {
|
|
595
|
+
(t == null ? void 0 : t.length) !== 0 && (l(Y(Le(t || I), ["id", "url", "width", "height", "description"])), s());
|
|
596
|
+
}, Te = async (t) => {
|
|
597
|
+
b(t);
|
|
598
|
+
}, ze = async () => {
|
|
599
|
+
g && (S(g == null ? void 0 : g.id), await Ae(g.id, {
|
|
569
600
|
onSuccess: () => {
|
|
570
|
-
S(null),
|
|
601
|
+
S(null), b(null);
|
|
571
602
|
},
|
|
572
603
|
onError: () => {
|
|
573
604
|
S(null);
|
|
574
605
|
}
|
|
575
|
-
}),
|
|
576
|
-
},
|
|
606
|
+
}), b(null));
|
|
607
|
+
}, De = (t) => {
|
|
577
608
|
x(t.id), E("details");
|
|
578
|
-
},
|
|
609
|
+
}, je = async (t, h) => {
|
|
579
610
|
try {
|
|
580
|
-
const
|
|
581
|
-
if (
|
|
582
|
-
const z = await
|
|
611
|
+
const M = localStorage.getItem("chai_optimize_images") !== "false";
|
|
612
|
+
if (h) {
|
|
613
|
+
const z = await re([
|
|
583
614
|
{
|
|
584
615
|
file: t,
|
|
585
616
|
folderId: void 0,
|
|
586
617
|
name: o.name || "",
|
|
587
|
-
optimize:
|
|
618
|
+
optimize: M
|
|
588
619
|
}
|
|
589
620
|
]);
|
|
590
621
|
if ((z == null ? void 0 : z.length) > 0) {
|
|
591
|
-
const
|
|
592
|
-
|
|
593
|
-
...Y(
|
|
594
|
-
url:
|
|
622
|
+
const oe = z[0];
|
|
623
|
+
l({
|
|
624
|
+
...Y(oe, ["id", "width", "height", "description"]),
|
|
625
|
+
url: oe.url
|
|
595
626
|
});
|
|
596
627
|
}
|
|
597
628
|
} else {
|
|
598
|
-
const z = await
|
|
629
|
+
const z = await ne({
|
|
599
630
|
id: o.id || "",
|
|
600
631
|
file: t
|
|
601
632
|
});
|
|
602
|
-
z &&
|
|
633
|
+
z && l({
|
|
603
634
|
...Y(z, ["id", "width", "height", "description"]),
|
|
604
635
|
url: z.url
|
|
605
636
|
});
|
|
606
637
|
}
|
|
607
638
|
m({ show: !1, file: "" }), s();
|
|
608
|
-
} catch (
|
|
609
|
-
console.error(c("Error saving edited image:"),
|
|
639
|
+
} catch (M) {
|
|
640
|
+
console.error(c("Error saving edited image:"), M);
|
|
610
641
|
}
|
|
611
|
-
},
|
|
642
|
+
}, Fe = L((t) => {
|
|
612
643
|
J([t]);
|
|
613
|
-
}, []),
|
|
644
|
+
}, []), Ue = L(
|
|
614
645
|
(t) => {
|
|
615
|
-
|
|
646
|
+
se(t);
|
|
616
647
|
},
|
|
617
|
-
[
|
|
648
|
+
[se]
|
|
618
649
|
);
|
|
619
|
-
return /* @__PURE__ */
|
|
620
|
-
/* @__PURE__ */
|
|
650
|
+
return /* @__PURE__ */ n(H, { children: [
|
|
651
|
+
/* @__PURE__ */ n("div", { className: "flex h-[80vh] max-h-[1232px] w-[80vw] max-w-[1232px] flex-col space-y-4", children: [
|
|
621
652
|
/* @__PURE__ */ e("h1", { className: "text-lg font-medium", children: c("Digital Asset Manager") }),
|
|
622
|
-
v === "grid" ? /* @__PURE__ */
|
|
653
|
+
v === "grid" ? /* @__PURE__ */ n(H, { children: [
|
|
623
654
|
/* @__PURE__ */ e(
|
|
624
|
-
|
|
655
|
+
At,
|
|
625
656
|
{
|
|
626
|
-
maxFileSize:
|
|
627
|
-
allowedTypes:
|
|
628
|
-
uploadAssets:
|
|
629
|
-
isUpdatingAsset:
|
|
630
|
-
isUploadingAsset:
|
|
631
|
-
onUploaded:
|
|
657
|
+
maxFileSize: r,
|
|
658
|
+
allowedTypes: k,
|
|
659
|
+
uploadAssets: re,
|
|
660
|
+
isUpdatingAsset: Se,
|
|
661
|
+
isUploadingAsset: Ce,
|
|
662
|
+
onUploaded: Fe
|
|
632
663
|
}
|
|
633
664
|
),
|
|
634
|
-
/* @__PURE__ */
|
|
635
|
-
/* @__PURE__ */
|
|
636
|
-
/* @__PURE__ */
|
|
665
|
+
/* @__PURE__ */ n("div", { className: "relative flex flex-1 flex-col gap-y-3 overflow-hidden rounded-lg border p-2", children: [
|
|
666
|
+
/* @__PURE__ */ n("div", { className: "flex items-center justify-between gap-3", children: [
|
|
667
|
+
/* @__PURE__ */ n("div", { className: "relative w-1/2", children: [
|
|
637
668
|
/* @__PURE__ */ e(
|
|
638
|
-
|
|
669
|
+
Ge,
|
|
639
670
|
{
|
|
640
671
|
strokeWidth: 3,
|
|
641
672
|
className: `absolute left-2 top-2.5 h-4 w-4 text-muted-foreground ${F.length > 0 ? "text-indigo-800" : ""}`
|
|
642
673
|
}
|
|
643
674
|
),
|
|
644
675
|
/* @__PURE__ */ e(
|
|
645
|
-
|
|
676
|
+
xe,
|
|
646
677
|
{
|
|
647
678
|
placeholder: c("Search assets..."),
|
|
648
|
-
onChange:
|
|
679
|
+
onChange: Ee,
|
|
649
680
|
value: F,
|
|
650
681
|
className: "pl-8"
|
|
651
682
|
}
|
|
652
683
|
)
|
|
653
684
|
] }),
|
|
654
|
-
/* @__PURE__ */
|
|
655
|
-
|
|
656
|
-
|
|
685
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-x-2", children: [
|
|
686
|
+
I.length > 0 ? /* @__PURE__ */ e("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
687
|
+
I.length > 0 && /* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(
|
|
657
688
|
p,
|
|
658
689
|
{
|
|
659
690
|
variant: "outline",
|
|
660
691
|
size: "sm",
|
|
661
|
-
onClick: () =>
|
|
692
|
+
onClick: () => ke(),
|
|
662
693
|
title: c("Clear selection"),
|
|
663
694
|
children: c("Clear")
|
|
664
695
|
}
|
|
@@ -667,16 +698,16 @@ function Lt({ close: s, onSelect: n, mode: h = "image", assetId: a }) {
|
|
|
667
698
|
p,
|
|
668
699
|
{
|
|
669
700
|
size: "sm",
|
|
670
|
-
onClick: () =>
|
|
671
|
-
disabled:
|
|
701
|
+
onClick: () => ce(I),
|
|
702
|
+
disabled: I.length === 0,
|
|
672
703
|
children: c("Select Asset")
|
|
673
704
|
}
|
|
674
705
|
)
|
|
675
706
|
] }) }) : null,
|
|
676
|
-
/* @__PURE__ */ e(p, { variant: "ghost", size: "icon", onClick: () =>
|
|
707
|
+
/* @__PURE__ */ e(p, { variant: "ghost", size: "icon", onClick: () => Ne(), children: /* @__PURE__ */ e(Re, { className: "h-4 w-4" }) })
|
|
677
708
|
] })
|
|
678
709
|
] }),
|
|
679
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto pb-[66px]", children: W ? /* @__PURE__ */
|
|
710
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto pb-[66px]", children: W ? /* @__PURE__ */ n("div", { className: "columns-1 gap-3 space-y-3 sm:columns-3 md:columns-5", children: [
|
|
680
711
|
/* @__PURE__ */ e("div", { className: "h-64 w-full animate-pulse rounded bg-gray-200" }),
|
|
681
712
|
/* @__PURE__ */ e("div", { className: "h-64 w-full animate-pulse rounded bg-gray-200" }),
|
|
682
713
|
/* @__PURE__ */ e("div", { className: "h-64 w-full animate-pulse rounded bg-gray-200" }),
|
|
@@ -687,34 +718,34 @@ function Lt({ close: s, onSelect: n, mode: h = "image", assetId: a }) {
|
|
|
687
718
|
/* @__PURE__ */ e("div", { className: "h-64 w-full animate-pulse rounded bg-gray-200" }),
|
|
688
719
|
/* @__PURE__ */ e("div", { className: "h-64 w-full animate-pulse rounded bg-gray-200" }),
|
|
689
720
|
/* @__PURE__ */ e("div", { className: "h-64 w-full animate-pulse rounded bg-gray-200" })
|
|
690
|
-
] }) : !W && !
|
|
691
|
-
/* @__PURE__ */ e("div", { className: "text-muted-foreground", children: /* @__PURE__ */ e(
|
|
721
|
+
] }) : !W && !be ? /* @__PURE__ */ n("div", { className: "flex h-full flex-col items-center justify-center rounded-lg border", children: [
|
|
722
|
+
/* @__PURE__ */ e("div", { className: "text-muted-foreground", children: /* @__PURE__ */ e(Ke, { className: "h-9 w-9 text-indigo-500" }) }),
|
|
692
723
|
/* @__PURE__ */ e("div", { className: "text-lg text-muted-foreground", children: c("No assets found") }),
|
|
693
724
|
/* @__PURE__ */ e("div", { className: "text-sm text-muted-foreground", children: j.length > 0 ? c("No assets found for your search: {{query}}", { query: j }) : c("Start uploading assets to get started") }),
|
|
694
725
|
/* @__PURE__ */ e("br", {})
|
|
695
|
-
] }) : /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-3 p-1", children: D == null ? void 0 : D.map((t) => /* @__PURE__ */
|
|
726
|
+
] }) : /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-3 p-1", children: D == null ? void 0 : D.map((t) => /* @__PURE__ */ n(
|
|
696
727
|
"div",
|
|
697
728
|
{
|
|
698
|
-
className:
|
|
729
|
+
className: ye(
|
|
699
730
|
"group relative flex max-h-[180px] max-w-[180px] cursor-pointer flex-col justify-between overflow-hidden rounded-lg border-2 transition-all",
|
|
700
|
-
|
|
731
|
+
I.some((h) => h.id === t.id) ? "border-blue-500" : "hover:border-black/90",
|
|
701
732
|
C && (g == null ? void 0 : g.id) === t.id ? "pointer-events-none opacity-50" : "",
|
|
702
733
|
C === t.id ? "pointer-events-none opacity-50" : ""
|
|
703
734
|
),
|
|
704
|
-
onClick: () =>
|
|
705
|
-
onDoubleClick: () =>
|
|
735
|
+
onClick: () => Ie(t),
|
|
736
|
+
onDoubleClick: () => ce([t]),
|
|
706
737
|
children: [
|
|
707
|
-
/* @__PURE__ */
|
|
708
|
-
C === t.id ? /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-black/50", children: /* @__PURE__ */ e(
|
|
738
|
+
/* @__PURE__ */ n("div", { className: "aspect-square relative overflow-hidden", children: [
|
|
739
|
+
C === t.id ? /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-black/50", children: /* @__PURE__ */ e(G, { className: "h-8 w-8 animate-spin text-white" }) }) : null,
|
|
709
740
|
t.type === "image" ? /* @__PURE__ */ e(
|
|
710
741
|
"img",
|
|
711
742
|
{
|
|
712
743
|
src: `${t.thumbnailUrl || "/placeholder.svg"}?v=${(t == null ? void 0 : t.updatedAt) || t.createdAt}`,
|
|
713
744
|
alt: t.name,
|
|
714
|
-
className: `h-full min-h-[80px] w-full object-contain ${
|
|
745
|
+
className: `h-full min-h-[80px] w-full object-contain ${I.some((h) => h.id === t.id) ? "" : "group-hover:blur group-hover:contrast-50"}`
|
|
715
746
|
}
|
|
716
|
-
) : /* @__PURE__ */
|
|
717
|
-
/* @__PURE__ */ e(
|
|
747
|
+
) : /* @__PURE__ */ n("div", { className: "flex h-full items-center justify-center", children: [
|
|
748
|
+
/* @__PURE__ */ e(Qe, { className: "h-12 w-12 text-muted-foreground" }),
|
|
718
749
|
t.thumbnailUrl && /* @__PURE__ */ e(
|
|
719
750
|
"img",
|
|
720
751
|
{
|
|
@@ -725,97 +756,97 @@ function Lt({ close: s, onSelect: n, mode: h = "image", assetId: a }) {
|
|
|
725
756
|
)
|
|
726
757
|
] })
|
|
727
758
|
] }),
|
|
728
|
-
/* @__PURE__ */
|
|
759
|
+
/* @__PURE__ */ n("div", { className: "flex items-end justify-between border-t-[1px] border-black/10 bg-white px-2 py-1", children: [
|
|
729
760
|
/* @__PURE__ */ e("div", { className: "truncate text-xs leading-tight", title: t.name, children: t.name }),
|
|
730
|
-
/* @__PURE__ */ e("div", { className: "flex items-center justify-between whitespace-nowrap text-[9px] font-light text-muted-foreground", children: /* @__PURE__ */ e("span", { children:
|
|
761
|
+
/* @__PURE__ */ e("div", { className: "flex items-center justify-between whitespace-nowrap text-[9px] font-light text-muted-foreground", children: /* @__PURE__ */ e("span", { children: ee((t == null ? void 0 : t.size) || 0) }) })
|
|
731
762
|
] }),
|
|
732
|
-
!
|
|
733
|
-
/* @__PURE__ */ e(_, { children: /* @__PURE__ */
|
|
734
|
-
/* @__PURE__ */ e(
|
|
763
|
+
!I.some((h) => h.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__ */ n("div", { className: "grid grid-cols-4 gap-2 p-2", children: [
|
|
764
|
+
/* @__PURE__ */ e(_, { children: /* @__PURE__ */ n(P, { children: [
|
|
765
|
+
/* @__PURE__ */ e(q, { asChild: !0, children: /* @__PURE__ */ e(
|
|
735
766
|
p,
|
|
736
767
|
{
|
|
737
768
|
variant: "secondary",
|
|
738
769
|
size: "icon",
|
|
739
770
|
className: "h-8 w-8 rounded-full",
|
|
740
|
-
onClick: (
|
|
741
|
-
|
|
771
|
+
onClick: (h) => {
|
|
772
|
+
h.stopPropagation(), De(t);
|
|
742
773
|
},
|
|
743
|
-
children: /* @__PURE__ */ e(
|
|
774
|
+
children: /* @__PURE__ */ e(We, { className: "h-4 w-4" })
|
|
744
775
|
}
|
|
745
776
|
) }),
|
|
746
|
-
/* @__PURE__ */ e(
|
|
777
|
+
/* @__PURE__ */ e(B, { children: /* @__PURE__ */ e("p", { children: c("View Details") }) })
|
|
747
778
|
] }) }),
|
|
748
|
-
/* @__PURE__ */ e(_, { children: /* @__PURE__ */
|
|
749
|
-
/* @__PURE__ */ e(
|
|
779
|
+
/* @__PURE__ */ e(_, { children: /* @__PURE__ */ n(P, { children: [
|
|
780
|
+
/* @__PURE__ */ e(q, { asChild: !0, children: /* @__PURE__ */ e(
|
|
750
781
|
p,
|
|
751
782
|
{
|
|
752
783
|
variant: "secondary",
|
|
753
784
|
size: "icon",
|
|
754
785
|
className: "h-8 w-8 rounded-full",
|
|
755
|
-
onClick: (
|
|
756
|
-
|
|
786
|
+
onClick: (h) => {
|
|
787
|
+
h.stopPropagation(), navigator.clipboard.writeText(t.url), w.success(c("Asset URL copied to clipboard"));
|
|
757
788
|
},
|
|
758
|
-
children: /* @__PURE__ */ e(
|
|
789
|
+
children: /* @__PURE__ */ e(fe, { className: "h-4 w-4" })
|
|
759
790
|
}
|
|
760
791
|
) }),
|
|
761
|
-
/* @__PURE__ */ e(
|
|
792
|
+
/* @__PURE__ */ e(B, { children: /* @__PURE__ */ e("p", { children: c("Copy URL") }) })
|
|
762
793
|
] }) }),
|
|
763
|
-
/* @__PURE__ */ e(_, { children: /* @__PURE__ */
|
|
764
|
-
/* @__PURE__ */ e(
|
|
794
|
+
/* @__PURE__ */ e(_, { children: /* @__PURE__ */ n(P, { children: [
|
|
795
|
+
/* @__PURE__ */ e(q, { asChild: !0, children: /* @__PURE__ */ e(
|
|
765
796
|
p,
|
|
766
797
|
{
|
|
767
798
|
variant: "secondary",
|
|
768
799
|
size: "icon",
|
|
769
800
|
className: "h-8 w-8 rounded-full",
|
|
770
|
-
onClick: (
|
|
771
|
-
|
|
801
|
+
onClick: (h) => {
|
|
802
|
+
h.stopPropagation(), m({
|
|
772
803
|
id: t.id,
|
|
773
804
|
show: !0,
|
|
774
805
|
file: t.url,
|
|
775
806
|
name: t.name
|
|
776
807
|
});
|
|
777
808
|
},
|
|
778
|
-
children: /* @__PURE__ */ e(
|
|
809
|
+
children: /* @__PURE__ */ e(Ve, { className: "h-4 w-4" })
|
|
779
810
|
}
|
|
780
811
|
) }),
|
|
781
|
-
/* @__PURE__ */ e(
|
|
812
|
+
/* @__PURE__ */ e(B, { children: /* @__PURE__ */ e("p", { children: c("Edit Image") }) })
|
|
782
813
|
] }) }),
|
|
783
|
-
/* @__PURE__ */ e(_, { children: /* @__PURE__ */
|
|
784
|
-
/* @__PURE__ */ e(
|
|
814
|
+
/* @__PURE__ */ e(_, { children: /* @__PURE__ */ n(P, { children: [
|
|
815
|
+
/* @__PURE__ */ e(q, { asChild: !0, children: /* @__PURE__ */ e(
|
|
785
816
|
p,
|
|
786
817
|
{
|
|
787
818
|
variant: "destructive",
|
|
788
819
|
size: "icon",
|
|
789
820
|
className: "h-8 w-8 rounded-full",
|
|
790
|
-
onClick: (
|
|
791
|
-
|
|
821
|
+
onClick: (h) => {
|
|
822
|
+
h.stopPropagation(), Te(t);
|
|
792
823
|
},
|
|
793
|
-
children: /* @__PURE__ */ e(
|
|
824
|
+
children: /* @__PURE__ */ e(He, { className: "h-4 w-4" })
|
|
794
825
|
}
|
|
795
826
|
) }),
|
|
796
|
-
/* @__PURE__ */ e(
|
|
827
|
+
/* @__PURE__ */ e(B, { children: /* @__PURE__ */ e("p", { children: c("Delete Asset") }) })
|
|
797
828
|
] }) })
|
|
798
829
|
] }) }),
|
|
799
|
-
|
|
830
|
+
I.some((h) => h.id === t.id) && /* @__PURE__ */ e("div", { className: "absolute right-1 top-1 h-max rounded-full border border-white bg-blue-500 p-1", children: /* @__PURE__ */ e(Xe, { className: "h-3 w-3 text-white", strokeWidth: 5 }) })
|
|
800
831
|
]
|
|
801
832
|
},
|
|
802
833
|
t.id
|
|
803
834
|
)) }) }),
|
|
804
|
-
T > 1 && /* @__PURE__ */ e("div", { className: "absolute bottom-0 left-0 right-0 border-t bg-white p-4", children: /* @__PURE__ */ e(
|
|
805
|
-
|
|
835
|
+
T > 1 && /* @__PURE__ */ e("div", { className: "absolute bottom-0 left-0 right-0 border-t bg-white p-4", children: /* @__PURE__ */ e(tt, { fallback: /* @__PURE__ */ e("div", { className: "text-red-500", children: c("Error loading pagination") }), children: /* @__PURE__ */ e(
|
|
836
|
+
gt,
|
|
806
837
|
{
|
|
807
|
-
currentPage:
|
|
838
|
+
currentPage: Q,
|
|
808
839
|
totalPages: T,
|
|
809
|
-
onPageChange:
|
|
840
|
+
onPageChange: Ue,
|
|
810
841
|
pageRangeDisplayed: 3,
|
|
811
842
|
showPageInput: !0
|
|
812
843
|
}
|
|
813
844
|
) }) })
|
|
814
845
|
] })
|
|
815
846
|
] }) : /* @__PURE__ */ e(
|
|
816
|
-
|
|
847
|
+
Nt,
|
|
817
848
|
{
|
|
818
|
-
assetId: N ||
|
|
849
|
+
assetId: N || i || "",
|
|
819
850
|
onBack: () => {
|
|
820
851
|
E("grid"), x(null);
|
|
821
852
|
},
|
|
@@ -831,8 +862,8 @@ function Lt({ close: s, onSelect: n, mode: h = "image", assetId: a }) {
|
|
|
831
862
|
if (N) {
|
|
832
863
|
f(!0);
|
|
833
864
|
try {
|
|
834
|
-
const
|
|
835
|
-
|
|
865
|
+
const h = D.find((M) => M.id === N);
|
|
866
|
+
h && await ne(Me(h, { description: t }));
|
|
836
867
|
} finally {
|
|
837
868
|
f(!1);
|
|
838
869
|
}
|
|
@@ -843,14 +874,14 @@ function Lt({ close: s, onSelect: n, mode: h = "image", assetId: a }) {
|
|
|
843
874
|
)
|
|
844
875
|
] }),
|
|
845
876
|
o.show && /* @__PURE__ */ e(
|
|
846
|
-
|
|
877
|
+
Ye,
|
|
847
878
|
{
|
|
848
|
-
fallback: /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ e(
|
|
879
|
+
fallback: /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ e(G, { className: "h-8 w-8 animate-spin" }) }),
|
|
849
880
|
children: /* @__PURE__ */ e(
|
|
850
|
-
|
|
881
|
+
wt,
|
|
851
882
|
{
|
|
852
883
|
imageUrl: o.file,
|
|
853
|
-
onSave:
|
|
884
|
+
onSave: je,
|
|
854
885
|
onClose: () => m({ show: !1, file: "" }),
|
|
855
886
|
defaultSavedImageName: o.name,
|
|
856
887
|
isEditing: !!o.id
|
|
@@ -858,20 +889,20 @@ function Lt({ close: s, onSelect: n, mode: h = "image", assetId: a }) {
|
|
|
858
889
|
)
|
|
859
890
|
}
|
|
860
891
|
),
|
|
861
|
-
g && /* @__PURE__ */ e(
|
|
862
|
-
/* @__PURE__ */
|
|
863
|
-
/* @__PURE__ */ e(
|
|
864
|
-
/* @__PURE__ */ e(
|
|
892
|
+
g && /* @__PURE__ */ e(at, { open: !!g, onOpenChange: () => b(null), children: /* @__PURE__ */ n(lt, { children: [
|
|
893
|
+
/* @__PURE__ */ n(rt, { children: [
|
|
894
|
+
/* @__PURE__ */ e(nt, { children: c("Delete Asset") }),
|
|
895
|
+
/* @__PURE__ */ e(st, { children: c('Are you sure you want to delete "{{name}}"? This action cannot be undone.', {
|
|
865
896
|
name: g.name
|
|
866
897
|
}) })
|
|
867
898
|
] }),
|
|
868
|
-
/* @__PURE__ */
|
|
869
|
-
/* @__PURE__ */ e(p, { variant: "outline", onClick: () =>
|
|
870
|
-
/* @__PURE__ */ e(p, { variant: "destructive", onClick:
|
|
899
|
+
/* @__PURE__ */ n(ct, { className: "gap-2 sm:gap-0", children: [
|
|
900
|
+
/* @__PURE__ */ e(p, { variant: "outline", onClick: () => b(null), children: c("Cancel") }),
|
|
901
|
+
/* @__PURE__ */ e(p, { variant: "destructive", onClick: ze, children: c("Delete") })
|
|
871
902
|
] })
|
|
872
903
|
] }) })
|
|
873
904
|
] });
|
|
874
905
|
}
|
|
875
906
|
export {
|
|
876
|
-
|
|
907
|
+
_t as default
|
|
877
908
|
};
|