1import{d as W,ag as X,aC as Y,G as L,a3 as Z,z as ee,E as ae,I as le,o as i,j as b,w as x,a as O,u as e,h as y,c as F,F as Q,b as P,g as te,f as T,J as se,r as n,l as re}from"./B7jKphlx.js";import{_ as ne}from"./CHR9Nqy4.js";import{_ as oe}from"./BC1_ZVhi.js";import{_ as ie}from"./0PGe7-oM.js";import{_ as ue}from"./Cx38clDD.js";import"./BNtfcHnG.js";import"./C2uwvWaH.js";import"./otH78XZw.js";import"./BMJ1OtK8.js";import"./C8oKskU6.js";import"./0xmjySIm.js";import"./jFOUyIsZ.js";import"./B6zY9kdV.js";const ge={class:"w-full mt-12 mb-4 text-center text-clear"},ce={class:"pb-8 bg-surface news-listing"},de={key:3,class:"w-full px-4 mt-12 mb-4 text-center text-clear"},ve={key:4,class:"w-full px-4 mt-12 mb-4 text-center text-clear"},Fe=W({name:"ListingsNews",__name:"index",props:{slots:{default:()=>({adSlot:void 0})},widget:{default:()=>({complexCardStyle:!1})}},setup(N){const $=N,A=X(),j=Y(),R=L(),B=Z(),{$gc:_}=ee(),{defaultProperty:C,property:f,propertyIds:k}=ae(B),{setProperty:G}=B,u=n(!0),D=n(1),v=n(),g=n([]),J=n(null),o=n([]),p=n(null),w=n(),V=n(!0),h=n(!1),c=n(10),M={label:"All",slug:""},m=re(()=>{var d;const a=((d=A.params)==null?void 0:d.slug)||"",l=A.hash.substring(1);if(typeof a=="string")return g.value.find(s=>s.slug.replace("/","")===a);if(a.length===1&&l)return g.value.find(s=>s.slug.replace("/","")===l.toLowerCase());if(a.length===2&&k.value.includes(a[1]))return{label:"All",slug:""};if(a.length===3&&k.value.includes(a[1]))return g.value.find(s=>s.slug.replace("/","")===a[2]);if(a.length===2&&k.value.includes(a[1])&&l)return g.value.find(s=>s.slug.replace("/","")===l.toLowerCase());if(a.length===1)return M;const t=g.value.find(s=>s.slug.replace("/","")===a[1]);return(t==null?void 0:t.childFriendly)!==void 0&&L().setChildFriendly(t==null?void 0:t.childFriendly),t}),U=async(a={page:{size:c.value,number:1},sort:"publishedDateTime:desc"})=>{var s,S,z;const l=((s=m.value)==null?void 0:s.label)==="All",t=f.value||C.value||void 0,d=t?`propertyID:${t}`:void 0;if(l){try{const r=await _().news.web().getLatest(d,a);o.value=a.page.number!==1?o.value.concat(r):r,w.value=!1}catch(r){console.error("Error fetching latest news",r),p.value=r,w.value=!1}u.value=!1}else try{const r=await _().news.web().getByCategory((S=m.value)==null?void 0:S.slug,a,d);o.value=a.page.number!==1?o.value.concat(r):r,w.value=!1}catch(r){console.error("Error fetching news for category:",(z=m.value)==null?void 0:z.slug,r),w.value=!1,p.value=r}finally{u.value=!1}};return le(async()=>{(()=>{const a=A.params.slug[1];k.value.includes(a)?G(a):G(f.value||C.value)})(),await(async()=>{try{const a=(await _().news.web().getCategories({pageSize:100,propertyID:f.value||C.value})).map(l=>({label:l.newsCategory,slug:l.newsCategoryID,childFriendly:l.childFriendly}));g.value=[M,...a]}catch(a){console.error("Error fetching news categories",a),J.value=a}})(),await(async()=>{var a;if($.slots.adSlot)return h.value=!0,void(c.value=10);try{const l=await _().advertising.web().getAdvertisingSlots("news_page_slot");v.value=(a=l==null?void 0:l.attributes)==null?void 0:a.adverts,h.value=v.value.length>=1||R.useManagedAds,c.value=h.value?10:12}catch(l){console.error("Error fetching news_page_slot ads",l),h.value=!1,c.value=12}})(),await U()}),(a,l)=>{const t=te,d=ne,s=oe,S=ie,z=se,r=ue;return i(),b(r,null,{error:x(({error:E})=>[O("div",ge,[P(t,{tag:"h5"},{default:x(()=>[...l[2]||(l[2]=[T(" Sorry, something went wrong! Please try again later. ",-1)])]),_:1})])]),default:x(()=>{var E,q,H;return[O("div",ce,[e(J)?y("",!0):(i(),b(d,{key:0,"show-arrows":"dynamic",class:"px-4 group bg-surface-high text-clear row-contained","show-fade":!1,"active-tab":(E=e(m))==null?void 0:E.slug,items:e(g),onTabUpdated:l[0]||(l[0]=K=>{return I=K.slug,L(),void(f.value===C.value?j.push(`/news${I}`):j.push(`/news/${f.value}${I}`));var I})},null,8,["active-tab","items"])),(q=$.widget)!=null&&q.complexCardStyle?y("",!0):(i(),F(Q,{key:1},[e(u)||!e(p)&&e(o).length?(i(),b(s,{key:0,loading:e(u),list:e(o),"show-ads":e(h),"page-size":e(c),"has-adverts":e(v)&&e(v).length>=1,"ad-position":4},null,8,["loading","list","show-ads","page-size","has-adverts"])):y("",!0)],64)),(H=$.widget)!=null&&H.complexCardStyle?(i(),F(Q,{key:2},[e(m)&&e(u)||!e(p)&&e(o).length?(i(),b(S,{key:0,loading:e(u),"ad-slot":N.slots.adSlot,"news-list":e(o),"show-ads":e(h),"page-size":e(c),"page-number":e(D),"has-adverts":e(v)&&e(v).length>=1,"ad-position":4,category:e(m)},null,8,["loading","ad-slot","news-list","show-ads","page-size","page-number","has-adverts","category"])):y("",!0)],64)):!e(u)&&e(p)?(i(),F("div",de,[P(t,{tag:"h5"},{default:x(()=>[...l[3]||(l[3]=[T(" Sorry, something went wrong! Please try again later. ",-1)])]),_:1})])):e(u)||e(o).length?y("",!0):(i(),F("div",ve,[P(t,{tag:"h5"},{default:x(()=>[...l[4]||(l[4]=[T(" No news articles found for this category! ",-1)])]),_:1})])),e(o).length&&!e(p)&&e(V)?(i(),b(z,{key:5,class:"w-full mx-auto max-w-fit",content:"Load more news",icon:"article","icon-pack":"fan",loading:e(w),onClicked:l[1]||(l[1]=K=>(async()=>
1{w.value=!0,D.value+=1,await U({page:{size:c.value,number:D.value},sort:"publishedDateTime:desc"})})())},null,8,["loading"])):y("",!0)])]}),_:1})}}});export{Fe 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.