(()=>{var a={};a.id=3363,a.ids=[3363],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},5486:a=>{"use strict";a.exports=require("bcrypt")},6850:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>H,patchFetch:()=>G,routeModule:()=>C,serverHooks:()=>F,workAsyncStorage:()=>D,workUnitAsyncStorage:()=>E});var d={};c.r(d),c.d(d,{POST:()=>B});var e=c(95736),f=c(9117),g=c(4044),h=c(39326),i=c(32324),j=c(261),k=c(54290),l=c(85328),m=c(38928),n=c(46595),o=c(3421),p=c(17679),q=c(41681),r=c(63446),s=c(86439),t=c(51356),u=c(10641),v=c(42987),w=c(36437);let x=c(52731).createTransport({host:process.env.EMAIL_SERVER_HOST,port:465,secure:!0,auth:{user:process.env.COMPANY_EMAIL_USER,pass:process.env.COMPANY_EMAIL_PASS}});async function y({to:a,subject:b,html:c}){try{return await x.sendMail({from:process.env.SUPPORT_EMAIL,to:a,subject:b,html:c}),!0}catch(a){throw console.error("Email sending error:",a),a}}var z=c(55511),A=c.n(z);async function B(a){try{await (0,v.A)();let{email:b}=await a.json();if(!b)return u.NextResponse.json({message:"Email is required"},{status:400});let c=await w.A.findOne({email:b});if(!c)return u.NextResponse.json({message:"If the email exists, an OTP has been sent"},{status:200});let d=Math.floor(1e5+9e5*Math.random()).toString(),e=new Date(Date.now()+6e5),f=A().randomBytes(32).toString("hex"),g=new Date(Date.now()+9e5);c.otp=d,c.otpExpiry=e,c.resetToken=f,c.resetTokenExpiry=g,await c.save();let h=`${process.env.NEXTAUTH_URL||"http://localhost:3000"}/forgotResetPassword?token=${f}`;try{await y({to:b,subject:"Password Reset OTP - Ajibest",html:`
          <div style="font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto;">
            <h2 style="color: #333;">Password Reset Request</h2>
            <p>You requested to reset your password. Use the OTP below to proceed:</p>
            <div style="background: #f4f4f4; padding: 15px; text-align: center; margin: 20px 0;">
              <h1 style="margin: 0; color: #333; letter-spacing: 5px; font-size: 32px;">${d}</h1>
            </div>
            <p style="margin: 20px 0;">
              <strong>Or click the link below to automatically fill the OTP:</strong>
            </p>
            <div style="text-align: center; margin: 25px 0;">
              <a href="${h}" 
                 style="background-color: #5D7DF3; color: white; padding: 12px 24px; 
                        text-decoration: none; border-radius: 5px; font-weight: bold;
                        display: inline-block;">
                Reset Your Password
              </a>
            </div>
            <p>This OTP is valid for 10 minutes.</p>
            <p>If you didn't request this, please ignore this email.</p>
            <hr style="border: none; border-top: 1px solid #eee; margin: 20px 0;" />
            <p style="color: #666; font-size: 12px;">This is an automated message, please do not reply.</p>
          </div>
        `})}catch(a){console.error("Failed to send email:",a)}return u.NextResponse.json({message:"If the email exists, an OTP has been sent"},{status:200})}catch(a){return console.error("Forgot password error:",a),u.NextResponse.json({message:"Internal server error"},{status:500})}}let C=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/forgot-password/route",pathname:"/api/forgot-password",filename:"route",bundlePath:"app/api/forgot-password/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"C:\\laptop\\Ajibest\\Ajibest\\app\\api\\forgot-password\\route.ts",nextConfigOutput:"",userland:d}),{workAsyncStorage:D,workUnitAsyncStorage:E,serverHooks:F}=C;function G(){return(0,g.patchFetch)({workAsyncStorage:D,workUnitAsyncStorage:E})}async function H(a,b,c){var d;let e="/api/forgot-password/route";"/index"===e&&(e="/");let g=await C.prepare(a,b,{srcPage:e,multiZoneDraftMode:!1});if(!g)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:u,params:v,nextConfig:w,isDraftMode:x,prerenderManifest:y,routerServerContext:z,isOnDemandRevalidate:A,revalidateOnlyGenerated:B,resolvedPathname:D}=g,E=(0,j.normalizeAppPath)(e),F=!!(y.dynamicRoutes[E]||y.routes[D]);if(F&&!x){let a=!!y.routes[D],b=y.dynamicRoutes[E];if(b&&!1===b.fallback&&!a)throw new s.NoFallbackError}let G=null;!F||C.isDev||x||(G="/index"===(G=D)?"/":G);let H=!0===C.isDev||!F,I=F&&!H,J=a.method||"GET",K=(0,i.getTracer)(),L=K.getActiveScopeSpan(),M={params:v,prerenderManifest:y,renderOpts:{experimental:{cacheComponents:!!w.experimental.cacheComponents,authInterrupts:!!w.experimental.authInterrupts},supportsDynamicResponse:H,incrementalCache:(0,h.getRequestMeta)(a,"incrementalCache"),cacheLifeProfiles:null==(d=w.experimental)?void 0:d.cacheLife,isRevalidate:I,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d)=>C.onRequestError(a,b,d,z)},sharedContext:{buildId:u}},N=new k.NodeNextRequest(a),O=new k.NodeNextResponse(b),P=l.NextRequestAdapter.fromNodeNextRequest(N,(0,l.signalFromNodeResponse)(b));try{let d=async c=>C.handle(P,M).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let d=K.getRootSpanAttributes();if(!d)return;if(d.get("next.span_type")!==m.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${d.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=d.get("next.route");if(e){let a=`${J} ${e}`;c.setAttributes({"next.route":e,"http.route":e,"next.span_name":a}),c.updateName(a)}else c.updateName(`${J} ${a.url}`)}),g=async g=>{var i,j;let k=async({previousCacheEntry:f})=>{try{if(!(0,h.getRequestMeta)(a,"minimalMode")&&A&&B&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let e=await d(g);a.fetchMetrics=M.renderOpts.fetchMetrics;let i=M.renderOpts.pendingWaitUntil;i&&c.waitUntil&&(c.waitUntil(i),i=void 0);let j=M.renderOpts.collectedTags;if(!F)return await (0,o.I)(N,O,e,M.renderOpts.pendingWaitUntil),null;{let a=await e.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(e.headers);j&&(b[r.NEXT_CACHE_TAGS_HEADER]=j),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==M.renderOpts.collectedRevalidate&&!(M.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&M.renderOpts.collectedRevalidate,d=void 0===M.renderOpts.collectedExpire||M.renderOpts.collectedExpire>=r.INFINITE_CACHE?void 0:M.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:e.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:d}}}}catch(b){throw(null==f?void 0:f.isStale)&&await C.onRequestError(a,b,{routerKind:"App Router",routePath:e,routeType:"route",revalidateReason:(0,n.c)({isRevalidate:I,isOnDemandRevalidate:A})},z),b}},l=await C.handleResponse({req:a,nextConfig:w,cacheKey:G,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:y,isRoutePPREnabled:!1,isOnDemandRevalidate:A,revalidateOnlyGenerated:B,responseGenerator:k,waitUntil:c.waitUntil});if(!F)return null;if((null==l||null==(i=l.value)?void 0:i.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==l||null==(j=l.value)?void 0:j.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});(0,h.getRequestMeta)(a,"minimalMode")||b.setHeader("x-nextjs-cache",A?"REVALIDATED":l.isMiss?"MISS":l.isStale?"STALE":"HIT"),x&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let m=(0,p.fromNodeOutgoingHttpHeaders)(l.value.headers);return(0,h.getRequestMeta)(a,"minimalMode")&&F||m.delete(r.NEXT_CACHE_TAGS_HEADER),!l.cacheControl||b.getHeader("Cache-Control")||m.get("Cache-Control")||m.set("Cache-Control",(0,q.getCacheControlHeader)(l.cacheControl)),await (0,o.I)(N,O,new Response(l.value.body,{headers:m,status:l.value.status||200})),null};L?await g(L):await K.withPropagatedContext(a.headers,()=>K.trace(m.BaseServerSpan.handleRequest,{spanName:`${J} ${a.url}`,kind:i.SpanKind.SERVER,attributes:{"http.method":J,"http.target":a.url}},g))}catch(b){if(b instanceof s.NoFallbackError||await C.onRequestError(a,b,{routerKind:"App Router",routePath:E,routeType:"route",revalidateReason:(0,n.c)({isRevalidate:I,isOnDemandRevalidate:A})}),F)throw b;return await (0,o.I)(N,O,new Response(null,{status:500})),null}}},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},14985:a=>{"use strict";a.exports=require("dns")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},34631:a=>{"use strict";a.exports=require("tls")},36437:(a,b,c)=>{"use strict";c.d(b,{A:()=>k});var d=c(56037),e=c.n(d),f=c(5486),g=c.n(f);let h=new d.Schema({name:{type:String},phoneNumber:{type:String},address:{type:String},image:{type:String},email:{type:String},userAccountNumber:{type:String},userBankName:{type:String},userAccountName:{type:String}}),i=new d.Schema({title:{type:String},description:{type:String},location:{type:String},image:{type:String},userEmail:{type:String},propertyId:{type:d.Schema.Types.ObjectId,ref:"Property"},propertyType:{type:String,enum:["House","Land","Farm","Commercial","Office","Shop"]},listingPurpose:{type:String,enum:["For Renting","For Sale"]},paymentMethod:{type:String,enum:["installment","payOnce"]},initialPayment:{type:Number},propertyPrice:{type:Number},bedrooms:{type:Number},bathrooms:{type:Number},amenities:{type:String},utilities:{type:String},plotNumber:{type:String},state:{type:String},size:{type:String,enum:["Quarter Plot","Half Plot","Full Plot"]},instalmentAllowed:{type:Boolean},paymentHistory:[{paymentDate:{type:Date},nextPaymentDate:{type:Date},amount:{type:Number},propertyPrice:{type:Number},totalPaymentMade:{type:Number},remainingBalance:{type:Number},paymentCompleted:{type:Boolean}}],withdrawnDate:{type:Date,default:Date.now},isWithdrawnApproved:{type:Boolean,default:!1},withdrawalReason:{type:String},isWithdrawn:{type:Boolean,default:!1},approvedAt:{type:Date},approvedBy:{type:String}}),j=new d.Schema({username:{type:String,unique:!0,index:!0},name:{type:String},email:{type:String,required:[!0,"Please provide an email"],unique:!0,index:!0},image:{type:String,maxlength:128},emailToken:{type:String},otp:{type:String},otpExpiry:{type:Date},resetToken:{type:String},resetTokenExpiry:{type:Date},isActive:{type:Boolean,required:[!0,"Please verify your Email"],default:!1},phoneNumber:{type:String},password:{type:String,maxlength:128},bvnOrNin:{type:String},role:{type:String,enum:["User","Admin","Agent"],default:"User"},nextOfKin:{type:h,required:!1},userAccountNumber:{type:String},userBankName:{type:String},userAccountName:{type:String},state:{type:String},country:{type:String},lga:{type:String},address:{type:String},dateOfRegistration:{type:Date,default:Date.now},lastLoginTime:Date,favouriteProperties:[{type:d.Schema.Types.ObjectId,ref:"Property"}],propertyPurOrRented:[{title:{type:String},description:{type:String},location:{type:String},image:{type:String},userEmail:{type:String},propertyId:{type:d.Schema.Types.ObjectId,ref:"Property"},paymentDate:{type:Date},propertyType:{type:String,enum:["House","Land","Farm","Commercial","Office","Shop"]},listingPurpose:{type:String,enum:["For Renting","For Sale"]},paymentMethod:{type:String,enum:["installment","payOnce"]},propertyPrice:{type:Number},bedrooms:{type:Number},bathrooms:{type:Number},amenities:{type:String},utilities:{type:String},plotNumber:{type:String},state:{type:String},size:{type:String,enum:["Quarter Plot","Half Plot","Full Plot"]},rentalDuration:{type:Number},instalmentAllowed:{type:Boolean}}],remainingBalance:{type:Number,default:0},totalPaymentToBeMade:{type:Number,default:0},totalPropertyPurchased:{type:Number,default:0},totalPaymentMade:{type:Number,default:0},totalPaymentsGross:{type:Number,default:0},propertyUnderPayment:[{title:{type:String},description:{type:String},location:{type:String},image:{type:String},userEmail:{type:String},propertyId:{type:d.Schema.Types.ObjectId,ref:"Property"},propertyType:{type:String,enum:["House","Land","Farm","Commercial","Office","Shop"]},listingPurpose:{type:String,enum:["For Renting","For Sale"]},paymentMethod:{type:String,enum:["installment","payOnce"]},initialPayment:{type:Number},propertyPrice:{type:Number},bedrooms:{type:Number},bathrooms:{type:Number},amenities:{type:String},utilities:{type:String},plotNumber:{type:String},state:{type:String},size:{type:String,enum:["Quarter Plot","Half Plot","Full Plot"]},instalmentAllowed:{type:Boolean},paymentHistory:[{paymentDate:{type:Date},nextPaymentDate:{type:Date},amount:{type:Number},propertyPrice:{type:Number},totalPaymentMade:{type:Number},remainingBalance:{type:Number},paymentCompleted:{type:Boolean}}],isWithdrawn:{type:Boolean,default:!1},isWithdrawnApproved:{type:Boolean,default:!1},withdrawalReason:{type:String},approvedAt:{type:Date},approvedBy:{type:String}}],propertyWithdrawn:[i],referralEarnings:{type:Number,default:0},numberOfReferrals:{type:Number,default:0}},{timestamps:!0});j.pre("save",async function(a){try{if(!this.isModified("password")||/\$2[ayb]\$/.test(this.password))return a();let b=await g().genSalt(10);this.password=await g().hash(this.password,b)}catch(a){throw a}a()});let k=e().models.User||e().model("User",j)},42987:(a,b,c)=>{"use strict";c.d(b,{A:()=>h});var d=c(56037),e=c.n(d);let f=process.env.MONGODB_URI,g=!1,h=async()=>{if(e().set("strictQuery",!0),!g)try{await e().connect(f,{dbName:"Ajibest"}),g=!0}catch(a){throw a}}},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{"use strict";a.exports=require("crypto")},55591:a=>{"use strict";a.exports=require("https")},56037:a=>{"use strict";a.exports=require("mongoose")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},74075:a=>{"use strict";a.exports=require("zlib")},78335:()=>{},79551:a=>{"use strict";a.exports=require("url")},79646:a=>{"use strict";a.exports=require("child_process")},81630:a=>{"use strict";a.exports=require("http")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},91645:a=>{"use strict";a.exports=require("net")},94735:a=>{"use strict";a.exports=require("events")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[5873,1428,1692,5112],()=>b(b.s=6850));module.exports=c})();