"use strict";(()=>{var e={};e.id=5661,e.ids=[5661],e.modules={53524:e=>{e.exports=require("@prisma/client")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},32081:e=>{e.exports=require("child_process")},6113:e=>{e.exports=require("crypto")},9523:e=>{e.exports=require("dns")},82361:e=>{e.exports=require("events")},57147:e=>{e.exports=require("fs")},13685:e=>{e.exports=require("http")},95687:e=>{e.exports=require("https")},41808:e=>{e.exports=require("net")},22037:e=>{e.exports=require("os")},71017:e=>{e.exports=require("path")},12781:e=>{e.exports=require("stream")},24404:e=>{e.exports=require("tls")},57310:e=>{e.exports=require("url")},73837:e=>{e.exports=require("util")},59796:e=>{e.exports=require("zlib")},24370:(e,r,t)=>{t.r(r),t.d(r,{headerHooks:()=>v,originalPathname:()=>w,requestAsyncStorage:()=>m,routeModule:()=>P,serverHooks:()=>q,staticGenerationAsyncStorage:()=>x,staticGenerationBailout:()=>f});var o={};t.r(o),t.d(o,{POST:()=>l}),t(95655);var s=t(83323),i=t(54647),n=t(66886),a=t(30953),u=t(82280),p=t(6113),d=t.n(p);async function l(e){try{let{email:r,productId:t}=await e.json();if(!r||!t)return n.Z.json({error:"Email and Product ID are required"},{status:400});let o=await a._.order.findFirst({where:{OR:[{email:r},{user:{email:r}}],items:{some:{productId:t}}}});if(!o)return n.Z.json({error:"You can only review products you have purchased."},{status:403});let s=d().randomInt(1e5,999999).toString(),i=new Date(Date.now()+6e5);await a._.verificationToken.upsert({where:{identifier_token:{identifier:r,token:s}},update:{expires:i},create:{identifier:r,token:s,expires:i}});let p=await u.y.sendReviewOTP(r,s,o.customerName||"Values Customer");if(!p)return n.Z.json({error:"Failed to send OTP email"},{status:500});return n.Z.json({message:"OTP sent successfully"})}catch(e){return console.error("Error sending OTP:",e),n.Z.json({error:"Internal Server Error"},{status:500})}}let c=s.AppRouteRouteModule,P=new c({definition:{kind:i.x.APP_ROUTE,page:"/api/reviews/send-otp/route",pathname:"/api/reviews/send-otp",filename:"route",bundlePath:"app/api/reviews/send-otp/route"},resolvedPagePath:"D:\\Code\\MusaFoods_New\\musafoods\\app\\api\\reviews\\send-otp\\route.ts",nextConfigOutput:"standalone",userland:o}),{requestAsyncStorage:m,staticGenerationAsyncStorage:x,serverHooks:q,headerHooks:v,staticGenerationBailout:f}=P,w="/api/reviews/send-otp/route"},54647:(e,r)=>{var t;Object.defineProperty(r,"x",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE"}(t||(t={}))}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),o=r.X(0,[9727,3497,6886,3330,2280],()=>t(24370));module.exports=o})();