"use strict";(()=>{vare={};e.id=7402,e.ids=[7402],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},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")},21820:e=>{e.exports=require("os")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){returnfunctione(r,t){returntinr?r[t]:"then"inr&&"function"==typeofr.then?r.then(r=>e(r,t)):"function"==typeofr&&"default"===t?r:void0}}})},87476:(e,r,t)=>{t.r(r),t.d(r,{config:()=>m,default:()=>E,routeModule:()=>y});varn={};t.r(n),t.d(n,{default:()=>S});vars=t(89947),o=t(2706),i=t(96762),a=t(29021),l=t.n(a),c=t(21820),u=t.n(c),d=t(79646),p=t(67619);asyncfunction_({dbName:e,user:r,res:t}){letn=u().platform().match(/win/i)?"'C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\\mysqldump.exe'":"mysqldump";try{lets={cwd:process.cwd()},o=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${r.id}/export.sql`;u().platform().match(/win/i)&&(s.shell="bash.exe");leti=`${n} -u ${process.env.DSQL_DB_USERNAME} -h ${process.env.DSQL_DB_HOST} -p${process.env.DSQL_DB_PASSWORD}${e} > ${o}`;console.log(`exportDb.ts exe => ${i}`),(0,d.execSync)(i,s),t.setHeader("Content-Type","application/zip"),t.setHeader("Content-Disposition","attachment; filename=export.sql"),l().createReadStream(o).pipe(t)}catch(e){(0,p.default)({component:"/functions/backend/exportDb/lines-30-46",message:e.message,user:r})}}varf=t(69842);asyncfunctionS(e,r){if("GET"!==e.method)returnr.json({msg:"Failed!"});lett=await(0,f.A)(e,r,!0);if(!t)returnr.json({success:!1,msg:"Unauthorized"});let{dbName:n}=e.query;await_({dbName:n?.toString()||"",res:r,user:t})}letE=(0,i.M)(n,"default"),m=(0,i.M)(n,"config"),y=news.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/exportDatabase",pathname:"/api/exportDatabase",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>l});varn=t(48786),s=t(95969),o=t(29021),i=t.n(o),a=t(89159);asyncfunctionl(e,r,t){let{keyCookieName:o,csrfCookieName:l}=(0,a.A)();if(!e.cookies?.[o]?.match(/./))returnnull;letc=(0,s.A)({encryptedString:e.cookies[o]});if(!c)returnnull;letu=JSON.parse(c);if(!u.csrf_k||t&&!Object.keys(e.headers).find(e=>e.includes(u.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}/${u.csrf_k}`))returnnull;if(0==u.verification_status&&!t){lete=await(0,n.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"])}returnu?.date&&Date.now()-u.date>6048e5?null:u}},89159:(e,r,t)=>{t.d(r,{A:()=>n});functionn(e){letr=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",n=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",s=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+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=t;leta=r;e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),a+=n;letl=r;returne?.userId&&(l+=`user_${e.userId}_`),o&&(l+=`${o}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:l+=s}}},67619:(e,r,t)=>{t.r(r),t.d(r,{default:()=>o});varn=t(29021),s=t.n(n);asyncfunctiono({user:e,message:r,component:t,noMail:n,req:o}){leti=newDate,a=(()=>{if(!o)returnnull;try{lete=o.headers["x-forwarded-for"],r=o.headers["x-real-ip"],t=o.headers["cf-connecting-ip"],n=Array.isArray(e)?e[0]:e?.split(",")[0],s=t||n||r||o.socket.remoteAddress;if(!s)returnnull;returnString(s)}catch(e){returnnull}})();try{letn=`🚀 SERVER ERROR ===========================