"use strict";(()=>{var e={};e.id=534,e.ids=[534],e.modules={53524:e=>{e.exports=require("@prisma/client")},72934:e=>{e.exports=require("next/dist/client/components/action-async-storage.external.js")},54580:e=>{e.exports=require("next/dist/client/components/request-async-storage.external.js")},45869:e=>{e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},27790:e=>{e.exports=require("assert")},78893:e=>{e.exports=require("buffer")},84770:e=>{e.exports=require("crypto")},17702:e=>{e.exports=require("events")},32615:e=>{e.exports=require("http")},35240:e=>{e.exports=require("https")},86624:e=>{e.exports=require("querystring")},17360:e=>{e.exports=require("url")},21764:e=>{e.exports=require("util")},71568:e=>{e.exports=require("zlib")},93977:e=>{e.exports=require("node:fs/promises")},70612:e=>{e.exports=require("node:os")},49411:e=>{e.exports=require("node:path")},48749:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>w,patchFetch:()=>y,requestAsyncStorage:()=>x,routeModule:()=>m,serverHooks:()=>q,staticGenerationAsyncStorage:()=>g});var s={};t.r(s),t.d(s,{POST:()=>c,dynamic:()=>d});var n=t(49303),o=t(88716),a=t(60670),i=t(87070),p=t(75571),u=t(90455),l=t(96497);let d="force-dynamic";async function c(e){try{if(!await (0,p.getServerSession)(u.L))return i.NextResponse.json({error:"Unauthorized"},{status:401});let{fileName:r,contentType:t,isPublic:s}=await e.json();if(!r||!t)return i.NextResponse.json({error:"Missing fileName or contentType"},{status:400});let n=await (0,l.RP)(r,t,s??!0);return i.NextResponse.json(n)}catch(e){return console.error("Presigned URL error:",e),i.NextResponse.json({error:"Failed to generate URL"},{status:500})}}let m=new n.AppRouteRouteModule({definition:{kind:o.x.APP_ROUTE,page:"/api/upload/presigned/route",pathname:"/api/upload/presigned",filename:"route",bundlePath:"app/api/upload/presigned/route"},resolvedPagePath:"/Users/jarolsanchez/Desktop/evotrucks/nextjs_space/app/api/upload/presigned/route.ts",nextConfigOutput:"",userland:s}),{requestAsyncStorage:x,staticGenerationAsyncStorage:g,serverHooks:q}=m,w="/api/upload/presigned/route";function y(){return(0,a.patchFetch)({serverHooks:q,staticGenerationAsyncStorage:g})}},90455:(e,r,t)=>{t.d(r,{L:()=>i});var s=t(53797),n=t(42023),o=t.n(n),a=t(72331);let i={providers:[(0,s.Z)({name:"credentials",credentials:{email:{label:"Email",type:"email"},password:{label:"Password",type:"password"}},async authorize(e){if(!e?.email||!e?.password)return null;try{let r=await a._.user.findUnique({where:{email:e.email}});if(!r||!await o().compare(e.password,r.password))return null;return{id:r.id,email:r.email,name:r.name,role:r.role}}catch{return null}}})],session:{strategy:"jwt"},callbacks:{jwt:async({token:e,user:r})=>(r&&(e.role=r?.role,e.id=r?.id),e),session:async({session:e,token:r})=>(e?.user&&(e.user.role=r?.role,e.user.id=r?.id),e)},pages:{signIn:"/admin/login"},secret:process.env.NEXTAUTH_SECRET}},72331:(e,r,t)=>{t.d(r,{_:()=>n});var s=t(53524);let n=globalThis.prisma||new s.PrismaClient},96497:(e,r,t)=>{t.d(r,{RP:()=>p,qm:()=>u});let s=require("@aws-sdk/client-s3");var n=t(50128);let o=new s.S3Client({}),{bucketName:a,folderPrefix:i}={bucketName:process.env.AWS_BUCKET_NAME??"",folderPrefix:process.env.AWS_FOLDER_PREFIX??""};async function p(e,r,t=!1){let p=t?`${i}public/uploads`:`${i}uploads`,u=`${p}/${Date.now()}-${e}`,l=new s.PutObjectCommand({Bucket:a,Key:u,ContentType:r,ContentDisposition:t?"attachment":void 0});return{uploadUrl:await (0,n.e)(o,l,{expiresIn:3600}),cloud_storage_path:u}}async function u(e,r=!1){if(r){let r=process.env.AWS_REGION??"us-east-1";return`https://${a}.s3.${r}.amazonaws.com/${e}`}let t=new s.GetObjectCommand({Bucket:a,Key:e,ResponseContentDisposition:"attachment"});return(0,n.e)(o,t,{expiresIn:3600})}}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[948,598,70,790,128],()=>t(48749));module.exports=s})();