"use strict";(()=>{var e={};e.id=379,e.ids=[379],e.modules={517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7147:e=>{e.exports=require("fs")},3292:e=>{e.exports=require("fs/promises")},1017:e=>{e.exports=require("path")},8381:(e,r,t)=>{t.r(r),t.d(r,{headerHooks:()=>w,originalPathname:()=>z,requestAsyncStorage:()=>j,routeModule:()=>v,serverHooks:()=>h,staticGenerationAsyncStorage:()=>x,staticGenerationBailout:()=>P});var o={};t.r(o),t.d(o,{POST:()=>g,dynamic:()=>d,fetchCache:()=>c,maxDuration:()=>f,preferredRegion:()=>m,runtime:()=>l}),t(5655);var a=t(3323),i=t(4647),s=t(6886),n=t(3292),u=t(1017),p=t(7147);let l="nodejs",d="force-dynamic",c="force-no-store",f=30,m="auto";async function g(e){try{let r=e.headers.get("content-type");if(!r?.includes("multipart/form-data"))return s.Z.json({error:"Content-Type must be multipart/form-data"},{status:415});let t=await e.formData(),o=t.get("file");if(!o)return s.Z.json({error:"No file provided"},{status:400});let a=["image/jpeg","image/jpg","image/png","image/gif","image/svg+xml"];if(!a.includes(o.type))return s.Z.json({error:"Invalid file type",allowedTypes:a,receivedType:o.type},{status:400});if(o.size>5242880)return s.Z.json({error:"File too large",maxSize:5242880,receivedSize:o.size},{status:400});let i=await o.arrayBuffer(),l=(0,u.join)(process.cwd(),"public","footers");(0,p.existsSync)(l)||await (0,n.mkdir)(l,{recursive:!0});let d=o.name.replace(/[^a-zA-Z0-9_.-]/g,"_"),c=d.split(".").pop()?.toLowerCase()||"bin",f=`header-${Date.now()}.${c}`,m=(0,u.join)(l,f);return await (0,n.writeFile)(m,new Uint8Array(i)),s.Z.json({success:!0,filename:f,path:`/footers/${f}`,size:o.size,type:o.type})}catch(e){return console.error("Upload error:",e),s.Z.json({error:"Internal server error",...!1},{status:500})}}let y=a.AppRouteRouteModule,v=new y({definition:{kind:i.x.APP_ROUTE,page:"/api/upload/footers/route",pathname:"/api/upload/footers",filename:"route",bundlePath:"app/api/upload/footers/route"},resolvedPagePath:"C:\\Users\\HP\\Downloads\\project\\app\\api\\upload\\footers\\route.ts",nextConfigOutput:"",userland:o}),{requestAsyncStorage:j,staticGenerationAsyncStorage:x,serverHooks:h,headerHooks:w,staticGenerationBailout:P}=v,z="/api/upload/footers/route"}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),o=r.X(0,[303],()=>t(8381));module.exports=o})();