module.exports=[18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},35598,(e,t,r)=>{t.exports=e.x("@prisma/client-0f82be8c26997d85",()=>require("@prisma/client-0f82be8c26997d85"))},87552,e=>{"use strict";var t=e.i(35598);let r=globalThis.prisma??new t.PrismaClient;e.s(["prisma",0,r])},2895,e=>{"use strict";var t=e.i(16894),r=e.i(31625),a=e.i(87552);let n=(0,r.cache)(async()=>{let e=await (0,t.cookies)(),r=e.get("userId")?.value;if(!r)return null;try{let e=await a.prisma.user.findUnique({where:{id:parseInt(r)}});if(!e)return null;let{password:t,...n}=e;return n}catch(e){return console.error("Auth error:",e),null}});e.s(["getCurrentUser",0,n])},42005,e=>{"use strict";var t=e.i(17220),r=e.i(61876),a=e.i(13992),n=e.i(53884),i=e.i(71499),s=e.i(38080),o=e.i(31965),l=e.i(49640),d=e.i(92260),u=e.i(23679),c=e.i(64012),p=e.i(40845),m=e.i(12191),h=e.i(1323),x=e.i(72901),f=e.i(93695);e.i(24017);var g=e.i(10021),R=e.i(65960),v=e.i(2895),w=e.i(87552);async function y(t,r){let a=(await r.params).id,n=await (0,v.getCurrentUser)();if(!n||"HR"!==n.role)return R.NextResponse.json({error:"Yetkisiz erişim"},{status:403});try{let r=parseInt(a),{status:n,rejectionReason:i}=await t.json();if(console.log(`[API] Processing Request ${r} with status ${n}`),!["APPROVED","REJECTED"].includes(n))return console.error("[API] Invalid status:",n),R.NextResponse.json({error:"Geçersiz durum"},{status:400});let s=await w.prisma.leaveRequest.findUnique({where:{id:r},include:{user:!0}});if(!s)return R.NextResponse.json({error:"Talep bulunamadı"},{status:404});if("PENDING"!==s.status)return R.NextResponse.json({error:"Bu talep zaten işleme alınmış"},{status:400});await w.prisma.$transaction(async e=>{if("APPROVED"===n){if(!await e.user.findUnique({where:{id:s.userId}}))throw Error("Kullanıcı bulunamadı");await e.user.update({where:{id:s.userId},data:{leaveBalance:{decrement:s.days}}}),await e.leaveTransaction.create({data:{userId:s.userId,amount:-s.days,reason:`İzin Talebi Onayı #${r} (${s.days} g\xfcn)`,createdAt:new Date}})}else"REJECTED"===n&&await e.leaveTransaction.create({data:{userId:s.userId,amount:0,reason:`İzin Talebi Reddi #${r}${i?": "+i:""}`,createdAt:new Date}});await e.leaveRequest.update({where:{id:r},data:{status:n}})});try{let{sendEmail:t,generateEmailTemplate:r}=await e.A(86911);if("APPROVED"===n){let a="İzin Talebiniz Onaylanmıştır",n=r({title:a,body:`
                        <p>${new Date(s.startDate).toLocaleDateString("tr-TR")} - ${new Date(s.endDate).toLocaleDateString("tr-TR")} tarihleri arasındaki izin talebiniz <strong>onaylanmıştır</strong>.</p>
                        <p>Onaylanmış olan izninize dair imzalanması gereken belgeniz mail ekinde bulunmaktadır. L\xfctfen en kısa zamanda izin s\xfcrecinizin tamamlanması i\xe7in ilgili dok\xfcmanı İnsan Kaynakları birimine <strong>ıslak imzalı olarak</strong> iletiniz.</p>
                        <p>İyi \xe7alışmalar ve iyi tatiller dileriz.</p>
                        <p>G\xfcncel izin hakkınızı ve ge\xe7miş taleplerinizi personel panelinden kontrol edebilirsiniz.</p>
                    `,userName:s.user.name||"Değerli Çalışanımız"}),i="",o="";switch(s.type){case"Yıllık":default:o="yillik-izin-formu.docx";break;case"Mazeret":o="mazeret-izni-formu.docx";break;case"Ücretsiz":o="ucretsiz-izin-formu.docx"}i=`public/attachments/${o}`;let l=process.cwd(),d=`${l}/${i}`,u=await e.A(23970),c=[];if(console.log(`[Email] Checking attachment: ${d}`),u.existsSync(d))console.log(`[Email] Attachment found: ${d}`),c.push({filename:o,path:d});else{console.warn(`[Email] ⚠️ Attachment not found at path: ${d}`);try{let e=`${l}/public/attachments`;u.existsSync(e)?console.log("[Email] Files in directory:",u.readdirSync(e)):console.log("[Email] Directory does not exist:",e)}catch(e){console.error("Error listing dir:",e)}}await t(s.user.email,`${a} - Koruyucu OSGB`,n,c.length>0?c:void 0)}else{let e="İzin Talebiniz Hakkında",a=`
                    <p>${new Date(s.startDate).toLocaleDateString("tr-TR")} - ${new Date(s.endDate).toLocaleDateString("tr-TR")} tarihleri arasındaki izin talebiniz, yapılan değerlendirme sonucunda <strong>reddedilmiştir</strong>.</p>
                `;i&&(a+=`
                    <div style="background-color: #f9fafb; border-left: 4px solid #6b7280; padding: 15px; margin: 20px 0;">
                        <p style="margin: 0; color: #111827; font-weight: 600;">A\xe7ıklama:</p>
                        <p style="margin: 5px 0 0 0; color: #374151;">${i}</p>
                    </div>
                    `),a+=`<p>Planlamanızı buna g\xf6re yapmanızı rica ederiz.</p><p>G\xfcncel izin hakkınızı ve ge\xe7miş taleplerinizi personel panelinden kontrol edebilirsiniz.</p>`;let n=r({title:e,body:a,userName:s.user.name||"Değerli Çalışanımız"});await t(s.user.email,`${e} - Koruyucu OSGB`,n)}}catch(e){console.error("Email sending failed:",e)}return R.NextResponse.json({success:!0})}catch(e){return console.error("Approval Error:",e),R.NextResponse.json({error:e.message||"Sunucu hatası"},{status:500})}}e.s(["PUT",()=>y],10819);var E=e.i(10819);let b=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/requests/[id]/route",pathname:"/api/requests/[id]",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/Documents/koruyucu-izin-sistemi/app/api/requests/[id]/route.ts",nextConfigOutput:"standalone",userland:E}),{workAsyncStorage:k,workUnitAsyncStorage:z,serverHooks:A}=b;function C(){return(0,a.patchFetch)({workAsyncStorage:k,workUnitAsyncStorage:z})}async function T(e,t,a){b.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let R="/api/requests/[id]/route";R=R.replace(/\/index$/,"")||"/";let v=await b.prepare(e,t,{srcPage:R,multiZoneDraftMode:!1});if(!v)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:w,params:y,nextConfig:E,parsedUrl:k,isDraftMode:z,prerenderManifest:A,routerServerContext:C,isOnDemandRevalidate:T,revalidateOnlyGenerated:P,resolvedPathname:D,clientReferenceManifest:N,serverActionsManifest:q}=v,$=(0,o.normalizeAppPath)(R),O=!!(A.dynamicRoutes[$]||A.routes[D]),S=async()=>((null==C?void 0:C.render404)?await C.render404(e,t,k,!1):t.end("This page could not be found"),null);if(O&&!z){let e=!!A.routes[D],t=A.dynamicRoutes[$];if(t&&!1===t.fallback&&!e){if(E.experimental.adapterPath)return await S();throw new f.NoFallbackError}}let _=null;!O||b.isDev||z||(_="/index"===(_=D)?"/":_);let I=!0===b.isDev||!O,j=O&&!I;q&&N&&(0,s.setManifestsSingleton)({page:R,clientReferenceManifest:N,serverActionsManifest:q});let U=e.method||"GET",H=(0,i.getTracer)(),M=H.getActiveScopeSpan(),K={params:y,prerenderManifest:A,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:I,incrementalCache:(0,n.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:E.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>b.onRequestError(e,t,a,n,C)},sharedContext:{buildId:w}},L=new l.NodeNextRequest(e),B=new l.NodeNextResponse(t),F=d.NextRequestAdapter.fromNodeNextRequest(L,(0,d.signalFromNodeResponse)(t));try{let s=async e=>b.handle(F,K).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=H.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${U} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t)}else e.updateName(`${U} ${R}`)}),o=!!(0,n.getRequestMeta)(e,"minimalMode"),l=async n=>{var i,l;let d=async({previousCacheEntry:r})=>{try{if(!o&&T&&P&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let i=await s(n);e.fetchMetrics=K.renderOpts.fetchMetrics;let l=K.renderOpts.pendingWaitUntil;l&&a.waitUntil&&(a.waitUntil(l),l=void 0);let d=K.renderOpts.collectedTags;if(!O)return await (0,p.sendResponse)(L,B,i,K.renderOpts.pendingWaitUntil),null;{let e=await i.blob(),t=(0,m.toNodeOutgoingHttpHeaders)(i.headers);d&&(t[x.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==K.renderOpts.collectedRevalidate&&!(K.renderOpts.collectedRevalidate>=x.INFINITE_CACHE)&&K.renderOpts.collectedRevalidate,a=void 0===K.renderOpts.collectedExpire||K.renderOpts.collectedExpire>=x.INFINITE_CACHE?void 0:K.renderOpts.collectedExpire;return{value:{kind:g.CachedRouteKind.APP_ROUTE,status:i.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await b.onRequestError(e,t,{routerKind:"App Router",routePath:R,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:j,isOnDemandRevalidate:T})},!1,C),t}},u=await b.handleResponse({req:e,nextConfig:E,cacheKey:_,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:P,responseGenerator:d,waitUntil:a.waitUntil,isMinimalMode:o});if(!O)return null;if((null==u||null==(i=u.value)?void 0:i.kind)!==g.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(l=u.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});o||t.setHeader("x-nextjs-cache",T?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),z&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,m.fromNodeOutgoingHttpHeaders)(u.value.headers);return o&&O||f.delete(x.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,h.getCacheControlHeader)(u.cacheControl)),await (0,p.sendResponse)(L,B,new Response(u.value.body,{headers:f,status:u.value.status||200})),null};M?await l(M):await H.withPropagatedContext(e.headers,()=>H.trace(u.BaseServerSpan.handleRequest,{spanName:`${U} ${R}`,kind:i.SpanKind.SERVER,attributes:{"http.method":U,"http.target":e.url}},l))}catch(t){if(t instanceof f.NoFallbackError||await b.onRequestError(e,t,{routerKind:"App Router",routePath:$,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:j,isOnDemandRevalidate:T})},!1,C),O)throw t;return await (0,p.sendResponse)(L,B,new Response(null,{status:500})),null}}e.s(["handler",()=>T,"patchFetch",()=>C,"routeModule",()=>b,"serverHooks",()=>A,"workAsyncStorage",()=>k,"workUnitAsyncStorage",()=>z],42005)},86911,e=>{e.v(t=>Promise.all(["server/chunks/[externals]__0db74300._.js","server/chunks/[root-of-the-server]__83bc68e7._.js"].map(t=>e.l(t))).then(()=>t(12835)))},23970,e=>{e.v(t=>Promise.all(["server/chunks/[externals]_fs_54ffce70._.js"].map(t=>e.l(t))).then(()=>t(22734)))}];

//# sourceMappingURL=%5Broot-of-the-server%5D__07e00f21._.js.map