1import{R as t,r as m}from"./vendor-a6c4fc13.js";import{R as X,u as Z,f as ee,a as te,S as ae,b as ne,c as le,P as re,C as se,F as ie,d as oe,e as ce}from"./structuredData-878b5f53.js";import"./utils-3a9d2551.js";const ue=({result:_,newsType:h,title:D,date:b,url:M})=>h==="undefined"||h===void 0||!h?null:t.createElement(X,{result:_,href:M,className:"news-result-card"},t.createElement("div",{className:"news-result-card__type"},h),t.createElement("h3",{className:"news-result-card__title"},D),t.createElement("p",{className:"news-result-card__date"},b)),O="MMM d, yyyy",he=()=>{const _="News Listing",[h,D]=m.useState(O),[b,M]=m.useState("en"),[R,q]=m.useState(999);m.useEffect(()=>{const e=document.querySelector(`[aria-label="${_}"]`);if(e){const a=e.getAttribute("data-date-format"),n=e.getAttribute("data-language"),l=e.getAttribute("data-facet-options-number");D(a||O),M(n?n.split("-")[0]:"en"),q(l?Number(l):999)}},[]);const U={organizationId:"analysisgroupnonproduction13h6gxjnn",searchHub:"euro-new-events",pipeline:"euro-new-events",apiKey:"xx8043e01e-0876-4045-bb89-d0902b725336",fieldsToInclude:["title","date","source","collection","language","contenttype","eventenddate"],facetFields:["source","collection","language"],numberOfResults:20},w=m.useCallback((e,a,n="en",l)=>{try{const c=i=>typeof i=="number"||typeof i=="string"&&!isNaN(Number(i))?new Date(Number(i)):typeof i=="string"?new Date(i):null;let o=c(e);(!o||isNaN(o.getTime()))&&(o=new Date);const u=l?c(l):null,y=(i,d)=>{const F=i.getDate(),S=i.getMonth(),f=i.getFullYear();let g;d.includes("MMMM")?g=new Intl.DateTimeFormat(n,{month:"long"}).format(i):d.includes("MMM")?g=new Intl.DateTimeFormat(n,{month:"short"}).format(i):d.includes("MM")?g=String(S+1).padStart(2,"0"):g=String(S+1);let N;return d.includes("yyyy")?N=String(f):d.includes("yy")?N=String(f).slice(-2):N=String(f),`${F} ${g} ${N}`};if(u&&!isNaN(u.getTime())&&u.getTime()>o.getTime()){const i=o.getFullYear(),d=u.getFullYear(),F=o.getMonth(),S=u.getMonth(),f=o.getDate(),g=u.getDate();if(i===d&&F===S&&f===g)return y(o,a);const k=a.includes("MMMM")?"long":"short",I=new Intl.DateTimeFormat(n,{month:k}).format(o),J=new Intl.DateTimeFormat(n,{month:k}).format(u);return i===d&&F===S?`${f}â${g} ${I} ${i}`:i===d?`${f} ${I}â${g} ${J} ${i}`:`${y(o,a)}â${y(u,a)}`}return y(o,a)}catch(c){return console.warn("Error formatting date:",e,c),new Date().toLocaleDateString(n)}},[]),Y=m.useCallback(e=>{const a=e,n=a.raw||{},l=n.displaycontenttype||n.contenttype||a.contenttype||"NEWS",c=n.pageauthordate||n.date,o=n.eventenddate||n.enddate,u=w(c,h,b,o);return{id:a.uniqueId||a.id||String(Math.random()),type:l,title:n.pagename||a.title||"Untitled",date:u,url:a.clickUri,originalResult:e}},[w,h,b]),{listingSectionRef:V,isMobile:L,isFilterDialogOpen:j,setIsFilterDialogOpen:C,labels:r,searchLabels:E,coveoState:s,sortFields:B,displayedFacets:p,selectedFilterValues:P,transformedResults:v,numberOfResults:z,handleSearchSubmit:T,handleSortChange:G,handlePageChange:H,handleFacetChange:x,handleRemoveSelectedFilter:K,handleClearAllFilters:A}=Z({listingAriaLabel:_,transformCoveoResult:Y,fallbackConfig:U,language:b}),$=m.useMemo(()=>({listName:"News & Events Listing",description:"A collection of news articles and events from Analysis Group.",url:typeof window<"u"?window.location.href:void 0}),[]),Q=m.useMemo(()=>{if(!v.length||s.loading)return null;const e=v.map(a=>{var c;const n=(c=s.results)==null?void 0:c.find(o=>{const u=o;return u.uniqueId===a.id||u.id===a.id}),l=n?n.raw||{}:{};return{id:a.id,title:a.title,datePublished:a.date||void 0,url:a.url||void 0,author:(l==null?void 0:l.author)||void 0,description:(l==null?void 0:l.description)||(l==null?void 0:l.excerpt)||void 0,locationCreated:(l==null?void 0:l.location)||(l==null?void 0:l.eventlocation)||void 0}});return ee($,e)},[v,s.loading,s.results,$]);te(Q,!s.loading&&!s.error);const W=()=>t.createElement(t.Fragment,null,t.createElement("div",{className:"listing__search-wrapper"},t.createElement(oe,{onSearch:T,initialValue:s.query,labels:{searchLabel:E.searchLabel,searchPlaceholder:E.searchPlaceholder,clearLabel:E.clearLabel,submitLabel:E.submitLabel}}
1)),t.createElement("div",{className:"listing__facets-wrapper"},t.createElement("h2",{className:"listing__filter-title"},r.filterResultsTitle||"FILTER RESULTS"),p.length>0?p.map(e=>e.values.length===0?null:t.createElement(ce,{key:e.field,facetData:e,onFilterChange:x,showMoreLabel:r.showMoreLabel,showLessLabel:r.showLessLabel,initialItemsToShow:R})):t.createElement("div",{className:"listing__no-facets"},t.createElement("p",null,r.noFacets||"No filters available for this search."))));return t.createElement("section",{className:"listing container","aria-label":"News Listing",ref:V},t.createElement("div",{className:"listing__container"},t.createElement("div",{className:"listing__content"},!L&&t.createElement("div",{className:"listing__left-wrapper col-12 col-md-4"},t.createElement(W,null)),t.createElement("div",{className:"listing__right-wrapper col-12 col-md-8"},t.createElement("div",{className:"listing__actions"},t.createElement("div",{className:"listing__actions-top"},t.createElement(ae,{totalResults:s.totalResults,labels:{showingResults:r.showingResults,ofResults:r.ofResults,results:r.results,forTerm:r.forTerm,noResults:r.noResults,loading:r.loading},currentPage:s.currentPage,resultsPerPage:z,searchQuery:s.query,firstSearchExecuted:s.firstSearchExecuted,isLoading:s.loading,hasResults:s.hasResults}),t.createElement("div",{className:"listing__sort"},t.createElement(ne,{sortBy:s.currentSort,sortFields:B,labels:{sortLabel:r.sortLabel,relevanceSort:r.relevanceSort},onSortChange:G}))),P.length>0&&t.createElement("div",{className:"listing__actions-bottom"},t.createElement(le,{filters:P,onRemoveFilter:(e,a)=>K(e,a),onClearAll:A,labels:{clearAll:r.clearAll,removeFilter:r.removeFilter}}))),t.createElement("div",{className:"listing__results"},s.loading?t.createElement("div",{className:"listing__loading"},t.createElement("p",null,r.loading||"Loading...")):s.error?t.createElement("div",{className:"listing__error"},t.createElement("p",null,r.error||"Error:"," ",s.error),t.createElement("p",null,r.errorMessage||"There was an error loading the news listing. Please try again.")):v.length>0?v.map(e=>t.createElement(ue,{key:e.id,newsType:e.type,title:e.title,date:e.date,url:e.url,result:e.originalResult||{raw:{}}})):s.firstSearchExecuted&&t.createElement("div",{className:"listing__no-results"},t.createElement("p",null,r.noResults||"No content found. Please try a different search."))),t.createElement("div",{className:"listing__pagination-container"},s.totalPages>1&&t.createElement(re,{currentPage:s.currentPage,totalPages:s.totalPages,onPageChange:H,labels:{next:r.paginationNext||"Next",previous:r.paginationPrevious||"Previous",page:r.paginationPage||"Page",ellipsis:r.paginationEllipsis||"..."}}))))),L&&p.length>0&&t.createElement("button",{className:"listing__filter-search-button",onClick:()=>C(!0)},r.filterAndSearchButton||"Filter & Search"," ",t.createElement(se,null)),L&&p.length>0&&t.createElement(ie,{isOpen:j,onClose:()=>C(!1),onSearch:T,initialSearchTerm:s.query,facets:p.filter(e=>e.values.length>0).map(e=>({label:e.title,field:e.field,expanded:e.expanded})),generateFacetData:(e,a,n)=>{const l=p.find(c=>c.field===e.field);return l?{...l,title:e.label,expanded:!0,values:l.values.map(c=>({...c,selected:(n[e.field]??[]).includes(c.label)}))}:{title:e.label,field:e.field,expanded:!0,values:[]}},results:s.results,selectedFacets:Object.fromEntries(Object.entries(s.facets).map(([e,a])=>[e,a.filter(n=>n.state==="selected").map(n=>n.value)]).filter(([,e])=>e.length>0)),onFilterChange:(e,a,n)=>x(e,a,n),onClearAllFilters:A,labels:r,searchLabels:E,facetOptionsNumber:R}))};export{he as default}; 2//# sourceMappingURL=index-825140c0.js.map
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.