1import{n as e}from"./i4j8FxYU.js";import{nt as t}from"./Cw6tMj5C.js";import{t as n,tr as r}from"./COs4qgDs.js";var i=e=>{let t=`props`in e?e.props:e;return{sportId:`sport_id`in t?t.sport_id==`0`?void 0:t.sport_id:`sportId`in t?t.sportId:void 0,locationIndicator:`extra`in t&&t.extra?.location_indicator?t.extra.location_indicator:`locationIndicator`in t?t.locationIndicator:void 0,gameId:`extra`in t&&t.extra?.game_id?t.extra.game_id:`gameId`in t?t.gameId:void 0,spotLight:`extra`in t&&t.extra?.spotlight?t.extra.spotlight:`spotLight`in t?t.spotLight:void 0,streamingProvider:`extra`in t&&t.extra?.streaming_provider?t.extra.streaming_provider:`streamingProvider`in t?t.streamingProvider:void 0,ticketedOnly:`ticketedOnly`in t?t.ticketedOnly:void 0,withCoverageOnly:`withCoverageOnly`in t?t.withCoverageOnly:void 0,groupedByDates:`groupedByDates`in t?t.groupedByDates:void 0,startDate:`startDate`in t?t.startDate:void 0,endDate:`endDate`in t?t.endDate:void 0,$pageIndex:`$pageIndex`in t?t.$pageIndex:void 0,$pageSize:`$pageSize`in t?t.$pageSize:void 0}},a=class{fetch;resourceBaseUrl=`/api/v2.1/EventsResults`;constructor({fetch:e}){this.fetch=e}async get(e){let t=i(e),a=`props`in e&&`start`in e.props?e.props.start:void 0,o=`props`in e&&`count`in e.props?e.props.count:void 0,s;return(a||o)&&(s=new n(a,o),t.pageIndex=s.pageIndex,t.pageSize=s.pageSize),this.fetch(this.resourceBaseUrl+`/results`,{params:t,onResponse:({response:e})=>{e.status===204&&(e._data=null)}}).then(e=>{if(!e)return[];let t=e.items.map(e=>r(e));return s?s.getData(t):t}).catch(e=>(console.error(`[ResultsRepo] get() Request error caught`,e),[]))}async getUpcoming(e){let t={data:[],before:``,after:``};return this.fetch(this.resourceBaseUrl+`/upcoming`,{params:e,onResponse:({response:e})=>{e.status===204&&(e._data=null)}}).then(e=>(t.data=e?.items||[],t.before=e?.before||``,t.after=e?.after||``,t)).catch(e=>(console.error(`[ResultsRepo] getUpcoming() Request error caught`,e),t))}},o=e(`results`,{state:()=>({results:{},resultsUpcoming:{},isLoadingMore:{},isLoading:{},moreToLoad:{},currentPage:{},totalPages:{},isLoadingUpcoming:{}}),actions:{async fetchResults(e){let{fetch:t,...n}=e;if(!(e.hash in this.results)){this.isLoading[e.hash]=!0;let r=await new a({fetch:t}).get(n);this.results[e.hash]=r,this.isLoading[e.hash]=!1}},async fetchUpcoming({payload:e,fetch:n}){let r=t(e);if(!(r in this.results)){this.isLoadingUpcoming[r]=!0;let{data:t}=await new a({fetch:n}).getUpcoming(e);this.resultsUpcoming[r]=t,this.isLoadingUpcoming[r]=!1}},async fetchMoreResults(e){let{fetch:t,...n}=e;this.isLoadingMore[e.hash]=!0;let r=await new a({fetch:t}).get(n),{props:i}=e;(!r||!r.length||r.length&&i.count&&r.length<i.count)&&(this.moreToLoad[e.hash]=!1),this.results[e.hash]=this.results[e.hash]?.concat(r),this.isLoadingMore[e.hash]=!1}},getters:{getResults:e=>t=>t in e.results?e.results[t]:[],getResultsCoverage:e=>n=>{let r=t(n);return r in e.resultsUpcoming?e.resultsUpcoming[r]:[]},getResultsTickets:e=>n=>{let r=t(n);return r in e.resultsUpcoming?e.resultsUpcoming[r]:[]},getLoadingMoreFlag:e=>t=>t in e.isLoadingMore?e.isLoadingMore[t]??!1:!1,getLoadingFlag:e=>t=>t in e.isLoading?e.isLoading[t]??!1:!1,getMoreToLoad:e=>t=>t in e.moreToLoad?e.moreToLoad[t]??!0:!0,getPageInfo:e=>n=>{let r=t(n);return{currentPage:e.currentPage[r]||1,totalPages:e.totalPages[r]||1}},getLoadingUpcomingFlag:e=>n=>{let r=t(n);return r in e.isLoadingUpcoming?e.isLoadingUpcoming[r]??!1:!1}}});export{o 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.