"use strict";(()=>{var e={};e.id=8464,e.ids=[8464],e.modules={47795:e=>{e.exports=require("generate-password")},75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},21572:e=>{e.exports=require("nodemailer")},72583:e=>{e.exports=require("sanitize-html")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")},21435:(e,r,s)=>{s.r(r),s.d(r,{config:()=>_,default:()=>p,routeModule:()=>c});var a={};s.r(a),s.d(a,{default:()=>n});var t=s(89947),o=s(2706),i=s(96762),u=s(68829),l=s(83704),d=s(89159);async function n(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let{facebookUserId:s,facebookUserImage:a,facebookUserFullName:t,facebookUserFirstName:o,facebookUserLastName:i,facebookUserEmail:n,supEmail:p}=e.body,{invite:_}=e.query;try{let e=await (0,l.A)({email:n,payload:{email:n,first_name:o,last_name:i,social_id:s,social_platform:"facebook",image:a,image_thumbnail:a,username:`facebook-user-${s}`},social_platform:"facebook",social_id:s,invitation:_,supEmail:p});if(e.payload?.csrf_k){let s=(0,u.A)({data:JSON.stringify(e.payload)}),{keyCookieName:a,csrfCookieName:t}=(0,d.A)();r.setHeader("Set-Cookie",[`${a}=${s};samesite=strict;path=/;HttpOnly=true;Secure=true`,`${t}=${e.payload.csrf_k};samesite=strict;path=/;HttpOnly=true`])}r.json(e)}catch(e){console.log(e.message),r.json({success:!1,msg:"Failed!"})}}let p=(0,i.M)(a,"default"),_=(0,i.M)(a,"config"),c=new t.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/social-login/facebook-auth",pathname:"/api/social-login/facebook-auth",bundlePath:"",filename:""},userland:a})},89159:(e,r,s)=>{s.d(r,{A:()=>a});function a(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",s=process.env.DSQL_COOKIES_KEY_NAME||"key",a=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",t=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=s;let u=r;e?.userId&&(u+=`user_${e.userId}_`),o&&(u+=`${o}_`),u+=a;let l=r;return e?.userId&&(l+=`user_${e.userId}_`),o&&(l+=`${o}_`),{keyCookieName:i,csrfCookieName:u,oneTimeCodeName:l+=t}}}};var r=require("../../../webpack-api-runtime.js");r.C(e);var s=e=>r(r.s=e),a=r.X(0,[2319,3704],()=>s(21435));module.exports=a})();