1import{r as e,R as t}from"./index.js";import{c as a}from"./client.js";import{u as s,P as r,s as i}from"./store.js";import{P as o}from"./index2.js";import{H as n,a as p,b as m,c as l}from"./h2h-stats-container.js";import{t as h,Y as d}from"./bundle-es.js";import{H as c}from"./h2h-error.js";import{H as g}from"./h2h-stats.js";import{g as j}from"./get-h2h-player-info.js";import"./_commonjsHelpers.js";import"./tournament-player-service.js";import"./api-client.js";import"./content-api.js";import"./search-api.js";import"./favourite-player-button.js";import"./svg-icon.js";import"./player-headshot.js";import"./tennis.js";import"./moment.js";import"./use-window-resize.js";import"./measurements.js";import"./h2h-career-surface-records-shared.js";import"./chart.js";import"./unlocked-badge.js";import"./index3.js";import"./rankings-constants.js";import"./index4.js";import"./index5.js";import"./SwitchTransition.js";import"./player-select.js";import"./_rollupPluginBabelHelpers.js";import"./tournament-icon-image.js";import"./flag.js";import"./loader.js";function y({title:a,playerInfo:r,opponentInfo:i,widgetName:o,widgetType:j}){const[y,f]=e.useState(n.CAREER),[u,w]=e.useState(r),[I,b]=e.useState(i),{data:E,isLoading:N,isFetching:T,isError:_,error:H}=s({playerId:u?.playerid,opponentId:I?.playerid,params:{sort:"desc"}},{skip:!u.playerid||!I.playerid}),S=E?.bio?.[0]||u,k=E?.bio?.[1]||I;return t.createElement(p,{value:{reducedStats:!0,h2hData:E,h2hIsLoading:N,h2hIsFetching:T,statsToShow:y,setStatsToShow:f,setCurrentPlayerInfo:w,setCurrentOpponentInfo:b}},t.createElement("div",{className:"h2h__header"},t.createElement("h1",{className:"h2h__title h-m-sb"},a||h.lookup("label.h2h.title")),t.createElement("div",{className:"h2h__player-stats-switcher-container"},t.createElement(m,{onStatsChange:f,small:!1,widgetName:o,widgetType:j}))),t.createElement("div",{className:"h2h__content"},_?t.createElement(c,{error:H}):t.createElement(t.Fragment,null,t.createElement(l,{playerId:S.playerid,playerName:S&&`${S?.firstname} ${S?.lastname}`,opponentId:k.playerid,opponentName:k&&`${k?.firstname} ${k?.lastname}`,showFavouriteButton:!0,widgetName:o,widgetType:j}),t.createElement(g,{h2hData:E,playerInfo:u,opponentInfo:I,widgetName:o,widgetType:j})),t.createElement("a",{className:"h2h__all-stats-link sbtn sbtn--med sbtn--gt "+(S.playerid?"":"is-disabled"),href:d([S.playerid,k.playerid])},h.lookup("label.h2h.showAll"))))}y.propTypes={title:o.string,playerInfo:o.object,opponentInfo:o.object,widgetName:o.string,widgetType:o.string};class f{constructor(e){this.container=e,this.containerRoot=a.createRoot(this.container),this.title=this.container.dataset.title,this.playerInfo=j(this.container.dataset).playerInfo,this.opponentInfo=j(this.container.dataset).opponentInfo,this.widgetName=this.container.dataset.trackingWidgetName,this.widgetType=this.container.dataset.trackingWidgetType,this.renderH2H()}renderH2H(){this.containerRoot.render(t.createElement(r,{store:i},t.createElement(y,{title:this.title?.length?this.title:"",playerInfo:this.playerInfo,opponentInfo:this.opponentInfo,widgetName:this.widgetName,widgetType:this.widgetType})))}}export{f as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.