"use strict";(()=>{var e={};e.id=9405,e.ids=[9405],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")},30822:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>h,patchFetch:()=>w,requestAsyncStorage:()=>f,routeModule:()=>p,serverHooks:()=>m,staticGenerationAsyncStorage:()=>x});var n={};t.r(n),t.d(n,{DELETE:()=>d,PUT:()=>l});var s=t(49303),o=t(88716),a=t(60670),i=t(87070),u=t(8194),c=t(95456);async function l(e,{params:r}){try{let t=await (0,c.ts)();if(!t)return i.NextResponse.json({error:"Unauthorized"},{status:401});let{id:n}=await r,{name:s,sortOrder:o}=await e.json(),a=await u._.floorArea.findFirst({where:{id:n},include:{store:!0}});if(!a||a.store.tenantId!==t.tenantId)return i.NextResponse.json({error:"Not found"},{status:404});let l=await u._.floorArea.update({where:{id:n},data:{...s?.trim()&&{name:s.trim()},...void 0!==o&&{sortOrder:o}}});return i.NextResponse.json({floorArea:l})}catch{return i.NextResponse.json({error:"Server error"},{status:500})}}async function d(e,{params:r}){try{let e=await (0,c.ts)();if(!e)return i.NextResponse.json({error:"Unauthorized"},{status:401});let{id:t}=await r,n=await u._.floorArea.findFirst({where:{id:t},include:{store:!0}});if(!n||n.store.tenantId!==e.tenantId)return i.NextResponse.json({error:"Not found"},{status:404});return await u._.floorArea.delete({where:{id:t}}),i.NextResponse.json({success:!0})}catch{return i.NextResponse.json({error:"Server error"},{status:500})}}let p=new s.AppRouteRouteModule({definition:{kind:o.x.APP_ROUTE,page:"/api/floor-areas/[id]/route",pathname:"/api/floor-areas/[id]",filename:"route",bundlePath:"app/api/floor-areas/[id]/route"},resolvedPagePath:"D:\\PROJECT\\resto-saas\\src\\app\\api\\floor-areas\\[id]\\route.ts",nextConfigOutput:"",userland:n}),{requestAsyncStorage:f,staticGenerationAsyncStorage:x,serverHooks:m}=p,h="/api/floor-areas/[id]/route";function w(){return(0,a.patchFetch)({serverHooks:m,staticGenerationAsyncStorage:x})}},95456:(e,r,t)=>{t.d(r,{Gv:()=>d,MH:()=>m,PT:()=>h,RA:()=>p,WX:()=>f,c_:()=>l,ts:()=>x});var n=t(41482),s=t.n(n),o=t(42023),a=t.n(o),i=t(71615),u=t(8194);let c=process.env.JWT_SECRET||"fallback-secret-change-me";async function l(e){return a().hash(e,12)}async function d(e,r){return a().compare(e,r)}function p(e){return s().sign(e,c,{expiresIn:"7d"})}function f(e){try{return s().verify(e,c)}catch{return null}}async function x(){let e=await (0,i.cookies)(),r=e.get("token")?.value;if(!r)return null;let t=f(r);return t?await u._.user.findUnique({where:{id:t.userId},include:{tenant:!0,store:!0}}):null}function m(e,r){return r.includes(e)}function h(e){return!["owner","admin"].includes(e.role)&&!!e.storeId&&!!e.store&&!e.store.isActive}},8194:(e,r,t)=>{t.d(r,{_:()=>s});let n=require("@prisma/client"),s=globalThis.prisma??new n.PrismaClient}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),n=r.X(0,[8948,5972,4261,2023],()=>t(30822));module.exports=n})();