{"version":3,"file":"js/scripts_react_mls-leader-card_main_js.js?_t=a3c489224f47d9fba371","mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AAAA;AAGA;AAkBA;AACA;AACA;AACA;AAEA;AACA;AAAA;AAGA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAWA;AACA;AACA;AAYA;AAAA;AAGA;AAEA;;;;;;;;;;;;;;;;AC/FA;;;;;;;;;;;;;;;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAIA;AACA;AAAA;AAAA;AACA;AAEA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AAAA;AAGA;AAAA;AAAA;AACA;AACA;AAAA;AAGA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAEA;AACA;AAUA;AAAA;AAAA;AACA;AACA;AAAA;AAMA;AACA;AAGA;AAGA;AAEA;;;;;;;;;;;;;;;;AC5EA;;;;;;;;;;;;;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AAEA;AACA;AAAA;AACA;AACA;AACA;AAGA;AACA;AAEA;AACA;AAEA;AAMA;AAGA;AAEA;;;;;;;;;;;;;;;;AC9BA;;;;;;;;;;;;;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAOA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAGA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAkBA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAeA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AACA;AAcA;AAGA;AAEA;;;;;;;;;;;;;;;;;;;;;;AC9EA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAAA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AAEA;AA2BA;AACA;AAIA;AAYA;AAGA;AAEA;;;;;;;;;;;;;;;;AClFA;;;;;;;;;;;;;;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AAGA;AAEA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AAEA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAwBA;AAGA;AAGA;AAEA;;;;;;;;;;;;;;;;AC3EA;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AAEA;AACA;AAEA;AAAA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AAEA;AACA;AAAA;AACA;AACA;AAEA;AAEA;AAAA;AACA;AACA;AAGA;AAEA;AAgBA;AAGA;AAEA;;;;;;;;;;;;;;;;AC/EA;;;;;;;;;;;;;;;;;;ACAA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AAQA;AAEA;AAEA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAiBA;AACA;AAGA;AAGA;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;ACrDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAAA;AAGA;AACA;AAAA;AAGA;AACA;AAAA;AAGA;AACA;AAEA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAYA;AAGA;AAEA;;;;;;;;;;;;;;;;;ACnHA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AAAA;AAGA;AACA;;;;;;;;;;;;;;;;ACbA;AAEA;AACA;AAYA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAiBA;AAEA;;;;;;;;;;;;;;;ACnCA;AAGA;;;;;;;;;;;;;;;;ACJA;;;;;;;;;;;;;;;;ACAA;AAEA;AACA;AAAA;AAEA;AAOA;AAEA;;;;;;;;;;;;;;;;ACdA;;;;;;;;;;;;;;;;;ACAA;AACA;AAEA;AACA;AAEA;AACA;AAEA;;;;;;;;;;;;;;;;ACTA;;;;;;;;;;;;;;;ACAA;AAAA;AAEA;;;;;;;;;;;;;;;;;;;;;;ACFA;AAEA;AAAA;AACA;AACA;AACA;AAEA;AAEA;AAAA;AACA;AACA;AACA;AAEA;AAEA;AAAA;AAAA;AACA;AAEA;AAAA;AAGA;AAAA;AAAA;AACA;AAAA;AAEA;AAAA;AAAA;AACA;AACA;AAAA;AAEA;AACA;AAEA;AASA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AAiBA;AAGA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AAKA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAEA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAKA;AAGA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AAEA;AAAA;AAAA;AACA;AAAA;AAKA;AAAA;AAAA;AACA;AACA;AAAA;AAIA;AAAA;AAAA;AACA;AACA;AAAA;AAIA;AAEA;AAGA;AAEA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAYA;AAMA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAIA;AAIA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AAOA","sources":["webpack://@mlssoccer/netcore/./scripts/react/mls-leader-card/components/ClubLeaderCardBody/ClubLeaderCardBody.js","webpack://@mlssoccer/netcore/./scripts/react/mls-leader-card/components/ClubLeaderCardBody/index.js","webpack://@mlssoccer/netcore/./scripts/react/mls-leader-card/components/ClubLeaderCardFigure/ClubLeaderCardFigure.js","webpack://@mlssoccer/netcore/./scripts/react/mls-leader-card/components/ClubLeaderCardFigure/index.js","webpack://@mlssoccer/netcore/./scripts/react/mls-leader-card/components/ClubLeaderData/ClubLeaderData.js","webpack://@mlssoccer/netcore/./scripts/react/mls-leader-card/components/ClubLeaderData/index.js","webpack://@mlssoccer/netcore/./scripts/react/mls-leader-card/components/LeaderCardLoading/LeaderCardLoading.js","webpack://@mlssoccer/netcore/./scripts/react/mls-leader-card/components/PlayerLeaderCardBody/PlayerLeaderCardBody.js","webpack://@mlssoccer/netcore/./scripts/react/mls-leader-card/components/PlayerLeaderCardBody/index.js","webpack://@mlssoccer/netcore/./scripts/react/mls-leader-card/components/PlayerLeaderCardFigure/PlayerLeaderCardFigure.js","webpack://@mlssoccer/netcore/./scripts/react/mls-leader-card/components/PlayerLeaderCardFigure/index.js","webpack://@mlssoccer/netcore/./scripts/react/mls-leader-card/components/PlayerLeaderData/PlayerLeaderData.js","webpack://@mlssoccer/netcore/./scripts/react/mls-leader-card/components/PlayerLeaderData/index.js","webpack://@mlssoccer/netcore/./scripts/react/mls-leader-card/components/PlayerRankedItem/PlayerRankedItem.js","webpack://@mlssoccer/netcore/./scripts/react/mls-leader-card/main.js","webpack://@mlssoccer/netcore/./scripts/react/mls-leader-card/utils.js","webpack://@mlssoccer/netcore/./scripts/react/shared/components/BlockFooter/BlockFooter.js","webpack://@mlssoccer/netcore/./scripts/react/shared/components/ConditionalWrapper/ConditionalWrapper.js","webpack://@mlssoccer/netcore/./scripts/react/shared/components/ConditionalWrapper/index.js","webpack://@mlssoccer/netcore/./scripts/react/shared/components/ErrorDisplay/ErrorDisplay.js","webpack://@mlssoccer/netcore/./scripts/react/shared/components/ErrorDisplay/index.js","webpack://@mlssoccer/netcore/./scripts/react/shared/components/LoadingDisplay/LoadingDisplay.js","webpack://@mlssoccer/netcore/./scripts/react/shared/components/LoadingDisplay/index.js","webpack://@mlssoccer/netcore/./scripts/react/shared/components/LoadingDisplay/utils.js","webpack://@mlssoccer/netcore/./scripts/react/shared/svg/Svg.js"],"sourcesContent":["import React from \"react\";\nimport BlockFooter from \"../../../shared/components/BlockFooter/BlockFooter\";\nimport { round } from \"../../../../libraries/_helpers\";\nimport { useLeaderCard } from \"../../utils\";\nimport { formatClubStats } from \"../../../shared/utils\";\nimport { useReactAppState } from \"../../../shared/containers/utils\";\n\nfunction ClubLeaderCardBody({ first }) {\n const {\n footer,\n clubsData,\n currentStatType,\n statTableUrl,\n rest,\n mlsPhaseType\n } = useLeaderCard();\n\n const { isLeague, urlList, t } = useReactAppState();\n const { baseUrl } = urlList || {};\n const { club } = first || {};\n const name = club?.shortName || club?.name || club?.abbreviation || \"\";\n\n const backgroundColor = club?.backgroundColor || \"\";\n const roundedFirstStat = first && first[currentStatType] === 0 || first[currentStatType] ? round(first[currentStatType], 2) : \"\";\n const urlWithQueryParams = statTableUrl ? `${statTableUrl}?stat-type=${currentStatType}` : null;\n\n const restClubData = rest ? rest.map(item => {\n const { club } = item || {};\n const { opta_id: clubOptaId } = club || {};\n const restFoundClub = clubsData.find(c => c?.optaId === clubOptaId);\n\n return formatClubStats(item, restFoundClub, mlsPhaseType);\n }) : null;\n\n return (\n
\n
\n
\n
\n {isLeague ?\n \n {name}\n \n :\n <>{name}\n }
\n
\n
{roundedFirstStat}
\n
\n
\n {\n restClubData.map((item, index) => {\n const otherClub = item.club || {};\n const otherClubOptaId = otherClub?.optaId;\n const otherName = otherClub?.shortName || otherClub?.name || otherClub?.abbreviation || \"\";\n const roundedOtherStat = item && item[currentStatType] === 0 || item[currentStatType] ? round(item[currentStatType], 2) : \"\";\n\n if (otherClubOptaId == null) {\n return null;\n }\n\n return (\n \n
\n \n {isLeague ?\n \n {otherName}\n \n :\n <>{otherName}\n }\n \n
\n
{roundedOtherStat}
\n
\n );\n })\n }\n
\n {\n statTableUrl\n ? \n : null\n }\n \n );\n};\n\n// eslint-disable-next-line no-func-assign\nClubLeaderCardBody = React.memo(ClubLeaderCardBody);\n\nexport default ClubLeaderCardBody;\n","export { default } from './ClubLeaderCardBody';\n","import React from \"react\";\nimport Picture from \"../../../shared/components/Picture\";\nimport { cardTypes, formatImageUrl } from \"../../../shared/utils\";\nimport { CardBackground } from \"../../../shared/svg/Svg\";\nimport { useReactAppState } from \"../../../shared/containers/utils\";\nimport { useLeaderCard } from \"../../utils\";\nimport ConditionalWrapper from \"../../../shared/components/ConditionalWrapper\";\n\nfunction ClubLeaderCardFigure({ clubData }) {\n const { t, isLeague, urlList } = useReactAppState();\n const { baseUrl } = urlList || {};\n\n const { advertiser, header } = useLeaderCard();\n\n const { club } = clubData || {};\n const { name, logoColorUrl } = club || {};\n\n const { highQuality: clubLogoSrc } = logoColorUrl\n ? formatImageUrl(logoColorUrl, {\n format: \"w_175,h_175,c_pad\",\n extension: \"f_png\",\n })\n : {};\n\n return (\n (\n \n {children}\n \n )}\n >\n \n {clubLogoSrc ? (\n \n ) : null}\n \n
\n

