"use strict";(()=>{var e={};e.id=2850,e.ids=[2850],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")},48896:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>x,patchFetch:()=>h,requestAsyncStorage:()=>p,routeModule:()=>d,serverHooks:()=>m,staticGenerationAsyncStorage:()=>w});var n={};r.r(n),r.d(n,{GET:()=>c});var a=r(49303),s=r(88716),i=r(60670),o=r(87070),u=r(8194),l=r(95456);async function c(e){try{let t=await (0,l.ts)();if(!t)return o.NextResponse.json({error:"Unauthorized"},{status:401});let{searchParams:r}=new URL(e.url),n=r.get("status"),a=parseInt(r.get("page")||"1"),s=parseInt(r.get("limit")||"20"),i=(a-1)*s,c={tenantId:t.tenantId};n&&"all"!==n&&(c.status=n);let[d,p]=await Promise.all([u._.withdrawalRequest.findMany({where:c,orderBy:{createdAt:"desc"},take:s,skip:i}),u._.withdrawalRequest.count({where:c})]);return o.NextResponse.json({withdrawals:d.map(e=>({id:e.id,amount:Number(e.amount),bankName:e.bankName,bankAccount:e.bankAccount,bankHolder:e.bankHolder,status:e.status,notes:e.notes,adminNotes:e.adminNotes,processedAt:e.processedAt,createdAt:e.createdAt})),pagination:{page:a,limit:s,total:p,totalPages:Math.ceil(p/s)}})}catch{return o.NextResponse.json({error:"Server error"},{status:500})}}let d=new a.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/wallet/withdrawals/route",pathname:"/api/wallet/withdrawals",filename:"route",bundlePath:"app/api/wallet/withdrawals/route"},resolvedPagePath:"D:\\PROJECT\\resto-saas\\src\\app\\api\\wallet\\withdrawals\\route.ts",nextConfigOutput:"",userland:n}),{requestAsyncStorage:p,staticGenerationAsyncStorage:w,serverHooks:m}=d,x="/api/wallet/withdrawals/route";function h(){return(0,i.patchFetch)({serverHooks:m,staticGenerationAsyncStorage:w})}},95456:(e,t,r)=>{r.d(t,{Gv:()=>d,MH:()=>x,PT:()=>h,RA:()=>p,WX:()=>w,c_:()=>c,ts:()=>m});var n=r(41482),a=r.n(n),s=r(42023),i=r.n(s),o=r(71615),u=r(8194);let l=process.env.JWT_SECRET||"fallback-secret-change-me";async function c(e){return i().hash(e,12)}async function d(e,t){return i().compare(e,t)}function p(e){return a().sign(e,l,{expiresIn:"7d"})}function w(e){try{return a().verify(e,l)}catch{return null}}async function m(){let e=await (0,o.cookies)(),t=e.get("token")?.value;if(!t)return null;let r=w(t);return r?await u._.user.findUnique({where:{id:r.userId},include:{tenant:!0,store:!0}}):null}function x(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,{_:()=>a});let n=require("@prisma/client"),a=globalThis.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,4261,2023],()=>r(48896));module.exports=n})();