PageSourceSearch

https://www.ewn.co.za/_nuxt/CXHLbxwY.js

js ewn.co.za collected 2026-10-02 02:32:55 UTC 11,230 bytes, 19 lines download raw bytes

1import{_ as z,c,o as r,a as v,i as R,aq as H,b as y,D as Z,j as _,k as L,B as S,ar as b,as as B,n as u,A as w,F,l as j,at as K,au as P,t as M,av as W,aw as f,ax as J,Z as U,a3 as G,a6 as Y,h as X}from"./CBZx7rdy.js";import{_ as ee}from"./BXrdiHdf.js";const ne={},te={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"stroke-current"};function ae(t,n){return r(),c("svg",te,n[0]||(n[0]=[v("path",{d:"M15.375 5.25L8.625 12L15.375 18.75","stroke-width":"2.25","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))}const se=z(ne,[["render",ae]]),ie={class:"grid grid-cols-3 py-4 lg:hidden"},le=R({__name:"SearchBar",props:{activeSearchMode:{type:Boolean}},emits:["resetRecentResultMode"],setup(t,{emit:n}){const a=t,s=n,e=H(),l=()=>{a.activeSearchMode?s("resetRecentResultMode"):e.push("/")};return(d,o)=>{const p=se;return r(),c("div",ie,[v("span",{onClick:l,class:"flex items-center justify-self-start"},[y(p)]),o[0]||(o[0]=v("p",{class:"justify-self-center text-base font-bold"},"Search",-1))])}}}),oe={},re={"aria-hidden":"true",class:"fill-current",viewBox:"0 0 32 32",width:"32",height:"32",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function ue(t,n){return r(),c("svg",re,n[0]||(n[0]=[v("path",{opacity:"0.1","fill-rule":"evenodd","clip-rule":"evenodd",d:"M16 6.5C13.3478 6.5 10.8043 7.55357 8.92893 9.42893C7.05357 11.3043 6 13.8478 6 16.5C6 19.1522 7.05357 21.6957 8.92893 23.5711C10.8043 25.4464 13.3478 26.5 16 26.5C18.6522 26.5 21.1957 25.4464 23.0711 23.5711C24.9464 21.6957 26 19.1522 26 16.5C26 13.8478 24.9464 11.3043 23.0711 9.42893C21.1957 7.55357 18.6522 6.5 16 6.5ZM2 16.5C2 8.768 8.268 2.5 16 2.5C23.732 2.5 30 8.768 30 16.5C30 24.232 23.732 30.5 16 30.5C8.268 30.5 2 24.232 2 16.5Z",fill:"#101010"},null,-1),v("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M16.0003 6.50002C13.4221 6.49422 10.9425 7.49001 9.08434 9.27735C8.69937 9.63329 8.19003 9.82383 7.66596 9.80795C7.1419 9.79206 6.64504 9.57102 6.28234 9.19241C5.91964 8.81381 5.72011 8.30792 5.72672 7.78366C5.73333 7.2594 5.94554 6.75869 6.31767 6.38935C8.92023 3.88863 12.3911 2.49446 16.0003 2.50002C16.5308 2.50002 17.0395 2.71073 17.4145 3.0858C17.7896 3.46088 18.0003 3.96958 18.0003 4.50002C18.0003 5.03045 17.7896 5.53916 17.4145 5.91423C17.0395 6.2893 16.5308 6.50002 16.0003 6.50002Z"},null,-1)]))}const O=z(oe,[["render",ue]]),de=async t=>{const a=Z().public.autocompleteBaseUrl;return(await(await fetch(`${a}/?q=${encodeURIComponent(t)}`)).json()).slice(0,3)},ce={class:"relative"},me={class:"relative flex flex-row items-center gap-3 overflow-hidden rounded-md bg-surface-03 p-3"},ve=["value","onKeydown"],pe={key:0,class:"absolute w-full bg-surface-primary p-4 md:static"},fe={class:"flex flex-col gap-1"},he=["onClick"],_e={class:"line-clamp-1"},ge=R({__name:"SearchForm",props:{modelValue:{}},emits:["setRecentResultMode","update:modelValue"],setup(t,{emit:n}){const a=n,s=m=>{const i=m.target.value;p(i),a("update:modelValue",i)},e=_(!1),l=_(0),d=_([]),o=L(()=>[...d.value]),p=K(m=>{d.value=[],l.value=0,!(!m||m.length<3)&&(e.value=!0,de(m).then(i=>{d.value=i}).catch(()=>{d.value=[]}).finally(()=>{e.value=!1}))},500),k=()=>{l.value!==0&&a("update:modelValue",d.value[l.value-1]),d.value=[]},$=()=>{l.value=Math.max(0,l.value-1)},x=()=>{l.value=Math.min(l.value+1,o.value.length-1)},C=m=>{a("update:modelValue",m),d.value=[]};return(m,i)=>{const h=P,V=O;return r(),c("div",ce,[v("div",me,[y(h),v("input",{class:"flex-1 border-none bg-surface-03 text-sm font-medium text-content-primary outline-none",placeholder:"Search for Podcasts, Shows, Videos,...",value:m.modelValue,onInput:s,onFocusin:i[0]||(i[0]=g=>!m.modelValue.length&&m.$emit("setRecentResultMode")),onKeydown:[b(k,["enter"]),i[1]||(i[1]=b(g=>d.value=[],["esc"])),b(B($,["prevent"]),["up"]),b(B(x,["prevent"]),["down"])]},null,40,ve)]),u(d).length||u(e)?(r(),c("div",pe,[v("div",fe,[i[2]||(i[2]=v("div",{class:"p-2 text-left text-lg font-bold mb-2"},"Do you mean?",-1)),(r(!0),c(F,null,j(u(o),(g,I)=>(r(),c("button",{key:I,class:"cursor-pointer rounded-sm p-2 text-left hover:bg-neutral-125 text-sm",onClick:A=>C(g)},[v("span",_e,M(g),1)],8,he))),128)),u(e)?(r(),w(V,{key:0,class:"animate-spin"})):S("",!0)])])):S("",!0)])}}}),ke={key:0,class:"mb-5 text-lg font-bold lg:mt-4"},ye={class:"flex flex-col gap-9 pb-32"},Se={key:0,class:"text-base"},be=R({__name:"SearchResult",props:{results:{},isHistoryResult:{type:Boolean},hideResultTitle:{type:Boolean}},setup(t){return(n,a)=>{const s=ee;return r(),c(F,null,[n.hideResultTitle?S("",!0):(r(),c("h6",ke,M(n.isHistoryResult?"Your last results":"Results"),1)),v("div",ye,[n.results.length?(r(!0),c(F,{key:1},j(n.results,(e,l)=>(r(),w(s,{key:l,teaser:{headline:e.headline,headerImage:{sm:e.imageUrl,lg:e.imageUrl,md:e.imageUrl},path:e.path,subline:e.subline,id:e.pageId,tags:[],__typename:e.__typename,isBreakingNews:!1},"small-layout":!0},null,8,["teaser"]))),128)):(r(),c("span",Se,M(n.isHistoryResult?"No recent search result!":"No result found!"),1))])],64)}}});var T={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"getSearchContent"}
1,variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"searchQuery"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"page"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"pageSize"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"mediaType"}},type:{kind:"NamedType",name:{kind:"Name",value:"MediaType"}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"search"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"query"},arguments:[{kind:"Argument",name:{kind:"Name",value:"query"},value:{kind:"Variable",name:{kind:"Name",value:"searchQuery"}}},{kind:"Argument",name:{kind:"Name",value:"skip"},value:{kind:"Variable",name:{kind:"Name",value:"page"}}},{kind:"Argument",name:{kind:"Name",value:"take"},value:{kind:"Variable",name:{kind:"Name",value:"pageSize"}}},{kind:"Argument",name:{kind:"Name",value:"mediaType"},value:{kind:"Variable",name:{kind:"Name",value:"mediaType"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"total"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"results"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__typename"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"headline"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"headerImage"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"typename"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"overline"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"creatorName"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"subline"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"_url"},arguments:[],directives:[]}]}}]}}]}}]}}],loc:{start:0,end:393}};T.loc.source={body:`query getSearchContent($searchQuery: String, $page: Int, $pageSize: Int, $mediaType: MediaType) {
2  search {
3    query(query: $searchQuery, skip: $page, take: $pageSize, mediaType: $mediaType) {
4      total
5      results {
6        __typename
7        id
8        headline
9        headerImage
10        typename
11        overline
12        creatorName
13        subline
14        _url
15      }
16    }
17  }
18}
19`,name:"GraphQL request",locationOffset:{line:1,column:1}};function N(t,n){if(t.kind==="FragmentSpread")n.add(t.name.value);else if(t.kind==="VariableDefinition"){var a=t.type;a.kind==="NamedType"&&n.add(a.name.value)}t.selectionSet&&t.selectionSet.selections.forEach(function(s){N(s,n)}),t.variableDefinitions&&t.variableDefinitions.forEach(function(s){N(s,n)}),t.definitions&&t.definitions.forEach(function(s){N(s,n)})}var D={};(function(){T.definitions.forEach(function(n){if(n.name){var a=new Set;N(n,a),D[n.name.value]=a}})})();function q(t,n){for(var a=0;a<t.definitions.length;a++){var s=t.definitions[a];if(s.name&&s.name.value==n)return s}}function Ne(t,n){var a={kind:t.kind,definitions:[q(t,n)]};t.hasOwnProperty("loc")&&(a.loc=t.loc);var s=D[n]||new Set,e=new Set,l=new Set;for(s.forEach(function(o){l.add(o)});l.size>0;){var d=l;l=new Set,d.forEach(function(o){if(!e.has(o)){e.add(o);var p=D[o]||new Set;p.forEach(function(k){l.add(k)})}})}return e.forEach(function(o){var p=q(t,o);p&&a.definitions.push(p)}),a}Ne(T,"getSearchContent");const we=t=>{var n,a,s;return t.search.query?{total:((n=t.search.query)==null?void 0:n.total)??0,result:(s=(a=t.search.query)==null?void 0:a.results)==null?void 0:s.map(e=>({headline:e==null?void 0:e.headline,imageUrl:e==null?void 0:e.headerImage,pageId:e==null?void 0:e.id,overline:e==null?void 0:e.overline,subline:e==null?void 0:e.subline,type:e==null?void 0:e.typename,path:e==null?void 0:e._url,author:(e==null?void 0:e.creatorName)??"",__typename:e==null?void 0:e.__typename}))}:{total:0,results:[]}},Re=()=>{const t=W(T),{loading:n,error:a,load:s}=t;return{result:L(()=>t.result.value&&we(t.result.value)),error:a,loading:n,load:s}},Te={class:"w-full"},$e={class:"sticky top-0 z-20 mb-4 pb-4 bg-content-white lg:pt-8"},xe={key:1,class:"absolute inset-0 flex items-center justify-center bg-content-white"},Ie=R({__name:"index",setup(t){const n=_(f.INITIAL_STATE),a=_(null),s=_(""),e=_(0),l=_(10),d=J("search-result",[],sessionStorage,{serializer:{read:i=>i?JSON.parse(i):null,write:i=>JSON.stringify(i)}}),{result:o,loading:p,error:k,load:$}=Re(),x=K(i=>$(void 0,{searchQuery:i,pageSize:l.value}),500),C=async()=>{await x(s.value),n.value=f.LIVE_RESULT,e.value=0},m=L(()=>{var i;switch(n.value){case f.SAVED_RESULT:return d.value;case f.LIVE_RESULT:return((i=o.value)==null?void 0:i.result)||[];default:return[]}});return U(o,()=>{var i;o&&(d.value=(i=o.value)==null?void 0:i.result.slice(-10))}),U([s],()=>{C()}),G({title:()=>"EWN | Search",ogTitle:()=>
19"EWN | Search",twitterTitle:()=>"EWN | Search"}),(i,h)=>{const V=X,g=le,I=ge,A=be,Q=O;return r(),c("div",Te,[u(k)?(r(),w(V,{key:0})):(r(),c("div",{key:1,ref_key:"el",ref:a,class:"relative flex flex-col w-full px-4"},[v("div",$e,[y(g,{"active-search-mode":u(n)!==u(f).INITIAL_STATE,onResetRecentResultMode:h[0]||(h[0]=E=>n.value=u(f).INITIAL_STATE)},null,8,["active-search-mode"]),y(I,{modelValue:u(s),"onUpdate:modelValue":h[1]||(h[1]=E=>Y(s)?s.value=E:null),onSetRecentResultMode:h[2]||(h[2]=E=>n.value=u(f).SAVED_RESULT)},null,8,["modelValue"])]),u(n)!==u(f).INITIAL_STATE?(r(),w(A,{key:0,results:u(m),"is-history-result":u(n)===u(f).SAVED_RESULT},null,8,["results","is-history-result"])):S("",!0),u(p)?(r(),c("div",xe,[y(Q,{class:"animate-spin"})])):S("",!0)],512))])}}});export{Ie as default};

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.