"use strict";(()=>{vare={};e.id=294,e.ids=[294],e.modules={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")},79646:e=>{e.exports=require("child_process")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},98397:(e,r,t)=>{t.r(r),t.d(r,{config:()=>S,default:()=>E,routeModule:()=>m});vars={};t.r(s),t.d(s,{default:()=>f});vari=t(89947),a=t(2706),n=t(96762),o=t(51348),l=t.n(o),u=t(6420),d=t.n(u),c=t(47670),_=t.n(c);t(29021),t(33873);let{execSync:p}=t(79646);asyncfunctionf(e,r){if("POST"!==e.method)returnr.json({msg:"Failed!"});lett=awaitd()(e,r,!0);if(!t)returnr.json({success:!1,msg:"Unauthorized"});let{userObject:s,database_access:i,user_priviledge:a,db_tables:n,inv_user_id:o}=e.body,u=awaitl()("UPDATE user_users SET database_access = ? ,user_priviledge = ? WHERE user_id = ? AND email = ?",[i,a,t.id,s.email]),c=n.split("|");awaitl()(`DELETE FROM delegated_user_tables WHERE root_user_id='${t.id}' AND delegated_user_id='${o}'`);for(lete=0;e<c.length;e++){let[r,s]=c[e].split("-");await_()({dbFullName:"datasquirel",tableName:"delegated_user_tables",data:{delegated_user_id:o,root_user_id:t.id,database:r,table:s,priviledge:a}})}r.json({success:!!u?.affectedRows})}letE=(0,n.M)(s,"default"),S=(0,n.M)(s,"config"),m=newi.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/updateAdminUserAccess",pathname:"/api/updateAdminUserAccess",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);lets=t(51348),i=t(72835),a=t(29021),n=t(31341);asyncfunctiono(e,r,t,o){let{keyCookieName:l,csrfCookieName:u}=n();if(!e.cookies?.[l]?.match(/./))returnnull;letd=i({encryptedString:e.cookies[l]});if(!d)returnnull;letc=JSON.parse(d);if(!c.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${c.csrf_k}`)))returnnull;let_=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!_)returnconsole.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!a.existsSync(`${_}/${c.csrf_k}`))returnnull;if(0==c.verification_status&&!t){lete=awaits(`SELECT verification_status FROM users WHERE id='${c.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}returnc?.date&&Date.now()-c.date>6048e5?null:c}e.exports=o},31341:e=>{e.exports=function(){lete=process.env.DSQL_COOKIES_PREFIX||"dsql_";return{keyCookieName:e+(process.env.DSQL_COOKIES_KEY_NAME||"key"),csrfCookieName:e+(process.env.DSQL_COOKIES_CSRF_NAME||"csrf")}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:i}=t(55511),{Buffer:a}=t(79428);e.exports=({encryptedString:e,encryptionKey:r,encryptionSalt:t})=>{if(!e?.match(/./))returnconsole.log("Encrypted string is invalid"),e;letn=r||process.env.DSQL_ENCRYPTION_PASSWORD,o=t||process.env.DSQL_ENCRYPTION_SALT,l=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!n?.match(/.{8,}/))returnconsole.log("Decrption key is invalid"),e;if(!o?.match(/.{8,}/))returnconsole.log("Decrption salt is invalid"),e;letu=i("aes-192-cbc",s(n,o,l),a.alloc(16,0));try{letr=u.update(e,"hex","utf8");returnr+=u.final("utf8")}catch(r){returnconsole.log("Error in decrypting =>",r.message),e}}}};varr=require("../../webpack-api-runtime.js");r.C(e);vart=e=>r(r.s=e),s=r.X(0,[4050],()=>t(98397));module.exports=s})();