(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[484],{2525:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/[lang]",function(){return s(7565)}])},2613:function(e,t,s){"use strict";var a=s(5893);s(7294);var n=s(1210),i=s(5076),o=s(369);t.Z=e=>(0,a.jsx)("div",{className:"".concat(e.data.type," ").concat(e.data.id),children:(0,a.jsxs)("div",{className:"".concat(e.data.type,"-content"),children:[(0,a.jsx)("a",{href:e.data.cta.link,target:"_blank",rel:"noopener noreferrer",children:(0,a.jsx)("img",{src:e.data.img.src,alt:e.data.img.alt})}),(0,a.jsx)("p",{className:"fb-btn",children:(0,a.jsx)(n.Z,{data:e.data.cta})}),(0,a.jsx)("div",{className:"promo-text",children:(0,a.jsx)(o.Z,{text:e.data.text,dynamicData:{beneficiaries:e.beneficiaries}})}),(0,a.jsx)(i.Z,{data:e.data.links})]})})},7565:function(e,t,s){"use strict";s.r(t),s.d(t,{__N_SSG:function(){return j},default:function(){return Home}});var a=s(5893),n=s(7294),i=s(9008),o=s.n(i),c=s(9532),r=s(2613),l=s(7980);s(9205);var d=s(7111),u=s(4147),m=s(542),h=s(7601);let{isLocal:p,apiUrl:f}=u,x=p?f.dev:f.prod;var j=!0;function Home(e){let{lang:t}=e,s=h.data.pages.home[t],[i,u]=(0,n.useState)(null),[p,f]=(0,n.useState)(null),[j,g]=(0,n.useState)(""),[N,v]=(0,n.useState)(null),[w,_]=(0,n.useState)(!1),sortAsc=e=>function(t,s){return""===t[e]||null===t[e]||"Voice For The Needy"===t[e]?1:""===s[e]||null===s[e]||"Voice For The Needy"===s[e]?-1:t[e]===s[e]?0:t[e]<s[e]?-1:1},renderRescuers=(e,s)=>{let n=e.logo?e.logo:"no-logo.png",i="Voice For The Needy"===e.association?"/img/logos/rescuers/".concat(t||"en","/"):"/img/logos/rescuers/";return(0,a.jsxs)("div",{className:"rescuer",children:[(0,a.jsx)("div",{className:"assoc-logo",children:(0,a.jsx)("a",{href:e.assocFb,target:"_blank",children:(0,a.jsx)("img",{src:"".concat(i).concat(n),alt:e.association})})}),(0,a.jsxs)("div",{className:"rescuer-name",children:[e.association&&(0,a.jsx)("a",{href:e.assocFb,target:"_blank",children:e.association}),e.firstName&&(0,a.jsxs)("a",{href:e.personalFb,target:"_blank",children:[e.firstName," ",e.lastName]})]})]},s)},getBeneficiaries=async()=>{f(null),v(null),_(!1),await fetch("".concat(x,"/getBeneficiaries?home=true"),{method:"post",mode:"cors",timeout:"30000",headers:{Accept:"application/json","Content-Type":"application/json"}}).then(e=>{e.json().then(e=>{u(e.beneficiaries),f(e.beneficiaries),v(!1),_(!1)})}).catch(e=>{var t;console.log("GET BENEFICIARIES ERROR",e),f(null),_(null==s?void 0:null===(t=s.content)||void 0===t?void 0:t.loadingError),v(!1)})};return(0,n.useEffect)(()=>{window&&(m.ZP.initialize("UA-72177946-1"),m.ZP.pageview(window.location.pathname+window.location.search)),getBeneficiaries()},[]),(0,a.jsxs)(c.Z,{children:[(0,a.jsxs)(o(),{children:[(0,a.jsx)("title",{children:s.meta.title}),(0,a.jsx)("meta",{name:"viewport",content:"initial-scale=1.0, width=device-width"}),(0,a.jsx)("meta",{name:"description",content:s.meta.description}),(0,a.jsx)("meta",{property:"og:description",content:s.meta.description}),(0,a.jsx)("meta",{property:"og:title",content:s.meta.title}),(0,a.jsx)("meta",{property:"og:image",content:s.meta.img})]}),s&&s.content&&(0,a.jsxs)("div",{className:"promos homepage",children:[s.content.promos&&i&&(0,a.jsx)("div",{className:"active-promos",children:(e=>{let t=e.map((e,t)=>(0,a.jsx)(r.Z,{data:e,beneficiaries:i.length},t));return t})(s.content.promos)}),(0,a.jsx)(l.Z,{}),(0,a.jsx)("h1",{className:"h1-spring1",children:s.content.title}),(0,a.jsx)("h3",{className:"h3-subtitle",children:s.content.subtitle}),s.content.rescuers&&N&&(0,a.jsx)(d.Z,{page:s.content.loading}),s.content.rescuers&&!N&&(0,a.jsxs)("div",{className:"rescuers-container",children:[s.content.search&&(0,a.jsx)("div",{className:"search",children:(0,a.jsx)("input",{placeholder:s.content.search,type:"text",value:j,onChange:e=>{let t=e.target.value,s=i.filter(e=>e.association&&-1!==e.association.toLowerCase().indexOf(t.toLowerCase())||e.firstName&&-1!==e.firstName.toLowerCase().indexOf(t.toLowerCase())||e.lastName&&-1!==e.lastName.toLowerCase().indexOf(t.toLowerCase())||e.location&&-1!==e.location.toLowerCase().indexOf(t.toLowerCase()));g(t),f(s)}})}),(0,a.jsxs)("div",{className:"rescuers",children:[p&&p.filter(e=>"Voice For The Needy"!==e.association).sort(sortAsc("association")).map((e,t)=>renderRescuers(e,t)),p&&p.filter(e=>"Voice For The Needy"===e.association).sort(sortAsc("firstName")).map((e,t)=>renderRescuers(e,t))]})]})]})]})}},4147:function(e){"use strict";e.exports=JSON.parse('{"isLocal":false,"apiUrl":{"dev":"http://localhost:9999/.netlify/functions","prod":"/.netlify/functions"}}')}},function(e){e.O(0,[976,948,583,262,774,888,179],function(){return e(e.s=2525)}),_N_E=e.O()}]);