"use strict";(()=>{vare={};e.id=3812,e.ids=[3812],e.modules={27825:e=>{e.exports=require("lodash")},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")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},21110:(e,s,t)=>{t.r(s),t.d(s,{config:()=>h,default:()=>g,routeModule:()=>E});varr={};t.r(r),t.d(r,{default:()=>S});vara=t(89947),i=t(2706),n=t(96762),l=t(59474),o=t.n(l),d=t(6420),u=t.n(d),c=t(47670),_=t.n(c),p=t(51348),m=t.n(p),f=t(14533),v=t.n(f);asyncfunctionS(e,s){if("POST"!==e.method)returns.json({msg:"Failed!"});lett=awaitu()(e,s,!0);if(!t)returns.json({success:!1,msg:"Unauthorized"});letr=e.body,a=r.paradigm;if(a?.match(/database/)){lete=await_()({dbFullName:"datasquirel",tableName:"user_users",data:(()=>{lete=Object.keys(r),s={};returne.forEach(e=>{e?.match(/paradigm|priviledge|database_access|databases|confirm/)||(s[e]=r[e])}),s.user_id=t.id,s.password=v()({encryptionKey:process.env.DSQL_ENCRYPTION_PASSWORD||"",password:r.password}),s.user_type="database",s.email=r.email_address,s.image="/images/user-preset.png",s.image_thumbnail="/images/user-preset-thumbnail.png",deletes.email_address,s})()});s.json({success:!!e?.insertId,msg:"New User User Added",newUserId:e.insertId})}else{if(t?.email===r.email_address)returns.json({success:!1,msg:"Can't Invite yourself"});lete=awaitm()("SELECT * FROM invitations WHERE invited_user_email=? AND inviting_user_id=?",[r.email_address,t.id]);if(e&&e[0])returns.json({success:!1,msg:"User Already Invited"});await_()({dbFullName:"datasquirel",tableName:"invitations",data:{inviting_user_id:t.id,invited_user_email:r.email_address,database_access:r.database_access,priviledge:r.priviledge,db_tables_data:r.db_tables}});leta=awaito()({to:r.email_address,subject:`${t.first_name}${t.last_name} Invited you`,text:`${t.first_name}${t.last_name} has invited you to manage a datasquirel account`,html:`