"use strict";(()=>{var e={};e.id=7714,e.ids=[7714],e.modules={53524:e=>{e.exports=require("@prisma/client")},20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},95738:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>y,patchFetch:()=>v,requestAsyncStorage:()=>f,routeModule:()=>l,serverHooks:()=>m,staticGenerationAsyncStorage:()=>g});var n={};r.r(n),r.d(n,{GET:()=>d,POST:()=>c});var i=r(49303),a=r(88716),s=r(60670),o=r(87070),u=r(72331);async function p(e){let{searchParams:t}=new URL(e.url),r=t.get("userId")||e.headers.get("x-user-id");if(!r)return!1;let n=await u._.user.findUnique({where:{id:r}});return n?.role==="ADMIN"}async function d(e){if(!await p(e))return o.NextResponse.json({error:"Unauthorized"},{status:401});try{let e=await u._.systemConfig.findMany();return o.NextResponse.json(e)}catch(e){return o.NextResponse.json({error:"Failed to fetch configs"},{status:500})}}async function c(e){if(!await p(e))return o.NextResponse.json({error:"Unauthorized"},{status:401});try{let t=await e.json();return Array.isArray(t)?await u._.$transaction(t.map(e=>u._.systemConfig.upsert({where:{key:e.key},update:{value:String(e.value),description:e.description},create:{key:e.key,value:String(e.value),description:e.description}}))):await u._.systemConfig.upsert({where:{key:t.key},update:{value:String(t.value),description:t.description},create:{key:t.key,value:String(t.value),description:t.description}}),o.NextResponse.json({success:!0})}catch(e){return console.error("Config update error:",e),o.NextResponse.json({error:"Failed to update config"},{status:500})}}let l=new i.AppRouteRouteModule({definition:{kind:a.x.APP_ROUTE,page:"/api/admin/config/route",pathname:"/api/admin/config",filename:"route",bundlePath:"app/api/admin/config/route"},resolvedPagePath:"C:\\Users\\MSI\\Downloads\\film\\app\\api\\admin\\config\\route.ts",nextConfigOutput:"standalone",userland:n}),{requestAsyncStorage:f,staticGenerationAsyncStorage:g,serverHooks:m}=l,y="/api/admin/config/route";function v(){return(0,s.patchFetch)({serverHooks:m,staticGenerationAsyncStorage:g})}},72331:(e,t,r)=>{r.d(t,{_:()=>i});var n=r(53524);let i=global.prisma||new n.PrismaClient}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),n=t.X(0,[8948,5972],()=>r(95738));module.exports=n})();