text: (this["webpackJsonpcricket-scorer"]=this["webpackJsonpcricket-scorer"]||[]).push([[0],{41:function(e,t,n){},52:function(e,t,n){},53:function(e,t,n){"use strict";n.r(t);var a=n(1),c=n(11),s=n.n(c),r=(n(41),n(4)),l=n(17),i="WKT",o="R",d="C",u="LBW",b="B",j="ST",h="Hit Wicket",O="Field Obstruct",m="WD",p="NB",x="LB",g="B",v="PEN",f="nb",y="YTB",w="O",N="OS",S="ONS",T="ODM",I="IN_PROGRESS",k="COMPLETE",R=[{label:"0",value:0,disabled:!1},{label:"1",value:1,disabled:!1},{label:"2",value:2,disabled:!1},{label:"3",value:3,disabled:!1},{label:"4",value:4,disabled:!1},{label:"5",value:5,disabled:!1},{label:"6",value:6,disabled:!1}],B=[{label:"Wide",value:m,disabled:!1},{label:"No Ball",value:p,disabled:!1},{label:"No Ball (Hit by batsman)",value:f,disabled:!1},{label:"Leg Bye",value:x,disabled:!1},{label:"Bye",value:g,disabled:!1},{label:"Penalty",value:v,disabled:!1}],F=[{label:"Bowled",value:b,disabled:!1},{label:"LBW",value:u,disabled:!1},{label:"Catch Out",value:d,disabled:!1},{label:"Run Out",value:o,disabled:!1},{label:"Stump Out",value:j,disabled:!1},{label:"Hit Wicket",value:h,disabled:!1},{label:"Field Obstruct",value:O,disabled:!1}],E="YTS",C="COMPLETED",P="MI",L=["Quinton de Kock","Rohit Sharma","Suryakumar Yadav","Ishan Kishan","Kieron Pollard","Hardik Pandya","Krunal Pandya","Jayant Yadav","Rahul Chahar","Jasprit Bumrah","Trent Boult"],W="CSK",A=["Ruturaj Gaikwad","Faf du Plessis","Suresh Raina","Moeen Ali","Ambati Rayudu","Ravindra Jadeja","MS Dhoni","Sam Curran","Lungi Ngidi","Deepak Chahar","Shardul Thakur"],_=n(13),D=n(10),M=n(3),q=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Array.isArray(t))n=[],t.forEach((function(t){n.push(e(t))}));else{var a=function(a){Array.isArray(t[a])?t[a].forEach((function(e){n[a].push(e)})):"object"===typeof t[a]?(n[a]={},e(t[a],n[a])):n[a]=t[a]};for(var c in t)a(c)}return n},H=function(e){return!isNaN(e)},Y=function(e,t,n,a){return{totalScore:0,totalWickets:0,extras:{wides:0,noBalls:0,legByes:0,byes:0,penaltyRuns:0},battingTeam:e,bowlingTeam:n,batsmen:t.map((function(e){return{name:e,status:y,runsScored:0,ballsFaced:0,fours:0,sixes:0,strikeRate:0,wicketDetails:null}})),bowlers:a.map((function(e){return{name:e,totalOvers:0,wicketsTaken:0,runsGiven:0,maiden:0,economy:0}})),overs:[],status:E}},G=function(e){return e.findIndex((function(e){return H(e)}))},K=function(e,t){var n=U(t),a=!0,c=X(t),s=G(t);c>-1&&(t[c]===f?n-=1:[m,x,g,p,v].includes(t[c])&&(n=0),a=![m,p,v].includes(t[c]));var r=e.runsScored+n,l=n%4===0?e.fours+n/4:e.fours,i=n%6===0?e.sixes+n/6:e.sixes,o=a?e.ballsFaced+1:e.ballsFaced,d=o?Number((100*r/o).toFixed(2)):0,u=t[s]&&t[c]!==v?H(t[s])&&t[0]%2===0?N:S:N;return Object(M.a)(Object(M.a)({},e),{},{runsScored:r,ballsFaced:o,fours:l,sixes:i,strikeRate:d,status:u})},U=function(e){var t=function(e){return isNaN(Number(e))?e===i?0:[m,p,f].includes(e)?1:0:Number(e)};return console.log("Total Runs from ball",e.reduce((function(e,n){return e+t(n)}),0)),e.reduce((function(e,n){return e+t(n)}),0)},J=function(e){return Array.isArray(e)?e.every((function(e){return e!==m&&e!==p&&e!==f&&e!==v})):"string"===typeof e?!new RegExp([m,p,f,v].join("|")).test(e):void 0},V=function(e){return!!Object.keys(e).some((function(t){return e[t]}))&&[b,u,d,j,h].includes(e.wicketType)},z=function(e,t){var n=U(t);if(J(t)){var a=function(e){var t=e+.1,n=String(t).split(".");return n.length>1&&"6"===n[1]&&(t=Number(n[0])+1),Number(t.toFixed(1))}(e.totalOvers);return(t.includes(x)||t.includes(g))&&(n=0),Object(M.a)(Object(M.a)({},e),{},{totalOvers:a,runsGiven:e.runsGiven+n})}return Object(M.a)(Object(M.a)({},e),{},{runsGiven:e.runsGiven+n})},Q=function(e){var t=0;return e.length&&(t=Number(e.reduce((function(e,t){return e+Number(J(t))}),0))),t},X=function(e){return e.findIndex((function(e){return[m,p,x,g,v,f].includes(e)}))},Z=function(e){var t=e.filter((function(e){return e.status===k})).length,n=t;return e.length-t>0&&(n+=Number("0."+String(Q(e[e.length-1].details)))),Number(n)},$=function(e,t,n,a,c){var s=null===e&&!isNaN(e)&&!t;return n&&(s=n===o?!a||!c:(n===d||n===j)&&!c),s},ee=function(e){var t=e.runsGiven,n=String(e.totalOvers).split("."),a=Object(r.a)(n,2),c=a[0],s=a[1];return Number((t/(6*c+(s||0))*6).toFixed(2))},te=function(e,t,n,a,c,s){var r=U(t),l=X(t),o=e.batsmen.findIndex((function(e){return e.name===n.name})),d=e.batsmen.findIndex((function(e){return e.name===a.name})),u=e.batsmen.findIndex((function(e){return e.name===s.whoOut}));if(e.overs[e.overs.length-1]=Object(M.a)(Object(M.a)({},e.overs[e.overs.length-1]),{},{details:[].concat(Object(D.a)(e.overs[e.overs.length-1].details),[t.join("")]),totalRunsInThisOver:e.overs[e.overs.length-1].totalRunsInThisOver+r}),l>-1){var b=function(e){var t={wides:0,noBalls:0,legByes:0,byes:0,penaltyRuns:0},n=X(e),a=U(e);return n>-1&&(e[n]===m?t=Object(M.a)(Object(M.a)({},t),{},{wides:a}):e[n]===p||e[n]===f?t=Object(M.a)(Object(M.a)({},t),{},{noBalls:1}):e[n]===x?t=Object(M.a)(Object(M.a)({},t),{},{legByes:a}):e[n]===g?t=Object(M.a)(Object(M.a)({},t),{},{byes:a}):e[n]===v&&(t=Object(M.a)(Object(M.a)({},t),{},{penaltyRuns:a}))),t}(t);e=Object(M.a)(Object(M.a)({},e),{},{extras:Object(M.a)(Object(M.a)({},e.extras),{},{wides:e.extras.wides?e.extras.wides+b.wides:b.wides,noBalls:e.extras.noBalls?e.extras.noBalls+b.noBalls:b.noBalls,legByes:e.extras.legByes?e.extras.legByes+b.legByes:b.legByes,byes:e.extras.byes?e.extras.byes+b.byes:b.byes,penaltyRuns:e.extras.penaltyRuns?e.extras.penaltyRuns+b.penaltyRuns:b.penaltyRuns})})}e=Object(M.a)(Object(M.a)({},e),{},{totalScore:e.totalScore+r}),o>-1&&(e.batsmen[o]=Object(M.a)(Object(M.a)({},e.batsmen[o]),K(e.batsmen[o],t)));var j=G(t);if(t[l]!==v&&H(t[j])&&t[j]>0&&t[j]%2!==0&&d>-1&&(e.batsmen[d]=Object(M.a)(Object(M.a)({},e.batsmen[d]),{},{status:N})),Object.keys(s).some((function(e){return s[e]}))&&u>-1&&(e.batsmen[u]=Object(M.a)(Object(M.a)({},e.batsmen[u]),{},{status:w,wicketDetails:{bowler:c.name,type:s.wicketType,outBy:s.outByPlayer}})),function(e){return e.some((function(e){return e===i}))}(t)&&(e=Object(M.a)(Object(M.a)({},e),{},{totalWickets:e.totalWickets+1}),u>-1)){var h=Z(e.overs);e=Object(M.a)(Object(M.a)({},e),{},{fow:e.fow?[].concat(Object(D.a)(e.fow),[{score:e.totalScore,totalOvers:h,batsman:e.batsmen[u]}]):[{score:e.totalScore,totalOvers:h,batsman:e.batsmen[u]}]})}var O=!1;if(6===Q(e.overs[e.overs.length-1].details)){var y,T;if(e.overs[e.overs.length-1]=Object(M.a)(Object(M.a)({},e.overs[e.overs.length-1]),{},{status:k}),0===e.overs[e.overs.length-1].totalRunsInThisOver&&(O=!0),o>-1)e.batsmen[o].status===N?y=S:e.batsmen[o].status===S&&(y=N),e.batsmen[o]=Object(M.a)(Object(M.a)({},e.batsmen[o]),{},{status:y});if(d>-1)e.batsmen[d].status===N?T=S:e.batsmen[d].status===S&&(T=N),e.batsmen[d]=Object(M.a)(Object(M.a)({},e.batsmen[d]),{},{status:T})}(j=e.bowlers.findIndex((function(e){return e.name===c.name})))>-1&&(e.bowlers[j]=Object(M.a)(Object(M.a)(Object(M.a)({},e.bowlers[j]),z(e.bowlers[j],t)),{},{wicketsTaken:V(s)?e.bowlers[j].wicketsTaken+1:e.bowlers[j].wicketsTaken}),e.bowlers[j]=Object(M.a)(Object(M.a)({},e.bowlers[j]),{},{economy:ee(e.bowlers[j]),maiden:O?e.bowlers[j].maiden+1:e.bowlers[j].maiden}));var I=K(e.partnerships[e.partnerships.length-1][n.name],t),R=I.runsScored,B=I.ballsFaced;return e.partnerships[e.partnerships.length-1]=Object(M.a)(Object(M.a)({},e.partnerships[e.partnerships.length-1]),{},Object(_.a)({},n.name,{runsScored:R,ballsFaced:B})),e},ne=n(24),ae=n(0);var ce=function(e){var t=e.overs,n={labels:Array.from(Array(t.length).keys()).map((function(e){return"Over ".concat(e+1)})),datasets:[{label:"Runs",backgroundColor:"#2196F3",data:Array.from(t.map((function(e){return e.totalRunsInThisOver})))}]};return Object(ae.jsx)("div",{class:"rca-batting-score rca-padding ",children:Object(ae.jsx)(ne.a,{style:{height:"325px"},type:"bar",data:n,options:{maintainAspectRatio:!1,aspectRatio:.8,plugins:{legend:{labels:{color:"#2196F3"}}},scales:{x:{grid:{color:"#ebedef"}},y:{grid:{color:"#ebedef"},beginAtZero:!0}}}})})};var se=function(e){var t=e.inning;return Object(ae.jsx)("div",{className:"rca-batting-score rca-padding ",children:t.partnerships.map((function(e,n,a){var c=Object.keys(e)[0],s=Object.keys(e)[1],r=e[c].runsScored,l=e[s].runsScored,i=r+l,o=r/t.totalScore*100,d=l/t.totalScore*100;return Object(ae.jsx)(ae.Fragment,{children:Object(ae.jsx)("div",{className:"pad-10 rca-no-bottom-padding",style:{borderBottom:"1px"},children:Object(ae.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[Object(ae.jsxs)("div",{style:{width:"50%"},children:[Object(ae.jsx)("span",{className:"rca-match-title",children:c}),Object(ae.jsxs)("span",{className:"rca-match-score",children:[r,"(",e[c].ballsFaced,")"]}),Object(ae.jsx)("span",{className:"rca-match-title",children:"&"}),Object(ae.jsx)("span",{className:"rca-match-title",children:s}),Object(ae.jsxs)("span",{className:"rca-match-score",children:[l,"(",e[s].ballsFaced,")"]})]}),Object(ae.jsx)("div",{className:"progress",children:Object(ae.jsx)("div",{className:"barR",style:{width:o+"%",borderRight:"1px solid #6c757d"},children:Object(ae.jsx)("p",{className:"percent"})})}),Object(ae.jsx)("div",{className:"progress",children:Object(ae.jsx)("div",{className:"barL",style:{width:d+"%"},children:Object(ae.jsx)("p",{className:"percent"})})}),Object(ae.jsx)("div",{style:{width:"10%",marginLeft:"20px"},children:Object(ae.jsxs)("span",{className:"rca-match-score",children:[i,"(",e[Object.keys(e)[0]].ballsFaced+e[Object.keys(e)[1]].ballsFaced,")"]})})]})})})}))})};var re=function(e){var t=e.inning,n=function(e){var t;return e.wicketDetails.type!==b&&e.wicketDetails.type!==u||(t="".concat(e.wicketDetails.type," ").concat(e.wicketDetails.bowler)),e.wicketDetails.type!==o&&e.wicketDetails.type!==j||(t="".concat(e.wicketDetails.type," ").concat(e.wicketDetails.outBy)),e.wicketDetails.type===d&&(t="".concat(e.wicketDetails.type," ").concat(e.wicketDetails.outBy," B ").concat(e.wicketDetails.bowler)),e.wicketDetails.type!==h&&e.wicketDetails.type!==O||(t="".concat(e.wicketDetails.type)),t};return t.status!==E?Object(ae.jsx)(ae.Fragment,{children:Object(ae.jsxs)(l.b,{style:{fontFamily:"Lato, Verdana, Helvetica, sans-serif"},children:[Object(ae.jsx)(l.a,{header:"Scorecard",children:Object(ae.jsxs)("div",{style:{maxHeight:"350px",overflowY:"scroll"},class:"rca-padding rca-no-top-padding rca-no-bottom-padding",children:[Object(ae.jsxs)("div",{class:"rca-batting-score rca-padding ",children:[Object(ae.jsxs)("h3",{children:[t.battingTeam," Batting: ",Object(ae.jsxs)("strong",{children:[" ",t.totalScore,"/",t.totalWickets," in ",Z(t.overs)," Overs"]})]}),Object(ae.jsx)("div",{class:"rca-row",children:Object(ae.jsxs)("div",{class:"rca-header rca-table",children:[Object(ae.jsx)("div",{class:"rca-col rca-player",children:"Batsmen"}),Object(ae.jsx)("div",{class:"rca-col rca-player"}),Object(ae.jsx)("div",{class:"rca-col",children:"Runs"}),Object(ae.jsx)("div",{class:"rca-col",children:"4s"}),Object(ae.jsx)("div",{class:"rca-col",children:"6s"}),Object(ae.jsx)("div",{class:"rca-col",children:"Strike Rate"})]})}),t.batsmen.filter((function(e){return e.status!==y})).sort((function(e,t){return e.order-t.order})).map((function(e,t){var a,c;return e.wicketDetails?a=n(e):e.status!==N&&e.status!==S||(c="Not Out"),Object(ae.jsx)("div",{class:"rca-row",children:Object(ae.jsxs)("div",{class:"rca-table",children:[Object(ae.jsx)("div",{class:"rca-col rca-player",children:e.name}),Object(ae.jsx)("div",{class:"rca-col rca-player",children:a||Object(ae.jsx)("span",{style:{color:"#2196F3"},children:c})}),Object(ae.jsxs)("div",{class:"rca-col",children:[e.runsScored," (",e.ballsFaced,")"]}),Object(ae.jsx)("div",{class:"rca-col",children:e.fours}),Object(ae.jsx)("div",{class:"rca-col",children:e.sixes}),Object(ae.jsx)("div",{class:"rca-col",children:e.strikeRate})]})},t)})),Object(ae.jsx)("div",{class:"rca-clear"}),Object(ae.jsxs)("div",{class:"rca-padding",children:[Object(ae.jsxs)("span",{children:["Fours: ",Object(ae.jsx)("strong",{children:t.batsmen.reduce((function(e,t){return e+t.fours}),0)})]}),",",Object(ae.jsxs)("span",{children:[" Sixes: ",Object(ae.jsx)("strong",{children:t.batsmen.reduce((function(e,t){return e+t.sixes}),0)})]}),",",Object(ae.jsxs)("span",{children:[" Extras: ",Object(ae.jsxs)("strong",{children:[Object.keys(t.extras).reduce((function(e,n){return e+t.extras[n]}),0)," (WD: ",t.extras.wides,", NB: ",t.extras.noBalls,", LB: ",t.extras.legByes,", B: ",t.extras.byes,", P: ",t.extras.penaltyRuns,")"]})]})]}),function(){if(t.status!==C)return Object(ae.jsxs)("div",{class:"rca-padding",children:[Object(ae.jsx)("span",{class:"rca-match-title",children:"Yet To Bat:"}),t.batsmen.filter((function(e){return![S,N,w].includes(e.status)})).map((function(e,t,n){return Object(ae.jsx)(ae.Fragment,{children:Object(ae.jsxs)("span",{class:"rca-match-score",children:[e.name,Object(ae.jsx)("span",{children:t<n.length-1?",":""})]})})}))]})}(),t.fow?Object(ae.jsxs)("div",{class:"rca-padding",children:[Object(ae.jsx)("span",{class:"rca-match-title",children:"Fall Of Wickets:"}),function(){var e=t.fow,a=[];return e&&(a=e.map((function(e,t,a){var c=n(e.batsman);return Object(ae.jsx)(ae.Fragment,{children:Object(ae.jsxs)("span",{class:"rca-match-score",children:[Object(ae.jsxs)("span",{className:"bold",children:[e.score,"-",t+1]})," (",e.batsman.name," ",c," ",e.batsman.runsScored,"(",e.batsman.ballsFaced,"), ",e.totalOvers," Overs)",Object(ae.jsx)("span",{children:t<a.length-1?",":""})]})})}))),a}()]}):""]}),Object(ae.jsxs)("div",{class:"rca-bowling-score rca-padding",children:[Object(ae.jsxs)("h3",{children:[" ",t.bowlingTeam," Bowling:"]}),Object(ae.jsx)("div",{class:"rca-row",children:Object(ae.jsxs)("div",{class:"rca-header rca-table",children:[Object(ae.jsx)("div",{class:"rca-col rca-player",children:"Bowlers"}),Object(ae.jsx)("div",{class:"rca-col",children:"Overs"}),Object(ae.jsx)("div",{class:"rca-col",children:"Maiden"}),Object(ae.jsx)("div",{class:"rca-col",children:"Runs"}),Object(ae.jsx)("div",{class:"rca-col",children:"Wickets"}),Object(ae.jsx)("div",{class:"rca-col",children:"Economy"})]})}),t.bowlers.filter((function(e){return e.totalOvers>0})).map((function(e,t){return Object(ae.jsx)("div",{class:"rca-row",children:Object(ae.jsxs)("div",{class:"rca-table",children:[Object(ae.jsx)("div",{class:"rca-col rca-player",children:e.name}),Object(ae.jsx)("div",{class:"rca-col",children:e.totalOvers}),Object(ae.jsx)("div",{class:"rca-col",children:e.maiden}),Object(ae.jsx)("div",{class:"rca-col",children:e.runsGiven}),Object(ae.jsx)("div",{class:"rca-col",children:e.wicketsTaken}),Object(ae.jsx)("div",{class:"rca-col",children:e.economy})]})},e.index)})),Object(ae.jsx)("div",{class:"rca-clear"})]})]})}),Object(ae.jsx)(l.a,{header:"Partnerships",children:Object(ae.jsx)("div",{style:{maxHeight:"350px",overflowY:"auto"},class:"rca-padding rca-no-top-padding rca-no-bottom-padding",children:Object(ae.jsx)(se,{inning:t})})}),Object(ae.jsx)(l.a,{header:"Runs Per Over",children:Object(ae.jsx)("div",{style:{maxHeight:"350px",overflowY:"auto"},class:"rca-padding rca-no-top-padding rca-no-bottom-padding",children:Object(ae.jsx)(ce,{overs:t.overs})})})]})}):Object(ae.jsx)("div",{style:{fontSize:"40px",padding:"85px",textAlign:"center"},children:"Inning Yet To Start"})},le=n(14),ie=["#2196F3","#FFFF00"];var oe=function(e){var t,n,a=e.innings;return a&&(a[0].status!==E&&(n=a[0].overs),a[1].status!==E&&(n=a[0].overs.length>a[1].overs.length?a[0].overs:a[1].overs),t={labels:[0].concat(Object(D.a)(Array.from(Array(n.length).keys()).map((function(e){return"".concat(e+1)})))),datasets:a.map((function(e,t){return{type:"line",label:e.battingTeam,data:[0].concat(Object(D.a)(e.overs.map((function(t,n){for(var a=0,c=0;c<=n;c++)a+=e.overs[c].totalRunsInThisOver;return a})))),fill:!1,borderColor:ie[t],tension:.4,radius:0,pointBackgroundColor:ie[t]}}))},t=Object(M.a)(Object(M.a)({},t),{},{datasets:[].concat(Object(D.a)(t.datasets),Object(D.a)(a.map((function(e,t){return{type:"bar",label:"".concat(e.battingTeam," Runs Per Over"),data:[0].concat(Object(D.a)(Array.from(e.overs.map((function(e){return e.totalRunsInThisOver}))))),backgroundColor:ie[t]}}))))})),Object(ae.jsx)("div",{class:"rca-batting-score rca-padding ",children:Object(ae.jsx)(ne.a,{style:{height:"325px"},type:"line",data:t,options:{maintainAspectRatio:!1,aspectRatio:.6,plugins:{legend:{labels:{color:"#495057"}}},scales:{x:{ticks:{color:"#495057"},grid:{color:"#ebedef"}},y:{ticks:{color:"#495057"},grid:{color:"#ebedef"}}}}})})};var de=Object(le.b)((function(e){return{innings:e.match.innings,currentInningIndex:e.match.currentInningIndex}}),null)((function(e){var t=e.innings,n=e.currentInningIndex;return Object(ae.jsx)(ae.Fragment,{children:Object(ae.jsxs)(l.b,{activeIndex:n,style:{fontFamily:"Lato, Verdana, Helvetica, sans-serif"},children:[t.map((function(e,t){return Object(ae.jsx)(l.a,{header:"Inning "+(t+1),children:Object(ae.jsx)("div",{style:{maxHeight:"400px"},children:Object(ae.jsx)(re,{inning:e})})},t)})),Object(ae.jsx)(l.a,{disabled:t[0].status===E,header:"Comparison",children:Object(ae.jsx)("div",{style:{maxHeight:"350px"},class:"rca-padding rca-no-top-padding rca-no-bottom-padding",children:Object(ae.jsx)(oe,{innings:t})})})]})})})),ue=n(29),be=n(21),je=n(16),he=n(9),Oe="INSERT_MATCH_DETAILS",me="UPDATE_INNINGS",pe="FORCE_END_OVER",xe="END_BALL",ge="END_INNING",ve="RESET_LAST_BALL",fe="START_NEXT_INNING",ye="SET_MATCH_RESULT",we=function(e){return e.innings[e.currentInningIndex].batsmen.filter((function(e){return e.status===y||"RETD_HURT"===e.status}))},Ne=function(e){return e.innings[e.currentInningIndex].batsmen.filter((function(e){return e.status===S||e.status===N}))},Se=function(e){var t=e.innings[e.currentInningIndex].batsmen.filter((function(e){return e.status===N}))[0];return t||null},Te=function(e){var t=e.innings[e.currentInningIndex].batsmen.filter((function(e){return e.status===S}))[0];return t||null},Ie=function(e){var t=e.innings[e.currentInningIndex].overs;return e.innings[e.currentInningIndex].bowlers.filter((function(n){return 0===t.length||t[t.length-1].bowlerName!==n.name&&Number(n.totalOvers)<e.details.maxOversPerBowler}))},ke=function(e){var t=e.innings[e.currentInningIndex].overs,n=t.length&&t[t.length-1],a=n&&n.status===I?n.bowlerName:null;return a?e.innings[e.currentInningIndex].bowlers.filter((function(e){return e.name===a}))[0]:null},Re=function(e){var t=e.innings[e.currentInningIndex].overs,n=t.length&&t[t.length-1];return n||null},Be=function(e){return e.innings[e.currentInningIndex].totalWickets},Fe=function(e){return e.innings[e.currentInningIndex]},Ee=function(e){var t=e.innings[e.currentInningIndex].overs,n=t.length>0&&t[t.length-1],a=n&&n.details.length>0&&n.details[n.details.length-1];return a||""},Ce=function(e){return e.details.teams[e.innings[e.currentInningIndex].bowlingTeam]},Pe=function(e){return Z(e.innings[e.currentInningIndex].overs)},Le=function(e){return function(e,t){var n=Z(t),a=String(n).split("."),c=Object(r.a)(a,1)[0],s=String(n).split(".")[1]?String(n).split(".")[1]:0,l=6*Number(c)+Number(s);return 0===l?0:Number((e/(l/6)).toFixed(2))}(e.innings[e.currentInningIndex].totalScore,e.innings[e.currentInningIndex].overs)},We=function(e){return function(e,t,n,a){var c=Z(n),s=String(c).split("."),l=Object(r.a)(s,2),i=l[0],o=l[1],d=6*a-(6*Number(i)+(Number(o)?Number(o):0));return Number(((t-e)/d*6).toFixed(2))}(e.innings[e.currentInningIndex].totalScore,e.innings[e.currentInningIndex].target,e.innings[e.currentInningIndex].overs,e.details.totalOversPerInning)},Ae=function(e){return e.details.totalOversPerInning},_e={details:null,innings:[],currentInningIndex:0},De=function(e){return{type:me,payload:e}},Me=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_e,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case Oe:return Object(M.a)(Object(M.a)({},e),{},{details:t.payload});case me:return Object(M.a)(Object(M.a)({},e),{},{innings:t.payload});case fe:return Object(M.a)(Object(M.a)({},e),{},{currentInningIndex:e.currentInningIndex+1});case ye:return Object(M.a)(Object(M.a)({},e),{},{details:Object(M.a)(Object(M.a)({},e.details),{},{result:t.payload})});case pe:case xe:case ge:case ve:return Object(M.a)(Object(M.a)({},e),{},{innings:t.payload});default:return e}},qe=n(6);var He=Object(le.b)(null,(function(e){return{insertMatchDetails:function(t){return e({type:Oe,payload:t})},updateInnings:function(t){return e(De(t))}}}))((function(e){var t=e.insertMatchDetails,n=e.updateInnings,c=Object(a.useState)(P),s=Object(r.a)(c,2),l=s[0],i=s[1],o=Object(a.useState)(W),d=Object(r.a)(o,2),u=d[0],b=d[1],j=Object(a.useState)(T),h=Object(r.a)(j,2),O=h[0],m=h[1],p=Object(a.useState)(5),x=Object(r.a)(p,2),g=x[0],v=x[1],f=Object(a.useState)(L),y=Object(r.a)(f,2),w=y[0],N=y[1],S=Object(a.useState)(A),I=Object(r.a)(S,2),k=I[0],R=I[1],B=Object(a.useState)(121),F=Object(r.a)(B,2),E=F[0],C=F[1],D=Object(a.useState)(1),M=Object(r.a)(D,2),q=M[0],H=M[1],G=Object(qe.f)(),K=[{name:"One Day Match",value:T},{name:"Test Match (Not Supported)",value:"TM",disabled:!0}],U=Array.from(Array(50).keys()).map((function(e){return{name:e+1,value:e+1}})),J=[{name:l+" won the toss and elected to bat first",value:121},{name:l+" won the toss and elected to bowl first",value:211},{name:u+" won the toss and elected to bat first",value:212},{name:u+" won the toss and elected to bowl first",value:122}],V=Array.from(Array(Math.ceil(Number(g/2))).keys()).map((function(e){return{name:e+1,value:e+1}}));return Object(ae.jsxs)("div",{children:[Object(ae.jsxs)("div",{className:"p-fluid p-formgrid p-grid",children:[Object(ae.jsxs)("div",{className:"p-field p-col-12 p-md-6",children:[Object(ae.jsx)("label",{htmlFor:"team1",children:"First Team Name"}),Object(ae.jsx)(be.a,{id:"team1",type:"text",placeholder:"Enter team name",value:l,onChange:function(e){return i(e.target.value)}})]}),Object(ae.jsxs)("div",{className:"p-field p-col-12 p-md-6",children:[Object(ae.jsx)("label",{htmlFor:"team2",children:"Second Team Name"}),Object(ae.jsx)(be.a,{id:"team2",type:"text",placeholder:"Enter team name",value:u,onChange:function(e){return b(e.target.value)}})]}),Object(ae.jsxs)("div",{className:"p-field p-col-12 p-md-3",children:[Object(ae.jsx)("label",{htmlFor:"matchType",children:"Match Type"}),Object(ae.jsx)(he.a,{inputId:"matchType",value:O,options:K,onChange:function(e){return m(e.value)},placeholder:"Select",optionLabel:"name"})]}),Object(ae.jsxs)("div",{className:"p-field p-col-12 p-md-3",children:[Object(ae.jsx)("label",{htmlFor:"overs",children:"No. of Overs"}),Object(ae.jsx)(he.a,{inputId:"overs",value:g,options:U,onChange:function(e){return v(e.value)},placeholder:"Select",optionLabel:"name"})]}),Object(ae.jsxs)("div",{className:"p-field p-col-12 p-md-3",children:[Object(ae.jsx)("label",{htmlFor:"overs",children:"Max. Overs Per Bowler"}),Object(ae.jsx)(he.a,{inputId:"maxOversPerBowler",value:q,options:V,onChange:function(e){return H(e.value)},placeholder:"Select",optionLabel:"name"})]}),Object(ae.jsxs)("div",{className:"p-field p-col-12 p-md-3",children:[Object(ae.jsx)("label",{htmlFor:"tossResult",children:"Toss Result"}),Object(ae.jsx)(he.a,{inputId:"tossResult",value:E,options:J,onChange:function(e){return C(e.value)},placeholder:"Select",optionLabel:"name"})]})]}),Object(ae.jsxs)("div",{className:"card p-fluid",children:[Object(ae.jsxs)("h4",{children:["Add ",l||"1st"," Team Players"]}),Object(ae.jsx)(ue.a,{value:w,max:11,onChange:function(e){return N(e.value)}})]}),Object(ae.jsxs)("div",{className:"card p-fluid",children:[Object(ae.jsxs)("h4",{children:["Add ",u||"2nd"," Team Players"]}),Object(ae.jsx)(ue.a,{value:k,max:11,onChange:function(e){return R(e.value)}})]}),Object(ae.jsx)("div",{className:"p-fluid",children:Object(ae.jsx)(je.a,{type:"button",label:"Start Match",className:"p-mt-5",onClick:function(){return function(){var e;t({teams:(e={},Object(_.a)(e,l,w),Object(_.a)(e,u,k),e),matchType:O,totalOversPerInning:g,tossResult:E,maxOversPerBowler:q,totalPlayersPerSide:w.length});var a,c,s,r,i=[];121===E||122===E?(a=l,c=w,s=u,r=k):(a=u,c=k,s=l,r=w),i.push(Y(a,c,s,r)),O===T&&i.push(Y(s,r,a,c)),n(i),G.push("full-scorecard")}()}})})]})})),Ye=n(28);var Ge=Object(le.b)((function(e){return{teams:(t=e.match,Object.keys(t.details.teams)),tossResult:e.match.details.tossResult,matchResult:e.match.details.result,currentInningIndex:e.match.currentInningIndex,currentInning:Fe(e.match),totalOvers:Pe(e.match),currentRunRate:Le(e.match),requiredRunRate:We(e.match),strikerBatsman:Se(e.match),nonStrikerBatsman:Te(e.match),currentOver:Re(e.match),currentBowler:ke(e.match),totalOversPerInning:Ae(e.match),fow:e.match.innings[e.match.currentInningIndex].fow};var t}),null)((function(e){var t=e.currentInning,n=e.totalOvers,c=e.currentRunRate,s=e.strikerBatsman,l=e.nonStrikerBatsman,i=e.currentOver,o=e.currentBowler,d=e.totalOversPerInning,u=e.currentInningIndex,b=e.tossResult,j=e.teams,h=e.requiredRunRate,O=e.matchResult,m=e.fow,p=Object(a.useState)(Number(String(b).split("")[2])),x=Object(r.a)(p,1)[0],g=Object(a.useState)(Number(String(b).split("")[0])===x?"bat":"bowl"),v=Object(r.a)(g,1)[0];return t.status===I?Object(ae.jsxs)(ae.Fragment,{children:[Object(ae.jsx)("div",{class:"rca-column-4 rca-no-right-padding",children:Object(ae.jsxs)("div",{class:"rca-menu-widget rca-left-border",children:[Object(ae.jsxs)("div",{class:"pad-10 rca-no-bottom-padding",children:[Object(ae.jsxs)("span",{class:"rca-match-title",children:[t.battingTeam,":"]}),Object(ae.jsxs)("span",{class:"rca-match-score bold",children:[t.totalScore,"/",t.totalWickets]}),Object(ae.jsx)("span",{class:"rca-match-title",children:"Overs:"}),Object(ae.jsxs)("span",{class:"rca-match-score bold",children:[n," (",d,")"]}),Object(ae.jsx)("span",{class:"rca-match-title",children:"CRR:"}),Object(ae.jsx)("span",{class:"rca-match-score bold",children:c})]}),Object(ae.jsxs)("div",{class:"pad-10",children:[t.target?Object(ae.jsxs)(ae.Fragment,{children:[Object(ae.jsx)("span",{class:"rca-match-title",children:"Target:"}),Object(ae.jsx)("span",{class:"rca-match-score bold",children:t.target}),Object(ae.jsx)("span",{class:"rca-match-title",children:"RRR:"}),Object(ae.jsx)("span",{class:"rca-match-score bold",children:h})]}):Object(ae.jsxs)(ae.Fragment,{children:[Object(ae.jsx)("span",{class:"rca-match-title",children:"Toss:"}),Object(ae.jsxs)("span",{class:"rca-match-score bold",children:[j[x-1],"(",v,")"]})]}),function(){var e=t.partnerships[t.partnerships.length-1],n=Object.keys(e).reduce((function(t,n){return t+e[n].ballsFaced}),0),a=m?m[m.length-1].score:0;return Object(ae.jsxs)(ae.Fragment,{children:[Object(ae.jsx)("span",{class:"rca-match-title",children:"Partnership:"}),Object(ae.jsxs)("span",{class:"rca-match-score bold",children:[t.totalScore-a,"(",n,")"]})]})}()]})]})}),Object(ae.jsx)("div",{class:"rca-column-2  rca-no-right-padding rca-no-left-padding",children:Object(ae.jsx)("div",{class:"rca-left-border",style:{backgroundColor:"white"},children:Object(ae.jsxs)(ae.Fragment,{children:[s?Object(ae.jsx)("div",{className:"pad-10 rca-no-bottom-padding",children:Object(ae.jsxs)("div",{className:"rca-batsman",children:[Object(ae.jsx)("span",{className:"player",children:s.name}),Object(ae.jsxs)("span",{style:{float:"right"},children:[Object(ae.jsx)("span",{style:{color:"#2196F3"},children:"*"}),s.runsScored,"(",s.ballsFaced,")"]})]})}):Object(ae.jsx)(ae.Fragment,{}),l?Object(ae.jsx)("div",{className:"pad-10",children:Object(ae.jsxs)("div",{className:"rca-batsman",children:[Object(ae.jsx)("span",{className:"player",children:l.name}),Object(ae.jsxs)("span",{style:{float:"right"},children:[l.runsScored,"(",l.ballsFaced,")"]})]})}):Object(ae.jsx)(ae.Fragment,{})]})})}),Object(ae.jsx)("div",{class:"rca-column-6 rca-no-left-padding",children:Object(ae.jsxs)("div",{class:"rca-menu-widget rca-left-border rca-right-border",children:[Object(ae.jsx)("div",{className:"pad-10 rca-no-bottom-padding",children:Object(ae.jsxs)("div",{className:"rca-ball-detail",style:{marginTop:"2.5px"},children:[function(){if(o)return Object(ae.jsxs)("div",{className:"rca-bowler-info",style:{display:"inline",marginRight:"5px"},children:[Object(ae.jsxs)("span",{class:"rca-match-title",children:[o.name,":"]}),Object(ae.jsxs)("span",{className:"rca-bolwing",children:[o.runsGiven,"-",o.wicketsTaken," in ",o.totalOvers]})]})}(),Object(ae.jsxs)("div",{className:"rca-match-schedule",style:{display:"inline"},children:[Object(ae.jsx)("span",{class:"rca-match-title",style:{marginRight:"5px"},children:"This Over:"}),Object(ae.jsx)("ul",{className:"rca-ball-by",style:{display:"inline-block"},children:i&&i.details.length?i.details.map((function(e){var t="";return(e.includes("6")||e.includes("4"))&&(t="b6"),e.includes("W")&&!e.includes("WD")&&(t="w"),Object(ae.jsx)("li",{className:t,children:e})})):Object(ae.jsx)(ae.Fragment,{children:"-"})})]})]})}),Object(ae.jsxs)("div",{className:"pad-10",children:[function(){if(m){var e=m[m.length-1];return Object(ae.jsxs)(ae.Fragment,{children:[Object(ae.jsx)("span",{class:"rca-match-title",children:"Last Wicket:"}),Object(ae.jsxs)("span",{class:"rca-match-score bold",children:[e.score,"-",t.totalWickets," (",e.batsman.name,")"]})]})}}(),t.target?Object(ae.jsxs)("span",{class:"rca-match-score bold",children:[" ",t.battingTeam," NEEDS ",t.target-t.totalScore," RUNS OFF ",((t.target-t.totalScore)/h*6).toFixed(0)," BALLS"]}):Object(ae.jsxs)(ae.Fragment,{children:[Object(ae.jsx)("span",{class:"rca-match-title",children:"Projected Score:"}),Object(ae.jsx)("span",{class:"rca-match-score bold",children:(c*d).toFixed(0)})]})]})]})})]}):t.status===E?Object(ae.jsx)(ae.Fragment,{children:Object(ae.jsx)("div",{class:"rca-column-12",children:Object(ae.jsx)("div",{class:"rca-menu-widget rca-left-border",children:Object(ae.jsxs)("div",{class:"rca-padding",style:{textAlign:"center"},children:[Object(ae.jsxs)("span",{style:{fontWeight:"bold"},children:[t.battingTeam," vs ",t.bowlingTeam," "]}),Object(ae.jsxs)("span",{children:[d," Over Match, "]}),0===u?Object(ae.jsx)(ae.Fragment,{children:Object(ae.jsxs)("span",{style:{fontWeight:"bold"},className:"rca-center",children:["Toss Result - ",j[x-1]," won the toss and elected to ",v," first"]})}):Object(ae.jsx)(ae.Fragment,{children:Object(ae.jsxs)("span",{style:{fontWeight:"bold"},children:[t.battingTeam," Requires ",t.target," in ",d," Overs at Rate ",h," Runs Per Over"]})})]})})})}):O?Object(ae.jsx)(ae.Fragment,{children:Object(ae.jsx)("div",{class:"rca-column-12",children:Object(ae.jsx)("div",{class:"rca-menu-widget rca-left-border",children:Object(ae.jsxs)("div",{class:"rca-padding",style:{textAlign:"center"},children:[Object(ae.jsxs)("span",{style:{fontWeight:"bold"},children:["1'st Inning ",t.bowlingTeam," - ",t.target-1,", "]}),Object(ae.jsxs)("span",{style:{fontWeight:"bold"},children:["2'nd Inning ",t.battingTeam," - ",t.totalScore,"/",t.totalWickets,", ",O]})]})})})}):t.status===C?Object(ae.jsx)(ae.Fragment,{children:Object(ae.jsx)("div",{class:"rca-column-12",children:Object(ae.jsx)("div",{class:"rca-menu-widget rca-left-border",children:Object(ae.jsxs)("div",{class:"rca-padding",style:{textAlign:"center"},children:[function(){var e="";return 0===u?e="st":1===u?e="nd":2===u?e="rd":3===u&&(e="th"),Object(ae.jsx)(ae.Fragment,{children:Object(ae.jsxs)("span",{children:[u+1,"'",e," Inning "]})})}(),Object(ae.jsxs)("span",{style:{fontWeight:"bold"},children:[t.battingTeam," - ",t.totalScore,"/",t.totalWickets,", "]}),Object(ae.jsxs)("span",{style:{fontWeight:"bold"},children:[t.bowlingTeam," Requires ",t.totalScore+1," Runs in ",d," Overs at Rate ",Number(((t.totalScore+1)/d).toFixed(2))," Runs Per Over"]})]})})})}):void 0})),Ke=n(33);function Ue(){var e=Object(a.useContext)(Ze),t=e.wicketDetails,n=e.dispatchWicketDetails,c=e.currentBatsmanOptions;return Object(ae.jsxs)("div",{className:"marg-right-10",children:[Object(ae.jsx)("div",{className:"marg-top-right-bottom-10 equal-width",children:"Who Out"}),Object(ae.jsx)("div",{className:"equal-width",children:Object(ae.jsx)(he.a,{disabled:!t.wicketType||[b,u,h,j,d].includes(t.wicketType),optionLabel:"name",value:t.whoOut,options:c,onChange:function(e){return n({type:"SET_WHO_OUT",payload:e.value})},placeholder:"Select"})})]})}function Je(){var e=Object(a.useContext)(Ze),t=e.wicketDetails,n=e.dispatchWicketDetails,c=e.bowlingTeamPlayersOptions,s="Out By";return t.wicketType===o?s="Run Out By":t.wicketType===d?s="Caught By":t.wicketType===j&&(s="Stumped By"),Object(ae.jsxs)("div",{children:[Object(ae.jsx)("div",{className:"marg-top-right-bottom-10 equal-width",children:s}),Object(ae.jsx)("div",{className:"equal-width",children:Object(ae.jsx)(he.a,{disabled:!t.wicketType||[b,u,h,O].includes(t.wicketType),optionLabel:"name",value:t.outByPlayer,options:c,onChange:function(e){return n({type:"SET_OUT_BY_PLAYER",payload:e.value})},placeholder:"Select"})})]})}var Ve=function(){return Object(ae.jsxs)(ae.Fragment,{children:[Object(ae.jsx)(Ue,{}),Object(ae.jsx)(Je,{})]})},ze=n(32),Qe={wicketType:null,whoOut:null,outByPlayer:null},Xe=function(e,t){switch(t.type){case"SET_WICKET_TYPE":return Object(M.a)(Object(M.a)({},e),{},{wicketType:t.payload});case"SET_WHO_OUT":return Object(M.a)(Object(M.a)({},e),{},{whoOut:t.payload});case"SET_OUT_BY_PLAYER":return Object(M.a)(Object(M.a)({},e),{},{outByPlayer:t.payload});case"RESET_WICKET_DETAILS_STATE":return Qe;default:return e}},Ze=Object(a.createContext)();var $e=Object(le.b)((function(e){return{totalPlayersPerSide:(t=e.match,t.details.totalPlayersPerSide),innings:e.match.innings,currentInningIndex:e.match.currentInningIndex,batsmenYetToBatOrRetdHurt:we(e.match),batsmenNotOut:Ne(e.match),strikerBatsman:Se(e.match),nonStrikerBatsman:Te(e.match),nextPossibleBowlers:Ie(e.match),currentBowler:ke(e.match),totalWickets:Be(e.match),lastBall:Ee(e.match),currentOver:Re(e.match),bowlingTeamPlayers:Ce(e.match),totalOvers:Pe(e.match),totalOversPerInning:Ae(e.match),matchResult:e.match.details.result};var t}),(function(e){return{updateInnings:function(t){return e(De(t))},startNextInning:function(){return e({type:fe})},setMatchResult:function(t){return e(function(e){return{type:ye,payload:e}}(t))}}}))((function(e){var t=e.totalPlayersPerSide,n=e.batsmenYetToBatOrRetdHurt,c=e.strikerBatsman,s=e.nonStrikerBatsman,l=e.batsmenNotOut,y=e.nextPossibleBowlers,w=e.currentBowler,T=e.totalWickets,P=e.currentInningIndex,L=e.innings,W=e.lastBall,A=e.currentOver,H=e.bowlingTeamPlayers,Y=e.totalOvers,G=e.totalOversPerInning,K=e.matchResult,U=e.updateInnings,J=e.startNextInning,V=e.setMatchResult,z=Object(a.useState)(c?c.name:null),Q=Object(r.a)(z,2),X=Q[0],ee=Q[1],ne=Object(a.useState)(s?s.name:null),ce=Object(r.a)(ne,2),se=ce[0],re=ce[1],le=Object(a.useReducer)(Xe,Qe),ie=Object(r.a)(le,2),oe=ie[0],de=ie[1],ue=Object(a.useState)(w),be=Object(r.a)(ue,2),Oe=be[0],me=be[1];Object(a.useEffect)((function(){w||me(null)}),[w]);var pe=Object(a.useState)(null),xe=Object(r.a)(pe,2),ge=xe[0],ve=xe[1],fe=Object(a.useState)(!0),ye=Object(r.a)(fe,2),we=ye[0],Ne=ye[1];Object(a.useEffect)((function(){W.indexOf(i)>-1&&l.length&&l.length<2&&(we?(re(ge||null),l[0].name&&ee(l[0].name)):(ee(ge||null),l[0].name&&re(l[0].name)))}),[we,ge,l,W]);var Se=Object(a.useState)(R),Te=Object(r.a)(Se,2),Ie=Te[0],ke=Te[1],Re=Object(a.useState)(B),Be=Object(r.a)(Re,2),Fe=Be[0],Ee=Be[1],Ce=Object(a.useState)(F),Pe=Object(r.a)(Ce,2),Le=Pe[0],We=Pe[1],Ae=Object(a.useState)(0),_e=Object(r.a)(Ae,2),De=_e[0],Me=_e[1];Object(a.useEffect)((function(){var e=q(F);De&&De>0&&(e.map((function(e){return[b,u,d,h,j].includes(e.value)?e.disabled=!0:e.disabled=!1})),de({type:"RESET_WICKET_DETAILS_STATE"})),We(Object(D.a)(e))}),[De]);var qe=Object(a.useState)(null),He=Object(r.a)(qe,2),Ye=He[0],Ge=He[1];Object(a.useEffect)((function(){var e=q(R);Ye&&Ye===v&&(e.map((function(e){return[0,1,2,3,4,6].includes(e.value)?e.disabled=!0:e.disabled=!1})),de({type:"RESET_WICKET_DETAILS_STATE"}),Me(5)),ke(Object(D.a)(e))}),[Ye]),Object(a.useEffect)((function(){var e=q(B);oe.wicketType&&([b,u,d].includes(oe.wicketType)?(e.map((function(e){return e.disabled=!0})),Ge(null)):oe.wicketType===j&&(e.map((function(e){return e.value!==m?e.disabled=!0:e.disabled=!1})),[x,g,v,p,f].includes(Ye)&&Ge(null))),Ee(Object(D.a)(e))}),[oe.wicketType,Ye]),Object(a.useEffect)((function(){[O,o].includes(oe.wicketType)&&(de({type:"SET_WHO_OUT",payload:null}),de({type:"SET_OUT_BY_PLAYER",payload:null})),[b,u,h,j,d].includes(oe.wicketType)&&de({type:"SET_WHO_OUT",payload:X})}),[oe.wicketType]);var Ue=Object(a.useState)(""),Je=Object(r.a)(Ue,2),$e=Je[0],et=Je[1];Object(a.useEffect)((function(){var e=[];(De||0===De)&&e.push(De),Ye&&e.push(Ye),oe.wicketType&&(e.length&&(0===De&&1===e.length||e.push("+")),e.push(i),0===De&&e.splice(0,1)),et(e)}),[De,Ye,oe.wicketType]);var tt=n.map((function(e){return{name:e.name,value:e.name}})),nt=l.map((function(e){return{name:e.name,value:e.name}})),at=y.map((function(e){return{name:e.name,value:e.name}})),ct=H.map((function(e){return{name:e,value:e}})),st=[X,se].map((function(e){return{name:e,value:e}})),rt=function(){de({type:"RESET_WICKET_DETAILS_STATE"}),Me(null),Ge(null)},lt=function(){return w&&T<t-1&&A.status===I&&!(l.length<2)?Object(ae.jsxs)(ae.Fragment,{children:[Object(ae.jsxs)("div",{className:"marg-bottom-10",style:{display:"inline-flex"},children:[Object(ae.jsxs)("div",{className:"marg-right-10",children:[Object(ae.jsx)("div",{className:"marg-top-right-bottom-10 equal-width",children:"Runs"}),Object(ae.jsxs)("div",{className:"equal-width",children:[Object(ae.jsx)(he.a,{optionLabel:"label",value:De,options:Ie,onChange:function(e){return Me(e.value)},placeholder:"Select"}),Object(ae.jsx)(Ke.a,{disabled:Ye===v,className:"marg-left-10",value:De,onValueChange:function(e){return Me(e.value)},mode:"decimal",min:0,max:100})]})]}),Object(ae.jsxs)("div",{className:"marg-right-10",children:[Object(ae.jsx)("div",{className:"marg-top-right-bottom-10 equal-width",children:"Extras"}),Object(ae.jsx)("div",{className:"equal-width",children:Object(ae.jsx)(he.a,{optionLabel:"label",value:Ye,options:Fe,onChange:function(e){return Ge(e.value)},placeholder:"Select"})})]}),Object(ae.jsxs)("div",{className:"marg-right-10",children:[Object(ae.jsx)("div",{className:"marg-top-right-bottom-10 equal-width",children:"Wicket"}),Object(ae.jsx)("div",{className:"equal-width",children:Object(ae.jsx)(he.a,{optionLabel:"label",value:oe.wicketType,options:Le,onChange:function(e){return de({type:"SET_WICKET_TYPE",payload:e.value})},placeholder:"Select"})})]}),Object(ae.jsx)("div",{className:"marg-right-10",style:{display:"inherit"},children:Object(ae.jsx)(Ze.Provider,{value:{wicketDetails:oe,dispatchWicketDetails:de,currentBatsmanOptions:st,bowlingTeamPlayersOptions:ct},children:Object(ae.jsx)(Ve,{})})})]}),Object(ae.jsxs)("div",{style:{textAlignLast:"center"},children:[Object(ae.jsx)(je.a,{style:{marginRight:"10px"},type:"button",label:"Reset Ball",onClick:function(){return rt()}}),Object(ae.jsx)(je.a,{type:"button",disabled:$(De,Ye,oe.wicketType,oe.whoOut,oe.outByPlayer),label:"Save Ball",onClick:function(){return L[P]=Object(M.a)(Object(M.a)({},L[P]),te(L[P],$e,c,s,w,oe)),L[P].totalWickets!==L[P].batsmen.length-1&&Z(L[P].overs)!==G||(L[P].status=C,L[P+1]&&(L[P+1].target=L[P].totalScore+1)),V(function(){var e;return L[P].target&&(L[P].totalScore>=L[P].target?(e="Match Result - ".concat(L[P].battingTeam," Won By ").concat(L[P].batsmen.length-1-L[P].totalWickets," Wickets"),L[P].status=C):L[P].status===C&&(e=L[P].totalScore===L[P].target-1?"Match Result - Tied":"Match Result - ".concat(L[P].bowlingTeam," Won By ").concat(L[P].target-L[P].totalScore-1," Runs"))),e}()),U(L),void rt()}})]})]}):Object(ae.jsx)(ae.Fragment,{})},it=function(){var e=[];return n.length===t?e.push(Object(ae.jsxs)("div",{className:"marg-bottom-10",style:{display:"inline-flex"},children:[Object(ae.jsxs)("div",{className:"marg-right-10",children:[Object(ae.jsx)("div",{className:"marg-top-right-bottom-10 equal-width",children:"On Strike End"}),Object(ae.jsx)(he.a,{className:"equal-width",optionLabel:"name",value:X,options:tt,onChange:function(e){return ee(e.value)},placeholder:"Select"})]}),Object(ae.jsxs)("div",{className:"marg-right-10",children:[Object(ae.jsx)("div",{className:"marg-top-right-bottom-10 equal-width",children:"On Non Strike End"}),Object(ae.jsx)(he.a,{className:"equal-width",optionLabel:"name",value:se,options:tt,onChange:function(e){return re(e.value)},placeholder:"Select"})]})]},e.length)):T<t-1&&W.indexOf(i)>-1&&l.length<2&&e.push(Object(ae.jsxs)("div",{className:"marg-bottom-10",style:{display:"inline-flex"},children:[Object(ae.jsxs)("div",{className:"marg-right-10",children:[Object(ae.jsx)("div",{className:"marg-top-right-bottom-10 equal-width",children:"Current Batsman"}),Object(ae.jsxs)("div",{className:"equal-width",children:[Object(ae.jsx)(he.a,{optionLabel:"name",value:l[0].name,options:nt,onChange:function(e){return ee(e.value)},placeholder:"Select"}),Object(ae.jsx)(ze.a,{style:{marginLeft:"10px"},checked:we,onChange:function(e){return Ne(e.value)},onLabel:"On Strike",offLabel:"On Non Strike",onIcon:"pi pi-check",offIcon:"pi pi-times"})]})]}),Object(ae.jsxs)("div",{className:"marg-right-10",children:[Object(ae.jsx)("div",{className:"marg-top-right-bottom-10",children:"Next Batsman"}),Object(ae.jsxs)("div",{className:"equal-width",children:[Object(ae.jsx)(he.a,{optionLabel:"name",value:ge,options:tt,onChange:function(e){return ve(e.value)},placeholder:"Select"}),Object(ae.jsx)(ze.a,{style:{marginLeft:"10px"},checked:!we,onChange:function(e){return Ne(!e.value)},onIcon:"pi pi-check",onLabel:"On Strike",offLabel:"On Non Strike",offIcon:"pi pi-times"})]})]})]},e.length)),(!w||A.status===k)&&Y<G&&e.push(Object(ae.jsx)("div",{className:"marg-bottom-10",style:{display:"inline-flex"},children:Object(ae.jsxs)("div",{className:"marg-right-10",children:[Object(ae.jsx)("div",{className:"marg-top-right-bottom-10 equal-width",children:"Choose Bowler"}),Object(ae.jsx)(he.a,{className:"equal-width",optionLabel:"name",value:Oe,options:at,onChange:function(e){return me(e.value)},placeholder:"Select"})]})},e.length)),e.length&&e.push(Object(ae.jsx)("div",{style:{textAlign:"center"},children:Object(ae.jsx)(je.a,{type:"button",disabled:!X||!se||!Oe||X===se,label:"Continue",onClick:function(){return function(){if(n.length===t||W.indexOf(i)>-1){var e=L[P].batsmen.findIndex((function(e){return e.name===X}));e>-1&&(L[P].batsmen[e]=Object(M.a)(Object(M.a)({},L[P].batsmen[e]),{},{status:N,order:n.length===t?1:L[P].batsmen[e].order?L[P].batsmen[e].order:T+2}));var a,c,s=L[P].batsmen.findIndex((function(e){return e.name===se}));s>-1&&(L[P].batsmen[s]=Object(M.a)(Object(M.a)({},L[P].batsmen[s]),{},{status:S,order:n.length===t?2:L[P].batsmen[s].order?L[P].batsmen[s].order:T+2})),L[P].partnerships?L[P].partnerships=[].concat(Object(D.a)(L[P].partnerships),[(a={},Object(_.a)(a,L[P].batsmen[e].name,{runsScored:0,ballsFaced:0}),Object(_.a)(a,L[P].batsmen[s].name,{runsScored:0,ballsFaced:0}),a)]):L[P].partnerships=[(c={},Object(_.a)(c,L[P].batsmen[e].name,{runsScored:0,ballsFaced:0}),Object(_.a)(c,L[P].batsmen[s].name,{runsScored:0,ballsFaced:0}),c)]}A&&A.status!==k||L[P].bowlers.findIndex((function(e){return e.name===Oe}))>-1&&L[P].overs.push({details:[],bowlerName:Oe,status:I,totalRunsInThisOver:0}),L[P].status=I,U(L)}()}})},e.length)),e};return Object(ae.jsx)("div",{children:Object(ae.jsx)("div",{className:"rca-container",children:Object(ae.jsx)("div",{className:"rca-column-12",children:Object(ae.jsx)("div",{className:"rca-medium-widget rca-padding min-ht-unset pad-top-10 rca-top-border",children:K?Object(ae.jsx)("div",{style:{fontSize:"30px",padding:"10px",textAlign:"center"},children:"Match Ended"}):(Y<G||L[P].status===E)&&T!==t-1?Object(ae.jsxs)(ae.Fragment,{children:[Object(ae.jsx)(it,{}),Object(ae.jsx)(lt,{})]}):K?void 0:Object(ae.jsx)(ae.Fragment,{children:Object(ae.jsx)("div",{style:{textAlign:"center"},children:Object(ae.jsx)(je.a,{type:"button",label:"Start Next Inning",onClick:function(){return J()}})})})})})})})})),et=n(34);var tt=Object(le.b)((function(e){return{liveScore:(t=e.match,t.innings[t.currentInningIndex]?"Live ".concat(t.innings[t.currentInningIndex].battingTeam,": ").concat(t.innings[t.currentInningIndex].totalScore,"/").concat(t.innings[t.currentInningIndex].totalWickets," in ").concat(Pe(t)," Overs"):"")};var t}),null)((function(e){var t=e.liveScore,n=Object(a.useState)(!1),c=Object(r.a)(n,2),s=c[0],l=c[1];return Object(ae.jsx)("div",{children:Object(ae.jsxs)("div",{className:"rca-container",children:[Object(ae.jsx)("div",{className:"rca-row",children:Object(ae.jsx)("div",{className:"rca-column-12",children:Object(ae.jsx)("div",{className:"rca-logo",children:Object(ae.jsxs)("h2",{children:[Object(ae.jsx)("span",{children:Object(ae.jsx)("img",{src:"src/images/logo-01.png",style:{width:"50px"},alt:""})}),Object(ae.jsx)("span",{children:"Cricket Scorer"})]})})})}),Object(ae.jsx)("div",{className:"rca-row",children:Object(ae.jsx)("div",{className:"rca-column-12",children:Object(ae.jsx)("div",{className:"rca-mini-widget rca-tab-simple",children:Object(ae.jsxs)("div",{id:"rtab-1",className:"rca-padding",children:[Object(ae.jsx)("div",{className:"rca-column-12",children:Object(ae.jsx)("div",{className:"rca-blog-content",children:Object(ae.jsx)("div",{className:"rca-padding",children:Object(ae.jsx)(Ye.a,{children:Object(ae.jsx)("div",{children:Object(ae.jsxs)(qe.c,{children:[Object(ae.jsx)(qe.a,{exact:!0,path:"/",component:He}),Object(ae.jsx)(qe.a,{path:"/full-scorecard",component:de}),Object(ae.jsx)(qe.a,{component:He})]})})})})})}),Object(ae.jsx)("div",{className:"rca-clear"})]})})})}),""!==t?Object(ae.jsxs)(ae.Fragment,{children:[Object(ae.jsx)(Ge,{}),Object(ae.jsx)("div",{style:{position:"fixed",top:"90.7%",right:"2%"},children:Object(ae.jsx)(je.a,{icon:"pi pi-pencil",title:"Update Inning",onClick:function(){return l(!0)},className:"p-mr-2"})}),Object(ae.jsx)(et.a,{visible:s,position:"bottom",onHide:function(){return l(!1)},children:Object(ae.jsx)($e,{})})]}):Object(ae.jsx)(ae.Fragment,{})]})})})),nt=function(e){e&&e instanceof Function&&n.e(4).then(n.bind(null,56)).then((function(t){var n=t.getCLS,a=t.getFID,c=t.getFCP,s=t.getLCP,r=t.getTTFB;n(e),a(e),c(e),s(e),r(e)}))},at=(n(48),n(49),n(50),n(51),n(25)),ct=n(35),st=Object(at.createStore)(Object(at.combineReducers)({match:Me}),Object(ct.composeWithDevTools)());n(52);s.a.render(Object(ae.jsx)(le.a,{store:st,children:Object(ae.jsx)(tt,{})}),document.getElementById("root")),nt()}},[[53,1,2]]]);
  //# sourceMappingURL=main.5e65408d.chunk.js.map