(self.webpackChunk=self.webpackChunk||[]).push([[2878],{10042:(e,t,n)=>{"use strict";n.d(t,{R:()=>N,w:()=>S});var r=n(82762),o=n(35104),i=n(58061),l=n(16575),s=n(85782),a=n(44955),d=n(46062),u=n.n(d),p=n(44036),c=n.n(p),v=n(96793),m=n.n(v),b=n(17892),g=n.n(b),I=n(11173),h=n.n(I),f=n(42464),y=n.n(f),T=n(57090),x=n.n(T),C={};C.styleTagTransform=y(),C.setAttributes=g(),C.insert=m().bind(null,"head"),C.domAPI=c(),C.insertStyleElement=h(),u()(x(),C),x()&&x().locals&&x().locals;var E=n(56753);const _=(0,s.dG)("premierbet-tv"),S={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,u;const{isLoaded:p,layout:c}=(0,i.$Y)(),v=(null==c||null==(n=c.sportRibbon)?void 0:n.inPlay)||[];return(null==(d=(0,i.aF)().user)||null==(u=d.account)?void 0:u.id)?p&&e.length?(0,E.tZ)("div",{className:_("sports"),children:e.map((e=>{var n;const{categories:o,markets:i}=e,d=null==i?void 0:i[0],u=null==(n=v.find((0,s.TY)({providerId:e.sportId})))?void 0:n.name;return(0,E.tZ)(l.OY,{showMarketSelector:!1,matches:{categories:o,markets:i},sportRef:e.sportId,onOddsClick:t=>{(0,a.Ul)(Object.assign({},t,{type:r.BetType.LIVE,sportId:e.sportId}))},isLoading:t,selectedMarket:d,restore:!0,isLive:!0,title:u},e.sportId)}))}):(0,E.tZ)(l.$J,{messageKey:"TV.NONE",params:{name:o.NZ.tv.name}}):(0,E.tZ)("div",{className:_("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:()=>p});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}},u=(0,s._i)({fallbackConfig:a,validations:d}),p=()=>{const[e,t]=(0,r.eJ)(Object.assign({},a,{isLoaded:!1}));return(0,r.d4)((()=>{const e=s.PK.getKey(i.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}},2878:(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),u=n(85782),p=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),f=n(44036),y=n.n(f),T=n(96793),x=n.n(T),C=n(17892),E=n.n(C),_=n(11173),S=n.n(_),N=n(42464),L=n.n(N),Z=n(46344),P=n.n(Z),w={};w.styleTagTransform=L(),w.setAttributes=E(),w.insert=x().bind(null,"head"),w.domAPI=y(),w.insertStyleElement=S(),h()(P(),w),P()&&P().locals&&P().locals;var V=n(56753);const k="inplay-sport-selector",O=(0,u.dG)(k),R=new RegExp(`^${i.APP_ROUTES.live}`),A=function({selectOnLoad:e}){var t,n;const[I,h]=(0,r.eJ)(-1),f=(0,o.TH)(),y=(0,o.k6)(),T=(0,g.W)(),{user:x}=(0,s.aF)(),{isLoading:C,liveEventsCount:E,inplaySports:_,premierbetTVCount:S}=(()=>{var e;const[t,n]=(0,r.eJ)([]),[o,i]=(0,r.eJ)(),[l,a]=(0,r.eJ)(0),[d,u]=(0,r.eJ)(),[b,g]=(0,r.eJ)(!1),I=(0,s.bx)((()=>{g(!0)})),{layout:h,isLoaded:f}=(0,s.$Y)(),{userLanguage:y}=(0,r.qp)(m.AZ),T=()=>v.jV.getEventsCount("LIVE",{locale:y}).pipe((0,p.U)((e=>{var t;n((null==h||null==(t=h.sportRibbon)?void 0:t.inPlay)||[]),i(e.eventsCountPerSport),a(e.premierBetTvEventsCount||0)})));(0,r.d4)((()=>{if(f){const e=T().pipe((0,c.w)((()=>I.liveEventsCountSubscription()))).subscribe(u);return()=>null==e?void 0:e.unsubscribe()}}),[null==h||null==(e=h.sportRibbon)?void 0:e.inPlay,f]),(0,r.d4)((()=>{if(f&&b){const e=T().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]);const x=(0,r.Ye)((()=>function(e,t){return null!=t&&t.length?t.map((n=>{const r=e.find((e=>e.providerId===n.sportId));if(null!=r&&r.providerZoomId){var o;const e=t.find((e=>e.sportId===r.providerZoomId));return Object.assign({},n,{eventCount:n.eventCount+(null!=(o=null==e?void 0:e.eventCount)?o:0)})}return n})):[]}(t,o)),[t,o]);return{isLoading:!f||!o,liveEventsCount:x,inplaySports:t,premierbetTVCount:l}})(),N=C||!T.isLoaded,L=(0,r.Ye)((()=>{const e=null!=E&&E.length?[..._].sort(((e,t)=>Number(E.findIndex((0,u.TY)({sportId:t.providerId}))>-1)-Number(E.findIndex((0,u.TY)({sportId:e.providerId}))>-1))):_;return T.enableStreamingTV?[b.w,...e]:e}),[_,E,T.enableStreamingTV]);(0,r.d4)((()=>{e&&_.length&&L.length&&(-1===I||f.pathname===i.APP_ROUTES.live)&&(()=>{const e=f.pathname.replace(R,""),t=(n=e,L.findIndex((e=>e.targetUri===n)));var n;if(-1===t&&L.length){const e=T.enableStreamingTV?1:0;h(e),y.replace(`${i.APP_ROUTES.live}${L[e].targetUri}`)}t>-1&&h(t)})()}),[f.pathname,L,I]);const Z=(0,r.Ye)((()=>L.map((e=>{const t=e.providerId===b.w.providerId?{eventCount:S}: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,u.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:k,children:[(0,V.BX)("div",{className:O("header"),children:[(0,V.tZ)(d.le,{className:O("icon"),name:"live"}),(0,V.tZ)("div",{className:O("title"),children:(0,V.tZ)(d.vN,{tkey:"_LIVE_NOW"})})]}),(0,V.tZ)(d.rf,{selectedIndex:I,children:Z})]})})}},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:initial;min-width:56px}.inplay-sport-selector .horizontal-ribbon-menu-item--_TV_ .horizontal-ribbon-menu-item__name{width:100%;text-overflow:initial;margin:0 10px}.inplay-sport-selector .badge{background:var(--live-now-badge-background-color);color:var(--live-now-badge-text-color)}","",""]]}}]);