@unciatech/file-manager 0.0.19 → 0.0.21

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.mjs CHANGED
@@ -1,27 +1,11 @@
1
- var pi=Object.defineProperty,ui=Object.defineProperties;var mi=Object.getOwnPropertyDescriptors;var vo=Object.getOwnPropertySymbols;var Ya=Object.prototype.hasOwnProperty,qa=Object.prototype.propertyIsEnumerable;var Ka=(e,t,o)=>t in e?pi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,r=(e,t)=>{for(var o in t||(t={}))Ya.call(t,o)&&Ka(e,o,t[o]);if(vo)for(var o of vo(t))qa.call(t,o)&&Ka(e,o,t[o]);return e},s=(e,t)=>ui(e,mi(t));var f=(e,t)=>{var o={};for(var a in e)Ya.call(e,a)&&t.indexOf(a)<0&&(o[a]=e[a]);if(e!=null&&vo)for(var a of vo(e))t.indexOf(a)<0&&qa.call(e,a)&&(o[a]=e[a]);return o};import{useCallback as Le}from"react";var J={PAGE:"page",MODAL:"modal"},bs=Object.values(J),K={IMAGE:"images",VIDEO:"videos",AUDIO:"audios",FILE:"files"},ws=Object.values(K),Ee={SINGLE:"single",MULTIPLE:"multiple"},Cs=Object.values(Ee),fi={GRID:"grid",LIST:"list"},ys=Object.values(fi),da={LOCAL:"local",REMOTE:"remote",YOUTUBE:"youtube",VIMEO:"vimeo"},Fs=Object.values(da);import{useRouter as gi}from"next/navigation";import{toast as Ae}from"sonner";var ca=(e,t)=>{let o=[...e];return t.forEach(a=>{o.some(i=>i.id===a.id)?o=o.filter(i=>i.id!==a.id):o.push(a)}),o},Qa=(e,t)=>{let o=[...e];return t.forEach(a=>{o.some(i=>i.id===a.id)?o=o.filter(i=>i.id!==a.id):o.push(a)}),o};function Ja(e){let{mode:t,selectionMode:o,files:a,folders:n,selectedFiles:i,selectedFolders:l,currentFolder:c,setSelectedFiles:d,setSelectedFolders:g,setCurrentFolder:u,setFiles:b,setFolders:p,setPagination:C,loadData:w,isInSelectionMode:k,provider:y,onFilesSelected:M,onClose:I,basePath:N,setIsLoading:h,setFileDetailsModalFile:D}=e,Z=gi(),Y=Le((P,z,V=!1)=>{let O=[P];if(V||z&&(z.metaKey||z.ctrlKey)){d(W=>ca(W,O));return}if(k()&&t!==J.MODAL){d(W=>ca(W,O));return}if(t===J.MODAL){o==="single"?(d([P]),M==null||M([P]),I==null||I()):d(W=>ca(W,O));return}D(P)},[t,o,k,d,M,I,D]),ae=Le((P,z,V=!1)=>{let O=P?P.id:null;if((V||z&&(z.metaKey||z.ctrlKey))&&P){g(W=>Qa(W,[P]));return}if(k()&&P){g(W=>Qa(W,[P]));return}if(t===J.PAGE){h(!0);let W=N!=null?N:"/media",De=O===null?W:`${W}/${O}`;Z.push(De)}else{h(!0),d([]),g([]);let W=new URLSearchParams(window.location.search);O===null?W.delete("folderId"):W.set("folderId",String(O)),W.set("page","1");let De=`${window.location.pathname}?${W.toString()}`;Z.push(De,{scroll:!1})}},[k,t,Z,g,d,N,h]),Ce=Le(()=>{d([]),g([])},[d,g]),m=Le(P=>{P?(d(a),g(t===J.PAGE?n:[])):(d([]),g([]))},[a,n,t,d,g]),S=Le(async(P=!1)=>{await w(P)},[w]),x=Le(async P=>{var z;try{await y.uploadFiles(P,(z=c==null?void 0:c.id)!=null?z:null),await S(!0),d([]),Ae.success("Upload Successful",{description:`${P.length} file(s) uploaded successfully`})}catch(V){let O=V instanceof Error?V.message:"Failed to upload files";Ae.error("Upload Failed",{description:O}),console.error("Upload failed:",V)}},[c,y,S,d]),R=Le(async P=>{var z;try{await y.createFolder(P,(z=c==null?void 0:c.id)!=null?z:null),await S(!0),d([]),Ae.success("Folder Created",{description:`Folder "${P}" created successfully`})}catch(V){let O=V instanceof Error?V.message:"Failed to create folder";Ae.error("Create Folder Failed",{description:O}),console.error("Failed to create folder:",V)}},[c,y,S,d]),T=Le(async P=>{try{i.length>0&&await y.moveFiles(i.map(V=>V.id),P),l.length>0&&await y.moveFolders(l.map(V=>V.id),P),await S(!0),d([]),g([]);let z=i.length+l.length;Ae.success("Move Successful",{description:`${z} item(s) moved successfully`})}catch(z){let V=z instanceof Error?z.message:"Failed to move items";Ae.error("Move Failed",{description:V}),console.error("Failed to move items:",z)}},[i,l,y,S,d,g]),_=Le(async(P,z)=>{try{p(V=>V.map(O=>O.id===P?s(r({},O),{name:z}):O)),await y.renameFolder(P,z),await S(!0),Ae.success("Folder Renamed",{description:`Folder renamed to "${z}"`})}catch(V){let O=V instanceof Error?V.message:"Failed to rename folder";Ae.error("Rename Failed",{description:O}),console.error("Failed to rename folder:",V)}},[y,S]),me=Le(async(P,z)=>{try{b(V=>V.map(O=>{if(O.id===P){let Ye=z,{metaData:W}=Ye,De=f(Ye,["metaData"]);return s(r(r({},O),De),{metaData:W?r(r({},O.metaData),W):O.metaData})}return O})),await y.updateFileMetaData(P,z),await S(!0)}catch(V){let O=V instanceof Error?V.message:"Failed to update metadata";Ae.error("Update Failed",{description:O}),console.error("Failed to update metadata:",V)}},[y,S]),Tt=Le(async()=>{try{i.length>0&&await y.deleteFiles(i.map(z=>z.id)),l.length>0&&await y.deleteFolders(l.map(z=>z.id)),await S(!0),d([]),g([]);let P=i.length+l.length;Ae.success("Delete Successful",{description:`${P} item(s) deleted successfully`})}catch(P){let z=P instanceof Error?P.message:"Failed to delete items";Ae.error("Delete Failed",{description:z}),console.error("Failed to delete items:",P)}},[i,l,y,S,d,g]);return{handleFileClick:Y,handleFolderClick:ae,handleClearSelection:Ce,handleSelectAllGlobal:m,uploadFiles:x,createFolder:R,bulkMove:T,renameFolder:_,updateFileMetadata:me,bulkDelete:Tt,refreshData:S}}import{useParams as hi,useSearchParams as vi,useRouter as xi,usePathname as bi}from"next/navigation";import{useCallback as xo,useEffect as to,useMemo as Xa,useRef as er,useState as de}from"react";import{toast as pa}from"sonner";function tr(e){let{mode:t,selectionMode:o,initialFolderId:a,acceptedFileTypesForModal:n,allowedFileTypes:i,provider:l,onFilesSelected:c,onClose:d,basePath:g}=e,u=hi(),b=vi(),p=xi(),C=bi(),w=Math.max(1,parseInt(b.get("page")||"1",10)),k=Math.max(1,parseInt(b.get("limit")||"24",10)),y=b.get("query")||"",M=Xa(()=>{if(t===J.PAGE&&(u!=null&&u.path)){let L=Array.isArray(u.path)?u.path[0]:u.path;return typeof L=="string"&&/^\d+$/.test(L)?Number(L):null}if(t===J.MODAL){let L=b.get("folderId");if(L&&/^\d+$/.test(L))return Number(L)}return a!=null?a:null},[t,u,b,a]),[I,N]=de([]),[h,D]=de([]),[Z,Y]=de([]),[ae,Ce]=de([]),[m,S]=de(null),[x,R]=de(!0),[T,_]=de({currentPage:w,totalPages:1,totalFiles:0,filesPerPage:k}),me=er(null);me.current=m;let[Tt,P]=de(y),[z,V]=de(y);to(()=>{let L=setTimeout(()=>{V(Tt)},300);return()=>clearTimeout(L)},[Tt]);let O=er(M),Ye=xo((L,ie)=>{let le=new URLSearchParams(b.toString());le.set("page",L.toString()),le.set("limit",ie.toString()),p.push(`${C}?${le.toString()}`,{scroll:!1})},[p,C]);to(()=>{_(L=>s(r({},L),{currentPage:w,filesPerPage:k})),P(y)},[w,k,y]),to(()=>{M!==O.current&&(t===J.PAGE&&Ye(1,k),O.current=M)},[M,k,Ye,t]);let W=T.currentPage,De=T.filesPerPage;to(()=>{let L=!1,ie=async()=>{if(M&&(!me.current||me.current.id!==M))try{R(!0);let se=await l.getFolder(M);if(L)return;S(se),await le(se)}catch(se){let ho=se instanceof Error?se.message:"Failed to load folder";if(pa.error("Load Folder Failed",{description:ho}),console.error("Failed to fetch current folder",se),L)return;S(null),L||R(!1)}else M===null&&me.current!==null?(S(null),await le(null)):me.current?await le(me.current):await le(null)},le=async se=>{var ho;if(!L){R(!0);try{let Mt=[];t===J.MODAL?Mt=n:Mt=i;let eo=await l.getItems((ho=se==null?void 0:se.id)!=null?ho:null,Mt,W,De,z);if(L)return;D(eo.folders),N(eo.files),_(eo.pagination)}catch(Mt){let eo=Mt instanceof Error?Mt.message:"Failed to load data";pa.error("Load Data Failed",{description:eo}),console.error("Failed to load data:",Mt)}finally{L||R(!1)}}};return ie(),()=>{L=!0}},[M,l,t,n,i,W,De,z]),to(()=>{Ce([]),Y([])},[m]);let[jn,Wn]=de(!1),[$n,Kn]=de(!1),[Yn,qn]=de(!1),[Qn,Jn]=de(!1),[Xn,ei]=de(!1),[ti,oi]=de(null),[ai,ri]=de(null),ni=xo(async(L=!1)=>{var ie;L||R(!0);try{let le=[];t===J.MODAL?le=n:le=i;let se=await l.getItems((ie=m==null?void 0:m.id)!=null?ie:null,le,W,De,z);D(se.folders),N(se.files),_(se.pagination)}catch(le){let se=le instanceof Error?le.message:"Failed to load data";pa.error("Load Data Failed",{description:se}),console.error("Failed to load data:",le)}finally{L||R(!1)}},[m,t,n,i,l,W,De,z]),ii=()=>Z.length>0||ae.length>0,li=()=>m,si=Xa(()=>()=>{let L=I.length+(t===J.PAGE?h.length:0),ie=Z.length+ae.length;return ie===0?!1:ie===L?!0:"indeterminate"},[I.length,h.length,Z.length,ae.length,t]),di=xo(L=>{_(ie=>s(r({},ie),{currentPage:L})),t===J.PAGE&&Ye(L,De)},[Ye,De,t]),ci=xo(L=>{P(L);let ie=new URLSearchParams(b.toString());L.trim()?(ie.set("query",L),ie.set("page","1")):ie.delete("query"),p.push(`${C}?${ie.toString()}`,{scroll:!1})},[p,C,b]);return{files:I,folders:h,selectedFiles:Z,selectedFolders:ae,currentFolder:m,isLoading:x,pagination:T,isUploadModalOpen:jn,isCreateFolderModalOpen:$n,isSearchModalOpen:Yn,isMoveFileModalOpen:Qn,isRenameFolderModalOpen:Xn,fileDetailsModalFile:ai,folderToRename:ti,setFiles:N,setFolders:D,setSelectedFiles:Y,setSelectedFolders:Ce,setCurrentFolder:S,setPagination:_,setIsUploadModalOpen:Wn,setIsCreateFolderModalOpen:Kn,setIsSearchModalOpen:qn,setIsMoveFileModalOpen:Jn,setIsRenameFolderModalOpen:ei,setFileDetailsModalFile:ri,setFolderToRename:oi,loadData:ni,setIsLoading:R,isInSelectionMode:ii,getCurrentFolder:li,getSelectionState:si,handlePageChange:di,searchQuery:Tt,updateSearchQuery:ci,mode:t,selectionMode:o,acceptedFileTypesForModal:n,provider:l,onFilesSelected:c,onClose:d,basePath:g}}import{createContext as wi,useContext as Ci,useMemo as yi}from"react";import{jsx as Fi}from"react/jsx-runtime";var or=wi(void 0);function bo({children:e,mode:t=J.PAGE,selectionMode:o=Ee.SINGLE,allowedFileTypes:a,onFilesSelected:n,onClose:i,acceptedFileTypesForModal:l,initialFolderId:c=null,provider:d,basePath:g="/media",maxUploadFiles:u=50,maxUploadSize:b=100*1024*1024}){let p=tr({mode:t,selectionMode:o,initialFolderId:c,acceptedFileTypesForModal:l,allowedFileTypes:a,provider:d,onFilesSelected:n,onClose:i,basePath:g}),C=Ja(p),w=yi(()=>({files:p.files,folders:p.folders,selectedFiles:p.selectedFiles,selectedFolders:p.selectedFolders,currentFolder:p.currentFolder,isLoading:p.isLoading,pagination:p.pagination,isUploadModalOpen:p.isUploadModalOpen,isCreateFolderModalOpen:p.isCreateFolderModalOpen,isSearchModalOpen:p.isSearchModalOpen,isMoveFileModalOpen:p.isMoveFileModalOpen,isRenameFolderModalOpen:p.isRenameFolderModalOpen,fileDetailsModalFile:p.fileDetailsModalFile,folderToRename:p.folderToRename,mode:p.mode,selectionMode:p.selectionMode,allowedFileTypes:a,acceptedFileTypesForModal:p.acceptedFileTypesForModal,maxUploadFiles:u,maxUploadSize:b,setIsUploadModalOpen:p.setIsUploadModalOpen,setIsCreateFolderModalOpen:p.setIsCreateFolderModalOpen,setIsSearchModalOpen:p.setIsSearchModalOpen,setIsMoveFileModalOpen:p.setIsMoveFileModalOpen,setSelectedFiles:p.setSelectedFiles,setSelectedFolders:p.setSelectedFolders,setIsRenameFolderModalOpen:p.setIsRenameFolderModalOpen,setFileDetailsModalFile:p.setFileDetailsModalFile,setFolderToRename:p.setFolderToRename,handleFileClick:C.handleFileClick,handleFolderClick:C.handleFolderClick,handleClearSelection:C.handleClearSelection,handleSelectAllGlobal:C.handleSelectAllGlobal,handlePageChange:p.handlePageChange,searchQuery:p.searchQuery,updateSearchQuery:p.updateSearchQuery,uploadFiles:C.uploadFiles,createFolder:C.createFolder,bulkMove:C.bulkMove,renameFolder:C.renameFolder,updateFileMetadata:C.updateFileMetadata,bulkDelete:C.bulkDelete,refreshData:C.refreshData,isInSelectionMode:p.isInSelectionMode,getCurrentFolder:p.getCurrentFolder,getSelectionState:p.getSelectionState,onClose:p.onClose,onFilesSelected:p.onFilesSelected,provider:d,basePath:p.basePath}),[p,C,d,a,u,b]);return Fi(or.Provider,{value:w,children:e})}function E(){let e=Ci(or);if(e===void 0)throw new Error("useFileManager must be used within a FileManagerProvider");return e}import{clsx as Mi}from"clsx";import{twMerge as ki}from"tailwind-merge";function v(...e){return ki(Mi(e))}import{jsx as ua,jsxs as Di}from"react/jsx-runtime";function wo(e){return Di("svg",s(r({xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 29.93 40.02",width:"100",height:"100"},e),{children:[ua("path",{fill:"#e5252a",d:"M5.21 0l13.38 0 11.34 11.82 0 22.99c0,2.88 -2.33,5.21 -5.2,5.21l-19.52 0c-2.88,0 -5.21,-2.33 -5.21,-5.21l0 -29.6c0,-2.88 2.33,-5.21 5.21,-5.21z"}),ua("polygon",{fill:"#fff",fillOpacity:".302",points:"18.58 0 18.58 11.73 29.93 11.73"}),ua("path",{fill:"#fff",fillRule:"nonzero",d:"M5.79 29.86l0 -7.31 3.11 0c0.77,0 1.38,0.21 1.84,0.64 0.46,0.42 0.69,0.99 0.69,1.7 0,0.71 -0.23,1.28 -0.69,1.7 -0.46,0.43 -1.07,0.64 -1.84,0.64l-1.24 0 0 2.63 -1.87 0zm1.87 -4.22l1.03 0c0.28,0 0.5,-0.06 0.65,-0.2 0.15,-0.13 0.23,-0.31 0.23,-0.55 0,-0.24 -0.08,-0.42 -0.23,-0.55 -0.15,-0.14 -0.37,-0.2 -0.65,-0.2l-1.03 0 0 1.5zm4.54 4.22l0 -7.31 2.59 0c0.51,0 0.99,0.07 1.44,0.22 0.45,0.15 0.86,0.36 1.22,0.65 0.36,0.28 0.65,0.66 0.86,1.14 0.2,0.48 0.31,1.03 0.31,1.65 0,0.61 -0.11,1.16 -0.31,1.64 -0.21,0.48 -0.5,0.86 -0.86,1.14 -0.36,0.29 -0.77,0.5 -1.22,0.65 -0.45,0.15 -0.93,0.22 -1.44,0.22l-2.59 0zm1.83 -1.59l0.54 0c0.29,0 0.56,-0.03 0.81,-0.1 0.24,-0.07 0.47,-0.18 0.69,-0.33 0.21,-0.15 0.38,-0.36 0.5,-0.64 0.12,-0.28 0.18,-0.61 0.18,-0.99 0,-0.39 -0.06,-0.72 -0.18,-1 -0.12,-0.28 -0.29,-0.49 -0.5,-0.64 -0.22,-0.15 -0.45,-0.26 -0.69,-0.33 -0.25,-0.07 -0.52,-0.1 -0.81,-0.1l-0.54 0 0 4.13zm5.53 1.59l0 -7.31 5.2 0 0 1.59 -3.33 0 0 1.17 2.66 0 0 1.58 -2.66 0 0 2.97 -1.87 0z"})]}))}import{jsx as ma,jsxs as Ii}from"react/jsx-runtime";function Co(e){return Ii("svg",s(r({xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 17.69 23.65",width:"100",height:"100"},e),{children:[ma("path",{fill:"#00733b",d:"M3.08 0l7.91 0 6.7 6.99 0 13.58c0,1.7 -1.38,3.08 -3.08,3.08l-11.53 0c-1.7,0 -3.08,-1.38 -3.08,-3.08l0 -17.49c0,-1.7 1.38,-3.08 3.08,-3.08z"}),ma("polygon",{fill:"#fff",fillOpacity:".302",points:"10.98 0 10.98 6.93 17.69 6.93"}),ma("path",{fill:"#fff",d:"M5.21 17.35l3.14 0 0 1.19 -3.14 0 0 -1.19zm4.12 -6.08l3.15 0 0 1.18 -3.15 0 0 -1.18zm-4.12 0l3.14 0 0 1.18 -3.14 0 0 -1.18zm4.12 2l3.15 0 0 1.19 -3.15 0 0 -1.19zm-4.12 0l3.14 0 0 1.19 -3.14 0 0 -1.19zm4.12 2.08l3.15 0 0 1.19 -3.15 0 0 -1.19zm-4.12 0l3.14 0 0 1.19 -3.14 0 0 -1.19zm4.12 2l3.15 0 0 1.19 -3.15 0 0 -1.19z"})]}))}import{jsx as fa,jsxs as Ni}from"react/jsx-runtime";function yo(e){return Ni("svg",s(r({xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 24.33 32.53",width:"100",height:"100"},e),{children:[fa("path",{fill:"#e03303",d:"M4.23 0l10.88 0 9.22 9.61 0 18.69c0,2.33 -1.9,4.23 -4.23,4.23l-15.87 0c-2.34,0 -4.23,-1.9 -4.23,-4.23l0 -24.07c0,-2.34 1.89,-4.23 4.23,-4.23z"}),fa("polygon",{fill:"#fff",fillOpacity:".302",points:"15.1 0 15.1 9.53 24.33 9.53"}),fa("path",{fill:"#fff",fillRule:"nonzero",d:"M11.76 16.13c-2.44,0.12 -4.38,2.15 -4.35,4.62 0.04,2.46 2.04,4.47 4.5,4.5 2.48,0.04 4.51,-1.9 4.62,-4.34 0.01,-0.12 -0.09,-0.22 -0.21,-0.22l-4.13 0c-0.12,0 -0.22,-0.1 -0.22,-0.21l0 -4.14c0,-0.12 -0.09,-0.21 -0.21,-0.21zm1.1 -0.67l0 4.13c0,0.12 0.09,0.21 0.21,0.21l4.14 0c0.12,0 0.21,-0.1 0.21,-0.22 -0.11,-2.34 -1.99,-4.22 -4.34,-4.33 -0.12,-0.01 -0.22,0.09 -0.22,0.21z"})]}))}import{jsx as ga,jsxs as Pi}from"react/jsx-runtime";function Fo(e){return Pi("svg",s(r({xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 38.89 51.99",width:"100",height:"100"},e),{children:[ga("path",{fill:"#0263d1",fillRule:"nonzero",d:"M6.76 0l17.4 0 14.73 15.36 0 29.87c0,3.73 -3.03,6.76 -6.77,6.76l-25.36 0c-3.73,0 -6.76,-3.03 -6.76,-6.76l0 -38.47c0,-3.73 3.03,-6.76 6.76,-6.76z"}),ga("polygon",{fill:"#fff",fillOpacity:".302",points:"24.14 0 24.14 15.24 38.89 15.24"}),ga("path",{fill:"#fff",fillRule:"nonzero",d:"M26.3 27.05l-13.71 0c-0.63,0 -1.15,-0.51 -1.15,-1.14 0,-0.63 0.52,-1.14 1.15,-1.14l13.71 0c0.63,0 1.14,0.51 1.14,1.14 0,0.63 -0.51,1.14 -1.14,1.14l0 0zm-4.57 13.71l-9.14 0c-0.63,0 -1.15,-0.51 -1.15,-1.14 0,-0.63 0.52,-1.14 1.15,-1.14l9.14 0c0.63,0 1.14,0.51 1.14,1.14 0,0.63 -0.51,1.14 -1.14,1.14l0 0zm4.57 -4.57l-13.71 0c-0.63,0 -1.15,-0.51 -1.15,-1.14 0,-0.63 0.52,-1.14 1.15,-1.14l13.71 0c0.63,0 1.14,0.51 1.14,1.14 0,0.63 -0.51,1.14 -1.14,1.14l0 0zm0 -4.57l-13.71 0c-0.63,0 -1.15,-0.51 -1.15,-1.14 0,-0.63 0.52,-1.14 1.15,-1.14l13.71 0c0.63,0 1.14,0.51 1.14,1.14 0,0.63 -0.51,1.14 -1.14,1.14l0 0z"})]}))}import{jsx as ha,jsxs as Si}from"react/jsx-runtime";function Mo(e){return Si("svg",s(r({xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 24.33 32.53",width:"100",height:"100"},e),{children:[ha("path",{fill:"#ffc000",d:"M4.23 0l10.88 0 9.22 9.61 0 18.69c0,2.33 -1.9,4.23 -4.23,4.23l-15.87 0c-2.34,0 -4.23,-1.9 -4.23,-4.23l0 -24.07c0,-2.34 1.89,-4.23 4.23,-4.23z"}),ha("polygon",{fill:"#ffffff",fillOpacity:".302",points:"15.1 0 15.1 9.53 24.33 9.53"}),ha("path",{fill:"#ffffff",fillRule:"nonzero",d:"M16.45 21.21l-8.57 0c-0.4,0 -0.72,0.32 -0.72,0.72 0,0.39 0.32,0.71 0.72,0.71l8.57 0c0.4,0 0.72,-0.32 0.72,-0.71 0,-0.4 -0.32,-0.72 -0.72,-0.72l0 0zm0 2.86l-8.57 0c-0.4,0 -0.72,0.32 -0.72,0.72 0,0.39 0.32,0.71 0.72,0.71l8.57 0c0.4,0 0.72,-0.32 0.72,-0.71 0,-0.4 -0.32,-0.72 -0.72,-0.72l0 0zm-4.36 -8.57l-4.21 0c-0.4,0 -0.72,0.31 -0.72,0.71 0,0.4 0.32,0.71 0.72,0.71l4.21 0c0.4,0 0.72,-0.31 0.72,-0.71 0,-0.4 -0.32,-0.71 -0.72,-0.71l0 0zm4.36 2.85l-8.57 0c-0.4,0 -0.72,0.32 -0.72,0.72 0,0.39 0.32,0.71 0.72,0.71l8.57 0c0.4,0 0.72,-0.32 0.72,-0.71 0,-0.4 -0.32,-0.72 -0.72,-0.72l0 0z"})]}))}import{jsx as Et,jsxs as va}from"react/jsx-runtime";function ko(e){return va("svg",s(r({xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",width:"100",height:"100",viewBox:"0 0 48 48","aria-hidden":"true"},e),{children:[va("linearGradient",{id:"X-uD4Bgl9JIhUIufrZZzja_Pjo0BrMdm974_gr1",x1:"37.127",x2:"25.868",y1:"6.873",y2:"18.132",gradientUnits:"userSpaceOnUse",children:[Et("stop",{offset:"0",stopColor:"#262626",stopOpacity:"0"}),Et("stop",{offset:".913",stopColor:"#262626",stopOpacity:".8"})]}),Et("path",{fill:"url(#X-uD4Bgl9JIhUIufrZZzja_Pjo0BrMdm974_gr1)",d:"M28,4v8c0,2.209,1.791,4,4,4h8L28,4z",children:" "}),va("linearGradient",{id:"X-uD4Bgl9JIhUIufrZZzjb_Pjo0BrMdm974_gr2",x1:"-8.398",x2:"74.731",y1:"51.185",y2:"-18.568",gradientUnits:"userSpaceOnUse",children:[Et("stop",{offset:"0",stopColor:"#262626",stopOpacity:"0"}),Et("stop",{offset:"1",stopColor:"#262626",stopOpacity:".8"})]}),Et("path",{fill:"url(#X-uD4Bgl9JIhUIufrZZzjb_Pjo0BrMdm974_gr2)",d:"M40,16v23c0,2.761-2.239,5-5,5H8V9c0-2.761,2.239-5,5-5h15L40,16z"})]}))}import{jsx as xa,jsxs as zi}from"react/jsx-runtime";function Do(e){return zi("svg",s(r({xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 24.33 32.53",width:"100",height:"100","aria-hidden":"true"},e),{children:[xa("path",{fill:"#ffb11f",d:"M4.23 0l10.88 0 9.22 9.61 0 18.69c0,2.33 -1.9,4.23 -4.23,4.23l-15.87 0c-2.34,0 -4.23,-1.9 -4.23,-4.23l0 -24.07c0,-2.34 1.89,-4.23 4.23,-4.23z"}),xa("polygon",{fill:"#fff",fillOpacity:".302",points:"15.1 0 15.1 9.53 24.33 9.53"}),xa("path",{fill:"#fff",fillRule:"nonzero",d:"M8.96 16.9l0 -2.22c0,-0.24 -0.19,-0.43 -0.43,-0.43l-1.2 0c-0.24,0 -0.43,0.19 -0.43,0.43l0 2.22 -0.67 1.96c-0.19,0.55 -0.1,1.16 0.24,1.63 0.33,0.47 0.88,0.75 1.46,0.75 0.58,0 1.12,-0.28 1.46,-0.75 0.34,-0.47 0.43,-1.08 0.24,-1.63l-0.67 -1.96zm-0.28 3.08c-0.34,0.49 -1.16,0.49 -1.51,0 -0.17,-0.24 -0.22,-0.56 -0.12,-0.84l0.22 -0.66 1.31 0 0.23 0.66c0.09,0.28 0.05,0.6 -0.13,0.84zm-3.41 -17.65l0 1.22c0,0.24 0.19,0.43 0.43,0.43l1.63 0 0 1.82 -1.63 0c-0.24,0 -0.43,0.19 -0.43,0.43l0 0.94c0,0.24 0.19,0.44 0.43,0.44l1.63 0 0 1.81 -1.63 0c-0.24,0 -0.43,0.19 -0.43,0.43l0 0.95c0,0.24 0.19,0.43 0.43,0.43l1.63 0 0 1.38c0,0.24 0.2,0.43 0.44,0.43l2.39 0c0.23,0 0.43,-0.19 0.43,-0.43l0 -0.95c0,-0.23 -0.2,-0.43 -0.43,-0.43l-1.64 0 0 -1.81 1.64 0c0.23,0 0.43,-0.19 0.43,-0.43l0 -0.95c0,-0.24 -0.2,-0.43 -0.43,-0.43l-1.64 0 0 -1.81 1.64 0c0.23,0 0.43,-0.2 0.43,-0.44l0 -0.94c0,-0.24 -0.2,-0.44 -0.43,-0.44l-1.64 0 0 -1.66c0,0 -3.25,0.01 -3.25,0.01z"})]}))}import{jsx as ba,jsxs as Ri}from"react/jsx-runtime";function Io(e){return Ri("svg",s(r({xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 20.49 27.4",width:"100",height:"100","aria-hidden":"true"},e),{children:[ba("path",{fill:"#00a1e0",d:"M3.56 0l9.17 0 7.76 8.1 0 15.73c0,1.97 -1.59,3.57 -3.56,3.57l-13.37 0c-1.96,0 -3.56,-1.6 -3.56,-3.57l0 -20.27c0,-1.96 1.6,-3.56 3.56,-3.56z"}),ba("polygon",{fill:"#fff",fillOpacity:".302",points:"12.72 0 12.72 8.03 20.49 8.03"}),ba("path",{fill:"#fff",fillRule:"nonzero",d:"M12.07 20.44l-0.52 0 0 -0.99 0.11 0c0.26,0 0.39,-0.14 0.39,-0.42l0 -1.45c0,-0.23 0.06,-0.41 0.16,-0.53 0.11,-0.11 0.27,-0.21 0.48,-0.3 -0.2,-0.08 -0.36,-0.18 -0.47,-0.3 -0.11,-0.12 -0.17,-0.29 -0.17,-0.52l0 -1.45c0,-0.28 -0.13,-0.42 -0.39,-0.42l-0.11 0 0 -0.99 0.52 0c0.31,0 0.56,0.1 0.76,0.3 0.2,0.2 0.3,0.45 0.3,0.75l0 1.55c0,0.38 0.21,0.57 0.63,0.57l0 1.03c-0.42,0 -0.63,0.19 -0.63,0.58l0 1.54c0,0.3 -0.1,0.55 -0.3,0.75 -0.2,0.2 -0.45,0.3 -0.76,0.3zm-3.65 0c-0.3,0 -0.56,-0.1 -0.76,-0.3 -0.2,-0.2 -0.3,-0.45 -0.3,-0.75l0 -1.54c0,-0.39 -0.21,-0.58 -0.63,-0.58l0 -1.03c0.42,0 0.63,-0.19 0.63,-0.57l0 -1.55c0,-0.3 0.1,-0.55 0.3,-0.75 0.2,-0.2 0.46,-0.3 0.76,-0.3l0.53 0 0 0.99 -0.12 0c-0.26,0 -0.39,0.14 -0.39,0.42l0 1.45c0,0.23 -0.05,0.4 -0.16,0.52 -0.11,0.12 -0.27,0.22 -0.48,0.3 0.21,0.09 0.37,0.19 0.48,0.3 0.11,0.12 0.16,0.3 0.16,0.53l0 1.45c0,0.28 0.13,0.42 0.39,0.42l0.12 0 0 0.99 -0.53 0z"})]}))}import{jsx as wa,jsxs as Ti}from"react/jsx-runtime";function Lt(e){return Ti("svg",s(r({xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 24.33 32.53",width:"100",height:"100"},e),{children:[wa("path",{fill:"#90c",d:"M4.23 0l10.88 0 9.22 9.61 0 18.69c0,2.33 -1.9,4.23 -4.23,4.23l-15.87 0c-2.34,0 -4.23,-1.9 -4.23,-4.23l0 -24.07c0,-2.34 1.89,-4.23 4.23,-4.23z"}),wa("polygon",{fill:"#fff",fillOpacity:".302",points:"15.1 0 15.1 9.53 24.33 9.53"}),wa("path",{fill:"#fff",fillRule:"nonzero",d:"M15.07 21.38c0.31,-0.52 0.52,-1.18 0.56,-1.83 0.02,-0.42 -0.07,-0.86 -0.27,-1.27 -0.32,-0.65 -0.86,-1.01 -1.39,-1.37 -0.39,-0.26 -0.76,-0.51 -1.02,-0.86l-0.05 -0.06c-0.15,-0.21 -0.33,-0.45 -0.36,-0.65 -0.02,-0.2 -0.21,-0.34 -0.4,-0.33 -0.21,0.02 -0.36,0.18 -0.36,0.39l0 6.86c-0.32,-0.2 -0.72,-0.32 -1.16,-0.32 -1.06,0 -1.92,0.69 -1.92,1.54 0,0.85 0.86,1.54 1.92,1.54 1.06,0 1.93,-0.69 1.93,-1.54l0 -4.49c0.58,0.23 1.52,0.79 1.78,2.1 -0.05,0.07 -0.09,0.15 -0.15,0.21 -0.14,0.16 -0.12,0.4 0.04,0.55 0.16,0.14 0.4,0.12 0.54,-0.04 0.1,-0.12 0.2,-0.25 0.28,-0.4 0.01,-0.01 0.02,-0.02 0.03,-0.03z"})]}))}import{jsx as ee,jsxs as ar}from"react/jsx-runtime";function No(e){return ar("svg",s(r({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 64 64",width:"100",height:"100"},e),{children:[ee("path",{fill:"#188a32",d:"M56,35v8c0,1.66-1.34,3-3,3H11c-1.66,0-3-1.34-3-3v-8c0-1.66,1.34-3,3-3h42C54.66,32,56,33.34,56,35z"}),ee("path",{fill:"#0082AA",d:"M44,29v5c0,1.66-1.34,3-3,3H23c-1.66,0-3-1.34-3-3v-5h4v4h16v-4H44z"}),ee("path",{fill:"#4d50c6",d:`M53,32H11c-1.657,0-3-1.343-3-3v-8c0-1.657,1.343-3,3-3h42c1.657,0,3,1.343,3,3v8
2
- C56,30.657,54.657,32,53,32z`}),ee("path",{fill:"#e6275e",d:`M53,18H11c-1.657,0-3-1.343-3-3V7c0-1.657,1.343-3,3-3h42c1.657,0,3,1.343,3,3v8
3
- C56,16.657,54.657,18,53,18z`}),ee("rect",{width:"16",height:"42",x:"24",y:"4",fill:"#FAB400"}),ee("path",{fill:"#DC9600",d:"M32,46L32,46c-4.418,0-8-3.582-8-8v-4h16v4C40,42.418,36.418,46,32,46z"}),ee("path",{fill:"#FAB400",d:"M32,44L32,44c-4.418,0-8-3.582-8-8v-4h16v4C40,40.418,36.418,44,32,44z"}),ee("rect",{width:"16",height:"4",x:"24",y:"33",fill:"#DC9600"}),ee("path",{fill:"#F0F0F0",d:`M44,17v16c0,1.66-1.34,3-3,3H23c-1.66,0-3-1.34-3-3V17c0-1.66,1.34-3,3-3h1v18h16V14h1
4
- C42.66,14,44,15.34,44,17z`}),ee("path",{fill:"#D2D2D2",d:"M34,31v2c0,1.1-0.9,2-2,2s-2-0.9-2-2v-2H34z"}),ee("path",{fill:"#F0F0F0",d:`M32,34L32,34c-1.105,0-2-0.895-2-2v-8c0-1.105,0.895-2,2-2h0c1.105,0,2,0.895,2,2v8
5
- C34,33.105,33.105,34,32,34z`}),ee("circle",{cx:"32",cy:"18",r:"2",fill:"#C80A50"}),ee("circle",{cx:"32",cy:"10",r:"2",fill:"#00A0C8"}),ee("path",{fill:"#F0F0F0",d:"M34,18h-4c0-1.1,0.9-2,2-2S34,16.9,34,18z"}),ee("path",{fill:"#0A5078",d:`M47,60H17c-1.105,0-2-0.895-2-2V44c0-1.105,0.895-2,2-2h30c1.105,0,2,0.895,2,2v14
6
- C49,59.105,48.105,60,47,60z`}),ee("path",{fill:"#F0F0F0",d:`M35,53h-6c-0.552,0-1-0.448-1-1v-3c0-2.206,1.794-4,4-4s4,1.794,4,4v3C36,52.552,35.552,53,35,53z
7
- M30,51h4v-2c0-1.103-0.897-2-2-2s-2,0.897-2,2V51z`}),ee("path",{fill:"#F0F0F0",d:"M29 57c-.552 0-1-.448-1-1v-4c0-.552.448-1 1-1s1 .448 1 1v4C30 56.552 29.552 57 29 57zM35 57c-.552 0-1-.448-1-1v-4c0-.552.448-1 1-1s1 .448 1 1v4C36 56.552 35.552 57 35 57zM42 53h-3c-.552 0-1-.448-1-1v-6c0-.552.448-1 1-1h3c2.206 0 4 1.794 4 4S44.206 53 42 53zM40 51h2c1.103 0 2-.897 2-2s-.897-2-2-2h-2V51z"}),ee("path",{fill:"#F0F0F0",d:"M39 57c-.552 0-1-.448-1-1v-4c0-.552.448-1 1-1s1 .448 1 1v4C40 56.552 39.552 57 39 57zM45.001 57c-.367 0-.72-.202-.896-.553l-2-4c-.247-.494-.047-1.095.447-1.342.495-.248 1.095-.047 1.342.447l2 4c.247.494.047 1.095-.447 1.342C45.304 56.966 45.151 57 45.001 57z"}),ar("g",{children:[ee("path",{fill:"#F0F0F0",d:`M22,53h-3c-0.552,0-1-0.448-1-1v-6c0-0.552,0.448-1,1-1h3c2.206,0,4,1.794,4,4S24.206,53,22,53z
8
- M20,51h2c1.103,0,2-0.897,2-2s-0.897-2-2-2h-2V51z`}),ee("path",{fill:"#F0F0F0",d:"M19 57c-.552 0-1-.448-1-1v-4c0-.552.448-1 1-1s1 .448 1 1v4C20 56.552 19.552 57 19 57zM25.001 57c-.367 0-.72-.202-.896-.553l-2-4c-.247-.494-.047-1.095.447-1.342.495-.248 1.095-.047 1.342.447l2 4c.247.494.047 1.095-.447 1.342C25.304 56.966 25.151 57 25.001 57z"})]})]}))}import{jsx as rr,jsxs as Ei}from"react/jsx-runtime";function Po(e){return Ei("svg",s(r({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 48 48",width:"100",height:"100"},e),{children:[rr("path",{fill:"#e8e9ea",d:`M8.16,17.51V3.74c0-1.79,1.45-3.24,3.24-3.24h20.53l12.79,12.8v30.96c0,1.79-1.45,3.24-3.24,3.24H11.4
9
- c-1.79,0-3.24-1.45-3.24-3.24v-1.62`}),rr("path",{fill:"#697d7f",d:"M44.72 13.3h-9.93c-1.58 0-2.86-1.28-2.86-2.86V.5M11.53 25.42c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5H4.78c-.83 0-1.5.67-1.5 1.5v11.53c0 .83.67 1.5 1.5 1.5h6.75c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5H6.28v-2.76h3.98c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5H6.28v-2.76H11.53zM36.33 25.42c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5h-6.75c-.83 0-1.5.67-1.5 1.5v11.53c0 .83.67 1.5 1.5 1.5h6.75c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5h-5.25v-2.76h3.98c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5h-3.98v-2.76H36.33zM15.55 36.67c.26.19.57.28.87.28.47 0 .93-.22 1.22-.63l2.92-4.07 2.92 4.07c.29.41.75.63 1.22.63.3 0 .61-.09.87-.28.67-.48.83-1.42.34-2.09l-3.51-4.89 3.51-4.89c.48-.67.33-1.61-.34-2.09-.67-.48-1.61-.33-2.09.34l-2.92 4.07-2.92-4.07c-.48-.67-1.42-.83-2.09-.34-.67.48-.83 1.42-.34 2.09l3.51 4.89-3.51 4.89C14.72 35.25 14.87 36.19 15.55 36.67z"})]}))}import{jsx as Ca,jsxs as Li}from"react/jsx-runtime";function At(e){return Li("svg",s(r({xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 17.69 23.65",width:"100",height:"100"},e),{children:[Ca("path",{fill:"#0ac963",d:"M3.08 0l7.91 0 6.7 6.99 0 13.58c0,1.7 -1.38,3.08 -3.08,3.08l-11.53 0c-1.7,0 -3.08,-1.38 -3.08,-3.08l0 -17.49c0,-1.7 1.38,-3.08 3.08,-3.08z"}),Ca("polygon",{fill:"#fff",fillOpacity:".302",points:"10.98 0 10.98 6.93 17.69 6.93"}),Ca("path",{fill:"#fff",d:"M11.85 11.82l-6.01 0c-0.45,0 -0.82,0.37 -0.82,0.82l0 3.82c0,0.45 0.37,0.82 0.82,0.82l6.01 0c0.45,0 0.81,-0.37 0.81,-0.82l0 -3.82c0,-0.45 -0.36,-0.82 -0.81,-0.82zm-4.37 1.03c0.49,0 0.88,0.4 0.88,0.88 0,0.49 -0.39,0.89 -0.88,0.89 -0.49,0 -0.89,-0.4 -0.89,-0.89 0,-0.48 0.4,-0.88 0.89,-0.88zm4.64 3.61c0,0.15 -0.12,0.28 -0.27,0.28l-6.01 0c-0.15,0 -0.27,-0.13 -0.27,-0.28l0 -0.16 1.09 -1.09 0.9 0.9c0.11,0.11 0.28,0.11 0.39,0l2.26 -2.26 1.91 1.91 0 0.7 0 0z"})]}))}import{jsx as ya,jsxs as Ai}from"react/jsx-runtime";function So(e){return Ai("svg",s(r({xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 29.93 40.02",width:"100",height:"100"},e),{children:[ya("path",{fill:"#fa0000",d:"M5.21 0l13.38 0 11.34 11.82 0 22.99c0,2.88 -2.33,5.21 -5.2,5.21l-19.52 0c-2.88,0 -5.21,-2.33 -5.21,-5.21l0 -29.6c0,-2.88 2.33,-5.21 5.21,-5.21z"}),ya("polygon",{fill:"#fff",fillOpacity:".302",points:"18.58 0 18.58 11.73 29.93 11.73"}),ya("path",{fill:"#fff",fillRule:"nonzero",d:"M14.97 18.16c-3.57,0 -6.47,2.9 -6.47,6.47 0,3.57 2.9,6.46 6.47,6.46 3.57,0 6.46,-2.89 6.46,-6.46 0,-3.57 -2.9,-6.46 -6.46,-6.47zm2.72 6.67c-0.05,0.09 -0.12,0.16 -0.21,0.21l0 0 -3.69 1.85c-0.23,0.11 -0.51,0.02 -0.62,-0.21 -0.04,-0.06 -0.05,-0.13 -0.05,-0.21l0 -3.69c0,-0.26 0.21,-0.46 0.46,-0.46 0.07,0 0.14,0.01 0.21,0.05l3.69 1.84c0.23,0.12 0.32,0.39 0.21,0.62z"})]}))}import{jsx as kt,jsxs as _i}from"react/jsx-runtime";function zo(e){return _i("svg",s(r({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 64 64",width:"100",height:"100"},e),{children:[kt("path",{fill:"#5a5959",d:`M2.1,57.4h57.7c1.1,0,2.1-0.9,2.1-2.1V13.4c0-1.1-0.9-2.1-2.1-2.1H31c-0.8,0-1.5-0.4-1.8-1.1l-1.7-3.4
10
- c-0.4-0.7-1.1-1.1-1.8-1.1H2.1C0.9,5.7,0,6.6,0,7.8v47.5C0,56.4,0.9,57.4,2.1,57.4z`}),kt("path",{fill:"#504e4e",d:`M3,58.3h56.7c1.1,0,2.1-0.9,2.1-2.1V14.3c0-1.1-0.9-2.1-2.1-2.1H31c-0.8,0-1.5-0.4-1.8-1.1l-1.7-3.4
11
- c-0.4-0.7-1.1-1.1-1.8-1.1H2.1C0.9,6.6,0,7.6,0,8.7v46.6C0,56.9,1.3,58.3,3,58.3z`}),kt("rect",{width:"58.6",height:"21.1",x:"1.6",y:"14.7",fill:"#ffffff"}),kt("rect",{width:".8",height:"21.1",x:"1.6",y:"14.7",fill:"#f3f3f3"}),kt("rect",{width:"58.6",height:".9",x:"1.6",y:"14.7",fill:"#f3f1f1"}),kt("path",{fill:"#676666",d:`M64,18.6v35.8c0,1.7-1.3,3-3,3H3c-1.7,0-3-1.3-3-3v-31c0-1.7,1.3-3,3-3h29.2c0.8,0,1.6-0.3,2.1-0.9l3-3
12
- c0.6-0.6,1.3-0.9,2.1-0.9H61C62.7,15.6,64,17,64,18.6z`}),kt("path",{fill:"#6f6d6d",d:`M64,19.5v35.8c0,1.7-1.3,3-3,3H3c-1.7,0-3-1.3-3-3v-31c0-1.7,1.3-3,3-3h29.2c0.8,0,1.6-0.3,2.1-0.9l3-3
13
- c0.6-0.6,1.3-0.9,2.1-0.9H61C62.7,16.5,64,17.9,64,19.5z`})]}))}import{jsx as Ro,jsxs as Vi}from"react/jsx-runtime";function To(e){return Vi("svg",s(r({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 64 64",width:"100",height:"100"},e),{children:[Ro("path",{fill:"#5a5959",d:`M2.1,57.4h57.7c1.1,0,2.1-0.9,2.1-2.1V13.4c0-1.1-0.9-2.1-2.1-2.1H31c-0.8,0-1.5-0.4-1.8-1.1l-1.7-3.4
14
- c-0.4-0.7-1.1-1.1-1.8-1.1H2.1C0.9,5.7,0,6.6,0,7.8v47.5C0,56.4,0.9,57.4,2.1,57.4z`}),Ro("path",{fill:"#504e4e",d:`M3,58.3h56.7c1.1,0,2.1-0.9,2.1-2.1V14.3c0-1.1-0.9-2.1-2.1-2.1H31c-0.8,0-1.5-0.4-1.8-1.1l-1.7-3.4
15
- c-0.4-0.7-1.1-1.1-1.8-1.1H2.1C0.9,6.6,0,7.6,0,8.7v46.6C0,56.9,1.3,58.3,3,58.3z`}),Ro("path",{fill:"#676666",d:`M64,18.6v35.8c0,1.7-1.3,3-3,3H3c-1.7,0-3-1.3-3-3v-31c0-1.7,1.3-3,3-3h29.2c0.8,0,1.6-0.3,2.1-0.9l3-3
16
- c0.6-0.6,1.3-0.9,2.1-0.9H61C62.7,15.6,64,17,64,18.6z`}),Ro("path",{fill:"#6f6d6d",d:`M64,19.5v35.8c0,1.7-1.3,3-3,3H3c-1.7,0-3-1.3-3-3v-31c0-1.7,1.3-3,3-3h29.2c0.8,0,1.6-0.3,2.1-0.9l3-3
17
- c0.6-0.6,1.3-0.9,2.1-0.9H61C62.7,16.5,64,17.9,64,19.5z`})]}))}import{jsx as re,jsxs as _t}from"react/jsx-runtime";function qe(e){return re("svg",s(r({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24","aria-hidden":"true"},e),{children:_t("g",{fill:"none",children:[re("path",{d:"M16.2 5C17.8802 5 18.7202 5 19.362 5.32698C19.9265 5.6146 20.3854 6.07354 20.673 6.63803C21 7.27976 21 8.11984 21 9.8V11.2C21 12.8802 21 13.7202 20.673 14.362C20.3854 14.9265 19.9265 15.3854 19.362 15.673C18.7202 16 17.8802 16 16.2 16H7.8C6.11984 16 5.27976 16 4.63803 15.673C4.07354 15.3854 3.6146 14.9265 3.32698 14.362C3 13.7202 3 12.8802 3 11.2L3 6.8C3 5.11984 3 4.27976 3.32698 3.63803C3.6146 3.07354 4.07354 2.6146 4.63803 2.32698C5.27976 2 6.11984 2 7.8 2L9.28741 2C9.91355 2 10.2266 2 10.5108 2.0863C10.7624 2.1627 10.9964 2.28796 11.1996 2.45491C11.429 2.64349 11.6027 2.90398 11.95 3.42496L13 5H16.2Z",fill:"url(#1752500502786-6297956_folder_existing_0_ekojck6b3)","data-glass":"origin",mask:"url(#1752500502786-6297956_folder_mask_2iow0yqdp)"}),re("path",{d:"M16.2 5C17.8802 5 18.7202 5 19.362 5.32698C19.9265 5.6146 20.3854 6.07354 20.673 6.63803C21 7.27976 21 8.11984 21 9.8V11.2C21 12.8802 21 13.7202 20.673 14.362C20.3854 14.9265 19.9265 15.3854 19.362 15.673C18.7202 16 17.8802 16 16.2 16H7.8C6.11984 16 5.27976 16 4.63803 15.673C4.07354 15.3854 3.6146 14.9265 3.32698 14.362C3 13.7202 3 12.8802 3 11.2L3 6.8C3 5.11984 3 4.27976 3.32698 3.63803C3.6146 3.07354 4.07354 2.6146 4.63803 2.32698C5.27976 2 6.11984 2 7.8 2L9.28741 2C9.91355 2 10.2266 2 10.5108 2.0863C10.7624 2.1627 10.9964 2.28796 11.1996 2.45491C11.429 2.64349 11.6027 2.90398 11.95 3.42496L13 5H16.2Z",fill:"url(#1752500502786-6297956_folder_existing_0_ekojck6b3)","data-glass":"clone",filter:"url(#1752500502786-6297956_folder_filter_56qas2ark)",clipPath:"url(#1752500502786-6297956_folder_clipPath_gygn8e14a)"}),re("path",{d:"M17.4051 9C19.3327 9 20.2965 9 20.9861 9.39213C21.5914 9.73631 22.0581 10.2803 22.3062 10.9309C22.5889 11.6721 22.4424 12.6247 22.1492 14.5299L21.6262 17.9299C21.4039 19.3744 21.2928 20.0966 20.9388 20.6393C20.6267 21.1176 20.1846 21.4969 19.6644 21.7326C19.0742 22 18.3435 22 16.882 22L7.11801 22C5.65653 22 4.92579 22 4.33558 21.7326C3.8154 21.4969 3.3733 21.1176 3.06124 20.6393C2.70717 20.0966 2.59606 19.3744 2.37383 17.9299L1.85075 14.5299C1.55764 12.6247 1.41109 11.6721 1.6938 10.9309C1.94194 10.2803 2.40865 9.73631 3.01392 9.39213C3.70353 9 4.66733 9 6.59493 9L17.4051 9Z",fill:"url(#1752500502786-6297956_folder_existing_1_v5o9796uz)","data-glass":"blur"}),re("path",{d:"M18.6807 9.00586C19.7975 9.02423 20.4692 9.09846 20.9864 9.39258C21.5915 9.73676 22.0586 10.2802 22.3067 10.9307C22.5894 11.6719 22.4426 12.6251 22.1495 14.5303L21.626 17.9297C21.4038 19.3742 21.2926 20.097 20.9385 20.6396L20.8155 20.8135C20.5147 21.2098 20.1193 21.5262 19.6641 21.7324C19.074 21.9997 18.3431 22 16.8819 22V21.25C17.624 21.25 18.1389 21.2495 18.543 21.2188C18.9374 21.1887 19.1709 21.133 19.3546 21.0498C19.7447 20.873 20.0766 20.5882 20.3106 20.2295C20.4208 20.0606 20.5119 19.8385 20.6016 19.4531C20.6935 19.0584 20.772 18.5489 20.8848 17.8154L21.4083 14.416C21.5568 13.4504 21.6601 12.7732 21.6954 12.2441C21.7302 11.7223 21.6913 11.4231 21.6055 11.1982C21.4194 10.7103 21.0693 10.3021 20.6153 10.0439C20.4061 9.92506 20.1166 9.84086 19.5958 9.7959C19.0675 9.75031 18.3823 9.75 17.4053 9.75H6.59479C5.61785 9.75 4.93266 9.75032 4.40436 9.7959C3.88353 9.84086 3.59399 9.92504 3.38483 10.0439C2.93088 10.3021 2.5807 10.7103 2.3946 11.1982C2.30885 11.4231 2.26996 11.7223 2.30475 12.2441C2.34005 12.7732 2.44331 13.4504 2.59186 14.416L3.1153 17.8154C3.22814 18.5489 3.30665 19.0584 3.3985 19.4531C3.4882 19.8385 3.5793 20.0606 3.68952 20.2295C3.92357 20.5882 4.25545 20.873 4.64558 21.0498C4.82929 21.133 5.06268 21.1887 5.4571 21.2188C5.86121 21.2495 6.37613 21.25 7.11823 21.25V22L6.14948 21.9961C5.44148 21.9856 4.96108 21.9493 4.56452 21.8213L4.336 21.7324C3.88079 21.5262 3.48544 21.2098 3.18464 20.8135L3.06159 20.6396C2.79608 20.2327 2.66703 19.7244 2.52546 18.8867L2.37409 17.9297L1.85065 14.5303C1.57585 12.744 1.42974 11.7947 1.64558 11.0723L1.6944 10.9307C1.91158 10.3615 2.29578 9.8738 2.79401 9.53027L3.01374 9.39258C3.70332 9.00046 4.66737 9 6.59479 9H17.4053L18.6807 9.00586ZM16.8819 21.25V22H7.11823V21.25H16.8819Z",fill:"url(#1752500502786-6297956_folder_existing_2_vhap9347d)"}),_t("defs",{children:[_t("linearGradient",{id:"1752500502786-6297956_folder_existing_0_ekojck6b3",x1:"12",y1:"2",x2:"12",y2:"16",gradientUnits:"userSpaceOnUse",children:[re("stop",{stopColor:"#575757"}),re("stop",{offset:"1",stopColor:"#151515"})]}),_t("linearGradient",{id:"1752500502786-6297956_folder_existing_1_v5o9796uz",x1:"23",y1:"15.5",x2:"1",y2:"15.5",gradientUnits:"userSpaceOnUse",children:[re("stop",{stopColor:"#E3E3E5",stopOpacity:".6"}),re("stop",{offset:"1",stopColor:"#BBBBC0",stopOpacity:".6"})]}),_t("linearGradient",{id:"1752500502786-6297956_folder_existing_2_vhap9347d",x1:"12",y1:"9",x2:"12",y2:"16.528",gradientUnits:"userSpaceOnUse",children:[re("stop",{stopColor:"#fff"}),re("stop",{offset:"1",stopColor:"#fff",stopOpacity:"0"})]}),re("filter",{id:"1752500502786-6297956_folder_filter_56qas2ark",x:"-100%",y:"-100%",width:"400%",height:"400%",filterUnits:"objectBoundingBox",primitiveUnits:"userSpaceOnUse",children:re("feGaussianBlur",{stdDeviation:"2",x:"0%",y:"0%",width:"100%",height:"100%",in:"SourceGraphic",edgeMode:"none",result:"blur"})}),re("clipPath",{id:"1752500502786-6297956_folder_clipPath_gygn8e14a",children:re("path",{d:"M17.4051 9C19.3327 9 20.2965 9 20.9861 9.39213C21.5914 9.73631 22.0581 10.2803 22.3062 10.9309C22.5889 11.6721 22.4424 12.6247 22.1492 14.5299L21.6262 17.9299C21.4039 19.3744 21.2928 20.0966 20.9388 20.6393C20.6267 21.1176 20.1846 21.4969 19.6644 21.7326C19.0742 22 18.3435 22 16.882 22L7.11801 22C5.65653 22 4.92579 22 4.33558 21.7326C3.8154 21.4969 3.3733 21.1176 3.06124 20.6393C2.70717 20.0966 2.59606 19.3744 2.37383 17.9299L1.85075 14.5299C1.55764 12.6247 1.41109 11.6721 1.6938 10.9309C1.94194 10.2803 2.40865 9.73631 3.01392 9.39213C3.70353 9 4.66733 9 6.59493 9L17.4051 9Z",fill:"url(#1752500502786-6297956_folder_existing_1_v5o9796uz)"})}),_t("mask",{id:"1752500502786-6297956_folder_mask_2iow0yqdp",children:[re("rect",{width:"100%",height:"100%",fill:"#FFF"}),re("path",{d:"M17.4051 9C19.3327 9 20.2965 9 20.9861 9.39213C21.5914 9.73631 22.0581 10.2803 22.3062 10.9309C22.5889 11.6721 22.4424 12.6247 22.1492 14.5299L21.6262 17.9299C21.4039 19.3744 21.2928 20.0966 20.9388 20.6393C20.6267 21.1176 20.1846 21.4969 19.6644 21.7326C19.0742 22 18.3435 22 16.882 22L7.11801 22C5.65653 22 4.92579 22 4.33558 21.7326C3.8154 21.4969 3.3733 21.1176 3.06124 20.6393C2.70717 20.0966 2.59606 19.3744 2.37383 17.9299L1.85075 14.5299C1.55764 12.6247 1.41109 11.6721 1.6938 10.9309C1.94194 10.2803 2.40865 9.73631 3.01392 9.39213C3.70353 9 4.66733 9 6.59493 9L17.4051 9Z",fill:"#000"})]})]})]})}))}import{jsx as nr,jsxs as Gi}from"react/jsx-runtime";function Eo(e){return Gi("svg",s(r({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},e),{children:[nr("path",{opacity:"0.4",d:"M13.4919 2.29395C13.0743 1.94268 12.5457 1.75 11.9997 1.75C11.5221 1.75 11.058 1.89775 10.6697 2.16992L10.5085 2.29395L1.5974 9.78906C1.18491 10.1364 1.13178 10.7528 1.47924 11.165C1.78946 11.5327 2.31307 11.6121 2.71557 11.3789V15.9531V15.955C2.71555 17.0543 2.71553 17.9612 2.7976 18.6885C2.88313 19.4463 3.06823 20.1292 3.52318 20.7217L3.68627 20.9199C3.85487 21.1119 4.04268 21.2876 4.24584 21.4434L4.47143 21.6016C5.01004 21.9427 5.61706 22.0932 6.281 22.168C7.00121 22.2491 7.89724 22.249 8.98176 22.249H8.99975H14.9997H15.0178C16.1023 22.249 16.9983 22.2491 17.7185 22.168C18.4771 22.0825 19.1606 21.8977 19.7537 21.4434L19.9529 21.2803C20.145 21.1119 20.3205 20.9245 20.4763 20.7217L20.6345 20.4961C20.976 19.9581 21.127 19.3517 21.2019 18.6885C21.284 17.9612 21.2839 17.0543 21.2839 15.955V15.9531V11.3789C21.6864 11.6121 22.21 11.5327 22.5203 11.165C22.846 10.7785 22.8199 10.2127 22.4753 9.85742L13.4919 2.29395Z",fill:"#141B34"}),nr("path",{d:"M14.9998 17V22.249H8.99979V17C8.99979 15.5859 9.00002 14.8788 9.43924 14.4395C9.87855 14.0001 10.5857 14 11.9998 14C13.4139 14 14.121 14.0002 14.5603 14.4395C14.9997 14.8788 14.9998 15.5858 14.9998 17Z",fill:"#141B34"})]}))}import{jsx as ir}from"react/jsx-runtime";function xe(e){return ir("svg",s(r({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",viewBox:"0 0 48 48","aria-hidden":"true"},e),{children:ir("path",{fill:"currentColor",d:"M46.599 46.599a4.498 4.498 0 0 1-6.363 0l-7.941-7.941C29.028 40.749 25.167 42 21 42 9.402 42 0 32.598 0 21S9.402 0 21 0s21 9.402 21 21c0 4.167-1.251 8.028-3.342 11.295l7.941 7.941a4.498 4.498 0 0 1 0 6.363zM21 6C12.717 6 6 12.714 6 21s6.717 15 15 15c8.286 0 15-6.714 15-15S29.286 6 21 6z"})}))}import{jsx as lr,jsxs as Oi}from"react/jsx-runtime";function Qe(e){return Oi("svg",s(r({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},e),{children:[lr("path",{fill:"currentColor",opacity:"0.4",d:"M20.4155 3.66085C22.3012 5.52939 19.2842 20.7253 16.1883 20.9931C13.5911 21.2177 12.7819 16.0954 12.2348 14.4719C11.695 12.8696 11.0943 12.2927 9.50513 11.767C5.46811 10.4315 3.4496 9.76374 3.04996 8.70639C1.99171 5.90649 18.0071 1.27438 20.4155 3.66085Z"}),lr("path",{fill:"currentColor",d:"M3.04996 8.70639C3.4496 9.76374 5.46811 10.4315 9.50513 11.767C10.3308 12.0402 10.8897 12.3271 11.3118 12.7646L20.4155 3.66085C18.0071 1.27438 1.99171 5.90649 3.04996 8.70639Z"})]}))}import{jsx as g0,jsxs as h0}from"react/jsx-runtime";import{jsx as sr,jsxs as Bi}from"react/jsx-runtime";function Dt(e){return Bi("svg",s(r({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},e),{children:[sr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.75 11.7499C18.3023 11.7499 18.75 12.1977 18.75 12.7499V15.7499H21.75C22.3023 15.7499 22.75 16.1977 22.75 16.7499C22.75 17.3022 22.3023 17.7499 21.75 17.7499H18.75V20.7499C18.75 21.3022 18.3023 21.7499 17.75 21.7499C17.1977 21.7499 16.75 21.3022 16.75 20.7499V17.7499H13.75C13.1977 17.7499 12.75 17.3022 12.75 16.7499C12.75 16.1977 13.1977 15.7499 13.75 15.7499H16.75V12.7499C16.75 12.1977 17.1977 11.7499 17.75 11.7499Z",fill:"currentColor"}),sr("path",{opacity:"0.4",d:"M9.4626 2.48876C8.82373 2.24919 8.11205 2.24951 7.08264 2.24996C6.2039 2.24995 5.32205 2.24999 4.7497 2.30044C4.15996 2.35243 3.64388 2.46238 3.17258 2.7254C2.56533 3.06428 2.06428 3.56534 1.7254 4.17258C1.46238 4.64388 1.35242 5.15996 1.30044 5.7497C1.24999 6.32205 1.24999 7.03077 1.25 7.9095V11.0574C1.24999 13.3658 1.24998 15.1748 1.43975 16.5863C1.63399 18.031 2.03933 19.1711 2.93414 20.0659C3.82895 20.9607 4.96897 21.366 6.41371 21.5603C7.82519 21.75 9.63423 21.75 11.9426 21.75H13.2923C14.1084 21.75 14.8409 21.75 15.5 21.7383V18.9999H13.75C12.5074 18.9999 11.5 17.9926 11.5 16.7499C11.5 15.5073 12.5074 14.4999 13.75 14.4999H15.5V12.7499C15.5 11.5073 16.5074 10.4999 17.75 10.4999C18.9926 10.4999 20 11.5073 20 12.7499V14.4999H22.7383C22.75 13.8408 22.75 13.1084 22.75 12.2923C22.75 11.2733 22.75 10.3688 22.683 9.70949C22.6137 9.02893 22.4669 8.43872 22.118 7.91661C21.8444 7.50715 21.4929 7.15559 21.0834 6.88199C20.5613 6.53313 19.9711 6.38628 19.2905 6.31705C18.6312 6.24998 17.8095 6.24999 16.7905 6.25L13.2361 6.25C12.92 6.25 12.7396 6.24908 12.6064 6.23531C12.5044 6.22817 12.4348 6.15255 12.4128 6.11563C12.3409 6.0027 12.0838 5.48909 11.9425 5.20636C11.4704 4.25121 10.8581 3.01205 9.4626 2.48876Z",fill:"currentColor"})]}))}import{jsx as dr}from"react/jsx-runtime";function lt(e){return dr("svg",s(r({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:dr("path",{d:"M9.00005 6C9.00005 6 15 10.4189 15 12C15 13.5812 9 18 9 18",stroke:"#141B34",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))}import{jsx as cr}from"react/jsx-runtime";function Vt(e){return cr("svg",s(r({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},e),{children:cr("path",{fill:"currentColor",d:"M16.62 2.99c-.49-.49-1.28-.49-1.77 0L6.54 11.3c-.39.39-.39 1.02 0 1.41l8.31 8.31c.49.49 1.28.49 1.77 0s.49-1.28 0-1.77L9.38 12l7.25-7.25c.48-.48.48-1.28-.01-1.76z"})}))}import{jsx as pr}from"react/jsx-runtime";function It(e){return pr("svg",s(r({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},e),{children:pr("path",{fill:"currentColor",d:"M19,11H13V5a1,1,0,0,0-2,0v6H5a1,1,0,0,0,0,2h6v6a1,1,0,0,0,2,0V13h6a1,1,0,0,0,0-2Z"})}))}import{jsx as Fa,jsxs as Hi}from"react/jsx-runtime";function Be(e){return Hi("svg",s(r({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},e),{children:[Fa("path",{fill:"currentColor",d:"M3 6.386c0-.484.345-.877.771-.877h2.665c.529-.016.996-.399 1.176-.965l.03-.1l.115-.391c.07-.24.131-.45.217-.637c.338-.739.964-1.252 1.687-1.383c.184-.033.378-.033.6-.033h3.478c.223 0 .417 0 .6.033c.723.131 1.35.644 1.687 1.383c.086.187.147.396.218.637l.114.391l.03.1c.18.566.74.95 1.27.965h2.57c.427 0 .772.393.772.877s-.345.877-.771.877H3.77c-.425 0-.77-.393-.77-.877"}),Fa("path",{fill:"currentColor",fillRule:"evenodd",d:"M9.425 11.482c.413-.044.78.273.821.707l.5 5.263c.041.433-.26.82-.671.864c-.412.043-.78-.273-.821-.707l-.5-5.263c-.041-.434.26-.821.671-.864m5.15 0c.412.043.713.43.671.864l-.5 5.263c-.04.434-.408.75-.82.707c-.413-.044-.713-.43-.672-.864l.5-5.264c.041-.433.409-.75.82-.707",clipRule:"evenodd"}),Fa("path",{fill:"currentColor",d:"M11.596 22h.808c2.783 0 4.174 0 5.08-.886c.904-.886.996-2.339 1.181-5.245l.267-4.188c.1-1.577.15-2.366-.303-2.865c-.454-.5-1.22-.5-2.753-.5H8.124c-1.533 0-2.3 0-2.753.5s-.404 1.288-.303 2.865l.267 4.188c.185 2.906.277 4.36 1.182 5.245c.905.886 2.296.886 5.079.886",opacity:"0.5"})]}))}import{jsx as ur,jsxs as Zi}from"react/jsx-runtime";function He(e){return Zi("svg",s(r({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:3.5,strokeLinecap:"round",strokeLinejoin:"round"},e),{children:[ur("path",{d:"M18 6L6 18"}),ur("path",{d:"M6 6L18 18"})]}))}import{jsx as Lo,jsxs as Ui}from"react/jsx-runtime";function Ao(e){return Ui("svg",s(r({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e),{children:[Lo("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),Lo("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"}),Lo("path",{d:"M7 11l5 5l5 -5"}),Lo("path",{d:"M12 4l0 12"})]}))}import{jsx as _o,jsxs as ji}from"react/jsx-runtime";function Vo(e){return ji("svg",s(r({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e),{children:[_o("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_o("path",{d:"M9 15l6 -6"}),_o("path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464"}),_o("path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"})]}))}import{jsx as mr}from"react/jsx-runtime";function Go(e){return mr("svg",s(r({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},e),{children:mr("path",{fill:"currentColor",fillRule:"evenodd",d:"M9.944 1.25H10a.75.75 0 0 1 0 1.5c-1.907 0-3.261.002-4.29.14c-1.005.135-1.585.389-2.008.812S3.025 4.705 2.89 5.71c-.138 1.029-.14 2.383-.14 4.29a.75.75 0 0 1-1.5 0v-.056c0-1.838 0-3.294.153-4.433c.158-1.172.49-2.121 1.238-2.87c.749-.748 1.698-1.08 2.87-1.238c1.14-.153 2.595-.153 4.433-.153m8.345 1.64c-1.027-.138-2.382-.14-4.289-.14a.75.75 0 0 1 0-1.5h.056c1.838 0 3.294 0 4.433.153c1.172.158 2.121.49 2.87 1.238c.748.749 1.08 1.698 1.238 2.87c.153 1.14.153 2.595.153 4.433V10a.75.75 0 0 1-1.5 0c0-1.907-.002-3.261-.14-4.29c-.135-1.005-.389-1.585-.812-2.008s-1.003-.677-2.009-.812M2 13.25a.75.75 0 0 1 .75.75c0 1.907.002 3.262.14 4.29c.135 1.005.389 1.585.812 2.008s1.003.677 2.009.812c1.028.138 2.382.14 4.289.14a.75.75 0 0 1 0 1.5h-.056c-1.838 0-3.294 0-4.433-.153c-1.172-.158-2.121-.49-2.87-1.238c-.748-.749-1.08-1.698-1.238-2.87c-.153-1.14-.153-2.595-.153-4.433V14a.75.75 0 0 1 .75-.75m20 0a.75.75 0 0 1 .75.75v.056c0 1.838 0 3.294-.153 4.433c-.158 1.172-.49 2.121-1.238 2.87c-.749.748-1.698 1.08-2.87 1.238c-1.14.153-2.595.153-4.433.153H14a.75.75 0 0 1 0-1.5c1.907 0 3.262-.002 4.29-.14c1.005-.135 1.585-.389 2.008-.812s.677-1.003.812-2.009c.138-1.027.14-2.382.14-4.289a.75.75 0 0 1 .75-.75",clipRule:"evenodd"})}))}import{jsx as fr,jsxs as Wi}from"react/jsx-runtime";function Je(e){return Wi("svg",s(r({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e),{children:[fr("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),fr("path",{d:"M5 12l5 5l10 -10"})]}))}import{jsx as gr}from"react/jsx-runtime";function Gt(e){return gr("svg",s(r({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},e),{children:gr("path",{fill:"currentColor",fillRule:"evenodd",d:"M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2s10 4.477 10 10m-5.97-3.03a.75.75 0 0 1 0 1.06l-5 5a.75.75 0 0 1-1.06 0l-2-2a.75.75 0 1 1 1.06-1.06l1.47 1.47l2.235-2.235L14.97 8.97a.75.75 0 0 1 1.06 0",clipRule:"evenodd"})}))}import{jsx as hr}from"react/jsx-runtime";function Ot(e){return hr("svg",s(r({xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",width:"100",height:"100",viewBox:"0 0 72 72",fill:"currentColor"},e),{children:hr("path",{d:"M38.406 22.234l11.36 11.36L28.784 54.576l-12.876 4.307c-1.725.577-3.367-1.065-2.791-2.79l4.307-12.876L38.406 22.234zM41.234 19.406l5.234-5.234c1.562-1.562 4.095-1.562 5.657 0l5.703 5.703c1.562 1.562 1.562 4.095 0 5.657l-5.234 5.234L41.234 19.406z"})}))}import{jsx as Ma,jsxs as $i}from"react/jsx-runtime";function Nt(e){return $i("svg",s(r({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e),{children:[Ma("circle",{cx:"12",cy:"12",r:"1"}),Ma("circle",{cx:"19",cy:"12",r:"1"}),Ma("circle",{cx:"5",cy:"12",r:"1"})]}))}import{jsx as vr}from"react/jsx-runtime";function Oo(e){return vr("svg",s(r({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e),{children:vr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 6.75a1.75 1.75 0 1 0 0-3.5 1.75 1.75 0 0 0 0 3.5zm0 14a1.75 1.75 0 1 0 0-3.5 1.75 1.75 0 0 0 0 3.5zM13.75 12a1.75 1.75 0 1 1-3.5 0 1.75 1.75 0 0 1 3.5 0z",fill:"#000000"})}))}import{jsx as xr}from"react/jsx-runtime";function Bo(e){return xr("svg",s(r({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e),{children:xr("path",{d:"M18 11h-12c-1.104 0-2 .896-2 2s.896 2 2 2h12c1.104 0 2-.896 2-2s-.896-2-2-2z"})}))}import{jsx as st,jsxs as Ki}from"react/jsx-runtime";function ce(e){return Ki("svg",s(r({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e),{children:[st("path",{d:"M12 3L12 6",stroke:"#000000",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),st("path",{d:"M21 12L18 12",stroke:"#000000",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),st("path",{d:"M12 21L12 18",stroke:"#000000",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),st("path",{d:"M3 12L6 12",stroke:"#000000",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),st("path",{d:"M5.63586 5.63605L7.75718 7.75737",stroke:"#000000",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),st("path",{d:"M18.3639 5.63605L16.2426 7.75737",stroke:"#000000",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),st("path",{d:"M18.3641 18.3639L16.2428 16.2426",stroke:"#000000",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),st("path",{d:"M5.63623 18.3639L7.75755 16.2426",stroke:"#000000",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))}import{jsx as br}from"react/jsx-runtime";function oo(e){return br("svg",s(r({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},e),{children:br("path",{d:"M21.4086 9.35258C23.5305 10.5065 23.5305 13.4935 21.4086 14.6474L8.59662 21.6145C6.53435 22.736 4 21.2763 4 18.9671V5.0329C4 2.72368 6.53435 1.26402 8.59661 2.38548L21.4086 9.35258Z"})}))}import{jsx as wr}from"react/jsx-runtime";function Ho(e){return wr("svg",s(r({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e),{children:wr("path",{clipRule:"evenodd",d:"M8 16C12.4183 16 16 12.4183 16 8C16 3.58172 12.4183 0 8 0C3.58172 0 0 3.58172 0 8C0 12.4183 3.58172 16 8 16ZM7 9V3H9V9H7ZM7 13V11H9V13H7Z",fill:"#030708",fillRule:"evenodd"})}))}import{jsx as Zo,jsxs as Yi}from"react/jsx-runtime";function Bt(e){return Yi("svg",s(r({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e),{children:[Zo("path",{id:"primary",d:"M14,18H9A6,6,0,0,1,5.54,7.11",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"}),Zo("path",{id:"primary-2","data-name":"primary",d:"M10,6h5a6,6,0,0,1,3.46,10.89",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"}),Zo("polyline",{id:"primary-3","data-name":"primary",points:"12 16 14 18 12 20",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"}),Zo("polyline",{id:"primary-4","data-name":"primary",points:"12 8 10 6 12 4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})]}))}import{jsx as Fc}from"react/jsx-runtime";import{jsx as Cr}from"react/jsx-runtime";function Uo(e){return Cr("svg",s(r({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e),{children:Cr("path",{d:"M9.821,118.048h104.4c7.3,0,12-7.7,8.7-14.2l-52.2-92.5c-3.601-7.199-13.9-7.199-17.5,0l-52.2,92.5 C-2.179,110.348,2.521,118.048,9.821,118.048z M70.222,96.548c0,4.8-3.5,8.5-8.5,8.5s-8.5-3.7-8.5-8.5v-0.2c0-4.8,3.5-8.5,8.5-8.5 s8.5,3.7,8.5,8.5V96.548z M57.121,34.048h9.801c2.699,0,4.3,2.3,4,5.2l-4.301,37.6c-0.3,2.7-2.1,4.4-4.6,4.4s-4.3-1.7-4.6-4.4 l-4.301-37.6C52.821,36.348,54.422,34.048,57.121,34.048z"})}))}import{jsx as ao,jsxs as Qi}from"react/jsx-runtime";var yr=o=>{var a=o,{className:e}=a,t=f(a,["className"]);return ao("nav",r({"data-slot":"pagination",role:"navigation","aria-label":"pagination",className:v("mx-auto flex w-full justify-center",e)},t))};function Fr(o){var a=o,{className:e}=a,t=f(a,["className"]);return ao("ul",r({"data-slot":"pagination-content",className:v("flex flex-row items-center gap-1",e)},t))}function ro(o){var a=o,{className:e}=a,t=f(a,["className"]);return ao("li",r({"data-slot":"pagination-item",className:v("",e)},t))}var Mr=o=>{var a=o,{className:e}=a,t=f(a,["className"]);return Qi("span",s(r({"data-slot":"pagination-ellipsis","aria-hidden":!0,className:v("flex h-9 w-9 items-center justify-center",e)},t),{children:[ao(Nt,{className:"h-4 w-4"}),ao("span",{className:"sr-only",children:"More pages"})]}))};import{cva as Ji}from"class-variance-authority";import{Slot as Xi}from"radix-ui";import{jsx as tl}from"react/jsx-runtime";var el=Ji("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
+ import {c,b,a,s,d,f as f$1,l,E as E$1,F,p,k,z,q as q$1,n,o,m,r,j,y as y$1,x,K,L,G,C,H,e,A,w,B,h,I,J,D,i,t,u,v}from'./chunk-4DQRTTKI.mjs';import Fi,{createContext,forwardRef,useMemo,useContext,useState,useRef,useEffect,useCallback,Component}from'react';import {useParams,useSearchParams,useRouter,usePathname}from'next/navigation';import {toast}from'sonner';import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {cva}from'class-variance-authority';import {Slot,Dialog,DropdownMenu,Checkbox,Label,ScrollArea}from'radix-ui';import*as Me from'@radix-ui/react-tooltip';import {Command}from'cmdk';import*as q from'@radix-ui/react-context-menu';var Mo=(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},sa=(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 la(e){let{mode:t,selectionMode:a$1,files:o,folders:r,selectedFiles:n,selectedFolders:s,currentFolder:m,setSelectedFiles:l,setSelectedFolders:v,setCurrentFolder:u,setFiles:x,setFolders:c$1,setPagination:w,loadData:F,isInSelectionMode:M,provider:C,onFilesSelected:N,onClose:D,basePath:k,setIsLoading:b$1,setFileDetailsModalFile:S}=e,j=useRouter(),J=useCallback((P,z,O=false)=>{let V=[P];if(O||z&&(z.metaKey||z.ctrlKey)){l(K=>Mo(K,V));return}if(M()&&t!==d.MODAL){l(K=>Mo(K,V));return}if(t===d.MODAL){a$1==="single"?(l([P]),N==null||N([P]),D==null||D()):l(K=>Mo(K,V));return}S(P);},[t,a$1,M,l,N,D,S]),te=useCallback((P,z,O=false)=>{let V=P?P.id:null;if((O||z&&(z.metaKey||z.ctrlKey))&&P){v(K=>sa(K,[P]));return}if(M()&&P){v(K=>sa(K,[P]));return}if(t===d.PAGE){b$1(true);let K=k!=null?k:"/media",he=V===null?K:`${K}/${V}`;j.push(he);}else {b$1(true),l([]),v([]);let K=new URLSearchParams(window.location.search);V===null?K.delete("folderId"):K.set("folderId",String(V)),K.set("page","1");let he=`${window.location.pathname}?${K.toString()}`;j.push(he,{scroll:false});}},[M,t,j,v,l,k,b$1]),ve=useCallback(()=>{l([]),v([]);},[l,v]),d$1=useCallback(P=>{P?(l(o),v(t===d.PAGE?r:[])):(l([]),v([]));},[o,r,t,l,v]),I=useCallback(async(P=false)=>{await F(P);},[F]),g=useCallback(async P=>{var z;try{await C.uploadFiles(P,(z=m==null?void 0:m.id)!=null?z:null),await I(!0),l([]),toast.success("Upload Successful",{description:`${P.length} file(s) uploaded successfully`});}catch(O){let V=O instanceof Error?O.message:"Failed to upload files";toast.error("Upload Failed",{description:V}),console.error("Upload failed:",O);}},[m,C,I,l]),R=useCallback(async P=>{var z;try{await C.createFolder(P,(z=m==null?void 0:m.id)!=null?z:null),await I(!0),l([]),toast.success("Folder Created",{description:`Folder "${P}" created successfully`});}catch(O){let V=O instanceof Error?O.message:"Failed to create folder";toast.error("Create Folder Failed",{description:V}),console.error("Failed to create folder:",O);}},[m,C,I,l]),T=useCallback(async P=>{try{n.length>0&&await C.moveFiles(n.map(O=>O.id),P),s.length>0&&await C.moveFolders(s.map(O=>O.id),P),await I(!0),l([]),v([]);let z=n.length+s.length;toast.success("Move Successful",{description:`${z} item(s) moved successfully`});}catch(z){let O=z instanceof Error?z.message:"Failed to move items";toast.error("Move Failed",{description:O}),console.error("Failed to move items:",z);}},[n,s,C,I,l,v]),A=useCallback(async(P,z)=>{try{c$1(O=>O.map(V=>V.id===P?b(a({},V),{name:z}):V)),await C.renameFolder(P,z),await I(!0),toast.success("Folder Renamed",{description:`Folder renamed to "${z}"`});}catch(O){let V=O instanceof Error?O.message:"Failed to rename folder";toast.error("Rename Failed",{description:V}),console.error("Failed to rename folder:",O);}},[C,I]),de=useCallback(async(P,z)=>{try{x(O=>O.map(V=>{if(V.id===P){let Ve=z,{metaData:K}=Ve,he=c(Ve,["metaData"]);return b(a(a({},V),he),{metaData:K?a(a({},V.metaData),K):V.metaData})}return V})),await C.updateFileMetaData(P,z),await I(!0);}catch(O){let V=O instanceof Error?O.message:"Failed to update metadata";toast.error("Update Failed",{description:V}),console.error("Failed to update metadata:",O);}},[C,I]),yt=useCallback(async()=>{try{n.length>0&&await C.deleteFiles(n.map(z=>z.id)),s.length>0&&await C.deleteFolders(s.map(z=>z.id)),await I(!0),l([]),v([]);let P=n.length+s.length;toast.success("Delete Successful",{description:`${P} item(s) deleted successfully`});}catch(P){let z=P instanceof Error?P.message:"Failed to delete items";toast.error("Delete Failed",{description:z}),console.error("Failed to delete items:",P);}},[n,s,C,I,l,v]);return {handleFileClick:J,handleFolderClick:te,handleClearSelection:ve,handleSelectAllGlobal:d$1,uploadFiles:g,createFolder:R,bulkMove:T,renameFolder:A,updateFileMetadata:de,bulkDelete:yt,refreshData:I}}function ma(e){let{mode:t,selectionMode:a$1,initialFolderId:o,acceptedFileTypesForModal:r,allowedFileTypes:n,provider:s,onFilesSelected:m,onClose:l,basePath:v}=e,u=useParams(),x=useSearchParams(),c=useRouter(),w=usePathname(),F=Math.max(1,parseInt(x.get("page")||"1",10)),M=Math.max(1,parseInt(x.get("limit")||"24",10)),C=x.get("query")||"",N=useMemo(()=>{if(t===d.PAGE&&(u!=null&&u.path)){let L=Array.isArray(u.path)?u.path[0]:u.path;return typeof L=="string"&&/^\d+$/.test(L)?Number(L):null}if(t===d.MODAL){let L=x.get("folderId");if(L&&/^\d+$/.test(L))return Number(L)}return o!=null?o:null},[t,u,x,o]),[D,k]=useState([]),[b$1,S]=useState([]),[j,J]=useState([]),[te,ve]=useState([]),[d$1,I]=useState(null),[g,R]=useState(true),[T,A]=useState({currentPage:F,totalPages:1,totalFiles:0,filesPerPage:M}),de=useRef(null);de.current=d$1;let[yt,P]=useState(C),[z,O]=useState(C);useEffect(()=>{let L=setTimeout(()=>{O(yt);},300);return ()=>clearTimeout(L)},[yt]);let V=useRef(N),Ve=useCallback((L,ae)=>{let re=new URLSearchParams(x.toString());re.set("page",L.toString()),re.set("limit",ae.toString()),c.push(`${w}?${re.toString()}`,{scroll:false});},[c,w]);useEffect(()=>{A(L=>b(a({},L),{currentPage:F,filesPerPage:M})),P(C);},[F,M,C]),useEffect(()=>{N!==V.current&&(t===d.PAGE&&Ve(1,M),V.current=N);},[N,M,Ve,t]);let K=T.currentPage,he=T.filesPerPage;useEffect(()=>{let L=false,ae=async()=>{if(N&&(!de.current||de.current.id!==N))try{R(!0);let ne=await s.getFolder(N);if(L)return;I(ne),await re(ne);}catch(ne){let Jt=ne instanceof Error?ne.message:"Failed to load folder";if(toast.error("Load Folder Failed",{description:Jt}),console.error("Failed to fetch current folder",ne),L)return;I(null),L||R(false);}else N===null&&de.current!==null?(I(null),await re(null)):de.current?await re(de.current):await re(null);},re=async ne=>{var Jt;if(!L){R(true);try{let ut=[];t===d.MODAL?ut=r:ut=n;let Lt=await s.getItems((Jt=ne==null?void 0:ne.id)!=null?Jt:null,ut,K,he,z);if(L)return;S(Lt.folders),k(Lt.files),A(Lt.pagination);}catch(ut){let Lt=ut instanceof Error?ut.message:"Failed to load data";toast.error("Load Data Failed",{description:Lt}),console.error("Failed to load data:",ut);}finally{L||R(false);}}};return ae(),()=>{L=true;}},[N,s,t,r,n,K,he,z]),useEffect(()=>{ve([]),J([]);},[d$1]);let[zr,Rr]=useState(false),[Tr,Er]=useState(false),[Lr,_r]=useState(false),[Ar,Or]=useState(false),[Br,Vr]=useState(false),[Gr,Ur]=useState(null),[Hr,$r]=useState(null),Kr=useCallback(async(L=false)=>{var ae;L||R(true);try{let re=[];t===d.MODAL?re=r:re=n;let ne=await s.getItems((ae=d$1==null?void 0:d$1.id)!=null?ae:null,re,K,he,z);S(ne.folders),k(ne.files),A(ne.pagination);}catch(re){let ne=re instanceof Error?re.message:"Failed to load data";toast.error("Load Data Failed",{description:ne}),console.error("Failed to load data:",re);}finally{L||R(false);}},[d$1,t,r,n,s,K,he,z]),Wr=()=>j.length>0||te.length>0,jr=()=>d$1,Qr=useMemo(()=>()=>{let L=D.length+(t===d.PAGE?b$1.length:0),ae=j.length+te.length;return ae===0?false:ae===L?true:"indeterminate"},[D.length,b$1.length,j.length,te.length,t]),Yr=useCallback(L=>{A(ae=>b(a({},ae),{currentPage:L})),t===d.PAGE&&Ve(L,he);},[Ve,he,t]),qr=useCallback(L=>{P(L);let ae=new URLSearchParams(x.toString());L.trim()?(ae.set("query",L),ae.set("page","1")):ae.delete("query"),c.push(`${w}?${ae.toString()}`,{scroll:false});},[c,w,x]);return {files:D,folders:b$1,selectedFiles:j,selectedFolders:te,currentFolder:d$1,isLoading:g,pagination:T,isUploadModalOpen:zr,isCreateFolderModalOpen:Tr,isSearchModalOpen:Lr,isMoveFileModalOpen:Ar,isRenameFolderModalOpen:Br,fileDetailsModalFile:Hr,folderToRename:Gr,setFiles:k,setFolders:S,setSelectedFiles:J,setSelectedFolders:ve,setCurrentFolder:I,setPagination:A,setIsUploadModalOpen:Rr,setIsCreateFolderModalOpen:Er,setIsSearchModalOpen:_r,setIsMoveFileModalOpen:Or,setIsRenameFolderModalOpen:Vr,setFileDetailsModalFile:$r,setFolderToRename:Ur,loadData:Kr,setIsLoading:R,isInSelectionMode:Wr,getCurrentFolder:jr,getSelectionState:Qr,handlePageChange:Yr,searchQuery:yt,updateSearchQuery:qr,mode:t,selectionMode:a$1,acceptedFileTypesForModal:r,provider:s,onFilesSelected:m,onClose:l,basePath:v}}var ua=createContext(void 0);function no({children:e,mode:t=d.PAGE,selectionMode:a=f$1.SINGLE,allowedFileTypes:o,onFilesSelected:r,onClose:n,acceptedFileTypesForModal:s,initialFolderId:m=null,provider:l,basePath:v="/media",maxUploadFiles:u=50,maxUploadSize:x=100*1024*1024}){let c=ma({mode:t,selectionMode:a,initialFolderId:m,acceptedFileTypesForModal:s,allowedFileTypes:o,provider:l,onFilesSelected:r,onClose:n,basePath:v}),w=la(c),F=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:x,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:w.handleFileClick,handleFolderClick:w.handleFolderClick,handleClearSelection:w.handleClearSelection,handleSelectAllGlobal:w.handleSelectAllGlobal,handlePageChange:c.handlePageChange,searchQuery:c.searchQuery,updateSearchQuery:c.updateSearchQuery,uploadFiles:w.uploadFiles,createFolder:w.createFolder,bulkMove:w.bulkMove,renameFolder:w.renameFolder,updateFileMetadata:w.updateFileMetadata,bulkDelete:w.bulkDelete,refreshData:w.refreshData,isInSelectionMode:c.isInSelectionMode,getCurrentFolder:c.getCurrentFolder,getSelectionState:c.getSelectionState,onClose:c.onClose,onFilesSelected:c.onFilesSelected,provider:l,basePath:c.basePath}),[c,w,l,o,u,x]);return jsx(ua.Provider,{value:F,children:e})}function E(){let e=useContext(ua);if(e===void 0)throw new Error("useFileManager must be used within a FileManagerProvider");return e}function f(...e){return twMerge(clsx(e))}var pa=a$1=>{var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx("nav",a({"data-slot":"pagination",role:"navigation","aria-label":"pagination",className:f("mx-auto flex w-full justify-center",e)},t))};function fa(a$1){var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx("ul",a({"data-slot":"pagination-content",className:f("flex flex-row items-center gap-1",e)},t))}function Ut(a$1){var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx("li",a({"data-slot":"pagination-item",className:f("",e)},t))}var ga=a$1=>{var o=a$1,{className:e}=o,t=c(o,["className"]);return jsxs("span",b(a({"data-slot":"pagination-ellipsis","aria-hidden":true,className:f("flex h-9 w-9 items-center justify-center",e)},t),{children:[jsx(z,{className:"h-4 w-4"}),jsx("span",{className:"sr-only",children:"More pages"})]}))};var un=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:`
18
2
  justify-start font-normal hover:bg-background [&_svg]:transition-colors [&_svg]:hover:text-foreground data-[state=open]:bg-background
19
3
  focus-visible:border-ring focus-visible:outline-hidden focus-visible:ring-[3px] focus-visible:ring-ring/30
20
4
  [[data-state=open]>&]:border-ring [[data-state=open]>&]:outline-hidden [[data-state=open]>&]:ring-[3px]
21
5
  [[data-state=open]>&]:ring-ring/30
22
6
  aria-invalid:border-destructive/60 aria-invalid:ring-destructive/10 dark:aria-invalid:border-destructive dark:aria-invalid:ring-destructive/20
23
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
24
- `},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:!0,className:"h-auto min-h-7"},{size:"md",autoHeight:!0,className:"h-auto min-h-9"},{size:"sm",autoHeight:!0,className:"h-auto min-h-8"},{size:"lg",autoHeight:!0,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:!0,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 F(C){var w=C,{className:e,selected:t,variant:o,radius:a,appearance:n,mode:i,size:l,autoHeight:c,underlined:d,underline:g,asChild:u=!1,placeholder:b=!1}=w,p=f(w,["className","selected","variant","radius","appearance","mode","size","autoHeight","underlined","underline","asChild","placeholder"]);let k=u?Xi.Slot:"button";return tl(k,r(r({"data-slot":"button",className:v(el({variant:o,size:l,radius:a,appearance:n,mode:i,autoHeight:c,placeholder:b,underlined:d,underline:g,className:e}),u&&p.disabled&&"pointer-events-none opacity-50")},t&&{"data-state":"open"}),p))}import{jsx as Ie,jsxs as ka}from"react/jsx-runtime";function ol(e,t){let o=[];if(t<=7)for(let a=1;a<=t;a++)o.push(a);else e<=4?o.push(1,2,3,4,5,"ellipsis",t):e>=t-3?o.push(1,"ellipsis",t-4,t-3,t-2,t-1,t):o.push(1,"ellipsis",e-1,e,e+1,"ellipsis",t);return o}function kr({className:e}){let{pagination:t,handlePageChange:o,files:a,folders:n}=E(),{currentPage:i,totalPages:l}=t,c=((a==null?void 0:a.length)||0)+((n==null?void 0:n.length)||0);if(l<=1||c===0)return null;let d=ol(i,l);return Ie(yr,{className:e,children:ka(Fr,{children:[Ie(ro,{children:Ie(F,{variant:"ghost",radius:"full",asChild:!0,disabled:i===1,onClick:()=>i>1&&o(i-1),children:ka("span",{children:[Ie(Vt,{className:"rtl:rotate-180"})," Previous"]})})}),d.map((g,u)=>g==="ellipsis"?Ie(ro,{children:Ie(Mr,{})},`ellipsis-${i}-${l}-${u}`):Ie(ro,{children:Ie(F,{variant:g===i?"outline":"ghost",mode:"icon",size:"icon",radius:"full",asChild:!0,onClick:()=>o(g),disabled:g===i,children:Ie("span",{children:g})})},g)),Ie(ro,{children:Ie(F,{variant:"ghost",radius:"full",asChild:!0,disabled:i===l,onClick:()=>i<l&&o(i+1),children:ka("span",{children:["Next ",Ie(lt,{className:"rtl:rotate-180"})]})})})]})})}import{jsx as al}from"react/jsx-runtime";function Dr({children:e,className:t}){return al("div",{className:v("p-4 flex md:flex-row gap-2",t),children:e})}import{useState as kl}from"react";import{cva as rl}from"class-variance-authority";import{Dialog as Pt}from"radix-ui";import{jsx as _e,jsxs as Da}from"react/jsx-runtime";var nl=rl("flex flex-col fixed outline-0 z-50 border border-border bg-background 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 Ne(t){var e=f(t,[]);return _e(Pt.Root,r({"data-slot":"dialog"},e))}function il(t){var e=f(t,[]);return _e(Pt.Portal,r({"data-slot":"dialog-portal"},e))}function Xe(t){var e=f(t,[]);return _e(Pt.Close,r({"data-slot":"dialog-close"},e))}function ll(o){var a=o,{className:e}=a,t=f(a,["className"]);return _e(Pt.Overlay,r({"data-slot":"dialog-overlay",className:v("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 Pe(l){var c=l,{className:e,children:t,showCloseButton:o=!0,overlay:a=!0,variant:n}=c,i=f(c,["className","children","showCloseButton","overlay","variant"]);return Da(il,{children:[a&&_e(ll,{}),Da(Pt.Content,s(r({"data-slot":"dialog-content",className:v(nl({variant:n}),e)},i),{children:[t,o&&Da(Xe,{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:[_e(He,{className:"size-4 text-gray-600 dark:text-zinc-400"}),_e("span",{className:"sr-only",children:"Close"})]})]}))]})}var Ze=o=>{var a=o,{className:e}=a,t=f(a,["className"]);return _e("div",r({"data-slot":"dialog-header",className:v("flex flex-col space-y-1 text-center sm:text-start mb-5",e)},t))},Ue=o=>{var a=o,{className:e}=a,t=f(a,["className"]);return _e("div",r({"data-slot":"dialog-footer",className:v("flex flex-col-reverse sm:flex-row sm:justify-end pt-5 sm:space-x-2.5",e)},t))};function Se(o){var a=o,{className:e}=a,t=f(a,["className"]);return _e(Pt.Title,r({"data-slot":"dialog-title",className:v("text-lg font-semibold leading-none tracking-tight",e)},t))}function dt(o){var a=o,{className:e}=a,t=f(a,["className"]);return _e(Pt.Description,r({"data-slot":"dialog-description",className:v("text-sm text-muted-foreground",e)},t))}import{cva as sl}from"class-variance-authority";import{jsx as Ht,jsxs as cl}from"react/jsx-runtime";var dl=sl("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 Ir(g){var u=g,{className:e,variant:t,size:o,icon:a,appearance:n,close:i=!1,onClose:l,children:c}=u,d=f(u,["className","variant","size","icon","appearance","close","onClose","children"]);return cl("div",s(r({"data-slot":"alert",role:"alert",className:v(dl({variant:t,size:o,icon:a,appearance:n}),e)},d),{children:[c,i&&Ht("button",{onClick:l,"aria-label":"Dismiss","data-slot":"alert-close",className:v("group shrink-0 size-4 cursor-pointer"),children:Ht(He,{className:"opacity-60 group-hover:opacity-100 size-4"})})]}))}function Nr(o){var a=o,{className:e}=a,t=f(a,["className"]);return Ht("div",r({"data-slot":"alert-title",className:v("grow tracking-tight",e)},t))}function Pr(a){var n=a,{children:e,className:t}=n,o=f(n,["children","className"]);return Ht("div",s(r({"data-slot":"alert-icon",className:v("shrink-0",t)},o),{children:e}))}function Sr(o){var a=o,{className:e}=a,t=f(a,["className"]);return Ht("div",r({"data-slot":"alert-description",className:v("text-sm [&_p]:leading-relaxed [&_p]:mb-2",e)},t))}function zr(o){var a=o,{className:e}=a,t=f(a,["className"]);return Ht("div",r({"data-slot":"alert-content",className:v("space-y-2 [&_[data-slot=alert-title]]:font-semibold",e)},t))}import*as ze from"@radix-ui/react-tooltip";import{jsx as Zt,jsxs as ul}from"react/jsx-runtime";function pl(o){var a=o,{delayDuration:e=0}=a,t=f(a,["delayDuration"]);return Zt(ze.Provider,r({"data-slot":"tooltip-provider",delayDuration:e},t))}function Rr(t){var e=f(t,[]);return Zt(pl,{children:Zt(ze.Root,r({"data-slot":"tooltip"},e))})}function Tr(t){var e=f(t,[]);return Zt(ze.Trigger,r({"data-slot":"tooltip-trigger"},e))}function Er(n){var i=n,{className:e,sideOffset:t=0,children:o}=i,a=f(i,["className","sideOffset","children"]);return Zt(ze.Portal,{children:ul(ze.Content,s(r({"data-slot":"tooltip-content",sideOffset:t,className:v("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)},a),{children:[o,Zt(ze.Arrow,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]}))})}function oe(e){if(e===0)return"0 Bytes";let t=1024,o=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],a=Math.floor(Math.log(e)/Math.log(t));return Number.parseFloat((e/Math.pow(t,a)).toFixed(2))+" "+o[a]}import{useCallback as be,useRef as ml,useState as fl,useEffect as gl}from"react";var Lr=(e={})=>{let{maxFiles:t=Number.POSITIVE_INFINITY,maxSize:o=Number.POSITIVE_INFINITY,accept:a="*",multiple:n=!1,initialFiles:i=[],onFilesChange:l,onFilesAdded:c,onError:d}=e,[g,u]=fl({files:i.map(m=>({file:m,id:m.id,preview:m.url})),isDragging:!1,errors:[]}),b=ml(null);gl(()=>()=>{g.files.forEach(m=>{m.preview&&m.file instanceof File&&URL.revokeObjectURL(m.preview)})},[g.files]);let p=be(m=>{if(m instanceof File){if(m.size>o)return`File "${m.name}" exceeds the maximum size of ${oe(o)}.`}else if(m.size>o)return`File "${m.name}" exceeds the maximum size of ${oe(o)}.`;if(a!=="*"){let S=a.split(",").map(_=>_.trim()),x=m instanceof File?m.type||"":m.type,R=`.${m instanceof File,m.name.split(".").pop()}`;if(!S.some(_=>{if(_.startsWith("."))return R.toLowerCase()===_.toLowerCase();if(_.endsWith("/*")){let me=_.split("/")[0];return x.startsWith(`${me}/`)}return x===_}))return`File "${m instanceof File,m.name}" is not an accepted file type.`}return null},[a,o]),C=be(m=>m instanceof File?URL.createObjectURL(m):m.url,[]),w=be(m=>m instanceof File?`${m.name}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`:m.id.toString(),[]),k=be(()=>{u(m=>{for(let x of m.files)x.preview&&x.file instanceof File&&x.file.type.startsWith("image/")&&URL.revokeObjectURL(x.preview);b.current&&(b.current.value="");let S=s(r({},m),{files:[],errors:[]});return l==null||l(S.files),S})},[l]),y=be(m=>{if(!m||m.length===0)return;let S=Array.from(m),x=[];u(R=>s(r({},R),{errors:[]})),n||k(),u(R=>{if(n&&t!==Number.POSITIVE_INFINITY&&R.files.length+S.length>t)return x.push(`You can only upload a maximum of ${t} files.`),d==null||d(x),s(r({},R),{errors:x});let T=[];for(let _ of S){if(n&&R.files.some(P=>P.file.name===_.name&&P.file.size===_.size))continue;if(_.size>o){x.push(n?`Some files exceed the maximum size of ${oe(o)}.`:`File exceeds the maximum size of ${oe(o)}.`);continue}let me=p(_);me?x.push(me):T.push({file:_,id:w(_),preview:C(_)})}if(T.length>0){c==null||c(T);let _=n?[...R.files,...T]:T;return l==null||l(_),s(r({},R),{files:_,errors:x})}else if(x.length>0)return d==null||d(x),s(r({},R),{errors:x});return R}),b.current&&(b.current.value="")},[t,n,o,p,C,w,k,l,c,d]),M=be(m=>{u(S=>{let x=S.files.find(T=>T.id===m);x&&x.preview&&x.file instanceof File&&x.file.type.startsWith("image/")&&URL.revokeObjectURL(x.preview);let R=S.files.filter(T=>T.id!==m);return l==null||l(R),s(r({},S),{files:R,errors:[]})})},[l]),I=be(()=>{u(m=>s(r({},m),{errors:[]}))},[]),N=be(m=>{m.preventDefault(),m.stopPropagation(),u(S=>s(r({},S),{isDragging:!0}))},[]),h=be(m=>{m.preventDefault(),m.stopPropagation(),!m.currentTarget.contains(m.relatedTarget)&&u(S=>s(r({},S),{isDragging:!1}))},[]),D=be(m=>{m.preventDefault(),m.stopPropagation()},[]),Z=be(m=>{var S;if(m.preventDefault(),m.stopPropagation(),u(x=>s(r({},x),{isDragging:!1})),!((S=b.current)!=null&&S.disabled)&&m.dataTransfer.files&&m.dataTransfer.files.length>0)if(n)y(m.dataTransfer.files);else{let x=m.dataTransfer.files[0];y([x])}},[y,n]),Y=be(m=>{m.target.files&&m.target.files.length>0&&y(m.target.files)},[y]),ae=be(()=>{b.current&&b.current.click()},[]),Ce=be((m={})=>s(r({},m),{type:"file",onChange:Y,accept:m.accept||a,multiple:m.multiple!==void 0?m.multiple:n,ref:b}),[a,n,Y]);return[g,{addFiles:y,removeFile:M,clearFiles:k,clearErrors:I,handleDragEnter:N,handleDragLeave:h,handleDragOver:D,handleDrop:Z,handleFileChange:Y,openFileDialog:ae,getInputProps:Ce}]};import Ar from"mime";import{jsx as fe}from"react/jsx-runtime";function je(e,t){if(typeof e!="string")return console.warn("getFileTypeFromMime: mimeType is not a string:",e),K.FILE;let o=e;if(t){let a=t.toLowerCase().replace(/^\./,""),n=Ar.getType(a);n&&(o=n)}return o.startsWith("image/")?K.IMAGE:o.startsWith("video/")?K.VIDEO:o.startsWith("audio/")?K.AUDIO:K.FILE}function jo(e,t){let o=e;if(t){let a=t.toLowerCase().replace(/^\./,""),n=Ar.getType(a);n&&(o=n)}if(o.startsWith("image/"))return"image";if(o.startsWith("video/"))return"video";if(o.startsWith("audio/"))return"audio";switch(o){case"application/pdf":return"pdf";case"application/json":return"json";case"application/zip":case"application/x-zip-compressed":return"zip";case"application/x-rar-compressed":case"application/vnd.rar":return"rar";case"application/x-msdownload":case"application/x-executable":return"exe";case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":case"application/vnd.ms-excel":case"text/csv":return"excel";case"application/vnd.openxmlformats-officedocument.presentationml.presentation":case"application/vnd.ms-powerpoint":return"powerpoint";case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":case"application/msword":return"document"}if(o.startsWith("text/"))return"txt";if(t)switch(t.toLowerCase().replace(/^\./,"")){case"exe":case"msi":return"exe";case"zip":return"zip";case"rar":return"rar";case"pdf":return"pdf";case"csv":return"excel"}return"file"}var ct=a=>{var n=a,{type:e,className:t}=n,o=f(n,["type","className"]);switch(e){case"folder-with-files":return fe(zo,r({className:t},o));case"folder":return fe(To,r({className:t},o));case"image":return fe(At,r({className:t},o));case"video":return fe(So,r({className:t},o));case"audio":return fe(Lt,r({className:t},o));case"pdf":return fe(wo,r({className:t},o));case"excel":case"xlsx":return fe(Co,r({className:t},o));case"powerpoint":case"pptx":return fe(yo,r({className:t},o));case"document":case"docx":case"doc":return fe(Fo,r({className:t},o));case"txt":return fe(Mo,r({className:t},o));case"json":return fe(Io,r({className:t},o));case"zip":return fe(Do,r({className:t},o));case"rar":return fe(No,r({className:t},o));case"exe":return fe(Po,r({className:t},o));default:return fe(ko,r({className:t},o))}};function _r(e){if(!e||e.length===0)return"*/*";let t=[];for(let o of e)switch(o){case K.IMAGE:t.push("image/*");break;case K.VIDEO:t.push("video/*");break;case K.AUDIO:t.push("audio/*");break;case K.FILE:t.push("application/*","text/*");break}return t.join(",")}function Vr(e){if(!e||e.length===0)return"All files";let t=[];for(let o of e)switch(o){case K.IMAGE:t.push("Images");break;case K.VIDEO:t.push("Videos");break;case K.AUDIO:t.push("Audio");break;case K.FILE:t.push("Files");break}return t.join(", ")}import{jsx as Gr,jsxs as hl}from"react/jsx-runtime";function Ia(e){return hl("svg",s(r({xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",color:"currentColor"},e),{children:[Gr("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"}),Gr("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"})]}))}import{forwardRef as vl}from"react";import{jsx as Or,jsxs as xl}from"react/jsx-runtime";var ye=vl((i,n)=>{var l=i,{className:e,iconClassName:t,label:o="Close"}=l,a=f(l,["className","iconClassName","label"]);return xl(F,s(r({ref:n,variant:"outline",size:"icon",radius:"full",type:"button",className:v("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)},a),{children:[Or(He,{className:v("size-5 transition-colors text-inherit",t)}),Or("span",{className:"sr-only",children:o})]}))});ye.displayName="CloseButton";import{useState as bl}from"react";import{jsx as Br,jsxs as wl}from"react/jsx-runtime";function Hr({file:e}){var n;let[t,o]=bl(!1),a=e.previewUrl||e.url;return a&&!t?Br("img",{src:a,alt:((n=e==null?void 0:e.name)==null?void 0:n.substring(0,10))||"image",className:"w-full h-full object-contain rounded-md drop-shadow-md",onError:()=>o(!0)}):Br(At,{})}function Zr({file:e}){return e.caption?wl("p",{className:"text-xs text-blue-600 dark:text-blue-400 line-clamp-2 mb-2",children:[e.height," x ",e.width]}):null}import{useState as Cl}from"react";import{jsx as Re,jsxs as Na}from"react/jsx-runtime";function Ur({file:e,className:t}){let[o,a]=Cl(!1);return e.previewUrl&&!o?Na("div",{className:"relative w-full h-full",children:[Re("img",{src:e.previewUrl,className:"w-full h-full object-contain rounded-md",alt:e.name,onError:()=>a(!0)}),Re("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:Re("div",{className:"bg-black/60 rounded-full p-2 backdrop-blur-xs",children:Re(oo,{className:"size-5 text-white fill-white"})})})]}):e.url&&!o?Na("div",{className:"relative w-full h-full",children:[Re("video",{src:`${e.url}#t=0.001`,className:"w-full h-full object-contain rounded-md",preload:"metadata",muted:!0,playsInline:!0,onError:()=>a(!0)}),Re("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:Re("div",{className:"bg-black/60 rounded-full p-2 backdrop-blur-xs",children:Re(oo,{className:"size-5 text-white fill-white"})})})]}):Re("div",{className:"w-full h-full flex items-center justify-center bg-transparent",children:Re("div",{className:"text-center",children:Re("div",{className:"text-4xl",children:Re(ct,{type:"video",className:t})})})})}function jr({file:e}){var t;return(t=e.metaData)!=null&&t.duration?Na("p",{className:"text-xs text-blue-600 dark:text-blue-400 mb-2",children:["Duration: ",Math.floor(e.metaData.duration/60),":",(e.metaData.duration%60).toString().padStart(2,"0")]}):null}import{jsx as Wo,jsxs as yl}from"react/jsx-runtime";function Wr({file:e,className:t}){return Wo("div",{className:"w-full h-full flex items-center justify-center bg-transparent",children:Wo("div",{className:"text-center",children:Wo("div",{className:"text-4xl",children:Wo(ct,{type:"audio",className:t})})})})}function $r({file:e}){var t;return(t=e.metaData)!=null&&t.duration?yl("p",{className:"text-xs text-blue-600 dark:text-blue-400 mb-2",children:["Duration: ",Math.floor(e.metaData.duration/60),":",(e.metaData.duration%60).toString().padStart(2,"0")]}):null}import{jsx as no,jsxs as Fl}from"react/jsx-runtime";function Kr({file:e,className:t}){let o=jo(e.mime,e.ext);return no("div",{className:"w-full h-full flex items-center justify-center bg-transparent relative",children:e.previewUrl?no("img",{src:e.previewUrl,alt:e.name,className:"w-full h-full object-contain rounded-md drop-shadow-md"}):no("div",{className:"text-center",children:no("div",{className:"text-4xl",children:no(ct,{type:o,className:t})})})})}function Yr({file:e}){var t;return(t=e.metaData)!=null&&t.pageCount?Fl("p",{className:"text-xs text-blue-600 dark:text-blue-400 mb-2",children:["Pages: ",e.metaData.pageCount]}):null}import{jsx as Ml}from"react/jsx-runtime";function qr({file:e}){let t=jo(e.mime,e.ext);return Ml(ct,{type:t})}var Qr={images:{component:Hr,metadataComponent:Zr},videos:{component:Ur,metadataComponent:jr},files:{component:Kr,metadataComponent:Yr},audios:{component:Wr,metadataComponent:$r},default:{component:qr}};function pt(e){let t=je(e.mime,e.ext);return Qr[t]||Qr.default}import{jsx as Jr}from"react/jsx-runtime";function Ut(o){var a=o,{className:e}=a,t=f(a,["className"]);return Jr("kbd",r({"data-slot":"kbd",className:v("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 jt(o){var a=o,{className:e}=a,t=f(a,["className"]);return Jr("kbd",r({"data-slot":"kbd-group",className:v("inline-flex items-center gap-1",e)},t))}import{jsx as A,jsxs as q}from"react/jsx-runtime";function Xr(){let{isUploadModalOpen:e,setIsUploadModalOpen:t,uploadFiles:o,allowedFileTypes:a,maxUploadFiles:n,maxUploadSize:i}=E(),l=_r(a),c=Vr(a),[d,g]=kl([]),[{isDragging:u,errors:b},{removeFile:p,clearFiles:C,handleDragEnter:w,handleDragLeave:k,handleDragOver:y,handleDrop:M,openFileDialog:I,getInputProps:N}]=Lr({maxFiles:n,maxSize:i,accept:l,multiple:!0,onFilesChange:x=>{let R=x.map(T=>{let _=d.find(me=>me.id===T.id);return _?r(r({},_),T):s(r({},T),{progress:100,status:"completed"})});g(R)}}),h=x=>{p(x)},D=x=>{g(R=>R.map(T=>T.id===x?s(r({},T),{progress:0,status:"uploading",error:void 0}):T))},Z=()=>{let x=d.filter(R=>R.status==="completed");if(x.length>0){let R=x.map(T=>({name:T.file.name,size:T.file.size,type:je(T.file.type,T.file.name.split(".").pop()),lastModified:T.file instanceof File?T.file.lastModified:Date.now(),file:T.file,metadata:{}}));o(R),Y()}},Y=()=>{t(!1),C(),g([])},ae=(x,R)=>{let T={id:"temp",name:x.name,size:x.size,mime:x.type,ext:x.name.split(".").pop()||"",url:R||"",createdAt:new Date(x.lastModified),updatedAt:new Date(x.lastModified),folderId:null,metaData:{}},{component:_}=pt(T);return A(_,{file:T,metaData:T.metaData})},Ce=d.filter(x=>x.status==="completed").length,m=d.filter(x=>x.status==="uploading").length,S=Ce>0&&m===0;return A(Ne,{open:e,onOpenChange:t,children:q(Pe,{className:"p-0 max-w-4xl max-h-[80vh] flex flex-col",variant:"default",showCloseButton:!1,children:[q(Ze,{className:"pt-5 pb-3 m-0 border-b border-border",children:[A(Se,{className:"px-6 text-base",children:q("div",{className:"flex w-full items-center justify-between gap-2",children:[q("span",{children:["Upload Files",A(jt,{className:"ml-2",children:q(Ut,{children:[A("span",{className:"text-lg",children:"\u2318"})," + U"]})})]}),A(ye,{onClick:()=>t(!1)})]})}),A(dt,{})]}),q("div",{className:"p-6 overflow-y-auto flex-1",children:[q("div",{className:v("relative rounded-lg border-dashed border-[2.5px] bg-gray-100 dark:bg-zinc-800 border-gray-300 dark:border-zinc-600 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:w,onDragLeave:k,onDragOver:y,onDrop:M,children:[A("input",s(r({},N()),{className:"sr-only"})),q("div",{className:"flex flex-col items-center",children:[A("div",{className:v("flex h-12 w-12 items-center justify-center rounded-full transition-colors",u?"border-primary bg-primary/10":"border-muted-foreground/25"),children:A(Ia,{className:"mb-3 text-zinc-400 dark:text-zinc-500"})}),q("div",{className:"space-y-2",children:[q("p",{className:"text-sm font-medium",children:["Drop files here or"," ",A("button",{type:"button",onClick:I,className:"cursor-pointer text-blue-600 dark:text-blue-400 underline-offset-4 underline",children:"browse files"})]}),q("p",{className:"text-xs text-muted-foreground",children:[c," \u2022 Max size: ",oe(i)," \u2022 Max files: ",n]})]})]})]}),d.length>0&&A("div",{className:"space-y-4",children:A("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3 lg:grid-cols-4",children:d.map(x=>q("div",{className:"relative group",children:[A(ye,{onClick:()=>h(x.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"}),q("div",{className:"relative overflow-hidden rounded-lg border bg-card transition-colors",children:[A("div",{className:"relative aspect-square bg-muted border-b border-slate-200 dark:border-zinc-800",children:A("div",{className:"flex h-full items-center justify-center p-4",children:A("div",{className:"w-[75%] h-[75%] flex items-center justify-center",children:x.status==="uploading"?q("div",{className:"relative w-full h-full flex items-center justify-center",children:[q("svg",{className:"size-12 -rotate-90 absolute",viewBox:"0 0 48 48",children:[A("circle",{cx:"24",cy:"24",r:"20",fill:"none",stroke:"currentColor",strokeWidth:"3",className:"text-muted-foreground/20"}),A("circle",{cx:"24",cy:"24",r:"20",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeDasharray:`${2*Math.PI*20}`,strokeDashoffset:`${2*Math.PI*20*(1-x.progress/100)}`,className:"text-primary transition-all duration-300",strokeLinecap:"round"})]}),x.file instanceof File&&ae(x.file,x.preview)]}):x.file instanceof File&&ae(x.file,x.preview)})})}),A("div",{className:"p-3",children:q("div",{className:"space-y-1",children:[A("p",{className:"truncate text-xs font-medium",children:x.file.name}),q("div",{className:"relative flex items-center justify-between gap-2",children:[A("span",{className:"text-[11px] text-blue-600 dark:text-blue-400 font-semibold tracking-tight",children:oe(x.file.size)}),x.status==="error"&&x.error&&q(Rr,{children:[A(Tr,{asChild:!0,children:A(F,{onClick:()=>D(x.id),variant:"ghost",size:"icon",className:"absolute end-0 -top-1.25 size-6 text-destructive hover:bg-destructive/10 hover:text-destructive",children:A(Bt,{className:"size-3 opacity-100"})})}),A(Er,{children:"Upload failed. Retry"})]})]})]})})]})]},x.id))})}),b.length>0&&q(Ir,{variant:"destructive",appearance:"light",className:"mt-5",children:[A(Pr,{children:A(Uo,{})}),q(zr,{children:[A(Nr,{children:"File upload error(s)"}),A(Sr,{children:b.map((x,R)=>A("p",{className:"last:mb-0",children:x},R))})]})]})]}),q(Ue,{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:[A(Xe,{asChild:!0,children:A(F,{type:"button",radius:"full",variant:"outline",onClick:Y,className:"w-full md:w-auto",children:"Cancel"})}),q(F,{type:"button",radius:"full",onClick:Z,disabled:!S,className:"w-full md:w-auto",children:["Upload ",Ce>0&&`(${Ce})`]})]})]})})}import{useState as Nl,useEffect as Pl}from"react";import{cva as $o}from"class-variance-authority";import{jsx as Il}from"react/jsx-runtime";var Dl=$o(`
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 y(w){var F=w,{className:e,selected:t,variant:a$1,radius:o,appearance:r,mode:n,size:s,autoHeight:m,underlined:l,underline:v,asChild:u=false,placeholder:x=false}=F,c$1=c(F,["className","selected","variant","radius","appearance","mode","size","autoHeight","underlined","underline","asChild","placeholder"]);let M=u?Slot.Slot:"button";return jsx(M,a(a({"data-slot":"button",className:f(un({variant:a$1,size:s,radius:o,appearance:r,mode:n,autoHeight:m,placeholder:x,underlined:l,underline:v,className:e}),u&&c$1.disabled&&"pointer-events-none opacity-50")},t&&{"data-state":"open"}),c$1))}function fn(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 va({className:e}){let{pagination:t,handlePageChange:a,files:o$1,folders:r}=E(),{currentPage:n,totalPages:s}=t,m=((o$1==null?void 0:o$1.length)||0)+((r==null?void 0:r.length)||0);if(s<=1||m===0)return null;let l=fn(n,s);return jsx(pa,{className:e,children:jsxs(fa,{children:[jsx(Ut,{children:jsx(y,{variant:"ghost",radius:"full",asChild:true,disabled:n===1,onClick:()=>n>1&&a(n-1),children:jsxs("span",{children:[jsx(p,{className:"rtl:rotate-180"})," Previous"]})})}),l.map((v,u)=>v==="ellipsis"?jsx(Ut,{children:jsx(ga,{})},`ellipsis-${n}-${s}-${u}`):jsx(Ut,{children:jsx(y,{variant:v===n?"outline":"ghost",mode:"icon",size:"icon",radius:"full",asChild:true,onClick:()=>a(v),disabled:v===n,children:jsx("span",{children:v})})},v)),jsx(Ut,{children:jsx(y,{variant:"ghost",radius:"full",asChild:true,disabled:n===s,onClick:()=>n<s&&a(n+1),children:jsxs("span",{children:["Next ",jsx(o,{className:"rtl:rotate-180"})]})})})]})})}function xa({children:e,className:t}){return jsx("div",{className:f("p-4 flex md:flex-row gap-2",t),children:e})}var xn=cva("flex flex-col fixed outline-0 z-50 border border-border bg-background 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 Fe(t){var e=c(t,[]);return jsx(Dialog.Root,a({"data-slot":"dialog"},e))}function bn(t){var e=c(t,[]);return jsx(Dialog.Portal,a({"data-slot":"dialog-portal"},e))}function Ge(t){var e=c(t,[]);return jsx(Dialog.Close,a({"data-slot":"dialog-close"},e))}function hn(a$1){var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx(Dialog.Overlay,a({"data-slot":"dialog-overlay",className:f("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 we(s$1){var m=s$1,{className:e,children:t,showCloseButton:a$1=true,overlay:o=true,variant:r}=m,n=c(m,["className","children","showCloseButton","overlay","variant"]);return jsxs(bn,{children:[o&&jsx(hn,{}),jsxs(Dialog.Content,b(a({"data-slot":"dialog-content",className:f(xn({variant:r}),e)},n),{children:[t,a$1&&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:[jsx(s,{className:"size-4 text-gray-600 dark:text-zinc-400"}),jsx("span",{className:"sr-only",children:"Close"})]})]}))]})}var Le=a$1=>{var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx("div",a({"data-slot":"dialog-header",className:f("flex flex-col space-y-1 text-center sm:text-start mb-5",e)},t))},_e=a$1=>{var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx("div",a({"data-slot":"dialog-footer",className:f("flex flex-col-reverse sm:flex-row sm:justify-end pt-5 sm:space-x-2.5",e)},t))};function Ne(a$1){var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx(Dialog.Title,a({"data-slot":"dialog-title",className:f("text-lg font-semibold leading-none tracking-tight",e)},t))}function Je(a$1){var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx(Dialog.Description,a({"data-slot":"dialog-description",className:f("text-sm text-muted-foreground",e)},t))}var Cn=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 ba(v){var u=v,{className:e,variant:t,size:a$1,icon:o,appearance:r,close:n=false,onClose:s$1,children:m}=u,l=c(u,["className","variant","size","icon","appearance","close","onClose","children"]);return jsxs("div",b(a({"data-slot":"alert",role:"alert",className:f(Cn({variant:t,size:a$1,icon:o,appearance:r}),e)},l),{children:[m,n&&jsx("button",{onClick:s$1,"aria-label":"Dismiss","data-slot":"alert-close",className:f("group shrink-0 size-4 cursor-pointer"),children:jsx(s,{className:"opacity-60 group-hover:opacity-100 size-4"})})]}))}function ha(a$1){var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx("div",a({"data-slot":"alert-title",className:f("grow tracking-tight",e)},t))}function ya(o){var r=o,{children:e,className:t}=r,a$1=c(r,["children","className"]);return jsx("div",b(a({"data-slot":"alert-icon",className:f("shrink-0",t)},a$1),{children:e}))}function Ca(a$1){var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx("div",a({"data-slot":"alert-description",className:f("text-sm [&_p]:leading-relaxed [&_p]:mb-2",e)},t))}function Fa(a$1){var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx("div",a({"data-slot":"alert-content",className:f("space-y-2 [&_[data-slot=alert-title]]:font-semibold",e)},t))}function wn(a$1){var o=a$1,{delayDuration:e=0}=o,t=c(o,["delayDuration"]);return jsx(Me.Provider,a({"data-slot":"tooltip-provider",delayDuration:e},t))}function wa(t){var e=c(t,[]);return jsx(wn,{children:jsx(Me.Root,a({"data-slot":"tooltip"},e))})}function Na(t){var e=c(t,[]);return jsx(Me.Trigger,a({"data-slot":"tooltip-trigger"},e))}function Ma(r){var n=r,{className:e,sideOffset:t=0,children:a$1}=n,o=c(n,["className","sideOffset","children"]);return jsx(Me.Portal,{children:jsxs(Me.Content,b(a({"data-slot":"tooltip-content",sideOffset:t,className:f("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$1,jsx(Me.Arrow,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]}))})}function ee(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 ka=(e={})=>{let{maxFiles:t=Number.POSITIVE_INFINITY,maxSize:a$1=Number.POSITIVE_INFINITY,accept:o="*",multiple:r=false,initialFiles:n=[],onFilesChange:s,onFilesAdded:m,onError:l}=e,[v,u]=useState({files:n.map(d=>({file:d,id:d.id,preview:d.url})),isDragging:false,errors:[]}),x=useRef(null);useEffect(()=>()=>{v.files.forEach(d=>{d.preview&&d.file instanceof File&&URL.revokeObjectURL(d.preview);});},[v.files]);let c=useCallback(d=>{if(d instanceof File){if(d.size>a$1)return `File "${d.name}" exceeds the maximum size of ${ee(a$1)}.`}else if(d.size>a$1)return `File "${d.name}" exceeds the maximum size of ${ee(a$1)}.`;if(o!=="*"){let I=o.split(",").map(A=>A.trim()),g=d instanceof File?d.type||"":d.type,R=`.${d.name.split(".").pop()}`;if(!I.some(A=>{if(A.startsWith("."))return R.toLowerCase()===A.toLowerCase();if(A.endsWith("/*")){let de=A.split("/")[0];return g.startsWith(`${de}/`)}return g===A}))return `File "${d.name}" is not an accepted file type.`}return null},[o,a$1]),w=useCallback(d=>d instanceof File?URL.createObjectURL(d):d.url,[]),F=useCallback(d=>d instanceof File?`${d.name}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`:d.id.toString(),[]),M=useCallback(()=>{u(d=>{for(let g of d.files)g.preview&&g.file instanceof File&&g.file.type.startsWith("image/")&&URL.revokeObjectURL(g.preview);x.current&&(x.current.value="");let I=b(a({},d),{files:[],errors:[]});return s==null||s(I.files),I});},[s]),C=useCallback(d=>{if(!d||d.length===0)return;let I=Array.from(d),g=[];u(R=>b(a({},R),{errors:[]})),r||M(),u(R=>{if(r&&t!==Number.POSITIVE_INFINITY&&R.files.length+I.length>t)return g.push(`You can only upload a maximum of ${t} files.`),l==null||l(g),b(a({},R),{errors:g});let T=[];for(let A of I){if(r&&R.files.some(P=>P.file.name===A.name&&P.file.size===A.size))continue;if(A.size>a$1){g.push(r?`Some files exceed the maximum size of ${ee(a$1)}.`:`File exceeds the maximum size of ${ee(a$1)}.`);continue}let de=c(A);de?g.push(de):T.push({file:A,id:F(A),preview:w(A)});}if(T.length>0){m==null||m(T);let A=r?[...R.files,...T]:T;return s==null||s(A),b(a({},R),{files:A,errors:g})}else if(g.length>0)return l==null||l(g),b(a({},R),{errors:g});return R}),x.current&&(x.current.value="");},[t,r,a$1,c,w,F,M,s,m,l]),N=useCallback(d=>{u(I=>{let g=I.files.find(T=>T.id===d);g&&g.preview&&g.file instanceof File&&g.file.type.startsWith("image/")&&URL.revokeObjectURL(g.preview);let R=I.files.filter(T=>T.id!==d);return s==null||s(R),b(a({},I),{files:R,errors:[]})});},[s]),D=useCallback(()=>{u(d=>b(a({},d),{errors:[]}));},[]),k=useCallback(d=>{d.preventDefault(),d.stopPropagation(),u(I=>b(a({},I),{isDragging:true}));},[]),b$1=useCallback(d=>{d.preventDefault(),d.stopPropagation(),!d.currentTarget.contains(d.relatedTarget)&&u(I=>b(a({},I),{isDragging:false}));},[]),S=useCallback(d=>{d.preventDefault(),d.stopPropagation();},[]),j=useCallback(d=>{var I;if(d.preventDefault(),d.stopPropagation(),u(g=>b(a({},g),{isDragging:false})),!((I=x.current)!=null&&I.disabled)&&d.dataTransfer.files&&d.dataTransfer.files.length>0)if(r)C(d.dataTransfer.files);else {let g=d.dataTransfer.files[0];C([g]);}},[C,r]),J=useCallback(d=>{d.target.files&&d.target.files.length>0&&C(d.target.files);},[C]),te=useCallback(()=>{x.current&&x.current.click();},[]),ve=useCallback((d={})=>b(a({},d),{type:"file",onChange:J,accept:d.accept||o,multiple:d.multiple!==void 0?d.multiple:r,ref:x}),[o,r,J]);return [v,{addFiles:C,removeFile:N,clearFiles:M,clearErrors:D,handleDragEnter:k,handleDragLeave:b$1,handleDragOver:S,handleDrop:j,handleFileChange:J,openFileDialog:te,getInputProps:ve}]};function Io(e){return jsxs("svg",b(a({xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",color:"currentColor"},e),{children:[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"}),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 xe=forwardRef((n,r)=>{var s$1=n,{className:e,iconClassName:t,label:a$1="Close"}=s$1,o=c(s$1,["className","iconClassName","label"]);return jsxs(y,b(a({ref:r,variant:"outline",size:"icon",radius:"full",type:"button",className:f("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:[jsx(s,{className:f("size-5 transition-colors text-inherit",t)}),jsx("span",{className:"sr-only",children:a$1})]}))});xe.displayName="CloseButton";function Sa({file:e}){var r;let[t,a]=useState(false),o=e.previewUrl||e.url;return o&&!t?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)}):jsx(i,{})}function za({file:e}){return e.caption?jsxs("p",{className:"text-xs text-primary line-clamp-2 mb-2",children:[e.height," x ",e.width]}):null}function Ra({file:e,className:t}){let[a,o]=useState(false);return e.previewUrl&&!a?jsxs("div",{className:"relative w-full h-full",children:[jsx("img",{src:e.previewUrl,className:"w-full h-full object-contain rounded-md",alt:e.name,onError:()=>o(true)}),jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:jsx("div",{className:"bg-black/60 rounded-full p-2 backdrop-blur-xs",children:jsx(D,{className:"size-5 text-white fill-white"})})})]}):e.url&&!a?jsxs("div",{className:"relative w-full h-full",children:[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)}),jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:jsx("div",{className:"bg-black/60 rounded-full p-2 backdrop-blur-xs",children:jsx(D,{className:"size-5 text-white fill-white"})})})]}):jsx("div",{className:"w-full h-full flex items-center justify-center bg-transparent",children:jsx("div",{className:"text-center",children:jsx("div",{className:"text-4xl",children:jsx(J,{type:"video",className:t})})})})}function Ta({file:e}){var t;return (t=e.metaData)!=null&&t.duration?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 Ea({file:e,className:t}){return jsx("div",{className:"w-full h-full flex items-center justify-center bg-transparent",children:jsx("div",{className:"text-center",children:jsx("div",{className:"text-4xl",children:jsx(J,{type:"audio",className:t})})})})}function La({file:e}){var t;return (t=e.metaData)!=null&&t.duration?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 _a({file:e,className:t}){let a=I(e.mime,e.ext);return jsx("div",{className:"w-full h-full flex items-center justify-center bg-transparent relative",children:e.previewUrl?jsx("img",{src:e.previewUrl,alt:e.name,className:"w-full h-full object-contain rounded-md drop-shadow-md"}):jsx("div",{className:"text-center",children:jsx("div",{className:"text-4xl",children:jsx(J,{type:a,className:t})})})})}function Aa({file:e}){var t;return (t=e.metaData)!=null&&t.pageCount?jsxs("p",{className:"text-xs text-primary mb-2",children:["Pages: ",e.metaData.pageCount]}):null}function Oa({file:e}){let t=I(e.mime,e.ext);return jsx(J,{type:t})}var Ba={images:{component:Sa,metadataComponent:za},videos:{component:Ra,metadataComponent:Ta},files:{component:_a,metadataComponent:Aa},audios:{component:Ea,metadataComponent:La},default:{component:Oa}};function Xe(e){let t=H(e.mime,e.ext);return Ba[t]||Ba.default}function Mt(a$1){var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx("kbd",a({"data-slot":"kbd",className:f("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 kt(a$1){var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx("kbd",a({"data-slot":"kbd-group",className:f("inline-flex items-center gap-1",e)},t))}function Ga(){let{isUploadModalOpen:e,setIsUploadModalOpen:t,uploadFiles:a$1,allowedFileTypes:o,maxUploadFiles:r,maxUploadSize:n}=E(),s=K(o),m=L(o),[l,v]=useState([]),[{isDragging:u,errors:x},{removeFile:c,clearFiles:w,handleDragEnter:F$1,handleDragLeave:M,handleDragOver:C,handleDrop:N,openFileDialog:D,getInputProps:k}]=ka({maxFiles:r,maxSize:n,accept:s,multiple:true,onFilesChange:g=>{let R=g.map(T=>{let A=l.find(de=>de.id===T.id);return A?a(a({},A),T):b(a({},T),{progress:100,status:"completed"})});v(R);}}),b$1=g=>{c(g);},S=g=>{v(R=>R.map(T=>T.id===g?b(a({},T),{progress:0,status:"uploading",error:void 0}):T));},j=()=>{let g=l.filter(R=>R.status==="completed");if(g.length>0){let R=g.map(T=>({name:T.file.name,size:T.file.size,type:H(T.file.type,T.file.name.split(".").pop()),lastModified:T.file instanceof File?T.file.lastModified:Date.now(),file:T.file,metadata:{}}));a$1(R),J();}},J=()=>{t(false),w(),v([]);},te=(g,R)=>{let T={id:"temp",name:g.name,size:g.size,mime:g.type,ext:g.name.split(".").pop()||"",url:R||"",createdAt:new Date(g.lastModified),updatedAt:new Date(g.lastModified),folderId:null,metaData:{}},{component:A}=Xe(T);return jsx(A,{file:T,metaData:T.metaData})},ve=l.filter(g=>g.status==="completed").length,d=l.filter(g=>g.status==="uploading").length,I=ve>0&&d===0;return jsx(Fe,{open:e,onOpenChange:t,children:jsxs(we,{className:"p-0 max-w-4xl max-h-[80vh] flex flex-col",variant:"default",showCloseButton:false,children:[jsxs(Le,{className:"pt-5 pb-3 m-0 border-b border-border",children:[jsx(Ne,{className:"px-6 text-base",children:jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[jsxs("span",{children:["Upload Files",jsx(kt,{className:"ml-2",children:jsxs(Mt,{children:[jsx("span",{className:"text-lg",children:"\u2318"})," + U"]})})]}),jsx(xe,{onClick:()=>t(false)})]})}),jsx(Je,{})]}),jsxs("div",{className:"p-6 overflow-y-auto flex-1",children:[jsxs("div",{className:f("relative rounded-lg border-dashed border-[2.5px] bg-muted border-border 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:F$1,onDragLeave:M,onDragOver:C,onDrop:N,children:[jsx("input",b(a({},k()),{className:"sr-only"})),jsxs("div",{className:"flex flex-col items-center",children:[jsx("div",{className:f("flex h-12 w-12 items-center justify-center rounded-full transition-colors",u?"border-primary bg-primary/10":"border-muted-foreground/25"),children:jsx(Io,{className:"mb-3 text-muted-foreground"})}),jsxs("div",{className:"space-y-2",children:[jsxs("p",{className:"text-sm font-medium",children:["Drop files here or"," ",jsx("button",{type:"button",onClick:D,className:"cursor-pointer text-primary underline-offset-4 underline",children:"browse files"})]}),jsxs("p",{className:"text-xs text-muted-foreground",children:[m," \u2022 Max size: ",ee(n)," \u2022 Max files: ",r]})]})]})]}),l.length>0&&jsx("div",{className:"space-y-4",children:jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3 lg:grid-cols-4",children:l.map(g=>jsxs("div",{className:"relative group",children:[jsx(xe,{onClick:()=>b$1(g.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"}),jsxs("div",{className:"relative overflow-hidden rounded-lg border bg-card transition-colors",children:[jsx("div",{className:"relative aspect-square bg-muted border-b border-border",children:jsx("div",{className:"flex h-full items-center justify-center p-4",children:jsx("div",{className:"w-[75%] h-[75%] flex items-center justify-center",children:g.status==="uploading"?jsxs("div",{className:"relative w-full h-full flex items-center justify-center",children:[jsxs("svg",{className:"size-12 -rotate-90 absolute",viewBox:"0 0 48 48",children:[jsx("circle",{cx:"24",cy:"24",r:"20",fill:"none",stroke:"currentColor",strokeWidth:"3",className:"text-muted-foreground/20"}),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-g.progress/100)}`,className:"text-primary transition-all duration-300",strokeLinecap:"round"})]}),g.file instanceof File&&te(g.file,g.preview)]}):g.file instanceof File&&te(g.file,g.preview)})})}),jsx("div",{className:"p-3",children:jsxs("div",{className:"space-y-1",children:[jsx("p",{className:"truncate text-xs font-medium",children:g.file.name}),jsxs("div",{className:"relative flex items-center justify-between gap-2",children:[jsx("span",{className:"text-[11px] text-primary font-semibold tracking-tight",children:ee(g.file.size)}),g.status==="error"&&g.error&&jsxs(wa,{children:[jsx(Na,{asChild:true,children:jsx(y,{onClick:()=>S(g.id),variant:"ghost",size:"icon",className:"absolute end-0 -top-1.25 size-6 text-destructive hover:bg-destructive/10 hover:text-destructive",children:jsx(F,{className:"size-3 opacity-100"})})}),jsx(Ma,{children:"Upload failed. Retry"})]})]})]})})]})]},g.id))})}),x.length>0&&jsxs(ba,{variant:"destructive",appearance:"light",className:"mt-5",children:[jsx(ya,{children:jsx(G,{})}),jsxs(Fa,{children:[jsx(ha,{children:"File upload error(s)"}),jsx(Ca,{children:x.map((g,R)=>jsx("p",{className:"last:mb-0",children:g},R))})]})]})]}),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:[jsx(Ge,{asChild:true,children:jsx(y,{type:"button",radius:"full",variant:"outline",onClick:J,className:"w-full md:w-auto",children:"Cancel"})}),jsxs(y,{type:"button",radius:"full",onClick:j,disabled:!I,className:"w-full md:w-auto",children:["Upload ",ve>0&&`(${ve})`]})]})]})})}var On=cva(`
25
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
26
10
  focus-visible:ring-ring/30 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-[3px]
27
11
  disabled:cursor-not-allowed disabled:opacity-60
@@ -29,7 +13,7 @@ var pi=Object.defineProperty,ui=Object.defineProperties;var mi=Object.getOwnProp
29
13
  file:h-full [&[type=file]]:py-0 file:border-solid file:border-input file:bg-transparent
30
14
  file:font-medium file:not-italic file:text-foreground file:p-0 file:border-0 file:border-e
31
15
  aria-invalid:border-destructive/60 aria-invalid:ring-destructive/10 dark:aria-invalid:border-destructive dark:aria-invalid:ring-destructive/20
32
- `,{variants:{variant:{lg:"h-10 px-4 text-sm rounded-md file:pe-4 file:me-4",md:"h-9 px-3 text-sm rounded-md file:pe-3 file:me-3",sm:"h-8 px-2.5 text-xs rounded-md file:pe-2.5 file:me-2.5"}},defaultVariants:{variant:"md"}}),Cm=$o("flex items-center shrink-0 justify-center bg-muted border border-input shadow-xs shadow-[rgba(0,0,0,0.05)] text-secondary-foreground [&_svg]:text-secondary-foreground/60",{variants:{variant:{lg:"rounded-md h-10 min-w-10 px-4 text-sm [&_svg:not([class*=size-])]:size-4.5",md:"rounded-md h-9 min-w-9 px-3 text-sm [&_svg:not([class*=size-])]:size-4.5",sm:"rounded-md h-8 min-w-7 text-xs px-2.5 [&_svg:not([class*=size-])]:size-3.5"},mode:{default:"",icon:"px-0 justify-center"}},defaultVariants:{variant:"md",mode:"default"}}),ym=$o(`
16
+ `,{variants:{variant:{lg:"h-10 px-4 text-sm rounded-md file:pe-4 file:me-4",md:"h-9 px-3 text-sm rounded-md file:pe-3 file:me-3",sm:"h-8 px-2.5 text-xs rounded-md file:pe-2.5 file:me-2.5"}},defaultVariants:{variant:"md"}});cva("flex items-center shrink-0 justify-center bg-muted border border-input shadow-xs shadow-[rgba(0,0,0,0.05)] text-secondary-foreground [&_svg]:text-secondary-foreground/60",{variants:{variant:{lg:"rounded-md h-10 min-w-10 px-4 text-sm [&_svg:not([class*=size-])]:size-4.5",md:"rounded-md h-9 min-w-9 px-3 text-sm [&_svg:not([class*=size-])]:size-4.5",sm:"rounded-md h-8 min-w-7 text-xs px-2.5 [&_svg:not([class*=size-])]:size-3.5"},mode:{default:"",icon:"px-0 justify-center"}},defaultVariants:{variant:"md",mode:"default"}});cva(`
33
17
  flex items-stretch
34
18
  [&_[data-slot=input]]:grow
35
19
  [&_[data-slot=input-addon]:has(+[data-slot=input])]:rounded-e-none [&_[data-slot=input-addon]:has(+[data-slot=input])]:border-e-0
@@ -48,7 +32,7 @@ var pi=Object.defineProperty,ui=Object.defineProperties;var mi=Object.getOwnProp
48
32
  [&_[data-slot=datefield]+[data-slot=input-addon]]:border-s-0
49
33
  [&_[data-slot=datefield]:has(~[data-slot=input-addon])]:[&_[data-slot=input]]:rounded-e-none
50
34
  [&_[data-slot=datefield]~[data-slot=input-addon]]:rounded-s-none
51
- `,{variants:{},defaultVariants:{}}),Fm=$o(`
35
+ `,{variants:{},defaultVariants:{}});cva(`
52
36
  flex items-center gap-1.5
53
37
  has-[:focus-visible]:ring-ring/30
54
38
  has-[:focus-visible]:border-ring
@@ -81,36 +65,35 @@ var pi=Object.defineProperty,ui=Object.defineProperties;var mi=Object.getOwnProp
81
65
  has-[[aria-invalid=true]]:ring-destructive/10
82
66
  dark:has-[[aria-invalid=true]]:border-destructive
83
67
  dark:has-[[aria-invalid=true]]:ring-destructive/20
84
- `,{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 Wt(n){var i=n,{className:e,type:t,variant:o}=i,a=f(i,["className","type","variant"]);return Il("input",r({"data-slot":"input",type:t,className:v(Dl({variant:o}),e)},a))}import{jsx as Te,jsxs as $t}from"react/jsx-runtime";function en(){let{isCreateFolderModalOpen:e,setIsCreateFolderModalOpen:t,isRenameFolderModalOpen:o,setIsRenameFolderModalOpen:a,createFolder:n,renameFolder:i,folderToRename:l,setFolderToRename:c}=E(),[d,g]=Nl(""),u=o,b=e||o;Pl(()=>{o&&l?g(l.name):e||g("")},[o,e,l]);let p=async()=>{if(d.trim()!==""){if(u&&l){let w=l.id;w!==null&&await i(w,d.trim()),a(!1),c(null)}else n(d.trim()),t(!1);g("")}},C=()=>{u?(a(!1),c(null)):t(!1),g("")};return b?Te(Ne,{open:b,onOpenChange:C,children:$t(Pe,{className:"p-0 max-w-xl m-auto max-h-[32vh] flex flex-col",variant:"fullscreen",showCloseButton:!1,children:[Te(Ze,{className:"pt-5 pb-3 m-0 border-b border-border flex w-full justify-between",children:Te(Se,{className:"px-6 text-base",children:$t("div",{className:"flex w-full items-center justify-between gap-2",children:[$t("span",{children:[u?"Rename Folder":"Create New Folder",!u&&Te("span",{className:"ml-4",children:Te(jt,{children:$t(Ut,{children:[Te("span",{className:"text-lg",children:"\u2318"})," + F"]})})})]}),Te(ye,{onClick:C})]})})}),$t("div",{className:"p-6",children:[Te("label",{htmlFor:"folder-name",className:"hidden mb-2",children:"Folder Name:"}),Te(Wt,{id:"folder-name",name:"folder-name",value:d,onChange:w=>g(w.target.value),placeholder:"Enter folder name",autoFocus:!0,onKeyDown:w=>{w.key==="Enter"&&d.trim()!==""&&p()}})]}),$t(Ue,{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:[Te(Xe,{asChild:!0,children:Te(F,{type:"button",variant:"outline",onClick:C,radius:"full",className:"w-full md:w-auto",children:"Cancel"})}),Te(F,{type:"button",disabled:d.trim()==="",onClick:p,radius:"full",className:"w-full md:w-auto",children:u?"Rename":"Create"})]})]})}):null}import{useState as Sa,useEffect as za}from"react";function We(e,t=30){if(e.length<=t)return e;let o=e.slice(0,Math.ceil(t/2)),a=e.slice(-Math.floor(t/2));return`${o}...${a}`}import{useEffect as Sl,useRef as zl,useState as tn}from"react";function Pa({threshold:e=0,root:t=null,rootMargin:o="0%"}={}){let[a,n]=tn(),[i,l]=tn(null),c=zl(null);return Sl(()=>(c.current&&c.current.disconnect(),i&&typeof window!="undefined"&&"IntersectionObserver"in window&&(c.current=new IntersectionObserver(([d])=>{n(d)},{threshold:e,root:t,rootMargin:o}),c.current.observe(i)),()=>{c.current&&c.current.disconnect()}),[i,e,t,o]),{ref:l,entry:a}}import{jsx as G,jsxs as ge}from"react/jsx-runtime";function on({folder:e,selectedFolderId:t,onSelect:o,onLoadChildren:a,disabledFolderIds:n=[],treeState:i}){var h;let[l,c]=Sa(!1),d=((h=e.folderCount)!=null?h:0)>0,g=t===e.id,u=n.includes(e.id),b=i.loading.has(e.id),p=i.loaded.has(e.id),C=i.folders.get(e.id)||[],w=i.pagination.get(e.id),{ref:k,entry:y}=Pa({threshold:.1,rootMargin:"100px"}),M=w&&w.currentPage<w.totalPages;return za(()=>{if(l&&(y!=null&&y.isIntersecting)&&M&&!b){let D=((w==null?void 0:w.currentPage)||1)+1;a(e.id,D)}},[y==null?void 0:y.isIntersecting,M,b,l,w,e.id,a]),ge("li",{children:[ge("div",{className:"flex items-center gap-1.5 py-1",children:[d?G("button",{onClick:async()=>{if(!d)return;let D=!l;c(D),D&&!p&&!b&&await a(e.id,1)},className:"p-1 -m-1 hover:bg-gray-100 dark:hover:bg-zinc-700 rounded transition-colors","aria-label":l?"Collapse folder":"Expand folder",children:G(lt,{className:`size-4 text-gray-500 dark:text-zinc-400 transition-transform ${!u&&l?"rotate-90":""}`})}):G("div",{className:"w-4"}),ge("button",{onClick:()=>{u||o(e.id)},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 ${g?"bg-blue-100 text-blue-600 dark:text-blue-400 font-semibold":u?"opacity-50 cursor-not-allowed":"hover:bg-gray-100 dark:hover:bg-zinc-700"}`,children:[G(qe,{className:"size-8 text-white shrink-0",strokeWidth:1.5}),ge("div",{className:"flex flex-col gap-1",children:[G("span",{className:"truncate min-w-0",children:We(e.name,15)}),u?G("span",{className:"text-[0.6rem] text-left font-medium text-gray-900 dark:text-zinc-300",children:"(Already selected)"}):""]})]})]}),!u&&l&&ge("ul",{className:"pl-6",children:[C.map(D=>G(on,{folder:D,selectedFolderId:t,onSelect:o,onLoadChildren:a,disabledFolderIds:n,treeState:i},D.id)),(b||M)&&G("li",{ref:k,className:"py-2 pl-6 flex justify-start",children:G(ce,{className:"h-4 w-4 animate-spin text-blue-500"})}),b&&C.length===0&&G("li",{className:"py-1",children:G("div",{className:"flex items-center gap-1.5 px-2",children:G("span",{className:"text-sm text-gray-500 dark:text-zinc-400",children:"Loading..."})})})]})]})}function an(){let{isMoveFileModalOpen:e,setIsMoveFileModalOpen:t,selectedFiles:o,selectedFolders:a,bulkMove:n,provider:i}=E(),[l,c]=Sa(void 0),[d,g]=Sa({folders:new Map,loading:new Set,loaded:new Set,pagination:new Map}),{ref:u,entry:b}=Pa({threshold:.1,rootMargin:"100px"}),p=d.pagination.get(null),C=p&&p.currentPage<p.totalPages,w=d.loading.has(null),k=a.map(h=>h.id),y=d.folders.get(null)||[];za(()=>{e&&!d.loaded.has(null)&&!d.loading.has(null)&&M(null,1)},[e]),za(()=>{if(e&&(b!=null&&b.isIntersecting)&&C&&!w){let h=((p==null?void 0:p.currentPage)||1)+1;M(null,h)}},[b==null?void 0:b.isIntersecting,C,w,p,e]);let M=async(h,D=1)=>{if(!d.loading.has(h)){g(Z=>s(r({},Z),{loading:new Set(Z.loading).add(h)}));try{let Z=await i.getFolders(h,D,20);g(Y=>{let ae=new Set(Y.loading);ae.delete(h);let Ce=new Set(Y.loaded);Ce.add(h);let m=new Map(Y.folders),S=m.get(h)||[];D>1?m.set(h,[...S,...Z.folders]):m.set(h,Z.folders);let x=new Map(Y.pagination);return x.set(h,Z.pagination),{folders:m,loading:ae,loaded:Ce,pagination:x}})}catch(Z){console.error(`Failed to load folders for ${h}:`,Z),g(Y=>{let ae=new Set(Y.loading);return ae.delete(h),s(r({},Y),{loading:ae})})}}},I=()=>{l!==void 0&&(n(l),t(!1),c(void 0),g({folders:new Map,loading:new Set,loaded:new Set,pagination:new Map}))},N=h=>{t(h),h?M(null,1):(c(void 0),g({folders:new Map,loading:new Set,loaded:new Set,pagination:new Map}))};return e?G(Ne,{open:e,onOpenChange:N,children:ge(Pe,{className:"p-0 max-w-3xl max-h-full m-auto md:max-h-[80vh] flex flex-col",variant:"fullscreen",showCloseButton:!1,children:[ge(Ze,{className:"pt-5 pb-3 m-0 border-b border-border",children:[G(Se,{className:"px-6 text-base",children:ge("div",{className:"flex w-full items-center justify-between gap-2",children:[ge("span",{className:"w-full text-left",children:["Move Items",ge("p",{className:"text-gray-400 text-xs",children:["Moving ",o.length," file",o.length===1?"":"s"," and"," ",a.length," folder",a.length===1?"":"s","."]})]}),G(ye,{onClick:()=>N(!1)})]})}),G(dt,{})]}),G("div",{className:"text-sm my-3 px-6 flex-1 flex flex-col min-h-0",children:G("div",{className:"space-y-4 flex flex-col flex-1 min-h-0",children:ge("div",{className:"flex flex-col flex-1 min-h-0",children:[G("label",{className:"block mb-2 font-medium text-gray-900 dark:text-zinc-100",children:"Select destination folder:"}),ge("ul",{className:"border rounded-xl p-2 shadow-inner overflow-y-auto flex-1 min-h-0",children:[G("li",{children:ge("div",{className:"flex items-center gap-1.5 py-1",children:[G("div",{className:"w-4"}),ge("button",{onClick:()=>c(null),className:`flex items-center gap-1.5 px-2 py-1 rounded-xl flex-1 text-left transition-colors min-w-0 ${l===null?"bg-blue-100 text-blue-600 dark:text-blue-400 font-semibold":"hover:bg-gray-100 dark:hover:bg-zinc-700"}`,children:[G(qe,{className:"size-8 text-white shrink-0",strokeWidth:1.5}),G("div",{className:"flex flex-col gap-1",children:G("span",{className:"truncate min-w-0",children:"Root Directory"})})]})]})}),y.map(h=>G(on,{folder:h,selectedFolderId:l,onSelect:D=>c(D),onLoadChildren:M,disabledFolderIds:k,treeState:d},h.id)),(w||C)&&G("li",{ref:u,className:"py-2 pl-6 flex justify-start",children:G(ce,{className:"h-5 w-5 animate-spin text-blue-500"})}),y.length===0&&!w&&!C&&G("li",{className:"text-gray-500 dark:text-zinc-400 text-sm text-center py-4",children:"No nested folders available"})]})]})})}),ge(Ue,{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:[G(Xe,{asChild:!0,children:G(F,{type:"button",variant:"outline",radius:"full",className:"w-full md:w-auto",children:"Cancel"})}),G(F,{type:"button",onClick:I,disabled:l===void 0,radius:"full",className:"w-full md:w-auto",children:"Move"})]})]})}):null}import{useState as Qo}from"react";import{ScrollArea as io}from"radix-ui";import{jsx as lo,jsxs as Tl}from"react/jsx-runtime";function rn(i){var l=i,{className:e,viewportClassName:t,children:o,viewportRef:a}=l,n=f(l,["className","viewportClassName","children","viewportRef"]);return Tl(io.Root,s(r({"data-slot":"scroll-area",className:v("relative overflow-hidden",e)},n),{children:[lo(io.Viewport,{ref:a,className:v("h-full w-full rounded-[inherit]",t),children:o}),lo(Rl,{}),lo(io.Corner,{})]}))}function Rl(a){var n=a,{className:e,orientation:t="vertical"}=n,o=f(n,["className","orientation"]);return lo(io.ScrollAreaScrollbar,s(r({"data-slot":"scroll-area-scrollbar",orientation:t,className:v("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2 flex-col border-t border-t-transparent p-[1px]",e)},o),{children:lo(io.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}))}import{jsx as et,jsxs as Ko}from"react/jsx-runtime";function ut({title:e,open:t,onClose:o,previewSection:a,metadataSection:n,footer:i}){return et(Ne,{open:t,onOpenChange:l=>!l&&o(),children:Ko(Pe,{className:"p-0 max-w-6xl w-full mx-auto flex flex-col",variant:"fullscreen",showCloseButton:!1,children:[Ko(Ze,{className:"pt-5 pb-3 m-0 border-b border-border",children:[et(Se,{className:"px-6 text-base",children:Ko("div",{className:"flex w-full justify-between gap-2",children:[et("span",{children:e}),et(ye,{onClick:()=>o()})]})}),et(dt,{})]}),et(rn,{className:"flex-1 h-0",children:Ko("div",{className:"grid grid-cols-1 lg:grid-cols-2 min-h-full",children:[et("div",{className:"p-6 border-b lg:border-b-0 lg:border-r border-slate-200 dark:border-zinc-700",children:a}),et("div",{className:"p-6 overflow-y-auto ",children:n})]})}),et(Ue,{className:"px-6 py-4 border-t border-border",children:i})]})})}import{toast as Kt}from"sonner";import{useState as Ra}from"react";import{jsx as Ve}from"react/jsx-runtime";function mt({file:e}){let{provider:t,setFileDetailsModalFile:o,refreshData:a}=E(),[n,i]=Ra(!1);return Ve(F,{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()=>{i(!0);try{await t.deleteFiles([e.id]),await a(),o(null),Kt.success("File Deleted",{description:`${We(e.name,20)} has been deleted`})}catch(c){Kt.error("Delete failed"),i(!1)}},disabled:n,children:n?Ve(ce,{className:"size-5 animate-spin"}):Ve(Be,{className:"size-5"})})}function ft({file:e}){let[t,o]=Ra(!1);return Ve(F,{variant:"outline",size:"icon",radius:"full",onClick:async()=>{o(!0);try{let n=document.createElement("a");n.href=e.url,n.download=e.name,n.click(),Kt.success("Download Started",{description:`Downloading ${We(e.name,20)}`})}catch(n){Kt.error("Download failed")}finally{o(!1)}},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?Ve(ce,{className:"size-5 animate-spin"}):Ve(Ao,{className:"size-5",strokeWidth:2.5})})}function gt({file:e}){let[t,o]=Ra(!1);return Ve(F,{variant:"outline",size:"icon",radius:"full",onClick:async()=>{try{await navigator.clipboard.writeText(e.url),o(!0),Kt.success("Link Copied",{description:"File URL copied to clipboard"}),setTimeout(()=>o(!1),2e3)}catch(n){Kt.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
85
- ${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?Ve(Je,{className:"size-5 animate-in zoom-in duration-200",strokeWidth:3}):Ve(Vo,{className:"size-5",strokeWidth:2.5})})}function nn({file:e,onFullscreen:t}){return Ve(F,{variant:"outline",size:"icon",radius:"full",onClick:t,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:Ve(Go,{className:"size-5",strokeWidth:1})})}import{cva as El}from"class-variance-authority";import{jsx as Al}from"react/jsx-runtime";var Ll=El(`
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 Dt(r){var n=r,{className:e,type:t,variant:a$1}=n,o=c(n,["className","type","variant"]);return jsx("input",a({"data-slot":"input",type:t,className:f(On({variant:a$1}),e)},o))}function Ua(){let{isCreateFolderModalOpen:e,setIsCreateFolderModalOpen:t,isRenameFolderModalOpen:a,setIsRenameFolderModalOpen:o,createFolder:r,renameFolder:n,folderToRename:s,setFolderToRename:m}=E(),[l,v]=useState(""),u=a,x=e||a;useEffect(()=>{a&&s?v(s.name):e||v("");},[a,e,s]);let c=async()=>{if(l.trim()!==""){if(u&&s){let F=s.id;F!==null&&await n(F,l.trim()),o(false),m(null);}else r(l.trim()),t(false);v("");}},w=()=>{u?(o(false),m(null)):t(false),v("");};return x?jsx(Fe,{open:x,onOpenChange:w,children:jsxs(we,{className:"p-0 max-w-xl m-auto max-h-[32vh] flex flex-col",variant:"fullscreen",showCloseButton:false,children:[jsx(Le,{className:"pt-5 pb-3 m-0 border-b border-border flex w-full justify-between",children:jsx(Ne,{className:"px-6 text-base",children:jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[jsxs("span",{children:[u?"Rename Folder":"Create New Folder",!u&&jsx("span",{className:"ml-4",children:jsx(kt,{children:jsxs(Mt,{children:[jsx("span",{className:"text-lg",children:"\u2318"})," + F"]})})})]}),jsx(xe,{onClick:w})]})})}),jsxs("div",{className:"p-6",children:[jsx("label",{htmlFor:"folder-name",className:"hidden mb-2",children:"Folder Name:"}),jsx(Dt,{id:"folder-name",name:"folder-name",value:l,onChange:F=>v(F.target.value),placeholder:"Enter folder name",autoFocus:true,onKeyDown:F=>{F.key==="Enter"&&l.trim()!==""&&c();}})]}),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:[jsx(Ge,{asChild:true,children:jsx(y,{type:"button",variant:"outline",onClick:w,radius:"full",className:"w-full md:w-auto",children:"Cancel"})}),jsx(y,{type:"button",disabled:l.trim()==="",onClick:c,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 zo({threshold:e=0,root:t=null,rootMargin:a="0%"}={}){let[o,r]=useState(),[n,s]=useState(null),m=useRef(null);return useEffect(()=>(m.current&&m.current.disconnect(),n&&typeof window!="undefined"&&"IntersectionObserver"in window&&(m.current=new IntersectionObserver(([l])=>{r(l);},{threshold:e,root:t,rootMargin:a}),m.current.observe(n)),()=>{m.current&&m.current.disconnect();}),[n,e,t,a]),{ref:s,entry:o}}function $a({folder:e,selectedFolderId:t,onSelect:a,onLoadChildren:o$1,disabledFolderIds:r=[],treeState:n}){var b;let[s,m]=useState(false),l=((b=e.folderCount)!=null?b:0)>0,v=t===e.id,u=r.includes(e.id),x=n.loading.has(e.id),c=n.loaded.has(e.id),w=n.folders.get(e.id)||[],F=n.pagination.get(e.id),{ref:M,entry:C$1}=zo({threshold:.1,rootMargin:"100px"}),N=F&&F.currentPage<F.totalPages;return useEffect(()=>{if(s&&(C$1!=null&&C$1.isIntersecting)&&N&&!x){let S=((F==null?void 0:F.currentPage)||1)+1;o$1(e.id,S);}},[C$1==null?void 0:C$1.isIntersecting,N,x,s,F,e.id,o$1]),jsxs("li",{children:[jsxs("div",{className:"flex items-center gap-1.5 py-1",children:[l?jsx("button",{onClick:async()=>{if(!l)return;let S=!s;m(S),S&&!c&&!x&&await o$1(e.id,1);},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:jsx(o,{className:`size-4 text-gray-500 dark:text-zinc-400 transition-transform ${!u&&s?"rotate-90":""}`})}):jsx("div",{className:"w-4"}),jsxs("button",{onClick:()=>{u||a(e.id);},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 ${v?"bg-blue-100 text-blue-600 dark:text-blue-400 font-semibold":u?"opacity-50 cursor-not-allowed":"hover:bg-gray-100 dark:hover:bg-zinc-700"}`,children:[jsx(j,{className:"size-8 text-white shrink-0",strokeWidth:1.5}),jsxs("div",{className:"flex flex-col gap-1",children:[jsx("span",{className:"truncate min-w-0",children:Ae(e.name,15)}),u?jsx("span",{className:"text-[0.6rem] text-left font-medium text-gray-900 dark:text-zinc-300",children:"(Already selected)"}):""]})]})]}),!u&&s&&jsxs("ul",{className:"pl-6",children:[w.map(S=>jsx($a,{folder:S,selectedFolderId:t,onSelect:a,onLoadChildren:o$1,disabledFolderIds:r,treeState:n},S.id)),(x||N)&&jsx("li",{ref:M,className:"py-2 pl-6 flex justify-start",children:jsx(C,{className:"h-4 w-4 animate-spin text-blue-500"})}),x&&w.length===0&&jsx("li",{className:"py-1",children:jsx("div",{className:"flex items-center gap-1.5 px-2",children:jsx("span",{className:"text-sm text-gray-500 dark:text-zinc-400",children:"Loading..."})})})]})]})}function Ka(){let{isMoveFileModalOpen:e,setIsMoveFileModalOpen:t,selectedFiles:a$1,selectedFolders:o,bulkMove:r,provider:n}=E(),[s,m]=useState(void 0),[l,v]=useState({folders:new Map,loading:new Set,loaded:new Set,pagination:new Map}),{ref:u,entry:x}=zo({threshold:.1,rootMargin:"100px"}),c=l.pagination.get(null),w=c&&c.currentPage<c.totalPages,F=l.loading.has(null),M=o.map(b=>b.id),C$1=l.folders.get(null)||[];useEffect(()=>{e&&!l.loaded.has(null)&&!l.loading.has(null)&&N(null,1);},[e]),useEffect(()=>{if(e&&(x!=null&&x.isIntersecting)&&w&&!F){let b=((c==null?void 0:c.currentPage)||1)+1;N(null,b);}},[x==null?void 0:x.isIntersecting,w,F,c,e]);let N=async(b$1,S=1)=>{if(!l.loading.has(b$1)){v(j=>b(a({},j),{loading:new Set(j.loading).add(b$1)}));try{let j=await n.getFolders(b$1,S,20);v(J=>{let te=new Set(J.loading);te.delete(b$1);let ve=new Set(J.loaded);ve.add(b$1);let d=new Map(J.folders),I=d.get(b$1)||[];S>1?d.set(b$1,[...I,...j.folders]):d.set(b$1,j.folders);let g=new Map(J.pagination);return g.set(b$1,j.pagination),{folders:d,loading:te,loaded:ve,pagination:g}});}catch(j){console.error(`Failed to load folders for ${b$1}:`,j),v(J=>{let te=new Set(J.loading);return te.delete(b$1),b(a({},J),{loading:te})});}}},D=()=>{s!==void 0&&(r(s),t(false),m(void 0),v({folders:new Map,loading:new Set,loaded:new Set,pagination:new Map}));},k=b=>{t(b),b?N(null,1):(m(void 0),v({folders:new Map,loading:new Set,loaded:new Set,pagination:new Map}));};return e?jsx(Fe,{open:e,onOpenChange:k,children:jsxs(we,{className:"p-0 max-w-3xl max-h-full m-auto md:max-h-[80vh] flex flex-col",variant:"fullscreen",showCloseButton:false,children:[jsxs(Le,{className:"pt-5 pb-3 m-0 border-b border-border",children:[jsx(Ne,{className:"px-6 text-base",children:jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[jsxs("span",{className:"w-full text-left",children:["Move Items",jsxs("p",{className:"text-gray-400 text-xs",children:["Moving ",a$1.length," file",a$1.length===1?"":"s"," and"," ",o.length," folder",o.length===1?"":"s","."]})]}),jsx(xe,{onClick:()=>k(false)})]})}),jsx(Je,{})]}),jsx("div",{className:"text-sm my-3 px-6 flex-1 flex flex-col min-h-0",children:jsx("div",{className:"space-y-4 flex flex-col flex-1 min-h-0",children:jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[jsx("label",{className:"block mb-2 font-medium text-gray-900 dark:text-zinc-100",children:"Select destination folder:"}),jsxs("ul",{className:"border rounded-xl p-2 shadow-inner overflow-y-auto flex-1 min-h-0",children:[jsx("li",{children:jsxs("div",{className:"flex items-center gap-1.5 py-1",children:[jsx("div",{className:"w-4"}),jsxs("button",{onClick:()=>m(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:[jsx(j,{className:"size-8 text-white shrink-0",strokeWidth:1.5}),jsx("div",{className:"flex flex-col gap-1",children:jsx("span",{className:"truncate min-w-0",children:"Root Directory"})})]})]})}),C$1.map(b=>jsx($a,{folder:b,selectedFolderId:s,onSelect:S=>m(S),onLoadChildren:N,disabledFolderIds:M,treeState:l},b.id)),(F||w)&&jsx("li",{ref:u,className:"py-2 pl-6 flex justify-start",children:jsx(C,{className:"h-5 w-5 animate-spin text-blue-500"})}),C$1.length===0&&!F&&!w&&jsx("li",{className:"text-gray-500 dark:text-zinc-400 text-sm text-center py-4",children:"No nested folders available"})]})]})})}),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:[jsx(Ge,{asChild:true,children:jsx(y,{type:"button",variant:"outline",radius:"full",className:"w-full md:w-auto",children:"Cancel"})}),jsx(y,{type:"button",onClick:D,disabled:s===void 0,radius:"full",className:"w-full md:w-auto",children:"Move"})]})]})}):null}function Wa(n){var s=n,{className:e,viewportClassName:t,children:a$1,viewportRef:o}=s,r=c(s,["className","viewportClassName","children","viewportRef"]);return jsxs(ScrollArea.Root,b(a({"data-slot":"scroll-area",className:f("relative overflow-hidden",e)},r),{children:[jsx(ScrollArea.Viewport,{ref:o,className:f("h-full w-full rounded-[inherit]",t),children:a$1}),jsx($n,{}),jsx(ScrollArea.Corner,{})]}))}function $n(o){var r=o,{className:e,orientation:t="vertical"}=r,a$1=c(r,["className","orientation"]);return jsx(ScrollArea.ScrollAreaScrollbar,b(a({"data-slot":"scroll-area-scrollbar",orientation:t,className:f("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2 flex-col border-t border-t-transparent p-[1px]",e)},a$1),{children:jsx(ScrollArea.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}))}function et({title:e,open:t,onClose:a,previewSection:o,metadataSection:r,footer:n}){return jsx(Fe,{open:t,onOpenChange:s=>!s&&a(),children:jsxs(we,{className:"p-0 max-w-6xl w-full mx-auto flex flex-col",variant:"fullscreen",showCloseButton:false,children:[jsxs(Le,{className:"pt-5 pb-3 m-0 border-b border-border",children:[jsx(Ne,{className:"px-6 text-base",children:jsxs("div",{className:"flex w-full justify-between gap-2",children:[jsx("span",{children:e}),jsx(xe,{onClick:()=>a()})]})}),jsx(Je,{})]}),jsx(Wa,{className:"flex-1 h-0",children:jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 min-h-full",children:[jsx("div",{className:"p-6 border-b lg:border-b-0 lg:border-r border-slate-200 dark:border-zinc-700",children:o}),jsx("div",{className:"p-6 overflow-y-auto ",children:r})]})}),jsx(_e,{className:"px-6 py-4 border-t border-border",children:n})]})})}function tt({file:e}){let{provider:t,setFileDetailsModalFile:a,refreshData:o}=E(),[r$1,n]=useState(false);return jsx(y,{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),toast.success("File Deleted",{description:`${Ae(e.name,20)} has been deleted`});}catch(m){toast.error("Delete failed"),n(false);}},disabled:r$1,children:r$1?jsx(C,{className:"size-5 animate-spin"}):jsx(r,{className:"size-5"})})}function ot({file:e}){let[t$1,a]=useState(false);return jsx(y,{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(),toast.success("Download Started",{description:`Downloading ${Ae(e.name,20)}`});}catch(r){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$1,children:t$1?jsx(C,{className:"size-5 animate-spin"}):jsx(t,{className:"size-5",strokeWidth:2.5})})}function at({file:e}){let[t,a]=useState(false);return jsx(y,{variant:"outline",size:"icon",radius:"full",onClick:async()=>{try{await navigator.clipboard.writeText(e.url),a(!0),toast.success("Link Copied",{description:"File URL copied to clipboard"}),setTimeout(()=>a(!1),2e3);}catch(r){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?jsx(w,{className:"size-5 animate-in zoom-in duration-200",strokeWidth:3}):jsx(u,{className:"size-5",strokeWidth:2.5})})}function ja({file:e,onFullscreen:t}){return jsx(y,{variant:"outline",size:"icon",radius:"full",onClick:t,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:jsx(v,{className:"size-5",strokeWidth:1})})}var jn=cva(`
86
70
  w-full bg-background border border-input bg-background text-foreground shadow-xs shadow-black/5 transition-[color,box-shadow]
87
71
  text-foreground placeholder:text-muted-foreground/80 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-[3px]
88
72
  focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 [&[readonly]]:opacity-70
89
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
90
- `,{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 $e(a){var n=a,{className:e,variant:t}=n,o=f(n,["className","variant"]);return Al("textarea",r({"data-slot":"textarea",className:v(Ll({variant:t}),e)},o))}import{cva as _l}from"class-variance-authority";import{Label as Vl}from"radix-ui";import{jsx as Ol}from"react/jsx-runtime";var Gl=_l("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 Ge(a){var n=a,{className:e,variant:t}=n,o=f(n,["className","variant"]);return Ol(Vl.Root,r({"data-slot":"label",className:v(Gl({variant:t}),e)},o))}function ht(e){let t=typeof e=="string"?new Date(e):e,o=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0"),n=t.getFullYear();return`${o}/${a}/${n}`}function Yo(e){let t=Math.floor(e/60),o=e%60;return`${t}:${o.toString().padStart(2,"0")}`}import{useMemo as V1}from"react";import{cva as Bl}from"class-variance-authority";import{Separator as S1}from"radix-ui";import{jsx as T1}from"react/jsx-runtime";import{jsx as ln,jsxs as U1}from"react/jsx-runtime";var Hl=Bl("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 vt(a){var n=a,{className:e,orientation:t="vertical"}=n,o=f(n,["className","orientation"]);return ln("div",r({role:"group","data-slot":"field","data-orientation":t,className:v(Hl({orientation:t}),e)},o))}function xt(o){var a=o,{className:e}=a,t=f(a,["className"]);return ln(Ge,r({"data-slot":"field-label",className:v("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))}import{cva as sn}from"class-variance-authority";import{jsx as qo}from"react/jsx-runtime";function bt(o){var a=o,{className:e}=a,t=f(a,["className"]);return qo("div",r({"data-slot":"input-group",role:"group",className:v("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 Zl=sn("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 wt(a){var n=a,{className:e,align:t="inline-start"}=n,o=f(n,["className","align"]);return qo("div",r({role:"group","data-slot":"input-group-addon","data-align":t,className:v(Zl({align:t}),e),onClick:i=>{var l,c;i.target.closest("button")||(c=(l=i.currentTarget.parentElement)==null?void 0:l.querySelector("input"))==null||c.focus()}},o))}var J1=sn("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(o){var a=o,{className:e}=a,t=f(a,["className"]);return qo("span",r({className:v("text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",e)},t))}function yt(o){var a=o,{className:e}=a,t=f(a,["className"]);return qo(Wt,r({"data-slot":"input-group-control",className:v("flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent",e)},t))}import{jsx as U,jsxs as he}from"react/jsx-runtime";function dn({file:e,onClose:t,onSave:o,onDelete:a}){var y;let[n,i]=Qo(!1),[l,c]=Qo(e.name),[d,g]=Qo(e.alternativeText||""),[u,b]=Qo(e.caption||""),p=async()=>{i(!0);try{await(o==null?void 0:o({name:l,alternativeText:d,caption:u})),t()}finally{i(!1)}},C=he("div",{className:"flex flex-col h-full",children:[he("div",{className:"flex gap-2 mb-4",children:[U(mt,{file:e}),U(ft,{file:e}),U(gt,{file:e}),U(nn,{file:e,onFullscreen:()=>window.open(e.url,"_blank")})]}),U("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 Oe(o){var r=o,{className:e,variant:t}=r,a$1=c(r,["className","variant"]);return jsx("textarea",a({"data-slot":"textarea",className:f(jn({variant:t}),e)},a$1))}var Zn=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$1=c(r,["className","variant"]);return jsx(Label.Root,a({"data-slot":"label",className:f(Zn({variant:t}),e)},a$1))}function rt(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 co(e){let t=Math.floor(e/60),a=e%60;return `${t}:${a.toString().padStart(2,"0")}`}var ei=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 nt(o){var r=o,{className:e,orientation:t="vertical"}=r,a$1=c(r,["className","orientation"]);return jsx("div",a({role:"group","data-slot":"field","data-orientation":t,className:f(ei({orientation:t}),e)},a$1))}function it(a$1){var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx(Re,a({"data-slot":"field-label",className:f("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 st(a$1){var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx("div",a({"data-slot":"input-group",role:"group",className:f("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=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 lt(o){var r=o,{className:e,align:t="inline-start"}=r,a$1=c(r,["className","align"]);return jsx("div",a({role:"group","data-slot":"input-group-addon","data-align":t,className:f(ti({align:t}),e),onClick:n=>{var s,m;n.target.closest("button")||(m=(s=n.currentTarget.parentElement)==null?void 0:s.querySelector("input"))==null||m.focus();}},a$1))}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 dt(a$1){var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx("span",a({className:f("text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",e)},t))}function ct(a$1){var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx(Dt,a({"data-slot":"input-group-control",className:f("flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent",e)},t))}function qa({file:e,onClose:t,onSave:a,onDelete:o}){var C$1;let[r,n]=useState(false),[s,m]=useState(e.name),[l,v]=useState(e.alternativeText||""),[u,x]=useState(e.caption||""),c=async()=>{n(true);try{await(a==null?void 0:a({name:s,alternativeText:l,caption:u})),t();}finally{n(false);}},w=jsxs("div",{className:"flex flex-col h-full",children:[jsxs("div",{className:"flex gap-2 mb-4",children:[jsx(tt,{file:e}),jsx(ot,{file:e}),jsx(at,{file:e}),jsx(ja,{file:e,onFullscreen:()=>window.open(e.url,"_blank")})]}),jsx("div",{className:"flex-1 flex items-center justify-center bg-gray-50 rounded-lg overflow-hidden",style:{backgroundImage:`
91
75
  linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
92
76
  linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
93
77
  linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
94
78
  linear-gradient(-45deg, transparent 75%, #e5e7eb 75%)
95
- `,backgroundSize:"20px 20px",backgroundPosition:"0 0, 0 10px, 10px -10px, -10px 0px"},children:U("img",{src:e.previewUrl||e.url,alt:e.alternativeText||e.name,className:"max-w-full max-h-full object-contain"})})]}),w=he("div",{className:"space-y-6",children:[he("div",{className:"grid grid-cols-2 gap-4",children:[he("div",{children:[U("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Size"}),U("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:oe(e.size)})]}),he("div",{children:[U("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Dimensions"}),U("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:e.width&&e.height?`${e.width}\xD7${e.height}`:"N/A"})]}),he("div",{children:[U("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Date"}),U("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:ht(e.createdAt)})]}),he("div",{children:[U("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Extension"}),U("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:((y=e.ext)==null?void 0:y.replace(".",""))||"N/A"})]})]}),he("div",{className:"space-y-4 pt-4 border-t border-slate-200 dark:border-zinc-700",children:[U("div",{className:"space-y-2",children:he(vt,{className:"gap-0",children:[U(xt,{htmlFor:"fileName",children:"File name"}),he(bt,{children:[U(yt,{id:"fileName",placeholder:"Enter file name",value:l.replace(e.ext||"",""),onChange:M=>c(M.target.value)}),U(wt,{align:"inline-end",className:"pr-1",children:U(Ct,{className:"font-bold bg-gray-200 dark:bg-zinc-700 rounded-lg py-1 px-3",children:e.ext})})]})]})}),he("div",{className:"space-y-2",children:[U(Ge,{htmlFor:"altText",children:"Alternative text"}),U($e,{id:"altText",value:d,onChange:M=>g(M.target.value),placeholder:"Describe the image for accessibility",rows:3}),U("p",{className:"text-xs text-muted-foreground",children:"This text will be displayed if the asset can't be shown."})]}),he("div",{className:"space-y-2",children:[U(Ge,{htmlFor:"caption",children:"Caption"}),U($e,{id:"caption",value:u,onChange:M=>b(M.target.value),placeholder:"Add a caption",rows:3})]})]})]});return U(ut,{title:"Details",open:!0,onClose:t,previewSection:C,metadataSection:w,footer:he("div",{className:"flex w-full justify-between items-center flex-col sm:flex-row gap-2 ",children:[U(F,{className:"w-full md:w-auto",variant:"outline",onClick:t,radius:"full",disabled:n,children:"Cancel"}),he(F,{className:"w-full md:w-auto",onClick:p,radius:"full",disabled:n,children:[n&&U(ce,{className:"mr-2 h-4 w-4 animate-spin"}),"Finish"]})]})})}import{useState as Ta}from"react";import{jsx as j,jsxs as pe}from"react/jsx-runtime";function cn({file:e,onClose:t,onSave:o,onDelete:a}){var w,k,y;let[n,i]=Ta(!1),[l,c]=Ta(e.name),[d,g]=Ta(e.caption||""),u=async()=>{i(!0);try{await(o==null?void 0:o({name:l,caption:d})),t()}finally{i(!1)}},b=pe("div",{className:"flex flex-col h-full",children:[pe("div",{className:"flex gap-2 mb-4",children:[j(mt,{file:e}),j(ft,{file:e}),j(gt,{file:e})]}),j("div",{className:"flex-1 flex items-center justify-center bg-black rounded-lg overflow-hidden",children:j("video",{src:e.url,controls:!0,className:"max-w-full max-h-full",style:{maxHeight:"500px"},children:"Your browser does not support the video tag."})})]}),p=pe("div",{className:"space-y-6",children:[pe("div",{className:"grid grid-cols-2 gap-4",children:[pe("div",{children:[j("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Size"}),j("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:oe(e.size)})]}),pe("div",{children:[j("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Dimensions"}),j("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:e.width&&e.height?`${e.width}\xD7${e.height}`:"N/A"})]}),pe("div",{children:[j("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Duration"}),j("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:(w=e.metaData)!=null&&w.duration?Yo(e.metaData.duration):"N/A"})]}),pe("div",{children:[j("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Date"}),j("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:ht(e.createdAt)})]}),pe("div",{children:[j("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Extension"}),j("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:((k=e.ext)==null?void 0:k.replace(".",""))||"N/A"})]}),pe("div",{children:[j("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Video Source"}),j("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400 capitalize",children:((y=e.metaData)==null?void 0:y.videoSource)||"local"})]})]}),pe("div",{className:"space-y-4 pt-4 border-t border-slate-200",children:[j("div",{className:"space-y-2",children:pe(vt,{className:"gap-0",children:[j(xt,{htmlFor:"fileName",children:"File name"}),pe(bt,{children:[j(yt,{id:"fileName",placeholder:"Enter file name",value:l.replace(e.ext||"",""),onChange:M=>c(M.target.value)}),j(wt,{align:"inline-end",className:"pr-1",children:j(Ct,{className:"font-bold bg-gray-200 dark:bg-zinc-700 rounded-lg py-1 px-3",children:e.ext})})]})]})}),pe("div",{className:"space-y-2",children:[j(Ge,{htmlFor:"caption",children:"Caption"}),j($e,{id:"caption",value:d,onChange:M=>g(M.target.value),placeholder:"Add a caption",rows:3})]})]})]});return j(ut,{title:"Details",open:!0,onClose:t,previewSection:b,metadataSection:p,footer:pe("div",{className:"flex w-full sm:justify-between justify-center items-center flex-col sm:flex-row gap-2 ",children:[j(F,{variant:"outline",onClick:t,radius:"full",className:"w-full md:w-auto",disabled:n,children:"Cancel"}),pe(F,{onClick:u,radius:"full",className:"w-full md:w-auto",disabled:n,children:[n&&j(ce,{className:"mr-2 h-4 w-4 animate-spin"}),"Finish"]})]})})}import{useState as Ea}from"react";import{jsx as B,jsxs as ue}from"react/jsx-runtime";function pn({file:e,onClose:t,onSave:o,onDelete:a}){var w,k,y;let[n,i]=Ea(!1),[l,c]=Ea(e.name),[d,g]=Ea(e.caption||""),u=async()=>{i(!0);try{await(o==null?void 0:o({name:l,caption:d})),t()}finally{i(!1)}},b=ue("div",{className:"flex flex-col h-full",children:[ue("div",{className:"flex gap-2 mb-4",children:[B(mt,{file:e}),B(ft,{file:e}),B(gt,{file:e})]}),ue("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:[B("div",{className:"mb-8",children:B("div",{className:"w-32 h-32 rounded-full bg-white dark:bg-gray-800 shadow-lg flex items-center justify-center",children:B(Lt,{className:"w-16 h-16 text-purple-600 dark:text-purple-400"})})}),B("div",{className:"w-full max-w-md",children:B("audio",{src:e.url,controls:!0,className:"w-full",children:"Your browser does not support the audio tag."})})]})]}),p=ue("div",{className:"space-y-6",children:[ue("div",{className:"grid grid-cols-2 gap-4",children:[ue("div",{children:[B("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Size"}),B("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:oe(e.size)})]}),ue("div",{children:[B("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Duration"}),B("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:(w=e.metaData)!=null&&w.duration?Yo(e.metaData.duration):"N/A"})]}),ue("div",{children:[B("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Bitrate"}),B("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:(k=e.metaData)!=null&&k.bitrate?`${e.metaData.bitrate} kbps`:"N/A"})]}),ue("div",{children:[B("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Date"}),B("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:ht(e.createdAt)})]}),ue("div",{children:[B("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Extension"}),B("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:((y=e.ext)==null?void 0:y.replace(".",""))||"N/A"})]})]}),ue("div",{className:"space-y-4 pt-4 border-t border-slate-200 dark:border-zinc-700",children:[B("div",{className:"space-y-2",children:ue(vt,{className:"gap-0",children:[B(xt,{htmlFor:"fileName",children:"File name"}),ue(bt,{children:[B(yt,{id:"fileName",placeholder:"Enter file name",value:l.replace(e.ext||"",""),onChange:M=>c(M.target.value)}),B(wt,{align:"inline-end",className:"pr-1",children:B(Ct,{className:"font-bold bg-gray-200 dark:bg-zinc-700 rounded-lg py-1 px-3",children:e.ext})})]})]})}),ue("div",{className:"space-y-2",children:[B(Ge,{htmlFor:"caption",children:"Caption"}),B($e,{id:"caption",value:d,onChange:M=>g(M.target.value),placeholder:"Add a caption",rows:3})]})]})]});return B(ut,{title:"Details",open:!0,onClose:t,previewSection:b,metadataSection:p,footer:ue("div",{className:"flex gap-2 w-full sm:justify-between justify-center items-center flex-col sm:flex-row ",children:[B(F,{variant:"outline",onClick:t,radius:"full",className:"w-full md:w-auto",disabled:n,children:"Cancel"}),ue(F,{onClick:u,radius:"full",className:"w-full md:w-auto",disabled:n,children:[n&&B(ce,{className:"mr-2 h-4 w-4 animate-spin"}),"Finish"]})]})})}import{useState as La}from"react";import{jsx as $,jsxs as ne}from"react/jsx-runtime";function un({file:e,onClose:t,onSave:o}){var k,y,M,I;let[a,n]=La(!1),[i,l]=La(e.name),[c,d]=La(((k=e.metaData)==null?void 0:k.description)||""),g=async()=>{n(!0);try{await(o==null?void 0:o({name:i,metaData:s(r({},e.metaData),{description:c})})),t()}finally{n(!1)}},u=((y=e.ext)==null?void 0:y.replace(".",""))||"file",{component:b}=pt(e),p=ne("div",{className:"flex flex-col h-full",children:[ne("div",{className:"flex gap-2 mb-4",children:[$(mt,{file:e}),$(ft,{file:e}),$(gt,{file:e})]}),ne("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:[$("div",{className:"mb-4 w-32 h-32 flex items-center justify-center",children:$(b,{file:e,metaData:e.metaData})}),ne("p",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:[u," File"]})]})]}),C=ne("div",{className:"space-y-6",children:[ne("div",{className:"grid grid-cols-2 gap-4",children:[ne("div",{children:[$("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Size"}),$("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:oe(e.size)})]}),ne("div",{children:[$("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Date"}),$("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:ht(e.createdAt)})]}),ne("div",{children:[$("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Extension"}),$("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:u})]}),((M=e.metaData)==null?void 0:M.pageCount)&&ne("div",{children:[$("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Page Count"}),$("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:e.metaData.pageCount})]}),((I=e.metaData)==null?void 0:I.author)&&ne("div",{children:[$("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Author"}),$("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:e.metaData.author})]})]}),ne("div",{className:"space-y-4 pt-4 border-t border-slate-200",children:[$("div",{className:"space-y-2",children:ne(vt,{className:"gap-0",children:[$(xt,{htmlFor:"fileName",children:"File name"}),ne(bt,{children:[$(yt,{id:"fileName",placeholder:"Enter file name",value:i.replace(e.ext||"",""),onChange:N=>l(N.target.value)}),$(wt,{align:"inline-end",className:"pr-1",children:$(Ct,{className:"font-bold bg-gray-200 dark:bg-zinc-700 rounded-lg py-1 px-3",children:e.ext})})]})]})}),ne("div",{className:"space-y-2",children:[$(Ge,{htmlFor:"description",children:"Description"}),$($e,{id:"description",value:c,onChange:N=>d(N.target.value),placeholder:"Add a description",rows:3})]})]})]});return $(ut,{title:"Details",open:!0,onClose:t,previewSection:p,metadataSection:C,footer:ne("div",{className:"flex w-full justify-between items-center flex-col sm:flex-row gap-2 ",children:[$(F,{className:"w-full md:w-auto",variant:"outline",onClick:t,radius:"full",disabled:a,children:"Cancel"}),ne(F,{className:"w-full md:w-auto",onClick:g,radius:"full",disabled:a,children:[a&&$(ce,{className:"mr-2 h-4 w-4 animate-spin"}),"Save"]})]})})}import{jsx as St,jsxs as Ul}from"react/jsx-runtime";function mn({className:e}){let{fileDetailsModalFile:t,setFileDetailsModalFile:o,updateFileMetadata:a}=E(),n=()=>{o(null)},i=async c=>{t&&await a(t.id,c)},l=()=>{if(!t)return null;switch(je(t.mime,t.ext)){case K.IMAGE:return St(dn,{file:t,onClose:n,onSave:i});case K.VIDEO:return St(cn,{file:t,onClose:n,onSave:i});case K.AUDIO:return St(pn,{file:t,onClose:n,onSave:i});case K.FILE:default:return St(un,{file:t,onClose:n,onSave:i})}};return Ul("div",{className:v("",e),children:[St(Xr,{}),St(en,{}),St(an,{}),l()]})}import{jsx as fn}from"react/jsx-runtime";function jl(o){var a=o,{children:e}=a,t=f(a,["children"]);return fn(bo,s(r({mode:J.PAGE,selectionMode:Ee.MULTIPLE},t),{children:e}))}function Wl(c){var d=c,{children:e,fileSelectionMode:t=Ee.SINGLE,acceptedFileTypes:o,viewMode:a="grid",onFilesSelected:n,onClose:i}=d,l=f(d,["children","fileSelectionMode","acceptedFileTypes","viewMode","onFilesSelected","onClose"]);return fn(bo,s(r({mode:J.MODAL,selectionMode:t,acceptedFileTypesForModal:o||l.allowedFileTypes,viewMode:a,onFilesSelected:n,onClose:i},l),{children:e}))}var tt={Page:jl,Modal:Wl,Header:Dr,Footer:kr,Overlays:mn};import{jsx as we,jsxs as zt}from"react/jsx-runtime";function gn(){let{setIsMoveFileModalOpen:e}=E();return zt(F,{variant:"outline",size:"lg",radius:"full",onClick:()=>e(!0),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:[we(Qe,{className:"size-5"}),we("span",{className:"hidden sm:inline",children:"Move"})]})}function hn(){let{bulkDelete:e}=E();return zt(F,{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:[we(Be,{className:"size-5"}),we("span",{className:"hidden",children:"Delete"})]})}function vn(){let{handleClearSelection:e}=E();return zt(F,{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:[we(He,{className:"size-5 transition-colors"}),"Clear"]})}function xn(){let{selectedFiles:e,selectedFolders:t}=E();return e.length+t.length===0?null:we("div",{className:"w-full",children:zt("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[zt("div",{className:"flex items-center gap-2 flex-1 sm:flex-initial",children:[we(gn,{}),we(hn,{})]}),we(vn,{})]})})}function bn({className:e}){let{selectedFiles:t,selectedFolders:o}=E();return t.length+o.length===0?null:we("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:we("div",{className:"px-4 sm:px-6 py-3 mx-auto",children:zt("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[zt("div",{className:"flex items-center gap-2 flex-1 sm:flex-initial",children:[we(gn,{}),we(hn,{})]}),we(vn,{})]})})})}import{jsx as $l}from"react/jsx-runtime";function Aa(o){var a=o,{className:e}=a,t=f(a,["className"]);return $l("div",r({"data-slot":"skeleton",className:v("animate-pulse rounded-md bg-accent",e)},t))}import{useRouter as Kl}from"next/navigation";import{Fragment as Yl,jsx as ot,jsxs as _a}from"react/jsx-runtime";function Jo(){let{currentFolder:e,handleFolderClick:t,isLoading:o}=E(),a=Kl(),n=()=>{a.back()};return o?_a("div",{className:"flex item-center w-full",children:[ot(Aa,{className:"rounded-full size-10 mr-2 shrink-0"}),ot(Aa,{className:"min-w-32 rounded-md h-full"})]}):ot(Yl,{children:e?_a("div",{className:"flex items-center flex-1 min-w-0 max-w-[calc(100%-40px)]",children:[ot(F,{variant:"outline",size:"icon",radius:"full",disabled:o,className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 mr-2",onClick:n,children:ot(Vt,{className:"size-5 text-gray-900 dark:text-zinc-100",strokeWidth:"1.5"})}),ot("h1",{className:"text-lg flex-1 min-w-0 align-middle font-semibold",children:We(e.name,20)})]}):_a("div",{className:"flex items-center flex-1 min-w-0 max-w-[calc(100%-40px)]",children:[ot(F,{className:"mr-2 shrink-0",radius:"full",variant:"ghost",mode:"icon",size:"icon",onClick:()=>t(null),children:ot(Eo,{className:"size-6 text-gray-900 dark:text-zinc-100"})}),ot("h1",{className:"text-lg flex-1 min-w-0 align-middle font-semibold",children:"Home"})]})})}import{Circle as Qf}from"lucide-react";import{DropdownMenu as Yt}from"radix-ui";import{jsx as qt,jsxs as tg}from"react/jsx-runtime";function so(t){var e=f(t,[]);return qt(Yt.Root,r({"data-slot":"dropdown-menu"},e))}function co(t){var e=f(t,[]);return qt(Yt.Trigger,r({className:"select-none","data-slot":"dropdown-menu-trigger"},e))}function po(a){var n=a,{className:e,sideOffset:t=4}=n,o=f(n,["className","sideOffset"]);return qt(Yt.Portal,{children:qt(Yt.Content,r({"data-slot":"dropdown-menu-content",sideOffset:t,className:v("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)},o))})}function at(n){var i=n,{className:e,inset:t,variant:o}=i,a=f(i,["className","inset","variant"]);return qt(Yt.Item,r({"data-slot":"dropdown-menu-item",className:v("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",o==="destructive"&&"text-destructive hover:text-destructive focus:text-destructive hover:bg-destructive/5 focus:bg-destructive/5 data-[active=true]:bg-destructive/5",e)},a))}function wn(o){var a=o,{className:e}=a,t=f(a,["className"]);return qt(Yt.Separator,r({"data-slot":"dropdown-menu-separator",className:v("-mx-2 my-1.5 h-px bg-muted",e)},t))}import{useCallback as Xl,useEffect as es,useState as ta}from"react";import{Command as Qt}from"cmdk";import{jsx as Ke,jsxs as Mn}from"react/jsx-runtime";function ql(o){var a=o,{className:e}=a,t=f(a,["className"]);return Ke(Qt,r({className:v("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e)},t))}var Cn=n=>{var i=n,{children:e,className:t,shouldFilter:o}=i,a=f(i,["children","className","shouldFilter"]);return Ke(Ne,s(r({},a),{children:Mn(Pe,{className:v("overflow-hidden p-0 shadow-lg",t),children:[Ke(Se,{className:"hidden"}),Ke(ql,{shouldFilter:o,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 yn(o){var a=o,{className:e}=a,t=f(a,["className"]);return Mn("div",{className:"flex items-center border-border border-b px-3","cmdk-input-wrapper":"","data-slot":"command-input",children:[Ke(xe,{className:"me-2 h-4 w-4 shrink-0 opacity-50"}),Ke(Qt.Input,r({className:v("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-hidden text-foreground placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e)},t))]})}function Fn(o){var a=o,{className:e}=a,t=f(a,["className"]);return Ke(Qt.List,r({"data-slot":"command-list",className:v("max-h-[300px] overflow-y-auto overflow-x-hidden",e)},t))}function Xo(t){var e=f(t,[]);return Ke(Qt.Empty,r({"data-slot":"command-empty",className:"py-6 text-center text-sm"},e))}function Va(o){var a=o,{className:e}=a,t=f(a,["className"]);return Ke(Qt.Group,r({"data-slot":"command-group",className:v("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 Ga(o){var a=o,{className:e}=a,t=f(a,["className"]);return Ke(Qt.Item,r({"data-slot":"command-item",className:v("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))}import{useEffect as Ql,useState as Jl}from"react";function ea(e,t=500){let[o,a]=Jl(e);return Ql(()=>{let n=setTimeout(()=>{a(e)},t);return()=>{clearTimeout(n)}},[e,t]),o}import{toast as ts}from"sonner";import{Fragment as os,jsx as Q,jsxs as rt}from"react/jsx-runtime";function Oa(){let[e,t]=ta(""),[o,a]=ta([]),[n,i]=ta([]),[l,c]=ta(!1),{provider:d,handleFolderClick:g,handleClearSelection:u,isSearchModalOpen:b,setIsSearchModalOpen:p,setFileDetailsModalFile:C}=E(),w=ea(e,300),k=Xl(async I=>{c(!0);try{let[N,h]=await Promise.all([d.findFiles(I),d.findFolders(I)]);a(N),i(h)}catch(N){let h=N instanceof Error?N.message:"Search failed";ts.error("Search Failed",{description:h}),a([]),i([])}finally{c(!1)}},[d]);return es(()=>{b&&w.length>0?k(w):(a([]),i([]))},[w,b,k]),rt(os,{children:[rt(F,{variant:"outline",size:"icon",radius:"full",className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",onClick:()=>p(!0),children:[Q(xe,{className:"size-4 text-gray-700 dark:text-zinc-300"}),Q("span",{className:"hidden",children:"Search"})]}),rt(Cn,{className:"max-w-4xl w-full",open:b,onOpenChange:I=>{p(I),I||(t(""),a([]),i([]))},shouldFilter:!1,children:[Q(yn,{placeholder:"Type to search files or folders...",value:e,onValueChange:I=>{t(I)}}),rt(Fn,{children:[l&&Q(Xo,{children:"Searching..."}),!l&&o.length===0&&n.length===0&&!e&&Q(Xo,{children:rt("div",{className:"flex flex-col items-center justify-center py-8 px-4 text-center",children:[Q(xe,{className:"size-12 text-gray-300 dark:text-zinc-600 mb-3"}),Q("p",{className:"text-sm font-medium text-gray-900 dark:text-zinc-100 mb-1",children:"Search your files and folders"}),Q("p",{className:"text-xs text-gray-500 dark:text-zinc-400",children:"Start typing to find what you're looking for"}),Q("p",{className:"text-xs text-gray-500 dark:text-zinc-400 mt-2",children:Q(jt,{children:rt(Ut,{children:[Q("span",{className:"text-lg",children:"\u2318"})," + K"]})})})]})}),!l&&o.length===0&&n.length===0&&e&&Q(Xo,{children:rt("div",{className:"flex flex-col items-center justify-center py-8 px-4 text-center",children:[Q(xe,{className:"size-12 text-gray-300 dark:text-zinc-600 mb-3"}),Q("p",{className:"text-sm font-medium text-gray-900 dark:text-zinc-100 mb-1",children:"No results found"}),Q("p",{className:"text-xs text-gray-500 dark:text-zinc-400",children:"Try searching with different keywords"})]})}),n.length>0&&Q(Va,{heading:"Folders",children:n.map(I=>rt(Ga,{onSelect:()=>{u(),p(!1),g(I)},children:[Q(qe,{className:"size-4 mr-2 shrink-0",strokeWidth:1.5}),Q("span",{children:We(I.name,60)})]},I.id))}),o.length>0&&Q(Va,{heading:"Files",children:o.map(I=>{let{component:N}=pt(I);return rt(Ga,{onSelect:()=>{u(),C(I)},children:[Q("div",{className:"size-6 mr-2 shrink-0 flex items-center justify-center",children:Q(N,{file:I,metaData:I.metaData})}),Q("span",{children:We(I.name,60)})]},I.id)})})]})]})]})}import{cva as as}from"class-variance-authority";import{Checkbox as kn}from"radix-ui";import{jsx as Ba,jsxs as ns}from"react/jsx-runtime";var rs=as(`
79
+ `,backgroundSize:"20px 20px",backgroundPosition:"0 0, 0 10px, 10px -10px, -10px 0px"},children:jsx("img",{src:e.previewUrl||e.url,alt:e.alternativeText||e.name,className:"max-w-full max-h-full object-contain"})})]}),F=jsxs("div",{className:"space-y-6",children:[jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Size"}),jsx("p",{className:"text-xs font-bold text-primary",children:ee(e.size)})]}),jsxs("div",{children:[jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Dimensions"}),jsx("p",{className:"text-xs font-bold text-primary",children:e.width&&e.height?`${e.width}\xD7${e.height}`:"N/A"})]}),jsxs("div",{children:[jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Date"}),jsx("p",{className:"text-xs font-bold text-primary",children:rt(e.createdAt)})]}),jsxs("div",{children:[jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Extension"}),jsx("p",{className:"text-xs font-bold text-primary",children:((C$1=e.ext)==null?void 0:C$1.replace(".",""))||"N/A"})]})]}),jsxs("div",{className:"space-y-4 pt-4 border-t border-border",children:[jsx("div",{className:"space-y-2",children:jsxs(nt,{className:"gap-0",children:[jsx(it,{htmlFor:"fileName",children:"File name"}),jsxs(st,{children:[jsx(ct,{id:"fileName",placeholder:"Enter file name",value:s.replace(e.ext||"",""),onChange:N=>m(N.target.value)}),jsx(lt,{align:"inline-end",className:"pr-1",children:jsx(dt,{className:"font-bold bg-accent rounded-lg py-1 px-3",children:e.ext})})]})]})}),jsxs("div",{className:"space-y-2",children:[jsx(Re,{htmlFor:"altText",children:"Alternative text"}),jsx(Oe,{id:"altText",value:l,onChange:N=>v(N.target.value),placeholder:"Describe the image for accessibility",rows:3}),jsx("p",{className:"text-xs text-muted-foreground",children:"This text will be displayed if the asset can't be shown."})]}),jsxs("div",{className:"space-y-2",children:[jsx(Re,{htmlFor:"caption",children:"Caption"}),jsx(Oe,{id:"caption",value:u,onChange:N=>x(N.target.value),placeholder:"Add a caption",rows:3})]})]})]});return jsx(et,{title:"Details",open:true,onClose:t,previewSection:w,metadataSection:F,footer:jsxs("div",{className:"flex w-full justify-between items-center flex-col sm:flex-row gap-2 ",children:[jsx(y,{className:"w-full md:w-auto",variant:"outline",onClick:t,radius:"full",disabled:r,children:"Cancel"}),jsxs(y,{className:"w-full md:w-auto",onClick:c,radius:"full",disabled:r,children:[r&&jsx(C,{className:"mr-2 h-4 w-4 animate-spin"}),"Finish"]})]})})}function Za({file:e,onClose:t,onSave:a,onDelete:o}){var F,M,C$1;let[r,n]=useState(false),[s,m]=useState(e.name),[l,v]=useState(e.caption||""),u=async()=>{n(true);try{await(a==null?void 0:a({name:s,caption:l})),t();}finally{n(false);}},x=jsxs("div",{className:"flex flex-col h-full",children:[jsxs("div",{className:"flex gap-2 mb-4",children:[jsx(tt,{file:e}),jsx(ot,{file:e}),jsx(at,{file:e})]}),jsx("div",{className:"flex-1 flex items-center justify-center bg-black rounded-lg overflow-hidden",children: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."})})]}),c=jsxs("div",{className:"space-y-6",children:[jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Size"}),jsx("p",{className:"text-xs font-bold text-primary",children:ee(e.size)})]}),jsxs("div",{children:[jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Dimensions"}),jsx("p",{className:"text-xs font-bold text-primary",children:e.width&&e.height?`${e.width}\xD7${e.height}`:"N/A"})]}),jsxs("div",{children:[jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Duration"}),jsx("p",{className:"text-xs font-bold text-primary",children:(F=e.metaData)!=null&&F.duration?co(e.metaData.duration):"N/A"})]}),jsxs("div",{children:[jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Date"}),jsx("p",{className:"text-xs font-bold text-primary",children:rt(e.createdAt)})]}),jsxs("div",{children:[jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Extension"}),jsx("p",{className:"text-xs font-bold text-primary",children:((M=e.ext)==null?void 0:M.replace(".",""))||"N/A"})]}),jsxs("div",{children:[jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Video Source"}),jsx("p",{className:"text-xs font-bold text-primary capitalize",children:((C$1=e.metaData)==null?void 0:C$1.videoSource)||"local"})]})]}),jsxs("div",{className:"space-y-4 pt-4 border-t border-border",children:[jsx("div",{className:"space-y-2",children:jsxs(nt,{className:"gap-0",children:[jsx(it,{htmlFor:"fileName",children:"File name"}),jsxs(st,{children:[jsx(ct,{id:"fileName",placeholder:"Enter file name",value:s.replace(e.ext||"",""),onChange:N=>m(N.target.value)}),jsx(lt,{align:"inline-end",className:"pr-1",children:jsx(dt,{className:"font-bold bg-accent rounded-lg py-1 px-3",children:e.ext})})]})]})}),jsxs("div",{className:"space-y-2",children:[jsx(Re,{htmlFor:"caption",children:"Caption"}),jsx(Oe,{id:"caption",value:l,onChange:N=>v(N.target.value),placeholder:"Add a caption",rows:3})]})]})]});return jsx(et,{title:"Details",open:true,onClose:t,previewSection:x,metadataSection:c,footer:jsxs("div",{className:"flex w-full sm:justify-between justify-center items-center flex-col sm:flex-row gap-2 ",children:[jsx(y,{variant:"outline",onClick:t,radius:"full",className:"w-full md:w-auto",disabled:r,children:"Cancel"}),jsxs(y,{onClick:u,radius:"full",className:"w-full md:w-auto",disabled:r,children:[r&&jsx(C,{className:"mr-2 h-4 w-4 animate-spin"}),"Finish"]})]})})}function Ja({file:e,onClose:t,onSave:a,onDelete:o}){var F,M,C$1;let[r,n]=useState(false),[s,m]=useState(e.name),[l,v]=useState(e.caption||""),u=async()=>{n(true);try{await(a==null?void 0:a({name:s,caption:l})),t();}finally{n(false);}},x=jsxs("div",{className:"flex flex-col h-full",children:[jsxs("div",{className:"flex gap-2 mb-4",children:[jsx(tt,{file:e}),jsx(ot,{file:e}),jsx(at,{file:e})]}),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:[jsx("div",{className:"mb-8",children:jsx("div",{className:"w-32 h-32 rounded-full bg-white dark:bg-gray-800 shadow-lg flex items-center justify-center",children:jsx(h,{className:"w-16 h-16 text-purple-600 dark:text-purple-400"})})}),jsx("div",{className:"w-full max-w-md",children:jsx("audio",{src:e.url,controls:true,className:"w-full",children:"Your browser does not support the audio tag."})})]})]}),c=jsxs("div",{className:"space-y-6",children:[jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Size"}),jsx("p",{className:"text-xs font-bold text-primary",children:ee(e.size)})]}),jsxs("div",{children:[jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Duration"}),jsx("p",{className:"text-xs font-bold text-primary",children:(F=e.metaData)!=null&&F.duration?co(e.metaData.duration):"N/A"})]}),jsxs("div",{children:[jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Bitrate"}),jsx("p",{className:"text-xs font-bold text-primary",children:(M=e.metaData)!=null&&M.bitrate?`${e.metaData.bitrate} kbps`:"N/A"})]}),jsxs("div",{children:[jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Date"}),jsx("p",{className:"text-xs font-bold text-primary",children:rt(e.createdAt)})]}),jsxs("div",{children:[jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Extension"}),jsx("p",{className:"text-xs font-bold text-primary",children:((C$1=e.ext)==null?void 0:C$1.replace(".",""))||"N/A"})]})]}),jsxs("div",{className:"space-y-4 pt-4 border-t border-border",children:[jsx("div",{className:"space-y-2",children:jsxs(nt,{className:"gap-0",children:[jsx(it,{htmlFor:"fileName",children:"File name"}),jsxs(st,{children:[jsx(ct,{id:"fileName",placeholder:"Enter file name",value:s.replace(e.ext||"",""),onChange:N=>m(N.target.value)}),jsx(lt,{align:"inline-end",className:"pr-1",children:jsx(dt,{className:"font-bold bg-accent rounded-lg py-1 px-3",children:e.ext})})]})]})}),jsxs("div",{className:"space-y-2",children:[jsx(Re,{htmlFor:"caption",children:"Caption"}),jsx(Oe,{id:"caption",value:l,onChange:N=>v(N.target.value),placeholder:"Add a caption",rows:3})]})]})]});return jsx(et,{title:"Details",open:true,onClose:t,previewSection:x,metadataSection:c,footer:jsxs("div",{className:"flex gap-2 w-full sm:justify-between justify-center items-center flex-col sm:flex-row ",children:[jsx(y,{variant:"outline",onClick:t,radius:"full",className:"w-full md:w-auto",disabled:r,children:"Cancel"}),jsxs(y,{onClick:u,radius:"full",className:"w-full md:w-auto",disabled:r,children:[r&&jsx(C,{className:"mr-2 h-4 w-4 animate-spin"}),"Finish"]})]})})}function Xa({file:e,onClose:t,onSave:a$1}){var M,C$1,N,D;let[o,r]=useState(false),[n,s]=useState(e.name),[m,l]=useState(((M=e.metaData)==null?void 0:M.description)||""),v=async()=>{r(true);try{await(a$1==null?void 0:a$1({name:n,metaData:b(a({},e.metaData),{description:m})})),t();}finally{r(false);}},u=((C$1=e.ext)==null?void 0:C$1.replace(".",""))||"file",{component:x}=Xe(e),c=jsxs("div",{className:"flex flex-col h-full",children:[jsxs("div",{className:"flex gap-2 mb-4",children:[jsx(tt,{file:e}),jsx(ot,{file:e}),jsx(at,{file:e})]}),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:[jsx("div",{className:"mb-4 w-32 h-32 flex items-center justify-center",children:jsx(x,{file:e,metaData:e.metaData})}),jsxs("p",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:[u," File"]})]})]}),w=jsxs("div",{className:"space-y-6",children:[jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Size"}),jsx("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:ee(e.size)})]}),jsxs("div",{children:[jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Date"}),jsx("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:rt(e.createdAt)})]}),jsxs("div",{children:[jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide mb-1",children:"Extension"}),jsx("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:u})]}),((N=e.metaData)==null?void 0:N.pageCount)&&jsxs("div",{children:[jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Page Count"}),jsx("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:e.metaData.pageCount})]}),((D=e.metaData)==null?void 0:D.author)&&jsxs("div",{children:[jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Author"}),jsx("p",{className:"text-xs font-bold text-blue-600 dark:text-blue-400",children:e.metaData.author})]})]}),jsxs("div",{className:"space-y-4 pt-4 border-t border-slate-200",children:[jsx("div",{className:"space-y-2",children:jsxs(nt,{className:"gap-0",children:[jsx(it,{htmlFor:"fileName",children:"File name"}),jsxs(st,{children:[jsx(ct,{id:"fileName",placeholder:"Enter file name",value:n.replace(e.ext||"",""),onChange:k=>s(k.target.value)}),jsx(lt,{align:"inline-end",className:"pr-1",children:jsx(dt,{className:"font-bold bg-gray-200 dark:bg-zinc-700 rounded-lg py-1 px-3",children:e.ext})})]})]})}),jsxs("div",{className:"space-y-2",children:[jsx(Re,{htmlFor:"description",children:"Description"}),jsx(Oe,{id:"description",value:m,onChange:k=>l(k.target.value),placeholder:"Add a description",rows:3})]})]})]});return jsx(et,{title:"Details",open:true,onClose:t,previewSection:c,metadataSection:w,footer:jsxs("div",{className:"flex w-full justify-between items-center flex-col sm:flex-row gap-2 ",children:[jsx(y,{className:"w-full md:w-auto",variant:"outline",onClick:t,radius:"full",disabled:o,children:"Cancel"}),jsxs(y,{className:"w-full md:w-auto",onClick:v,radius:"full",disabled:o,children:[o&&jsx(C,{className:"mr-2 h-4 w-4 animate-spin"}),"Save"]})]})})}function er({className:e$1}){let{fileDetailsModalFile:t,setFileDetailsModalFile:a,updateFileMetadata:o}=E(),r=()=>{a(null);},n=async m=>{t&&await o(t.id,m);},s=()=>{if(!t)return null;switch(H(t.mime,t.ext)){case e.IMAGE:return jsx(qa,{file:t,onClose:r,onSave:n});case e.VIDEO:return jsx(Za,{file:t,onClose:r,onSave:n});case e.AUDIO:return jsx(Ja,{file:t,onClose:r,onSave:n});case e.FILE:default:return jsx(Xa,{file:t,onClose:r,onSave:n})}};return jsxs("div",{className:f("",e$1),children:[jsx(Ga,{}),jsx(Ua,{}),jsx(Ka,{}),s()]})}function ai(a$1){var o=a$1,{children:e}=o,t=c(o,["children"]);return jsx(no,b(a({mode:d.PAGE,selectionMode:f$1.MULTIPLE},t),{children:e}))}function ri(m){var l=m,{children:e,fileSelectionMode:t=f$1.SINGLE,acceptedFileTypes:a$1,viewMode:o="grid",onFilesSelected:r,onClose:n}=l,s=c(l,["children","fileSelectionMode","acceptedFileTypes","viewMode","onFilesSelected","onClose"]);return jsx(no,b(a({mode:d.MODAL,selectionMode:t,acceptedFileTypesForModal:a$1||s.allowedFileTypes,viewMode:o,onFilesSelected:r,onClose:n},s),{children:e}))}var He={Page:ai,Modal:ri,Header:xa,Footer:va,Overlays:er};function or(){let{setIsMoveFileModalOpen:e}=E();return jsxs(y,{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:[jsx(m,{className:"size-5"}),jsx("span",{className:"hidden sm:inline",children:"Move"})]})}function ar(){let{bulkDelete:e}=E();return jsxs(y,{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:[jsx(r,{className:"size-5"}),jsx("span",{className:"hidden",children:"Delete"})]})}function rr(){let{handleClearSelection:e}=E();return jsxs(y,{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:[jsx(s,{className:"size-5 transition-colors"}),"Clear"]})}function nr(){let{selectedFiles:e,selectedFolders:t}=E();return e.length+t.length===0?null:jsx("div",{className:"w-full",children:jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[jsxs("div",{className:"flex items-center gap-2 flex-1 sm:flex-initial",children:[jsx(or,{}),jsx(ar,{})]}),jsx(rr,{})]})})}function ir({className:e}){let{selectedFiles:t,selectedFolders:a}=E();return t.length+a.length===0?null: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:jsx("div",{className:"px-4 sm:px-6 py-3 mx-auto",children:jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[jsxs("div",{className:"flex items-center gap-2 flex-1 sm:flex-initial",children:[jsx(or,{}),jsx(ar,{})]}),jsx(rr,{})]})})})}function Oo(a$1){var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx("div",a({"data-slot":"skeleton",className:f("animate-pulse rounded-md bg-accent",e)},t))}function po(){let{currentFolder:e,handleFolderClick:t,isLoading:a}=E(),o=useRouter(),r=()=>{o.back();};return a?jsxs("div",{className:"flex item-center w-full",children:[jsx(Oo,{className:"rounded-full size-10 mr-2 shrink-0"}),jsx(Oo,{className:"min-w-32 rounded-md h-full"})]}):jsx(Fragment,{children:e?jsxs("div",{className:"flex items-center flex-1 min-w-0 max-w-[calc(100%-40px)]",children:[jsx(y,{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:r,children:jsx(p,{className:"size-5 text-gray-900 dark:text-zinc-100",strokeWidth:"1.5"})}),jsx("h1",{className:"text-lg flex-1 min-w-0 align-middle font-semibold",children:Ae(e.name,20)})]}):jsxs("div",{className:"flex items-center flex-1 min-w-0 max-w-[calc(100%-40px)]",children:[jsx(y,{className:"mr-2 shrink-0",radius:"full",variant:"ghost",mode:"icon",size:"icon",onClick:()=>t(null),children:jsx(k,{className:"size-6 text-gray-900 dark:text-zinc-100"})}),jsx("h1",{className:"text-lg flex-1 min-w-0 align-middle font-semibold",children:"Home"})]})})}function Wt(t){var e=c(t,[]);return jsx(DropdownMenu.Root,a({"data-slot":"dropdown-menu"},e))}function jt(t){var e=c(t,[]);return jsx(DropdownMenu.Trigger,a({className:"select-none","data-slot":"dropdown-menu-trigger"},e))}function Qt(o){var r=o,{className:e,sideOffset:t=4}=r,a$1=c(r,["className","sideOffset"]);return jsx(DropdownMenu.Portal,{children:jsx(DropdownMenu.Content,a({"data-slot":"dropdown-menu-content",sideOffset:t,className:f("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$1))})}function Ke(r){var n=r,{className:e,inset:t,variant:a$1}=n,o=c(n,["className","inset","variant"]);return jsx(DropdownMenu.Item,a({"data-slot":"dropdown-menu-item",className:f("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$1==="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 sr(a$1){var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx(DropdownMenu.Separator,a({"data-slot":"dropdown-menu-separator",className:f("-mx-2 my-1.5 h-px bg-muted",e)},t))}function di(a$1){var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx(Command,a({className:f("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e)},t))}var lr=r=>{var n=r,{children:e,className:t,shouldFilter:a$1}=n,o=c(n,["children","className","shouldFilter"]);return jsx(Fe,b(a({},o),{children:jsxs(we,{className:f("overflow-hidden p-0 shadow-lg",t),children:[jsx(Ne,{className:"hidden"}),jsx(di,{shouldFilter:a$1,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 dr(a$1){var o=a$1,{className:e}=o,t=c(o,["className"]);return jsxs("div",{className:"flex items-center border-border border-b px-3","cmdk-input-wrapper":"","data-slot":"command-input",children:[jsx(l,{className:"me-2 h-4 w-4 shrink-0 opacity-50"}),jsx(Command.Input,a({className:f("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-hidden text-foreground placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e)},t))]})}function cr(a$1){var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx(Command.List,a({"data-slot":"command-list",className:f("max-h-[300px] overflow-y-auto overflow-x-hidden",e)},t))}function fo(t){var e=c(t,[]);return jsx(Command.Empty,a({"data-slot":"command-empty",className:"py-6 text-center text-sm"},e))}function Vo(a$1){var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx(Command.Group,a({"data-slot":"command-group",className:f("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 Go(a$1){var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx(Command.Item,a({"data-slot":"command-item",className:f("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 go(e,t=500){let[a,o]=useState(e);return useEffect(()=>{let r=setTimeout(()=>{o(e);},t);return ()=>{clearTimeout(r);}},[e,t]),a}function Uo(){let[e,t]=useState(""),[a,o]=useState([]),[r,n]=useState([]),[s,m]=useState(false),{provider:l$1,handleFolderClick:v,handleClearSelection:u,isSearchModalOpen:x,setIsSearchModalOpen:c,setFileDetailsModalFile:w}=E(),F=go(e,300),M=useCallback(async D=>{m(true);try{let[k,b]=await Promise.all([l$1.findFiles(D),l$1.findFolders(D)]);o(k),n(b);}catch(k){let b=k instanceof Error?k.message:"Search failed";toast.error("Search Failed",{description:b}),o([]),n([]);}finally{m(false);}},[l$1]);return useEffect(()=>{x&&F.length>0?M(F):(o([]),n([]));},[F,x,M]),jsxs(Fragment,{children:[jsxs(y,{variant:"outline",size:"icon",radius:"full",className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",onClick:()=>c(true),children:[jsx(l,{className:"size-4 text-gray-700 dark:text-zinc-300"}),jsx("span",{className:"hidden",children:"Search"})]}),jsxs(lr,{className:"max-w-4xl w-full",open:x,onOpenChange:D=>{c(D),D||(t(""),o([]),n([]));},shouldFilter:false,children:[jsx(dr,{placeholder:"Type to search files or folders...",value:e,onValueChange:D=>{t(D);}}),jsxs(cr,{children:[s&&jsx(fo,{children:"Searching..."}),!s&&a.length===0&&r.length===0&&!e&&jsx(fo,{children:jsxs("div",{className:"flex flex-col items-center justify-center py-8 px-4 text-center",children:[jsx(l,{className:"size-12 text-gray-300 dark:text-zinc-600 mb-3"}),jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-zinc-100 mb-1",children:"Search your files and folders"}),jsx("p",{className:"text-xs text-gray-500 dark:text-zinc-400",children:"Start typing to find what you're looking for"}),jsx("p",{className:"text-xs text-gray-500 dark:text-zinc-400 mt-2",children:jsx(kt,{children:jsxs(Mt,{children:[jsx("span",{className:"text-lg",children:"\u2318"})," + K"]})})})]})}),!s&&a.length===0&&r.length===0&&e&&jsx(fo,{children:jsxs("div",{className:"flex flex-col items-center justify-center py-8 px-4 text-center",children:[jsx(l,{className:"size-12 text-gray-300 dark:text-zinc-600 mb-3"}),jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-zinc-100 mb-1",children:"No results found"}),jsx("p",{className:"text-xs text-gray-500 dark:text-zinc-400",children:"Try searching with different keywords"})]})}),r.length>0&&jsx(Vo,{heading:"Folders",children:r.map(D=>jsxs(Go,{onSelect:()=>{u(),c(false),v(D);},children:[jsx(j,{className:"size-4 mr-2 shrink-0",strokeWidth:1.5}),jsx("span",{children:Ae(D.name,60)})]},D.id))}),a.length>0&&jsx(Vo,{heading:"Files",children:a.map(D=>{let{component:k}=Xe(D);return jsxs(Go,{onSelect:()=>{u(),w(D);},children:[jsx("div",{className:"size-6 mr-2 shrink-0 flex items-center justify-center",children:jsx(k,{file:D,metaData:D.metaData})}),jsx("span",{children:Ae(D.name,60)})]},D.id)})})]})]})]})}var xi=cva(`
96
80
  group peer bg-background shrink-0 rounded-md border border-input ring-offset-background focus-visible:outline-none
97
81
  focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50
98
82
  aria-invalid:border-destructive/60 aria-invalid:ring-destructive/10 dark:aria-invalid:border-destructive dark:aria-invalid:ring-destructive/20
99
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,
100
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
101
- `,{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 uo(a){var n=a,{className:e,size:t}=n,o=f(n,["className","size"]);return Ba(kn.Root,s(r({"data-slot":"checkbox",className:v(rs({size:t}),e)},o),{children:ns(kn.Indicator,{className:v("flex items-center justify-center text-current"),children:[Ba(Je,{className:"group-data-[state=indeterminate]:hidden"}),Ba(Bo,{className:"hidden group-data-[state=indeterminate]:block"})]})}))}import{jsx as mo,jsxs as In}from"react/jsx-runtime";function Dn(){return mo(Oa,{})}function Ha(){let{setIsUploadModalOpen:e}=E();return In(F,{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(!0),children:[mo(It,{strokeWidth:2,className:"size-5 text-gray-900 dark:text-zinc-100"}),mo("span",{className:"hidden sm:inline",children:"Upload File"})]})}function Za(){let{setIsCreateFolderModalOpen:e}=E();return In(F,{variant:"outline",size:"icon",radius:"full",className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",onClick:()=>e(!0),children:[mo(Dt,{className:"size-5 text-gray-900 dark:text-zinc-100"}),mo("span",{className:"hidden",children:"Create Folder"})]})}import{useEffect as ls,useState as ss}from"react";import{jsx as oa,jsxs as is}from"react/jsx-runtime";function Nn(e){return is("svg",s(r({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:[oa("circle",{cx:"12",cy:"12",r:"4"}),oa("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 Pn(e){return oa("svg",s(r({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:oa("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}))}import{jsx as Ua}from"react/jsx-runtime";function Sn(){let[e,t]=ss(!1);return ls(()=>{let n=localStorage.getItem("theme")==="dark";t(n),document.documentElement.classList.toggle("dark",n)},[]),Ua(F,{variant:"outline",size:"icon",radius:"full",onClick:()=>{let a=!e;t(a),document.documentElement.classList.toggle("dark",a),localStorage.setItem("theme",a?"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?Ua(Nn,{className:"size-4 text-yellow-500"}):Ua(Pn,{className:"size-4 text-gray-700 dark:text-zinc-300"})})}import{Fragment as Tn,jsx as H,jsxs as ve}from"react/jsx-runtime";function zn(){let{setIsUploadModalOpen:e,setIsCreateFolderModalOpen:t,setIsSearchModalOpen:o}=E();return ve(Tn,{children:[ve("div",{className:"hidden md:flex gap-2",children:[H(Ha,{}),H(Za,{}),H(Dn,{}),H(Sn,{})]}),H("div",{className:"flex md:hidden",children:ve(so,{children:[H(co,{asChild:!0,children:H(F,{variant:"outline",size:"icon",radius:"full",className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",children:H(Nt,{className:"size-5"})})}),ve(po,{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:[ve(at,{onClick:()=>e(!0),className:"cursor-pointer",children:[H(It,{className:"size-5 text-gray-900 dark:text-zinc-100"}),H("span",{className:"inline",children:"Upload File"})]}),ve(at,{onClick:()=>t(!0),className:"cursor-pointer",children:[H(Dt,{className:"size-5 text-gray-900 dark:text-zinc-100"}),H("span",{className:"inline",children:"Create Folder"})]}),ve(at,{onClick:()=>o(!0),className:"cursor-pointer",children:[H(xe,{className:"size-5 text-gray-700 dark:text-zinc-300"}),H("span",{className:"inline",children:"Search"})]})]})]})})]})}function Rn({onSearchClick:e}){let{setIsUploadModalOpen:t,setIsCreateFolderModalOpen:o}=E();return ve(Tn,{children:[ve("div",{className:"hidden md:flex gap-2",children:[H(Ha,{}),H(Za,{}),e?ve(F,{variant:"outline",size:"icon",radius:"full",className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",onClick:e,children:[H(xe,{className:"size-5 text-gray-900 dark:text-zinc-100"}),H("span",{className:"hidden",children:"Search"})]}):null]}),H("div",{className:"flex md:hidden",children:ve(so,{children:[H(co,{asChild:!0,children:H(F,{variant:"outline",size:"icon",radius:"full",className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",children:H(Nt,{className:"size-5"})})}),ve(po,{align:"end",className:"w-48",children:[ve(at,{onClick:()=>t(!0),className:"cursor-pointer",children:[H(It,{className:"size-5 text-gray-900 dark:text-zinc-100"}),H("span",{className:"inline",children:"Upload File"})]}),ve(at,{onClick:()=>o(!0),className:"cursor-pointer",children:[H(Dt,{className:"size-5 text-gray-900 dark:text-zinc-100"}),H("span",{className:"inline",children:"Create Folder"})]}),e?ve(at,{onClick:e,className:"cursor-pointer",children:[H(xe,{className:"size-5 text-gray-700 dark:text-zinc-300"}),H("span",{className:"inline",children:"Search"})]}):null]})]})})]})}import ds from"react";import*as X from"@radix-ui/react-context-menu";import{CircleIcon as l4}from"lucide-react";import{jsx as Jt,jsxs as p4}from"react/jsx-runtime";function En(t){var e=f(t,[]);return Jt(X.Root,r({"data-slot":"context-menu"},e))}function Ln(t){var e=f(t,[]);return Jt(X.Trigger,r({"data-slot":"context-menu-trigger"},e))}function An(o){var a=o,{className:e}=a,t=f(a,["className"]);return Jt(X.Portal,{children:Jt(X.Content,r({"data-slot":"context-menu-content",className:v("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 _n(n){var i=n,{className:e,inset:t,variant:o="default"}=i,a=f(i,["className","inset","variant"]);return Jt(X.Item,r({"data-slot":"context-menu-item","data-inset":t,"data-variant":o,className:v("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)},a))}function Vn(o){var a=o,{className:e}=a,t=f(a,["className"]);return Jt(X.Separator,r({"data-slot":"context-menu-separator",className:v("bg-border -mx-1 my-1 h-px",e)},t))}import{jsx as Ft,jsxs as fo}from"react/jsx-runtime";function aa({children:e,menuItems:t,isInSelectionMode:o=!1,mode:a}){let n=!o&&a!=="modal",i=(l=!1)=>t.map((c,d)=>{let g=d===t.length-1,u=c.variant==="destructive",b=l?at:_n,p=l?wn:Vn,C=d<t.length-1&&t[d+1].variant==="destructive";return fo(ds.Fragment,{children:[fo(b,{onClick:c.onClick,className:c.className||`text-sm font-medium ${u?"text-red-600 focus:text-red-700 focus:bg-red-50":""} ${d===0?"rounded-t-xl":""} ${g?"rounded-b-xl":""}`,children:[c.icon,c.label]}),C&&!g&&Ft(p,{className:"bg-gray-200 dark:bg-zinc-700"})]},d)});return fo(En,{children:[Ft(Ln,{children:fo("div",{className:"relative w-full h-full",children:[e,n&&Ft("div",{className:"absolute top-0 right-0 z-10 md:hidden",onClick:l=>l.stopPropagation(),children:fo(so,{children:[Ft(co,{asChild:!0,children:Ft(F,{variant:"ghost",size:"icon",radius:"full",className:"focus-visible:ring-0 focus-visible:ring-offset-0",children:Ft(Oo,{className:"size-4 text-gray-700 dark:text-zinc-300"})})}),Ft(po,{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:i(!0)})]})})]})}),n&&Ft(An,{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:i(!1)})]})}import{jsx as Fe,jsxs as ra}from"react/jsx-runtime";function Gn({file:e,isSelected:t,onSelect:o,onDelete:a,onEdit:n,onMove:i,selectionMode:l,showCheckbox:c=!1,mode:d=J.PAGE,isInSelectionMode:g=!1}){let u=h=>{h.stopPropagation(),confirm(`Are you sure you want to delete "${e.name}"?`)&&a(e.id)},b=h=>{h.stopPropagation(),n(e)},p=h=>{h.stopPropagation(),o(e,void 0,!0)},C=h=>{h.stopPropagation(),i(e)},w=h=>{o(e,h,!1)},k=h=>{o(e,void 0,!0)},y=h=>{h.stopPropagation()},{component:M,metadataComponent:I}=pt(e);return Fe(aa,{menuItems:[{label:"Edit",icon:Fe(Ot,{className:"size-6"}),onClick:b},{label:"Select File",icon:Fe(Gt,{className:"size-6"}),onClick:p},{label:"Move to...",icon:Fe(Qe,{className:"size-6"}),onClick:C},{label:"Delete",icon:Fe(Be,{className:"size-6 text-red-600"}),onClick:u,variant:"destructive"}],isInSelectionMode:g,mode:d,children:ra("div",{className:"group relative flex flex-col items-center justify-start transition-all duration-200 cursor-pointer w-full select-none",onDoubleClick:w,onClick:w,children:[ra("div",{className:`
102
- relative w-full aspect-square flex items-center justify-center mb-1 overflow-hidden rounded-2xl hover:bg-gray-200/60 dark:hover:bg-zinc-700/60
103
- ${t?"bg-gray-200/60 dark:bg-zinc-700/60":""}
104
- `,children:[Fe("div",{className:"w-[75%] h-[75%] flex items-center justify-center",children:Fe(M,{file:e,metaData:e.metaData})}),(l===Ee.MULTIPLE||c)&&Fe("div",{className:`absolute top-2 left-2 z-10 ${t?"opacity-100":"opacity-0 group-hover:opacity-100"} transition-opacity duration-200`,onClick:y,children:Fe(uo,{checked:t,onCheckedChange:k,className:"bg-white/90 dark:bg-zinc-900/90 border-gray-300 dark:border-zinc-600 shadow-sm data-[state=checked]:bg-blue-600 data-[state=checked]:border-blue-600 rounded-full h-5 w-5"})})]}),ra("div",{className:"w-full text-center px-0.5 flex flex-col items-center",children:[Fe("span",{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 Yt(o){var r=o,{className:e,size:t}=r,a$1=c(r,["className","size"]);return jsx(Checkbox.Root,b(a({"data-slot":"checkbox",className:f(xi({size:t}),e)},a$1),{children:jsxs(Checkbox.Indicator,{className:f("flex items-center justify-center text-current"),children:[jsx(w,{className:"group-data-[state=indeterminate]:hidden"}),jsx(B,{className:"hidden group-data-[state=indeterminate]:block"})]})}))}function pr(){return jsx(Uo,{})}function $o(){let{setIsUploadModalOpen:e}=E();return jsxs(y,{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:[jsx(q$1,{strokeWidth:2,className:"size-5 text-gray-900 dark:text-zinc-100"}),jsx("span",{className:"hidden sm:inline",children:"Upload File"})]})}function Ko(){let{setIsCreateFolderModalOpen:e}=E();return jsxs(y,{variant:"outline",size:"icon",radius:"full",className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",onClick:()=>e(true),children:[jsx(n,{className:"size-5 text-gray-900 dark:text-zinc-100"}),jsx("span",{className:"hidden",children:"Create Folder"})]})}function gr(e){return jsxs("svg",b(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:[jsx("circle",{cx:"12",cy:"12",r:"4"}),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 vr(e){return jsx("svg",b(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:jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}))}function xr(){let[e,t]=useState(false);return useEffect(()=>{let r=localStorage.getItem("theme")==="dark";t(r),document.documentElement.classList.toggle("dark",r);},[]),jsx(y,{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?jsx(gr,{className:"size-4 text-yellow-500"}):jsx(vr,{className:"size-4 text-gray-700 dark:text-zinc-300"})})}function br(){let{setIsUploadModalOpen:e,setIsCreateFolderModalOpen:t,setIsSearchModalOpen:a}=E();return jsxs(Fragment,{children:[jsxs("div",{className:"hidden md:flex gap-2",children:[jsx($o,{}),jsx(Ko,{}),jsx(pr,{}),jsx(xr,{})]}),jsx("div",{className:"flex md:hidden",children:jsxs(Wt,{children:[jsx(jt,{asChild:true,children:jsx(y,{variant:"outline",size:"icon",radius:"full",className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",children:jsx(z,{className:"size-5"})})}),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:[jsxs(Ke,{onClick:()=>e(true),className:"cursor-pointer",children:[jsx(q$1,{className:"size-5 text-gray-900 dark:text-zinc-100"}),jsx("span",{className:"inline",children:"Upload File"})]}),jsxs(Ke,{onClick:()=>t(true),className:"cursor-pointer",children:[jsx(n,{className:"size-5 text-gray-900 dark:text-zinc-100"}),jsx("span",{className:"inline",children:"Create Folder"})]}),jsxs(Ke,{onClick:()=>a(true),className:"cursor-pointer",children:[jsx(l,{className:"size-5 text-gray-700 dark:text-zinc-300"}),jsx("span",{className:"inline",children:"Search"})]})]})]})})]})}function hr({onSearchClick:e}){let{setIsUploadModalOpen:t,setIsCreateFolderModalOpen:a}=E();return jsxs(Fragment,{children:[jsxs("div",{className:"hidden md:flex gap-2",children:[jsx($o,{}),jsx(Ko,{}),e?jsxs(y,{variant:"outline",size:"icon",radius:"full",className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",onClick:e,children:[jsx(l,{className:"size-5 text-gray-900 dark:text-zinc-100"}),jsx("span",{className:"hidden",children:"Search"})]}):null]}),jsx("div",{className:"flex md:hidden",children:jsxs(Wt,{children:[jsx(jt,{asChild:true,children:jsx(y,{variant:"outline",size:"icon",radius:"full",className:"border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",children:jsx(z,{className:"size-5"})})}),jsxs(Qt,{align:"end",className:"w-48",children:[jsxs(Ke,{onClick:()=>t(true),className:"cursor-pointer",children:[jsx(q$1,{className:"size-5 text-gray-900 dark:text-zinc-100"}),jsx("span",{className:"inline",children:"Upload File"})]}),jsxs(Ke,{onClick:()=>a(true),className:"cursor-pointer",children:[jsx(n,{className:"size-5 text-gray-900 dark:text-zinc-100"}),jsx("span",{className:"inline",children:"Create Folder"})]}),e?jsxs(Ke,{onClick:e,className:"cursor-pointer",children:[jsx(l,{className:"size-5 text-gray-700 dark:text-zinc-300"}),jsx("span",{className:"inline",children:"Search"})]}):null]})]})})]})}function Cr(t){var e=c(t,[]);return jsx(q.Root,a({"data-slot":"context-menu"},e))}function Fr(t){var e=c(t,[]);return jsx(q.Trigger,a({"data-slot":"context-menu-trigger"},e))}function wr(a$1){var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx(q.Portal,{children:jsx(q.Content,a({"data-slot":"context-menu-content",className:f("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 Nr(r){var n=r,{className:e,inset:t,variant:a$1="default"}=n,o=c(n,["className","inset","variant"]);return jsx(q.Item,a({"data-slot":"context-menu-item","data-inset":t,"data-variant":a$1,className:f("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 Mr(a$1){var o=a$1,{className:e}=o,t=c(o,["className"]);return jsx(q.Separator,a({"data-slot":"context-menu-separator",className:f("bg-border -mx-1 my-1 h-px",e)},t))}function bo({children:e,menuItems:t,isInSelectionMode:a=false,mode:o}){let r=!a&&o!=="modal",n=(s=false)=>t.map((m,l)=>{let v=l===t.length-1,u=m.variant==="destructive",x=s?Ke:Nr,c=s?sr:Mr,w=l<t.length-1&&t[l+1].variant==="destructive";return jsxs(Fi.Fragment,{children:[jsxs(x,{onClick:m.onClick,className:m.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:[m.icon,m.label]}),w&&!v&&jsx(c,{className:"bg-gray-200 dark:bg-zinc-700"})]},l)});return jsxs(Cr,{children:[jsx(Fr,{children:jsxs("div",{className:"relative w-full h-full",children:[e,r&&jsx("div",{className:"absolute top-0 right-0 z-10 md:hidden",onClick:s=>s.stopPropagation(),children:jsxs(Wt,{children:[jsx(jt,{asChild:true,children:jsx(y,{variant:"ghost",size:"icon",radius:"full",className:"focus-visible:ring-0 focus-visible:ring-offset-0",children:jsx(A,{className:"size-4 text-gray-700 dark:text-zinc-300"})})}),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&&jsx(wr,{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 kr({file:e,isSelected:t,onSelect:a,onDelete:o,onEdit:r$1,onMove:n,selectionMode:s,showCheckbox:m$1=false,mode:l=d.PAGE,isInSelectionMode:v=false}){let u=b=>{b.stopPropagation(),confirm(`Are you sure you want to delete "${e.name}"?`)&&o(e.id);},x$1=b=>{b.stopPropagation(),r$1(e);},c=b=>{b.stopPropagation(),a(e,void 0,true);},w=b=>{b.stopPropagation(),n(e);},F=b=>{a(e,b,false);},M=b=>{a(e,void 0,true);},C=b=>{b.stopPropagation();},{component:N,metadataComponent:D}=Xe(e);return jsx(bo,{menuItems:[{label:"Edit",icon:jsx(y$1,{className:"size-6"}),onClick:x$1},{label:"Select File",icon:jsx(x,{className:"size-6"}),onClick:c},{label:"Move to...",icon:jsx(m,{className:"size-6"}),onClick:w},{label:"Delete",icon:jsx(r,{className:"size-6 text-red-600"}),onClick:u,variant:"destructive"}],isInSelectionMode:v,mode:l,children:jsxs("div",{className:"group relative flex flex-col items-center justify-start transition-all duration-200 cursor-pointer w-full select-none",onDoubleClick:F,onClick:F,children:[jsxs("div",{className:`
86
+ relative w-full aspect-square flex items-center justify-center mb-1 overflow-hidden rounded-2xl hover:bg-accent/60
87
+ ${t?"bg-accent/60":""}
88
+ `,children:[jsx("div",{className:"w-[75%] h-[75%] flex items-center justify-center",children:jsx(N,{file:e,metaData:e.metaData})}),(s===f$1.MULTIPLE||m$1)&&jsx("div",{className:`absolute top-2 left-2 z-10 ${t?"opacity-100":"opacity-0 group-hover:opacity-100"} transition-opacity duration-200`,onClick:C,children:jsx(Yt,{checked:t,onCheckedChange:M,className:"bg-background/90 border-border shadow-sm data-[state=checked]:bg-primary data-[state=checked]:border-primary rounded-full h-5 w-5"})})]}),jsxs("div",{className:"w-full text-center px-0.5 flex flex-col items-center",children:[jsx("span",{className:`
105
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
106
- ${t?"bg-[#2563EB] text-white antialiased shadow-sm":"text-[#374151] dark:text-zinc-300 group-hover:text-black dark:group-hover:text-white"}
107
- `,children:e.name}),ra("div",{className:`flex flex-col items-center justify-center gap-0.5 mt-1 transition-opacity duration-200 ${t?"opacity-60":"opacity-100"}`,children:[Fe("span",{className:"text-[11px] text-blue-600 dark:text-blue-400 font-medium tracking-tight",children:oe(e.size)}),I?Fe("div",{className:"text-[11px] text-gray-400 flex items-center scale-95",children:Fe(I,{file:e})}):null]})]})]})})}import{jsx as Oe,jsxs as na}from"react/jsx-runtime";function On({folder:e,isSelected:t,onSelect:o,onRightClick:a,onDelete:n,onRename:i,onMove:l,selectionMode:c,showCheckbox:d,mode:g,isInSelectionMode:u}){let b=N=>{N.stopPropagation(),confirm(`Are you sure you want to delete "${e.name}"?
90
+ ${t?"bg-primary text-primary-foreground antialiased shadow-sm":"text-foreground group-hover:text-foreground/80"}
91
+ `,children:e.name}),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:[jsx("span",{className:"text-[11px] text-primary font-medium tracking-tight",children:ee(e.size)}),D?jsx("div",{className:"text-[11px] text-muted-foreground flex items-center scale-95",children:jsx(D,{file:e})}):null]})]})]})})}function Dr({folder:e,isSelected:t,onSelect:a,onRightClick:o,onDelete:r$1,onRename:n,onMove:s,selectionMode:m$1,showCheckbox:l,mode:v,isInSelectionMode:u}){let x$1=k=>{k.stopPropagation(),confirm(`Are you sure you want to delete "${e.name}"?
108
92
 
109
- \u26A0\uFE0F Warning: This will also delete all ${e.fileCount} file(s) inside this folder.`)&&n(e.id)},p=N=>{N.stopPropagation(),i(e)},C=N=>{N.stopPropagation(),l(e)},w=N=>{N.stopPropagation(),o(e,void 0,!0)},k=N=>{o(e,N,!1)},y=N=>{o(e,void 0,!0)},M=N=>{N.stopPropagation()};return Oe(aa,{menuItems:[{label:"Rename",icon:Oe(Ot,{className:"size-6"}),onClick:p},{label:"Select Folder",icon:Oe(Gt,{className:"size-6"}),onClick:w},{label:"Move to...",icon:Oe(Qe,{className:"size-5 mr-1"}),onClick:C},{label:"Delete",icon:Oe(Be,{className:"size-5 mr-1 text-red-600"}),onClick:b,variant:"destructive"}],isInSelectionMode:u,mode:g,children:na("div",{className:"group relative flex flex-col items-center justify-start transition-all duration-200 cursor-pointer w-full select-none",onDoubleClick:k,onClick:k,children:[na("div",{className:`
110
- relative w-full aspect-square flex items-center justify-center mb-1 overflow-hidden rounded-2xl hover:bg-gray-200/60 dark:hover:bg-zinc-700/60
111
-
112
- ${t?"bg-gray-200/60 dark:bg-zinc-700/60":""}
113
- `,children:[Oe("div",{className:"w-[75%] h-[75%] flex items-center justify-center transform dark:brightness-[2]",children:Oe(qe,{className:"w-full h-full text-blue-400 fill-blue-400/20 drop-shadow-sm",strokeWidth:1.5})}),(c===Ee.MULTIPLE||d)&&Oe("div",{className:`absolute top-2 left-2 z-10 ${t?"opacity-100":"opacity-0 group-hover:opacity-100"} transition-opacity duration-200`,onClick:M,children:Oe(uo,{checked:t,onCheckedChange:y,className:"bg-white/90 dark:bg-zinc-900/90 border-gray-300 dark:border-zinc-600 shadow-sm data-[state=checked]:bg-blue-600 data-[state=checked]:border-blue-600 rounded-full h-5 w-5"})})]}),na("div",{className:"w-full text-center px-0.5 flex flex-col items-center",children:[Oe("span",{className:`
114
- text-[13px] font-semibold leading-[1.3] tracking-tight line-clamp-2 px-2.5 pb-[2px] rounded-[6px] transition-colors duration-100 break-words max-w-full
115
- ${t?"bg-[#2563EB] text-white antialiased shadow-sm":"text-[#374151] dark:text-zinc-300 group-hover:text-black dark:group-hover:text-white"}
116
- `,children:e.name}),Oe("div",{className:`flex items-center justify-center gap-1 mt-1 transition-opacity duration-200 ${t?"opacity-60":"opacity-100"}`,children:na("span",{className:"text-[11px] text-blue-600 dark:text-blue-400 font-medium tracking-tight px-1.5 rounded-full",children:[e.fileCount," items"]})})]})]})})}import{jsx as Xt,jsxs as ja}from"react/jsx-runtime";function ia(){let{files:e,folders:t,isLoading:o,handleFileClick:a,handleFolderClick:n,bulkDelete:i,mode:l,selectionMode:c,isInSelectionMode:d,selectedFiles:g,selectedFolders:u,currentFolder:b,setSelectedFiles:p,setSelectedFolders:C,setIsRenameFolderModalOpen:w,setIsMoveFileModalOpen:k,setFileDetailsModalFile:y,setFolderToRename:M}=E(),N=(()=>{if(!b)return 18;let h=b.folderCount||0,D=b.fileCount||0,Z=h+D;return Z>0?Z:18})();return o?Xt("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:N}).map((h,D)=>ja("div",{className:"flex flex-col items-center justify-start w-full gap-2",children:[Xt("div",{className:"w-full aspect-square bg-gray-100 dark:bg-zinc-800 rounded-2xl animate-pulse"}),ja("div",{className:"flex flex-col items-center gap-1 w-full",children:[Xt("div",{className:"h-4 w-20 bg-gray-100 dark:bg-zinc-800 rounded animate-pulse"}),Xt("div",{className:"h-3 w-12 bg-gray-100 dark:bg-zinc-800 rounded animate-pulse"})]})]},D))}):ja("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(h=>Xt(On,{folder:h,isSelected:u.some(D=>D.id===h.id),onSelect:n,onDelete:()=>i(),onRename:D=>{M(D),w(!0)},onMove:D=>{C([D]),p([]),k(!0)},selectionMode:c,mode:l,isInSelectionMode:d()},h.id)),e.map(h=>Xt(Gn,{file:h,isSelected:g.some(D=>D.id===h.id),onSelect:a,onDelete:()=>i(),onEdit:D=>{y(D)},onMove:D=>{p([D]),C([]),k(!0)},selectionMode:c,mode:l,isInSelectionMode:d()},h.id))]})}import{Component as cs}from"react";import{jsx as nt,jsxs as Wa}from"react/jsx-runtime";var la=class extends cs{constructor(o){super(o);this.handleReset=()=>{window.location.reload()};this.state={hasError:!1,error:null}}static getDerivedStateFromError(o){return{hasError:!0,error:o}}componentDidCatch(o,a){console.error("FileManager Error Boundary caught an error:",o,a)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:nt("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:Wa("div",{className:"text-center max-w-md flex flex-col items-center",children:[nt("div",{className:"bg-red-100 p-3 rounded-full mb-4",children:nt(Ho,{className:"size-8 text-red-600"})}),nt("h2",{className:"text-xl font-semibold text-slate-900 mb-2",children:"Something went wrong"}),nt("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&&Wa("details",{className:"mb-6 text-left w-full border border-slate-200 rounded-lg overflow-hidden flex-col group",children:[nt("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"}),nt("div",{className:"p-3 bg-white dark:bg-zinc-900",children:nt("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()})})]}),Wa(F,{onClick:this.handleReset,radius:"full",className:"gap-2",children:[nt(Bt,{className:"size-4"}),"Reload Application"]})]})}):this.props.children}};import{useEffect as ps}from"react";function Bn(){let{handleSelectAllGlobal:e,handleClearSelection:t,getSelectionState:o,isCreateFolderModalOpen:a,setIsCreateFolderModalOpen:n,isUploadModalOpen:i,setIsUploadModalOpen:l,isSearchModalOpen:c,setIsSearchModalOpen:d}=E();return ps(()=>{let g=u=>{u.key==="k"&&(u.metaKey||u.ctrlKey)&&(u.preventDefault(),d(!c)),u.key==="a"&&(u.metaKey||u.ctrlKey)&&(u.preventDefault(),o()===!0?t():e(!0)),u.key==="f"&&(u.metaKey||u.ctrlKey)&&(u.preventDefault(),n(!a)),u.key==="u"&&(u.metaKey||u.ctrlKey)&&(u.preventDefault(),l(!i))};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,t,o,a,n,i,l,c,d]),null}import{jsx as it,jsxs as sa}from"react/jsx-runtime";function us(e){return it(la,{children:sa(tt.Page,s(r({},e),{children:[it(Bn,{}),sa("div",{className:"flex h-full relative pb-12 overflow-hidden",children:[sa("div",{className:"flex-1 flex w-full flex-col",children:[it(tt.Header,{children:sa("div",{className:"flex w-full justify-between gap-2",children:[it(Jo,{}),it(zn,{})]})}),it(bn,{className:"-mb-1"}),it(ia,{}),it(tt.Footer,{className:"pt-6 pb-10"})]}),it(tt.Overlays,{})]})]}))})}import{useState as Hn,useRef as ms,useEffect as Zn}from"react";import{Fragment as vs,jsx as te,jsxs as Rt}from"react/jsx-runtime";function fs(a){var n=a,{open:e,onClose:t}=n,o=f(n,["open","onClose"]);return te(tt.Modal,s(r({},o),{onClose:t,children:te(Ne,{open:e,onOpenChange:t,children:te(gs,{onClose:t})})}))}function gs({onClose:e}){let{updateSearchQuery:t}=E(),[o,a]=Hn(!1),[n,i]=Hn(""),l=ms(null),c=ea(n,300);return Zn(()=>{t(c)},[c,t]),Zn(()=>{o&&l.current&&l.current.focus()},[o]),Rt(Pe,{className:"p-0",variant:"fullscreen",showCloseButton:!1,children:[Rt(Ze,{className:"pt-5 pb-3 m-0 border-b border-border",children:[te(Se,{className:"px-6 text-base",children:te("div",{className:"flex w-full justify-between gap-2",children:o?Rt("div",{className:"flex items-center gap-4 flex-1",children:[te(xe,{className:"size-5 text-gray-500 shrink-0"}),te(Wt,{ref:l,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:n,onChange:d=>i(d.target.value),onKeyDown:d=>{d.key==="Escape"&&(i(""),t(""),a(!1))}}),te(ye,{onClick:()=>{i(""),t(""),a(!1)},className:"shrink-0",label:"Cancel Search"})]}):Rt(vs,{children:[te(Jo,{}),te(Rn,{onSearchClick:()=>a(!0)}),te(ye,{onClick:e})]})})}),te(dt,{className:"sr-only",children:"Browse and select files from your media library"})]}),Rt("div",{className:"overflow-y-auto flex-1 pb-4",children:[te(ia,{}),te(tt.Footer,{className:"my-4"}),te(tt.Overlays,{})]}),te(hs,{onClose:e})]})}function hs({onClose:e}){let{selectedFiles:t,onFilesSelected:o,setSelectedFiles:a,setSelectedFolders:n,updateSearchQuery:i,handlePageChange:l}=E();return Rt(Ue,{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:[te(xn,{}),te(Xe,{asChild:!0,children:te(F,{type:"button",variant:"outline",onClick:e,radius:"full",className:"w-full md:w-auto mr-0",children:"Cancel"})}),Rt(F,{type:"button",onClick:()=>{o&&t.length>0&&(o(t),a([]),n([]),i(""),l(1),e())},disabled:t.length===0,radius:"full",className:"w-full md:w-auto",children:["Select ",t.length>0?`(${t.length})`:""]})]})}var Me=[{id:1,name:"Documents",pathId:1,path:"/1",parentId:null,fileCount:20,folderCount:0,createdAt:new Date("2024-01-01"),updatedAt:new Date("2024-01-01")},{id:2,name:"Images",pathId:2,path:"/2",parentId:null,fileCount:10,folderCount:3,createdAt:new Date("2024-01-01"),updatedAt:new Date("2024-01-01")},{id:3,name:"Videos",pathId:3,path:"/3",parentId:null,fileCount:5,folderCount:0,createdAt:new Date("2024-01-01"),updatedAt:new Date("2024-01-01")},{id:4,name:"Music Some Long Name Streched also so long to fit in the card Music Some Long Name Streched also so long to fit in the card",pathId:4,path:"/4",parentId:null,fileCount:5,folderCount:0,createdAt:new Date("2024-01-01"),updatedAt:new Date("2024-01-01")},{id:5,name:"Archives",pathId:5,path:"/5",parentId:null,fileCount:5,folderCount:0,createdAt:new Date("2024-01-01"),updatedAt:new Date("2024-01-01")},{id:6,name:"Album 01",pathId:6,path:"/2/6",parentId:2,fileCount:0,folderCount:0,createdAt:new Date("2024-01-01"),updatedAt:new Date("2024-01-01")},{id:7,name:"Album 02",pathId:7,path:"/2/7",parentId:2,fileCount:0,folderCount:0,createdAt:new Date("2024-01-01"),updatedAt:new Date("2024-01-01")},{id:8,name:"Squirrels",pathId:8,path:"/2/8",parentId:2,fileCount:1,folderCount:0,createdAt:new Date("2024-01-01"),updatedAt:new Date("2024-01-01")}],Un=[{id:1,name:"Important",color:"#ef4444"},{id:2,name:"Work",color:"#3b82f6"},{id:3,name:"Personal",color:"#10b981"},{id:4,name:"Project",color:"#8b5cf6"},{id:5,name:"Archive",color:"#6b7280"}],ke=[{id:101,name:"welcome.pdf",url:"/placeholder.svg?height=400&width=300",size:245e3,createdAt:new Date("2024-05-15T10:00:00Z"),updatedAt:new Date("2024-05-15T10:00:00Z"),folderId:null,tags:["important"],mime:"application/pdf",ext:".pdf",metaData:{pageCount:2,author:"Admin"}},{id:102,name:"desktop_wallpaper.jpg",url:"https://images.unsplash.com/photo-1557683316-973673baf926",size:42e5,createdAt:new Date("2024-05-14T15:30:00Z"),updatedAt:new Date("2024-05-14T15:30:00Z"),folderId:null,tags:["personal"],mime:"image/jpeg",ext:".jpg",width:5e3,height:3333,formats:{thumbnail:{ext:".jpg",url:"https://images.unsplash.com/photo-1557683316-973673baf926?w=156",hash:"thumbnail_desktop_wallpaper_abc123",mime:"image/jpeg",name:"thumbnail_desktop_wallpaper.jpg",path:null,size:5.57,width:156,height:104},small:{ext:".jpg",url:"https://images.unsplash.com/photo-1557683316-973673baf926?w=500",hash:"small_desktop_wallpaper_abc123",mime:"image/jpeg",name:"small_desktop_wallpaper.jpg",path:null,size:47.27,width:500,height:333},medium:{ext:".jpg",url:"https://images.unsplash.com/photo-1557683316-973673baf926?w=750",hash:"medium_desktop_wallpaper_abc123",mime:"image/jpeg",name:"medium_desktop_wallpaper.jpg",path:null,size:97.89,width:750,height:500},large:{ext:".jpg",url:"https://images.unsplash.com/photo-1557683316-973673baf926?w=1000",hash:"large_desktop_wallpaper_abc123",mime:"image/jpeg",name:"large_desktop_wallpaper.jpg",path:null,size:159.48,width:1e3,height:667}},metaData:{}},{id:103,name:"quick_notes.txt",url:"/placeholder.svg?height=400&width=300",size:3500,createdAt:new Date("2024-05-13T09:45:00Z"),updatedAt:new Date("2024-05-13T09:45:00Z"),folderId:null,tags:[],mime:"text/plain",ext:".txt",metaData:{}},{id:104,name:"intro_video.mp4",url:"https://docs.material-tailwind.com/demo.mp4",size:12e6,createdAt:new Date("2024-05-12T14:00:00Z"),updatedAt:new Date("2024-05-12T14:00:00Z"),folderId:null,tags:[],mime:"video/mp4",ext:".mp4",width:1920,height:1080,metaData:{duration:90,videoSource:"local"}},{id:105,name:"profile_photo.png",url:"https://images.unsplash.com/photo-1535713875002-d1d0cf377fde",size:85e4,createdAt:new Date("2024-05-11T11:20:00Z"),updatedAt:new Date("2024-05-11T11:20:00Z"),folderId:null,tags:["personal"],mime:"image/png",ext:".png",width:2e3,height:2e3,formats:{thumbnail:{ext:".png",url:"https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=156",hash:"thumbnail_profile_photo_def456",mime:"image/png",name:"thumbnail_profile_photo.png",path:null,size:8.2,width:156,height:156},small:{ext:".png",url:"https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=500",hash:"small_profile_photo_def456",mime:"image/png",name:"small_profile_photo.png",path:null,size:52.3,width:500,height:500},medium:{ext:".png",url:"https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=750",hash:"medium_profile_photo_def456",mime:"image/png",name:"medium_profile_photo.png",path:null,size:110.5,width:750,height:750},large:{ext:".png",url:"https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=1000",hash:"large_profile_photo_def456",mime:"image/png",name:"large_profile_photo.png",path:null,size:185.7,width:1e3,height:1e3}},metaData:{}},{id:106,name:"todo_list.md",url:"/placeholder.svg?height=400&width=300",size:6200,createdAt:new Date("2024-05-10T08:30:00Z"),updatedAt:new Date("2024-05-10T08:30:00Z"),folderId:null,tags:["important"],mime:"text/markdown",ext:".md",metaData:{}},{id:107,name:"app_settings.json",url:"/placeholder.svg?height=400&width=300",size:4800,createdAt:new Date("2024-05-09T16:15:00Z"),updatedAt:new Date("2024-05-09T16:15:00Z"),folderId:null,tags:[],mime:"application/json",ext:".json",metaData:{}},{id:108,name:"mountain_landscape.webp",url:"https://images.unsplash.com/photo-1506905925346-21bda4d32df4",size:12e5,createdAt:new Date("2024-05-08T13:00:00Z"),updatedAt:new Date("2024-05-08T13:00:00Z"),folderId:null,tags:["personal"],mime:"image/webp",ext:".webp",width:4e3,height:2667,metaData:{}},{id:1,name:"Key-Monastery-img.avif",url:"https://unciatrails.com/wp-content/uploads/2024/07/Key-Monastery-img.avif",size:2621440,createdAt:new Date("2023-10-26T10:30:00Z"),updatedAt:new Date("2023-10-26T10:30:00Z"),folderId:8,tags:["personal","important"],mime:"image/avif",ext:".avif",caption:"A cute squirrel in the park",alternativeText:"Gray squirrel sitting on wooden fence",width:3024,height:4032,metaData:{}},{id:2,name:"project_proposal thoda sa.pdf",url:"/placeholder.svg?height=400&width=300",size:1048576,createdAt:new Date("2024-05-10T14:20:00Z"),updatedAt:new Date("2024-05-10T14:20:00Z"),folderId:1,tags:["work","important"],mime:"application/pdf",ext:".pdf",metaData:{pageCount:15,author:"John Doe"}},{id:3,name:"quarterly_report.xlsx",url:"/placeholder.svg?height=400&width=300",size:524288,createdAt:new Date("2024-05-08T09:15:00Z"),updatedAt:new Date("2024-05-08T09:15:00Z"),folderId:1,tags:["work"],mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ext:".xlsx",metaData:{pageCount:10}},{id:4,name:"presentation.pptx",url:"/placeholder.svg?height=400&width=300",size:2097152,createdAt:new Date("2024-05-05T16:45:00Z"),updatedAt:new Date("2024-05-05T16:45:00Z"),folderId:1,tags:["work","project"],mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation",ext:".pptx",metaData:{pageCount:20}},{id:8,name:"documnet.doc",url:"/placeholder.svg?height=400&width=300",size:2097152,createdAt:new Date("2024-05-05T16:45:00Z"),updatedAt:new Date("2024-05-05T16:45:00Z"),folderId:1,tags:["work","project"],mime:"application/msword",ext:".doc",metaData:{pageCount:20}},{id:5,name:"demo_video.mp4",url:"https://docs.material-tailwind.com/demo.mp4",size:10485760,createdAt:new Date("2024-05-03T11:30:00Z"),updatedAt:new Date("2024-05-03T11:30:00Z"),folderId:3,tags:["project"],mime:"video/mp4",ext:".mp4",width:1920,height:1080,metaData:{duration:120,videoSource:"remote"}},{id:6,name:"podcast_episode.mp3",url:"/placeholder.svg?height=400&width=300",size:5242880,createdAt:new Date("2024-05-02T10:00:00Z"),updatedAt:new Date("2024-05-02T10:00:00Z"),folderId:4,tags:["personal"],mime:"audio/mpeg",ext:".mp3",metaData:{duration:3600}},{id:7,name:"notes.txt",url:"/placeholder.svg?height=400&width=300",size:1024,createdAt:new Date("2024-05-01T09:00:00Z"),updatedAt:new Date("2024-05-01T09:00:00Z"),folderId:1,tags:["work"],mime:"text/plain",ext:".txt",metaData:{}},{id:9,name:"data.json",url:"/placeholder.svg?height=400&width=300",size:2048,createdAt:new Date("2024-04-30T15:00:00Z"),updatedAt:new Date("2024-04-30T15:00:00Z"),folderId:1,tags:["project"],mime:"application/json",ext:".json",metaData:{}},{id:10,name:"archive.zip",url:"/placeholder.svg?height=400&width=300",size:104857600,createdAt:new Date("2024-04-29T12:00:00Z"),updatedAt:new Date("2024-04-29T12:00:00Z"),folderId:5,tags:["archive"],mime:"application/zip",ext:".zip",metaData:{description:"Project backup"}},{id:11,name:"setup.exe",url:"/placeholder.svg?height=400&width=300",size:52428800,createdAt:new Date("2024-04-28T11:00:00Z"),updatedAt:new Date("2024-04-28T11:00:00Z"),folderId:5,tags:["software"],mime:"application/x-msdownload",ext:".exe",metaData:{description:"Installer"}},{id:12,name:"old_stuff.rar",url:"/placeholder.svg?height=400&width=300",size:20971520,createdAt:new Date("2024-04-27T10:00:00Z"),updatedAt:new Date("2024-04-27T10:00:00Z"),folderId:5,tags:["archive"],mime:"application/x-rar-compressed",ext:".rar",metaData:{description:"Old files"}},{id:13,name:"meeting_notes_q1.pdf",url:"/placeholder.svg?height=400&width=300",size:856e3,createdAt:new Date("2024-03-15T09:00:00Z"),updatedAt:new Date("2024-03-15T09:00:00Z"),folderId:1,tags:["work"],mime:"application/pdf",ext:".pdf",metaData:{pageCount:8,author:"Sarah Johnson"}},{id:14,name:"budget_2024.xlsx",url:"/placeholder.svg?height=400&width=300",size:425e3,createdAt:new Date("2024-03-10T14:30:00Z"),updatedAt:new Date("2024-03-10T14:30:00Z"),folderId:1,tags:["work","important"],mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ext:".xlsx",metaData:{pageCount:5}},{id:15,name:"team_photo.jpg",url:"https://images.unsplash.com/photo-1522071820081-009f0129c71c",size:32e5,createdAt:new Date("2024-02-28T11:00:00Z"),updatedAt:new Date("2024-02-28T11:00:00Z"),folderId:2,tags:["work"],mime:"image/jpeg",ext:".jpg",width:4e3,height:3e3,metaData:{}},{id:16,name:"logo_design.png",url:"https://images.unsplash.com/photo-1611162617474-5b21e879e113",size:15e5,createdAt:new Date("2024-02-20T10:00:00Z"),updatedAt:new Date("2024-02-20T10:00:00Z"),folderId:2,tags:["project"],mime:"image/png",ext:".png",width:2e3,height:2e3,metaData:{}},{id:17,name:"product_demo.mp4",url:"https://docs.material-tailwind.com/demo.mp4",size:15e6,createdAt:new Date("2024-02-15T16:00:00Z"),updatedAt:new Date("2024-02-15T16:00:00Z"),folderId:3,tags:["project"],mime:"video/mp4",ext:".mp4",width:1920,height:1080,metaData:{duration:180,videoSource:"local"}},{id:18,name:"training_video.mp4",url:"https://docs.material-tailwind.com/demo.mp4",size:25e6,createdAt:new Date("2024-02-10T09:30:00Z"),updatedAt:new Date("2024-02-10T09:30:00Z"),folderId:3,tags:["work"],mime:"video/mp4",ext:".mp4",width:1920,height:1080,metaData:{duration:300,videoSource:"local"}},{id:19,name:"background_music.mp3",url:"/placeholder.svg?height=400&width=300",size:45e5,createdAt:new Date("2024-02-05T14:00:00Z"),updatedAt:new Date("2024-02-05T14:00:00Z"),folderId:4,tags:["personal"],mime:"audio/mpeg",ext:".mp3",metaData:{duration:240}},{id:20,name:"contract_template.docx",url:"/placeholder.svg?height=400&width=300",size:65e4,createdAt:new Date("2024-01-30T11:00:00Z"),updatedAt:new Date("2024-01-30T11:00:00Z"),folderId:1,tags:["work"],mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",ext:".docx",metaData:{pageCount:12}},{id:21,name:"invoice_jan.pdf",url:"/placeholder.svg?height=400&width=300",size:32e4,createdAt:new Date("2024-01-25T10:00:00Z"),updatedAt:new Date("2024-01-25T10:00:00Z"),folderId:1,tags:["work","important"],mime:"application/pdf",ext:".pdf",metaData:{pageCount:3}},{id:22,name:"vacation_photo1.jpg",url:"https://images.unsplash.com/photo-1506905925346-21bda4d32df4",size:28e5,createdAt:new Date("2024-01-20T15:00:00Z"),updatedAt:new Date("2024-01-20T15:00:00Z"),folderId:2,tags:["personal"],mime:"image/jpeg",ext:".jpg",width:3500,height:2500,metaData:{}},{id:23,name:"vacation_photo2.jpg",url:"https://images.unsplash.com/photo-1469474968028-56623f02e42e",size:31e5,createdAt:new Date("2024-01-20T15:05:00Z"),updatedAt:new Date("2024-01-20T15:05:00Z"),folderId:2,tags:["personal"],mime:"image/jpeg",ext:".jpg",width:4e3,height:2800,metaData:{}},{id:24,name:"project_backup.zip",url:"/placeholder.svg?height=400&width=300",size:85e6,createdAt:new Date("2024-01-15T12:00:00Z"),updatedAt:new Date("2024-01-15T12:00:00Z"),folderId:5,tags:["archive","project"],mime:"application/zip",ext:".zip",metaData:{description:"Full project backup"}},{id:25,name:"presentation_final.pptx",url:"/placeholder.svg?height=400&width=300",size:35e5,createdAt:new Date("2024-01-10T16:00:00Z"),updatedAt:new Date("2024-01-10T16:00:00Z"),folderId:1,tags:["work","important"],mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation",ext:".pptx",metaData:{pageCount:35}},{id:26,name:"screenshot_001.png",url:"https://images.unsplash.com/photo-1517694712202-14dd9538aa97",size:12e5,createdAt:new Date("2024-01-05T09:00:00Z"),updatedAt:new Date("2024-01-05T09:00:00Z"),folderId:2,tags:["work"],mime:"image/png",ext:".png",width:1920,height:1080,metaData:{}},{id:27,name:"config.json",url:"/placeholder.svg?height=400&width=300",size:5e3,createdAt:new Date("2023-12-28T14:00:00Z"),updatedAt:new Date("2023-12-28T14:00:00Z"),folderId:1,tags:["project"],mime:"application/json",ext:".json",metaData:{}},{id:28,name:"readme.md",url:"/placeholder.svg?height=400&width=300",size:8500,createdAt:new Date("2023-12-20T10:00:00Z"),updatedAt:new Date("2023-12-20T10:00:00Z"),folderId:1,tags:["project"],mime:"text/markdown",ext:".md",metaData:{}},{id:29,name:"database_backup.sql",url:"/placeholder.svg?height=400&width=300",size:12e6,createdAt:new Date("2023-12-15T11:00:00Z"),updatedAt:new Date("2023-12-15T11:00:00Z"),folderId:5,tags:["archive","important"],mime:"application/sql",ext:".sql",metaData:{description:"Database backup"}},{id:30,name:"tutorial_video.mp4",url:"https://docs.material-tailwind.com/demo.mp4",size:18e6,createdAt:new Date("2023-12-10T13:00:00Z"),updatedAt:new Date("2023-12-10T13:00:00Z"),folderId:3,tags:["personal"],mime:"video/mp4",ext:".mp4",width:1920,height:1080,metaData:{duration:420,videoSource:"local"}},{id:31,name:"company_logo.svg",url:"/placeholder.svg?height=400&width=300",size:45e3,createdAt:new Date("2023-12-05T09:00:00Z"),updatedAt:new Date("2023-12-05T09:00:00Z"),folderId:2,tags:["work"],mime:"image/svg+xml",ext:".svg",metaData:{}},{id:32,name:"report_q4.pdf",url:"/placeholder.svg?height=400&width=300",size:18e5,createdAt:new Date("2023-12-01T15:00:00Z"),updatedAt:new Date("2023-12-01T15:00:00Z"),folderId:1,tags:["work","important"],mime:"application/pdf",ext:".pdf",metaData:{pageCount:25,author:"Finance Team"}},{id:33,name:"nature_photo.webp",url:"https://images.unsplash.com/photo-1441974231531-c6227db76b6e",size:95e4,createdAt:new Date("2023-11-25T12:00:00Z"),updatedAt:new Date("2023-11-25T12:00:00Z"),folderId:2,tags:["personal"],mime:"image/webp",ext:".webp",width:3e3,height:2e3,metaData:{}},{id:34,name:"podcast_intro.mp3",url:"/placeholder.svg?height=400&width=300",size:25e5,createdAt:new Date("2023-11-20T10:00:00Z"),updatedAt:new Date("2023-11-20T10:00:00Z"),folderId:4,tags:["personal"],mime:"audio/mpeg",ext:".mp3",metaData:{duration:180}},{id:35,name:"data_export.csv",url:"/placeholder.svg?height=400&width=300",size:85e4,createdAt:new Date("2023-11-15T14:00:00Z"),updatedAt:new Date("2023-11-15T14:00:00Z"),folderId:1,tags:["work"],mime:"text/csv",ext:".csv",metaData:{}},{id:36,name:"wireframes.pdf",url:"/placeholder.svg?height=400&width=300",size:42e5,createdAt:new Date("2023-11-10T11:00:00Z"),updatedAt:new Date("2023-11-10T11:00:00Z"),folderId:1,tags:["project"],mime:"application/pdf",ext:".pdf",metaData:{pageCount:45}},{id:37,name:"cityscape.jpg",url:"https://images.unsplash.com/photo-1449824913935-59a10b8d2000",size:38e5,createdAt:new Date("2023-11-05T16:00:00Z"),updatedAt:new Date("2023-11-05T16:00:00Z"),folderId:2,tags:["personal"],mime:"image/jpeg",ext:".jpg",width:4500,height:3e3,metaData:{}},{id:38,name:"interview_recording.mp3",url:"/placeholder.svg?height=400&width=300",size:85e5,createdAt:new Date("2023-11-01T09:00:00Z"),updatedAt:new Date("2023-11-01T09:00:00Z"),folderId:4,tags:["work"],mime:"audio/mpeg",ext:".mp3",metaData:{duration:1800}},{id:39,name:"client_files.rar",url:"/placeholder.svg?height=400&width=300",size:45e6,createdAt:new Date("2023-10-25T13:00:00Z"),updatedAt:new Date("2023-10-25T13:00:00Z"),folderId:5,tags:["archive","work"],mime:"application/x-rar-compressed",ext:".rar",metaData:{description:"Client deliverables"}},{id:40,name:"marketing_plan.docx",url:"/placeholder.svg?height=400&width=300",size:12e5,createdAt:new Date("2023-10-20T10:00:00Z"),updatedAt:new Date("2023-10-20T10:00:00Z"),folderId:1,tags:["work"],mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",ext:".docx",metaData:{pageCount:18}},{id:41,name:"analytics_data.xlsx",url:"/placeholder.svg?height=400&width=300",size:21e5,createdAt:new Date("2023-10-15T15:00:00Z"),updatedAt:new Date("2023-10-15T15:00:00Z"),folderId:1,tags:["work"],mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ext:".xlsx",metaData:{pageCount:8}},{id:42,name:"sunset_beach.jpg",url:"https://images.unsplash.com/photo-1507525428034-b723cf961d3e",size:32e5,createdAt:new Date("2023-10-10T17:00:00Z"),updatedAt:new Date("2023-10-10T17:00:00Z"),folderId:2,tags:["personal"],mime:"image/jpeg",ext:".jpg",width:4e3,height:2700,metaData:{}},{id:43,name:"webinar_recording.mp4",url:"https://docs.material-tailwind.com/demo.mp4",size:35e6,createdAt:new Date("2023-10-05T14:00:00Z"),updatedAt:new Date("2023-10-05T14:00:00Z"),folderId:3,tags:["work"],mime:"video/mp4",ext:".mp4",width:1920,height:1080,metaData:{duration:600,videoSource:"local"}},{id:44,name:"sound_effects.wav",url:"/placeholder.svg?height=400&width=300",size:15e6,createdAt:new Date("2023-10-01T11:00:00Z"),updatedAt:new Date("2023-10-01T11:00:00Z"),folderId:4,tags:["project"],mime:"audio/wav",ext:".wav",metaData:{duration:120}},{id:45,name:"legacy_system.zip",url:"/placeholder.svg?height=400&width=300",size:125e6,createdAt:new Date("2023-09-25T09:00:00Z"),updatedAt:new Date("2023-09-25T09:00:00Z"),folderId:5,tags:["archive"],mime:"application/zip",ext:".zip",metaData:{description:"Old system files"}}];var go=e=>new Promise(t=>setTimeout(t,e)),$a=class{getFolder(t){if(t===null)return Promise.resolve(null);let o=Me.find(i=>i.id===t);if(!o)return Promise.resolve(null);let a=r({},o),n=a;for(;n.parentId!==null;){let i=Me.find(l=>l.id===n.parentId);if(i)n.parent=r({},i),n=n.parent;else break}return Promise.resolve(a)}async getFolders(t,o=1,a=20,n=""){await go(300);let i=t!==null?Me.filter(p=>p.parentId===t):Me.filter(p=>p.parentId===null),l=i;if(n&&n.trim()){let p=n.toLowerCase().trim();l=i.filter(C=>C.name.toLowerCase().includes(p))}let c=l.sort((p,C)=>new Date(p.createdAt).getTime()-new Date(C.createdAt).getTime()),d=c.length,g=Math.ceil(d/a),u=(o-1)*a;return{folders:c.slice(u,u+a),pagination:{currentPage:o,totalPages:g,totalFiles:d,filesPerPage:a}}}getTags(){return Promise.resolve(Un.map(t=>t.name))}async getFiles(t,o,a,n,i){await go(500);let l=[...ke];if(t!==null&&(l=l.filter(w=>w.folderId===t)),o&&o.length>0&&(l=l.filter(w=>{let k=je(w.mime,w.ext);return o.includes(k)})),i){let w=i==null?void 0:i.toLowerCase();l=l.filter(k=>k.name.toLowerCase().includes(w))}let c=l.sort((w,k)=>new Date(w.createdAt).getTime()-new Date(k.createdAt).getTime()),d=a!=null?a:1,g=n!=null?n:10,u=c.length,b=Math.ceil(u/g),p=(d-1)*g,C=c.slice(p,p+g);return Promise.resolve({files:C,pagination:{currentPage:d,totalPages:b,totalFiles:u,filesPerPage:g}})}async getItems(t,o,a=1,n=24,i=""){await go(300);let l=t!==null?Me.filter(h=>h.parentId===t):Me.filter(h=>h.parentId===null),c=t!==null?ke.filter(h=>h.folderId===t):ke.filter(h=>h.folderId===null);if(o&&o.length>0&&(c=c.filter(h=>{let D=je(h.mime,h.ext);return o.includes(D)})),i&&i.trim()){let h=i.toLowerCase().trim();l=l.filter(D=>D.name.toLowerCase().includes(h)),c=c.filter(D=>{var Z,Y;return D.name.toLowerCase().includes(h)||((Y=(Z=D.ext)==null?void 0:Z.toLowerCase().includes(h))!=null?Y:!1)})}let d=l.sort((h,D)=>new Date(h.createdAt).getTime()-new Date(D.createdAt).getTime()),g=c.sort((h,D)=>new Date(h.createdAt).getTime()-new Date(D.createdAt).getTime()),u=d.length+g.length,b=Math.ceil(u/n)||1,p=(a-1)*n,C=p+n,w=d.slice(Math.max(0,p),Math.min(d.length,C)),k=w.length,y=n-k,M=Math.min(d.length,p),I=Math.max(0,p-d.length),N=g.slice(I,I+y);return{folders:w,files:N,pagination:{currentPage:a,totalPages:b,totalFiles:u,filesPerPage:n}}}async createFolder(t,o){await go(300);let a={id:Date.now(),name:t,parentId:o!=null?o:null,pathId:typeof o=="number"?o:0,path:"",fileCount:0,folderCount:0,createdAt:new Date,updatedAt:new Date};return Me.push(a),a}getMetaDataType(t,o){return t.type.startsWith("image/")?{}:t.type.startsWith("video/")?{duration:0,videoSource:o!=null?o:da.LOCAL}:t.type.startsWith("audio/")?{duration:0}:{description:""}}getFileType(t){var a;let o="."+((a=t.name.split(".").pop())==null?void 0:a.toLowerCase());return je(t.type,o)}async uploadFiles(t,o){var n;await go(500);let a=[];for(let{file:i,videoSource:l}of t){let c=this.getFileType(i),d="."+((n=i.name.split(".").pop())==null?void 0:n.toLowerCase()),g={id:Date.now()+Math.random(),name:i.name,folderId:o!=null?o:null,size:i.size,url:URL.createObjectURL(i),mime:i.type||"application/octet-stream",ext:d,metaData:this.getMetaDataType(i,l),createdAt:new Date,updatedAt:new Date,tags:[],width:c===K.IMAGE?800:void 0,height:c===K.IMAGE?600:void 0};ke.push(g),a.push(g)}return a}renameFolder(t,o){let a=Me.find(n=>n.id===t);return a?(a.name=o,a.updatedAt=new Date,Promise.resolve(a)):Promise.reject(new Error("Folder not found"))}updateFileMetaData(t,o){let a=ke.find(c=>c.id===t);if(!a)return Promise.reject(new Error("File not found"));let l=o,{metaData:n}=l,i=f(l,["metaData"]);return Object.assign(a,i),n&&(a.metaData=r(r({},a.metaData),n)),a.updatedAt=new Date,Promise.resolve(a)}deleteFiles(t){for(let o of t){let a=ke.findIndex(n=>n.id===o);a!==-1&&ke.splice(a,1)}return Promise.resolve()}deleteFolders(t){for(let o of t){let a=Me.findIndex(n=>n.id===o);if(a!==-1){Me.splice(a,1);for(let n=ke.length-1;n>=0;n--)ke[n].folderId===o&&ke.splice(n,1)}}return Promise.resolve()}findFiles(t){let o=t==null?void 0:t.toLowerCase(),a=ke.filter(n=>{var i;return n.name.toLowerCase().includes(o)||((i=n.tags)==null?void 0:i.some(l=>l.toLowerCase().includes(o)))});return Promise.resolve(a)}findFolders(t){let o=t==null?void 0:t.toLowerCase(),a=Me.filter(n=>n.name.toLowerCase().includes(o));return Promise.resolve(a)}moveFiles(t,o){let a=[];for(let n of t){let i=ke.find(l=>l.id===n);i&&(i.folderId=o,i.updatedAt=new Date,a.push(i))}return Promise.resolve(a)}moveFolders(t,o){let a=[];for(let n of t){let i=Me.find(l=>l.id===n);i&&(i.parentId=o,i.updatedAt=new Date,a.push(i))}return Promise.resolve(a)}};export{us as FileManager,fs as FileManagerModal,bo as FileManagerProvider,$a as MockProvider,E as useFileManager};
93
+ \u26A0\uFE0F Warning: This will also delete all ${e.fileCount} file(s) inside this folder.`)&&r$1(e.id);},c=k=>{k.stopPropagation(),n(e);},w=k=>{k.stopPropagation(),s(e);},F=k=>{k.stopPropagation(),a(e,void 0,true);},M=k=>{a(e,k,false);},C=k=>{a(e,void 0,true);},N=k=>{k.stopPropagation();};return jsx(bo,{menuItems:[{label:"Rename",icon:jsx(y$1,{className:"size-6"}),onClick:c},{label:"Select Folder",icon:jsx(x,{className:"size-6"}),onClick:F},{label:"Move to...",icon:jsx(m,{className:"size-5 mr-1"}),onClick:w},{label:"Delete",icon:jsx(r,{className:"size-5 mr-1 text-red-600"}),onClick:x$1,variant:"destructive"}],isInSelectionMode:u,mode:v,children:jsxs("div",{className:"group relative flex flex-col items-center justify-start transition-all duration-200 cursor-pointer w-full select-none",onDoubleClick:M,onClick:M,children:[jsxs("div",{className:`
94
+ relative w-full aspect-square flex items-center justify-center mb-1 overflow-hidden rounded-2xl hover:bg-accent/60
95
+ ${t?"bg-accent/60":""}
96
+ `,children:[jsx("div",{className:"w-[75%] h-[75%] flex items-center justify-center transform dark:brightness-[2]",children:jsx(j,{className:"w-full h-full text-blue-400 fill-blue-400/20 drop-shadow-sm",strokeWidth:1.5})}),(m$1===f$1.MULTIPLE||l)&&jsx("div",{className:`absolute top-2 left-2 z-10 ${t?"opacity-100":"opacity-0 group-hover:opacity-100"} transition-opacity duration-200`,onClick:N,children:jsx(Yt,{checked:t,onCheckedChange:C,className:"bg-background/90 border-border shadow-sm data-[state=checked]:bg-primary data-[state=checked]:border-primary rounded-full h-5 w-5"})})]}),jsxs("div",{className:"w-full text-center px-0.5 flex flex-col items-center",children:[jsx("span",{className:`
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
+ ${t?"bg-primary text-primary-foreground antialiased shadow-sm":"text-foreground group-hover:text-foreground/80"}
99
+ `,children:e.name}),jsx("div",{className:`flex items-center justify-center gap-1 mt-1 transition-opacity duration-200 ${t?"opacity-60":"opacity-100"}`,children:jsxs("span",{className:"text-[11px] text-primary font-medium tracking-tight px-1.5 rounded-full",children:[e.fileCount," items"]})})]})]})})}function Co(){let{files:e,folders:t,isLoading:a,handleFileClick:o,handleFolderClick:r,bulkDelete:n,mode:s,selectionMode:m,isInSelectionMode:l,selectedFiles:v,selectedFolders:u,currentFolder:x,setSelectedFiles:c,setSelectedFolders:w,setIsRenameFolderModalOpen:F,setIsMoveFileModalOpen:M,setFileDetailsModalFile:C,setFolderToRename:N}=E(),k=(()=>{if(!x)return 18;let b=x.folderCount||0,S=x.fileCount||0,j=b+S;return j>0?j:18})();return a?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:k}).map((b,S)=>jsxs("div",{className:"flex flex-col items-center justify-start w-full gap-2",children:[jsx("div",{className:"w-full aspect-square bg-muted rounded-2xl animate-pulse"}),jsxs("div",{className:"flex flex-col items-center gap-1 w-full",children:[jsx("div",{className:"h-4 w-20 bg-muted rounded animate-pulse"}),jsx("div",{className:"h-3 w-12 bg-muted rounded animate-pulse"})]})]},S))}):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(b=>jsx(Dr,{folder:b,isSelected:u.some(S=>S.id===b.id),onSelect:r,onDelete:()=>n(),onRename:S=>{N(S),F(true);},onMove:S=>{w([S]),c([]),M(true);},selectionMode:m,mode:s,isInSelectionMode:l()},b.id)),e.map(b=>jsx(kr,{file:b,isSelected:v.some(S=>S.id===b.id),onSelect:o,onDelete:()=>n(),onEdit:S=>{C(S);},onMove:S=>{c([S]),w([]),M(true);},selectionMode:m,mode:s,isInSelectionMode:l()},b.id))]})}var Fo=class extends Component{constructor(a){super(a);this.handleReset=()=>{window.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: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:jsxs("div",{className:"text-center max-w-md flex flex-col items-center",children:[jsx("div",{className:"bg-red-100 p-3 rounded-full mb-4",children:jsx(E$1,{className:"size-8 text-red-600"})}),jsx("h2",{className:"text-xl font-semibold text-slate-900 mb-2",children:"Something went wrong"}),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&&jsxs("details",{className:"mb-6 text-left w-full border border-slate-200 rounded-lg overflow-hidden flex-col group",children:[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"}),jsx("div",{className:"p-3 bg-white dark:bg-zinc-900",children: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()})})]}),jsxs(y,{onClick:this.handleReset,radius:"full",className:"gap-2",children:[jsx(F,{className:"size-4"}),"Reload Application"]})]})}):this.props.children}};function Pr(){let{handleSelectAllGlobal:e,handleClearSelection:t,getSelectionState:a,isCreateFolderModalOpen:o,setIsCreateFolderModalOpen:r,isUploadModalOpen:n,setIsUploadModalOpen:s,isSearchModalOpen:m,setIsSearchModalOpen:l}=E();return useEffect(()=>{let v=u=>{u.key==="k"&&(u.metaKey||u.ctrlKey)&&(u.preventDefault(),l(!m)),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,m,l]),null}function Mi(e){return jsx(Fo,{children:jsxs(He.Page,b(a({},e),{children:[jsx(Pr,{}),jsxs("div",{className:"flex h-full relative pb-12 overflow-hidden",children:[jsxs("div",{className:"flex-1 flex w-full flex-col",children:[jsx(He.Header,{children:jsxs("div",{className:"flex w-full justify-between gap-2",children:[jsx(po,{}),jsx(br,{})]})}),jsx(ir,{className:"-mb-1"}),jsx(Co,{}),jsx(He.Footer,{className:"pt-6 pb-10"})]}),jsx(He.Overlays,{})]})]}))})}function Di(o){var r=o,{open:e,onClose:t}=r,a$1=c(r,["open","onClose"]);return jsx(He.Modal,b(a({},a$1),{onClose:t,children:jsx(Fe,{open:e,onOpenChange:t,children:jsx(Pi,{onClose:t})})}))}function Pi({onClose:e}){let{updateSearchQuery:t}=E(),[a,o]=useState(false),[r,n]=useState(""),s=useRef(null),m=go(r,300);return useEffect(()=>{t(m);},[m,t]),useEffect(()=>{a&&s.current&&s.current.focus();},[a]),jsxs(we,{className:"p-0",variant:"fullscreen",showCloseButton:false,children:[jsxs(Le,{className:"pt-5 pb-3 m-0 border-b border-border",children:[jsx(Ne,{className:"px-6 text-base",children:jsx("div",{className:"flex w-full justify-between gap-2",children:a?jsxs("div",{className:"flex items-center gap-4 flex-1",children:[jsx(l,{className:"size-5 text-gray-500 shrink-0"}),jsx(Dt,{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));}}),jsx(xe,{onClick:()=>{n(""),t(""),o(false);},className:"shrink-0",label:"Cancel Search"})]}):jsxs(Fragment,{children:[jsx(po,{}),jsx(hr,{onSearchClick:()=>o(true)}),jsx(xe,{onClick:e})]})})}),jsx(Je,{className:"sr-only",children:"Browse and select files from your media library"})]}),jsxs("div",{className:"overflow-y-auto flex-1 pb-4",children:[jsx(Co,{}),jsx(He.Footer,{className:"my-4"}),jsx(He.Overlays,{})]}),jsx(Ii,{onClose:e})]})}function Ii({onClose:e}){let{selectedFiles:t,onFilesSelected:a,setSelectedFiles:o,setSelectedFolders:r,updateSearchQuery:n,handlePageChange:s}=E();return 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:[jsx(nr,{}),jsx(Ge,{asChild:true,children:jsx(y,{type:"button",variant:"outline",onClick:e,radius:"full",className:"w-full md:w-auto mr-0",children:"Cancel"})}),jsxs(y,{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})`:""]})]})}export{Mi as FileManager,Di as FileManagerModal,no as FileManagerProvider,E as useFileManager};