import{r as e,j as t,c as s}from"./router.chunk.YsRm4bSN.js";import{s as sprintf,_ as __}from"./wordpress.chunk.BVds2GcU.js";import{S as r}from"./donation.chunk.D76CvJSa.js";import{u as a,i as n,b5 as o,c4 as c,D as i,aw as m,ax as d,l as p,$ as u,L as h,N as j,aC as l,aD as f,az as g}from"./main.chunk.N-eZ2ybB.js";import{m as k}from"./pdf-core.chunk.D33I_Wdh.js";import{P as x,a as _}from"./pdf-pledge-without-reward-content.chunk.BqaTTSZo.js";import{P as w}from"./pdf-receipt-document.chunk.BnWw5Zlc.js";import{u as y}from"./use-currency.chunk.QE--bLc6.js";import{f as E}from"./date-utils.chunk.DWRtWTmT.js";import"./react-jsx-runtime.chunk.ATkk6v2S.js";import"./react.js";import"./react-dom-client.chunk.BMQ1litG.js";import"./react-dom.js";import"./utils.chunk.C1IATKsN.js";import"./ui-radix.chunk.Xzokq_Gv.js";import"./icons.chunk.BwnSC3zE.js";import"./forms.chunk.Bz8aaTWe.js";import"./pdf-context.chunk.DXMR6h2w.js";import"./pdf-signature.chunk.IQZSL9sf.js";import"./pdf-html.chunk.CXZoRVhj.js";const D=({pledge:s,template:r})=>{const{toCurrency:m}=y(),{appConfig:d}=a(),p=e.useMemo(()=>{const e={campaign_name:s.campaign.title,backer_name:sprintf("%s %s",s.backer.first_name,s.backer.last_name),pledge_amount:n(s.payment.total)?m(s.payment.total):o(2),payment_method:s.payment.payment_method.label,pledge_date_time:n(s.created_at)?E(s.created_at,i.HUMAN_READABLE_FULL_DATE_TIME):o(2)};return r.content.greetings=c(r.short_codes??[],r.content.greetings,e),r},[r,s,m]),u=window.innerHeight;return t.jsx(k,{width:"100%",height:u,children:t.jsx(w,{pdfReceiptTemplate:p,toCurrency:m,appConfig:d,children:n(s.reward)?t.jsx(x,{pledge:s}):t.jsx(_,{pledge:s})})})},L=e=>s({queryKey:["PledgeReceipt",e],queryFn:()=>(e=>m.get(d.PLEDGE_RECEIPT(e)).then(e=>e.data))(e)}),b=()=>{const{uid:e}=p(),s=L(e);return u(s,{Loading:t.jsx(g,{}),Error:t.jsx(l,{className:"growfund-mt-10",children:t.jsxs(f,{children:[t.jsx(r,{}),t.jsx("div",{children:__("Donation not found.","growfund")})]})}),Empty:t.jsx(h,{className:"growfund-mt-10",children:t.jsxs(j,{className:"growfund-flex growfund-flex-col growfund-items-center",children:[t.jsx(r,{}),t.jsx("div",{children:__("Donation not found.","growfund")})]})}),Success:e=>t.jsx(D,{...e.data})})};export{b as default};
