@chaibuilder/pages 0.4.8-beta.5 → 0.4.8-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{B4MFY5CR-BwIm3qbQ.js → B4MFY5CR-C-y1qMcz.js} +1 -1
- package/dist/{B4MFY5CR-DY8Z5ymd.cjs → B4MFY5CR-CZIhZc_v.cjs} +1 -1
- package/dist/{HO4MOOFI-B4ibIKNg.js → HO4MOOFI-D1WZ0Hg3.js} +2 -2
- package/dist/{HO4MOOFI-BYBE5fZ8.cjs → HO4MOOFI-iH74XHta.cjs} +1 -1
- package/dist/{HUY7CZI3-8v8-fX5C.cjs → HUY7CZI3-Bf9J-1mq.cjs} +1 -1
- package/dist/{HUY7CZI3-B9mlw8Vt.js → HUY7CZI3-DABOTt0o.js} +2 -2
- package/dist/digital-asset-manager-CI-fxUjE.cjs +1 -0
- package/dist/{digital-asset-manager-D5mWFg9t.js → digital-asset-manager-ty2MhSyj.js} +104 -100
- package/dist/{index-gqdpcAQ2.js → index-B9yYtFHS.js} +3 -3
- package/dist/{index-CisI4Eqe.cjs → index-D6MzyrPC.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
- package/dist/digital-asset-manager-yZJivo7V.cjs +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c, T as l, P as m, a as u, D as v, Q as i } from "./B4MFY5CR-
|
|
2
|
-
import { g as d, c as f, a as e } from "./index-
|
|
1
|
+
import { c, T as l, P as m, a as u, D as v, Q as i } from "./B4MFY5CR-C-y1qMcz.js";
|
|
2
|
+
import { g as d, c as f, a as e } from "./index-B9yYtFHS.js";
|
|
3
3
|
var p = (a) => {
|
|
4
4
|
const [r, t] = c({
|
|
5
5
|
prefix: "TanstackQueryDevtools"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./B4MFY5CR-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./B4MFY5CR-CZIhZc_v.cjs"),t=require("./index-D6MzyrPC.cjs");var s=c=>{const[r,o]=e.createLocalStorage({prefix:"TanstackQueryDevtools"}),l=t.getPreferredColorScheme(),a=t.createMemo(()=>{const n=r.theme_preference||e.THEME_PREFERENCE;return n!=="system"?n:l()});return t.createComponent(e.QueryDevtoolsContext.Provider,{value:c,get children(){return t.createComponent(e.PiPProvider,{localStore:r,setLocalStore:o,get children(){return t.createComponent(e.ThemeContext.Provider,{value:a,get children(){return t.createComponent(e.Devtools,{localStore:r,setLocalStore:o})}})}})}})},u=s;exports.default=u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./B4MFY5CR-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./B4MFY5CR-CZIhZc_v.cjs"),t=require("./index-D6MzyrPC.cjs");var u=o=>{const[r,n]=e.createLocalStorage({prefix:"TanstackQueryDevtools"}),c=t.getPreferredColorScheme(),a=t.createMemo(()=>{const l=r.theme_preference||e.THEME_PREFERENCE;return l!=="system"?l:c()});return t.createComponent(e.QueryDevtoolsContext.Provider,{value:o,get children(){return t.createComponent(e.PiPProvider,{disabled:!0,localStore:r,setLocalStore:n,get children(){return t.createComponent(e.ThemeContext.Provider,{value:a,get children(){return t.createComponent(e.ParentPanel,{get children(){return t.createComponent(e.ContentView,{localStore:r,setLocalStore:n,get onClose(){return o.onClose},showPanelViewOnly:!0})}})}})}})}})},i=u;exports.default=i;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./B4MFY5CR-
|
|
2
|
-
import { g as v, c as C, a as e } from "./index-
|
|
1
|
+
import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./B4MFY5CR-C-y1qMcz.js";
|
|
2
|
+
import { g as v, c as C, a as e } from "./index-B9yYtFHS.js";
|
|
3
3
|
var h = (t) => {
|
|
4
4
|
const [r, o] = s({
|
|
5
5
|
prefix: "TanstackQueryDevtools"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),L=require("@chaibuilder/sdk"),t=require("@chaibuilder/sdk/ui"),y=require("lodash-es"),j=require("lucide-react"),X=require("react-dropzone"),N=require("@tanstack/react-query"),w=require("sonner"),a=require("./index-D6MzyrPC.cjs"),Z=()=>{const l=a.useAssetsApiUrl(),c=N.useQueryClient(),d=a.useFetch();return N.useMutation({mutationFn:async({file:r,folderId:h,name:g})=>d(l,{action:a.ACTIONS.UPLOAD_ASSET,data:{file:r,folderId:h,name:g}}),onSuccess:()=>{c.invalidateQueries({queryKey:[a.QUERY_KEY_BASE,a.ACTIONS.GET_ASSETS]}),w.toast.success("Asset uploaded successfully")},onError:()=>{w.toast.error("Failed to upload asset")}})},ee=()=>{const l=a.useAssetsApiUrl(),c=N.useQueryClient(),d=a.useFetch();return N.useMutation({mutationFn:async r=>d(l,{action:a.ACTIONS.DELETE_ASSET,data:{id:r}}),onSuccess:()=>{c.invalidateQueries({queryKey:[a.QUERY_KEY_BASE,a.ACTIONS.GET_ASSETS]}),w.toast.success("Asset deleted successfully")},onError:()=>{w.toast.error("Failed to delete asset")}})},se=()=>{const l=a.useAssetsApiUrl(),c=N.useQueryClient(),d=a.useFetch();return N.useMutation({mutationFn:async r=>d(l,{action:a.ACTIONS.UPDATE_ASSET,data:r}),onSuccess:()=>{c.invalidateQueries({queryKey:[a.QUERY_KEY_BASE,a.ACTIONS.GET_ASSETS]}),w.toast.success("Asset updated successfully")},onError:()=>{w.toast.error("Failed to update asset")}})},te=(l={})=>{const c=a.useAssetsApiUrl(),d=a.useFetch(),{search:r,page:h=1,limit:g=10}=l;return N.useQuery({queryKey:[a.QUERY_KEY_BASE,a.ACTIONS.GET_ASSETS,r,h,g],queryFn:async()=>await d(c,{action:a.ACTIONS.GET_ASSETS,data:{search:r,page:h,limit:g}}),retry:1})};function ae(){const[c,d]=n.useState([]),[r,h]=n.useState({query:"",page:1,pageSize:10}),g=y.debounce(()=>r.query,300)(),{data:o,isLoading:C}=te({search:(g==null?void 0:g.toLowerCase().trim())||"",page:r.page,limit:r.pageSize}),v=o?Math.ceil(o.total/o.pageSize):0,u=(o==null?void 0:o.page)||1,f=u<v,x=u>1,{mutate:E,isPending:k}=se(),{mutate:b,isPending:m}=Z(),{mutate:T,isPending:U}=ee(),S=n.useCallback(p=>{p>=1&&p<=v&&h(A=>({...A,page:p}))},[v]),q=n.useCallback(()=>{f&&S(u+1)},[u,f,S]),F=n.useCallback(()=>{x&&S(u-1)},[u,x,S]),I=n.useCallback(p=>{h(A=>({...A,query:p,page:1}))},[]),D=n.useCallback(p=>{d(A=>y.find(A,{id:p.id})?[]:[p])},[!1]),z=n.useCallback(()=>{d([])},[]);return{query:(r==null?void 0:r.query)||"",selectedAssets:c,assets:(o==null?void 0:o.assets)||[],currentPage:u,totalPages:v,hasNextPage:f,hasPreviousPage:x,uploadAsset:b,updateAsset:E,deleteAsset:T,goToPage:S,nextPage:q,previousPage:F,updateSearchQuery:I,clearSelectedAssets:z,updateSelectedAssets:D,isLoadingAssets:C,isUploadingAsset:m,isUpdatingAsset:k,isDeletingAsset:U}}const le=n.lazy(()=>Promise.resolve().then(()=>require("./asset-metadata-editor-IRTgc3or.cjs"))),ne=n.lazy(()=>Promise.resolve().then(()=>require("./image-editor-DHmv5L8S.cjs")));function ie({close:l,onSelect:c,mode:d="image"}){const h=n.useMemo(()=>[d],[d]),[g,o]=n.useState("browse"),[C,v]=n.useState(null),[u,f]=n.useState(null),[x,E]=n.useState({show:!1,file:""}),{query:k,assets:b,selectedAssets:m,uploadAsset:T,updateAsset:U,deleteAsset:S,updateSearchQuery:q,clearSelectedAssets:F,updateSelectedAssets:I,isLoadingAssets:D,isUploadingAsset:z,isUpdatingAsset:p}=ae(),A=n.useRef(null),_=n.useCallback(async s=>new Promise((i,M)=>{const Q=s[0],P=new FileReader;P.readAsDataURL(Q),P.onload=async()=>{const B=await T({file:P.result,folderId:null,name:Q.name},{onSuccess:()=>{o("browse")}});i(B)},P.onerror=B=>M(B)}),[T]),{getRootProps:O,getInputProps:R,isDragActive:K}=X.useDropzone({onDrop:_,accept:{"image/*":h.includes("image")?[]:[]},maxSize:10*1024*1024}),Y=()=>{console.log("selectedAssets",m,y.pick(y.first(m),["url","width","height","description"])),m.length!==0&&(c(y.pick(y.first(m),["url","width","height","description"])),l())},G=async s=>{f(s)},$=async()=>{u&&(await S(u.id),f(null))},H=s=>{v(s)},V=async(s,i)=>{await U(y.merge(s,y.pick(i,["id","description"]))),l()},J=s=>{q(s.target.value)},W=async(s,i)=>{try{i?await T({file:s,folderId:null,name:x.name||""}):await U({id:x.id||"",file:s}),E({show:!1,file:""}),o("browse")}catch(M){console.error("Error saving edited image:",M)}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"min-w-[700px] min-h-[600px] w-[900px] max-w-[900px]",children:[e.jsx("h1",{className:"text-lg font-medium pb-4",children:"Digital Asset Manager"}),e.jsxs(t.Tabs,{value:g,onValueChange:s=>o(s),className:"flex-1 flex flex-col h-full",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs(t.TabsList,{children:[e.jsx(t.TabsTrigger,{value:"browse",children:"Browse Assets"}),e.jsx(t.TabsTrigger,{value:"upload",children:"Upload"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[m.length>0&&e.jsx(e.Fragment,{children:e.jsx(t.Button,{variant:"outline",size:"sm",onClick:()=>F(),title:"Clear selection",children:"Clear"})}),e.jsx(t.Button,{size:"sm",onClick:Y,disabled:m.length===0,children:"Select Asset"})]})]}),e.jsxs(t.TabsContent,{value:"browse",className:"flex-1 flex flex-col",children:[e.jsx("div",{className:"flex items-center gap-2 mb-2",children:e.jsxs("div",{className:"relative w-full",children:[e.jsx(j.Search,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(t.Input,{placeholder:"Search assets...",value:k,onChange:J,className:"pl-8"})]})}),D&&b.length===0?e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2 overflow-y-auto max-h-[550px] p-1",children:[e.jsx("div",{className:"bg-gray-200 h-64 w-full animate-pulse rounded"}),e.jsx("div",{className:"bg-gray-200 h-64 w-full animate-pulse rounded"}),e.jsx("div",{className:"bg-gray-200 h-64 w-full animate-pulse rounded"}),e.jsx("div",{className:"bg-gray-200 h-64 w-full animate-pulse rounded"}),e.jsx("div",{className:"bg-gray-200 h-64 w-full animate-pulse rounded"}),e.jsx("div",{className:"bg-gray-200 h-64 w-full animate-pulse rounded"}),e.jsx("div",{className:"bg-gray-200 h-64 w-full animate-pulse rounded"}),e.jsx("div",{className:"bg-gray-200 h-64 w-full animate-pulse rounded"}),e.jsx("div",{className:"bg-gray-200 h-64 w-full animate-pulse rounded"}),e.jsx("div",{className:"bg-gray-200 h-64 w-full animate-pulse rounded"})]}):b.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center text-center p-12 h-[380px]",children:[e.jsxs("div",{className:"text-muted-foreground mb-2",children:[e.jsx("h3",{className:"text-gray-800 font-medium",children:"No assets to display"}),e.jsx("p",{className:"text-sm",children:"You haven't uploaded any assets yet. Start by uploading your first asset."})]}),e.jsx("div",{className:"flex gap-2 pt-4",children:e.jsx(t.Button,{size:"lg",onClick:()=>o("upload"),children:"Upload Assets"})})]}):e.jsxs("div",{ref:A,className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2 overflow-y-auto max-h-[550px] p-1",children:[b.map(s=>e.jsx(t.Card,{className:L.mergeClasses("cursor-pointer overflow-hidden transition-all",m.some(i=>i.id===s.id)?"ring-2 ring-primary":"hover:ring-2 hover:ring-primary/20"),onClick:()=>I(s),children:e.jsxs(t.CardContent,{className:"p-0 relative group",children:[e.jsxs("div",{className:"aspect-square relative overflow-hidden bg-muted",children:[s.type==="image"?e.jsx("img",{src:s.thumbnailUrl||"/placeholder.svg",alt:s.name,className:"object-cover w-full h-full min-h-[100px]"}):e.jsxs("div",{className:"flex items-center justify-center h-full",children:[e.jsx(j.Film,{className:"h-12 w-12 text-muted-foreground"}),s.thumbnailUrl&&e.jsx("img",{src:s.thumbnailUrl||"/placeholder.svg",alt:s.name,className:"absolute inset-0 object-cover w-full h-full"})]}),e.jsxs("div",{className:"absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2",children:[e.jsx(t.Button,{variant:"secondary",size:"icon",className:"h-8 w-8",onClick:i=>{i.stopPropagation(),H(s)},children:e.jsx(j.ImageIcon,{className:"h-4 w-4"})}),e.jsx(t.Button,{variant:"secondary",size:"icon",className:"h-8 w-8",onClick:i=>{i.stopPropagation(),E({id:s.id,show:!0,file:s.url,name:s.name})},children:e.jsx(j.Edit,{className:"h-4 w-4"})}),e.jsx(t.Button,{variant:"destructive",size:"icon",className:"h-8 w-8",onClick:i=>{i.stopPropagation(),G(s)},children:e.jsx(j.Trash2,{className:"h-4 w-4"})})]}),m.some(i=>i.id===s.id)&&e.jsx("div",{className:"absolute top-2 left-2",children:e.jsx("input",{type:"checkbox",checked:m.some(i=>i.id===s.id),readOnly:!0,className:"rounded-full"})})]}),e.jsxs("div",{className:"p-2",children:[e.jsx("div",{className:"text-sm font-medium truncate",title:s.name,children:s.name}),e.jsxs("div",{className:"text-xs text-muted-foreground flex items-center justify-between",children:[e.jsx("span",{children:re((s==null?void 0:s.size)||0)}),e.jsx("span",{children:oe(s.createdAt)})]})]})]})},s.id)),D&&b.length>0&&e.jsx("div",{className:"col-span-full flex justify-center py-4",children:e.jsx(j.Loader2,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})]}),e.jsx(t.TabsContent,{value:"upload",className:"flex-1 ",children:e.jsxs("div",{...O(),className:L.mergeClasses("border-2 border-dashed rounded-lg h-[380px] flex flex-col items-center justify-center text-center cursor-pointer hover:bg-gray-50",K?"border-primary bg-primary/5":"border-muted-foreground/20"),children:[e.jsx("input",{...R()}),p||z?e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx(j.Loader2,{className:"h-12 w-12 text-primary animate-spin mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-1",children:"Uploading files..."}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Please wait while your files are being processed."})]}):e.jsxs(e.Fragment,{children:[e.jsx(j.Upload,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-1",children:"Drag & drop files here"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"or click to browse your files"}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.jsxs("p",{children:["Accepted file types: ",h.join(", ")]}),e.jsxs("p",{children:["Maximum file size: ",10,"MB"]})]})]})]})})]})]}),C&&e.jsx(n.Suspense,{fallback:e.jsx("div",{children:"Loading..."}),children:e.jsx(le,{asset:C,onSave:s=>V(C,s),onCancel:()=>{v(null)}})}),x.show&&e.jsx(n.Suspense,{fallback:e.jsx("div",{children:"Loading..."}),children:e.jsx(ne,{imageUrl:x.file,onSave:W,onClose:()=>E({show:!1,file:""}),defaultSavedImageName:x.name,isEditing:!!x.id})}),u&&e.jsx(t.Dialog,{open:!!u,onOpenChange:()=>f(null),children:e.jsxs(t.DialogContent,{children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{children:"Delete Asset"}),e.jsxs(t.DialogDescription,{children:['Are you sure you want to delete "',u.name,'"? This action cannot be undone.']})]}),e.jsxs(t.DialogFooter,{className:"gap-2 sm:gap-0",children:[e.jsx(t.Button,{variant:"outline",onClick:()=>f(null),children:"Cancel"}),e.jsx(t.Button,{variant:"destructive",onClick:$,children:"Delete"})]})]})})]})}function re(l){return l<1024?`${l.toFixed(2)} B`:l<1024*1024?`${(l/1024).toFixed(2)} KB`:`${(l/(1024*1024)).toFixed(2)} MB`}function oe(l){const c=new Date(l);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(c)}exports.default=ie;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { jsxs as t, Fragment as Q, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { mergeClasses as
|
|
4
|
-
import { Tabs as
|
|
5
|
-
import { debounce as
|
|
6
|
-
import { Search as Ee, Film as Te, ImageIcon as De, Edit as Pe, Trash2 as Ue, Loader2 as
|
|
2
|
+
import J, { useState as S, useCallback as w, useMemo as de, useRef as ue, Suspense as $ } from "react";
|
|
3
|
+
import { mergeClasses as H } from "@chaibuilder/sdk";
|
|
4
|
+
import { Tabs as me, TabsList as he, TabsTrigger as V, Button as f, TabsContent as W, Input as ge, Card as pe, CardContent as fe, Dialog as ye, DialogContent as ve, DialogHeader as xe, DialogTitle as Ne, DialogDescription as we, DialogFooter as Ae } from "@chaibuilder/sdk/ui";
|
|
5
|
+
import { debounce as Se, find as be, pick as R, first as X, merge as Ce } from "lodash-es";
|
|
6
|
+
import { Search as Ee, Film as Te, ImageIcon as De, Edit as Pe, Trash2 as Ue, Loader2 as Z, Upload as Fe } from "lucide-react";
|
|
7
7
|
import { useDropzone as ze } from "react-dropzone";
|
|
8
|
-
import { useQueryClient as
|
|
8
|
+
import { useQueryClient as K, useMutation as G, useQuery as ke } from "@tanstack/react-query";
|
|
9
9
|
import { toast as b } from "sonner";
|
|
10
|
-
import { W as F, X as z, Y as y, Z as k } from "./index-
|
|
10
|
+
import { W as F, X as z, Y as y, Z as k } from "./index-B9yYtFHS.js";
|
|
11
11
|
const Me = () => {
|
|
12
|
-
const a = F(), r =
|
|
13
|
-
return
|
|
12
|
+
const a = F(), r = K(), o = z();
|
|
13
|
+
return G({
|
|
14
14
|
mutationFn: async ({
|
|
15
15
|
file: i,
|
|
16
|
-
folderId:
|
|
17
|
-
name:
|
|
16
|
+
folderId: u,
|
|
17
|
+
name: m
|
|
18
18
|
}) => o(a, {
|
|
19
19
|
action: y.UPLOAD_ASSET,
|
|
20
|
-
data: { file: i, folderId:
|
|
20
|
+
data: { file: i, folderId: u, name: m }
|
|
21
21
|
}),
|
|
22
22
|
onSuccess: () => {
|
|
23
23
|
r.invalidateQueries({
|
|
@@ -29,8 +29,8 @@ const Me = () => {
|
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
}, Ie = () => {
|
|
32
|
-
const a = F(), r =
|
|
33
|
-
return
|
|
32
|
+
const a = F(), r = K(), o = z();
|
|
33
|
+
return G({
|
|
34
34
|
mutationFn: async (i) => o(a, {
|
|
35
35
|
action: y.DELETE_ASSET,
|
|
36
36
|
data: { id: i }
|
|
@@ -45,8 +45,8 @@ const Me = () => {
|
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
}, qe = () => {
|
|
48
|
-
const a = F(), r =
|
|
49
|
-
return
|
|
48
|
+
const a = F(), r = K(), o = z();
|
|
49
|
+
return G({
|
|
50
50
|
mutationFn: async (i) => o(a, {
|
|
51
51
|
action: y.UPDATE_ASSET,
|
|
52
52
|
data: i
|
|
@@ -61,51 +61,51 @@ const Me = () => {
|
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
63
|
}, je = (a = {}) => {
|
|
64
|
-
const r = F(), o = z(), { search: i, page:
|
|
64
|
+
const r = F(), o = z(), { search: i, page: u = 1, limit: m = 10 } = a;
|
|
65
65
|
return ke({
|
|
66
|
-
queryKey: [k, y.GET_ASSETS, i,
|
|
66
|
+
queryKey: [k, y.GET_ASSETS, i, u, m],
|
|
67
67
|
queryFn: async () => await o(r, {
|
|
68
68
|
action: y.GET_ASSETS,
|
|
69
69
|
data: {
|
|
70
70
|
search: i,
|
|
71
|
-
page:
|
|
72
|
-
limit:
|
|
71
|
+
page: u,
|
|
72
|
+
limit: m
|
|
73
73
|
}
|
|
74
74
|
}),
|
|
75
75
|
retry: 1
|
|
76
76
|
});
|
|
77
77
|
};
|
|
78
78
|
function _e() {
|
|
79
|
-
const [r, o] = S([]), [i,
|
|
79
|
+
const [r, o] = S([]), [i, u] = S({
|
|
80
80
|
query: "",
|
|
81
81
|
page: 1,
|
|
82
82
|
pageSize: 10
|
|
83
|
-
}),
|
|
84
|
-
search: (
|
|
83
|
+
}), m = Se(() => i.query, 300)(), { data: n, isLoading: C } = je({
|
|
84
|
+
search: (m == null ? void 0 : m.toLowerCase().trim()) || "",
|
|
85
85
|
page: i.page,
|
|
86
86
|
limit: i.pageSize
|
|
87
|
-
}), v = n ? Math.ceil(n.total / n.pageSize) : 0, c = (n == null ? void 0 : n.page) || 1, p = c < v,
|
|
88
|
-
(
|
|
89
|
-
|
|
87
|
+
}), v = n ? Math.ceil(n.total / n.pageSize) : 0, c = (n == null ? void 0 : n.page) || 1, p = c < v, h = c > 1, { mutate: E, isPending: M } = qe(), { mutate: A, isPending: d } = Me(), { mutate: T, isPending: D } = Ie(), x = w(
|
|
88
|
+
(g) => {
|
|
89
|
+
g >= 1 && g <= v && u((N) => ({
|
|
90
90
|
...N,
|
|
91
|
-
page:
|
|
91
|
+
page: g
|
|
92
92
|
}));
|
|
93
93
|
},
|
|
94
94
|
[v]
|
|
95
95
|
), I = w(() => {
|
|
96
96
|
p && x(c + 1);
|
|
97
97
|
}, [c, p, x]), q = w(() => {
|
|
98
|
-
|
|
99
|
-
}, [c,
|
|
100
|
-
|
|
98
|
+
h && x(c - 1);
|
|
99
|
+
}, [c, h, x]), j = w((g) => {
|
|
100
|
+
u((N) => ({
|
|
101
101
|
...N,
|
|
102
|
-
query:
|
|
102
|
+
query: g,
|
|
103
103
|
page: 1
|
|
104
104
|
// Reset to first page on new search
|
|
105
105
|
}));
|
|
106
106
|
}, []), P = w(
|
|
107
|
-
(
|
|
108
|
-
o((N) =>
|
|
107
|
+
(g) => {
|
|
108
|
+
o((N) => be(N, { id: g.id }) ? [] : [g]);
|
|
109
109
|
},
|
|
110
110
|
[!1]
|
|
111
111
|
), _ = w(() => {
|
|
@@ -119,7 +119,7 @@ function _e() {
|
|
|
119
119
|
currentPage: c,
|
|
120
120
|
totalPages: v,
|
|
121
121
|
hasNextPage: p,
|
|
122
|
-
hasPreviousPage:
|
|
122
|
+
hasPreviousPage: h,
|
|
123
123
|
// Mutations
|
|
124
124
|
uploadAsset: A,
|
|
125
125
|
updateAsset: E,
|
|
@@ -132,22 +132,22 @@ function _e() {
|
|
|
132
132
|
updateSelectedAssets: P,
|
|
133
133
|
// Loading
|
|
134
134
|
isLoadingAssets: C,
|
|
135
|
-
isUploadingAsset:
|
|
135
|
+
isUploadingAsset: d,
|
|
136
136
|
isUpdatingAsset: M,
|
|
137
137
|
isDeletingAsset: D
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
|
-
const Le =
|
|
140
|
+
const Le = J.lazy(() => import("./asset-metadata-editor-CyTBhS-V.js")), Be = J.lazy(() => import("./image-editor-By8RDHso.js"));
|
|
141
141
|
function Je({
|
|
142
142
|
close: a,
|
|
143
143
|
onSelect: r,
|
|
144
144
|
mode: o = "image"
|
|
145
145
|
}) {
|
|
146
|
-
const
|
|
146
|
+
const u = de(() => [o], [o]), [m, n] = S("browse"), [C, v] = S(null), [c, p] = S(null), [h, E] = S({ show: !1, file: "" }), {
|
|
147
147
|
// Data
|
|
148
148
|
query: M,
|
|
149
149
|
assets: A,
|
|
150
|
-
selectedAssets:
|
|
150
|
+
selectedAssets: d,
|
|
151
151
|
// Mutations
|
|
152
152
|
uploadAsset: T,
|
|
153
153
|
updateAsset: D,
|
|
@@ -158,17 +158,17 @@ function Je({
|
|
|
158
158
|
// Loading
|
|
159
159
|
isLoadingAssets: P,
|
|
160
160
|
isUploadingAsset: _,
|
|
161
|
-
isUpdatingAsset:
|
|
161
|
+
isUpdatingAsset: g
|
|
162
162
|
// isDeletingAsset,
|
|
163
|
-
} = _e(), N =
|
|
163
|
+
} = _e(), N = ue(null), O = w(
|
|
164
164
|
async (s) => new Promise((l, L) => {
|
|
165
|
-
const
|
|
166
|
-
U.readAsDataURL(
|
|
165
|
+
const Y = s[0], U = new FileReader();
|
|
166
|
+
U.readAsDataURL(Y), U.onload = async () => {
|
|
167
167
|
const B = await T(
|
|
168
168
|
{
|
|
169
169
|
file: U.result,
|
|
170
170
|
folderId: null,
|
|
171
|
-
name:
|
|
171
|
+
name: Y.name
|
|
172
172
|
},
|
|
173
173
|
{
|
|
174
174
|
onSuccess: () => {
|
|
@@ -180,34 +180,38 @@ function Je({
|
|
|
180
180
|
}, U.onerror = (B) => L(B);
|
|
181
181
|
}),
|
|
182
182
|
[T]
|
|
183
|
-
), { getRootProps:
|
|
184
|
-
onDrop:
|
|
183
|
+
), { getRootProps: ee, getInputProps: se, isDragActive: te } = ze({
|
|
184
|
+
onDrop: O,
|
|
185
185
|
accept: {
|
|
186
|
-
"image/*":
|
|
186
|
+
"image/*": u.includes("image") ? [] : []
|
|
187
187
|
},
|
|
188
188
|
maxSize: 10 * 1024 * 1024
|
|
189
|
-
}),
|
|
190
|
-
|
|
191
|
-
|
|
189
|
+
}), ae = () => {
|
|
190
|
+
console.log(
|
|
191
|
+
"selectedAssets",
|
|
192
|
+
d,
|
|
193
|
+
R(X(d), ["url", "width", "height", "description"])
|
|
194
|
+
), d.length !== 0 && (r(
|
|
195
|
+
R(X(d), ["url", "width", "height", "description"])
|
|
192
196
|
), a());
|
|
193
|
-
},
|
|
197
|
+
}, le = async (s) => {
|
|
194
198
|
p(s);
|
|
195
|
-
},
|
|
199
|
+
}, ie = async () => {
|
|
196
200
|
c && (await x(c.id), p(null));
|
|
197
|
-
},
|
|
201
|
+
}, ne = (s) => {
|
|
198
202
|
v(s);
|
|
199
|
-
},
|
|
200
|
-
await D(Ce(s,
|
|
201
|
-
},
|
|
203
|
+
}, re = async (s, l) => {
|
|
204
|
+
await D(Ce(s, R(l, ["id", "description"]))), a();
|
|
205
|
+
}, oe = (s) => {
|
|
202
206
|
I(s.target.value);
|
|
203
|
-
},
|
|
207
|
+
}, ce = async (s, l) => {
|
|
204
208
|
try {
|
|
205
209
|
l ? await T({
|
|
206
210
|
file: s,
|
|
207
211
|
folderId: null,
|
|
208
|
-
name:
|
|
212
|
+
name: h.name || ""
|
|
209
213
|
}) : await D({
|
|
210
|
-
id:
|
|
214
|
+
id: h.id || "",
|
|
211
215
|
file: s
|
|
212
216
|
}), E({ show: !1, file: "" }), n("browse");
|
|
213
217
|
} catch (L) {
|
|
@@ -218,19 +222,19 @@ function Je({
|
|
|
218
222
|
/* @__PURE__ */ t("div", { className: "min-w-[700px] min-h-[600px] w-[900px] max-w-[900px]", children: [
|
|
219
223
|
/* @__PURE__ */ e("h1", { className: "text-lg font-medium pb-4", children: "Digital Asset Manager" }),
|
|
220
224
|
/* @__PURE__ */ t(
|
|
221
|
-
|
|
225
|
+
me,
|
|
222
226
|
{
|
|
223
|
-
value:
|
|
227
|
+
value: m,
|
|
224
228
|
onValueChange: (s) => n(s),
|
|
225
229
|
className: "flex-1 flex flex-col h-full",
|
|
226
230
|
children: [
|
|
227
231
|
/* @__PURE__ */ t("div", { className: "flex justify-between items-center mb-2", children: [
|
|
228
|
-
/* @__PURE__ */ t(
|
|
229
|
-
/* @__PURE__ */ e(
|
|
230
|
-
/* @__PURE__ */ e(
|
|
232
|
+
/* @__PURE__ */ t(he, { children: [
|
|
233
|
+
/* @__PURE__ */ e(V, { value: "browse", children: "Browse Assets" }),
|
|
234
|
+
/* @__PURE__ */ e(V, { value: "upload", children: "Upload" })
|
|
231
235
|
] }),
|
|
232
236
|
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
|
|
233
|
-
|
|
237
|
+
d.length > 0 && /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e(
|
|
234
238
|
f,
|
|
235
239
|
{
|
|
236
240
|
variant: "outline",
|
|
@@ -244,22 +248,22 @@ function Je({
|
|
|
244
248
|
f,
|
|
245
249
|
{
|
|
246
250
|
size: "sm",
|
|
247
|
-
onClick:
|
|
248
|
-
disabled:
|
|
251
|
+
onClick: ae,
|
|
252
|
+
disabled: d.length === 0,
|
|
249
253
|
children: "Select Asset"
|
|
250
254
|
}
|
|
251
255
|
)
|
|
252
256
|
] })
|
|
253
257
|
] }),
|
|
254
|
-
/* @__PURE__ */ t(
|
|
258
|
+
/* @__PURE__ */ t(W, { value: "browse", className: "flex-1 flex flex-col", children: [
|
|
255
259
|
/* @__PURE__ */ e("div", { className: "flex items-center gap-2 mb-2", children: /* @__PURE__ */ t("div", { className: "relative w-full", children: [
|
|
256
260
|
/* @__PURE__ */ e(Ee, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
|
|
257
261
|
/* @__PURE__ */ e(
|
|
258
|
-
|
|
262
|
+
ge,
|
|
259
263
|
{
|
|
260
264
|
placeholder: "Search assets...",
|
|
261
265
|
value: M,
|
|
262
|
-
onChange:
|
|
266
|
+
onChange: oe,
|
|
263
267
|
className: "pl-8"
|
|
264
268
|
}
|
|
265
269
|
)
|
|
@@ -288,14 +292,14 @@ function Je({
|
|
|
288
292
|
className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2 overflow-y-auto max-h-[550px] p-1",
|
|
289
293
|
children: [
|
|
290
294
|
A.map((s) => /* @__PURE__ */ e(
|
|
291
|
-
|
|
295
|
+
pe,
|
|
292
296
|
{
|
|
293
|
-
className:
|
|
297
|
+
className: H(
|
|
294
298
|
"cursor-pointer overflow-hidden transition-all",
|
|
295
|
-
|
|
299
|
+
d.some((l) => l.id === s.id) ? "ring-2 ring-primary" : "hover:ring-2 hover:ring-primary/20"
|
|
296
300
|
),
|
|
297
301
|
onClick: () => j(s),
|
|
298
|
-
children: /* @__PURE__ */ t(
|
|
302
|
+
children: /* @__PURE__ */ t(fe, { className: "p-0 relative group", children: [
|
|
299
303
|
/* @__PURE__ */ t("div", { className: "aspect-square relative overflow-hidden bg-muted", children: [
|
|
300
304
|
s.type === "image" ? /* @__PURE__ */ e(
|
|
301
305
|
"img",
|
|
@@ -323,7 +327,7 @@ function Je({
|
|
|
323
327
|
size: "icon",
|
|
324
328
|
className: "h-8 w-8",
|
|
325
329
|
onClick: (l) => {
|
|
326
|
-
l.stopPropagation(),
|
|
330
|
+
l.stopPropagation(), ne(s);
|
|
327
331
|
},
|
|
328
332
|
children: /* @__PURE__ */ e(De, { className: "h-4 w-4" })
|
|
329
333
|
}
|
|
@@ -352,17 +356,17 @@ function Je({
|
|
|
352
356
|
size: "icon",
|
|
353
357
|
className: "h-8 w-8",
|
|
354
358
|
onClick: (l) => {
|
|
355
|
-
l.stopPropagation(),
|
|
359
|
+
l.stopPropagation(), le(s);
|
|
356
360
|
},
|
|
357
361
|
children: /* @__PURE__ */ e(Ue, { className: "h-4 w-4" })
|
|
358
362
|
}
|
|
359
363
|
)
|
|
360
364
|
] }),
|
|
361
|
-
|
|
365
|
+
d.some((l) => l.id === s.id) && /* @__PURE__ */ e("div", { className: "absolute top-2 left-2", children: /* @__PURE__ */ e(
|
|
362
366
|
"input",
|
|
363
367
|
{
|
|
364
368
|
type: "checkbox",
|
|
365
|
-
checked:
|
|
369
|
+
checked: d.some(
|
|
366
370
|
(l) => l.id === s.id
|
|
367
371
|
),
|
|
368
372
|
readOnly: !0,
|
|
@@ -388,23 +392,23 @@ function Je({
|
|
|
388
392
|
},
|
|
389
393
|
s.id
|
|
390
394
|
)),
|
|
391
|
-
P && A.length > 0 && /* @__PURE__ */ e("div", { className: "col-span-full flex justify-center py-4", children: /* @__PURE__ */ e(
|
|
395
|
+
P && A.length > 0 && /* @__PURE__ */ e("div", { className: "col-span-full flex justify-center py-4", children: /* @__PURE__ */ e(Z, { className: "h-6 w-6 animate-spin text-muted-foreground" }) })
|
|
392
396
|
]
|
|
393
397
|
}
|
|
394
398
|
)
|
|
395
399
|
] }),
|
|
396
|
-
/* @__PURE__ */ e(
|
|
400
|
+
/* @__PURE__ */ e(W, { value: "upload", className: "flex-1 ", children: /* @__PURE__ */ t(
|
|
397
401
|
"div",
|
|
398
402
|
{
|
|
399
|
-
...
|
|
400
|
-
className:
|
|
403
|
+
...ee(),
|
|
404
|
+
className: H(
|
|
401
405
|
"border-2 border-dashed rounded-lg h-[380px] flex flex-col items-center justify-center text-center cursor-pointer hover:bg-gray-50",
|
|
402
|
-
|
|
406
|
+
te ? "border-primary bg-primary/5" : "border-muted-foreground/20"
|
|
403
407
|
),
|
|
404
408
|
children: [
|
|
405
|
-
/* @__PURE__ */ e("input", { ...
|
|
406
|
-
|
|
407
|
-
/* @__PURE__ */ e(
|
|
409
|
+
/* @__PURE__ */ e("input", { ...se() }),
|
|
410
|
+
g || _ ? /* @__PURE__ */ t("div", { className: "flex flex-col items-center", children: [
|
|
411
|
+
/* @__PURE__ */ e(Z, { className: "h-12 w-12 text-primary animate-spin mb-4" }),
|
|
408
412
|
/* @__PURE__ */ e("h3", { className: "text-lg font-medium mb-1", children: "Uploading files..." }),
|
|
409
413
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "Please wait while your files are being processed." })
|
|
410
414
|
] }) : /* @__PURE__ */ t(Q, { children: [
|
|
@@ -414,7 +418,7 @@ function Je({
|
|
|
414
418
|
/* @__PURE__ */ t("div", { className: "text-xs text-muted-foreground", children: [
|
|
415
419
|
/* @__PURE__ */ t("p", { children: [
|
|
416
420
|
"Accepted file types: ",
|
|
417
|
-
|
|
421
|
+
u.join(", ")
|
|
418
422
|
] }),
|
|
419
423
|
/* @__PURE__ */ t("p", { children: [
|
|
420
424
|
"Maximum file size: ",
|
|
@@ -430,43 +434,43 @@ function Je({
|
|
|
430
434
|
}
|
|
431
435
|
)
|
|
432
436
|
] }),
|
|
433
|
-
C && /* @__PURE__ */ e(
|
|
437
|
+
C && /* @__PURE__ */ e($, { fallback: /* @__PURE__ */ e("div", { children: "Loading..." }), children: /* @__PURE__ */ e(
|
|
434
438
|
Le,
|
|
435
439
|
{
|
|
436
440
|
asset: C,
|
|
437
|
-
onSave: (s) =>
|
|
441
|
+
onSave: (s) => re(C, s),
|
|
438
442
|
onCancel: () => {
|
|
439
443
|
v(null);
|
|
440
444
|
}
|
|
441
445
|
}
|
|
442
446
|
) }),
|
|
443
|
-
|
|
447
|
+
h.show && /* @__PURE__ */ e($, { fallback: /* @__PURE__ */ e("div", { children: "Loading..." }), children: /* @__PURE__ */ e(
|
|
444
448
|
Be,
|
|
445
449
|
{
|
|
446
|
-
imageUrl:
|
|
447
|
-
onSave:
|
|
450
|
+
imageUrl: h.file,
|
|
451
|
+
onSave: ce,
|
|
448
452
|
onClose: () => E({ show: !1, file: "" }),
|
|
449
|
-
defaultSavedImageName:
|
|
450
|
-
isEditing: !!
|
|
453
|
+
defaultSavedImageName: h.name,
|
|
454
|
+
isEditing: !!h.id
|
|
451
455
|
}
|
|
452
456
|
) }),
|
|
453
457
|
c && /* @__PURE__ */ e(
|
|
454
|
-
|
|
458
|
+
ye,
|
|
455
459
|
{
|
|
456
460
|
open: !!c,
|
|
457
461
|
onOpenChange: () => p(null),
|
|
458
|
-
children: /* @__PURE__ */ t(
|
|
459
|
-
/* @__PURE__ */ t(
|
|
460
|
-
/* @__PURE__ */ e(
|
|
461
|
-
/* @__PURE__ */ t(
|
|
462
|
+
children: /* @__PURE__ */ t(ve, { children: [
|
|
463
|
+
/* @__PURE__ */ t(xe, { children: [
|
|
464
|
+
/* @__PURE__ */ e(Ne, { children: "Delete Asset" }),
|
|
465
|
+
/* @__PURE__ */ t(we, { children: [
|
|
462
466
|
'Are you sure you want to delete "',
|
|
463
467
|
c.name,
|
|
464
468
|
'"? This action cannot be undone.'
|
|
465
469
|
] })
|
|
466
470
|
] }),
|
|
467
|
-
/* @__PURE__ */ t(
|
|
471
|
+
/* @__PURE__ */ t(Ae, { className: "gap-2 sm:gap-0", children: [
|
|
468
472
|
/* @__PURE__ */ e(f, { variant: "outline", onClick: () => p(null), children: "Cancel" }),
|
|
469
|
-
/* @__PURE__ */ e(f, { variant: "destructive", onClick:
|
|
473
|
+
/* @__PURE__ */ e(f, { variant: "destructive", onClick: ie, children: "Delete" })
|
|
470
474
|
] })
|
|
471
475
|
] })
|
|
472
476
|
}
|
|
@@ -7422,7 +7422,7 @@ var Ed = (e, t = !1) => {
|
|
|
7422
7422
|
const t = oa(() => {
|
|
7423
7423
|
const n = this, [s] = R(this, yt), [a] = R(this, vt), [i] = R(this, Et), [l] = R(this, bt), [o] = R(this, gt);
|
|
7424
7424
|
let c;
|
|
7425
|
-
return R(this, wt) ? c = R(this, wt) : (c = ia(() => import("./HO4MOOFI-
|
|
7425
|
+
return R(this, wt) ? c = R(this, wt) : (c = ia(() => import("./HO4MOOFI-D1WZ0Hg3.js")), te(this, wt, c)), Ca(R(this, Yt), R(this, pt)), ra(c, aa({
|
|
7426
7426
|
get queryFlavor() {
|
|
7427
7427
|
return R(n, zt);
|
|
7428
7428
|
},
|
|
@@ -7516,7 +7516,7 @@ var Ed = (e, t = !1) => {
|
|
|
7516
7516
|
const t = oa(() => {
|
|
7517
7517
|
const n = this, [s] = R(this, At), [a] = R(this, xt), [i] = R(this, Tt), [l] = R(this, Ct), [o] = R(this, St), [c] = R(this, Pt);
|
|
7518
7518
|
let h;
|
|
7519
|
-
return R(this, _t) ? h = R(this, _t) : (h = ia(() => import("./HUY7CZI3-
|
|
7519
|
+
return R(this, _t) ? h = R(this, _t) : (h = ia(() => import("./HUY7CZI3-DABOTt0o.js")), te(this, _t, h)), Ca(R(this, en), R(this, Nt)), ra(h, aa({
|
|
7520
7520
|
get queryFlavor() {
|
|
7521
7521
|
return R(n, Zt);
|
|
7522
7522
|
},
|
|
@@ -7634,7 +7634,7 @@ var Iu = process.env.NODE_ENV !== "development" ? function() {
|
|
|
7634
7634
|
} : Pu;
|
|
7635
7635
|
process.env.NODE_ENV;
|
|
7636
7636
|
const ku = Qa(
|
|
7637
|
-
() => import("./digital-asset-manager-
|
|
7637
|
+
() => import("./digital-asset-manager-ty2MhSyj.js")
|
|
7638
7638
|
);
|
|
7639
7639
|
ul();
|
|
7640
7640
|
ec();
|