module.exports=[50640,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"InvariantError",{enumerable:!0,get:function(){return d}});class d extends Error{constructor(a,b){super(`Invariant: ${a.endsWith(".")?a:a+"."} This is a bug in Next.js.`,b),this.name="InvariantError"}}},27699,(a,b,c)=>{b.exports=a.x("events",()=>require("events"))},874,(a,b,c)=>{b.exports=a.x("buffer",()=>require("buffer"))},6461,(a,b,c)=>{b.exports=a.x("zlib",()=>require("zlib"))},54799,(a,b,c)=>{b.exports=a.x("crypto",()=>require("crypto"))},63021,(a,b,c)=>{b.exports=a.x("@prisma/client-2c3a283f134fdcb6",()=>require("@prisma/client-2c3a283f134fdcb6"))},4446,(a,b,c)=>{b.exports=a.x("net",()=>require("net"))},99348,(a,b,c)=>{b.exports=a.x("string_decoder",()=>require("string_decoder"))},88947,(a,b,c)=>{b.exports=a.x("stream",()=>require("stream"))},55004,(a,b,c)=>{b.exports=a.x("tls",()=>require("tls"))},46786,(a,b,c)=>{b.exports=a.x("os",()=>require("os"))},22734,(a,b,c)=>{b.exports=a.x("fs",()=>require("fs"))},37936,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"registerServerReference",{enumerable:!0,get:function(){return d.registerServerReference}});let d=a.r(11857)},13095,(a,b,c)=>{"use strict";function d(a){for(let b=0;b<a.length;b++){let c=a[b];if("function"!=typeof c)throw Object.defineProperty(Error(`A "use server" file can only export async functions, found ${typeof c}.
Read more: https://nextjs.org/docs/messages/invalid-use-server-value`),"__NEXT_ERROR_CODE",{value:"E352",enumerable:!1,configurable:!0})}}Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"ensureServerEntryExports",{enumerable:!0,get:function(){return d}})},6971,(a,b,c)=>{b.exports=a.x("sharp-20c6a5da84e2135f",()=>require("sharp-20c6a5da84e2135f"))},24868,(a,b,c)=>{b.exports=a.x("fs/promises",()=>require("fs/promises"))},42882,a=>{"use strict";var b=a.i(37936),c=a.i(1241),d=a.i(6971),e=a.i(14747),f=a.i(24868);let g=e.default.join(process.cwd(),"public","uploads");async function h(a,b,c){let h=e.default.extname(b).toLowerCase(),i=e.default.basename(b,h);if(!c.startsWith("image/")){let b=`${i}-${Date.now()}${h}`,d=e.default.join(g,b);return await f.default.writeFile(d,a),{url:`/uploads/${b}`,thumbnailUrl:null,filename:b,mimeType:c,size:a.length,width:null,height:null}}let j=`${i}-${Date.now()}.webp`,k=`thumb-${j}`,l=e.default.join(g,j),m=e.default.join(g,k),n=await (0,d.default)(a).rotate().resize(1200,null,{withoutEnlargement:!0}).webp({quality:75,effort:6}).toFile(l);return await (0,d.default)(a).resize(300,300,{fit:"cover"}).webp({quality:60}).toFile(m),{url:`/uploads/${j}`,thumbnailUrl:`/uploads/${k}`,filename:j,mimeType:"image/webp",size:n.size,width:n.width,height:n.height}}async function i(a){try{let b=e.default.join(process.cwd(),"public",a);await f.default.unlink(b)}catch(b){console.error(`Error deleting file: ${a}`,b)}}var j=a.i(18558);async function k(a){let b=a.get("file"),d=a.get("folderId");if(!b)throw Error("No file provided");let e=Buffer.from(await b.arrayBuffer()),f=await h(e,b.name,b.type),g=await c.prisma.media.create({data:{...f,folderId:d||null}});return(0,j.revalidatePath)("/admin/media"),g}async function l(a=null,b){return await c.prisma.media.findMany({where:{folderId:a||null,...b?{filename:{contains:b}}:{}},orderBy:{createdAt:"desc"}})}async function m(a){let b=await c.prisma.media.findUnique({where:{id:a}});b&&(await i(b.url),b.thumbnailUrl&&await i(b.thumbnailUrl),await c.prisma.media.delete({where:{id:a}}),(0,j.revalidatePath)("/admin/media"))}async function n(a,b=null){let d=await c.prisma.folder.create({data:{name:a,parentId:b||null}});return(0,j.revalidatePath)("/admin/media"),d}async function o(a=null){return await c.prisma.folder.findMany({where:{parentId:a||null},orderBy:{name:"asc"},include:{_count:{select:{media:!0,folders:!0}}}})}async function p(a){return await c.prisma.folder.findUnique({where:{id:a},include:{parent:!0}})}async function q(a){await c.prisma.folder.delete({where:{id:a}}),(0,j.revalidatePath)("/admin/media")}async function r(a){let b=[],d=a;for(;d;){let a=await c.prisma.folder.findUnique({where:{id:d},select:{id:!0,name:!0,parentId:!0}});if(!a)break;b.unshift(a),d=a.parentId}return b}(0,a.i(13095).ensureServerEntryExports)([k,l,m,n,o,p,q,r]),(0,b.registerServerReference)(k,"404ef4bfad4221c24b7b814c06648c00aed1c345a3",null),(0,b.registerServerReference)(l,"604426b7595790fa876d1e547516ad859aa22ec0ac",null),(0,b.registerServerReference)(m,"405d188f49f57bd19a93600ce38f1817cbed758c01",null),(0,b.registerServerReference)(n,"6084b18a62281e53c9f0e0ab5f1897ecd4a44561ee",null),(0,b.registerServerReference)(o,"409d6f943f61ff941ed739a63cb64311f80e87c106",null),(0,b.registerServerReference)(p,"40da9d14a249b8e6f3eca300b5f9fd7724fa13b1b3",null),(0,b.registerServerReference)(q,"40ba422e17f932404af535f33b28e7c64219ab2bb4",null),(0,b.registerServerReference)(r,"409207eb406ef73387e2210d48f75e590566634c18",null),a.s(["createFolder",0,n,"deleteFolder",0,q,"deleteMedia",0,m,"getBreadcrumbs",0,r,"getFolder",0,p,"getFolders",0,o,"getMedia",0,l,"uploadMedia",0,k],42882)},85080,a=>{"use strict";var b=a.i(42882);a.s([],8915),a.i(8915),a.s(["404ef4bfad4221c24b7b814c06648c00aed1c345a3",()=>b.uploadMedia,"405d188f49f57bd19a93600ce38f1817cbed758c01",()=>b.deleteMedia,"409207eb406ef73387e2210d48f75e590566634c18",()=>b.getBreadcrumbs,"409d6f943f61ff941ed739a63cb64311f80e87c106",()=>b.getFolders,"40ba422e17f932404af535f33b28e7c64219ab2bb4",()=>b.deleteFolder,"40da9d14a249b8e6f3eca300b5f9fd7724fa13b1b3",()=>b.getFolder,"604426b7595790fa876d1e547516ad859aa22ec0ac",()=>b.getMedia,"6084b18a62281e53c9f0e0ab5f1897ecd4a44561ee",()=>b.createFolder],85080)}];

//# sourceMappingURL=%5Broot-of-the-server%5D__0j_rwl5._.js.map