{header}

\n {advertiser ? (\n
\n
\n {t(\"leader_card_presented_by\")}\n
\n
\n {advertiser ? (\n \n ) : null}\n
\n
\n ) : null}\n
\n \n \n );\n}\n\n// eslint-disable-next-line no-func-assign\nClubLeaderCardFigure = React.memo(ClubLeaderCardFigure);\n\nexport default ClubLeaderCardFigure;\n","export { default } from './ClubLeaderCardFigure';\n","import React from 'react';\nimport { formatClubStats } from \"../../../shared/utils\";\nimport ClubLeaderCardFigure from \"../ClubLeaderCardFigure\";\nimport ClubLeaderCardBody from \"../ClubLeaderCardBody\";\nimport { useLeaderCard } from \"../../utils\";\n\nfunction ClubLeaderData() {\n const {\n first,\n clubsData,\n mlsPhaseType,\n } = useLeaderCard();\n\n const { club: firstClub } = first || {};\n const { opta_id: firstClubOptaId } = firstClub || {};\n\n const matchedClub = clubsData != null ? clubsData.find(c => c?.optaId === firstClubOptaId) : null;\n const firstClubData = formatClubStats(first, matchedClub, mlsPhaseType);\n\n return (\n <>\n \n \n \n );\n}\n\n// eslint-disable-next-line no-func-assign\nClubLeaderData = React.memo(ClubLeaderData);\n\nexport default ClubLeaderData;\n","export { default } from './ClubLeaderData';\n","import React from \"react\";\nimport Picture from \"../../../shared/components/Picture\";\nimport { CardBackground } from \"../../../shared/svg/Svg\";\nimport BlockFooter from \"../../../shared/components/BlockFooter/BlockFooter\";\nimport { useReactAppState } from \"../../../shared/containers/utils\";\n\nfunction LeaderCardLoading({ cardType = \"player\", currentStatViewType, advertiser, statTableUrl }) {\n const { t } = useReactAppState();\n return (\n
\n
\n
\n {\n cardType === \"player\"\n ? (\n \n )\n : (\n \n )\n }\n \n
\n
\n {advertiser\n ? (\n
\n
\n
\n ) : null\n }\n\n {\n cardType === \"player\"\n ? (\n
\n \n
\n )\n : null\n }\n
\n
\n
\n
\n
\n
\n
\n
\n {\n [...Array(3)].map((item, index) => {\n return (\n
\n
\n
\n
\n );\n })\n }\n
\n {\n statTableUrl && currentStatViewType\n ? \n : null\n }\n
\n
\n
\n );\n}\n\n// eslint-disable-next-line no-func-assign\nLeaderCardLoading = React.memo(LeaderCardLoading);\n\nexport default LeaderCardLoading;\n","import React from \"react\";\nimport BlockFooter from \"../../../shared/components/BlockFooter/BlockFooter\";\nimport { round } from \"../../../../libraries/_helpers\";\nimport PlayerRankedItem from \"../PlayerRankedItem/PlayerRankedItem\";\nimport LoadingDisplay from \"../../../shared/components/LoadingDisplay\";\nimport { useLeaderCard } from \"../../utils\";\nimport { useReactAppState } from \"../../../shared/containers/utils\";\n\nfunction PlayerLeaderCardBody({ first, rest }) {\n const {\n footer,\n currentStatType,\n statTableUrl\n } = useLeaderCard();\n\n const { urlList, isLeague, clubOptaId, t } = useReactAppState();\n const { baseUrl } = urlList || {};\n const { player: firstPlayer, club } = first || {};\n const { knownName, lastName, firstName, isOptaKnownName, fullName } = firstPlayer || {};\n const name = knownName && !isOptaKnownName\n ? knownName\n : firstName && lastName\n ? `${firstName.charAt(0)}. ${lastName}`\n : lastName\n ? lastName\n : firstName ? firstName : \"\";\n\n const backgroundColor = club?.backgroundColor || \"\";\n const roundedFirstStat = first && first[currentStatType] === 0 || first[currentStatType] ? round(first[currentStatType], 2) : \"\";\n const urlWithQueryParams = statTableUrl ? `${statTableUrl}?stat-type=${currentStatType}` : null;\n const isCurrentClub = club?.optaId == clubOptaId;\n const playerSlug = first?.player?.slug;\n\n return (\n
\n
\n
\n {\n isLeague || isCurrentClub ?\n
\n {name}\n
:\n
{name}
\n }\n {\n isLeague ?\n :\n
{club?.name}
\n }\n
\n
{roundedFirstStat}
\n
\n
\n {\n rest && rest.length > 0\n ? rest.map(({ data, isLoading }, index) => {\n const { player } = data || {};\n return isLoading\n ? \n : player\n ? \n : null;\n })\n : null\n }\n
\n {\n statTableUrl\n ? \n : null\n }\n
\n );\n}\n\n// eslint-disable-next-line no-func-assign\nPlayerLeaderCardBody = React.memo(PlayerLeaderCardBody);\n\nexport default PlayerLeaderCardBody;\n","export { default } from './PlayerLeaderCardBody';\n","import React from \"react\";\nimport Picture from \"../../../shared/components/Picture\";\nimport { cardTypes, formatImageUrl } from \"../../../shared/utils\";\nimport { CardBackground } from \"../../../shared/svg/Svg\";\nimport { useLeaderCard } from \"../../utils\";\nimport { useReactAppState } from \"../../../shared/containers/utils\";\n\nfunction PlayerLeaderCardFigure({ playerData, clubData }) {\n const { advertiser, header } = useLeaderCard();\n\n const { t, urlList, isLeague } = useReactAppState();\n const { baseUrl } = urlList || {};\n const { player, club } = playerData || {};\n const { image } = player || {};\n const { templateUrl, title } = image || {};\n const { name, logoColorUrl } = club || {};\n\n const { highQuality } = templateUrl\n ? formatImageUrl(templateUrl, {\n format: \"w_175,h_175,c_pad\",\n extension: \"f_png\",\n })\n : {};\n const { highQuality: clubLogoSrc } = logoColorUrl\n ? formatImageUrl(logoColorUrl, {\n format: \"w_175,h_175,c_pad\",\n extension: \"f_png\",\n })\n : {};\n const clubSlug = clubData?.slug;\n\n return (\n \n \n \n
\n

