(self.webpackChunk=self.webpackChunk||[]).push([[3198],{10042:(e,t,n)=>{"use strict";n.d(t,{R:()=>N,w:()=>_});var r=n(82762),o=n(35104),i=n(58061),l=n(16575),s=n(85782),a=n(44955),d=n(46062),p=n.n(d),u=n(44036),c=n.n(u),v=n(96793),m=n.n(v),b=n(17892),g=n.n(b),I=n(11173),h=n.n(I),y=n(42464),T=n.n(y),f=n(57090),x=n.n(f),C={};C.styleTagTransform=T(),C.setAttributes=g(),C.insert=m().bind(null,"head"),C.domAPI=c(),C.insertStyleElement=h(),p()(x(),C),x()&&x().locals&&x().locals;var E=n(56753);const S=(0,s.dG)("premierbet-tv"),_={name:o.NZ.tv.name,mediaItemId:"tv-icon",providerId:r.SportProviderId.TV,targetUri:o.NZ.tv.targetUri,tabs:[],modules:[]},N=({eventsBySports:e,isLoading:t})=>{var n,d,p;const{isLoaded:u,layout:c}=(0,i.$Y)(),v=(null==c||null==(n=c.sportRibbon)?void 0:n.inPlay)||[];return(null==(d=(0,i.aF)().user)||null==(p=d.account)?void 0:p.id)?u&&e.length?(0,E.tZ)("div",{className:S("sports"),children:e.map((e=>{const{categories:n,markets:o}=e,i=null==o?void 0:o[0],{name:d}=v.find((0,s.TY)({providerId:e.sportId}));return(0,E.tZ)(l.OY,{showMarketSelector:!1,matches:{categories:n,markets:o},sportRef:e.sportId,onOddsClick:t=>{(0,a.Ul)(Object.assign({},t,{type:r.BetType.LIVE,sportId:e.sportId}))},isLoading:t,selectedMarket:i,restore:!0,isLive:!0,title:d},e.sportId)}))}):(0,E.tZ)(l.$J,{messageKey:"TV.NONE",params:{name:o.NZ.tv.name}}):(0,E.tZ)("div",{className:S("unlogged"),children:(0,E.tZ)(l.vN,{tkey:"TV.LOGIN_MESSAGE",name:o.NZ.tv.name})})}},97717:(e,t,n)=>{"use strict";n.d(t,{W:()=>u});var r=n(12139),o=n(64763),i=n(82762),l=n(35104),s=n(85573);const a={enableStreamingTV:l.NZ.tv.enabled},d={enableStreamingTV:{type:o.FeatureConfigurationsDataType.Boolean}},p=(0,s._i)({fallbackConfig:a,validations:d}),u=()=>{const[e,t]=(0,r.eJ)(Object.assign({},a,{isLoaded:!1}));return(0,r.d4)((()=>{const e=s.PK.getKey(i.FeatureToggleKeys.LiveSportsConfig,{validator:p}).subscribe({next:e=>{t(Object.assign({},e.composedConfig,{isLoaded:!0}))},error:()=>{t((e=>Object.assign({},e,{isLoaded:!0})))}});return()=>e.unsubscribe()}),[]),e}},23198:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>A});var r=n(12139),o=n(56747),i=n(82762),l=n(35104),s=n(58061),a=n(91193),d=n(16575),p=n(85782),u=n(77984),c=n(12335),v=n(58059),m=n(96e3);var b=n(10042),g=n(97717),I=n(46062),h=n.n(I),y=n(44036),T=n.n(y),f=n(96793),x=n.n(f),C=n(17892),E=n.n(C),S=n(11173),_=n.n(S),N=n(42464),L=n.n(N),P=n(46344),Z=n.n(P),k={};k.styleTagTransform=L(),k.setAttributes=E(),k.insert=x().bind(null,"head"),k.domAPI=T(),k.insertStyleElement=_(),h()(Z(),k),Z()&&Z().locals&&Z().locals;var V=n(56753);const O="inplay-sport-selector",R=(0,p.dG)(O),w=new RegExp(`^${i.APP_ROUTES.live}`),A=function({selectOnLoad:e}){var t,n;const[I,h]=(0,r.eJ)(-1),y=(0,o.TH)(),T=(0,o.k6)(),f=(0,g.W)(),{user:x}=(0,s.aF)(),{isLoading:C,liveEventsCount:E,inplaySports:S,premierbetTVCount:_}=(()=>{var e;const[t,n]=(0,r.eJ)([]),[o,i]=(0,r.eJ)(),[l,a]=(0,r.eJ)(0),[d,p]=(0,r.eJ)(),[b,g]=(0,r.eJ)(!1),I=(0,s.bx)((()=>{g(!0)})),{layout:h,isLoaded:y}=(0,s.$Y)(),{userLanguage:T}=(0,r.qp)(m.AZ),f=()=>v.jV.getEventsCount("LIVE",{locale:T}).pipe((0,u.U)((e=>{var t;n((null==h||null==(t=h.sportRibbon)?void 0:t.inPlay)||[]),i(e.eventsCountPerSport),a(e.premierBetTvEventsCount||0)})));return(0,r.d4)((()=>{if(y){const e=f().pipe((0,c.w)((()=>I.liveEventsCountSubscription()))).subscribe(p);return()=>null==e?void 0:e.unsubscribe()}}),[null==h||null==(e=h.sportRibbon)?void 0:e.inPlay,y]),(0,r.d4)((()=>{if(y&&b){const e=f().subscribe((()=>{g(!1)}));return()=>null==e?void 0:e.unsubscribe()}}),[b]),(0,r.d4)((()=>{var e,t,n;const r=null==d?void 0:d.data;i(null!=(e=null==r||null==(t=r.eventsCountPerSport)?void 0:t.filter((e=>e.eventCount>0)))?e:[]),a(null!=(n=null==r?void 0:r.premierBetTvEventsCount)?n:0)}),[d]),{isLoading:!y||!o,liveEventsCount:o,inplaySports:t,premierbetTVCount:l}})(),N=C||!f.isLoaded,L=(0,r.Ye)((()=>{const e=null!=E&&E.length?[...S].sort(((e,t)=>Number(E.findIndex((0,p.TY)({sportId:t.providerId}))>-1)-Number(E.findIndex((0,p.TY)({sportId:e.providerId}))>-1))):S;return f.enableStreamingTV?[b.w,...e]:e}),[S,E,f.enableStreamingTV]);(0,r.d4)((()=>{e&&S.length&&L.length&&(-1===I||y.pathname===i.APP_ROUTES.live)&&(()=>{const e=y.pathname.replace(w,""),t=(n=e,L.findIndex((e=>e.targetUri===n)));var n;if(-1===t&&L.length){const e=f.enableStreamingTV?1:0;h(e),T.replace(`${i.APP_ROUTES.live}${L[e].targetUri}`)}t>-1&&h(t)})()}),[y.pathname,L,I]);const P=(0,r.Ye)((()=>L.map((e=>{const t=e.providerId===b.w.providerId?{eventCount:_}:null==E?void 0:E.find((t=>t.sportId===e.providerId));return(0,V.tZ)(d.O9,{item:e,inplaySportEvents:null==t?void 0:t.eventCount,appRoute:i.APP_ROUTES.live,className:e.providerId,onClick:()=>{var t,n;e.providerId===b.w.providerId&&(0,p.PH)({event:i.GTMCustomEvents.PREMIERBET_TV_CLICK,eventID:i.GTMCustomEventsIds.PREMIERBET_TV_CLICK,customerID:null!=x&&null!=(t=x.account)&&t.id?Number(x.account.id):null,country:(null==x||null==(n=x.account)?void 0:n.country)||l.NZ.defaults.countryCode,platform:a.Z})}},e.providerId)}))),[L,null==x||null==(t=x.account)?void 0:t.country,null==x||null==(n=x.account)?void 0:n.id]);return(0,V.tZ)(d.Od,{visible:N,type:i.SkeletonType.LiveSportsRibbon,fixedHeight:85,children:(0,V.BX)("div",{className:O,children:[(0,V.BX)("div",{className:R("header"),children:[(0,V.tZ)(d.le,{className:R("icon"),name:"live"}),(0,V.tZ)("div",{className:R("title"),children:(0,V.tZ)(d.vN,{tkey:"_LIVE_NOW"})})]}),(0,V.tZ)(d.rf,{selectedIndex:I,children:P})]})})}},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}","",""]]},46344:e=>{e.exports=[[e.id,".inplay-sport-selector{border-bottom:1px solid var(--color-brand-8);min-height:85px}.inplay-sport-selector__header{display:flex;flex-direction:row}.inplay-sport-selector__title{color:var(--color-red);font-size:16px;font-weight:700;line-height:24px;padding:4px 0}.inplay-sport-selector__icon{margin:8px 4px 8px 12px;fill:var(--color-red);width:16px;height:16px}.inplay-sport-selector .horizontal-ribbon-menu-item--_TV_{width:80px}.inplay-sport-selector .badge{background:var(--live-now-badge-background-color);color:var(--live-now-badge-text-color)}","",""]]}}]);