"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[9524],{19524:(e,t,r)=>{r.r(t),r.d(t,{default:()=>v});var n=r(12139),o=r(56747),s=r(58059),i=r(82762),d=r(58061),u=r(16575),l=r(44955),a=r(80787),c=r(97717),p=r(56753);const v=function({sports:e,pageId:t,eventsNumber:r}){var v,I;(0,d.TK)();const g=(0,c.W)(),b=(0,d.qM)(),f=(0,o.k6)(),[m,S]=(0,n.eJ)(),[h,T,k]=(0,d.CU)(!0,i.LoaderMode.Skeleton),[E,O]=(0,n.eJ)(),[C,V]=(0,n.eJ)(),{providerId:y}=E||{},N=(0,n.Ye)((()=>{var e;const t=E?null==m||null==(e=m.find((e=>e.providerId===E.providerId)))?void 0:e.targetUri:"";return`${i.APP_ROUTES.live}${t}`}),[m,E]);(0,n.d4)((()=>{if(g.isLoaded){const e=s.JA.getSports({mode:k.current,connector:T}).subscribe(S);return()=>e.unsubscribe()}}),[g]),(0,n.d4)((()=>{null!=e&&e.length&&V(e[0].providerId)}),[e]);const{eventsBySports:M,changeMarketHandler:L,restore:J,selectedMarket:P,loading:U}=(0,a.Z)({history:f,selectedSport:E,setSelectedSport:O,sports:m,pageId:t,providerId:C,isModule:!0,eventsNumber:r});return(0,p.tZ)(u.OY,{title:b("_LIVE_NOW"),viewAllLink:N,matches:{categories:null==M||null==(v=M[0])?void 0:v.categories,markets:null==M||null==(I=M[0])?void 0:I.markets},sportRef:y,sports:e,onOddsClick:e=>{(0,l.Ul)(Object.assign({},e,{type:i.BetType.LIVE,sportId:y}))},onMarketChange:L,onSportChange:e=>V(e.providerId),selectedSport:E,selectedMarket:P,isLoading:U||!y||h,noEventsMessageKey:"LIVE.NONE",restore:J,showMarketSelector:!0,showSportSelector:!0,isLive:!0})}},80787:(e,t,r)=>{r.d(t,{Z:()=>p});var n=r(12139),o=r(58059),s=r(82762),i=r(58061),d=r(96e3),u=r(85782),l=r(72709),a=r(25846);const c=(e,t)=>e.reduce(((e,r)=>(r.competitions.forEach((r=>{r.events.forEach((r=>{t?r.sportId===t&&e.push(r.id):e.push(r.id)}))})),e)),[]),p=({history:e,selectedSport:t,setSelectedSport:r,sports:p,targetUri:v,pageId:I,isModule:g,providerId:b,eventsNumber:f})=>{var m,S,h;const[T,k]=(0,n.eJ)([]),[E,O]=(0,n.eJ)(null),[C,V]=(0,n.eJ)(!1),[y,N]=(0,n.eJ)(!1),M=(0,n.sO)(null),[L,J]=(0,n.eJ)(),[P,U]=(0,n.eJ)(),[j,w]=(0,n.eJ)([]),A=(0,n.sO)({}),R=(0,n.sO)({}),[Y,_]=(0,n.eJ)(null),Z=(0,n.sO)(null),{userLanguage:$}=(0,n.qp)(d.AZ),{id:F}=L||{id:null},{providerId:K,providerZoomId:D}=P||{providerId:null},B=null==(m=(0,i.aF)().user)||null==(S=m.account)?void 0:S.id,x=()=>{const{sport:e,market:t}=R.current;r(e),U(e),O(t||null),J(t||null),V(!0),_(null),Z.current=null,M.current=null},W=(e=!0)=>(V(!1),N(e),o.jV.getLiveEvents(Object.assign({locale:$,sportId:K,marketId:F,pageId:I},D?{zoomSportId:D}:{}),K===s.SportProviderId.TV).subscribe({next:e=>{var t;const n=null==(t=e.data[0])?void 0:t.markets[0];N(!1),k(e.data),r(P),O(L||n||null),M.current=n||null,K===s.SportProviderId.TV&&(Z.current=e.data.filter((e=>e.markets[0])).map((e=>({sportId:e.sportId,marketId:e.markets[0].id})))),_(null);const o=e.data.reduce(((e,t)=>[...e,...c(t.categories,K)]),[]),i=D?e.data.reduce(((e,t)=>[...e,...c(t.categories,D)]),[]):[];A.current={[K]:o,[D]:i},f&&w([...o,...i])},error:x}));return(0,n.d4)((()=>{if((v||b)&&p){let r;R.current.sport=t,R.current.market=L,J(void 0),r=g?p.find((e=>e.providerId===b)):p.find((0,u.TY)({targetUri:v})),r?(U(r),_(null),Z.current=null,M.current=null):g||e.replace(s.APP_ROUTES.live)}else k([]),J(void 0),U(void 0),_(null),O(null),Z.current=null,M.current=null}),[v,p,b]),(0,n.d4)((()=>{if(null!==Y){if(0!==Y){const e=W(!1);return()=>e.unsubscribe()}k([])}}),[Y]),(0,n.d4)((()=>{if(null!=P&&P.providerId&&(B||(null==P?void 0:P.providerId)!==s.SportProviderId.TV)){const e=W();return()=>e.unsubscribe()}B||(null==P?void 0:P.providerId)!==s.SportProviderId.TV||(k([]),r(P),Z.current=null)}),[$,F,null==P?void 0:P.providerId,B]),T.forEach((e=>{(0,l._A)(e.categories)})),(0,a.w)({sportId:null==t?void 0:t.providerId,sportZoomId:null==t?void 0:t.providerZoomId,marketId:(null==E?void 0:E.id)||(null==(h=M.current)?void 0:h.id),setStateFunction:k,pageType:a._.Inplay,hasEvents:!!T,eventIds:f?j:null,onSportEventsCountChange:_,TVsports:Z.current,eventsNumber:f,onReconnected:()=>W(!1),sportsEventsIds:A.current}),{showMarketSelector:!!E||!!M.current,eventsBySports:T,selectedMarket:E||M.current,changeMarketHandler:e=>{e.id!==(null==L?void 0:L.id)&&(R.current.market=L,J(e))},restore:C,loading:y}}},97717:(e,t,r)=>{r.d(t,{W:()=>c});var n=r(12139),o=r(64763),s=r(82762),i=r(35104),d=r(85573);const u={enableStreamingTV:i.NZ.tv.enabled},l={enableStreamingTV:{type:o.FeatureConfigurationsDataType.Boolean}},a=(0,d._i)({fallbackConfig:u,validations:l}),c=()=>{const[e,t]=(0,n.eJ)(Object.assign({},u,{isLoaded:!1}));return(0,n.d4)((()=>{const e=d.PK.getKey(s.FeatureToggleKeys.LiveSportsConfig,{validator:a}).subscribe({next:e=>{t(Object.assign({},e.composedConfig,{isLoaded:!0}))},error:()=>{t((e=>Object.assign({},e,{isLoaded:!0})))}});return()=>e.unsubscribe()}),[]),e}},25846:(e,t,r)=>{r.d(t,{_:()=>c,w:()=>v});var n=r(12139),o=r(94953),s=r(99054),i=r(82762),d=r(35104),u=r(58061),l=r(85782);function a(e,t){return void 0!==t.marketCount&&e.marketCount!==t.marketCount&&(e.marketCount=t.marketCount,!0)}let c;!function(e){e.Inplay="Inplay",e.VirtualSport="VirtualSport",e.VirtualRacing="VirtualRacing"}(c||(c={}));const p="v1"===d.NZ.apiVersion;function v({sportId:e,sportZoomId:t,marketId:r,setStateFunction:d,pageType:v,hasEvents:I,eventIds:g,onSportEventsCountChange:b,TVsports:f,eventsNumber:m,onReconnected:S,sportsEventsIds:h}){const[T,k]=(0,n.eJ)(null),E=(0,u.bx)(S);function O(e){const t=t=>{const r={EVENT_UPDATE:C,MARKET_UPDATE:V,SCORE_UPDATE:y}[e.type];let n=!1;return r&&t&&(n=r(e,t)),n};switch(v){case c.Inplay:d((r=>{const n=function(e,t){const{competitionId:r,eventId:n}=e;for(const e of t)for(const t of e.categories){const e=t.competitions||[];if(r){const t=e.find((0,l.TY)({id:r})),o=null==t?void 0:t.events.find((0,l.TY)({id:n}));if(o)return o}for(let t=0;t<e.length;++t){const r=e[t].events.find((0,l.TY)({id:n}));if(r)return r}}return null}(e,r);return t(n)?[...r]:r}));break;case c.VirtualSport:d((r=>{const n=function(e,t){const{eventId:r}=e,n=t.groupedEvents.map((e=>e.events.find((0,l.TY)({id:r}))));return n&&n[0]}(e,r);return t(n)?Object.assign({},r):r}));break;case c.VirtualRacing:d((r=>{const n=function(e,t){const{eventId:r}=e;return t.find((0,l.TY)({id:r}))}(e,r);return t(n)?[...r]:r}))}}function C(e,t){const r=e.data;let n=!1;return n=a(t,e),t.state!==r.state&&(t.state=r.state,n=!0),n}function V(e,t){var r;const n=e.data,o=t.markets.find((0,l.TY)({id:n.id}));if(!o)return console.warn(`NOT FOUND MARKET e.id:${t.id} m.ids: ${t.markets.map((e=>e.id)).join(",")}; update: m.id:${n.id}`),!1;let s=!1;return s=a(t,e),o.active!==n.active&&(o.active=n.active,s=!0),o.state!==n.state&&(o.state=n.state,s=!0),null==(r=n.outcomes)||r.forEach((e=>{const r=o.outcomes.find(p?(0,l.TY)({id:e.id}):(0,l.TY)({entityId:e.entityId}));var n;r?(p?(void 0!==e.change&&r.change!==e.change&&(r.change=e.change,s=!0),r.value!==e.value&&(r.value=null!=(n=e.value)?n:null,s=!0)):void 0!==e.value&&r.value!==e.value&&(r.change=Number(e.value)-Number(r.value),r.value=e.value,s=!0),void 0!==e.priceId&&r.priceId!==e.priceId&&(r.priceId=e.priceId,s=!0),r.active!==e.active&&(r.active=e.active,s=!0)):console.warn(`NOT FOUND OUTCOME e.id:${t.id} m.id: ${o.id} o.id: ${o.outcomes.map((e=>e.id)).join(",")}; update: o.id:${e[p?"id":"entityId"]}`)})),s}function y(e,t){const r=e.data,n=t.scoreboard;let o=!1;return o=a(t,e),Object.keys(r).some((e=>r[e]!==n[e]))&&(t.scoreboard=Object.assign({},t.scoreboard,r),o=!0),o}(0,n.d4)((()=>{if(e&&I){let n;if(k(null),f)n=E.sportTVSubscription({sports:f}).subscribe(O);else if(r&&e!==i.SportProviderId.TV)if(g)n=E.eventListSubscription(g,r).subscribe(O);else{const s=[E.sportSubscription(e,r)];t&&s.push(E.sportSubscription(t,r)),n=(0,o.T)(...s).subscribe(O)}return()=>{var e;return null==(e=n)?void 0:e.unsubscribe()}}}),[e,r,v,I,g,f]),(0,n.d4)((()=>{if(e){let r;if(e===i.SportProviderId.TV)r=E.liveEventsCountSubscription().subscribe((e=>{var t;b&&b(null!=(t=e.data.premierBetTvEventsCount)?t:0)}));else{const n=[E.sportEventsIdsSubscription(e).pipe((0,s.h)((t=>t.sportId===e)))];t&&n.push(E.sportEventsIdsSubscription(t).pipe((0,s.h)((e=>e.sportId===t)))),r=(0,o.T)(...n).subscribe((r=>{let n=[];var o,s;r.sportId===e&&(n=[...r.data.eventIds,...null!=(o=null==h?void 0:h[t])?o:[]]),r.sportId===t&&(n=[...null!=(s=null==h?void 0:h[e])?s:[],...r.data.eventIds]),k(n)}))}return()=>r.unsubscribe()}}),[e]),(0,n.d4)((()=>{b&&T&&(g?function(e,t,r){if(r&&e.length<r&&e.length<t.length)return!0;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!0;return!1}(g,T,m)&&b(T.length):b(T.length))}),[T,g])}}}]);