"use strict";(()=>{var e={};e.id=3340,e.ids=[3340,2331],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")},84770:e=>{e.exports=require("crypto")},49131:(e,t,a)=>{a.r(t),a.d(t,{originalPathname:()=>h,patchFetch:()=>k,requestAsyncStorage:()=>c,routeModule:()=>m,serverHooks:()=>g,staticGenerationAsyncStorage:()=>l});var s={};a.r(s),a.d(s,{POST:()=>u});var r=a(49303),i=a(88716),n=a(60670),p=a(87070),o=a(72331),d=a(84770);async function u(e,{params:t}){try{let{message:a}=await e.json();if(!a?.trim())return p.NextResponse.json({success:!1,message:"Pesan tidak boleh kosong"},{status:400});let s=await o.prisma.supportTicket.findUnique({where:{id:t.id},include:{user:{select:{id:!0}}}});if(!s)return p.NextResponse.json({success:!1,message:"Tiket tidak ditemukan"},{status:404});return await o.prisma.message.create({data:{threadId:s.threadId,senderType:"admin",recipientId:s.userId,content:a.trim(),isRead:!1}}),await o.prisma.message.create({data:{threadId:`notif-${(0,d.randomUUID)()}`,senderType:"admin",recipientId:s.userId,subject:`Balasan Tiket: ${s.subject}`,content:`Admin telah membalas tiket dukungan Anda "${s.subject}". Buka tab Dukungan untuk melihat balasan.`,isRead:!1,isBroadcast:!1}}),"open"===s.status&&await o.prisma.supportTicket.update({where:{id:t.id},data:{status:"in_progress",updatedAt:new Date}}),p.NextResponse.json({success:!0,message:"Balasan terkirim"})}catch(e){return console.error("Support reply POST error:",e),p.NextResponse.json({success:!1,message:"Gagal mengirim balasan"},{status:500})}}let m=new r.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/admin/support/[id]/reply/route",pathname:"/api/admin/support/[id]/reply",filename:"route",bundlePath:"app/api/admin/support/[id]/reply/route"},resolvedPagePath:"C:\\xampp\\htdocs\\Bolafest\\app\\api\\admin\\support\\[id]\\reply\\route.ts",nextConfigOutput:"standalone",userland:s}),{requestAsyncStorage:c,staticGenerationAsyncStorage:l,serverHooks:g}=m,h="/api/admin/support/[id]/reply/route";function k(){return(0,n.patchFetch)({serverHooks:g,staticGenerationAsyncStorage:l})}},72331:(e,t,a)=>{a.d(t,{prisma:()=>r});var s=a(53524);let r=globalThis.prisma??new s.PrismaClient({log:["error"]})}};var t=require("../../../../../../webpack-runtime.js");t.C(e);var a=e=>t(t.s=e),s=t.X(0,[9276,5972],()=>a(49131));module.exports=s})();