https://donat-widget.netlify.app/_next/static/chunks/pages/widget/[collectionId]-2e6ea1c86ddf9069.js
1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[297],{5380:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/widget/[collectionId]",function(){return n(9915)}])},530:function(e,t,n){"use strict";var l=n(5893),a=n(2567),i=n(3967),o=n.n(i);let r={plain:"",nav:"w-28 h-10 bg-donat-blue text-white rounded-xl [&:not(:disabled)]:hover-grow !py-4 min-w-[100px]",amount:"w-28 h-10 bg-donat-blue text-white opacity-80 [&:not(:disabled)]:hover:opacity-100 rounded-xl",iconBg:"text-2xl text-donat-blue font-light w-6 h-6 rounded-xl hover:bg-donat-blue hover:text-white",iconGrow:"[&:not(:disabled)]:hover-grow-lg",iconBoth:"min-w-[15px] p-[3px] bg-white text-donat-green rounded-sm [&:not(:disabled)]:hover:bg-donat-blue [&:not(:disabled)]:hover-grow-lg"};t.Z=e=>{let t=()=>(0,l.jsxs)("button",{disabled:e.disabled||e.loading,className:o()("flex justify-center items-center gap-3 disabled:opacity-70",r[e.variant||"plain"],e.className),type:e.type,onClick:e.onClick,children:[e.label,e.loading&&(0,l.jsx)(a.JO,{icon:"ant-design:loading-outlined",className:"animate-spin"}),!e.loading&&e.icon&&(0,l.jsx)(a.JO,{icon:e.icon,className:"text-[130%]"})]});return e.link?(0,l.jsx)("a",{href:e.link,target:"_blank",rel:"noreferrer noopener",children:(0,l.jsx)(t,{})}):(0,l.jsx)(t,{})}},3040:function(e,t,n){"use strict";var l=n(5893),a=n(3967),i=n.n(a);t.Z=e=>(0,l.jsxs)("div",{className:i()("round-checkbox relative group flex items-center gap-3 w-full px-3 py-1 rounded-xl",!e.disabled&&"cursor-pointer"),onClick:()=>{var t;e.disabled||null===(t=e.onChange)||void 0===t||t.call(e)},children:[(0,l.jsx)("input",{type:"checkbox",className:i()("invisible outline-none placeholder-white-500",!e.disabled&&"cursor-pointer",e.className),disabled:e.disabled,checked:e.value,onChange:()=>null}),(0,l.jsx)("label",{htmlFor:"checkbox",className:i()("bg-white rounded-full items-center border border-white cursor-pointer h-7 w-7 absolute left-0 top-[10]",!e.disabled&&"cursor-pointer",e.value&&"!bg-donat-blue !border-donat-blue group-hover:!bg-white"),children:(0,l.jsx)("div",{className:"border-2 border-white border-t-0 border-r-0 group-hover:border-donat-blue w-3 h-1.5 absolute top-2 left-[7px] -rotate-45"})}),(0,l.jsx)("div",{className:e.disabled?"text-gray-400":"text-donat-blue",children:e.label})]})},7900:function(e,t,n){"use strict";var l=n(5893),a=n(3967),i=n.n(a);t.Z=e=>(0,l.jsxs)("div",{className:"w-full flex flex-col gap-2",children:[(0,l.jsx)("input",{type:e.type,placeholder:e.placeholder,className:i()("w-full h-10 bg-white placeholder-gray-400 text-donat-blue px-3 py-1 rounded-xl text-center",{"border border-red-500":e.error,"border-0":!e.error},e.className),disabled:e.disabled,...e.register}),e.error&&e.error.type&&(0,l.jsx)("div",{className:"text-red-500 text-right text-xs absolute mt-[25px] ml-[10px]",children:e.error.message||e.error.type})]})},4890:function(e,t,n){"use strict";var l=n(5893),a=n(2567);t.Z=()=>(0,l.jsx)("div",{className:"w-full h-full flex items-center justify-center",children:(0,l.jsx)(a.JO,{icon:"ant-design:loading-outlined",className:"w-20 h-20 animate-spin text-white"})})},5718:function(e,t,n){"use strict";var l=n(5893),a=n(7294),i=n(8003),o=n(5675),r=n.n(o),s=n(8276);t.Z=e=>{let{i18n:t}=(0,s.$G)(),n=(0,a.useMemo)(()=>"options"in e.options[0]?e.options.flatMap(e=>e.options):e.options,[e.options]);return(0,l.jsx)(i.ZP,{value:n.find(t=>t.value===e.value),onChange:t=>{var n;null===(n=e.onChange)||void 0===n||n.call(e,t.value)},options:e.options,formatOptionLabel:e=>(0,l.jsxs)("div",{className:"flex gap-4 pl-4 justify-left items-center",children:[e.icon&&(0,l.jsx)(r(),{src:e.icon,alt:e.label,width:"20",height:"20",className:"max-h-6 max-w-6"}),(0,l.jsx)("span",{children:"en"===t.language&&e.labelEn||e.label})]}),styles:{control:e=>({...e,display:"flex",justifyContent:"center",margin:"auto",borderRadius:"0.75rem"}),option:e=>({...e}),valueContainer:e=>({...e,justifyContent:"center"})},className:"w-full h-10 text-donat-blue",menuPosition:"fixed",minMenuHeight:500})}},746:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var l=n(5893),a=n(5675),i=n.n(a);n(7294);var o=n(1163),r=n(8276),s=n(530);let c=[{value:"cz",icon:"flag:cz-4x3"},{value:"en",icon:"flag:gb-4x3"}];var d=()=>{let e=(0,o.useRouter)(),{i18n:t}=(0,r.$G)(),n=t.language,a=c.find(e=>e.value!==n),i=t=>{e.push({pathname:e.pathname,query:e.query},e.asPath,{locale:t})};return(0,l.jsx)("div",{children:a&&(0,l.jsx)(s.Z,{icon:a.icon,className:"hover-grow",onClick:()=>i(a.value),"aria-label":"Switch to ".concat("en"===a.value?"English":"Czech")})})},u=()=>{let{t:e}=(0,r.$G)();return(0,l.jsxs)("div",{className:"w-full flex justify-between items-center align-middle min-h-[32px] px-6 bottom-0 bg-donat-blue text-small",children:[(0,l.jsxs)("div",{className:"flex gap-3",children:[(0,l.jsx)("a",{href:"https://donat.network/",target:"_blank",rel:"noreferrer noopener",children:(0,l.jsx)(i(),{src:"/img/logo/logo-inline-white-green.svg",alt:"DonatNetwork",width:105,height:18,className:"hover-grow",priority:!0})}),(0,l.jsxs)("span",{className:"opacity-70",children:[e("footer.prices_from")," ",(0,l.jsx)("a",{href:"https://coingecko.com/",target:"_blank",rel:"noreferrer noopener",className:"text-blue-600 hover:text-blue-700",children:"CoinGecko"})]})]}),(0,l.jsx)("div",{}),(0,l.jsx)(d,{})]})}},7689:function(e,t,n){"use strict";n.d(t,{GZ:function(){return l},Oc:function(){return a}});let l=1,a="https://donat-widget.netlify.app"},9915:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSP:function(){return W},default:function(){return J}});var l,a,i=n(5893),o=n(746),r=n(7294),s=n(4529);let c=(0,s.Ue)(e=>({prices:{},setPrices:t=>e({prices:t})}));var d=n(7066),u=n(6971),g=()=>{let e=c(e=>e.setPrices),[t,n]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{t||(n(!0),d.default.get("/api/coingecko").then(t=>{let{data:n}=t;e(n)}).catch(e=>(0,u.s)("Error fetching prices data",e)))},[t,e]),(0,i.jsx)(i.Fragment,{})},m=n(9204);let v=(0,s.Ue)(e=>({setCollection:t=>e({collection:t})}));var h=n(1163),x=n(4603),b=()=>{let e=v(e=>e.setCollection),[t,n]=(0,r.useState)(""),l=(0,h.useRouter)();return(0,r.useEffect)(()=>{l.query.collectionId&&"string"==typeof l.query.collectionId&&t!==l.query.collectionId&&(n(l.query.collectionId),d.default.get("/api/collection/"+l.query.collectionId).then(t=>{let{data:n}=t;(0,x.Q)(n)?e(n):l.push("/widget/404")}).catch(e=>{var t;e instanceof m.d7&&(null===(t=e.response)||void 0===t?void 0:t.data)==="Did not find collection"?l.push("/widget/404"):(0,u.s)("Error fetching collection data",e)}))},[t,l.query.collectionId,e]),(0,i.jsx)(i.Fragment,{})};(l=a||(a={}))[l.ONBOARD=0]="ONBOARD",l[l.DETAILS=1]="DETAILS",l[l.PAYMENT=2]="PAYMENT",l[l.THANKYOU=3]="THANKYOU";let f=(0,s.Ue)(e=>({formStage:a.ONBOARD,setFormStage:t=>e({formStage:t}),setDonationId:t=>e({donationId:t}),setOnboardForm:t=>e({onboardForm:t}),setDetailsForm:t=>e({detailsForm:t}),setPaymentData:t=>e({paymentData:t})})),p=(0,s.Ue)(e=>({setDonation:t=>e({donation:t})}));var j=()=>{let e=f(e=>e.donationId),t=f(e=>e.setFormStage),n=p(e=>e.donation),l=p(e=>e.setDonation);return(0,r.useEffect)(()=>
1{if(!e||(null==n?void 0:n.paid))return;let i=setInterval(async()=>{d.default.get("/api/donation/"+e).then(e=>{let{data:n}=e;n.paid&&(console.log("We got paid!"),l(n),t(a.THANKYOU))}).catch(e=>(0,u.s)("Error fetching donation data",e))},4e3);return()=>clearInterval(i)},[e,t,l,null==n?void 0:n.paid]),(0,i.jsx)(i.Fragment,{})},y=e=>(0,i.jsxs)("div",{className:"layout-container",children:[(0,i.jsx)(g,{}),(0,i.jsx)(b,{}),(0,i.jsx)(j,{}),e.children,(0,i.jsx)(o.Z,{})]}),k=n(530),w=n(3040),N=n(7900),E=n(7689),S=n(3967),C=n.n(S),I=n(381),_=n.n(I),A=n(8276),D=()=>{var e,t;let n=v(e=>e.collection),[l,a]=(0,r.useState)(!0),[o,s]=(0,r.useState)(!0);(0,r.useEffect)(()=>{if(!(null==n?void 0:n.totalCzkRaised)||n.totalCzkRaised<E.GZ)return;let e=[()=>a(!1),()=>{s(e=>!e),a(!0)}],t=[setTimeout(e[0],1300),setTimeout(e[1],1600)];return()=>t.forEach(e=>clearTimeout(e))},[o,n]);let{t:c,i18n:d}=(0,A.$G)(),u=(0,r.useMemo)(()=>"en"===d.language&&(null==n?void 0:n.name_en)||(null==n?void 0:n.name),[n,d.language]);return(0,i.jsxs)("div",{className:"h-22 w-full flex flex-col justify-between shrink-0 px-6 pt-5 pb-3 m-0 text-xs bg-donat-blue",children:[(0,i.jsx)("div",{className:C()("transition-opacity ease-in-out duration-500 line-clamp-1",l?"opacity-100":"opacity-0",30>((null==u?void 0:u.length)||0)?"title":"title-small"),children:o?u:(0,i.jsxs)(i.Fragment,{children:[c("header.collected")," ",(0,i.jsxs)("b",{children:[((null==n?void 0:n.totalCzkRaised)||0).toLocaleString("cs-CZ")," ",c("header.czk")]})," ",c("header.from")," ",(0,i.jsxs)("b",{children:[null==n?void 0:n.totalDonations," ",c("header.donors")]})]})}),n&&(0,i.jsxs)("div",{className:"text-small w-full flex justify-between align-middle h-4",children:[(0,i.jsx)("a",{href:null===(e=n.organisation)||void 0===e?void 0:e.website,target:"_blank",rel:"noreferrer noopener",children:null===(t=n.organisation)||void 0===t?void 0:t.name}),(0,i.jsxs)("div",{children:[c("header.started")," ",_()(n.startDate||n.createdAt).format("DD/MM/YYYY")]})]})]})},Z=n(7536),F=n(5718);let O=[{key:"btc",displayName:"Bitcoin (BTC)",coingeckoApiId:"bitcoin",suggestedAmounts:[5e-4,.002,.005],blockExplorerUrl:"...",rounding:6,icon:"/img/currency/btc.svg"},{key:"btc",displayName:"Bitcoin Lightning (BTC)",coingeckoApiId:"bitcoin",suggestedAmounts:[5e-4,.002,.005],blockExplorerUrl:"...",rounding:6,icon:"/img/currency/btc-ln.svg"},{key:"eth",displayName:"Ethereum (ETH)",coingeckoApiId:"ethereum",suggestedAmounts:[.01,.05,.1],blockExplorerUrl:"...",rounding:4,icon:"/img/currency/eth.svg"},{key:"usdt",displayName:"Tether (USDT)",coingeckoApiId:"tether",suggestedAmounts:[20,100,200],blockExplorerUrl:"...",icon:"/img/currency/usdt.svg"},{key:"usdc",displayName:"USD Coin (USDC)",coingeckoApiId:"usd-coin",suggestedAmounts:[20,100,200],blockExplorerUrl:"...",icon:"/img/currency/usdc.svg"},{key:"sol",displayName:"Solana (SOL)",coingeckoApiId:"solana",suggestedAmounts:[1,5,10],blockExplorerUrl:"https://explorer.solana.com/tx",icon:"/img/currency/sol.svg"},{key:"matic",displayName:"Polygon (MATIC)",coingeckoApiId:"matic-network",suggestedAmounts:[20,100,200],blockExplorerUrl:"https://polygonscan.com/tx",icon:"/img/currency/matic.svg"},{key:"trx",displayName:"Tron (TRX)",coingeckoApiId:"tron",suggestedAmounts:[200,1e3,2e3],blockExplorerUrl:"...",icon:"/img/currency/trx.svg"},{key:"ltc",displayName:"Litecoin (LTC)",coingeckoApiId:"litecoin",suggestedAmounts:[.1,1,3],blockExplorerUrl:"...",icon:"/img/currency/ltc.svg"}];var T=()=>{let e=f(e=>e.onboardForm),t=f(e=>e.setFormStage),n=f(e=>e.setDonationId),l=f(e=>e.setOnboardForm),i=f(e=>e.setDetailsForm),o=f(e=>e.setPaymentData),r=v(e=>e.collection),s=async e=>{console.log("createInvoice()",e);try{if(!e)throw Error("No donation id to create invoice from");console.log("actually sending");let{data:t}=await d.default.post("/api/confirmo/create",{donationId:e});o({invoiceId:t.invoiceId})}catch(e){(0,u.s)("Error creating Confirmo invoice",e)}};return{onFinishedOnboard:async e=>{l(e),t(a.DETAILS)},onFinishedDetails:async function(l){let o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(i(l),o)return t(a.ONBOARD);if(!e)throw Error("Onboard form not filled out");let c={...e};c.localState=void 0;let g={onboardForm:c,detailsForm:l,collectionId:(null==r?void 0:r.id)||""};try{let{data:e}=await d.default.post("/api/donation",g);n(e.donationId),await s(e.donationId),t(a.PAYMENT)}catch(e){(0,u.s)("Error creating donation",e)}},createInvoice:s}},U=n(5675),P=n.n(U),B=n(4890),z=()=>{var e;let t=f(e=>e.onboardForm),n=v(e=>e.collection),l=c(e=>e.prices),{onFinishedOnboard:a}
1=T(),{t:o}=(0,A.$G)(),{register:s,handleSubmit:d,watch:u,setValue:g,clearErrors:m,formState:{errors:h}}=(0,Z.cI)({mode:"onBlur",defaultValues:{amount:(null==t?void 0:t.localState)?t.localState.amount:O[0].suggestedAmounts[0]}}),[x,b]=(0,r.useState)(t&&(null===(e=t.localState)||void 0===e?void 0:e.currencyIndex)||0),[p,j]=(0,r.useState)(t?t.tipPercentage:5),[y,E]=(0,r.useState)(!!t&&t.wantsAnonymous),S=u("amount"),[C,I]=(0,r.useState)(0),[_,U]=(0,r.useState)(!1);(0,r.useEffect)(()=>{I(Math.round((S||0)*(-1===x?0:l[O[x].key])*100)/100)},[S,x,l]);let z=async e=>{U(!0);let t={inputCzkAmount:C,tipPercentage:p,wantsAnonymous:y,note:e.note,localState:{currencyIndex:x,amount:S}};await a(t),U(!1)},R=e=>{g("amount",e,{shouldDirty:!0}),m()};return n?(null==n?void 0:n.altPaymentUrl)?(0,i.jsxs)("div",{className:"flex flex-col items-center h-full pt-[100px] gap-4",children:[(0,i.jsx)(P(),{src:"/img/link.svg",alt:"Link",className:"mb-16",width:160,height:160,priority:!0}),(0,i.jsx)(k.Z,{variant:"nav",link:n.altPaymentUrl,className:"!w-[260px] !h-[50px] text-xl",label:o("onboard.go_to_donation"),icon:"ph:arrow-right"}),(0,i.jsx)("div",{className:"text-xs text-white mx-[70px]",children:o("onboard.org_has_own_method")})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(D,{}),(0,i.jsxs)("div",{className:"view-body gap-4",children:[(0,i.jsxs)("div",{id:"currency",children:[(0,i.jsx)("label",{children:o("onboard.select_currency")}),(0,i.jsx)(F.Z,{options:O.map((e,t)=>({label:e.displayName,value:t,icon:e.icon})),value:x,onChange:e=>{b(e),g("amount",O[e].suggestedAmounts[0],{shouldDirty:!0})}})]}),(0,i.jsxs)("div",{id:"amount",children:[(0,i.jsxs)("div",{className:"text-s text-white font-light w-full flex justify-between",children:[(0,i.jsx)("label",{children:o("onboard.input_amount")}),(0,i.jsxs)("div",{children:["â ",(C*(1+p/100)).toFixed(2)," CZK"]})]}),(0,i.jsx)(N.Z,{type:"number",placeholder:o("onboard.amount"),disabled:-1===x,register:s("amount",{required:o("onboard.input_amount"),validate:e=>e>0||o("onboard.input_positive_amount")}),error:h.amount}),(0,i.jsx)("div",{className:"flex gap-3 mt-4",children:O[-1===x?1:x].suggestedAmounts.map((e,t)=>(0,i.jsx)(k.Z,{variant:"amount",label:String(e),disabled:-1===x,onClick:()=>R(e)},t))})]}),(0,i.jsxs)("div",{id:"tip",className:"",children:[(0,i.jsxs)("div",{className:"text-s text-white font-light w-full flex justify-between",children:[(0,i.jsx)("label",{children:o("onboard.tip_donat")}),(0,i.jsxs)("div",{children:[(S*p/100).toFixed(O[x].rounding||2)," ",O[x].key.toUpperCase()]})]}),(0,i.jsxs)("div",{className:"flex flex-row justify-between items-center bg-white rounded-xl",children:[(0,i.jsx)("div",{className:"h-10"}),(0,i.jsx)(k.Z,{variant:"iconBg",label:"-",onClick:()=>j(e=>Math.max(0,e-2))}),(0,i.jsxs)("div",{className:"text-donat-blue font-roboto text-lg text-center w-[200px]",children:[p,"%"]}),(0,i.jsx)(k.Z,{variant:"iconBg",label:"+",onClick:()=>j(e=>Math.min(40,e+2))}),(0,i.jsx)("div",{})]}),(0,i.jsx)("div",{className:"text-xs text-donat-blue mt-2",children:o("onboard.tip_info")})]}),(0,i.jsxs)("div",{className:"-mt-2",children:[(0,i.jsx)("label",{children:o("onboard.leave_note")}),(0,i.jsx)(N.Z,{type:"text",register:s("note"),error:h.note})]})]}),(0,i.jsxs)("div",{className:"view-bottom",children:[C*(1+p/100)>=25e3||!1===n.anonymousOption?(0,i.jsx)("div",{}):(0,i.jsx)(w.Z,{label:o("onboard.anonymous"),value:y,onChange:()=>E(e=>!e)}),(0,i.jsx)(k.Z,{label:"Ok",variant:"nav",icon:"ph:arrow-right",loading:_,onClick:d(z)})]})]}):(0,i.jsx)(B.Z,{})};let R=[{label:"Alb\xe1nie",labelEn:"Albania",icon:"/img/flag/al.svg"},{label:"Andorra",labelEn:"Andorra",icon:"/img/flag/ad.svg"},{label:"Rakousko",labelEn:"Austria",icon:"/img/flag/at.svg"},{label:"BÄlorusko",labelEn:"Belarus",icon:"/img/flag/by.svg"},{label:"Belgie",labelEn:"Belgium",icon:"/img/flag/be.svg"},{label:"Bosna a Hercegovina",labelEn:"Bosnia and Herzegovina",icon:"/img/flag/ba.svg"},{label:"Bulharsko",labelEn:"Bulgaria",icon:"/img/flag/bg.svg"},{label:"Kanada",labelEn:"Canada",icon:"/img/flag/ca.svg"},{label:"Chorvatsko",labelEn:"Croatia",icon:"/img/flag/hr.svg"},{label:"Äesk\xe1 republika",labelEn:"Czech Republic",icon:"/img/flag/cz.svg"},{label:"D\xe1nsko",labelEn:"Denmark",icon:"/img/flag/dk.svg"},{label:"Anglie",labelEn:"England",icon:"/img/flag/gb-eng.svg"}
1,{label:"Estonsko",labelEn:"Estonia",icon:"/img/flag/ee.svg"},{label:"Finsko",labelEn:"Finland",icon:"/img/flag/fi.svg"},{label:"Francie",labelEn:"France",icon:"/img/flag/fr.svg"},{label:"NÄmecko",labelEn:"Germany",icon:"/img/flag/de.svg"},{label:"Åecko",labelEn:"Greece",icon:"/img/flag/gr.svg"},{label:"MaÄarsko",labelEn:"Hungary",icon:"/img/flag/hu.svg"},{label:"Island",labelEn:"Iceland",icon:"/img/flag/is.svg"},{label:"Irsko",labelEn:"Ireland",icon:"/img/flag/ie.svg"},{label:"It\xe1lie",labelEn:"Italy",icon:"/img/flag/it.svg"},{label:"LotyÅ¡sko",labelEn:"Latvia",icon:"/img/flag/lv.svg"},{label:"LichtenÅ¡tejnsko",labelEn:"Liechtenstein",icon:"/img/flag/li.svg"},{label:"Litva",labelEn:"Lithuania",icon:"/img/flag/lt.svg"},{label:"Lucembursko",labelEn:"Luxembourg",icon:"/img/flag/lu.svg"},{label:"Malta",labelEn:"Malta",icon:"/img/flag/mt.svg"},{label:"Moldavsko",labelEn:"Moldova",icon:"/img/flag/md.svg"},{label:"Monako",labelEn:"Monaco",icon:"/img/flag/mc.svg"},{label:"Äern\xe1 Hora",labelEn:"Montenegro",icon:"/img/flag/me.svg"},{label:"Nizozemsko",labelEn:"Netherlands",icon:"/img/flag/nl.svg"},{label:"Severn\xed Irsko",labelEn:"Northern Ireland",icon:"/img/flag/gb-nir.svg"},{label:"Norsko",labelEn:"Norway",icon:"/img/flag/no.svg"},{label:"Polsko",labelEn:"Poland",icon:"/img/flag/pl.svg"},{label:"Portugalsko",labelEn:"Portugal",icon:"/img/flag/pt.svg"},{label:"Rumunsko",icon:"/img/flag/ro.svg"},{label:"Rusko",icon:"/img/flag/ru.svg"},{label:"Skotsko",icon:"/img/flag/gb-sct.svg"},{label:"Srbsko",icon:"/img/flag/rs.svg"},{label:"Slovensko",icon:"/img/flag/sk.svg"},{label:"Slovinsko",icon:"/img/flag/si.svg"},{label:"Å panÄlsko",icon:"/img/flag/es.svg"},{label:"Å v\xe9dsko",icon:"/img/flag/se.svg"},{label:"Å v\xfdcarsko",icon:"/img/flag/ch.svg"},{label:"Ukrajina",icon:"/img/flag/ua.svg"},{label:"Velk\xe1 Brit\xe1nie",icon:"/img/flag/gb.svg"},{label:"USA",icon:"/img/flag/us.svg"}],M=(e,t,n,l,a)=>({type:"text",placeholder:t,register:n(e,{required:a("details.required_field")}),error:l[e]});var L=()=>{let e=f(e=>e.onboardForm),t=f(e=>e.detailsForm),{onFinishedDetails:n}=T(),[l,a]=(0,r.useState)(!1),{t:o}=(0,A.$G)(),{register:s,handleSubmit:c,setValue:d,getValues:u,reset:g,formState:{errors:m}}=(0,Z.cI)({mode:"onBlur",defaultValues:async()=>{let e={...t};return delete e.isCompany,delete e.country,e}}),[v,h]=(0,r.useState)((null==t?void 0:t.isCompany)||!1),[x,b]=(0,r.useState)((null==t?void 0:t.country)?R.findIndex(e=>e.label===t.country):R.findIndex(e=>"Äesk\xe1 republika"===e.label)),p=async e=>{a(!0),await n({isCompany:v,country:R[x].label,...e}),a(!1)},j=()=>{n({isCompany:v,country:R[x].label,...u()},!0),g(void 0,{keepDefaultValues:!1})};return e.inputCzkAmount*(1+e.tipPercentage/100)>=25e3?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(D,{}),(0,i.jsxs)("div",{className:"view-body gap-4",children:[(0,i.jsx)("label",{children:o("details.aml")}),(0,i.jsx)("div",{className:"flex justify-center",children:(0,i.jsx)(k.Z,{label:o("details.send_email"),variant:"nav",link:"mailto:[email protected]"})})]}),(0,i.jsx)("div",{className:"view-bottom",children:(0,i.jsx)(k.Z,{label:o("details.back"),variant:"nav",icon:"ph:arrow-left",className:"flex-row-reverse",onClick:j})})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(D,{}),(0,i.jsxs)("div",{className:"view-body gap-4",children:[(null==e?void 0:e.wantsAnonymous)?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("label",{children:o("details.anonymous_confirmation")}),(0,i.jsx)(N.Z,{type:"text",placeholder:"Email",register:s("email",{pattern:{value:/\S+@\S+\.\S+/,message:o("details.enter_valid_email")}}),error:m.email})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(w.Z,{label:o("details.donate_as_company"),value:v,onChange:()=>{h(e=>!e),d("firstName",""),d("lastName","")}}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(N.Z,{...M("firstName",o(v?"details.company_name":"details.name"),s,m,o)}),(0,i.jsx)(N.Z,{...M("lastName",o(v?"details.reg_no":"details.last_name"),s,m,o)})]}),(0,i.jsx)(N.Z,{type:"text",placeholder:"Email",register:s("email",{required:o("details.required_field"),pattern:{value:/\S+@\S+\.\S+/,message:o("details.enter_valid_email")}}),error:m.email}),(0,i.jsx)(N.Z,{...M("address",o("details.street_address"),s,m,o)}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(N.Z,{...M("city",o("details.city"),s,m,o)}),(0,i.jsx)(N.Z,{...M("zipcode",o("details.zipcode"),s,m,o)})]}),(0,i.jsx)(F.Z,{options:R.map((e,t)=>({...e,value:t})),value:x,onChange:e=>{b(e)}})]}),(0,i.jsxs)("div",{className:"text-xs text-donat-blue",children:[o("details.consent.pre")," ",(0,i.jsx)("a",{className:"underline hover:text-white",href:"https://donat.network/terms/",target:"_blank",rel:"noreferrer noopener",children:o("details.consent.link")})," ",o("details.consent.post")]})]}),(0,i.jsxs)("div",{className:"view-bottom",children:[(0,i.jsx)(k.Z,{label:o("details.back"),variant:"nav",icon:"ph:arrow-left",className:"flex-row-reverse",onClick:j}),(0,i.jsx)(k.Z,{label:"Ok",variant:"nav",icon:"ph:arrow-right",loading:l,onClick:c(p)})]})]})},q=()=>{let e=f(e=>e.paymentData),[t,n]=(0,r.useState)(!0),l=e=>{"confirmo_closed"===e.data&&n(!1)};return((0,r.useEffect)(()=>(window.addEventListener("message",l),()=>window.removeEventListener("message",l))),null==e?void 0:e.invoiceId)?(0,i.jsx)(i.Fragment,{children:t?(0,i.jsx)("div",{className:"relative w-full h-full overflow-hidden p-[1px]",children:(0,i.jsx)("iframe",{"data-type":"text/html",src:"/confirmo-overlay/".concat(e.invoiceId),className:"w-full h-full"})}):(0,i.jsxs)("div",{className:"layout-container p-12",children:[(0,i.jsx)("div",{className:"text-xl",children:"You closed the Confirmo payment. Would you like to reopen it?"}),(0,i.jsx)("div",{className:"w-full flex justify-center mb-12",children:(0,i.jsx)(k.Z,{variant:"nav",label:"Reopen",onClick:()=>n(!0)})})]})}):(0,i.jsx)("div",{children:"Something went wrong: you should see invoice, but we did not receive it."})},G=n(2567);let Y=e=>e?e.slice(0,5)+"..."+e.slice(-5):"";var H=e=>{let[t,n]=(0,r.useState)(!1),l=O.find(t=>t.key===e.currency),a=l?"".concat(l.blockExplorerUrl,"/").concat(e.hex):"";return(0,i.jsxs)("div",{className:"flex items-center",children:[(0,i.jsx)("a",{href:a,target:"_blank",rel:"noreferrer noopener",className:"text-highlight whitespace-nowrap block overflow-ellipsis overflow-hidden underline hover:text-white",children:Y(e.hex)}),(0,i.jsx)(G.JO,{icon:t?"ant-design:check-outlined":"ant-design:copy-outlined",role:"button",onClick:()=>{navigator.clipboard.writeText(e.hex).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)}
1).catch(e=>console.error("Error writing to clipboard: ".concat(e.reason)))},className:"hover:text-white ml-1 w-4 h-4 inline cursor-pointer"})]})};let V=e=>null==e?"":String(e).replaceAll("<","<").replaceAll(">",">"),K=e=>{let t=encodeURIComponent("https://donat.network/projects/"),n=encodeURIComponent("Krypto-dar!"),l=encodeURIComponent("darujKrypto"),a=encodeURIComponent("PodpoÅil/a jsem sv\xfdm kryptem organizaci ".concat(V(e).replaceAll('"',"'")," na @Donat_Network! Pod\xedvejte se na dalÅ¡\xed krypto-sb\xedrky, tÅeba v\xe1s nÄco zaujme... "));return{twitterShareUrl:"https://twitter.com/intent/tweet?text=".concat(a,"&url=").concat(t,"&hashtags=").concat(l),linkedinShareUrl:"https://www.linkedin.com/sharing/share-offsite/?url=".concat(t,"&title=").concat(n),facebookShareUrl:"https://www.facebook.com/sharer/sharer.php?u=".concat(t)}};var $=()=>{var e;let t=p(e=>e.donation),n=v(e=>e.collection),l=(0,r.useMemo)(()=>(null==t?void 0:t.paidTx)?t.paidTx.split(","):[],[t]),{twitterShareUrl:a,linkedinShareUrl:o,facebookShareUrl:s}=K(null==n?void 0:null===(e=n.organisation)||void 0===e?void 0:e.name),{t:c}=(0,A.$G)();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(D,{}),(0,i.jsxs)("div",{className:"view-body items-center mt-6 gap-8",children:[(0,i.jsx)(P(),{src:"/img/clap.svg",alt:"thanks",width:150,height:114}),(0,i.jsx)("div",{className:"text-2xl font-medium text-white",children:c("thanks.thanks")}),(0,i.jsxs)("div",{className:"grid grid-cols-[auto,auto] grid-flow-row text-donat-blue gap-1 text-sm",children:[(0,i.jsx)("div",{className:"text-right font-medium pr-2",children:c("thanks.donation_id")}),(0,i.jsx)("div",{className:"text-left",children:null==t?void 0:t.id}),(0,i.jsx)("div",{className:"text-right font-medium pr-2",children:c("thanks.you_donated")}),(0,i.jsxs)("div",{className:"text-left",children:[null==t?void 0:t.paidAmount," ",null==t?void 0:t.paidCrypto]}),(0,i.jsx)("div",{className:"text-right font-medium pr-2",children:c("thanks.worth")}),(0,i.jsxs)("div",{className:"text-left",children:[((null==t?void 0:t.paidCzkCredited)||0).toFixed(2)," CZK "]}),(0,i.jsx)("div",{className:"text-right font-medium pr-2",children:c("thanks.transaction")}),(0,i.jsx)("div",{className:"text-left",children:l.map(e=>{var n;return(0,i.jsx)(H,{hex:e,currency:(null==t?void 0:null===(n=t.paidCrypto)||void 0===n?void 0:n.toLowerCase())||""},e)})})]}),(0,i.jsxs)("div",{className:"flex flex-col items-center",children:[(0,i.jsx)("div",{className:"text-lg font-medium text-white",children:c("thanks.share")}),(0,i.jsxs)("div",{className:"flex gap-6 mt-2",children:[(0,i.jsx)(k.Z,{variant:"iconBoth",icon:"simple-icons:x",link:a}),(0,i.jsx)(k.Z,{variant:"iconBoth",icon:"ri:linkedin-fill",link:o}),(0,i.jsx)(k.Z,{variant:"iconBoth",icon:"ri:facebook-fill",link:s})]})]})]})]})},W=!0,J=()=>{let e=[z,L,q,$][f(e=>e.formStage)];return(0,i.jsx)(y,{children:(0,i.jsx)(e,{})})}},4603:function(e,t,n){"use strict";n.d(t,{Q:function(){return l}});let l=e=>e&&e.active&&(!e.startDate||new Date(e.startDate).getTime()<Date.now())&&(!e.endDate||new Date(e.endDate).getTime()>Date.now())},6971:function(e,t,n){"use strict";n.d(t,{s:function(){return i}});var l=n(9204),a=n(6501);let i=(e,t)=>{var n;console.error(e,t),t instanceof l.d7&&console.error("Server returned message:",null===(n=t.response)||void 0===n?void 0:n.data),a.ZP.error("NÄco se pokazilo, zkuste to pros\xedm pozdÄji.")}},3250:function(e,t,n){"use strict";var l=n(7294),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=l.useState,o=l.useEffect,r=l.useLayoutEffect,s=l.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!a(e,n)}catch(e){return!0}}var d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),l=i({inst:{value:n,getSnapshot:t}}),a=l[0].inst,d=l[1];return r(function(){a.value=n,a.getSnapshot=t,c(a)&&d({inst:a})},[e,n,t]),o(function(){return c(a)&&d({inst:a}),e(function(){c(a)&&d({inst:a})})},[e]),s(n),n};t.useSyncExternalStore=void 0!==l.useSyncExternalStore?l.useSyncExternalStore:d},139:function(e,t,n){"use strict";var l=n(7294),a=n(1688),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=a.useSyncExternalStore,r=l.useRef,s=l.useEffect,c=l.useMemo,d=l.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,l,a){var u=r(null);if(null===u.current){var g={hasValue:!1,value:null};u.current=g}else g=u.current;var m=o(e,(u=c(function(){function e(e){if(!s){if(s=!0,o=e,e=l(e),void 0!==a&&g.hasValue){var t=g.value;if(a(t,e))return r=t}return r=e}if(t=r,i(o,e))return t;var n=l(e);return void 0!==a&&a(t,n)?t:(o=e,r=n)}var o,r,s=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,n,l,a]))[0],u[1]);return s(function(){g.hasValue=!0,g.value=m},[m]),d(m),m}},1688:function(e,t,n){"use strict";e.exports=n(3250)},2798:function(e,t,n){"use strict";e.exports=n(139)},4529:function(e,t,n){"use strict";n.d(t,{Ue:function(){return g}});let l=e=>{let t;let n=new Set,l=(e,l)=>{let a="function"==typeof e?e(t):e;if(!Object.is(a,t)){let e=t;t=(null!=l?l:"object"!=typeof a||null===a)?a:Object.assign({}
1,t,a),n.forEach(n=>n(t,e))}},a=()=>t,i={setState:l,getState:a,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},o=t=e(l,a,i);return i},a=e=>e?l(e):l;var i=n(7294),o=n(2798);let{useDebugValue:r}=i,{useSyncExternalStoreWithSelector:s}=o,c=!1,d=e=>e,u=e=>{"function"!=typeof e&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");let t="function"==typeof e?a(e):e,n=(e,n)=>(function(e,t=d,n){n&&!c&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),c=!0);let l=s(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return r(l),l})(t,e,n);return Object.assign(n,t),n},g=e=>e?u(e):u}},function(e){e.O(0,[885,206,876,204,620,3,536,888,774,179],function(){return e(e.s=5380)}),_N_E=e.O()}]);
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.