@unciatech/file-manager 0.0.41 → 0.0.42

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/index.cjs CHANGED
@@ -1,11 +1,11 @@
1
- 'use strict';var chunkSV5VFLC2_cjs=require('./chunk-SV5VFLC2.cjs'),yi=require('react'),sonner=require('sonner'),jsxRuntime=require('react/jsx-runtime'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),classVarianceAuthority=require('class-variance-authority'),radixUi=require('radix-ui'),Ne=require('@radix-ui/react-tooltip'),cmdk=require('cmdk'),X=require('@radix-ui/react-context-menu');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var yi__default=/*#__PURE__*/_interopDefault(yi);var Ne__namespace=/*#__PURE__*/_interopNamespace(Ne);var X__namespace=/*#__PURE__*/_interopNamespace(X);var ao="locationchange";if(typeof window!="undefined"&&!window.__navigationPatched){window.__navigationPatched=true;let e=window.history.pushState,t=window.history.replaceState;window.history.pushState=function(...a){let o=e.apply(this,a);return setTimeout(()=>window.dispatchEvent(new Event(ao)),0),o},window.history.replaceState=function(...a){let o=t.apply(this,a);return setTimeout(()=>window.dispatchEvent(new Event(ao)),0),o};}function ro({basePath:e,onNavigate:t}={}){let[a,o]=yi.useState(()=>typeof window!="undefined"?window.location.pathname:"/"),[r,n]=yi.useState(()=>typeof window!="undefined"?window.location.search:"");yi.useEffect(()=>{let p=()=>{o(window.location.pathname),n(window.location.search);};return window.addEventListener("popstate",p),window.addEventListener(ao,p),()=>{window.removeEventListener("popstate",p),window.removeEventListener(ao,p);}},[]);let s=yi.useCallback((p,F)=>{t?t(p,F):(history.pushState(null,"",p),(F==null?void 0:F.scroll)!==false&&window.scrollTo(0,0));},[t]),d=yi.useCallback(p=>{t?t(p,{replace:true}):history.replaceState(null,"",p);},[t]),l=yi.useCallback(()=>{history.back();},[]),v=yi.useMemo(()=>new URLSearchParams(r),[r]),u=yi.useMemo(()=>{if(!e)return {};let p=e.replace(/\/$/,""),F=p.startsWith("/")?p:`/${p}`;if(!a.startsWith(F))return {};let c=a.slice(F.length).replace(/^\//,"");return c?{path:c.split("/").filter(Boolean)[0]}:{}},[a,e]);return {push:s,replace:d,back:l,pathname:a,searchParams:v,params:u}}var Po=(e,t)=>{let a=[...e];return t.forEach(o=>{a.some(n=>n.id===o.id)?a=a.filter(n=>n.id!==o.id):a.push(o);}),a},ma=(e,t)=>{let a=[...e];return t.forEach(o=>{a.some(n=>n.id===o.id)?a=a.filter(n=>n.id!==o.id):a.push(o);}),a};function pa(e){let{mode:t,selectionMode:a,files:o,folders:r,selectedFiles:n,selectedFolders:s,currentFolder:d,setSelectedFiles:l,setSelectedFolders:v,setCurrentFolder:u,setFiles:p,setFolders:F,setPagination:c,loadData:h,isInSelectionMode:N,provider:x,onFilesSelected:V,onClose:C,basePath:I,setIsLoading:D,setFileDetailsModalFile:O}=e,{push:P}=ro({basePath:e.basePath,onNavigate:e.onNavigate}),J=yi.useCallback((M,z,A=false)=>{let B=[M];if(A||z&&(z.metaKey||z.ctrlKey)){l(Q=>Po(Q,B));return}if(N()&&t!==chunkSV5VFLC2_cjs.d.MODAL){l(Q=>Po(Q,B));return}if(t===chunkSV5VFLC2_cjs.d.MODAL){a==="single"?(l([M]),V==null||V([M]),C==null||C()):l(Q=>Po(Q,B));return}O(M);},[t,a,N,l,V,C,O]),q=yi.useCallback((M,z,A=false)=>{let B=M?M.id:null;if((A||z&&(z.metaKey||z.ctrlKey))&&M){v(Q=>ma(Q,[M]));return}if(N()&&M){v(Q=>ma(Q,[M]));return}if(t===chunkSV5VFLC2_cjs.d.PAGE){D(true);let Q=I!=null?I:"/media",De=Q.startsWith("/")?Q:`/${Q}`,yt=B===null?De:`${De}/${B}`;P(yt);}else {D(true),l([]),v([]);let Q=new URLSearchParams(globalThis.location.search);B===null?Q.delete("folderId"):Q.set("folderId",String(B)),Q.set("page","1");let De=`${globalThis.location.pathname}?${Q.toString()}`;P(De,{scroll:false});}},[N,t,P,v,l,I,D]),W=yi.useCallback(()=>{l([]),v([]);},[l,v]),g=yi.useCallback(M=>{M?(l(o),v(t===chunkSV5VFLC2_cjs.d.PAGE?r:[])):(l([]),v([]));},[o,r,t,l,v]),k=yi.useCallback(async(M=false)=>{await h(M);},[h]),m=yi.useCallback(async M=>{var z;try{await x.uploadFiles(M,(z=d==null?void 0:d.id)!=null?z:null),await k(!0),l([]),sonner.toast.success("Upload Successful",{description:`${M.length} file(s) uploaded successfully`});}catch(A){let B=A instanceof Error?A.message:"Failed to upload files";sonner.toast.error("Upload Failed",{description:B}),console.error("Upload failed:",A);}},[d,x,k,l]),T=yi.useCallback(async M=>{var z;try{await x.createFolder(M,(z=d==null?void 0:d.id)!=null?z:null),await k(!0),l([]),sonner.toast.success("Folder Created",{description:`Folder "${M}" created successfully`});}catch(A){let B=A instanceof Error?A.message:"Failed to create folder";sonner.toast.error("Create Folder Failed",{description:B}),console.error("Failed to create folder:",A);}},[d,x,k,l]),S=yi.useCallback(async M=>{try{n.length>0&&await x.moveFiles(n.map(A=>A.id),M),s.length>0&&await x.moveFolders(s.map(A=>A.id),M),await k(!0),l([]),v([]);let z=n.length+s.length;sonner.toast.success("Move Successful",{description:`${z} item(s) moved successfully`});}catch(z){let A=z instanceof Error?z.message:"Failed to move items";sonner.toast.error("Move Failed",{description:A}),console.error("Failed to move items:",z);}},[n,s,x,k,l,v]),E=yi.useCallback(async(M,z)=>{try{F(A=>A.map(B=>B.id===M?chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({},B),{name:z}):B)),await x.renameFolder(M,z),await k(!0),sonner.toast.success("Folder Renamed",{description:`Folder renamed to "${z}"`});}catch(A){let B=A instanceof Error?A.message:"Failed to rename folder";sonner.toast.error("Rename Failed",{description:B}),console.error("Failed to rename folder:",A);}},[x,k,F]),be=yi.useCallback(async(M,z)=>{try{p(A=>A.map(B=>{if(B.id===M){let ht=z,{metaData:Q}=ht,De=chunkSV5VFLC2_cjs.c(ht,["metaData"]);return chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a(chunkSV5VFLC2_cjs.a({},B),De),{metaData:Q?chunkSV5VFLC2_cjs.a(chunkSV5VFLC2_cjs.a({},B.metaData),Q):B.metaData})}return B})),await x.updateFileMetaData(M,z),await k(!0);}catch(A){let B=A instanceof Error?A.message:"Failed to update metadata";sonner.toast.error("Update Failed",{description:B}),console.error("Failed to update metadata:",A);}},[x,k,p]),qe=yi.useCallback(async()=>{try{n.length>0&&await x.deleteFiles(n.map(z=>z.id)),s.length>0&&await x.deleteFolders(s.map(z=>z.id)),await k(!0),l([]),v([]);let M=n.length+s.length;sonner.toast.success("Delete Successful",{description:`${M} item(s) deleted successfully`});}catch(M){let z=M instanceof Error?M.message:"Failed to delete items";sonner.toast.error("Delete Failed",{description:z}),console.error("Failed to delete items:",M);}},[n,s,x,k,l,v]);return {handleFileClick:J,handleFolderClick:q,handleClearSelection:W,handleSelectAllGlobal:g,uploadFiles:m,createFolder:T,bulkMove:S,renameFolder:E,updateFileMetadata:be,bulkDelete:qe,refreshData:k}}function va(e){let{mode:t,selectionMode:a,initialFolderId:o,acceptedFileTypesForModal:r,allowedFileTypes:n,provider:s,onFilesSelected:d,onClose:l,basePath:v,onNavigate:u}=e,{params:p,searchParams:F,push:c,replace:h,pathname:N}=ro({basePath:v,onNavigate:u}),x=Math.max(1,Number.parseInt(F.get("page")||"1",10)),V=Math.max(1,Number.parseInt(F.get("limit")||"24",10)),C=F.get("query")||"",I=yi.useMemo(()=>{if(t===chunkSV5VFLC2_cjs.d.PAGE&&(p!=null&&p.path)){let L=Array.isArray(p.path)?p.path[0]:p.path;return typeof L=="string"&&/^\d+$/.test(L)?Number(L):null}if(t===chunkSV5VFLC2_cjs.d.MODAL){let L=F.get("folderId");if(L&&/^\d+$/.test(L))return Number(L)}return o!=null?o:null},[t,p,F,o]),[D,O]=yi.useState([]),[P,J]=yi.useState([]),[q,W]=yi.useState([]),[g,k]=yi.useState([]),[m,T]=yi.useState(null),[S,E]=yi.useState(true),[be,qe]=yi.useState({currentPage:x,totalPages:1,totalFiles:0,filesPerPage:V}),M=yi.useRef(null);M.current=m;let[z,A]=yi.useState(C),[B,ht]=yi.useState(C);yi.useEffect(()=>{let L=setTimeout(()=>{ht(z);},300);return ()=>clearTimeout(L)},[z]);let Q=yi.useRef(I),De=yi.useCallback((L,se,ae=false)=>{let ee=new URLSearchParams(F.toString());ee.set("page",L.toString()),ee.set("limit",se.toString());let pt=ee.toString(),Ee=pt?`${N}?${pt}`:N;ae?h(Ee):c(Ee,{scroll:false});},[c,h,N,F]);yi.useEffect(()=>{qe(L=>chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({},L),{currentPage:x,filesPerPage:V})),A(C);},[x,V,C]),yi.useEffect(()=>{I!==Q.current&&(t===chunkSV5VFLC2_cjs.d.PAGE&&De(1,V,true),Q.current=I);},[I,V,De,t]);let yt=be.currentPage,wt=be.filesPerPage;yi.useEffect(()=>{let L=false,se=async()=>{if(I&&(!M.current||M.current.id!==I))try{E(!0);let ee=await s.getFolder(I);if(L)return;T(ee),await ae(ee);}catch(ee){let pt=ee instanceof Error?ee.message:"Failed to load folder";if(sonner.toast.error("Load Folder Failed",{description:pt}),console.error("Failed to fetch current folder",ee),L)return;T(null),L||E(false);}else I===null&&M.current!==null?(T(null),await ae(null)):M.current?await ae(M.current):await ae(null);},ae=async ee=>{var pt;if(!L){E(true);try{let Ee=[];t===chunkSV5VFLC2_cjs.d.MODAL?Ee=r:Ee=n;let _t=await s.getItems((pt=ee==null?void 0:ee.id)!=null?pt:null,Ee,yt,wt,B);if(L)return;J(_t.folders),O(_t.files),qe(_t.pagination);}catch(Ee){let _t=Ee instanceof Error?Ee.message:"Failed to load data";sonner.toast.error("Load Data Failed",{description:_t}),console.error("Failed to load data:",Ee);}finally{L||E(false);}}};return se(),()=>{L=true;}},[I,s,t,r,n,yt,wt,B]),yi.useEffect(()=>{k([]),W([]);},[m]);let[_r,Ar]=yi.useState(false),[Or,Br]=yi.useState(false),[Gr,Vr]=yi.useState(false),[Ur,Hr]=yi.useState(false),[$r,Kr]=yi.useState(false),[Wr,jr]=yi.useState(null),[Qr,qr]=yi.useState(null),Yr=yi.useCallback(async(L=false)=>{var se;L||E(true);try{let ae=[];t===chunkSV5VFLC2_cjs.d.MODAL?ae=r:ae=n;let ee=await s.getItems((se=m==null?void 0:m.id)!=null?se:null,ae,yt,wt,B);J(ee.folders),O(ee.files),qe(ee.pagination);}catch(ae){let ee=ae instanceof Error?ae.message:"Failed to load data";sonner.toast.error("Load Data Failed",{description:ee}),console.error("Failed to load data:",ae);}finally{L||E(false);}},[m,t,r,n,s,yt,wt,B]),Zr=()=>q.length>0||g.length>0,Jr=()=>m,Xr=yi.useMemo(()=>()=>{let L=D.length+(t===chunkSV5VFLC2_cjs.d.PAGE?P.length:0),se=q.length+g.length;return se===0?false:se===L?true:"indeterminate"},[D.length,P.length,q.length,g.length,t]),en=yi.useCallback(L=>{qe(se=>chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({},se),{currentPage:L})),t===chunkSV5VFLC2_cjs.d.PAGE&&De(L,wt);},[De,wt,t]),tn=yi.useCallback(L=>{A(L);let se=new URLSearchParams(F.toString());L.trim()?(se.set("query",L),se.set("page","1")):se.delete("query");let ae=se.toString();h(ae?`${N}?${ae}`:N);},[h,N,F]);return {files:D,folders:P,selectedFiles:q,selectedFolders:g,currentFolder:m,isLoading:S,pagination:be,isUploadModalOpen:_r,isCreateFolderModalOpen:Or,isSearchModalOpen:Gr,isMoveFileModalOpen:Ur,isRenameFolderModalOpen:$r,fileDetailsModalFile:Qr,folderToRename:Wr,setFiles:O,setFolders:J,setSelectedFiles:W,setSelectedFolders:k,setCurrentFolder:T,setPagination:qe,setIsUploadModalOpen:Ar,setIsCreateFolderModalOpen:Br,setIsSearchModalOpen:Vr,setIsMoveFileModalOpen:Hr,setIsRenameFolderModalOpen:Kr,setFileDetailsModalFile:qr,setFolderToRename:jr,loadData:Yr,setIsLoading:E,isInSelectionMode:Zr,getCurrentFolder:Jr,getSelectionState:Xr,handlePageChange:en,searchQuery:z,updateSearchQuery:tn,mode:t,selectionMode:a,acceptedFileTypesForModal:r,provider:s,onFilesSelected:d,onClose:l,basePath:v,onNavigate:u}}var xa=yi.createContext(void 0);function io({children:e,mode:t=chunkSV5VFLC2_cjs.d.PAGE,selectionMode:a=chunkSV5VFLC2_cjs.h.SINGLE,allowedFileTypes:o,onFilesSelected:r,onClose:n,acceptedFileTypesForModal:s,initialFolderId:d=null,provider:l,basePath:v="/media",maxUploadFiles:u=50,maxUploadSize:p=100*1024*1024,onNavigate:F}){let c=va({mode:t,selectionMode:a,initialFolderId:d,acceptedFileTypesForModal:s,allowedFileTypes:o,provider:l,onFilesSelected:r,onClose:n,basePath:v,onNavigate:F}),h=pa(c),N=yi.useMemo(()=>({files:c.files,folders:c.folders,selectedFiles:c.selectedFiles,selectedFolders:c.selectedFolders,currentFolder:c.currentFolder,isLoading:c.isLoading,pagination:c.pagination,isUploadModalOpen:c.isUploadModalOpen,isCreateFolderModalOpen:c.isCreateFolderModalOpen,isSearchModalOpen:c.isSearchModalOpen,isMoveFileModalOpen:c.isMoveFileModalOpen,isRenameFolderModalOpen:c.isRenameFolderModalOpen,fileDetailsModalFile:c.fileDetailsModalFile,folderToRename:c.folderToRename,mode:c.mode,selectionMode:c.selectionMode,allowedFileTypes:o,acceptedFileTypesForModal:c.acceptedFileTypesForModal,maxUploadFiles:u,maxUploadSize:p,setIsUploadModalOpen:c.setIsUploadModalOpen,setIsCreateFolderModalOpen:c.setIsCreateFolderModalOpen,setIsSearchModalOpen:c.setIsSearchModalOpen,setIsMoveFileModalOpen:c.setIsMoveFileModalOpen,setSelectedFiles:c.setSelectedFiles,setSelectedFolders:c.setSelectedFolders,setIsRenameFolderModalOpen:c.setIsRenameFolderModalOpen,setFileDetailsModalFile:c.setFileDetailsModalFile,setFolderToRename:c.setFolderToRename,handleFileClick:h.handleFileClick,handleFolderClick:h.handleFolderClick,handleClearSelection:h.handleClearSelection,handleSelectAllGlobal:h.handleSelectAllGlobal,handlePageChange:c.handlePageChange,searchQuery:c.searchQuery,updateSearchQuery:c.updateSearchQuery,uploadFiles:h.uploadFiles,createFolder:h.createFolder,bulkMove:h.bulkMove,renameFolder:h.renameFolder,updateFileMetadata:h.updateFileMetadata,bulkDelete:h.bulkDelete,refreshData:h.refreshData,isInSelectionMode:c.isInSelectionMode,getCurrentFolder:c.getCurrentFolder,getSelectionState:c.getSelectionState,onClose:c.onClose,onFilesSelected:c.onFilesSelected,provider:l,basePath:c.basePath}),[c,h,l,o,u,p]);return jsxRuntime.jsx(xa.Provider,{value:N,children:e})}function R(){let e=yi.useContext(xa);if(e===void 0)throw new Error("useFileManager must be used within a FileManagerProvider");return e}function b(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var ba=a=>{var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx("nav",chunkSV5VFLC2_cjs.a({"data-slot":"pagination",role:"navigation","aria-label":"pagination",className:b("mx-auto flex w-full justify-center",e)},t))};function ha(a){var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx("ul",chunkSV5VFLC2_cjs.a({"data-slot":"pagination-content",className:b("flex flex-row items-center gap-1",e)},t))}function $t(a){var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx("li",chunkSV5VFLC2_cjs.a({"data-slot":"pagination-item",className:b("",e)},t))}var ya=a=>{var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsxs("span",chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({"data-slot":"pagination-ellipsis","aria-hidden":true,className:b("flex h-9 w-9 items-center justify-center",e)},t),{children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.F,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{className:"sr-only",children:"More pages"})]}))};var fn=classVarianceAuthority.cva("cursor-pointer group whitespace-nowrap focus-visible:outline-hidden inline-flex items-center justify-center has-data-[arrow=true]:justify-between whitespace-nowrap text-sm font-medium ring-offset-background transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-60 [&_svg]:shrink-0",{variants:{variant:{primary:"bg-primary text-primary-foreground hover:bg-primary/90 data-[state=open]:bg-primary/90",mono:"bg-zinc-950 text-white dark:bg-zinc-300 dark:text-black hover:bg-zinc-950/90 dark:hover:bg-zinc-300/90 data-[state=open]:bg-zinc-950/90 dark:data-[state=open]:bg-zinc-300/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90 data-[state=open]:bg-destructive/90",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/90 data-[state=open]:bg-secondary/90",outline:"bg-background text-accent-foreground border border-input hover:bg-accent data-[state=open]:bg-accent",dashed:"text-accent-foreground border border-input border-dashed bg-background hover:bg-accent hover:text-accent-foreground data-[state=open]:text-accent-foreground",ghost:"text-accent-foreground hover:bg-accent hover:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",dim:"text-muted-foreground hover:text-foreground data-[state=open]:text-foreground",foreground:"",inverse:""},appearance:{default:"",ghost:""},underline:{solid:"",dashed:""},underlined:{solid:"",dashed:""},size:{lg:"h-10 px-4 text-sm gap-1.5 [&_svg:not([class*=size-])]:size-4",md:"h-9 px-3 gap-1.5 text-sm [&_svg:not([class*=size-])]:size-4",sm:"h-8 px-2.5 gap-1.25 text-xs [&_svg:not([class*=size-])]:size-3.5",xs:"h-7 px-2 gap-1 text-xs [&_svg:not([class*=size-])]:size-3.5",icon:"size-9 [&_svg:not([class*=size-])]:size-4 shrink-0"},autoHeight:{true:"",false:""},radius:{md:"rounded-md",full:"rounded-full"},mode:{default:"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",icon:"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 shrink-0",link:"text-primary h-auto p-0 bg-transparent rounded-none hover:bg-transparent data-[state=open]:bg-transparent",input:`
1
+ 'use strict';var chunkXOGHUQYC_cjs=require('./chunk-XOGHUQYC.cjs'),yi=require('react'),sonner=require('sonner'),jsxRuntime=require('react/jsx-runtime'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),classVarianceAuthority=require('class-variance-authority'),radixUi=require('radix-ui'),Ne=require('@radix-ui/react-tooltip'),cmdk=require('cmdk'),X=require('@radix-ui/react-context-menu');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var yi__default=/*#__PURE__*/_interopDefault(yi);var Ne__namespace=/*#__PURE__*/_interopNamespace(Ne);var X__namespace=/*#__PURE__*/_interopNamespace(X);var ao="locationchange";if(typeof window!="undefined"&&!window.__navigationPatched){window.__navigationPatched=true;let e=window.history.pushState,t=window.history.replaceState;window.history.pushState=function(...a){let o=e.apply(this,a);return setTimeout(()=>window.dispatchEvent(new Event(ao)),0),o},window.history.replaceState=function(...a){let o=t.apply(this,a);return setTimeout(()=>window.dispatchEvent(new Event(ao)),0),o};}function ro({basePath:e,onNavigate:t}={}){let[a,o]=yi.useState(()=>typeof window!="undefined"?window.location.pathname:"/"),[r,n]=yi.useState(()=>typeof window!="undefined"?window.location.search:"");yi.useEffect(()=>{let p=()=>{o(window.location.pathname),n(window.location.search);};return window.addEventListener("popstate",p),window.addEventListener(ao,p),()=>{window.removeEventListener("popstate",p),window.removeEventListener(ao,p);}},[]);let s=yi.useCallback((p,F)=>{t?t(p,F):(history.pushState(null,"",p),(F==null?void 0:F.scroll)!==false&&window.scrollTo(0,0));},[t]),d=yi.useCallback(p=>{t?t(p,{replace:true}):history.replaceState(null,"",p);},[t]),l=yi.useCallback(()=>{history.back();},[]),v=yi.useMemo(()=>new URLSearchParams(r),[r]),u=yi.useMemo(()=>{if(!e)return {};let p=e.replace(/\/$/,""),F=p.startsWith("/")?p:`/${p}`;if(!a.startsWith(F))return {};let c=a.slice(F.length).replace(/^\//,"");return c?{path:c.split("/").filter(Boolean)[0]}:{}},[a,e]);return {push:s,replace:d,back:l,pathname:a,searchParams:v,params:u}}var Po=(e,t)=>{let a=[...e];return t.forEach(o=>{a.some(n=>n.id===o.id)?a=a.filter(n=>n.id!==o.id):a.push(o);}),a},ma=(e,t)=>{let a=[...e];return t.forEach(o=>{a.some(n=>n.id===o.id)?a=a.filter(n=>n.id!==o.id):a.push(o);}),a};function pa(e){let{mode:t,selectionMode:a,files:o,folders:r,selectedFiles:n,selectedFolders:s,currentFolder:d,setSelectedFiles:l,setSelectedFolders:v,setCurrentFolder:u,setFiles:p,setFolders:F,setPagination:c,loadData:h,isInSelectionMode:N,provider:x,onFilesSelected:V,onClose:C,basePath:I,setIsLoading:D,setFileDetailsModalFile:O}=e,{push:P}=ro({basePath:e.basePath,onNavigate:e.onNavigate}),J=yi.useCallback((M,z,A=false)=>{let B=[M];if(A||z&&(z.metaKey||z.ctrlKey)){l(Q=>Po(Q,B));return}if(N()&&t!==chunkXOGHUQYC_cjs.d.MODAL){l(Q=>Po(Q,B));return}if(t===chunkXOGHUQYC_cjs.d.MODAL){a==="single"?(l([M]),V==null||V([M]),C==null||C()):l(Q=>Po(Q,B));return}O(M);},[t,a,N,l,V,C,O]),q=yi.useCallback((M,z,A=false)=>{let B=M?M.id:null;if((A||z&&(z.metaKey||z.ctrlKey))&&M){v(Q=>ma(Q,[M]));return}if(N()&&M){v(Q=>ma(Q,[M]));return}if(t===chunkXOGHUQYC_cjs.d.PAGE){D(true);let Q=I!=null?I:"/media",De=Q.startsWith("/")?Q:`/${Q}`,yt=B===null?De:`${De}/${B}`;P(yt);}else {D(true),l([]),v([]);let Q=new URLSearchParams(globalThis.location.search);B===null?Q.delete("folderId"):Q.set("folderId",String(B)),Q.set("page","1");let De=`${globalThis.location.pathname}?${Q.toString()}`;P(De,{scroll:false});}},[N,t,P,v,l,I,D]),W=yi.useCallback(()=>{l([]),v([]);},[l,v]),g=yi.useCallback(M=>{M?(l(o),v(t===chunkXOGHUQYC_cjs.d.PAGE?r:[])):(l([]),v([]));},[o,r,t,l,v]),k=yi.useCallback(async(M=false)=>{await h(M);},[h]),m=yi.useCallback(async M=>{var z;try{await x.uploadFiles(M,(z=d==null?void 0:d.id)!=null?z:null),await k(!0),l([]),sonner.toast.success("Upload Successful",{description:`${M.length} file(s) uploaded successfully`});}catch(A){let B=A instanceof Error?A.message:"Failed to upload files";sonner.toast.error("Upload Failed",{description:B}),console.error("Upload failed:",A);}},[d,x,k,l]),T=yi.useCallback(async M=>{var z;try{await x.createFolder(M,(z=d==null?void 0:d.id)!=null?z:null),await k(!0),l([]),sonner.toast.success("Folder Created",{description:`Folder "${M}" created successfully`});}catch(A){let B=A instanceof Error?A.message:"Failed to create folder";sonner.toast.error("Create Folder Failed",{description:B}),console.error("Failed to create folder:",A);}},[d,x,k,l]),S=yi.useCallback(async M=>{try{n.length>0&&await x.moveFiles(n.map(A=>A.id),M),s.length>0&&await x.moveFolders(s.map(A=>A.id),M),await k(!0),l([]),v([]);let z=n.length+s.length;sonner.toast.success("Move Successful",{description:`${z} item(s) moved successfully`});}catch(z){let A=z instanceof Error?z.message:"Failed to move items";sonner.toast.error("Move Failed",{description:A}),console.error("Failed to move items:",z);}},[n,s,x,k,l,v]),E=yi.useCallback(async(M,z)=>{try{F(A=>A.map(B=>B.id===M?chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({},B),{name:z}):B)),await x.renameFolder(M,z),await k(!0),sonner.toast.success("Folder Renamed",{description:`Folder renamed to "${z}"`});}catch(A){let B=A instanceof Error?A.message:"Failed to rename folder";sonner.toast.error("Rename Failed",{description:B}),console.error("Failed to rename folder:",A);}},[x,k,F]),be=yi.useCallback(async(M,z)=>{try{p(A=>A.map(B=>{if(B.id===M){let ht=z,{metaData:Q}=ht,De=chunkXOGHUQYC_cjs.c(ht,["metaData"]);return chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a(chunkXOGHUQYC_cjs.a({},B),De),{metaData:Q?chunkXOGHUQYC_cjs.a(chunkXOGHUQYC_cjs.a({},B.metaData),Q):B.metaData})}return B})),await x.updateFileMetaData(M,z),await k(!0);}catch(A){let B=A instanceof Error?A.message:"Failed to update metadata";sonner.toast.error("Update Failed",{description:B}),console.error("Failed to update metadata:",A);}},[x,k,p]),qe=yi.useCallback(async()=>{try{n.length>0&&await x.deleteFiles(n.map(z=>z.id)),s.length>0&&await x.deleteFolders(s.map(z=>z.id)),await k(!0),l([]),v([]);let M=n.length+s.length;sonner.toast.success("Delete Successful",{description:`${M} item(s) deleted successfully`});}catch(M){let z=M instanceof Error?M.message:"Failed to delete items";sonner.toast.error("Delete Failed",{description:z}),console.error("Failed to delete items:",M);}},[n,s,x,k,l,v]);return {handleFileClick:J,handleFolderClick:q,handleClearSelection:W,handleSelectAllGlobal:g,uploadFiles:m,createFolder:T,bulkMove:S,renameFolder:E,updateFileMetadata:be,bulkDelete:qe,refreshData:k}}function va(e){let{mode:t,selectionMode:a,initialFolderId:o,acceptedFileTypesForModal:r,allowedFileTypes:n,provider:s,onFilesSelected:d,onClose:l,basePath:v,onNavigate:u}=e,{params:p,searchParams:F,push:c,replace:h,pathname:N}=ro({basePath:v,onNavigate:u}),x=Math.max(1,Number.parseInt(F.get("page")||"1",10)),V=Math.max(1,Number.parseInt(F.get("limit")||"24",10)),C=F.get("query")||"",I=yi.useMemo(()=>{if(t===chunkXOGHUQYC_cjs.d.PAGE&&(p!=null&&p.path)){let L=Array.isArray(p.path)?p.path[0]:p.path;return typeof L=="string"&&/^\d+$/.test(L)?Number(L):null}if(t===chunkXOGHUQYC_cjs.d.MODAL){let L=F.get("folderId");if(L&&/^\d+$/.test(L))return Number(L)}return o!=null?o:null},[t,p,F,o]),[D,O]=yi.useState([]),[P,J]=yi.useState([]),[q,W]=yi.useState([]),[g,k]=yi.useState([]),[m,T]=yi.useState(null),[S,E]=yi.useState(true),[be,qe]=yi.useState({currentPage:x,totalPages:1,totalFiles:0,filesPerPage:V}),M=yi.useRef(null);M.current=m;let[z,A]=yi.useState(C),[B,ht]=yi.useState(C);yi.useEffect(()=>{let L=setTimeout(()=>{ht(z);},300);return ()=>clearTimeout(L)},[z]);let Q=yi.useRef(I),De=yi.useCallback((L,se,ae=false)=>{let ee=new URLSearchParams(F.toString());ee.set("page",L.toString()),ee.set("limit",se.toString());let pt=ee.toString(),Ee=pt?`${N}?${pt}`:N;ae?h(Ee):c(Ee,{scroll:false});},[c,h,N,F]);yi.useEffect(()=>{qe(L=>chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({},L),{currentPage:x,filesPerPage:V})),A(C);},[x,V,C]),yi.useEffect(()=>{I!==Q.current&&(t===chunkXOGHUQYC_cjs.d.PAGE&&De(1,V,true),Q.current=I);},[I,V,De,t]);let yt=be.currentPage,wt=be.filesPerPage;yi.useEffect(()=>{let L=false,se=async()=>{if(I&&(!M.current||M.current.id!==I))try{E(!0);let ee=await s.getFolder(I);if(L)return;T(ee),await ae(ee);}catch(ee){let pt=ee instanceof Error?ee.message:"Failed to load folder";if(sonner.toast.error("Load Folder Failed",{description:pt}),console.error("Failed to fetch current folder",ee),L)return;T(null),L||E(false);}else I===null&&M.current!==null?(T(null),await ae(null)):M.current?await ae(M.current):await ae(null);},ae=async ee=>{var pt;if(!L){E(true);try{let Ee=[];t===chunkXOGHUQYC_cjs.d.MODAL?Ee=r:Ee=n;let _t=await s.getItems((pt=ee==null?void 0:ee.id)!=null?pt:null,Ee,yt,wt,B);if(L)return;J(_t.folders),O(_t.files),qe(_t.pagination);}catch(Ee){let _t=Ee instanceof Error?Ee.message:"Failed to load data";sonner.toast.error("Load Data Failed",{description:_t}),console.error("Failed to load data:",Ee);}finally{L||E(false);}}};return se(),()=>{L=true;}},[I,s,t,r,n,yt,wt,B]),yi.useEffect(()=>{k([]),W([]);},[m]);let[_r,Ar]=yi.useState(false),[Or,Br]=yi.useState(false),[Gr,Vr]=yi.useState(false),[Ur,Hr]=yi.useState(false),[$r,Kr]=yi.useState(false),[Wr,jr]=yi.useState(null),[Qr,qr]=yi.useState(null),Yr=yi.useCallback(async(L=false)=>{var se;L||E(true);try{let ae=[];t===chunkXOGHUQYC_cjs.d.MODAL?ae=r:ae=n;let ee=await s.getItems((se=m==null?void 0:m.id)!=null?se:null,ae,yt,wt,B);J(ee.folders),O(ee.files),qe(ee.pagination);}catch(ae){let ee=ae instanceof Error?ae.message:"Failed to load data";sonner.toast.error("Load Data Failed",{description:ee}),console.error("Failed to load data:",ae);}finally{L||E(false);}},[m,t,r,n,s,yt,wt,B]),Zr=()=>q.length>0||g.length>0,Jr=()=>m,Xr=yi.useMemo(()=>()=>{let L=D.length+(t===chunkXOGHUQYC_cjs.d.PAGE?P.length:0),se=q.length+g.length;return se===0?false:se===L?true:"indeterminate"},[D.length,P.length,q.length,g.length,t]),en=yi.useCallback(L=>{qe(se=>chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({},se),{currentPage:L})),t===chunkXOGHUQYC_cjs.d.PAGE&&De(L,wt);},[De,wt,t]),tn=yi.useCallback(L=>{A(L);let se=new URLSearchParams(F.toString());L.trim()?(se.set("query",L),se.set("page","1")):se.delete("query");let ae=se.toString();h(ae?`${N}?${ae}`:N);},[h,N,F]);return {files:D,folders:P,selectedFiles:q,selectedFolders:g,currentFolder:m,isLoading:S,pagination:be,isUploadModalOpen:_r,isCreateFolderModalOpen:Or,isSearchModalOpen:Gr,isMoveFileModalOpen:Ur,isRenameFolderModalOpen:$r,fileDetailsModalFile:Qr,folderToRename:Wr,setFiles:O,setFolders:J,setSelectedFiles:W,setSelectedFolders:k,setCurrentFolder:T,setPagination:qe,setIsUploadModalOpen:Ar,setIsCreateFolderModalOpen:Br,setIsSearchModalOpen:Vr,setIsMoveFileModalOpen:Hr,setIsRenameFolderModalOpen:Kr,setFileDetailsModalFile:qr,setFolderToRename:jr,loadData:Yr,setIsLoading:E,isInSelectionMode:Zr,getCurrentFolder:Jr,getSelectionState:Xr,handlePageChange:en,searchQuery:z,updateSearchQuery:tn,mode:t,selectionMode:a,acceptedFileTypesForModal:r,provider:s,onFilesSelected:d,onClose:l,basePath:v,onNavigate:u}}var xa=yi.createContext(void 0);function io({children:e,mode:t=chunkXOGHUQYC_cjs.d.PAGE,selectionMode:a=chunkXOGHUQYC_cjs.h.SINGLE,allowedFileTypes:o,onFilesSelected:r,onClose:n,acceptedFileTypesForModal:s,initialFolderId:d=null,provider:l,basePath:v="/media",maxUploadFiles:u=50,maxUploadSize:p=100*1024*1024,onNavigate:F}){let c=va({mode:t,selectionMode:a,initialFolderId:d,acceptedFileTypesForModal:s,allowedFileTypes:o,provider:l,onFilesSelected:r,onClose:n,basePath:v,onNavigate:F}),h=pa(c),N=yi.useMemo(()=>({files:c.files,folders:c.folders,selectedFiles:c.selectedFiles,selectedFolders:c.selectedFolders,currentFolder:c.currentFolder,isLoading:c.isLoading,pagination:c.pagination,isUploadModalOpen:c.isUploadModalOpen,isCreateFolderModalOpen:c.isCreateFolderModalOpen,isSearchModalOpen:c.isSearchModalOpen,isMoveFileModalOpen:c.isMoveFileModalOpen,isRenameFolderModalOpen:c.isRenameFolderModalOpen,fileDetailsModalFile:c.fileDetailsModalFile,folderToRename:c.folderToRename,mode:c.mode,selectionMode:c.selectionMode,allowedFileTypes:o,acceptedFileTypesForModal:c.acceptedFileTypesForModal,maxUploadFiles:u,maxUploadSize:p,setIsUploadModalOpen:c.setIsUploadModalOpen,setIsCreateFolderModalOpen:c.setIsCreateFolderModalOpen,setIsSearchModalOpen:c.setIsSearchModalOpen,setIsMoveFileModalOpen:c.setIsMoveFileModalOpen,setSelectedFiles:c.setSelectedFiles,setSelectedFolders:c.setSelectedFolders,setIsRenameFolderModalOpen:c.setIsRenameFolderModalOpen,setFileDetailsModalFile:c.setFileDetailsModalFile,setFolderToRename:c.setFolderToRename,handleFileClick:h.handleFileClick,handleFolderClick:h.handleFolderClick,handleClearSelection:h.handleClearSelection,handleSelectAllGlobal:h.handleSelectAllGlobal,handlePageChange:c.handlePageChange,searchQuery:c.searchQuery,updateSearchQuery:c.updateSearchQuery,uploadFiles:h.uploadFiles,createFolder:h.createFolder,bulkMove:h.bulkMove,renameFolder:h.renameFolder,updateFileMetadata:h.updateFileMetadata,bulkDelete:h.bulkDelete,refreshData:h.refreshData,isInSelectionMode:c.isInSelectionMode,getCurrentFolder:c.getCurrentFolder,getSelectionState:c.getSelectionState,onClose:c.onClose,onFilesSelected:c.onFilesSelected,provider:l,basePath:c.basePath}),[c,h,l,o,u,p]);return jsxRuntime.jsx(xa.Provider,{value:N,children:e})}function R(){let e=yi.useContext(xa);if(e===void 0)throw new Error("useFileManager must be used within a FileManagerProvider");return e}function b(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var ba=a=>{var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx("nav",chunkXOGHUQYC_cjs.a({"data-slot":"pagination",role:"navigation","aria-label":"pagination",className:b("mx-auto flex w-full justify-center",e)},t))};function ha(a){var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx("ul",chunkXOGHUQYC_cjs.a({"data-slot":"pagination-content",className:b("flex flex-row items-center gap-1",e)},t))}function $t(a){var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx("li",chunkXOGHUQYC_cjs.a({"data-slot":"pagination-item",className:b("",e)},t))}var ya=a=>{var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsxs("span",chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({"data-slot":"pagination-ellipsis","aria-hidden":true,className:b("flex h-9 w-9 items-center justify-center",e)},t),{children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.F,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{className:"sr-only",children:"More pages"})]}))};var fn=classVarianceAuthority.cva("cursor-pointer group whitespace-nowrap focus-visible:outline-hidden inline-flex items-center justify-center has-data-[arrow=true]:justify-between whitespace-nowrap text-sm font-medium ring-offset-background transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-60 [&_svg]:shrink-0",{variants:{variant:{primary:"bg-primary text-primary-foreground hover:bg-primary/90 data-[state=open]:bg-primary/90",mono:"bg-zinc-950 text-white dark:bg-zinc-300 dark:text-black hover:bg-zinc-950/90 dark:hover:bg-zinc-300/90 data-[state=open]:bg-zinc-950/90 dark:data-[state=open]:bg-zinc-300/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90 data-[state=open]:bg-destructive/90",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/90 data-[state=open]:bg-secondary/90",outline:"bg-background text-accent-foreground border border-input hover:bg-accent data-[state=open]:bg-accent",dashed:"text-accent-foreground border border-input border-dashed bg-background hover:bg-accent hover:text-accent-foreground data-[state=open]:text-accent-foreground",ghost:"text-accent-foreground hover:bg-accent hover:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",dim:"text-muted-foreground hover:text-foreground data-[state=open]:text-foreground",foreground:"",inverse:""},appearance:{default:"",ghost:""},underline:{solid:"",dashed:""},underlined:{solid:"",dashed:""},size:{lg:"h-10 px-4 text-sm gap-1.5 [&_svg:not([class*=size-])]:size-4",md:"h-9 px-3 gap-1.5 text-sm [&_svg:not([class*=size-])]:size-4",sm:"h-8 px-2.5 gap-1.25 text-xs [&_svg:not([class*=size-])]:size-3.5",xs:"h-7 px-2 gap-1 text-xs [&_svg:not([class*=size-])]:size-3.5",icon:"size-9 [&_svg:not([class*=size-])]:size-4 shrink-0"},autoHeight:{true:"",false:""},radius:{md:"rounded-md",full:"rounded-full"},mode:{default:"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",icon:"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 shrink-0",link:"text-primary h-auto p-0 bg-transparent rounded-none hover:bg-transparent data-[state=open]:bg-transparent",input:`
2
2
  justify-start font-normal hover:bg-background [&_svg]:transition-colors [&_svg]:hover:text-foreground data-[state=open]:bg-background
3
3
  focus-visible:border-ring focus-visible:outline-hidden focus-visible:ring-[3px] focus-visible:ring-ring/30
4
4
  [[data-state=open]>&]:border-ring [[data-state=open]>&]:outline-hidden [[data-state=open]>&]:ring-[3px]
5
5
  [[data-state=open]>&]:ring-ring/30
6
6
  aria-invalid:border-destructive/60 aria-invalid:ring-destructive/10 dark:aria-invalid:border-destructive dark:aria-invalid:ring-destructive/20
7
7
  in-data-[invalid=true]:border-destructive/60 in-data-[invalid=true]:ring-destructive/10 dark:in-data-[invalid=true]:border-destructive dark:in-data-[invalid=true]:ring-destructive/20
8
- `},placeholder:{true:"text-muted-foreground",false:""}},compoundVariants:[{variant:"ghost",mode:"default",className:"[&_svg:not([role=img]):not([class*=text-]):not([class*=opacity-])]:opacity-60"},{variant:"outline",mode:"default",className:"[&_svg:not([role=img]):not([class*=text-]):not([class*=opacity-])]:opacity-60"},{variant:"dashed",mode:"default",className:"[&_svg:not([role=img]):not([class*=text-]):not([class*=opacity-])]:opacity-60"},{variant:"secondary",mode:"default",className:"[&_svg:not([role=img]):not([class*=text-]):not([class*=opacity-])]:opacity-60"},{variant:"outline",mode:"input",className:"[&_svg:not([role=img]):not([class*=text-]):not([class*=opacity-])]:opacity-60"},{variant:"outline",mode:"icon",className:"[&_svg:not([role=img]):not([class*=text-]):not([class*=opacity-])]:opacity-60"},{size:"xs",autoHeight:true,className:"h-auto min-h-7"},{size:"md",autoHeight:true,className:"h-auto min-h-9"},{size:"sm",autoHeight:true,className:"h-auto min-h-8"},{size:"lg",autoHeight:true,className:"h-auto min-h-10"},{variant:"primary",mode:"default",appearance:"default",className:"shadow-xs shadow-black/5"},{variant:"mono",mode:"default",appearance:"default",className:"shadow-xs shadow-black/5"},{variant:"secondary",mode:"default",appearance:"default",className:"shadow-xs shadow-black/5"},{variant:"outline",mode:"default",appearance:"default",className:"shadow-xs shadow-black/5"},{variant:"dashed",mode:"default",appearance:"default",className:"shadow-xs shadow-black/5"},{variant:"destructive",mode:"default",appearance:"default",className:"shadow-xs shadow-black/5"},{variant:"primary",mode:"icon",appearance:"default",className:"shadow-xs shadow-black/5"},{variant:"mono",mode:"icon",appearance:"default",className:"shadow-xs shadow-black/5"},{variant:"secondary",mode:"icon",appearance:"default",className:"shadow-xs shadow-black/5"},{variant:"outline",mode:"icon",appearance:"default",className:"shadow-xs shadow-black/5"},{variant:"dashed",mode:"icon",appearance:"default",className:"shadow-xs shadow-black/5"},{variant:"destructive",mode:"icon",appearance:"default",className:"shadow-xs shadow-black/5"},{variant:"primary",mode:"link",underline:"solid",className:"font-medium text-primary hover:text-primary/90 [&_svg:not([role=img]):not([class*=text-])]:opacity-60 hover:underline hover:underline-offset-4 hover:decoration-solid"},{variant:"primary",mode:"link",underline:"dashed",className:"font-medium text-primary hover:text-primary/90 [&_svg:not([role=img]):not([class*=text-])]:opacity-60 hover:underline hover:underline-offset-4 hover:decoration-dashed decoration-1"},{variant:"primary",mode:"link",underlined:"solid",className:"font-medium text-primary hover:text-primary/90 [&_svg:not([role=img]):not([class*=text-])]:opacity-60 underline underline-offset-4 decoration-solid"},{variant:"primary",mode:"link",underlined:"dashed",className:"font-medium text-primary hover:text-primary/90 [&_svg]:opacity-60 underline underline-offset-4 decoration-dashed decoration-1"},{variant:"inverse",mode:"link",underline:"solid",className:"font-medium text-inherit [&_svg:not([role=img]):not([class*=text-])]:opacity-60 hover:underline hover:underline-offset-4 hover:decoration-solid"},{variant:"inverse",mode:"link",underline:"dashed",className:"font-medium text-inherit [&_svg:not([role=img]):not([class*=text-])]:opacity-60 hover:underline hover:underline-offset-4 hover:decoration-dashed decoration-1"},{variant:"inverse",mode:"link",underlined:"solid",className:"font-medium text-inherit [&_svg:not([role=img]):not([class*=text-])]:opacity-60 underline underline-offset-4 decoration-solid"},{variant:"inverse",mode:"link",underlined:"dashed",className:"font-medium text-inherit [&_svg:not([role=img]):not([class*=text-])]:opacity-60 underline underline-offset-4 decoration-dashed decoration-1"},{variant:"foreground",mode:"link",underline:"solid",className:"font-medium text-foreground [&_svg:not([role=img]):not([class*=text-])]:opacity-60 hover:underline hover:underline-offset-4 hover:decoration-solid"},{variant:"foreground",mode:"link",underline:"dashed",className:"font-medium text-foreground [&_svg:not([role=img]):not([class*=text-])]:opacity-60 hover:underline hover:underline-offset-4 hover:decoration-dashed decoration-1"},{variant:"foreground",mode:"link",underlined:"solid",className:"font-medium text-foreground [&_svg:not([role=img]):not([class*=text-])]:opacity-60 underline underline-offset-4 decoration-solid"},{variant:"foreground",mode:"link",underlined:"dashed",className:"font-medium text-foreground [&_svg:not([role=img]):not([class*=text-])]:opacity-60 underline underline-offset-4 decoration-dashed decoration-1"},{variant:"primary",appearance:"ghost",className:"bg-transparent text-primary/90 hover:bg-primary/5 data-[state=open]:bg-primary/5"},{variant:"destructive",appearance:"ghost",className:"bg-transparent text-destructive/90 hover:bg-destructive/5 data-[state=open]:bg-destructive/5"},{variant:"ghost",mode:"icon",className:"text-muted-foreground"},{size:"xs",mode:"icon",className:"w-7 h-7 p-0 [[&_svg:not([class*=size-])]:size-3.5"},{size:"sm",mode:"icon",className:"w-8 h-8 p-0 [[&_svg:not([class*=size-])]:size-3.5"},{size:"md",mode:"icon",className:"w-9 h-9 p-0 [&_svg:not([class*=size-])]:size-4"},{size:"icon",className:"w-9 h-9 p-0 [&_svg:not([class*=size-])]:size-4"},{size:"lg",mode:"icon",className:"w-10 h-10 p-0 [&_svg:not([class*=size-])]:size-4"},{mode:"input",placeholder:true,variant:"outline",className:"font-normal text-muted-foreground"},{mode:"input",variant:"outline",size:"sm",className:"gap-1.25"},{mode:"input",variant:"outline",size:"md",className:"gap-1.5"},{mode:"input",variant:"outline",size:"lg",className:"gap-1.5"}],defaultVariants:{variant:"primary",mode:"default",size:"md",radius:"md",appearance:"default"}});function w(c){var h=c,{className:e,selected:t,variant:a,radius:o,appearance:r,mode:n,size:s,autoHeight:d,underlined:l,underline:v,asChild:u=false,placeholder:p=false}=h,F=chunkSV5VFLC2_cjs.c(h,["className","selected","variant","radius","appearance","mode","size","autoHeight","underlined","underline","asChild","placeholder"]);let N=u?radixUi.Slot.Slot:"button";return jsxRuntime.jsx(N,chunkSV5VFLC2_cjs.a(chunkSV5VFLC2_cjs.a({"data-slot":"button",className:b(fn({variant:a,size:s,radius:o,appearance:r,mode:n,autoHeight:d,placeholder:p,underlined:l,underline:v,className:e}),u&&F.disabled&&"pointer-events-none opacity-50")},t&&{"data-state":"open"}),F))}function vn(e,t){let a=[];if(t<=7)for(let o=1;o<=t;o++)a.push(o);else e<=4?a.push(1,2,3,4,5,"ellipsis",t):e>=t-3?a.push(1,"ellipsis",t-4,t-3,t-2,t-1,t):a.push(1,"ellipsis",e-1,e,e+1,"ellipsis",t);return a}function wa({className:e}){let{pagination:t,handlePageChange:a,files:o,folders:r}=R(),{currentPage:n,totalPages:s}=t,d=((o==null?void 0:o.length)||0)+((r==null?void 0:r.length)||0);if(s<=1||d===0)return null;let l=vn(n,s);return jsxRuntime.jsx(ba,{className:e,children:jsxRuntime.jsxs(ha,{children:[jsxRuntime.jsx($t,{children:jsxRuntime.jsx(w,{variant:"ghost",radius:"full",asChild:true,disabled:n===1,onClick:()=>n>1&&a(n-1),children:jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.v,{className:"rtl:rotate-180"})," Previous"]})})}),l.map((v,u)=>v==="ellipsis"?jsxRuntime.jsx($t,{children:jsxRuntime.jsx(ya,{})},`ellipsis-${n}-${s}-${u}`):jsxRuntime.jsx($t,{children:jsxRuntime.jsx(w,{variant:v===n?"outline":"ghost",mode:"icon",size:"icon",radius:"full",asChild:true,onClick:()=>a(v),disabled:v===n,children:jsxRuntime.jsx("span",{children:v})})},v)),jsxRuntime.jsx($t,{children:jsxRuntime.jsx(w,{variant:"ghost",radius:"full",asChild:true,disabled:n===s,onClick:()=>n<s&&a(n+1),children:jsxRuntime.jsxs("span",{children:["Next ",jsxRuntime.jsx(chunkSV5VFLC2_cjs.u,{className:"rtl:rotate-180"})]})})})]})})}function Ca({children:e,className:t}){return jsxRuntime.jsx("div",{className:b("p-4 flex md:flex-row gap-2",t),children:e})}var hn=classVarianceAuthority.cva("flex flex-col fixed outline-0 z-50 border border-border bg-background text-foreground shadow-lg shadow-black/5 duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 rounded-2xl",{variants:{variant:{default:"left-[50%] top-[50%] max-w-lg translate-x-[-50%] translate-y-[-50%] w-full p-6 max-h-[90dvh]",fullscreen:"top-5 left-5 right-5 bottom-5"}},defaultVariants:{variant:"default"}});function we(t){var e=chunkSV5VFLC2_cjs.c(t,[]);return jsxRuntime.jsx(radixUi.Dialog.Root,chunkSV5VFLC2_cjs.a({"data-slot":"dialog"},e))}function yn(t){var e=chunkSV5VFLC2_cjs.c(t,[]);return jsxRuntime.jsx(radixUi.Dialog.Portal,chunkSV5VFLC2_cjs.a({"data-slot":"dialog-portal"},e))}function Ge(t){var e=chunkSV5VFLC2_cjs.c(t,[]);return jsxRuntime.jsx(radixUi.Dialog.Close,chunkSV5VFLC2_cjs.a({"data-slot":"dialog-close"},e))}function wn(a){var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx(radixUi.Dialog.Overlay,chunkSV5VFLC2_cjs.a({"data-slot":"dialog-overlay",className:b("fixed inset-0 z-50 bg-black/30 [backdrop-filter:blur(4px)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e)},t))}function Ce(s){var d=s,{className:e,children:t,showCloseButton:a=true,overlay:o=true,variant:r}=d,n=chunkSV5VFLC2_cjs.c(d,["className","children","showCloseButton","overlay","variant"]);return jsxRuntime.jsxs(yn,{children:[o&&jsxRuntime.jsx(wn,{}),jsxRuntime.jsxs(radixUi.Dialog.Content,chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({"data-slot":"dialog-content",className:b(hn({variant:r}),e)},n),{children:[t,a&&jsxRuntime.jsxs(Ge,{className:"cursor-pointer outline-0 absolute end-5 top-5 rounded-full opacity-60 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.y,{className:"size-4 text-gray-600 dark:text-zinc-400"}),jsxRuntime.jsx("span",{className:"sr-only",children:"Close"})]})]}))]})}var Le=a=>{var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx("div",chunkSV5VFLC2_cjs.a({"data-slot":"dialog-header",className:b("flex flex-col space-y-1 text-center sm:text-start mb-5",e)},t))},_e=a=>{var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx("div",chunkSV5VFLC2_cjs.a({"data-slot":"dialog-footer",className:b("flex flex-col-reverse sm:flex-row sm:justify-end pt-5 sm:space-x-2.5",e)},t))};function Fe(a){var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx(radixUi.Dialog.Title,chunkSV5VFLC2_cjs.a({"data-slot":"dialog-title",className:b("text-lg font-semibold leading-none tracking-tight",e)},t))}function Xe(a){var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx(radixUi.Dialog.Description,chunkSV5VFLC2_cjs.a({"data-slot":"dialog-description",className:b("text-sm text-muted-foreground",e)},t))}var Fn=classVarianceAuthority.cva("flex items-stretch w-full gap-2 group-[.toaster]:w-(--width)",{variants:{variant:{secondary:"",primary:"",destructive:"",success:"",info:"",mono:"",warning:""},icon:{primary:"",destructive:"",success:"",info:"",warning:""},appearance:{solid:"",outline:"",light:"",stroke:"text-foreground"},size:{lg:"rounded-lg p-4 gap-3 text-base [&>[data-slot=alert-icon]>svg]:size-6 *:data-slot=alert-icon:mt-0.5 [&_[data-slot=alert-close]]:mt-1",md:"rounded-lg p-3.5 gap-2.5 text-sm [&>[data-slot=alert-icon]>svg]:size-5 *:data-slot=alert-icon:mt-0 [&_[data-slot=alert-close]]:mt-0.5",sm:"rounded-md px-3 py-2.5 gap-2 text-xs [&>[data-slot=alert-icon]>svg]:size-4 *:data-alert-icon:mt-0.5 [&_[data-slot=alert-close]]:mt-0.25 [&_[data-slot=alert-close]_svg]:size-3.5"}},compoundVariants:[{variant:"secondary",appearance:"solid",className:"bg-muted text-foreground"},{variant:"primary",appearance:"solid",className:"bg-primary text-primary-foreground"},{variant:"destructive",appearance:"solid",className:"bg-destructive text-destructive-foreground"},{variant:"success",appearance:"solid",className:"bg-[var(--color-success,var(--color-green-500))] text-[var(--color-success-foreground,var(--color-white))]"},{variant:"info",appearance:"solid",className:"bg-[var(--color-info,var(--color-violet-600))] text-[var(--color-info-foreground,var(--color-white))]"},{variant:"warning",appearance:"solid",className:"bg-[var(--color-warning,var(--color-yellow-500))] text-[var(--color-warning-foreground,var(--color-white))]"},{variant:"mono",appearance:"solid",className:"bg-zinc-950 text-white dark:bg-zinc-300 dark:text-black *:data-slot-[alert=close]:text-white"},{variant:"secondary",appearance:"outline",className:"border border-border bg-background text-foreground [&_[data-slot=alert-close]]:text-foreground"},{variant:"primary",appearance:"outline",className:"border border-border bg-background text-primary [&_[data-slot=alert-close]]:text-foreground"},{variant:"destructive",appearance:"outline",className:"border border-border bg-background text-destructive [&_[data-slot=alert-close]]:text-foreground"},{variant:"success",appearance:"outline",className:"border border-border bg-background text-[var(--color-success,var(--color-green-500))] [&_[data-slot=alert-close]]:text-foreground"},{variant:"info",appearance:"outline",className:"border border-border bg-background text-[var(--color-info,var(--color-violet-600))] [&_[data-slot=alert-close]]:text-foreground"},{variant:"warning",appearance:"outline",className:"border border-border bg-background text-[var(--color-warning,var(--color-yellow-500))] [&_[data-slot=alert-close]]:text-foreground"},{variant:"mono",appearance:"outline",className:"border border-border bg-background text-foreground [&_[data-slot=alert-close]]:text-foreground"},{variant:"secondary",appearance:"light",className:"bg-muted border border-border text-foreground"},{variant:"primary",appearance:"light",className:"text-foreground bg-[var(--color-primary-soft,var(--color-blue-50))] border border-[var(--color-primary-alpha,var(--color-blue-100))] [&_[data-slot=alert-icon]]:text-primary dark:bg-[var(--color-primary-soft,var(--color-blue-950))] dark:border-[var(--color-primary-alpha,var(--color-blue-900))]"},{variant:"destructive",appearance:"light",className:"bg-[var(--color-destructive-soft,var(--color-red-50))] border border-[var(--color-destructive-alpha,var(--color-red-100))] text-foreground [&_[data-slot=alert-icon]]:text-destructive dark:bg-[var(--color-destructive-soft,var(--color-red-950))] dark:border-[var(--color-destructive-alpha,var(--color-red-900))] "},{variant:"success",appearance:"light",className:"bg-[var(--color-success-soft,var(--color-green-50))] border border-[var(--color-success-alpha,var(--color-green-200))] text-foreground [&_[data-slot=alert-icon]]:text-[var(--color-success-foreground,var(--color-green-600))] dark:bg-[var(--color-success-soft,var(--color-green-950))] dark:border-[var(--color-success-alpha,var(--color-green-900))]"},{variant:"info",appearance:"light",className:"bg-[var(--color-info-soft,var(--color-violet-50))] border border-[var(--color-info-alpha,var(--color-violet-100))] text-foreground [&_[data-slot=alert-icon]]:text-[var(--color-info-foreground,var(--color-violet-600))] dark:bg-[var(--color-info-soft,var(--color-violet-950))] dark:border-[var(--color-info-alpha,var(--color-violet-900))]"},{variant:"warning",appearance:"light",className:"bg-[var(--color-warning-soft,var(--color-yellow-50))] border border-[var(--color-warning-alpha,var(--color-yellow-200))] text-foreground [&_[data-slot=alert-icon]]:text-[var(--color-warning-foreground,var(--color-yellow-600))] dark:bg-[var(--color-warning-soft,var(--color-yellow-950))] dark:border-[var(--color-warning-alpha,var(--color-yellow-900))]"},{variant:"mono",icon:"primary",className:"[&_[data-slot=alert-icon]]:text-primary"},{variant:"mono",icon:"warning",className:"[&_[data-slot=alert-icon]]:text-[var(--color-warning-foreground,var(--color-yellow-600))]"},{variant:"mono",icon:"success",className:"[&_[data-slot=alert-icon]]:text-[var(--color-success-foreground,var(--color-green-600))]"},{variant:"mono",icon:"destructive",className:"[&_[data-slot=alert-icon]]:text-destructive"},{variant:"mono",icon:"info",className:"[&_[data-slot=alert-icon]]:text-[var(--color-info-foreground,var(--color-violet-600))]"}],defaultVariants:{variant:"secondary",appearance:"solid",size:"md"}});function Fa(v){var u=v,{className:e,variant:t,size:a,icon:o,appearance:r,close:n=false,onClose:s,children:d}=u,l=chunkSV5VFLC2_cjs.c(u,["className","variant","size","icon","appearance","close","onClose","children"]);return jsxRuntime.jsxs("div",chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({"data-slot":"alert",role:"alert",className:b(Fn({variant:t,size:a,icon:o,appearance:r}),e)},l),{children:[d,n&&jsxRuntime.jsx("button",{onClick:s,"aria-label":"Dismiss","data-slot":"alert-close",className:b("group shrink-0 size-4 cursor-pointer"),children:jsxRuntime.jsx(chunkSV5VFLC2_cjs.y,{className:"opacity-60 group-hover:opacity-100 size-4"})})]}))}function Na(a){var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx("div",chunkSV5VFLC2_cjs.a({"data-slot":"alert-title",className:b("grow tracking-tight",e)},t))}function Ma(o){var r=o,{children:e,className:t}=r,a=chunkSV5VFLC2_cjs.c(r,["children","className"]);return jsxRuntime.jsx("div",chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({"data-slot":"alert-icon",className:b("shrink-0",t)},a),{children:e}))}function ka(a){var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx("div",chunkSV5VFLC2_cjs.a({"data-slot":"alert-description",className:b("text-sm [&_p]:leading-relaxed [&_p]:mb-2",e)},t))}function Da(a){var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx("div",chunkSV5VFLC2_cjs.a({"data-slot":"alert-content",className:b("space-y-2 [&_[data-slot=alert-title]]:font-semibold",e)},t))}function Mn(a){var o=a,{delayDuration:e=0}=o,t=chunkSV5VFLC2_cjs.c(o,["delayDuration"]);return jsxRuntime.jsx(Ne__namespace.Provider,chunkSV5VFLC2_cjs.a({"data-slot":"tooltip-provider",delayDuration:e},t))}function Pa(t){var e=chunkSV5VFLC2_cjs.c(t,[]);return jsxRuntime.jsx(Mn,{children:jsxRuntime.jsx(Ne__namespace.Root,chunkSV5VFLC2_cjs.a({"data-slot":"tooltip"},e))})}function Ia(t){var e=chunkSV5VFLC2_cjs.c(t,[]);return jsxRuntime.jsx(Ne__namespace.Trigger,chunkSV5VFLC2_cjs.a({"data-slot":"tooltip-trigger"},e))}function Sa(r){var n=r,{className:e,sideOffset:t=0,children:a}=n,o=chunkSV5VFLC2_cjs.c(n,["className","sideOffset","children"]);return jsxRuntime.jsx(Ne__namespace.Portal,{children:jsxRuntime.jsxs(Ne__namespace.Content,chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({"data-slot":"tooltip-content",sideOffset:t,className:b("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e)},o),{children:[a,jsxRuntime.jsx(Ne__namespace.Arrow,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]}))})}function re(e){if(e===0)return "0 Bytes";let t=1024,a=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],o=Math.floor(Math.log(e)/Math.log(t));return Number.parseFloat((e/Math.pow(t,o)).toFixed(2))+" "+a[o]}var za=(e={})=>{let{maxFiles:t=Number.POSITIVE_INFINITY,maxSize:a=Number.POSITIVE_INFINITY,accept:o="*",multiple:r=false,initialFiles:n=[],onFilesChange:s,onFilesAdded:d,onError:l}=e,[v,u]=yi.useState({files:n.map(g=>({file:g,id:g.id,preview:g.url})),isDragging:false,errors:[]}),p=yi.useRef(null);yi.useEffect(()=>()=>{v.files.forEach(g=>{g.preview&&g.file instanceof File&&URL.revokeObjectURL(g.preview);});},[v.files]);let F=yi.useCallback(g=>{if(g.size>a)return `File "${g.name}" exceeds the maximum size of ${re(a)}.`;if(o!=="*"){let k=o.split(",").map(E=>E.trim()),m=g instanceof File?g.type||"":g.type,T=`.${g.name.split(".").pop()}`;if(!k.some(E=>{if(E.startsWith("."))return T.toLowerCase()===E.toLowerCase();if(E.endsWith("/*")){let be=E.split("/")[0];return m.startsWith(`${be}/`)}return m===E}))return `File "${g.name}" is not an accepted file type.`}return null},[o,a]),c=yi.useCallback(g=>g instanceof File?URL.createObjectURL(g):g.url,[]),h=yi.useCallback(g=>g instanceof File?`${g.name}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`:g.id.toString(),[]),N=yi.useCallback(()=>{u(g=>{for(let m of g.files)m.preview&&m.file instanceof File&&m.file.type.startsWith("image/")&&URL.revokeObjectURL(m.preview);p.current&&(p.current.value="");let k=chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({},g),{files:[],errors:[]});return s==null||s(k.files),k});},[s]),x=yi.useCallback(g=>{if(!g||g.length===0)return;let k=Array.from(g),m=[];u(T=>chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({},T),{errors:[]})),r||N(),u(T=>{if(r&&t!==Number.POSITIVE_INFINITY&&T.files.length+k.length>t)return m.push(`You can only upload a maximum of ${t} files.`),l==null||l(m),chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({},T),{errors:m});let S=[];for(let E of k){if(r&&T.files.some(M=>M.file.name===E.name&&M.file.size===E.size))continue;if(E.size>a){m.push(r?`Some files exceed the maximum size of ${re(a)}.`:`File exceeds the maximum size of ${re(a)}.`);continue}let be=F(E);be?m.push(be):S.push({file:E,id:h(E),preview:c(E)});}if(S.length>0){d==null||d(S);let E=r?[...T.files,...S]:S;return s==null||s(E),chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({},T),{files:E,errors:m})}else if(m.length>0)return l==null||l(m),chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({},T),{errors:m});return T}),p.current&&(p.current.value="");},[t,r,a,F,c,h,N,s,d,l]),V=yi.useCallback(g=>{u(k=>{let m=k.files.find(S=>S.id===g);m!=null&&m.preview&&m.file instanceof File&&m.file.type.startsWith("image/")&&URL.revokeObjectURL(m.preview);let T=k.files.filter(S=>S.id!==g);return s==null||s(T),chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({},k),{files:T,errors:[]})});},[s]),C=yi.useCallback(()=>{u(g=>chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({},g),{errors:[]}));},[]),I=yi.useCallback(g=>{g.preventDefault(),g.stopPropagation(),u(k=>chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({},k),{isDragging:true}));},[]),D=yi.useCallback(g=>{g.preventDefault(),g.stopPropagation(),!g.currentTarget.contains(g.relatedTarget)&&u(k=>chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({},k),{isDragging:false}));},[]),O=yi.useCallback(g=>{g.preventDefault(),g.stopPropagation();},[]),P=yi.useCallback(g=>{var k;if(g.preventDefault(),g.stopPropagation(),u(m=>chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({},m),{isDragging:false})),!((k=p.current)!=null&&k.disabled)&&g.dataTransfer.files&&g.dataTransfer.files.length>0)if(r)x(g.dataTransfer.files);else {let m=g.dataTransfer.files[0];x([m]);}},[x,r]),J=yi.useCallback(g=>{g.target.files&&g.target.files.length>0&&x(g.target.files);},[x]),q=yi.useCallback(()=>{p.current&&p.current.click();},[]),W=yi.useCallback((g={})=>{var k;return chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({},g),{type:"file",onChange:J,accept:g.accept||o,multiple:(k=g.multiple)!=null?k:r,ref:p})},[o,r,J]);return [v,{addFiles:x,removeFile:V,clearFiles:N,clearErrors:C,handleDragEnter:I,handleDragLeave:D,handleDragOver:O,handleDrop:P,handleFileChange:J,openFileDialog:q,getInputProps:W}]};function Ro(e){return jsxRuntime.jsxs("svg",chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",color:"currentColor"},e),{children:[jsxRuntime.jsx("path",{d:"M13.0059 21.25C13.0059 21.8023 12.5581 22.25 12.0059 22.25C11.4536 22.25 11.0059 21.8023 11.0059 21.25L11.0059 16.75L10.4116 16.75C10.236 16.7501 10.0203 16.7503 9.84387 16.7282L9.84053 16.7278C9.71408 16.712 9.13804 16.6402 8.86368 16.0746C8.58872 15.5078 8.89065 15.0076 8.95597 14.8994L8.95841 14.8954C9.05062 14.7424 9.18477 14.5715 9.29511 14.4309L9.31885 14.4007C9.61348 14.0249 9.99545 13.5406 10.3759 13.1496C10.5657 12.9545 10.783 12.7533 11.0139 12.5944C11.2191 12.4532 11.5693 12.25 12 12.25C12.4307 12.25 12.7809 12.4532 12.9861 12.5944C13.217 12.7533 13.4343 12.9545 13.6241 13.1496C14.0046 13.5406 14.3865 14.0249 14.6812 14.4007L14.7049 14.4309C14.8152 14.5715 14.9494 14.7424 15.0416 14.8954L15.044 14.8994C15.1093 15.0076 15.4113 15.5078 15.1363 16.0746C14.862 16.6402 14.2859 16.712 14.1595 16.7278L14.1561 16.7282C13.9797 16.7503 13.764 16.7501 13.5884 16.75L13.0059 16.75L13.0059 21.25Z",fill:"currentColor",fillRule:"evenodd"}),jsxRuntime.jsx("path",{d:"M1.25 12.5C1.25 9.85827 3.03106 7.63322 5.45825 6.9592C5.65424 6.90478 5.75224 6.87756 5.80872 6.81971C5.8652 6.76186 5.88991 6.66386 5.93931 6.46785C6.62272 3.75655 9.07671 1.75002 12 1.75002C15.2149 1.75002 17.8628 4.17733 18.2112 7.29925C18.2385 7.54461 18.2522 7.66731 18.3147 7.7383C18.3772 7.80929 18.4989 7.83881 18.7423 7.89787C21.0422 8.4559 22.75 10.5285 22.75 13C22.75 15.8995 20.3995 18.25 17.5 18.25H16.4006C15.942 18.25 15.7126 18.25 15.6826 18.2119C15.6679 18.1933 15.6641 18.1839 15.6617 18.1604C15.6567 18.1121 15.8519 17.9223 16.2425 17.5427C17.2326 16.5804 17.255 14.9976 16.2927 14.0075C15.6442 13.1982 15.0315 12.3422 14.2379 11.6663C13.6086 11.1303 12.8426 10.75 12 10.75C11.1574 10.75 10.3914 11.1303 9.76209 11.6663C8.96846 12.3422 8.35575 13.1982 7.7073 14.0075C6.74496 14.9976 6.76745 16.5804 7.75753 17.5427C8.14807 17.9223 8.34334 18.1121 8.33832 18.1604C8.33587 18.1839 8.33206 18.1933 8.31739 18.2119C8.28737 18.25 8.05801 18.25 7.59942 18.25H7C3.82436 18.25 1.25 15.6757 1.25 12.5Z",fill:"currentColor"})]}))}var ve=yi.forwardRef((n,r)=>{var s=n,{className:e,iconClassName:t,label:a="Close"}=s,o=chunkSV5VFLC2_cjs.c(s,["className","iconClassName","label"]);return jsxRuntime.jsxs(w,chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({ref:r,variant:"outline",size:"icon",radius:"full",type:"button",className:b("border border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 text-gray-500 dark:text-zinc-400","hover:text-red-600 hover:border-red-300 hover:bg-red-50","dark:hover:text-red-400 dark:hover:border-red-700 dark:hover:bg-red-900/40","active:scale-95 transition-all duration-200",e)},o),{children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.y,{className:b("size-5 transition-colors text-inherit",t)}),jsxRuntime.jsx("span",{className:"sr-only",children:a})]}))});ve.displayName="CloseButton";function La({file:e}){var r;let[t,a]=yi.useState(false),o=e.previewUrl||e.url;return o&&!t?jsxRuntime.jsx("img",{src:o,alt:((r=e==null?void 0:e.name)==null?void 0:r.substring(0,10))||"image",className:"w-full h-full object-contain rounded-md drop-shadow-md",onError:()=>a(true)}):jsxRuntime.jsx(chunkSV5VFLC2_cjs.o,{})}function _a({file:e}){return e.caption?jsxRuntime.jsxs("p",{className:"text-xs text-primary line-clamp-2 mb-2",children:[e.height," x ",e.width]}):null}function Aa({file:e,className:t}){let[a,o]=yi.useState(false);return e.previewUrl&&!a?jsxRuntime.jsxs("div",{className:"relative w-full h-full",children:[jsxRuntime.jsx("img",{src:e.previewUrl,className:"w-full h-full object-contain rounded-md",alt:e.name,onError:()=>o(true)}),jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:jsxRuntime.jsx("div",{className:"bg-black/60 rounded-full p-2 backdrop-blur-xs",children:jsxRuntime.jsx(chunkSV5VFLC2_cjs.J,{className:"size-5 text-white fill-white"})})})]}):e.url&&!a?jsxRuntime.jsxs("div",{className:"relative w-full h-full",children:[jsxRuntime.jsx("video",{src:`${e.url}#t=0.001`,className:"w-full h-full object-contain rounded-md",preload:"metadata",muted:true,playsInline:true,onError:()=>o(true)}),jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:jsxRuntime.jsx("div",{className:"bg-black/60 rounded-full p-2 backdrop-blur-xs",children:jsxRuntime.jsx(chunkSV5VFLC2_cjs.J,{className:"size-5 text-white fill-white"})})})]}):jsxRuntime.jsx("div",{className:"w-full h-full flex items-center justify-center bg-transparent",children:jsxRuntime.jsx("div",{className:"text-center",children:jsxRuntime.jsx("div",{className:"text-4xl",children:jsxRuntime.jsx(chunkSV5VFLC2_cjs.P,{type:"video",className:t})})})})}function Oa({file:e}){var t;return (t=e.metaData)!=null&&t.duration?jsxRuntime.jsxs("p",{className:"text-xs text-primary mb-2",children:["Duration: ",Math.floor(e.metaData.duration/60),":",(e.metaData.duration%60).toString().padStart(2,"0")]}):null}function Ba({file:e,className:t}){return jsxRuntime.jsx("div",{className:"w-full h-full flex items-center justify-center bg-transparent",children:jsxRuntime.jsx("div",{className:"text-center",children:jsxRuntime.jsx("div",{className:"text-4xl",children:jsxRuntime.jsx(chunkSV5VFLC2_cjs.P,{type:"audio",className:t})})})})}function Ga({file:e}){var t;return (t=e.metaData)!=null&&t.duration?jsxRuntime.jsxs("p",{className:"text-xs text-primary mb-2",children:["Duration: ",Math.floor(e.metaData.duration/60),":",(e.metaData.duration%60).toString().padStart(2,"0")]}):null}function Va({file:e,className:t}){let a=chunkSV5VFLC2_cjs.O(e.mime,e.ext);return jsxRuntime.jsx("div",{className:"w-full h-full flex items-center justify-center bg-transparent relative",children:e.previewUrl?jsxRuntime.jsx("img",{src:e.previewUrl,alt:e.name,className:"w-full h-full object-contain rounded-md drop-shadow-md"}):jsxRuntime.jsx("div",{className:"text-center",children:jsxRuntime.jsx("div",{className:"text-4xl",children:jsxRuntime.jsx(chunkSV5VFLC2_cjs.P,{type:a,className:t})})})})}function Ua({file:e}){var t;return (t=e.metaData)!=null&&t.pageCount?jsxRuntime.jsxs("p",{className:"text-xs text-primary mb-2",children:["Pages: ",e.metaData.pageCount]}):null}function Ha({file:e}){let t=chunkSV5VFLC2_cjs.O(e.mime,e.ext);return jsxRuntime.jsx(chunkSV5VFLC2_cjs.P,{type:t})}var $a={images:{component:La,metadataComponent:_a},videos:{component:Aa,metadataComponent:Oa},files:{component:Va,metadataComponent:Ua},audios:{component:Ba,metadataComponent:Ga},default:{component:Ha}};function et(e){let t=chunkSV5VFLC2_cjs.N(e.mime,e.ext);return $a[t]||$a.default}function kt(a){var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx("kbd",chunkSV5VFLC2_cjs.a({"data-slot":"kbd",className:b("bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none","[&_svg:not([class*='size-'])]:size-3","[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",e)},t))}function Dt(a){var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx("kbd",chunkSV5VFLC2_cjs.a({"data-slot":"kbd-group",className:b("inline-flex items-center gap-1",e)},t))}function Wa(){let{isUploadModalOpen:e,setIsUploadModalOpen:t,uploadFiles:a,allowedFileTypes:o,maxUploadFiles:r,maxUploadSize:n}=R(),s=chunkSV5VFLC2_cjs.Q(o),d=chunkSV5VFLC2_cjs.R(o),[l,v]=yi.useState([]),[{isDragging:u,errors:p},{removeFile:F,clearFiles:c,handleDragEnter:h,handleDragLeave:N,handleDragOver:x,handleDrop:V,openFileDialog:C,getInputProps:I}]=za({maxFiles:r,maxSize:n,accept:s,multiple:true,onFilesChange:m=>{let T=m.map(S=>{let E=l.find(be=>be.id===S.id);return E?chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a(chunkSV5VFLC2_cjs.a({},E),S),{file:S.file}):chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({},S),{file:S.file,progress:100,status:"completed"})});v(T);}}),D=m=>{F(m);},O=m=>{v(T=>T.map(S=>S.id===m?chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({},S),{progress:0,status:"uploading",error:void 0}):S));},P=()=>{let m=l.filter(T=>T.status==="completed");if(m.length>0){let T=m.map(S=>({name:S.file.name,size:S.file.size,type:chunkSV5VFLC2_cjs.N(S.file.type,S.file.name.split(".").pop()),lastModified:S.file instanceof File?S.file.lastModified:Date.now(),file:S.file,metadata:{}}));a(T),J();}},J=()=>{t(false),c(),v([]);},q=(m,T)=>{let S={id:"temp",name:m.name,size:m.size,mime:m.type,ext:m.name.split(".").pop()||"",url:T||"",createdAt:new Date(m.lastModified),updatedAt:new Date(m.lastModified),folderId:null,metaData:{}},{component:E}=et(S);return jsxRuntime.jsx(E,{file:S,metaData:S.metaData})},W=l.filter(m=>m.status==="completed").length,g=l.filter(m=>m.status==="uploading").length,k=W>0&&g===0;return jsxRuntime.jsx(we,{open:e,onOpenChange:t,children:jsxRuntime.jsxs(Ce,{className:"p-0 max-w-4xl max-h-[80vh] flex flex-col",variant:"default",showCloseButton:false,children:[jsxRuntime.jsxs(Le,{className:"pt-5 pb-3 m-0 border-b border-border",children:[jsxRuntime.jsx(Fe,{className:"px-6 text-base",children:jsxRuntime.jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[jsxRuntime.jsxs("span",{children:["Upload Files",jsxRuntime.jsx(Dt,{className:"ml-2",children:jsxRuntime.jsxs(kt,{children:[jsxRuntime.jsx("span",{className:"text-lg",children:"\u2318"})," + U"]})})]}),jsxRuntime.jsx(ve,{onClick:()=>t(false)})]})}),jsxRuntime.jsx(Xe,{})]}),jsxRuntime.jsxs("div",{className:"p-6 overflow-y-auto flex-1",children:[jsxRuntime.jsxs("div",{className:b("relative w-full rounded-xl border-2 border-dashed bg-muted border-muted-foreground/25 px-6 py-16 text-center transition-colors mb-4",u?"border-primary bg-primary/5":"border-muted-foreground/25 hover:border-muted-foreground/50"),onDragEnter:h,onDragLeave:N,onDragOver:x,onDrop:V,children:[jsxRuntime.jsx("input",chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({},I()),{className:"sr-only"})),jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("div",{className:b("flex h-12 w-12 items-center justify-center rounded-full transition-colors",u?"border-primary bg-primary/10":"border-muted-foreground/25"),children:jsxRuntime.jsx(Ro,{className:"mb-3 text-muted-foreground"})}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("p",{className:"text-sm font-medium",children:["Drop files here or"," ",jsxRuntime.jsx("button",{type:"button",onClick:C,className:"cursor-pointer text-primary underline-offset-4 underline",children:"browse files"})]}),jsxRuntime.jsxs("p",{className:"text-xs text-muted-foreground",children:[d," \u2022 Max size: ",re(n)," \u2022 Max files: ",r]})]})]})]}),l.length>0&&jsxRuntime.jsx("div",{className:"space-y-4",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3 lg:grid-cols-4",children:l.map(m=>jsxRuntime.jsxs("div",{className:"relative group",children:[jsxRuntime.jsx(ve,{onClick:()=>D(m.id),className:"absolute -inset-e-2 -top-2 z-10 size-6 rounded-full opacity-0 transition-opacity group-hover:opacity-100",iconClassName:"size-3"}),jsxRuntime.jsxs("div",{className:"relative overflow-hidden rounded-lg border border-muted-foreground/25 bg-card transition-colors",children:[jsxRuntime.jsx("div",{className:"relative aspect-square bg-muted border-muted-foreground/25",children:jsxRuntime.jsx("div",{className:"flex h-full items-center justify-center p-4",children:jsxRuntime.jsx("div",{className:"w-[75%] h-[75%] flex items-center justify-center",children:m.status==="uploading"?jsxRuntime.jsxs("div",{className:"relative w-full h-full flex items-center justify-center",children:[jsxRuntime.jsxs("svg",{className:"size-12 -rotate-90 absolute",viewBox:"0 0 48 48",children:[jsxRuntime.jsx("circle",{cx:"24",cy:"24",r:"20",fill:"none",stroke:"currentColor",strokeWidth:"3",className:"text-muted-foreground/20"}),jsxRuntime.jsx("circle",{cx:"24",cy:"24",r:"20",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeDasharray:`${2*Math.PI*20}`,strokeDashoffset:`${2*Math.PI*20*(1-m.progress/100)}`,className:"text-primary transition-all duration-300",strokeLinecap:"round"})]}),m.file instanceof File&&q(m.file,m.preview)]}):m.file instanceof File&&q(m.file,m.preview)})})}),jsxRuntime.jsx("div",{className:"p-3",children:jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("p",{className:"truncate text-xs font-medium",children:m.file.name}),jsxRuntime.jsxs("div",{className:"relative flex items-center justify-between gap-2",children:[jsxRuntime.jsx("span",{className:"text-[11px] text-primary font-semibold tracking-tight",children:re(m.file.size)}),m.status==="error"&&m.error&&jsxRuntime.jsxs(Pa,{children:[jsxRuntime.jsx(Ia,{asChild:true,children:jsxRuntime.jsx(w,{onClick:()=>O(m.id),variant:"ghost",size:"icon",className:"absolute end-0 -top-1.25 size-6 text-destructive hover:bg-destructive/10 hover:text-destructive",children:jsxRuntime.jsx(chunkSV5VFLC2_cjs.L,{className:"size-3 opacity-100"})})}),jsxRuntime.jsx(Sa,{children:"Upload failed. Retry"})]})]})]})})]})]},m.id))})}),p.length>0&&jsxRuntime.jsxs(Fa,{variant:"destructive",appearance:"light",className:"mt-5",children:[jsxRuntime.jsx(Ma,{children:jsxRuntime.jsx(chunkSV5VFLC2_cjs.M,{})}),jsxRuntime.jsxs(Da,{children:[jsxRuntime.jsx(Na,{children:"File upload error(s)"}),jsxRuntime.jsx(ka,{children:p.map(m=>jsxRuntime.jsx("p",{className:"last:mb-0",children:m},m))})]})]})]}),jsxRuntime.jsxs(_e,{className:"px-6 py-4 border-t border-border w-full sm:justify-between justify-center items-center flex-col sm:flex-row gap-2 ",children:[jsxRuntime.jsx(Ge,{asChild:true,children:jsxRuntime.jsx(w,{type:"button",radius:"full",variant:"outline",onClick:J,className:"w-full md:w-auto",children:"Cancel"})}),jsxRuntime.jsxs(w,{type:"button",radius:"full",onClick:P,disabled:!k,className:"w-full md:w-auto",children:["Upload ",W>0&&`(${W})`]})]})]})})}var Gn=classVarianceAuthority.cva(`
8
+ `},placeholder:{true:"text-muted-foreground",false:""}},compoundVariants:[{variant:"ghost",mode:"default",className:"[&_svg:not([role=img]):not([class*=text-]):not([class*=opacity-])]:opacity-60"},{variant:"outline",mode:"default",className:"[&_svg:not([role=img]):not([class*=text-]):not([class*=opacity-])]:opacity-60"},{variant:"dashed",mode:"default",className:"[&_svg:not([role=img]):not([class*=text-]):not([class*=opacity-])]:opacity-60"},{variant:"secondary",mode:"default",className:"[&_svg:not([role=img]):not([class*=text-]):not([class*=opacity-])]:opacity-60"},{variant:"outline",mode:"input",className:"[&_svg:not([role=img]):not([class*=text-]):not([class*=opacity-])]:opacity-60"},{variant:"outline",mode:"icon",className:"[&_svg:not([role=img]):not([class*=text-]):not([class*=opacity-])]:opacity-60"},{size:"xs",autoHeight:true,className:"h-auto min-h-7"},{size:"md",autoHeight:true,className:"h-auto min-h-9"},{size:"sm",autoHeight:true,className:"h-auto min-h-8"},{size:"lg",autoHeight:true,className:"h-auto min-h-10"},{variant:"primary",mode:"default",appearance:"default",className:"shadow-xs shadow-black/5"},{variant:"mono",mode:"default",appearance:"default",className:"shadow-xs shadow-black/5"},{variant:"secondary",mode:"default",appearance:"default",className:"shadow-xs shadow-black/5"},{variant:"outline",mode:"default",appearance:"default",className:"shadow-xs shadow-black/5"},{variant:"dashed",mode:"default",appearance:"default",className:"shadow-xs shadow-black/5"},{variant:"destructive",mode:"default",appearance:"default",className:"shadow-xs shadow-black/5"},{variant:"primary",mode:"icon",appearance:"default",className:"shadow-xs shadow-black/5"},{variant:"mono",mode:"icon",appearance:"default",className:"shadow-xs shadow-black/5"},{variant:"secondary",mode:"icon",appearance:"default",className:"shadow-xs shadow-black/5"},{variant:"outline",mode:"icon",appearance:"default",className:"shadow-xs shadow-black/5"},{variant:"dashed",mode:"icon",appearance:"default",className:"shadow-xs shadow-black/5"},{variant:"destructive",mode:"icon",appearance:"default",className:"shadow-xs shadow-black/5"},{variant:"primary",mode:"link",underline:"solid",className:"font-medium text-primary hover:text-primary/90 [&_svg:not([role=img]):not([class*=text-])]:opacity-60 hover:underline hover:underline-offset-4 hover:decoration-solid"},{variant:"primary",mode:"link",underline:"dashed",className:"font-medium text-primary hover:text-primary/90 [&_svg:not([role=img]):not([class*=text-])]:opacity-60 hover:underline hover:underline-offset-4 hover:decoration-dashed decoration-1"},{variant:"primary",mode:"link",underlined:"solid",className:"font-medium text-primary hover:text-primary/90 [&_svg:not([role=img]):not([class*=text-])]:opacity-60 underline underline-offset-4 decoration-solid"},{variant:"primary",mode:"link",underlined:"dashed",className:"font-medium text-primary hover:text-primary/90 [&_svg]:opacity-60 underline underline-offset-4 decoration-dashed decoration-1"},{variant:"inverse",mode:"link",underline:"solid",className:"font-medium text-inherit [&_svg:not([role=img]):not([class*=text-])]:opacity-60 hover:underline hover:underline-offset-4 hover:decoration-solid"},{variant:"inverse",mode:"link",underline:"dashed",className:"font-medium text-inherit [&_svg:not([role=img]):not([class*=text-])]:opacity-60 hover:underline hover:underline-offset-4 hover:decoration-dashed decoration-1"},{variant:"inverse",mode:"link",underlined:"solid",className:"font-medium text-inherit [&_svg:not([role=img]):not([class*=text-])]:opacity-60 underline underline-offset-4 decoration-solid"},{variant:"inverse",mode:"link",underlined:"dashed",className:"font-medium text-inherit [&_svg:not([role=img]):not([class*=text-])]:opacity-60 underline underline-offset-4 decoration-dashed decoration-1"},{variant:"foreground",mode:"link",underline:"solid",className:"font-medium text-foreground [&_svg:not([role=img]):not([class*=text-])]:opacity-60 hover:underline hover:underline-offset-4 hover:decoration-solid"},{variant:"foreground",mode:"link",underline:"dashed",className:"font-medium text-foreground [&_svg:not([role=img]):not([class*=text-])]:opacity-60 hover:underline hover:underline-offset-4 hover:decoration-dashed decoration-1"},{variant:"foreground",mode:"link",underlined:"solid",className:"font-medium text-foreground [&_svg:not([role=img]):not([class*=text-])]:opacity-60 underline underline-offset-4 decoration-solid"},{variant:"foreground",mode:"link",underlined:"dashed",className:"font-medium text-foreground [&_svg:not([role=img]):not([class*=text-])]:opacity-60 underline underline-offset-4 decoration-dashed decoration-1"},{variant:"primary",appearance:"ghost",className:"bg-transparent text-primary/90 hover:bg-primary/5 data-[state=open]:bg-primary/5"},{variant:"destructive",appearance:"ghost",className:"bg-transparent text-destructive/90 hover:bg-destructive/5 data-[state=open]:bg-destructive/5"},{variant:"ghost",mode:"icon",className:"text-muted-foreground"},{size:"xs",mode:"icon",className:"w-7 h-7 p-0 [[&_svg:not([class*=size-])]:size-3.5"},{size:"sm",mode:"icon",className:"w-8 h-8 p-0 [[&_svg:not([class*=size-])]:size-3.5"},{size:"md",mode:"icon",className:"w-9 h-9 p-0 [&_svg:not([class*=size-])]:size-4"},{size:"icon",className:"w-9 h-9 p-0 [&_svg:not([class*=size-])]:size-4"},{size:"lg",mode:"icon",className:"w-10 h-10 p-0 [&_svg:not([class*=size-])]:size-4"},{mode:"input",placeholder:true,variant:"outline",className:"font-normal text-muted-foreground"},{mode:"input",variant:"outline",size:"sm",className:"gap-1.25"},{mode:"input",variant:"outline",size:"md",className:"gap-1.5"},{mode:"input",variant:"outline",size:"lg",className:"gap-1.5"}],defaultVariants:{variant:"primary",mode:"default",size:"md",radius:"md",appearance:"default"}});function w(c){var h=c,{className:e,selected:t,variant:a,radius:o,appearance:r,mode:n,size:s,autoHeight:d,underlined:l,underline:v,asChild:u=false,placeholder:p=false}=h,F=chunkXOGHUQYC_cjs.c(h,["className","selected","variant","radius","appearance","mode","size","autoHeight","underlined","underline","asChild","placeholder"]);let N=u?radixUi.Slot.Slot:"button";return jsxRuntime.jsx(N,chunkXOGHUQYC_cjs.a(chunkXOGHUQYC_cjs.a({"data-slot":"button",className:b(fn({variant:a,size:s,radius:o,appearance:r,mode:n,autoHeight:d,placeholder:p,underlined:l,underline:v,className:e}),u&&F.disabled&&"pointer-events-none opacity-50")},t&&{"data-state":"open"}),F))}function vn(e,t){let a=[];if(t<=7)for(let o=1;o<=t;o++)a.push(o);else e<=4?a.push(1,2,3,4,5,"ellipsis",t):e>=t-3?a.push(1,"ellipsis",t-4,t-3,t-2,t-1,t):a.push(1,"ellipsis",e-1,e,e+1,"ellipsis",t);return a}function wa({className:e}){let{pagination:t,handlePageChange:a,files:o,folders:r}=R(),{currentPage:n,totalPages:s}=t,d=((o==null?void 0:o.length)||0)+((r==null?void 0:r.length)||0);if(s<=1||d===0)return null;let l=vn(n,s);return jsxRuntime.jsx(ba,{className:e,children:jsxRuntime.jsxs(ha,{children:[jsxRuntime.jsx($t,{children:jsxRuntime.jsx(w,{variant:"ghost",radius:"full",asChild:true,disabled:n===1,onClick:()=>n>1&&a(n-1),children:jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.v,{className:"rtl:rotate-180"})," Previous"]})})}),l.map((v,u)=>v==="ellipsis"?jsxRuntime.jsx($t,{children:jsxRuntime.jsx(ya,{})},`ellipsis-${n}-${s}-${u}`):jsxRuntime.jsx($t,{children:jsxRuntime.jsx(w,{variant:v===n?"outline":"ghost",mode:"icon",size:"icon",radius:"full",asChild:true,onClick:()=>a(v),disabled:v===n,children:jsxRuntime.jsx("span",{children:v})})},v)),jsxRuntime.jsx($t,{children:jsxRuntime.jsx(w,{variant:"ghost",radius:"full",asChild:true,disabled:n===s,onClick:()=>n<s&&a(n+1),children:jsxRuntime.jsxs("span",{children:["Next ",jsxRuntime.jsx(chunkXOGHUQYC_cjs.u,{className:"rtl:rotate-180"})]})})})]})})}function Ca({children:e,className:t}){return jsxRuntime.jsx("div",{className:b("p-4 flex md:flex-row gap-2",t),children:e})}var hn=classVarianceAuthority.cva("flex flex-col fixed outline-0 z-50 border border-border bg-background text-foreground shadow-lg shadow-black/5 duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 rounded-2xl",{variants:{variant:{default:"left-[50%] top-[50%] max-w-lg translate-x-[-50%] translate-y-[-50%] w-full p-6 max-h-[90dvh]",fullscreen:"top-5 left-5 right-5 bottom-5"}},defaultVariants:{variant:"default"}});function we(t){var e=chunkXOGHUQYC_cjs.c(t,[]);return jsxRuntime.jsx(radixUi.Dialog.Root,chunkXOGHUQYC_cjs.a({"data-slot":"dialog"},e))}function yn(t){var e=chunkXOGHUQYC_cjs.c(t,[]);return jsxRuntime.jsx(radixUi.Dialog.Portal,chunkXOGHUQYC_cjs.a({"data-slot":"dialog-portal"},e))}function Ge(t){var e=chunkXOGHUQYC_cjs.c(t,[]);return jsxRuntime.jsx(radixUi.Dialog.Close,chunkXOGHUQYC_cjs.a({"data-slot":"dialog-close"},e))}function wn(a){var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx(radixUi.Dialog.Overlay,chunkXOGHUQYC_cjs.a({"data-slot":"dialog-overlay",className:b("fixed inset-0 z-50 bg-black/30 [backdrop-filter:blur(4px)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e)},t))}function Ce(s){var d=s,{className:e,children:t,showCloseButton:a=true,overlay:o=true,variant:r}=d,n=chunkXOGHUQYC_cjs.c(d,["className","children","showCloseButton","overlay","variant"]);return jsxRuntime.jsxs(yn,{children:[o&&jsxRuntime.jsx(wn,{}),jsxRuntime.jsxs(radixUi.Dialog.Content,chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({"data-slot":"dialog-content",className:b(hn({variant:r}),e)},n),{children:[t,a&&jsxRuntime.jsxs(Ge,{className:"cursor-pointer outline-0 absolute end-5 top-5 rounded-full opacity-60 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.y,{className:"size-4 text-gray-600 dark:text-zinc-400"}),jsxRuntime.jsx("span",{className:"sr-only",children:"Close"})]})]}))]})}var Le=a=>{var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx("div",chunkXOGHUQYC_cjs.a({"data-slot":"dialog-header",className:b("flex flex-col space-y-1 text-center sm:text-start mb-5",e)},t))},_e=a=>{var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx("div",chunkXOGHUQYC_cjs.a({"data-slot":"dialog-footer",className:b("flex flex-col-reverse sm:flex-row sm:justify-end pt-5 sm:space-x-2.5",e)},t))};function Fe(a){var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx(radixUi.Dialog.Title,chunkXOGHUQYC_cjs.a({"data-slot":"dialog-title",className:b("text-lg font-semibold leading-none tracking-tight",e)},t))}function Xe(a){var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx(radixUi.Dialog.Description,chunkXOGHUQYC_cjs.a({"data-slot":"dialog-description",className:b("text-sm text-muted-foreground",e)},t))}var Fn=classVarianceAuthority.cva("flex items-stretch w-full gap-2 group-[.toaster]:w-(--width)",{variants:{variant:{secondary:"",primary:"",destructive:"",success:"",info:"",mono:"",warning:""},icon:{primary:"",destructive:"",success:"",info:"",warning:""},appearance:{solid:"",outline:"",light:"",stroke:"text-foreground"},size:{lg:"rounded-lg p-4 gap-3 text-base [&>[data-slot=alert-icon]>svg]:size-6 *:data-slot=alert-icon:mt-0.5 [&_[data-slot=alert-close]]:mt-1",md:"rounded-lg p-3.5 gap-2.5 text-sm [&>[data-slot=alert-icon]>svg]:size-5 *:data-slot=alert-icon:mt-0 [&_[data-slot=alert-close]]:mt-0.5",sm:"rounded-md px-3 py-2.5 gap-2 text-xs [&>[data-slot=alert-icon]>svg]:size-4 *:data-alert-icon:mt-0.5 [&_[data-slot=alert-close]]:mt-0.25 [&_[data-slot=alert-close]_svg]:size-3.5"}},compoundVariants:[{variant:"secondary",appearance:"solid",className:"bg-muted text-foreground"},{variant:"primary",appearance:"solid",className:"bg-primary text-primary-foreground"},{variant:"destructive",appearance:"solid",className:"bg-destructive text-destructive-foreground"},{variant:"success",appearance:"solid",className:"bg-[var(--color-success,var(--color-green-500))] text-[var(--color-success-foreground,var(--color-white))]"},{variant:"info",appearance:"solid",className:"bg-[var(--color-info,var(--color-violet-600))] text-[var(--color-info-foreground,var(--color-white))]"},{variant:"warning",appearance:"solid",className:"bg-[var(--color-warning,var(--color-yellow-500))] text-[var(--color-warning-foreground,var(--color-white))]"},{variant:"mono",appearance:"solid",className:"bg-zinc-950 text-white dark:bg-zinc-300 dark:text-black *:data-slot-[alert=close]:text-white"},{variant:"secondary",appearance:"outline",className:"border border-border bg-background text-foreground [&_[data-slot=alert-close]]:text-foreground"},{variant:"primary",appearance:"outline",className:"border border-border bg-background text-primary [&_[data-slot=alert-close]]:text-foreground"},{variant:"destructive",appearance:"outline",className:"border border-border bg-background text-destructive [&_[data-slot=alert-close]]:text-foreground"},{variant:"success",appearance:"outline",className:"border border-border bg-background text-[var(--color-success,var(--color-green-500))] [&_[data-slot=alert-close]]:text-foreground"},{variant:"info",appearance:"outline",className:"border border-border bg-background text-[var(--color-info,var(--color-violet-600))] [&_[data-slot=alert-close]]:text-foreground"},{variant:"warning",appearance:"outline",className:"border border-border bg-background text-[var(--color-warning,var(--color-yellow-500))] [&_[data-slot=alert-close]]:text-foreground"},{variant:"mono",appearance:"outline",className:"border border-border bg-background text-foreground [&_[data-slot=alert-close]]:text-foreground"},{variant:"secondary",appearance:"light",className:"bg-muted border border-border text-foreground"},{variant:"primary",appearance:"light",className:"text-foreground bg-[var(--color-primary-soft,var(--color-blue-50))] border border-[var(--color-primary-alpha,var(--color-blue-100))] [&_[data-slot=alert-icon]]:text-primary dark:bg-[var(--color-primary-soft,var(--color-blue-950))] dark:border-[var(--color-primary-alpha,var(--color-blue-900))]"},{variant:"destructive",appearance:"light",className:"bg-[var(--color-destructive-soft,var(--color-red-50))] border border-[var(--color-destructive-alpha,var(--color-red-100))] text-foreground [&_[data-slot=alert-icon]]:text-destructive dark:bg-[var(--color-destructive-soft,var(--color-red-950))] dark:border-[var(--color-destructive-alpha,var(--color-red-900))] "},{variant:"success",appearance:"light",className:"bg-[var(--color-success-soft,var(--color-green-50))] border border-[var(--color-success-alpha,var(--color-green-200))] text-foreground [&_[data-slot=alert-icon]]:text-[var(--color-success-foreground,var(--color-green-600))] dark:bg-[var(--color-success-soft,var(--color-green-950))] dark:border-[var(--color-success-alpha,var(--color-green-900))]"},{variant:"info",appearance:"light",className:"bg-[var(--color-info-soft,var(--color-violet-50))] border border-[var(--color-info-alpha,var(--color-violet-100))] text-foreground [&_[data-slot=alert-icon]]:text-[var(--color-info-foreground,var(--color-violet-600))] dark:bg-[var(--color-info-soft,var(--color-violet-950))] dark:border-[var(--color-info-alpha,var(--color-violet-900))]"},{variant:"warning",appearance:"light",className:"bg-[var(--color-warning-soft,var(--color-yellow-50))] border border-[var(--color-warning-alpha,var(--color-yellow-200))] text-foreground [&_[data-slot=alert-icon]]:text-[var(--color-warning-foreground,var(--color-yellow-600))] dark:bg-[var(--color-warning-soft,var(--color-yellow-950))] dark:border-[var(--color-warning-alpha,var(--color-yellow-900))]"},{variant:"mono",icon:"primary",className:"[&_[data-slot=alert-icon]]:text-primary"},{variant:"mono",icon:"warning",className:"[&_[data-slot=alert-icon]]:text-[var(--color-warning-foreground,var(--color-yellow-600))]"},{variant:"mono",icon:"success",className:"[&_[data-slot=alert-icon]]:text-[var(--color-success-foreground,var(--color-green-600))]"},{variant:"mono",icon:"destructive",className:"[&_[data-slot=alert-icon]]:text-destructive"},{variant:"mono",icon:"info",className:"[&_[data-slot=alert-icon]]:text-[var(--color-info-foreground,var(--color-violet-600))]"}],defaultVariants:{variant:"secondary",appearance:"solid",size:"md"}});function Fa(v){var u=v,{className:e,variant:t,size:a,icon:o,appearance:r,close:n=false,onClose:s,children:d}=u,l=chunkXOGHUQYC_cjs.c(u,["className","variant","size","icon","appearance","close","onClose","children"]);return jsxRuntime.jsxs("div",chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({"data-slot":"alert",role:"alert",className:b(Fn({variant:t,size:a,icon:o,appearance:r}),e)},l),{children:[d,n&&jsxRuntime.jsx("button",{onClick:s,"aria-label":"Dismiss","data-slot":"alert-close",className:b("group shrink-0 size-4 cursor-pointer"),children:jsxRuntime.jsx(chunkXOGHUQYC_cjs.y,{className:"opacity-60 group-hover:opacity-100 size-4"})})]}))}function Na(a){var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx("div",chunkXOGHUQYC_cjs.a({"data-slot":"alert-title",className:b("grow tracking-tight",e)},t))}function Ma(o){var r=o,{children:e,className:t}=r,a=chunkXOGHUQYC_cjs.c(r,["children","className"]);return jsxRuntime.jsx("div",chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({"data-slot":"alert-icon",className:b("shrink-0",t)},a),{children:e}))}function ka(a){var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx("div",chunkXOGHUQYC_cjs.a({"data-slot":"alert-description",className:b("text-sm [&_p]:leading-relaxed [&_p]:mb-2",e)},t))}function Da(a){var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx("div",chunkXOGHUQYC_cjs.a({"data-slot":"alert-content",className:b("space-y-2 [&_[data-slot=alert-title]]:font-semibold",e)},t))}function Mn(a){var o=a,{delayDuration:e=0}=o,t=chunkXOGHUQYC_cjs.c(o,["delayDuration"]);return jsxRuntime.jsx(Ne__namespace.Provider,chunkXOGHUQYC_cjs.a({"data-slot":"tooltip-provider",delayDuration:e},t))}function Pa(t){var e=chunkXOGHUQYC_cjs.c(t,[]);return jsxRuntime.jsx(Mn,{children:jsxRuntime.jsx(Ne__namespace.Root,chunkXOGHUQYC_cjs.a({"data-slot":"tooltip"},e))})}function Ia(t){var e=chunkXOGHUQYC_cjs.c(t,[]);return jsxRuntime.jsx(Ne__namespace.Trigger,chunkXOGHUQYC_cjs.a({"data-slot":"tooltip-trigger"},e))}function Sa(r){var n=r,{className:e,sideOffset:t=0,children:a}=n,o=chunkXOGHUQYC_cjs.c(n,["className","sideOffset","children"]);return jsxRuntime.jsx(Ne__namespace.Portal,{children:jsxRuntime.jsxs(Ne__namespace.Content,chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({"data-slot":"tooltip-content",sideOffset:t,className:b("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e)},o),{children:[a,jsxRuntime.jsx(Ne__namespace.Arrow,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]}))})}function re(e){if(e===0)return "0 Bytes";let t=1024,a=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],o=Math.floor(Math.log(e)/Math.log(t));return Number.parseFloat((e/Math.pow(t,o)).toFixed(2))+" "+a[o]}var za=(e={})=>{let{maxFiles:t=Number.POSITIVE_INFINITY,maxSize:a=Number.POSITIVE_INFINITY,accept:o="*",multiple:r=false,initialFiles:n=[],onFilesChange:s,onFilesAdded:d,onError:l}=e,[v,u]=yi.useState({files:n.map(g=>({file:g,id:g.id,preview:g.url})),isDragging:false,errors:[]}),p=yi.useRef(null);yi.useEffect(()=>()=>{v.files.forEach(g=>{g.preview&&g.file instanceof File&&URL.revokeObjectURL(g.preview);});},[v.files]);let F=yi.useCallback(g=>{if(g.size>a)return `File "${g.name}" exceeds the maximum size of ${re(a)}.`;if(o!=="*"){let k=o.split(",").map(E=>E.trim()),m=g instanceof File?g.type||"":g.type,T=`.${g.name.split(".").pop()}`;if(!k.some(E=>{if(E.startsWith("."))return T.toLowerCase()===E.toLowerCase();if(E.endsWith("/*")){let be=E.split("/")[0];return m.startsWith(`${be}/`)}return m===E}))return `File "${g.name}" is not an accepted file type.`}return null},[o,a]),c=yi.useCallback(g=>g instanceof File?URL.createObjectURL(g):g.url,[]),h=yi.useCallback(g=>g instanceof File?`${g.name}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`:g.id.toString(),[]),N=yi.useCallback(()=>{u(g=>{for(let m of g.files)m.preview&&m.file instanceof File&&m.file.type.startsWith("image/")&&URL.revokeObjectURL(m.preview);p.current&&(p.current.value="");let k=chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({},g),{files:[],errors:[]});return s==null||s(k.files),k});},[s]),x=yi.useCallback(g=>{if(!g||g.length===0)return;let k=Array.from(g),m=[];u(T=>chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({},T),{errors:[]})),r||N(),u(T=>{if(r&&t!==Number.POSITIVE_INFINITY&&T.files.length+k.length>t)return m.push(`You can only upload a maximum of ${t} files.`),l==null||l(m),chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({},T),{errors:m});let S=[];for(let E of k){if(r&&T.files.some(M=>M.file.name===E.name&&M.file.size===E.size))continue;if(E.size>a){m.push(r?`Some files exceed the maximum size of ${re(a)}.`:`File exceeds the maximum size of ${re(a)}.`);continue}let be=F(E);be?m.push(be):S.push({file:E,id:h(E),preview:c(E)});}if(S.length>0){d==null||d(S);let E=r?[...T.files,...S]:S;return s==null||s(E),chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({},T),{files:E,errors:m})}else if(m.length>0)return l==null||l(m),chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({},T),{errors:m});return T}),p.current&&(p.current.value="");},[t,r,a,F,c,h,N,s,d,l]),V=yi.useCallback(g=>{u(k=>{let m=k.files.find(S=>S.id===g);m!=null&&m.preview&&m.file instanceof File&&m.file.type.startsWith("image/")&&URL.revokeObjectURL(m.preview);let T=k.files.filter(S=>S.id!==g);return s==null||s(T),chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({},k),{files:T,errors:[]})});},[s]),C=yi.useCallback(()=>{u(g=>chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({},g),{errors:[]}));},[]),I=yi.useCallback(g=>{g.preventDefault(),g.stopPropagation(),u(k=>chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({},k),{isDragging:true}));},[]),D=yi.useCallback(g=>{g.preventDefault(),g.stopPropagation(),!g.currentTarget.contains(g.relatedTarget)&&u(k=>chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({},k),{isDragging:false}));},[]),O=yi.useCallback(g=>{g.preventDefault(),g.stopPropagation();},[]),P=yi.useCallback(g=>{var k;if(g.preventDefault(),g.stopPropagation(),u(m=>chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({},m),{isDragging:false})),!((k=p.current)!=null&&k.disabled)&&g.dataTransfer.files&&g.dataTransfer.files.length>0)if(r)x(g.dataTransfer.files);else {let m=g.dataTransfer.files[0];x([m]);}},[x,r]),J=yi.useCallback(g=>{g.target.files&&g.target.files.length>0&&x(g.target.files);},[x]),q=yi.useCallback(()=>{p.current&&p.current.click();},[]),W=yi.useCallback((g={})=>{var k;return chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({},g),{type:"file",onChange:J,accept:g.accept||o,multiple:(k=g.multiple)!=null?k:r,ref:p})},[o,r,J]);return [v,{addFiles:x,removeFile:V,clearFiles:N,clearErrors:C,handleDragEnter:I,handleDragLeave:D,handleDragOver:O,handleDrop:P,handleFileChange:J,openFileDialog:q,getInputProps:W}]};function Ro(e){return jsxRuntime.jsxs("svg",chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",color:"currentColor"},e),{children:[jsxRuntime.jsx("path",{d:"M13.0059 21.25C13.0059 21.8023 12.5581 22.25 12.0059 22.25C11.4536 22.25 11.0059 21.8023 11.0059 21.25L11.0059 16.75L10.4116 16.75C10.236 16.7501 10.0203 16.7503 9.84387 16.7282L9.84053 16.7278C9.71408 16.712 9.13804 16.6402 8.86368 16.0746C8.58872 15.5078 8.89065 15.0076 8.95597 14.8994L8.95841 14.8954C9.05062 14.7424 9.18477 14.5715 9.29511 14.4309L9.31885 14.4007C9.61348 14.0249 9.99545 13.5406 10.3759 13.1496C10.5657 12.9545 10.783 12.7533 11.0139 12.5944C11.2191 12.4532 11.5693 12.25 12 12.25C12.4307 12.25 12.7809 12.4532 12.9861 12.5944C13.217 12.7533 13.4343 12.9545 13.6241 13.1496C14.0046 13.5406 14.3865 14.0249 14.6812 14.4007L14.7049 14.4309C14.8152 14.5715 14.9494 14.7424 15.0416 14.8954L15.044 14.8994C15.1093 15.0076 15.4113 15.5078 15.1363 16.0746C14.862 16.6402 14.2859 16.712 14.1595 16.7278L14.1561 16.7282C13.9797 16.7503 13.764 16.7501 13.5884 16.75L13.0059 16.75L13.0059 21.25Z",fill:"currentColor",fillRule:"evenodd"}),jsxRuntime.jsx("path",{d:"M1.25 12.5C1.25 9.85827 3.03106 7.63322 5.45825 6.9592C5.65424 6.90478 5.75224 6.87756 5.80872 6.81971C5.8652 6.76186 5.88991 6.66386 5.93931 6.46785C6.62272 3.75655 9.07671 1.75002 12 1.75002C15.2149 1.75002 17.8628 4.17733 18.2112 7.29925C18.2385 7.54461 18.2522 7.66731 18.3147 7.7383C18.3772 7.80929 18.4989 7.83881 18.7423 7.89787C21.0422 8.4559 22.75 10.5285 22.75 13C22.75 15.8995 20.3995 18.25 17.5 18.25H16.4006C15.942 18.25 15.7126 18.25 15.6826 18.2119C15.6679 18.1933 15.6641 18.1839 15.6617 18.1604C15.6567 18.1121 15.8519 17.9223 16.2425 17.5427C17.2326 16.5804 17.255 14.9976 16.2927 14.0075C15.6442 13.1982 15.0315 12.3422 14.2379 11.6663C13.6086 11.1303 12.8426 10.75 12 10.75C11.1574 10.75 10.3914 11.1303 9.76209 11.6663C8.96846 12.3422 8.35575 13.1982 7.7073 14.0075C6.74496 14.9976 6.76745 16.5804 7.75753 17.5427C8.14807 17.9223 8.34334 18.1121 8.33832 18.1604C8.33587 18.1839 8.33206 18.1933 8.31739 18.2119C8.28737 18.25 8.05801 18.25 7.59942 18.25H7C3.82436 18.25 1.25 15.6757 1.25 12.5Z",fill:"currentColor"})]}))}var ve=yi.forwardRef((n,r)=>{var s=n,{className:e,iconClassName:t,label:a="Close"}=s,o=chunkXOGHUQYC_cjs.c(s,["className","iconClassName","label"]);return jsxRuntime.jsxs(w,chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({ref:r,variant:"outline",size:"icon",radius:"full",type:"button",className:b("border border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 text-gray-500 dark:text-zinc-400","hover:text-red-600 hover:border-red-300 hover:bg-red-50","dark:hover:text-red-400 dark:hover:border-red-700 dark:hover:bg-red-900/40","active:scale-95 transition-all duration-200",e)},o),{children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.y,{className:b("size-5 transition-colors text-inherit",t)}),jsxRuntime.jsx("span",{className:"sr-only",children:a})]}))});ve.displayName="CloseButton";function La({file:e}){var r;let[t,a]=yi.useState(false),o=e.previewUrl||e.url;return o&&!t?jsxRuntime.jsx("img",{src:o,alt:((r=e==null?void 0:e.name)==null?void 0:r.substring(0,10))||"image",className:"w-full h-full object-contain rounded-md drop-shadow-md",onError:()=>a(true)}):jsxRuntime.jsx(chunkXOGHUQYC_cjs.o,{})}function _a({file:e}){return e.caption?jsxRuntime.jsxs("p",{className:"text-xs text-primary line-clamp-2 mb-2",children:[e.height," x ",e.width]}):null}function Aa({file:e,className:t}){let[a,o]=yi.useState(false);return e.previewUrl&&!a?jsxRuntime.jsxs("div",{className:"relative w-full h-full",children:[jsxRuntime.jsx("img",{src:e.previewUrl,className:"w-full h-full object-contain rounded-md",alt:e.name,onError:()=>o(true)}),jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:jsxRuntime.jsx("div",{className:"bg-black/60 rounded-full p-2 backdrop-blur-xs",children:jsxRuntime.jsx(chunkXOGHUQYC_cjs.J,{className:"size-5 text-white fill-white"})})})]}):e.url&&!a?jsxRuntime.jsxs("div",{className:"relative w-full h-full",children:[jsxRuntime.jsx("video",{src:`${e.url}#t=0.001`,className:"w-full h-full object-contain rounded-md",preload:"metadata",muted:true,playsInline:true,onError:()=>o(true)}),jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:jsxRuntime.jsx("div",{className:"bg-black/60 rounded-full p-2 backdrop-blur-xs",children:jsxRuntime.jsx(chunkXOGHUQYC_cjs.J,{className:"size-5 text-white fill-white"})})})]}):jsxRuntime.jsx("div",{className:"w-full h-full flex items-center justify-center bg-transparent",children:jsxRuntime.jsx("div",{className:"text-center",children:jsxRuntime.jsx("div",{className:"text-4xl",children:jsxRuntime.jsx(chunkXOGHUQYC_cjs.P,{type:"video",className:t})})})})}function Oa({file:e}){var t;return (t=e.metaData)!=null&&t.duration?jsxRuntime.jsxs("p",{className:"text-xs text-primary mb-2",children:["Duration: ",Math.floor(e.metaData.duration/60),":",(e.metaData.duration%60).toString().padStart(2,"0")]}):null}function Ba({file:e,className:t}){return jsxRuntime.jsx("div",{className:"w-full h-full flex items-center justify-center bg-transparent",children:jsxRuntime.jsx("div",{className:"text-center",children:jsxRuntime.jsx("div",{className:"text-4xl",children:jsxRuntime.jsx(chunkXOGHUQYC_cjs.P,{type:"audio",className:t})})})})}function Ga({file:e}){var t;return (t=e.metaData)!=null&&t.duration?jsxRuntime.jsxs("p",{className:"text-xs text-primary mb-2",children:["Duration: ",Math.floor(e.metaData.duration/60),":",(e.metaData.duration%60).toString().padStart(2,"0")]}):null}function Va({file:e,className:t}){let a=chunkXOGHUQYC_cjs.O(e.mime,e.ext);return jsxRuntime.jsx("div",{className:"w-full h-full flex items-center justify-center bg-transparent relative",children:e.previewUrl?jsxRuntime.jsx("img",{src:e.previewUrl,alt:e.name,className:"w-full h-full object-contain rounded-md drop-shadow-md"}):jsxRuntime.jsx("div",{className:"text-center",children:jsxRuntime.jsx("div",{className:"text-4xl",children:jsxRuntime.jsx(chunkXOGHUQYC_cjs.P,{type:a,className:t})})})})}function Ua({file:e}){var t;return (t=e.metaData)!=null&&t.pageCount?jsxRuntime.jsxs("p",{className:"text-xs text-primary mb-2",children:["Pages: ",e.metaData.pageCount]}):null}function Ha({file:e}){let t=chunkXOGHUQYC_cjs.O(e.mime,e.ext);return jsxRuntime.jsx(chunkXOGHUQYC_cjs.P,{type:t})}var $a={images:{component:La,metadataComponent:_a},videos:{component:Aa,metadataComponent:Oa},files:{component:Va,metadataComponent:Ua},audios:{component:Ba,metadataComponent:Ga},default:{component:Ha}};function et(e){let t=chunkXOGHUQYC_cjs.N(e.mime,e.ext);return $a[t]||$a.default}function kt(a){var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx("kbd",chunkXOGHUQYC_cjs.a({"data-slot":"kbd",className:b("bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none","[&_svg:not([class*='size-'])]:size-3","[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",e)},t))}function Dt(a){var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx("kbd",chunkXOGHUQYC_cjs.a({"data-slot":"kbd-group",className:b("inline-flex items-center gap-1",e)},t))}function Wa(){let{isUploadModalOpen:e,setIsUploadModalOpen:t,uploadFiles:a,allowedFileTypes:o,maxUploadFiles:r,maxUploadSize:n}=R(),s=chunkXOGHUQYC_cjs.Q(o),d=chunkXOGHUQYC_cjs.R(o),[l,v]=yi.useState([]),[{isDragging:u,errors:p},{removeFile:F,clearFiles:c,handleDragEnter:h,handleDragLeave:N,handleDragOver:x,handleDrop:V,openFileDialog:C,getInputProps:I}]=za({maxFiles:r,maxSize:n,accept:s,multiple:true,onFilesChange:m=>{let T=m.map(S=>{let E=l.find(be=>be.id===S.id);return E?chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a(chunkXOGHUQYC_cjs.a({},E),S),{file:S.file}):chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({},S),{file:S.file,progress:100,status:"completed"})});v(T);}}),D=m=>{F(m);},O=m=>{v(T=>T.map(S=>S.id===m?chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({},S),{progress:0,status:"uploading",error:void 0}):S));},P=()=>{let m=l.filter(T=>T.status==="completed");if(m.length>0){let T=m.map(S=>({name:S.file.name,size:S.file.size,type:chunkXOGHUQYC_cjs.N(S.file.type,S.file.name.split(".").pop()),lastModified:S.file instanceof File?S.file.lastModified:Date.now(),file:S.file,metadata:{}}));a(T),J();}},J=()=>{t(false),c(),v([]);},q=(m,T)=>{let S={id:"temp",name:m.name,size:m.size,mime:m.type,ext:m.name.split(".").pop()||"",url:T||"",createdAt:new Date(m.lastModified),updatedAt:new Date(m.lastModified),folderId:null,metaData:{}},{component:E}=et(S);return jsxRuntime.jsx(E,{file:S,metaData:S.metaData})},W=l.filter(m=>m.status==="completed").length,g=l.filter(m=>m.status==="uploading").length,k=W>0&&g===0;return jsxRuntime.jsx(we,{open:e,onOpenChange:t,children:jsxRuntime.jsxs(Ce,{className:"p-0 max-w-4xl max-h-[80vh] flex flex-col",variant:"default",showCloseButton:false,children:[jsxRuntime.jsxs(Le,{className:"pt-5 pb-3 m-0 border-b border-border",children:[jsxRuntime.jsx(Fe,{className:"px-6 text-base",children:jsxRuntime.jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[jsxRuntime.jsxs("span",{children:["Upload Files",jsxRuntime.jsx(Dt,{className:"ml-2",children:jsxRuntime.jsxs(kt,{children:[jsxRuntime.jsx("span",{className:"text-lg",children:"\u2318"})," + U"]})})]}),jsxRuntime.jsx(ve,{onClick:()=>t(false)})]})}),jsxRuntime.jsx(Xe,{})]}),jsxRuntime.jsxs("div",{className:"p-6 overflow-y-auto flex-1",children:[jsxRuntime.jsxs("div",{className:b("relative w-full rounded-xl border-2 border-dashed bg-muted border-muted-foreground/25 px-6 py-16 text-center transition-colors mb-4",u?"border-primary bg-primary/5":"border-muted-foreground/25 hover:border-muted-foreground/50"),onDragEnter:h,onDragLeave:N,onDragOver:x,onDrop:V,children:[jsxRuntime.jsx("input",chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({},I()),{className:"sr-only"})),jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("div",{className:b("flex h-12 w-12 items-center justify-center rounded-full transition-colors",u?"border-primary bg-primary/10":"border-muted-foreground/25"),children:jsxRuntime.jsx(Ro,{className:"mb-3 text-muted-foreground"})}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("p",{className:"text-sm font-medium",children:["Drop files here or"," ",jsxRuntime.jsx("button",{type:"button",onClick:C,className:"cursor-pointer text-primary underline-offset-4 underline",children:"browse files"})]}),jsxRuntime.jsxs("p",{className:"text-xs text-muted-foreground",children:[d," \u2022 Max size: ",re(n)," \u2022 Max files: ",r]})]})]})]}),l.length>0&&jsxRuntime.jsx("div",{className:"space-y-4",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3 lg:grid-cols-4",children:l.map(m=>jsxRuntime.jsxs("div",{className:"relative group",children:[jsxRuntime.jsx(ve,{onClick:()=>D(m.id),className:"absolute -inset-e-2 -top-2 z-10 size-6 rounded-full opacity-0 transition-opacity group-hover:opacity-100",iconClassName:"size-3"}),jsxRuntime.jsxs("div",{className:"relative overflow-hidden rounded-lg border border-muted-foreground/25 bg-card transition-colors",children:[jsxRuntime.jsx("div",{className:"relative aspect-square bg-muted border-muted-foreground/25",children:jsxRuntime.jsx("div",{className:"flex h-full items-center justify-center p-4",children:jsxRuntime.jsx("div",{className:"w-[75%] h-[75%] flex items-center justify-center",children:m.status==="uploading"?jsxRuntime.jsxs("div",{className:"relative w-full h-full flex items-center justify-center",children:[jsxRuntime.jsxs("svg",{className:"size-12 -rotate-90 absolute",viewBox:"0 0 48 48",children:[jsxRuntime.jsx("circle",{cx:"24",cy:"24",r:"20",fill:"none",stroke:"currentColor",strokeWidth:"3",className:"text-muted-foreground/20"}),jsxRuntime.jsx("circle",{cx:"24",cy:"24",r:"20",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeDasharray:`${2*Math.PI*20}`,strokeDashoffset:`${2*Math.PI*20*(1-m.progress/100)}`,className:"text-primary transition-all duration-300",strokeLinecap:"round"})]}),m.file instanceof File&&q(m.file,m.preview)]}):m.file instanceof File&&q(m.file,m.preview)})})}),jsxRuntime.jsx("div",{className:"p-3",children:jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("p",{className:"truncate text-xs font-medium",children:m.file.name}),jsxRuntime.jsxs("div",{className:"relative flex items-center justify-between gap-2",children:[jsxRuntime.jsx("span",{className:"text-[11px] text-primary font-semibold tracking-tight",children:re(m.file.size)}),m.status==="error"&&m.error&&jsxRuntime.jsxs(Pa,{children:[jsxRuntime.jsx(Ia,{asChild:true,children:jsxRuntime.jsx(w,{onClick:()=>O(m.id),variant:"ghost",size:"icon",className:"absolute end-0 -top-1.25 size-6 text-destructive hover:bg-destructive/10 hover:text-destructive",children:jsxRuntime.jsx(chunkXOGHUQYC_cjs.L,{className:"size-3 opacity-100"})})}),jsxRuntime.jsx(Sa,{children:"Upload failed. Retry"})]})]})]})})]})]},m.id))})}),p.length>0&&jsxRuntime.jsxs(Fa,{variant:"destructive",appearance:"light",className:"mt-5",children:[jsxRuntime.jsx(Ma,{children:jsxRuntime.jsx(chunkXOGHUQYC_cjs.M,{})}),jsxRuntime.jsxs(Da,{children:[jsxRuntime.jsx(Na,{children:"File upload error(s)"}),jsxRuntime.jsx(ka,{children:p.map(m=>jsxRuntime.jsx("p",{className:"last:mb-0",children:m},m))})]})]})]}),jsxRuntime.jsxs(_e,{className:"px-6 py-4 border-t border-border w-full sm:justify-between justify-center items-center flex-col sm:flex-row gap-2 ",children:[jsxRuntime.jsx(Ge,{asChild:true,children:jsxRuntime.jsx(w,{type:"button",radius:"full",variant:"outline",onClick:J,className:"w-full md:w-auto",children:"Cancel"})}),jsxRuntime.jsxs(w,{type:"button",radius:"full",onClick:P,disabled:!k,className:"w-full md:w-auto",children:["Upload ",W>0&&`(${W})`]})]})]})})}var Gn=classVarianceAuthority.cva(`
9
9
  flex w-full bg-background border border-input shadow-xs shadow-black/5 transition-[color,box-shadow] text-foreground placeholder:text-muted-foreground/80
10
10
  focus-visible:ring-ring/30 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-[3px]
11
11
  disabled:cursor-not-allowed disabled:opacity-60
@@ -65,35 +65,35 @@
65
65
  has-[[aria-invalid=true]]:ring-destructive/10
66
66
  dark:has-[[aria-invalid=true]]:border-destructive
67
67
  dark:has-[[aria-invalid=true]]:ring-destructive/20
68
- `,{variants:{variant:{sm:"gap-1.25 [&_svg:not([class*=size-])]:size-3.5",md:"gap-1.5 [&_svg:not([class*=size-])]:size-4",lg:"gap-1.5 [&_svg:not([class*=size-])]:size-4"}},defaultVariants:{variant:"md"}});function Pt(r){var n=r,{className:e,type:t,variant:a}=n,o=chunkSV5VFLC2_cjs.c(n,["className","type","variant"]);return jsxRuntime.jsx("input",chunkSV5VFLC2_cjs.a({"data-slot":"input",type:t,className:b(Gn({variant:a}),e)},o))}function ja(){let{isCreateFolderModalOpen:e,setIsCreateFolderModalOpen:t,isRenameFolderModalOpen:a,setIsRenameFolderModalOpen:o,createFolder:r,renameFolder:n,folderToRename:s,setFolderToRename:d}=R(),[l,v]=yi.useState(null),u=a,p=e||a,F=u&&s?s.name:"",c=l!=null?l:F,h=async()=>{if(c.trim()!==""){if(u&&s){let x=s.id;x!==null&&await n(x,c.trim()),o(false),d(null);}else r(c.trim()),t(false);v(null);}},N=()=>{u?(o(false),d(null)):t(false),v(null);};return p?jsxRuntime.jsx(we,{open:p,onOpenChange:N,children:jsxRuntime.jsxs(Ce,{className:"p-0 max-w-xl m-auto max-h-[32vh] flex flex-col",variant:"fullscreen",showCloseButton:false,children:[jsxRuntime.jsx(Le,{className:"pt-5 pb-3 m-0 border-b border-border flex w-full justify-between",children:jsxRuntime.jsx(Fe,{className:"px-6 text-base",children:jsxRuntime.jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[jsxRuntime.jsxs("span",{children:[u?"Rename Folder":"Create New Folder",!u&&jsxRuntime.jsx("span",{className:"ml-4",children:jsxRuntime.jsx(Dt,{children:jsxRuntime.jsxs(kt,{children:[jsxRuntime.jsx("span",{className:"text-lg",children:"\u2318"})," + F"]})})})]}),jsxRuntime.jsx(ve,{onClick:N})]})})}),jsxRuntime.jsxs("div",{className:"p-6",children:[jsxRuntime.jsx("label",{htmlFor:"folder-name",className:"hidden mb-2",children:"Folder Name:"}),jsxRuntime.jsx(Pt,{id:"folder-name",name:"folder-name",value:c,onChange:x=>v(x.target.value),placeholder:"Enter folder name",autoFocus:true,onKeyDown:x=>{x.key==="Enter"&&c.trim()!==""&&h();}})]}),jsxRuntime.jsxs(_e,{className:"px-6 py-4 border-t border-border w-full sm:justify-between justify-center items-center flex-col sm:flex-row gap-2 ",children:[jsxRuntime.jsx(Ge,{asChild:true,children:jsxRuntime.jsx(w,{type:"button",variant:"outline",onClick:N,radius:"full",className:"w-full md:w-auto",children:"Cancel"})}),jsxRuntime.jsx(w,{type:"button",disabled:c.trim()==="",onClick:h,radius:"full",className:"w-full md:w-auto",children:u?"Rename":"Create"})]})]})}):null}function Ae(e,t=30){if(e.length<=t)return e;let a=e.slice(0,Math.ceil(t/2)),o=e.slice(-Math.floor(t/2));return `${a}...${o}`}function Eo({threshold:e=0,root:t=null,rootMargin:a="0%"}={}){let[o,r]=yi.useState(),[n,s]=yi.useState(null),d=yi.useRef(null);return yi.useEffect(()=>(d.current&&d.current.disconnect(),n&&typeof globalThis!="undefined"&&"IntersectionObserver"in globalThis&&(d.current=new IntersectionObserver(([l])=>{r(l);},{threshold:e,root:t,rootMargin:a}),d.current.observe(n)),()=>{d.current&&d.current.disconnect();}),[n,e,t,a]),{ref:s,entry:o}}function Ya({folder:e,selectedFolderId:t,onSelect:a,onLoadChildren:o,disabledFolderIds:r=[],treeState:n}){var q;let[s,d]=yi.useState(false),l=((q=e.folderCount)!=null?q:0)>0,v=t===e.id,u=r.includes(e.id),p=n.loading.has(e.id),F=n.loaded.has(e.id),c=n.folders.get(e.id)||[],h=n.pagination.get(e.id),{ref:N,entry:x}=Eo({threshold:.1,rootMargin:"100px"}),V=h&&h.currentPage<h.totalPages;yi.useEffect(()=>{if(s&&(x!=null&&x.isIntersecting)&&V&&!p){let W=((h==null?void 0:h.currentPage)||1)+1;o(e.id,W);}},[x==null?void 0:x.isIntersecting,V,p,s,h,e.id,o]);let C=async()=>{if(!l)return;let W=!s;d(W),W&&!F&&!p&&await o(e.id,1);},I=()=>{u||a(e.id);},D="bg-blue-100 text-blue-600 dark:text-blue-400 font-semibold",O="opacity-50 cursor-not-allowed",J="hover:bg-gray-100 dark:hover:bg-zinc-700";return v?J=D:u&&(J=O),jsxRuntime.jsxs("li",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 py-1",children:[l?jsxRuntime.jsx("button",{onClick:C,className:"p-1 -m-1 hover:bg-gray-100 dark:hover:bg-zinc-700 rounded transition-colors","aria-label":s?"Collapse folder":"Expand folder",children:jsxRuntime.jsx(chunkSV5VFLC2_cjs.u,{className:`size-4 text-gray-500 dark:text-zinc-400 transition-transform ${!u&&s?"rotate-90":""}`})}):jsxRuntime.jsx("div",{className:"w-4"}),jsxRuntime.jsxs("button",{onClick:I,disabled:u,title:e.name,className:`flex items-center gap-1.5 px-2 py-1 rounded-xl flex-1 text-left transition-colors min-w-0 ${J}`,children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.p,{className:"size-8 text-white shrink-0",strokeWidth:1.5}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx("span",{className:"truncate min-w-0",children:Ae(e.name,15)}),u?jsxRuntime.jsx("span",{className:"text-[0.6rem] text-left font-medium text-gray-900 dark:text-zinc-300",children:"(Already selected)"}):""]})]})]}),!u&&s&&jsxRuntime.jsxs("ul",{className:"pl-6",children:[c.map(W=>jsxRuntime.jsx(Ya,{folder:W,selectedFolderId:t,onSelect:a,onLoadChildren:o,disabledFolderIds:r,treeState:n},W.id)),(p||V)&&jsxRuntime.jsx("li",{ref:N,className:"py-2 pl-6 flex justify-start",children:jsxRuntime.jsx(chunkSV5VFLC2_cjs.I,{className:"h-4 w-4 animate-spin text-blue-500"})}),p&&c.length===0&&jsxRuntime.jsx("li",{className:"py-1",children:jsxRuntime.jsx("div",{className:"flex items-center gap-1.5 px-2",children:jsxRuntime.jsx("span",{className:"text-sm text-gray-500 dark:text-zinc-400",children:"Loading..."})})})]})]})}function Za(){let{isMoveFileModalOpen:e,setIsMoveFileModalOpen:t,selectedFiles:a,selectedFolders:o,bulkMove:r,provider:n}=R(),[s,d]=yi.useState(void 0),[l,v]=yi.useState({folders:new Map,loading:new Set,loaded:new Set,pagination:new Map}),u=yi.useRef(new Set),p=yi.useRef(false),{ref:F,entry:c}=Eo({threshold:.1,rootMargin:"100px"}),h=l.pagination.get(null),N=h&&h.currentPage<h.totalPages,x=l.loading.has(null),V=o.map(P=>P.id),C=l.folders.get(null)||[],I=yi.useCallback(async(P,J=1)=>{if(!u.current.has(P)){u.current.add(P),v(q=>chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({},q),{loading:new Set(q.loading).add(P)}));try{let q=await n.getFolders(P,J,20);v(W=>{let g=new Set(W.loading);g.delete(P);let k=new Set(W.loaded);k.add(P);let m=new Map(W.folders),T=m.get(P)||[];J>1?m.set(P,[...T,...q.folders]):m.set(P,q.folders);let S=new Map(W.pagination);return S.set(P,q.pagination),{folders:m,loading:g,loaded:k,pagination:S}});}catch(q){console.error(`Failed to load folders for ${P}:`,q),v(W=>{let g=new Set(W.loading);return g.delete(P),chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({},W),{loading:g})});}finally{u.current.delete(P);}}},[n]);yi.useEffect(()=>{e?p.current||(p.current=true,I(null,1)):p.current=false;},[e,I]),yi.useEffect(()=>{if(e&&(c!=null&&c.isIntersecting)&&N&&!x){let P=((h==null?void 0:h.currentPage)||1)+1;I(null,P);}},[e,c==null?void 0:c.isIntersecting,N,x,h,I]);let D=()=>{s!==void 0&&(r(s),t(false),d(void 0),v({folders:new Map,loading:new Set,loaded:new Set,pagination:new Map}));},O=P=>{t(P),P||(d(void 0),v({folders:new Map,loading:new Set,loaded:new Set,pagination:new Map}),u.current.clear());};return e?jsxRuntime.jsx(we,{open:e,onOpenChange:O,children:jsxRuntime.jsxs(Ce,{className:"p-0 max-w-3xl max-h-full m-auto md:max-h-[80vh] flex flex-col",variant:"fullscreen",showCloseButton:false,children:[jsxRuntime.jsxs(Le,{className:"pt-5 pb-3 m-0 border-b border-border",children:[jsxRuntime.jsx(Fe,{className:"px-6 text-base",children:jsxRuntime.jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[jsxRuntime.jsxs("span",{className:"w-full text-left",children:["Move Items",jsxRuntime.jsxs("p",{className:"text-gray-400 text-xs",children:["Moving ",a.length," file",a.length===1?"":"s"," and"," ",o.length," folder",o.length===1?"":"s","."]})]}),jsxRuntime.jsx(ve,{onClick:()=>O(false)})]})}),jsxRuntime.jsx(Xe,{})]}),jsxRuntime.jsx("div",{className:"text-sm my-3 px-6 flex-1 flex flex-col min-h-0",children:jsxRuntime.jsx("div",{className:"space-y-4 flex flex-col flex-1 min-h-0",children:jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsx("label",{htmlFor:"destination-folder",className:"block mb-2 font-medium text-gray-900 dark:text-zinc-100",children:"Select destination folder:"}),jsxRuntime.jsxs("ul",{id:"destination-folder",className:"border rounded-xl p-2 shadow-inner overflow-y-auto flex-1 min-h-0",children:[jsxRuntime.jsx("li",{children:jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 py-1",children:[jsxRuntime.jsx("div",{className:"w-4"}),jsxRuntime.jsxs("button",{onClick:()=>d(null),className:`flex items-center gap-1.5 px-2 py-1 rounded-xl flex-1 text-left transition-colors min-w-0 ${s===null?"bg-blue-100 text-blue-600 dark:text-blue-400 font-semibold":"hover:bg-gray-100 dark:hover:bg-zinc-700"}`,children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.p,{className:"size-8 text-white shrink-0",strokeWidth:1.5}),jsxRuntime.jsx("div",{className:"flex flex-col gap-1",children:jsxRuntime.jsx("span",{className:"truncate min-w-0",children:"Root Directory"})})]})]})}),C.map(P=>jsxRuntime.jsx(Ya,{folder:P,selectedFolderId:s,onSelect:J=>d(J),onLoadChildren:I,disabledFolderIds:V,treeState:l},P.id)),(x||N)&&jsxRuntime.jsx("li",{ref:F,className:"py-2 pl-6 flex justify-start",children:jsxRuntime.jsx(chunkSV5VFLC2_cjs.I,{className:"h-5 w-5 animate-spin text-blue-500"})}),C.length===0&&!x&&!N&&jsxRuntime.jsx("li",{className:"text-gray-500 dark:text-zinc-400 text-sm text-center py-4",children:"No nested folders available"})]})]})})}),jsxRuntime.jsxs(_e,{className:"px-6 py-4 border-t border-border w-full sm:justify-between justify-center items-center flex-col sm:flex-row gap-2 ",children:[jsxRuntime.jsx(Ge,{asChild:true,children:jsxRuntime.jsx(w,{type:"button",variant:"outline",radius:"full",className:"w-full md:w-auto",children:"Cancel"})}),jsxRuntime.jsx(w,{type:"button",onClick:D,disabled:s===void 0,radius:"full",className:"w-full md:w-auto",children:"Move"})]})]})}):null}function tt({title:e,open:t,onClose:a,previewSection:o,metadataSection:r,footer:n}){return jsxRuntime.jsx(we,{open:t,onOpenChange:s=>!s&&a(),children:jsxRuntime.jsxs(Ce,{className:"p-0 max-w-6xl w-full m-auto h-[80vh] flex flex-col overflow-hidden",variant:"fullscreen",showCloseButton:false,children:[jsxRuntime.jsxs(Le,{className:"pt-5 pb-3 border-b border-border shrink-0",children:[jsxRuntime.jsx(Fe,{className:"px-6 text-base",children:jsxRuntime.jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[jsxRuntime.jsx("span",{className:"truncate",children:e}),jsxRuntime.jsx(ve,{onClick:a})]})}),jsxRuntime.jsx(Xe,{})]}),jsxRuntime.jsx("div",{className:"flex-1 min-h-0",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 h-full",children:[jsxRuntime.jsx("div",{className:"p-6 border-b lg:border-b-0 lg:border-r border-slate-200 dark:border-zinc-700 overflow-auto",children:o}),jsxRuntime.jsx("div",{className:"p-6 overflow-auto",children:r})]})}),jsxRuntime.jsx(_e,{className:"px-6 py-4 border-t border-border shrink-0",children:n})]})})}function ot({file:e}){let{provider:t,setFileDetailsModalFile:a,refreshData:o}=R(),[r,n]=yi.useState(false);return jsxRuntime.jsx(w,{variant:"outline",size:"icon",radius:"full",title:"Delete",className:"border border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 hover:text-red-600 dark:hover:text-red-400 hover:border-red-300 dark:hover:border-red-700 hover:bg-red-50 dark:hover:bg-red-900/40 active:scale-95 transition-all duration-200",onClick:async()=>{n(true);try{await t.deleteFiles([e.id]),await o(),a(null),sonner.toast.success("File Deleted",{description:`${Ae(e.name,20)} has been deleted`});}catch(d){sonner.toast.error("Delete failed"),n(false);}},disabled:r,children:r?jsxRuntime.jsx(chunkSV5VFLC2_cjs.I,{className:"size-5 animate-spin"}):jsxRuntime.jsx(chunkSV5VFLC2_cjs.x,{className:"size-5"})})}function at({file:e}){let[t,a]=yi.useState(false);return jsxRuntime.jsx(w,{variant:"outline",size:"icon",radius:"full",onClick:async()=>{a(true);try{let r=document.createElement("a");r.href=e.url,r.download=e.name,r.click(),sonner.toast.success("Download Started",{description:`Downloading ${Ae(e.name,20)}`});}catch(r){sonner.toast.error("Download failed");}finally{a(false);}},className:"border border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 hover:text-blue-600 dark:hover:text-blue-400 hover:border-blue-300 dark:hover:border-blue-700 hover:bg-blue-50 dark:hover:bg-blue-900/40 active:scale-95 transition-all duration-200",title:"Download",disabled:t,children:t?jsxRuntime.jsx(chunkSV5VFLC2_cjs.I,{className:"size-5 animate-spin"}):jsxRuntime.jsx(chunkSV5VFLC2_cjs.z,{className:"size-5",strokeWidth:2.5})})}function rt({file:e}){let[t,a]=yi.useState(false);return jsxRuntime.jsx(w,{variant:"outline",size:"icon",radius:"full",onClick:async()=>{try{await navigator.clipboard.writeText(e.url),a(!0),sonner.toast.success("Link Copied",{description:"File URL copied to clipboard"}),setTimeout(()=>a(!1),2e3);}catch(r){sonner.toast.error("Failed to copy link");}},className:`border border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 active:scale-95 transition-all duration-200
69
- ${t?"text-green-700 dark:text-green-400 border-green-400 dark:border-green-700 bg-green-100 dark:bg-green-900/40 font-bold":"hover:text-orange-600 dark:hover:text-orange-400 hover:border-orange-300 dark:hover:border-orange-700 hover:bg-orange-50 dark:hover:bg-orange-900/40"}`,title:"Copy Link",disabled:t,children:t?jsxRuntime.jsx(chunkSV5VFLC2_cjs.C,{className:"size-5 animate-in zoom-in duration-200",strokeWidth:3}):jsxRuntime.jsx(chunkSV5VFLC2_cjs.A,{className:"size-5",strokeWidth:2.5})})}function Ja({onFullscreen:e}){return jsxRuntime.jsx(w,{variant:"outline",size:"icon",radius:"full",onClick:e,className:"border border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 hover:text-purple-600 dark:hover:text-purple-400 hover:border-purple-300 dark:hover:border-purple-700 hover:bg-purple-50 dark:hover:bg-purple-900/40 active:scale-95 transition-all duration-200",title:"Fullscreen",children:jsxRuntime.jsx(chunkSV5VFLC2_cjs.B,{className:"size-5",strokeWidth:1})})}var jn=classVarianceAuthority.cva(`
68
+ `,{variants:{variant:{sm:"gap-1.25 [&_svg:not([class*=size-])]:size-3.5",md:"gap-1.5 [&_svg:not([class*=size-])]:size-4",lg:"gap-1.5 [&_svg:not([class*=size-])]:size-4"}},defaultVariants:{variant:"md"}});function Pt(r){var n=r,{className:e,type:t,variant:a}=n,o=chunkXOGHUQYC_cjs.c(n,["className","type","variant"]);return jsxRuntime.jsx("input",chunkXOGHUQYC_cjs.a({"data-slot":"input",type:t,className:b(Gn({variant:a}),e)},o))}function ja(){let{isCreateFolderModalOpen:e,setIsCreateFolderModalOpen:t,isRenameFolderModalOpen:a,setIsRenameFolderModalOpen:o,createFolder:r,renameFolder:n,folderToRename:s,setFolderToRename:d}=R(),[l,v]=yi.useState(null),u=a,p=e||a,F=u&&s?s.name:"",c=l!=null?l:F,h=async()=>{if(c.trim()!==""){if(u&&s){let x=s.id;x!==null&&await n(x,c.trim()),o(false),d(null);}else r(c.trim()),t(false);v(null);}},N=()=>{u?(o(false),d(null)):t(false),v(null);};return p?jsxRuntime.jsx(we,{open:p,onOpenChange:N,children:jsxRuntime.jsxs(Ce,{className:"p-0 max-w-xl m-auto max-h-[32vh] flex flex-col",variant:"fullscreen",showCloseButton:false,children:[jsxRuntime.jsx(Le,{className:"pt-5 pb-3 m-0 border-b border-border flex w-full justify-between",children:jsxRuntime.jsx(Fe,{className:"px-6 text-base",children:jsxRuntime.jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[jsxRuntime.jsxs("span",{children:[u?"Rename Folder":"Create New Folder",!u&&jsxRuntime.jsx("span",{className:"ml-4",children:jsxRuntime.jsx(Dt,{children:jsxRuntime.jsxs(kt,{children:[jsxRuntime.jsx("span",{className:"text-lg",children:"\u2318"})," + F"]})})})]}),jsxRuntime.jsx(ve,{onClick:N})]})})}),jsxRuntime.jsxs("div",{className:"p-6",children:[jsxRuntime.jsx("label",{htmlFor:"folder-name",className:"hidden mb-2",children:"Folder Name:"}),jsxRuntime.jsx(Pt,{id:"folder-name",name:"folder-name",value:c,onChange:x=>v(x.target.value),placeholder:"Enter folder name",autoFocus:true,onKeyDown:x=>{x.key==="Enter"&&c.trim()!==""&&h();}})]}),jsxRuntime.jsxs(_e,{className:"px-6 py-4 border-t border-border w-full sm:justify-between justify-center items-center flex-col sm:flex-row gap-2 ",children:[jsxRuntime.jsx(Ge,{asChild:true,children:jsxRuntime.jsx(w,{type:"button",variant:"outline",onClick:N,radius:"full",className:"w-full md:w-auto",children:"Cancel"})}),jsxRuntime.jsx(w,{type:"button",disabled:c.trim()==="",onClick:h,radius:"full",className:"w-full md:w-auto",children:u?"Rename":"Create"})]})]})}):null}function Ae(e,t=30){if(e.length<=t)return e;let a=e.slice(0,Math.ceil(t/2)),o=e.slice(-Math.floor(t/2));return `${a}...${o}`}function Eo({threshold:e=0,root:t=null,rootMargin:a="0%"}={}){let[o,r]=yi.useState(),[n,s]=yi.useState(null),d=yi.useRef(null);return yi.useEffect(()=>(d.current&&d.current.disconnect(),n&&typeof globalThis!="undefined"&&"IntersectionObserver"in globalThis&&(d.current=new IntersectionObserver(([l])=>{r(l);},{threshold:e,root:t,rootMargin:a}),d.current.observe(n)),()=>{d.current&&d.current.disconnect();}),[n,e,t,a]),{ref:s,entry:o}}function Ya({folder:e,selectedFolderId:t,onSelect:a,onLoadChildren:o,disabledFolderIds:r=[],treeState:n}){var q;let[s,d]=yi.useState(false),l=((q=e.folderCount)!=null?q:0)>0,v=t===e.id,u=r.includes(e.id),p=n.loading.has(e.id),F=n.loaded.has(e.id),c=n.folders.get(e.id)||[],h=n.pagination.get(e.id),{ref:N,entry:x}=Eo({threshold:.1,rootMargin:"100px"}),V=h&&h.currentPage<h.totalPages;yi.useEffect(()=>{if(s&&(x!=null&&x.isIntersecting)&&V&&!p){let W=((h==null?void 0:h.currentPage)||1)+1;o(e.id,W);}},[x==null?void 0:x.isIntersecting,V,p,s,h,e.id,o]);let C=async()=>{if(!l)return;let W=!s;d(W),W&&!F&&!p&&await o(e.id,1);},I=()=>{u||a(e.id);},D="bg-blue-100 text-blue-600 dark:text-blue-400 font-semibold",O="opacity-50 cursor-not-allowed",J="hover:bg-gray-100 dark:hover:bg-zinc-700";return v?J=D:u&&(J=O),jsxRuntime.jsxs("li",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 py-1",children:[l?jsxRuntime.jsx("button",{onClick:C,className:"p-1 -m-1 hover:bg-gray-100 dark:hover:bg-zinc-700 rounded transition-colors","aria-label":s?"Collapse folder":"Expand folder",children:jsxRuntime.jsx(chunkXOGHUQYC_cjs.u,{className:`size-4 text-gray-500 dark:text-zinc-400 transition-transform ${!u&&s?"rotate-90":""}`})}):jsxRuntime.jsx("div",{className:"w-4"}),jsxRuntime.jsxs("button",{onClick:I,disabled:u,title:e.name,className:`flex items-center gap-1.5 px-2 py-1 rounded-xl flex-1 text-left transition-colors min-w-0 ${J}`,children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.p,{className:"size-8 text-white shrink-0",strokeWidth:1.5}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx("span",{className:"truncate min-w-0",children:Ae(e.name,15)}),u?jsxRuntime.jsx("span",{className:"text-[0.6rem] text-left font-medium text-gray-900 dark:text-zinc-300",children:"(Already selected)"}):""]})]})]}),!u&&s&&jsxRuntime.jsxs("ul",{className:"pl-6",children:[c.map(W=>jsxRuntime.jsx(Ya,{folder:W,selectedFolderId:t,onSelect:a,onLoadChildren:o,disabledFolderIds:r,treeState:n},W.id)),(p||V)&&jsxRuntime.jsx("li",{ref:N,className:"py-2 pl-6 flex justify-start",children:jsxRuntime.jsx(chunkXOGHUQYC_cjs.I,{className:"h-4 w-4 animate-spin text-blue-500"})}),p&&c.length===0&&jsxRuntime.jsx("li",{className:"py-1",children:jsxRuntime.jsx("div",{className:"flex items-center gap-1.5 px-2",children:jsxRuntime.jsx("span",{className:"text-sm text-gray-500 dark:text-zinc-400",children:"Loading..."})})})]})]})}function Za(){let{isMoveFileModalOpen:e,setIsMoveFileModalOpen:t,selectedFiles:a,selectedFolders:o,bulkMove:r,provider:n}=R(),[s,d]=yi.useState(void 0),[l,v]=yi.useState({folders:new Map,loading:new Set,loaded:new Set,pagination:new Map}),u=yi.useRef(new Set),p=yi.useRef(false),{ref:F,entry:c}=Eo({threshold:.1,rootMargin:"100px"}),h=l.pagination.get(null),N=h&&h.currentPage<h.totalPages,x=l.loading.has(null),V=o.map(P=>P.id),C=l.folders.get(null)||[],I=yi.useCallback(async(P,J=1)=>{if(!u.current.has(P)){u.current.add(P),v(q=>chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({},q),{loading:new Set(q.loading).add(P)}));try{let q=await n.getFolders(P,J,20);v(W=>{let g=new Set(W.loading);g.delete(P);let k=new Set(W.loaded);k.add(P);let m=new Map(W.folders),T=m.get(P)||[];J>1?m.set(P,[...T,...q.folders]):m.set(P,q.folders);let S=new Map(W.pagination);return S.set(P,q.pagination),{folders:m,loading:g,loaded:k,pagination:S}});}catch(q){console.error(`Failed to load folders for ${P}:`,q),v(W=>{let g=new Set(W.loading);return g.delete(P),chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({},W),{loading:g})});}finally{u.current.delete(P);}}},[n]);yi.useEffect(()=>{e?p.current||(p.current=true,I(null,1)):p.current=false;},[e,I]),yi.useEffect(()=>{if(e&&(c!=null&&c.isIntersecting)&&N&&!x){let P=((h==null?void 0:h.currentPage)||1)+1;I(null,P);}},[e,c==null?void 0:c.isIntersecting,N,x,h,I]);let D=()=>{s!==void 0&&(r(s),t(false),d(void 0),v({folders:new Map,loading:new Set,loaded:new Set,pagination:new Map}));},O=P=>{t(P),P||(d(void 0),v({folders:new Map,loading:new Set,loaded:new Set,pagination:new Map}),u.current.clear());};return e?jsxRuntime.jsx(we,{open:e,onOpenChange:O,children:jsxRuntime.jsxs(Ce,{className:"p-0 max-w-3xl max-h-full m-auto md:max-h-[80vh] flex flex-col",variant:"fullscreen",showCloseButton:false,children:[jsxRuntime.jsxs(Le,{className:"pt-5 pb-3 m-0 border-b border-border",children:[jsxRuntime.jsx(Fe,{className:"px-6 text-base",children:jsxRuntime.jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[jsxRuntime.jsxs("span",{className:"w-full text-left",children:["Move Items",jsxRuntime.jsxs("p",{className:"text-gray-400 text-xs",children:["Moving ",a.length," file",a.length===1?"":"s"," and"," ",o.length," folder",o.length===1?"":"s","."]})]}),jsxRuntime.jsx(ve,{onClick:()=>O(false)})]})}),jsxRuntime.jsx(Xe,{})]}),jsxRuntime.jsx("div",{className:"text-sm my-3 px-6 flex-1 flex flex-col min-h-0",children:jsxRuntime.jsx("div",{className:"space-y-4 flex flex-col flex-1 min-h-0",children:jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsx("label",{htmlFor:"destination-folder",className:"block mb-2 font-medium text-gray-900 dark:text-zinc-100",children:"Select destination folder:"}),jsxRuntime.jsxs("ul",{id:"destination-folder",className:"border rounded-xl p-2 shadow-inner overflow-y-auto flex-1 min-h-0",children:[jsxRuntime.jsx("li",{children:jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 py-1",children:[jsxRuntime.jsx("div",{className:"w-4"}),jsxRuntime.jsxs("button",{onClick:()=>d(null),className:`flex items-center gap-1.5 px-2 py-1 rounded-xl flex-1 text-left transition-colors min-w-0 ${s===null?"bg-blue-100 text-blue-600 dark:text-blue-400 font-semibold":"hover:bg-gray-100 dark:hover:bg-zinc-700"}`,children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.p,{className:"size-8 text-white shrink-0",strokeWidth:1.5}),jsxRuntime.jsx("div",{className:"flex flex-col gap-1",children:jsxRuntime.jsx("span",{className:"truncate min-w-0",children:"Root Directory"})})]})]})}),C.map(P=>jsxRuntime.jsx(Ya,{folder:P,selectedFolderId:s,onSelect:J=>d(J),onLoadChildren:I,disabledFolderIds:V,treeState:l},P.id)),(x||N)&&jsxRuntime.jsx("li",{ref:F,className:"py-2 pl-6 flex justify-start",children:jsxRuntime.jsx(chunkXOGHUQYC_cjs.I,{className:"h-5 w-5 animate-spin text-blue-500"})}),C.length===0&&!x&&!N&&jsxRuntime.jsx("li",{className:"text-gray-500 dark:text-zinc-400 text-sm text-center py-4",children:"No nested folders available"})]})]})})}),jsxRuntime.jsxs(_e,{className:"px-6 py-4 border-t border-border w-full sm:justify-between justify-center items-center flex-col sm:flex-row gap-2 ",children:[jsxRuntime.jsx(Ge,{asChild:true,children:jsxRuntime.jsx(w,{type:"button",variant:"outline",radius:"full",className:"w-full md:w-auto",children:"Cancel"})}),jsxRuntime.jsx(w,{type:"button",onClick:D,disabled:s===void 0,radius:"full",className:"w-full md:w-auto",children:"Move"})]})]})}):null}function tt({title:e,open:t,onClose:a,previewSection:o,metadataSection:r,footer:n}){return jsxRuntime.jsx(we,{open:t,onOpenChange:s=>!s&&a(),children:jsxRuntime.jsxs(Ce,{className:"p-0 max-w-6xl w-full m-auto h-[80vh] flex flex-col overflow-hidden",variant:"fullscreen",showCloseButton:false,children:[jsxRuntime.jsxs(Le,{className:"pt-5 pb-3 border-b border-border shrink-0",children:[jsxRuntime.jsx(Fe,{className:"px-6 text-base",children:jsxRuntime.jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[jsxRuntime.jsx("span",{className:"truncate",children:e}),jsxRuntime.jsx(ve,{onClick:a})]})}),jsxRuntime.jsx(Xe,{})]}),jsxRuntime.jsx("div",{className:"flex-1 min-h-0",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 h-full",children:[jsxRuntime.jsx("div",{className:"p-6 border-b lg:border-b-0 lg:border-r border-slate-200 dark:border-zinc-700 overflow-auto",children:o}),jsxRuntime.jsx("div",{className:"p-6 overflow-auto",children:r})]})}),jsxRuntime.jsx(_e,{className:"px-6 py-4 border-t border-border shrink-0",children:n})]})})}function ot({file:e}){let{provider:t,setFileDetailsModalFile:a,refreshData:o}=R(),[r,n]=yi.useState(false);return jsxRuntime.jsx(w,{variant:"outline",size:"icon",radius:"full",title:"Delete",className:"border border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 hover:text-red-600 dark:hover:text-red-400 hover:border-red-300 dark:hover:border-red-700 hover:bg-red-50 dark:hover:bg-red-900/40 active:scale-95 transition-all duration-200",onClick:async()=>{n(true);try{await t.deleteFiles([e.id]),await o(),a(null),sonner.toast.success("File Deleted",{description:`${Ae(e.name,20)} has been deleted`});}catch(d){sonner.toast.error("Delete failed"),n(false);}},disabled:r,children:r?jsxRuntime.jsx(chunkXOGHUQYC_cjs.I,{className:"size-5 animate-spin"}):jsxRuntime.jsx(chunkXOGHUQYC_cjs.x,{className:"size-5"})})}function at({file:e}){let[t,a]=yi.useState(false);return jsxRuntime.jsx(w,{variant:"outline",size:"icon",radius:"full",onClick:async()=>{a(true);try{let r=document.createElement("a");r.href=e.url,r.download=e.name,r.click(),sonner.toast.success("Download Started",{description:`Downloading ${Ae(e.name,20)}`});}catch(r){sonner.toast.error("Download failed");}finally{a(false);}},className:"border border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 hover:text-blue-600 dark:hover:text-blue-400 hover:border-blue-300 dark:hover:border-blue-700 hover:bg-blue-50 dark:hover:bg-blue-900/40 active:scale-95 transition-all duration-200",title:"Download",disabled:t,children:t?jsxRuntime.jsx(chunkXOGHUQYC_cjs.I,{className:"size-5 animate-spin"}):jsxRuntime.jsx(chunkXOGHUQYC_cjs.z,{className:"size-5",strokeWidth:2.5})})}function rt({file:e}){let[t,a]=yi.useState(false);return jsxRuntime.jsx(w,{variant:"outline",size:"icon",radius:"full",onClick:async()=>{try{await navigator.clipboard.writeText(e.url),a(!0),sonner.toast.success("Link Copied",{description:"File URL copied to clipboard"}),setTimeout(()=>a(!1),2e3);}catch(r){sonner.toast.error("Failed to copy link");}},className:`border border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 active:scale-95 transition-all duration-200
69
+ ${t?"text-green-700 dark:text-green-400 border-green-400 dark:border-green-700 bg-green-100 dark:bg-green-900/40 font-bold":"hover:text-orange-600 dark:hover:text-orange-400 hover:border-orange-300 dark:hover:border-orange-700 hover:bg-orange-50 dark:hover:bg-orange-900/40"}`,title:"Copy Link",disabled:t,children:t?jsxRuntime.jsx(chunkXOGHUQYC_cjs.C,{className:"size-5 animate-in zoom-in duration-200",strokeWidth:3}):jsxRuntime.jsx(chunkXOGHUQYC_cjs.A,{className:"size-5",strokeWidth:2.5})})}function Ja({onFullscreen:e}){return jsxRuntime.jsx(w,{variant:"outline",size:"icon",radius:"full",onClick:e,className:"border border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 hover:text-purple-600 dark:hover:text-purple-400 hover:border-purple-300 dark:hover:border-purple-700 hover:bg-purple-50 dark:hover:bg-purple-900/40 active:scale-95 transition-all duration-200",title:"Fullscreen",children:jsxRuntime.jsx(chunkXOGHUQYC_cjs.B,{className:"size-5",strokeWidth:1})})}var jn=classVarianceAuthority.cva(`
70
70
  w-full bg-background border border-input bg-background text-foreground shadow-xs shadow-black/5 transition-[color,box-shadow]
71
71
  text-foreground placeholder:text-muted-foreground/80 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-[3px]
72
72
  focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 [&[readonly]]:opacity-70
73
73
  aria-invalid:border-destructive aria-invalid:border-destructive/60 aria-invalid:ring-destructive/10 dark:aria-invalid:border-destructive dark:aria-invalid:ring-destructive/20
74
- `,{variants:{variant:{sm:"px-2.5 py-2.5 text-xs rounded-md",md:"px-3 py-3 text-sm rounded-md",lg:"px-4 py-4 text-sm rounded-md"}},defaultVariants:{variant:"md"}});function Ue(o){var r=o,{className:e,variant:t}=r,a=chunkSV5VFLC2_cjs.c(r,["className","variant"]);return jsxRuntime.jsx("textarea",chunkSV5VFLC2_cjs.a({"data-slot":"textarea",className:b(jn({variant:t}),e)},a))}var Zn=classVarianceAuthority.cva("text-sm leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-50",{variants:{variant:{primary:"font-medium",secondary:"font-normal"}},defaultVariants:{variant:"primary"}});function Re(o){var r=o,{className:e,variant:t}=r,a=chunkSV5VFLC2_cjs.c(r,["className","variant"]);return jsxRuntime.jsx(radixUi.Label.Root,chunkSV5VFLC2_cjs.a({"data-slot":"label",className:b(Zn({variant:t}),e)},a))}function nt(e){let t=typeof e=="string"?new Date(e):e,a=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0"),r=t.getFullYear();return `${a}/${o}/${r}`}function uo(e){let t=Math.floor(e/60),a=e%60;return `${t}:${a.toString().padStart(2,"0")}`}var ei=classVarianceAuthority.cva("group/field flex w-full gap-3 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],horizontal:["flex-row items-center","[&>[data-slot=field-label]]:flex-auto","has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"],responsive:["flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto","@md/field-group:[&>[data-slot=field-label]]:flex-auto","@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"]}},defaultVariants:{orientation:"vertical"}});function it(o){var r=o,{className:e,orientation:t="vertical"}=r,a=chunkSV5VFLC2_cjs.c(r,["className","orientation"]);return jsxRuntime.jsx("div",chunkSV5VFLC2_cjs.a({role:"group","data-slot":"field","data-orientation":t,className:b(ei({orientation:t}),e)},a))}function st(a){var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx(Re,chunkSV5VFLC2_cjs.a({"data-slot":"field-label",className:b("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4","has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10",e)},t))}function lt(a){var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx("div",chunkSV5VFLC2_cjs.a({"data-slot":"input-group",role:"group",className:b("group/input-group border-input dark:bg-input/30 relative flex w-full items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none","h-9 min-w-0 has-[>textarea]:h-auto","has-[>[data-align=inline-start]]:[&>input]:pl-2","has-[>[data-align=inline-end]]:[&>input]:pr-2","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3","has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]","has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",e)},t))}var ti=classVarianceAuthority.cva("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50",{variants:{align:{"inline-start":"order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]","inline-end":"order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]","block-start":"order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5","block-end":"order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5"}},defaultVariants:{align:"inline-start"}});function dt(o){var r=o,{className:e,align:t="inline-start"}=r,a=chunkSV5VFLC2_cjs.c(r,["className","align"]);return jsxRuntime.jsx("div",chunkSV5VFLC2_cjs.a({role:"group","data-slot":"input-group-addon","data-align":t,className:b(ti({align:t}),e),onClick:n=>{var s,d;n.target.closest("button")||(d=(s=n.currentTarget.parentElement)==null?void 0:s.querySelector("input"))==null||d.focus();}},a))}classVarianceAuthority.cva("text-sm shadow-none flex gap-2 items-center",{variants:{size:{xs:"h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",sm:"h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function ct(a){var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx("span",chunkSV5VFLC2_cjs.a({className:b("text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",e)},t))}function ut(a){var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx(Pt,chunkSV5VFLC2_cjs.a({"data-slot":"input-group-control",className:b("flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent",e)},t))}function tr({file:e,onClose:t,onSave:a}){var N;let[o,r]=yi.useState(false),[n,s]=yi.useState(e.name),[d,l]=yi.useState(e.alternativeText||""),[v,u]=yi.useState(e.caption||""),p=async()=>{r(true);try{await(a==null?void 0:a({name:n,alternativeText:d,caption:v})),t();}finally{r(false);}},F=jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex gap-2 mb-4",children:[jsxRuntime.jsx(ot,{file:e}),jsxRuntime.jsx(at,{file:e}),jsxRuntime.jsx(rt,{file:e}),jsxRuntime.jsx(Ja,{onFullscreen:()=>window.open(e.url,"_blank")})]}),jsxRuntime.jsx("div",{className:"flex-1 flex items-center justify-center bg-gray-50 rounded-lg overflow-hidden",style:{backgroundImage:`
74
+ `,{variants:{variant:{sm:"px-2.5 py-2.5 text-xs rounded-md",md:"px-3 py-3 text-sm rounded-md",lg:"px-4 py-4 text-sm rounded-md"}},defaultVariants:{variant:"md"}});function Ue(o){var r=o,{className:e,variant:t}=r,a=chunkXOGHUQYC_cjs.c(r,["className","variant"]);return jsxRuntime.jsx("textarea",chunkXOGHUQYC_cjs.a({"data-slot":"textarea",className:b(jn({variant:t}),e)},a))}var Zn=classVarianceAuthority.cva("text-sm leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-50",{variants:{variant:{primary:"font-medium",secondary:"font-normal"}},defaultVariants:{variant:"primary"}});function Re(o){var r=o,{className:e,variant:t}=r,a=chunkXOGHUQYC_cjs.c(r,["className","variant"]);return jsxRuntime.jsx(radixUi.Label.Root,chunkXOGHUQYC_cjs.a({"data-slot":"label",className:b(Zn({variant:t}),e)},a))}function nt(e){let t=typeof e=="string"?new Date(e):e,a=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0"),r=t.getFullYear();return `${a}/${o}/${r}`}function uo(e){let t=Math.floor(e/60),a=e%60;return `${t}:${a.toString().padStart(2,"0")}`}var ei=classVarianceAuthority.cva("group/field flex w-full gap-3 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],horizontal:["flex-row items-center","[&>[data-slot=field-label]]:flex-auto","has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"],responsive:["flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto","@md/field-group:[&>[data-slot=field-label]]:flex-auto","@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"]}},defaultVariants:{orientation:"vertical"}});function it(o){var r=o,{className:e,orientation:t="vertical"}=r,a=chunkXOGHUQYC_cjs.c(r,["className","orientation"]);return jsxRuntime.jsx("div",chunkXOGHUQYC_cjs.a({role:"group","data-slot":"field","data-orientation":t,className:b(ei({orientation:t}),e)},a))}function st(a){var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx(Re,chunkXOGHUQYC_cjs.a({"data-slot":"field-label",className:b("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4","has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10",e)},t))}function lt(a){var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx("div",chunkXOGHUQYC_cjs.a({"data-slot":"input-group",role:"group",className:b("group/input-group border-input dark:bg-input/30 relative flex w-full items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none","h-9 min-w-0 has-[>textarea]:h-auto","has-[>[data-align=inline-start]]:[&>input]:pl-2","has-[>[data-align=inline-end]]:[&>input]:pr-2","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3","has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]","has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",e)},t))}var ti=classVarianceAuthority.cva("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50",{variants:{align:{"inline-start":"order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]","inline-end":"order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]","block-start":"order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5","block-end":"order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5"}},defaultVariants:{align:"inline-start"}});function dt(o){var r=o,{className:e,align:t="inline-start"}=r,a=chunkXOGHUQYC_cjs.c(r,["className","align"]);return jsxRuntime.jsx("div",chunkXOGHUQYC_cjs.a({role:"group","data-slot":"input-group-addon","data-align":t,className:b(ti({align:t}),e),onClick:n=>{var s,d;n.target.closest("button")||(d=(s=n.currentTarget.parentElement)==null?void 0:s.querySelector("input"))==null||d.focus();}},a))}classVarianceAuthority.cva("text-sm shadow-none flex gap-2 items-center",{variants:{size:{xs:"h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",sm:"h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function ct(a){var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx("span",chunkXOGHUQYC_cjs.a({className:b("text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",e)},t))}function ut(a){var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx(Pt,chunkXOGHUQYC_cjs.a({"data-slot":"input-group-control",className:b("flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent",e)},t))}function tr({file:e,onClose:t,onSave:a}){var N;let[o,r]=yi.useState(false),[n,s]=yi.useState(e.name),[d,l]=yi.useState(e.alternativeText||""),[v,u]=yi.useState(e.caption||""),p=async()=>{r(true);try{await(a==null?void 0:a({name:n,alternativeText:d,caption:v})),t();}finally{r(false);}},F=jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex gap-2 mb-4",children:[jsxRuntime.jsx(ot,{file:e}),jsxRuntime.jsx(at,{file:e}),jsxRuntime.jsx(rt,{file:e}),jsxRuntime.jsx(Ja,{onFullscreen:()=>window.open(e.url,"_blank")})]}),jsxRuntime.jsx("div",{className:"flex-1 flex items-center justify-center bg-gray-50 rounded-lg overflow-hidden",style:{backgroundImage:`
75
75
  linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
76
76
  linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
77
77
  linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
78
78
  linear-gradient(-45deg, transparent 75%, #e5e7eb 75%)
79
- `,backgroundSize:"20px 20px",backgroundPosition:"0 0, 0 10px, 10px -10px, -10px 0px"},children:jsxRuntime.jsx("img",{src:e.previewUrl||e.url,alt:e.alternativeText||e.name,className:"max-w-full max-h-full object-contain"})})]}),c=jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Size"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:re(e.size)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Dimensions"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:e.width&&e.height?`${e.width}\xD7${e.height}`:"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Date"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:nt(e.createdAt)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Extension"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:((N=e.ext)==null?void 0:N.replace(".",""))||"N/A"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-4 pt-4 border-t border-border",children:[jsxRuntime.jsx("div",{className:"space-y-2",children:jsxRuntime.jsxs(it,{className:"gap-0",children:[jsxRuntime.jsx(st,{htmlFor:"fileName",children:"File name"}),jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx(ut,{id:"fileName",placeholder:"Enter file name",value:n.replace(e.ext||"",""),onChange:x=>s(x.target.value)}),jsxRuntime.jsx(dt,{align:"inline-end",className:"pr-1",children:jsxRuntime.jsx(ct,{className:"font-bold bg-accent rounded-lg py-1 px-3",children:e.ext})})]})]})}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Re,{htmlFor:"altText",children:"Alternative text"}),jsxRuntime.jsx(Ue,{id:"altText",value:d,onChange:x=>l(x.target.value),placeholder:"Describe the image for accessibility",rows:3}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"This text will be displayed if the asset can't be shown."})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Re,{htmlFor:"caption",children:"Caption"}),jsxRuntime.jsx(Ue,{id:"caption",value:v,onChange:x=>u(x.target.value),placeholder:"Add a caption",rows:3})]})]})]});return jsxRuntime.jsx(tt,{title:"Details",open:true,onClose:t,previewSection:F,metadataSection:c,footer:jsxRuntime.jsxs("div",{className:"flex w-full justify-between items-center flex-col sm:flex-row gap-2 ",children:[jsxRuntime.jsx(w,{className:"w-full md:w-auto",variant:"outline",onClick:t,radius:"full",disabled:o,children:"Cancel"}),jsxRuntime.jsxs(w,{className:"w-full md:w-auto",onClick:p,radius:"full",disabled:o,children:[o&&jsxRuntime.jsx(chunkSV5VFLC2_cjs.I,{className:"mr-2 h-4 w-4 animate-spin"}),"Finish"]})]})})}function or({file:e,onClose:t,onSave:a}){var c,h,N;let[o,r]=yi.useState(false),[n,s]=yi.useState(e.name),[d,l]=yi.useState(e.caption||""),v=async()=>{r(true);try{await(a==null?void 0:a({name:n,caption:d})),t();}finally{r(false);}},u=jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex gap-2 mb-4",children:[jsxRuntime.jsx(ot,{file:e}),jsxRuntime.jsx(at,{file:e}),jsxRuntime.jsx(rt,{file:e})]}),jsxRuntime.jsx("div",{className:"flex-1 flex items-center justify-center bg-black rounded-lg overflow-hidden",children:jsxRuntime.jsx("video",{src:e.url,controls:true,className:"max-w-full max-h-full",style:{maxHeight:"500px"},children:"Your browser does not support the video tag."})})]}),p=jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Size"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:re(e.size)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Dimensions"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:e.width&&e.height?`${e.width}\xD7${e.height}`:"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Duration"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:(c=e.metaData)!=null&&c.duration?uo(e.metaData.duration):"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Date"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:nt(e.createdAt)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Extension"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:((h=e.ext)==null?void 0:h.replace(".",""))||"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Video Source"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary capitalize",children:((N=e.metaData)==null?void 0:N.videoSource)||"local"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-4 pt-4 border-t border-border",children:[jsxRuntime.jsx("div",{className:"space-y-2",children:jsxRuntime.jsxs(it,{className:"gap-0",children:[jsxRuntime.jsx(st,{htmlFor:"fileName",children:"File name"}),jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx(ut,{id:"fileName",placeholder:"Enter file name",value:n.replace(e.ext||"",""),onChange:x=>s(x.target.value)}),jsxRuntime.jsx(dt,{align:"inline-end",className:"pr-1",children:jsxRuntime.jsx(ct,{className:"font-bold bg-accent rounded-lg py-1 px-3",children:e.ext})})]})]})}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Re,{htmlFor:"caption",children:"Caption"}),jsxRuntime.jsx(Ue,{id:"caption",value:d,onChange:x=>l(x.target.value),placeholder:"Add a caption",rows:3})]})]})]});return jsxRuntime.jsx(tt,{title:"Details",open:true,onClose:t,previewSection:u,metadataSection:p,footer:jsxRuntime.jsxs("div",{className:"flex w-full sm:justify-between justify-center items-center flex-col sm:flex-row gap-2 ",children:[jsxRuntime.jsx(w,{variant:"outline",onClick:t,radius:"full",className:"w-full md:w-auto",disabled:o,children:"Cancel"}),jsxRuntime.jsxs(w,{onClick:v,radius:"full",className:"w-full md:w-auto",disabled:o,children:[o&&jsxRuntime.jsx(chunkSV5VFLC2_cjs.I,{className:"mr-2 h-4 w-4 animate-spin"}),"Finish"]})]})})}function ar({file:e,onClose:t,onSave:a}){var c,h,N;let[o,r]=yi.useState(false),[n,s]=yi.useState(e.name),[d,l]=yi.useState(e.caption||""),v=async()=>{r(true);try{await(a==null?void 0:a({name:n,caption:d})),t();}finally{r(false);}},u=jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex gap-2 mb-4",children:[jsxRuntime.jsx(ot,{file:e}),jsxRuntime.jsx(at,{file:e}),jsxRuntime.jsx(rt,{file:e})]}),jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center bg-linear-to-br from-purple-50 to-blue-50 dark:from-purple-950 dark:to-blue-950 rounded-lg p-8",children:[jsxRuntime.jsx("div",{className:"mb-8",children:jsxRuntime.jsx("div",{className:"w-32 h-32 rounded-full bg-white dark:bg-gray-800 shadow-lg flex items-center justify-center",children:jsxRuntime.jsx(chunkSV5VFLC2_cjs.n,{className:"w-16 h-16 text-purple-600 dark:text-purple-400"})})}),jsxRuntime.jsx("div",{className:"w-full max-w-md",children:jsxRuntime.jsxs("audio",{src:e.url,controls:true,className:"w-full",children:[jsxRuntime.jsx("track",{kind:"captions",srcLang:"en",label:"English"}),"Your browser does not support the audio tag."]})})]})]}),p=jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Size"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:re(e.size)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Duration"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:(c=e.metaData)!=null&&c.duration?uo(e.metaData.duration):"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Bitrate"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:(h=e.metaData)!=null&&h.bitrate?`${e.metaData.bitrate} kbps`:"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Date"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:nt(e.createdAt)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Extension"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:((N=e.ext)==null?void 0:N.replace(".",""))||"N/A"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-4 pt-4 border-t border-border",children:[jsxRuntime.jsx("div",{className:"space-y-2",children:jsxRuntime.jsxs(it,{className:"gap-0",children:[jsxRuntime.jsx(st,{htmlFor:"fileName",children:"File name"}),jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx(ut,{id:"fileName",placeholder:"Enter file name",value:n.replace(e.ext||"",""),onChange:x=>s(x.target.value)}),jsxRuntime.jsx(dt,{align:"inline-end",className:"pr-1",children:jsxRuntime.jsx(ct,{className:"font-bold bg-accent rounded-lg py-1 px-3",children:e.ext})})]})]})}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Re,{htmlFor:"caption",children:"Caption"}),jsxRuntime.jsx(Ue,{id:"caption",value:d,onChange:x=>l(x.target.value),placeholder:"Add a caption",rows:3})]})]})]});return jsxRuntime.jsx(tt,{title:"Details",open:true,onClose:t,previewSection:u,metadataSection:p,footer:jsxRuntime.jsxs("div",{className:"flex gap-2 w-full sm:justify-between justify-center items-center flex-col sm:flex-row ",children:[jsxRuntime.jsx(w,{variant:"outline",onClick:t,radius:"full",className:"w-full md:w-auto",disabled:o,children:"Cancel"}),jsxRuntime.jsxs(w,{onClick:v,radius:"full",className:"w-full md:w-auto",disabled:o,children:[o&&jsxRuntime.jsx(chunkSV5VFLC2_cjs.I,{className:"mr-2 h-4 w-4 animate-spin"}),"Finish"]})]})})}function rr({file:e,onClose:t,onSave:a}){var N,x,V,C;let[o,r]=yi.useState(false),[n,s]=yi.useState(e.name),[d,l]=yi.useState(((N=e.metaData)==null?void 0:N.description)||""),v=async()=>{r(true);try{await(a==null?void 0:a({name:n,metaData:chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({},e.metaData),{description:d})})),t();}finally{r(false);}},u=((x=e.ext)==null?void 0:x.replace(".",""))||"file",{component:p}=et(e),F=jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex gap-2 mb-4",children:[jsxRuntime.jsx(ot,{file:e}),jsxRuntime.jsx(at,{file:e}),jsxRuntime.jsx(rt,{file:e})]}),jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center bg-linear-to-br from-gray-50 to-gray-100 dark:from-gray-900 dark:to-gray-800 rounded-lg p-8",children:[jsxRuntime.jsx("div",{className:"mb-4 w-32 h-32 flex items-center justify-center",children:jsxRuntime.jsx(p,{file:e,metaData:e.metaData})}),jsxRuntime.jsxs("p",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:[u," File"]})]})]}),c=jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Size"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:re(e.size)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Date"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:nt(e.createdAt)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Extension"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:u})]}),((V=e.metaData)==null?void 0:V.pageCount)&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Page Count"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:e.metaData.pageCount})]}),((C=e.metaData)==null?void 0:C.author)&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Author"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:e.metaData.author})]})]}),jsxRuntime.jsxs("div",{className:"space-y-4 pt-4 border-t border-slate-200",children:[jsxRuntime.jsx("div",{className:"space-y-2",children:jsxRuntime.jsxs(it,{className:"gap-0",children:[jsxRuntime.jsx(st,{htmlFor:"fileName",children:"File name"}),jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx(ut,{id:"fileName",placeholder:"Enter file name",value:n.replace(e.ext||"",""),onChange:I=>s(I.target.value)}),jsxRuntime.jsx(dt,{align:"inline-end",className:"pr-1",children:jsxRuntime.jsx(ct,{className:"font-bold bg-gray-200 dark:bg-zinc-700 rounded-lg py-1 px-3",children:e.ext})})]})]})}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Re,{htmlFor:"description",children:"Description"}),jsxRuntime.jsx(Ue,{id:"description",value:d,onChange:I=>l(I.target.value),placeholder:"Add a description",rows:3})]})]})]});return jsxRuntime.jsx(tt,{title:"Details",open:true,onClose:t,previewSection:F,metadataSection:c,footer:jsxRuntime.jsxs("div",{className:"flex w-full justify-between items-center flex-col sm:flex-row gap-2 ",children:[jsxRuntime.jsx(w,{className:"w-full md:w-auto",variant:"outline",onClick:t,radius:"full",disabled:o,children:"Cancel"}),jsxRuntime.jsxs(w,{className:"w-full md:w-auto",onClick:v,radius:"full",disabled:o,children:[o&&jsxRuntime.jsx(chunkSV5VFLC2_cjs.I,{className:"mr-2 h-4 w-4 animate-spin"}),"Save"]})]})})}function nr({className:e}){let{fileDetailsModalFile:t,setFileDetailsModalFile:a,updateFileMetadata:o}=R(),r=()=>{a(null);},n=async d=>{t&&await o(t.id,d);},s=()=>{if(!t)return null;switch(chunkSV5VFLC2_cjs.N(t.mime,t.ext)){case chunkSV5VFLC2_cjs.f.IMAGE:return jsxRuntime.jsx(tr,{file:t,onClose:r,onSave:n});case chunkSV5VFLC2_cjs.f.VIDEO:return jsxRuntime.jsx(or,{file:t,onClose:r,onSave:n});case chunkSV5VFLC2_cjs.f.AUDIO:return jsxRuntime.jsx(ar,{file:t,onClose:r,onSave:n});case chunkSV5VFLC2_cjs.f.FILE:default:return jsxRuntime.jsx(rr,{file:t,onClose:r,onSave:n})}};return jsxRuntime.jsxs("div",{className:b("",e),children:[jsxRuntime.jsx(Wa,{}),jsxRuntime.jsx(ja,{}),jsxRuntime.jsx(Za,{}),s()]})}function ai(a){var o=a,{children:e}=o,t=chunkSV5VFLC2_cjs.c(o,["children"]);return jsxRuntime.jsx(io,chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({mode:chunkSV5VFLC2_cjs.d.PAGE,selectionMode:chunkSV5VFLC2_cjs.h.MULTIPLE},t),{children:e}))}function ri(d){var l=d,{children:e,fileSelectionMode:t=chunkSV5VFLC2_cjs.h.SINGLE,acceptedFileTypes:a,viewMode:o="grid",onFilesSelected:r,onClose:n}=l,s=chunkSV5VFLC2_cjs.c(l,["children","fileSelectionMode","acceptedFileTypes","viewMode","onFilesSelected","onClose"]);return jsxRuntime.jsx(io,chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({mode:chunkSV5VFLC2_cjs.d.MODAL,selectionMode:t,acceptedFileTypesForModal:a||s.allowedFileTypes,viewMode:o,onFilesSelected:r,onClose:n},s),{children:e}))}var He={Page:ai,Modal:ri,Header:Ca,Footer:wa,Overlays:nr};function sr(){let{setIsMoveFileModalOpen:e}=R();return jsxRuntime.jsxs(w,{variant:"outline",size:"lg",radius:"full",onClick:()=>e(true),className:"text-md font-medium border border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 hover:bg-blue-50 dark:hover:bg-blue-900/40 hover:text-blue-600 dark:hover:text-blue-400 hover:border-blue-300 dark:hover:border-blue-700 shadow-sm transition-all duration-200",children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.s,{className:"size-5"}),jsxRuntime.jsx("span",{className:"hidden sm:inline",children:"Move"})]})}function lr(){let{bulkDelete:e}=R();return jsxRuntime.jsxs(w,{variant:"outline",size:"lg",radius:"full",onClick:e,className:"text-md font-medium border border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 hover:bg-red-50 dark:hover:bg-red-900/40 hover:text-red-600 dark:hover:text-red-400 hover:border-red-300 dark:hover:border-red-700 shadow-sm transition-all duration-200",children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.x,{className:"size-5"}),jsxRuntime.jsx("span",{className:"hidden",children:"Delete"})]})}function dr(){let{handleClearSelection:e}=R();return jsxRuntime.jsxs(w,{variant:"outline",size:"lg",onClick:e,className:"rounded-full text-md font-medium border border-transparent text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 hover:bg-blue-50 dark:hover:bg-blue-900/40 hover:border-blue-300 dark:hover:border-blue-700 hover:font-semibold transition-all duration-200",children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.y,{className:"size-5 transition-colors"}),"Clear"]})}function cr(){let{selectedFiles:e,selectedFolders:t}=R();return e.length+t.length===0?null:jsxRuntime.jsx("div",{className:"w-full",children:jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 sm:flex-initial",children:[jsxRuntime.jsx(sr,{}),jsxRuntime.jsx(lr,{})]}),jsxRuntime.jsx(dr,{})]})})}function ur({className:e}){let{selectedFiles:t,selectedFolders:a}=R();return t.length+a.length===0?null:jsxRuntime.jsx("div",{className:`fixed bottom-0 left-0 right-0 z-50 bg-white/80 dark:bg-zinc-900/80 backdrop-blur-sm border-t border-gray-200 dark:border-zinc-700 shadow-lg ${e||""}`,children:jsxRuntime.jsx("div",{className:"px-4 sm:px-6 py-3 mx-auto",children:jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 sm:flex-initial",children:[jsxRuntime.jsx(sr,{}),jsxRuntime.jsx(lr,{})]}),jsxRuntime.jsx(dr,{})]})})})}function Vo(a){var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx("div",chunkSV5VFLC2_cjs.a({"data-slot":"skeleton",className:b("animate-pulse rounded-md bg-accent",e)},t))}function fo(){let{currentFolder:e,handleFolderClick:t,isLoading:a}=R(),o=()=>{history.back();};return a?jsxRuntime.jsxs("div",{className:"flex item-center w-full",children:[jsxRuntime.jsx(Vo,{className:"rounded-full size-10 mr-2 shrink-0"}),jsxRuntime.jsx(Vo,{className:"min-w-32 rounded-md h-full"})]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:e?jsxRuntime.jsxs("div",{className:"flex items-center flex-1 min-w-0 max-w-[calc(100%-40px)]",children:[jsxRuntime.jsx(w,{variant:"outline",size:"icon",radius:"full",disabled:a,className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 mr-2",onClick:o,children:jsxRuntime.jsx(chunkSV5VFLC2_cjs.v,{className:"size-5 text-gray-900 dark:text-zinc-100",strokeWidth:"1.5"})}),jsxRuntime.jsx("h1",{className:"text-lg flex-1 min-w-0 align-middle font-semibold",children:Ae(e.name,20)})]}):jsxRuntime.jsxs("div",{className:"flex items-center flex-1 min-w-0 max-w-[calc(100%-40px)]",children:[jsxRuntime.jsx(w,{className:"mr-2 shrink-0",radius:"full",variant:"ghost",mode:"icon",size:"icon",onClick:()=>t(null),children:jsxRuntime.jsx(chunkSV5VFLC2_cjs.q,{className:"size-6 text-gray-900 dark:text-zinc-100"})}),jsxRuntime.jsx("h1",{className:"text-lg flex-1 min-w-0 align-middle font-semibold",children:"Home"})]})})}function Wt(t){var e=chunkSV5VFLC2_cjs.c(t,[]);return jsxRuntime.jsx(radixUi.DropdownMenu.Root,chunkSV5VFLC2_cjs.a({"data-slot":"dropdown-menu"},e))}function jt(t){var e=chunkSV5VFLC2_cjs.c(t,[]);return jsxRuntime.jsx(radixUi.DropdownMenu.Trigger,chunkSV5VFLC2_cjs.a({className:"select-none","data-slot":"dropdown-menu-trigger"},e))}function Qt(o){var r=o,{className:e,sideOffset:t=4}=r,a=chunkSV5VFLC2_cjs.c(r,["className","sideOffset"]);return jsxRuntime.jsx(radixUi.DropdownMenu.Portal,{children:jsxRuntime.jsx(radixUi.DropdownMenu.Content,chunkSV5VFLC2_cjs.a({"data-slot":"dropdown-menu-content",sideOffset:t,className:b("space-y-0.5 z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover p-2 text-popover-foreground shadow-md shadow-black/5 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e)},a))})}function Ke(r){var n=r,{className:e,inset:t,variant:a}=n,o=chunkSV5VFLC2_cjs.c(n,["className","inset","variant"]);return jsxRuntime.jsx(radixUi.DropdownMenu.Item,chunkSV5VFLC2_cjs.a({"data-slot":"dropdown-menu-item",className:b("text-foreground relative flex cursor-default select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-hidden transition-colors data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([role=img]):not([class*=text-])]:opacity-60 [&_svg:not([class*=size-])]:size-4 [&_svg]:shrink-0","focus:bg-accent focus:text-foreground","data-[active=true]:bg-accent data-[active=true]:text-accent-foreground",t&&"ps-8",a==="destructive"&&"text-destructive hover:text-destructive focus:text-destructive hover:bg-destructive/5 focus:bg-destructive/5 data-[active=true]:bg-destructive/5",e)},o))}function mr(a){var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx(radixUi.DropdownMenu.Separator,chunkSV5VFLC2_cjs.a({"data-slot":"dropdown-menu-separator",className:b("-mx-2 my-1.5 h-px bg-muted",e)},t))}function si(a){var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx(cmdk.Command,chunkSV5VFLC2_cjs.a({className:b("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e)},t))}var pr=r=>{var n=r,{children:e,className:t,shouldFilter:a}=n,o=chunkSV5VFLC2_cjs.c(n,["children","className","shouldFilter"]);return jsxRuntime.jsx(we,chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({},o),{children:jsxRuntime.jsxs(Ce,{className:b("overflow-hidden p-0 shadow-lg",t),children:[jsxRuntime.jsx(Fe,{className:"hidden"}),jsxRuntime.jsx(si,{shouldFilter:a,className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})]})}))};function fr(a){var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsxs("div",{className:"flex items-center border-border border-b px-3","cmdk-input-wrapper":"","data-slot":"command-input",children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.r,{className:"me-2 h-4 w-4 shrink-0 opacity-50"}),jsxRuntime.jsx(cmdk.Command.Input,chunkSV5VFLC2_cjs.a({className:b("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none! shadow-none! focus:outline-none focus:ring-0 focus-visible:outline-none focus-visible:ring-0 border-none text-foreground placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e)},t))]})}function gr(a){var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx(cmdk.Command.List,chunkSV5VFLC2_cjs.a({"data-slot":"command-list",className:b("max-h-[300px] overflow-y-auto overflow-x-hidden",e)},t))}function go(t){var e=chunkSV5VFLC2_cjs.c(t,[]);return jsxRuntime.jsx(cmdk.Command.Empty,chunkSV5VFLC2_cjs.a({"data-slot":"command-empty",className:"py-6 text-center text-sm"},e))}function Ho(a){var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx(cmdk.Command.Group,chunkSV5VFLC2_cjs.a({"data-slot":"command-group",className:b("overflow-hidden p-1.5 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e)},t))}function $o(a){var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx(cmdk.Command.Item,chunkSV5VFLC2_cjs.a({"data-slot":"command-item",className:b("relative flex text-foreground cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-hidden data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0","[&_svg:not([role=img]):not([class*=text-])]:opacity-60",e)},t))}function vo(e,t=500){let[a,o]=yi.useState(e);return yi.useEffect(()=>{let r=setTimeout(()=>{o(e);},t);return ()=>{clearTimeout(r);}},[e,t]),a}function Ko(){let[e,t]=yi.useState(""),[a,o]=yi.useState([]),[r,n]=yi.useState([]),[s,d]=yi.useState(false),{provider:l,handleFolderClick:v,handleClearSelection:u,isSearchModalOpen:p,setIsSearchModalOpen:F,setFileDetailsModalFile:c}=R(),h=vo(e,300),N=yi.useCallback(async C=>{d(true);try{let[I,D]=await Promise.all([l.findFiles(C),l.findFolders(C)]);o(I),n(D);}catch(I){let D=I instanceof Error?I.message:"Search failed";sonner.toast.error("Search Failed",{description:D}),o([]),n([]);}finally{d(false);}},[l]);return yi.useEffect(()=>{p&&h.length>0?N(h):(o([]),n([]));},[h,p,N]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(w,{variant:"outline",size:"icon",radius:"full",className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",onClick:()=>F(true),children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.r,{className:"size-4 text-gray-700 dark:text-zinc-300"}),jsxRuntime.jsx("span",{className:"hidden",children:"Search"})]}),jsxRuntime.jsxs(pr,{className:"max-w-4xl w-full",open:p,onOpenChange:C=>{F(C),C||(t(""),o([]),n([]));},shouldFilter:false,children:[jsxRuntime.jsx(fr,{placeholder:"Type to search files or folders...",value:e,onValueChange:C=>{t(C);}}),jsxRuntime.jsxs(gr,{children:[s&&jsxRuntime.jsx(go,{children:"Searching..."}),!s&&a.length===0&&r.length===0&&!e&&jsxRuntime.jsx(go,{children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-8 px-4 text-center",children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.r,{className:"size-12 text-gray-300 dark:text-zinc-600 mb-3"}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-zinc-100 mb-1",children:"Search your files and folders"}),jsxRuntime.jsx("p",{className:"text-xs text-gray-500 dark:text-zinc-400",children:"Start typing to find what you're looking for"}),jsxRuntime.jsx("p",{className:"text-xs text-gray-500 dark:text-zinc-400 mt-2",children:jsxRuntime.jsx(Dt,{children:jsxRuntime.jsxs(kt,{children:[jsxRuntime.jsx("span",{className:"text-lg",children:"\u2318"})," + K"]})})})]})}),!s&&a.length===0&&r.length===0&&e&&jsxRuntime.jsx(go,{children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-8 px-4 text-center",children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.r,{className:"size-12 text-gray-300 dark:text-zinc-600 mb-3"}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-zinc-100 mb-1",children:"No results found"}),jsxRuntime.jsx("p",{className:"text-xs text-gray-500 dark:text-zinc-400",children:"Try searching with different keywords"})]})}),r.length>0&&jsxRuntime.jsx(Ho,{heading:"Folders",children:r.map(C=>jsxRuntime.jsxs($o,{onSelect:()=>{u(),F(false),v(C);},children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.p,{className:"size-4 mr-2 shrink-0",strokeWidth:1.5}),jsxRuntime.jsx("span",{children:Ae(C.name,60)})]},C.id))}),a.length>0&&jsxRuntime.jsx(Ho,{heading:"Files",children:a.map(C=>{let{component:I}=et(C);return jsxRuntime.jsxs($o,{onSelect:()=>{u(),c(C);},children:[jsxRuntime.jsx("div",{className:"size-6 mr-2 shrink-0 flex items-center justify-center",children:jsxRuntime.jsx(I,{file:C,metaData:C.metaData})}),jsxRuntime.jsx("span",{children:Ae(C.name,60)})]},C.id)})})]})]})]})}var gi=classVarianceAuthority.cva(`
79
+ `,backgroundSize:"20px 20px",backgroundPosition:"0 0, 0 10px, 10px -10px, -10px 0px"},children:jsxRuntime.jsx("img",{src:e.previewUrl||e.url,alt:e.alternativeText||e.name,className:"max-w-full max-h-full object-contain"})})]}),c=jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Size"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:re(e.size)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Dimensions"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:e.width&&e.height?`${e.width}\xD7${e.height}`:"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Date"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:nt(e.createdAt)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Extension"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:((N=e.ext)==null?void 0:N.replace(".",""))||"N/A"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-4 pt-4 border-t border-border",children:[jsxRuntime.jsx("div",{className:"space-y-2",children:jsxRuntime.jsxs(it,{className:"gap-0",children:[jsxRuntime.jsx(st,{htmlFor:"fileName",children:"File name"}),jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx(ut,{id:"fileName",placeholder:"Enter file name",value:n.replace(e.ext||"",""),onChange:x=>s(x.target.value)}),jsxRuntime.jsx(dt,{align:"inline-end",className:"pr-1",children:jsxRuntime.jsx(ct,{className:"font-bold bg-accent rounded-lg py-1 px-3",children:e.ext})})]})]})}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Re,{htmlFor:"altText",children:"Alternative text"}),jsxRuntime.jsx(Ue,{id:"altText",value:d,onChange:x=>l(x.target.value),placeholder:"Describe the image for accessibility",rows:3}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"This text will be displayed if the asset can't be shown."})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Re,{htmlFor:"caption",children:"Caption"}),jsxRuntime.jsx(Ue,{id:"caption",value:v,onChange:x=>u(x.target.value),placeholder:"Add a caption",rows:3})]})]})]});return jsxRuntime.jsx(tt,{title:"Details",open:true,onClose:t,previewSection:F,metadataSection:c,footer:jsxRuntime.jsxs("div",{className:"flex w-full justify-between items-center flex-col sm:flex-row gap-2 ",children:[jsxRuntime.jsx(w,{className:"w-full md:w-auto",variant:"outline",onClick:t,radius:"full",disabled:o,children:"Cancel"}),jsxRuntime.jsxs(w,{className:"w-full md:w-auto",onClick:p,radius:"full",disabled:o,children:[o&&jsxRuntime.jsx(chunkXOGHUQYC_cjs.I,{className:"mr-2 h-4 w-4 animate-spin"}),"Finish"]})]})})}function or({file:e,onClose:t,onSave:a}){var c,h,N;let[o,r]=yi.useState(false),[n,s]=yi.useState(e.name),[d,l]=yi.useState(e.caption||""),v=async()=>{r(true);try{await(a==null?void 0:a({name:n,caption:d})),t();}finally{r(false);}},u=jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex gap-2 mb-4",children:[jsxRuntime.jsx(ot,{file:e}),jsxRuntime.jsx(at,{file:e}),jsxRuntime.jsx(rt,{file:e})]}),jsxRuntime.jsx("div",{className:"flex-1 flex items-center justify-center bg-black rounded-lg overflow-hidden",children:jsxRuntime.jsx("video",{src:e.url,controls:true,className:"max-w-full max-h-full",style:{maxHeight:"500px"},children:"Your browser does not support the video tag."})})]}),p=jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Size"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:re(e.size)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Dimensions"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:e.width&&e.height?`${e.width}\xD7${e.height}`:"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Duration"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:(c=e.metaData)!=null&&c.duration?uo(e.metaData.duration):"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Date"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:nt(e.createdAt)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Extension"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:((h=e.ext)==null?void 0:h.replace(".",""))||"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Video Source"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary capitalize",children:((N=e.metaData)==null?void 0:N.videoSource)||"local"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-4 pt-4 border-t border-border",children:[jsxRuntime.jsx("div",{className:"space-y-2",children:jsxRuntime.jsxs(it,{className:"gap-0",children:[jsxRuntime.jsx(st,{htmlFor:"fileName",children:"File name"}),jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx(ut,{id:"fileName",placeholder:"Enter file name",value:n.replace(e.ext||"",""),onChange:x=>s(x.target.value)}),jsxRuntime.jsx(dt,{align:"inline-end",className:"pr-1",children:jsxRuntime.jsx(ct,{className:"font-bold bg-accent rounded-lg py-1 px-3",children:e.ext})})]})]})}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Re,{htmlFor:"caption",children:"Caption"}),jsxRuntime.jsx(Ue,{id:"caption",value:d,onChange:x=>l(x.target.value),placeholder:"Add a caption",rows:3})]})]})]});return jsxRuntime.jsx(tt,{title:"Details",open:true,onClose:t,previewSection:u,metadataSection:p,footer:jsxRuntime.jsxs("div",{className:"flex w-full sm:justify-between justify-center items-center flex-col sm:flex-row gap-2 ",children:[jsxRuntime.jsx(w,{variant:"outline",onClick:t,radius:"full",className:"w-full md:w-auto",disabled:o,children:"Cancel"}),jsxRuntime.jsxs(w,{onClick:v,radius:"full",className:"w-full md:w-auto",disabled:o,children:[o&&jsxRuntime.jsx(chunkXOGHUQYC_cjs.I,{className:"mr-2 h-4 w-4 animate-spin"}),"Finish"]})]})})}function ar({file:e,onClose:t,onSave:a}){var c,h,N;let[o,r]=yi.useState(false),[n,s]=yi.useState(e.name),[d,l]=yi.useState(e.caption||""),v=async()=>{r(true);try{await(a==null?void 0:a({name:n,caption:d})),t();}finally{r(false);}},u=jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex gap-2 mb-4",children:[jsxRuntime.jsx(ot,{file:e}),jsxRuntime.jsx(at,{file:e}),jsxRuntime.jsx(rt,{file:e})]}),jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center bg-linear-to-br from-purple-50 to-blue-50 dark:from-purple-950 dark:to-blue-950 rounded-lg p-8",children:[jsxRuntime.jsx("div",{className:"mb-8",children:jsxRuntime.jsx("div",{className:"w-32 h-32 rounded-full bg-white dark:bg-gray-800 shadow-lg flex items-center justify-center",children:jsxRuntime.jsx(chunkXOGHUQYC_cjs.n,{className:"w-16 h-16 text-purple-600 dark:text-purple-400"})})}),jsxRuntime.jsx("div",{className:"w-full max-w-md",children:jsxRuntime.jsxs("audio",{src:e.url,controls:true,className:"w-full",children:[jsxRuntime.jsx("track",{kind:"captions",srcLang:"en",label:"English"}),"Your browser does not support the audio tag."]})})]})]}),p=jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Size"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:re(e.size)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Duration"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:(c=e.metaData)!=null&&c.duration?uo(e.metaData.duration):"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Bitrate"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:(h=e.metaData)!=null&&h.bitrate?`${e.metaData.bitrate} kbps`:"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Date"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:nt(e.createdAt)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Extension"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-primary",children:((N=e.ext)==null?void 0:N.replace(".",""))||"N/A"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-4 pt-4 border-t border-border",children:[jsxRuntime.jsx("div",{className:"space-y-2",children:jsxRuntime.jsxs(it,{className:"gap-0",children:[jsxRuntime.jsx(st,{htmlFor:"fileName",children:"File name"}),jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx(ut,{id:"fileName",placeholder:"Enter file name",value:n.replace(e.ext||"",""),onChange:x=>s(x.target.value)}),jsxRuntime.jsx(dt,{align:"inline-end",className:"pr-1",children:jsxRuntime.jsx(ct,{className:"font-bold bg-accent rounded-lg py-1 px-3",children:e.ext})})]})]})}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Re,{htmlFor:"caption",children:"Caption"}),jsxRuntime.jsx(Ue,{id:"caption",value:d,onChange:x=>l(x.target.value),placeholder:"Add a caption",rows:3})]})]})]});return jsxRuntime.jsx(tt,{title:"Details",open:true,onClose:t,previewSection:u,metadataSection:p,footer:jsxRuntime.jsxs("div",{className:"flex gap-2 w-full sm:justify-between justify-center items-center flex-col sm:flex-row ",children:[jsxRuntime.jsx(w,{variant:"outline",onClick:t,radius:"full",className:"w-full md:w-auto",disabled:o,children:"Cancel"}),jsxRuntime.jsxs(w,{onClick:v,radius:"full",className:"w-full md:w-auto",disabled:o,children:[o&&jsxRuntime.jsx(chunkXOGHUQYC_cjs.I,{className:"mr-2 h-4 w-4 animate-spin"}),"Finish"]})]})})}function rr({file:e,onClose:t,onSave:a}){var N,x,V,C;let[o,r]=yi.useState(false),[n,s]=yi.useState(e.name),[d,l]=yi.useState(((N=e.metaData)==null?void 0:N.description)||""),v=async()=>{r(true);try{await(a==null?void 0:a({name:n,metaData:chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({},e.metaData),{description:d})})),t();}finally{r(false);}},u=((x=e.ext)==null?void 0:x.replace(".",""))||"file",{component:p}=et(e),F=jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex gap-2 mb-4",children:[jsxRuntime.jsx(ot,{file:e}),jsxRuntime.jsx(at,{file:e}),jsxRuntime.jsx(rt,{file:e})]}),jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center bg-linear-to-br from-gray-50 to-gray-100 dark:from-gray-900 dark:to-gray-800 rounded-lg p-8",children:[jsxRuntime.jsx("div",{className:"mb-4 w-32 h-32 flex items-center justify-center",children:jsxRuntime.jsx(p,{file:e,metaData:e.metaData})}),jsxRuntime.jsxs("p",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:[u," File"]})]})]}),c=jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Size"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:re(e.size)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Date"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:nt(e.createdAt)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Extension"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:u})]}),((V=e.metaData)==null?void 0:V.pageCount)&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Page Count"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:e.metaData.pageCount})]}),((C=e.metaData)==null?void 0:C.author)&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Author"}),jsxRuntime.jsx("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:e.metaData.author})]})]}),jsxRuntime.jsxs("div",{className:"space-y-4 pt-4 border-t border-slate-200",children:[jsxRuntime.jsx("div",{className:"space-y-2",children:jsxRuntime.jsxs(it,{className:"gap-0",children:[jsxRuntime.jsx(st,{htmlFor:"fileName",children:"File name"}),jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx(ut,{id:"fileName",placeholder:"Enter file name",value:n.replace(e.ext||"",""),onChange:I=>s(I.target.value)}),jsxRuntime.jsx(dt,{align:"inline-end",className:"pr-1",children:jsxRuntime.jsx(ct,{className:"font-bold bg-gray-200 dark:bg-zinc-700 rounded-lg py-1 px-3",children:e.ext})})]})]})}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Re,{htmlFor:"description",children:"Description"}),jsxRuntime.jsx(Ue,{id:"description",value:d,onChange:I=>l(I.target.value),placeholder:"Add a description",rows:3})]})]})]});return jsxRuntime.jsx(tt,{title:"Details",open:true,onClose:t,previewSection:F,metadataSection:c,footer:jsxRuntime.jsxs("div",{className:"flex w-full justify-between items-center flex-col sm:flex-row gap-2 ",children:[jsxRuntime.jsx(w,{className:"w-full md:w-auto",variant:"outline",onClick:t,radius:"full",disabled:o,children:"Cancel"}),jsxRuntime.jsxs(w,{className:"w-full md:w-auto",onClick:v,radius:"full",disabled:o,children:[o&&jsxRuntime.jsx(chunkXOGHUQYC_cjs.I,{className:"mr-2 h-4 w-4 animate-spin"}),"Save"]})]})})}function nr({className:e}){let{fileDetailsModalFile:t,setFileDetailsModalFile:a,updateFileMetadata:o}=R(),r=()=>{a(null);},n=async d=>{t&&await o(t.id,d);},s=()=>{if(!t)return null;switch(chunkXOGHUQYC_cjs.N(t.mime,t.ext)){case chunkXOGHUQYC_cjs.f.IMAGE:return jsxRuntime.jsx(tr,{file:t,onClose:r,onSave:n});case chunkXOGHUQYC_cjs.f.VIDEO:return jsxRuntime.jsx(or,{file:t,onClose:r,onSave:n});case chunkXOGHUQYC_cjs.f.AUDIO:return jsxRuntime.jsx(ar,{file:t,onClose:r,onSave:n});case chunkXOGHUQYC_cjs.f.FILE:default:return jsxRuntime.jsx(rr,{file:t,onClose:r,onSave:n})}};return jsxRuntime.jsxs("div",{className:b("",e),children:[jsxRuntime.jsx(Wa,{}),jsxRuntime.jsx(ja,{}),jsxRuntime.jsx(Za,{}),s()]})}function ai(a){var o=a,{children:e}=o,t=chunkXOGHUQYC_cjs.c(o,["children"]);return jsxRuntime.jsx(io,chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({mode:chunkXOGHUQYC_cjs.d.PAGE,selectionMode:chunkXOGHUQYC_cjs.h.MULTIPLE},t),{children:e}))}function ri(d){var l=d,{children:e,fileSelectionMode:t=chunkXOGHUQYC_cjs.h.SINGLE,acceptedFileTypes:a,viewMode:o="grid",onFilesSelected:r,onClose:n}=l,s=chunkXOGHUQYC_cjs.c(l,["children","fileSelectionMode","acceptedFileTypes","viewMode","onFilesSelected","onClose"]);return jsxRuntime.jsx(io,chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({mode:chunkXOGHUQYC_cjs.d.MODAL,selectionMode:t,acceptedFileTypesForModal:a||s.allowedFileTypes,viewMode:o,onFilesSelected:r,onClose:n},s),{children:e}))}var He={Page:ai,Modal:ri,Header:Ca,Footer:wa,Overlays:nr};function sr(){let{setIsMoveFileModalOpen:e}=R();return jsxRuntime.jsxs(w,{variant:"outline",size:"lg",radius:"full",onClick:()=>e(true),className:"text-md font-medium border border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 hover:bg-blue-50 dark:hover:bg-blue-900/40 hover:text-blue-600 dark:hover:text-blue-400 hover:border-blue-300 dark:hover:border-blue-700 shadow-sm transition-all duration-200",children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.s,{className:"size-5"}),jsxRuntime.jsx("span",{className:"hidden sm:inline",children:"Move"})]})}function lr(){let{bulkDelete:e}=R();return jsxRuntime.jsxs(w,{variant:"outline",size:"lg",radius:"full",onClick:e,className:"text-md font-medium border border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 hover:bg-red-50 dark:hover:bg-red-900/40 hover:text-red-600 dark:hover:text-red-400 hover:border-red-300 dark:hover:border-red-700 shadow-sm transition-all duration-200",children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.x,{className:"size-5"}),jsxRuntime.jsx("span",{className:"hidden",children:"Delete"})]})}function dr(){let{handleClearSelection:e}=R();return jsxRuntime.jsxs(w,{variant:"outline",size:"lg",onClick:e,className:"rounded-full text-md font-medium border border-transparent text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 hover:bg-blue-50 dark:hover:bg-blue-900/40 hover:border-blue-300 dark:hover:border-blue-700 hover:font-semibold transition-all duration-200",children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.y,{className:"size-5 transition-colors"}),"Clear"]})}function cr(){let{selectedFiles:e,selectedFolders:t}=R();return e.length+t.length===0?null:jsxRuntime.jsx("div",{className:"w-full",children:jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 sm:flex-initial",children:[jsxRuntime.jsx(sr,{}),jsxRuntime.jsx(lr,{})]}),jsxRuntime.jsx(dr,{})]})})}function ur({className:e}){let{selectedFiles:t,selectedFolders:a}=R();return t.length+a.length===0?null:jsxRuntime.jsx("div",{className:`fixed bottom-0 left-0 right-0 z-50 bg-white/80 dark:bg-zinc-900/80 backdrop-blur-sm border-t border-gray-200 dark:border-zinc-700 shadow-lg ${e||""}`,children:jsxRuntime.jsx("div",{className:"px-4 sm:px-6 py-3 mx-auto",children:jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 sm:flex-initial",children:[jsxRuntime.jsx(sr,{}),jsxRuntime.jsx(lr,{})]}),jsxRuntime.jsx(dr,{})]})})})}function Vo(a){var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx("div",chunkXOGHUQYC_cjs.a({"data-slot":"skeleton",className:b("animate-pulse rounded-md bg-accent",e)},t))}function fo(){let{currentFolder:e,handleFolderClick:t,isLoading:a}=R(),o=()=>{history.back();};return a?jsxRuntime.jsxs("div",{className:"flex item-center w-full",children:[jsxRuntime.jsx(Vo,{className:"rounded-full size-10 mr-2 shrink-0"}),jsxRuntime.jsx(Vo,{className:"min-w-32 rounded-md h-full"})]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:e?jsxRuntime.jsxs("div",{className:"flex items-center flex-1 min-w-0 max-w-[calc(100%-40px)]",children:[jsxRuntime.jsx(w,{variant:"outline",size:"icon",radius:"full",disabled:a,className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 mr-2",onClick:o,children:jsxRuntime.jsx(chunkXOGHUQYC_cjs.v,{className:"size-5 text-gray-900 dark:text-zinc-100",strokeWidth:"1.5"})}),jsxRuntime.jsx("h1",{className:"text-lg flex-1 min-w-0 align-middle font-semibold",children:Ae(e.name,20)})]}):jsxRuntime.jsxs("div",{className:"flex items-center flex-1 min-w-0 max-w-[calc(100%-40px)]",children:[jsxRuntime.jsx(w,{className:"mr-2 shrink-0",radius:"full",variant:"ghost",mode:"icon",size:"icon",onClick:()=>t(null),children:jsxRuntime.jsx(chunkXOGHUQYC_cjs.q,{className:"size-6 text-gray-900 dark:text-zinc-100"})}),jsxRuntime.jsx("h1",{className:"text-lg flex-1 min-w-0 align-middle font-semibold",children:"Home"})]})})}function Wt(t){var e=chunkXOGHUQYC_cjs.c(t,[]);return jsxRuntime.jsx(radixUi.DropdownMenu.Root,chunkXOGHUQYC_cjs.a({"data-slot":"dropdown-menu"},e))}function jt(t){var e=chunkXOGHUQYC_cjs.c(t,[]);return jsxRuntime.jsx(radixUi.DropdownMenu.Trigger,chunkXOGHUQYC_cjs.a({className:"select-none","data-slot":"dropdown-menu-trigger"},e))}function Qt(o){var r=o,{className:e,sideOffset:t=4}=r,a=chunkXOGHUQYC_cjs.c(r,["className","sideOffset"]);return jsxRuntime.jsx(radixUi.DropdownMenu.Portal,{children:jsxRuntime.jsx(radixUi.DropdownMenu.Content,chunkXOGHUQYC_cjs.a({"data-slot":"dropdown-menu-content",sideOffset:t,className:b("space-y-0.5 z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover p-2 text-popover-foreground shadow-md shadow-black/5 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e)},a))})}function Ke(r){var n=r,{className:e,inset:t,variant:a}=n,o=chunkXOGHUQYC_cjs.c(n,["className","inset","variant"]);return jsxRuntime.jsx(radixUi.DropdownMenu.Item,chunkXOGHUQYC_cjs.a({"data-slot":"dropdown-menu-item",className:b("text-foreground relative flex cursor-default select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-hidden transition-colors data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([role=img]):not([class*=text-])]:opacity-60 [&_svg:not([class*=size-])]:size-4 [&_svg]:shrink-0","focus:bg-accent focus:text-foreground","data-[active=true]:bg-accent data-[active=true]:text-accent-foreground",t&&"ps-8",a==="destructive"&&"text-destructive hover:text-destructive focus:text-destructive hover:bg-destructive/5 focus:bg-destructive/5 data-[active=true]:bg-destructive/5",e)},o))}function mr(a){var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx(radixUi.DropdownMenu.Separator,chunkXOGHUQYC_cjs.a({"data-slot":"dropdown-menu-separator",className:b("-mx-2 my-1.5 h-px bg-muted",e)},t))}function si(a){var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx(cmdk.Command,chunkXOGHUQYC_cjs.a({className:b("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e)},t))}var pr=r=>{var n=r,{children:e,className:t,shouldFilter:a}=n,o=chunkXOGHUQYC_cjs.c(n,["children","className","shouldFilter"]);return jsxRuntime.jsx(we,chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({},o),{children:jsxRuntime.jsxs(Ce,{className:b("overflow-hidden p-0 shadow-lg",t),children:[jsxRuntime.jsx(Fe,{className:"hidden"}),jsxRuntime.jsx(si,{shouldFilter:a,className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})]})}))};function fr(a){var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsxs("div",{className:"flex items-center border-border border-b px-3","cmdk-input-wrapper":"","data-slot":"command-input",children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.r,{className:"me-2 h-4 w-4 shrink-0 opacity-50"}),jsxRuntime.jsx(cmdk.Command.Input,chunkXOGHUQYC_cjs.a({className:b("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none! shadow-none! focus:outline-none focus:ring-0 focus-visible:outline-none focus-visible:ring-0 border-none text-foreground placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e)},t))]})}function gr(a){var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx(cmdk.Command.List,chunkXOGHUQYC_cjs.a({"data-slot":"command-list",className:b("max-h-[300px] overflow-y-auto overflow-x-hidden",e)},t))}function go(t){var e=chunkXOGHUQYC_cjs.c(t,[]);return jsxRuntime.jsx(cmdk.Command.Empty,chunkXOGHUQYC_cjs.a({"data-slot":"command-empty",className:"py-6 text-center text-sm"},e))}function Ho(a){var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx(cmdk.Command.Group,chunkXOGHUQYC_cjs.a({"data-slot":"command-group",className:b("overflow-hidden p-1.5 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e)},t))}function $o(a){var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx(cmdk.Command.Item,chunkXOGHUQYC_cjs.a({"data-slot":"command-item",className:b("relative flex text-foreground cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-hidden data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0","[&_svg:not([role=img]):not([class*=text-])]:opacity-60",e)},t))}function vo(e,t=500){let[a,o]=yi.useState(e);return yi.useEffect(()=>{let r=setTimeout(()=>{o(e);},t);return ()=>{clearTimeout(r);}},[e,t]),a}function Ko(){let[e,t]=yi.useState(""),[a,o]=yi.useState([]),[r,n]=yi.useState([]),[s,d]=yi.useState(false),{provider:l,handleFolderClick:v,handleClearSelection:u,isSearchModalOpen:p,setIsSearchModalOpen:F,setFileDetailsModalFile:c}=R(),h=vo(e,300),N=yi.useCallback(async C=>{d(true);try{let[I,D]=await Promise.all([l.findFiles(C),l.findFolders(C)]);o(I),n(D);}catch(I){let D=I instanceof Error?I.message:"Search failed";sonner.toast.error("Search Failed",{description:D}),o([]),n([]);}finally{d(false);}},[l]);return yi.useEffect(()=>{p&&h.length>0?N(h):(o([]),n([]));},[h,p,N]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(w,{variant:"outline",size:"icon",radius:"full",className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",onClick:()=>F(true),children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.r,{className:"size-4 text-gray-700 dark:text-zinc-300"}),jsxRuntime.jsx("span",{className:"hidden",children:"Search"})]}),jsxRuntime.jsxs(pr,{className:"max-w-4xl w-full",open:p,onOpenChange:C=>{F(C),C||(t(""),o([]),n([]));},shouldFilter:false,children:[jsxRuntime.jsx(fr,{placeholder:"Type to search files or folders...",value:e,onValueChange:C=>{t(C);}}),jsxRuntime.jsxs(gr,{children:[s&&jsxRuntime.jsx(go,{children:"Searching..."}),!s&&a.length===0&&r.length===0&&!e&&jsxRuntime.jsx(go,{children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-8 px-4 text-center",children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.r,{className:"size-12 text-gray-300 dark:text-zinc-600 mb-3"}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-zinc-100 mb-1",children:"Search your files and folders"}),jsxRuntime.jsx("p",{className:"text-xs text-gray-500 dark:text-zinc-400",children:"Start typing to find what you're looking for"}),jsxRuntime.jsx("p",{className:"text-xs text-gray-500 dark:text-zinc-400 mt-2",children:jsxRuntime.jsx(Dt,{children:jsxRuntime.jsxs(kt,{children:[jsxRuntime.jsx("span",{className:"text-lg",children:"\u2318"})," + K"]})})})]})}),!s&&a.length===0&&r.length===0&&e&&jsxRuntime.jsx(go,{children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-8 px-4 text-center",children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.r,{className:"size-12 text-gray-300 dark:text-zinc-600 mb-3"}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-zinc-100 mb-1",children:"No results found"}),jsxRuntime.jsx("p",{className:"text-xs text-gray-500 dark:text-zinc-400",children:"Try searching with different keywords"})]})}),r.length>0&&jsxRuntime.jsx(Ho,{heading:"Folders",children:r.map(C=>jsxRuntime.jsxs($o,{onSelect:()=>{u(),F(false),v(C);},children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.p,{className:"size-4 mr-2 shrink-0",strokeWidth:1.5}),jsxRuntime.jsx("span",{children:Ae(C.name,60)})]},C.id))}),a.length>0&&jsxRuntime.jsx(Ho,{heading:"Files",children:a.map(C=>{let{component:I}=et(C);return jsxRuntime.jsxs($o,{onSelect:()=>{u(),c(C);},children:[jsxRuntime.jsx("div",{className:"size-6 mr-2 shrink-0 flex items-center justify-center",children:jsxRuntime.jsx(I,{file:C,metaData:C.metaData})}),jsxRuntime.jsx("span",{children:Ae(C.name,60)})]},C.id)})})]})]})]})}var gi=classVarianceAuthority.cva(`
80
80
  group peer bg-background shrink-0 rounded-md border border-input ring-offset-background focus-visible:outline-none
81
81
  focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50
82
82
  aria-invalid:border-destructive/60 aria-invalid:ring-destructive/10 dark:aria-invalid:border-destructive dark:aria-invalid:ring-destructive/20
83
83
  [[data-invalid=true]_&]:border-destructive/60 [[data-invalid=true]_&]:ring-destructive/10 dark:[[data-invalid=true]_&]:border-destructive dark:[[data-invalid=true]_&]:ring-destructive/20,
84
84
  data-[state=checked]:bg-primary data-[state=checked]:border-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:bg-primary data-[state=indeterminate]:border-primary data-[state=indeterminate]:text-primary-foreground
85
- `,{variants:{size:{sm:"size-4.5 [&_svg]:size-3",md:"size-5 [&_svg]:size-3.5",lg:"size-5.5 [&_svg]:size-4"}},defaultVariants:{size:"md"}});function bo(o){var r=o,{className:e,size:t}=r,a=chunkSV5VFLC2_cjs.c(r,["className","size"]);return jsxRuntime.jsx(radixUi.Checkbox.Root,chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({"data-slot":"checkbox",className:b(gi({size:t}),e)},a),{children:jsxRuntime.jsxs(radixUi.Checkbox.Indicator,{className:b("flex items-center justify-center text-current"),children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.C,{className:"group-data-[state=indeterminate]:hidden"}),jsxRuntime.jsx(chunkSV5VFLC2_cjs.H,{className:"hidden group-data-[state=indeterminate]:block"})]})}))}function br(){return jsxRuntime.jsx(Ko,{})}function jo(){let{setIsUploadModalOpen:e}=R();return jsxRuntime.jsxs(w,{variant:"outline",size:"md",radius:"full",className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 text-md font-medium",onClick:()=>e(true),children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.w,{strokeWidth:2,className:"size-5 text-gray-900 dark:text-zinc-100"}),jsxRuntime.jsx("span",{className:"hidden sm:inline",children:"Upload File"})]})}function Qo(){let{setIsCreateFolderModalOpen:e}=R();return jsxRuntime.jsxs(w,{variant:"outline",size:"icon",radius:"full",className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",onClick:()=>e(true),children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.t,{className:"size-5 text-gray-900 dark:text-zinc-100"}),jsxRuntime.jsx("span",{className:"hidden",children:"Create Folder"})]})}function yr(e){return jsxRuntime.jsxs("svg",chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e),{children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"}),jsxRuntime.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"})]}))}function wr(e){return jsxRuntime.jsx("svg",chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e),{children:jsxRuntime.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}))}function Cr(){let[e,t]=yi.useState(false);return yi.useEffect(()=>{let r=localStorage.getItem("theme")==="dark";t(r),document.documentElement.classList.toggle("dark",r);},[]),jsxRuntime.jsx(w,{variant:"outline",size:"icon",radius:"full",onClick:()=>{let o=!e;t(o),document.documentElement.classList.toggle("dark",o),localStorage.setItem("theme",o?"dark":"light");},className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900","aria-label":e?"Switch to light mode":"Switch to dark mode",children:e?jsxRuntime.jsx(yr,{className:"size-4 text-yellow-500"}):jsxRuntime.jsx(wr,{className:"size-4 text-gray-700 dark:text-zinc-300"})})}function Fr(){let{setIsUploadModalOpen:e,setIsCreateFolderModalOpen:t,setIsSearchModalOpen:a}=R();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"hidden md:flex gap-2",children:[jsxRuntime.jsx(jo,{}),jsxRuntime.jsx(Qo,{}),jsxRuntime.jsx(br,{}),jsxRuntime.jsx(Cr,{})]}),jsxRuntime.jsx("div",{className:"flex md:hidden",children:jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx(jt,{asChild:true,children:jsxRuntime.jsx(w,{variant:"outline",size:"icon",radius:"full",className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",children:jsxRuntime.jsx(chunkSV5VFLC2_cjs.F,{className:"size-5"})})}),jsxRuntime.jsxs(Qt,{align:"end",className:"w-56 rounded-2xl shadow-xl bg-white/50 dark:bg-zinc-900/80 backdrop-blur-2xl border-gray-200 dark:border-zinc-700",children:[jsxRuntime.jsxs(Ke,{onClick:()=>e(true),className:"cursor-pointer",children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.w,{className:"size-5 text-gray-900 dark:text-zinc-100"}),jsxRuntime.jsx("span",{className:"inline",children:"Upload File"})]}),jsxRuntime.jsxs(Ke,{onClick:()=>t(true),className:"cursor-pointer",children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.t,{className:"size-5 text-gray-900 dark:text-zinc-100"}),jsxRuntime.jsx("span",{className:"inline",children:"Create Folder"})]}),jsxRuntime.jsxs(Ke,{onClick:()=>a(true),className:"cursor-pointer",children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.r,{className:"size-5 text-gray-700 dark:text-zinc-300"}),jsxRuntime.jsx("span",{className:"inline",children:"Search"})]})]})]})})]})}function Nr({onSearchClick:e}){let{setIsUploadModalOpen:t,setIsCreateFolderModalOpen:a}=R();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"hidden md:flex gap-2",children:[jsxRuntime.jsx(jo,{}),jsxRuntime.jsx(Qo,{}),e?jsxRuntime.jsxs(w,{variant:"outline",size:"icon",radius:"full",className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",onClick:e,children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.r,{className:"size-5 text-gray-900 dark:text-zinc-100"}),jsxRuntime.jsx("span",{className:"hidden",children:"Search"})]}):null]}),jsxRuntime.jsx("div",{className:"flex md:hidden",children:jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx(jt,{asChild:true,children:jsxRuntime.jsx(w,{variant:"outline",size:"icon",radius:"full",className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",children:jsxRuntime.jsx(chunkSV5VFLC2_cjs.F,{className:"size-5"})})}),jsxRuntime.jsxs(Qt,{align:"end",className:"w-48",children:[jsxRuntime.jsxs(Ke,{onClick:()=>t(true),className:"cursor-pointer",children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.w,{className:"size-5 text-gray-900 dark:text-zinc-100"}),jsxRuntime.jsx("span",{className:"inline",children:"Upload File"})]}),jsxRuntime.jsxs(Ke,{onClick:()=>a(true),className:"cursor-pointer",children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.t,{className:"size-5 text-gray-900 dark:text-zinc-100"}),jsxRuntime.jsx("span",{className:"inline",children:"Create Folder"})]}),e?jsxRuntime.jsxs(Ke,{onClick:e,className:"cursor-pointer",children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.r,{className:"size-5 text-gray-700 dark:text-zinc-300"}),jsxRuntime.jsx("span",{className:"inline",children:"Search"})]}):null]})]})})]})}function kr(t){var e=chunkSV5VFLC2_cjs.c(t,[]);return jsxRuntime.jsx(X__namespace.Root,chunkSV5VFLC2_cjs.a({"data-slot":"context-menu"},e))}function Dr(t){var e=chunkSV5VFLC2_cjs.c(t,[]);return jsxRuntime.jsx(X__namespace.Trigger,chunkSV5VFLC2_cjs.a({"data-slot":"context-menu-trigger"},e))}function Pr(a){var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx(X__namespace.Portal,{children:jsxRuntime.jsx(X__namespace.Content,chunkSV5VFLC2_cjs.a({"data-slot":"context-menu-content",className:b("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e)},t))})}function Ir(r){var n=r,{className:e,inset:t,variant:a="default"}=n,o=chunkSV5VFLC2_cjs.c(n,["className","inset","variant"]);return jsxRuntime.jsx(X__namespace.Item,chunkSV5VFLC2_cjs.a({"data-slot":"context-menu-item","data-inset":t,"data-variant":a,className:b("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e)},o))}function Sr(a){var o=a,{className:e}=o,t=chunkSV5VFLC2_cjs.c(o,["className"]);return jsxRuntime.jsx(X__namespace.Separator,chunkSV5VFLC2_cjs.a({"data-slot":"context-menu-separator",className:b("bg-border -mx-1 my-1 h-px",e)},t))}function yo({children:e,menuItems:t,isInSelectionMode:a=false,mode:o}){let r=!a&&o!=="modal",n=(s=false)=>t.map((d,l)=>{let v=l===t.length-1,u=d.variant==="destructive",p=s?Ke:Ir,F=s?mr:Sr,c=l<t.length-1&&t[l+1].variant==="destructive";return jsxRuntime.jsxs(yi__default.default.Fragment,{children:[jsxRuntime.jsxs(p,{onClick:d.onClick,className:d.className||`text-sm font-medium ${u?"text-red-600 focus:text-red-700 focus:bg-red-50":""} ${l===0?"rounded-t-xl":""} ${v?"rounded-b-xl":""}`,children:[d.icon,d.label]}),c&&!v&&jsxRuntime.jsx(F,{className:"bg-gray-200 dark:bg-zinc-700"})]},l)});return jsxRuntime.jsxs(kr,{children:[jsxRuntime.jsx(Dr,{children:jsxRuntime.jsxs("div",{className:"relative w-full h-full",children:[e,r&&jsxRuntime.jsx("div",{className:"absolute top-0 right-0 z-10 md:hidden",onClick:s=>s.stopPropagation(),children:jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx(jt,{asChild:true,children:jsxRuntime.jsx(w,{variant:"ghost",size:"icon",radius:"full",className:"focus-visible:ring-0 focus-visible:ring-offset-0",children:jsxRuntime.jsx(chunkSV5VFLC2_cjs.G,{className:"size-4 text-gray-700 dark:text-zinc-300"})})}),jsxRuntime.jsx(Qt,{className:"w-56 rounded-2xl shadow-xl bg-white/50 dark:bg-zinc-900/80 backdrop-blur-2xl border-gray-200 dark:border-zinc-700",children:n(true)})]})})]})}),r&&jsxRuntime.jsx(Pr,{className:"w-56 rounded-2xl shadow-xl bg-white/50 dark:bg-zinc-900/80 backdrop-blur-2xl border-gray-200 dark:border-zinc-700",children:n(false)})]})}function zr({file:e,isSelected:t,onSelect:a,onDelete:o,onEdit:r,onMove:n,selectionMode:s,showCheckbox:d=false,mode:l=chunkSV5VFLC2_cjs.d.PAGE,isInSelectionMode:v=false}){let u=D=>{D.stopPropagation(),confirm(`Are you sure you want to delete "${e.name}"?`)&&o(e.id);},p=D=>{D.stopPropagation(),r(e);},F=D=>{D.stopPropagation(),a(e,void 0,true);},c=D=>{D.stopPropagation(),n(e);},h=D=>{a(e,D,false);},N=()=>{a(e,void 0,true);},x=D=>{D.stopPropagation();},{component:V,metadataComponent:C}=et(e);return jsxRuntime.jsx(yo,{menuItems:[{label:"Edit",icon:jsxRuntime.jsx(chunkSV5VFLC2_cjs.E,{className:"size-6"}),onClick:p},{label:"Select File",icon:jsxRuntime.jsx(chunkSV5VFLC2_cjs.D,{className:"size-6"}),onClick:F},{label:"Move to...",icon:jsxRuntime.jsx(chunkSV5VFLC2_cjs.s,{className:"size-6"}),onClick:c},{label:"Delete",icon:jsxRuntime.jsx(chunkSV5VFLC2_cjs.x,{className:"size-6 text-red-600"}),onClick:u,variant:"destructive"}],isInSelectionMode:v,mode:l,children:jsxRuntime.jsxs("div",{className:"group relative flex flex-col items-center justify-start transition-all duration-200 cursor-pointer w-full select-none",onDoubleClick:h,onClick:h,children:[jsxRuntime.jsxs("div",{className:`
85
+ `,{variants:{size:{sm:"size-4.5 [&_svg]:size-3",md:"size-5 [&_svg]:size-3.5",lg:"size-5.5 [&_svg]:size-4"}},defaultVariants:{size:"md"}});function bo(o){var r=o,{className:e,size:t}=r,a=chunkXOGHUQYC_cjs.c(r,["className","size"]);return jsxRuntime.jsx(radixUi.Checkbox.Root,chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({"data-slot":"checkbox",className:b(gi({size:t}),e)},a),{children:jsxRuntime.jsxs(radixUi.Checkbox.Indicator,{className:b("flex items-center justify-center text-current"),children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.C,{className:"group-data-[state=indeterminate]:hidden"}),jsxRuntime.jsx(chunkXOGHUQYC_cjs.H,{className:"hidden group-data-[state=indeterminate]:block"})]})}))}function br(){return jsxRuntime.jsx(Ko,{})}function jo(){let{setIsUploadModalOpen:e}=R();return jsxRuntime.jsxs(w,{variant:"outline",size:"md",radius:"full",className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 text-md font-medium",onClick:()=>e(true),children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.w,{strokeWidth:2,className:"size-5 text-gray-900 dark:text-zinc-100"}),jsxRuntime.jsx("span",{className:"hidden sm:inline",children:"Upload File"})]})}function Qo(){let{setIsCreateFolderModalOpen:e}=R();return jsxRuntime.jsxs(w,{variant:"outline",size:"icon",radius:"full",className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",onClick:()=>e(true),children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.t,{className:"size-5 text-gray-900 dark:text-zinc-100"}),jsxRuntime.jsx("span",{className:"hidden",children:"Create Folder"})]})}function yr(e){return jsxRuntime.jsxs("svg",chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e),{children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"}),jsxRuntime.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"})]}))}function wr(e){return jsxRuntime.jsx("svg",chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e),{children:jsxRuntime.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}))}function Cr(){let[e,t]=yi.useState(false);return yi.useEffect(()=>{let r=localStorage.getItem("theme")==="dark";t(r),document.documentElement.classList.toggle("dark",r);},[]),jsxRuntime.jsx(w,{variant:"outline",size:"icon",radius:"full",onClick:()=>{let o=!e;t(o),document.documentElement.classList.toggle("dark",o),localStorage.setItem("theme",o?"dark":"light");},className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900","aria-label":e?"Switch to light mode":"Switch to dark mode",children:e?jsxRuntime.jsx(yr,{className:"size-4 text-yellow-500"}):jsxRuntime.jsx(wr,{className:"size-4 text-gray-700 dark:text-zinc-300"})})}function Fr(){let{setIsUploadModalOpen:e,setIsCreateFolderModalOpen:t,setIsSearchModalOpen:a}=R();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"hidden md:flex gap-2",children:[jsxRuntime.jsx(jo,{}),jsxRuntime.jsx(Qo,{}),jsxRuntime.jsx(br,{}),jsxRuntime.jsx(Cr,{})]}),jsxRuntime.jsx("div",{className:"flex md:hidden",children:jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx(jt,{asChild:true,children:jsxRuntime.jsx(w,{variant:"outline",size:"icon",radius:"full",className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",children:jsxRuntime.jsx(chunkXOGHUQYC_cjs.F,{className:"size-5"})})}),jsxRuntime.jsxs(Qt,{align:"end",className:"w-56 rounded-2xl shadow-xl bg-white/50 dark:bg-zinc-900/80 backdrop-blur-2xl border-gray-200 dark:border-zinc-700",children:[jsxRuntime.jsxs(Ke,{onClick:()=>e(true),className:"cursor-pointer",children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.w,{className:"size-5 text-gray-900 dark:text-zinc-100"}),jsxRuntime.jsx("span",{className:"inline",children:"Upload File"})]}),jsxRuntime.jsxs(Ke,{onClick:()=>t(true),className:"cursor-pointer",children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.t,{className:"size-5 text-gray-900 dark:text-zinc-100"}),jsxRuntime.jsx("span",{className:"inline",children:"Create Folder"})]}),jsxRuntime.jsxs(Ke,{onClick:()=>a(true),className:"cursor-pointer",children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.r,{className:"size-5 text-gray-700 dark:text-zinc-300"}),jsxRuntime.jsx("span",{className:"inline",children:"Search"})]})]})]})})]})}function Nr({onSearchClick:e}){let{setIsUploadModalOpen:t,setIsCreateFolderModalOpen:a}=R();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"hidden md:flex gap-2",children:[jsxRuntime.jsx(jo,{}),jsxRuntime.jsx(Qo,{}),e?jsxRuntime.jsxs(w,{variant:"outline",size:"icon",radius:"full",className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",onClick:e,children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.r,{className:"size-5 text-gray-900 dark:text-zinc-100"}),jsxRuntime.jsx("span",{className:"hidden",children:"Search"})]}):null]}),jsxRuntime.jsx("div",{className:"flex md:hidden",children:jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx(jt,{asChild:true,children:jsxRuntime.jsx(w,{variant:"outline",size:"icon",radius:"full",className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",children:jsxRuntime.jsx(chunkXOGHUQYC_cjs.F,{className:"size-5"})})}),jsxRuntime.jsxs(Qt,{align:"end",className:"w-48",children:[jsxRuntime.jsxs(Ke,{onClick:()=>t(true),className:"cursor-pointer",children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.w,{className:"size-5 text-gray-900 dark:text-zinc-100"}),jsxRuntime.jsx("span",{className:"inline",children:"Upload File"})]}),jsxRuntime.jsxs(Ke,{onClick:()=>a(true),className:"cursor-pointer",children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.t,{className:"size-5 text-gray-900 dark:text-zinc-100"}),jsxRuntime.jsx("span",{className:"inline",children:"Create Folder"})]}),e?jsxRuntime.jsxs(Ke,{onClick:e,className:"cursor-pointer",children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.r,{className:"size-5 text-gray-700 dark:text-zinc-300"}),jsxRuntime.jsx("span",{className:"inline",children:"Search"})]}):null]})]})})]})}function kr(t){var e=chunkXOGHUQYC_cjs.c(t,[]);return jsxRuntime.jsx(X__namespace.Root,chunkXOGHUQYC_cjs.a({"data-slot":"context-menu"},e))}function Dr(t){var e=chunkXOGHUQYC_cjs.c(t,[]);return jsxRuntime.jsx(X__namespace.Trigger,chunkXOGHUQYC_cjs.a({"data-slot":"context-menu-trigger"},e))}function Pr(a){var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx(X__namespace.Portal,{children:jsxRuntime.jsx(X__namespace.Content,chunkXOGHUQYC_cjs.a({"data-slot":"context-menu-content",className:b("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e)},t))})}function Ir(r){var n=r,{className:e,inset:t,variant:a="default"}=n,o=chunkXOGHUQYC_cjs.c(n,["className","inset","variant"]);return jsxRuntime.jsx(X__namespace.Item,chunkXOGHUQYC_cjs.a({"data-slot":"context-menu-item","data-inset":t,"data-variant":a,className:b("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e)},o))}function Sr(a){var o=a,{className:e}=o,t=chunkXOGHUQYC_cjs.c(o,["className"]);return jsxRuntime.jsx(X__namespace.Separator,chunkXOGHUQYC_cjs.a({"data-slot":"context-menu-separator",className:b("bg-border -mx-1 my-1 h-px",e)},t))}function yo({children:e,menuItems:t,isInSelectionMode:a=false,mode:o}){let r=!a&&o!=="modal",n=(s=false)=>t.map((d,l)=>{let v=l===t.length-1,u=d.variant==="destructive",p=s?Ke:Ir,F=s?mr:Sr,c=l<t.length-1&&t[l+1].variant==="destructive";return jsxRuntime.jsxs(yi__default.default.Fragment,{children:[jsxRuntime.jsxs(p,{onClick:d.onClick,className:d.className||`text-sm font-medium ${u?"text-red-600 focus:text-red-700 focus:bg-red-50":""} ${l===0?"rounded-t-xl":""} ${v?"rounded-b-xl":""}`,children:[d.icon,d.label]}),c&&!v&&jsxRuntime.jsx(F,{className:"bg-gray-200 dark:bg-zinc-700"})]},l)});return jsxRuntime.jsxs(kr,{children:[jsxRuntime.jsx(Dr,{children:jsxRuntime.jsxs("div",{className:"relative w-full h-full",children:[e,r&&jsxRuntime.jsx("div",{className:"absolute top-0 right-0 z-10 md:hidden",onClick:s=>s.stopPropagation(),children:jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx(jt,{asChild:true,children:jsxRuntime.jsx(w,{variant:"ghost",size:"icon",radius:"full",className:"focus-visible:ring-0 focus-visible:ring-offset-0",children:jsxRuntime.jsx(chunkXOGHUQYC_cjs.G,{className:"size-4 text-gray-700 dark:text-zinc-300"})})}),jsxRuntime.jsx(Qt,{className:"w-56 rounded-2xl shadow-xl bg-white/50 dark:bg-zinc-900/80 backdrop-blur-2xl border-gray-200 dark:border-zinc-700",children:n(true)})]})})]})}),r&&jsxRuntime.jsx(Pr,{className:"w-56 rounded-2xl shadow-xl bg-white/50 dark:bg-zinc-900/80 backdrop-blur-2xl border-gray-200 dark:border-zinc-700",children:n(false)})]})}function zr({file:e,isSelected:t,onSelect:a,onDelete:o,onEdit:r,onMove:n,selectionMode:s,showCheckbox:d=false,mode:l=chunkXOGHUQYC_cjs.d.PAGE,isInSelectionMode:v=false}){let u=D=>{D.stopPropagation(),confirm(`Are you sure you want to delete "${e.name}"?`)&&o(e.id);},p=D=>{D.stopPropagation(),r(e);},F=D=>{D.stopPropagation(),a(e,void 0,true);},c=D=>{D.stopPropagation(),n(e);},h=D=>{a(e,D,false);},N=()=>{a(e,void 0,true);},x=D=>{D.stopPropagation();},{component:V,metadataComponent:C}=et(e);return jsxRuntime.jsx(yo,{menuItems:[{label:"Edit",icon:jsxRuntime.jsx(chunkXOGHUQYC_cjs.E,{className:"size-6"}),onClick:p},{label:"Select File",icon:jsxRuntime.jsx(chunkXOGHUQYC_cjs.D,{className:"size-6"}),onClick:F},{label:"Move to...",icon:jsxRuntime.jsx(chunkXOGHUQYC_cjs.s,{className:"size-6"}),onClick:c},{label:"Delete",icon:jsxRuntime.jsx(chunkXOGHUQYC_cjs.x,{className:"size-6 text-red-600"}),onClick:u,variant:"destructive"}],isInSelectionMode:v,mode:l,children:jsxRuntime.jsxs("div",{className:"group relative flex flex-col items-center justify-start transition-all duration-200 cursor-pointer w-full select-none",onDoubleClick:h,onClick:h,children:[jsxRuntime.jsxs("div",{className:`
86
86
  relative w-full aspect-square flex items-center justify-center mb-1 overflow-hidden rounded-2xl hover:bg-accent/60
87
87
  ${t?"bg-accent/60":""}
88
- `,children:[jsxRuntime.jsx("div",{className:"w-[75%] h-[75%] flex items-center justify-center",children:jsxRuntime.jsx(V,{file:e,metaData:e.metaData})}),(s===chunkSV5VFLC2_cjs.h.MULTIPLE||d)&&jsxRuntime.jsx("div",{className:`absolute top-2 left-2 z-10 ${t?"opacity-100":"opacity-0 group-hover:opacity-100"} transition-opacity duration-200`,onClick:x,children:jsxRuntime.jsx(bo,{checked:t,onCheckedChange:N,className:"bg-background/90 border-border shadow-sm data-[state=checked]:bg-primary data-[state=checked]:border-primary rounded-full h-5 w-5"})})]}),jsxRuntime.jsxs("div",{className:"w-full text-center px-0.5 flex flex-col items-center",children:[jsxRuntime.jsx("span",{className:`
88
+ `,children:[jsxRuntime.jsx("div",{className:"w-[75%] h-[75%] flex items-center justify-center",children:jsxRuntime.jsx(V,{file:e,metaData:e.metaData})}),(s===chunkXOGHUQYC_cjs.h.MULTIPLE||d)&&jsxRuntime.jsx("div",{className:`absolute top-2 left-2 z-10 ${t?"opacity-100":"opacity-0 group-hover:opacity-100"} transition-opacity duration-200`,onClick:x,children:jsxRuntime.jsx(bo,{checked:t,onCheckedChange:N,className:"bg-background/90 border-border shadow-sm data-[state=checked]:bg-primary data-[state=checked]:border-primary rounded-full h-5 w-5"})})]}),jsxRuntime.jsxs("div",{className:"w-full text-center px-0.5 flex flex-col items-center",children:[jsxRuntime.jsx("span",{className:`
89
89
  text-[13px] font-semibold leading-[1.3] tracking-tight line-clamp-2 px-2.5 py-[2px] rounded-[6px] transition-colors duration-100 wrap-break-word max-w-full
90
90
  ${t?"bg-primary text-primary-foreground antialiased shadow-sm":"text-foreground group-hover:text-foreground/80"}
91
91
  `,children:e.name}),jsxRuntime.jsxs("div",{className:`flex flex-col items-center justify-center gap-0.5 mt-1 transition-opacity duration-200 ${t?"opacity-60":"opacity-100"}`,children:[jsxRuntime.jsx("span",{className:"text-[11px] text-primary font-medium tracking-tight",children:re(e.size)}),C?jsxRuntime.jsx("div",{className:"text-[11px] text-muted-foreground flex items-center scale-95",children:jsxRuntime.jsx(C,{file:e})}):null]})]})]})})}function Rr({folder:e,isSelected:t,onSelect:a,onDelete:o,onRename:r,onMove:n,selectionMode:s,showCheckbox:d,mode:l,isInSelectionMode:v}){let u=C=>{C.stopPropagation(),confirm(`Are you sure you want to delete "${e.name}"?
92
92
 
93
- \u26A0\uFE0F Warning: This will also delete all ${e.fileCount} file(s) inside this folder.`)&&o(e.id);},p=C=>{C.stopPropagation(),r(e);},F=C=>{C.stopPropagation(),n(e);},c=C=>{C.stopPropagation(),a(e,void 0,true);},h=C=>{a(e,C,false);},N=()=>{a(e,void 0,true);},x=C=>{C.stopPropagation();};return jsxRuntime.jsx(yo,{menuItems:[{label:"Rename",icon:jsxRuntime.jsx(chunkSV5VFLC2_cjs.E,{className:"size-6"}),onClick:p},{label:"Select Folder",icon:jsxRuntime.jsx(chunkSV5VFLC2_cjs.D,{className:"size-6"}),onClick:c},{label:"Move to...",icon:jsxRuntime.jsx(chunkSV5VFLC2_cjs.s,{className:"size-5 mr-1"}),onClick:F},{label:"Delete",icon:jsxRuntime.jsx(chunkSV5VFLC2_cjs.x,{className:"size-5 mr-1 text-red-600"}),onClick:u,variant:"destructive"}],isInSelectionMode:v,mode:l,children:jsxRuntime.jsxs("div",{className:"group relative flex flex-col items-center justify-start transition-all duration-200 cursor-pointer w-full select-none",onDoubleClick:h,onClick:h,children:[jsxRuntime.jsxs("div",{className:`
93
+ \u26A0\uFE0F Warning: This will also delete all ${e.fileCount} file(s) inside this folder.`)&&o(e.id);},p=C=>{C.stopPropagation(),r(e);},F=C=>{C.stopPropagation(),n(e);},c=C=>{C.stopPropagation(),a(e,void 0,true);},h=C=>{a(e,C,false);},N=()=>{a(e,void 0,true);},x=C=>{C.stopPropagation();};return jsxRuntime.jsx(yo,{menuItems:[{label:"Rename",icon:jsxRuntime.jsx(chunkXOGHUQYC_cjs.E,{className:"size-6"}),onClick:p},{label:"Select Folder",icon:jsxRuntime.jsx(chunkXOGHUQYC_cjs.D,{className:"size-6"}),onClick:c},{label:"Move to...",icon:jsxRuntime.jsx(chunkXOGHUQYC_cjs.s,{className:"size-5 mr-1"}),onClick:F},{label:"Delete",icon:jsxRuntime.jsx(chunkXOGHUQYC_cjs.x,{className:"size-5 mr-1 text-red-600"}),onClick:u,variant:"destructive"}],isInSelectionMode:v,mode:l,children:jsxRuntime.jsxs("div",{className:"group relative flex flex-col items-center justify-start transition-all duration-200 cursor-pointer w-full select-none",onDoubleClick:h,onClick:h,children:[jsxRuntime.jsxs("div",{className:`
94
94
  relative w-full aspect-square flex items-center justify-center mb-1 overflow-hidden rounded-2xl hover:bg-accent/60
95
95
  ${t?"bg-accent/60":""}
96
- `,children:[jsxRuntime.jsx("div",{className:"w-[75%] h-[75%] flex items-center justify-center transform dark:brightness-[2]",children:jsxRuntime.jsx(chunkSV5VFLC2_cjs.p,{className:"w-full h-full text-blue-400 fill-blue-400/20 drop-shadow-sm",strokeWidth:1.5})}),(s===chunkSV5VFLC2_cjs.h.MULTIPLE||d)&&jsxRuntime.jsx("div",{className:`absolute top-2 left-2 z-10 ${t?"opacity-100":"opacity-0 group-hover:opacity-100"} transition-opacity duration-200`,onClick:x,children:jsxRuntime.jsx(bo,{checked:t,onCheckedChange:N,className:"bg-background/90 border-border shadow-sm data-[state=checked]:bg-primary data-[state=checked]:border-primary rounded-full h-5 w-5"})})]}),jsxRuntime.jsxs("div",{className:"w-full text-center px-0.5 flex flex-col items-center",children:[jsxRuntime.jsx("span",{className:`
96
+ `,children:[jsxRuntime.jsx("div",{className:"w-[75%] h-[75%] flex items-center justify-center transform dark:brightness-[2]",children:jsxRuntime.jsx(chunkXOGHUQYC_cjs.p,{className:"w-full h-full text-blue-400 fill-blue-400/20 drop-shadow-sm",strokeWidth:1.5})}),(s===chunkXOGHUQYC_cjs.h.MULTIPLE||d)&&jsxRuntime.jsx("div",{className:`absolute top-2 left-2 z-10 ${t?"opacity-100":"opacity-0 group-hover:opacity-100"} transition-opacity duration-200`,onClick:x,children:jsxRuntime.jsx(bo,{checked:t,onCheckedChange:N,className:"bg-background/90 border-border shadow-sm data-[state=checked]:bg-primary data-[state=checked]:border-primary rounded-full h-5 w-5"})})]}),jsxRuntime.jsxs("div",{className:"w-full text-center px-0.5 flex flex-col items-center",children:[jsxRuntime.jsx("span",{className:`
97
97
  text-[13px] font-semibold leading-[1.3] tracking-tight line-clamp-2 px-2.5 pb-[2px] rounded-[6px] transition-colors duration-100 wrap-break-word max-w-full
98
98
  ${t?"bg-primary text-primary-foreground antialiased shadow-sm":"text-foreground group-hover:text-foreground/80"}
99
- `,children:e.name}),jsxRuntime.jsx("div",{className:`flex items-center justify-center gap-1 mt-1 transition-opacity duration-200 ${t?"opacity-60":"opacity-100"}`,children:jsxRuntime.jsxs("span",{className:"text-[11px] text-primary font-medium tracking-tight px-1.5 rounded-full",children:[e.fileCount," items"]})})]})]})})}function Fo(){let{files:e,folders:t,isLoading:a,handleFileClick:o,handleFolderClick:r,bulkDelete:n,mode:s,selectionMode:d,isInSelectionMode:l,selectedFiles:v,selectedFolders:u,currentFolder:p,setSelectedFiles:F,setSelectedFolders:c,setIsRenameFolderModalOpen:h,setIsMoveFileModalOpen:N,setFileDetailsModalFile:x,setFolderToRename:V}=R(),I=(()=>{if(!p)return 18;let D=p.folderCount||0,O=p.fileCount||0,P=D+O;return P>0?P:18})();return a?jsxRuntime.jsx("div",{className:"p-4 grid grid-cols-2 gap-x-4 gap-y-8 sm:grid-cols-3 md:grid-cols-5 lg:grid-cols-6 xl:grid-cols-7 2xl:grid-cols-8 content-start",children:Array.from({length:I}).map((D,O)=>{var P;return jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-start w-full gap-2",children:[jsxRuntime.jsx("div",{className:"w-full aspect-square bg-muted rounded-2xl animate-pulse"}),jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-1 w-full",children:[jsxRuntime.jsx("div",{className:"h-4 w-20 bg-muted rounded animate-pulse"}),jsxRuntime.jsx("div",{className:"h-3 w-12 bg-muted rounded animate-pulse"})]})]},`skeleton-${(P=p==null?void 0:p.id)!=null?P:"root"}-${O}`)})}):jsxRuntime.jsxs("div",{className:"p-4 grid grid-cols-2 gap-x-4 gap-y-8 sm:grid-cols-3 md:grid-cols-5 lg:grid-cols-6 xl:grid-cols-7 2xl:grid-cols-8 content-start",children:[t.map(D=>jsxRuntime.jsx(Rr,{folder:D,isSelected:u.some(O=>O.id===D.id),onSelect:r,onDelete:()=>n(),onRename:O=>{V(O),h(true);},onMove:O=>{c([O]),F([]),N(true);},selectionMode:d,mode:s,isInSelectionMode:l()},D.id)),e.map(D=>jsxRuntime.jsx(zr,{file:D,isSelected:v.some(O=>O.id===D.id),onSelect:o,onDelete:()=>n(),onEdit:O=>{x(O);},onMove:O=>{F([O]),c([]),N(true);},selectionMode:d,mode:s,isInSelectionMode:l()},D.id))]})}var No=class extends yi.Component{constructor(a){super(a);this.handleReset=()=>{globalThis.location.reload();};this.state={hasError:false,error:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,o){console.error("FileManager Error Boundary caught an error:",a,o);}render(){return this.state.hasError?this.props.fallback?this.props.fallback:jsxRuntime.jsx("div",{className:"flex items-center justify-center min-h-[400px] p-8 w-full h-full bg-slate-50/50 rounded-lg border border-dashed border-slate-200",children:jsxRuntime.jsxs("div",{className:"text-center max-w-md flex flex-col items-center",children:[jsxRuntime.jsx("div",{className:"bg-red-100 p-3 rounded-full mb-4",children:jsxRuntime.jsx(chunkSV5VFLC2_cjs.K,{className:"size-8 text-red-600"})}),jsxRuntime.jsx("h2",{className:"text-xl font-semibold text-slate-900 mb-2",children:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-slate-500 mb-6",children:"The file manager encountered an unexpected error. Refreshing the page usually resolves this issue."}),this.state.error&&jsxRuntime.jsxs("details",{className:"mb-6 text-left w-full border border-slate-200 rounded-lg overflow-hidden flex-col group",children:[jsxRuntime.jsx("summary",{className:"cursor-pointer text-xs font-mono bg-slate-100 p-2 text-slate-600 hover:bg-slate-200 transition-colors",children:"View Technical Details"}),jsxRuntime.jsx("div",{className:"p-3 bg-white dark:bg-zinc-900",children:jsxRuntime.jsx("pre",{className:"text-[10px] text-slate-600 font-mono whitespace-pre-wrap word-break-all max-h-40 overflow-auto",children:this.state.error.toString()})})]}),jsxRuntime.jsxs(w,{onClick:this.handleReset,radius:"full",className:"gap-2",children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.L,{className:"size-4"}),"Reload Application"]})]})}):this.props.children}};function Tr(){let{handleSelectAllGlobal:e,handleClearSelection:t,getSelectionState:a,isCreateFolderModalOpen:o,setIsCreateFolderModalOpen:r,isUploadModalOpen:n,setIsUploadModalOpen:s,isSearchModalOpen:d,setIsSearchModalOpen:l}=R();return yi.useEffect(()=>{let v=u=>{u.key==="k"&&(u.metaKey||u.ctrlKey)&&(u.preventDefault(),l(!d)),u.key==="a"&&(u.metaKey||u.ctrlKey)&&(u.preventDefault(),a()===true?t():e(true)),u.key==="f"&&(u.metaKey||u.ctrlKey)&&(u.preventDefault(),r(!o)),u.key==="u"&&(u.metaKey||u.ctrlKey)&&(u.preventDefault(),s(!n));};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,t,a,o,r,n,s,d,l]),null}function Fi(e){return jsxRuntime.jsx(No,{children:jsxRuntime.jsxs(He.Page,chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({},e),{children:[jsxRuntime.jsx(Tr,{}),jsxRuntime.jsxs("div",{className:"flex h-full relative pb-12 overflow-hidden bg-background text-foreground",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex w-full flex-col overflow-y-auto",children:[jsxRuntime.jsx(He.Header,{children:jsxRuntime.jsxs("div",{className:"flex w-full justify-between gap-2",children:[jsxRuntime.jsx(fo,{}),jsxRuntime.jsx(Fr,{})]})}),jsxRuntime.jsx(ur,{className:"-mb-1"}),jsxRuntime.jsx(Fo,{}),jsxRuntime.jsx(He.Footer,{className:"pt-6 pb-10"})]}),jsxRuntime.jsx(He.Overlays,{})]})]}))})}function Mi(o){var r=o,{open:e,onClose:t}=r,a=chunkSV5VFLC2_cjs.c(r,["open","onClose"]);return jsxRuntime.jsx(He.Modal,chunkSV5VFLC2_cjs.b(chunkSV5VFLC2_cjs.a({},a),{onClose:t,children:jsxRuntime.jsx(we,{open:e,onOpenChange:t,children:jsxRuntime.jsx(ki,{onClose:t})})}))}function ki({onClose:e}){let{updateSearchQuery:t}=R(),[a,o]=yi.useState(false),[r,n]=yi.useState(""),s=yi.useRef(null),d=vo(r,300);return yi.useEffect(()=>{t(d);},[d,t]),yi.useEffect(()=>{a&&s.current&&s.current.focus();},[a]),jsxRuntime.jsxs(Ce,{className:"p-0",variant:"fullscreen",showCloseButton:false,children:[jsxRuntime.jsxs(Le,{className:"pt-5 pb-3 m-0 border-b border-border",children:[jsxRuntime.jsx(Fe,{className:"px-6 text-base",children:jsxRuntime.jsx("div",{className:"flex w-full justify-between gap-2",children:a?jsxRuntime.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[jsxRuntime.jsx(chunkSV5VFLC2_cjs.r,{className:"size-5 text-gray-500 shrink-0"}),jsxRuntime.jsx(Pt,{ref:s,type:"text",placeholder:"Search files and folders...",className:"border-none shadow-none focus-visible:ring-0 h-auto p-0 text-base font-semibold",value:r,onChange:l=>n(l.target.value),onKeyDown:l=>{l.key==="Escape"&&(n(""),t(""),o(false));}}),jsxRuntime.jsx(ve,{onClick:()=>{n(""),t(""),o(false);},className:"shrink-0",label:"Cancel Search"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(fo,{}),jsxRuntime.jsx(Nr,{onSearchClick:()=>o(true)}),jsxRuntime.jsx(ve,{onClick:e})]})})}),jsxRuntime.jsx(Xe,{className:"sr-only",children:"Browse and select files from your media library"})]}),jsxRuntime.jsxs("div",{className:"overflow-y-auto flex-1 pb-4",children:[jsxRuntime.jsx(Fo,{}),jsxRuntime.jsx(He.Footer,{className:"my-4"}),jsxRuntime.jsx(He.Overlays,{})]}),jsxRuntime.jsx(Di,{onClose:e})]})}function Di({onClose:e}){let{selectedFiles:t,onFilesSelected:a,setSelectedFiles:o,setSelectedFolders:r,updateSearchQuery:n,handlePageChange:s}=R();return jsxRuntime.jsxs(_e,{className:"px-6 py-4 border-t border-border w-full sm:justify-between justify-center items-center flex-col sm:flex-row gap-2",children:[jsxRuntime.jsx(cr,{}),jsxRuntime.jsx(Ge,{asChild:true,children:jsxRuntime.jsx(w,{type:"button",variant:"outline",onClick:e,radius:"full",className:"w-full md:w-auto mr-0",children:"Cancel"})}),jsxRuntime.jsxs(w,{type:"button",onClick:()=>{a&&t.length>0&&(a(t),o([]),r([]),n(""),s(1),e());},disabled:t.length===0,radius:"full",className:"w-full md:w-auto",children:["Select ",t.length>0?`(${t.length})`:""]})]})}Object.defineProperty(exports,"FILE_TYPE",{enumerable:true,get:function(){return chunkSV5VFLC2_cjs.f}});Object.defineProperty(exports,"FILE_TYPES",{enumerable:true,get:function(){return chunkSV5VFLC2_cjs.g}});Object.defineProperty(exports,"MODE",{enumerable:true,get:function(){return chunkSV5VFLC2_cjs.d}});Object.defineProperty(exports,"MODES",{enumerable:true,get:function(){return chunkSV5VFLC2_cjs.e}});Object.defineProperty(exports,"MockProvider",{enumerable:true,get:function(){return chunkSV5VFLC2_cjs.S}});Object.defineProperty(exports,"SELECTION_MODE",{enumerable:true,get:function(){return chunkSV5VFLC2_cjs.h}});Object.defineProperty(exports,"SELECTION_MODES",{enumerable:true,get:function(){return chunkSV5VFLC2_cjs.i}});Object.defineProperty(exports,"VIDEO_SOURCE",{enumerable:true,get:function(){return chunkSV5VFLC2_cjs.l}});Object.defineProperty(exports,"VIDEO_SOURCES",{enumerable:true,get:function(){return chunkSV5VFLC2_cjs.m}});Object.defineProperty(exports,"VIEW_MODE",{enumerable:true,get:function(){return chunkSV5VFLC2_cjs.j}});Object.defineProperty(exports,"VIEW_MODES",{enumerable:true,get:function(){return chunkSV5VFLC2_cjs.k}});exports.FileManager=Fi;exports.FileManagerModal=Mi;exports.FileManagerProvider=io;exports.useFileManager=R;
99
+ `,children:e.name}),jsxRuntime.jsx("div",{className:`flex items-center justify-center gap-1 mt-1 transition-opacity duration-200 ${t?"opacity-60":"opacity-100"}`,children:jsxRuntime.jsxs("span",{className:"text-[11px] text-primary font-medium tracking-tight px-1.5 rounded-full",children:[e.fileCount," items"]})})]})]})})}function Fo(){let{files:e,folders:t,isLoading:a,handleFileClick:o,handleFolderClick:r,bulkDelete:n,mode:s,selectionMode:d,isInSelectionMode:l,selectedFiles:v,selectedFolders:u,currentFolder:p,setSelectedFiles:F,setSelectedFolders:c,setIsRenameFolderModalOpen:h,setIsMoveFileModalOpen:N,setFileDetailsModalFile:x,setFolderToRename:V}=R(),I=(()=>{if(!p)return 18;let D=p.folderCount||0,O=p.fileCount||0,P=D+O;return P>0?P:18})();return a?jsxRuntime.jsx("div",{className:"p-4 grid grid-cols-2 gap-x-4 gap-y-8 sm:grid-cols-3 md:grid-cols-5 lg:grid-cols-6 xl:grid-cols-7 2xl:grid-cols-8 content-start",children:Array.from({length:I}).map((D,O)=>{var P;return jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-start w-full gap-2",children:[jsxRuntime.jsx("div",{className:"w-full aspect-square bg-muted rounded-2xl animate-pulse"}),jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-1 w-full",children:[jsxRuntime.jsx("div",{className:"h-4 w-20 bg-muted rounded animate-pulse"}),jsxRuntime.jsx("div",{className:"h-3 w-12 bg-muted rounded animate-pulse"})]})]},`skeleton-${(P=p==null?void 0:p.id)!=null?P:"root"}-${O}`)})}):jsxRuntime.jsxs("div",{className:"p-4 grid grid-cols-2 gap-x-4 gap-y-8 sm:grid-cols-3 md:grid-cols-5 lg:grid-cols-6 xl:grid-cols-7 2xl:grid-cols-8 content-start",children:[t.map(D=>jsxRuntime.jsx(Rr,{folder:D,isSelected:u.some(O=>O.id===D.id),onSelect:r,onDelete:()=>n(),onRename:O=>{V(O),h(true);},onMove:O=>{c([O]),F([]),N(true);},selectionMode:d,mode:s,isInSelectionMode:l()},D.id)),e.map(D=>jsxRuntime.jsx(zr,{file:D,isSelected:v.some(O=>O.id===D.id),onSelect:o,onDelete:()=>n(),onEdit:O=>{x(O);},onMove:O=>{F([O]),c([]),N(true);},selectionMode:d,mode:s,isInSelectionMode:l()},D.id))]})}var No=class extends yi.Component{constructor(a){super(a);this.handleReset=()=>{globalThis.location.reload();};this.state={hasError:false,error:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,o){console.error("FileManager Error Boundary caught an error:",a,o);}render(){return this.state.hasError?this.props.fallback?this.props.fallback:jsxRuntime.jsx("div",{className:"flex items-center justify-center min-h-[400px] p-8 w-full h-full bg-slate-50/50 rounded-lg border border-dashed border-slate-200",children:jsxRuntime.jsxs("div",{className:"text-center max-w-md flex flex-col items-center",children:[jsxRuntime.jsx("div",{className:"bg-red-100 p-3 rounded-full mb-4",children:jsxRuntime.jsx(chunkXOGHUQYC_cjs.K,{className:"size-8 text-red-600"})}),jsxRuntime.jsx("h2",{className:"text-xl font-semibold text-slate-900 mb-2",children:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-slate-500 mb-6",children:"The file manager encountered an unexpected error. Refreshing the page usually resolves this issue."}),this.state.error&&jsxRuntime.jsxs("details",{className:"mb-6 text-left w-full border border-slate-200 rounded-lg overflow-hidden flex-col group",children:[jsxRuntime.jsx("summary",{className:"cursor-pointer text-xs font-mono bg-slate-100 p-2 text-slate-600 hover:bg-slate-200 transition-colors",children:"View Technical Details"}),jsxRuntime.jsx("div",{className:"p-3 bg-white dark:bg-zinc-900",children:jsxRuntime.jsx("pre",{className:"text-[10px] text-slate-600 font-mono whitespace-pre-wrap word-break-all max-h-40 overflow-auto",children:this.state.error.toString()})})]}),jsxRuntime.jsxs(w,{onClick:this.handleReset,radius:"full",className:"gap-2",children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.L,{className:"size-4"}),"Reload Application"]})]})}):this.props.children}};function Tr(){let{handleSelectAllGlobal:e,handleClearSelection:t,getSelectionState:a,isCreateFolderModalOpen:o,setIsCreateFolderModalOpen:r,isUploadModalOpen:n,setIsUploadModalOpen:s,isSearchModalOpen:d,setIsSearchModalOpen:l}=R();return yi.useEffect(()=>{let v=u=>{u.key==="k"&&(u.metaKey||u.ctrlKey)&&(u.preventDefault(),l(!d)),u.key==="a"&&(u.metaKey||u.ctrlKey)&&(u.preventDefault(),a()===true?t():e(true)),u.key==="f"&&(u.metaKey||u.ctrlKey)&&(u.preventDefault(),r(!o)),u.key==="u"&&(u.metaKey||u.ctrlKey)&&(u.preventDefault(),s(!n));};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,t,a,o,r,n,s,d,l]),null}function Fi(e){return jsxRuntime.jsx(No,{children:jsxRuntime.jsxs(He.Page,chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({},e),{children:[jsxRuntime.jsx(Tr,{}),jsxRuntime.jsxs("div",{className:"flex h-full relative pb-12 overflow-hidden bg-background text-foreground",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex w-full flex-col overflow-y-auto",children:[jsxRuntime.jsx(He.Header,{children:jsxRuntime.jsxs("div",{className:"flex w-full justify-between gap-2",children:[jsxRuntime.jsx(fo,{}),jsxRuntime.jsx(Fr,{})]})}),jsxRuntime.jsx(ur,{className:"-mb-1"}),jsxRuntime.jsx(Fo,{}),jsxRuntime.jsx(He.Footer,{className:"pt-6 pb-10"})]}),jsxRuntime.jsx(He.Overlays,{})]})]}))})}function Mi(o){var r=o,{open:e,onClose:t}=r,a=chunkXOGHUQYC_cjs.c(r,["open","onClose"]);return jsxRuntime.jsx(He.Modal,chunkXOGHUQYC_cjs.b(chunkXOGHUQYC_cjs.a({},a),{onClose:t,children:jsxRuntime.jsx(we,{open:e,onOpenChange:t,children:jsxRuntime.jsx(ki,{onClose:t})})}))}function ki({onClose:e}){let{updateSearchQuery:t}=R(),[a,o]=yi.useState(false),[r,n]=yi.useState(""),s=yi.useRef(null),d=vo(r,300);return yi.useEffect(()=>{t(d);},[d,t]),yi.useEffect(()=>{a&&s.current&&s.current.focus();},[a]),jsxRuntime.jsxs(Ce,{className:"p-0",variant:"fullscreen",showCloseButton:false,children:[jsxRuntime.jsxs(Le,{className:"pt-5 pb-3 m-0 border-b border-border",children:[jsxRuntime.jsx(Fe,{className:"px-6 text-base",children:jsxRuntime.jsx("div",{className:"flex w-full justify-between gap-2",children:a?jsxRuntime.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[jsxRuntime.jsx(chunkXOGHUQYC_cjs.r,{className:"size-5 text-gray-500 shrink-0"}),jsxRuntime.jsx(Pt,{ref:s,type:"text",placeholder:"Search files and folders...",className:"border-none shadow-none focus-visible:ring-0 h-auto p-0 text-base font-semibold",value:r,onChange:l=>n(l.target.value),onKeyDown:l=>{l.key==="Escape"&&(n(""),t(""),o(false));}}),jsxRuntime.jsx(ve,{onClick:()=>{n(""),t(""),o(false);},className:"shrink-0",label:"Cancel Search"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(fo,{}),jsxRuntime.jsx(Nr,{onSearchClick:()=>o(true)}),jsxRuntime.jsx(ve,{onClick:e})]})})}),jsxRuntime.jsx(Xe,{className:"sr-only",children:"Browse and select files from your media library"})]}),jsxRuntime.jsxs("div",{className:"overflow-y-auto flex-1 pb-4",children:[jsxRuntime.jsx(Fo,{}),jsxRuntime.jsx(He.Footer,{className:"my-4"}),jsxRuntime.jsx(He.Overlays,{})]}),jsxRuntime.jsx(Di,{onClose:e})]})}function Di({onClose:e}){let{selectedFiles:t,onFilesSelected:a,setSelectedFiles:o,setSelectedFolders:r,updateSearchQuery:n,handlePageChange:s}=R();return jsxRuntime.jsxs(_e,{className:"px-6 py-4 border-t border-border w-full sm:justify-between justify-center items-center flex-col sm:flex-row gap-2",children:[jsxRuntime.jsx(cr,{}),jsxRuntime.jsx(Ge,{asChild:true,children:jsxRuntime.jsx(w,{type:"button",variant:"outline",onClick:e,radius:"full",className:"w-full md:w-auto mr-0",children:"Cancel"})}),jsxRuntime.jsxs(w,{type:"button",onClick:()=>{a&&t.length>0&&(a(t),o([]),r([]),n(""),s(1),e());},disabled:t.length===0,radius:"full",className:"w-full md:w-auto",children:["Select ",t.length>0?`(${t.length})`:""]})]})}Object.defineProperty(exports,"FILE_TYPE",{enumerable:true,get:function(){return chunkXOGHUQYC_cjs.f}});Object.defineProperty(exports,"FILE_TYPES",{enumerable:true,get:function(){return chunkXOGHUQYC_cjs.g}});Object.defineProperty(exports,"MODE",{enumerable:true,get:function(){return chunkXOGHUQYC_cjs.d}});Object.defineProperty(exports,"MODES",{enumerable:true,get:function(){return chunkXOGHUQYC_cjs.e}});Object.defineProperty(exports,"MockProvider",{enumerable:true,get:function(){return chunkXOGHUQYC_cjs.S}});Object.defineProperty(exports,"SELECTION_MODE",{enumerable:true,get:function(){return chunkXOGHUQYC_cjs.h}});Object.defineProperty(exports,"SELECTION_MODES",{enumerable:true,get:function(){return chunkXOGHUQYC_cjs.i}});Object.defineProperty(exports,"VIDEO_SOURCE",{enumerable:true,get:function(){return chunkXOGHUQYC_cjs.l}});Object.defineProperty(exports,"VIDEO_SOURCES",{enumerable:true,get:function(){return chunkXOGHUQYC_cjs.m}});Object.defineProperty(exports,"VIEW_MODE",{enumerable:true,get:function(){return chunkXOGHUQYC_cjs.j}});Object.defineProperty(exports,"VIEW_MODES",{enumerable:true,get:function(){return chunkXOGHUQYC_cjs.k}});exports.FileManager=Fi;exports.FileManagerModal=Mi;exports.FileManagerProvider=io;exports.useFileManager=R;