(self.webpackChunk=self.webpackChunk||[]).push([[9454],{79454:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>g});var n=r(12139),o=r(56747),s=r(77984),i=r(58059),d=r(82762),a=r(58061),l=r(16575),u=r(10042),c=r(80787),p=r(97717),v=r(44955),I=r(56753);const g=function(){var e,t;(0,a.TK)();const r=(0,a.qM)()("_LIVE_NOW"),[g,m]=(0,n.eJ)(),[b,f,h]=(0,a.CU)(!0,d.LoaderMode.Skeleton),[S,T]=(0,n.eJ)(),{name:k,providerId:E}=S||{},y=(0,o.UO)(),O=(0,o.k6)(),V=(null==y?void 0:y.sportName)&&`/${y[0]}/${y.sportName}`,N=(0,p.W)();(0,a.jr)(k?`${r} | ${k}`:r);const{eventsBySports:C,changeMarketHandler:L,restore:Z,selectedMarket:M,showMarketSelector:U,loading:w}=(0,c.Z)({history:O,selectedSport:S,setSelectedSport:T,sports:g,targetUri:V});return(0,n.d4)((()=>{if(N.isLoaded){const e=i.JA.getSports({mode:h.current,connector:f}).pipe((0,s.U)((e=>(N.enableStreamingTV&&e[0].providerId!==u.w.providerId&&e.unshift(u.w),e)))).subscribe(m);return()=>e.unsubscribe()}}),[N]),(null==S?void 0:S.providerId)===u.w.providerId?(0,I.tZ)(u.R,{eventsBySports:C,isLoading:!E||b||w}):(0,I.tZ)(l.OY,{showMarketSelector:U,matches:{categories:null==C||null==(e=C[0])?void 0:e.categories,markets:null==C||null==(t=C[0])?void 0:t.markets},sportRef:E,onOddsClick:e=>{var t,r;(0,v.Ul)(Object.assign({},e,{type:d.BetType.LIVE,sportId:null!=(t=null==e||null==(r=e.event)?void 0:r.sportId)?t:E}))},onMarketChange:L,selectedMarket:M,isLoading:!E||b||w,noEventsMessageKey:"LIVE.NONE",restore:Z,isLive:!0})}},10042:(e,t,r)=>{"use strict";r.d(t,{R:()=>N,w:()=>V});var n=r(82762),o=r(35104),s=r(58061),i=r(16575),d=r(85782),a=r(44955),l=r(46062),u=r.n(l),c=r(44036),p=r.n(c),v=r(96793),I=r.n(v),g=r(17892),m=r.n(g),b=r(11173),f=r.n(b),h=r(42464),S=r.n(h),T=r(57090),k=r.n(T),E={};E.styleTagTransform=S(),E.setAttributes=m(),E.insert=I().bind(null,"head"),E.domAPI=p(),E.insertStyleElement=f(),u()(k(),E),k()&&k().locals&&k().locals;var y=r(56753);const O=(0,d.dG)("premierbet-tv"),V={name:o.NZ.tv.name,mediaItemId:"tv-icon",providerId:n.SportProviderId.TV,targetUri:o.NZ.tv.targetUri,tabs:[],modules:[]},N=({eventsBySports:e,isLoading:t})=>{var r,l,u;const{isLoaded:c,layout:p}=(0,s.$Y)(),v=(null==p||null==(r=p.sportRibbon)?void 0:r.inPlay)||[];return(null==(l=(0,s.aF)().user)||null==(u=l.account)?void 0:u.id)?c&&e.length?(0,y.tZ)("div",{className:O("sports"),children:e.map((e=>{var r;const{categories:o,markets:s}=e,l=null==s?void 0:s[0],u=null==(r=v.find((0,d.TY)({providerId:e.sportId})))?void 0:r.name;return(0,y.tZ)(i.OY,{showMarketSelector:!1,matches:{categories:o,markets:s},sportRef:e.sportId,onOddsClick:t=>{(0,a.Ul)(Object.assign({},t,{type:n.BetType.LIVE,sportId:e.sportId}))},isLoading:t,selectedMarket:l,restore:!0,isLive:!0,title:u},e.sportId)}))}):(0,y.tZ)(i.$J,{messageKey:"TV.NONE",params:{name:o.NZ.tv.name}}):(0,y.tZ)("div",{className:O("unlogged"),children:(0,y.tZ)(i.vN,{tkey:"TV.LOGIN_MESSAGE",name:o.NZ.tv.name})})}},80787:(e,t,r)=>{"use strict";r.d(t,{Z:()=>p});var n=r(12139),o=r(58059),s=r(82762),i=r(58061),d=r(96e3),a=r(85782),l=r(72709),u=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:m,eventsNumber:b})=>{var f,h,S;const[T,k]=(0,n.eJ)([]),[E,y]=(0,n.eJ)(null),[O,V]=(0,n.eJ)(!1),[N,C]=(0,n.eJ)(!1),L=(0,n.sO)(null),[Z,M]=(0,n.eJ)(),[U,w]=(0,n.eJ)(),[P,_]=(0,n.eJ)([]),J=(0,n.sO)({}),R=(0,n.sO)({}),[j,Y]=(0,n.eJ)(null),$=(0,n.sO)(null),{userLanguage:A}=(0,n.qp)(d.AZ),{id:x}=Z||{id:null},{providerId:B,providerZoomId:F}=U||{providerId:null},K=null==(f=(0,i.aF)().user)||null==(h=f.account)?void 0:h.id,D=()=>{const{sport:e,market:t}=R.current;r(e),w(e),y(t||null),M(t||null),V(!0),Y(null),$.current=null,L.current=null},G=(e=!0)=>(V(!1),C(e),o.jV.getLiveEvents(Object.assign({locale:A,sportId:B,marketId:x,pageId:I},F?{zoomSportId:F}:{}),B===s.SportProviderId.TV).subscribe({next:e=>{var t;const n=null==(t=e.data[0])?void 0:t.markets[0];C(!1),k(e.data),r(U),y(Z||n||null),L.current=n||null,B===s.SportProviderId.TV&&($.current=e.data.filter((e=>e.markets[0])).map((e=>({sportId:e.sportId,marketId:e.markets[0].id})))),Y(null);const o=e.data.reduce(((e,t)=>[...e,...c(t.categories,B)]),[]),i=F?e.data.reduce(((e,t)=>[...e,...c(t.categories,F)]),[]):[];J.current={[B]:o,[F]:i},b&&_([...o,...i])},error:D}));return(0,n.d4)((()=>{if((v||m)&&p){let r;R.current.sport=t,R.current.market=Z,M(void 0),r=g?p.find((e=>e.providerId===m)):p.find((0,a.TY)({targetUri:v})),r?(w(r),Y(null),$.current=null,L.current=null):g||e.replace(s.APP_ROUTES.live)}else k([]),M(void 0),w(void 0),Y(null),y(null),$.current=null,L.current=null}),[v,p,m]),(0,n.d4)((()=>{if(null!==j){if(0!==j){const e=G(!1);return()=>e.unsubscribe()}k([])}}),[j]),(0,n.d4)((()=>{if(null!=U&&U.providerId&&(K||(null==U?void 0:U.providerId)!==s.SportProviderId.TV)){const e=G();return()=>e.unsubscribe()}K||(null==U?void 0:U.providerId)!==s.SportProviderId.TV||(k([]),r(U),$.current=null)}),[A,x,null==U?void 0:U.providerId,K]),T.forEach((e=>{(0,l._A)(e.categories)})),(0,u.w)({sportId:null==t?void 0:t.providerId,sportZoomId:null==t?void 0:t.providerZoomId,marketId:(null==E?void 0:E.id)||(null==(S=L.current)?void 0:S.id),setStateFunction:k,pageType:u._.Inplay,hasEvents:!!T,eventIds:b?P:null,onSportEventsCountChange:Y,TVsports:$.current,eventsNumber:b,onReconnected:()=>G(!1),sportsEventsIds:J.current}),{showMarketSelector:!!E||!!L.current,eventsBySports:T,selectedMarket:E||L.current,changeMarketHandler:e=>{e.id!==(null==Z?void 0:Z.id)&&(R.current.market=Z,M(e))},restore:O,loading:N}}},97717:(e,t,r)=>{"use strict";r.d(t,{W:()=>c});var n=r(12139),o=r(64763),s=r(82762),i=r(35104),d=r(85573);const a={enableStreamingTV:i.NZ.tv.enabled},l={enableStreamingTV:{type:o.FeatureConfigurationsDataType.Boolean}},u=(0,d._i)({fallbackConfig:a,validations:l}),c=()=>{const[e,t]=(0,n.eJ)(Object.assign({},a,{isLoaded:!1}));return(0,n.d4)((()=>{const e=d.PK.getKey(s.FeatureToggleKeys.LiveSportsConfig,{validator:u}).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)=>{"use strict";r.d(t,{_:()=>c,w:()=>v});var n=r(12139),o=r(94953),s=r(99054),i=r(82762),d=r(35104),a=r(58061),l=r(85782);function u(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:m,TVsports:b,eventsNumber:f,onReconnected:h,sportsEventsIds:S}){const[T,k]=(0,n.eJ)(null),E=(0,a.bx)(h);function y(e){const t=t=>{const r={EVENT_UPDATE:O,MARKET_UPDATE:V,SCORE_UPDATE:N}[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 O(e,t){const r=e.data;let n=!1;return n=u(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=u(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 N(e,t){const r=e.data,n=t.scoreboard;let o=!1;return o=u(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),b)n=E.sportTVSubscription({sports:b}).subscribe(y);else if(r&&e!==i.SportProviderId.TV)if(g)n=E.eventListSubscription(g,r).subscribe(y);else{const s=[E.sportSubscription(e,r)];t&&s.push(E.sportSubscription(t,r)),n=(0,o.T)(...s).subscribe(y)}return()=>{var e;return null==(e=n)?void 0:e.unsubscribe()}}}),[e,r,v,I,g,b]),(0,n.d4)((()=>{if(e){let r;if(e===i.SportProviderId.TV)r=E.liveEventsCountSubscription().subscribe((e=>{var t;m&&m(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==S?void 0:S[t])?o:[]]),r.sportId===t&&(n=[...null!=(s=null==S?void 0:S[e])?s:[],...r.data.eventIds]),k(n)}))}return()=>r.unsubscribe()}}),[e]),(0,n.d4)((()=>{m&&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,f)&&m(T.length):m(T.length))}),[T,g])}},57090:e=>{e.exports=[[e.id,".premierbet-tv__unlogged{padding:32px 16px;font-size:14px;text-align:center}.premierbet-tv__sports .events-module:first-child .page-header{border-top:none}","",""]]}}]);