1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RichTextEditor-Dy7lBMtu.js","assets/vendor-query-CniT1WJL.js","assets/vendor-react-69GsFwrV.js","assets/index-KjAD5lCC.js","assets/vendor-forms-q6h4WU-p.js","assets/vendor-ui-Ad3ANzF6.js","assets/index-Z2Xl0dpv.css"])))=>i.map(i=>d[i]); 2import{j as e,b as B}from"./vendor-query-CniT1WJL.js";import{aD as X,aE as ee,aF as te,aG as ae,m as I,u as se,E as ne,aH as ie,aI as R,F as re,G as C,q as F,V as y,O as $,M as _,P as q,aJ as oe,aK as le,t as M,aL as de,aM as ce,aN as ue,aO as pe}from"./index-KjAD5lCC.js";import{r as d,u as he,L as z}from"./vendor-react-69GsFwrV.js";import{A as me}from"./AccountNav-CGK2802V.js";import{b as xe}from"./prayer-bridge-xtgJoFug.js";import{v as D,a9 as Y,b5 as fe,b6 as be,b7 as ge,ap as ye,b8 as ve,d as ke,aj as we,b9 as je}from"./vendor-ui-Ad3ANzF6.js";import"./vendor-forms-q6h4WU-p.js";function Ne(){const t=X();return d.useCallback(a=>t({title:a?"Edit link":"Add a link",description:"Clear the field to remove the link. Links must start with https.",label:"Web address",placeholder:"https://example.com",defaultValue:a??"https://",confirmLabel:"Ap
2ply"}),[t])}const V="image/png,image/jpeg,image/webp,image/heic,image/heif",Ce=15*1024*1024,Se=new Set(["image/png","image/jpeg","image/webp","image/heic","image/heif"]);function W(t){return Se.has(t.type)?t.size>Ce?"Photos are capped at 15 MB. Try a smaller one.":null:"Pick a PNG, JPEG, WebP, or HEIC photo."}function Pe(){return new Promise(t=>{const a=document.createElement("input");a.type="file",a.accept=V,a.style.display="none";const n=s=>{a.remove(),t(s)};a.addEventListener("change",()=>n(a.files?.[0]??null),{once:!0}),a.addEventListener("cancel",()=>n(null),{once:!0}),document.body.appendChild(a),a.click()})}function H(t){const a=ee(),n=te();return d.useCallback(async(s,r)=>{const o=await a.mutateAsync({data:{campaignId:t,size:s.size,contentType:s.type,purpose:r}});if(!(await fetch(o.uploadURL,{method:"PUT",headers:{"content-type":o.contentType},body:s})).ok)throw new Error("The upload did not complete. Please try again.");return{url:(await n.mutateAsync({id:t,data:{uploadId:o.uploadId,purpose:r}})).url}},[t,n,a])}function Ae(t,a,n){const s=H(t);return d.useCallback(async()=>{const r=await Pe();if(!r)return null;const o=W(r);if(o)return n(o),null;try{return await s(r,a)}catch(c){return n(c instanceof Error?c.message:"That photo could not be uploaded."),null}},[s,a,n])}const Te=d.lazy(()=>ae(()=>import("./RichTextEditor-Dy7lBMtu.js"),__vite__mapDeps([0,1,2,3,4,5,6])));function Ee(){return e.jsx("div",{className:"h-[280px] animate-pulse rounded-md border border-black/15 bg-black/5 dark:border-white/15 dark:bg-white/5","aria-hidden":"true"})}function Ie({value:t,onChange:a,preset:n,campaignId:s,canAddPhotos:r=!0,disabled:o,ariaLabel:c,testId:l,onError:u}){const x=Ne(),h=Ae(s,n==="story"?"story":"update",u),m=d.useCallback(()=>h(),[h]);return e.jsx(d.Suspense,{fallback:e.jsx(Ee,{}),children:e.jsx(Te,{value:t,onChange:a,preset:n,disabled:o,ariaLabel:c,testId:l,promptForUrl:x,onRequestImage:r?m:void 0})})}function K(t){const{toast:a}=I();return e.jsx(Ie,{...t,onError:n=>a({title:"That photo will not work",description:n,variant:"destructive"})})}function Q(t){return/<img\b/i.test(t)?!1:t.replace(/<[^>]*>/g,"").replace(/ /g," ").trim().length===0}const Le={draft:"Draft",review:"In review",approved:"Approved",scheduled:"Scheduled",live:"Live now",paused:"Paused",ended:"Ended",reconciling:"Reconciling",settled:"Settled",cancelled:"Cancelled"},Me=new Set(["live","paused","ended","reconciling","settled"]),$e=new Set(["draft","review","approved","scheduled"]),Ue=new Set(["draft","review","approved","scheduled","live","paused"]),_e={draft:"Received",submitted:"Under review",needs_info:"Needs more info",approved:"Approved",rejected:"Not approved",withdrawn:"Withdrawn",suspended:"Paused"};function E(t,a){if(t instanceof R&&t.data&&typeof t.data=="object"){const s=t.data;if(typeof s.blockedBy=="string"&&s.blockedBy.trim())return s.blockedBy;if(typeof s.error=="string"&&s.error.trim())return s.error}return t?.message??a}function G(t){const a=new Date(t);if(Number.isNaN(a.getTime()))return"";const n=s=>String(s).padStart(2,"0");return`${a.getFullYear()}-${n(a.getMonth()+1)}-${n(a.getDate())}T${n(a.getHours())}:${n(a.getMinutes())}`}function U(t){if(!t.trim())return null;const a=new Date(t);return Number.isNaN(a.getTime())?null:a.toISOString()}function J(t){if(!t.trim())return null;const a=ue(t);return a===null||a<=0?void 0:a}function ze(t){return t==null?"":(t/100).toFixed(2)}function Be({slots:t,onCreated:a}){const{toast:n}
2=I(),[s,r]=d.useState(!1),[o,c]=d.useState(""),[l,u]=d.useState(""),[x,p]=d.useState(""),[h,m]=d.useState(""),[N,v]=d.useState(""),[k,g]=d.useState(null),w=de(),b="w-full rounded-lg border border-ink/15 bg-white px-3 py-2 text-base sm:text-sm text-ink placeholder:text-ink-3 outline-none focus:border-vida-green-600 dark:border-white/15 dark:bg-white/5 dark:text-white dark:placeholder:text-white/40";function j(){c(""),u(""),p(""),m(""),v(""),g(null)}async function T(i){i.preventDefault(),g(null);const f=o.trim();if(f.length<2){g("Give your campaign a name of at least two characters.");return}const S=l.trim().toUpperCase();if(!/^[A-Z0-9]+(?:-[A-Z0-9]+)*$/.test(S)||S.length<2){g("The Support Code can use letters, numbers and dashes only.");return}const P=U(h),A=U(N);if(!P||!A){g("Choose when your campaign starts and ends.");return}if(new Date(P).getTime()>=new Date(A).getTime()){g("The end date has to come after the start date.");return}const L=J(x);if(L===void 0){g("The goal has to be a dollar amount, or blank for no goal.");return}try{await w.mutateAsync({data:{title:f,startsAt:P,endsAt:A,goalCents:L,supportCode:{code:S,type:"attribution_only"}}}),n({title:"Campaign created",description:"Add your story and a photo, then take it live when you are ready."}),j(),r(!1),a()}catch(Z){g(E(Z,"Please try again."))}}return s?e.jsx(C,{className:"mb-4",children:e.jsxs("form",{onSubmit:T,className:"space-y-3",children:[e.jsx("p",{className:"text-body font-semibold text-ink dark:text-white",children:"A new campaign"}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-caption text-ink-2 dark:text-white/70",children:"Campaign name"}),e.jsx("input",{className:b,value:o,onChange:i=>c(i.target.value),placeholder:"What you are raising for","data-testid":"input-vf-new-title"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-caption text-ink-2 dark:text-white/70",children:"Support Code"}),e.jsx("input",{className:`${b} font-mono uppercase`,value:l,onChange:i=>u(i.target.value),placeholder:"MYCODE","data-testid":"input-vf-new-code"}),e.jsx("span",{className:"mt-1 block text-caption text-ink-3 dark:text-white/55",children:"The one string you hand to people. It becomes your page link too, so letters, numbers and dashes only."})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-caption text-ink-2 dark:text-white/70",children:"Starts"}),e.jsx("input",{type:"datetime-local",className:b,value:h,onChange:i=>m(i.target.value),"data-testid":"input-vf-new-starts"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-caption text-ink-2 dark:text-white/70",children:"Ends"}),e.jsx("input",{type:"datetime-local",className:b,value:N,onChange:i=>v(i.target.value),"data-testid":"input-vf-new-ends"})]})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-caption text-ink-2 dark:text-white/70",children:"Goal (optional)"}),e.jsx("input",{inputMode:"decimal",className:b,value:x,onChange:i=>p(i.target.value),placeholder:"2500.00","data-testid":"input-vf-new-goal"})]}),k?e.jsx("p",{className:"text-caption text-red-600 dark:text-red-400","data-testid":"text-vf-new-error",children:k}):null,e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(y,{type:"submit",disabled:w.isPending,children:w.isPending?"Creating...":"Create campaign"}),e.jsx(y,{type:"button",variant:"ghost",onClick:()=>{j(),r(!1)},children:"Cancel"})]})]})}):e.jsx(C,{className:"mb-4",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-body font-semibold text-ink dark:text-white",children:"Start another campaign"}),e.jsxs("p",{className:"mt-0.5 text-caption text-ink-3 dark:text-white/55",children:["You are using ",t.used," of ",t.max,"."]})]}),e.jsxs(y,{type:"button",onClick:()=>r(!0),"data-testid":"button-vf-new-campaign",children:[e.jsx(Y,{className:"size-4","aria-hidden":"true"}),"New campaign"]})]})})}function O({value:t,label:a}
2){const[n,s]=d.useState(!1);return e.jsxs(y,{type:"button",variant:"ghost",size:"sm",onClick:()=>{navigator.clipboard?.writeText(t),s(!0),window.setTimeout(()=>s(!1),2e3)},children:[n?e.jsx(ke,{className:"size-4","aria-hidden":"true"}):e.jsx(we,{className:"size-4","aria-hidden":"true"}),n?"Copied":a]})}function Fe({campaign:t}){const{toast:a}=I(),n=B(),[s,r]=d.useState(""),[o,c]=d.useState(0),l=ce(),u=t.id,x=!Q(s)&&!l.isPending,p=h=>{h.preventDefault(),x&&l.mutate({id:u,data:{body:s}},{onSuccess:()=>{r(""),c(m=>m+1),a({title:"Update posted",description:"It is live on your Impact Page."}),n.invalidateQueries({queryKey:$()})},onError:m=>{a({title:"Could not post the update",description:E(m,"Please try again."),variant:"destructive"})}})};return e.jsxs("form",{onSubmit:p,className:"mt-4 border-t border-[--vp-hairline] pt-4",children:[e.jsxs("p",{className:"mb-1.5 flex items-center gap-1.5 text-sm font-semibold text-ink dark:text-white",children:[e.jsx(je,{className:"size-4 text-vida-green-700","aria-hidden":"true"}),"Post an update"]}),e.jsx(K,{value:s,onChange:r,preset:"update",campaignId:u,canAddPhotos:t.canUploadMedia!==!1,disabled:l.isPending,ariaLabel:"Write a progress update",testId:"editor-vf-update"},o),e.jsx("p",{className:"mt-1 text-caption text-ink-3 dark:text-white/55",children:t.canUploadMedia===!1?t.mediaBlockedReason??"Photos are turned off for this campaign right now.":"Add up to three photos. Everyone following the campaign sees this on your public page."}),e.jsx(y,{type:"submit",disabled:!x,className:"mt-2",children:l.isPending?"Posting...":"Post update"})]})}function Ge({application:t}){return e.jsxs(C,{className:"mb-4","data-testid":"card-vf-application",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-overline uppercase text-primary",children:"Your application"}),e.jsx("p",{className:"mt-1 text-t3 font-semibold text-ink dark:text-white",children:t.displayName}),e.jsxs("p",{className:"mt-1 text-caption text-ink-3 dark:text-white/55",children:["Submitted ",_(t.createdAt)]})]}),e.jsx(q,{variant:t.status==="approved"?"mint":"gold",children:_e[t.status]??t.status})]}),t.status==="submitted"||t.status==="draft"?e.jsx("p",{className:"mt-3 text-body text-ink-2 dark:text-white/70",children:"Our team reads every application and will be in touch by email. Once approved, you can finish setting up the campaign here."}):t.status==="needs_info"?e.jsxs("div",{className:"mt-3",children:[e.jsx("p",{className:"text-body text-ink-2 dark:text-white/70",children:"We need a little more information before we can finish the review."}),t.needsInfoMessage?e.jsxs("div",{className:"mt-3 rounded-2xl bg-vida-mint-soft p-4","data-testid":"text-vf-needs-info",children:[e.jsx("p",{className:"text-overline uppercase text-vida-green-700",children:"What we need"}),e.jsx("p",{className:"mt-1.5 whitespace-pre-wrap text-body text-ink-2",children:t.needsInfoMessage}),e.jsx("p",{className:"mt-2 text-caption text-ink-3",children:"Reply by email and we will pick it up."})]}):e.jsx("p",{className:"mt-1 text-body text-ink-2 dark:text-white/70",children:"Keep an eye on your inbox."})]}):null]})}function Oe({campaign:t,editable:a,onSaved:n}){const{toast:s}
2=I(),r=d.useRef(null),[o,c]=d.useState(!1),l=H(t.id),u=t.canUploadMedia===!1?t.mediaBlockedReason:null;async function x(p){const h=W(p);if(h){s({title:"That photo will not work",description:h,variant:"destructive"});return}c(!0);try{const m=await l(p,"hero");s({title:"Photo saved",description:await n(m.url)})}catch(m){s({title:"Could not save that photo",description:E(m,"Please try again."),variant:"destructive"})}finally{c(!1),r.current&&(r.current.value="")}}return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"relative aspect-[16/9] w-full overflow-hidden rounded-2xl bg-vida-mint-soft",children:t.heroImageUrl?e.jsx("img",{src:t.heroImageUrl,alt:t.title,className:"size-full object-cover"}):e.jsxs("div",{className:"flex size-full flex-col items-center justify-center gap-2 text-vida-green-700",children:[e.jsx(D,{className:"size-10","aria-hidden":"true"}),e.jsx("p",{className:"text-caption",children:"No photo yet"})]})}),a?e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:r,type:"file",accept:V,className:"hidden","data-testid":`input-vf-photo-${t.id}`,onChange:p=>{const h=p.target.files?.[0];h&&x(h)}}),e.jsxs(y,{type:"button",variant:"ghost",size:"sm",className:"mt-2",disabled:o||u!=null,onClick:()=>r.current?.click(),children:[e.jsx(ve,{className:"size-4","aria-hidden":"true"}),o?"Uploading...":t.heroImageUrl?"Replace the photo":"Add a photo"]}),e.jsx("p",{className:"mt-1 text-caption text-ink-3 dark:text-white/55",children:u??"PNG, JPEG, WebP, or HEIC, up to 15 MB. It appears at the top of your public page, and location data is removed before it is published."})]}):null]})}function Re({campaign:t,isPublic:a,onSave:n,saving:s,onClose:r}
2){const[o,c]=d.useState(t.title),[l,u]=d.useState(t.storyMarkdown??""),[x,p]=d.useState(ze(t.goalCents)),[h,m]=d.useState(G(t.startsAt)),[N,v]=d.useState(G(t.endsAt)),[k,g]=d.useState(t.showPrayerCount),[w,b]=d.useState(null),j="w-full rounded-lg border border-ink/15 bg-white px-3 py-2 text-base sm:text-sm text-ink placeholder:text-ink-3 outline-none focus:border-vida-green-600 dark:border-white/15 dark:bg-white/5 dark:text-white dark:placeholder:text-white/40";async function T(i){i.preventDefault(),b(null);const f=o.trim();if(f.length<2){b("Give your campaign a title of at least two characters.");return}const S=J(x);if(S===void 0){b("The goal has to be a dollar amount, or blank for no goal.");return}const P=U(N);if(!P){b("Pick an end date for your campaign.");return}const A=a?null:U(h);if(!a&&!A){b("Pick a start date for your campaign.");return}const L=xe({title:f,storyMarkdown:Q(l)?null:l,goalCents:S,endsAt:P,startsAt:A,showPrayerCount:k});await n(L)&&r()}return e.jsxs("form",{onSubmit:T,className:"mt-4 space-y-3 border-t border-[--vp-hairline] pt-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:`vf-title-${t.id}`,className:"mb-1 block text-sm font-semibold text-ink dark:text-white",children:"Campaign title"}),e.jsx("input",{id:`vf-title-${t.id}`,value:o,onChange:i=>c(i.target.value),maxLength:160,className:j})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 block text-sm font-semibold text-ink dark:text-white",children:"Your story"}),e.jsx(K,{value:l,onChange:u,preset:"story",campaignId:t.id,canAddPhotos:t.canUploadMedia!==!1,disabled:s,ariaLabel:"Write your campaign story",testId:"editor-vf-story"}),e.jsx("p",{className:"mt-1 text-caption text-ink-3 dark:text-white/55",children:"This is your public page. Write it the way you would tell a friend, including your health situation if that is what this is about. One rule: do not say a VidaPeps product treats or cures anything."})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:`vf-goal-${t.id}`,className:"mb-1 block text-sm font-semibold text-ink dark:text-white",children:"Goal (optional)"}),e.jsx("input",{id:`vf-goal-${t.id}`,value:x,onChange:i=>p(i.target.value),inputMode:"decimal",placeholder:"5000.00",className:j})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:`vf-ends-${t.id}`,className:"mb-1 block text-sm font-semibold text-ink dark:text-white",children:"Ends"}),e.jsx("input",{id:`vf-ends-${t.id}`,type:"datetime-local",value:N,onChange:i=>v(i.target.value),className:j}),a?e.jsx("p",{className:"mt-1 text-caption text-ink-3 dark:text-white/55",children:"You can push the end date out, but not pull it in. Supporters already contributed against the date you published."}):null]})]}),a?null:e.jsxs("div",{children:[e.jsx("label",{htmlFor:`vf-starts-${t.id}`,className:"mb-1 block text-sm font-semibold text-ink dark:text-white",children:"Starts"}),e.jsx("input",{id:`vf-starts-${t.id}`,type:"datetime-local",value:h,onChange:i=>m(i.target.value),className:j})]}),e.jsxs("label",{className:"flex items-start gap-2.5",htmlFor:`vf-prayer-${t.id}`,children:[e.jsx("input",{id:`vf-prayer-${t.id}`,type:"checkbox",checked:k,onChange:i=>g(i.target.checked),className:"mt-0.5 size-4 rounded border-ink-3 accent-[hsl(var(--primary))]","data-testid":`checkbox-vf-prayer-${t.id}`}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-sm font-semibold text-ink dark:text-white",children:"Show prayer support on my Impact Page"}),e.jsx("span",{className:"mt-0.5 block text-caption text-ink-3 dark:text-white/55",children:"If a linked VidaPray need agrees, show how many people are praying. Prayer text is never shared."})]})]}),w?e.jsx("p",{className:"text-caption text-danger","data-testid":`text-vf-edit-error-${t.id}`,children:w}):null,e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(y,{type:"submit",size:"sm",disabled:s,children:s?"Saving...":"Save changes"}),e.jsx(y,{type:"button",size:"sm",variant:"ghost",onClick:r,disabled:s,children:"Cancel"})]}),e.jsx("p",{className:"text-caption text-ink-3 dark:text-white/55",children:"The Support Code and your page address never change once they are reserved. They are printed on supporter receipts and typed at checkout."})]})}function qe({campaign:t}){const{toast:a}
2=I(),n=B(),[s,r]=d.useState(!1),[o,c]=d.useState(null),l=oe(),u=le(),x=t.status==="settled",p=Me.has(t.status),h=$e.has(t.status),m=Ue.has(t.status),N=t.estimatedContributionCents+t.leafTotalCents,v=t.goalCents,k=v&&v>0?Math.min(100,Math.round(N/v*100)):null,g=typeof window>"u"?"":window.location.origin;function w(){n.invalidateQueries({queryKey:$()})}function b(i,f){return f.copyPendingReview?"Your public page keeps showing the last approved version until our team reads the change.":i.copyApproved&&!f.copyApproved?"Because you changed public copy, it goes back to our team for a quick read.":"Your campaign has been updated."}async function j(i){try{const f=await l.mutateAsync({id:t.id,data:i});return w(),a({title:"Saved",description:b(t,f)}),!0}catch(f){return a({title:"Could not save your changes",description:E(f,"Please try again."),variant:"destructive"}),!1}}async function T(){c(null);try{const i=await u.mutateAsync({id:t.id});if(w(),i.blockedBy){c(i.blockedBy),a({title:"Sent to our team",description:"We will take one look and then your page goes public."});return}a({title:"Your campaign is live",description:"Share your link and your Support Code with everyone you know."})}catch(i){const f=E(i,"Please try again.");c(f),a({title:"Not live yet",description:f,variant:"destructive"})}}return e.jsxs(C,{className:"mb-4","data-testid":`card-vf-campaign-${t.id}`,children:[e.jsx(Oe,{campaign:t,editable:m,onSaved:async i=>{const f=await l.mutateAsync({id:t.id,data:{heroImageUrl:i}});return w(),b(t,f)}}),e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-t3 font-semibold text-ink dark:text-white",children:t.title}),e.jsxs("p",{className:"mt-1 inline-flex items-center gap-1.5 text-caption text-ink-3 dark:text-white/55",children:[e.jsx(fe,{className:"size-3.5","aria-hidden":"true"}),_(t.startsAt)," to ",_(t.endsAt)]})]}),e.jsx(q,{variant:t.status==="live"?"mint":"neutral",children:Le[t.status]??t.status})]}),p||t.supportCode?e.jsxs("div",{className:"mt-4 space-y-2 rounded-2xl bg-bone p-3 dark:bg-white/5",children:[p?e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("p",{className:"min-w-0 break-all text-caption text-ink-2 dark:text-white/70",children:`${g}/forward/c/${t.publicSlug}`}),e.jsx(O,{value:`${g}/forward/c/${t.publicSlug}`,label:"Copy link"})]}):null,t.supportCode?e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("p",{className:"font-mono text-body font-semibold tracking-wide text-ink dark:text-white",children:t.supportCode}),e.jsx(O,{value:t.supportCode,label:"Copy code"})]}):null,e.jsx("p",{className:"text-caption text-ink-3 dark:text-white/55",children:"Supporters enter your Support Code at checkout so their order counts toward this campaign."})]}):null,k!=null&&v!=null?e.jsxs("div",{className:"mt-4",children:[e.jsx("div",{className:"h-2.5 w-full overflow-hidden rounded-full bg-ink/10 dark:bg-white/10",role:"progressbar","aria-valuenow":k,"aria-valuemin":0,"aria-valuemax":100,"aria-label":"Progress toward your campaign goal",children:e.jsx("div",{className:"h-full rounded-full bg-vida-green-600 transition-[width]",style:{width:`${k}%`}})}),e.jsxs("p",{className:"mt-2 text-caption text-ink-3 dark:text-white/55",children:[M(N)," of ",M(v)," goal (",k,"%)"]})]}):null,e.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-2 sm:grid-cols-4",children:[e.jsxs("div",{className:"rounded-xl bg-bone px-3 py-2.5 text-center dark:bg-white/5",children:[e.jsx("p",{className:"font-mono text-t3 font-bold text-ink tabular-nums dark:text-white",children:M(t.estimatedContributionCents)}),e.jsx("p",{className:"mt-0.5 text-overline normal-case tracking-[0.02em] text-ink-3 dark:text-white/55",children:x?"Final amount":"Estimated contribution"})]}),e.jsxs("div",{className:"rounded-xl bg-bone px-3 py-2.5 text-center dark:bg-white/5",children:[e.jsx("p",{className:"font-mono text-t3 font-bold text-ink tabular-nums dark:text-white",children:M(t.leafTotalCents)}),e.jsx("p",{className:"mt-0.5 text-overline normal-case tracking-[0.02em] text-ink-3 dark:text-white/55",children:t.leafCount===1?"1 VidaLeaf":`${t.leafCount} VidaLeafs`})]}),e.jsxs("div",{className:"rounded-xl bg-bone px-3 py-2.5 text-center dark:bg-white/5",children:[e.jsx("p",{className:"font-mono text-t3 font-bold text-ink tabular-nums dark:text-white",children:t.pendingWishCount}),e.jsx("p",{className:"mt-0.5 text-overline normal-case tracking-[0.02em] text-ink-3 dark:text-white/55",children:"Wishes in review"})]}),e.jsxs("div",{className:"rounded-xl bg-bone px-3 py-2.5 text-center dark:bg-white/5",children:[e.jsx("p",{className:"font-mono text-t3 font-bold text-ink tabular-nums dark:text-white",children:t.updateCount}),e.jsx("p",{className:"mt-0.5 text-overline normal-case tracking-[0.02em] text-ink-3 dark:text-white/55",children:"Updates posted"})]})]}),!x&&e.jsx("p",{className:"mt-2 text-caption text-ink-3 dark:text-white/55",children:"The contribution figure is an estimate until final settlement."}),t.copyPendingReview?e.jsx("div",{className:"mt-4 rounded-2xl bg-vida-gold-soft p-3","data-testid":`text-vf-copy-pending-${t.id}`,children:e.jsx("p",{className:"text-caption text-vida-gold-700",children:"Your edit is with our team. Your public page is showing the last approved version until we read it, so nothing you changed is public yet."})}):null,o?e.jsx("div",{className:"mt-4 rounded-2xl bg-vida-gold-soft p-3","data-testid":`text-vf-blocked-${t.id}`,children:e.jsx("p",{className:"text-caption text-vida-gold-700",children:o})}):null,e.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[h?e.jsxs(y,{type:"button",onClick:T,disabled:u.isPending,"data-testid":`button-vf-go-live-${t.id}`,children:[e.jsx(be,{className:"size-4","aria-hidden":"true"}),u.isPending?"Launching...":"Take my campaign live"]}):null,m?e.jsxs(y,{type:"button",variant:"ghost",onClick:()=>r(i=>!i),"data-testid":`button-vf-edit-${t.id}`,children:[e.jsx(ge,{className:"size-4","aria-hidden":"true"}),s?"Close editor":"Edit my campaign"]}):null,p?e.jsxs(z,{href:`/forward/c/${t.publicSlug}`,className:"inline-flex items-center gap-1 text-caption font-semibold text-primary hover:text-primary/80",children:["View Impact Page",e.jsx(ye,{className:"size-3.5","aria-hidden":"true"})]}):e.jsx("p",{className:"text-caption text-ink-3 dark:text-white/55",children:"Your Impact Page goes public the moment you take the campaign live."})]}),s?e.jsx(Re,{campaign:t,isPublic:p,onSave:j,saving:l.isPending,onClose:()=>r(!1)}):null,e.jsx(Fe,{campaign:t})]})}function Je(){const{isAuthenticated:t,isLoading:a}=se(),[,n]=he(),s=B();d.useEffect(()=>{!a&&!t&&n("/login?redirect=/account/forward")},[a,t,n]);const r=ne({query:{enabled:t,retry:!1,queryKey:$()}}),o=ie({query:{enabled:t,retry:!1,queryKey:pe()}});if(!t)return null;const c=r.data?.items??[],l=r.data?.campaignSlots,u=o.data??r.data?.application??null,x=o.isError&&o.error instanceof R&&o.error.status===404,p=r.isLoading||o.isLoading&&!x,h=c.length===0&&u==null&&!p;return e.jsxs(e.Fragment,{children:[e.jsx(me,{}),e.jsxs(re,{width:"narrow",className:"pb-8 pt-6 md:pb-12",children:[e.jsxs(C,{tone:"dark",className:"vp-panel-gradient mb-5 border-0 text-white",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[e.jsx(D,{className:"size-4.5 text-vida-mint","aria-hidden":"true"}),e.jsx("span",{className:"text-overline uppercase text-vida-mint",children:"VidaForward"})]}),e.jsx("h1",{className:"font-display text-t2 text-white",children:"Your VidaForward Campaigns"}),e.jsx("p",{className:"mt-2 text-body text-white/75",children:"Set up your page, take it live, and post updates as things happen."})]}),p?e.jsxs("div",{className:"space-y-4",children:[e.jsx(F,{className:"h-24 w-full rounded-card"}),e.jsx(F,{className:"h-48 w-full rounded-card"})]}):h?e.jsx(C,{children:e.jsxs("div",{className:"flex flex-col items-center py-6 text-center",children:[e.jsx(Y,{className:"size-10 text-vida-green-700","aria-hidden":"true"}),e.jsx("h2",{className:"mt-3 text-t3 font-semibold text-ink dark:text-white",children:"No campaigns yet"}),e.jsx("p",{className:"mt-2 max-w-md text-body text-ink-2 dark:text-white/70",children:"Support a person or organization you choose with a Support Code and VidaLeaf contributions."}),e.jsxs("div",{className:"mt-5 flex flex-col items-center justify-center gap-2.5 sm:flex-row",children:[e.jsx(y,{asChild:!0,children:e.jsx(z,{href:"/forward/apply",children:"Start a campaign"})}),e.jsx(y,{asChild:!0,variant:"ghost",children:e.jsx(z,{href:"/forward",children:"How VidaForward works"})})]})]})}):e.jsxs(e.Fragment,{children:[u?e.jsx(Ge,{application:u}):null,c.map(m=>e.jsx(qe,{campaign:m},m.id)),l?.canCreate?e.jsx(Be,{slots:l,onCreated:()=>s.invalidateQueries({queryKey:$()})}):l&&l.used>=l.max?e.jsx(C,{className:"mb-4",children:e.jsxs("p",{className:"text-caption text-ink-3 dark:text-white/55",children:["You are running ",l.used," of ",l.max," campaigns. Finish or cancel one to start another."]})}):null]})]})]})}export{Je as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.