"use strict";(()=>{vare={};e.id=8105,e.ids=[8105],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},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")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},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}}})},71405:(e,r,t)=>{t.r(r),t.d(r,{config:()=>v,default:()=>g,routeModule:()=>y});vars={};t.r(s),t.d(s,{default:()=>D});varn=t(89947),o=t(2706),a=t(96762),i=t(33873),c=t.n(i),l=t(48225),u=t.n(l),_=t(6420),d=t.n(_),S=t(48227),p=t.n(S),f=t(64122),m=t.n(f);letE=t(29021);asyncfunctionD(e,r){if("POST"!==e.method)returnr.json({msg:"Failed!"});lett=awaitd()(e,r,!0);if(!t)returnr.json({success:!1,msg:"Unauthorized"});lets=e.body,{media_name:n,media_url:o,media_thumbnail_url:a,media_path:i,media_thumbnail_path:l,folder:_}=s;"production".match(/production/);try{lete=s?.private==1;if(!process.env.DSQL_STATIC_SERVER_DIR)throwconsole.log("Static File ENV not Found!"),Error("No Static Path!");letn=p()({isPrivate:e,user:t,folder:s.folder?s.folder+"/":"",video:!!s.media_type?.match(/video/i)});if(!n)throwError("Couldn't grab paths!");let{fileRootPath:i,urlRootPath:l,relativePath:u}=n;_?.match(/./);letd=o.match(/[^\/]+$/)[0],S=a.match(/[^\/]+$/)[0],f=c().normalize(i+d),D=c().normalize(i+S);E.unlinkSync(f);try{E.unlinkSync(D)}catch(e){}awaitm()({dbFullName:"datasquirel",tableName:"user_media",identifierColumnName:"id",identifierValue:s.id}),r.json({success:!0})}catch(e){console.log("ERROR in deleting user media =>",e.message),u()({component:"/api/deleteUserMedia/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Database Files could not be written!"})}}letg=(0,a.M)(s,"default"),v=(0,a.M)(s,"config"),y=newn.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/deleteUserMedia",pathname:"/api/deleteUserMedia",bundlePath:"",filename:""},userland:s})},48227:(e,r,t)=>{lets=t(29021),n=t(33873);e.exports=function({isPrivate:e,user:r,folder:t,video:o,pathOnly:a}){"production".match(/production/);leti=r?.id||r?.user_id,c=process.env.DSQL_STATIC_SERVER_DIR;if(!c)returnconsole.log("Static File ENV not Found!"),null;letl=e?`@/${o?"videos":"media"}/${t?t+"/":""}`:o?`/videos/user-videos/user-${i}/${t?t+"/":""}`:`/images/user-images/user-${i}/${t?t+"/":""}`,u=e?`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${i}/media/${t?t+"/":""}`:n.join(c,l);returns.existsSync(u)||a||s.mkdirSync(u,{recursive:!0}),{fileRootPath:u,urlRootPath:e?`@/media/${t?t+"/":""}`:`${process.env.DSQL_STATIC_HOST}${l}`,relativePath:l}}},6420:(e,r,t)=>{t(81630);lets=t(51348),n=t(72835),o=t(29021),a=t(31341);asyncfunctioni(e,r,t,i){let{keyCookieName:c,csrfCookieName:l}=a();if(!e.cookies?.[c]?.match(/./))returnnull;letu=n({encryptedString:e.cookies[c]});if(!u)returnnull;let_=JSON.parse(u);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.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}/${_.csrf_k}`))returnnull;if(0==_.verification_status&&!t){lete=awaits(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return_?.date&&Date.now()-_.date>6048e5?null:_}e.exports=i},31341:e=>{e.exports=function(e){letr=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),n&&(o+=`${n}_`),o+=t;leta=r;returne?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),{keyCookieName:o,csrfCookieName:a+=s}}},64122:(e,r,t)=>{