"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:()=>f});vars={};t.r(s),t.d(s,{config:()=>c,default:()=>u});vara=t(89947),o=t(2706),n=t(96762),i=t(69842),l=t(33170);letc={api:{responseLimit:"1mb",bodyParser:{sizeLimit:"200mb"}}};asyncfunctionu(e,r){if("POST"!==e.method)returnr.json({msg:"Failed!"});lett=await(0,i.A)(e,r,!0);if(!t)returnr.json({success:!1,msg:"Unauthorized"});let{paradigm:s,dbName:a,tableName:o,payload:n}=e.body;try{lete=await(0,l.A)({dbName:a,paradigm:s,payload:n,tableName:o,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,n.M)(s,"default"),p=(0,n.M)(s,"config"),f=newa.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/exportTableData",pathname:"/api/exportTableData",bundlePath:"",filename:""},userland:s})},33170:(e,r,t)=>{t.d(r,{A:()=>n});vars=t(98e3),a=t(67619),o=t(48786);asyncfunctionn({paradigm:e,userId:r,dbName:t,tableName:n,payload:i,payloadType:l}){letc={};try{leta=`${process.env.DSQL_USER_DB_PREFIX}${r}_${t.replace(/ /g,"")}`;switch(e){case"export":letu=await(0,o.A)(`SELECT * FROM \`${a}\`.\`${n}\``);c.tableData=u;break;case"import":letd="base64"==l?Buffer.from(i,"base64").toString():i,p="object"===l?i:JSON.parse(d);for(lete=0;e<p.length;e++){letr=p[e],t=await(0,s.A)({data:r,dbFullName:a,tableName:n,dbContext:"Dsql User",paradigm:"Full Access",duplicateColumnName:"id",duplicateColumnValue:r?.id,update:!0});if(t.error)throwError(t.error)}break;default:returnnull}returnc}catch(e){return(0,a.A)({component:"/functions/backend/importExportTableDataFn",message:e.message}),null}}},69842:(e,r,t)=>{t.d(r,{A:()=>l});vars=t(48786),a=t(95969),o=t(29021),n=t.n(o),i=t(89159);asyncfunctionl(e,r,t){try{let{keyCookieName:o,csrfCookieName:l}=(0,i.A)();if(!e.cookies?.[o]?.match(/./))throwError("Request Cookies not Found!");letc=(0,a.A)({encryptedString:e.cookies[o]});if(!c)throwError("Couldn't decrypt auth cookie!");letu=JSON.parse(c);if(!u.csrf_k)throwError("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throwconsole.log("req.headers",e.headers),console.log("userObject",u),Error("Deep Auth Failed. `csrf` key not found in request headers!");letd=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throwError("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!n().existsSync(`${d}/${u.csrf_k}`))throwError("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){lete=await(0,s.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throwError("Key expired!");returnu}catch(e){returnconsole.log(`userAuth Error: ${e.message}`),null}}},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",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),n=r;e?.userId&&(n+=`user_${e.userId}_`),o&&(n+=`${o}_`),n+=t;leti=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=s;letl=r;returne?.userId&&(l+=`user_${e.userId}_`),o&&(l+=`${o}_`),{keyCookieName:n,csrfCookieName:i,oneTimeCodeName:l+=a}}},67619:(e,r,t)=>{t.d(r,{A:()=>o});vars=t(29021),a=t.n(s);asyncfunctiono({user:e,message:r,component:t,noMail:s,req:o}){letn=newDate,i=(()=>{if(!o)returnnull;try{lete=o.headers["x-forwarded-for"],