import{_ as L}from"./WebSearchField-BRa-jdLh.mjs";import{_ as w}from"./WebSearchFilterCount-BWqaAvrN.mjs";import{_ as y,o as n,c,F as M,r as A,a as l,k as T,t as C,d as _,v as V,D as K,w as f,b as h,i as d,p as O,m as U,n as N,aj as D,N as q}from"./entry.DPwc-EV0.js";import{V as j}from"./vue-select-DlY5_TFh.mjs";import{u as g}from"./useAlgoliaSearch-C40txc1L.mjs";import{_ as z}from"./WebSearchSort-Cv0Qo5Z5.mjs";import{_ as E}from"./WebViewToggle-6qhaq_At.mjs";import R from"./WebContentList-W4TiV2An.mjs";import{_ as Z}from"./WebPager-CC-Z5TOR.mjs";import"./_getMatchData-DBNiRSif.mjs";import"./_Uint8Array-Bki-tCc2.mjs";import"./_baseIsEqual-Qp0O0Rsf.mjs";import"./WebContentItem-DFVYreAc.mjs";import"./WebImage-BBQZzdK6.mjs";import"./useImageUrl-1XbeiwSF.mjs";import"./Pager-DoE47wmp.mjs";const G={props:{field:{type:String},options:{type:Array},values:{type:[Boolean,Array]},columns:{type:Number,default:1}},emits:["update"]},J=["value","checked"];function Q(e,o,t,m,s,u){const p=w;return n(),c("div",{class:V(["checkbox-filter","columns-"+t.columns])},[(n(!0),c(M,null,A(t.options,r=>(n(),c("div",{key:r.value,class:"checkbox"},[l("label",null,[l("input",{type:"checkbox",name:"contentType",value:r.value,checked:t.values.length?t.values.indexOf(r.value)>=0:!1,onInput:o[0]||(o[0]=a=>{e.$emit("update",t.field,a.target.value)})},null,40,J),T(" "+C(r.label.replace(/([A-Z])/g," $1"))+" ",1),_(p,{count:r.count},null,8,["count"])])]))),128))],2)}const X=y(G,[["render",Q]]),Y={components:{VueSelect:j},props:{field:{type:String},options:{type:Array},values:{type:Array},required:{type:Boolean,default:!1}},emits:["update"],data(){return{localVal:this.values}},watch:{localVal(e,o){this.localVal=e,this.$emit("update",this.field,e)}}},ee={class:"select-filter"},te={class:"option"},se=["innerHTML"],oe={class:"option"},le=["innerHTML"];function ne(e,o,t,m,s,u){const p=w,r=K("VueSelect");return n(),c("div",ee,[_(r,{modelValue:s.localVal,"onUpdate:modelValue":o[0]||(o[0]=a=>s.localVal=a),placeholder:"Select...",class:"select",options:t.options,reduce:a=>a.value,label:"label",clearable:!t.required,multiple:!0},{option:f(a=>[l("div",te,[l("div",{innerHTML:a.label},null,8,se),a.count?(n(),h(p,{key:0,count:a.count},null,8,["count"])):d("",!0)])]),"selected-option":f(a=>[l("div",oe,[l("div",{innerHTML:a.label},null,8,le),a.count?(n(),h(p,{key:0,alternate:!0,count:a.count},null,8,["count"])):d("",!0)])]),_:1},8,["modelValue","options","reduce","clearable"])])}const ae=y(Y,[["render",ne]]),ie={props:{facetOptions:{type:Object,required:!0},filters:{type:Object},layout:{type:String,default:"stacked"}},emits:["updateFilters"],methods:{toggleCheckboxFilter(e,o){const t={...this.filters},m=[...t[e].value];t[e].value=g.toggleCheckboxFilter(o,m),this.$emit("updateFilters",t)},updateFilter(e,o){const t={...this.filters};t[e].value=o,this.$emit("updateFilters",t)}}},W=e=>(O("data-v-809f1d8c"),e=e(),U(),e),re={key:0,class:"filter content-type checkboxes"},ce=W(()=>l("label",null,"Type",-1)),ue={key:1,class:"filter"},pe=W(()=>l("label",null,"Section",-1));function de(e,o,t,m,s,u){const p=X,r=ae;return n(),c("div",{class:V(["web-search-filters",t.layout])},[t.facetOptions.contentType.length?(n(),c("div",re,[ce,_(p,{field:"type",options:t.facetOptions.contentType,values:t.filters.type.value,onUpdate:u.toggleCheckboxFilter},null,8,["options","values","onUpdate"])])):d("",!0),t.facetOptions.websiteSchedule.length?(n(),c("div",ue,[pe,_(r,{field:"websiteSchedule",options:t.facetOptions.websiteSchedule,values:t.filters.websiteSchedule.value,onUpdate:u.updateFilter},null,8,["options","values","onUpdate"])])):d("",!0)],2)}const he=y(ie,[["render",de],["__scopeId","data-v-809f1d8c"]]),_e={props:{tenantKey:{type:String,required:!0},imagePosition:{type:String,default:"above"},dateFormat:{type:String},itemMask:{type:Boolean,default:!1},authorFilter:{type:Boolean,default:!1},labelFilter:{type:Boolean,default:!1},statusFilter:{type:Boolean,default:!1},syncWithUrl:{type:Boolean,default:!1},cutoffDate:{type:Number},mode:{type:String,default:"public"},imageShaping:{type:String},excludeContentTypes:{type:Array,default:()=>["Promotion","Contact"]}},emits:["item-click","updateFilters"],data(){return{viewType:"grid",userHasToggled:!1,selectedItems:[],facetOptions:{contentType:[],websiteSchedule:[]},index:null,results:{hits:[],page:1,nbPages:0},filters:{text:"",type:{value:[]},websiteSchedule:{value:[]},tenant:[this.tenantKey],page:1},sort:"relevance",changeSortOnSearch:!0,searchOnFilterChange:!1,filterKey:Math.random()}},async mounted(){this.syncWithUrl&&(this.filters={...this.filters,...g.getFiltersFromUrl()}),this.filterKey=Math.random(),await this.search()},methods:{updateFilter(e,o){this.changeSortOnSearch&&(this.sort="relevance",this.changeSortOnSearch=!1);const t={...this.filters};t[e]=o,this.filters[e]=o,this.$emit("updateFilters",t),this.search()},updateFilters(e){this.filters={...this.filters,...e},this.filters.page=1,this.search()},getPage(e){this.results.page=e,this.filters.page=e,this.search()},updateSort(e){this.sort=e,this.filters.page=1,this.search()},async search(){const e=await g.search(this.syncWithUrl,this.cutoffDate,this.filters,this.filters.page-1,this.mode,this.sort,this.excludeContentTypes,20);this.facetOptions=e.facetOptions,this.results=e.results,this.searchOnFilterChange=!0}}},me=e=>(O("data-v-d45c32e0"),e=e(),U(),e),fe={class:"search"},ye={class:"search-field-wrapper"},ge={class:"field"},ve={class:"stats"},be={key:0,class:"count"},Se={class:"columns"},Fe={key:0,class:"sponsored-search",style:{marginBottom:"15px"}},ke=me(()=>l("div",{class:"sponsored-search-text"},"Search sponsored by",-1)),xe=["src"],we={class:"results"},Te={class:"topbar"},Ce={class:"sort"},Ve={key:1,class:"no-results"};function Oe(e,o,t,m,s,u){const p=L,r=he,a=z,B=E,P=R,$=Z,I=q;return n(),c("div",fe,[_(I,null,{default:f(()=>{var v,b,S,F,k,x;return[l("div",ye,[l("div",ge,[(n(),h(p,{key:s.filterKey,value:s.filters.text,onUpdate:o[0]||(o[0]=i=>{u.updateFilter("text",i)})},null,8,["value"])),l("div",ve,[l("div",null,[s.results?(n(),c("span",be,C(s.results.nbHits),1)):d("",!0),T(" results ")])])])]),l("div",Se,[l("div",{class:"filters",style:N({paddingRight:"25px",fontFamily:e.$ss.primaryFontFamily})},[(b=(v=e.$ss)==null?void 0:v.sponsoredSearch)!=null&&b.enabled?(n(),c("div",Fe,[ke,(n(),h(D((F=(S=e.$ss)==null?void 0:S.sponsoredSearch)!=null&&F.clickUrl?"a":"span"),{href:(x=(k=e.$ss)==null?void 0:k.sponsoredSearch)==null?void 0:x.clickUrl,target:"_blank"},{default:f(()=>{var i;return[l("img",{src:`${((i=e.$ss.sponsoredSearch)!=null&&i.searchPageLogo?e.$ss.sponsoredSearch.searchPageLogo:e.$ss.sponsoredSearch.logo).split("?")[0]}?auto=format,compress&height=50`,alt:"Sponsored search logo",height:"35",class:"sponsored-search-logo"},null,8,xe)]}),_:1},8,["href"]))])):d("",!0),_(r,{"facet-options":s.facetOptions,filters:s.filters,onUpdateFilters:u.updateFilters},null,8,["facet-options","filters","onUpdateFilters"])],4),l("div",we,[l("div",Te,[l("div",Ce,[(n(),h(a,{key:s.sort,value:s.sort,"sort-options":["relevance","published","alpha","alpha_desc"],style:{display:"flex"},onUpdateSort:u.updateSort},null,8,["value","onUpdateSort"]))]),_(B,{value:s.viewType,style:{display:"flex"},onSetViewType:o[1]||(o[1]=i=>{s.viewType=i})},null,8,["value"])]),(n(),h(P,{key:s.viewType,"image-position":s.viewType==="list"?"left":"above","image-shaping":t.imageShaping,"number-of-columns":s.viewType==="list"?1:4,"show-summary":!0,data:{items:s.results.hits.map(i=>({...i,authors:{edges:((i==null?void 0:i.authors)??[]).map(H=>({node:H}))}}))},"item-mask":t.itemMask,onItemClick:o[2]||(o[2]=i=>{e.$emit("item-click",{...i,tenantKey:t.tenantKey})})},null,8,["image-position","image-shaping","number-of-columns","data","item-mask"])),s.results.nbPages>0?(n(),h($,{key:0,"active-page":s.results.page,"total-count":s.results.nbHits,"items-per-page":s.results.hitsPerPage,onChangeValue:o[3]||(o[3]=i=>u.getPage(i))},null,8,["active-page","total-count","items-per-page"])):d("",!0),s.results.nbHits===0?(n(),c("div",Ve," There were no results that matched your criteria.")):d("",!0)])])]}),_:1})])}const Ee=y(_e,[["render",Oe],["__scopeId","data-v-d45c32e0"]]);export{Ee as default};