!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="31194cc0-9b77-4398-9794-cce34f433ac0",e._sentryDebugIdIdentifier="sentry-dbid-31194cc0-9b77-4398-9794-cce34f433ac0")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9932],{9932:(e,n,t)=>{t.r(n),t.d(n,{default:()=>Q});var s=t(6029),r=t(21377),l=t(41249),a=t(55729),i=t(65789),c=t(62859),o=t(76868),u=t(90248),d=function(e){return e.Glance="G",e.LegGlance="LG",e.Hook="H",e.Pull="P",e.OnDrive="OD",e.StraightDrive="SD",e.OffDrive="OfD",e.CoverDrive="CD",e.CutDrive="CtD",e.SquareCut="SqC",e.LateCut="LC",e}({}),x=function(e){return e.Single="single",e.Fours="fours",e.Sixes="sixes",e}({});let f=[{startAngle:65,endAngle:115,key:"G"},{startAngle:20,endAngle:65,key:"LG"},{startAngle:350,endAngle:20,key:"H"},{startAngle:310,endAngle:350,key:"P"},{startAngle:285,endAngle:310,key:"OD"},{startAngle:255,endAngle:285,key:"SD"},{startAngle:230,endAngle:255,key:"OfD"},{startAngle:190,endAngle:230,key:"CD"},{startAngle:172.5,endAngle:190,key:"CtD"},{startAngle:155,endAngle:172.5,key:"SqC"},{startAngle:115,endAngle:155,key:"LC"}],g=[{startAngle:65,endAngle:115,key:"G"},{startAngle:115,endAngle:160,key:"LG"},{startAngle:160,endAngle:190,key:"H"},{startAngle:190,endAngle:230,key:"P"},{startAngle:230,endAngle:255,key:"OD"},{startAngle:255,endAngle:285,key:"SD"},{startAngle:285,endAngle:310,key:"OfD"},{startAngle:310,endAngle:350,key:"CD"},{startAngle:350,endAngle:7.5,key:"CtD"},{startAngle:7.5,endAngle:25,key:"SqC"},{startAngle:25,endAngle:65,key:"LC"}];function h(e){let{group:n,selected:t,setGroup:r,messageId:a,color:i}=e;return(0,s.jsxs)(l.so,{h:"32px",align:"center",px:"sm",bg:"surface.s2",cursor:"pointer",br:"lg",border:t===n?"1px solid primary.default":void 0,onClick:()=>r(n),children:[i&&(0,s.jsx)(l.az,{h:"2px",w:"8px",mx:"xs",bg:i}),(0,s.jsx)(l.EY,{as:"div",font:"assistive.default",color:"onSurface.nLv1",children:(0,s.jsx)(u.A,{id:a})})]})}function p(e){let{detailedGroup:n,setDetailedGroup:t}=e;return(0,s.jsxs)(l.so,{gap:"sm",minH:"48px",align:"center",px:"sm",children:[(0,s.jsx)(h,{group:void 0,selected:n,setGroup:t,messageId:"total"}),(0,s.jsx)(h,{group:x.Single,selected:n,setGroup:t,messageId:"cricket_singles_and_threes",color:"cricketSpecific.singleRuns"}),(0,s.jsx)(h,{group:x.Fours,selected:n,setGroup:t,messageId:"4s",color:"cricketSpecific.firstCircleRuns"}),(0,s.jsx)(h,{group:x.Sixes,selected:n,setGroup:t,messageId:"6s",color:"cricketSpecific.secondCircleRuns"})]})}var m=t(54409);function j(){return(0,s.jsxs)(l.so,{minH:"48px",align:"center",px:"sm",children:[(0,s.jsx)(m.wjs,{h:"24px",fill:"playerPosition.midfield"}),(0,s.jsx)(l.EY,{ml:"sm",font:"assistive.default",color:"onSurface.nLv1",children:(0,s.jsx)(u.A,{id:"img.click.swap"})})]})}function y(){return(0,s.jsxs)(l.so,{minH:"48px",px:"sm",align:"center",children:[(0,s.jsx)(m.G_L,{fill:"onSurface.nLv3"}),(0,s.jsx)(l.EY,{as:"div",ml:"sm",font:"assistive.default",color:"onSurface.nLv3",children:(0,s.jsx)(u.A,{id:"cricket.wagon.wheel.extra"})})]})}var k=t(10292),v=t(947);let A=(e,n,t)=>{var r,a;let i=null==(a=e.player.cricketPlayerInfo)||null==(r=a.batting)?void 0:r.toLowerCase(),c="";return i&&(c=n.formatMessage({id:"hand.short.".concat(i)})),(0,s.jsxs)(l.so,{align:"center",children:[(0,s.jsx)(k.t,{id:e.player.id,size:24}),(0,s.jsx)(l.EY,{mx:"sm",ellipsis:!0,children:e.player.name+(c?" (".concat(c,")"):"")}),t===e.player.id&&(0,s.jsx)(l.az,{h:16,w:16,children:(0,s.jsx)(m.BM3,{fill:"sofaSingles.live"})})]})};function C(e){let{players:n,selectedBatterIndex:t,setSelectedBatterIndex:r}=e,{event:i}=(0,a.useContext)(c.y$),o=(0,v.A)();return(0,s.jsx)(l.ms,{mt:"lg",w:"100%",items:n,buttonStyle:{width:"100%",height:"40px"},renderItem:e=>A(e,o,i.currentBatsmanId),selectedItem:n[t],onSelectedItemChange:e=>{r(e.selectedItemIndex||0)}})}function w(e){let{label:n}=e;return(0,s.jsx)(l.EY,{w:"32px",as:"div",font:"assistive.default",color:"onSurface.nLv3",align:"center",children:n})}function S(){return(0,s.jsxs)(l.so,{w:"100%",h:"24px",pl:"sm",align:"center",children:[(0,s.jsx)(l.az,{grow:1,shrink:1,children:(0,s.jsx)(l.EY,{font:"assistive.default",color:"onSurface.nLv3",children:(0,s.jsx)(u.A,{id:"cricket.zone.name"})})}),(0,s.jsx)(w,{label:"4s"}),(0,s.jsx)(w,{label:"6s"}),(0,s.jsx)(w,{label:"R"})]})}function b(e){let{value:n}=e;return(0,s.jsx)(l.EY,{w:"32px",as:"div",font:"table.medium",color:"onSurface.nLv1",align:"center",children:n})}function L(e){let{rowData:n,messageId:t}=e;return(0,s.jsxs)(l.so,{w:"100%",h:"48px",pl:"sm",align:"center",children:[(0,s.jsx)(l.az,{grow:1,shrink:1,children:(0,s.jsx)(l.EY,{font:"table.medium",color:"onSurface.nLv1",children:(0,s.jsx)(u.A,{id:t})})}),(0,s.jsx)(b,{value:n.fours}),(0,s.jsx)(b,{value:n.sixes}),(0,s.jsx)(b,{value:n.runs})]})}function D(e){let{data:n,zones:t}=e;return(0,s.jsxs)(l.so,{mt:"sm",direction:"column",w:"100%",children:[(0,s.jsx)(S,{}),t.map(e=>(0,s.jsx)(L,{messageId:"cricket.zone.".concat(e.key.toLowerCase()),rowData:n.zones[e.key]},e.key)),(0,s.jsx)(L,{messageId:"total",rowData:{runs:n.totalRuns,fours:n.totalFours,sixes:n.totalSixes}})]})}var I=t(67717);function E(e){let{activeTeam:n,onTeamClick:t}=e,[r,i]=(0,a.useState)(!1);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(l.so,{justify:"space-between",h:"40px",pt:"14px",px:"sm",children:[(0,s.jsx)(l.EY,{as:"div",h:"16px",font:"display.medium",color:"onSurface.nLv1",children:(0,s.jsx)(u.A,{id:"cricket.wagon.wheel"})}),(0,s.jsx)(l.AM,{closeOnOutsideClick:!0,controls:[r,i],children:(0,s.jsxs)(l.AM.Content,{w:"312px",right:"100%",elevation:3,children:[(0,s.jsx)(l.EY,{as:"div",color:"onSurface.nLv1",font:"display.large",children:(0,s.jsx)(u.A,{id:"cricket.wagon.wheel"})}),(0,s.jsx)(l.EY,{as:"div",color:"onSurface.nLv1",font:"body.mediumParagraph",mt:"sm",children:(0,s.jsx)(u.A,{id:"cricket.wagon.wheel.desc"})}),(0,s.jsx)(l.so,{mt:"xl",h:"36px",justify:"flex-end",children:(0,s.jsx)(l.$n,{h:"36px",w:"77px",variant:"unshielded",onClick:()=>i(!1),children:(0,s.jsx)(u.A,{id:"close_window_button"})})})]})})]}),(0,s.jsx)(I.n,{activeTeam:n,onTeamClick:t,mt:"lg"})]})}var z=t(41735);let P="-".concat(15," -").concat(15," ").concat(310," ").concat(310);function M(e){let{radius:n,dashesCount:t}=e,r=(0,a.useContext)(z.ThemeContext);return(0,s.jsx)("circle",{cx:140,cy:140,r:n,fill:"none",strokeWidth:"2",strokeDasharray:2*n*Math.PI/t/2,stroke:r.colors.surface.s1})}var G=t(90112),R=t(9127);let _=e=>(e+90)*Math.PI/180,O=e=>e.endAngle"Left"===e?g:f,Y=(e,n)=>{switch(n.group){case"fours":return e.colors.cricketSpecific.firstCircleRuns;case"sixes":return e.colors.cricketSpecific.secondCircleRuns;default:return e.colors.cricketSpecific.singleRuns}},Z=(e,n)=>{if(!n)return e;let t=180-e;return t<0?360+t:t};function H(e){var n,t;let{selectedPlayerData:r,detailedGroup:l}=e,a=(null==r||null==(t=r.player)||null==(n=t.cricketPlayerInfo)?void 0:n.batting)==="Left",i=(0,z.useTheme)();return(0,s.jsx)(G.N,{children:r.runs.map(e=>{if(l&&e.group!==l)return null;let n=Z(e.angle,a),t=Math.sin(_(n))*e.length+140,r=Math.cos(_(n))*e.length+140;return(0,s.jsx)(R.m.line,{x1:140,y1:140,initial:{x1:140,y1:140,x2:140,y2:140},exit:{x2:140,y2:140,transition:{duration:.5}},transition:{duration:.5,delay:.25},animate:{x2:t,y2:r},stroke:Y(i,e),strokeWidth:2},e.id)})})}var q=t(21501),B=t(14352);function N(e){let{radius:n,transformedFill:t,startX:r,startY:l,endX:a,endY:i,lineW:c,lineColor:o}=e;return(0,s.jsx)("path",{fill:t,stroke:o,strokeWidth:c,d:"M ".concat(140,",").concat(140,"\n L ").concat(r,",").concat(l,"\n A ").concat(n,",").concat(n," 0,0,0 ").concat(a,",").concat(i,"\n L ").concat(140,",").concat(140)})}function U(e){let{radius:n,transformedFill:t,startX:r,startY:l,endX:i,endY:c,zone:o}=e,u=(0,q.ZC)(r)||140,d=(0,q.ZC)(l)||140,x=(0,q.ZC)(i)||140,f=(0,q.ZC)(c)||140,g=(0,q.ZC)(t)||t,h=(0,B.s)(),p="".concat(n,"-").concat(o.startAngle,"-").concat(o.endAngle);return(0,a.useEffect)(()=>{(async()=>{await h.start({d:"M ".concat(140,",").concat(140,"\n L ").concat(r,",").concat(l,"\n A ").concat(n,",").concat(n," 0,0,0 ").concat(i,",").concat(c,"\n L ").concat(140,",").concat(140),fill:t},{duration:.5})})().catch()},[p]),(0,s.jsx)(G.N,{children:(0,s.jsx)(R.m.path,{fill:g,d:"M ".concat(140,",").concat(140,"\n L ").concat(u,",").concat(d,"\n A ").concat(u,",").concat(d," 0,0,0 ").concat(x,",").concat(f,"\n L ").concat(140,",").concat(140),animate:h})})}function W(e){let{zone:n,fill:t,ratio:r,lineColor:l,lineW:a,animated:i}=e,c=(0,z.useTheme)(),o=void 0!==r?140*r:140,u=r?c.setAlpha(t,r):t,d=Math.sin(_(n.startAngle))*o+140,x=Math.cos(_(n.startAngle))*o+140,f=Math.sin(_(n.endAngle))*o+140,g=Math.cos(_(n.endAngle))*o+140,h={radius:o,lineColor:l,lineW:a,transformedFill:u,startX:d,startY:x,endX:f,endY:g,zone:n};return(0,s.jsx)(s.Fragment,{children:i?(0,s.jsx)(U,{...h}):(0,s.jsx)(N,{...h})})}let $=z.default.text.withConfig({componentId:"sc-19a90eb3-0"})(["font:",";color:",";fill:",";text-anchor:middle;"],e=>e.theme.typography.font.table.small,e=>e.theme.colors.onSurface.nLv1,e=>e.theme.colors.onSurface.nLv1);function V(e){let{zone:n,showRuns:t,runs:r}=e,l=O(n),i=142.5*Math.sin(_(l))+140,c=142.5*Math.cos(_(l))+140,o=(0,a.useContext)(z.ThemeContext);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("circle",{cx:i,cy:c,r:"12",stroke:"none",strokeWidth:"3",fill:o.colors.surface.s1}),(0,s.jsx)($,{x:i,y:c+4.8,children:t?r:n.key})]})}function X(e){var n,t;let{selectedPlayerData:r,isDetailed:i,detailedGroup:c}=e,o=(0,a.useContext)(z.ThemeContext),[u,d]=(0,a.useState)(!1),x=(0,a.useCallback)(()=>d(e=>!e),[d]),f=F(null==r||null==(t=r.player)||null==(n=t.cricketPlayerInfo)?void 0:n.batting);return(0,s.jsx)(l.so,{mt:"sm",justify:"center",h:"".concat(310,"px"),align:"center",alignSelf:"center",onClick:x,cursor:"pointer",style:{userSelect:"none"},children:(0,s.jsxs)("svg",{className:"wheel-base",height:"100%",width:"100%",viewBox:P,children:[(0,s.jsx)("circle",{cx:140,cy:140,r:140,fill:o.colors.neutral.highlight})," ",f.map(e=>{let n=e.key,t=r.maxZoneRuns&&r.zones[n].runs?r.zones[n].runs/r.maxZoneRuns:0;return(0,s.jsxs)(a.Fragment,{children:[(0,s.jsx)(W,{zone:e,fill:o.colors.cricketSpecific.cricketTerrain}),!i&&(0,s.jsx)(W,{zone:e,fill:o.colors.cricketSpecific.cricketTerrainSecondary,ratio:t,animated:!0})]},e.key)}),f.map(e=>(0,s.jsx)(W,{zone:e,fill:"none",lineW:"1px",lineColor:o.colors.surface.s1},e.key)),(0,s.jsx)(M,{radius:59,dashesCount:27}),(0,s.jsx)(M,{radius:129,dashesCount:54}),i&&(0,s.jsx)(H,{selectedPlayerData:r,detailedGroup:c}),f.map(e=>(0,s.jsx)(V,{zone:e,showRuns:u,runs:r.zones[e.key].runs},e.key))]})})}function J(e){let{isDetailed:n,onClick:t}=e;return(0,s.jsxs)(l.so,{minH:"56px",bg:"surface.s2",br:"lg",px:"lg",gap:"20px",justify:"space-between",align:"center",children:[(0,s.jsxs)(l.az,{children:[(0,s.jsx)(l.EY,{as:"div",font:"body.medium",color:"onSurface.nLv1",children:(0,s.jsx)(u.A,{id:"cricket_ww_appearance"})}),(0,s.jsx)(l.EY,{as:"div",font:"body.small",color:"onSurface.nLv3",mt:"xxs",children:(0,s.jsx)(u.A,{id:"cricket_ww_detailedgraph"})})]}),(0,s.jsx)(l.lM,{checked:n,onChange:t})]})}var K=t(70215);function Q(e){var n,t;let{incidents:u,isInWidget:d}=e,{event:f,leftTeam:g,rightTeam:h}=(0,a.useContext)(c.y$),m=(0,K.A)(f,"winnerCode"),[k,v]=(0,a.useState)(function(e,n,t,s){if(e.status.type===r.XUj.Finished&&s)return s===r.Jfo.Left?r.cxP.Left:r.cxP.Right;for(let e of t)if("ball"===e.incidentType)return e.battingTeamId===n.id?r.cxP.Left:r.cxP.Right;return r.cxP.Left}(f,g,u,m)),A=function(e){let{leftTeam:n}=(0,a.useContext)(c.y$);return(0,a.useMemo)(()=>{let t={left:{},right:{}},s=[...e].reverse(),l=0;return s.forEach(e=>{if("ball"!==e.incidentType||!T[e.zone])return;let s=T[e.zone],a=e.batsman,i=e.battingTeamId===n.id?r.cxP.Left:r.cxP.Right;!t[i][a.id]&&(t[i][a.id]={player:a,zones:{G:{runs:0,fours:0,sixes:0},CD:{runs:0,fours:0,sixes:0},CtD:{runs:0,fours:0,sixes:0},H:{runs:0,fours:0,sixes:0},LC:{runs:0,fours:0,sixes:0},LG:{runs:0,fours:0,sixes:0},OD:{runs:0,fours:0,sixes:0},OfD:{runs:0,fours:0,sixes:0},P:{runs:0,fours:0,sixes:0},SD:{runs:0,fours:0,sixes:0},SqC:{runs:0,fours:0,sixes:0}},order:l,maxZoneRuns:0,totalRuns:0,totalFours:0,totalSixes:0,runs:[]},l++);let c=t[i][a.id].zones[s].runs+e.runs;if(t[i][a.id].maxZoneRunse.order-n.order),right:Object.values(t.right).sort((e,n)=>e.order-n.order)}},[e])}(u),w=A[k],[S,b]=(0,a.useState)(()=>(function(e,n){if(e.status.type===r.XUj.Finished&&e.winnerCode){let e=0,t=0;return n.forEach((n,s)=>{n.totalRuns>e&&(e=n.totalRuns,t=s)}),t}return e.currentBatsmanId?Math.max(n.findIndex(n=>n.player.id===e.currentBatsmanId),0):0})(f,w)),L=(0,a.useCallback)(e=>{v(e),b(0)},[v,b,f.id,g.id,h.id]),I=w[S],z=F(null==I||null==(t=I.player)||null==(n=t.cricketPlayerInfo)?void 0:n.batting),[P,M]=(0,a.useState)(!1),[G,R]=(0,a.useState)(void 0);return 0===A.left.length&&0===A.right.length?null:(0,s.jsx)(i.Zp,{isInverseDesktop:d,children:(0,s.jsxs)(l.az,{px:"sm",pb:"sm",children:[(0,s.jsx)(E,{activeTeam:k,onTeamClick:L}),I?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(C,{players:w,selectedBatterIndex:S,setSelectedBatterIndex:b}),P?(0,s.jsx)(p,{detailedGroup:G,setDetailedGroup:R}):(0,s.jsx)(j,{}),(0,s.jsx)(X,{selectedPlayerData:I,isDetailed:P,detailedGroup:G}),(0,s.jsx)(J,{isDetailed:P,onClick:()=>{M(e=>!e)}}),(0,s.jsx)(D,{zones:z,data:I}),f.status.type===r.XUj.InProgress&&(0,s.jsx)(y,{})]}):(0,s.jsx)(o.p,{graphic:"wagon-wheel",descriptionMessageId:"cricket.wagon.wheel.ph",mt:"lg",py:"72px"})]})})}},14352:(e,n,t)=>{t.d(n,{s:()=>u});var s=t(42330),r=t(55094),l=t(43479);function a(e,n){[...n].reverse().forEach(t=>{let s=e.getVariant(t);s&&(0,r.U)(e,s),e.variantChildren&&e.variantChildren.forEach(e=>{a(e,n)})})}function i(){let e=!1,n=new Set,t={subscribe:e=>(n.add(e),()=>void n.delete(e)),start(t,r){(0,s.V)(e,"controls.start() should only be called after a component has mounted. Consider calling within a useEffect hook.");let a=[];return n.forEach(e=>{a.push((0,l._)(e,t,{transitionOverride:r}))}),Promise.all(a)},set:t=>((0,s.V)(e,"controls.set() should only be called after a component has mounted. Consider calling within a useEffect hook."),n.forEach(e=>{var n,s;n=e,Array.isArray(s=t)?a(n,s):"string"==typeof s?a(n,[s]):(0,r.U)(n,s)})),stop(){n.forEach(e=>{e.values.forEach(e=>e.stop())})},mount:()=>(e=!0,()=>{e=!1,t.stop()})};return t}var c=t(44033),o=t(2274);let u=function(){let e=(0,c.M)(i);return(0,o.E)(e.mount,[]),e}}}]);