"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[812],{6300:(m,c,e)=>{e.d(c,{g:()=>t});const t={article:"News",blog:"Blog",event:"Event",programme:"Programme",scholarship:"Scholarship"}},5560:(m,c,e)=>{e.r(c),e.d(c,{default:()=>x});var t=e(6109),O=e(3519),i=e(4586),K=e(1224),d=e(7664),s=e(8561),X=e.n(s),M=e(9522),y=e(6681),D=e(1420),g=e(4750),U=e(6300),S=e(2294);const x=({title:l,intro:b,keywords:j,manualNewsSelection:_,keywordsEBS:Z,keywordsLocation:z,keywordsSchools:H,keywordsSubject:J,keywordsTheme:N,seeMore:Q})=>{const h=(0,y.v9)(D.i8.selectors.selectVersionStatus),[f,v]=(0,t.useState)(null),L=(0,S.Z)(),$=(r=>Object.entries(r).filter(([a])=>a!=null).map(([a,E])=>({field:a,contains:E})))({keywords:j,keywordsLocation:z,keywordsTheme:N,keywordsSchools:H,keywordsSubject:J,keywordsEBS:Z});(0,t.useEffect)(()=>{let r=!0;return(async()=>{let E=[];E=[s.Op.equalTo("sys.versionStatus",h),s.Op.equalTo("sys.contentTypeId","article"),s.Op.or(...$.flatMap(o=>o.contains?Array.isArray(o.contains)?o.contains.map(p=>s.Op.contains(o.field,p)):[s.Op.contains(o.field,o.contains)]:[]))];const B=new s.Query(...E);B.orderBy=s.OrderBy.desc("datePublished");const C=await(0,M.E)(d.cachedSearch.search(B,0));if(C.response&&r){const p=C.response.items.map(P=>(0,d.mapJson)(P,g.l));if(!_||_.length===0)v(p.slice(0,3));else{const P=_,A=[];P.forEach(n=>{A.push(n.id)});const F=[s.Op.equalTo("sys.versionStatus",h),s.Op.equalTo("sys.contentTypeId","article"),s.Op.or(...A.flatMap(n=>[s.Op.equalTo("sys.id",n)]))],R=new s.Query(...F);R.orderBy=s.OrderBy.desc("datePublished");const I=await(0,M.E)(d.cachedSearch.search(R,0));let W=[];I.response&&r&&(W=I.response.items);const G=[...W.map(n=>(0,d.mapJson)(n,g.l)),...p],V=[...new Map(G.map(n=>[n.id,n])).values()];v(V.slice(0,_.length))}}})(),()=>{r=!1}},[]);const u=(0,y.v9)(D.routing.selectors.selectRouteEntryContentTypeId),T=(()=>u==="researchInstituteOverview"||u==="researchProjectThemeOverview"||u==="schoolLandingPage"?"white":"greyShade")();return f?t.createElement(K.ZP,{id:"news",heading:l,lead:b,background:T,width:!1,padding:!1,variant:"feature",seeMoreLink:Q},t.createElement(w,null,f.map((r,a)=>t.createElement(i.Z,{key:a,variant:T==="greyShade"||u==="schoolLandingPage"?L?"darkBlueWithGreenBorder":"darkBlue":"white",taxonomy:U.g.article,color:L?"green":"pink",padded:!0,...r})))):null},w=O.default.div` display: flex; flex-wrap: wrap; justify-content: space-between; gap: ${l=>l.theme.spacing.s}; @media ${l=>l.theme.mq.min.laptop} { display: grid; grid-template-columns: 1fr 1fr 1fr; } `},9522:(m,c,e)=>{e.d(c,{E:()=>t});const t=O=>O.then(i=>({error:null,response:i})).catch(i=>({error:i,response:null}))}}]);