"use strict";(()=>{vare={};e.id=8935,e.ids=[8935],e.modules={39908:e=>{e.exports=require("@moduletrace/datasquirel/dist/users/user-auth")},27825:e=>{e.exports=require("lodash")},75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},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")},34042:(e,r,t)=>{t.r(r),t.d(r,{config:()=>g,default:()=>p,routeModule:()=>f});vara={};t.r(a),t.d(a,{default:()=>_});vari=t(89947),s=t(2706),n=t(96762),l=t(69842),d=t(67619),u=t(27825),o=t.n(u),m=t(48786),c=t(98e3);asyncfunction_(e,r){if("POST"!==e.method)returnr.json({user:null,msg:"Registration Failed!"});lett=await(0,l.A)(e,r,!0);if(!t)returnr.json({success:!1,msg:"Unauthorized"});leta=o().cloneDeep(e.body),i=a.inviting_user_id,s=a.invited_user_email,n=a.database_access,u=a.priviledge;try{lete=await(0,m.A)("SELECT email FROM user_users WHERE user_id=? AND invited_user_id=? AND user_type='admin' AND email=?",[i,t.id,t.email]);if(e&&e[0])returnr.json({success:!1});leta=await(0,c.A)({dbFullName:"datasquirel",tableName:"user_users",data:{user_id:i,invited_user_id:t.id,database_access:n,user_priviledge:u,user_type:"admin",first_name:t.first_name,last_name:t.last_name,email:t.email,username:t.first_name,image:t.image,image_thumbnail:t.image_thumbnail}});await(0,m.A)("UPDATE invitations SET invitation_status='Accepted' WHERE inviting_user_id=? AND invited_user_email=?",[i,s]);letl=await(0,m.A)("SELECT db_tables_data FROM invitations WHERE inviting_user_id=?",[i]);if(await(0,m.A)(`DELETE FROM delegated_user_tables WHERE root_user_id='${i}' AND delegated_user_id='${t.id}'`),l&&l[0]){lete=l[0].db_tables_data.split("|");for(letr=0;r<e.length;r++){let[a,s]=e[r].split("-");await(0,c.A)({dbFullName:"datasquirel",tableName:"delegated_user_tables",data:{delegated_user_id:t.id,root_user_id:i,database:a,table:s,priviledge:u}})}}r.json({success:!!a?.insertId})}catch(a){(0,d.A)({component:"/api/acceptUserInvitation/catch-error",message:a.message,user:t,req:e}),r.json({success:!1})}}letp=(0,n.M)(a,"default"),g=(0,n.M)(a,"config"),f=newi.PagesAPIRouteModule({definition:{kind:s.A.PAGES_API,page:"/api/acceptUserInvitation",pathname:"/api/acceptUserInvitation",bundlePath:"",filename:""},userland:a})},69842:(e,r,t)=>{t.d(r,{A:()=>s});vara=t(39908),i=t.n(a);asyncfunctions(e,r,t){leta=i()({req:e,level:t?"deep":void0});returnconsole.log(a),a.payload}},67619:(e,r,t)=>{t.d(r,{A:()=>s});vara=t(29021),i=t.n(a);asyncfunctions({user:e,message:r,component:t,noMail:a,req:s}){letn=newDate,l=(()=>{if(!s)returnnull;try{lete=s.headers["x-forwarded-for"],r=s.headers["x-real-ip"],t=s.headers["cf-connecting-ip"],a=Array.isArray(e)?e[0]:e?.split(",")[0],i=t||a||r||s.socket.remoteAddress;if(!i)returnnull;returnString(i)}catch(e){returnnull}})();try{leta=`🚀 SERVER ERROR ===========================