!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9e7ec4c1-facf-481a-9ca7-0bb679b91bee",e._sentryDebugIdIdentifier="sentry-dbid-9e7ec4c1-facf-481a-9ca7-0bb679b91bee")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9923],{6695:(e,t,r)=>{r.r(t),r.d(t,{easeBack:()=>N,easeBackIn:()=>T,easeBackInOut:()=>N,easeBackOut:()=>z,easeBounce:()=>S,easeBounceIn:()=>P,easeBounceInOut:()=>D,easeBounceOut:()=>S,easeCircle:()=>j,easeCircleIn:()=>y,easeCircleInOut:()=>j,easeCircleOut:()=>w,easeCubic:()=>i.wq,easeCubicIn:()=>i.EY,easeCubicInOut:()=>i.wq,easeCubicOut:()=>i.Jx,easeElastic:()=>q,easeElasticIn:()=>R,easeElasticInOut:()=>H,easeElasticOut:()=>q,easeExp:()=>b,easeExpIn:()=>v,easeExpInOut:()=>b,easeExpOut:()=>m,easeLinear:()=>n,easePoly:()=>c,easePolyIn:()=>l,easePolyInOut:()=>c,easePolyOut:()=>u,easeQuad:()=>o,easeQuadIn:()=>s,easeQuadInOut:()=>o,easeQuadOut:()=>a,easeSin:()=>x,easeSinIn:()=>h,easeSinInOut:()=>x,easeSinOut:()=>f});let n=e=>+e;function s(e){return e*e}function a(e){return e*(2-e)}function o(e){return((e*=2)<=1?e*e:--e*(2-e)+1)/2}var i=r(36729),l=function e(t){function r(e){return Math.pow(e,t)}return t*=1,r.exponent=e,r}(3),u=function e(t){function r(e){return 1-Math.pow(1-e,t)}return t*=1,r.exponent=e,r}(3),c=function e(t){function r(e){return((e*=2)<=1?Math.pow(e,t):2-Math.pow(2-e,t))/2}return t*=1,r.exponent=e,r}(3),d=Math.PI,p=d/2;function h(e){return 1==+e?1:1-Math.cos(e*p)}function f(e){return Math.sin(e*p)}function x(e){return(1-Math.cos(d*e))/2}function g(e){return(Math.pow(2,-10*e)-9765625e-10)*1.0009775171065494}function v(e){return g(1-e)}function m(e){return 1-g(e)}function b(e){return((e*=2)<=1?g(1-e):2-g(e-1))/2}function y(e){return 1-Math.sqrt(1-e*e)}function w(e){return Math.sqrt(1- --e*e)}function j(e){return((e*=2)<=1?1-Math.sqrt(1-e*e):Math.sqrt(1-(e-=2)*e)+1)/2}var k=4/11,I=6/11,C=8/11,M=3/4,B=9/11,_=10/11,E=15/16,O=21/22,A=63/64,L=1/(4/11)/(4/11);function P(e){return 1-S(1-e)}function S(e){return(e*=1){r.r(t),r.d(t,{default:()=>Y});var n=r(6029),s=r(21501),a=r(76356),o=r(55729),i=r(48683),l=r(62859),u=r(54409),c=r(28349),d=r(90248),p=r(54053),h=r(84942);function f(e){let{isOpen:t,setIsOpen:r}=e,{leftTeam:s,rightTeam:i}=(0,o.useContext)(l.y$),u=(0,h.z)(s),f=(0,h.z)(i);return(0,n.jsxs)(p.A,{isOpen:t,setIsOpen:r,header:"event.tennisPower",children:[(0,n.jsx)(c.EY,{px:"lg",maxW:{md:"[320px]"},display:"block",textStyle:"body.medium",mb:"lg",children:(0,n.jsx)(d.A,{id:"tennis_power_description"})}),(0,n.jsxs)(a.az,{position:"relative",w:"[320px]",h:"[242px]",children:[(0,n.jsx)(a.I4.img,{src:"/static/images/tennis-power-info-graphic-all-themes.svg",alt:"Tennis Power Diagram",w:"[127px]",h:"[209px]",mt:"lg",mb:"md",position:"absolute",top:"0",left:"lg"}),(0,n.jsx)(c.EY,{textStyle:"display.micro",wordBreak:"break-word",position:"absolute",top:"0",left:"lg",color:"secondary.default",children:(0,n.jsx)(d.A,{id:"event.tennisPower.lowLevel",values:{playerName:(0,n.jsx)("bdi",{children:u})}})}),(0,n.jsx)(c.EY,{textStyle:"display.micro",wordBreak:"break-word",position:"absolute",top:"[62px]",left:"[144px]",color:"secondary.default",children:(0,n.jsx)(d.A,{id:"event.tennisPower.breakWon",values:{playerName:(0,n.jsx)("bdi",{children:u}),break:()=>(0,n.jsx)("br",{})}})}),(0,n.jsx)(c.EY,{textStyle:"display.micro",wordBreak:"break-word",position:"absolute",top:"[154px]",left:"[144px]",color:"primary.default",children:(0,n.jsx)(d.A,{id:"event.tennisPower.breakWon",values:{playerName:(0,n.jsx)("bdi",{children:f})}})}),(0,n.jsx)(c.EY,{textStyle:"display.micro",wordBreak:"break-word",position:"absolute",bottom:"0",left:"lg",color:"primary.default",children:(0,n.jsx)(d.A,{id:"event.tennisPower.highLevel",values:{playerName:(0,n.jsx)("bdi",{children:f})}})})]})]})}var x=r(21377),g=r(93338),v=r(6695),m=r(59411),b=r(27956),y=r(14632),w=r(62042);let j=(0,w.cx)("score",(0,w.AH)({position:"absolute",top:"-xl",h:"[128px]",display:"flex",flexDirection:"column",justifyContent:"space-between",textAlign:"end",textStyle:"display.medium",color:"neutrals.nLv3","& > span":{position:"relative",left:{_ltr:"2xs",_rtl:"0"},display:"block",color:"neutrals.nLv3","&.has-tie-break":{left:{_ltr:"[-6px]",_rtl:"sm"},"&.is-double-digit":{left:{_ltr:"[-10px]",_rtl:"md"}}},"& > sup":{position:"absolute",width:"[10px]",top:"[6px]",textAlign:"center"},"&.win":{color:"neutrals.nLv1"}},"&.last.live > span":{color:"status.live!"},_before:{content:'""',position:"absolute",top:"[18px]",right:{_ltr:"0",_rtl:"2xs"},w:"2xs",h:"[6px]",borderInlineEnd:"2px solid {colors.secondary.default/40}",transition:"[border]",transitionDuration:"normal"},_after:{content:'""',position:"absolute",bottom:"[18px]",right:{_ltr:"0",_rtl:"2xs"},w:"2xs",h:"[6px]",borderInlineEnd:"2px solid {colors.secondary.default/40}",transition:"[border]",transitionDuration:"normal"},"&.hide-triangles":{_before:{display:"none"},_after:{display:"none"},"& .serve":{left:"sm"}},"&.home:before":{borderColor:"neutrals.nLv1"},"&.away:after":{borderColor:"neutrals.nLv1"},"&.last.live:before":{borderColor:"secondary.default/40"},"&.last.live:after":{borderColor:"primary.default/40"}})),k=(0,w.cx)("serve",(0,w.AH)({position:"absolute",fill:"status.live",top:"2xs",right:{_ltr:"[initial]",_rtl:"-md"}})),I=(0,w.cx)("set",(0,w.AH)({display:"inline-block",position:"relative",mr:"2xs",bg:"surface.s1",bgImage:"linear-gradient({colors.secondary.highlight}, {colors.secondary.highlight} 50%, {colors.primary.highlight} 50%, {colors.primary.highlight})",borderTop:"2px solid {colors.secondary.default/40}",borderBottom:"2px solid {colors.primary.default/40}",transition:"all",transitionDuration:"normal","&.home":{borderTopColor:"neutrals.nLv1"},"&.away":{borderBottomColor:"neutrals.nLv1"},"& > g > path":{shapeRendering:"crispEdges"}}));var C=r(19240);let M={...v,...b,...y,...m},B=M.scaleLinear().domain([0,100]).range([0,40]),_=(e,t)=>{let r=B(e.value);return"\n M".concat(Math.max(9.6*t,1),",0\n v").concat(-r,"\n h").concat(8,"\n v").concat(r,"\n z")},E=(e,t)=>r=>{let n="period".concat(r+1);return[e[n]||0,t[n]||0]};function O(e){var t,r;let{tennisPowerRankings:s}=e,{event:i,leftTeam:u,rightTeam:d,leftScore:p,rightScore:h}=(0,o.useContext)(l.y$),f=(0,o.useRef)(null),{textDirection:v}=(0,c.$c)(),m=i.status.type===x.XUj.InProgress,b="rtl"===v,y=(null==(t=u.subTeams)?void 0:t.length)===2&&(null==(r=d.subTeams)?void 0:r.length)===2;return(0,o.useEffect)(()=>{if(!f.current||!s)return;let e=M.select(f.current),t=s.reduce((e,t)=>(!e.length||t.set>e.length?e.push([t]):e[e.length-1].push(t),e),[]);i.lastPeriod&&Number(i.lastPeriod.match(/\d/g))>t.length&&t.push([]);let r=E(p,h),n=e.selectAll(".set").data(t);n.selectAll("g").remove(),n.exit().remove();let a=n.enter().insert("svg",".end").merge(n).classed(I,!0).classed("home",(e,n)=>{let[s,a]=r(n);return(!m||n!==t.length-1)&&s>a}).classed("away",(e,n)=>{let[s,a]=r(n);return(!m||n!==t.length-1)&&s"0 -40 ".concat(9.6*e.length," 80")).attr("width",e=>8*(e.length+ +(1===e.length))).attr("transform",b?"scale(-1,1)":"").attr("height",80).selectAll("g").data(e=>e).enter().append("g");a.append("path").classed("game",!0).attr("d",_).attr("fill",e=>e.value>=0?g.S.var("colors.secondary.default"):g.S.var("colors.primary.default")),a.filter(e=>e.breakOccurred).append("svg").attr("width",8).attr("height",12).attr("viewBox","0 0 8 12").attr("x",e=>Math.max(9.6*(e.game-1),1)).attr("y",e=>e.value>0?1:-13).attr("fill",g.S.var("colors.status.val")).append("path").attr("d","M3.5 2.31002L1.19 1.15002C0.46 1.88002 0 2.89002 0 4.00002C0 5.11002 0.46 6.12002 1.19 6.85002L3.5 5.70002V2.31002ZM3.99999 0C3.30999 0 2.66999 0.19 2.10999 0.5L4.49999 1.7V6.31L2.10999 7.51C2.67999 7.82 3.30999 8.01 3.99999 8.01C6.20999 8.01 7.99999 6.22 7.99999 4.01C7.99999 1.8 6.20999 0 3.99999 0Z");let o=t.map((e,t)=>{let n=r(t),s="period".concat(t+1,"TieBreak"),a=p[s]||null,o=h[s]||null,i=y&&"period3TieBreak"===s&&1===e.length;return{width:8*e.length,scores:n.map((e,t)=>({value:e,win:t?n[1]>n[0]:n[0]>n[1],tieBreak:i?void 0:t?o:a}))}}),l=e.selectAll(".score").data(o);l.selectAll("span").remove(),l.exit().remove(),l.enter().insert("div",".end").merge(l).classed(j,!0).classed("last",(e,r)=>r===t.length-1).classed("live",m).classed("hide-triangles",(e,r)=>0===t[r].length).classed("home",e=>e.scores[0].value>e.scores[1].value).classed("away",e=>e.scores[1].value>e.scores[0].value).style("width",e=>"".concat(8===e.width?16:e.width,"px")).style("left",(e,t,r)=>{if(b)return"";let n=0,s=t;for(;s>0;)n+=parseInt(r[s-1].style.width||"0",10)+2,s-=1;return"".concat(n,"px")}).style("right",(e,t,r)=>{if(!b)return"";let n=2,s=t;for(;s>0;)n+=parseInt(r[s-1].style.width||"0",10)+2,s-=1;return"".concat(n,"px")}).selectAll("span").data(e=>e.scores).enter().append("span").classed("win",e=>e.win).text(e=>e.value).filter(e=>"number"==typeof e.tieBreak).classed("has-tie-break",!0).classed("is-double-digit",e=>!!e.tieBreak&&e.tieBreak>9).append("sup").text(e=>e.tieBreak),i.firstToServe&&m&&e.selectAll(".score").filter((e,t,r)=>t===r.length-1).selectAll("span").filter((e,t)=>t===i.firstToServe-1).append("svg").classed(k,!0).attr("width",12).attr("height",12).attr("viewBox","0 0 12 12").append("path").attr("d","M6 10a4 4 0 1 0 0-8 4 4 0 0 0 0 8z")},[i.id,s,m,i.firstToServe]),(0,n.jsx)(c.tR,{startPosition:"end",buttonStyle:"solid",colorPalette:"surface",showButtons:"desktop",children:(0,n.jsxs)(a.so,{py:"2xl",children:[(0,n.jsxs)(a.so,{direction:"column",justify:"space-between",mr:"xs",py:"sm",children:[(0,n.jsx)(C.e,{team:u,hasFlag:!1}),(0,n.jsx)(C.e,{team:d,hasFlag:!1})]}),(0,n.jsx)(a.so,{ref:f,dir:v,position:"relative",height:"8xl",mr:"[6px]",grow:0,shrink:1,basis:m?"[300px]":"[auto]",children:(0,n.jsx)("div",{className:"end"})}),i.status.type===x.XUj.Finished&&(0,n.jsxs)(a.so,{grow:1,shrink:1,basis:"[auto]",direction:"column",children:[(0,n.jsx)(a.az,{py:"xs",px:"md",h:"3xl",flexGrow:1,flexShrink:1,flexBasis:"[auto]",textAlign:"center",bg:1===i.winnerCode?"secondary.highlight":"surface.s2",children:(0,n.jsx)(c.EY,{textStyle:"display.extraLarge",color:1===i.winnerCode?"neutrals.nLv1":"neutrals.nLv3",children:p.display||p.current})}),(0,n.jsx)(a.az,{py:"xs",px:"md",h:"3xl",flexGrow:1,flexShrink:1,flexBasis:"[auto]",textAlign:"center",bg:2===i.winnerCode?"primary.highlight":"surface.s2",children:(0,n.jsx)(c.EY,{textStyle:"display.extraLarge",color:2===i.winnerCode?"neutrals.nLv1":"neutrals.nLv3",children:h.display||h.current})})]})]})})}var A=r(82070),L=r(4967),P=r(45860),S=r(65078);let D=e=>{let t=(0,S.g3)(),r=(0,L.Ui)(e.startTimestamp,Date.now(),"hours")>8,{data:n,error:s}=(0,P.Ay)(x.bnp.tennisPower(e.id),r?{}:{refreshInterval:1e4});return{tennisPowerRankings:t?null==n?void 0:n.tennisPowerRankings.map(e=>({...e,value:-1*e.value})):null==n?void 0:n.tennisPowerRankings,error:s}},T=e=>{let{sum:t}=e.reduce((e,t)=>(t.set!==e.prev&&(e.sum+=1,e.prev=t.set),e),{sum:0,prev:0});return t},z=(e,t)=>{let r=-1;return Object.keys(e).forEach(n=>{n===t&&(r=e[n])}),r};var N=r(35621);function Y(){let{event:e,leftScore:t,rightScore:r}=(0,o.useContext)(l.y$),{tennisPowerRankings:c,error:d}=D(e),[p,h]=(0,o.useState)(!1),x=(0,s.hX)();return(0,o.useMemo)(()=>{if(d)return!1;if(c){if(0!==T(c)){let e=!0,n=1,s=0,a=0;for(let o=0;on){let o=z(t,"period".concat(n)),i=z(r,"period".concat(n));(o!==s||i!==a)&&(e=!1),s=0,a=0,n++}i.value>0?s++:a++}return e}return!1}return!0},[c,d])?(0,n.jsxs)(a.so,{direction:"column",gap:"sm",children:[(0,n.jsxs)(i.Zp,{children:[(0,n.jsx)(i.Zp.Header,{title:(0,n.jsx)(N.J,{event:e}),actionComponent:(0,n.jsx)(u.G_L,{onClick:e=>{e.stopPropagation(),e.preventDefault(),h(!0)},cursor:"pointer",fill:"onSurface.nLv1"})}),(0,n.jsx)(a.az,{px:"sm",children:x?(0,n.jsx)(A.U,{}):(0,n.jsx)(O,{tennisPowerRankings:c})})]}),(0,n.jsx)(f,{isOpen:p,setIsOpen:h})]}):(0,n.jsx)(N.A,{event:e})}}}]);