(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,31529,e=>{"use strict";var t=e.i(43476),a=e.i(71645),r=e.i(18566);e.s(["default",0,function({requestId:e}){let n=(0,r.useRouter)(),[i,s]=(0,a.useState)(!1),[o,d]=(0,a.useState)(null),[l,c]=(0,a.useState)(!1);async function u(t,a=!1){if("approve"===t&&!a&&!confirm("Issue this refund? The buyer will be refunded via their original payment method, the order marked refunded, and its tickets voided.")||"approve"===t&&a&&!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 r="reject"===t?prompt("Reason for rejecting (optional):")??void 0:void 0;d(null),s(!0);let i=await fetch("/api/refunds/resolve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requestId:e,action:t,note:r,manual:a})}),o=await i.json().catch(()=>({}));if(s(!1),!i.ok){d(o.error||"Action failed"),o.gatewayFailed&&c(!0);return}n.refresh()}return(0,t.jsxs)("div",{className:"flex flex-col items-end gap-1",children:[(0,t.jsxs)("div",{className:"flex gap-1.5",children:[(0,t.jsx)("button",{type:"button",onClick:()=>u("approve"),disabled:i,className:"be-act be-act-primary",children:"Issue refund"}),(0,t.jsx)("button",{type:"button",onClick:()=>u("reject"),disabled:i,className:"be-act be-act-ghost",children:"Reject"})]}),o&&(0,t.jsx)("span",{className:"text-xs text-[color:var(--pill-danger-fg)]",children:o}),l&&(0,t.jsx)("button",{type:"button",onClick:()=>u("approve",!0),disabled:i,className:"be-act be-act-warn",children:"Record manual refund instead"})]})}])}]);