module.exports=[29281,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(50944);a.s(["default",0,function({requestId:a}){let e=(0,d.useRouter)(),[f,g]=(0,c.useState)(!1),[h,i]=(0,c.useState)(null),[j,k]=(0,c.useState)(!1);async function l(b,c=!1){if("approve"===b&&!c&&!confirm("Issue this refund? The buyer will be refunded via their original payment method, the order marked refunded, and its tickets voided.")||"approve"===b&&c&&!confirm("Record this as a manually-handled refund? No gateway refund will be sent — the order is marked refunded and its tickets voided. Move the money back to the buyer yourself."))return;let d="reject"===b?prompt("Reason for rejecting (optional):")??void 0:void 0;i(null),g(!0);let f=await fetch("/api/refunds/resolve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requestId:a,action:b,note:d,manual:c})}),h=await f.json().catch(()=>({}));if(g(!1),!f.ok){i(h.error||"Action failed"),h.gatewayFailed&&k(!0);return}e.refresh()}return(0,b.jsxs)("div",{className:"flex flex-col items-end gap-1",children:[(0,b.jsxs)("div",{className:"flex gap-1.5",children:[(0,b.jsx)("button",{type:"button",onClick:()=>l("approve"),disabled:f,className:"be-act be-act-primary",children:"Issue refund"}),(0,b.jsx)("button",{type:"button",onClick:()=>l("reject"),disabled:f,className:"be-act be-act-ghost",children:"Reject"})]}),h&&(0,b.jsx)("span",{className:"text-xs text-[color:var(--pill-danger-fg)]",children:h}),j&&(0,b.jsx)("button",{type:"button",onClick:()=>l("approve",!0),disabled:f,className:"be-act be-act-warn",children:"Record manual refund instead"})]})}])}];

//# sourceMappingURL=src_app_admin_refunds_refund-resolve-actions_tsx_1crekkx._.js.map