"use strict";(()=>{vare={};e.id=2127,e.ids=[2127],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},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}}})},63311:(e,r,t)=>{t.r(r),t.d(r,{config:()=>_,default:()=>d,routeModule:()=>f});varn={};t.r(n),t.d(n,{default:()=>l});vars=t(89947),i=t(2706),o=t(96762),a=t(29021),u=t.n(a),c=t(69842);asyncfunctionl(e,r){if("POST"!==e.method)returnr.json({success:!1,msg:"Failed!"});lett=await(0,c.A)(e,r,!0);if(!t)returnr.json({success:!1,msg:"Unauthorized"});try{letn=JSON.parse(e.body).path.replace(/ /g,"").replace(/\.\./g,"");if(n?.match(/\.\./))returnr.json({success:!1,msg:"Error!",error:"Invalid url"});lets=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${t.id.toString().replace(/\//g,"")}`,i=n.replace(/\@/,s);u().createReadStream(i).pipe(r)}catch(e){console.log("ERROR in getPrivateMedia api route:",e.message),r.json({success:!1,msg:"Error!",error:e})}}letd=(0,o.M)(n,"default"),_=(0,o.M)(n,"config"),f=news.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/media/getPrivateMedia",pathname:"/api/media/getPrivateMedia",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>u});varn=t(48786),s=t(95969),i=t(29021),o=t.n(i),a=t(89159);asyncfunctionu(e,r,t){let{keyCookieName:i,csrfCookieName:u}=(0,a.A)();if(!e.cookies?.[i]?.match(/./))returnnull;letc=(0,s.A)({encryptedString:e.cookies[i]});if(!c)returnnull;letl=JSON.parse(c);if(!l.csrf_k||t&&!Object.keys(e.headers).find(e=>e.includes(l.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&&!o().existsSync(`${d}/${l.csrf_k}`))returnnull;if(0==l.verification_status&&!t){lete=await(0,n.A)(`SELECT verification_status FROM users WHERE id='${l.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}returnl?.date&&Date.now()-l.date>6048e5?null:l}},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",i=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),i&&(o+=`${i}_`),o+=t;leta=r;e?.userId&&(a+=`user_${e.userId}_`),i&&(a+=`${i}_`),a+=n;letu=r;returne?.userId&&(u+=`user_${e.userId}_`),i&&(u+=`${i}_`),{keyCookieName:o,csrfCookieName:a,oneTimeCodeName:u+=s}}},95969:(e,r,t)=>{t.d(r,{A:()=>i});varn=t(55511),s=t(79428);functioni({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))returnconsole.log("Encrypted string is invalid"),e;leti=r||process.env.DSQL_ENCRYPTION_PASSWORD,o=t||process.env.DSQL_ENCRYPTION_SALT,a=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!i?.match(/.{8,}/))returnconsole.log("Decrption key is invalid"),e;if(!o?.match(/.{8,}/))returnconsole.log("Decrption salt is invalid"),e;letu=(0,n.scryptSync)(i,o,a),c=s.Buffer.alloc(16,0),l=(0,n.createDecipheriv)("aes-192-cbc",u,c);try{letr=l.update(e,"hex","utf8");returnr+=l.final("utf8")}catch(r){returnconsole.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>n});asyncfunctionn(...e){letr=global.DSQL_DB_CONN;try{if(!r)throwError("No Connection provided to DB_HANDLER function!");lett=awaitr.query(...e);returnJSON.parse(JSON.stringify(t))}catch(e){returnconsole.log("DB Error =>",e),{success:!1,error:e.message}}finally{awaitr?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){returnt}});vart=function(e){returne.PAGES="PAGES",e.PAGES_API="PAG