{header}

\n {advertiser ? (\n
\n
\n {t(\"leader_card_presented_by\")}\n
\n
\n {advertiser ? (\n \n ) : null}\n
\n
\n ) : null}\n
\n {isLeague ? (\n \n \n \n ) : (\n \n )}\n
\n
\n \n );\n}\n\n// eslint-disable-next-line no-func-assign\nPlayerLeaderCardFigure = React.memo(PlayerLeaderCardFigure);\n\nexport default PlayerLeaderCardFigure;\n","export { default } from './PlayerLeaderCardFigure';\n","import React from 'react';\nimport { useQueries, useQuery } from \"react-query\";\nimport PlayerLeaderCardFigure from \"../PlayerLeaderCardFigure\";\nimport PlayerLeaderCardBody from \"../PlayerLeaderCardBody\";\nimport { apiURL, forgePlayerDAPI } from \"../../../shared/api/variables\";\nimport { fetchClient } from \"../../../shared/api/fetching\";\nimport { cardTypes, formatPlayerStats } from \"../../../shared/utils\";\nimport ErrorDisplay from \"../../../shared/components/ErrorDisplay\";\nimport LeaderCardLoading from \"../LeaderCardLoading/LeaderCardLoading\";\nimport { useLeaderCard } from \"../../utils\";\nimport { useReactAppState } from \"../../../shared/containers/utils\";\n\nfunction PlayerLeaderData() {\n const { t } = useReactAppState();\n const {\n first,\n rest,\n currentStatType,\n clubsData,\n advertiser,\n mlsPhaseType,\n statTableUrl\n } = useLeaderCard();\n\n const { player: firstPlayer, club } = first || {};\n const { opta_id: firstPlayerOptaId } = firstPlayer || {};\n const { opta_id, optaId } = club || {};\n const playerOptaId = firstPlayerOptaId + \"\";\n\n const foundClub = clubsData != null ? clubsData.find(c => c?.optaId === opta_id || c?.optaId === optaId) : null;\n const firstPlayerEndpoint = forgePlayerDAPI({ optaId: firstPlayerOptaId });\n\n const { isLoading, isError, data: firstPlayerData, error } = useQuery({\n queryKey: [`forge-player`, { playerOptaId }],\n queryFn: () => fetchClient({ endpoint: firstPlayerEndpoint, apiURL: apiURL.forgeDAPI }),\n select: playerArray => formatPlayerStats(first, playerArray?.items?.[0], foundClub, mlsPhaseType)\n });\n\n const playerOptaIdList = rest ? rest.map(item => {\n const { player, club } = item || {};\n const { opta_id } = player || {};\n const { opta_id: clubOptaId } = club || {};\n const playerOptaId = opta_id + \"\";\n\n const playerEndpoint = forgePlayerDAPI({ optaId: playerOptaId });\n return {\n queryKey: [`forge-player`, { playerOptaId }],\n queryFn: () => fetchClient({ endpoint: playerEndpoint, apiURL: apiURL.forgeDAPI }),\n select: playerArray => {\n const restFoundClub = clubsData != null ? clubsData.find(c => c?.optaId === clubOptaId) : null;\n\n return formatPlayerStats(item, playerArray?.items?.[0], restFoundClub, mlsPhaseType);\n }\n };\n }) : null;\n\n const restData = useQueries(playerOptaIdList);\n\n return (\n isLoading\n ? \n : isError\n ? \n : (\n firstPlayerData && restData && restData.length > 0\n ? (\n <>\n \n \n \n )\n : null\n )\n );\n}\n\n// eslint-disable-next-line no-func-assign\nPlayerLeaderData = React.memo(PlayerLeaderData);\n\nexport default PlayerLeaderData;\n","export { default } from './PlayerLeaderData';\n","import React from 'react';\nimport { round } from \"../../../../libraries/_helpers\";\nimport { useReactAppState } from \"../../../shared/containers/utils\";\n\nfunction PlayerRankedItem({ item, index, statType }) {\n const otherPlayer = item.player || {};\n const otherClub = item.club || {};\n\n const { knownName, firstName, lastName, fullName, slug } = otherPlayer || {};\n const { urlList, isLeague, clubOptaId } = useReactAppState();\n const { baseUrl } = urlList || {};\n\n const otherName = knownName\n ? knownName\n : firstName && lastName\n ? `${firstName.charAt(0)}. ${lastName}`\n : lastName\n ? lastName\n : firstName ? firstName : \"\";\n\n const isCurrentClub = otherClub?.optaId == clubOptaId;\n\n const roundedOtherStat = item && item[statType] === 0 || item[statType] ? round(item[statType], 2) : \"\";\n\n return (\n
\n
\n {\n isLeague || isCurrentClub ?\n \n {otherName}\n \n :\n {otherName}\n }\n {isLeague || isCurrentClub ?\n \n {otherClub?.abbreviation}\n \n :\n {otherClub?.abbreviation}\n }\n
\n
{roundedOtherStat}
\n
\n );\n}\n\n// eslint-disable-next-line no-func-assign\nPlayerRankedItem = React.memo(PlayerRankedItem);\n\nexport default PlayerRankedItem;\n","import React, { useEffect, useState } from \"react\";\nimport { useQuery } from \"react-query\";\nimport { fetchClient } from \"../shared/api/fetching\";\nimport { cardTypes, mapStatTypeToStatsApi, queryStatusTypes } from \"../shared/utils\";\nimport { apiURL, d3ClubsAPI, mlsClubStatsAPI, mlsPlayerStatsAPI } from \"../shared/api/variables\";\nimport LeaderCardLoading from \"./components/LeaderCardLoading/LeaderCardLoading\";\nimport PlayerLeaderData from \"./components/PlayerLeaderData\";\nimport ClubLeaderData from \"./components/ClubLeaderData\";\nimport { useReactAppState } from \"../shared/containers/utils\";\nimport { LeaderCardContext } from \"./utils\";\n\nfunction LeaderCard({ options }) {\n const { t, apiList } = useReactAppState();\n const {\n d3SportsAPI,\n } = apiList || {};\n\n const cardType = options.cardType;\n const season = options.season;\n const competitionOptaId = options.competitionOptaId;\n const statViewType = options.statViewType;\n const advertiser = options.advertiser;\n const statTableUrl = options.statTableUrl;\n const statLeadersClubsData = options.statLeadersClubsData;\n const clubOptaId = options.clubOptaId;\n const mlsPhaseType = options.mlsPhaseType;\n const [currentStatViewType, setCurrentStatViewType] = useState(mapStatTypeToStatsApi(statViewType));\n\n const clubsEndpoint = d3ClubsAPI({ competitionOptaId, season });\n const {\n status: clubsStatus,\n data: clubsData,\n } = useQuery({\n queryKey: [`d3-clubs`, { competitionOptaId, season }],\n queryFn: () => fetchClient({ endpoint: clubsEndpoint, apiURL: d3SportsAPI }),\n enabled: statLeadersClubsData == null\n });\n\n const clubs = clubsData ? clubsData : statLeadersClubsData;\n const statsApiEndpoint = cardType === cardTypes.club\n ? mlsClubStatsAPI({\n season,\n desc: true,\n competitionOptaId,\n includeRegularSeasonStats: true,\n mlsPhaseType,\n statType: currentStatViewType.value,\n pageSize: 4\n })\n : mlsPlayerStatsAPI({\n season,\n desc: true,\n clubOptaId,\n competitionOptaId,\n mlsPhaseType,\n statType: currentStatViewType?.value,\n pageSize: 4\n });\n\n const { status: mlsDataStatus, data } = useQuery({\n queryKey: [`mls-${currentStatViewType.key}`, {\n competitionOptaId,\n season,\n cardType,\n clubOptaId,\n mlsPhaseType\n }],\n queryFn: () => fetchClient({ endpoint: statsApiEndpoint, apiURL: apiURL.statsAPI })\n });\n\n useEffect(() => {\n setCurrentStatViewType(mapStatTypeToStatsApi(statViewType));\n }, [statViewType]);\n\n if (mlsDataStatus === queryStatusTypes.loading || clubsStatus === queryStatusTypes.loading) {\n return ;\n }\n\n if (mlsDataStatus === queryStatusTypes.error || clubsStatus === queryStatusTypes.error) {\n return null;\n }\n\n const [first, ...rest] = data && data.length > 0 ? data : [];\n const footer = t(currentStatViewType.key);\n\n return (\n clubs && first && rest && rest.length > 0 ? (\n
\n
\n \n {\n cardType === cardTypes.player\n ? \n : \n }\n \n
\n
\n ) : null\n );\n}\n\n// eslint-disable-next-line no-func-assign\nLeaderCard = React.memo(LeaderCard);\n\nexport default LeaderCard;\n","import React from 'react';\n\nexport const LeaderCardContext = React.createContext();\nLeaderCardContext.displayName = \"LeaderCardContext\";\n\nexport function useLeaderCard() {\n const context = React.useContext(LeaderCardContext);\n\n if (context === undefined) {\n throw new Error(\"useLeaderCard must be used in a \");\n }\n\n return context;\n}\n","import React from 'react';\n\nfunction BlockFooter({ title, link, iconSize = \"medium\" }) {\n return (\n
\n
\n
\n
\n {\n link\n ? (\n \n
\n {title}\n \n \n \n \n \n
\n
\n )\n : (\n
\n {title}\n
\n )\n }\n
\n
\n
\n
\n );\n}\n\nexport default BlockFooter;\n","/*This will render a wrapper around a children based on a condition */\nconst ConditionalWrapper = ({ condition, wrapper, children }) =>\n condition ? wrapper(children) : children;\n\nexport default ConditionalWrapper;\n","export { default } from './ConditionalWrapper';\n","import React from 'react';\n\nconst ErrorDisplay = ({ error }) => {\n if (!error || !error.message) return null;\n\n return (\n
\n

\n {error.message}\n

\n
\n );\n};\n\nexport default ErrorDisplay;\n","export { default } from './ErrorDisplay';\n","import React from 'react';\nimport { loadingTypes } from \"./utils\";\n\nconst LoadingDisplay = (props) => {\n const { width = \"100\", type = loadingTypes.line, ...otherProps } = props || {};\n\n return
;\n};\n\nexport default LoadingDisplay;\n","export { default } from './LoadingDisplay';\n","export const loadingTypes = {\n line: 'line'\n};\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":""}