"use strict";(()=>{vare={};e.id=1132,e.ids=[1132],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")},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}}})},18885:(e,r,t)=>{t.r(r),t.d(r,{config:()=>g,default:()=>f,routeModule:()=>E});vara={};t.r(a),t.d(a,{default:()=>p});varn=t(89947),s=t(2706),o=t(96762),i=t(77377),l=t(31495),u=t(60125),c=t(67619),d=t(69842),_=t(30802);asyncfunctionp(e,r){if("POST"!==e.method)returnr.json({msg:"Failed!"});lett=await(0,d.A)(e,r,!0);if(!t)returnr.json({success:!1,msg:"Unauthorized"});let{dbSlug:a,tableName:n,payload:s,entryId:o,tableSchema:p,delegated:f,dbId:g}=e.body;deletes.id,deletes.uuid,deletes.date_created,deletes.date_created_code,deletes.date_created_timestamp,deletes.date_updated,deletes.date_updated_code,deletes.date_updated_timestamp;try{letc=await(0,u.A)({databaseSlug:a,request:e,user:t,query:e.query}),d=c?.rootUserId?`datasquirel_user_${c.rootUserId}_${a}`:`datasquirel_user_${t.id}_${a}`;if(!await(0,l.A)({user:t,confirmedDelegetedUser:c,database:a,table:n,dbId:g,priviledgeRegex:/Update Entries/i}))returnr.json({success:!1,msg:"Unauthorized"});letf=await(0,_.A)({dbContext:"Dsql User",paradigm:"Full Access",dbFullName:d,tableName:n,identifierColumnName:"id",identifierValue:o,data:s,tableSchema:p});if(f?.error)throwError(f.error);if(!f)throwError("No result returned!");await(0,i.A)({dbName:d,entryId:o,entryOrder:s.order,tableName:n,tableSchema:p}),r.json({success:!0,payload:f})}catch(e){(0,c.default)({component:"/api/updateTableEntry/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Database Files could not be written!",err:e.message})}}letf=(0,o.M)(a,"default"),g=(0,o.M)(a,"config"),E=newn.PagesAPIRouteModule({definition:{kind:s.A.PAGES_API,page:"/api/updateTableEntry",pathname:"/api/updateTableEntry",bundlePath:"",filename:""},userland:a})},31495:(e,r,t)=>{t.d(r,{A:()=>s});vara=t(48786),n=t(67619);asyncfunctions({user:e,confirmedDelegetedUser:r,database:t,table:s,priviledgeRegex:o,dbId:i}){letl,u;try{r?.delegated?(l=await(0,a.A)("SELECT priviledge FROM delegated_user_tables WHERE root_user_id=? AND delegated_user_id=? AND `database`=? AND `table`=?",[r.rootUserId,e.id,t,s]),u=l[0]?.priviledge?.match(o)):(l=await(0,a.A)("SELECT table_slug FROM user_database_tables WHERE user_id=? AND table_slug=? AND db_id=?",[e.id,s,i]),u=!0)}catch(r){(0,n.default)({component:"checkUserRights",message:r.message,user:e})}return!!l&&!!l[0]&&!!u}},60125:(e,r,t)=>{t.d(r,{A:()=>n});vara=t(95969);asyncfunctionn({request:e,databaseSlug:r,user:t,query:n}){try{lets=t.id,o=null;if(!n?.delegated)return{dbUserId:s};leti=n.dbUserId,l=`${process.env.DSQL_USER_DB_PREFIX}${i}_${r}`,u=`${process.env.DSQL_USER_DELEGATED_DB_COOKIE_PREFIX}${l}`;try{if(!e.cookies?.[u])throwError("Cookie not present");lett=(0,a.A)({encryptedString:e.cookies[u]});if(!t)throwError("Invalid Token");if((o=JSON.parse(t)).databaseSlug===r)return{dbUserId:s=o.rootUserId,rootUserId:o.rootUserId,rootUserName:o.rootUserName,rootUserEmail:o.rootUserEmail,rootUserImage:o.rootUserImage,databaseFullName:o.databaseFullName,databaseSlug:o.databaseSlug,allowedTables:o.allowedTables,priviledges:o.priviledges,database:o.databaseSlug,delegated:!0}}catch(e){}return{dbUserId:s}}catch(e){returnnull}}},77377:(e,r,t)=>{t.d(r,{A:()=>n});leta=t(37275);asyncfunctionn({dbName:e,entryId:r,entryOrder:t,tableName:n,tableSchema:s}){try{if(s.fields.find(e=>!!e.fieldName?.match(/^order$/i))&&t){lets=awaita({database:e,paradigm:"Full Access",queryString:`SELECT * FROM ${n} WHERE \`order\` = '${t}' AND id != ?`,queryValues:[String(r)]});if(!s?.[0])throwError("No Existing Order");awaita({