"use strict";(()=>{var e={};e.id=2376,e.ids=[2376],e.modules={72934:e=>{e.exports=require("next/dist/client/components/action-async-storage.external.js")},54580:e=>{e.exports=require("next/dist/client/components/request-async-storage.external.js")},45869:e=>{e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},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")},78893:e=>{e.exports=require("buffer")},84770:e=>{e.exports=require("crypto")},76162:e=>{e.exports=require("stream")},21764:e=>{e.exports=require("util")},1113:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>m,patchFetch:()=>h,requestAsyncStorage:()=>l,routeModule:()=>p,serverHooks:()=>f,staticGenerationAsyncStorage:()=>x});var s={};r.r(s),r.d(s,{DELETE:()=>d});var n=r(49303),a=r(88716),i=r(60670),o=r(87070),u=r(8194),c=r(95456);async function d(e,{params:t}){try{let e=await (0,c.ts)();if(!e)return o.NextResponse.json({error:"Unauthorized"},{status:401});let{id:r}=await t;if(!await u._.accessCode.findFirst({where:{id:r,store:{tenantId:e.tenantId}}}))return o.NextResponse.json({error:"Kode tidak ditemukan"},{status:404});return await u._.accessCode.update({where:{id:r},data:{isActive:!1}}),o.NextResponse.json({message:"Kode dinonaktifkan"})}catch{return o.NextResponse.json({error:"Server error"},{status:500})}}let p=new n.AppRouteRouteModule({definition:{kind:a.x.APP_ROUTE,page:"/api/access-codes/[id]/route",pathname:"/api/access-codes/[id]",filename:"route",bundlePath:"app/api/access-codes/[id]/route"},resolvedPagePath:"D:\\PROJECT\\resto-saas\\src\\app\\api\\access-codes\\[id]\\route.ts",nextConfigOutput:"",userland:s}),{requestAsyncStorage:l,staticGenerationAsyncStorage:x,serverHooks:f}=p,m="/api/access-codes/[id]/route";function h(){return(0,i.patchFetch)({serverHooks:f,staticGenerationAsyncStorage:x})}},95456:(e,t,r)=>{r.d(t,{Gv:()=>p,MH:()=>m,PT:()=>h,RA:()=>l,WX:()=>x,c_:()=>d,ts:()=>f});var s=r(41482),n=r.n(s),a=r(42023),i=r.n(a),o=r(71615),u=r(8194);let c=process.env.JWT_SECRET||"fallback-secret-change-me";async function d(e){return i().hash(e,12)}async function p(e,t){return i().compare(e,t)}function l(e){return n().sign(e,c,{expiresIn:"7d"})}function x(e){try{return n().verify(e,c)}catch{return null}}async function f(){let e=await (0,o.cookies)(),t=e.get("token")?.value;if(!t)return null;let r=x(t);return r?await u._.user.findUnique({where:{id:r.userId},include:{tenant:!0,store:!0}}):null}function m(e,t){return t.includes(e)}function h(e){return!["owner","admin"].includes(e.role)&&!!e.storeId&&!!e.store&&!e.store.isActive}},8194:(e,t,r)=>{r.d(t,{_:()=>n});let s=require("@prisma/client"),n=globalThis.prisma??new s.PrismaClient}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),s=t.X(0,[8948,5972,4261,2023],()=>r(1113));module.exports=s})();