{"version":3,"file":"js/react/mls-players-career-stats-app.js?_t=76b03fd72a41ed5ef3f5","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA;AACA;AAAA;AAEA;AAEA;AAEA;AACA;AAOA;AACA;AAAA;AAEA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAAA;AACA;AAEA;AAAA;AACA;AACA;AAGA;AACA;AAMA;AACA;AAAA;AACA;AACA;AAEA;AAOA;AACA;AAAA;AACA;AACA;AAEA;AAaA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAcA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAiBA;AACA;AACA;AAcA;AACA;AACA;AAUA;AACA;AACA;AAUA;AACA;AACA;AAcA;AACA;AACA;AAaA;AACA;AACA;AASA;AACA;AACA;AAMA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AASA;;;;;;;;;;;;;;;;AC5PA;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAAA;AACA;AACA;AACA;AACA;AAGA;AAEA;AACA;AACA;AACA;AAAA;AAEA;AACA;AAAA;AACA;AACA;AAGA;AAEA;AACA;AACA;AAAA;AACA;AAIA;AAAA;AAEA;AAAA;AACA;AAGA;AAEA;AACA;AAAA;AAGA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAEA;AACA;AACA;AAAA;AACA;AAGA;AAEA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAiBA;AAEA;;;;;;;;;;;;;;;;AC1HA;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAAA;AAGA;AACA;AAAA;AAGA;AACA;AAAA;AAGA;AAAA;AACA;AACA;AACA;AACA;AACA;AAGA;AAEA;AACA;AAAA;AAGA;AACA;AAAA;AAGA;AACA;AAAA;AAGA;AAwBA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAIA;AAGA;AAEA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AAEA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AAIA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAQA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AAAA;AAkBA;AAGA;AAEA;;;;;;;;;;;;;;;;;;;;;;ACrKA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAEA;AACA;AAEA;AACA;AACA;AAAA;AAGA;AACA;AAEA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAEA;AAAA;AACA;AAGA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AAAA;AAGA;AACA;AAEA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAEA;AAAA;AACA;AAGA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AAAA;AAGA;AAEA;AACA;AAAA;AACA;AAGA;AACA;AAIA;AAEA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAEA;AAAA;AACA;AAGA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;;;;;;;;;;;;;;;;ACpaA;AACA;AACA;AACA;AACA;AAEA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAEA;AAAA;AAGA;AACA;AACA;AAAA;AAEA;AAEA;AAAA;AACA;AACA;AAEA;AACA;AAAA;AACA;AACA;AACA;AAGA;AACA;AACA;AAAA;AAGA;AACA;AAEA;AACA;AAAA;AACA;AAGA;AACA;AAAA;AACA;AAGA;AACA;AACA;AAAA;AAGA;AACA;AACA;AAAA;AAGA;AACA;AAAA;AAIA;AAMA;AACA;AACA;AAAA;AACA;AACA;AAGA;AACA;AACA;AAAA;AAGA;AAOA;AAAA;AACA;AAGA;AAEA;AACA;AAAA;AAGA;AAAA;AACA;AACA;AAGA;AACA;AACA;AAEA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AAGA;AAEA;;;;;;;;;;;;;;;;AC7JA;;;;;;;;;;;;;;;;ACAA;AAEA;AACA;AACA;AAAA;AAGA;AACA;AAAA;AAGA;AACA;AAEA;AACA;AAAA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AAAA;AAGA;AAAA;AAGA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAGA;AACA;AAAA;AAGA;AAAA;AACA;AACA;AAIA;AACA;AACA;AAGA;AAEA;;;;;;;;;;;;;;;;ACtDA;;;;;;;;;;;;;;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAGA;AACA;AACA;AAAA;AACA;AAGA;AACA;AAEA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAAA;AACA;AAGA;AACA;AAEA;AACA;AAAA;AAGA;AACA;AAAA;AAGA;AAEA;A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","sources":["webpack://@mlssoccer/netcore/./scripts/libraries/_modules/tracking/helpers.js","webpack://@mlssoccer/netcore/./scripts/react/mls-players-career-stats/app.js","webpack://@mlssoccer/netcore/./scripts/react/mls-players-career-stats/components/PlayersCareerTable/PlayersCareerTable.js","webpack://@mlssoccer/netcore/./scripts/react/mls-players-career-stats/components/PlayersCareerTable/index.js","webpack://@mlssoccer/netcore/./scripts/react/mls-players-career-stats/main.js","webpack://@mlssoccer/netcore/./scripts/react/mls-players-career-stats/utils.js","webpack://@mlssoccer/netcore/./scripts/react/shared/components/ButtonBase/ButtonBase.js","webpack://@mlssoccer/netcore/./scripts/react/shared/components/ButtonBase/index.js","webpack://@mlssoccer/netcore/./scripts/react/shared/components/ButtonGroup/ButtonGroup.js","webpack://@mlssoccer/netcore/./scripts/react/shared/components/ButtonGroup/index.js","webpack://@mlssoccer/netcore/./scripts/react/shared/components/Dropdown/Dropdown.js","webpack://@mlssoccer/netcore/./scripts/react/shared/components/Dropdown/index.js","webpack://@mlssoccer/netcore/./scripts/react/shared/components/Table/Table.js","webpack://@mlssoccer/netcore/./scripts/react/shared/components/Table/index.js","webpack://@mlssoccer/netcore/./scripts/react/shared/components/ToggleButton/ToggleButton.js","webpack://@mlssoccer/netcore/./scripts/react/shared/components/ToggleButton/index.js","webpack://@mlssoccer/netcore/./scripts/react/shared/hooks/useEventCallback.js","webpack://@mlssoccer/netcore/./scripts/react/shared/hooks/useForkRef.js","webpack://@mlssoccer/netcore/./scripts/react/shared/hooks/useIsFocusVisible.js","webpack://@mlssoccer/netcore/./scripts/react/shared/hooks/useResize.js","webpack://@mlssoccer/netcore/./scripts/react/shared/svg/Svg.js"],"sourcesContent":["/**\n * @private\n * Push somethig in dataLayer\n * @param obj object to push\n */\nconst dataLayerPush = (obj) => {\n if (!obj) return;\n\n window.dataLayer = window.dataLayer ?? [];\n\n obj = cleanupNull(obj);\n\n window.dataLayer.push(obj);\n};\n\n/**\n * @private\n * cleanup inner props\n * @param {object} obj\n */\nconst cleanupNull = (obj) => {\n if (obj === null) return undefined;\n\n if (typeof obj === 'string') return obj;\n\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) {\n if (Array.isArray(obj[key])) {\n for (let index = 0; index < obj[key].length; index++) {\n obj[key][index] = cleanupNull(obj[key][index]);\n }\n } else {\n obj[key] = cleanupNull(obj[key]);\n }\n }\n }\n\n return obj;\n};\n\n/**\n * Push new Core dataLayer info\n * @param data the meta data\n */\nexport const addCoreDataLayer = (data) => {\n dataLayerPush({\n 'event': 'dataLayer-initialized',\n ...data,\n });\n};\n\n/**\n * Track generic event\n * @param {string} eventName event name\n * @param {any} data event data\n */\nexport const trackEvent = (eventName, data = {}) => {\n dataLayerPush({\n 'event': eventName,\n ...data\n });\n};\n\n/**\n * track block impression\n * @param {string} bucketName\n * @param {string} blockType\n * @param {{\n * id: string,\n * name: string,\n * creative: string,\n * position: string,\n * }[]} promotions\n */\nexport const trackBlockImpression = (bucketName, blockType, promotions) => {\n const impressionData = {\n bucketName,\n blockType,\n 'ecommerce': promotions?.length ? {\n 'promoView': {\n promotions,\n },\n } : undefined,\n };\n\n trackEvent('block-impression', impressionData);\n};\n\n/**\n * track block click\n * @param {string} bucketName\n * @param {string} blockType\n * @param {object} data\n * @param {{\n * id: string,\n * name: string,\n * creative: string,\n * position: string,\n * }} promotion\n */\nexport const trackBlockClick = (bucketName, blockType, layoutName, blockLayout, blockStyle, data, promotion) => {\n const clickData = {\n bucketName,\n blockType,\n layoutName,\n blockLayout,\n blockStyle,\n ...data,\n 'ecommerce': promotion ? {\n 'promoClick': {\n promotions: [promotion],\n },\n } : undefined,\n };\n\n trackEvent('block-click', clickData);\n};\n\n/**\n * Track MatchHub click event\n * @param {{\n * clickType: string,\n * clickItem: string,\n * match: string,\n * matchState: string,\n * clubName: string,\n * playerName: string,\n * competition: string,\n * cardType: string,\n * optaEventType: string,\n * toggle: string\n * }} clickData\n */\nexport const trackMatchHubClick = (clickData) => {\n trackEvent('match-hub-click', clickData);\n};\n\n/**\n * Track Match interaction event\n * @param {{\n * clickType: string,\n * clickItem: string,\n * clickPosition: string,\n * matchState: string,\n * match: string,\n * competition: string,\n * travelType: string\n * }} clickData\n */\nexport const trackMatchInteraction = (clickData) => {\n trackEvent('match-interaction', clickData);\n};\n\n/**\n * Track Week Selector event\n * @param {{\n * selectorLocation: 'top' | 'bottom',\n * direction: 'forward' | 'back',\n * selection: string\n * }} clickData\n */\nexport const trackWeekSelector = (clickData) => {\n trackEvent('week-selector-click', clickData);\n};\n\n/**\n * Track Filter interaction event\n * @param {{\n * statsCategory: string,\n * filterType: string,\n * clickItem: string\n * }} clickData\n */\nexport const trackFilterClick = (clickData) => {\n trackEvent('filter-click', clickData);\n};\n\n/**\n * Track FeaturedMatch click event\n * @param {{\n* clickType: string,\n* clickItem: string,\n* match: string,\n* matchState: string,\n* playerName: string,\n* competition: string,\n* toggle: string\n* }} clickData\n*/\nexport const trackFeaturedMatchClick = (clickData) => {\n trackEvent('featured-match-click', clickData);\n};\n\n/**\n * Track HorizontalScoreboardMatch click event\n * @param {{\n* clickType: string,\n* clickItem: string,\n* match: string,\n* matchState: string,\n* competition: string,\n* clickPosition: string,\n* }} clickData\n*/\nexport const trackHorizontalScoreboardMatch = (clickData) => {\n trackEvent('horizontal-scoreboard-match-click', clickData);\n};\n\n/**\n * Track user successful login event\n * @param {{\n* userId: string,\n* method: string,\n* }} eventData\n*/\nexport const trackUserLogin = (eventData) => {\n trackEvent('successful-login-freemium', eventData);\n};\n\n\n/**\n * Track user login freemium login wall event\n*/\nexport const trackUserFreemiumLoginWall = (eventData) => {\n trackEvent('freemium-login-wall', eventData);\n};\n\nexport const trackUserFreemiumLoginWallViewed = (eventData) => {\n trackEvent('freemium-login-wall_viewed', eventData);\n};\n\nexport const trackUserFreemiumLoginWallCtaClicked = (eventData) => {\n trackEvent('freemium-cta-click', eventData);\n};\n\nexport const trackUserFreemiumSuccessfulSignup = (eventData) => {\n trackEvent('successful-signup', eventData);\n};\n\nexport const trackUserFreemiumSuccessfulLogin = (eventData) => {\n trackEvent('successful-login-freemium', eventData);\n};\n\nexport const trackUserLogged = (userId) => {\n // const dataLayerInitialized = window.dataLayer.find((e) => e.event == 'dataLayer-initialized');\n\n // if (dataLayerInitialized) {\n // dataLayerPush({\n // ...dataLayerInitialized,\n // 'userId': userId,\n // });\n // }\n};\n","export { default } from './main';\n","import React, { useEffect } from 'react';\nimport { useSortBy, useTable } from \"react-table\";\nimport { useColumns } from \"../../../shared/components/Table/utils\";\nimport Table from \"../../../shared/components/Table\";\nimport { NoResults } from \"../../../shared/svg/Svg\";\nimport { getEmptyStatTableValuesAccessors } from \"../../../shared/utils\";\nimport { useReactAppState } from \"../../../shared/containers/utils\";\nimport { round } from \"../../../../libraries/_helpers\";\nimport { averageValues } from '../../utils';\n\nconst PlayersCareerTable = ({ baseClass, emptyResultsComponent, playerData, statType, order, setOrder }) => {\n const { t } = useReactAppState();\n const columns = useColumns(statType, playerData);\n const columnAccessors = columns[0].columns.map((el) => el?.accessor);\n const getTotal = (columnAccessors, playerData) => {\n if (columnAccessors?.length && playerData?.length) {\n const total = {};\n const totalRecordsCount = {};\n\n columnAccessors.forEach((accessor) => {\n Object.defineProperty(total, accessor, {\n value: accessor === \"date\" ? t(\"total\") : (accessor === \"name\" ? \"\" : 0),\n writable: true,\n enumerable: true\n });\n });\n\n const keys = Object.keys(total);\n\n playerData.forEach((data) => {\n keys.forEach((key) => {\n if (total?.hasOwnProperty(key) && key !== \"name\" && key !== \"date\") {\n total[key] = data[key] ? round(total[key] + data[key], 1) : round(total[key] + 0, 1);\n }\n if(data[key]){\n totalRecordsCount[key] = (totalRecordsCount[key] || 0) + 1;\n }\n });\n });\n\n const averageKeys = Object.keys(averageValues);\n\n averageKeys.forEach((key) => {\n if (key in total && key in totalRecordsCount) {\n total[key] = round(total[key] / totalRecordsCount[key], 2);\n }\n });\n\n\n return total;\n } else {\n return null;\n }\n };\n\n const totalColumn = getTotal(columnAccessors, playerData);\n\n if (totalColumn) {\n playerData.push(totalColumn);\n }\n\n const {\n getTableProps,\n getTableBodyProps,\n headerGroups,\n rows,\n prepareRow,\n state: { sortBy },\n } = useTable(\n {\n columns,\n data: playerData && playerData.length > 0\n ? playerData\n : getEmptyStatTableValuesAccessors(30, columnAccessors).items,\n autoResetPage: true,\n autoResetSortBy: false,\n manualSortBy: true,\n disableMultiSort: true,\n disableSortRemove: true,\n initialState: {\n sortBy: [{ id: order?.id, desc: order?.desc }]\n }\n },\n useSortBy,\n );\n\n const { desc: descending, id } = sortBy[0] || {};\n\n useEffect(() => {\n if (id != order?.id || order?.desc != descending) {\n setOrder({ id, desc: descending });\n }\n }, [descending, id]);\n\n return (\n <>\n \n {\n rows.length < 1\n ? (\n <>\n
\n \n {\n emptyResultsComponent ? emptyResultsComponent : null\n }\n
\n \n )\n : null\n }\n \n );\n};\n\nexport default PlayersCareerTable;\n","export { default } from './PlayersCareerTable';\n","import React, { useState, useMemo, useEffect } from 'react';\nimport { useQuery } from \"react-query\";\nimport { statTypes } from \"../shared/components/Table/utils\";\nimport { fetchClient } from \"../shared/api/fetching\";\nimport PlayersCareerTable from \"./components/PlayersCareerTable\";\nimport { apiURL, mlsPlayerCareerStatsAPI } from \"../shared/api/variables\";\nimport Dropdown from \"../shared/components/Dropdown\";\nimport ButtonGroup from \"../shared/components/ButtonGroup\";\nimport ToggleButton from \"../shared/components/ToggleButton\";\nimport { formatSeasonStatsData, formatRegularSeasonStatsData, formatPostSeasonStatsData } from './utils';\nimport { useReactAppState } from \"../shared/containers/utils\";\nimport { NoResults } from \"../shared/svg/Svg\";\n\nfunction PlayersCareerStats({ options }) {\n const customCompetition = options?.competitionId ? options?.competitionId : \"98\";\n const initialStatType = options?.position === \"goalkeeper\" ? statTypes.playersCareerStatsGoalKeeping : statTypes.playersCareerStatsGeneral;\n const [order, setOrder] = useState({ id: \"date\", desc: true });\n const [statType, setStatType] = useState(initialStatType);\n\n const { t, mediaQueries } = useReactAppState();\n const { isLargeMin } = mediaQueries || {};\n\n const endpointKey = useMemo(() => {\n return `currentQueryType:statType:${statType ? statType : initialStatType}-orderType:${order?.desc}:-orderBy:${order?.id}`;\n }, [statType, order]);\n\n useEffect(() => {\n setOrder({ id: \"date\", desc: true });\n }, [statType]);\n\n const playerStatsEndpoint = () => {\n return mlsPlayerCareerStatsAPI({ playerOptaId: options?.player?.optaId, desc: order?.desc, orderBy: order?.id, filterType: options?.filterType, competitionId: customCompetition });\n };\n\n const {\n data: statsData,\n isLoading: statsLoading\n } = useQuery({\n queryKey: [`mls-players-career-stats-${options?.filterType}-${endpointKey}`],\n queryFn: () => fetchClient({ endpoint: playerStatsEndpoint(), apiURL: apiURL.statsAPI })\n });\n\n let formatStatsData = [];\n\n if (options?.filterType === \"MLS Regular Season\") {\n formatStatsData = statsData ? formatRegularSeasonStatsData(statsData) : [];\n }\n\n if (options?.filterType === \"MLS Post Season\") {\n formatStatsData = statsData ? formatPostSeasonStatsData(statsData) : [];\n }\n\n if (options?.filterType === \"Custom Competition\") {\n formatStatsData = statsData ? formatSeasonStatsData(statsData) : [];\n }\n\n return (\n <>\n {statsLoading ||\n formatStatsData?.length ?\n
\n {options?.title ?\n <>\n
\n
\n {t(options?.title)}\n
\n
\n
\n
\n {t(options?.title)}\n
\n
\n \n : null\n }\n
\n {\n isLargeMin\n ? (\n setStatType(e.target.value)}\n aria-label=\"statistics category\"\n >\n \n {t(\"stats_general\")}\n \n \n {t(\"stats_passing\")}\n \n\n \n {t(\"stats_attacking\")}\n \n\n \n {t(\"stats_defending\")}\n \n \n )\n : (\n setStatType(val)}\n displayKey={\"name\"}\n valueKey={\"statType\"}\n items={[\n {\n statType: initialStatType,\n name: t(\"stats_general\")\n },\n {\n statType: statTypes.playersCareerStatsPassing,\n name: t(\"stats_passing\")\n },\n {\n statType: statTypes.playersCareerStatsAttacking,\n name: t(\"stats_attacking\")\n },\n {\n statType: statTypes.playersCareerStatsDefending,\n name: t(\"stats_defending\")\n }]}\n currentValue={statType}\n />\n )\n }\n
\n {\n statsLoading ||\n formatStatsData?.length ?\n \n }\n />\n :\n
\n \n
{t(\"no_match_log_available\")}
\n
\n }\n
\n :\n
\n \n
{t(\"no_stats_available\")}
\n
\n }\n \n );\n}\n\n// eslint-disable-next-line no-func-assign\nPlayersCareerStats = React.memo(PlayersCareerStats);\n\nexport default PlayersCareerStats;\n","import { createContext, useContext } from \"react\";\nimport { calculatePercentage, round, calculateSubtractedValues, calculateSum, decimalRound } from \"../../libraries/_helpers\";\n\nexport const StatsContext = createContext();\nStatsContext.displayName = 'Stats';\n\nexport function useStatsData() {\n const context = useContext(StatsContext);\n if (context === undefined) {\n throw new Error('useStatsData must be used within a or ');\n }\n return context;\n}\n\nexport function formatSeasonStatsData(data) {\n if (!data) {\n return [];\n }\n\n return data.map(el => {\n const { statistics, club, season } = el || {};\n\n const {\n goals,\n goal_assist,\n total_scoring_att,\n ontarget_scoring_att,\n accurate_pass,\n saves,\n accurate_long_balls,\n failed_long_balls,\n clearance,\n penalty_save,\n penalty_faced,\n mins_played,\n goals_conceded,\n clean_sheet,\n interception,\n attempts_conceded_ibox,\n expected_goals_conceded,\n attempts_conceded_obox,\n expected_assists,\n total_att_assist,\n accurate_fwd_zone_pass,\n accurate_back_zone_pass,\n accurate_cross,\n successful_short_pass,\n accurate_launches,\n failed_launches,\n expected_goals,\n att_ibox_goal,\n att_obox_goal,\n att_hd_goal,\n att_pen_goal,\n att_pen_taken,\n total_pass,\n total_offside,\n game_started,\n games_played,\n turnover,\n yellow_card,\n total_red_card,\n fk_foul_lost,\n fk_foul_won,\n corner_taken,\n duel_won,\n aerial_duel,\n duel,\n accurate_shooting_per,\n } = statistics || {};\n\n const { name } = club || {};\n\n const {\n opta_id\n } = season || {};\n\n return {\n date: opta_id ? opta_id : null,\n name: name ? name : null,\n games_played: games_played ? games_played : 0,\n game_started: game_started ? game_started : 0,\n expected_goals_minus_goals: round(calculateSubtractedValues(expected_goals, goals), 1),\n att_ibox_goal: att_ibox_goal ? att_ibox_goal : 0,\n att_obox_goal: att_obox_goal ? att_obox_goal : 0,\n att_hd_goal: att_hd_goal ? att_hd_goal : 0,\n att_pen_goal: att_pen_goal ? att_pen_goal : 0,\n att_pen_taken: att_pen_taken ? att_pen_taken : 0,\n att_pen_percentage: calculatePercentage(att_pen_goal, att_pen_taken),\n accurate_shooting_per: accurate_shooting_per || calculatePercentage(goals, total_scoring_att),\n goals_assists: calculateSum(goals, goal_assist),\n expected_goals_assists: round(calculateSum(expected_goals, expected_assists), 1),\n expected_assists_minus_assists: round(calculateSubtractedValues(expected_assists, goal_assist), 1),\n launches_attempted: calculateSum(accurate_launches, failed_launches),\n shots_against: calculateSum(attempts_conceded_ibox, attempts_conceded_obox),\n headed_duel_percentage: calculatePercentage(aerial_duel, duel),\n ground_duel_percentage: calculatePercentage(duel_won, duel),\n long_ball_percentage: calculatePercentage(\n accurate_long_balls,\n accurate_long_balls + failed_long_balls\n ),\n penalty_kick_save_percentage: calculatePercentage(penalty_save, penalty_faced),\n save_percentage: calculatePercentage(saves, calculateSum(goals_conceded, saves)),\n saves: saves ? saves : 0,\n clearance: clearance ? clearance : 0,\n penalty_faced: penalty_faced ? penalty_faced : 0,\n penalty_save: penalty_save ? penalty_save : 0,\n interception: interception ? interception : 0,\n clean_sheet: clean_sheet ? clean_sheet : 0,\n expected_goals_conceded: expected_goals_conceded ? round(expected_goals_conceded, 1) : 0,\n successful_short_pass: successful_short_pass ? successful_short_pass : 0,\n accurate_long_balls: accurate_long_balls || 0,\n expected_assists: expected_assists ? round(expected_assists, 1) : 0,\n total_att_assist: total_att_assist ? total_att_assist : 0,\n accurate_pass: accurate_pass ? accurate_pass : 0,\n total_pass: total_pass ? total_pass : 0,\n accurate_fwd_zone_pass: accurate_fwd_zone_pass ? accurate_fwd_zone_pass : 0,\n accurate_back_zone_pass: accurate_back_zone_pass ? accurate_back_zone_pass : 0,\n accurate_cross: accurate_cross ? accurate_cross : 0,\n mins_played: mins_played ? mins_played : 0,\n goals: goals ? goals : 0,\n goal_assist: goal_assist ? goal_assist : 0,\n total_scoring_att: total_scoring_att ? total_scoring_att : 0,\n ontarget_scoring_att: ontarget_scoring_att ? ontarget_scoring_att : 0,\n accurate_pass_per: calculatePercentage(accurate_pass, total_pass),\n total_offside: total_offside ? total_offside : 0,\n turnover: turnover ? turnover : 0,\n goals_conceded: goals_conceded ? round(goals_conceded, 1) : 0,\n yellow_card: yellow_card ? yellow_card : 0,\n total_red_card: total_red_card ? total_red_card : 0,\n fk_foul_lost: fk_foul_lost ? fk_foul_lost : 0,\n fk_foul_won: fk_foul_won ? fk_foul_won : 0,\n corner_taken: corner_taken ? corner_taken : 0,\n };\n });\n}\n\nexport function formatRegularSeasonStatsData(data) {\n if (!data) {\n return [];\n }\n\n return data.map(el => {\n const { regular_season_statistics, club, season } = el || {};\n\n const {\n goals,\n goal_assist,\n total_scoring_att,\n ontarget_scoring_att,\n accurate_pass,\n saves,\n accurate_long_balls,\n failed_long_balls,\n clearance,\n penalty_save,\n penalty_faced,\n mins_played,\n goals_conceded,\n clean_sheet,\n interception,\n attempts_conceded_ibox,\n expected_goals_conceded,\n attempts_conceded_obox,\n expected_assists,\n total_att_assist,\n accurate_fwd_zone_pass,\n accurate_back_zone_pass,\n accurate_cross,\n successful_short_pass,\n accurate_launches,\n failed_launches,\n expected_goals,\n att_ibox_goal,\n att_obox_goal,\n att_hd_goal,\n att_pen_goal,\n att_pen_taken,\n total_pass,\n total_offside,\n game_started,\n games_played,\n turnover,\n yellow_card,\n total_red_card,\n fk_foul_lost,\n fk_foul_won,\n corner_taken,\n duel_won,\n aerial_duel,\n duel,\n accurate_shooting_per,\n accurate_cross_per,\n att_freekick_total,\n att_rf_total,\n att_lf_total,\n att_hd_total,\n total_clearance,\n aerial_won\n } = regular_season_statistics || {};\n\n const { name } = club || {};\n\n const {\n opta_id\n } = season || {};\n\n return {\n date: opta_id ? opta_id : null,\n name: name ? name : null,\n games_played: games_played ? games_played : 0,\n game_started: game_started ? game_started : 0,\n expected_goals_minus_goals: round(calculateSubtractedValues(expected_goals, goals), 1),\n att_ibox_goal: att_ibox_goal ? att_ibox_goal : 0,\n att_obox_goal: att_obox_goal ? att_obox_goal : 0,\n att_hd_goal: att_hd_goal ? att_hd_goal : 0,\n att_pen_goal: att_pen_goal ? att_pen_goal : 0,\n att_pen_taken: att_pen_taken ? att_pen_taken : 0,\n att_pen_percentage: calculatePercentage(att_pen_goal, att_pen_taken),\n accurate_shooting_per: accurate_shooting_per || calculatePercentage(goals, total_scoring_att),\n goals_assists: calculateSum(goals, goal_assist),\n expected_goals_assists: round(calculateSum(expected_goals, expected_assists), 1),\n expected_assists_minus_assists: round(calculateSubtractedValues(expected_assists, goal_assist), 1),\n launches_attempted: calculateSum(accurate_launches, failed_launches),\n shots_against: calculateSum(attempts_conceded_ibox, attempts_conceded_obox),\n headed_duel_percentage: calculatePercentage(aerial_duel, duel),\n ground_duel_percentage: calculatePercentage(duel_won, duel),\n long_ball_percentage: calculatePercentage(\n accurate_long_balls,\n accurate_long_balls + failed_long_balls\n ),\n penalty_kick_save_percentage: calculatePercentage(penalty_save, penalty_faced),\n save_percentage: calculatePercentage(saves, calculateSum(goals_conceded, saves)),\n saves: saves ? saves : 0,\n clearance: clearance ? clearance : 0,\n penalty_faced: penalty_faced ? penalty_faced : 0,\n penalty_save: penalty_save ? penalty_save : 0,\n interception: interception ? interception : 0,\n clean_sheet: clean_sheet ? clean_sheet : 0,\n expected_goals_conceded: expected_goals_conceded ? round(expected_goals_conceded, 1) : 0,\n successful_short_pass: successful_short_pass ? successful_short_pass : 0,\n accurate_long_balls: accurate_long_balls || 0,\n expected_assists: expected_assists ? round(expected_assists, 1) : 0,\n total_att_assist: total_att_assist ? total_att_assist : 0,\n accurate_pass: accurate_pass ? accurate_pass : 0,\n total_pass: total_pass ? total_pass : 0,\n accurate_fwd_zone_pass: accurate_fwd_zone_pass ? accurate_fwd_zone_pass : 0,\n accurate_back_zone_pass: accurate_back_zone_pass ? accurate_back_zone_pass : 0,\n accurate_cross: accurate_cross ? accurate_cross : 0,\n mins_played: mins_played ? mins_played : 0,\n goals: goals ? goals : 0,\n goal_assist: goal_assist ? goal_assist : 0,\n total_scoring_att: total_scoring_att ? total_scoring_att : 0,\n ontarget_scoring_att: ontarget_scoring_att ? ontarget_scoring_att : 0,\n accurate_pass_per: calculatePercentage(accurate_pass, total_pass),\n total_offside: total_offside ? total_offside : 0,\n turnover: turnover ? turnover : 0,\n goals_conceded: goals_conceded ? round(goals_conceded, 1) : 0,\n yellow_card: yellow_card ? yellow_card : 0,\n total_red_card: total_red_card ? total_red_card : 0,\n fk_foul_lost: fk_foul_lost ? fk_foul_lost : 0,\n fk_foul_won: fk_foul_won ? fk_foul_won : 0,\n corner_taken: corner_taken ? corner_taken : 0,\n accurate_cross_per: decimalRound(accurate_cross_per) || 0,\n att_freekick_total: att_freekick_total || 0,\n att_rf_total: att_rf_total || 0,\n att_lf_total: att_lf_total || 0,\n att_hd_total: att_hd_total || 0,\n expected_goals: decimalRound(expected_goals) || 0,\n aerial_duel: aerial_duel || 0,\n aerial_duel_per: calculatePercentage(aerial_won, aerial_duel),\n total_clearance: total_clearance || 0,\n };\n });\n}\n\nexport function formatPostSeasonStatsData(data) {\n if (!data) {\n return [];\n }\n\n return data\n .filter((el) => {\n const { postseason_statistics } = el || {};\n const {\n mins_played,\n } = postseason_statistics || {};\n\n return (\n mins_played\n );\n })\n .map(el => {\n const { postseason_statistics, club, season } = el || {};\n\n const {\n goals,\n goal_assist,\n total_scoring_att,\n ontarget_scoring_att,\n accurate_pass,\n saves,\n accurate_long_balls,\n failed_long_balls,\n clearance,\n penalty_save,\n penalty_faced,\n mins_played,\n goals_conceded,\n clean_sheet,\n interception,\n attempts_conceded_ibox,\n expected_goals_conceded,\n attempts_conceded_obox,\n expected_assists,\n total_att_assist,\n accurate_fwd_zone_pass,\n accurate_back_zone_pass,\n accurate_cross,\n successful_short_pass,\n accurate_launches,\n failed_launches,\n expected_goals,\n att_ibox_goal,\n att_obox_goal,\n att_hd_goal,\n att_pen_goal,\n att_pen_taken,\n total_pass,\n total_offside,\n game_started,\n games_played,\n turnover,\n yellow_card,\n total_red_card,\n fk_foul_lost,\n fk_foul_won,\n corner_taken,\n duel_won,\n aerial_duel,\n duel,\n accurate_shooting_per,\n } = postseason_statistics || {};\n\n const { name } = club || {};\n\n const {\n opta_id\n } = season || {};\n\n return {\n date: opta_id ? opta_id : null,\n name: name ? name : null,\n games_played: games_played ? games_played : 0,\n game_started: game_started ? game_started : 0,\n expected_goals_minus_goals: round(calculateSubtractedValues(expected_goals, goals), 1),\n att_ibox_goal: att_ibox_goal ? att_ibox_goal : 0,\n att_obox_goal: att_obox_goal ? att_obox_goal : 0,\n att_hd_goal: att_hd_goal ? att_hd_goal : 0,\n att_pen_goal: att_pen_goal ? att_pen_goal : 0,\n att_pen_taken: att_pen_taken ? att_pen_taken : 0,\n att_pen_percentage: calculatePercentage(att_pen_goal, att_pen_taken),\n accurate_shooting_per: accurate_shooting_per || calculatePercentage(goals, total_scoring_att),\n goals_assists: calculateSum(goals, goal_assist),\n expected_goals_assists: round(calculateSum(expected_goals, expected_assists), 1),\n expected_assists_minus_assists: round(calculateSubtractedValues(expected_assists, goal_assist), 1),\n launches_attempted: calculateSum(accurate_launches, failed_launches),\n shots_against: calculateSum(attempts_conceded_ibox, attempts_conceded_obox),\n headed_duel_percentage: calculatePercentage(aerial_duel, duel),\n ground_duel_percentage: calculatePercentage(duel_won, duel),\n long_ball_percentage: calculatePercentage(\n accurate_long_balls,\n accurate_long_balls + failed_long_balls\n ),\n penalty_kick_save_percentage: calculatePercentage(penalty_save, penalty_faced),\n save_percentage: calculatePercentage(saves, calculateSum(goals_conceded, saves)),\n saves: saves ? saves : 0,\n clearance: clearance ? clearance : 0,\n penalty_faced: penalty_faced ? penalty_faced : 0,\n penalty_save: penalty_save ? penalty_save : 0,\n interception: interception ? interception : 0,\n clean_sheet: clean_sheet ? clean_sheet : 0,\n expected_goals_conceded: expected_goals_conceded ? round(expected_goals_conceded, 1) : 0,\n successful_short_pass: successful_short_pass ? successful_short_pass : 0,\n accurate_long_balls: accurate_long_balls || 0,\n expected_assists: expected_assists ? round(expected_assists, 1) : 0,\n total_att_assist: total_att_assist ? total_att_assist : 0,\n accurate_pass: accurate_pass ? accurate_pass : 0,\n total_pass: total_pass ? total_pass : 0,\n accurate_fwd_zone_pass: accurate_fwd_zone_pass ? accurate_fwd_zone_pass : 0,\n accurate_back_zone_pass: accurate_back_zone_pass ? accurate_back_zone_pass : 0,\n accurate_cross: accurate_cross ? accurate_cross : 0,\n mins_played: mins_played ? mins_played: 0,\n goals: goals ? goals : 0,\n goal_assist: goal_assist ? goal_assist : 0,\n total_scoring_att: total_scoring_att ? total_scoring_att : 0,\n ontarget_scoring_att: ontarget_scoring_att ? ontarget_scoring_att : 0,\n accurate_pass_per: calculatePercentage(accurate_pass, total_pass),\n total_offside: total_offside ? total_offside : 0,\n turnover: turnover ? turnover : 0,\n goals_conceded: goals_conceded ? round(goals_conceded, 1) : 0,\n yellow_card: yellow_card ? yellow_card : 0,\n total_red_card: total_red_card ? total_red_card : 0,\n fk_foul_lost: fk_foul_lost ? fk_foul_lost : 0,\n fk_foul_won: fk_foul_won ? fk_foul_won : 0,\n corner_taken: corner_taken ? corner_taken : 0,\n };\n });\n}\n\nexport const averageValues = {\n accurate_pass_per: true,\n accurate_shooting_per: true,\n att_pen_percentage: true,\n att_pen_taken: true,\n ground_duel_percentage: true,\n headed_duel_percentage: true,\n long_ball_percentage: true,\n penalty_kick_save_percentage: true,\n save_percentage: true,\n};\n\n","import React, { forwardRef, useImperativeHandle } from 'react';\nimport ReactDOM from 'react-dom';\nimport useIsFocusVisible from \"../../hooks/useIsFocusVisible\";\nimport useEventCallback from \"../../hooks/useEventCallback\";\nimport useForkRef from \"../../hooks/useForkRef\";\n\nconst ButtonBase = forwardRef(function ButtonBase(props, ref) {\n const {\n action,\n buttonRef: buttonRefProp,\n children,\n className,\n component = 'button',\n disabled = false,\n onBlur,\n onClick,\n onFocus,\n onFocusVisible,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseLeave,\n onMouseUp,\n onTouchEnd,\n onTouchMove,\n onTouchStart,\n onDragLeave,\n tabIndex = 0,\n type = 'button',\n ...other\n } = props;\n\n const buttonRef = React.useRef(null);\n function getButtonNode() {\n // eslint-disable-next-line react/no-find-dom-node\n return ReactDOM.findDOMNode(buttonRef.current);\n }\n\n const [focusVisible, setFocusVisible] = React.useState(false);\n if (disabled && focusVisible) {\n setFocusVisible(false);\n }\n const { isFocusVisible, ref: focusVisibleRef } = useIsFocusVisible();\n\n useImperativeHandle(\n action,\n () => ({\n focusVisible: () => {\n setFocusVisible(true);\n buttonRef.current?.focus();\n },\n }),\n [],\n );\n\n const handleFocus = useEventCallback((event) => {\n if (!buttonRef.current) {\n buttonRef.current = event.currentTarget;\n }\n\n if (isFocusVisible(event)) {\n setFocusVisible(true);\n\n if (onFocusVisible) {\n onFocusVisible(event);\n }\n }\n\n if (onFocus) {\n onFocus(event);\n }\n });\n\n const isNonNativeButton = () => {\n const button = getButtonNode();\n return component && component !== 'button' && !(button.tagName === 'A' && button.href);\n };\n\n const handleKeyDown = useEventCallback((event) => {\n if (event.target === event.currentTarget && isNonNativeButton() && event.key === ' ') {\n event.preventDefault();\n }\n\n if (onKeyDown) {\n onKeyDown(event);\n }\n\n // Keyboard accessibility for non interactive elements\n if (\n event.target === event.currentTarget &&\n isNonNativeButton() &&\n event.key === 'Enter' &&\n !disabled\n ) {\n event.preventDefault();\n if (onClick) {\n onClick(event);\n }\n }\n });\n\n const handleKeyUp = useEventCallback((event) => {\n if (onKeyUp) {\n onKeyUp(event);\n }\n\n if (\n onClick &&\n event.target === event.currentTarget &&\n isNonNativeButton() &&\n event.key === ' ' &&\n !event.defaultPrevented\n ) {\n onClick(event);\n }\n });\n\n let ComponentProp = component;\n\n if (other?.href) {\n ComponentProp = 'a';\n }\n\n const buttonProps = {\n type,\n disabled\n };\n\n const handleUserRef = useForkRef(buttonRefProp, ref);\n const handleOwnRef = useForkRef(focusVisibleRef, buttonRef);\n const handleRef = useForkRef(handleUserRef, handleOwnRef);\n\n return (\n \n {children}\n \n );\n});\n\nexport default ButtonBase;\n","export { default } from './ButtonBase';\n","import React, { useState, forwardRef } from 'react';\n\nfunction isValueSelected(value, candidate) {\n if (candidate === undefined || value === undefined) {\n return false;\n }\n\n if (Array.isArray(candidate)) {\n return candidate.indexOf(value) >= 0;\n }\n\n return value === candidate;\n}\n\nconst ButtonGroup = forwardRef(function ToggleButton(props, ref) {\n const {\n children,\n className,\n onChange,\n value,\n } = props;\n\n const handleChange = (event, buttonValue) => {\n if (!onChange) {\n return;\n }\n\n onChange(event, value === buttonValue ? null : buttonValue);\n };\n\n return (\n \n {React.Children.map(children, (child) => {\n if (!React.isValidElement(child)) {\n return null;\n }\n\n return React.cloneElement(child, {\n className: child.props.className,\n onChange: handleChange,\n selected:\n child.props.selected === undefined\n ? isValueSelected(child.props.value, value)\n : child.props.selected,\n });\n })}\n \n );\n});\n\nexport default ButtonGroup;\n","export { default } from './ButtonGroup';\n","import React, { useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport { checkIfObject } from \"../../../../libraries/_helpers\";\nimport useResize from \"../../hooks/useResize\";\nimport { trackFilterClick } from '../../../../libraries/_modules/tracking/helpers';\nimport { translateTypes } from \"../../utils\";\nimport { useReactAppState } from \"../../containers/utils\";\n\nfunction findOption({ items, value, valueKey }) {\n if (!value || !items || items.length === 0) {\n return;\n }\n\n const matchedOption = (items || []).find((item) => {\n if ((valueKey && item[valueKey] && item[valueKey].toString() === value?.toString()) || item?.toString() === value?.toString()) {\n return item;\n }\n });\n\n return matchedOption ? matchedOption : items[0];\n}\n\nconst trackClick = (statsCategory, filterType, clickItem) => {\n trackFilterClick({ statsCategory, filterType, clickItem });\n};\n\nconst Dropdown = ({ extraClass, onChangeFn, items, type, currentValue, valueKey, displayKey, autoWidth = true, disabled = false, ariaLabel = \"\", title = \"\" }) => {\n const optionFound = useMemo(() => findOption({ items, value: currentValue, valueKey }), [items, currentValue, valueKey]);\n\n const ref = useRef(null);\n const { t } = useReactAppState() || {};\n\n function handleResize() {\n if (ref?.current && autoWidth) {\n setWidth(ref.current.offsetWidth + 48);\n }\n }\n\n const [width, setWidth] = useState(\"auto\");\n const [selectedOption, setSelectedOption] = useState(optionFound);\n\n useLayoutEffect(() => {\n setSelectedOption(optionFound);\n }, [items, currentValue]);\n\n useLayoutEffect(() => {\n handleResize();\n }, [items, selectedOption]);\n\n useResize(handleResize, 1000);\n\n const handleChange = React.useCallback((e) => {\n onChangeFn(e.target.value);\n trackClick('schedule', type, e.target.options[e.target.selectedIndex].innerText);\n }, [onChangeFn], []);\n\n return (\n <>\n \n {\n items\n ? items.map((item, index) => {\n const isObject = checkIfObject(item);\n return (\n \n {isObject ? translateTypes(t, item[displayKey]) : translateTypes(t, item)}\n \n );\n })\n : null\n }\n \n
\n \n {\n displayKey && selectedOption && selectedOption[displayKey]\n ? translateTypes(t, selectedOption[displayKey])\n : translateTypes(t, selectedOption)\n }\n \n
\n \n );\n};\n\nexport default Dropdown;\n","export { default } from './Dropdown';\n","import React from 'react';\nimport { getMinimumCount, getStandingsConfig, useHorizontalScrollSpy, getPlayoffCounter } from \"./utils\";\n\nfunction Table({\n baseClass,\n getTableProps,\n getTableBodyProps,\n headerGroups,\n rows,\n prepareRow,\n tableConfig,\n extraClasses,\n tableIsGrouped,\n tableReferences,\n headerPure,\n isGroupedByDivision\n}) {\n const [ref, isOriginalPosition] = useHorizontalScrollSpy(headerGroups);\n const emptyRows = !rows || rows.length < 1;\n const { homeAdvantage, topClubsLegend, playoffQualifiedEastConference, playoffQualifiedWestConference, playoffQualifiedCentralConference, homeAdvantageLegend, topClubs } = tableConfig || {};\n const header = headerGroups?.[0]?.headers?.[0]?.Header;\n\n let topClubsCounter = topClubsLegend ? getMinimumCount(topClubs, homeAdvantage, 1) : null;\n const playoffQualified = Math.max(Number.isInteger(playoffQualifiedEastConference) ? playoffQualifiedEastConference : 0, Number.isInteger(playoffQualifiedWestConference) ? playoffQualifiedWestConference : 0, Number.isInteger(playoffQualifiedCentralConference) ? playoffQualifiedCentralConference : 0);\n let homeAdvantageCounter = homeAdvantageLegend && header && !header.includes('none') ? getMinimumCount(homeAdvantage, playoffQualified, 4) : null;\n let playoffQualifiedCounter = !isGroupedByDivision ? getPlayoffCounter(headerPure, playoffQualifiedEastConference, playoffQualifiedWestConference, playoffQualifiedCentralConference) : null;\n\n return (\n <>\n
\n \n \n {headerGroups.map((headerGroup, headerGroupIndex) => (\n \n {headerGroup.headers.map((column, tableHeaderIndex) => (\n \n ))}\n \n ))}\n \n \n {!emptyRows\n ? rows.map((row, rowIndex) => {\n prepareRow(row);\n\n if (rowIndex !== 0 && topClubsCounter > 0) {\n topClubsCounter--;\n }\n\n if (rowIndex !== 0 && playoffQualifiedCounter > 0) {\n playoffQualifiedCounter--;\n }\n\n if (rowIndex !== 0 && homeAdvantageCounter > 0) {\n homeAdvantageCounter--;\n }\n\n return (\n \n {row.cells.map((cell, index) => {\n return (\n \n );\n })}\n \n );\n }) : null\n }\n \n
{\n if (e.key === \"Enter\") {\n column.toggleSortBy(!column.isSortedDesc);\n }\n }}\n {...column.getHeaderProps(column.getSortByToggleProps({ title: undefined }))}>\n \n \n {column.render(\"Header\")}\n \n {\n column.canSort\n ?
\n : null\n }\n
\n
\n {cell.render(\"Cell\")}\n
\n
\n
\n \n );\n}\n\n// eslint-disable-next-line no-func-assign\nTable = React.memo(Table);\n\nexport default Table;\n","export { default } from './Table';\n","import React, { forwardRef } from 'react';\nimport ButtonBase from \"../ButtonBase\";\n\nconst ToggleButton = forwardRef(function ToggleButton(props, ref) {\n const {\n children,\n label,\n className,\n disabled = false,\n onChange,\n onClick,\n selected,\n value,\n ...other\n } = props;\n\n const handleClick = (event) => {\n if (onClick) {\n onClick(event, value);\n if (event.isDefaultPrevented()) {\n return;\n }\n }\n\n if (onChange) {\n onChange(event, value);\n }\n };\n\n return (\n \n {\n label\n ? {children}\n : children\n }\n \n );\n});\n\nexport default ToggleButton;\n","export { default } from './ToggleButton';\n","import React, { useRef, useCallback } from 'react';\n\nconst useEnhancedEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;\n\nexport default function useEventCallback(fn) {\n const ref = useRef(fn);\n\n useEnhancedEffect(() => {\n ref.current = fn;\n });\n\n return useCallback((...args) => (0, ref.current)(...args), []);\n}\n","import * as React from 'react';\n\nexport default function useForkRef(refA, refB) {\n /**\n * This will create a new function if the ref props change and are defined.\n * This means react will call the old forkRef with `null` and the new forkRef\n * with the ref. Cleanup naturally emerges from this behavior\n */\n function setRef(ref, value) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n }\n\n return React.useMemo(() => {\n if (refA == null && refB == null) {\n return null;\n }\n return (refValue) => {\n setRef(refA, refValue);\n setRef(refB, refValue);\n };\n }, [refA, refB]);\n}\n","// based on https://github.com/WICG/focus-visible/blob/v4.1.5/src/focus-visible.js\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\n\nlet hadKeyboardEvent = true;\nlet hadFocusVisibleRecently = false;\nlet hadFocusVisibleRecentlyTimeout = null;\n\nconst inputTypesWhitelist = {\n text: true,\n search: true,\n url: true,\n tel: true,\n email: true,\n password: true,\n number: true,\n date: true,\n month: true,\n week: true,\n time: true,\n datetime: true,\n 'datetime-local': true,\n};\n\n/**\n * Computes whether the given element should automatically trigger the\n * `focus-visible` class being added, i.e. whether it should always match\n * `:focus-visible` when focused.\n * @param {Element} node\n * @return {boolean}\n */\nfunction focusTriggersKeyboardModality(node) {\n const { type, tagName } = node;\n\n if (tagName === 'INPUT' && inputTypesWhitelist[type] && !node.readOnly) {\n return true;\n }\n\n if (tagName === 'TEXTAREA' && !node.readOnly) {\n return true;\n }\n\n if (node.isContentEditable) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Keep track of our keyboard modality state with `hadKeyboardEvent`.\n * If the most recent user interaction was via the keyboard;\n * and the key press did not include a meta, alt/option, or control key;\n * then the modality is keyboard. Otherwise, the modality is not keyboard.\n * @param {KeyboardEvent} event\n */\nfunction handleKeyDown(event) {\n if (event.metaKey || event.altKey || event.ctrlKey) {\n return;\n }\n hadKeyboardEvent = true;\n}\n\n/**\n * If at any point a user clicks with a pointing device, ensure that we change\n * the modality away from keyboard.\n * This avoids the situation where a user presses a key on an already focused\n * element, and then clicks on a different element, focusing it with a\n * pointing device, while we still think we're in keyboard modality.\n */\nfunction handlePointerDown() {\n hadKeyboardEvent = false;\n}\n\nfunction handleVisibilityChange() {\n if (this.visibilityState === 'hidden') {\n // If the tab becomes active again, the browser will handle calling focus\n // on the element (Safari actually calls it twice).\n // If this tab change caused a blur on an element with focus-visible,\n // re-apply the class when the user switches back to the tab.\n if (hadFocusVisibleRecently) {\n hadKeyboardEvent = true;\n }\n }\n}\n\nfunction prepare(doc) {\n doc.addEventListener('keydown', handleKeyDown, true);\n doc.addEventListener('mousedown', handlePointerDown, true);\n doc.addEventListener('pointerdown', handlePointerDown, true);\n doc.addEventListener('touchstart', handlePointerDown, true);\n doc.addEventListener('visibilitychange', handleVisibilityChange, true);\n}\n\nexport function teardown(doc) {\n doc.removeEventListener('keydown', handleKeyDown, true);\n doc.removeEventListener('mousedown', handlePointerDown, true);\n doc.removeEventListener('pointerdown', handlePointerDown, true);\n doc.removeEventListener('touchstart', handlePointerDown, true);\n doc.removeEventListener('visibilitychange', handleVisibilityChange, true);\n}\n\nfunction isFocusVisible(event) {\n const { target } = event;\n try {\n return target.matches(':focus-visible');\n } catch (error) {\n // browsers not implementing :focus-visible will throw a SyntaxError\n // we use our own heuristic for those browsers\n // rethrow might be better if it's not the expected error but do we really\n // want to crash if focus-visible malfunctioned?\n }\n\n // no need for validFocusTarget check. the user does that by attaching it to\n // focusable events only\n return hadKeyboardEvent || focusTriggersKeyboardModality(target);\n}\n\n/**\n * Should be called if a blur event is fired on a focus-visible element\n */\nfunction handleBlurVisible() {\n // To detect a tab/window switch, we look for a blur event followed\n // rapidly by a visibility change.\n // If we don't see a visibility change within 100ms, it's probably a\n // regular focus change.\n hadFocusVisibleRecently = true;\n window.clearTimeout(hadFocusVisibleRecentlyTimeout);\n hadFocusVisibleRecentlyTimeout = window.setTimeout(() => {\n hadFocusVisibleRecently = false;\n }, 100);\n}\n\nexport default function useIsFocusVisible() {\n const ref = React.useCallback((instance) => {\n // eslint-disable-next-line react/no-find-dom-node\n const node = ReactDOM.findDOMNode(instance);\n if (node != null) {\n prepare(node.ownerDocument);\n }\n }, []);\n\n return { isFocusVisible, onBlurVisible: handleBlurVisible, ref };\n}\n","import { useEffect } from 'react';\nimport { debounce } from \"lodash\";\n\nfunction useResize(fn, delay = 1000) {\n useEffect(() => {\n const debouncedHandleResize = debounce(fn, delay);\n\n window.addEventListener('resize', debouncedHandleResize);\n\n return () => {\n window.removeEventListener('resize', debouncedHandleResize);\n };\n });\n}\n\nexport default useResize;\n","import React from \"react\";\n\nexport const chevronDirection = {\n down: \"down\",\n up: \"up\",\n left: \"left\",\n right: \"right\",\n};\n\nexport const Chevron = ({\n useEmptyClasses = false,\n extraClasses,\n direction = chevronDirection.down,\n size = \"small\",\n}) =>\n !useEmptyClasses ? (\n \n \n \n \n \n \n
\n ) : (\n
\n \n \n \n
\n );\n\nexport const Filters = ({ extraClasses, size = \"small\" }) => (\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n);\n\nexport const NoResults = ({ extraClasses, size = \"large\" }) => (\n \n \n \n \n \n \n \n \n \n \n);\n\nexport const MediaPlayingSVG = ({ extraClasses, size = \"large\" }) => (\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n);\n\nexport const CardBackground = ({ extraClasses }) => (\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n);\n\nexport const TriangleSVG = ({ extraClasses, size = \"small\" }) => (\n \n \n \n \n \n \n \n);\n"],"names":[],"sourceRoot":""}