"use strict";(()=>{vare={};e.id=8105,e.ids=[8105],e.modules={39908:e=>{e.exports=require("@moduletrace/datasquirel/dist/users/user-auth")},75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},9973:e=>{e.exports=require("serverless-mysql")},29021:e=>{e.exports=require("fs")},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}}})},5134:(e,r,t)=>{t.r(r),t.d(r,{config:()=>D,default:()=>m,routeModule:()=>A});varn={};t.r(n),t.d(n,{default:()=>f});vars=t(89947),o=t(2706),a=t(96762),i=t(29021),l=t.n(i),u=t(33873),c=t.n(u),d=t(67619),S=t(69842),p=t(45185),_=t(61932);asyncfunctionf(e,r){if("POST"!==e.method)returnr.json({msg:"Failed!"});lett=await(0,S.A)(e,r,!0);if(!t)returnr.json({success:!1,msg:"Unauthorized"});letn=e.body,{media_name:s,media_url:o,media_thumbnail_url:a,media_path:i,media_thumbnail_path:u,folder:f}=n;"production".match(/production/);try{lete=n?.private==1;if(!process.env.DSQL_STATIC_SERVER_DIR)throwconsole.log("Static File ENV not Found!"),Error("No Static Path!");lets=(0,p.A)({isPrivate:e,userId:t.id,folder:n.folder?n.folder+"/":"",video:!!n.media_type?.match(/video/i)});if(!s)throwError("Couldn't grab paths!");let{fileRootPath:i,urlRootPath:u,relativePath:d}=s;f?.match(/./);letS=o.match(/[^\/]+$/)[0],m=a.match(/[^\/]+$/)[0],D=c().normalize(i+S),A=c().normalize(i+m);l().unlinkSync(D);try{l().unlinkSync(A)}catch(e){}await(0,_.A)({dbFullName:"datasquirel",tableName:"user_media",identifierColumnName:"id",identifierValue:n.id}),r.json({success:!0})}catch(e){console.log("ERROR in deleting user media =>",e.message),(0,d.A)({component:"/api/deleteUserMedia/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Database Files could not be written!"})}}letm=(0,a.M)(n,"default"),D=(0,a.M)(n,"config"),A=news.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/deleteUserMedia",pathname:"/api/deleteUserMedia",bundlePath:"",filename:""},userland:n})},45185:(e,r,t)=>{t.d(r,{A:()=>i});varn=t(29021),s=t.n(n),o=t(33873),a=t.n(o);functioni({isPrivate:e,userId:r,folder:t,video:n,pathOnly:o}){"production".match(/production/);leti=process.env.DSQL_STATIC_SERVER_DIR;if(!i)returnconsole.log("Static File ENV not Found!"),null;letl=e?`@/${n?"videos":"media"}/${t?t+"/":""}`:n?`/videos/user-videos/user-${r}/${t?t+"/":""}`:`/images/user-images/user-${r}/${t?t+"/":""}`,u=e?`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${r}/media/${t?t+"/":""}`:a().join(i,l);returns().existsSync(u)||o||s().mkdirSync(u,{recursive:!0}),{fileRootPath:u,urlRootPath:e?`@/media/${t?t+"/":""}`:`${process.env.DSQL_STATIC_HOST}${l}`,relativePath:l}}},69842:(e,r,t)=>{t.d(r,{A:()=>o});varn=t(39908),s=t.n(n);asyncfunctiono(e,r,t){letn=s()({req:e,level:t?"deep":void0});returnconsole.log(n),n.payload}},61932:(e,r,t)=>{t.d(r,{A:()=>a});varn=t(48786),s=t(37897),o=t(62050);asyncfunctiona({dbContext:e,paradigm:r,dbFullName:t,tableName:a,identifierColumnName:i,identifierValue:l,useLocal:u}){try{letc=!!u||!e?.match(/dsql.user/i)&&(!t||!!t.match(/^datasquirel$/)),d=u?o.A:c?n.A:s.A,S=`DELETE FROM \`${t}\`.\`${a}\` WHERE \`${i}\`=?`;returnc?awaitd(S,[l]):awaitd({paradigm:r,queryString:S,queryValues:[l]})}catch(e){returnnull}}},67619:(e,r,t)=>{t.d(r,{A:()=>o});varn=t(29021),s=t.n(n);asyncfunctiono({user:e,message:r,component:t,noMail:n,req:o}){leta=newDate,i=(()=>{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 ===========================