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