fansunited-data-layer 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/fansunited/constants.d.ts +5 -0
- package/api/fansunited/constants.d.ts.map +1 -0
- package/api/fansunited/football/competition/index.d.ts +30 -0
- package/api/fansunited/football/competition/index.d.ts.map +1 -0
- package/api/fansunited/football/competition/transformer.d.ts +11 -0
- package/api/fansunited/football/competition/transformer.d.ts.map +1 -0
- package/api/fansunited/football/competition/types.d.ts +70 -0
- package/api/fansunited/football/competition/types.d.ts.map +1 -0
- package/api/fansunited/football/competitions/index.d.ts +27 -0
- package/api/fansunited/football/competitions/index.d.ts.map +1 -0
- package/api/fansunited/football/competitions/transformer.d.ts +14 -0
- package/api/fansunited/football/competitions/transformer.d.ts.map +1 -0
- package/api/fansunited/football/competitions/types.d.ts +67 -0
- package/api/fansunited/football/competitions/types.d.ts.map +1 -0
- package/api/fansunited/football/http.d.ts +8 -0
- package/api/fansunited/football/http.d.ts.map +1 -0
- package/api/fansunited/football/index.d.ts +19 -0
- package/api/fansunited/football/index.d.ts.map +1 -0
- package/api/fansunited/football/matches/index.d.ts +61 -0
- package/api/fansunited/football/matches/index.d.ts.map +1 -0
- package/api/fansunited/football/matches/transformer.d.ts +28 -0
- package/api/fansunited/football/matches/transformer.d.ts.map +1 -0
- package/api/fansunited/football/matches/types.d.ts +328 -0
- package/api/fansunited/football/matches/types.d.ts.map +1 -0
- package/api/fansunited/football/players/index.d.ts +30 -0
- package/api/fansunited/football/players/index.d.ts.map +1 -0
- package/api/fansunited/football/players/transformer.d.ts +10 -0
- package/api/fansunited/football/players/transformer.d.ts.map +1 -0
- package/api/fansunited/football/players/types.d.ts +70 -0
- package/api/fansunited/football/players/types.d.ts.map +1 -0
- package/api/fansunited/football/search/index.d.ts +49 -0
- package/api/fansunited/football/search/index.d.ts.map +1 -0
- package/api/fansunited/football/search/transformer.d.ts +10 -0
- package/api/fansunited/football/search/transformer.d.ts.map +1 -0
- package/api/fansunited/football/search/types.d.ts +151 -0
- package/api/fansunited/football/search/types.d.ts.map +1 -0
- package/api/fansunited/football/teams/index.d.ts +30 -0
- package/api/fansunited/football/teams/index.d.ts.map +1 -0
- package/api/fansunited/football/teams/transformer.d.ts +10 -0
- package/api/fansunited/football/teams/transformer.d.ts.map +1 -0
- package/api/fansunited/football/teams/types.d.ts +87 -0
- package/api/fansunited/football/teams/types.d.ts.map +1 -0
- package/api/fansunited/http.d.ts +54 -0
- package/api/fansunited/http.d.ts.map +1 -0
- package/api/fansunited/index.d.ts +10 -0
- package/api/fansunited/index.d.ts.map +1 -0
- package/api/sportal365-sports/constants.d.ts +16 -0
- package/api/sportal365-sports/constants.d.ts.map +1 -0
- package/api/sportal365-sports/football/competitions/competition.types.d.ts +148 -0
- package/api/sportal365-sports/football/competitions/competition.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/competitions/index.d.ts +54 -0
- package/api/sportal365-sports/football/competitions/index.d.ts.map +1 -0
- package/api/sportal365-sports/football/competitions/utils.d.ts +14 -0
- package/api/sportal365-sports/football/competitions/utils.d.ts.map +1 -0
- package/api/sportal365-sports/football/http.d.ts +8 -0
- package/api/sportal365-sports/football/http.d.ts.map +1 -0
- package/api/sportal365-sports/football/index.d.ts +19 -0
- package/api/sportal365-sports/football/index.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/index.d.ts +151 -0
- package/api/sportal365-sports/football/matches/index.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/commentary.d.ts +12 -0
- package/api/sportal365-sports/football/matches/transformers/commentary.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/index.d.ts +10 -0
- package/api/sportal365-sports/football/matches/transformers/index.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/lineup.d.ts +11 -0
- package/api/sportal365-sports/football/matches/transformers/lineup.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/match-event.d.ts +12 -0
- package/api/sportal365-sports/football/matches/transformers/match-event.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/match.d.ts +11 -0
- package/api/sportal365-sports/football/matches/transformers/match.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/odds.d.ts +11 -0
- package/api/sportal365-sports/football/matches/transformers/odds.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/statistics.d.ts +11 -0
- package/api/sportal365-sports/football/matches/transformers/statistics.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/commentary.types.d.ts +27 -0
- package/api/sportal365-sports/football/matches/types/commentary.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/event.types.d.ts +19 -0
- package/api/sportal365-sports/football/matches/types/event.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/index.d.ts +16 -0
- package/api/sportal365-sports/football/matches/types/index.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/lineup.types.d.ts +80 -0
- package/api/sportal365-sports/football/matches/types/lineup.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/match.types.d.ts +47 -0
- package/api/sportal365-sports/football/matches/types/match.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/minute.types.d.ts +8 -0
- package/api/sportal365-sports/football/matches/types/minute.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/odds.types.d.ts +80 -0
- package/api/sportal365-sports/football/matches/types/odds.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/option.types.d.ts +129 -0
- package/api/sportal365-sports/football/matches/types/option.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/referee.types.d.ts +13 -0
- package/api/sportal365-sports/football/matches/types/referee.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/statistics.types.d.ts +45 -0
- package/api/sportal365-sports/football/matches/types/statistics.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/status.types.d.ts +13 -0
- package/api/sportal365-sports/football/matches/types/status.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/team.types.d.ts +17 -0
- package/api/sportal365-sports/football/matches/types/team.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/winner.types.d.ts +15 -0
- package/api/sportal365-sports/football/matches/types/winner.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/search/index.d.ts +45 -0
- package/api/sportal365-sports/football/search/index.d.ts.map +1 -0
- package/api/sportal365-sports/football/search/search.transformer.d.ts +10 -0
- package/api/sportal365-sports/football/search/search.transformer.d.ts.map +1 -0
- package/api/sportal365-sports/football/search/search.types.d.ts +147 -0
- package/api/sportal365-sports/football/search/search.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/standings/index.d.ts +43 -0
- package/api/sportal365-sports/football/standings/index.d.ts.map +1 -0
- package/api/sportal365-sports/football/standings/standing.transformer.d.ts +15 -0
- package/api/sportal365-sports/football/standings/standing.transformer.d.ts.map +1 -0
- package/api/sportal365-sports/football/standings/standing.types.d.ts +73 -0
- package/api/sportal365-sports/football/standings/standing.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/statistics/index.d.ts +42 -0
- package/api/sportal365-sports/football/statistics/index.d.ts.map +1 -0
- package/api/sportal365-sports/football/statistics/player-season.transformer.d.ts +11 -0
- package/api/sportal365-sports/football/statistics/player-season.transformer.d.ts.map +1 -0
- package/api/sportal365-sports/football/statistics/player-season.types.d.ts +84 -0
- package/api/sportal365-sports/football/statistics/player-season.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/teams/index.d.ts +53 -0
- package/api/sportal365-sports/football/teams/index.d.ts.map +1 -0
- package/api/sportal365-sports/football/teams/squad.types.d.ts +63 -0
- package/api/sportal365-sports/football/teams/squad.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/teams/team.types.d.ts +58 -0
- package/api/sportal365-sports/football/teams/team.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/teams/utils.d.ts +24 -0
- package/api/sportal365-sports/football/teams/utils.d.ts.map +1 -0
- package/api/sportal365-sports/http.d.ts +59 -0
- package/api/sportal365-sports/http.d.ts.map +1 -0
- package/api/sportal365-sports/index.d.ts +14 -0
- package/api/sportal365-sports/index.d.ts.map +1 -0
- package/api/sportal365-sports/search/http.d.ts +8 -0
- package/api/sportal365-sports/search/http.d.ts.map +1 -0
- package/api/sportal365-sports/search/index.d.ts +43 -0
- package/api/sportal365-sports/search/index.d.ts.map +1 -0
- package/api/sportal365-sports/search/search.transformer.d.ts +10 -0
- package/api/sportal365-sports/search/search.transformer.d.ts.map +1 -0
- package/api/sportal365-sports/search/search.types.d.ts +209 -0
- package/api/sportal365-sports/search/search.types.d.ts.map +1 -0
- package/api/sportal365-sports/shared/index.d.ts +6 -0
- package/api/sportal365-sports/shared/index.d.ts.map +1 -0
- package/api/sportal365-sports/shared/providerRef.helper.d.ts +79 -0
- package/api/sportal365-sports/shared/providerRef.helper.d.ts.map +1 -0
- package/api/sportal365-sports/shared/types.d.ts +189 -0
- package/api/sportal365-sports/shared/types.d.ts.map +1 -0
- package/api/sportal365-sports/statistics/http.d.ts +8 -0
- package/api/sportal365-sports/statistics/http.d.ts.map +1 -0
- package/api/sportal365-sports/statistics/index.d.ts +55 -0
- package/api/sportal365-sports/statistics/index.d.ts.map +1 -0
- package/api/sportal365-sports/statistics/team-stats.transformer.d.ts +14 -0
- package/api/sportal365-sports/statistics/team-stats.transformer.d.ts.map +1 -0
- package/api/sportal365-sports/statistics/team-stats.types.d.ts +45 -0
- package/api/sportal365-sports/statistics/team-stats.types.d.ts.map +1 -0
- package/client.cjs +8 -0
- package/client.d.ts +20 -0
- package/client.d.ts.map +1 -0
- package/client.js +12065 -0
- package/config/index.d.ts +31 -0
- package/config/index.d.ts.map +1 -0
- package/config/types.d.ts +36 -0
- package/config/types.d.ts.map +1 -0
- package/fansunited-data-layer.cjs +1 -0
- package/fansunited-data-layer.js +1739 -0
- package/helpers/competition.helpers.d.ts +22 -0
- package/helpers/competition.helpers.d.ts.map +1 -0
- package/helpers/index.d.ts +7 -0
- package/helpers/index.d.ts.map +1 -0
- package/helpers/team.helpers.d.ts +289 -0
- package/helpers/team.helpers.d.ts.map +1 -0
- package/index-Cogo-Kkd.cjs +1 -0
- package/index-D7T2Yy11.js +1170 -0
- package/index.d.ts +39 -0
- package/index.d.ts.map +1 -0
- package/package.json +14 -17
- package/providers/competition/hooks/index.d.ts +6 -0
- package/providers/competition/hooks/index.d.ts.map +1 -0
- package/providers/competition/hooks/useCompetitionStats.d.ts +8 -0
- package/providers/competition/hooks/useCompetitionStats.d.ts.map +1 -0
- package/providers/competition/hooks/useGoalDistribution.d.ts +11 -0
- package/providers/competition/hooks/useGoalDistribution.d.ts.map +1 -0
- package/providers/competition/hooks/useMatchHelpers.d.ts +16 -0
- package/providers/competition/hooks/useMatchHelpers.d.ts.map +1 -0
- package/providers/competition/hooks/useStandingsCalculations.d.ts +18 -0
- package/providers/competition/hooks/useStandingsCalculations.d.ts.map +1 -0
- package/providers/competition/hooks/useStandingsHelpers.d.ts +23 -0
- package/providers/competition/hooks/useStandingsHelpers.d.ts.map +1 -0
- package/providers/competition/hooks/useTeamPosition.d.ts +8 -0
- package/providers/competition/hooks/useTeamPosition.d.ts.map +1 -0
- package/providers/competition/hooks/useTeamResultsTable.d.ts +9 -0
- package/providers/competition/hooks/useTeamResultsTable.d.ts.map +1 -0
- package/providers/competition/utils/competitionStats.d.ts +42 -0
- package/providers/competition/utils/competitionStats.d.ts.map +1 -0
- package/providers/competition/utils/goalDistribution.d.ts +41 -0
- package/providers/competition/utils/goalDistribution.d.ts.map +1 -0
- package/providers/competition/utils/index.d.ts +6 -0
- package/providers/competition/utils/index.d.ts.map +1 -0
- package/providers/competition/utils/standingsCalculations.d.ts +24 -0
- package/providers/competition/utils/standingsCalculations.d.ts.map +1 -0
- package/providers/competition.context.d.ts +8 -0
- package/providers/competition.context.d.ts.map +1 -0
- package/providers/competition.provider.d.ts +3 -0
- package/providers/competition.provider.d.ts.map +1 -0
- package/providers/competition.types.d.ts +118 -0
- package/providers/competition.types.d.ts.map +1 -0
- package/providers/fansunited-config.context.d.ts +6 -0
- package/providers/fansunited-config.context.d.ts.map +1 -0
- package/providers/fansunited-config.hooks.d.ts +19 -0
- package/providers/fansunited-config.hooks.d.ts.map +1 -0
- package/providers/fansunited-config.provider.d.ts +44 -0
- package/providers/fansunited-config.provider.d.ts.map +1 -0
- package/providers/fansunited-config.types.d.ts +48 -0
- package/providers/fansunited-config.types.d.ts.map +1 -0
- package/providers/fansunited-sdk.hook.d.ts +40 -0
- package/providers/fansunited-sdk.hook.d.ts.map +1 -0
- package/providers/index.d.ts +20 -0
- package/providers/index.d.ts.map +1 -0
- package/providers/match/hooks/useEventHelpers.d.ts +12 -0
- package/providers/match/hooks/useEventHelpers.d.ts.map +1 -0
- package/providers/match/hooks/useHeadToHeadHelpers.d.ts +13 -0
- package/providers/match/hooks/useHeadToHeadHelpers.d.ts.map +1 -0
- package/providers/match/hooks/useLineupHelpers.d.ts +13 -0
- package/providers/match/hooks/useLineupHelpers.d.ts.map +1 -0
- package/providers/match/hooks/useMatchStandingsCalculations.d.ts +20 -0
- package/providers/match/hooks/useMatchStandingsCalculations.d.ts.map +1 -0
- package/providers/match/hooks/useMatchStatus.d.ts +12 -0
- package/providers/match/hooks/useMatchStatus.d.ts.map +1 -0
- package/providers/match/hooks/useOddsHelpers.d.ts +10 -0
- package/providers/match/hooks/useOddsHelpers.d.ts.map +1 -0
- package/providers/match/hooks/useScoreHelpers.d.ts +16 -0
- package/providers/match/hooks/useScoreHelpers.d.ts.map +1 -0
- package/providers/match/hooks/useStandingsHelpers.d.ts +22 -0
- package/providers/match/hooks/useStandingsHelpers.d.ts.map +1 -0
- package/providers/match/hooks/useStatisticsHelpers.d.ts +13 -0
- package/providers/match/hooks/useStatisticsHelpers.d.ts.map +1 -0
- package/providers/match/hooks/useTeamHelpers.d.ts +11 -0
- package/providers/match/hooks/useTeamHelpers.d.ts.map +1 -0
- package/providers/match/hooks/useTeamStatsHelpers.d.ts +12 -0
- package/providers/match/hooks/useTeamStatsHelpers.d.ts.map +1 -0
- package/providers/match.context.d.ts +8 -0
- package/providers/match.context.d.ts.map +1 -0
- package/providers/match.provider.d.ts +3 -0
- package/providers/match.provider.d.ts.map +1 -0
- package/providers/match.types.d.ts +151 -0
- package/providers/match.types.d.ts.map +1 -0
- package/providers/team/hooks/useFormStats.d.ts +49 -0
- package/providers/team/hooks/useFormStats.d.ts.map +1 -0
- package/providers/team/hooks/useMatchHelpers.d.ts +12 -0
- package/providers/team/hooks/useMatchHelpers.d.ts.map +1 -0
- package/providers/team/hooks/useSquadHelpers.d.ts +17 -0
- package/providers/team/hooks/useSquadHelpers.d.ts.map +1 -0
- package/providers/team.context.d.ts +8 -0
- package/providers/team.context.d.ts.map +1 -0
- package/providers/team.provider.d.ts +3 -0
- package/providers/team.provider.d.ts.map +1 -0
- package/providers/team.types.d.ts +68 -0
- package/providers/team.types.d.ts.map +1 -0
- package/types/canonical/base.types.d.ts +366 -0
- package/types/canonical/base.types.d.ts.map +1 -0
- package/types/canonical/commentary.types.d.ts +42 -0
- package/types/canonical/commentary.types.d.ts.map +1 -0
- package/types/canonical/event.types.d.ts +31 -0
- package/types/canonical/event.types.d.ts.map +1 -0
- package/types/canonical/index.d.ts +17 -0
- package/types/canonical/index.d.ts.map +1 -0
- package/types/canonical/lineup.types.d.ts +33 -0
- package/types/canonical/lineup.types.d.ts.map +1 -0
- package/types/canonical/match.types.d.ts +153 -0
- package/types/canonical/match.types.d.ts.map +1 -0
- package/types/canonical/odds.types.d.ts +73 -0
- package/types/canonical/odds.types.d.ts.map +1 -0
- package/types/canonical/search.types.d.ts +101 -0
- package/types/canonical/search.types.d.ts.map +1 -0
- package/types/canonical/sports-search.types.d.ts +151 -0
- package/types/canonical/sports-search.types.d.ts.map +1 -0
- package/types/canonical/squad.types.d.ts +30 -0
- package/types/canonical/squad.types.d.ts.map +1 -0
- package/types/canonical/standing.types.d.ts +85 -0
- package/types/canonical/standing.types.d.ts.map +1 -0
- package/types/canonical/statistics.types.d.ts +81 -0
- package/types/canonical/statistics.types.d.ts.map +1 -0
- package/types/index.d.ts +10 -0
- package/types/index.d.ts.map +1 -0
- package/utilities/stats/core/helpers.d.ts +65 -0
- package/utilities/stats/core/helpers.d.ts.map +1 -0
- package/utilities/stats/core/index.d.ts +7 -0
- package/utilities/stats/core/index.d.ts.map +1 -0
- package/utilities/stats/core/types.d.ts +39 -0
- package/utilities/stats/core/types.d.ts.map +1 -0
- package/utilities/stats/index.d.ts +27 -0
- package/utilities/stats/index.d.ts.map +1 -0
- package/utilities/stats/match/headToHead.d.ts +73 -0
- package/utilities/stats/match/headToHead.d.ts.map +1 -0
- package/utilities/stats/match/homeVsAway.d.ts +30 -0
- package/utilities/stats/match/homeVsAway.d.ts.map +1 -0
- package/utilities/stats/match/index.d.ts +8 -0
- package/utilities/stats/match/index.d.ts.map +1 -0
- package/utilities/stats/match/overUnder.d.ts +59 -0
- package/utilities/stats/match/overUnder.d.ts.map +1 -0
- package/utilities/stats/match/result.d.ts +13 -0
- package/utilities/stats/match/result.d.ts.map +1 -0
- package/utilities/stats/team/commonOpponents.d.ts +28 -0
- package/utilities/stats/team/commonOpponents.d.ts.map +1 -0
- package/utilities/stats/team/goalStats.d.ts +42 -0
- package/utilities/stats/team/goalStats.d.ts.map +1 -0
- package/utilities/stats/team/index.d.ts +7 -0
- package/utilities/stats/team/index.d.ts.map +1 -0
- package/utilities/stats/team/streaks.d.ts +48 -0
- package/utilities/stats/team/streaks.d.ts.map +1 -0
- package/vite.svg +1 -0
|
@@ -0,0 +1,1739 @@
|
|
|
1
|
+
import { t as C, g as R, f as w, c as z, S as ee, a as te } from "./index-D7T2Yy11.js";
|
|
2
|
+
import { b as Pt, d as $t, e as Ut, h as xt, i as Bt, j as Wt, k as qt, l as jt, m as Vt, n as Kt, o as Yt, p as zt, q as Jt, r as Qt, s as Xt, u as Zt, v as wt } from "./index-D7T2Yy11.js";
|
|
3
|
+
function oe(e) {
|
|
4
|
+
return {
|
|
5
|
+
entityType: "tournament",
|
|
6
|
+
id: e.id.toString(),
|
|
7
|
+
name: e.name,
|
|
8
|
+
slug: e.slug,
|
|
9
|
+
gender: e.gender,
|
|
10
|
+
type: e.type,
|
|
11
|
+
region: e.region,
|
|
12
|
+
country: {
|
|
13
|
+
id: e.country.id.toString(),
|
|
14
|
+
name: e.country.name,
|
|
15
|
+
code: void 0,
|
|
16
|
+
flag: e.country.url_flag ?? void 0,
|
|
17
|
+
providerRef: C(e.country.uuid)
|
|
18
|
+
},
|
|
19
|
+
assets: e.url_logo ? {
|
|
20
|
+
logo: e.url_logo
|
|
21
|
+
} : void 0,
|
|
22
|
+
providerRef: C(e.uuid)
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function ne(e) {
|
|
26
|
+
return {
|
|
27
|
+
entityType: "player",
|
|
28
|
+
id: e.id.toString(),
|
|
29
|
+
name: e.name,
|
|
30
|
+
slug: e.slug,
|
|
31
|
+
position: e.position,
|
|
32
|
+
gender: e.gender,
|
|
33
|
+
birthdate: e.birthdate,
|
|
34
|
+
country: {
|
|
35
|
+
id: e.country.id.toString(),
|
|
36
|
+
name: e.country.name,
|
|
37
|
+
code: void 0,
|
|
38
|
+
flag: e.country.url_flag ?? void 0,
|
|
39
|
+
providerRef: C(e.country.uuid)
|
|
40
|
+
},
|
|
41
|
+
assets: e.url_thumb ? {
|
|
42
|
+
photo: e.url_thumb
|
|
43
|
+
} : void 0,
|
|
44
|
+
providerRef: C(e.uuid)
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function se(e) {
|
|
48
|
+
return {
|
|
49
|
+
entityType: "team",
|
|
50
|
+
id: e.id.toString(),
|
|
51
|
+
name: e.name,
|
|
52
|
+
slug: e.slug,
|
|
53
|
+
shortName: e.short_name ?? void 0,
|
|
54
|
+
threeLetterCode: e.three_letter_code ?? void 0,
|
|
55
|
+
type: e.type === "national" ? "national" : "club",
|
|
56
|
+
gender: e.gender,
|
|
57
|
+
country: {
|
|
58
|
+
id: e.country.id.toString(),
|
|
59
|
+
name: e.country.name,
|
|
60
|
+
code: void 0,
|
|
61
|
+
flag: e.country.url_flag ?? void 0,
|
|
62
|
+
providerRef: C(e.country.uuid)
|
|
63
|
+
},
|
|
64
|
+
assets: e.url_logo ? {
|
|
65
|
+
logo: e.url_logo
|
|
66
|
+
} : void 0,
|
|
67
|
+
providerRef: C(e.uuid)
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function ie(e) {
|
|
71
|
+
return {
|
|
72
|
+
entityType: "president",
|
|
73
|
+
id: e.id.toString(),
|
|
74
|
+
name: e.name,
|
|
75
|
+
slug: e.slug,
|
|
76
|
+
birthdate: e.birthdate ?? void 0,
|
|
77
|
+
country: {
|
|
78
|
+
id: e.country.id.toString(),
|
|
79
|
+
name: e.country.name,
|
|
80
|
+
code: void 0,
|
|
81
|
+
flag: e.country.url_flag ?? void 0,
|
|
82
|
+
providerRef: C(e.country.uuid)
|
|
83
|
+
},
|
|
84
|
+
assets: e.url_thumb ? {
|
|
85
|
+
photo: e.url_thumb
|
|
86
|
+
} : void 0,
|
|
87
|
+
providerRef: C(e.uuid)
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function re(e) {
|
|
91
|
+
return {
|
|
92
|
+
entityType: "venue",
|
|
93
|
+
id: e.id.toString(),
|
|
94
|
+
name: e.name,
|
|
95
|
+
slug: e.slug,
|
|
96
|
+
city: {
|
|
97
|
+
id: e.city.id.toString(),
|
|
98
|
+
name: e.city.name,
|
|
99
|
+
country: {
|
|
100
|
+
id: e.city.country.id.toString(),
|
|
101
|
+
name: e.city.country.name,
|
|
102
|
+
code: void 0,
|
|
103
|
+
flag: e.city.country.url_flag ?? void 0,
|
|
104
|
+
providerRef: C(e.city.country.uuid)
|
|
105
|
+
},
|
|
106
|
+
providerRef: C(e.city.uuid)
|
|
107
|
+
},
|
|
108
|
+
country: {
|
|
109
|
+
id: e.country.id.toString(),
|
|
110
|
+
name: e.country.name,
|
|
111
|
+
code: void 0,
|
|
112
|
+
flag: e.country.url_flag ?? void 0,
|
|
113
|
+
providerRef: C(e.country.uuid)
|
|
114
|
+
},
|
|
115
|
+
profile: {
|
|
116
|
+
latitude: e.profile.lat,
|
|
117
|
+
longitude: e.profile.lng,
|
|
118
|
+
capacity: e.profile.capacity
|
|
119
|
+
},
|
|
120
|
+
assets: e.url_thumb ? {
|
|
121
|
+
image: e.url_thumb
|
|
122
|
+
} : void 0,
|
|
123
|
+
providerRef: C(e.uuid)
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function ae(e) {
|
|
127
|
+
return {
|
|
128
|
+
entityType: "coach",
|
|
129
|
+
id: e.id.toString(),
|
|
130
|
+
name: e.name,
|
|
131
|
+
slug: e.slug,
|
|
132
|
+
birthdate: e.birthdate ?? void 0,
|
|
133
|
+
country: {
|
|
134
|
+
id: e.country.id.toString(),
|
|
135
|
+
name: e.country.name,
|
|
136
|
+
code: void 0,
|
|
137
|
+
flag: e.country.url_flag ?? void 0,
|
|
138
|
+
providerRef: C(e.country.uuid)
|
|
139
|
+
},
|
|
140
|
+
assets: e.url_thumb ? {
|
|
141
|
+
photo: e.url_thumb
|
|
142
|
+
} : void 0,
|
|
143
|
+
providerRef: C(e.uuid)
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function ce(e) {
|
|
147
|
+
switch (e.entity_type) {
|
|
148
|
+
case "tournament":
|
|
149
|
+
return oe(e);
|
|
150
|
+
case "player":
|
|
151
|
+
return ne(e);
|
|
152
|
+
case "team":
|
|
153
|
+
return se(e);
|
|
154
|
+
case "president":
|
|
155
|
+
return ie(e);
|
|
156
|
+
case "venue":
|
|
157
|
+
return re(e);
|
|
158
|
+
case "coach":
|
|
159
|
+
return ae(e);
|
|
160
|
+
default:
|
|
161
|
+
throw new Error(`Unknown entity type: ${e.entity_type}`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
async function Ze(e, o) {
|
|
165
|
+
if (!e.query || e.query.trim() === "")
|
|
166
|
+
return {
|
|
167
|
+
results: [],
|
|
168
|
+
query: e.query || ""
|
|
169
|
+
};
|
|
170
|
+
const t = o || R(), { sportal365Sports: n } = t, s = e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["tournament", "player", "team", "president", "venue", "coach"], i = await w.get({
|
|
171
|
+
path: "/search",
|
|
172
|
+
params: {
|
|
173
|
+
query: e.query.trim(),
|
|
174
|
+
entity_type: s.join(","),
|
|
175
|
+
language_code: e.languageCode ?? n?.languageCode ?? "en"
|
|
176
|
+
},
|
|
177
|
+
headers: {
|
|
178
|
+
"Accept-Language": e.languageCode ?? n?.languageCode ?? "en"
|
|
179
|
+
},
|
|
180
|
+
next: e.next,
|
|
181
|
+
config: t
|
|
182
|
+
});
|
|
183
|
+
return !i || i.length === 0 ? {
|
|
184
|
+
results: [],
|
|
185
|
+
query: e.query
|
|
186
|
+
} : {
|
|
187
|
+
results: i.map(ce),
|
|
188
|
+
query: e.query
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
const le = z(ee);
|
|
192
|
+
function F(e) {
|
|
193
|
+
return {
|
|
194
|
+
language: e.language,
|
|
195
|
+
name: e.name,
|
|
196
|
+
shortName: e.short_name ?? void 0,
|
|
197
|
+
threeLetterCode: e.three_letter_code ?? void 0
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
function N(e) {
|
|
201
|
+
if (!(!e || !e.url))
|
|
202
|
+
return {
|
|
203
|
+
url: e.url
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
function M(e) {
|
|
207
|
+
if (e)
|
|
208
|
+
return {
|
|
209
|
+
id: e.id,
|
|
210
|
+
legacyId: e.legacy_id ?? void 0,
|
|
211
|
+
name: e.name,
|
|
212
|
+
shortName: e.short_name ?? void 0,
|
|
213
|
+
threeLetterCode: e.three_letter_code ?? void 0,
|
|
214
|
+
translations: e.translations.map(F),
|
|
215
|
+
displayAsset: N(e.display_asset),
|
|
216
|
+
slug: e.slug,
|
|
217
|
+
providerRef: e.id
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
function W(e) {
|
|
221
|
+
return {
|
|
222
|
+
entityType: "team",
|
|
223
|
+
id: e.id,
|
|
224
|
+
legacyId: e.legacy_id ?? void 0,
|
|
225
|
+
name: e.name,
|
|
226
|
+
shortName: e.short_name ?? void 0,
|
|
227
|
+
threeLetterCode: e.three_letter_code ?? void 0,
|
|
228
|
+
translations: e.translations.map(F),
|
|
229
|
+
displayAsset: N(e.display_asset),
|
|
230
|
+
slug: e.slug,
|
|
231
|
+
tagScore: e.tag_score ?? void 0,
|
|
232
|
+
sport: e.sport,
|
|
233
|
+
country: M(e.country),
|
|
234
|
+
gender: e.gender,
|
|
235
|
+
competitionIds: e.competition_ids,
|
|
236
|
+
type: e.type,
|
|
237
|
+
national: e.national,
|
|
238
|
+
undecided: e.undecided,
|
|
239
|
+
providerRef: e.id
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
function J(e) {
|
|
243
|
+
return {
|
|
244
|
+
entityType: "city",
|
|
245
|
+
id: e.id,
|
|
246
|
+
legacyId: e.legacy_id ?? void 0,
|
|
247
|
+
name: e.name,
|
|
248
|
+
shortName: e.short_name ?? void 0,
|
|
249
|
+
threeLetterCode: e.three_letter_code ?? void 0,
|
|
250
|
+
translations: e.translations.map(F),
|
|
251
|
+
displayAsset: N(e.display_asset),
|
|
252
|
+
slug: e.slug,
|
|
253
|
+
tagScore: e.tag_score ?? void 0,
|
|
254
|
+
sport: e.sport,
|
|
255
|
+
country: M(e.country),
|
|
256
|
+
providerRef: e.id
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
function de(e) {
|
|
260
|
+
return {
|
|
261
|
+
entityType: "horse",
|
|
262
|
+
id: e.id,
|
|
263
|
+
legacyId: e.legacy_id ?? void 0,
|
|
264
|
+
name: e.name,
|
|
265
|
+
shortName: e.short_name ?? void 0,
|
|
266
|
+
threeLetterCode: e.three_letter_code ?? void 0,
|
|
267
|
+
translations: e.translations.map(F),
|
|
268
|
+
displayAsset: N(e.display_asset),
|
|
269
|
+
slug: e.slug,
|
|
270
|
+
tagScore: e.tag_score ?? void 0,
|
|
271
|
+
sport: e.sport,
|
|
272
|
+
country: M(e.country),
|
|
273
|
+
gender: e.gender,
|
|
274
|
+
providerRef: e.id
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
function ue(e) {
|
|
278
|
+
return {
|
|
279
|
+
entityType: "player",
|
|
280
|
+
id: e.id,
|
|
281
|
+
legacyId: e.legacy_id ?? void 0,
|
|
282
|
+
name: e.name,
|
|
283
|
+
shortName: e.short_name ?? void 0,
|
|
284
|
+
threeLetterCode: e.three_letter_code ?? void 0,
|
|
285
|
+
translations: e.translations.map(F),
|
|
286
|
+
displayAsset: N(e.display_asset),
|
|
287
|
+
slug: e.slug,
|
|
288
|
+
tagScore: e.tag_score ?? void 0,
|
|
289
|
+
sport: e.sport,
|
|
290
|
+
country: M(e.country),
|
|
291
|
+
gender: e.gender,
|
|
292
|
+
birthdate: e.birthdate ?? void 0,
|
|
293
|
+
position: e.position ?? void 0,
|
|
294
|
+
providerRef: e.id
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
function me(e) {
|
|
298
|
+
return {
|
|
299
|
+
entityType: "coach",
|
|
300
|
+
id: e.id,
|
|
301
|
+
legacyId: e.legacy_id ?? void 0,
|
|
302
|
+
name: e.name,
|
|
303
|
+
shortName: e.short_name ?? void 0,
|
|
304
|
+
threeLetterCode: e.three_letter_code ?? void 0,
|
|
305
|
+
translations: e.translations.map(F),
|
|
306
|
+
displayAsset: N(e.display_asset),
|
|
307
|
+
slug: e.slug,
|
|
308
|
+
tagScore: e.tag_score ?? void 0,
|
|
309
|
+
sport: e.sport,
|
|
310
|
+
country: M(e.country),
|
|
311
|
+
gender: e.gender,
|
|
312
|
+
birthdate: e.birthdate ?? void 0,
|
|
313
|
+
providerRef: e.id
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
function fe(e) {
|
|
317
|
+
return {
|
|
318
|
+
entityType: "referee",
|
|
319
|
+
id: e.id,
|
|
320
|
+
legacyId: e.legacy_id ?? void 0,
|
|
321
|
+
name: e.name,
|
|
322
|
+
shortName: e.short_name ?? void 0,
|
|
323
|
+
threeLetterCode: e.three_letter_code ?? void 0,
|
|
324
|
+
translations: e.translations.map(F),
|
|
325
|
+
displayAsset: N(e.display_asset),
|
|
326
|
+
slug: e.slug,
|
|
327
|
+
tagScore: e.tag_score ?? void 0,
|
|
328
|
+
sport: e.sport,
|
|
329
|
+
country: M(e.country),
|
|
330
|
+
gender: e.gender,
|
|
331
|
+
birthdate: e.birthdate ?? void 0,
|
|
332
|
+
providerRef: e.id
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
function pe(e) {
|
|
336
|
+
return {
|
|
337
|
+
entityType: "venue",
|
|
338
|
+
id: e.id,
|
|
339
|
+
legacyId: e.legacy_id ?? void 0,
|
|
340
|
+
name: e.name,
|
|
341
|
+
shortName: e.short_name ?? void 0,
|
|
342
|
+
threeLetterCode: e.three_letter_code ?? void 0,
|
|
343
|
+
translations: e.translations.map(F),
|
|
344
|
+
displayAsset: N(e.display_asset),
|
|
345
|
+
slug: e.slug,
|
|
346
|
+
tagScore: e.tag_score ?? void 0,
|
|
347
|
+
sport: e.sport,
|
|
348
|
+
country: M(e.country),
|
|
349
|
+
city: e.city ? J(e.city) : void 0,
|
|
350
|
+
providerRef: e.id
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
function ge(e) {
|
|
354
|
+
return {
|
|
355
|
+
entityType: e.entity_type,
|
|
356
|
+
id: e.id,
|
|
357
|
+
legacyId: e.legacy_id ?? void 0,
|
|
358
|
+
name: e.name,
|
|
359
|
+
shortName: e.short_name ?? void 0,
|
|
360
|
+
threeLetterCode: e.three_letter_code ?? void 0,
|
|
361
|
+
translations: e.translations.map(F),
|
|
362
|
+
displayAsset: N(e.display_asset),
|
|
363
|
+
slug: e.slug,
|
|
364
|
+
tagScore: e.tag_score ?? void 0,
|
|
365
|
+
sport: e.sport,
|
|
366
|
+
country: M(e.country),
|
|
367
|
+
gender: e.gender,
|
|
368
|
+
type: e.type ?? void 0,
|
|
369
|
+
region: e.region ?? void 0,
|
|
370
|
+
providerRef: e.id
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
function ye(e) {
|
|
374
|
+
return {
|
|
375
|
+
entityType: "match",
|
|
376
|
+
id: e.id,
|
|
377
|
+
legacyId: e.legacy_id ?? void 0,
|
|
378
|
+
name: e.name,
|
|
379
|
+
shortName: e.short_name ?? void 0,
|
|
380
|
+
threeLetterCode: e.three_letter_code ?? void 0,
|
|
381
|
+
translations: e.translations.map(F),
|
|
382
|
+
displayAsset: N(e.display_asset),
|
|
383
|
+
slug: e.slug,
|
|
384
|
+
tagScore: e.tag_score ?? void 0,
|
|
385
|
+
sport: e.sport,
|
|
386
|
+
competitionId: e.competition_id ?? void 0,
|
|
387
|
+
startTime: e.start_time ?? void 0,
|
|
388
|
+
homeTeam: e.home_team ? W(e.home_team) : void 0,
|
|
389
|
+
awayTeam: e.away_team ? W(e.away_team) : void 0,
|
|
390
|
+
providerRef: e.id
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
function he(e) {
|
|
394
|
+
return {
|
|
395
|
+
entityType: "country",
|
|
396
|
+
id: e.id,
|
|
397
|
+
legacyId: e.legacy_id ?? void 0,
|
|
398
|
+
name: e.name,
|
|
399
|
+
shortName: e.short_name ?? void 0,
|
|
400
|
+
threeLetterCode: e.three_letter_code ?? void 0,
|
|
401
|
+
translations: e.translations.map(F),
|
|
402
|
+
displayAsset: N(e.display_asset),
|
|
403
|
+
slug: e.slug,
|
|
404
|
+
tagScore: e.tag_score ?? void 0,
|
|
405
|
+
sport: e.sport,
|
|
406
|
+
providerRef: e.id
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
function Te(e) {
|
|
410
|
+
switch (e.entity_type) {
|
|
411
|
+
case "team":
|
|
412
|
+
return W(e);
|
|
413
|
+
case "city":
|
|
414
|
+
return J(e);
|
|
415
|
+
case "horse":
|
|
416
|
+
return de(e);
|
|
417
|
+
case "player":
|
|
418
|
+
return ue(e);
|
|
419
|
+
case "coach":
|
|
420
|
+
return me(e);
|
|
421
|
+
case "referee":
|
|
422
|
+
return fe(e);
|
|
423
|
+
case "venue":
|
|
424
|
+
return pe(e);
|
|
425
|
+
case "tournament":
|
|
426
|
+
case "competition":
|
|
427
|
+
return ge(e);
|
|
428
|
+
case "match":
|
|
429
|
+
return ye(e);
|
|
430
|
+
case "country":
|
|
431
|
+
return he(e);
|
|
432
|
+
default: {
|
|
433
|
+
const o = e;
|
|
434
|
+
throw new Error(`Unknown entity type: ${o.entity_type}`);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
async function we(e = {}, o) {
|
|
439
|
+
const t = o ?? R(), n = {};
|
|
440
|
+
e.name && (n.name = e.name), e.entityTypes && e.entityTypes.length > 0 && (n.entity_type = e.entityTypes.join(",")), e.sports && e.sports.length > 0 && (n.sport = e.sports.join(",")), e.eventStartTime && (n.event_start_time = e.eventStartTime), e.ids && e.ids.length > 0 && (n.ids = e.ids.join(",")), e.competitionIds && e.competitionIds.length > 0 && (n.competition_ids = e.competitionIds.join(",")), e.domain && (n.domain = e.domain), e.inputLanguage && (n.input_language = e.inputLanguage), e.translationLanguage && (n.translation_language = e.translationLanguage), e.limit !== void 0 && (n.limit = e.limit.toString()), e.offset !== void 0 && (n.offset = e.offset.toString());
|
|
441
|
+
const s = await le.get({
|
|
442
|
+
path: "/suggest",
|
|
443
|
+
params: n,
|
|
444
|
+
next: e.next,
|
|
445
|
+
config: t
|
|
446
|
+
});
|
|
447
|
+
return !s.results || s.results.length === 0 ? {
|
|
448
|
+
results: [],
|
|
449
|
+
query: e.name
|
|
450
|
+
} : {
|
|
451
|
+
results: s.results.map(Te),
|
|
452
|
+
query: e.name
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
const ve = z(te);
|
|
456
|
+
function Se(e, o) {
|
|
457
|
+
return {
|
|
458
|
+
teamId: e.id,
|
|
459
|
+
teamName: e.name,
|
|
460
|
+
seasonId: o,
|
|
461
|
+
statistics: e.statistics.map((t) => ({
|
|
462
|
+
key: t.id,
|
|
463
|
+
value: t.value,
|
|
464
|
+
label: t.name
|
|
465
|
+
}))
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
async function et(e, o) {
|
|
469
|
+
const t = o || R(), n = e.next ?? { revalidate: 600 }, s = await ve.get({
|
|
470
|
+
path: "/statistics/aggregate",
|
|
471
|
+
params: {
|
|
472
|
+
participant_ids: e.teamId,
|
|
473
|
+
season_ids: e.seasonId,
|
|
474
|
+
participant_type: "TEAM"
|
|
475
|
+
},
|
|
476
|
+
next: n,
|
|
477
|
+
config: t
|
|
478
|
+
});
|
|
479
|
+
if (!s.data || s.data.length === 0)
|
|
480
|
+
throw new Error(`No statistics found for team ${e.teamId} in season ${e.seasonId}`);
|
|
481
|
+
return Se(s.data[0], e.seasonId);
|
|
482
|
+
}
|
|
483
|
+
function _e(e) {
|
|
484
|
+
const o = e.replace(/\/$/, "");
|
|
485
|
+
function t(n) {
|
|
486
|
+
return `${o}${n}`;
|
|
487
|
+
}
|
|
488
|
+
return {
|
|
489
|
+
async get(n) {
|
|
490
|
+
const s = n.config || R(), { fansUnited: i } = s;
|
|
491
|
+
if (!i)
|
|
492
|
+
throw new Error(
|
|
493
|
+
"Fans United configuration is missing. Add 'fansUnited' with 'apiKey' and 'clientId' to your config."
|
|
494
|
+
);
|
|
495
|
+
if (!i.apiKey || !i.clientId)
|
|
496
|
+
throw new Error("Fans United configuration requires both 'apiKey' and 'clientId'");
|
|
497
|
+
const r = new URL(t(n.path));
|
|
498
|
+
if (r.searchParams.set("key", i.apiKey), r.searchParams.set("client_id", i.clientId), n.params)
|
|
499
|
+
for (const [l, u] of Object.entries(n.params))
|
|
500
|
+
u !== void 0 && (Array.isArray(u) ? u.length > 0 && r.searchParams.set(l, u.join(",")) : r.searchParams.set(l, u));
|
|
501
|
+
const d = await fetch(r.toString(), {
|
|
502
|
+
method: "GET",
|
|
503
|
+
headers: {
|
|
504
|
+
Accept: "application/json",
|
|
505
|
+
"Content-Type": "application/json",
|
|
506
|
+
// Merge custom headers (they can override defaults)
|
|
507
|
+
...n.headers
|
|
508
|
+
},
|
|
509
|
+
signal: AbortSignal.timeout(3e4),
|
|
510
|
+
// Next.js cache options for ISR/on-demand revalidation
|
|
511
|
+
...n.next && { next: n.next }
|
|
512
|
+
});
|
|
513
|
+
if (!d.ok) {
|
|
514
|
+
let l = `Fans United API error: ${d.status} ${d.statusText}`;
|
|
515
|
+
try {
|
|
516
|
+
const u = await d.text();
|
|
517
|
+
u && (l += ` - ${u}`);
|
|
518
|
+
} catch {
|
|
519
|
+
}
|
|
520
|
+
throw new Error(l);
|
|
521
|
+
}
|
|
522
|
+
return d.json();
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
const Ce = "https://football.fansunitedapi.com", b = _e(Ce);
|
|
527
|
+
function Ae(e) {
|
|
528
|
+
return {
|
|
529
|
+
id: String(e.id),
|
|
530
|
+
name: e.name,
|
|
531
|
+
active: e.active,
|
|
532
|
+
providerRef: [
|
|
533
|
+
{
|
|
534
|
+
provider: "fansunited",
|
|
535
|
+
id: String(e.id)
|
|
536
|
+
}
|
|
537
|
+
]
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
function Oe(e) {
|
|
541
|
+
const o = {
|
|
542
|
+
id: String(e.id),
|
|
543
|
+
name: e.name,
|
|
544
|
+
shortName: e.short_name,
|
|
545
|
+
slug: e.slug,
|
|
546
|
+
type: e.type || "LEAGUE",
|
|
547
|
+
region: e.region,
|
|
548
|
+
gender: e.gender,
|
|
549
|
+
providerRef: [
|
|
550
|
+
{
|
|
551
|
+
provider: "fansunited",
|
|
552
|
+
id: String(e.id)
|
|
553
|
+
}
|
|
554
|
+
]
|
|
555
|
+
};
|
|
556
|
+
return e.country && (o.country = {
|
|
557
|
+
id: String(e.country.id),
|
|
558
|
+
name: e.country.name,
|
|
559
|
+
code: e.country.code,
|
|
560
|
+
flag: e.country.flag,
|
|
561
|
+
providerRef: [
|
|
562
|
+
{
|
|
563
|
+
provider: "fansunited",
|
|
564
|
+
id: String(e.country.id)
|
|
565
|
+
}
|
|
566
|
+
]
|
|
567
|
+
}), e.logo && (o.assets = {
|
|
568
|
+
logo: e.logo
|
|
569
|
+
}), e.seasons && e.seasons.length > 0 && (o.seasons = e.seasons.map(Ae)), e.current_season && (o.season = {
|
|
570
|
+
id: String(e.current_season.id),
|
|
571
|
+
name: e.current_season.name,
|
|
572
|
+
status: e.current_season.active ? "ACTIVE" : "INACTIVE"
|
|
573
|
+
}), o;
|
|
574
|
+
}
|
|
575
|
+
function Fe(e) {
|
|
576
|
+
return e.map(Oe);
|
|
577
|
+
}
|
|
578
|
+
async function tt(e, o) {
|
|
579
|
+
const t = {};
|
|
580
|
+
e?.lang ? t.lang = e.lang : t.lang = "EN", e?.sortField && (t.sort_field = e.sortField), e?.sortOrder && (t.sort_order = e.sortOrder), e?.page !== void 0 && (t.page = String(e.page)), e?.perPage !== void 0 && (t.per_page = String(e.perPage)), e?.countryId !== void 0 && (t.country_id = String(e.countryId)), e?.active !== void 0 && (t.active = e.active ? "1" : "0");
|
|
581
|
+
const n = await b.get({
|
|
582
|
+
path: "/v1/competitions",
|
|
583
|
+
params: t,
|
|
584
|
+
config: o,
|
|
585
|
+
next: e?.next
|
|
586
|
+
});
|
|
587
|
+
return Fe(n.data);
|
|
588
|
+
}
|
|
589
|
+
function Ne(e) {
|
|
590
|
+
return {
|
|
591
|
+
id: e.id,
|
|
592
|
+
name: e.name,
|
|
593
|
+
code: e.country_code,
|
|
594
|
+
assets: e.assets?.flag ? {
|
|
595
|
+
flag: e.assets.flag
|
|
596
|
+
} : void 0,
|
|
597
|
+
providerRef: [
|
|
598
|
+
{
|
|
599
|
+
provider: "fansunited",
|
|
600
|
+
id: e.id
|
|
601
|
+
}
|
|
602
|
+
]
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
function De(e) {
|
|
606
|
+
return {
|
|
607
|
+
id: e.id,
|
|
608
|
+
name: e.name,
|
|
609
|
+
type: e.type?.toUpperCase() || "LEAGUE",
|
|
610
|
+
gender: e.gender?.toUpperCase(),
|
|
611
|
+
country: e.country ? Ne(e.country) : void 0,
|
|
612
|
+
assets: e.assets?.logo ? {
|
|
613
|
+
logo: e.assets.logo
|
|
614
|
+
} : void 0,
|
|
615
|
+
providerRef: [
|
|
616
|
+
{
|
|
617
|
+
provider: "fansunited",
|
|
618
|
+
id: e.id
|
|
619
|
+
}
|
|
620
|
+
]
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
function Ge(e) {
|
|
624
|
+
return De(e.data);
|
|
625
|
+
}
|
|
626
|
+
async function ot(e, o, t) {
|
|
627
|
+
const n = t || R(), s = {};
|
|
628
|
+
o?.lang && (s.lang = o.lang);
|
|
629
|
+
const i = await b.get({
|
|
630
|
+
path: `/v1/competitions/${e}`,
|
|
631
|
+
params: s,
|
|
632
|
+
next: o?.next,
|
|
633
|
+
config: n
|
|
634
|
+
});
|
|
635
|
+
return Ge(i);
|
|
636
|
+
}
|
|
637
|
+
function Re(e) {
|
|
638
|
+
return {
|
|
639
|
+
id: e.id,
|
|
640
|
+
name: e.name,
|
|
641
|
+
code: e.country_code,
|
|
642
|
+
flag: e.assets?.flag,
|
|
643
|
+
providerRef: [
|
|
644
|
+
{
|
|
645
|
+
provider: "fansunited",
|
|
646
|
+
id: e.id
|
|
647
|
+
}
|
|
648
|
+
]
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
function Ee(e) {
|
|
652
|
+
return {
|
|
653
|
+
id: e.id,
|
|
654
|
+
name: e.name,
|
|
655
|
+
shortName: e.short_name || void 0,
|
|
656
|
+
threeLetterCode: e.code,
|
|
657
|
+
type: e.national ? "national" : "club",
|
|
658
|
+
gender: e.gender ? e.gender.toUpperCase() : void 0,
|
|
659
|
+
country: e.country ? Re(e.country) : void 0,
|
|
660
|
+
assets: e.assets?.logo ? {
|
|
661
|
+
logo: e.assets.logo
|
|
662
|
+
} : void 0,
|
|
663
|
+
metadata: e.colors ? {
|
|
664
|
+
shirtColors: e.colors.primary ? [
|
|
665
|
+
{
|
|
666
|
+
type: "home",
|
|
667
|
+
colorCode: e.colors.primary
|
|
668
|
+
}
|
|
669
|
+
] : void 0
|
|
670
|
+
} : void 0,
|
|
671
|
+
providerRef: [
|
|
672
|
+
{
|
|
673
|
+
provider: "fansunited",
|
|
674
|
+
id: e.id
|
|
675
|
+
}
|
|
676
|
+
]
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
function Me(e) {
|
|
680
|
+
return Ee(e.data);
|
|
681
|
+
}
|
|
682
|
+
async function nt(e, o, t) {
|
|
683
|
+
const n = t || R(), s = {};
|
|
684
|
+
o?.lang && (s.lang = o.lang);
|
|
685
|
+
const i = await b.get({
|
|
686
|
+
path: `/v1/teams/${e}`,
|
|
687
|
+
params: s,
|
|
688
|
+
next: o?.next,
|
|
689
|
+
config: n
|
|
690
|
+
});
|
|
691
|
+
return Me(i);
|
|
692
|
+
}
|
|
693
|
+
function be(e) {
|
|
694
|
+
return {
|
|
695
|
+
id: e.id,
|
|
696
|
+
name: e.name,
|
|
697
|
+
code: e.country_code,
|
|
698
|
+
flag: e.assets?.flag,
|
|
699
|
+
providerRef: [
|
|
700
|
+
{
|
|
701
|
+
provider: "fansunited",
|
|
702
|
+
id: e.id
|
|
703
|
+
}
|
|
704
|
+
]
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
function He(e) {
|
|
708
|
+
return {
|
|
709
|
+
type: "player",
|
|
710
|
+
id: e.id,
|
|
711
|
+
name: e.name,
|
|
712
|
+
position: e.position,
|
|
713
|
+
birthdate: e.birth_date,
|
|
714
|
+
country: e.country ? be(e.country) : void 0,
|
|
715
|
+
assets: e.assets?.headshot ? {
|
|
716
|
+
photo: e.assets.headshot
|
|
717
|
+
} : void 0,
|
|
718
|
+
providerRef: [
|
|
719
|
+
{
|
|
720
|
+
provider: "fansunited",
|
|
721
|
+
id: e.id
|
|
722
|
+
}
|
|
723
|
+
]
|
|
724
|
+
};
|
|
725
|
+
}
|
|
726
|
+
function Ie(e) {
|
|
727
|
+
return He(e.data);
|
|
728
|
+
}
|
|
729
|
+
async function st(e, o, t) {
|
|
730
|
+
const n = t || R(), s = {};
|
|
731
|
+
o?.lang && (s.lang = o.lang);
|
|
732
|
+
const i = await b.get({
|
|
733
|
+
path: `/v1/players/${e}`,
|
|
734
|
+
params: s,
|
|
735
|
+
next: o?.next,
|
|
736
|
+
config: n
|
|
737
|
+
});
|
|
738
|
+
return Ie(i);
|
|
739
|
+
}
|
|
740
|
+
function Q(e) {
|
|
741
|
+
return {
|
|
742
|
+
id: e.id,
|
|
743
|
+
name: e.name,
|
|
744
|
+
code: e.country_code,
|
|
745
|
+
assets: e.assets?.flag ? {
|
|
746
|
+
flag: e.assets.flag
|
|
747
|
+
} : void 0,
|
|
748
|
+
providerRef: [
|
|
749
|
+
{
|
|
750
|
+
provider: "fansunited",
|
|
751
|
+
id: e.id
|
|
752
|
+
}
|
|
753
|
+
]
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
function ke(e) {
|
|
757
|
+
return {
|
|
758
|
+
id: e.id,
|
|
759
|
+
name: e.name,
|
|
760
|
+
type: e.type?.toUpperCase() || "LEAGUE",
|
|
761
|
+
gender: e.gender?.toUpperCase(),
|
|
762
|
+
country: e.country ? Q(e.country) : void 0,
|
|
763
|
+
assets: e.assets?.logo ? {
|
|
764
|
+
logo: e.assets.logo
|
|
765
|
+
} : void 0,
|
|
766
|
+
providerRef: [
|
|
767
|
+
{
|
|
768
|
+
provider: "fansunited",
|
|
769
|
+
id: e.id
|
|
770
|
+
}
|
|
771
|
+
]
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
function Le(e) {
|
|
775
|
+
if (e.status) {
|
|
776
|
+
const i = {
|
|
777
|
+
notstarted: { code: "not_started", type: "NOT_STARTED", name: "Not Started" },
|
|
778
|
+
live: { code: "live", type: "LIVE", name: "Live" },
|
|
779
|
+
finished: { code: "finished", type: "FINISHED", name: "Finished" },
|
|
780
|
+
postponed: { code: "postponed", type: "POSTPONED", name: "Postponed" },
|
|
781
|
+
cancelled: { code: "cancelled", type: "CANCELLED", name: "Cancelled" },
|
|
782
|
+
abandoned: { code: "abandoned", type: "ABANDONED", name: "Abandoned" }
|
|
783
|
+
}[e.status.type];
|
|
784
|
+
if (i)
|
|
785
|
+
return i;
|
|
786
|
+
}
|
|
787
|
+
let o = "not_started", t = "NOT_STARTED", n = "Not Started";
|
|
788
|
+
return e.finished_at ? (o = "finished", t = "FINISHED", n = "Finished") : e.started_at && (o = "live", t = "LIVE", n = "Live"), {
|
|
789
|
+
code: o,
|
|
790
|
+
name: n,
|
|
791
|
+
type: t
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
function Pe(e) {
|
|
795
|
+
return {
|
|
796
|
+
kickoffTime: new Date(e.kickoff_at),
|
|
797
|
+
currentMinute: e.minute ?? void 0,
|
|
798
|
+
currentPeriod: void 0
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
function V(e) {
|
|
802
|
+
return {
|
|
803
|
+
id: e.id,
|
|
804
|
+
name: e.name,
|
|
805
|
+
shortName: e.short_name ?? void 0,
|
|
806
|
+
fullName: e.full_name ?? void 0,
|
|
807
|
+
threeLetterCode: e.code,
|
|
808
|
+
type: e.national ? "national" : "club",
|
|
809
|
+
gender: e.gender?.toUpperCase(),
|
|
810
|
+
country: e.country ? Q(e.country) : void 0,
|
|
811
|
+
assets: e.assets?.logo ? {
|
|
812
|
+
logo: e.assets.logo
|
|
813
|
+
} : void 0,
|
|
814
|
+
providerRef: [
|
|
815
|
+
{
|
|
816
|
+
provider: "fansunited",
|
|
817
|
+
id: e.id
|
|
818
|
+
}
|
|
819
|
+
]
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
function $e(e) {
|
|
823
|
+
if (!e) return;
|
|
824
|
+
const o = (n) => n ? {
|
|
825
|
+
competitorOne: n.home_goals !== null ? String(n.home_goals) : "0",
|
|
826
|
+
competitorTwo: n.away_goals !== null ? String(n.away_goals) : "0"
|
|
827
|
+
} : void 0, t = o(e.ft_score);
|
|
828
|
+
if (t)
|
|
829
|
+
return {
|
|
830
|
+
competitorOne: t.competitorOne,
|
|
831
|
+
competitorTwo: t.competitorTwo,
|
|
832
|
+
breakdown: {
|
|
833
|
+
total: t,
|
|
834
|
+
halfTime: o(e.ht_score),
|
|
835
|
+
regularTime: o(e.ft_score),
|
|
836
|
+
extraTime: o(e.aet_score),
|
|
837
|
+
penaltyShootout: o(e.pen_score)
|
|
838
|
+
}
|
|
839
|
+
};
|
|
840
|
+
}
|
|
841
|
+
function X(e) {
|
|
842
|
+
return {
|
|
843
|
+
id: e.id,
|
|
844
|
+
status: Le(e),
|
|
845
|
+
timing: Pe(e),
|
|
846
|
+
competitorOne: V(e.home_team),
|
|
847
|
+
competitorTwo: V(e.away_team),
|
|
848
|
+
score: $e(e.scores),
|
|
849
|
+
competition: e.context?.competition ? ke(e.context.competition) : void 0,
|
|
850
|
+
lineupStatus: e.lineups_confirmed ? "CONFIRMED" : "NOT_AVAILABLE",
|
|
851
|
+
updatedAt: e.updated_at ? new Date(e.updated_at) : void 0,
|
|
852
|
+
isUndecided: e.undecided ?? void 0,
|
|
853
|
+
providerRef: [
|
|
854
|
+
{
|
|
855
|
+
provider: "fansunited",
|
|
856
|
+
id: e.id
|
|
857
|
+
}
|
|
858
|
+
]
|
|
859
|
+
};
|
|
860
|
+
}
|
|
861
|
+
function Ue(e) {
|
|
862
|
+
return X(e.data);
|
|
863
|
+
}
|
|
864
|
+
function xe(e) {
|
|
865
|
+
return e.data.map(X);
|
|
866
|
+
}
|
|
867
|
+
async function it(e, o, t) {
|
|
868
|
+
const n = t || R(), s = {};
|
|
869
|
+
o?.lang && (s.lang = o.lang);
|
|
870
|
+
const i = await b.get({
|
|
871
|
+
path: `/v1/matches/${e}`,
|
|
872
|
+
params: s,
|
|
873
|
+
next: o?.next,
|
|
874
|
+
config: n
|
|
875
|
+
});
|
|
876
|
+
return Ue(i);
|
|
877
|
+
}
|
|
878
|
+
async function rt(e, o) {
|
|
879
|
+
const t = o || R(), n = {};
|
|
880
|
+
e?.lang && (n.lang = e.lang), e?.competitions && (n.competitions = e.competitions), e?.countries && (n.countries = e.countries), e?.fromDate && (n.from_date = e.fromDate), e?.toDate && (n.to_date = e.toDate), e?.matches && (n.matches = e.matches), e?.teams && (n.teams = e.teams), e?.status && (n.status = e.status), e?.limit !== void 0 && (n.limit = String(e.limit)), e?.page !== void 0 && (n.page = String(e.page)), e?.sortField && (n.sort_field = e.sortField), e?.sortOrder && (n.sort_order = e.sortOrder), e?.showDeleted !== void 0 && (n.show_deleted = e.showDeleted ? "true" : "false");
|
|
881
|
+
const s = await b.get({
|
|
882
|
+
path: "/v1/matches",
|
|
883
|
+
params: n,
|
|
884
|
+
next: e?.next,
|
|
885
|
+
config: t
|
|
886
|
+
});
|
|
887
|
+
return xe(s);
|
|
888
|
+
}
|
|
889
|
+
function q(e) {
|
|
890
|
+
return {
|
|
891
|
+
id: e.id,
|
|
892
|
+
name: e.name,
|
|
893
|
+
code: e.country_code,
|
|
894
|
+
flag: e.assets?.flag || void 0,
|
|
895
|
+
providerRef: [
|
|
896
|
+
{
|
|
897
|
+
provider: "fansunited",
|
|
898
|
+
id: e.id
|
|
899
|
+
}
|
|
900
|
+
]
|
|
901
|
+
};
|
|
902
|
+
}
|
|
903
|
+
function Be(e) {
|
|
904
|
+
return {
|
|
905
|
+
id: e.id,
|
|
906
|
+
name: e.name,
|
|
907
|
+
shortName: e.short_name || void 0,
|
|
908
|
+
type: e.type || "LEAGUE",
|
|
909
|
+
region: e.region,
|
|
910
|
+
gender: e.gender?.toUpperCase(),
|
|
911
|
+
country: e.country ? q(e.country) : void 0,
|
|
912
|
+
assets: e.assets?.logo ? {
|
|
913
|
+
logo: e.assets.logo
|
|
914
|
+
} : void 0,
|
|
915
|
+
providerRef: [
|
|
916
|
+
{
|
|
917
|
+
provider: "fansunited",
|
|
918
|
+
id: e.id
|
|
919
|
+
}
|
|
920
|
+
]
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
function We(e) {
|
|
924
|
+
return {
|
|
925
|
+
type: "player",
|
|
926
|
+
id: e.id,
|
|
927
|
+
name: e.name,
|
|
928
|
+
position: e.position || void 0,
|
|
929
|
+
gender: e.gender?.toUpperCase(),
|
|
930
|
+
birthdate: e.birthdate || void 0,
|
|
931
|
+
country: e.country ? q(e.country) : void 0,
|
|
932
|
+
assets: e.assets?.photo ? {
|
|
933
|
+
photo: e.assets.photo
|
|
934
|
+
} : void 0,
|
|
935
|
+
providerRef: [
|
|
936
|
+
{
|
|
937
|
+
provider: "fansunited",
|
|
938
|
+
id: e.id
|
|
939
|
+
}
|
|
940
|
+
]
|
|
941
|
+
};
|
|
942
|
+
}
|
|
943
|
+
function qe(e) {
|
|
944
|
+
return {
|
|
945
|
+
type: e.national ? "national" : "club",
|
|
946
|
+
id: e.id,
|
|
947
|
+
name: e.name,
|
|
948
|
+
shortName: e.short_name || void 0,
|
|
949
|
+
threeLetterCode: e.code || void 0,
|
|
950
|
+
gender: e.gender?.toUpperCase(),
|
|
951
|
+
country: e.country ? q(e.country) : void 0,
|
|
952
|
+
assets: e.assets?.logo ? {
|
|
953
|
+
logo: e.assets.logo
|
|
954
|
+
} : void 0,
|
|
955
|
+
providerRef: [
|
|
956
|
+
{
|
|
957
|
+
provider: "fansunited",
|
|
958
|
+
id: e.id
|
|
959
|
+
}
|
|
960
|
+
]
|
|
961
|
+
};
|
|
962
|
+
}
|
|
963
|
+
function B(e) {
|
|
964
|
+
switch (e.entity_type) {
|
|
965
|
+
case "competition": {
|
|
966
|
+
const o = Be(e);
|
|
967
|
+
return {
|
|
968
|
+
source: "FOOTBALL",
|
|
969
|
+
entityType: "competition",
|
|
970
|
+
entityId: e.id,
|
|
971
|
+
entityData: o
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
case "player": {
|
|
975
|
+
const o = We(e);
|
|
976
|
+
return {
|
|
977
|
+
source: "FOOTBALL",
|
|
978
|
+
entityType: "player",
|
|
979
|
+
entityId: e.id,
|
|
980
|
+
entityData: o
|
|
981
|
+
};
|
|
982
|
+
}
|
|
983
|
+
case "team": {
|
|
984
|
+
const o = qe(e);
|
|
985
|
+
return {
|
|
986
|
+
source: "FOOTBALL",
|
|
987
|
+
entityType: "team",
|
|
988
|
+
entityId: e.id,
|
|
989
|
+
entityData: o
|
|
990
|
+
};
|
|
991
|
+
}
|
|
992
|
+
case "venue":
|
|
993
|
+
case "coach":
|
|
994
|
+
return null;
|
|
995
|
+
default:
|
|
996
|
+
throw new Error(`Unknown entity type: ${e.entity_type}`);
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
async function at(e, o) {
|
|
1000
|
+
if (!e.query || e.query.trim() === "")
|
|
1001
|
+
return [];
|
|
1002
|
+
const t = o || R(), n = {
|
|
1003
|
+
q: e.query.trim()
|
|
1004
|
+
}, i = (e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["competition", "team", "player"]).map((d) => {
|
|
1005
|
+
switch (d) {
|
|
1006
|
+
case "team":
|
|
1007
|
+
return "teams";
|
|
1008
|
+
case "player":
|
|
1009
|
+
return "players";
|
|
1010
|
+
case "competition":
|
|
1011
|
+
return "competitions";
|
|
1012
|
+
default:
|
|
1013
|
+
return d;
|
|
1014
|
+
}
|
|
1015
|
+
});
|
|
1016
|
+
n.entities = i.join(","), e.lang && (n.lang = e.lang), e.limit && (n.limit = String(e.limit));
|
|
1017
|
+
const r = await b.get({
|
|
1018
|
+
path: "/v1/search",
|
|
1019
|
+
params: n,
|
|
1020
|
+
next: e.next,
|
|
1021
|
+
config: t
|
|
1022
|
+
}), a = [];
|
|
1023
|
+
return r.data && (r.data.competitions && r.data.competitions.forEach((d) => {
|
|
1024
|
+
const l = B({ ...d, entity_type: "competition" });
|
|
1025
|
+
l && a.push(l);
|
|
1026
|
+
}), r.data.teams && r.data.teams.forEach((d) => {
|
|
1027
|
+
const l = B({ ...d, entity_type: "team" });
|
|
1028
|
+
l && a.push(l);
|
|
1029
|
+
}), r.data.players && r.data.players.forEach((d) => {
|
|
1030
|
+
const l = B({ ...d, entity_type: "player" });
|
|
1031
|
+
l && a.push(l);
|
|
1032
|
+
})), a;
|
|
1033
|
+
}
|
|
1034
|
+
function ct(e) {
|
|
1035
|
+
return !e.seasons || e.seasons.length === 0 ? void 0 : e.seasons.find((t) => t.active) ?? e.seasons[0];
|
|
1036
|
+
}
|
|
1037
|
+
function lt(e, o) {
|
|
1038
|
+
const t = /* @__PURE__ */ new Date(), n = o.filter((s) => {
|
|
1039
|
+
const i = s.competitorOne.id === e || s.competitorTwo.id === e, r = s.status.type === "NOT_STARTED", a = new Date(s.timing.kickoffTime) >= t;
|
|
1040
|
+
return i && r && a;
|
|
1041
|
+
});
|
|
1042
|
+
return n.sort((s, i) => new Date(s.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()), n[0];
|
|
1043
|
+
}
|
|
1044
|
+
function dt(e, o) {
|
|
1045
|
+
const t = /* @__PURE__ */ new Date(), n = o.filter((s) => {
|
|
1046
|
+
const i = s.competitorOne.id === e || s.competitorTwo.id === e, r = s.status.type === "FINISHED", a = new Date(s.timing.kickoffTime) <= t;
|
|
1047
|
+
return i && r && a;
|
|
1048
|
+
});
|
|
1049
|
+
return n.sort((s, i) => new Date(i.timing.kickoffTime).getTime() - new Date(s.timing.kickoffTime).getTime()), n[0];
|
|
1050
|
+
}
|
|
1051
|
+
function ut(e, o) {
|
|
1052
|
+
const t = /* @__PURE__ */ new Date();
|
|
1053
|
+
return o.filter((s) => {
|
|
1054
|
+
const i = s.competitorOne.id === e || s.competitorTwo.id === e, r = s.status.type === "NOT_STARTED" || s.status.type === "LIVE", a = new Date(s.timing.kickoffTime) >= t || s.status.type === "LIVE";
|
|
1055
|
+
return i && r && a;
|
|
1056
|
+
}).sort(
|
|
1057
|
+
(s, i) => new Date(s.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()
|
|
1058
|
+
);
|
|
1059
|
+
}
|
|
1060
|
+
function mt(e, o) {
|
|
1061
|
+
const t = /* @__PURE__ */ new Date();
|
|
1062
|
+
return o.filter((s) => {
|
|
1063
|
+
const i = s.competitorOne.id === e || s.competitorTwo.id === e, r = s.status.type === "FINISHED", a = new Date(s.timing.kickoffTime) <= t;
|
|
1064
|
+
return i && r && a;
|
|
1065
|
+
}).sort(
|
|
1066
|
+
(s, i) => new Date(i.timing.kickoffTime).getTime() - new Date(s.timing.kickoffTime).getTime()
|
|
1067
|
+
);
|
|
1068
|
+
}
|
|
1069
|
+
function ft(e, o, t) {
|
|
1070
|
+
const n = t.filter((r) => r.status.type === "FINISHED"), s = t.filter(
|
|
1071
|
+
(r) => r.status.type === "NOT_STARTED" || r.status.type === "POSTPONED"
|
|
1072
|
+
), i = o.entries.map((r) => {
|
|
1073
|
+
const a = r.competitor.id, d = n.filter(
|
|
1074
|
+
(m) => m.competitorOne.id === e && m.competitorTwo.id === a || m.competitorOne.id === a && m.competitorTwo.id === e
|
|
1075
|
+
), l = s.filter(
|
|
1076
|
+
(m) => m.competitorOne.id === e && m.competitorTwo.id === a || m.competitorOne.id === a && m.competitorTwo.id === e
|
|
1077
|
+
);
|
|
1078
|
+
let u, c;
|
|
1079
|
+
return d.forEach((m) => {
|
|
1080
|
+
const p = m.competitorOne.id === e, g = parseInt(m.score?.competitorOne ?? "0"), h = parseInt(m.score?.competitorTwo ?? "0"), D = p ? g : h, S = p ? h : g;
|
|
1081
|
+
let A;
|
|
1082
|
+
D > S ? A = "W" : D === S ? A = "D" : A = "L";
|
|
1083
|
+
const G = {
|
|
1084
|
+
result: A,
|
|
1085
|
+
score: `${g} - ${h}`,
|
|
1086
|
+
date: m.timing.kickoffTime,
|
|
1087
|
+
matchId: m.id,
|
|
1088
|
+
isUpcoming: !1
|
|
1089
|
+
};
|
|
1090
|
+
p ? u = G : c = G;
|
|
1091
|
+
}), l.forEach((m) => {
|
|
1092
|
+
const p = m.competitorOne.id === e;
|
|
1093
|
+
p && !u ? u = {
|
|
1094
|
+
date: m.timing.kickoffTime,
|
|
1095
|
+
matchId: m.id,
|
|
1096
|
+
isUpcoming: !0
|
|
1097
|
+
} : !p && !c && (c = {
|
|
1098
|
+
date: m.timing.kickoffTime,
|
|
1099
|
+
matchId: m.id,
|
|
1100
|
+
isUpcoming: !0
|
|
1101
|
+
});
|
|
1102
|
+
}), {
|
|
1103
|
+
rank: r.rank,
|
|
1104
|
+
teamId: r.competitor.id,
|
|
1105
|
+
teamName: r.competitor.name,
|
|
1106
|
+
teamShortName: r.competitor.shortName,
|
|
1107
|
+
teamLogo: r.competitor.logo,
|
|
1108
|
+
gamesPlayed: r.stats.played ?? 0,
|
|
1109
|
+
points: r.stats.points ?? 0,
|
|
1110
|
+
homeResult: u,
|
|
1111
|
+
awayResult: c
|
|
1112
|
+
};
|
|
1113
|
+
});
|
|
1114
|
+
return {
|
|
1115
|
+
teamId: e,
|
|
1116
|
+
rows: i
|
|
1117
|
+
};
|
|
1118
|
+
}
|
|
1119
|
+
function pt(e, o = 10) {
|
|
1120
|
+
return e.players.filter((t) => (t.seasonStatistics?.goals ?? 0) > 0).sort((t, n) => {
|
|
1121
|
+
const s = t.seasonStatistics?.goals ?? 0, i = n.seasonStatistics?.goals ?? 0;
|
|
1122
|
+
if (i !== s)
|
|
1123
|
+
return i - s;
|
|
1124
|
+
const r = t.seasonStatistics?.assists ?? 0;
|
|
1125
|
+
return (n.seasonStatistics?.assists ?? 0) - r;
|
|
1126
|
+
}).slice(0, o);
|
|
1127
|
+
}
|
|
1128
|
+
function gt(e, o = 10) {
|
|
1129
|
+
return e.players.filter((t) => (t.seasonStatistics?.assists ?? 0) > 0).sort((t, n) => {
|
|
1130
|
+
const s = t.seasonStatistics?.assists ?? 0, i = n.seasonStatistics?.assists ?? 0;
|
|
1131
|
+
if (i !== s)
|
|
1132
|
+
return i - s;
|
|
1133
|
+
const r = t.seasonStatistics?.goals ?? 0;
|
|
1134
|
+
return (n.seasonStatistics?.goals ?? 0) - r;
|
|
1135
|
+
}).slice(0, o);
|
|
1136
|
+
}
|
|
1137
|
+
function yt(e, o = 10) {
|
|
1138
|
+
return e.players.filter((t) => (t.seasonStatistics?.appearances ?? 0) > 0).sort((t, n) => {
|
|
1139
|
+
const s = t.seasonStatistics?.appearances ?? 0, i = n.seasonStatistics?.appearances ?? 0;
|
|
1140
|
+
if (i !== s)
|
|
1141
|
+
return i - s;
|
|
1142
|
+
const r = t.seasonStatistics?.minutes ?? 0;
|
|
1143
|
+
return (n.seasonStatistics?.minutes ?? 0) - r;
|
|
1144
|
+
}).slice(0, o);
|
|
1145
|
+
}
|
|
1146
|
+
function ht(e, o = 10) {
|
|
1147
|
+
return e.players.filter((t) => (t.seasonStatistics?.minutes ?? 0) > 0).sort((t, n) => {
|
|
1148
|
+
const s = t.seasonStatistics?.minutes ?? 0, i = n.seasonStatistics?.minutes ?? 0;
|
|
1149
|
+
if (i !== s)
|
|
1150
|
+
return i - s;
|
|
1151
|
+
const r = t.seasonStatistics?.appearances ?? 0;
|
|
1152
|
+
return (n.seasonStatistics?.appearances ?? 0) - r;
|
|
1153
|
+
}).slice(0, o);
|
|
1154
|
+
}
|
|
1155
|
+
function Tt(e, o = 10) {
|
|
1156
|
+
return e.players.filter((t) => (t.seasonStatistics?.cleansheets ?? 0) > 0).sort((t, n) => {
|
|
1157
|
+
const s = t.seasonStatistics?.cleansheets ?? 0, i = n.seasonStatistics?.cleansheets ?? 0;
|
|
1158
|
+
if (i !== s)
|
|
1159
|
+
return i - s;
|
|
1160
|
+
const r = t.seasonStatistics?.appearances ?? 0;
|
|
1161
|
+
return (n.seasonStatistics?.appearances ?? 0) - r;
|
|
1162
|
+
}).slice(0, o);
|
|
1163
|
+
}
|
|
1164
|
+
function vt(e, o = 10) {
|
|
1165
|
+
return e.players.filter((t) => {
|
|
1166
|
+
const n = t.seasonStatistics?.yellowCards ?? 0, s = t.seasonStatistics?.redCards ?? 0;
|
|
1167
|
+
return n + s > 0;
|
|
1168
|
+
}).sort((t, n) => {
|
|
1169
|
+
const s = t.seasonStatistics?.yellowCards ?? 0, i = t.seasonStatistics?.redCards ?? 0, r = n.seasonStatistics?.yellowCards ?? 0, a = n.seasonStatistics?.redCards ?? 0, d = s + i * 3, l = r + a * 3;
|
|
1170
|
+
return l !== d ? l - d : a !== i ? a - i : r - s;
|
|
1171
|
+
}).slice(0, o);
|
|
1172
|
+
}
|
|
1173
|
+
const je = ["GOAL", "PENALTY_GOAL", "OWN_GOAL"];
|
|
1174
|
+
function O(e, o) {
|
|
1175
|
+
return o > 0 ? e / o * 100 : 0;
|
|
1176
|
+
}
|
|
1177
|
+
function U(e, o) {
|
|
1178
|
+
return o > 0 ? e / o : 0;
|
|
1179
|
+
}
|
|
1180
|
+
function St(e, o = !1, t = 2) {
|
|
1181
|
+
return o ? `${Math.round(e)}%` : Number.isInteger(e) ? e.toString() : e.toFixed(t);
|
|
1182
|
+
}
|
|
1183
|
+
function _t(e, o) {
|
|
1184
|
+
const t = typeof e == "string" ? parseFloat(e) : e;
|
|
1185
|
+
if (isNaN(t) || o === 0) return "0";
|
|
1186
|
+
const n = (t / o).toFixed(1);
|
|
1187
|
+
return `${t} (${n} avg)`;
|
|
1188
|
+
}
|
|
1189
|
+
function Ct(e, o) {
|
|
1190
|
+
const t = typeof e == "string" ? parseFloat(e) : e;
|
|
1191
|
+
return isNaN(t) || o === 0 ? "0.0" : (t / o).toFixed(1);
|
|
1192
|
+
}
|
|
1193
|
+
function At(e) {
|
|
1194
|
+
const o = parseFloat(e);
|
|
1195
|
+
return isNaN(o) ? "0%" : `${Math.round(o)}%`;
|
|
1196
|
+
}
|
|
1197
|
+
function Ve(e, o, t) {
|
|
1198
|
+
if (e.status?.type !== "FINISHED" || !e.score) return null;
|
|
1199
|
+
const n = parseInt(e.score.competitorOne || "0"), s = parseInt(e.score.competitorTwo || "0"), i = t ? n : s, r = t ? s : n;
|
|
1200
|
+
let a = null, d = null;
|
|
1201
|
+
const l = e.score.breakdown?.halfTime;
|
|
1202
|
+
if (l) {
|
|
1203
|
+
const p = parseInt(l.competitorOne || "0"), g = parseInt(l.competitorTwo || "0");
|
|
1204
|
+
a = t ? p : g, d = t ? g : p;
|
|
1205
|
+
}
|
|
1206
|
+
const u = e.statistics;
|
|
1207
|
+
let c = null, m = null;
|
|
1208
|
+
if (u) {
|
|
1209
|
+
const p = u.find?.((g) => g.type === "CORNERS");
|
|
1210
|
+
p && (c = t ? p.competitorOne : p.competitorTwo, m = t ? p.competitorTwo : p.competitorOne);
|
|
1211
|
+
}
|
|
1212
|
+
return {
|
|
1213
|
+
goalsFor: i,
|
|
1214
|
+
goalsAgainst: r,
|
|
1215
|
+
halfTimeGoalsFor: a,
|
|
1216
|
+
halfTimeGoalsAgainst: d,
|
|
1217
|
+
cornersFor: c,
|
|
1218
|
+
cornersAgainst: m,
|
|
1219
|
+
isWin: i > r,
|
|
1220
|
+
isDraw: i === r,
|
|
1221
|
+
isLoss: i < r
|
|
1222
|
+
};
|
|
1223
|
+
}
|
|
1224
|
+
function j(e, o) {
|
|
1225
|
+
return e.competitorOne.id === o;
|
|
1226
|
+
}
|
|
1227
|
+
function Ke(e, o) {
|
|
1228
|
+
return e.competitorTwo.id === o;
|
|
1229
|
+
}
|
|
1230
|
+
function Ot(e, o) {
|
|
1231
|
+
return j(e, o) || Ke(e, o);
|
|
1232
|
+
}
|
|
1233
|
+
function Ft(e) {
|
|
1234
|
+
return e.status?.type === "FINISHED";
|
|
1235
|
+
}
|
|
1236
|
+
function Nt(e, o) {
|
|
1237
|
+
const t = j(e, o);
|
|
1238
|
+
return parseInt(t ? e.score?.competitorOne || "0" : e.score?.competitorTwo || "0");
|
|
1239
|
+
}
|
|
1240
|
+
function Dt(e, o) {
|
|
1241
|
+
const t = j(e, o);
|
|
1242
|
+
return parseInt(t ? e.score?.competitorTwo || "0" : e.score?.competitorOne || "0");
|
|
1243
|
+
}
|
|
1244
|
+
function Gt(e, o, t) {
|
|
1245
|
+
const n = e.filter((u) => {
|
|
1246
|
+
if (u.status?.type !== "FINISHED" || !u.score) return !1;
|
|
1247
|
+
const c = u.competitorOne.id === o || u.competitorTwo.id === o, m = u.competitorOne.id === t || u.competitorTwo.id === t;
|
|
1248
|
+
return c && m;
|
|
1249
|
+
});
|
|
1250
|
+
let s = 0, i = 0, r = 0, a = 0, d = 0;
|
|
1251
|
+
n.forEach((u) => {
|
|
1252
|
+
const c = parseInt(u.score?.competitorOne || "0"), m = parseInt(u.score?.competitorTwo || "0"), p = u.competitorOne.id === o, g = p ? c : m, h = p ? m : c;
|
|
1253
|
+
a += g, d += h, g > h ? s++ : h > g ? i++ : r++;
|
|
1254
|
+
});
|
|
1255
|
+
const l = n.length;
|
|
1256
|
+
return {
|
|
1257
|
+
totalMatches: l,
|
|
1258
|
+
homeTeamWins: s,
|
|
1259
|
+
awayTeamWins: i,
|
|
1260
|
+
draws: r,
|
|
1261
|
+
homeTeamGoals: a,
|
|
1262
|
+
awayTeamGoals: d,
|
|
1263
|
+
homeTeamWinPercentage: l > 0 ? s / l * 100 : 0,
|
|
1264
|
+
awayTeamWinPercentage: l > 0 ? i / l * 100 : 0,
|
|
1265
|
+
drawPercentage: l > 0 ? r / l * 100 : 0,
|
|
1266
|
+
homeTeamAvgGoals: l > 0 ? a / l : 0,
|
|
1267
|
+
awayTeamAvgGoals: l > 0 ? d / l : 0
|
|
1268
|
+
};
|
|
1269
|
+
}
|
|
1270
|
+
function Rt(e, o, t, n = 5) {
|
|
1271
|
+
return e.filter((i) => {
|
|
1272
|
+
if (i.status?.type !== "FINISHED" || !i.score) return !1;
|
|
1273
|
+
const r = i.competitorOne.id === o || i.competitorTwo.id === o, a = i.competitorOne.id === t || i.competitorTwo.id === t;
|
|
1274
|
+
return r && a;
|
|
1275
|
+
}).sort((i, r) => new Date(r.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()).slice(0, n).map((i) => {
|
|
1276
|
+
const r = parseInt(i.score?.competitorOne || "0"), a = parseInt(i.score?.competitorTwo || "0"), d = i.competitorOne.id === o, l = d ? r : a, u = d ? a : r;
|
|
1277
|
+
let c;
|
|
1278
|
+
return l > u ? c = "home" : u > l ? c = "away" : c = "draw", {
|
|
1279
|
+
id: i.id,
|
|
1280
|
+
date: new Date(i.timing.kickoffTime).toLocaleDateString("en-GB", {
|
|
1281
|
+
day: "numeric",
|
|
1282
|
+
month: "short",
|
|
1283
|
+
year: "numeric"
|
|
1284
|
+
}),
|
|
1285
|
+
homeTeamName: i.competitorOne.name,
|
|
1286
|
+
awayTeamName: i.competitorTwo.name,
|
|
1287
|
+
homeTeamLogo: i.competitorOne.assets?.logo,
|
|
1288
|
+
awayTeamLogo: i.competitorTwo.assets?.logo,
|
|
1289
|
+
homeScore: r,
|
|
1290
|
+
awayScore: a,
|
|
1291
|
+
venue: i.venue?.name,
|
|
1292
|
+
winner: c
|
|
1293
|
+
};
|
|
1294
|
+
});
|
|
1295
|
+
}
|
|
1296
|
+
function Ye(e, o, t) {
|
|
1297
|
+
return e.filter((n) => {
|
|
1298
|
+
const s = n.competitorOne.id === o, i = n.competitorTwo.id === o;
|
|
1299
|
+
return !s && !i ? !1 : t === "home" ? s : i;
|
|
1300
|
+
}).map((n) => {
|
|
1301
|
+
const s = n.competitorOne.id === o;
|
|
1302
|
+
return Ve(n, o, s);
|
|
1303
|
+
}).filter((n) => n !== null);
|
|
1304
|
+
}
|
|
1305
|
+
function K(e, o, t, n) {
|
|
1306
|
+
let s = 0;
|
|
1307
|
+
for (const i of e) {
|
|
1308
|
+
const r = i.competitorOne.id === o, a = i.competitorTwo.id === o;
|
|
1309
|
+
if (!r && !a || t === "home" && !r || t === "away" && !a || i.status?.type !== "FINISHED") continue;
|
|
1310
|
+
const d = i.mainEvents;
|
|
1311
|
+
if (!d || !Array.isArray(d)) continue;
|
|
1312
|
+
const l = d.filter((g) => g.type && je.includes(g.type)).sort((g, h) => {
|
|
1313
|
+
const D = g.minute ?? 0, S = h.minute ?? 0;
|
|
1314
|
+
return D !== S ? D - S : (g.injuryMinute ?? 0) - (h.injuryMinute ?? 0);
|
|
1315
|
+
});
|
|
1316
|
+
if (l.length === 0) continue;
|
|
1317
|
+
const u = l[0], c = r ? "ONE" : "TWO", m = u.type === "OWN_GOAL";
|
|
1318
|
+
let p;
|
|
1319
|
+
m ? p = u.competitorPosition !== c : p = u.competitorPosition === c, (n === "scored" && p || n === "conceded" && !p) && s++;
|
|
1320
|
+
}
|
|
1321
|
+
return s;
|
|
1322
|
+
}
|
|
1323
|
+
function ze(e, o, t) {
|
|
1324
|
+
let n = 0;
|
|
1325
|
+
for (const s of e) {
|
|
1326
|
+
const i = s.competitorOne.id === o, r = s.competitorTwo.id === o;
|
|
1327
|
+
if (!i && !r || t === "home" && !i || t === "away" && !r || s.status?.type !== "FINISHED") continue;
|
|
1328
|
+
const a = s.mainEvents;
|
|
1329
|
+
a && Array.isArray(a) && n++;
|
|
1330
|
+
}
|
|
1331
|
+
return n;
|
|
1332
|
+
}
|
|
1333
|
+
function Et(e, o, t) {
|
|
1334
|
+
const n = Ye(e, o, t), s = n.length;
|
|
1335
|
+
if (s === 0)
|
|
1336
|
+
return {
|
|
1337
|
+
played: 0,
|
|
1338
|
+
goalsForPerMatch: 0,
|
|
1339
|
+
cleanSheets: 0,
|
|
1340
|
+
wonToNil: 0,
|
|
1341
|
+
scoringRate: 0,
|
|
1342
|
+
scoredInBothHalves: 0,
|
|
1343
|
+
scoredFirst: 0,
|
|
1344
|
+
leadingAtHalfTime: 0,
|
|
1345
|
+
goalsAgainstPerMatch: 0,
|
|
1346
|
+
failedToScore: 0,
|
|
1347
|
+
lostToNil: 0,
|
|
1348
|
+
concedingRate: 0,
|
|
1349
|
+
concededInBothHalves: 0,
|
|
1350
|
+
concededFirst: 0,
|
|
1351
|
+
losingAtHalfTime: 0,
|
|
1352
|
+
avgCornersFor: 0,
|
|
1353
|
+
avgCornersAgainst: 0
|
|
1354
|
+
};
|
|
1355
|
+
const i = n.reduce((f, v) => f + v.goalsFor, 0), r = n.reduce((f, v) => f + v.goalsAgainst, 0), a = n.filter((f) => f.goalsAgainst === 0).length, d = n.filter((f) => f.isWin && f.goalsAgainst === 0).length, l = n.filter((f) => f.goalsFor > 0).length, u = n.filter((f) => f.goalsFor === 0).length, c = n.filter((f) => f.isLoss && f.goalsFor === 0).length, m = n.filter((f) => f.goalsAgainst > 0).length, p = n.filter((f) => f.halfTimeGoalsFor !== null), g = p.length, h = p.filter((f) => {
|
|
1356
|
+
const v = f.halfTimeGoalsFor, I = f.goalsFor - v;
|
|
1357
|
+
return v > 0 && I > 0;
|
|
1358
|
+
}).length, D = K(e, o, t, "scored"), S = ze(e, o, t), A = p.filter((f) => f.halfTimeGoalsFor > f.halfTimeGoalsAgainst).length, G = p.filter((f) => {
|
|
1359
|
+
const v = f.halfTimeGoalsAgainst, I = f.goalsAgainst - v;
|
|
1360
|
+
return v > 0 && I > 0;
|
|
1361
|
+
}).length, k = K(e, o, t, "conceded"), L = p.filter((f) => f.halfTimeGoalsAgainst > f.halfTimeGoalsFor).length, H = n.filter((f) => f.cornersFor !== null), P = H.reduce((f, v) => f + (v.cornersFor || 0), 0), $ = H.reduce((f, v) => f + (v.cornersAgainst || 0), 0);
|
|
1362
|
+
return {
|
|
1363
|
+
played: s,
|
|
1364
|
+
goalsForPerMatch: U(i, s),
|
|
1365
|
+
cleanSheets: O(a, s),
|
|
1366
|
+
wonToNil: O(d, s),
|
|
1367
|
+
scoringRate: O(l, s),
|
|
1368
|
+
scoredInBothHalves: O(h, g),
|
|
1369
|
+
scoredFirst: O(D, S),
|
|
1370
|
+
leadingAtHalfTime: O(A, g),
|
|
1371
|
+
goalsAgainstPerMatch: U(r, s),
|
|
1372
|
+
failedToScore: O(u, s),
|
|
1373
|
+
lostToNil: O(c, s),
|
|
1374
|
+
concedingRate: O(m, s),
|
|
1375
|
+
concededInBothHalves: O(G, g),
|
|
1376
|
+
concededFirst: O(k, S),
|
|
1377
|
+
losingAtHalfTime: O(L, g),
|
|
1378
|
+
avgCornersFor: U(P, H.length),
|
|
1379
|
+
avgCornersAgainst: U($, H.length)
|
|
1380
|
+
};
|
|
1381
|
+
}
|
|
1382
|
+
function Je(e, o) {
|
|
1383
|
+
return e.filter((t) => t.status?.type !== "FINISHED" ? !1 : t.competitorOne.id === o || t.competitorTwo.id === o).map((t) => {
|
|
1384
|
+
const n = t.competitorOne.id === o, s = parseInt(t.score?.competitorOne || "0"), i = parseInt(t.score?.competitorTwo || "0"), r = s + i, a = t.periods;
|
|
1385
|
+
let d = null;
|
|
1386
|
+
if (a && Array.isArray(a)) {
|
|
1387
|
+
const l = a.find(
|
|
1388
|
+
(u) => u.type === "FIRST_HALF" || u.type === "1ST_HALF"
|
|
1389
|
+
);
|
|
1390
|
+
if (l?.score) {
|
|
1391
|
+
const u = parseInt(l.score.competitorOne || "0"), c = parseInt(l.score.competitorTwo || "0");
|
|
1392
|
+
d = u + c;
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
return { totalGoals: r, halfTimeGoals: d, isHome: n };
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
function y(e, o) {
|
|
1399
|
+
return e.length === 0 ? 0 : e.filter((n) => n > o).length / e.length * 100;
|
|
1400
|
+
}
|
|
1401
|
+
function Mt(e, o) {
|
|
1402
|
+
const t = Je(e, o), n = t.filter((c) => c.isHome), s = t.filter((c) => !c.isHome), i = t.map((c) => c.totalGoals), r = n.map((c) => c.totalGoals), a = s.map((c) => c.totalGoals), d = t.filter((c) => c.halfTimeGoals !== null).map((c) => c.halfTimeGoals), l = n.filter((c) => c.halfTimeGoals !== null).map((c) => c.halfTimeGoals), u = s.filter((c) => c.halfTimeGoals !== null).map((c) => c.halfTimeGoals);
|
|
1403
|
+
return {
|
|
1404
|
+
over05: {
|
|
1405
|
+
home: y(r, 0.5),
|
|
1406
|
+
total: y(i, 0.5),
|
|
1407
|
+
away: y(a, 0.5)
|
|
1408
|
+
},
|
|
1409
|
+
over15: {
|
|
1410
|
+
home: y(r, 1.5),
|
|
1411
|
+
total: y(i, 1.5),
|
|
1412
|
+
away: y(a, 1.5)
|
|
1413
|
+
},
|
|
1414
|
+
over25: {
|
|
1415
|
+
home: y(r, 2.5),
|
|
1416
|
+
total: y(i, 2.5),
|
|
1417
|
+
away: y(a, 2.5)
|
|
1418
|
+
},
|
|
1419
|
+
over35: {
|
|
1420
|
+
home: y(r, 3.5),
|
|
1421
|
+
total: y(i, 3.5),
|
|
1422
|
+
away: y(a, 3.5)
|
|
1423
|
+
},
|
|
1424
|
+
over45: {
|
|
1425
|
+
home: y(r, 4.5),
|
|
1426
|
+
total: y(i, 4.5),
|
|
1427
|
+
away: y(a, 4.5)
|
|
1428
|
+
},
|
|
1429
|
+
over55: {
|
|
1430
|
+
home: y(r, 5.5),
|
|
1431
|
+
total: y(i, 5.5),
|
|
1432
|
+
away: y(a, 5.5)
|
|
1433
|
+
},
|
|
1434
|
+
over05HT: {
|
|
1435
|
+
home: y(l, 0.5),
|
|
1436
|
+
total: y(d, 0.5),
|
|
1437
|
+
away: y(u, 0.5)
|
|
1438
|
+
},
|
|
1439
|
+
over15HT: {
|
|
1440
|
+
home: y(l, 1.5),
|
|
1441
|
+
total: y(d, 1.5),
|
|
1442
|
+
away: y(u, 1.5)
|
|
1443
|
+
},
|
|
1444
|
+
over25HT: {
|
|
1445
|
+
home: y(l, 2.5),
|
|
1446
|
+
total: y(d, 2.5),
|
|
1447
|
+
away: y(u, 2.5)
|
|
1448
|
+
}
|
|
1449
|
+
};
|
|
1450
|
+
}
|
|
1451
|
+
function Qe(e, o) {
|
|
1452
|
+
const t = e.competitorOne.id === o, n = e.competitorTwo.id === o;
|
|
1453
|
+
if (!t && !n || !e.score) return null;
|
|
1454
|
+
const s = parseInt(t ? e.score.competitorOne || "0" : e.score.competitorTwo || "0"), i = parseInt(t ? e.score.competitorTwo || "0" : e.score.competitorOne || "0");
|
|
1455
|
+
let r;
|
|
1456
|
+
return s > i ? r = "W" : s < i ? r = "L" : r = "D", {
|
|
1457
|
+
result: { score: `${s}:${i}`, result: r, isHome: t },
|
|
1458
|
+
isHome: t
|
|
1459
|
+
};
|
|
1460
|
+
}
|
|
1461
|
+
function bt(e, o, t, n, s, i) {
|
|
1462
|
+
const r = o?.entries.find((E) => E.competitor.id === e), a = t?.entries.find((E) => E.competitor.id === e), d = n?.entries.find((E) => E.competitor.id === e), l = s?.entries.find((E) => E.competitor.id === e), u = i?.entries.find((E) => E.competitor.id === e);
|
|
1463
|
+
if (!r) return null;
|
|
1464
|
+
const c = a?.stats?.goalsFor ?? 0, m = d?.stats?.goalsFor ?? 0, p = r?.stats?.goalsFor ?? 0, g = l?.stats?.goalsAgainst ?? 0, h = u?.stats?.goalsAgainst ?? 0, D = r?.stats?.goalsAgainst ?? 0, S = a?.stats?.played ?? 0, A = d?.stats?.played ?? 0, G = r?.stats?.played ?? 0, k = G > 0 ? p / G : 0, L = G > 0 ? D / G : 0, H = k + L, P = S > 0 ? c / S : 0, $ = A > 0 ? m / A : 0, f = S > 0 ? g / S : 0, v = A > 0 ? h / A : 0, I = P + f, Z = $ + v;
|
|
1465
|
+
return {
|
|
1466
|
+
homeGoals: c,
|
|
1467
|
+
totalGoals: p,
|
|
1468
|
+
awayGoals: m,
|
|
1469
|
+
homeGamesPlayed: S,
|
|
1470
|
+
awayGamesPlayed: A,
|
|
1471
|
+
totalGamesPlayed: G,
|
|
1472
|
+
homeGoalsConceded: g,
|
|
1473
|
+
totalGoalsConceded: D,
|
|
1474
|
+
awayGoalsConceded: h,
|
|
1475
|
+
gfPerMatch: k,
|
|
1476
|
+
gaPerMatch: L,
|
|
1477
|
+
gfGaPerMatch: H,
|
|
1478
|
+
homeGfPerMatch: P,
|
|
1479
|
+
awayGfPerMatch: $,
|
|
1480
|
+
homeGaPerMatch: f,
|
|
1481
|
+
awayGaPerMatch: v,
|
|
1482
|
+
homeGfGaPerMatch: I,
|
|
1483
|
+
awayGfGaPerMatch: Z
|
|
1484
|
+
};
|
|
1485
|
+
}
|
|
1486
|
+
function _(e, o, t, n) {
|
|
1487
|
+
const s = e.filter((r) => {
|
|
1488
|
+
const a = r.competitorOne.id === o, d = r.competitorTwo.id === o;
|
|
1489
|
+
return !(!a && !d || r.status?.type !== "FINISHED" || n === "home" && !a || n === "away" && !d);
|
|
1490
|
+
}).sort((r, a) => new Date(a.timing.kickoffTime).getTime() - new Date(r.timing.kickoffTime).getTime());
|
|
1491
|
+
if (s.length === 0) return null;
|
|
1492
|
+
let i = 0;
|
|
1493
|
+
for (const r of s) {
|
|
1494
|
+
const a = r.competitorOne.id === o;
|
|
1495
|
+
if (t(r, o, a))
|
|
1496
|
+
i++;
|
|
1497
|
+
else
|
|
1498
|
+
break;
|
|
1499
|
+
}
|
|
1500
|
+
return i > 0 ? i : null;
|
|
1501
|
+
}
|
|
1502
|
+
const T = {
|
|
1503
|
+
win: (e, o, t) => {
|
|
1504
|
+
const n = parseInt(t ? e.score?.competitorOne || "0" : e.score?.competitorTwo || "0"), s = parseInt(t ? e.score?.competitorTwo || "0" : e.score?.competitorOne || "0");
|
|
1505
|
+
return n > s;
|
|
1506
|
+
},
|
|
1507
|
+
draw: (e) => e.score?.competitorOne === e.score?.competitorTwo,
|
|
1508
|
+
loss: (e, o, t) => {
|
|
1509
|
+
const n = parseInt(t ? e.score?.competitorOne || "0" : e.score?.competitorTwo || "0"), s = parseInt(t ? e.score?.competitorTwo || "0" : e.score?.competitorOne || "0");
|
|
1510
|
+
return n < s;
|
|
1511
|
+
},
|
|
1512
|
+
noWin: (e, o, t) => !T.win(e, o, t),
|
|
1513
|
+
noDraw: (e) => !T.draw(e),
|
|
1514
|
+
noDefeat: (e, o, t) => !T.loss(e, o, t),
|
|
1515
|
+
scored: (e, o, t) => parseInt(t ? e.score?.competitorOne || "0" : e.score?.competitorTwo || "0") >= 1,
|
|
1516
|
+
conceded: (e, o, t) => parseInt(t ? e.score?.competitorTwo || "0" : e.score?.competitorOne || "0") >= 1,
|
|
1517
|
+
noGoalScored: (e, o, t) => !T.scored(e, o, t),
|
|
1518
|
+
noGoalConceded: (e, o, t) => !T.conceded(e, o, t),
|
|
1519
|
+
over25: (e) => parseInt(e.score?.competitorOne || "0") + parseInt(e.score?.competitorTwo || "0") > 2,
|
|
1520
|
+
under25: (e) => parseInt(e.score?.competitorOne || "0") + parseInt(e.score?.competitorTwo || "0") < 3,
|
|
1521
|
+
scoredTwice: (e, o, t) => parseInt(t ? e.score?.competitorOne || "0" : e.score?.competitorTwo || "0") >= 2,
|
|
1522
|
+
concededTwice: (e, o, t) => parseInt(t ? e.score?.competitorTwo || "0" : e.score?.competitorOne || "0") >= 2
|
|
1523
|
+
};
|
|
1524
|
+
function x(e, o, t) {
|
|
1525
|
+
return {
|
|
1526
|
+
win: _(e, o, T.win, t),
|
|
1527
|
+
draw: _(e, o, T.draw, t),
|
|
1528
|
+
loss: _(e, o, T.loss, t),
|
|
1529
|
+
noWin: _(e, o, T.noWin, t),
|
|
1530
|
+
noDraw: _(e, o, T.noDraw, t),
|
|
1531
|
+
noDefeat: _(e, o, T.noDefeat, t),
|
|
1532
|
+
scored: _(e, o, T.scored, t),
|
|
1533
|
+
conceded: _(e, o, T.conceded, t),
|
|
1534
|
+
noGoalScored: _(e, o, T.noGoalScored, t),
|
|
1535
|
+
noGoalConceded: _(e, o, T.noGoalConceded, t),
|
|
1536
|
+
over25: _(e, o, T.over25, t),
|
|
1537
|
+
under25: _(e, o, T.under25, t),
|
|
1538
|
+
scoredTwice: _(e, o, T.scoredTwice, t),
|
|
1539
|
+
concededTwice: _(e, o, T.concededTwice, t)
|
|
1540
|
+
};
|
|
1541
|
+
}
|
|
1542
|
+
function Ht(e, o, t) {
|
|
1543
|
+
const n = x(e, o, "home"), s = x(e, o), i = x(e, t, "away"), r = x(e, t);
|
|
1544
|
+
return [
|
|
1545
|
+
{
|
|
1546
|
+
label: "Consecutive wins",
|
|
1547
|
+
homeTeam: { home: n.win, total: s.win },
|
|
1548
|
+
awayTeam: { total: r.win, home: i.win },
|
|
1549
|
+
colorType: "neutral"
|
|
1550
|
+
},
|
|
1551
|
+
{
|
|
1552
|
+
label: "Consecutive draws",
|
|
1553
|
+
homeTeam: { home: n.draw, total: s.draw },
|
|
1554
|
+
awayTeam: { total: r.draw, home: i.draw },
|
|
1555
|
+
colorType: "neutral"
|
|
1556
|
+
},
|
|
1557
|
+
{
|
|
1558
|
+
label: "Consecutive defeats",
|
|
1559
|
+
homeTeam: { home: n.loss, total: s.loss },
|
|
1560
|
+
awayTeam: { total: r.loss, home: i.loss },
|
|
1561
|
+
colorType: "neutral"
|
|
1562
|
+
},
|
|
1563
|
+
{
|
|
1564
|
+
label: "No win",
|
|
1565
|
+
homeTeam: { home: n.noWin, total: s.noWin },
|
|
1566
|
+
awayTeam: { total: r.noWin, home: i.noWin },
|
|
1567
|
+
colorType: "negative"
|
|
1568
|
+
},
|
|
1569
|
+
{
|
|
1570
|
+
label: "No draw",
|
|
1571
|
+
homeTeam: { home: n.noDraw, total: s.noDraw },
|
|
1572
|
+
awayTeam: { total: r.noDraw, home: i.noDraw },
|
|
1573
|
+
colorType: "neutral"
|
|
1574
|
+
},
|
|
1575
|
+
{
|
|
1576
|
+
label: "No defeat",
|
|
1577
|
+
homeTeam: { home: n.noDefeat, total: s.noDefeat },
|
|
1578
|
+
awayTeam: { total: r.noDefeat, home: i.noDefeat },
|
|
1579
|
+
colorType: "positive"
|
|
1580
|
+
},
|
|
1581
|
+
{
|
|
1582
|
+
label: "Scored at least once",
|
|
1583
|
+
homeTeam: { home: n.scored, total: s.scored },
|
|
1584
|
+
awayTeam: { total: r.scored, home: i.scored },
|
|
1585
|
+
colorType: "positive"
|
|
1586
|
+
},
|
|
1587
|
+
{
|
|
1588
|
+
label: "Conceded at least once",
|
|
1589
|
+
homeTeam: { home: n.conceded, total: s.conceded },
|
|
1590
|
+
awayTeam: { total: r.conceded, home: i.conceded },
|
|
1591
|
+
colorType: "negative"
|
|
1592
|
+
},
|
|
1593
|
+
{
|
|
1594
|
+
label: "No goal scored",
|
|
1595
|
+
homeTeam: { home: n.noGoalScored, total: s.noGoalScored },
|
|
1596
|
+
awayTeam: { total: r.noGoalScored, home: i.noGoalScored },
|
|
1597
|
+
colorType: "neutral"
|
|
1598
|
+
},
|
|
1599
|
+
{
|
|
1600
|
+
label: "No goal conceded",
|
|
1601
|
+
homeTeam: { home: n.noGoalConceded, total: s.noGoalConceded },
|
|
1602
|
+
awayTeam: { total: r.noGoalConceded, home: i.noGoalConceded },
|
|
1603
|
+
colorType: "neutral"
|
|
1604
|
+
},
|
|
1605
|
+
{
|
|
1606
|
+
label: "GS + GC over 2.5",
|
|
1607
|
+
homeTeam: { home: n.over25, total: s.over25 },
|
|
1608
|
+
awayTeam: { total: r.over25, home: i.over25 },
|
|
1609
|
+
colorType: "neutral"
|
|
1610
|
+
},
|
|
1611
|
+
{
|
|
1612
|
+
label: "GS + GC under 2.5",
|
|
1613
|
+
homeTeam: { home: n.under25, total: s.under25 },
|
|
1614
|
+
awayTeam: { total: r.under25, home: i.under25 },
|
|
1615
|
+
colorType: "neutral"
|
|
1616
|
+
},
|
|
1617
|
+
{
|
|
1618
|
+
label: "Scored at least twice",
|
|
1619
|
+
homeTeam: { home: n.scoredTwice, total: s.scoredTwice },
|
|
1620
|
+
awayTeam: { total: r.scoredTwice, home: i.scoredTwice },
|
|
1621
|
+
colorType: "positive"
|
|
1622
|
+
},
|
|
1623
|
+
{
|
|
1624
|
+
label: "Conceded at least twice",
|
|
1625
|
+
homeTeam: { home: n.concededTwice, total: s.concededTwice },
|
|
1626
|
+
awayTeam: { total: r.concededTwice, home: i.concededTwice },
|
|
1627
|
+
colorType: "negative"
|
|
1628
|
+
}
|
|
1629
|
+
];
|
|
1630
|
+
}
|
|
1631
|
+
function Y(e, o) {
|
|
1632
|
+
const t = /* @__PURE__ */ new Map();
|
|
1633
|
+
return e.forEach((n) => {
|
|
1634
|
+
if (n.status?.type !== "FINISHED") return;
|
|
1635
|
+
const s = Qe(n, o);
|
|
1636
|
+
if (!s) return;
|
|
1637
|
+
const i = s.isHome ? n.competitorTwo.id : n.competitorOne.id, r = s.isHome ? n.competitorTwo : n.competitorOne, a = t.get(i) || {
|
|
1638
|
+
opponentId: i,
|
|
1639
|
+
opponentName: r.name,
|
|
1640
|
+
opponentLogo: r.assets?.logo
|
|
1641
|
+
};
|
|
1642
|
+
s.isHome ? a.homeResult = s.result : a.awayResult = s.result, t.set(i, a);
|
|
1643
|
+
}), t;
|
|
1644
|
+
}
|
|
1645
|
+
function It(e, o, t, n, s, i, r) {
|
|
1646
|
+
const a = Y(e, o), d = Y(e, t), l = /* @__PURE__ */ new Set([
|
|
1647
|
+
...a.keys(),
|
|
1648
|
+
...d.keys(),
|
|
1649
|
+
o,
|
|
1650
|
+
// Include home team as row for away team results
|
|
1651
|
+
t
|
|
1652
|
+
// Include away team as row for home team results
|
|
1653
|
+
]), u = [];
|
|
1654
|
+
return l.forEach((c) => {
|
|
1655
|
+
const m = a.get(c), p = d.get(c);
|
|
1656
|
+
if (!m && !p && c !== o && c !== t)
|
|
1657
|
+
return;
|
|
1658
|
+
let g, h;
|
|
1659
|
+
c === o ? (g = n, h = i) : c === t ? (g = s, h = r) : (g = m?.opponentName || p?.opponentName || "", h = m?.opponentLogo || p?.opponentLogo), u.push({
|
|
1660
|
+
opponentId: c,
|
|
1661
|
+
opponentName: g,
|
|
1662
|
+
opponentLogo: h,
|
|
1663
|
+
homeTeamHome: m?.homeResult,
|
|
1664
|
+
homeTeamAway: m?.awayResult,
|
|
1665
|
+
awayTeamHome: p?.homeResult,
|
|
1666
|
+
awayTeamAway: p?.awayResult,
|
|
1667
|
+
isHomeTeamRow: c === o,
|
|
1668
|
+
isAwayTeamRow: c === t
|
|
1669
|
+
});
|
|
1670
|
+
}), u.sort((c, m) => c.isHomeTeamRow ? -1 : m.isHomeTeamRow ? 1 : c.isAwayTeamRow ? -1 : m.isAwayTeamRow ? 1 : c.opponentName.localeCompare(m.opponentName));
|
|
1671
|
+
}
|
|
1672
|
+
export {
|
|
1673
|
+
je as GOAL_EVENT_TYPES,
|
|
1674
|
+
Pt as addProviderRef,
|
|
1675
|
+
Ve as analyzeMatch,
|
|
1676
|
+
U as calcAverage,
|
|
1677
|
+
O as calcPercentage,
|
|
1678
|
+
Gt as calculateH2HStats,
|
|
1679
|
+
_ as calculateStreak,
|
|
1680
|
+
Ct as formatAsAverage,
|
|
1681
|
+
At as formatPossessionPercentage,
|
|
1682
|
+
St as formatStatValue,
|
|
1683
|
+
_t as formatWithAverage,
|
|
1684
|
+
ct as getActiveSeason,
|
|
1685
|
+
R as getConfig,
|
|
1686
|
+
ot as getFansUnitedFootballCompetition,
|
|
1687
|
+
tt as getFansUnitedFootballCompetitions,
|
|
1688
|
+
it as getFansUnitedFootballMatch,
|
|
1689
|
+
rt as getFansUnitedFootballMatches,
|
|
1690
|
+
st as getFansUnitedFootballPlayer,
|
|
1691
|
+
at as getFansUnitedFootballSearch,
|
|
1692
|
+
nt as getFansUnitedFootballTeam,
|
|
1693
|
+
$t as getFootballCompetition,
|
|
1694
|
+
Ut as getFootballMatch,
|
|
1695
|
+
xt as getFootballMatchCommentary,
|
|
1696
|
+
Bt as getFootballMatchEvents,
|
|
1697
|
+
Wt as getFootballMatchLineups,
|
|
1698
|
+
qt as getFootballMatchOdds,
|
|
1699
|
+
jt as getFootballMatchStatistics,
|
|
1700
|
+
Vt as getFootballMatches,
|
|
1701
|
+
Kt as getFootballPlayerSeasonStatistics,
|
|
1702
|
+
Yt as getFootballSeasonDetails,
|
|
1703
|
+
zt as getFootballStandings,
|
|
1704
|
+
Jt as getFootballTeam,
|
|
1705
|
+
Qt as getFootballTeamSquad,
|
|
1706
|
+
Qe as getMatchResult,
|
|
1707
|
+
Dt as getOpponentScore,
|
|
1708
|
+
Xt as getProviderRefId,
|
|
1709
|
+
Rt as getRecentH2HMeetings,
|
|
1710
|
+
mt as getTeamFinishedMatches,
|
|
1711
|
+
bt as getTeamGoalStats,
|
|
1712
|
+
Et as getTeamHomeAwayStats,
|
|
1713
|
+
vt as getTeamMostDecorated,
|
|
1714
|
+
lt as getTeamNextMatch,
|
|
1715
|
+
Mt as getTeamOverUnderStats,
|
|
1716
|
+
dt as getTeamPreviousMatch,
|
|
1717
|
+
ft as getTeamResultsTable,
|
|
1718
|
+
Nt as getTeamScore,
|
|
1719
|
+
et as getTeamSeasonStatistics,
|
|
1720
|
+
x as getTeamStreaks,
|
|
1721
|
+
Ht as getTeamStreaksComparison,
|
|
1722
|
+
yt as getTeamTopAppearances,
|
|
1723
|
+
gt as getTeamTopAssisters,
|
|
1724
|
+
Tt as getTeamTopCleanSheets,
|
|
1725
|
+
ht as getTeamTopMinutesPlayed,
|
|
1726
|
+
pt as getTeamTopScorers,
|
|
1727
|
+
ut as getTeamUpcomingMatches,
|
|
1728
|
+
It as getTeamsCommonOpponents,
|
|
1729
|
+
Zt as isConfigured,
|
|
1730
|
+
Ft as isMatchFinished,
|
|
1731
|
+
Ke as isTeamAway,
|
|
1732
|
+
j as isTeamHome,
|
|
1733
|
+
Ot as isTeamInMatch,
|
|
1734
|
+
we as search,
|
|
1735
|
+
Ze as searchFootball,
|
|
1736
|
+
wt as setConfig,
|
|
1737
|
+
T as streakFilters,
|
|
1738
|
+
C as toProviderRefArray
|
|
1739
|
+
};
|