"use strict";(()=>{vare={};e.id=4727,e.ids=[4727],e.modules={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")},27310:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>d,routeModule:()=>_});vars={};t.r(s),t.d(s,{config:()=>u,default:()=>c});vara=t(89947),n=t(2706),i=t(96762),l=t(69842),o=t(33170);letu={api:{responseLimit:"1mb",bodyParser:{sizeLimit:"200mb"}}};asyncfunctionc(e,r){if("POST"!==e.method)returnr.json({msg:"Failed!"});lett=await(0,l.A)(e,r,!0);if(!t)returnr.json({success:!1,msg:"Unauthorized"});let{paradigm:s,dbName:a,tableName:n,payload:i}=e.body;try{lete=await(0,o.A)({dbName:a,paradigm:s,payload:i,tableName:n,userId:t.id,payloadType:"base64"});if(!e)returnr.json({success:!1,msg:"Operation Failed!"});r.json({success:!0,msg:"Success!",data:e?.tableData})}catch(e){r.json({success:!1,msg:e.message})}}letd=(0,i.M)(s,"default"),p=(0,i.M)(s,"config"),_=newa.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/exportTableData",pathname:"/api/exportTableData",bundlePath:"",filename:""},userland:s})},33170:(e,r,t)=>{t.d(r,{A:()=>i});vars=t(98e3),a=t(67619),n=t(48786);asyncfunctioni({paradigm:e,userId:r,dbName:t,tableName:i,payload:l,payloadType:o}){letu={};try{leta=`${process.env.DSQL_USER_DB_PREFIX}${r}_${t.replace(/ /g,"")}`;switch(e){case"export":letc=await(0,n.A)(`SELECT * FROM \`${a}\`.\`${i}\``);u.tableData=c;break;case"import":letd="base64"==o?Buffer.from(l,"base64").toString():l,p="object"===o?l:JSON.parse(d);for(lete=0;e<p.length;e++){letr=p[e],t=await(0,s.A)({data:r,dbFullName:a,tableName:i,dbContext:"Dsql User",paradigm:"Full Access",duplicateColumnName:"id",duplicateColumnValue:r?.id,update:!0});if(t.error)throwError(t.error)}break;default:returnnull}returnu}catch(e){return(0,a.default)({component:"/functions/backend/importExportTableDataFn",message:e.message}),null}}},69842:(e,r,t)=>{t.d(r,{A:()=>o});vars=t(48786),a=t(95969),n=t(29021),i=t.n(n),l=t(89159);asyncfunctiono(e,r,t){let{keyCookieName:n,csrfCookieName:o}=(0,l.A)();if(!e.cookies?.[n]?.match(/./))returnnull;letu=(0,a.A)({encryptedString:e.cookies[n]});if(!u)returnnull;letc=JSON.parse(u);if(!c.csrf_k||t&&!Object.keys(e.headers).find(e=>e.includes(c.csrf_k)))returnnull;letd=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)returnconsole.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!i().existsSync(`${d}/${c.csrf_k}`))returnnull;if(0==c.verification_status&&!t){lete=await(0,s.A)(`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}},89159:(e,r,t)=>{t.d(r,{A:()=>s});functions(e){letr=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",a=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",n=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),i+=t;letl=r;e?.userId&&(l+=`user_${e.userId}_`),n&&(l+=`${n}_`),l+=s;leto=r;returne?.userId&&(o+=`user_${e.userId}_`),n&&(o+=`${n}_`),{keyCookieName:i,csrfCookieName:l,oneTimeCodeName:o+=a}}},67619:(e,r,t)=>{t.r(r),t.d(r,{default:()=>n});vars=t(29021),a=t.n(s);asyncfunctionn({user:e,message:r,component:t,noMail:s,req:n}){leti=newDate,l=(()=>{if(!n)returnnull;try{lete=n.headers["x-forwarded-for"],r=n.headers["x-real-ip"],t=n.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],a=t||s||r||n.socket.remoteAddress;if(!a)returnnull;returnString(a)}catch(e){returnnull}})();try{lets=`🚀 SERVER ERROR ===========================