1import{a as e}from"./DH_oPWig.js";import{D as t,E as n,at as r,nt as i,qt as a,st as o,w as s,wt as c,zt as l}from"./BaBhFZm2.js";import{r as u}from"./CrukJ6M3.js";import{C as d}from"./Cv5BFZnk2.js";import"./BpqSkCXx2.js";import{t as f}from"./D3ohpT7u2.js";var p={__name:`SNGStories`,props:{theme:{type:String,default:`light-theme`,validator:function(e){return[`light-theme`,`dark-theme`].includes(e)}},wrapper:Boolean,moduleTitle:{type:String,required:!1,default:`All News`},id:{type:Number,required:!1},sportId:{type:Number,required:!1},type:{type:String,default:`recent`,validator:function(e){return[`related`,`trending`,`recent`].includes(e)}},dataType:{type:String,default:`all`,validator:function(e){return[`sport`,`story`,`all`].includes(e)}},sponsorContentConfig:{type:Object,default:()=>({show:!1,src:``,content:``,position:3,backgroundColor:``})},sponsorLogoConfig:{type:Object,default:()=>({show:!0,src:null,stack:!1})},callToActionConfig:{type:Object,default:()=>({show:!0,text:`All News`,url:`/archives`,forceUrl:!1})},orientationConfig:{type:Object,required:!1,default:()=>({mobile:{orientation:`top`,rows:1,count:4},tablet:{orientation:`top`,rows:1,count:4},desktopFull:{orientation:`top`,rows:1,count:4},desktopRail:{orientation:`left`,rows:1,count:4},desktopNoRail:{orientation:`top`,rows:1,count:4}})},loadMoreEnabled:Boolean,hideOnEmpty:{type:Boolean,default:!1},_id:String},setup(p){let m=f(),h=l(!1),{$customFetch:g}=e(),_=p,v=l(_.type),y=l(_.dataType),b=u(),x=s(()=>_.callToActionConfig?.forceUrl?_.callToActionConfig:{..._.callToActionConfig,url:b.value?.global_sport_name_slug?`/sports/${b.value?.global_sport_name_slug}/archives`:`/archives`}),S=l(1),C=()=>{let e=D.value*T.value;return{id:_.id||0,sportId:_.sportId||0,count:e,page:S.value}},w=s(()=>m.getLoadingStoriesFlag),T=l(1),E=l(`top`),D=l(4),O=async()=>{await m.fetchNewsBySport({payload:C(),fetch:g});let e=m.getNewsBySport(_.id??0);e&&(h.value=e&&S.value<e.pages)},k=async()=>{await m.fetchLatestNews({payload:C(),fetch:g});let e=m.getLatestNews;e&&(h.value=e&&S.value<e.pages)},A=async()=>{await m.fetchNewsByStoryId({payload:C(),fetch:g});let e=m.getNewsByStoryId(_.id??0);e&&(h.value=e&&S.value<e.pages)},j=s(()=>{let e=v.value===`related`?y.value===`story`?m.getNewsByStoryId(_.id??0):m.getNewsBySport(_.id??0):m.getLatestNews;return e?.items?.length?e?.items?.length?e.items:[]:m.getLatestNews?.items?.length?m.getLatestNews.items:[]});o(`stories`,s(()=>j.value)),o(`isLoading`,s(()=>w.value));let M=async()=>{S.value+=1,await N(),await P()},N=async()=>{try{v.value===`related`&&(y.value===`sport`&&await O(),y.value===`story`&&await A()),v.value===`recent`&&y.value===`all`&&await k()}catch{}},P=async()=>{!j.value?.length&&v.value===`related`&&(console.info(`[SStories] fetching all recent stories instead`),await k())};c(()=>_.id,async()=>{await N(),await P()}),i(async()=>{await N(),await P()});let F=s(()=>!_.hideOnEmpty||j.value.length>0);return(e,i)=>a(F)?(r(),n(a(d),{key:0,orientation:a(E),orientationConfig:p.orientationConfig,rows:a(T),count:a(D),moduleTitle:p.moduleTitle,sponsorLogoConfig:p.sponsorLogoConfig,sponsorContentConfig:p.sponsorContentConfig,callToActionConfig:a(x),hasMoreToLoad:a(h),wrapper:p.wrapper,loadMoreEnabled:p.loadMoreEnabled,onLoadMore:M},null,8,[`orientation`,`orientationConfig`,`rows`,`count`,`moduleTitle`,`sponsorLogoConfig`,`sponsorContentConfig`,`callToActionConfig`,`hasMoreToLoad`,`wrapper`,`loadMoreEnabled`])):t(``,!0)}};export{p as t};
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.