@apollosproject/canvas-embeds 2.1.570 → 2.1.572
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/widget/index.js +1 -1
package/package.json
CHANGED
package/widget/index.js
CHANGED
|
@@ -1941,7 +1941,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1941
1941
|
background-color: rgb(var(--color-brand-primary) / 0.3);
|
|
1942
1942
|
color: inherit;
|
|
1943
1943
|
}
|
|
1944
|
-
`,prt=({amount:e="0",selectedFrequency:t=null,selectedCampus:n=null,selectedFund:r=null,predefinedAmounts:i="",onError:a,isProcessing:o=!1,onShowPayment:s,onAmountChange:c,onFrequencyChange:d,onCampusChange:m,onFundChange:h,churchName:g,churchLogo:y,message:b,displayLogo:N,title:F,displayHeader:_})=>{var te;const{currentChurch:O}=_6(),{campuses:I,loading:R}=yD(),P=bD(t),M=T.useRef(null),U=T.useRef(null),q=T.useRef(null),X=i?i.split(",").map(K=>K.trim()).filter(K=>K):[];T.useEffect(()=>{P&&M.current&&q.current&&setTimeout(()=>{const K=q.current,z=M.current;if(K&&z){const ce=K.getBoundingClientRect();z.getBoundingClientRect().bottom>ce.bottom&&z.scrollIntoView({behavior:"smooth",block:"nearest"})}},100)},[P]),T.useEffect(()=>{n&&U.current&&q.current&&setTimeout(()=>{const K=q.current,z=U.current;if(K&&z){const ce=K.getBoundingClientRect();z.getBoundingClientRect().bottom>ce.bottom&&z.scrollIntoView({behavior:"smooth",block:"nearest"})}},100)},[n]);const[H,ne]=T.useState(80),Y=T.useRef(null);T.useLayoutEffect(()=>{Y.current&&(Y.current.textContent=e||"0",ne(Math.max(Y.current.offsetWidth+16,80)))},[e]),T.useEffect(()=>{const K=setTimeout(()=>{Y.current&&(Y.current.textContent=e||"0",ne(Math.max(Y.current.offsetWidth+16,80)))},10);return()=>clearTimeout(K)},[e]);const ie=K=>{const z=parseFloat(K);return!isNaN(z)&&z>999999.99},ae=K=>{let z=K.replace(/[^0-9.]/g,"");if(z.includes(".")){const ce=z.split(".");ce.length>2&&(z=ce[0]+"."+ce.slice(1).join("")),ce[1]&&ce[1].length>2&&(z=ce[0]+"."+ce[1].substring(0,2))}z.length>1&&z[0]==="0"&&z[1]!=="."&&(z=z.substring(1)),!ie(z)&&(z==="."&&(z="0."),c==null||c(z))},G=K=>{const z=I.find(ce=>ce.id===K);if(z){const ce={...z,donationFunds:z.donationFunds?z.donationFunds.map(ye=>({...ye})):[]};m==null||m(ce),h==null||h(null)}else m==null||m(null),h==null||h(null)},Pe=K=>{var ce;if(!n)return;const z=(ce=n.donationFunds)==null?void 0:ce.find(ye=>ye.id===K);h==null||h(z?{...z}:null)},Ne=K=>{const z=r1.find(ce=>ce.id===K);d==null||d(z||null)},me=()=>{if(typeof e=="string"){const K=parseFloat(e);return isNaN(K)?0:K}return e||0},Ce=K=>Number(K).toFixed(2),V=()=>{const K=me();if(!K||K<=0){a({message:"Please enter a valid amount"});return}if(K<.5){a({message:"Please enter an amount of $0.50 or more"});return}if(!n){a({message:"Please select a campus"});return}if(!r){a({message:"Please select a fund"});return}s&&s()};return x.jsxs("div",{className:"flex flex-col h-full","data-testid":"donation-setup-form",children:[x.jsx("style",{children:mrt}),_!=="false"?x.jsx(SD,{churchName:g,churchLogo:y,message:b,title:F,displayLogo:N,theme:void 0}):null,x.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-6",ref:q,children:x.jsxs("div",{className:"space-y-4",children:[x.jsxs("div",{className:"",children:[x.jsxs("div",{className:"flex items-start justify-center text-[60px] font-bold leading-none min-h-[60px]",children:[x.jsx("span",{className:"text-3xl leading-normal font-bold mt-3 flex-none text-brand dark:text-white",children:"$"}),x.jsx("span",{ref:Y,className:"absolute invisible h-0 overflow-hidden whitespace-pre text-[80px] font-bold font-inherit p-0 m-0",style:{fontFamily:"inherit",position:"absolute",left:"-9999px",top:"-9999px"},children:e||"0"}),x.jsx("input",{type:"text",inputMode:"decimal",placeholder:"0",value:e,onKeyDown:K=>{if(!["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(K.key)){if(/^[0-9]$/.test(K.key)||K.key==="."||K.ctrlKey||K.metaKey){if(K.key==="."&&e.includes(".")){K.preventDefault();return}if(/^[0-9]$/.test(K.key)){const z=K.target,ce=z.value,ye=z.selectionStart||0,se=ce.substring(0,ye)+K.key+ce.substring(z.selectionEnd||0);if(ie(se)){K.preventDefault();return}}return}K.preventDefault()}},onChange:K=>{const z=K.target.value;ae(z),requestAnimationFrame(()=>{if(Y.current){Y.current.textContent=z||"0";const ce=Math.max(Y.current.offsetWidth+16,80);ne(ce)}})},onInput:K=>{const z=K.target.value;if(Y.current){Y.current.textContent=z||"0";const ce=Math.max(Y.current.offsetWidth+16,80);ne(ce)}},onKeyUp:K=>{const z=K.target.value;if(Y.current){Y.current.textContent=z||"0";const ce=Math.max(Y.current.offsetWidth+16,80);ne(ce)}},onFocus:K=>{setTimeout(()=>{K.target.select()},0)},onClick:K=>{K.target.select()},disabled:o||R,className:"text-[80px] font-bold border-none outline-none bg-transparent flex-none p-0 m-0 text-brand dark:text-white caret-current text-center appearance-none transition-[width] duration-100 ease-in-out",style:{width:`${H}px`}})]}),X&&X.length>0?x.jsx("div",{className:"flex flex-wrap pt-12",style:{gap:"6px"},children:X.map(K=>x.jsxs(Xn,{onClick:()=>ae(K),disabled:o||R,surface:e===K?"solid":"material",className:"min-w-0 flex-1",style:{flexBasis:"calc(25% - 4.5px)",minWidth:"0",...e===K&&{"--btn-bg":"rgb(var(--color-brand-primary))","--btn-hover-overlay":"rgb(255 255 255 / 15%)"}},children:["$",K]},K))}):null]}),x.jsx("div",{children:x.jsxs("div",{className:"flex",children:[x.jsxs(Xn,{onClick:()=>{d==null||d(r1.find(K=>K.id===(O==null?void 0:O.givingDefaultFrequency))||r1[2])},disabled:o||R,surface:P?"solid":"material",className:"flex-1 rounded-r-none",style:{...P&&{"--btn-bg":"rgb(var(--color-brand-primary))","--btn-hover-overlay":"rgb(255 255 255 / 15%)"}},children:[x.jsx(Oie,{size:24}),"Recurring"]}),x.jsxs(Xn,{onClick:()=>d==null?void 0:d(null),disabled:o||R,surface:P?"material":"solid",className:"flex-1 rounded-l-none",style:{...!P&&{"--btn-bg":"rgb(var(--color-brand-primary))","--btn-hover-overlay":"rgb(255 255 255 / 15%)"}},children:[x.jsx(Die,{size:24}),"One time"]})]})}),P?x.jsxs("div",{ref:M,children:[x.jsx(bn,{className:"mb-4 pl-4 text-sm",fg:"secondary",children:"Frequency"}),x.jsxs(OT,{value:(t==null?void 0:t.id)||"",onChange:K=>Ne(K.target.value),disabled:o||R,required:!0,surface:"material",children:[x.jsx("option",{value:"",children:"Select a frequency"}),r1.map(K=>x.jsx("option",{value:K.id,children:K.id},K.id))]})]}):null,x.jsxs("div",{children:[x.jsx(bn,{className:"mb-4 pl-4 text-sm",fg:"secondary",children:"Campus"}),x.jsxs(OT,{value:(n==null?void 0:n.id)||"",onChange:K=>G(K.target.value),disabled:o||R,required:!0,surface:"material",children:[x.jsx("option",{value:"",children:R?"Loading...":"Select a campus"}),I.map(K=>x.jsx("option",{value:K.id,children:K.name},K.id))]})]}),n?x.jsxs("div",{ref:U,children:[x.jsx(bn,{className:"mb-4 pl-4 text-sm",fg:"secondary",id:"fund-label",children:"Fund"}),x.jsxs(OT,{value:(r==null?void 0:r.id)||"",onChange:K=>Pe(K.target.value),disabled:o,required:!0,surface:"material","aria-labelledby":"fund-label",children:[x.jsx("option",{value:"",children:"Select a fund"}),(te=n.donationFunds)==null?void 0:te.sort((K,z)=>(K.displayOrder||0)-(z.displayOrder||0)).map(K=>x.jsx("option",{value:K.id,children:K.displayName||K.name},K.id))]})]}):null]})}),x.jsxs("div",{className:"sticky bottom-0 z-10 px-6 py-4 bg-system-chrome dark:bg-system-chrome-dark",children:[x.jsxs(Xn,{type:"button",className:"w-full py-3",onClick:V,disabled:o||R||!n||!r||me()<=0,surface:"solid",children:["Give $",Ce(me())," ",P&&t?t.id:""]}),x.jsx("div",{className:"text-center mt-4 px-6",children:x.jsxs(bn,{className:"text-sm",fg:"secondary",children:["By making this gift, you agree to our",x.jsx("br",{})," ",x.jsx("a",{href:"https://apollos.com/terms",target:"_blank",rel:"noopener noreferrer",className:"text-brand-primary underline",children:"Terms of Use"})," ","and"," ",x.jsx("a",{href:"https://apollos.com/privacy",target:"_blank",rel:"noopener noreferrer",className:"text-brand-primary underline",children:"Privacy Policy"}),"."]})})]})]})},hrt=new Map([["bold",w.createElement(w.Fragment,null,w.createElement("path",{d:"M176.49,95.51a12,12,0,0,1,0,17l-56,56a12,12,0,0,1-17,0l-24-24a12,12,0,1,1,17-17L112,143l47.51-47.52A12,12,0,0,1,176.49,95.51ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z"}))],["duotone",w.createElement(w.Fragment,null,w.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),w.createElement("path",{d:"M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["fill",w.createElement(w.Fragment,null,w.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm45.66,85.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z"}))],["light",w.createElement(w.Fragment,null,w.createElement("path",{d:"M172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",w.createElement(w.Fragment,null,w.createElement("path",{d:"M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["thin",w.createElement(w.Fragment,null,w.createElement("path",{d:"M170.83,101.17a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]);var vrt=Object.defineProperty,grt=Object.defineProperties,yrt=Object.getOwnPropertyDescriptors,Rie=Object.getOwnPropertySymbols,krt=Object.prototype.hasOwnProperty,brt=Object.prototype.propertyIsEnumerable,Mie=(e,t,n)=>t in e?vrt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Srt=(e,t)=>{for(var n in t||(t={}))krt.call(t,n)&&Mie(e,n,t[n]);if(Rie)for(var n of Rie(t))brt.call(t,n)&&Mie(e,n,t[n]);return e},Nrt=(e,t)=>grt(e,yrt(t));const Lie=T.forwardRef((e,t)=>w.createElement(Jm,Nrt(Srt({ref:t},e),{weights:hrt})));Lie.displayName="CheckCircle";const $ie=({onRetry:e,theme:t})=>{var n,r;return x.jsxs("div",{className:"text-center p-6 flex flex-col items-center justify-center min-h-full",children:[x.jsx("div",{className:"mb-6",children:x.jsx(Lie,{size:64,color:((r=(n=t==null?void 0:t.colors)==null?void 0:n.base)==null?void 0:r.secondary)||"#17B582",weight:"fill"})}),x.jsx(bn,{as:"h3",className:"mb-4",children:"Thank You!"}),x.jsx(bn,{fg:"secondary",className:"mb-12",children:"Your donation has been processed successfully."}),x.jsx(Xn,{surface:"solid",onClick:e,children:"Make Another Donation"})]})};$ie.propTypes={onRetry:Xe.func.isRequired};const A6=new Map,Ert=e=>typeof window>"u"?Promise.resolve(null):(A6.has(e)||A6.set(e,Promise.resolve().then(()=>Vlt).then(({loadStripe:t})=>t(e)).catch(t=>(console.error("Failed to load Stripe.js",t),A6.delete(e),null))),A6.get(e)),wrt=({amount:e="0",frequency:t,message:n="",campus:r="",fund:i="",predefinedAmounts:a="",width:o="",height:s="",displayLogo:c="",title:d="",displayHeader:m="",prefilledPayment:h=null,userFirstName:g=null,userLastName:y=null,userEmail:b=null,userPhone:N=null})=>{var Ge,je,at,_e,Ae,Ye;const F=Oe=>typeof Oe=="string"&&parseFloat(Oe)>0,_=Oe=>typeof Oe=="string"&&Oe.trim().length>0,O=Oe=>Oe===null||typeof Oe=="string"&&Oe.trim().length>0,I=Oe=>Oe==null||typeof Oe=="object"&&!!Oe.id,R=T.useCallback(Oe=>Oe?F(Oe.amount)&&_(Oe.campusId)&&O(Oe.fundId||null)&&I(Oe.selectedFrequency):!1,[]),[P,M]=T.useState("setup"),[U,q]=T.useState(""),[X,H]=T.useState(null),[ne,Y]=T.useState(!1),[ie,ae]=T.useState(null),[G,Pe]=T.useState(()=>({amount:e,selectedFrequency:T6(t),selectedCampusId:r||null,selectedFundId:i||null,selectedCampus:null,selectedFund:null})),[Ne,me]=T.useState(!1);T.useEffect(()=>{h&&h.amount&&h.campusId&&Pe({amount:h.amount,selectedFrequency:h.selectedFrequency??null,selectedCampusId:h.campusId,selectedFundId:h.fundId??null,selectedCampus:null,selectedFund:null})},[h]);const Ce=T.useRef({amount:e,campus:r,fund:i}),{currentChurch:V,loading:te,error:K}=_6(),{campuses:z}=yD(),ce=yie(),ye=Ant(),se=T.useMemo(()=>{var ct,xt,Je,ht,Ut,dn,Kt,Bn,Mn,Jr,Wn,On,qn,lr;const Oe={light:{primary:((xt=(ct=ye==null?void 0:ye.colors)==null?void 0:ct.base)==null?void 0:xt.primary)||"#00676D",background:tr.colors.light.fill.screen,componentBackground:tr.colors.light.fill.paper,componentBorder:tr.colors.light.neutral.gray5,componentDivider:tr.colors.light.neutral.gray4,primaryText:tr.colors.light.text.primary,secondaryText:tr.colors.light.text.secondary,componentText:tr.colors.light.text.primary,icon:tr.colors.light.neutral.gray},dark:{primary:((ht=(Je=ye==null?void 0:ye.colors)==null?void 0:Je.base)==null?void 0:ht.secondary)||"#17B582",background:tr.colors.dark.fill.screen,componentBackground:tr.colors.dark.fill.paper,componentBorder:tr.colors.dark.neutral.gray5,componentDivider:tr.colors.dark.neutral.gray4,primaryText:tr.colors.dark.text.primary,secondaryText:tr.colors.dark.text.secondary,componentText:tr.colors.dark.text.primary,icon:tr.colors.dark.neutral.gray}};return{theme:ce==="dark"?"night":"stripe",variables:{colorPrimary:((dn=(Ut=ye==null?void 0:ye.colors)==null?void 0:Ut.base)==null?void 0:dn.primary)||"#00676D",colorBackground:ce==="dark"?Oe.dark.componentBackground:Oe.light.componentBackground,colorText:ce==="dark"?Oe.dark.primaryText:Oe.light.primaryText,colorTextSecondary:ce==="dark"?Oe.dark.secondaryText:Oe.light.secondaryText,colorTextPlaceholder:ce==="dark"?Oe.dark.secondaryText:Oe.light.secondaryText,colorDanger:((Bn=(Kt=ye==null?void 0:ye.colors)==null?void 0:Kt.base)==null?void 0:Bn.alert)||"#FF4444",colorSuccess:((Jr=(Mn=ye==null?void 0:ye.colors)==null?void 0:Mn.base)==null?void 0:Jr.success)||"#17B582",colorWarning:((On=(Wn=ye==null?void 0:ye.colors)==null?void 0:Wn.base)==null?void 0:On.warning)||"#FFA500",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",fontSizeBase:"16px",spacingUnit:((qn=ye==null?void 0:ye.space)==null?void 0:qn.xxxs)||"4px",borderRadius:((lr=ye==null?void 0:ye.radii)==null?void 0:lr.base)||"6px",iconColor:ce==="dark"?Oe.dark.icon:Oe.light.icon}}},[ye,ce]);T.useEffect(()=>{var xt;const Oe=(xt=V==null?void 0:V.stripeConnectAccount)==null?void 0:xt.publishableKey;if(!Oe){ae(null);return}const ct=Ert(Oe);ae(ct)},[(Ge=V==null?void 0:V.stripeConnectAccount)==null?void 0:Ge.publishableKey]),T.useEffect(()=>{if(!h)if(t!==void 0)Pe(Oe=>({...Oe,selectedFrequency:T6(t)}));else if(V!=null&&V.givingDefaultFrequency){const Oe=V.givingDefaultFrequency;if(Oe==="One Time"||Oe===null)Pe(ct=>({...ct,selectedFrequency:null}));else{const ct=r1.find(xt=>xt.id===Oe)||null;Pe(xt=>({...xt,selectedFrequency:ct}))}}else Pe(Oe=>({...Oe,selectedFrequency:null}))},[V==null?void 0:V.givingDefaultFrequency,h,t]),T.useEffect(()=>{!h&&e!==Ce.current.amount&&e!==G.amount&&Pe(Oe=>({...Oe,amount:e})),Ce.current.amount=e},[e,h]),T.useEffect(()=>{!h&&r!==Ce.current.campus&&r!==G.selectedCampusId&&Pe(Oe=>({...Oe,selectedCampusId:r||null,selectedCampus:null,selectedFund:null,selectedFundId:null})),Ce.current.campus=r},[r,h]),T.useEffect(()=>{!h&&i!==Ce.current.fund&&i!==G.selectedFundId&&Pe(Oe=>({...Oe,selectedFundId:i||null,selectedFund:null})),Ce.current.fund=i},[i,h]),T.useEffect(()=>{var Oe;if(!h&&G.selectedFundId&&((Oe=G.selectedCampus)!=null&&Oe.donationFunds)&&!G.selectedFund){let ct=G.selectedCampus.donationFunds.find(xt=>xt.id===G.selectedFundId);ct||(ct=G.selectedCampus.donationFunds.find(xt=>yS(G.selectedFundId,xt.name)||xt.displayName&&yS(G.selectedFundId,xt.displayName))),ct&&Pe(xt=>({...xt,selectedFund:{...ct}}))}},[h,G.selectedFundId,(je=G.selectedCampus)==null?void 0:je.donationFunds,G.selectedFund]),T.useEffect(()=>{if(z.length>0&&G.selectedCampusId&&!G.selectedCampus){const Oe=G.selectedCampusId.startsWith("Campus:")?G.selectedCampusId.substring(7):G.selectedCampusId;let ct=z.find(xt=>xt.id===Oe);if(ct||(ct=z.find(xt=>xt.id===G.selectedCampusId)),ct||(ct=z.find(xt=>yS(G.selectedCampusId,xt.name))),ct){const xt={...ct,donationFunds:ct.donationFunds?ct.donationFunds.map(Je=>({...Je})):[]};if(Pe(Je=>({...Je,selectedCampus:xt})),G.selectedFundId&&xt.donationFunds){let Je=xt.donationFunds.find(ht=>ht.id===G.selectedFundId);Je||(Je=xt.donationFunds.find(ht=>yS(G.selectedFundId,ht.name)||ht.displayName&&yS(G.selectedFundId,ht.displayName))),Je&&Pe(ht=>({...ht,selectedFund:{...Je}}))}}}},[z,G.selectedCampusId,G.selectedFundId,G.selectedCampus]);const[$e,{loading:J}]=Cnt(),ge=T.useCallback(()=>{M("success")},[]),he=T.useCallback(Oe=>{q(Oe.message)},[]),be=T.useCallback(()=>{q("")},[]),ke=T.useCallback(()=>{M("setup"),q(""),H(null),me(!1),Pe({amount:e,selectedFrequency:T6(t),selectedCampusId:null,selectedFundId:null,selectedCampus:null,selectedFund:null}),Y(!1)},[e,t]),le=T.useCallback(Oe=>{Pe(ct=>({...ct,amount:Oe}))},[]),Le=T.useCallback(Oe=>{Pe(ct=>({...ct,selectedFrequency:Oe}))},[]),ve=T.useCallback(Oe=>{Pe(ct=>({...ct,selectedCampus:Oe,selectedCampusId:(Oe==null?void 0:Oe.id)||null,selectedFund:null,selectedFundId:null}))},[]),We=T.useCallback(Oe=>{Pe(ct=>({...ct,selectedFund:Oe,selectedFundId:(Oe==null?void 0:Oe.id)||null}))},[]),Ke=T.useCallback(async(Oe,ct,xt,Je)=>{var ht;try{const Ut={amount:Math.round(Oe*100),campusId:xt||"",fundId:Je||null};Ut.recurring=Int(ct);const{data:dn,errors:Kt}=await $e({variables:{input:Ut}});if(Kt)throw new Error(Kt[0].message);if((ht=dn==null?void 0:dn.createPaymentIntent)!=null&&ht.clientSecret)H(dn.createPaymentIntent.clientSecret),M("payment");else throw new Error("No client secret received from server")}catch(Ut){he(Ut)}},[$e,he]),gt=T.useCallback(()=>{M("setup"),H(null)},[]),Rt={width:o?isNaN(Number(o))?o:`${o}px`:"100%",height:s?isNaN(Number(s))?s:`${s}px`:"500px",maxWidth:o?void 0:"400px",margin:o?"0":"0 auto",border:"none",position:"relative",overflow:"hidden",padding:0},Nt=te||!ie||J||ne;if(T.useEffect(()=>{h&&R(h)&&!te&&!J&&!Ne&&P==="setup"&&(me(!0),Pe({amount:h.amount,selectedFrequency:h.selectedFrequency??null,selectedCampusId:h.campusId,selectedFundId:h.fundId??null,selectedCampus:null,selectedFund:null}),Ke(parseFloat(h.amount),Sie(h.selectedFrequency),h.campusId,h.fundId??""))},[h,te,J,Ne,P,Ke,R]),K)return x.jsx(Xl,{style:Rt,children:x.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center p-3",children:[x.jsx(bn,{className:"text-red-600",children:"Unable to load church information. Please try again later."}),x.jsx(Xn,{surface:"tinted",onClick:ke,className:"mt-2",children:"Try Again"})]})});if(!te&&!ie)return x.jsx(Xl,{style:Rt,children:x.jsx("div",{className:"flex-1 flex flex-col justify-center items-center p-3",children:x.jsx(bn,{className:"text-red-600",children:"Online giving is not currently available. Please contact your church for assistance."})})});if(P==="success")return x.jsx(Xl,{style:Rt,children:x.jsx("div",{className:"flex-1 flex flex-col justify-center items-center",children:x.jsx($ie,{onRetry:ke,theme:ye||void 0})})});const mt=g||y?`${g} ${y}`.trim():"",it=(V==null?void 0:V.name)||"Your Church";return x.jsxs(Xl,{style:Rt,children:[Nt?x.jsx("div",{className:"absolute inset-0 bg-material-screen dark:bg-material-screen-dark flex items-center justify-center z-[1000]",children:x.jsx(F6,{size:32,className:"animate-spin mx-auto mb-2"})}):null,U?x.jsxs("div",{className:"absolute top-0 left-0 right-0 z-[50] p-3 flex items-center gap-2 bg-red-50 dark:bg-red-900 rounded-xl",style:{borderColor:((_e=(at=ye==null?void 0:ye.colors)==null?void 0:at.base)==null?void 0:_e.alert)||"#FF4444"},children:[x.jsx(eie,{size:20,color:((Ye=(Ae=ye==null?void 0:ye.colors)==null?void 0:Ae.base)==null?void 0:Ye.alert)||"#FF4444",weight:"fill"}),x.jsx("div",{className:"flex-1",children:x.jsx(bn,{className:"text-red-700 dark:text-red-300 font-medium text-sm",children:U})}),x.jsx(Xn,{surface:"tinted",onClick:be,className:"p-1 min-w-0 text-red-700 dark:text-red-300 hover:bg-red-100 dark:hover:bg-red-800/30",children:x.jsx(rie,{size:16})})]}):null,x.jsx("div",{className:"flex flex-col h-full min-h-[400px]",children:P==="payment"&&X&&ie?x.jsx(pie,{stripe:ie,options:{clientSecret:X,appearance:se},children:x.jsx(_ie,{amount:G!=null&&G.amount?parseFloat(G.amount):parseFloat(e),selectedFrequency:G==null?void 0:G.selectedFrequency,selectedCampusId:(G==null?void 0:G.selectedCampusId)||void 0,selectedFundId:(G==null?void 0:G.selectedFundId)||void 0,onSuccess:ge,onError:he,isProcessing:ne,onProcessingChange:Y,onBack:gt,userFullName:mt,userEmail:b||void 0,userPhone:N||void 0,churchName:it,churchLogo:V==null?void 0:V.logo,message:n,displayLogo:c,title:d,displayHeader:m})}):x.jsx(x.Fragment,{children:P==="setup"&&!(h&&R(h)&&!Ne)?x.jsx(prt,{amount:G.amount,selectedFrequency:G.selectedFrequency,selectedCampus:G.selectedCampus,selectedFund:G.selectedFund,predefinedAmounts:a,onError:Oe=>he(new Error(Oe.message)),isProcessing:J,onAmountChange:le,onFrequencyChange:Le,onCampusChange:ve,onFundChange:We,onShowPayment:()=>{const Oe=typeof G.amount=="string"?parseFloat(G.amount):G.amount,ct=Sie(G.selectedFrequency);Ke(Oe,ct,G.selectedCampusId||"",G.selectedFundId||"")},churchName:it,churchLogo:V==null?void 0:V.logo,message:n,displayLogo:c,title:d,displayHeader:m}):P==="setup"&&h&&R(h)&&!Ne?x.jsxs("div",{className:"flex flex-col justify-center items-center h-full min-h-[400px]",children:[x.jsx(F6,{size:32,className:"animate-spin mx-auto mb-2"}),x.jsx(bn,{children:"Preparing your donation..."})]}):null})})]})},Frt=e=>{const[t,n]=T.useState(!1);T.useEffect(()=>{n(!0)},[]);const r=()=>({width:e.width?isNaN(Number(e.width))?e.width:`${e.width}px`:"100%",height:e.height?isNaN(Number(e.height))?e.height:`${e.height}px`:"500px",maxWidth:e.width?void 0:"400px",margin:e.width?"0":"0 auto",border:"none",position:"relative",overflow:"hidden",padding:0});return x.jsx(bie,{children:t?x.jsx(wrt,{...e}):x.jsx(Xl,{style:r(),children:x.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center p-3",children:[x.jsx(F6,{size:32,className:"animate-spin mx-auto mb-2"}),x.jsx(bn,{className:"text-center",children:"Loading donation form..."})]})})})},xrt=T.forwardRef(function({to:t,href:n,isExternal:r,...i},a){const{navigate:o}=l6(),s=yte(),c=kte(),d=bte(),m=Y5(),h=KZe();if(r&&n||!t)return x.jsx("a",{ref:a,href:n,...i});let g;if(typeof t=="object"){if(!t.contentId)return null;g=t.contentId.split(":").join("-")}else if(t!=null&&t.includes("ContentItem"))g=t.split("/").slice(-1)[0];else return null;if(!d&&!m)return x.jsx("a",{ref:a,...i,href:`https://apollos.site/@${h}/c/${g}`,target:"_blank",rel:"noopener noreferrer"});let y=c&&m?`/ac/${g}`:`?${s?"apollosId":"id"}=${g}`;return m||(y=`${d}${n}`),x.jsx("a",{ref:a,...i,href:y,onClick:b=>{b.preventDefault(),o({id:g})}})}),Crt=({children:e})=>x.jsx(mye,{linkComponent:xrt,children:e});function O6(){return O6=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},O6.apply(null,arguments)}function jie(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function ND(e,t){return ND=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},ND(e,t)}function Vie(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ND(e,t)}function _rt(e,t){return e.classList?!!t&&e.classList.contains(t):(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")!==-1}function Trt(e,t){e.classList?e.classList.add(t):_rt(e,t)||(typeof e.className=="string"?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}function Hie(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function Art(e,t){e.classList?e.classList.remove(t):typeof e.className=="string"?e.className=Hie(e.className,t):e.setAttribute("class",Hie(e.className&&e.className.baseVal||"",t))}const Uie={disabled:!1};var zie={},Ort=zie.NODE_ENV!=="production"?Xe.oneOfType([Xe.number,Xe.shape({enter:Xe.number,exit:Xe.number,appear:Xe.number}).isRequired]):null,Irt=zie.NODE_ENV!=="production"?Xe.oneOfType([Xe.string,Xe.shape({enter:Xe.string,exit:Xe.string,active:Xe.string}),Xe.shape({enter:Xe.string,enterDone:Xe.string,enterActive:Xe.string,exit:Xe.string,exitDone:Xe.string,exitActive:Xe.string})]):null;const Bie=w.createContext(null);var Wie=function(t){return t.scrollTop},Prt={},kS="unmounted",lv="exited",sv="entering",i1="entered",ED="exiting",sd=function(e){Vie(t,e);function t(r,i){var a;a=e.call(this,r,i)||this;var o=i,s=o&&!o.isMounting?r.enter:r.appear,c;return a.appearStatus=null,r.in?s?(c=lv,a.appearStatus=sv):c=i1:r.unmountOnExit||r.mountOnEnter?c=kS:c=lv,a.state={status:c},a.nextCallback=null,a}t.getDerivedStateFromProps=function(i,a){var o=i.in;return o&&a.status===kS?{status:lv}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(i){var a=null;if(i!==this.props){var o=this.state.status;this.props.in?o!==sv&&o!==i1&&(a=sv):(o===sv||o===i1)&&(a=ED)}this.updateStatus(!1,a)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var i=this.props.timeout,a,o,s;return a=o=s=i,i!=null&&typeof i!="number"&&(a=i.exit,o=i.enter,s=i.appear!==void 0?i.appear:o),{exit:a,enter:o,appear:s}},n.updateStatus=function(i,a){if(i===void 0&&(i=!1),a!==null)if(this.cancelNextCallback(),a===sv){if(this.props.unmountOnExit||this.props.mountOnEnter){var o=this.props.nodeRef?this.props.nodeRef.current:Ly.findDOMNode(this);o&&Wie(o)}this.performEnter(i)}else this.performExit();else this.props.unmountOnExit&&this.state.status===lv&&this.setState({status:kS})},n.performEnter=function(i){var a=this,o=this.props.enter,s=this.context?this.context.isMounting:i,c=this.props.nodeRef?[s]:[Ly.findDOMNode(this),s],d=c[0],m=c[1],h=this.getTimeouts(),g=s?h.appear:h.enter;if(!i&&!o||Uie.disabled){this.safeSetState({status:i1},function(){a.props.onEntered(d)});return}this.props.onEnter(d,m),this.safeSetState({status:sv},function(){a.props.onEntering(d,m),a.onTransitionEnd(g,function(){a.safeSetState({status:i1},function(){a.props.onEntered(d,m)})})})},n.performExit=function(){var i=this,a=this.props.exit,o=this.getTimeouts(),s=this.props.nodeRef?void 0:Ly.findDOMNode(this);if(!a||Uie.disabled){this.safeSetState({status:lv},function(){i.props.onExited(s)});return}this.props.onExit(s),this.safeSetState({status:ED},function(){i.props.onExiting(s),i.onTransitionEnd(o.exit,function(){i.safeSetState({status:lv},function(){i.props.onExited(s)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(i,a){a=this.setNextCallback(a),this.setState(i,a)},n.setNextCallback=function(i){var a=this,o=!0;return this.nextCallback=function(s){o&&(o=!1,a.nextCallback=null,i(s))},this.nextCallback.cancel=function(){o=!1},this.nextCallback},n.onTransitionEnd=function(i,a){this.setNextCallback(a);var o=this.props.nodeRef?this.props.nodeRef.current:Ly.findDOMNode(this),s=i==null&&!this.props.addEndListener;if(!o||s){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var c=this.props.nodeRef?[this.nextCallback]:[o,this.nextCallback],d=c[0],m=c[1];this.props.addEndListener(d,m)}i!=null&&setTimeout(this.nextCallback,i)},n.render=function(){var i=this.state.status;if(i===kS)return null;var a=this.props,o=a.children;a.in,a.mountOnEnter,a.unmountOnExit,a.appear,a.enter,a.exit,a.timeout,a.addEndListener,a.onEnter,a.onEntering,a.onEntered,a.onExit,a.onExiting,a.onExited,a.nodeRef;var s=jie(a,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return w.createElement(Bie.Provider,{value:null},typeof o=="function"?o(i,s):w.cloneElement(w.Children.only(o),s))},t}(w.Component);sd.contextType=Bie,sd.propTypes=Prt.NODE_ENV!=="production"?{nodeRef:Xe.shape({current:typeof Element>"u"?Xe.any:function(e,t,n,r,i,a){var o=e[t];return Xe.instanceOf(o&&"ownerDocument"in o?o.ownerDocument.defaultView.Element:Element)(e,t,n,r,i,a)}}),children:Xe.oneOfType([Xe.func.isRequired,Xe.element.isRequired]).isRequired,in:Xe.bool,mountOnEnter:Xe.bool,unmountOnExit:Xe.bool,appear:Xe.bool,enter:Xe.bool,exit:Xe.bool,timeout:function(t){var n=Ort;t.addEndListener||(n=n.isRequired);for(var r=arguments.length,i=new Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];return n.apply(void 0,[t].concat(i))},addEndListener:Xe.func,onEnter:Xe.func,onEntering:Xe.func,onEntered:Xe.func,onExit:Xe.func,onExiting:Xe.func,onExited:Xe.func}:{};function a1(){}sd.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:a1,onEntering:a1,onEntered:a1,onExit:a1,onExiting:a1,onExited:a1},sd.UNMOUNTED=kS,sd.EXITED=lv,sd.ENTERING=sv,sd.ENTERED=i1,sd.EXITING=ED;var Drt={},Rrt=function(t,n){return t&&n&&n.split(" ").forEach(function(r){return Trt(t,r)})},wD=function(t,n){return t&&n&&n.split(" ").forEach(function(r){return Art(t,r)})},FD=function(e){Vie(t,e);function t(){for(var r,i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return r=e.call.apply(e,[this].concat(a))||this,r.appliedClasses={appear:{},enter:{},exit:{}},r.onEnter=function(s,c){var d=r.resolveArguments(s,c),m=d[0],h=d[1];r.removeClasses(m,"exit"),r.addClass(m,h?"appear":"enter","base"),r.props.onEnter&&r.props.onEnter(s,c)},r.onEntering=function(s,c){var d=r.resolveArguments(s,c),m=d[0],h=d[1],g=h?"appear":"enter";r.addClass(m,g,"active"),r.props.onEntering&&r.props.onEntering(s,c)},r.onEntered=function(s,c){var d=r.resolveArguments(s,c),m=d[0],h=d[1],g=h?"appear":"enter";r.removeClasses(m,g),r.addClass(m,g,"done"),r.props.onEntered&&r.props.onEntered(s,c)},r.onExit=function(s){var c=r.resolveArguments(s),d=c[0];r.removeClasses(d,"appear"),r.removeClasses(d,"enter"),r.addClass(d,"exit","base"),r.props.onExit&&r.props.onExit(s)},r.onExiting=function(s){var c=r.resolveArguments(s),d=c[0];r.addClass(d,"exit","active"),r.props.onExiting&&r.props.onExiting(s)},r.onExited=function(s){var c=r.resolveArguments(s),d=c[0];r.removeClasses(d,"exit"),r.addClass(d,"exit","done"),r.props.onExited&&r.props.onExited(s)},r.resolveArguments=function(s,c){return r.props.nodeRef?[r.props.nodeRef.current,s]:[s,c]},r.getClassNames=function(s){var c=r.props.classNames,d=typeof c=="string",m=d&&c?c+"-":"",h=d?""+m+s:c[s],g=d?h+"-active":c[s+"Active"],y=d?h+"-done":c[s+"Done"];return{baseClassName:h,activeClassName:g,doneClassName:y}},r}var n=t.prototype;return n.addClass=function(i,a,o){var s=this.getClassNames(a)[o+"ClassName"],c=this.getClassNames("enter"),d=c.doneClassName;a==="appear"&&o==="done"&&d&&(s+=" "+d),o==="active"&&i&&Wie(i),s&&(this.appliedClasses[a][o]=s,Rrt(i,s))},n.removeClasses=function(i,a){var o=this.appliedClasses[a],s=o.base,c=o.active,d=o.done;this.appliedClasses[a]={},s&&wD(i,s),c&&wD(i,c),d&&wD(i,d)},n.render=function(){var i=this.props;i.classNames;var a=jie(i,["classNames"]);return w.createElement(sd,O6({},a,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(w.Component);FD.defaultProps={classNames:""},FD.propTypes=Drt.NODE_ENV!=="production"?O6({},sd.propTypes,{classNames:Irt,onEnter:Xe.func,onEntering:Xe.func,onEntered:Xe.func,onExit:Xe.func,onExiting:Xe.func,onExited:Xe.func}):{};const qie={Search:zn(FD)`
|
|
1944
|
+
`,prt=({amount:e="0",selectedFrequency:t=null,selectedCampus:n=null,selectedFund:r=null,predefinedAmounts:i="",onError:a,isProcessing:o=!1,onShowPayment:s,onAmountChange:c,onFrequencyChange:d,onCampusChange:m,onFundChange:h,churchName:g,churchLogo:y,message:b,displayLogo:N,title:F,displayHeader:_})=>{var te;const{currentChurch:O}=_6(),{campuses:I,loading:R}=yD(),P=bD(t),M=T.useRef(null),U=T.useRef(null),q=T.useRef(null),X=i?i.split(",").map(K=>K.trim()).filter(K=>K):[];T.useEffect(()=>{P&&M.current&&q.current&&setTimeout(()=>{const K=q.current,z=M.current;if(K&&z){const ce=K.getBoundingClientRect();z.getBoundingClientRect().bottom>ce.bottom&&z.scrollIntoView({behavior:"smooth",block:"nearest"})}},100)},[P]),T.useEffect(()=>{n&&U.current&&q.current&&setTimeout(()=>{const K=q.current,z=U.current;if(K&&z){const ce=K.getBoundingClientRect();z.getBoundingClientRect().bottom>ce.bottom&&z.scrollIntoView({behavior:"smooth",block:"nearest"})}},100)},[n]);const[H,ne]=T.useState(80),Y=T.useRef(null);T.useLayoutEffect(()=>{Y.current&&(Y.current.textContent=e||"0",ne(Math.max(Y.current.offsetWidth+16,80)))},[e]),T.useEffect(()=>{const K=setTimeout(()=>{Y.current&&(Y.current.textContent=e||"0",ne(Math.max(Y.current.offsetWidth+16,80)))},10);return()=>clearTimeout(K)},[e]);const ie=K=>{const z=parseFloat(K);return!isNaN(z)&&z>999999.99},ae=K=>{let z=K.replace(/[^0-9.]/g,"");if(z.includes(".")){const ce=z.split(".");ce.length>2&&(z=ce[0]+"."+ce.slice(1).join("")),ce[1]&&ce[1].length>2&&(z=ce[0]+"."+ce[1].substring(0,2))}z.length>1&&z[0]==="0"&&z[1]!=="."&&(z=z.substring(1)),!ie(z)&&(z==="."&&(z="0."),c==null||c(z))},G=K=>{const z=I.find(ce=>ce.id===K);if(z){const ce={...z,donationFunds:z.donationFunds?z.donationFunds.map(ye=>({...ye})):[]};m==null||m(ce),h==null||h(null)}else m==null||m(null),h==null||h(null)},Pe=K=>{var ce;if(!n)return;const z=(ce=n.donationFunds)==null?void 0:ce.find(ye=>ye.id===K);h==null||h(z?{...z}:null)},Ne=K=>{const z=r1.find(ce=>ce.id===K);d==null||d(z||null)},me=()=>{if(typeof e=="string"){const K=parseFloat(e);return isNaN(K)?0:K}return e||0},Ce=K=>Number(K).toFixed(2),V=()=>{const K=me();if(!K||K<=0){a({message:"Please enter a valid amount"});return}if(K<.5){a({message:"Please enter an amount of $0.50 or more"});return}if(!n){a({message:"Please select a campus"});return}if(!r){a({message:"Please select a fund"});return}s&&s()};return x.jsxs("div",{className:"flex flex-col h-full","data-testid":"donation-setup-form",children:[x.jsx("style",{children:mrt}),_!=="false"?x.jsx(SD,{churchName:g,churchLogo:y,message:b,title:F,displayLogo:N,theme:void 0}):null,x.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-6",ref:q,children:x.jsxs("div",{className:"space-y-4",children:[x.jsxs("div",{className:"",children:[x.jsxs("div",{className:"flex items-start justify-center text-[60px] font-bold leading-none min-h-[60px]",children:[x.jsx("span",{className:"text-3xl leading-normal font-bold mt-3 flex-none text-brand dark:text-white",children:"$"}),x.jsx("span",{ref:Y,className:"absolute invisible h-0 overflow-hidden whitespace-pre text-[80px] font-bold font-inherit p-0 m-0",style:{fontFamily:"inherit",position:"absolute",left:"-9999px",top:"-9999px"},children:e||"0"}),x.jsx("input",{type:"text",inputMode:"decimal",placeholder:"0",value:e,onKeyDown:K=>{if(!["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(K.key)){if(/^[0-9]$/.test(K.key)||K.key==="."||K.ctrlKey||K.metaKey){if(K.key==="."&&e.includes(".")){K.preventDefault();return}if(/^[0-9]$/.test(K.key)){const z=K.target,ce=z.value,ye=z.selectionStart||0,se=ce.substring(0,ye)+K.key+ce.substring(z.selectionEnd||0);if(ie(se)){K.preventDefault();return}}return}K.preventDefault()}},onChange:K=>{const z=K.target.value;ae(z),requestAnimationFrame(()=>{if(Y.current){Y.current.textContent=z||"0";const ce=Math.max(Y.current.offsetWidth+16,80);ne(ce)}})},onInput:K=>{const z=K.target.value;if(Y.current){Y.current.textContent=z||"0";const ce=Math.max(Y.current.offsetWidth+16,80);ne(ce)}},onKeyUp:K=>{const z=K.target.value;if(Y.current){Y.current.textContent=z||"0";const ce=Math.max(Y.current.offsetWidth+16,80);ne(ce)}},onFocus:K=>{setTimeout(()=>{K.target.select()},0)},onClick:K=>{K.target.select()},disabled:o||R,className:"text-[80px] font-bold border-none outline-none bg-transparent flex-none p-0 m-0 text-brand dark:text-white caret-current text-center appearance-none transition-[width] duration-100 ease-in-out",style:{width:`${H}px`}})]}),X&&X.length>0?x.jsx("div",{className:"flex flex-wrap pt-12",style:{gap:"6px"},children:X.map(K=>x.jsxs(Xn,{onClick:()=>ae(K),disabled:o||R,surface:e===K?"solid":"material",className:"min-w-0 flex-1",style:{flexBasis:"calc(25% - 4.5px)",minWidth:"0",...e===K&&{"--btn-bg":"rgb(var(--color-brand-primary))","--btn-hover-overlay":"rgb(255 255 255 / 15%)"}},children:["$",K]},K))}):null]}),x.jsx("div",{children:x.jsxs("div",{className:"flex",children:[x.jsxs(Xn,{onClick:()=>{d==null||d(r1.find(K=>K.id===(O==null?void 0:O.givingDefaultFrequency))||r1[2])},disabled:o||R,surface:P?"solid":"material",className:"flex-1 rounded-r-none",style:{...P&&{"--btn-bg":"rgb(var(--color-brand-primary))","--btn-hover-overlay":"rgb(255 255 255 / 15%)"}},children:[x.jsx(Oie,{size:24}),"Recurring"]}),x.jsxs(Xn,{onClick:()=>d==null?void 0:d(null),disabled:o||R,surface:P?"material":"solid",className:"flex-1 rounded-l-none",style:{...!P&&{"--btn-bg":"rgb(var(--color-brand-primary))","--btn-hover-overlay":"rgb(255 255 255 / 15%)"}},children:[x.jsx(Die,{size:24}),"One time"]})]})}),P?x.jsxs("div",{ref:M,children:[x.jsx(bn,{className:"mb-4 pl-4 text-sm",fg:"secondary",children:"Frequency"}),x.jsxs(OT,{value:(t==null?void 0:t.id)||"",onChange:K=>Ne(K.target.value),disabled:o||R,required:!0,surface:"material",children:[x.jsx("option",{value:"",children:"Select a frequency"}),r1.map(K=>x.jsx("option",{value:K.id,children:K.id},K.id))]})]}):null,x.jsxs("div",{children:[x.jsx(bn,{className:"mb-4 pl-4 text-sm",fg:"secondary",children:"Campus"}),x.jsxs(OT,{value:(n==null?void 0:n.id)||"",onChange:K=>G(K.target.value),disabled:o||R,required:!0,surface:"material",children:[x.jsx("option",{value:"",children:R?"Loading...":"Select a campus"}),I.map(K=>x.jsx("option",{value:K.id,children:K.name},K.id))]})]}),n?x.jsxs("div",{ref:U,children:[x.jsx(bn,{className:"mb-4 pl-4 text-sm",fg:"secondary",id:"fund-label",children:"Fund"}),x.jsxs(OT,{value:(r==null?void 0:r.id)||"",onChange:K=>Pe(K.target.value),disabled:o,required:!0,surface:"material","aria-labelledby":"fund-label",children:[x.jsx("option",{value:"",children:"Select a fund"}),(te=n.donationFunds)==null?void 0:te.sort((K,z)=>(K.displayOrder||0)-(z.displayOrder||0)).map(K=>x.jsx("option",{value:K.id,children:K.displayName||K.name},K.id))]})]}):null]})}),x.jsxs("div",{className:"sticky bottom-0 z-10 px-6 py-4 bg-system-chrome dark:bg-system-chrome-dark",children:[x.jsxs(Xn,{type:"button",className:"w-full py-3",onClick:V,disabled:o||R||!n||!r||me()<=0,surface:"solid",children:["Give $",Ce(me())," ",P&&t?t.id:""]}),x.jsx("div",{className:"text-center mt-4 px-6",children:x.jsxs(bn,{className:"text-sm",fg:"primary",children:["By making this gift, you agree to our",x.jsx("br",{})," ",x.jsx("a",{href:"https://apollos.com/terms",target:"_blank",rel:"noopener noreferrer",className:"text-brand-primary underline",children:"Terms of Use"})," ","and"," ",x.jsx("a",{href:"https://apollos.com/privacy",target:"_blank",rel:"noopener noreferrer",className:"text-brand-primary underline",children:"Privacy Policy"}),"."]})})]})]})},hrt=new Map([["bold",w.createElement(w.Fragment,null,w.createElement("path",{d:"M176.49,95.51a12,12,0,0,1,0,17l-56,56a12,12,0,0,1-17,0l-24-24a12,12,0,1,1,17-17L112,143l47.51-47.52A12,12,0,0,1,176.49,95.51ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z"}))],["duotone",w.createElement(w.Fragment,null,w.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),w.createElement("path",{d:"M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["fill",w.createElement(w.Fragment,null,w.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm45.66,85.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z"}))],["light",w.createElement(w.Fragment,null,w.createElement("path",{d:"M172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",w.createElement(w.Fragment,null,w.createElement("path",{d:"M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["thin",w.createElement(w.Fragment,null,w.createElement("path",{d:"M170.83,101.17a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]);var vrt=Object.defineProperty,grt=Object.defineProperties,yrt=Object.getOwnPropertyDescriptors,Rie=Object.getOwnPropertySymbols,krt=Object.prototype.hasOwnProperty,brt=Object.prototype.propertyIsEnumerable,Mie=(e,t,n)=>t in e?vrt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Srt=(e,t)=>{for(var n in t||(t={}))krt.call(t,n)&&Mie(e,n,t[n]);if(Rie)for(var n of Rie(t))brt.call(t,n)&&Mie(e,n,t[n]);return e},Nrt=(e,t)=>grt(e,yrt(t));const Lie=T.forwardRef((e,t)=>w.createElement(Jm,Nrt(Srt({ref:t},e),{weights:hrt})));Lie.displayName="CheckCircle";const $ie=({onRetry:e,theme:t})=>{var n,r;return x.jsxs("div",{className:"text-center p-6 flex flex-col items-center justify-center min-h-full",children:[x.jsx("div",{className:"mb-6",children:x.jsx(Lie,{size:64,color:((r=(n=t==null?void 0:t.colors)==null?void 0:n.base)==null?void 0:r.secondary)||"#17B582",weight:"fill"})}),x.jsx(bn,{as:"h3",className:"mb-4",children:"Thank You!"}),x.jsx(bn,{fg:"secondary",className:"mb-12",children:"Your donation has been processed successfully."}),x.jsx(Xn,{surface:"solid",onClick:e,children:"Make Another Donation"})]})};$ie.propTypes={onRetry:Xe.func.isRequired};const A6=new Map,Ert=e=>typeof window>"u"?Promise.resolve(null):(A6.has(e)||A6.set(e,Promise.resolve().then(()=>Vlt).then(({loadStripe:t})=>t(e)).catch(t=>(console.error("Failed to load Stripe.js",t),A6.delete(e),null))),A6.get(e)),wrt=({amount:e="0",frequency:t,message:n="",campus:r="",fund:i="",predefinedAmounts:a="",width:o="",height:s="",displayLogo:c="",title:d="",displayHeader:m="",prefilledPayment:h=null,userFirstName:g=null,userLastName:y=null,userEmail:b=null,userPhone:N=null})=>{var Ge,je,at,_e,Ae,Ye;const F=Oe=>typeof Oe=="string"&&parseFloat(Oe)>0,_=Oe=>typeof Oe=="string"&&Oe.trim().length>0,O=Oe=>Oe===null||typeof Oe=="string"&&Oe.trim().length>0,I=Oe=>Oe==null||typeof Oe=="object"&&!!Oe.id,R=T.useCallback(Oe=>Oe?F(Oe.amount)&&_(Oe.campusId)&&O(Oe.fundId||null)&&I(Oe.selectedFrequency):!1,[]),[P,M]=T.useState("setup"),[U,q]=T.useState(""),[X,H]=T.useState(null),[ne,Y]=T.useState(!1),[ie,ae]=T.useState(null),[G,Pe]=T.useState(()=>({amount:e,selectedFrequency:T6(t),selectedCampusId:r||null,selectedFundId:i||null,selectedCampus:null,selectedFund:null})),[Ne,me]=T.useState(!1);T.useEffect(()=>{h&&h.amount&&h.campusId&&Pe({amount:h.amount,selectedFrequency:h.selectedFrequency??null,selectedCampusId:h.campusId,selectedFundId:h.fundId??null,selectedCampus:null,selectedFund:null})},[h]);const Ce=T.useRef({amount:e,campus:r,fund:i}),{currentChurch:V,loading:te,error:K}=_6(),{campuses:z}=yD(),ce=yie(),ye=Ant(),se=T.useMemo(()=>{var ct,xt,Je,ht,Ut,dn,Kt,Bn,Mn,Jr,Wn,On,qn,lr;const Oe={light:{primary:((xt=(ct=ye==null?void 0:ye.colors)==null?void 0:ct.base)==null?void 0:xt.primary)||"#00676D",background:tr.colors.light.fill.screen,componentBackground:tr.colors.light.fill.paper,componentBorder:tr.colors.light.neutral.gray5,componentDivider:tr.colors.light.neutral.gray4,primaryText:tr.colors.light.text.primary,secondaryText:tr.colors.light.text.secondary,componentText:tr.colors.light.text.primary,icon:tr.colors.light.neutral.gray},dark:{primary:((ht=(Je=ye==null?void 0:ye.colors)==null?void 0:Je.base)==null?void 0:ht.secondary)||"#17B582",background:tr.colors.dark.fill.screen,componentBackground:tr.colors.dark.fill.paper,componentBorder:tr.colors.dark.neutral.gray5,componentDivider:tr.colors.dark.neutral.gray4,primaryText:tr.colors.dark.text.primary,secondaryText:tr.colors.dark.text.secondary,componentText:tr.colors.dark.text.primary,icon:tr.colors.dark.neutral.gray}};return{theme:ce==="dark"?"night":"stripe",variables:{colorPrimary:((dn=(Ut=ye==null?void 0:ye.colors)==null?void 0:Ut.base)==null?void 0:dn.primary)||"#00676D",colorBackground:ce==="dark"?Oe.dark.componentBackground:Oe.light.componentBackground,colorText:ce==="dark"?Oe.dark.primaryText:Oe.light.primaryText,colorTextSecondary:ce==="dark"?Oe.dark.secondaryText:Oe.light.secondaryText,colorTextPlaceholder:ce==="dark"?Oe.dark.secondaryText:Oe.light.secondaryText,colorDanger:((Bn=(Kt=ye==null?void 0:ye.colors)==null?void 0:Kt.base)==null?void 0:Bn.alert)||"#FF4444",colorSuccess:((Jr=(Mn=ye==null?void 0:ye.colors)==null?void 0:Mn.base)==null?void 0:Jr.success)||"#17B582",colorWarning:((On=(Wn=ye==null?void 0:ye.colors)==null?void 0:Wn.base)==null?void 0:On.warning)||"#FFA500",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",fontSizeBase:"16px",spacingUnit:((qn=ye==null?void 0:ye.space)==null?void 0:qn.xxxs)||"4px",borderRadius:((lr=ye==null?void 0:ye.radii)==null?void 0:lr.base)||"6px",iconColor:ce==="dark"?Oe.dark.icon:Oe.light.icon}}},[ye,ce]);T.useEffect(()=>{var xt;const Oe=(xt=V==null?void 0:V.stripeConnectAccount)==null?void 0:xt.publishableKey;if(!Oe){ae(null);return}const ct=Ert(Oe);ae(ct)},[(Ge=V==null?void 0:V.stripeConnectAccount)==null?void 0:Ge.publishableKey]),T.useEffect(()=>{if(!h)if(t!==void 0)Pe(Oe=>({...Oe,selectedFrequency:T6(t)}));else if(V!=null&&V.givingDefaultFrequency){const Oe=V.givingDefaultFrequency;if(Oe==="One Time"||Oe===null)Pe(ct=>({...ct,selectedFrequency:null}));else{const ct=r1.find(xt=>xt.id===Oe)||null;Pe(xt=>({...xt,selectedFrequency:ct}))}}else Pe(Oe=>({...Oe,selectedFrequency:null}))},[V==null?void 0:V.givingDefaultFrequency,h,t]),T.useEffect(()=>{!h&&e!==Ce.current.amount&&e!==G.amount&&Pe(Oe=>({...Oe,amount:e})),Ce.current.amount=e},[e,h]),T.useEffect(()=>{!h&&r!==Ce.current.campus&&r!==G.selectedCampusId&&Pe(Oe=>({...Oe,selectedCampusId:r||null,selectedCampus:null,selectedFund:null,selectedFundId:null})),Ce.current.campus=r},[r,h]),T.useEffect(()=>{!h&&i!==Ce.current.fund&&i!==G.selectedFundId&&Pe(Oe=>({...Oe,selectedFundId:i||null,selectedFund:null})),Ce.current.fund=i},[i,h]),T.useEffect(()=>{var Oe;if(!h&&G.selectedFundId&&((Oe=G.selectedCampus)!=null&&Oe.donationFunds)&&!G.selectedFund){let ct=G.selectedCampus.donationFunds.find(xt=>xt.id===G.selectedFundId);ct||(ct=G.selectedCampus.donationFunds.find(xt=>yS(G.selectedFundId,xt.name)||xt.displayName&&yS(G.selectedFundId,xt.displayName))),ct&&Pe(xt=>({...xt,selectedFund:{...ct}}))}},[h,G.selectedFundId,(je=G.selectedCampus)==null?void 0:je.donationFunds,G.selectedFund]),T.useEffect(()=>{if(z.length>0&&G.selectedCampusId&&!G.selectedCampus){const Oe=G.selectedCampusId.startsWith("Campus:")?G.selectedCampusId.substring(7):G.selectedCampusId;let ct=z.find(xt=>xt.id===Oe);if(ct||(ct=z.find(xt=>xt.id===G.selectedCampusId)),ct||(ct=z.find(xt=>yS(G.selectedCampusId,xt.name))),ct){const xt={...ct,donationFunds:ct.donationFunds?ct.donationFunds.map(Je=>({...Je})):[]};if(Pe(Je=>({...Je,selectedCampus:xt})),G.selectedFundId&&xt.donationFunds){let Je=xt.donationFunds.find(ht=>ht.id===G.selectedFundId);Je||(Je=xt.donationFunds.find(ht=>yS(G.selectedFundId,ht.name)||ht.displayName&&yS(G.selectedFundId,ht.displayName))),Je&&Pe(ht=>({...ht,selectedFund:{...Je}}))}}}},[z,G.selectedCampusId,G.selectedFundId,G.selectedCampus]);const[$e,{loading:J}]=Cnt(),ge=T.useCallback(()=>{M("success")},[]),he=T.useCallback(Oe=>{q(Oe.message)},[]),be=T.useCallback(()=>{q("")},[]),ke=T.useCallback(()=>{M("setup"),q(""),H(null),me(!1),Pe({amount:e,selectedFrequency:T6(t),selectedCampusId:null,selectedFundId:null,selectedCampus:null,selectedFund:null}),Y(!1)},[e,t]),le=T.useCallback(Oe=>{Pe(ct=>({...ct,amount:Oe}))},[]),Le=T.useCallback(Oe=>{Pe(ct=>({...ct,selectedFrequency:Oe}))},[]),ve=T.useCallback(Oe=>{Pe(ct=>({...ct,selectedCampus:Oe,selectedCampusId:(Oe==null?void 0:Oe.id)||null,selectedFund:null,selectedFundId:null}))},[]),We=T.useCallback(Oe=>{Pe(ct=>({...ct,selectedFund:Oe,selectedFundId:(Oe==null?void 0:Oe.id)||null}))},[]),Ke=T.useCallback(async(Oe,ct,xt,Je)=>{var ht;try{const Ut={amount:Math.round(Oe*100),campusId:xt||"",fundId:Je||null};Ut.recurring=Int(ct);const{data:dn,errors:Kt}=await $e({variables:{input:Ut}});if(Kt)throw new Error(Kt[0].message);if((ht=dn==null?void 0:dn.createPaymentIntent)!=null&&ht.clientSecret)H(dn.createPaymentIntent.clientSecret),M("payment");else throw new Error("No client secret received from server")}catch(Ut){he(Ut)}},[$e,he]),gt=T.useCallback(()=>{M("setup"),H(null)},[]),Rt={width:o?isNaN(Number(o))?o:`${o}px`:"100%",height:s?isNaN(Number(s))?s:`${s}px`:"500px",maxWidth:o?void 0:"400px",margin:o?"0":"0 auto",border:"none",position:"relative",overflow:"hidden",padding:0},Nt=te||!ie||J||ne;if(T.useEffect(()=>{h&&R(h)&&!te&&!J&&!Ne&&P==="setup"&&(me(!0),Pe({amount:h.amount,selectedFrequency:h.selectedFrequency??null,selectedCampusId:h.campusId,selectedFundId:h.fundId??null,selectedCampus:null,selectedFund:null}),Ke(parseFloat(h.amount),Sie(h.selectedFrequency),h.campusId,h.fundId??""))},[h,te,J,Ne,P,Ke,R]),K)return x.jsx(Xl,{style:Rt,children:x.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center p-3",children:[x.jsx(bn,{className:"text-red-600",children:"Unable to load church information. Please try again later."}),x.jsx(Xn,{surface:"tinted",onClick:ke,className:"mt-2",children:"Try Again"})]})});if(!te&&!ie)return x.jsx(Xl,{style:Rt,children:x.jsx("div",{className:"flex-1 flex flex-col justify-center items-center p-3",children:x.jsx(bn,{className:"text-red-600",children:"Online giving is not currently available. Please contact your church for assistance."})})});if(P==="success")return x.jsx(Xl,{style:Rt,children:x.jsx("div",{className:"flex-1 flex flex-col justify-center items-center",children:x.jsx($ie,{onRetry:ke,theme:ye||void 0})})});const mt=g||y?`${g} ${y}`.trim():"",it=(V==null?void 0:V.name)||"Your Church";return x.jsxs(Xl,{style:Rt,children:[Nt?x.jsx("div",{className:"absolute inset-0 bg-material-screen dark:bg-material-screen-dark flex items-center justify-center z-[1000]",children:x.jsx(F6,{size:32,className:"animate-spin mx-auto mb-2"})}):null,U?x.jsxs("div",{className:"absolute top-0 left-0 right-0 z-[50] p-3 flex items-center gap-2 bg-red-50 dark:bg-red-900 rounded-xl",style:{borderColor:((_e=(at=ye==null?void 0:ye.colors)==null?void 0:at.base)==null?void 0:_e.alert)||"#FF4444"},children:[x.jsx(eie,{size:20,color:((Ye=(Ae=ye==null?void 0:ye.colors)==null?void 0:Ae.base)==null?void 0:Ye.alert)||"#FF4444",weight:"fill"}),x.jsx("div",{className:"flex-1",children:x.jsx(bn,{className:"text-red-700 dark:text-red-300 font-medium text-sm",children:U})}),x.jsx(Xn,{surface:"tinted",onClick:be,className:"p-1 min-w-0 text-red-700 dark:text-red-300 hover:bg-red-100 dark:hover:bg-red-800/30",children:x.jsx(rie,{size:16})})]}):null,x.jsx("div",{className:"flex flex-col h-full min-h-[400px]",children:P==="payment"&&X&&ie?x.jsx(pie,{stripe:ie,options:{clientSecret:X,appearance:se},children:x.jsx(_ie,{amount:G!=null&&G.amount?parseFloat(G.amount):parseFloat(e),selectedFrequency:G==null?void 0:G.selectedFrequency,selectedCampusId:(G==null?void 0:G.selectedCampusId)||void 0,selectedFundId:(G==null?void 0:G.selectedFundId)||void 0,onSuccess:ge,onError:he,isProcessing:ne,onProcessingChange:Y,onBack:gt,userFullName:mt,userEmail:b||void 0,userPhone:N||void 0,churchName:it,churchLogo:V==null?void 0:V.logo,message:n,displayLogo:c,title:d,displayHeader:m})}):x.jsx(x.Fragment,{children:P==="setup"&&!(h&&R(h)&&!Ne)?x.jsx(prt,{amount:G.amount,selectedFrequency:G.selectedFrequency,selectedCampus:G.selectedCampus,selectedFund:G.selectedFund,predefinedAmounts:a,onError:Oe=>he(new Error(Oe.message)),isProcessing:J,onAmountChange:le,onFrequencyChange:Le,onCampusChange:ve,onFundChange:We,onShowPayment:()=>{const Oe=typeof G.amount=="string"?parseFloat(G.amount):G.amount,ct=Sie(G.selectedFrequency);Ke(Oe,ct,G.selectedCampusId||"",G.selectedFundId||"")},churchName:it,churchLogo:V==null?void 0:V.logo,message:n,displayLogo:c,title:d,displayHeader:m}):P==="setup"&&h&&R(h)&&!Ne?x.jsxs("div",{className:"flex flex-col justify-center items-center h-full min-h-[400px]",children:[x.jsx(F6,{size:32,className:"animate-spin mx-auto mb-2"}),x.jsx(bn,{children:"Preparing your donation..."})]}):null})})]})},Frt=e=>{const[t,n]=T.useState(!1);T.useEffect(()=>{n(!0)},[]);const r=()=>({width:e.width?isNaN(Number(e.width))?e.width:`${e.width}px`:"100%",height:e.height?isNaN(Number(e.height))?e.height:`${e.height}px`:"500px",maxWidth:e.width?void 0:"400px",margin:e.width?"0":"0 auto",border:"none",position:"relative",overflow:"hidden",padding:0});return x.jsx(bie,{children:t?x.jsx(wrt,{...e}):x.jsx(Xl,{style:r(),children:x.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center p-3",children:[x.jsx(F6,{size:32,className:"animate-spin mx-auto mb-2"}),x.jsx(bn,{className:"text-center",children:"Loading donation form..."})]})})})},xrt=T.forwardRef(function({to:t,href:n,isExternal:r,...i},a){const{navigate:o}=l6(),s=yte(),c=kte(),d=bte(),m=Y5(),h=KZe();if(r&&n||!t)return x.jsx("a",{ref:a,href:n,...i});let g;if(typeof t=="object"){if(!t.contentId)return null;g=t.contentId.split(":").join("-")}else if(t!=null&&t.includes("ContentItem"))g=t.split("/").slice(-1)[0];else return null;if(!d&&!m)return x.jsx("a",{ref:a,...i,href:`https://apollos.site/@${h}/c/${g}`,target:"_blank",rel:"noopener noreferrer"});let y=c&&m?`/ac/${g}`:`?${s?"apollosId":"id"}=${g}`;return m||(y=`${d}${n}`),x.jsx("a",{ref:a,...i,href:y,onClick:b=>{b.preventDefault(),o({id:g})}})}),Crt=({children:e})=>x.jsx(mye,{linkComponent:xrt,children:e});function O6(){return O6=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},O6.apply(null,arguments)}function jie(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function ND(e,t){return ND=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},ND(e,t)}function Vie(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ND(e,t)}function _rt(e,t){return e.classList?!!t&&e.classList.contains(t):(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")!==-1}function Trt(e,t){e.classList?e.classList.add(t):_rt(e,t)||(typeof e.className=="string"?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}function Hie(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function Art(e,t){e.classList?e.classList.remove(t):typeof e.className=="string"?e.className=Hie(e.className,t):e.setAttribute("class",Hie(e.className&&e.className.baseVal||"",t))}const Uie={disabled:!1};var zie={},Ort=zie.NODE_ENV!=="production"?Xe.oneOfType([Xe.number,Xe.shape({enter:Xe.number,exit:Xe.number,appear:Xe.number}).isRequired]):null,Irt=zie.NODE_ENV!=="production"?Xe.oneOfType([Xe.string,Xe.shape({enter:Xe.string,exit:Xe.string,active:Xe.string}),Xe.shape({enter:Xe.string,enterDone:Xe.string,enterActive:Xe.string,exit:Xe.string,exitDone:Xe.string,exitActive:Xe.string})]):null;const Bie=w.createContext(null);var Wie=function(t){return t.scrollTop},Prt={},kS="unmounted",lv="exited",sv="entering",i1="entered",ED="exiting",sd=function(e){Vie(t,e);function t(r,i){var a;a=e.call(this,r,i)||this;var o=i,s=o&&!o.isMounting?r.enter:r.appear,c;return a.appearStatus=null,r.in?s?(c=lv,a.appearStatus=sv):c=i1:r.unmountOnExit||r.mountOnEnter?c=kS:c=lv,a.state={status:c},a.nextCallback=null,a}t.getDerivedStateFromProps=function(i,a){var o=i.in;return o&&a.status===kS?{status:lv}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(i){var a=null;if(i!==this.props){var o=this.state.status;this.props.in?o!==sv&&o!==i1&&(a=sv):(o===sv||o===i1)&&(a=ED)}this.updateStatus(!1,a)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var i=this.props.timeout,a,o,s;return a=o=s=i,i!=null&&typeof i!="number"&&(a=i.exit,o=i.enter,s=i.appear!==void 0?i.appear:o),{exit:a,enter:o,appear:s}},n.updateStatus=function(i,a){if(i===void 0&&(i=!1),a!==null)if(this.cancelNextCallback(),a===sv){if(this.props.unmountOnExit||this.props.mountOnEnter){var o=this.props.nodeRef?this.props.nodeRef.current:Ly.findDOMNode(this);o&&Wie(o)}this.performEnter(i)}else this.performExit();else this.props.unmountOnExit&&this.state.status===lv&&this.setState({status:kS})},n.performEnter=function(i){var a=this,o=this.props.enter,s=this.context?this.context.isMounting:i,c=this.props.nodeRef?[s]:[Ly.findDOMNode(this),s],d=c[0],m=c[1],h=this.getTimeouts(),g=s?h.appear:h.enter;if(!i&&!o||Uie.disabled){this.safeSetState({status:i1},function(){a.props.onEntered(d)});return}this.props.onEnter(d,m),this.safeSetState({status:sv},function(){a.props.onEntering(d,m),a.onTransitionEnd(g,function(){a.safeSetState({status:i1},function(){a.props.onEntered(d,m)})})})},n.performExit=function(){var i=this,a=this.props.exit,o=this.getTimeouts(),s=this.props.nodeRef?void 0:Ly.findDOMNode(this);if(!a||Uie.disabled){this.safeSetState({status:lv},function(){i.props.onExited(s)});return}this.props.onExit(s),this.safeSetState({status:ED},function(){i.props.onExiting(s),i.onTransitionEnd(o.exit,function(){i.safeSetState({status:lv},function(){i.props.onExited(s)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(i,a){a=this.setNextCallback(a),this.setState(i,a)},n.setNextCallback=function(i){var a=this,o=!0;return this.nextCallback=function(s){o&&(o=!1,a.nextCallback=null,i(s))},this.nextCallback.cancel=function(){o=!1},this.nextCallback},n.onTransitionEnd=function(i,a){this.setNextCallback(a);var o=this.props.nodeRef?this.props.nodeRef.current:Ly.findDOMNode(this),s=i==null&&!this.props.addEndListener;if(!o||s){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var c=this.props.nodeRef?[this.nextCallback]:[o,this.nextCallback],d=c[0],m=c[1];this.props.addEndListener(d,m)}i!=null&&setTimeout(this.nextCallback,i)},n.render=function(){var i=this.state.status;if(i===kS)return null;var a=this.props,o=a.children;a.in,a.mountOnEnter,a.unmountOnExit,a.appear,a.enter,a.exit,a.timeout,a.addEndListener,a.onEnter,a.onEntering,a.onEntered,a.onExit,a.onExiting,a.onExited,a.nodeRef;var s=jie(a,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return w.createElement(Bie.Provider,{value:null},typeof o=="function"?o(i,s):w.cloneElement(w.Children.only(o),s))},t}(w.Component);sd.contextType=Bie,sd.propTypes=Prt.NODE_ENV!=="production"?{nodeRef:Xe.shape({current:typeof Element>"u"?Xe.any:function(e,t,n,r,i,a){var o=e[t];return Xe.instanceOf(o&&"ownerDocument"in o?o.ownerDocument.defaultView.Element:Element)(e,t,n,r,i,a)}}),children:Xe.oneOfType([Xe.func.isRequired,Xe.element.isRequired]).isRequired,in:Xe.bool,mountOnEnter:Xe.bool,unmountOnExit:Xe.bool,appear:Xe.bool,enter:Xe.bool,exit:Xe.bool,timeout:function(t){var n=Ort;t.addEndListener||(n=n.isRequired);for(var r=arguments.length,i=new Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];return n.apply(void 0,[t].concat(i))},addEndListener:Xe.func,onEnter:Xe.func,onEntering:Xe.func,onEntered:Xe.func,onExit:Xe.func,onExiting:Xe.func,onExited:Xe.func}:{};function a1(){}sd.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:a1,onEntering:a1,onEntered:a1,onExit:a1,onExiting:a1,onExited:a1},sd.UNMOUNTED=kS,sd.EXITED=lv,sd.ENTERING=sv,sd.ENTERED=i1,sd.EXITING=ED;var Drt={},Rrt=function(t,n){return t&&n&&n.split(" ").forEach(function(r){return Trt(t,r)})},wD=function(t,n){return t&&n&&n.split(" ").forEach(function(r){return Art(t,r)})},FD=function(e){Vie(t,e);function t(){for(var r,i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return r=e.call.apply(e,[this].concat(a))||this,r.appliedClasses={appear:{},enter:{},exit:{}},r.onEnter=function(s,c){var d=r.resolveArguments(s,c),m=d[0],h=d[1];r.removeClasses(m,"exit"),r.addClass(m,h?"appear":"enter","base"),r.props.onEnter&&r.props.onEnter(s,c)},r.onEntering=function(s,c){var d=r.resolveArguments(s,c),m=d[0],h=d[1],g=h?"appear":"enter";r.addClass(m,g,"active"),r.props.onEntering&&r.props.onEntering(s,c)},r.onEntered=function(s,c){var d=r.resolveArguments(s,c),m=d[0],h=d[1],g=h?"appear":"enter";r.removeClasses(m,g),r.addClass(m,g,"done"),r.props.onEntered&&r.props.onEntered(s,c)},r.onExit=function(s){var c=r.resolveArguments(s),d=c[0];r.removeClasses(d,"appear"),r.removeClasses(d,"enter"),r.addClass(d,"exit","base"),r.props.onExit&&r.props.onExit(s)},r.onExiting=function(s){var c=r.resolveArguments(s),d=c[0];r.addClass(d,"exit","active"),r.props.onExiting&&r.props.onExiting(s)},r.onExited=function(s){var c=r.resolveArguments(s),d=c[0];r.removeClasses(d,"exit"),r.addClass(d,"exit","done"),r.props.onExited&&r.props.onExited(s)},r.resolveArguments=function(s,c){return r.props.nodeRef?[r.props.nodeRef.current,s]:[s,c]},r.getClassNames=function(s){var c=r.props.classNames,d=typeof c=="string",m=d&&c?c+"-":"",h=d?""+m+s:c[s],g=d?h+"-active":c[s+"Active"],y=d?h+"-done":c[s+"Done"];return{baseClassName:h,activeClassName:g,doneClassName:y}},r}var n=t.prototype;return n.addClass=function(i,a,o){var s=this.getClassNames(a)[o+"ClassName"],c=this.getClassNames("enter"),d=c.doneClassName;a==="appear"&&o==="done"&&d&&(s+=" "+d),o==="active"&&i&&Wie(i),s&&(this.appliedClasses[a][o]=s,Rrt(i,s))},n.removeClasses=function(i,a){var o=this.appliedClasses[a],s=o.base,c=o.active,d=o.done;this.appliedClasses[a]={},s&&wD(i,s),c&&wD(i,c),d&&wD(i,d)},n.render=function(){var i=this.props;i.classNames;var a=jie(i,["classNames"]);return w.createElement(sd,O6({},a,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(w.Component);FD.defaultProps={classNames:""},FD.propTypes=Drt.NODE_ENV!=="production"?O6({},sd.propTypes,{classNames:Irt,onEnter:Xe.func,onEntering:Xe.func,onEntered:Xe.func,onExit:Xe.func,onExiting:Xe.func,onExited:Xe.func}):{};const qie={Search:zn(FD)`
|
|
1945
1945
|
opacity: 0;
|
|
1946
1946
|
transition: opacity 0.3s ease-in-out;
|
|
1947
1947
|
|