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.
Files changed (308) hide show
  1. package/api/fansunited/constants.d.ts +5 -0
  2. package/api/fansunited/constants.d.ts.map +1 -0
  3. package/api/fansunited/football/competition/index.d.ts +30 -0
  4. package/api/fansunited/football/competition/index.d.ts.map +1 -0
  5. package/api/fansunited/football/competition/transformer.d.ts +11 -0
  6. package/api/fansunited/football/competition/transformer.d.ts.map +1 -0
  7. package/api/fansunited/football/competition/types.d.ts +70 -0
  8. package/api/fansunited/football/competition/types.d.ts.map +1 -0
  9. package/api/fansunited/football/competitions/index.d.ts +27 -0
  10. package/api/fansunited/football/competitions/index.d.ts.map +1 -0
  11. package/api/fansunited/football/competitions/transformer.d.ts +14 -0
  12. package/api/fansunited/football/competitions/transformer.d.ts.map +1 -0
  13. package/api/fansunited/football/competitions/types.d.ts +67 -0
  14. package/api/fansunited/football/competitions/types.d.ts.map +1 -0
  15. package/api/fansunited/football/http.d.ts +8 -0
  16. package/api/fansunited/football/http.d.ts.map +1 -0
  17. package/api/fansunited/football/index.d.ts +19 -0
  18. package/api/fansunited/football/index.d.ts.map +1 -0
  19. package/api/fansunited/football/matches/index.d.ts +61 -0
  20. package/api/fansunited/football/matches/index.d.ts.map +1 -0
  21. package/api/fansunited/football/matches/transformer.d.ts +28 -0
  22. package/api/fansunited/football/matches/transformer.d.ts.map +1 -0
  23. package/api/fansunited/football/matches/types.d.ts +328 -0
  24. package/api/fansunited/football/matches/types.d.ts.map +1 -0
  25. package/api/fansunited/football/players/index.d.ts +30 -0
  26. package/api/fansunited/football/players/index.d.ts.map +1 -0
  27. package/api/fansunited/football/players/transformer.d.ts +10 -0
  28. package/api/fansunited/football/players/transformer.d.ts.map +1 -0
  29. package/api/fansunited/football/players/types.d.ts +70 -0
  30. package/api/fansunited/football/players/types.d.ts.map +1 -0
  31. package/api/fansunited/football/search/index.d.ts +49 -0
  32. package/api/fansunited/football/search/index.d.ts.map +1 -0
  33. package/api/fansunited/football/search/transformer.d.ts +10 -0
  34. package/api/fansunited/football/search/transformer.d.ts.map +1 -0
  35. package/api/fansunited/football/search/types.d.ts +151 -0
  36. package/api/fansunited/football/search/types.d.ts.map +1 -0
  37. package/api/fansunited/football/teams/index.d.ts +30 -0
  38. package/api/fansunited/football/teams/index.d.ts.map +1 -0
  39. package/api/fansunited/football/teams/transformer.d.ts +10 -0
  40. package/api/fansunited/football/teams/transformer.d.ts.map +1 -0
  41. package/api/fansunited/football/teams/types.d.ts +87 -0
  42. package/api/fansunited/football/teams/types.d.ts.map +1 -0
  43. package/api/fansunited/http.d.ts +54 -0
  44. package/api/fansunited/http.d.ts.map +1 -0
  45. package/api/fansunited/index.d.ts +10 -0
  46. package/api/fansunited/index.d.ts.map +1 -0
  47. package/api/sportal365-sports/constants.d.ts +16 -0
  48. package/api/sportal365-sports/constants.d.ts.map +1 -0
  49. package/api/sportal365-sports/football/competitions/competition.types.d.ts +148 -0
  50. package/api/sportal365-sports/football/competitions/competition.types.d.ts.map +1 -0
  51. package/api/sportal365-sports/football/competitions/index.d.ts +54 -0
  52. package/api/sportal365-sports/football/competitions/index.d.ts.map +1 -0
  53. package/api/sportal365-sports/football/competitions/utils.d.ts +14 -0
  54. package/api/sportal365-sports/football/competitions/utils.d.ts.map +1 -0
  55. package/api/sportal365-sports/football/http.d.ts +8 -0
  56. package/api/sportal365-sports/football/http.d.ts.map +1 -0
  57. package/api/sportal365-sports/football/index.d.ts +19 -0
  58. package/api/sportal365-sports/football/index.d.ts.map +1 -0
  59. package/api/sportal365-sports/football/matches/index.d.ts +151 -0
  60. package/api/sportal365-sports/football/matches/index.d.ts.map +1 -0
  61. package/api/sportal365-sports/football/matches/transformers/commentary.d.ts +12 -0
  62. package/api/sportal365-sports/football/matches/transformers/commentary.d.ts.map +1 -0
  63. package/api/sportal365-sports/football/matches/transformers/index.d.ts +10 -0
  64. package/api/sportal365-sports/football/matches/transformers/index.d.ts.map +1 -0
  65. package/api/sportal365-sports/football/matches/transformers/lineup.d.ts +11 -0
  66. package/api/sportal365-sports/football/matches/transformers/lineup.d.ts.map +1 -0
  67. package/api/sportal365-sports/football/matches/transformers/match-event.d.ts +12 -0
  68. package/api/sportal365-sports/football/matches/transformers/match-event.d.ts.map +1 -0
  69. package/api/sportal365-sports/football/matches/transformers/match.d.ts +11 -0
  70. package/api/sportal365-sports/football/matches/transformers/match.d.ts.map +1 -0
  71. package/api/sportal365-sports/football/matches/transformers/odds.d.ts +11 -0
  72. package/api/sportal365-sports/football/matches/transformers/odds.d.ts.map +1 -0
  73. package/api/sportal365-sports/football/matches/transformers/statistics.d.ts +11 -0
  74. package/api/sportal365-sports/football/matches/transformers/statistics.d.ts.map +1 -0
  75. package/api/sportal365-sports/football/matches/types/commentary.types.d.ts +27 -0
  76. package/api/sportal365-sports/football/matches/types/commentary.types.d.ts.map +1 -0
  77. package/api/sportal365-sports/football/matches/types/event.types.d.ts +19 -0
  78. package/api/sportal365-sports/football/matches/types/event.types.d.ts.map +1 -0
  79. package/api/sportal365-sports/football/matches/types/index.d.ts +16 -0
  80. package/api/sportal365-sports/football/matches/types/index.d.ts.map +1 -0
  81. package/api/sportal365-sports/football/matches/types/lineup.types.d.ts +80 -0
  82. package/api/sportal365-sports/football/matches/types/lineup.types.d.ts.map +1 -0
  83. package/api/sportal365-sports/football/matches/types/match.types.d.ts +47 -0
  84. package/api/sportal365-sports/football/matches/types/match.types.d.ts.map +1 -0
  85. package/api/sportal365-sports/football/matches/types/minute.types.d.ts +8 -0
  86. package/api/sportal365-sports/football/matches/types/minute.types.d.ts.map +1 -0
  87. package/api/sportal365-sports/football/matches/types/odds.types.d.ts +80 -0
  88. package/api/sportal365-sports/football/matches/types/odds.types.d.ts.map +1 -0
  89. package/api/sportal365-sports/football/matches/types/option.types.d.ts +129 -0
  90. package/api/sportal365-sports/football/matches/types/option.types.d.ts.map +1 -0
  91. package/api/sportal365-sports/football/matches/types/referee.types.d.ts +13 -0
  92. package/api/sportal365-sports/football/matches/types/referee.types.d.ts.map +1 -0
  93. package/api/sportal365-sports/football/matches/types/statistics.types.d.ts +45 -0
  94. package/api/sportal365-sports/football/matches/types/statistics.types.d.ts.map +1 -0
  95. package/api/sportal365-sports/football/matches/types/status.types.d.ts +13 -0
  96. package/api/sportal365-sports/football/matches/types/status.types.d.ts.map +1 -0
  97. package/api/sportal365-sports/football/matches/types/team.types.d.ts +17 -0
  98. package/api/sportal365-sports/football/matches/types/team.types.d.ts.map +1 -0
  99. package/api/sportal365-sports/football/matches/types/winner.types.d.ts +15 -0
  100. package/api/sportal365-sports/football/matches/types/winner.types.d.ts.map +1 -0
  101. package/api/sportal365-sports/football/search/index.d.ts +45 -0
  102. package/api/sportal365-sports/football/search/index.d.ts.map +1 -0
  103. package/api/sportal365-sports/football/search/search.transformer.d.ts +10 -0
  104. package/api/sportal365-sports/football/search/search.transformer.d.ts.map +1 -0
  105. package/api/sportal365-sports/football/search/search.types.d.ts +147 -0
  106. package/api/sportal365-sports/football/search/search.types.d.ts.map +1 -0
  107. package/api/sportal365-sports/football/standings/index.d.ts +43 -0
  108. package/api/sportal365-sports/football/standings/index.d.ts.map +1 -0
  109. package/api/sportal365-sports/football/standings/standing.transformer.d.ts +15 -0
  110. package/api/sportal365-sports/football/standings/standing.transformer.d.ts.map +1 -0
  111. package/api/sportal365-sports/football/standings/standing.types.d.ts +73 -0
  112. package/api/sportal365-sports/football/standings/standing.types.d.ts.map +1 -0
  113. package/api/sportal365-sports/football/statistics/index.d.ts +42 -0
  114. package/api/sportal365-sports/football/statistics/index.d.ts.map +1 -0
  115. package/api/sportal365-sports/football/statistics/player-season.transformer.d.ts +11 -0
  116. package/api/sportal365-sports/football/statistics/player-season.transformer.d.ts.map +1 -0
  117. package/api/sportal365-sports/football/statistics/player-season.types.d.ts +84 -0
  118. package/api/sportal365-sports/football/statistics/player-season.types.d.ts.map +1 -0
  119. package/api/sportal365-sports/football/teams/index.d.ts +53 -0
  120. package/api/sportal365-sports/football/teams/index.d.ts.map +1 -0
  121. package/api/sportal365-sports/football/teams/squad.types.d.ts +63 -0
  122. package/api/sportal365-sports/football/teams/squad.types.d.ts.map +1 -0
  123. package/api/sportal365-sports/football/teams/team.types.d.ts +58 -0
  124. package/api/sportal365-sports/football/teams/team.types.d.ts.map +1 -0
  125. package/api/sportal365-sports/football/teams/utils.d.ts +24 -0
  126. package/api/sportal365-sports/football/teams/utils.d.ts.map +1 -0
  127. package/api/sportal365-sports/http.d.ts +59 -0
  128. package/api/sportal365-sports/http.d.ts.map +1 -0
  129. package/api/sportal365-sports/index.d.ts +14 -0
  130. package/api/sportal365-sports/index.d.ts.map +1 -0
  131. package/api/sportal365-sports/search/http.d.ts +8 -0
  132. package/api/sportal365-sports/search/http.d.ts.map +1 -0
  133. package/api/sportal365-sports/search/index.d.ts +43 -0
  134. package/api/sportal365-sports/search/index.d.ts.map +1 -0
  135. package/api/sportal365-sports/search/search.transformer.d.ts +10 -0
  136. package/api/sportal365-sports/search/search.transformer.d.ts.map +1 -0
  137. package/api/sportal365-sports/search/search.types.d.ts +209 -0
  138. package/api/sportal365-sports/search/search.types.d.ts.map +1 -0
  139. package/api/sportal365-sports/shared/index.d.ts +6 -0
  140. package/api/sportal365-sports/shared/index.d.ts.map +1 -0
  141. package/api/sportal365-sports/shared/providerRef.helper.d.ts +79 -0
  142. package/api/sportal365-sports/shared/providerRef.helper.d.ts.map +1 -0
  143. package/api/sportal365-sports/shared/types.d.ts +189 -0
  144. package/api/sportal365-sports/shared/types.d.ts.map +1 -0
  145. package/api/sportal365-sports/statistics/http.d.ts +8 -0
  146. package/api/sportal365-sports/statistics/http.d.ts.map +1 -0
  147. package/api/sportal365-sports/statistics/index.d.ts +55 -0
  148. package/api/sportal365-sports/statistics/index.d.ts.map +1 -0
  149. package/api/sportal365-sports/statistics/team-stats.transformer.d.ts +14 -0
  150. package/api/sportal365-sports/statistics/team-stats.transformer.d.ts.map +1 -0
  151. package/api/sportal365-sports/statistics/team-stats.types.d.ts +45 -0
  152. package/api/sportal365-sports/statistics/team-stats.types.d.ts.map +1 -0
  153. package/client.cjs +8 -0
  154. package/client.d.ts +20 -0
  155. package/client.d.ts.map +1 -0
  156. package/client.js +12065 -0
  157. package/config/index.d.ts +31 -0
  158. package/config/index.d.ts.map +1 -0
  159. package/config/types.d.ts +36 -0
  160. package/config/types.d.ts.map +1 -0
  161. package/fansunited-data-layer.cjs +1 -0
  162. package/fansunited-data-layer.js +1739 -0
  163. package/helpers/competition.helpers.d.ts +22 -0
  164. package/helpers/competition.helpers.d.ts.map +1 -0
  165. package/helpers/index.d.ts +7 -0
  166. package/helpers/index.d.ts.map +1 -0
  167. package/helpers/team.helpers.d.ts +289 -0
  168. package/helpers/team.helpers.d.ts.map +1 -0
  169. package/index-Cogo-Kkd.cjs +1 -0
  170. package/index-D7T2Yy11.js +1170 -0
  171. package/index.d.ts +39 -0
  172. package/index.d.ts.map +1 -0
  173. package/package.json +14 -17
  174. package/providers/competition/hooks/index.d.ts +6 -0
  175. package/providers/competition/hooks/index.d.ts.map +1 -0
  176. package/providers/competition/hooks/useCompetitionStats.d.ts +8 -0
  177. package/providers/competition/hooks/useCompetitionStats.d.ts.map +1 -0
  178. package/providers/competition/hooks/useGoalDistribution.d.ts +11 -0
  179. package/providers/competition/hooks/useGoalDistribution.d.ts.map +1 -0
  180. package/providers/competition/hooks/useMatchHelpers.d.ts +16 -0
  181. package/providers/competition/hooks/useMatchHelpers.d.ts.map +1 -0
  182. package/providers/competition/hooks/useStandingsCalculations.d.ts +18 -0
  183. package/providers/competition/hooks/useStandingsCalculations.d.ts.map +1 -0
  184. package/providers/competition/hooks/useStandingsHelpers.d.ts +23 -0
  185. package/providers/competition/hooks/useStandingsHelpers.d.ts.map +1 -0
  186. package/providers/competition/hooks/useTeamPosition.d.ts +8 -0
  187. package/providers/competition/hooks/useTeamPosition.d.ts.map +1 -0
  188. package/providers/competition/hooks/useTeamResultsTable.d.ts +9 -0
  189. package/providers/competition/hooks/useTeamResultsTable.d.ts.map +1 -0
  190. package/providers/competition/utils/competitionStats.d.ts +42 -0
  191. package/providers/competition/utils/competitionStats.d.ts.map +1 -0
  192. package/providers/competition/utils/goalDistribution.d.ts +41 -0
  193. package/providers/competition/utils/goalDistribution.d.ts.map +1 -0
  194. package/providers/competition/utils/index.d.ts +6 -0
  195. package/providers/competition/utils/index.d.ts.map +1 -0
  196. package/providers/competition/utils/standingsCalculations.d.ts +24 -0
  197. package/providers/competition/utils/standingsCalculations.d.ts.map +1 -0
  198. package/providers/competition.context.d.ts +8 -0
  199. package/providers/competition.context.d.ts.map +1 -0
  200. package/providers/competition.provider.d.ts +3 -0
  201. package/providers/competition.provider.d.ts.map +1 -0
  202. package/providers/competition.types.d.ts +118 -0
  203. package/providers/competition.types.d.ts.map +1 -0
  204. package/providers/fansunited-config.context.d.ts +6 -0
  205. package/providers/fansunited-config.context.d.ts.map +1 -0
  206. package/providers/fansunited-config.hooks.d.ts +19 -0
  207. package/providers/fansunited-config.hooks.d.ts.map +1 -0
  208. package/providers/fansunited-config.provider.d.ts +44 -0
  209. package/providers/fansunited-config.provider.d.ts.map +1 -0
  210. package/providers/fansunited-config.types.d.ts +48 -0
  211. package/providers/fansunited-config.types.d.ts.map +1 -0
  212. package/providers/fansunited-sdk.hook.d.ts +40 -0
  213. package/providers/fansunited-sdk.hook.d.ts.map +1 -0
  214. package/providers/index.d.ts +20 -0
  215. package/providers/index.d.ts.map +1 -0
  216. package/providers/match/hooks/useEventHelpers.d.ts +12 -0
  217. package/providers/match/hooks/useEventHelpers.d.ts.map +1 -0
  218. package/providers/match/hooks/useHeadToHeadHelpers.d.ts +13 -0
  219. package/providers/match/hooks/useHeadToHeadHelpers.d.ts.map +1 -0
  220. package/providers/match/hooks/useLineupHelpers.d.ts +13 -0
  221. package/providers/match/hooks/useLineupHelpers.d.ts.map +1 -0
  222. package/providers/match/hooks/useMatchStandingsCalculations.d.ts +20 -0
  223. package/providers/match/hooks/useMatchStandingsCalculations.d.ts.map +1 -0
  224. package/providers/match/hooks/useMatchStatus.d.ts +12 -0
  225. package/providers/match/hooks/useMatchStatus.d.ts.map +1 -0
  226. package/providers/match/hooks/useOddsHelpers.d.ts +10 -0
  227. package/providers/match/hooks/useOddsHelpers.d.ts.map +1 -0
  228. package/providers/match/hooks/useScoreHelpers.d.ts +16 -0
  229. package/providers/match/hooks/useScoreHelpers.d.ts.map +1 -0
  230. package/providers/match/hooks/useStandingsHelpers.d.ts +22 -0
  231. package/providers/match/hooks/useStandingsHelpers.d.ts.map +1 -0
  232. package/providers/match/hooks/useStatisticsHelpers.d.ts +13 -0
  233. package/providers/match/hooks/useStatisticsHelpers.d.ts.map +1 -0
  234. package/providers/match/hooks/useTeamHelpers.d.ts +11 -0
  235. package/providers/match/hooks/useTeamHelpers.d.ts.map +1 -0
  236. package/providers/match/hooks/useTeamStatsHelpers.d.ts +12 -0
  237. package/providers/match/hooks/useTeamStatsHelpers.d.ts.map +1 -0
  238. package/providers/match.context.d.ts +8 -0
  239. package/providers/match.context.d.ts.map +1 -0
  240. package/providers/match.provider.d.ts +3 -0
  241. package/providers/match.provider.d.ts.map +1 -0
  242. package/providers/match.types.d.ts +151 -0
  243. package/providers/match.types.d.ts.map +1 -0
  244. package/providers/team/hooks/useFormStats.d.ts +49 -0
  245. package/providers/team/hooks/useFormStats.d.ts.map +1 -0
  246. package/providers/team/hooks/useMatchHelpers.d.ts +12 -0
  247. package/providers/team/hooks/useMatchHelpers.d.ts.map +1 -0
  248. package/providers/team/hooks/useSquadHelpers.d.ts +17 -0
  249. package/providers/team/hooks/useSquadHelpers.d.ts.map +1 -0
  250. package/providers/team.context.d.ts +8 -0
  251. package/providers/team.context.d.ts.map +1 -0
  252. package/providers/team.provider.d.ts +3 -0
  253. package/providers/team.provider.d.ts.map +1 -0
  254. package/providers/team.types.d.ts +68 -0
  255. package/providers/team.types.d.ts.map +1 -0
  256. package/types/canonical/base.types.d.ts +366 -0
  257. package/types/canonical/base.types.d.ts.map +1 -0
  258. package/types/canonical/commentary.types.d.ts +42 -0
  259. package/types/canonical/commentary.types.d.ts.map +1 -0
  260. package/types/canonical/event.types.d.ts +31 -0
  261. package/types/canonical/event.types.d.ts.map +1 -0
  262. package/types/canonical/index.d.ts +17 -0
  263. package/types/canonical/index.d.ts.map +1 -0
  264. package/types/canonical/lineup.types.d.ts +33 -0
  265. package/types/canonical/lineup.types.d.ts.map +1 -0
  266. package/types/canonical/match.types.d.ts +153 -0
  267. package/types/canonical/match.types.d.ts.map +1 -0
  268. package/types/canonical/odds.types.d.ts +73 -0
  269. package/types/canonical/odds.types.d.ts.map +1 -0
  270. package/types/canonical/search.types.d.ts +101 -0
  271. package/types/canonical/search.types.d.ts.map +1 -0
  272. package/types/canonical/sports-search.types.d.ts +151 -0
  273. package/types/canonical/sports-search.types.d.ts.map +1 -0
  274. package/types/canonical/squad.types.d.ts +30 -0
  275. package/types/canonical/squad.types.d.ts.map +1 -0
  276. package/types/canonical/standing.types.d.ts +85 -0
  277. package/types/canonical/standing.types.d.ts.map +1 -0
  278. package/types/canonical/statistics.types.d.ts +81 -0
  279. package/types/canonical/statistics.types.d.ts.map +1 -0
  280. package/types/index.d.ts +10 -0
  281. package/types/index.d.ts.map +1 -0
  282. package/utilities/stats/core/helpers.d.ts +65 -0
  283. package/utilities/stats/core/helpers.d.ts.map +1 -0
  284. package/utilities/stats/core/index.d.ts +7 -0
  285. package/utilities/stats/core/index.d.ts.map +1 -0
  286. package/utilities/stats/core/types.d.ts +39 -0
  287. package/utilities/stats/core/types.d.ts.map +1 -0
  288. package/utilities/stats/index.d.ts +27 -0
  289. package/utilities/stats/index.d.ts.map +1 -0
  290. package/utilities/stats/match/headToHead.d.ts +73 -0
  291. package/utilities/stats/match/headToHead.d.ts.map +1 -0
  292. package/utilities/stats/match/homeVsAway.d.ts +30 -0
  293. package/utilities/stats/match/homeVsAway.d.ts.map +1 -0
  294. package/utilities/stats/match/index.d.ts +8 -0
  295. package/utilities/stats/match/index.d.ts.map +1 -0
  296. package/utilities/stats/match/overUnder.d.ts +59 -0
  297. package/utilities/stats/match/overUnder.d.ts.map +1 -0
  298. package/utilities/stats/match/result.d.ts +13 -0
  299. package/utilities/stats/match/result.d.ts.map +1 -0
  300. package/utilities/stats/team/commonOpponents.d.ts +28 -0
  301. package/utilities/stats/team/commonOpponents.d.ts.map +1 -0
  302. package/utilities/stats/team/goalStats.d.ts +42 -0
  303. package/utilities/stats/team/goalStats.d.ts.map +1 -0
  304. package/utilities/stats/team/index.d.ts +7 -0
  305. package/utilities/stats/team/index.d.ts.map +1 -0
  306. package/utilities/stats/team/streaks.d.ts +48 -0
  307. package/utilities/stats/team/streaks.d.ts.map +1 -0
  308. package/vite.svg +1 -0
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Competition helper functions
3
+ */
4
+ import type { FUSportsCompetition, FUSportsSeason } from "../types/canonical";
5
+ /**
6
+ * Get the active season from a competition
7
+ *
8
+ * Returns the season where `active` is true. If no season is active,
9
+ * returns the first season in the list (typically the most recent).
10
+ *
11
+ * @param competition - The competition with seasons array
12
+ * @returns The active season, or the first season, or undefined if no seasons exist
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const competition = await getFootballCompetition('3');
17
+ * const activeSeason = getActiveSeason(competition);
18
+ * console.log(activeSeason?.name); // "2024/2025"
19
+ * ```
20
+ */
21
+ export declare function getActiveSeason(competition: FUSportsCompetition): FUSportsSeason | undefined;
22
+ //# sourceMappingURL=competition.helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"competition.helpers.d.ts","sourceRoot":"","sources":["../../src/lib/helpers/competition.helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE9E;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,mBAAmB,GAAG,cAAc,GAAG,SAAS,CAU5F"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Helper functions for FansUnited Data Layer
3
+ */
4
+ export { getActiveSeason } from "./competition.helpers";
5
+ export { getTeamNextMatch, getTeamPreviousMatch, getTeamUpcomingMatches, getTeamFinishedMatches, getTeamResultsTable, getTeamTopScorers, getTeamTopAssisters, getTeamTopAppearances, getTeamTopMinutesPlayed, getTeamTopCleanSheets, getTeamMostDecorated, } from "./team.helpers";
6
+ export type { TeamResultTableResult, TeamResultTableRow, TeamResultTable } from "./team.helpers";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/helpers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EACH,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,GACvB,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,289 @@
1
+ /**
2
+ * Team helper functions
3
+ */
4
+ import type { FUSportsMatch, FUSportsStandings, FUSportsSquad, FUSportsSquadMember } from "../types/canonical";
5
+ /**
6
+ * Result against a specific team in the results table
7
+ */
8
+ export interface TeamResultTableResult {
9
+ /** Result type: W (win), D (draw), L (loss) from the team's perspective - used for styling. Undefined for upcoming matches */
10
+ result?: "W" | "D" | "L";
11
+ /** Score in format "home score - away score" (e.g., "2 - 1" means home team scored 2, away team scored 1). Undefined for upcoming matches */
12
+ score?: string;
13
+ /** Match date (for finished matches) or upcoming match date (for scheduled matches) */
14
+ date: Date;
15
+ /** Match ID for reference */
16
+ matchId: string;
17
+ /** Whether this is an upcoming match (not yet played) */
18
+ isUpcoming: boolean;
19
+ }
20
+ /**
21
+ * Single row in the team results table
22
+ */
23
+ export interface TeamResultTableRow {
24
+ /** Position in the standings */
25
+ rank: number;
26
+ /** Team ID */
27
+ teamId: string;
28
+ /** Team name */
29
+ teamName: string;
30
+ /** Team short name */
31
+ teamShortName?: string;
32
+ /** Team logo URL */
33
+ teamLogo?: string;
34
+ /** Games played */
35
+ gamesPlayed: number;
36
+ /** Points */
37
+ points: number;
38
+ /** Home result against the specified team (finished or upcoming) */
39
+ homeResult?: TeamResultTableResult;
40
+ /** Away result against the specified team (finished or upcoming) */
41
+ awayResult?: TeamResultTableResult;
42
+ }
43
+ /**
44
+ * Complete team results table data structure
45
+ */
46
+ export interface TeamResultTable {
47
+ /** The team ID this table is for */
48
+ teamId: string;
49
+ /** Array of table rows, ordered by standing position */
50
+ rows: TeamResultTableRow[];
51
+ }
52
+ /**
53
+ * Get the next upcoming match for a team from a list of matches
54
+ *
55
+ * Filters matches to find the team's next scheduled match (NOT_STARTED or LIVE)
56
+ * with the earliest start time from now.
57
+ *
58
+ * @param teamId - The team ID
59
+ * @param matches - Array of matches to filter through
60
+ * @returns The next match or undefined if no upcoming match found
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * const matches = await getFootballMatches({ teamIds: ['102'], limit: 50, offset: 0 });
65
+ * const nextMatch = getTeamNextMatch('102', matches);
66
+ * if (nextMatch) {
67
+ * console.log(`Next: ${nextMatch.competitorOne.name} vs ${nextMatch.competitorTwo.name}`);
68
+ * console.log(`Kickoff: ${nextMatch.timing.kickoffTime}`);
69
+ * }
70
+ * ```
71
+ */
72
+ export declare function getTeamNextMatch(teamId: string, matches: FUSportsMatch[]): FUSportsMatch | undefined;
73
+ /**
74
+ * Get the previous/last match for a team from a list of matches
75
+ *
76
+ * Filters matches to find the team's most recent finished match.
77
+ *
78
+ * @param teamId - The team ID
79
+ * @param matches - Array of matches to filter through
80
+ * @returns The previous match or undefined if no finished match found
81
+ *
82
+ * @example
83
+ * ```typescript
84
+ * const matches = await getFootballMatches({ teamIds: ['102'], limit: 50, offset: 0 });
85
+ * const prevMatch = getTeamPreviousMatch('102', matches);
86
+ * if (prevMatch) {
87
+ * console.log(`Last: ${prevMatch.competitorOne.name} ${prevMatch.score?.home}-${prevMatch.score?.away} ${prevMatch.competitorTwo.name}`);
88
+ * }
89
+ * ```
90
+ */
91
+ export declare function getTeamPreviousMatch(teamId: string, matches: FUSportsMatch[]): FUSportsMatch | undefined;
92
+ /**
93
+ * Get all upcoming matches for a team from a list of matches
94
+ *
95
+ * Filters matches to find all the team's upcoming matches (NOT_STARTED or LIVE),
96
+ * sorted by kickoff time (earliest first).
97
+ *
98
+ * @param teamId - The team ID
99
+ * @param matches - Array of matches to filter through
100
+ * @returns Array of upcoming matches sorted by kickoff time
101
+ *
102
+ * @example
103
+ * ```typescript
104
+ * const matches = await getFootballMatches({ teamIds: ['102'], limit: 50, offset: 0 });
105
+ * const upcomingMatches = getTeamUpcomingMatches('102', matches);
106
+ * upcomingMatches.forEach(match => {
107
+ * console.log(`${match.competitorOne.name} vs ${match.competitorTwo.name} - ${match.timing.kickoffTime}`);
108
+ * });
109
+ * ```
110
+ */
111
+ export declare function getTeamUpcomingMatches(teamId: string, matches: FUSportsMatch[]): FUSportsMatch[];
112
+ /**
113
+ * Get all finished matches for a team from a list of matches
114
+ *
115
+ * Filters matches to find all the team's finished matches,
116
+ * sorted by kickoff time (most recent first).
117
+ *
118
+ * @param teamId - The team ID
119
+ * @param matches - Array of matches to filter through
120
+ * @returns Array of finished matches sorted by kickoff time (most recent first)
121
+ *
122
+ * @example
123
+ * ```typescript
124
+ * const matches = await getFootballMatches({ teamIds: ['102'], limit: 50, offset: 0 });
125
+ * const finishedMatches = getTeamFinishedMatches('102', matches);
126
+ * finishedMatches.forEach(match => {
127
+ * console.log(`${match.competitorOne.name} ${match.score?.competitorOne}-${match.score?.competitorTwo} ${match.competitorTwo.name}`);
128
+ * });
129
+ * ```
130
+ */
131
+ export declare function getTeamFinishedMatches(teamId: string, matches: FUSportsMatch[]): FUSportsMatch[];
132
+ /**
133
+ * Get team results table showing all teams in the standings with their results against a specific team
134
+ *
135
+ * This creates a table showing:
136
+ * - All teams ordered by their standing position
137
+ * - Their games played and points from the standings
138
+ * - Their home and away results against the specified team
139
+ * - The date of their last match against the specified team
140
+ *
141
+ * @param teamId - The team ID to get results against
142
+ * @param standings - The competition standings
143
+ * @param matches - Array of finished matches in the competition
144
+ * @returns Team results table data structure
145
+ *
146
+ * @example
147
+ * ```typescript
148
+ * const standings = await getFootballStandings('123');
149
+ * const matches = await getFootballMatches({ stageIds: ['123'], limit: 500 });
150
+ * const resultsTable = getTeamResultsTable('102', standings, matches);
151
+ *
152
+ * resultsTable.rows.forEach(row => {
153
+ * console.log(`${row.rank}. ${row.teamName} - ${row.points} pts`);
154
+ * if (row.homeResult) {
155
+ * console.log(` Home: ${row.homeResult.result} ${row.homeResult.score}`);
156
+ * }
157
+ * if (row.awayResult) {
158
+ * console.log(` Away: ${row.awayResult.result} ${row.awayResult.score}`);
159
+ * }
160
+ * });
161
+ * ```
162
+ */
163
+ export declare function getTeamResultsTable(teamId: string, standings: FUSportsStandings, matches: FUSportsMatch[]): TeamResultTable;
164
+ /**
165
+ * Get team's top scorers sorted by goals
166
+ *
167
+ * Returns players sorted by total goals (descending), with ties broken by assists.
168
+ * Only includes players with at least 1 goal.
169
+ *
170
+ * @param squad - The team squad data
171
+ * @param limit - Maximum number of players to return (default: 10)
172
+ * @returns Array of squad members sorted by goals
173
+ *
174
+ * @example
175
+ * ```typescript
176
+ * const squad = await getFootballSquad('102');
177
+ * const topScorers = getTeamTopScorers(squad, 5);
178
+ * topScorers.forEach(player => {
179
+ * console.log(`${player.name}: ${player.seasonStatistics?.goals} goals`);
180
+ * });
181
+ * ```
182
+ */
183
+ export declare function getTeamTopScorers(squad: FUSportsSquad, limit?: number): FUSportsSquadMember[];
184
+ /**
185
+ * Get team's top assisters sorted by assists
186
+ *
187
+ * Returns players sorted by total assists (descending), with ties broken by goals.
188
+ * Only includes players with at least 1 assist.
189
+ *
190
+ * @param squad - The team squad data
191
+ * @param limit - Maximum number of players to return (default: 10)
192
+ * @returns Array of squad members sorted by assists
193
+ *
194
+ * @example
195
+ * ```typescript
196
+ * const squad = await getFootballSquad('102');
197
+ * const topAssisters = getTeamTopAssisters(squad, 5);
198
+ * topAssisters.forEach(player => {
199
+ * console.log(`${player.name}: ${player.seasonStatistics?.assists} assists`);
200
+ * });
201
+ * ```
202
+ */
203
+ export declare function getTeamTopAssisters(squad: FUSportsSquad, limit?: number): FUSportsSquadMember[];
204
+ /**
205
+ * Get team's players with most appearances sorted by appearances
206
+ *
207
+ * Returns players sorted by total appearances (descending), with ties broken by minutes played.
208
+ * Only includes players with at least 1 appearance.
209
+ *
210
+ * @param squad - The team squad data
211
+ * @param limit - Maximum number of players to return (default: 10)
212
+ * @returns Array of squad members sorted by appearances
213
+ *
214
+ * @example
215
+ * ```typescript
216
+ * const squad = await getFootballSquad('102');
217
+ * const topAppearances = getTeamTopAppearances(squad, 5);
218
+ * topAppearances.forEach(player => {
219
+ * console.log(`${player.name}: ${player.seasonStatistics?.appearances} appearances`);
220
+ * });
221
+ * ```
222
+ */
223
+ export declare function getTeamTopAppearances(squad: FUSportsSquad, limit?: number): FUSportsSquadMember[];
224
+ /**
225
+ * Get team's players with most minutes played sorted by minutes
226
+ *
227
+ * Returns players sorted by total minutes played (descending), with ties broken by appearances.
228
+ * Only includes players with at least 1 minute played.
229
+ *
230
+ * @param squad - The team squad data
231
+ * @param limit - Maximum number of players to return (default: 10)
232
+ * @returns Array of squad members sorted by minutes played
233
+ *
234
+ * @example
235
+ * ```typescript
236
+ * const squad = await getFootballSquad('102');
237
+ * const topMinutes = getTeamTopMinutesPlayed(squad, 5);
238
+ * topMinutes.forEach(player => {
239
+ * console.log(`${player.name}: ${player.seasonStatistics?.minutes} minutes`);
240
+ * });
241
+ * ```
242
+ */
243
+ export declare function getTeamTopMinutesPlayed(squad: FUSportsSquad, limit?: number): FUSportsSquadMember[];
244
+ /**
245
+ * Get team's players with most clean sheets sorted by clean sheets
246
+ *
247
+ * Returns players sorted by total clean sheets (descending), with ties broken by appearances.
248
+ * Only includes players with at least 1 clean sheet.
249
+ * Typically used for goalkeepers and defenders.
250
+ *
251
+ * @param squad - The team squad data
252
+ * @param limit - Maximum number of players to return (default: 10)
253
+ * @returns Array of squad members sorted by clean sheets
254
+ *
255
+ * @example
256
+ * ```typescript
257
+ * const squad = await getFootballSquad('102');
258
+ * const topCleanSheets = getTeamTopCleanSheets(squad, 5);
259
+ * topCleanSheets.forEach(player => {
260
+ * console.log(`${player.name}: ${player.seasonStatistics?.cleansheets} clean sheets`);
261
+ * });
262
+ * ```
263
+ */
264
+ export declare function getTeamTopCleanSheets(squad: FUSportsSquad, limit?: number): FUSportsSquadMember[];
265
+ /**
266
+ * Get team's most decorated players (most cards) sorted by total cards
267
+ *
268
+ * Returns players sorted by total cards (yellow + red cards, descending).
269
+ * Red cards are weighted more heavily (red card = 3 yellow cards equivalent).
270
+ * Ties are broken by red cards first, then yellow cards.
271
+ * Only includes players with at least 1 card.
272
+ *
273
+ * @param squad - The team squad data
274
+ * @param limit - Maximum number of players to return (default: 10)
275
+ * @returns Array of squad members sorted by total cards
276
+ *
277
+ * @example
278
+ * ```typescript
279
+ * const squad = await getFootballSquad('102');
280
+ * const mostDecorated = getTeamMostDecorated(squad, 5);
281
+ * mostDecorated.forEach(player => {
282
+ * const yellow = player.seasonStatistics?.yellowCards ?? 0;
283
+ * const red = player.seasonStatistics?.redCards ?? 0;
284
+ * console.log(`${player.name}: ${yellow} yellow, ${red} red`);
285
+ * });
286
+ * ```
287
+ */
288
+ export declare function getTeamMostDecorated(squad: FUSportsSquad, limit?: number): FUSportsSquadMember[];
289
+ //# sourceMappingURL=team.helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"team.helpers.d.ts","sourceRoot":"","sources":["../../src/lib/helpers/team.helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE/G;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC,8HAA8H;IAC9H,MAAM,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IACzB,6IAA6I;IAC7I,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uFAAuF;IACvF,IAAI,EAAE,IAAI,CAAC;IACX,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,UAAU,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,cAAc;IACd,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,sBAAsB;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oBAAoB;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mBAAmB;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa;IACb,MAAM,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,oEAAoE;IACpE,UAAU,CAAC,EAAE,qBAAqB,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,IAAI,EAAE,kBAAkB,EAAE,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,aAAa,GAAG,SAAS,CAepG;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,aAAa,GAAG,SAAS,CAexG;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,aAAa,EAAE,CAehG;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,aAAa,EAAE,CAehG;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,mBAAmB,CAC/B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,iBAAiB,EAC5B,OAAO,EAAE,aAAa,EAAE,GACzB,eAAe,CAuGjB;AAMD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,GAAE,MAAW,GAAG,mBAAmB,EAAE,CAkBjG;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,GAAE,MAAW,GAAG,mBAAmB,EAAE,CAkBnG;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,GAAE,MAAW,GAAG,mBAAmB,EAAE,CAkBrG;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,GAAE,MAAW,GAAG,mBAAmB,EAAE,CAkBvG;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,GAAE,MAAW,GAAG,mBAAmB,EAAE,CAkBrG;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,GAAE,MAAW,GAAG,mBAAmB,EAAE,CA+BpG"}
@@ -0,0 +1 @@
1
+ "use strict";const y="__FANSUNITED_DATA_LAYER_CONFIG__";function R(e){globalThis[y]=e}function c(){const e=globalThis[y];if(!e)throw new Error("Data layer config not initialized. Call setConfig() in your root layout.");return e}function D(){return globalThis[y]!==void 0}function E(e){const t=e.replace(/\/$/,"");function o(a){const{sportal365Sports:s}=a;if(!s)throw new Error("Sportal365 Sports API configuration is missing");const d=`${s.username}:${s.password}`;return`Basic ${btoa(d)}`}function n(a){return`${t}${a}`}return{async get(a){const s=a.config||c(),{sportal365Sports:d}=s;if(!d)throw new Error("Sportal365 Sports API configuration is missing");const u=new URL(n(a.path));if(a.params)for(const[p,f]of Object.entries(a.params))f!==void 0&&(Array.isArray(f)?f.length>0&&u.searchParams.set(p,f.join(",")):u.searchParams.set(p,f));const m=await fetch(u.toString(),{method:"GET",headers:{Authorization:o(s),"Content-Type":"application/json","X-Project":d.projectId,...a.headers},signal:d.timeout?AbortSignal.timeout(d.timeout):void 0,...a.next&&{next:a.next}});if(!m.ok)throw new Error(`Sportal365 API error: ${m.status} ${m.statusText}`);return m.json()}}}const N="https://football.api.sportal365.com",F="https://sports-statistics.api.sportal365.com",x="https://sports-search.api.sportal365.com",l=E(N);function S(e){if(e)return{id:e.id,name:e.name,slug:e.slug,position:e.position,gender:e.gender,assets:e.assets?{photo:e.assets.thumb?.url,photoTransparent:e.assets.thumb_transparent_background?.url}:void 0}}const P={GOAL:"GOAL",PENALTY_GOAL:"PENALTY_GOAL",OWN_GOAL:"OWN_GOAL",DISALLOWED_GOAL:"DISALLOWED_GOAL",PENALTY_SHOOTOUT_SCORED:"PENALTY_SHOOTOUT_SCORED",PENALTY_SHOOTOUT_MISSED:"PENALTY_SHOOTOUT_MISSED",YELLOW_CARD:"YELLOW_CARD",RED_CARD:"RED_CARD",YELLOW_RED_CARD:"YELLOW_RED_CARD",SUBSTITUTION:"SUBSTITUTION",KICKOFF:"KICKOFF",HALFTIME:"HALFTIME",START_SECOND_HALF:"START_SECOND_HALF",FINISHED:"FINISHED",INJURY_TIME:"INJURY_TIME",PENALTY_AWARDED:"PENALTY_AWARDED",PENALTY_MISSED:"PENALTY_MISSED",PENALTY_SAVED:"PENALTY_SAVED"};function _(e){const t=P[e.type_code];return t?{id:e.id,type:t,competitorPosition:e.team_position==="HOME"?"ONE":"TWO",minute:e.minute,injuryMinute:e.injury_minute,primaryPlayer:S(e.primary_player),secondaryPlayer:S(e.secondary_player),score:e.score?{competitorOne:String(e.score.home),competitorTwo:String(e.score.away)}:void 0}:(console.warn(`Unknown event type: ${e.type_code}`),null)}function i(e,t="sportal365"){if(e)return[{provider:t,id:e}]}function M(e,t){return e?e.find(n=>n.provider===t)?.id:void 0}function H(e,t,o){const n=e??[],a=n.findIndex(s=>s.provider===t);if(a>=0){const s=[...n];return s[a]={provider:t,id:o},s}else return[...n,{provider:t,id:o}]}function $(e){const t={finished_ap:"finished_after_penalties",finished_aet:"finished_after_extra_time",finished:"finished",not_started:"not_started",live:"live",interrupted:"interrupted",cancelled:"cancelled",postponed:"postponed",abandoned:"abandoned"};let o;return e.code&&t[e.code]?o=t[e.code]:o={FINISHED:"finished",NOT_STARTED:"not_started",LIVE:"live",INTERRUPTED:"interrupted",CANCELLED:"cancelled",POSTPONED:"postponed",UNKNOWN:"not_started",ABANDONED:"abandoned"}[e.type]??"not_started",{code:o,name:e.name,shortName:e.short_name,type:e.type}}function T(e){return{id:e.id,name:e.name,shortName:e.short_name??void 0,threeLetterCode:e.three_letter_code,slug:e.slug,type:e.type==="national"?"national":"club",gender:e.gender,assets:e.assets?{logo:e.assets.logo?.url,homeKit:e.assets.home_kit?.url,awayKit:e.assets.away_kit?.url,squadImage:e.assets.squad_image?.url}:void 0,metadata:e.shirt_color?{shirtColors:[{type:"home",colorCode:e.shirt_color}]}:void 0,providerRef:i(e.uuid)}}function Y(e){return{kickoffTime:new Date(e.kickoff_time),currentMinute:e.minute?.regular_time,phaseStartedAt:e.phase_started_at?new Date(e.phase_started_at):void 0,finishedAt:e.finished_at?new Date(e.finished_at):void 0,firstHalfStartedAt:e.first_half_started_at?new Date(e.first_half_started_at):void 0,secondHalfStartedAt:e.second_half_started_at?new Date(e.second_half_started_at):void 0,extraTimeFirstHalfStartedAt:e.extra_time_first_half_started_at?new Date(e.extra_time_first_half_started_at):void 0,extraTimeSecondHalfStartedAt:e.extra_time_second_half_started_at?new Date(e.extra_time_second_half_started_at):void 0}}function U(e){if(!e)return;const t=n=>n?{competitorOne:String(n.home),competitorTwo:String(n.away)}:void 0,o=e.after_extra_time??e.regular_time;return{competitorOne:o?.home!=null?String(o.home):null,competitorTwo:o?.away!=null?String(o.away):null,breakdown:{total:t(e.total),halfTime:t(e.half_time),regularTime:t(e.regular_time),extraTime:t(e.extra_time),penaltyShootout:t(e.penalty_shootout),aggregate:t(e.aggregate)}}}function G(e){if(e)return{id:e.id,name:e.name,slug:e.slug,assets:e.assets?.image?.url?{image:e.assets.image.url}:void 0,providerRef:i(e.uuid)}}function W(e){if(e?.length)return e.map(t=>({id:t.id,name:t.name,slug:t.slug,role:t.role??"REFEREE",gender:t.gender}))}function K(e){if(!e.season?.tournament)return;const{tournament:t,...o}=e.season;return{id:t.id,name:t.name,slug:t.slug,type:t.type,region:t.region,country:t.country?{id:t.country.id,name:t.country.name,code:t.country.code??void 0,flag:t.country.assets?.flag?.url,providerRef:i(t.country.uuid)}:void 0,season:{id:o.id,name:o.name,status:o.status},stage:e.stage?{id:e.stage.id,name:e.stage.name,type:e.stage.type}:void 0,assets:t.assets?.logo?.url?{logo:t.assets.logo.url}:void 0,providerRef:i(t.uuid)}}function V(e){if(!e.winner?.match?.id)return;const t={"Regular Time":"REGULAR_TIME","Extra Time":"EXTRA_TIME",Penalties:"PENALTIES"};return{competitorId:e.winner.match.id,reason:e.winner.match.reason?.name?t[e.winner.match.reason.name]:void 0,aggregate:!!e.winner.aggregate}}function O(e){return{id:e.id,slug:e.slug,status:$(e.status),timing:Y(e),competitorOne:T(e.home_team),competitorTwo:T(e.away_team),competition:K(e),round:e.round?{id:e.round.id??e.round.key,key:e.round.key,name:e.round.name,type:e.round.type??"REGULAR",providerRef:i(e.round.uuid)}:void 0,group:e.group?{id:e.group.id,name:e.group.name,providerRef:i(e.group.uuid)}:void 0,venue:G(e.venue),officials:W(e.referees),spectators:e.spectators??void 0,score:U(e.score),mainEvents:e.main_events?.map(_).filter(t=>t!==null),penaltyShootoutEvents:e.penalty_shootout_events?.map(_).filter(t=>t!==null),winner:V(e),coverage:e.coverage==="NOT_LIVE"?"UNKNOWN":e.coverage,lineupStatus:e.lineup_status==="UNCONFIRMED"?"EXPECTED":e.lineup_status,providerRef:i(e.uuid)}}function j(e){const t=e.player;return{id:t.id,name:t.name,slug:t.slug,position:t.position,shirtNumber:e.shirt_number,positionX:e.position_x??void 0,positionY:e.position_y??void 0,country:t.country?{id:t.country.id,name:t.country.name,code:t.country.code,providerRef:i(t.country.uuid)}:void 0,birthdate:t.birthdate,profile:t.profile?{height:t.profile.height,weight:t.profile.weight}:void 0,assets:t.assets?{photo:t.assets.thumb?.url,photoTransparent:t.assets.thumb_transparent_background?.url}:void 0,events:e.events?.map(_).filter(o=>o!==null),providerRef:i(t.uuid)}}function b(e){const t=[],o=[];for(const n of e.players){const a=j(n);n.type.category==="start"?t.push(a):n.type.category==="sub"&&o.push(a)}return{competitorId:e.team_id,formation:e.formation,coach:e.coach?{id:e.coach.id,name:e.coach.name,slug:e.coach.slug,country:e.coach.country?{id:e.coach.country.id,name:e.coach.country.name,code:e.coach.country.code,providerRef:i(e.coach.country.uuid)}:void 0,birthdate:e.coach.birthdate,providerRef:i(e.coach.uuid)}:void 0,starters:t,substitutes:o}}function B(e){return{matchId:e.match_id,confirmed:e.status==="CONFIRMED",competitorOne:b(e.home_team),competitorTwo:b(e.away_team)}}function g(e,t,o,n){return t==null?null:{key:e,value:String(t),label:o,unit:n}}function A(e,t){const o=(t.shots_on??0)+(t.shots_off??0)+(t.shots_blocked??0),n=[g("possession",t.possession,"Possession","%"),g("shots_total",o,"Shots"),g("shots_on_target",t.shots_on,"Shots on Target"),g("shots_off_target",t.shots_off,"Shots off Target"),g("shots_blocked",t.shots_blocked,"Shots Blocked"),g("corners",t.corners,"Corner Kicks"),g("goal_kicks",t.goal_kicks,"Goal Kicks"),g("throw_ins",t.throw_in,"Throw Ins"),g("offsides",t.offside,"Offsides"),g("fouls",t.fouls_committed,"Fouls"),g("yellow_cards",t.yellow_cards,"Yellow Cards"),g("passes",t.pass,"Passes"),g("crosses",t.crosses,"Crosses")];return{competitorId:e,statistics:n.filter(a=>a!==null)}}function q(e){const t=e.find(n=>n.home_team),o=e.find(n=>!n.home_team);if(!t||!o)throw new Error("Missing competitor statistics");return{competitorOne:A(String(t.team.id),t.statistics),competitorTwo:A(String(o.team.id),o.statistics)}}function X(e){const t=e.urls?.find(o=>o.app_type==="desktop")?.url;return{id:e.id,name:e.name,code:e.code,value:e.value??void 0,odds:e.odds,oddsOld:e.odds_old,movement:e.movement==="STABLE"?"NONE":e.movement,url:t}}function z(e){return{type:{id:e.type.id,code:e.type.code,name:e.type.name},period:{id:e.scope.id,type:e.scope.type,name:e.scope.name},selections:e.selections.map(X)}}function J(e){if(!e)return!0;const t=e.replace("#",""),o=parseInt(t.substring(0,2),16),n=parseInt(t.substring(2,4),16),a=parseInt(t.substring(4,6),16);return(.2126*o+.7152*n+.0722*a)/255<.5}function Q(e){const t=e.bookmaker.assets?.[0],o=e.bookmaker.branding||t,n=e.bookmaker.branding?.background_color||t?.background_color,a=e.bookmaker.branding?.text_color||(J(n)?"#FFFFFF":"#000000");return{operator:{id:e.bookmaker.id,name:e.bookmaker.name,url:e.bookmaker.url,branding:o?{backgroundColor:n,textColor:a,logo:t?.logo}:void 0},type:e.type,markets:e.markets.map(z)}}function Z(e,t){return{matchId:e,operators:t.map(Q)}}function I(e){if(e==null||e==="")return;const t=typeof e=="number"?e:parseInt(e,10);return isNaN(t)?void 0:t}function w(e){return{externalId:e.external_id,minute:I(e.elapsed),addedTime:I(e.elapsed_plus),text:e.auto_text,details:e.details,meta:{type:e.type,commentaryType:e.commentary_type,subtype1:e.subtype_1,subtype2:e.subtype_2,timestamp:e.incident_timestamp}}}async function ee(e,t,o){const n=o||c(),{sportal365Sports:a}=n,s=await l.get({path:`/v2/matches/${e}`,params:{language_code:t?.languageCode??a?.languageCode??"en",odd_client:t?.oddClient,odd_type:t?.oddType,scope_type:t?.scopeType,odd_format:t?.oddFormat,market_types:t?.marketTypes,bookmaker_ids:t?.bookmakerIds,optional_data:t?.optionalData},headers:{"Accept-Language":t?.languageCode??a?.languageCode??"en"},next:t?.next,config:n});return O(s)}async function te(e,t,o){const n=o||c(),{sportal365Sports:a}=n;return(await l.get({path:`/v2/matches/${e}/events`,params:{language_code:t?.languageCode??a?.languageCode??"en"},headers:{"Accept-Language":t?.languageCode??a?.languageCode??"en"},next:t?.next,config:n})).events.map(_).filter(d=>d!==null)}async function oe(e,t,o){const n=o||c(),{sportal365Sports:a}=n,s=await l.get({path:`/v2/matches/${e}/lineups`,params:{language_code:t?.languageCode??a?.languageCode??"en"},headers:{"Accept-Language":t?.languageCode??a?.languageCode??"en"},next:t?.next,config:n});return B(s)}async function ne(e,t,o){const n=o||c(),{sportal365Sports:a}=n,s=await l.get({path:`/v2/matches/${e}`,params:{language_code:t?.languageCode??a?.languageCode??"en",odd_client:t?.oddClient??a?.oddClient,odd_type:t?.oddType,scope_type:t?.scopeType??"ALL",odd_format:t?.oddFormat??"DECIMAL",market_types:t?.marketTypes,bookmaker_ids:t?.bookmakerIds},headers:{"Accept-Language":t?.languageCode??a?.languageCode??"en"},next:t?.next,config:n});return Z(e,s.odds??[])}async function ae(e,t,o){const n=o||c(),{sportal365Sports:a}=n,s=await l.get({path:`/events/${e}/teamstats`,params:{language_code:t?.languageCode??a?.languageCode??"en"},headers:{"Accept-Language":t?.languageCode??a?.languageCode??"en"},next:t?.next,config:n});return q(s)}async function se(e,t,o){const n=o||c(),{sportal365Sports:a}=n;return(await l.get({path:`/matches/${e}/commentary`,params:{language_code:t?.languageCode??a?.languageCode??"en"},headers:{"Accept-Language":t?.languageCode??a?.languageCode??"en"},next:t?.next,config:n})).map(w)}async function ie(e,t){const o=t||c(),{sportal365Sports:n}=o;return(await l.get({path:"/v2/matches",params:{language_code:e.languageCode??n?.languageCode??"en",limit:e.limit.toString(),offset:e.offset.toString(),tournament_ids:e.tournamentIds,season_ids:e.seasonIds,stage_ids:e.stageIds,group_ids:e.groupIds,round_ids:e.roundIds,round_filter:e.roundFilter,from_kickoff_time:e.fromKickoffTime,to_kickoff_time:e.toKickoffTime,team_ids:e.teamIds,team_ids_operator:e.teamIdsOperator,referee_id:e.refereeId,venue_id:e.venueId,player_id:e.playerId,status_types:e.statusTypes,status_codes:e.statusCodes,odd_client:e.oddClient??n?.oddClient,odd_type:e.oddType,scope_type:e.scopeType,odd_format:e.oddFormat,market_types:e.marketTypes,bookmaker_ids:e.bookmakerIds,sort_direction:e.sortDirection,optional_data:e.optionalData},headers:{"Accept-Language":e.languageCode??n?.languageCode??"en"},next:e.next,config:o})).matches.map(O)}function re(e){return{id:e.id,name:e.name,shortName:e.short_name??void 0,threeLetterCode:e.three_letter_code,slug:e.slug,type:e.type==="placeholder"||e.type==="club"?"club":"national",gender:e.gender,country:e.country?{id:e.country.id,name:e.country.name,code:e.country.code??void 0,flag:e.country.assets?.flag?.url,providerRef:i(e.country.uuid)}:void 0,venue:e.venue?{id:e.venue.id,name:e.venue.name,slug:e.venue.slug,city:e.venue.city?{id:e.venue.city.id,name:e.venue.city.name,country:e.venue.city.country?{id:e.venue.city.country.id,name:e.venue.city.country.name,code:e.venue.city.country.code??void 0,flag:e.venue.city.country.assets?.flag?.url,providerRef:i(e.venue.city.country.uuid)}:void 0,providerRef:i(e.venue.city.uuid??void 0)}:void 0,country:e.venue.country?{id:e.venue.country.id,name:e.venue.country.name,code:e.venue.country.code??void 0,flag:e.venue.country.assets?.flag?.url,providerRef:i(e.venue.country.uuid)}:void 0,profile:e.venue.profile?{latitude:e.venue.profile.lat,longitude:e.venue.profile.lng,capacity:e.venue.profile.capacity}:void 0,assets:e.venue.assets?.image?.url?{image:e.venue.assets.image.url}:void 0,providerRef:i(e.venue.uuid)}:void 0,coach:e.coach?{id:e.coach.id,name:e.coach.name,slug:e.coach.slug,country:{id:e.coach.country.id,name:e.coach.country.name,code:e.coach.country.code??void 0,flag:e.coach.country.assets?.flag?.url,providerRef:i(e.coach.country.uuid)},birthdate:e.coach.birthdate,providerRef:i(e.coach.uuid)}:void 0,founded:e.founded,assets:e.assets?{logo:e.assets.logo?.url,homeKit:e.assets.home_kit?.url,awayKit:e.assets.away_kit?.url,squadImage:e.assets.squad_image?.url}:void 0,metadata:{shirtColors:e.shirt_colors?.map(t=>({type:t.type,colorCode:t.color_code})),socials:e.social?{website:e.social.web,x:e.social.twitter_id,facebook:e.social.facebook_id,instagram:e.social.instagram_id,wikipedia:e.social.wikipedia_id}:void 0},activeSeasons:e.active_seasons?.map(t=>({id:t.id,name:t.name,slug:t.slug,active:t.status==="ACTIVE",providerRef:i(t.uuid)})),currentSeason:e.current_season?{id:e.current_season.id,name:e.current_season.name,slug:e.current_season.slug,active:e.current_season.status==="ACTIVE",providerRef:i(e.current_season.uuid)}:void 0,form:e.form&&e.form.length>0?{competitorId:e.id,results:e.form.map(t=>{const n=t.participants[0].id===e.uuid?t.participants[1]:t.participants[0],a=t.result[0]?.results.find(u=>u.position==="1")?.value,s=t.result[0]?.results.find(u=>u.position==="2")?.value,d=t.outcome==="win"?"W":t.outcome==="draw"?"D":"L";return{matchId:t.id,result:d,score:a&&s?`${a}-${s}`:void 0,opponent:{id:n.id,name:n.name,logo:n.display_asset?.url},date:new Date(t.start_time),competition:t.competition?{id:t.competition.id,name:t.competition.name}:void 0}}),formString:e.form.map(t=>t.outcome==="win"?"W":t.outcome==="draw"?"D":"L").join("")}:void 0,providerRef:i(e.uuid)}}function de(e){const t=e.player;return{id:t.id,name:t.name,slug:t.slug,position:t.position,shirtNumber:e.shirt_number,country:t.country?{id:t.country.id,name:t.country.name,code:t.country.code??void 0,flag:t.country.assets?.flag?.url,providerRef:i(t.country.uuid)}:void 0,gender:t.gender,birthdate:t.birthdate,profile:{height:t.profile?.height??void 0,weight:t.profile?.weight??void 0},assets:t.assets?{photo:t.assets.thumb?.url,photoTransparent:t.assets.thumb_transparent_background?.url}:void 0,status:e.status,contractType:e.contract_type,contractUntil:e.contract_until??void 0,joinedDate:e.start_date??void 0,providerRef:i(t.id)}}function ue(e){return{id:e.id,name:e.name,slug:e.slug,country:e.country?{id:e.country.id,name:e.country.name,code:e.country.code??void 0,flag:e.country.assets?.flag?.url,providerRef:i(e.country.uuid)}:void 0,birthdate:e.birthdate,providerRef:i(e.uuid)}}function ce(e){return{teamId:e.team.id,teamName:e.team.name,coach:e.coach?ue(e.coach):void 0,players:e.players.map(de)}}function le(e){const t=parseInt(e,10);return isNaN(t)?void 0:t}function r(e,t){const o=e.find(n=>n.name===t);return o?le(o.value):void 0}function ge(e,t){const o=e.statistics;return{playerId:e.player.id,seasonId:e.season.id,teamId:t,appearances:r(o,"played"),started:r(o,"started"),substituteIn:r(o,"substitute_in"),substituteOut:r(o,"substitute_out"),minutes:r(o,"minutes"),minutesSubstitute:r(o,"minutes_substitute"),goals:r(o,"goals"),goalsSubstitute:r(o,"goals_substitute"),penaltyGoals:r(o,"penalty_goals"),ownGoals:r(o,"own_goals"),assists:r(o,"assists"),shots:r(o,"shots"),shotsOnTarget:r(o,"shots_on_target"),yellowCards:r(o,"yellow_cards"),redCards:r(o,"red_cards"),foulsCommitted:r(o,"fouls_committed"),penaltiesCommitted:r(o,"penalties_committed"),penaltiesMissed:r(o,"penalties_missed"),cleansheets:r(o,"cleansheets"),saves:r(o,"saves"),conceded:r(o,"conceded"),caughtBall:r(o,"caught_ball"),penaltiesReceived:r(o,"penalties_received"),offsides:r(o,"offsides"),rawStatistics:o.map(n=>({name:n.name,value:n.value}))}}async function L(e,t){const o=t||c(),{sportal365Sports:n}=o,{seasonIds:a,teamId:s,languageCode:d,next:u}=e,m=u??{revalidate:120},p={season_ids:a.join(","),team_id:s,language_code:d??n?.languageCode??"en"},f=await l.get({path:"/v2/statistics/players/season",params:p,headers:{"Accept-Language":d??n?.languageCode??"en"},next:m,config:o}),v={};for(const C of f.statistics){const k=C.player.id;v[k]=ge(C,s)}return v}async function me(e,t,o){const n=o||c(),{sportal365Sports:a}=n,s=await l.get({path:`/v2/teams/${e}`,params:{language_code:t?.languageCode??a?.languageCode??"en",optional_data:"form"},headers:{"Accept-Language":t?.languageCode??a?.languageCode??"en"},next:t?.next,config:n});return re(s)}async function pe(e,t,o){const n=o||c(),{sportal365Sports:a}=n,s=await l.get({path:`/v2/teams/${e}/squad`,params:{language_code:t?.languageCode??a?.languageCode??"en",memberStatus:t?.memberStatus??"ACTIVE"},headers:{"Accept-Language":t?.languageCode??a?.languageCode??"en"},next:t?.next,config:n}),d=ce(s);if(t?.seasonIds&&t.seasonIds.length>0)try{const u=await L({seasonIds:t.seasonIds,teamId:e,languageCode:t.languageCode,next:t.next},n);for(const m of d.players){const p=u[m.id];p&&(m.seasonStatistics=p)}}catch{}return d}function fe(e){return{id:String(e.id),name:e.name,slug:e.slug,type:e.type,region:e.region,gender:e.gender,country:{id:String(e.country.id),name:e.country.name,flag:e.country.url_flag,providerRef:i(e.country.uuid)},seasons:e.seasons.map(t=>({id:String(t.id),name:t.name,slug:t.slug,active:t.active,providerRef:i(t.uuid)})),assets:e.url_logo?{logo:e.url_logo}:void 0,providerRef:i(e.uuid)}}function _e(e){const t=e.rounds.map(o=>({id:o.id,name:o.name,key:o.key,type:o.type,status:o.status,startDate:o.start_date,endDate:o.end_date,providerRef:i(o.uuid)}));return{id:e.stage.id,name:e.stage.name,slug:e.stage.slug,shortName:e.stage.short_name??void 0,type:e.stage.type,status:e.stage.status,coverage:e.stage.coverage,order:e.stage.order_in_season,startDate:e.stage.start_date,endDate:e.stage.end_date,rounds:t,providerRef:i(e.stage.uuid)}}function ye(e){const{season:t,stages:o}=e,{tournament:n}=t,a={id:n.id,name:n.name,slug:n.slug,type:n.type,region:n.region,gender:n.gender,country:{id:n.country.id,name:n.country.name,code:n.country.code??void 0,flag:n.country.assets?.flag?.url,providerRef:i(n.country.uuid)},assets:n.assets?.logo?.url?{logo:n.assets.logo.url}:void 0,providerRef:i(n.uuid)};return{id:t.id,name:t.name,slug:t.slug,active:t.status==="ACTIVE",status:t.status==="ACTIVE"?"ACTIVE":"INACTIVE",competition:a,stages:o.map(_e),providerRef:i(t.uuid)}}async function he(e,t,o){const n=o||c(),{sportal365Sports:a}=n,s=await l.get({path:`/tournaments/${e}`,params:{language_code:t?.languageCode??a?.languageCode??"en"},headers:{"Accept-Language":t?.languageCode??a?.languageCode??"en"},next:t?.next,config:n});return fe(s)}async function ve(e,t){const o=t||c(),{sportal365Sports:n}=o;if(!e?.seasonId&&!e?.competitionId)throw new Error("Either seasonId or competitionId must be provided");const a={language_code:e?.languageCode??n?.languageCode??"en"};e.seasonId?a.season_id=e.seasonId:e.competitionId&&(a.tournament_id=e.competitionId,e.status&&(a.status=e.status));const s=await l.get({path:"/v2/seasons/details",params:a,headers:{"Accept-Language":e?.languageCode??n?.languageCode??"en"},next:e?.next,config:o});return ye(s)}function h(e){return{championsleague:"championsLeague",europaleague:"europaLeague",conferenceleague:"conferenceLeague",relegation:"relegation",playoff:"playoff",promotion:"promotion"}[e.toLowerCase()]??e.toLowerCase().replace(/_/g,"")}function Ce(e){const t=e.toLowerCase();return t==="relegation"?"BOTTOM":t==="playoff"?"MIDDLE":"TOP"}function Se(e,t){if(!t||t.length===0)return;const o=t.map(a=>{const s=a.event,d=s.home_team.id===e,u=d?s.away_team:s.home_team,m=`${s.goal_home}-${s.goal_away}`;return{matchId:s.id.toString(),result:a.outcome,score:m,homeAway:d?"HOME":"AWAY",opponent:{id:u.id.toString(),name:u.name,logo:u.url_logo},date:new Date(s.start_time),competition:void 0}}),n=o.map(a=>a.result).join("");return{competitorId:e.toString(),results:o,formString:n}}function Te(e){return{key:h(e.code),name:e.name,position:Ce(e.type)}}function be(e){const t={played:e.played,won:e.wins,drawn:e.draws,lost:e.defeits,goalsFor:e.goals_for,goalsAgainst:e.goals_against,goalDifference:e.goals_for-e.goals_against,points:e.points},o=e.rules?.length>0?e.rules.map(a=>h(a.code)):void 0,n=Se(e.team.id,e.team.form??[]);return{rank:e.rank,competitor:{id:e.team.id.toString(),name:e.team.name,shortName:e.team.short_name??void 0,logo:e.team.url_logo},stats:t,form:n,rules:o}}function Ae(e){const t=e.map(be),o=new Map;for(const n of e)if(n.rules)for(const a of n.rules){const s=h(a.code);o.has(s)||o.set(s,Te(a))}return{entries:t,metadata:{legend:Array.from(o.values())}}}async function Ie(e,t){const o=t||c(),{sportal365Sports:n}=o,a=e.expand?.join(","),s=await l.get({path:`/tournaments/seasons/stages/${e.stageId}/standing`,params:{expand:a,language_code:e.languageCode??n?.languageCode??"en"},headers:{"Accept-Language":e.languageCode??n?.languageCode??"en"},next:e.next,config:o});return!s||s.length===0?{entries:[],metadata:{legend:[]}}:Ae(s)}exports.SPORTAL365_SPORTS_SEARCH_DOMAIN=x;exports.SPORTAL365_STATISTICS_DOMAIN=F;exports.addProviderRef=H;exports.createHttpClient=E;exports.footballHttp=l;exports.getConfig=c;exports.getFootballCompetition=he;exports.getFootballMatch=ee;exports.getFootballMatchCommentary=se;exports.getFootballMatchEvents=te;exports.getFootballMatchLineups=oe;exports.getFootballMatchOdds=ne;exports.getFootballMatchStatistics=ae;exports.getFootballMatches=ie;exports.getFootballPlayerSeasonStatistics=L;exports.getFootballSeasonDetails=ve;exports.getFootballStandings=Ie;exports.getFootballTeam=me;exports.getFootballTeamSquad=pe;exports.getProviderRefId=M;exports.isConfigured=D;exports.setConfig=R;exports.toProviderRefArray=i;